mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Scale 2D coordinates to backbuffer resolution. (#124)
* Starting with backbuffer scaling refactor. * CSD & primitive 2Ds refactored. * More refactoring. * Fix primitive 2D, and on screen 3D items. * Fix right side offset scaling. * Fix Inspire letterbox. * Fix offset scaling in world map. * Fix custom menus. * Remove debugging code.
This commit is contained in:
parent
1cf12fa97f
commit
40a8bf557b
10 changed files with 189 additions and 211 deletions
|
|
@ -1355,16 +1355,8 @@ static void CheckSwapChain()
|
||||||
if (g_needsResize)
|
if (g_needsResize)
|
||||||
Video::ComputeViewportDimensions();
|
Video::ComputeViewportDimensions();
|
||||||
|
|
||||||
if (g_aspectRatio >= NARROW_ASPECT_RATIO)
|
g_backBuffer->width = Video::s_viewportWidth;
|
||||||
{
|
g_backBuffer->height = Video::s_viewportHeight;
|
||||||
g_backBuffer->width = Video::s_viewportWidth * 720 / Video::s_viewportHeight;
|
|
||||||
g_backBuffer->height = 720;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_backBuffer->width = 960;
|
|
||||||
g_backBuffer->height = Video::s_viewportHeight * 960 / Video::s_viewportWidth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BeginCommandList()
|
static void BeginCommandList()
|
||||||
|
|
@ -2456,11 +2448,6 @@ static GuestSurface* GetBackBuffer()
|
||||||
return g_backBuffer;
|
return g_backBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuestSurface* Video::GetBackBuffer()
|
|
||||||
{
|
|
||||||
return g_backBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Video::ComputeViewportDimensions()
|
void Video::ComputeViewportDimensions()
|
||||||
{
|
{
|
||||||
uint32_t width = g_swapChain->getWidth();
|
uint32_t width = g_swapChain->getWidth();
|
||||||
|
|
@ -2663,9 +2650,6 @@ static GuestSurface* CreateSurface(uint32_t width, uint32_t height, uint32_t for
|
||||||
|
|
||||||
static void FlushViewport()
|
static void FlushViewport()
|
||||||
{
|
{
|
||||||
bool renderingToBackBuffer = g_renderTarget == g_backBuffer &&
|
|
||||||
g_backBuffer->texture != g_backBuffer->textureHolder.get();
|
|
||||||
|
|
||||||
auto& commandList = g_commandLists[g_frame];
|
auto& commandList = g_commandLists[g_frame];
|
||||||
|
|
||||||
if (g_dirtyStates.viewport)
|
if (g_dirtyStates.viewport)
|
||||||
|
|
@ -2677,17 +2661,6 @@ static void FlushViewport()
|
||||||
viewport.y += 0.5f;
|
viewport.y += 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderingToBackBuffer)
|
|
||||||
{
|
|
||||||
float width = Video::s_viewportWidth;
|
|
||||||
float height = Video::s_viewportHeight;
|
|
||||||
|
|
||||||
viewport.x *= width / g_backBuffer->width;
|
|
||||||
viewport.y *= height / g_backBuffer->height;
|
|
||||||
viewport.width *= width / g_backBuffer->width;
|
|
||||||
viewport.height *= height / g_backBuffer->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewport.minDepth > viewport.maxDepth)
|
if (viewport.minDepth > viewport.maxDepth)
|
||||||
std::swap(viewport.minDepth, viewport.maxDepth);
|
std::swap(viewport.minDepth, viewport.maxDepth);
|
||||||
|
|
||||||
|
|
@ -2704,17 +2677,6 @@ static void FlushViewport()
|
||||||
g_viewport.x + g_viewport.width,
|
g_viewport.x + g_viewport.width,
|
||||||
g_viewport.y + g_viewport.height);
|
g_viewport.y + g_viewport.height);
|
||||||
|
|
||||||
if (renderingToBackBuffer)
|
|
||||||
{
|
|
||||||
uint32_t width = Video::s_viewportWidth;
|
|
||||||
uint32_t height = Video::s_viewportHeight;
|
|
||||||
|
|
||||||
scissorRect.left = scissorRect.left * width / g_backBuffer->width;
|
|
||||||
scissorRect.top = scissorRect.top * height / g_backBuffer->height;
|
|
||||||
scissorRect.right = scissorRect.right * width / g_backBuffer->width;
|
|
||||||
scissorRect.bottom = scissorRect.bottom * height / g_backBuffer->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
commandList->setScissors(scissorRect);
|
commandList->setScissors(scissorRect);
|
||||||
|
|
||||||
g_dirtyStates.scissorRect = false;
|
g_dirtyStates.scissorRect = false;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ struct Video
|
||||||
static void Present();
|
static void Present();
|
||||||
static void StartPipelinePrecompilation();
|
static void StartPipelinePrecompilation();
|
||||||
static void WaitForGPU();
|
static void WaitForGPU();
|
||||||
static struct GuestSurface* GetBackBuffer();
|
|
||||||
static void ComputeViewportDimensions();
|
static void ComputeViewportDimensions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,36 +185,45 @@ void AspectRatioPatches::ComputeOffsets()
|
||||||
float height = Video::s_viewportHeight;
|
float height = Video::s_viewportHeight;
|
||||||
|
|
||||||
g_aspectRatio = width / height;
|
g_aspectRatio = width / height;
|
||||||
g_aspectRatioScale = 1.0f;
|
g_aspectRatioGameplayScale = 1.0f;
|
||||||
|
|
||||||
if (g_aspectRatio >= NARROW_ASPECT_RATIO)
|
if (g_aspectRatio >= NARROW_ASPECT_RATIO)
|
||||||
{
|
{
|
||||||
// height is locked to 720 in this case
|
g_aspectRatioOffsetX = (width - height * WIDE_ASPECT_RATIO) / 2.0f;
|
||||||
g_aspectRatioOffsetX = 0.5f * (g_aspectRatio * 720.0f - 1280.0f);
|
|
||||||
g_aspectRatioOffsetY = 0.0f;
|
g_aspectRatioOffsetY = 0.0f;
|
||||||
|
g_aspectRatioScale = height / 720.0f;
|
||||||
|
|
||||||
// keep same scale above Steam Deck aspect ratio
|
// keep same scale above Steam Deck aspect ratio
|
||||||
if (g_aspectRatio < WIDE_ASPECT_RATIO)
|
if (g_aspectRatio < WIDE_ASPECT_RATIO)
|
||||||
{
|
{
|
||||||
// interpolate to original 4:3 scale
|
// interpolate to original 4:3 scale
|
||||||
float steamDeckScale = g_aspectRatio / WIDE_ASPECT_RATIO;
|
float steamDeckScale = 1.0f / g_aspectRatioScale;
|
||||||
float narrowScale = ComputeScale(NARROW_ASPECT_RATIO);
|
float narrowScale = ComputeScale(NARROW_ASPECT_RATIO);
|
||||||
|
|
||||||
float lerpFactor = std::clamp((g_aspectRatio - NARROW_ASPECT_RATIO) / (STEAM_DECK_ASPECT_RATIO - NARROW_ASPECT_RATIO), 0.0f, 1.0f);
|
float lerpFactor = std::clamp((g_aspectRatio - NARROW_ASPECT_RATIO) / (STEAM_DECK_ASPECT_RATIO - NARROW_ASPECT_RATIO), 0.0f, 1.0f);
|
||||||
g_aspectRatioScale = narrowScale + (steamDeckScale - narrowScale) * lerpFactor;
|
g_aspectRatioGameplayScale = narrowScale + (steamDeckScale - narrowScale) * lerpFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// width is locked to 960 in this case to have 4:3 crop
|
// 4:3 crop
|
||||||
g_aspectRatioOffsetX = 0.5f * (960.0f - 1280.0f);
|
g_aspectRatioOffsetX = (width - width * NARROW_ASPECT_RATIO) / 2.0f;
|
||||||
g_aspectRatioOffsetY = 0.5f * (960.0f / g_aspectRatio - 720.0f);
|
g_aspectRatioOffsetY = (height - width / NARROW_ASPECT_RATIO) / 2.0f;
|
||||||
g_aspectRatioScale = ComputeScale(NARROW_ASPECT_RATIO);
|
g_aspectRatioScale = width / 960.0f;
|
||||||
|
g_aspectRatioGameplayScale = ComputeScale(NARROW_ASPECT_RATIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_narrowOffsetScale = std::clamp((g_aspectRatio - NARROW_ASPECT_RATIO) / (WIDE_ASPECT_RATIO - NARROW_ASPECT_RATIO), 0.0f, 1.0f);
|
g_aspectRatioNarrowScale = std::clamp((g_aspectRatio - NARROW_ASPECT_RATIO) / (WIDE_ASPECT_RATIO - NARROW_ASPECT_RATIO), 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GetViewport(void* application, be<uint32_t>* width, be<uint32_t>* height)
|
||||||
|
{
|
||||||
|
*width = 1280;
|
||||||
|
*height = 720;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUEST_FUNCTION_HOOK(sub_82E169B8, GetViewport);
|
||||||
|
|
||||||
// SWA::CGameDocument::ComputeScreenPosition
|
// SWA::CGameDocument::ComputeScreenPosition
|
||||||
PPC_FUNC_IMPL(__imp__sub_8250FC70);
|
PPC_FUNC_IMPL(__imp__sub_8250FC70);
|
||||||
PPC_FUNC(sub_8250FC70)
|
PPC_FUNC(sub_8250FC70)
|
||||||
|
|
@ -222,14 +231,15 @@ PPC_FUNC(sub_8250FC70)
|
||||||
__imp__sub_8250FC70(ctx, base);
|
__imp__sub_8250FC70(ctx, base);
|
||||||
|
|
||||||
auto position = reinterpret_cast<be<float>*>(base + ctx.r3.u32);
|
auto position = reinterpret_cast<be<float>*>(base + ctx.r3.u32);
|
||||||
position[0] = position[0] - g_aspectRatioOffsetX;
|
|
||||||
position[1] = position[1] - g_aspectRatioOffsetY;
|
position[0] = (position[0] / 1280.0f * Video::s_viewportWidth - g_aspectRatioOffsetX) / g_aspectRatioScale;
|
||||||
|
position[1] = (position[1] / 720.0f * Video::s_viewportHeight - g_aspectRatioOffsetY) / g_aspectRatioScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputeScreenPositionMidAsmHook(PPCRegister& f1, PPCRegister& f2)
|
void ComputeScreenPositionMidAsmHook(PPCRegister& f1, PPCRegister& f2)
|
||||||
{
|
{
|
||||||
f1.f64 -= g_aspectRatioOffsetX;
|
f1.f64 = (f1.f64 / 1280.0 * Video::s_viewportWidth - g_aspectRatioOffsetX) / g_aspectRatioScale;
|
||||||
f2.f64 -= g_aspectRatioOffsetY;
|
f2.f64 = (f2.f64 / 720.0 * Video::s_viewportHeight - g_aspectRatioOffsetY) / g_aspectRatioScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMapInfoMidAsmHook(PPCRegister& r4)
|
void WorldMapInfoMidAsmHook(PPCRegister& r4)
|
||||||
|
|
@ -258,11 +268,11 @@ PPC_FUNC(sub_8258B558)
|
||||||
if (scene != NULL)
|
if (scene != NULL)
|
||||||
{
|
{
|
||||||
ctx.r3.u32 = scene;
|
ctx.r3.u32 = scene;
|
||||||
ctx.f1.f64 = offsetX + g_narrowOffsetScale * 140.0f;
|
ctx.f1.f64 = offsetX + g_aspectRatioNarrowScale * 140.0f;
|
||||||
ctx.f2.f64 = offsetY;
|
ctx.f2.f64 = offsetY;
|
||||||
|
|
||||||
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
|
if (Config::UIScaleMode == EUIScaleMode::Edge && g_aspectRatioNarrowScale >= 1.0f)
|
||||||
ctx.f1.f64 += g_aspectRatioOffsetX;
|
ctx.f1.f64 += g_aspectRatioOffsetX / g_aspectRatioScale;
|
||||||
|
|
||||||
sub_830BB3D0(ctx, base);
|
sub_830BB3D0(ctx, base);
|
||||||
}
|
}
|
||||||
|
|
@ -282,9 +292,9 @@ PPC_FUNC(sub_8258B558)
|
||||||
uint32_t textBox = PPC_LOAD_U32(menuTextBox + 0x4);
|
uint32_t textBox = PPC_LOAD_U32(menuTextBox + 0x4);
|
||||||
if (textBox != NULL)
|
if (textBox != NULL)
|
||||||
{
|
{
|
||||||
float value = 708.0f + g_narrowOffsetScale * 140.0f;
|
float value = 708.0f + g_aspectRatioNarrowScale * 140.0f;
|
||||||
if (Config::UIScaleMode == EUIScaleMode::Edge && g_narrowOffsetScale >= 1.0f)
|
if (Config::UIScaleMode == EUIScaleMode::Edge && g_aspectRatioNarrowScale >= 1.0f)
|
||||||
value += g_aspectRatioOffsetX;
|
value += g_aspectRatioOffsetX / g_aspectRatioScale;
|
||||||
|
|
||||||
PPC_STORE_U32(textBox + 0x38, reinterpret_cast<uint32_t&>(value));
|
PPC_STORE_U32(textBox + 0x38, reinterpret_cast<uint32_t&>(value));
|
||||||
}
|
}
|
||||||
|
|
@ -740,8 +750,6 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
modifier.flags &= ~(ALIGN_LEFT | ALIGN_RIGHT);
|
modifier.flags &= ~(ALIGN_LEFT | ALIGN_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
|
||||||
|
|
||||||
uint32_t size = ctx.r5.u32 * stride;
|
uint32_t size = ctx.r5.u32 * stride;
|
||||||
ctx.r1.u32 -= size;
|
ctx.r1.u32 -= size;
|
||||||
|
|
||||||
|
|
@ -755,10 +763,12 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
|
|
||||||
if ((modifier.flags & STRETCH_HORIZONTAL) != 0)
|
if ((modifier.flags & STRETCH_HORIZONTAL) != 0)
|
||||||
{
|
{
|
||||||
scaleX = backBuffer->width / 1280.0f;
|
scaleX = Video::s_viewportWidth / 1280.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
scaleX = g_aspectRatioScale;
|
||||||
|
|
||||||
if ((modifier.flags & ALIGN_RIGHT) != 0)
|
if ((modifier.flags & ALIGN_RIGHT) != 0)
|
||||||
offsetX = g_aspectRatioOffsetX * 2.0f;
|
offsetX = g_aspectRatioOffsetX * 2.0f;
|
||||||
else if ((modifier.flags & ALIGN_LEFT) == 0)
|
else if ((modifier.flags & ALIGN_LEFT) == 0)
|
||||||
|
|
@ -766,27 +776,29 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
|
|
||||||
if ((modifier.flags & SCALE) != 0)
|
if ((modifier.flags & SCALE) != 0)
|
||||||
{
|
{
|
||||||
scaleX = g_aspectRatioScale;
|
scaleX *= g_aspectRatioGameplayScale;
|
||||||
|
|
||||||
if ((modifier.flags & ALIGN_RIGHT) != 0)
|
if ((modifier.flags & ALIGN_RIGHT) != 0)
|
||||||
offsetX += 1280.0f * (1.0f - scaleX);
|
offsetX += 1280.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||||
else if ((modifier.flags & ALIGN_LEFT) == 0)
|
else if ((modifier.flags & ALIGN_LEFT) == 0)
|
||||||
offsetX += 640.0f * (1.0f - scaleX);
|
offsetX += 640.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((modifier.flags & WORLD_MAP) != 0)
|
if ((modifier.flags & WORLD_MAP) != 0)
|
||||||
{
|
{
|
||||||
if ((modifier.flags & ALIGN_LEFT) != 0)
|
if ((modifier.flags & ALIGN_LEFT) != 0)
|
||||||
offsetX += (1.0f - g_narrowOffsetScale) * -20.0f;
|
offsetX += (1.0f - g_aspectRatioNarrowScale) * g_aspectRatioScale * -20.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((modifier.flags & STRETCH_VERTICAL) != 0)
|
if ((modifier.flags & STRETCH_VERTICAL) != 0)
|
||||||
{
|
{
|
||||||
scaleY = backBuffer->height / 720.0f;
|
scaleY = Video::s_viewportHeight / 720.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
scaleY = g_aspectRatioScale;
|
||||||
|
|
||||||
if ((modifier.flags & ALIGN_BOTTOM) != 0)
|
if ((modifier.flags & ALIGN_BOTTOM) != 0)
|
||||||
offsetY = g_aspectRatioOffsetY * 2.0f;
|
offsetY = g_aspectRatioOffsetY * 2.0f;
|
||||||
else if ((modifier.flags & ALIGN_TOP) == 0)
|
else if ((modifier.flags & ALIGN_TOP) == 0)
|
||||||
|
|
@ -794,12 +806,12 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
|
|
||||||
if ((modifier.flags & SCALE) != 0)
|
if ((modifier.flags & SCALE) != 0)
|
||||||
{
|
{
|
||||||
scaleY = g_aspectRatioScale;
|
scaleY *= g_aspectRatioGameplayScale;
|
||||||
|
|
||||||
if ((modifier.flags & ALIGN_BOTTOM) != 0)
|
if ((modifier.flags & ALIGN_BOTTOM) != 0)
|
||||||
offsetY += 720.0f * (1.0f - scaleY);
|
offsetY += 720.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||||
else if ((modifier.flags & ALIGN_TOP) == 0)
|
else if ((modifier.flags & ALIGN_TOP) == 0)
|
||||||
offsetY += 360.0f * (1.0f - scaleY);
|
offsetY += 360.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -836,7 +848,7 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
if ((offsetScaleModifier.flags & OFFSET_SCALE_LEFT) != 0)
|
if ((offsetScaleModifier.flags & OFFSET_SCALE_LEFT) != 0)
|
||||||
offsetX *= corner / offsetScaleModifier.cornerMax;
|
offsetX *= corner / offsetScaleModifier.cornerMax;
|
||||||
else if ((offsetScaleModifier.flags & OFFSET_SCALE_RIGHT) != 0)
|
else if ((offsetScaleModifier.flags & OFFSET_SCALE_RIGHT) != 0)
|
||||||
offsetX = 1280.0f - (1280.0f - offsetX) * (1280.0f - corner) / (1280.0f - offsetScaleModifier.cornerMax);
|
offsetX = Video::s_viewportWidth - (Video::s_viewportWidth - offsetX) * (1280.0f - corner) / (1280.0f - offsetScaleModifier.cornerMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < ctx.r5.u32; i++)
|
for (size_t i = 0; i < ctx.r5.u32; i++)
|
||||||
|
|
@ -852,11 +864,11 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
||||||
}
|
}
|
||||||
else if ((modifier.flags & EXTEND_RIGHT) != 0 && (i == 2 || i == 3))
|
else if ((modifier.flags & EXTEND_RIGHT) != 0 && (i == 2 || i == 3))
|
||||||
{
|
{
|
||||||
x = std::max(x, float(backBuffer->width));
|
x = std::max(x, float(Video::s_viewportWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
position[0] = round(x / backBuffer->width * Video::s_viewportWidth) / Video::s_viewportWidth * backBuffer->width;
|
position[0] = round(x);
|
||||||
position[1] = round(y / backBuffer->height * Video::s_viewportHeight) / Video::s_viewportHeight * backBuffer->height;
|
position[1] = round(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.r4.u32 = ctx.r1.u32;
|
ctx.r4.u32 = ctx.r1.u32;
|
||||||
|
|
@ -882,13 +894,12 @@ PPC_FUNC(sub_825E2E88)
|
||||||
PPC_FUNC_IMPL(__imp__sub_82E16C70);
|
PPC_FUNC_IMPL(__imp__sub_82E16C70);
|
||||||
PPC_FUNC(sub_82E16C70)
|
PPC_FUNC(sub_82E16C70)
|
||||||
{
|
{
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
|
||||||
auto scissorRect = reinterpret_cast<GuestRect*>(base + ctx.r4.u32);
|
auto scissorRect = reinterpret_cast<GuestRect*>(base + ctx.r4.u32);
|
||||||
|
|
||||||
scissorRect->left = scissorRect->left + g_aspectRatioOffsetX;
|
scissorRect->left = scissorRect->left * g_aspectRatioScale + g_aspectRatioOffsetX;
|
||||||
scissorRect->top = scissorRect->top + g_aspectRatioOffsetY;
|
scissorRect->top = scissorRect->top * g_aspectRatioScale + g_aspectRatioOffsetY;
|
||||||
scissorRect->right = scissorRect->right + g_aspectRatioOffsetX;
|
scissorRect->right = scissorRect->right * g_aspectRatioScale + g_aspectRatioOffsetX;
|
||||||
scissorRect->bottom = scissorRect->bottom + g_aspectRatioOffsetY;
|
scissorRect->bottom = scissorRect->bottom * g_aspectRatioScale + g_aspectRatioOffsetY;
|
||||||
|
|
||||||
__imp__sub_82E16C70(ctx, base);
|
__imp__sub_82E16C70(ctx, base);
|
||||||
}
|
}
|
||||||
|
|
@ -926,65 +937,76 @@ PPC_FUNC(sub_830D1EF0)
|
||||||
|
|
||||||
__imp__sub_830D1EF0(ctx, base);
|
__imp__sub_830D1EF0(ctx, base);
|
||||||
|
|
||||||
if (!PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET))
|
struct Vertex
|
||||||
{
|
{
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
be<float> x;
|
||||||
|
be<float> y;
|
||||||
|
be<float> z;
|
||||||
|
be<float> w;
|
||||||
|
be<uint32_t> color;
|
||||||
|
be<float> u;
|
||||||
|
be<float> v;
|
||||||
|
};
|
||||||
|
|
||||||
struct Vertex
|
auto vertex = reinterpret_cast<Vertex*>(base + ctx.r4.u32);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
float x = vertex[i].x * 640.0f + 640.0f;
|
||||||
|
float y = vertex[i].y * -360.0f + 360.0f;
|
||||||
|
|
||||||
|
if (PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET))
|
||||||
{
|
{
|
||||||
be<float> x;
|
// Stretch
|
||||||
be<float> y;
|
x = ((x + 0.5f) / 1280.0f) * Video::s_viewportWidth;
|
||||||
be<float> z;
|
y = ((y + 0.5f) / 720.0f) * Video::s_viewportHeight;
|
||||||
be<float> w;
|
}
|
||||||
be<uint32_t> color;
|
else
|
||||||
be<float> u;
|
|
||||||
be<float> v;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto vertex = reinterpret_cast<Vertex*>(base + ctx.r4.u32);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < 4; i++)
|
|
||||||
{
|
{
|
||||||
vertex[i].x = vertex[i].x * 1280.0f / backBuffer->width;
|
// Center
|
||||||
vertex[i].y = vertex[i].y * 720.0f / backBuffer->height;
|
x = g_aspectRatioOffsetX + (x + 0.5f) * g_aspectRatioScale;
|
||||||
|
y = g_aspectRatioOffsetY + (y + 0.5f) * g_aspectRatioScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool letterboxTop = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x1);
|
vertex[i].x = ((x - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f;
|
||||||
bool letterboxBottom = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x2);
|
vertex[i].y = ((y - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (letterboxTop || letterboxBottom)
|
bool letterboxTop = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x1);
|
||||||
|
bool letterboxBottom = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x2);
|
||||||
|
|
||||||
|
if (letterboxTop || letterboxBottom)
|
||||||
|
{
|
||||||
|
float halfPixelX = 1.0f / Video::s_viewportWidth;
|
||||||
|
float halfPixelY = 1.0f / Video::s_viewportHeight;
|
||||||
|
|
||||||
|
if (letterboxTop)
|
||||||
{
|
{
|
||||||
float halfPixelX = 1.0f / backBuffer->width;
|
vertex[0].x = -1.0f - halfPixelX;
|
||||||
float halfPixelY = 1.0f / backBuffer->height;
|
vertex[0].y = 1.0f + halfPixelY;
|
||||||
|
|
||||||
if (letterboxTop)
|
vertex[1].x = 1.0f - halfPixelX;
|
||||||
{
|
vertex[1].y = 1.0f + halfPixelY;
|
||||||
vertex[0].x = -1.0f - halfPixelX;
|
|
||||||
vertex[0].y = 1.0f + halfPixelY;
|
|
||||||
|
|
||||||
vertex[1].x = 1.0f - halfPixelX;
|
vertex[2].x = -1.0f - halfPixelX;
|
||||||
vertex[1].y = 1.0f + halfPixelY;
|
// vertex[2].y untouched
|
||||||
|
|
||||||
vertex[2].x = -1.0f - halfPixelX;
|
vertex[3].x = 1.0f - halfPixelX;
|
||||||
// vertex[2].y untouched
|
// vertex[3].y untouched
|
||||||
|
}
|
||||||
|
else if (letterboxBottom)
|
||||||
|
{
|
||||||
|
vertex[0].x = -1.0f - halfPixelX;
|
||||||
|
// vertex[0].y untouched
|
||||||
|
|
||||||
vertex[3].x = 1.0f - halfPixelX;
|
vertex[1].x = 1.0f - halfPixelX;
|
||||||
// vertex[3].y untouched
|
// vertex[1].y untouched
|
||||||
}
|
|
||||||
else if (letterboxBottom)
|
|
||||||
{
|
|
||||||
vertex[0].x = -1.0f - halfPixelX;
|
|
||||||
// vertex[0].y untouched
|
|
||||||
|
|
||||||
vertex[1].x = 1.0f - halfPixelX;
|
vertex[2].x = -1.0f - halfPixelX;
|
||||||
// vertex[1].y untouched
|
vertex[2].y = -1.0f + halfPixelY;
|
||||||
|
|
||||||
vertex[2].x = -1.0f - halfPixelX;
|
vertex[3].x = 1.0f - halfPixelX;
|
||||||
vertex[2].y = -1.0f + halfPixelY;
|
vertex[3].y = -1.0f + halfPixelY;
|
||||||
|
|
||||||
vertex[3].x = 1.0f - halfPixelX;
|
|
||||||
vertex[3].y = -1.0f + halfPixelY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1018,8 +1040,9 @@ static double ComputeObjGetItemX(uint32_t type)
|
||||||
x = 1058.0;
|
x = 1058.0;
|
||||||
|
|
||||||
x *= g_aspectRatioScale;
|
x *= g_aspectRatioScale;
|
||||||
|
x *= g_aspectRatioGameplayScale;
|
||||||
|
|
||||||
double scaleOffset = (1280.0 * (1.0 - g_aspectRatioScale));
|
double scaleOffset = (1280.0 * (1.0 - g_aspectRatioGameplayScale)) * g_aspectRatioScale;
|
||||||
|
|
||||||
if (Config::UIScaleMode == EUIScaleMode::Edge)
|
if (Config::UIScaleMode == EUIScaleMode::Edge)
|
||||||
{
|
{
|
||||||
|
|
@ -1031,8 +1054,7 @@ static double ComputeObjGetItemX(uint32_t type)
|
||||||
x += g_aspectRatioOffsetX + scaleOffset;
|
x += g_aspectRatioOffsetX + scaleOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
return (x - (0.5 * Video::s_viewportWidth)) / (0.5 * Video::s_viewportHeight) * OBJ_GET_ITEM_TANGENT;
|
||||||
return (x - (0.5 * backBuffer->width)) / (0.5 * backBuffer->height) * OBJ_GET_ITEM_TANGENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
@ -1066,10 +1088,10 @@ static double ComputeObjGetItemY(uint32_t type)
|
||||||
y = 582.0;
|
y = 582.0;
|
||||||
|
|
||||||
y *= g_aspectRatioScale;
|
y *= g_aspectRatioScale;
|
||||||
y += g_aspectRatioOffsetY * 2.0 + 720.0 * (1.0 - g_aspectRatioScale);
|
y *= g_aspectRatioGameplayScale;
|
||||||
|
y += g_aspectRatioOffsetY * 2.0 + 720.0 * (1.0 - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||||
|
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
return ((0.5 * Video::s_viewportHeight) - y) / (0.5 * Video::s_viewportHeight) * OBJ_GET_ITEM_TANGENT;
|
||||||
return ((0.5 * backBuffer->height) - y) / (0.5 * backBuffer->height) * OBJ_GET_ITEM_TANGENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.25;
|
return 0.25;
|
||||||
|
|
@ -1133,12 +1155,12 @@ PPC_FUNC(sub_82B8AA40)
|
||||||
PPC_STORE_U8(ctx.r3.u32, shouldDrawLetterbox);
|
PPC_STORE_U8(ctx.r3.u32, shouldDrawLetterbox);
|
||||||
if (shouldDrawLetterbox)
|
if (shouldDrawLetterbox)
|
||||||
{
|
{
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
float aspectRatio = std::max(NARROW_ASPECT_RATIO, g_aspectRatio);
|
||||||
uint32_t height = std::min(720u, backBuffer->height);
|
uint32_t width = aspectRatio * 720;
|
||||||
|
|
||||||
PPC_STORE_U32(ctx.r3.u32 + 0xC, backBuffer->width);
|
PPC_STORE_U32(ctx.r3.u32 + 0xC, width);
|
||||||
PPC_STORE_U32(ctx.r3.u32 + 0x10, height);
|
PPC_STORE_U32(ctx.r3.u32 + 0x10, 720);
|
||||||
PPC_STORE_U32(ctx.r3.u32 + 0x14, (height - backBuffer->width * 9 / 16) / 2);
|
PPC_STORE_U32(ctx.r3.u32 + 0x14, (720 - width * 9 / 16) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
__imp__sub_82B8AA40(ctx, base);
|
__imp__sub_82B8AA40(ctx, base);
|
||||||
|
|
@ -1161,5 +1183,5 @@ void InspireSubtitleMidAsmHook(PPCRegister& r3)
|
||||||
constexpr float NARROW_OFFSET = 485.0f;
|
constexpr float NARROW_OFFSET = 485.0f;
|
||||||
constexpr float WIDE_OFFSET = 560.0f;
|
constexpr float WIDE_OFFSET = 560.0f;
|
||||||
|
|
||||||
*reinterpret_cast<be<float>*>(g_memory.base + r3.u32 + 0x3C) = NARROW_OFFSET + (WIDE_OFFSET - NARROW_OFFSET) * g_narrowOffsetScale;
|
*reinterpret_cast<be<float>*>(g_memory.base + r3.u32 + 0x3C) = NARROW_OFFSET + (WIDE_OFFSET - NARROW_OFFSET) * g_aspectRatioNarrowScale;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ inline float g_aspectRatio;
|
||||||
inline float g_aspectRatioOffsetX;
|
inline float g_aspectRatioOffsetX;
|
||||||
inline float g_aspectRatioOffsetY;
|
inline float g_aspectRatioOffsetY;
|
||||||
inline float g_aspectRatioScale;
|
inline float g_aspectRatioScale;
|
||||||
inline float g_narrowOffsetScale;
|
inline float g_aspectRatioGameplayScale;
|
||||||
|
inline float g_aspectRatioNarrowScale;
|
||||||
|
|
||||||
struct AspectRatioPatches
|
struct AspectRatioPatches
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,8 @@ PPC_FUNC(sub_82AE30D8)
|
||||||
scaleV = g_aspectRatio / movieAspectRatio;
|
scaleV = g_aspectRatio / movieAspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto backBuffer = Video::GetBackBuffer();
|
float halfPixelX = 1.0f / Video::s_viewportWidth;
|
||||||
float halfPixelX = 1.0f / backBuffer->width;
|
float halfPixelY = 1.0f / Video::s_viewportHeight;
|
||||||
float halfPixelY = 1.0f / backBuffer->height;
|
|
||||||
|
|
||||||
pTopLeft->X = -1.0f - halfPixelX;
|
pTopLeft->X = -1.0f - halfPixelX;
|
||||||
pTopLeft->Y = 1.0f + halfPixelY;
|
pTopLeft->Y = 1.0f + halfPixelY;
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,8 @@ static void DrawHeaderContainer(const char* text)
|
||||||
? Lerp(1, 0, colourMotion)
|
? Lerp(1, 0, colourMotion)
|
||||||
: Lerp(0, 1, colourMotion);
|
: Lerp(0, 1, colourMotion);
|
||||||
|
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + containerMarginX), Scale(g_aspectRatioOffsetY + 136) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(containerMarginX), g_aspectRatioOffsetY + Scale(136) };
|
||||||
ImVec2 max = { min.x + textMarginX * 2 + textSize.x + Scale(5), Scale(g_aspectRatioOffsetY + 196) };
|
ImVec2 max = { min.x + textMarginX * 2 + textSize.x + Scale(5), g_aspectRatioOffsetY + Scale(196) };
|
||||||
|
|
||||||
DrawPauseHeaderContainer(g_upWindow.get(), min, max, alpha);
|
DrawPauseHeaderContainer(g_upWindow.get(), min, max, alpha);
|
||||||
|
|
||||||
|
|
@ -568,8 +568,8 @@ static void DrawContentContainer()
|
||||||
? Hermite(604, 573, motion)
|
? Hermite(604, 573, motion)
|
||||||
: Hermite(573, 604, motion);
|
: Hermite(573, 604, motion);
|
||||||
|
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + minX), Scale(g_aspectRatioOffsetY + minY) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(minX), g_aspectRatioOffsetY + Scale(minY) };
|
||||||
ImVec2 max = { Scale(g_aspectRatioOffsetX + maxX), Scale(g_aspectRatioOffsetY + maxY) };
|
ImVec2 max = { g_aspectRatioOffsetX + Scale(maxX), g_aspectRatioOffsetY + Scale(maxY) };
|
||||||
|
|
||||||
// Transparency fade animation.
|
// Transparency fade animation.
|
||||||
auto alpha = g_isClosing
|
auto alpha = g_isClosing
|
||||||
|
|
|
||||||
|
|
@ -229,8 +229,8 @@ void ButtonGuide::Draw()
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
auto& res = ImGui::GetIO().DisplaySize;
|
auto& res = ImGui::GetIO().DisplaySize;
|
||||||
|
|
||||||
ImVec2 regionMin = { Scale(g_aspectRatioOffsetX + g_sideMargins), Scale(g_aspectRatioOffsetY * 2.0f + 720.0f - 102.0f) };
|
ImVec2 regionMin = { g_aspectRatioOffsetX + Scale(g_sideMargins), g_aspectRatioOffsetY * 2.0f + Scale(720.0f - 102.0f) };
|
||||||
ImVec2 regionMax = { Scale(g_aspectRatioOffsetX + 1280.0f - g_sideMargins), Scale(g_aspectRatioOffsetY * 2.0f + 720.0f) };
|
ImVec2 regionMax = { g_aspectRatioOffsetX + Scale(1280.0f - g_sideMargins), g_aspectRatioOffsetY * 2.0f + Scale(720.0f) };
|
||||||
|
|
||||||
auto textMarginX = Scale(57);
|
auto textMarginX = Scale(57);
|
||||||
auto textMarginY = Scale(8);
|
auto textMarginY = Scale(8);
|
||||||
|
|
|
||||||
|
|
@ -110,12 +110,7 @@ inline void ResetProceduralOrigin()
|
||||||
|
|
||||||
inline float Scale(float size)
|
inline float Scale(float size)
|
||||||
{
|
{
|
||||||
auto& io = ImGui::GetIO();
|
return size * g_aspectRatioScale;
|
||||||
|
|
||||||
if (g_aspectRatio >= NARROW_ASPECT_RATIO)
|
|
||||||
return size * (io.DisplaySize.y / 720.0f);
|
|
||||||
else
|
|
||||||
return size * (io.DisplaySize.x / 960.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double ComputeMotion(double duration, double offset, double total)
|
inline double ComputeMotion(double duration, double offset, double total)
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ static void DrawLeftImage()
|
||||||
GuestTexture *guestTexture = g_installTextures[installTextureIndex % g_installTextures.size()].get();
|
GuestTexture *guestTexture = g_installTextures[installTextureIndex % g_installTextures.size()].get();
|
||||||
auto &res = ImGui::GetIO().DisplaySize;
|
auto &res = ImGui::GetIO().DisplaySize;
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + IMAGE_X), Scale(g_aspectRatioOffsetY + IMAGE_Y) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(IMAGE_X), g_aspectRatioOffsetY + Scale(IMAGE_Y) };
|
||||||
ImVec2 max = { min.x + Scale(IMAGE_WIDTH), min.y + Scale(IMAGE_HEIGHT) };
|
ImVec2 max = { min.x + Scale(IMAGE_WIDTH), min.y + Scale(IMAGE_HEIGHT) };
|
||||||
drawList->AddImage(guestTexture, min, max, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, a));
|
drawList->AddImage(guestTexture, min, max, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, a));
|
||||||
}
|
}
|
||||||
|
|
@ -458,9 +458,9 @@ static void DrawHeaderIconsForInstallPhase(double iconsPosX, double iconsPosY, d
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
|
|
||||||
// Arrow Circle Icon
|
// Arrow Circle Icon
|
||||||
ImVec2 arrowCircleMin = { Scale(iconsPosX - iconsScale / 2), Scale(iconsPosY - iconsScale / 2) };
|
ImVec2 arrowCircleMin = { g_aspectRatioOffsetX + Scale(iconsPosX - iconsScale / 2), Scale(iconsPosY - iconsScale / 2) };
|
||||||
ImVec2 arrowCircleMax = { Scale(iconsPosX + iconsScale / 2), Scale(iconsPosY + iconsScale / 2) };
|
ImVec2 arrowCircleMax = { g_aspectRatioOffsetX + Scale(iconsPosX + iconsScale / 2), Scale(iconsPosY + iconsScale / 2) };
|
||||||
ImVec2 center = { Scale(iconsPosX) + 0.5f, Scale(iconsPosY) - 0.5f };
|
ImVec2 center = { g_aspectRatioOffsetX + Scale(iconsPosX) + 0.5f, Scale(iconsPosY) - 0.5f };
|
||||||
|
|
||||||
float arrowCircleFadeMotion = ComputeMotionInstaller(g_installerStartTime, g_installerEndTime, INSTALL_ICONS_FADE_IN_ANIMATION_TIME, INSTALL_ICONS_FADE_IN_ANIMATION_DURATION);
|
float arrowCircleFadeMotion = ComputeMotionInstaller(g_installerStartTime, g_installerEndTime, INSTALL_ICONS_FADE_IN_ANIMATION_TIME, INSTALL_ICONS_FADE_IN_ANIMATION_DURATION);
|
||||||
float rotationMotion = ComputeMotionInstallerLoop(g_installerStartTime, ARROW_CIRCLE_LOOP_SPEED, 0);
|
float rotationMotion = ComputeMotionInstallerLoop(g_installerStartTime, ARROW_CIRCLE_LOOP_SPEED, 0);
|
||||||
|
|
@ -503,8 +503,8 @@ static void DrawHeaderIconsForInstallPhase(double iconsPosX, double iconsPosY, d
|
||||||
|
|
||||||
float pulseScale = iconsScale * pulseHermiteMotion * 1.5;
|
float pulseScale = iconsScale * pulseHermiteMotion * 1.5;
|
||||||
|
|
||||||
ImVec2 pulseMin = { Scale(iconsPosX - pulseScale / 2), Scale(iconsPosY - pulseScale / 2) };
|
ImVec2 pulseMin = { g_aspectRatioOffsetX + Scale(iconsPosX - pulseScale / 2), Scale(iconsPosY - pulseScale / 2) };
|
||||||
ImVec2 pulseMax = { Scale(iconsPosX + pulseScale / 2), Scale(iconsPosY + pulseScale / 2) };
|
ImVec2 pulseMax = { g_aspectRatioOffsetX + Scale(iconsPosX + pulseScale / 2), Scale(iconsPosY + pulseScale / 2) };
|
||||||
drawList->AddImage(g_pulseInstall.get(), pulseMin, pulseMax, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, 255 * pulseFade * pulseFadeMotion));
|
drawList->AddImage(g_pulseInstall.get(), pulseMin, pulseMax, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, 255 * pulseFade * pulseFadeMotion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,7 +512,7 @@ static void DrawHeaderIcons()
|
||||||
{
|
{
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
|
|
||||||
float iconsPosX = g_aspectRatioOffsetX + 253.0f;
|
float iconsPosX = 253.0f;
|
||||||
float iconsPosY = 79.0f;
|
float iconsPosY = 79.0f;
|
||||||
float iconsScale = 58;
|
float iconsScale = 58;
|
||||||
|
|
||||||
|
|
@ -520,8 +520,8 @@ static void DrawHeaderIcons()
|
||||||
float milesIconMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, MILES_ICON_ANIMATION_TIME, MILES_ICON_ANIMATION_DURATION);
|
float milesIconMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, MILES_ICON_ANIMATION_TIME, MILES_ICON_ANIMATION_DURATION);
|
||||||
float milesIconScale = iconsScale * (2 - milesIconMotion);
|
float milesIconScale = iconsScale * (2 - milesIconMotion);
|
||||||
|
|
||||||
ImVec2 milesElectricMin = { Scale(iconsPosX - milesIconScale / 2), Scale(iconsPosY - milesIconScale / 2) };
|
ImVec2 milesElectricMin = { g_aspectRatioOffsetX + Scale(iconsPosX - milesIconScale / 2), Scale(iconsPosY - milesIconScale / 2) };
|
||||||
ImVec2 milesElectricMax = { Scale(iconsPosX + milesIconScale / 2), Scale(iconsPosY + milesIconScale / 2) };
|
ImVec2 milesElectricMax = { g_aspectRatioOffsetX + Scale(iconsPosX + milesIconScale / 2), Scale(iconsPosY + milesIconScale / 2) };
|
||||||
drawList->AddImage(g_milesElectricIcon.get(), milesElectricMin, milesElectricMax, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, 255 * milesIconMotion));
|
drawList->AddImage(g_milesElectricIcon.get(), milesElectricMin, milesElectricMax, ImVec2(0, 0), ImVec2(1, 1), IM_COL32(255, 255, 255, 255 * milesIconMotion));
|
||||||
|
|
||||||
if (int(g_currentPage) >= int(WizardPage::Installing))
|
if (int(g_currentPage) >= int(WizardPage::Installing))
|
||||||
|
|
@ -578,7 +578,7 @@ static void DrawScanlineBars()
|
||||||
// Installer text
|
// Installer text
|
||||||
const std::string &headerText = Localise(g_currentPage == WizardPage::Installing ? "Installer_Header_Installing" : "Installer_Header_Installer");
|
const std::string &headerText = Localise(g_currentPage == WizardPage::Installing ? "Installer_Header_Installing" : "Installer_Header_Installer");
|
||||||
auto alphaMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION);
|
auto alphaMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION);
|
||||||
DrawTextWithOutline(g_dfsogeistdFont, Scale(42.0f), { Scale(g_aspectRatioOffsetX + 285.0f), Scale(57.0f) }, IM_COL32(255, 195, 0, 255 * alphaMotion), headerText.c_str(), 4, IM_COL32(0, 0, 0, 255 * alphaMotion), IMGUI_SHADER_MODIFIER_TITLE_BEVEL);
|
DrawTextWithOutline(g_dfsogeistdFont, Scale(42.0f), { g_aspectRatioOffsetX + Scale(285.0f), Scale(57.0f) }, IM_COL32(255, 195, 0, 255 * alphaMotion), headerText.c_str(), 4, IM_COL32(0, 0, 0, 255 * alphaMotion), IMGUI_SHADER_MODIFIER_TITLE_BEVEL);
|
||||||
|
|
||||||
// Top bar line
|
// Top bar line
|
||||||
drawList->AddLine
|
drawList->AddLine
|
||||||
|
|
@ -637,8 +637,8 @@ static void DrawDescriptionContainer()
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
auto fontSize = Scale(26.0f);
|
auto fontSize = Scale(26.0f);
|
||||||
|
|
||||||
ImVec2 descriptionMin = { Scale(g_aspectRatioOffsetX + CONTAINER_X), Scale(g_aspectRatioOffsetY + CONTAINER_Y) };
|
ImVec2 descriptionMin = { g_aspectRatioOffsetX + Scale(CONTAINER_X), g_aspectRatioOffsetY + Scale(CONTAINER_Y) };
|
||||||
ImVec2 descriptionMax = { Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT) };
|
ImVec2 descriptionMax = { g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT) };
|
||||||
SetProceduralOrigin(descriptionMin);
|
SetProceduralOrigin(descriptionMin);
|
||||||
DrawContainer(descriptionMin, descriptionMax, true);
|
DrawContainer(descriptionMin, descriptionMax, true);
|
||||||
|
|
||||||
|
|
@ -691,8 +691,8 @@ static void DrawDescriptionContainer()
|
||||||
|
|
||||||
ImVec2 imageMin =
|
ImVec2 imageMin =
|
||||||
{
|
{
|
||||||
/* X */ Scale(g_aspectRatioOffsetX + CONTAINER_X) + (Scale(CONTAINER_WIDTH) / 2) - (imageScale / 2) - (hedgeDevTextSize.x / 2) - hedgeDevTextMarginX,
|
/* X */ g_aspectRatioOffsetX + Scale(CONTAINER_X) + (Scale(CONTAINER_WIDTH) / 2) - (imageScale / 2) - (hedgeDevTextSize.x / 2) - hedgeDevTextMarginX,
|
||||||
/* Y */ Scale(g_aspectRatioOffsetY + CONTAINER_Y) + (Scale(CONTAINER_HEIGHT) / 2) - (imageScale / 2) + imageMarginY
|
/* Y */ g_aspectRatioOffsetY + Scale(CONTAINER_Y) + (Scale(CONTAINER_HEIGHT) / 2) - (imageScale / 2) + imageMarginY
|
||||||
};
|
};
|
||||||
|
|
||||||
ImVec2 imageMax = { imageMin.x + imageScale, imageMin.y + imageScale };
|
ImVec2 imageMax = { imageMin.x + imageScale, imageMin.y + imageScale };
|
||||||
|
|
@ -712,9 +712,9 @@ static void DrawDescriptionContainer()
|
||||||
auto marqueeTextMarginX = Scale(5);
|
auto marqueeTextMarginX = Scale(5);
|
||||||
auto marqueeTextMarginY = Scale(15);
|
auto marqueeTextMarginY = Scale(15);
|
||||||
|
|
||||||
ImVec2 textPos = { descriptionMax.x, Scale(g_aspectRatioOffsetY + CONTAINER_Y) + Scale(CONTAINER_HEIGHT) - marqueeTextSize.y - marqueeTextMarginY };
|
ImVec2 textPos = { descriptionMax.x, g_aspectRatioOffsetY + Scale(CONTAINER_Y) + Scale(CONTAINER_HEIGHT) - marqueeTextSize.y - marqueeTextMarginY };
|
||||||
ImVec2 textMin = { Scale(g_aspectRatioOffsetX + CONTAINER_X), textPos.y };
|
ImVec2 textMin = { g_aspectRatioOffsetX + Scale(CONTAINER_X), textPos.y };
|
||||||
ImVec2 textMax = { Scale(g_aspectRatioOffsetX + CONTAINER_X) + Scale(CONTAINER_WIDTH), Scale(g_aspectRatioOffsetY + CONTAINER_Y) + Scale(CONTAINER_HEIGHT) };
|
ImVec2 textMax = { g_aspectRatioOffsetX + Scale(CONTAINER_X) + Scale(CONTAINER_WIDTH), g_aspectRatioOffsetY + Scale(CONTAINER_Y) + Scale(CONTAINER_HEIGHT) };
|
||||||
|
|
||||||
SetMarqueeFade(textMin, textMax, Scale(32));
|
SetMarqueeFade(textMin, textMax, Scale(32));
|
||||||
DrawTextWithMarquee(g_seuratFont, fontSize, textPos, textMin, textMax, colWhite, CREDITS_TEXT, g_appearTime, 0.9, Scale(250));
|
DrawTextWithMarquee(g_seuratFont, fontSize, textPos, textMin, textMax, colWhite, CREDITS_TEXT, g_appearTime, 0.9, Scale(250));
|
||||||
|
|
@ -847,16 +847,16 @@ static void ComputeButtonColumnCoordinates(ButtonColumn buttonColumn, float &min
|
||||||
switch (buttonColumn)
|
switch (buttonColumn)
|
||||||
{
|
{
|
||||||
case ButtonColumnLeft:
|
case ButtonColumnLeft:
|
||||||
minX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_BUTTON_GAP);
|
minX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_BUTTON_GAP);
|
||||||
maxX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_BUTTON_GAP + CONTAINER_BUTTON_WIDTH);
|
maxX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_BUTTON_GAP + CONTAINER_BUTTON_WIDTH);
|
||||||
break;
|
break;
|
||||||
case ButtonColumnMiddle:
|
case ButtonColumnMiddle:
|
||||||
minX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH / 2.0f - CONTAINER_BUTTON_WIDTH / 2.0f);
|
minX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH / 2.0f - CONTAINER_BUTTON_WIDTH / 2.0f);
|
||||||
maxX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH / 2.0f + CONTAINER_BUTTON_WIDTH / 2.0f);
|
maxX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH / 2.0f + CONTAINER_BUTTON_WIDTH / 2.0f);
|
||||||
break;
|
break;
|
||||||
case ButtonColumnRight:
|
case ButtonColumnRight:
|
||||||
minX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH - CONTAINER_BUTTON_GAP - CONTAINER_BUTTON_WIDTH);
|
minX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH - CONTAINER_BUTTON_GAP - CONTAINER_BUTTON_WIDTH);
|
||||||
maxX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH - CONTAINER_BUTTON_GAP);
|
maxX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH - CONTAINER_BUTTON_GAP);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -868,8 +868,8 @@ static void DrawSourceButton(ButtonColumn buttonColumn, float yRatio, const char
|
||||||
ComputeButtonColumnCoordinates(buttonColumn, minX, maxX);
|
ComputeButtonColumnCoordinates(buttonColumn, minX, maxX);
|
||||||
|
|
||||||
float minusY = (CONTAINER_BUTTON_GAP + BUTTON_HEIGHT) * yRatio;
|
float minusY = (CONTAINER_BUTTON_GAP + BUTTON_HEIGHT) * yRatio;
|
||||||
ImVec2 min = { minX, Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - BUTTON_HEIGHT - minusY) };
|
ImVec2 min = { minX, g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - BUTTON_HEIGHT - minusY) };
|
||||||
ImVec2 max = { maxX, Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - minusY) };
|
ImVec2 max = { maxX, g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - minusY) };
|
||||||
DrawButton(min, max, sourceText, true, sourceSet, buttonPressed);
|
DrawButton(min, max, sourceText, true, sourceSet, buttonPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -882,8 +882,8 @@ static void DrawProgressBar(float progressRatio)
|
||||||
const uint32_t innerColor1 = IM_COL32(0, 32, 0, 255 * alpha);
|
const uint32_t innerColor1 = IM_COL32(0, 32, 0, 255 * alpha);
|
||||||
float xPadding = Scale(6.0f);
|
float xPadding = Scale(6.0f);
|
||||||
float yPadding = Scale(3.0f);
|
float yPadding = Scale(3.0f);
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + CONTAINER_X) + BOTTOM_X_GAP, Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(CONTAINER_X) + BOTTOM_X_GAP, g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
||||||
ImVec2 max = { Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH - BOTTOM_X_GAP), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
ImVec2 max = { g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH - BOTTOM_X_GAP), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
||||||
|
|
||||||
DrawButtonContainer(min, max, 0, 0, alpha);
|
DrawButtonContainer(min, max, 0, 0, alpha);
|
||||||
|
|
||||||
|
|
@ -1070,8 +1070,8 @@ static void DrawLanguagePicker()
|
||||||
ComputeButtonColumnCoordinates((i < 3) ? ButtonColumnLeft : ButtonColumnRight, minX, maxX);
|
ComputeButtonColumnCoordinates((i < 3) ? ButtonColumnLeft : ButtonColumnRight, minX, maxX);
|
||||||
|
|
||||||
float minusY = (CONTAINER_BUTTON_GAP + BUTTON_HEIGHT) * (float(i % 3));
|
float minusY = (CONTAINER_BUTTON_GAP + BUTTON_HEIGHT) * (float(i % 3));
|
||||||
ImVec2 min = { minX, Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - BUTTON_HEIGHT - minusY) };
|
ImVec2 min = { minX, g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - BUTTON_HEIGHT - minusY) };
|
||||||
ImVec2 max = { maxX, Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - minusY) };
|
ImVec2 max = { maxX, g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT - CONTAINER_BUTTON_GAP - minusY) };
|
||||||
|
|
||||||
// TODO: The active button should change its style to show an enabled toggle if it matches the current language.
|
// TODO: The active button should change its style to show an enabled toggle if it matches the current language.
|
||||||
|
|
||||||
|
|
@ -1096,8 +1096,8 @@ static void DrawSourcePickers()
|
||||||
ImVec2 textSize = ComputeTextSize(g_dfsogeistdFont, addFilesText.c_str(), 20.0f, squashRatio, ADD_BUTTON_MAX_TEXT_WIDTH);
|
ImVec2 textSize = ComputeTextSize(g_dfsogeistdFont, addFilesText.c_str(), 20.0f, squashRatio, ADD_BUTTON_MAX_TEXT_WIDTH);
|
||||||
textSize.x += BUTTON_TEXT_GAP;
|
textSize.x += BUTTON_TEXT_GAP;
|
||||||
|
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + CONTAINER_X + BOTTOM_X_GAP), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(CONTAINER_X + BOTTOM_X_GAP), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
||||||
ImVec2 max = { Scale(g_aspectRatioOffsetX + CONTAINER_X + BOTTOM_X_GAP + textSize.x * squashRatio), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
ImVec2 max = { g_aspectRatioOffsetX + Scale(CONTAINER_X + BOTTOM_X_GAP + textSize.x * squashRatio), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
||||||
DrawButton(min, max, addFilesText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
|
DrawButton(min, max, addFilesText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
|
||||||
if (buttonPressed)
|
if (buttonPressed)
|
||||||
{
|
{
|
||||||
|
|
@ -1232,8 +1232,8 @@ static void DrawNextButton()
|
||||||
ImVec2 textSize = ComputeTextSize(g_newRodinFont, buttonText.c_str(), 20.0f, squashRatio, NEXT_BUTTON_MAX_TEXT_WIDTH);
|
ImVec2 textSize = ComputeTextSize(g_newRodinFont, buttonText.c_str(), 20.0f, squashRatio, NEXT_BUTTON_MAX_TEXT_WIDTH);
|
||||||
textSize.x += BUTTON_TEXT_GAP;
|
textSize.x += BUTTON_TEXT_GAP;
|
||||||
|
|
||||||
ImVec2 min = { Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH - textSize.x * squashRatio - BOTTOM_X_GAP), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
ImVec2 min = { g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH - textSize.x * squashRatio - BOTTOM_X_GAP), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP) };
|
||||||
ImVec2 max = { Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH - BOTTOM_X_GAP), Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
ImVec2 max = { g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH - BOTTOM_X_GAP), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
|
||||||
|
|
||||||
bool buttonPressed = false;
|
bool buttonPressed = false;
|
||||||
DrawButton(min, max, buttonText.c_str(), false, nextButtonEnabled, buttonPressed, NEXT_BUTTON_MAX_TEXT_WIDTH);
|
DrawButton(min, max, buttonText.c_str(), false, nextButtonEnabled, buttonPressed, NEXT_BUTTON_MAX_TEXT_WIDTH);
|
||||||
|
|
@ -1318,10 +1318,10 @@ static void DrawHorizontalBorder(bool bottomBorder)
|
||||||
const uint32_t FADE_COLOR_RIGHT = IM_COL32(155, 225, 155, 0);
|
const uint32_t FADE_COLOR_RIGHT = IM_COL32(155, 225, 155, 0);
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
double borderScale = 1.0 - ComputeMotionInstaller(g_appearTime, g_disappearTime, CONTAINER_LINE_ANIMATION_TIME, CONTAINER_LINE_ANIMATION_DURATION);
|
double borderScale = 1.0 - ComputeMotionInstaller(g_appearTime, g_disappearTime, CONTAINER_LINE_ANIMATION_TIME, CONTAINER_LINE_ANIMATION_DURATION);
|
||||||
float midX = Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH / 5);
|
float midX = g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH / 5);
|
||||||
float minX = std::lerp(Scale(g_aspectRatioOffsetX + CONTAINER_X - BORDER_SIZE - BORDER_OVERSHOOT), midX, borderScale);
|
float minX = std::lerp(g_aspectRatioOffsetX + Scale(CONTAINER_X - BORDER_SIZE - BORDER_OVERSHOOT), midX, borderScale);
|
||||||
float maxX = std::lerp(Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH + SIDE_CONTAINER_WIDTH + BORDER_OVERSHOOT), midX, borderScale);
|
float maxX = std::lerp(g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH + SIDE_CONTAINER_WIDTH + BORDER_OVERSHOOT), midX, borderScale);
|
||||||
float minY = bottomBorder ? Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT) : Scale(g_aspectRatioOffsetY + CONTAINER_Y - BORDER_SIZE);
|
float minY = g_aspectRatioOffsetY + (bottomBorder ? Scale(CONTAINER_Y + CONTAINER_HEIGHT) : Scale(CONTAINER_Y - BORDER_SIZE));
|
||||||
float maxY = minY + Scale(BORDER_SIZE);
|
float maxY = minY + Scale(BORDER_SIZE);
|
||||||
drawList->AddRectFilledMultiColor
|
drawList->AddRectFilledMultiColor
|
||||||
(
|
(
|
||||||
|
|
@ -1350,11 +1350,11 @@ static void DrawVerticalBorder(bool rightBorder)
|
||||||
const uint32_t FADE_COLOR = IM_COL32(155, rightBorder ? 225 : 155, 155, 0);
|
const uint32_t FADE_COLOR = IM_COL32(155, rightBorder ? 225 : 155, 155, 0);
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
double borderScale = 1.0 - ComputeMotionInstaller(g_appearTime, g_disappearTime, CONTAINER_LINE_ANIMATION_TIME, CONTAINER_LINE_ANIMATION_DURATION);
|
double borderScale = 1.0 - ComputeMotionInstaller(g_appearTime, g_disappearTime, CONTAINER_LINE_ANIMATION_TIME, CONTAINER_LINE_ANIMATION_DURATION);
|
||||||
float minX = rightBorder ? Scale(g_aspectRatioOffsetX + CONTAINER_X + CONTAINER_WIDTH) : Scale(g_aspectRatioOffsetX + CONTAINER_X - BORDER_SIZE);
|
float minX = g_aspectRatioOffsetX + (rightBorder ? Scale(CONTAINER_X + CONTAINER_WIDTH) : Scale(CONTAINER_X - BORDER_SIZE));
|
||||||
float maxX = minX + Scale(BORDER_SIZE);
|
float maxX = minX + Scale(BORDER_SIZE);
|
||||||
float midY = Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT / 2);
|
float midY = g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT / 2);
|
||||||
float minY = std::lerp(Scale(g_aspectRatioOffsetY + CONTAINER_Y - BORDER_OVERSHOOT), midY, borderScale);
|
float minY = std::lerp(g_aspectRatioOffsetY + Scale(CONTAINER_Y - BORDER_OVERSHOOT), midY, borderScale);
|
||||||
float maxY = std::lerp(Scale(g_aspectRatioOffsetY + CONTAINER_Y + CONTAINER_HEIGHT + BORDER_OVERSHOOT), midY, borderScale);
|
float maxY = std::lerp(g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT + BORDER_OVERSHOOT), midY, borderScale);
|
||||||
drawList->AddRectFilledMultiColor
|
drawList->AddRectFilledMultiColor
|
||||||
(
|
(
|
||||||
{ minX, minY },
|
{ minX, minY },
|
||||||
|
|
|
||||||
|
|
@ -161,14 +161,14 @@ static void DrawScanlineBars()
|
||||||
if (g_aspectRatio >= WIDE_ASPECT_RATIO)
|
if (g_aspectRatio >= WIDE_ASPECT_RATIO)
|
||||||
optionsX = g_aspectRatioOffsetX;
|
optionsX = g_aspectRatioOffsetX;
|
||||||
else
|
else
|
||||||
optionsX = (1.0f - g_narrowOffsetScale) * -20.0f;
|
optionsX = (1.0f - g_aspectRatioNarrowScale) * g_aspectRatioScale * -20.0f;
|
||||||
|
|
||||||
// Options text
|
// Options text
|
||||||
DrawTextWithOutline
|
DrawTextWithOutline
|
||||||
(
|
(
|
||||||
g_dfsogeistdFont,
|
g_dfsogeistdFont,
|
||||||
Scale(48.0f),
|
Scale(48.0f),
|
||||||
{ Scale(optionsX + 122.0f), Scale(56.0f) },
|
{ optionsX + Scale(122.0f), Scale(56.0f) },
|
||||||
IM_COL32(255, 190, 33, 255),
|
IM_COL32(255, 190, 33, 255),
|
||||||
Localise("Options_Header_Name").c_str(),
|
Localise("Options_Header_Name").c_str(),
|
||||||
4,
|
4,
|
||||||
|
|
@ -322,7 +322,7 @@ static bool DrawCategories()
|
||||||
constexpr float WIDE_PADDING_GRID_COUNT = 3.0f;
|
constexpr float WIDE_PADDING_GRID_COUNT = 3.0f;
|
||||||
|
|
||||||
float gridSize = Scale(GRID_SIZE);
|
float gridSize = Scale(GRID_SIZE);
|
||||||
float textPadding = gridSize * Lerp(NARROW_PADDING_GRID_COUNT, WIDE_PADDING_GRID_COUNT, g_narrowOffsetScale);
|
float textPadding = gridSize * Lerp(NARROW_PADDING_GRID_COUNT, WIDE_PADDING_GRID_COUNT, g_aspectRatioNarrowScale);
|
||||||
float tabPadding = gridSize;
|
float tabPadding = gridSize;
|
||||||
|
|
||||||
float size = Scale(32.0f);
|
float size = Scale(32.0f);
|
||||||
|
|
@ -468,7 +468,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
constexpr float OPTION_WIDE_GRID_COUNT = 54.0f;
|
constexpr float OPTION_WIDE_GRID_COUNT = 54.0f;
|
||||||
|
|
||||||
auto gridSize = Scale(GRID_SIZE);
|
auto gridSize = Scale(GRID_SIZE);
|
||||||
auto optionWidth = gridSize * floor(Lerp(OPTION_NARROW_GRID_COUNT, OPTION_WIDE_GRID_COUNT, g_narrowOffsetScale));
|
auto optionWidth = gridSize * floor(Lerp(OPTION_NARROW_GRID_COUNT, OPTION_WIDE_GRID_COUNT, g_aspectRatioNarrowScale));
|
||||||
auto optionHeight = gridSize * 5.5f;
|
auto optionHeight = gridSize * 5.5f;
|
||||||
auto optionPadding = gridSize * 0.5f;
|
auto optionPadding = gridSize * 0.5f;
|
||||||
auto valueWidth = Scale(192.0f);
|
auto valueWidth = Scale(192.0f);
|
||||||
|
|
@ -1220,23 +1220,23 @@ void OptionsMenu::Draw()
|
||||||
|
|
||||||
DrawScanlineBars();
|
DrawScanlineBars();
|
||||||
|
|
||||||
float settingsGridCount = floor(Lerp(SETTINGS_NARROW_GRID_COUNT, SETTINGS_WIDE_GRID_COUNT, g_narrowOffsetScale));
|
float settingsGridCount = floor(Lerp(SETTINGS_NARROW_GRID_COUNT, SETTINGS_WIDE_GRID_COUNT, g_aspectRatioNarrowScale));
|
||||||
float paddingGridCount = Lerp(PADDING_NARROW_GRID_COUNT, PADDING_WIDE_GRID_COUNT, g_narrowOffsetScale);
|
float paddingGridCount = Lerp(PADDING_NARROW_GRID_COUNT, PADDING_WIDE_GRID_COUNT, g_aspectRatioNarrowScale);
|
||||||
float infoGridCount = floor(Lerp(INFO_NARROW_GRID_COUNT, INFO_WIDE_GRID_COUNT, g_narrowOffsetScale));
|
float infoGridCount = floor(Lerp(INFO_NARROW_GRID_COUNT, INFO_WIDE_GRID_COUNT, g_aspectRatioNarrowScale));
|
||||||
float totalGridCount = settingsGridCount + paddingGridCount + infoGridCount;
|
float totalGridCount = settingsGridCount + paddingGridCount + infoGridCount;
|
||||||
|
|
||||||
float offsetX = g_aspectRatioOffsetX + (1280.0f - ((GRID_SIZE * totalGridCount) - 1)) / 2.0f;
|
float offsetX = (1280.0f - ((GRID_SIZE * totalGridCount) - 1)) / 2.0f;
|
||||||
float minY = Scale(g_aspectRatioOffsetY + CONTAINER_POS_Y);
|
float minY = g_aspectRatioOffsetY + Scale(CONTAINER_POS_Y);
|
||||||
float maxY = Scale(g_aspectRatioOffsetY + (720.0f - CONTAINER_POS_Y + 1.0f));
|
float maxY = g_aspectRatioOffsetY + Scale((720.0f - CONTAINER_POS_Y + 1.0f));
|
||||||
|
|
||||||
DrawSettingsPanel(
|
DrawSettingsPanel(
|
||||||
{ Scale(offsetX), minY },
|
{ g_aspectRatioOffsetX + Scale(offsetX), minY },
|
||||||
{ Scale(offsetX + settingsGridCount * GRID_SIZE), maxY }
|
{ g_aspectRatioOffsetX + Scale(offsetX + settingsGridCount * GRID_SIZE), maxY }
|
||||||
);
|
);
|
||||||
|
|
||||||
DrawInfoPanel(
|
DrawInfoPanel(
|
||||||
{ Scale(offsetX + (settingsGridCount + paddingGridCount) * GRID_SIZE), minY },
|
{ g_aspectRatioOffsetX + Scale(offsetX + (settingsGridCount + paddingGridCount) * GRID_SIZE), minY },
|
||||||
{ Scale(offsetX + totalGridCount * GRID_SIZE), maxY }
|
{ g_aspectRatioOffsetX + Scale(offsetX + totalGridCount * GRID_SIZE), maxY }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (g_isStage)
|
if (g_isStage)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue