From 39110c9db7125252da802ec6a070d043248b6a65 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 19 Sep 2016 20:55:31 +0200 Subject: [PATCH] More cleanup --- src/Components/Modules/Logger.cpp | 6 +++++ src/Components/Modules/Maps.cpp | 14 +++++++++++- src/Components/Modules/Zones.cpp | 37 ++++++++++++++----------------- src/Utils/Memory.cpp | 1 - 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/Components/Modules/Logger.cpp b/src/Components/Modules/Logger.cpp index 98aa5e30..e030dd0c 100644 --- a/src/Components/Modules/Logger.cpp +++ b/src/Components/Modules/Logger.cpp @@ -300,5 +300,11 @@ namespace Components Logger::MessageMutex.lock(); Logger::MessageQueue.clear(); Logger::MessageMutex.unlock(); + + // Flush the console log + if (int fh = *reinterpret_cast(0x1AD8F28)) + { + Game::FS_FCloseFile(fh); + } } } diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 8ceb7174..3e8a7a9a 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -93,6 +93,15 @@ namespace Components } } + if (type == Game::XAssetType::ASSET_TYPE_STRINGTABLE) + { + if (FastFiles::Current() == "mp_cross_fire") + { + *restrict = true; + return; + } + } + if (type == Game::XAssetType::ASSET_TYPE_MAP_ENTS) { static std::string mapEntities; @@ -117,7 +126,7 @@ namespace Components format = "maps/%s.d3dbsp"; } - if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s) + if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s || mapname == "mp_cargoship"s || mapname == "mp_cross_fire"s) { // Adjust pointer to GameMap_Data Utils::Hook::Set(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data)); @@ -240,6 +249,9 @@ namespace Components Maps::AddDependency("co_hunted", "mp_storm"); Maps::AddDependency("mp_nuked", "iw4x_dependencies_mp"); Maps::AddDependency("mp_bloc", "iw4x_dependencies_mp"); + Maps::AddDependency("mp_bloc", "iw4x_dependencies_mp"); + Maps::AddDependency("mp_cargoship", "iw4x_dependencies_mp"); + Maps::AddDependency("mp_cross_fire", "iw4x_dependencies_mp"); Maps::AddDependency("^(?!mp_).*", "iw4x_dependencies_mp"); // All maps not starting with "mp_" } diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index 5162778f..ed8b7c50 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -100,7 +100,7 @@ namespace Components { // varXString = (varFxEffect + 256) //*(DWORD*)0x112B340 = (*(DWORD*)0x112B018) + 256; - DWORD thisFX = *(DWORD*)0x112B018; + //DWORD thisFX = *(DWORD*)0x112B018; /*if (*(char*)(thisFX + 176) == 0 || *(char*)(thisFX + 176) == 4) { @@ -354,7 +354,7 @@ namespace Components //#define Load_XStringPtr(x) Load_XStringPtr_(x); DBG(("wF: %s\n", **(DWORD**)varXString)) #define Load_XStringPtr Load_XStringPtr_ - void Load_WeaponDef_CodC(int doLoad) + void Load_WeaponDef_CodC(int /*doLoad*/) { // setup structures we use DWORD varWeaponDef = *(DWORD*)0x112A9F4;//*(DWORD*)0x112AE14; @@ -825,7 +825,7 @@ namespace Components for (int i = 0; i < count; i++) { - DWORD* varXString = (DWORD*)0x112B340; + //DWORD* varXString = (DWORD*)0x112B340; if (varStuff[1] < 16 || varStuff[1] == 39) { @@ -870,7 +870,7 @@ namespace Components AssetHandler::Relocate((DWORD)buffer + 172, 232, (DWORD)buffer + 168); } - void Load_WeaponAttach(int doLoad) + void Load_WeaponAttach(int /*doLoad*/) { // setup structures we use DWORD varWeaponAttach = *(DWORD*)0x112ADE0;//*(DWORD*)0x112AE14; @@ -894,7 +894,7 @@ namespace Components Utils::Hook gameWorldSpIntHook; - void GameWorldSpIntHookFunc(int doLoad) + void GameWorldSpIntHookFunc(int /*doLoad*/) { memset(*(void**)0x112AD7C, 0, 40); } @@ -980,17 +980,6 @@ namespace Components { ffVersion = fileVersion; - // patch the expected version - int version = (iw5) ? 316 : 276; - - if (iw5 && fileVersion >= 318) - { - version = fileVersion; - } - - *(DWORD*)0x4158F4 = version; - *(DWORD*)0x4158FB = version; - // physpreset size *(BYTE*)0x49CE0A = (iw5) ? 68 : 44; @@ -1087,10 +1076,18 @@ namespace Components void Zones::InstallPatches(int version) { - Zones::ZoneVersion = version; - AssetHandler::ClearRelocations(); - - PatchMW2_FifthInfinityApply(version, version >= 316); + Zones::ZoneVersion = version; +// AssetHandler::ClearRelocations(); +// +// if (Zones::ZoneVersion == VERSION_ALPHA2 || Zones::ZoneVersion == VERSION_ALPHA3 || Zones::ZoneVersion == XFILE_VERSION) +// { +// Utils::Hook::Set(0x4158F4, version); +// Utils::Hook::Set(0x4158FB, version); +// } +// +// PatchMW2_FifthInfinityApply(version, version >= 316); +// +// AntiCheat::EmptyHash(); } Zones::Zones() diff --git a/src/Utils/Memory.cpp b/src/Utils/Memory.cpp index dcf486b9..7e56bd80 100644 --- a/src/Utils/Memory.cpp +++ b/src/Utils/Memory.cpp @@ -27,7 +27,6 @@ namespace Utils { if (data) { - OutputDebugStringA(Utils::String::VA("Free: %X\n", (DWORD)data)); free(data); } }