fix infinite loop

This commit is contained in:
m 2023-01-09 16:03:43 -06:00
parent 37edda91d9
commit 15fdb6340f
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include <utils/hook.hpp>
namespace patches
{
namespace
{
void scr_are_textures_loaded_stub([[maybe_unused]] game::scriptInstance_t inst)
{
game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 1);
}
}
struct component final : generic_component
{
void post_unpack() override
{
if (game::is_server())
{
// Fix infinite loop
utils::hook::jump(0x1402E86B0_g, scr_are_textures_loaded_stub);
}
}
};
}
REGISTER_COMPONENT(patches::component)

View File

@ -74,6 +74,7 @@ namespace game
};
// Scr
WEAK symbol<void(scriptInstance_t inst, int value)> Scr_AddInt{0x0, 0x14016F160};
WEAK symbol<void(scriptInstance_t inst, const char* value)> Scr_AddString{0x0, 0x14016F320};
WEAK symbol<const char* (scriptInstance_t inst, unsigned int index)> Scr_GetString{0x0, 0x140171490};
WEAK symbol<void(gentity_s* ent, ScrVarCanonicalName_t stringValue, unsigned int paramcount)> Scr_Notify_Canon{0x0, 0x1402F5FF0};