2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 15:51: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 "Runtime/Graphics/CGX.hpp"
#include <zeus/Math.hpp> #include <zeus/Math.hpp>
#include <dolphin/gx.h>
namespace metaforce { namespace metaforce {
CGraphics::CProjectionState CGraphics::g_Proj; 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 oldProj = g_Proj;
const auto oldCull = g_cullMode; const auto oldCull = g_cullMode;
const auto oldLights = g_LightActive; const auto oldLights = g_LightActive;
SetOrtho(-g_Viewport.x10_halfWidth, g_Viewport.x10_halfWidth, g_Viewport.x14_halfHeight, -g_Viewport.x14_halfHeight, SetOrtho(-g_Viewport.x8_width / 2, g_Viewport.x8_width / 2, g_Viewport.xc_height / 2, -g_Viewport.xc_height / 2, -1.f,
-1.f, -10.f); -10.f);
GXLoadPosMtxImm(&zeus::skIdentityMatrix4f, GX_PNMTX0); GXLoadPosMtxImm(&zeus::skIdentityMatrix4f, GX_PNMTX0);
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(); DisableAllLights();
}
SetCullMode(ERglCullMode::None); SetCullMode(ERglCullMode::None);
tex.Load(GX_TEXMAP0, EClampMode::Repeat);
// float hPad, vPad; // float hPad, vPad;
// if (CGraphics::GetViewportAspect() >= 1.78f) { // 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 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 scaledH = static_cast<float>(h) / 448.f * static_cast<float>(g_Viewport.xc_height);
float x1 = scaledX - g_Viewport.x10_halfWidth; float x1 = scaledX - (g_Viewport.x8_width / 2);
float y1 = scaledY - g_Viewport.x14_halfHeight; float y1 = scaledY - (g_Viewport.xc_height / 2);
float x2 = x1 + scaledW; float x2 = x1 + scaledW;
float y2 = y1 + scaledH; 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; g_Proj = oldProj;
FlushProjection(); FlushProjection();
SetModelMatrix({}); SetModelMatrix({});

View File

@ -1,4 +1,5 @@
#include <zeus/CVector2f.hpp> #include <zeus/CVector2f.hpp>
#include <ranges>
#define IM_VEC2_CLASS_EXTRA \ #define IM_VEC2_CLASS_EXTRA \
ImVec2(const zeus::CVector2f& v) { \ ImVec2(const zeus::CVector2f& v) { \
x = v.x(); \ x = v.x(); \
@ -21,6 +22,7 @@
#include <SDL3/SDL_dialog.h> #include <SDL3/SDL_dialog.h>
#include <SDL3/SDL_error.h> #include <SDL3/SDL_error.h>
#include <magic_enum.hpp> #include <magic_enum.hpp>
#include <build/linux-default-relwithdebinfo/_deps/imgui-src/imgui_internal.h>
#include <zeus/CEulerAngles.hpp> #include <zeus/CEulerAngles.hpp>
namespace ImGui { 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() { void ImGuiConsole::ShowMenuGame() {
if (g_Main != nullptr) { if (g_Main != nullptr) {
@ -815,13 +817,26 @@ static std::string BytesToString(size_t bytes) {
} }
void ImGuiConsole::ShowDebugOverlay() { void ImGuiConsole::ShowDebugOverlay() {
if (!m_developer && !m_frameCounter && !m_frameRate && !m_inGameTime && !m_roomTimer) { const std::array flags{
return; m_frameCounter && (g_StateManager != nullptr),
} m_frameRate,
if (!m_playerInfo && !m_areaInfo && !m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo && m_inGameTime && (g_StateManager != nullptr),
!m_drawCallInfo && !m_bufferInfo) { 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; return;
} }
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav; ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;

View File

@ -109,7 +109,7 @@ bool CSaveGameScreen::PumpLoad() {
} }
x50_loadedFrame = x44_frmeGenericMenu.GetObj(); 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")); x54_textpane_message = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_message"));
x58_tablegroup_choices = static_cast<CGuiTableGroup*>(x50_loadedFrame->FindWidget("tablegroup_choices")); x58_tablegroup_choices = static_cast<CGuiTableGroup*>(x50_loadedFrame->FindWidget("tablegroup_choices"));
x5c_textpane_choice0 = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_choice0")); x5c_textpane_choice0 = static_cast<CGuiTextPane*>(x50_loadedFrame->FindWidget("textpane_choice0"));

2
extern/aurora vendored

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