valid checksums + dedi support

This commit is contained in:
m 2023-05-11 00:47:35 -05:00
parent 32f8dbb9f1
commit 3907a76351
3 changed files with 24 additions and 17 deletions

View File

@ -15,8 +15,9 @@ namespace script
constexpr size_t GSC_MAGIC = 0x1C000A0D43534780;
utils::hook::detour db_findxassetheader_hook;
utils::hook::detour gscr_get_bgb_remaining_hook;
utils::hook::detour load_gametype_script_hook;
utils::hook::detour server_script_checksum_hook;
utils::hook::detour gscr_get_bgb_remaining_hook;
std::unordered_map<std::string, game::RawFile*> loaded_scripts;
@ -113,19 +114,12 @@ namespace script
auto* script = get_loaded_script(name);
if (script)
{
// TODO: don't check checksums for custom GSC, but only for stock scripts we override
//utils::hook::copy(const_cast<char*>(script->buffer + 0x8), asset_header->buffer + 0x8, 4);
return script;
}
return asset_header;
}
void gscr_get_bgb_remaining_stub(game::scriptInstance_t inst, void* entref)
{
game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 255);
}
void load_gametype_script_stub()
{
if (!game::Com_IsInGame() || game::Com_IsRunningUILevel())
@ -137,15 +131,33 @@ namespace script
load_gametype_script_hook.invoke<void>();
load_scripts();
}
int server_script_checksum_stub()
{
return 1;
}
void gscr_get_bgb_remaining_stub(game::scriptInstance_t inst, void* entref)
{
game::Scr_AddInt(game::SCRIPTINSTANCE_SERVER, 255);
}
}
struct component final : generic_component
{
void post_unpack() override
{
// Return custom or overrided scripts if found
db_findxassetheader_hook.create(game::select(0x141420ED0, 0x1401D5FB0), db_findxassetheader_stub);
// Load our scripts when the gametype script is loaded
load_gametype_script_hook.create(game::select(0x141AAD850, 0x1402D7140), load_gametype_script_stub);
// Force GSC checksums to be valid
utils::hook::call(game::select(0x1408F2E5D, 0x1400E2D22), server_script_checksum_stub);
// Workaround for "Out of X" gobblegum
gscr_get_bgb_remaining_hook.create(game::select(0x141A8CAB0, 0x1402D2310), gscr_get_bgb_remaining_stub);
load_gametype_script_hook.create(0x141AAD850_g, load_gametype_script_stub);
}
};
};

View File

@ -1814,9 +1814,7 @@ namespace game
PlayerSoundsTable* playerSounds;
PlayerFXTable* playerFX;
SharedWeaponSounds* sharedWeaponSounds;
*/
RawFile* rawfile;
/*
StringTable* stringTable;
StructuredTable* structuredTable;
LeaderboardDef* leaderboardDef;

View File

@ -34,8 +34,8 @@ namespace game
WEAK symbol<unsigned int(const char* settingName, bool getDefault)> Com_GametypeSettings_GetUInt{
0x1420F4E00, 0x1404FE5C0
};
WEAK symbol<bool()> Com_IsRunningUILevel{0x142148350};
WEAK symbol<bool()> Com_IsInGame{0x1421482C0};
WEAK symbol<bool()> Com_IsRunningUILevel{0x142148350, 0x14045C070};
WEAK symbol<bool()> Com_IsInGame{0x1421482C0, 0x140504B90};
WEAK symbol<void(int localClientNum, eModes fromMode, eModes toMode, uint32_t flags)> Com_SwitchMode{
0x14214A4D0
};
@ -81,9 +81,6 @@ namespace game
WEAK symbol<qboolean(void* ent)> StuckInClient{0x1415A8360, 0x14023BFE0};
// GScr
WEAK symbol<void()> GScr_LoadGametypeScript{0x14092F680, 0x0};
// Live
WEAK symbol<bool(uint64_t, int*, bool)> Live_GetConnectivityInformation{0x141E0C380};
@ -180,7 +177,7 @@ namespace game
0x0, 0x1402F5FF0
};
WEAK symbol<unsigned int(scriptInstance_t inst)> Scr_GetNumParam{0x0, 0x140171320};
WEAK symbol<unsigned int(scriptInstance_t inst, const char* filename)> Scr_LoadScript{0x1412C83F0};
WEAK symbol<unsigned int(scriptInstance_t inst, const char* filename)> Scr_LoadScript{0x1412C83F0, 0x140156610};
WEAK symbol<void(const char* name, const char* key, unsigned int playbackFlags, float volume, void* callbackInfo,
int id)> Cinematic_StartPlayback{0x1412BE3A0};