From faa292123ae39702c7fcd180d85f79d9bad13cc5 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:24:36 +0300 Subject: [PATCH] Update spacing for default font & pixel snap 2D primitives. --- UnleashedRecomp/gpu/imgui/imgui_font_builder.cpp | 9 ++++++++- UnleashedRecomp/patches/aspect_ratio_patches.cpp | 7 ++++--- UnleashedRecompResources | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/UnleashedRecomp/gpu/imgui/imgui_font_builder.cpp b/UnleashedRecomp/gpu/imgui/imgui_font_builder.cpp index 73710155..5d07ab01 100644 --- a/UnleashedRecomp/gpu/imgui/imgui_font_builder.cpp +++ b/UnleashedRecomp/gpu/imgui/imgui_font_builder.cpp @@ -221,6 +221,8 @@ static bool FontBuilder_Build(ImFontAtlas* atlas) for (size_t i = 0; i < atlas->ConfigData.size(); i++) { auto& config = atlas->ConfigData[i]; + bool increaseSpacing = strstr(config.Name, "Seurat") != nullptr; + auto& [index, count] = ranges[i]; for (size_t j = 0; j < count; j++) { @@ -228,6 +230,11 @@ static bool FontBuilder_Build(ImFontAtlas* atlas) double x0, y0, x1, y1, u0, v0, u1, v1; glyph.getQuadPlaneBounds(x0, y0, x1, y1); glyph.getQuadAtlasBounds(u0, v0, u1, v1); + + double advance = glyph.getAdvance(); + if (increaseSpacing && glyph.getCodepoint() == ' ') + advance *= 1.5; + config.DstFont->AddGlyph( &config, glyph.getCodepoint(), @@ -239,7 +246,7 @@ static bool FontBuilder_Build(ImFontAtlas* atlas) v1 / packer.height, u1 / packer.width, v0 / packer.height, - glyph.getAdvance()); + advance); } config.DstFont->BuildLookupTable(); diff --git a/UnleashedRecomp/patches/aspect_ratio_patches.cpp b/UnleashedRecomp/patches/aspect_ratio_patches.cpp index a830b43c..2cfe69c7 100644 --- a/UnleashedRecomp/patches/aspect_ratio_patches.cpp +++ b/UnleashedRecomp/patches/aspect_ratio_patches.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "aspect_ratio_patches.h" #include "camera_patches.h" @@ -348,7 +349,7 @@ struct CsdModifier uint32_t cornerIndex{}; }; -static const ankerl::unordered_dense::map g_modifiers = +static const xxHashMap g_modifiers = { // ui_balloon { HashStr("ui_balloon/window/bg"), { STRETCH } }, @@ -1147,8 +1148,8 @@ PPC_FUNC(sub_830D1EF0) y = g_aspectRatioOffsetY + (y + 0.5f) * g_aspectRatioScale; } - vertex[i].x = ((x - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f; - vertex[i].y = ((y - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f; + vertex[i].x = ((round(x) - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f; + vertex[i].y = ((round(y) - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f; } bool letterboxTop = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x1); diff --git a/UnleashedRecompResources b/UnleashedRecompResources index 2d135d17..1d2ae6b5 160000 --- a/UnleashedRecompResources +++ b/UnleashedRecompResources @@ -1 +1 @@ -Subproject commit 2d135d175dfbedd84d78fb846bcc7de4a859f8ef +Subproject commit 1d2ae6b5f7fd5805e59465e66953bbd8066e75dd