diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 1822e1d7..a69501c1 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -11,6 +11,16 @@ namespace Components { Utils::Hook Exception::SetFilterHook; + __declspec(noreturn) void Exception::ErrorLongJmp(jmp_buf _Buf, int _Value) + { + if (!*reinterpret_cast(0x1AD7EB4)) + { + TerminateProcess(GetCurrentProcess(), 1337); + } + + longjmp(_Buf, _Value); + } + LONG WINAPI Exception::ExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo) { // Pass on harmless errors @@ -85,6 +95,8 @@ namespace Components SetUnhandledExceptionFilter(&Exception::ExceptionFilter); #endif + //Utils::Hook(0x4B241F, Exception::ErrorLongJmp, HOOK_CALL).Install()->Quick(); + Command::Add("mapTest", [](Command::Params params) { std::string command; diff --git a/src/Components/Modules/Exception.hpp b/src/Components/Modules/Exception.hpp index 71c4d35e..a30b7e1e 100644 --- a/src/Components/Modules/Exception.hpp +++ b/src/Components/Modules/Exception.hpp @@ -16,6 +16,7 @@ namespace Components private: static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo); static LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilterStub(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); + static __declspec(noreturn) void ErrorLongJmp(jmp_buf _Buf, int _Value); static Utils::Hook SetFilterHook; }; diff --git a/src/Components/Modules/FastFiles.cpp b/src/Components/Modules/FastFiles.cpp index 5005908e..27755777 100644 --- a/src/Components/Modules/FastFiles.cpp +++ b/src/Components/Modules/FastFiles.cpp @@ -6,7 +6,7 @@ namespace Components symmetric_CTR FastFiles::CurrentCTR; std::vector FastFiles::ZonePaths; - unsigned char FastFiles::ZoneKey[] = + unsigned char FastFiles::ZoneKey[1191] = { 0x30,0x82,0x04,0xA3,0x02,0x01,0x00,0x02,0x82,0x01,0x01, 0x00,0xBD,0x7E,0xD6,0xE2,0xE9,0x1C,0xB1,0x08,0x68,0xA2, diff --git a/src/Components/Modules/FastFiles.hpp b/src/Components/Modules/FastFiles.hpp index 33a8e129..c1952f47 100644 --- a/src/Components/Modules/FastFiles.hpp +++ b/src/Components/Modules/FastFiles.hpp @@ -17,6 +17,8 @@ namespace Components static void LoadLocalizeZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); + static unsigned char ZoneKey[1191]; + private: union Key { @@ -31,7 +33,6 @@ namespace Components static Key CurrentKey; static symmetric_CTR CurrentCTR; - static unsigned char ZoneKey[]; static std::vector ZonePaths; static const char* GetZoneLocation(const char* file); static void LoadInitialZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index e8afa978..caaa4b7a 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -6,6 +6,7 @@ namespace Components std::vector> Maps::DependencyList; std::vector Maps::CurrentDependencies; + bool Maps::IsSPMap; std::vector Maps::DlcPacks; std::vector Maps::EntryPool; @@ -13,6 +14,7 @@ namespace Components { if (!zoneInfo) return; + Maps::IsSPMap = false; Maps::CurrentMainZone = zoneInfo->name; Maps::CurrentDependencies.clear(); @@ -137,20 +139,9 @@ namespace Components } Game::GameMap_Data** Maps::GetWorldData() - { - bool handleAsSp = false; - - for (auto dependency : Maps::DependencyList) - { - if (dependency.second == "iw4x_dependencies_mp" && std::regex_match(Maps::CurrentMainZone, std::regex(dependency.first))) - { - handleAsSp = true; - break; - } - } - + { Game::XAssetType type = Game::XAssetType::ASSET_TYPE_GAME_MAP_MP; - if (Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || handleAsSp) + if (Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::IsSPMap) { type = Game::XAssetType::ASSET_TYPE_GAME_MAP_SP; } @@ -499,31 +490,6 @@ namespace Components //Maps::AddDependency("gulag", "mp_subbase"); //Maps::AddDependency("invasion", "mp_rust"); Maps::AddDependency("co_hunted", "mp_storm"); - Maps::AddDependency("mp_nuked", "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_bog_sh", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_killhouse", "iw4x_dependencies_mp"); - - Maps::AddDependency("^(?!mp_).*", "iw4x_dependencies_mp"); // All maps not starting with "mp_" - - Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_ambush_sh", "iw4x_dependencies_mp"); - - Maps::AddDependency("mp_shipment", "mp_shipment_long"); - Maps::AddDependency("mp_shipment", "iw4x_dependencies_mp"); - - // Testing - Maps::AddDependency("mp_trainingground", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_shootingrange", "iw4x_dependencies_mp"); - Maps::AddDependency("mp_cqbtraining", "iw4x_dependencies_mp"); - Maps::AddDependency("zm_asylum_sh", "iw4x_dependencies_mp"); #if defined(DEBUG) && defined(ENABLE_DXSDK) Command::Add("dumpmap", [] (Command::Params) diff --git a/src/Components/Modules/Maps.hpp b/src/Components/Modules/Maps.hpp index e63bbf90..ae4153c5 100644 --- a/src/Components/Modules/Maps.hpp +++ b/src/Components/Modules/Maps.hpp @@ -10,6 +10,7 @@ namespace Components const char* GetName() { return "Maps"; }; #endif + static void HandleAsSPMap() { IsSPMap = true; } static void AddDependency(std::string expression, std::string zone); private: @@ -21,6 +22,7 @@ namespace Components std::vector maps; }; + static bool IsSPMap; static std::vector DlcPacks; static std::vector EntryPool; diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index d1b2f777..1d2457ec 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -1344,6 +1344,8 @@ namespace Components if (patch) { + Maps::HandleAsSPMap(); + Zones::LoadFxElemDefArrayHook.Install(); Zones::LoadFxElemDefHook.Install();