Fix script patches crashing game on unload (#590)

This commit is contained in:
maybegreat48
2022-11-12 21:02:50 +00:00
committed by GitHub
parent ade733e4a0
commit ddc70a76e0
8 changed files with 26 additions and 8 deletions

View File

@ -51,6 +51,16 @@ namespace big
p.update(data);
}
script_patcher_service::script_patcher_service()
{
g_script_patcher_service = this;
}
script_patcher_service::~script_patcher_service()
{
g_script_patcher_service = nullptr;
}
void script_patcher_service::add_patch(script_patch&& patch)
{
m_script_patches.push_back(std::move(patch));

View File

@ -16,11 +16,14 @@ namespace big
void update_all_patches_for_script(rage::joaat_t script);
public:
script_patcher_service();
~script_patcher_service();
void add_patch(script_patch&& patch);
void on_script_load(rage::scrProgram* program);
std::uint8_t** get_script_bytecode(rage::joaat_t script);
void update();
};
inline script_patcher_service g_script_patcher_service;
inline script_patcher_service* g_script_patcher_service;
}