Fix crash in earth restoration cutscenes.

This commit is contained in:
Skyth 2025-01-13 23:18:42 +03:00
parent 8c0130ba4d
commit 922d287806

View file

@ -259,45 +259,47 @@ PPC_FUNC(sub_8258B558)
__imp__sub_8258B558(ctx, base);
uint32_t worldMapSimpleInfo = PPC_LOAD_U32(r3.u32 + 0x70);
auto setPosition = [&](uint32_t rcPtr, float offsetX = 0.0f, float offsetY = 0.0f)
{
uint32_t scene = PPC_LOAD_U32(rcPtr + 0x4);
if (scene != NULL)
if (worldMapSimpleInfo != NULL)
{
auto setPosition = [&](uint32_t rcPtr, float offsetX = 0.0f, float offsetY = 0.0f)
{
scene = PPC_LOAD_U32(scene + 0x4);
uint32_t scene = PPC_LOAD_U32(rcPtr + 0x4);
if (scene != NULL)
{
ctx.r3.u32 = scene;
ctx.f1.f64 = offsetX + g_narrowOffsetScale * 140.0f;
ctx.f2.f64 = offsetY;
scene = PPC_LOAD_U32(scene + 0x4);
if (scene != NULL)
{
ctx.r3.u32 = scene;
ctx.f1.f64 = offsetX + g_narrowOffsetScale * 140.0f;
ctx.f2.f64 = offsetY;
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
ctx.f1.f64 += g_offsetX;
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
ctx.f1.f64 += g_offsetX;
sub_830BB3D0(ctx, base);
sub_830BB3D0(ctx, base);
}
}
}
};
};
setPosition(worldMapSimpleInfo + 0x2C, 299.0f, -178.0f);
setPosition(worldMapSimpleInfo + 0x34);
setPosition(worldMapSimpleInfo + 0x4C);
setPosition(worldMapSimpleInfo + 0x2C, 299.0f, -178.0f);
setPosition(worldMapSimpleInfo + 0x34);
setPosition(worldMapSimpleInfo + 0x4C);
for (uint32_t it = PPC_LOAD_U32(worldMapSimpleInfo + 0x20); it != PPC_LOAD_U32(worldMapSimpleInfo + 0x24); it += 8)
setPosition(it);
for (uint32_t it = PPC_LOAD_U32(worldMapSimpleInfo + 0x20); it != PPC_LOAD_U32(worldMapSimpleInfo + 0x24); it += 8)
setPosition(it);
uint32_t menuTextBox = PPC_LOAD_U32(worldMapSimpleInfo + 0x5C);
if (menuTextBox != NULL)
{
uint32_t textBox = PPC_LOAD_U32(menuTextBox + 0x4);
if (textBox != NULL)
uint32_t menuTextBox = PPC_LOAD_U32(worldMapSimpleInfo + 0x5C);
if (menuTextBox != NULL)
{
float value = 708.0f + g_narrowOffsetScale * 140.0f;
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
value += g_offsetX;
uint32_t textBox = PPC_LOAD_U32(menuTextBox + 0x4);
if (textBox != NULL)
{
float value = 708.0f + g_narrowOffsetScale * 140.0f;
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
value += g_offsetX;
PPC_STORE_U32(textBox + 0x38, reinterpret_cast<uint32_t&>(value));
PPC_STORE_U32(textBox + 0x38, reinterpret_cast<uint32_t&>(value));
}
}
}
}