2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 09:11:22 +00:00

Minor fixes, cleanup ImGuiConsole, update aurora

This commit is contained in:
Phillip Stephens 2025-04-10 13:36:44 -07:00
parent 8a046832eb
commit a06f24bfc3
4 changed files with 60 additions and 26 deletions

View File

@ -8,6 +8,7 @@
#include "Runtime/Graphics/CGX.hpp"
#include <zeus/Math.hpp>
#include <dolphin/gx.h>
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<float>(w) / 640.f * static_cast<float>(g_Viewport.x8_width);
float scaledH = static_cast<float>(h) / 448.f * static_cast<float>(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({});

View File

@ -1,4 +1,5 @@
#include <zeus/CVector2f.hpp>
#include <ranges>
#define IM_VEC2_CLASS_EXTRA \
ImVec2(const zeus::CVector2f& v) { \
x = v.x(); \
@ -21,6 +22,7 @@
#include <SDL3/SDL_dialog.h>
#include <SDL3/SDL_error.h>
#include <magic_enum.hpp>
#include <build/linux-default-relwithdebinfo/_deps/imgui-src/imgui_internal.h>
#include <zeus/CEulerAngles.hpp>
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;

View File

@ -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<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_message"));
x58_tablegroup_choices = static_cast<CGuiTableGroup*>(x50_loadedFrame->FindWidget("tablegroup_choices"));
x5c_textpane_choice0 = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_choice0"));

2
extern/aurora vendored

@ -1 +1 @@
Subproject commit 37ae1bf9b59e80b94a1472bcdb8627f2064d7c1d
Subproject commit 3b56e337c08a1dd4946c226298011364c319c7a2