diff --git a/src/Components/Modules/ServerCommands.cpp b/src/Components/Modules/ServerCommands.cpp index a6d5c763..0361d660 100644 --- a/src/Components/Modules/ServerCommands.cpp +++ b/src/Components/Modules/ServerCommands.cpp @@ -63,12 +63,12 @@ namespace Components } } - void ServerCommands::OnServerCommandFailPrint(int type, const char *trash, ...) + void ServerCommands::OnServerCommandFailPrint(int type, const char *, ...) { Command::ClientParams params(*Game::cmd_id); const char *cmd = ""; - for (int i = 1; i < params.length(); i++) + for (std::size_t i = 1; i < params.length(); i++) cmd = Utils::String::VA("%s %s", cmd, params.get(i)); Game::Com_Printf(type, "Unknown client game command: %i %s\n", lastServerCommand, cmd); diff --git a/src/Components/Modules/Weapon.cpp b/src/Components/Modules/Weapon.cpp index 4c2ef802..ffb8bead 100644 --- a/src/Components/Modules/Weapon.cpp +++ b/src/Components/Modules/Weapon.cpp @@ -420,6 +420,22 @@ namespace Components Utils::Hook::Set(0x4F7630, 0x12DC + (sizeof(bg_sharedAmmoCaps) - (1200 * 4))); } + void* Weapon::LoadNoneWeaponHook() + { + // load anim scripts now, rather than a bit later on + ((void(*)())0x4E46A0)(); + Utils::Hook::Nop(0x4B3670, 5); + return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_WEAPON, "none").data; + } + + void __declspec(naked) Weapon::LoadNoneWeaponHookStub() + { + __asm + { + jmp LoadNoneWeaponHook + } + } + Weapon::Weapon() { Weapon::PatchLimit(); @@ -436,6 +452,8 @@ namespace Components // Skip double loading for fs_game Utils::Hook::Set(0x4081FD, 0xEB); + Utils::Hook(0x57B4F0, LoadNoneWeaponHookStub).install()->quick(); + // Don't load bounce sounds for now, it causes crashes // TODO: Actually check the weaponfiles and/or reset the soundtable correctly! //Utils::Hook::Nop(0x57A360, 5); diff --git a/src/Components/Modules/Weapon.hpp b/src/Components/Modules/Weapon.hpp index 1f785b35..3119c8c6 100644 --- a/src/Components/Modules/Weapon.hpp +++ b/src/Components/Modules/Weapon.hpp @@ -19,6 +19,8 @@ namespace Components private: static Game::XAssetHeader WeaponFileLoad(Game::XAssetType type, std::string filename); static void PatchLimit(); + static void* LoadNoneWeaponHook(); + static void LoadNoneWeaponHookStub(); static void PatchConfigStrings(); static const char* GetWeaponConfigString(int index);