Cleaning stuff

This commit is contained in:
Pavel Shevaev 2022-05-24 17:26:41 +03:00
parent 0892b08d81
commit 291e9622c4
1 changed files with 18 additions and 41 deletions

View File

@ -12,17 +12,6 @@ task('bhl_clean_cache', function()
bhl_clean_cache(); bhl_clean_cache();
}); });
function bhl_build_dll($mcs_bin)
{
global $GAME_ROOT;
$dll_file = get("UNITY_ASSETS_DIR")."/Plugins/game_bhl.dll";
bhl_shell_ensure("build_back_dll $mcs_bin $dll_file " . (is_dev() ? '-debug' : ''));
return $dll_file;
}
task('bhl_try', function($args = []) task('bhl_try', function($args = [])
{ {
global $GAME_ROOT; global $GAME_ROOT;
@ -92,6 +81,20 @@ task('bhl_callstack_file', function(array $args)
run('bhl_callstack', [$callstack]); run('bhl_callstack', [$callstack]);
}); });
task('bhl_find_module', function(array $args)
{
if(count($args) < 1)
{
echo "Usage: ./gamectl bhl_find_module <mod_id>";
return;
}
$mod_id = (int)$args[0];
$bhl_file = bhl_find_module($mod_id);
if($bhl_file)
echo "Found '$bhl_file'\n";
});
function bhl_find_name_hash($hash) function bhl_find_name_hash($hash)
{ {
global $GAME_ROOT; global $GAME_ROOT;
@ -121,20 +124,6 @@ function bhl_find_name_hash($hash)
return $result; return $result;
} }
task('bhl_find_module', function(array $args)
{
if(count($args) < 1)
{
echo "Usage: ./gamectl bhl_find_module <mod_id>";
return;
}
$mod_id = (int)$args[0];
$bhl_file = bhl_find_module($mod_id);
if($bhl_file)
echo "Found '$bhl_file'\n";
});
function bhl_find_module($mod_id) function bhl_find_module($mod_id)
{ {
global $GAME_ROOT; global $GAME_ROOT;
@ -217,14 +206,14 @@ function bhl_run_ex($bhl_inc_dir, array $bhl_files, $result_file, $debug = true,
$err_file = "$GAME_ROOT/build/bhl.error"; $err_file = "$GAME_ROOT/build/bhl.error";
ensure_rm($err_file); ensure_rm($err_file);
$user_sources = array( $user_sources = getor("BHL_USER_SOURCES", array(
get("UNITY_ASSETS_DIR")."/Scripts/bhl/register.cs", get("UNITY_ASSETS_DIR")."/Scripts/bhl/register.cs",
get("UNITY_ASSETS_DIR")."/Scripts/bhl/autobind.cs" get("UNITY_ASSETS_DIR")."/Scripts/bhl/autobind.cs"
); ));
$postproc_sources = array( $postproc_sources = getor("BHL_POSTPROC_SOURCES", array(
get("UNITY_ASSETS_DIR")."/Scripts/bhl/postproc.cs", get("UNITY_ASSETS_DIR")."/Scripts/bhl/postproc.cs",
); ));
$bhl_deps = $bhl_files; $bhl_deps = $bhl_files;
$bhl_deps = array_merge($bhl_deps, $user_sources); $bhl_deps = array_merge($bhl_deps, $user_sources);
@ -386,18 +375,6 @@ function bhl_show_position($line, $row, array $lines)
return "???"; return "???";
} }
function bhl_get_past_input($c, $in, $context_chars)
{
$past = substr($in, 0, $c+1);
return (strlen($past) > $context_chars ? '...' : '') . substr($past, -$context_chars);
}
function bhl_get_upcoming_input($c, $in, $context_chars)
{
$next = substr($in, $c+1);
return substr($next, 0, $context_chars) . (strlen($next) > $context_chars ? '...' : '');
}
function bhl_line_row_to_pos($file, $line, $row) function bhl_line_row_to_pos($file, $line, $row)
{ {
$pos = 0; $pos = 0;