Actually fix checkpoint loading
This commit is contained in:
parent
1e27c6cbc3
commit
5f17804280
@ -97,6 +97,17 @@ namespace scripting
|
||||
script_function_table[current_file][function_name] = codePos;
|
||||
scr_set_thread_position_hook.invoke<void>(threadName, codePos);
|
||||
}
|
||||
|
||||
utils::hook::detour sub_6B2940_hook;
|
||||
char sub_6B2940_stub(void* a1)
|
||||
{
|
||||
const auto result = sub_6B2940_hook.invoke<char>(a1);
|
||||
if (a1 != nullptr)
|
||||
{
|
||||
lua::engine::start();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -113,6 +124,11 @@ namespace scripting
|
||||
scr_set_thread_position_hook.create(0x5BC7E0_b, scr_set_thread_position_stub);
|
||||
process_script_hook.create(0x5C6160_b, process_script_stub);
|
||||
|
||||
// Loading last checkpoint doesn't call spawn player again (player_spawn_hook)
|
||||
// Not sure what this function does but `a1` is != nullptr when loading
|
||||
// the last checkpoint so we need to start lua in this context
|
||||
sub_6B2940_hook.create(0x6B2940_b, sub_6B2940_stub);
|
||||
|
||||
scheduler::loop([]()
|
||||
{
|
||||
lua::engine::run_frame();
|
||||
|
Loading…
Reference in New Issue
Block a user