[IMaterial] Sortkey workaround
Search a material with the same techset and copy its sortkey
This commit is contained in:
parent
021ec9f1c4
commit
e909329910
@ -118,6 +118,16 @@ namespace Assets
|
||||
|
||||
material->stateBitTable = reader.readArray<Game::GfxStateBits>(material->stateBitsCount);
|
||||
header->material = material;
|
||||
|
||||
// Find correct sortkey by comparing techsets
|
||||
Game::DB_EnumXAssets_Internal(Game::XAssetType::ASSET_TYPE_MATERIAL, [](Game::XAssetHeader header, void* data)
|
||||
{
|
||||
Game::Material* material = reinterpret_cast<Game::Material*>(data);
|
||||
if (std::string(material->techniqueSet->name) == header.material->techniqueSet->name)
|
||||
{
|
||||
material->sortKey = header.material->sortKey;
|
||||
}
|
||||
}, material, false);
|
||||
}
|
||||
|
||||
void IMaterial::loadJson(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder)
|
||||
|
@ -131,17 +131,8 @@ namespace Components
|
||||
{
|
||||
static Game::Material* a = m1;
|
||||
static Game::Material* b = m2;
|
||||
int result = 0;
|
||||
__asm
|
||||
{
|
||||
push m1
|
||||
push m2
|
||||
mov eax, 0x5235B0
|
||||
call eax
|
||||
add esp, 8
|
||||
mov result, eax
|
||||
}
|
||||
return result;
|
||||
|
||||
return Utils::Hook::Call<int(Game::Material*, Game::Material*)>(0x5235B0)(m1, m2);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -180,7 +171,7 @@ namespace Components
|
||||
}
|
||||
|
||||
Logger::Print("%d\n", sizeof(int (*)(Game::Material*, Game::Material*)));
|
||||
Utils::Hook::Set<int (*)(Game::Material*, Game::Material*)>(0x523894, static_cast<int (*)(Game::Material*, Game::Material*)>(Materials::MaterialComparePrint));
|
||||
Utils::Hook::Set<void*>(0x523894, Materials::MaterialComparePrint);
|
||||
#endif
|
||||
|
||||
// Renderer::OnFrame([] ()
|
||||
|
@ -494,7 +494,9 @@ namespace Game
|
||||
struct MaterialTechniqueSet
|
||||
{
|
||||
const char* name;
|
||||
char pad[4];
|
||||
char worldVertFormat;
|
||||
bool hasBeenUploaded;
|
||||
char unused[1];
|
||||
MaterialTechniqueSet* remappedTechniques;
|
||||
MaterialTechnique* techniques[48];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user