Better material fix until is done

This commit is contained in:
momo5502 2016-09-03 16:59:05 +02:00
parent f13ad26dfc
commit fe6c08acc8
2 changed files with 28 additions and 3 deletions

View File

@ -22,12 +22,30 @@ namespace Components
Game::Material* Materials::VerifyMaterial(Game::Material* material)
{
if (!IsBadReadPtr(material, 4) && !IsBadReadPtr(material->name, 1))
// if (!IsBadReadPtr(material, 4) && !IsBadReadPtr(material->name, 1))
// {
// return material;
// }
Materials::VerifyContainer container = { false, material };
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_MATERIAL, [] (Game::XAssetHeader header, void* data)
{
Materials::VerifyContainer* container = reinterpret_cast<Materials::VerifyContainer*>(data);
if (container && header.material == container->material)
{
container->isValid = true;
}
}, &container, false);
if (container.isValid)
{
return material;
}
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material;
else
{
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material;
}
}
__declspec(naked) void Materials::DrawMaterialStub()

View File

@ -11,6 +11,13 @@ namespace Components
#endif
private:
class VerifyContainer
{
public:
bool isValid;
Game::Material* material;
};
static Utils::Hook ImageVersionCheckHook;
static void ImageVersionCheck();