Fully fix material exploit

This commit is contained in:
momo5502 2015-12-30 16:06:58 +01:00
parent 3000a11785
commit 556a8594af
2 changed files with 29 additions and 0 deletions

View File

@ -20,10 +20,36 @@ namespace Components
}
}
Game::Material* Materials::VerifyMaterial(Game::Material* material)
{
if (!IsBadReadPtr(material, 4) && !IsBadReadPtr(material->name, 1))
{
return material;
}
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material;
}
void __declspec(naked) Materials::DrawMaterialStub()
{
__asm
{
push eax
call Materials::VerifyMaterial
add esp, 4h
mov edx, 5310F0h
jmp edx
}
}
Materials::Materials()
{
// Allow codo images
Materials::ImageVersionCheckHook.Initialize(0x53A456, Materials::ImageVersionCheck, HOOK_CALL)->Install();
// Fix material pointer exploit
Utils::Hook(0x534E0C, Materials::DrawMaterialStub, HOOK_CALL).Install()->Quick();
}
Materials::~Materials()

View File

@ -10,5 +10,8 @@ namespace Components
private:
static Utils::Hook ImageVersionCheckHook;
static void ImageVersionCheck();
static Game::Material* VerifyMaterial(Game::Material* material);
static void DrawMaterialStub();
};
}