mirror of
https://github.com/alicealys/t5-gsc-utils.git
synced 2025-04-19 20:42:54 +00:00
Some changes
This commit is contained in:
parent
a15cdd5949
commit
0df5ac4b60
@ -42,7 +42,7 @@ namespace exception
|
|||||||
|
|
||||||
utils::thread::suspend_other_threads();
|
utils::thread::suspend_other_threads();
|
||||||
show_mouse_cursor();
|
show_mouse_cursor();
|
||||||
MessageBoxA(nullptr, error_str.data(), "Plutonium T6 ERROR", MB_ICONERROR);
|
MessageBoxA(nullptr, error_str.data(), "Plutonium T5 ERROR", MB_ICONERROR);
|
||||||
TerminateProcess(GetCurrentProcess(), exception_data.code);
|
TerminateProcess(GetCurrentProcess(), exception_data.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace exception
|
|||||||
info.append("\r\n");
|
info.append("\r\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
line("Plutonium T6 Crash Dump");
|
line("Plutonium T5 Crash Dump");
|
||||||
line("");
|
line("");
|
||||||
line("Timestamp: "s + utils::string::get_timestamp());
|
line("Timestamp: "s + utils::string::get_timestamp());
|
||||||
line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode));
|
line(utils::string::va("Exception: 0x%08X", exceptioninfo->ExceptionRecord->ExceptionCode));
|
||||||
@ -93,13 +93,13 @@ namespace exception
|
|||||||
|
|
||||||
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||||
{
|
{
|
||||||
const std::string crash_name = utils::string::va("minidumps/plutonium-t6-crash-%s.zip",
|
const std::string crash_name = utils::string::va("minidumps/plutonium-t5-crash-%s.zip",
|
||||||
utils::string::get_timestamp().data());
|
utils::string::get_timestamp().data());
|
||||||
|
|
||||||
utils::compression::zip::archive zip_file{};
|
utils::compression::zip::archive zip_file{};
|
||||||
zip_file.add("crash.dmp", create_minidump(exceptioninfo));
|
zip_file.add("crash.dmp", create_minidump(exceptioninfo));
|
||||||
zip_file.add("info.txt", generate_crash_info(exceptioninfo));
|
zip_file.add("info.txt", generate_crash_info(exceptioninfo));
|
||||||
zip_file.write(crash_name, "Plutonium T6 Crash Dump");
|
zip_file.write(crash_name, "Plutonium T5 Crash Dump");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_harmless_error(const LPEXCEPTION_POINTERS exceptioninfo)
|
bool is_harmless_error(const LPEXCEPTION_POINTERS exceptioninfo)
|
||||||
@ -136,8 +136,10 @@ namespace exception
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
SetUnhandledExceptionFilter(exception_filter);
|
SetUnhandledExceptionFilter(exception_filter);
|
||||||
utils::hook::jump(reinterpret_cast<uintptr_t>(&SetUnhandledExceptionFilter), set_unhandled_exception_filter_stub);
|
utils::hook::jump(reinterpret_cast<uintptr_t>(&SetUnhandledExceptionFilter), set_unhandled_exception_filter_stub);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,10 @@ namespace gsc
|
|||||||
get_function_hook.create(SELECT_VALUE(0x0, 0x465E20), get_function_stub);
|
get_function_hook.create(SELECT_VALUE(0x0, 0x465E20), get_function_stub);
|
||||||
get_method_hook.create(SELECT_VALUE(0x0, 0x555580), get_method_stub);
|
get_method_hook.create(SELECT_VALUE(0x0, 0x555580), get_method_stub);
|
||||||
|
|
||||||
|
// \n******* script runtime error *******\n%s\n
|
||||||
|
utils::hook::set<char>(0xAABA68 + 40, '\n');
|
||||||
|
utils::hook::set<char>(0xAABA68 + 41, '\0');
|
||||||
|
|
||||||
function::add("print_", [](const scripting::variadic_args& va)
|
function::add("print_", [](const scripting::variadic_args& va)
|
||||||
{
|
{
|
||||||
for (const auto& arg : va)
|
for (const auto& arg : va)
|
||||||
|
@ -14,55 +14,10 @@
|
|||||||
|
|
||||||
namespace scripting
|
namespace scripting
|
||||||
{
|
{
|
||||||
std::unordered_map<int, std::unordered_map<std::string, int>> fields_table;
|
|
||||||
|
|
||||||
std::unordered_map<std::string, game::BuiltinMethodDef> method_map;
|
|
||||||
std::unordered_map<std::string, game::BuiltinFunctionDef> function_map;
|
|
||||||
|
|
||||||
std::unordered_map<std::string, std::unordered_map<std::string, const char*>> script_function_table;
|
|
||||||
std::unordered_map<std::string, std::vector<std::pair<std::string, const char*>>> script_function_table_sort;
|
|
||||||
std::unordered_map<const char*, std::pair<std::string, std::string>> script_function_table_rev;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
utils::hook::detour scr_add_class_field_hook;
|
|
||||||
utils::hook::detour g_shutdown_game_hook;
|
utils::hook::detour g_shutdown_game_hook;
|
||||||
|
|
||||||
void scr_add_class_field_stub(game::scriptInstance_t inst, unsigned int classnum, char const* name, unsigned int offset)
|
|
||||||
{
|
|
||||||
if (fields_table[classnum].find(name) == fields_table[classnum].end())
|
|
||||||
{
|
|
||||||
fields_table[classnum][name] = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
scr_add_class_field_hook.invoke<void>(inst, classnum, name, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
game::BuiltinMethodDef get_method(const std::string& name)
|
|
||||||
{
|
|
||||||
game::BuiltinMethodDef method{};
|
|
||||||
|
|
||||||
auto pName = name.data();
|
|
||||||
int arg = 0;
|
|
||||||
|
|
||||||
const auto func = game::Scr_GetMethod(&pName, &arg, &arg, &arg);
|
|
||||||
|
|
||||||
if (func)
|
|
||||||
{
|
|
||||||
method.actionFunc = reinterpret_cast<script_function>(func);
|
|
||||||
method.actionString = pName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
void load_functions()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
utils::hook::detour scr_load_script_hook;
|
|
||||||
|
|
||||||
std::vector<std::function<void()>> shutdown_callbacks;
|
std::vector<std::function<void()>> shutdown_callbacks;
|
||||||
void g_shutdown_game_stub(const int free_scripts)
|
void g_shutdown_game_stub(const int free_scripts)
|
||||||
{
|
{
|
||||||
@ -86,11 +41,6 @@ namespace scripting
|
|||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
//g_shutdown_game_hook.create(SELECT(0x60DCF0, 0x688A40), g_shutdown_game_stub);
|
//g_shutdown_game_hook.create(SELECT(0x60DCF0, 0x688A40), g_shutdown_game_stub);
|
||||||
|
|
||||||
//scr_add_class_field_hook.create(SELECT(0x6B7620, 0x438AD0), scr_add_class_field_stub);
|
|
||||||
//scr_post_load_scripts_hook.create(SELECT(0x642EB0, 0x425F80), post_load_scripts_stub);
|
|
||||||
|
|
||||||
//load_functions();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace game
|
|||||||
return utils::hook::invoke<unsigned int>(func, inst);
|
return utils::hook::invoke<unsigned int>(func, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableValue Scr_GetArrayIndexValue(scriptInstance_t inst, unsigned int name)
|
VariableValue Scr_GetArrayIndexValue(scriptInstance_t, unsigned int name)
|
||||||
{
|
{
|
||||||
VariableValue value{};
|
VariableValue value{};
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace game
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Scr_GetSelf(scriptInstance_t inst, unsigned int threadId)
|
unsigned int Scr_GetSelf(scriptInstance_t, unsigned int threadId)
|
||||||
{
|
{
|
||||||
return game::scr_VarGlob->variableList[threadId + 1].u.o.u.self;
|
return game::scr_VarGlob->variableList[threadId + 1].u.o.u.self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user