[Materials] Add material compare hook.

- It takes forever to run with it on because there are so many comparisons and logging it takes a while
This commit is contained in:
TheApadayo 2016-12-27 10:42:13 -05:00
parent 43db338a5a
commit b3e6da21dc
2 changed files with 25 additions and 3 deletions

View File

@ -126,6 +126,24 @@ namespace Components
fclose(fp); fclose(fp);
} }
} }
int Materials::MaterialComparePrint(Game::Material* m1, Game::Material* m2)
{
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;
}
#endif #endif
Materials::Materials() Materials::Materials()
@ -160,6 +178,9 @@ namespace Components
Utils::Hook::Nop(0x51F5AC, 5); Utils::Hook::Nop(0x51F5AC, 5);
Utils::Hook::Nop(0x51F4C4, 5); Utils::Hook::Nop(0x51F4C4, 5);
} }
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));
#endif #endif
// Renderer::OnFrame([] () // Renderer::OnFrame([] ()

View File

@ -28,6 +28,7 @@ namespace Components
#ifdef DEBUG #ifdef DEBUG
static void DumpImageCfg(int, const char*, const char* material); static void DumpImageCfg(int, const char*, const char* material);
static void DumpImageCfgPath(int, const char*, const char* material); static void DumpImageCfgPath(int, const char*, const char* material);
static int MaterialComparePrint(Game::Material* m1, Game::Material* m2);
#endif #endif
}; };
} }