[QuickPatch] add statebitsentry check code

This commit is contained in:
TheApadayo 2016-12-26 13:55:36 -05:00
parent 2c90324f25
commit 3e5829545a
2 changed files with 46 additions and 0 deletions

View File

@ -141,6 +141,45 @@ namespace Components
Game::CL_SelectStringTableEntryInDvar_f(); Game::CL_SelectStringTableEntryInDvar_f();
} }
void QuickPatch::CompareMaterialStateBits()
{
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_MATERIAL, [] (Game::XAssetHeader header, void* /*unused*/)
{
bool first = true;
Game::Material* material = header.material;
Logger::Print(6, "Checking material %s...", material->name);
#define COMPARE_TECHNIQUES(x) if(!(material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)] == material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)])) \
{ \
if(first) { Logger::Print("\nMismatch in material %s:\n", material->name); first = false; } \
Logger::Print(6, #x " != " #x "_DFOG\n"); \
Logger::Print("0x02%hhx %hhb\n", material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)], material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x)]); \
Logger::Print("0x02%hhx %hhb\n", material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)], material->stateBitsEntry[(Game::MaterialTechniqueType:: ## x ## _DFOG)]); \
}
COMPARE_TECHNIQUES(TECHNIQUE_EMISSIVE)
COMPARE_TECHNIQUES(TECHNIQUE_EMISSIVE_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SUN)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SUN_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SPOT)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_SPOT_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_OMNI)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_OMNI_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SUN)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SUN_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SPOT)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_SPOT_SHADOW)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_OMNI)
COMPARE_TECHNIQUES(TECHNIQUE_LIT_INSTANCED_OMNI_SHADOW)
#undef COMPARE_TECHNIQUES
if(first)
{
Logger::Print(6, "no mismatches found\n");
}
}, nullptr, false);
}
QuickPatch::QuickPatch() QuickPatch::QuickPatch()
{ {
// protocol version (workaround for hacks) // protocol version (workaround for hacks)
@ -402,6 +441,11 @@ namespace Components
throw new std::exception(); throw new std::exception();
}); });
Command::Add("checkmaterials", [] (Command::Params*)
{
QuickPatch::CompareMaterialStateBits();
});
// Dvars // Dvars
Dvar::Register<bool>("ui_streamFriendly", 0, Game::DVAR_FLAG_SAVED, "Stream friendly UI"); Dvar::Register<bool>("ui_streamFriendly", 0, Game::DVAR_FLAG_SAVED, "Stream friendly UI");

View File

@ -31,5 +31,7 @@ namespace Components
static int MsgReadBitsCompressCheckSV(const char *from, char *to, int size); static int MsgReadBitsCompressCheckSV(const char *from, char *to, int size);
static int MsgReadBitsCompressCheckCL(const char *from, char *to, int size); static int MsgReadBitsCompressCheckCL(const char *from, char *to, int size);
static void CL_HandleRelayPacketCheck(Game::msg_t* msg, int client); static void CL_HandleRelayPacketCheck(Game::msg_t* msg, int client);
static void CompareMaterialStateBits();
}; };
} }