[Materials] Don't compare remapped techniques
This commit is contained in:
parent
df2dd13b1d
commit
144874d36b
@ -269,19 +269,17 @@ namespace Components
|
|||||||
|
|
||||||
Game::G_GlassData* Maps::GetWorldData()
|
Game::G_GlassData* Maps::GetWorldData()
|
||||||
{
|
{
|
||||||
Game::G_GlassData** dataPtr;
|
Logger::Print("Waiting for database...\n");
|
||||||
|
while (!Game::Sys_IsDatabaseReady()) std::this_thread::sleep_for(10ms);
|
||||||
|
|
||||||
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::SPMap)
|
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::SPMap)
|
||||||
{
|
{
|
||||||
dataPtr = &Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].data;
|
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP].gameWorldSp[0].data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dataPtr = &Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].data;
|
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP].gameWorldMp[0].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::Print("Waiting for database...\n");
|
|
||||||
while(!*dataPtr) std::this_thread::sleep_for(1ms);
|
|
||||||
return *dataPtr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(naked) void Maps::GetWorldDataStub()
|
__declspec(naked) void Maps::GetWorldDataStub()
|
||||||
@ -848,11 +846,6 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Maps::DatabaseAndTechsetsReady()
|
|
||||||
{
|
|
||||||
return (Game::Sys_IsDatabaseReady() && !*reinterpret_cast<bool*>(0x69F9AFD)); // Make sure techsets are not dirty
|
|
||||||
}
|
|
||||||
|
|
||||||
Maps::Maps()
|
Maps::Maps()
|
||||||
{
|
{
|
||||||
Dvar::OnInit([]()
|
Dvar::OnInit([]()
|
||||||
@ -936,9 +929,6 @@ namespace Components
|
|||||||
// Disable distortion on custom maps
|
// Disable distortion on custom maps
|
||||||
Utils::Hook(0x50AA47, Maps::SetDistortionStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x50AA47, Maps::SetDistortionStub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
// Only sort materials when techsets are clean
|
|
||||||
Utils::Hook(0x50AAE6, Maps::DatabaseAndTechsetsReady, HOOK_CALL).install()->quick();
|
|
||||||
|
|
||||||
// Intercept map loading for usermap initialization
|
// Intercept map loading for usermap initialization
|
||||||
Utils::Hook(0x6245E3, Maps::SpawnServerStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x6245E3, Maps::SpawnServerStub, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook(0x62493E, Maps::SpawnServerStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x62493E, Maps::SpawnServerStub, HOOK_CALL).install()->quick();
|
||||||
|
@ -123,8 +123,6 @@ namespace Components
|
|||||||
static Game::dvar_t* GetDistortionDvar();
|
static Game::dvar_t* GetDistortionDvar();
|
||||||
static void SetDistortionStub();
|
static void SetDistortionStub();
|
||||||
|
|
||||||
static int DatabaseAndTechsetsReady();
|
|
||||||
|
|
||||||
void reallocateEntryPool();
|
void reallocateEntryPool();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
std::mutex Materials::TechsetMutex;
|
||||||
int Materials::ImageNameLength;
|
int Materials::ImageNameLength;
|
||||||
Utils::Hook Materials::ImageVersionCheckHook;
|
Utils::Hook Materials::ImageVersionCheckHook;
|
||||||
|
|
||||||
@ -150,6 +151,22 @@ namespace Components
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void Materials::OverrideTechsets()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> _(Materials::TechsetMutex);
|
||||||
|
Utils::Hook::Call<void()>(0x522D00)(); // Material_OverrideTechniqueSets
|
||||||
|
}
|
||||||
|
|
||||||
|
void Materials::MaterialSort()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> _(Materials::TechsetMutex);
|
||||||
|
|
||||||
|
if (!*reinterpret_cast<bool*>(0x69F9AFD))
|
||||||
|
{
|
||||||
|
Utils::Hook::Call<void()>(0x523A20)(); // Material_Sort
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Materials::Materials()
|
Materials::Materials()
|
||||||
{
|
{
|
||||||
Materials::ImageNameLength = 7;
|
Materials::ImageNameLength = 7;
|
||||||
@ -172,6 +189,18 @@ namespace Components
|
|||||||
// Debug material comparison
|
// Debug material comparison
|
||||||
Utils::Hook::Set<void*>(0x523894, Materials::MaterialComparePrint);
|
Utils::Hook::Set<void*>(0x523894, Materials::MaterialComparePrint);
|
||||||
|
|
||||||
|
// Synchronize material sorting
|
||||||
|
Utils::Hook(0x50AAFE, Materials::MaterialSort, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
|
// Don't compare remapped techsets
|
||||||
|
Utils::Hook::Set<BYTE>(0x523490, 0xEB);
|
||||||
|
Utils::Hook::Set<BYTE>(0x5234A0, 0xEB);
|
||||||
|
|
||||||
|
// Synchronize techset remapping
|
||||||
|
Utils::Hook(0x50AAD8, Materials::OverrideTechsets, HOOK_CALL).install()->quick();
|
||||||
|
Utils::Hook(0x518BB8, Materials::OverrideTechsets, HOOK_CALL).install()->quick();
|
||||||
|
Utils::Hook(0x5BC791, Materials::OverrideTechsets, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (Flags::HasFlag("dump"))
|
if (Flags::HasFlag("dump"))
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ namespace Components
|
|||||||
static int FormatImagePath(char* buffer, size_t size, int, int, const char* image);
|
static int FormatImagePath(char* buffer, size_t size, int, int, const char* image);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static std::mutex TechsetMutex;
|
||||||
static int ImageNameLength;
|
static int ImageNameLength;
|
||||||
|
|
||||||
static Utils::Hook ImageVersionCheckHook;
|
static Utils::Hook ImageVersionCheckHook;
|
||||||
@ -33,5 +34,7 @@ namespace Components
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int MaterialComparePrint(Game::Material* m1, Game::Material* m2);
|
static int MaterialComparePrint(Game::Material* m1, Game::Material* m2);
|
||||||
|
static void OverrideTechsets();
|
||||||
|
static void MaterialSort();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user