[Materials] Redirect preview images to loadscreens
This is a temporary workaround. We should create real previews!
This commit is contained in:
parent
b593987b72
commit
bc5aed43d8
@ -93,6 +93,22 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
int Materials::FormatImagePath(char* buffer, size_t size, int, int, const char* image)
|
||||
{
|
||||
if (Utils::String::StartsWith(image, "preview_"))
|
||||
{
|
||||
std::string newImage = image;
|
||||
Utils::String::Replace(newImage, "preview_", "loadscreen_");
|
||||
|
||||
if (FileSystem::File(fmt::sprintf("images/%s.iwi", newImage.data())).exists())
|
||||
{
|
||||
image = Utils::String::VA("%s", newImage.data());
|
||||
}
|
||||
}
|
||||
|
||||
return _snprintf_s(buffer, size, size, "images/%s.iwi", image);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Materials::DumpImageCfg(int, const char*, const char* material)
|
||||
{
|
||||
@ -126,6 +142,9 @@ namespace Components
|
||||
// Adapt death message to IW5 material format
|
||||
Utils::Hook(0x5A30D9, Materials::DeathMessageStub, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Resolve preview images to loadscreens
|
||||
Utils::Hook(0x53AC19, Materials::FormatImagePath, HOOK_CALL).install()->quick();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (Flags::HasFlag("dump"))
|
||||
{
|
||||
|
@ -23,6 +23,8 @@ namespace Components
|
||||
static int WriteDeathMessageIcon(char* string, int offset, Game::Material* material);
|
||||
static void DeathMessageStub();
|
||||
|
||||
static int FormatImagePath(char* buffer, size_t size, int, int, const char* image);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void DumpImageCfg(int, const char*, const char* material);
|
||||
static void DumpImageCfgPath(int, const char*, const char* material);
|
||||
|
Loading…
Reference in New Issue
Block a user