Remove dependencies.

This commit is contained in:
momo5502 2016-10-31 12:58:42 +01:00
parent e44006a588
commit af3a777a11
7 changed files with 24 additions and 40 deletions

View File

@ -11,6 +11,16 @@ namespace Components
{
Utils::Hook Exception::SetFilterHook;
__declspec(noreturn) void Exception::ErrorLongJmp(jmp_buf _Buf, int _Value)
{
if (!*reinterpret_cast<DWORD*>(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;

View File

@ -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;
};

View File

@ -6,7 +6,7 @@ namespace Components
symmetric_CTR FastFiles::CurrentCTR;
std::vector<std::string> 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,

View File

@ -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<std::string> ZonePaths;
static const char* GetZoneLocation(const char* file);
static void LoadInitialZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);

View File

@ -6,6 +6,7 @@ namespace Components
std::vector<std::pair<std::string, std::string>> Maps::DependencyList;
std::vector<std::string> Maps::CurrentDependencies;
bool Maps::IsSPMap;
std::vector<Maps::DLC> Maps::DlcPacks;
std::vector<Game::XAssetEntry> Maps::EntryPool;
@ -13,6 +14,7 @@ namespace Components
{
if (!zoneInfo) return;
Maps::IsSPMap = false;
Maps::CurrentMainZone = zoneInfo->name;
Maps::CurrentDependencies.clear();
@ -138,19 +140,8 @@ 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)

View File

@ -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<std::string> maps;
};
static bool IsSPMap;
static std::vector<DLC> DlcPacks;
static std::vector<Game::XAssetEntry> EntryPool;

View File

@ -1344,6 +1344,8 @@ namespace Components
if (patch)
{
Maps::HandleAsSPMap();
Zones::LoadFxElemDefArrayHook.Install();
Zones::LoadFxElemDefHook.Install();