diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index aca9da9a6..a83dd90c8 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -8,6 +8,7 @@ #include "Runtime/Graphics/CGX.hpp" #include +#include namespace metaforce { CGraphics::CProjectionState CGraphics::g_Proj; @@ -190,12 +191,21 @@ void CGraphics::Render2D(CTexture& tex, u32 x, u32 y, u32 w, u32 h, const zeus:: const auto oldProj = g_Proj; const auto oldCull = g_cullMode; const auto oldLights = g_LightActive; - SetOrtho(-g_Viewport.x10_halfWidth, g_Viewport.x10_halfWidth, g_Viewport.x14_halfHeight, -g_Viewport.x14_halfHeight, - -1.f, -10.f); + SetOrtho(-g_Viewport.x8_width / 2, g_Viewport.x8_width / 2, g_Viewport.xc_height / 2, -g_Viewport.xc_height / 2, -1.f, + -10.f); GXLoadPosMtxImm(&zeus::skIdentityMatrix4f, GX_PNMTX0); - DisableAllLights(); + GXVtxDescList desc[] = { + {GX_VA_POS, GX_DIRECT}, + {GX_VA_CLR0, GX_DIRECT}, + {GX_VA_TEX0, GX_DIRECT}, + {GX_VA_NULL, GX_NONE}, + }; + CGX::SetVtxDescv(desc); + SetTevStates(6); + if (g_LightActive.any()) { + DisableAllLights(); + } SetCullMode(ERglCullMode::None); - tex.Load(GX_TEXMAP0, EClampMode::Repeat); // float hPad, vPad; // if (CGraphics::GetViewportAspect() >= 1.78f) { @@ -211,23 +221,32 @@ void CGraphics::Render2D(CTexture& tex, u32 x, u32 y, u32 w, u32 h, const zeus:: float scaledW = static_cast(w) / 640.f * static_cast(g_Viewport.x8_width); float scaledH = static_cast(h) / 448.f * static_cast(g_Viewport.xc_height); - float x1 = scaledX - g_Viewport.x10_halfWidth; - float y1 = scaledY - g_Viewport.x14_halfHeight; + float x1 = scaledX - (g_Viewport.x8_width / 2); + float y1 = scaledY - (g_Viewport.xc_height / 2); float x2 = x1 + scaledW; float y2 = y1 + scaledH; - StreamBegin(GX_TRIANGLESTRIP); - StreamColor(col); - StreamTexcoord(0.f, 0.f); - StreamVertex(x1, y1, 1.f); - StreamTexcoord(1.f, 0.f); - StreamVertex(x2, y1, 1.f); - StreamTexcoord(0.f, 1.f); - StreamVertex(x1, y2, 1.f); - StreamTexcoord(1.f, 1.f); - StreamVertex(x2, y2, 1.f); - StreamEnd(); - SetLightState(g_LightActive); + tex.Load(GX_TEXMAP0, EClampMode::Repeat); + CGX::Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4); + { + GXPosition3f32(x1, y1, 1.f); + GXColor4f32(col.r(), col.g(), col.b(), col.a()); + GXTexCoord2f32(0.f, 0.f); + GXPosition3f32(x2, y1, 1.f); + GXColor4f32(col.r(), col.g(), col.b(), col.a()); + GXTexCoord2f32(1.f, 0.f); + GXPosition3f32(x1, y2, 1.f); + GXColor4f32(col.r(), col.g(), col.b(), col.a()); + GXTexCoord2f32(0.f, 1.f); + GXPosition3f32(x2, y2, 1.f); + GXColor4f32(col.r(), col.g(), col.b(), col.a()); + GXTexCoord2f32(1.f, 1.f); + } + CGX::End(); + + if (oldLights.any()) { + SetLightState(oldLights); + } g_Proj = oldProj; FlushProjection(); SetModelMatrix({}); diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index 1486a1de4..5f931d665 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -1,4 +1,5 @@ #include +#include #define IM_VEC2_CLASS_EXTRA \ ImVec2(const zeus::CVector2f& v) { \ x = v.x(); \ @@ -21,6 +22,7 @@ #include #include #include +#include #include namespace ImGui { @@ -146,7 +148,7 @@ static void Warp(const CAssetId worldId, TAreaId aId) { } } -static inline float GetScale() { return ImGui::GetIO().DisplayFramebufferScale.x; } +static inline float GetScale() { return ImGui::GetCurrentContext()->CurrentDpiScale; } void ImGuiConsole::ShowMenuGame() { if (g_Main != nullptr) { @@ -815,13 +817,26 @@ static std::string BytesToString(size_t bytes) { } void ImGuiConsole::ShowDebugOverlay() { - if (!m_developer && !m_frameCounter && !m_frameRate && !m_inGameTime && !m_roomTimer) { - return; - } - if (!m_playerInfo && !m_areaInfo && !m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo && - !m_drawCallInfo && !m_bufferInfo) { + const std::array flags{ + m_frameCounter && (g_StateManager != nullptr), + m_frameRate, + m_inGameTime && (g_StateManager != nullptr), + m_roomTimer && (g_StateManager != nullptr), + m_playerInfo && (g_StateManager != nullptr) && (g_StateManager->Player() != nullptr), + m_worldInfo && (g_StateManager != nullptr) && m_developer, + m_areaInfo && (g_StateManager != nullptr) && m_developer, + m_layerInfo && (g_StateManager != nullptr) && m_developer, + m_randomStats && m_developer, + m_drawCallInfo && m_developer, + m_bufferInfo && m_developer, + m_pipelineInfo && m_developer, + m_resourceStats && (g_SimplePool != nullptr), + }; + + if (std::ranges::all_of(flags, [](const bool v) { return !v; })) { return; } + ImGuiIO& io = ImGui::GetIO(); ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav; diff --git a/Runtime/MP1/CSaveGameScreen.cpp b/Runtime/MP1/CSaveGameScreen.cpp index 0e5ca888f..4d74cc2ba 100644 --- a/Runtime/MP1/CSaveGameScreen.cpp +++ b/Runtime/MP1/CSaveGameScreen.cpp @@ -109,7 +109,7 @@ bool CSaveGameScreen::PumpLoad() { } x50_loadedFrame = x44_frmeGenericMenu.GetObj(); - x50_loadedFrame->SetAspectConstraint(1.78f); + x50_loadedFrame->SetAspectConstraint(1.33f); x54_textpane_message = static_cast(x50_loadedFrame->FindWidget("textpane_message")); x58_tablegroup_choices = static_cast(x50_loadedFrame->FindWidget("tablegroup_choices")); x5c_textpane_choice0 = static_cast(x50_loadedFrame->FindWidget("textpane_choice0")); diff --git a/extern/aurora b/extern/aurora index 37ae1bf9b..3b56e337c 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit 37ae1bf9b59e80b94a1472bcdb8627f2064d7c1d +Subproject commit 3b56e337c08a1dd4946c226298011364c319c7a2