From 7cc9894aa12175f10ad91174cff41ef1701df166 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Thu, 15 May 2025 15:25:18 -0600 Subject: Fix compile (#199) * Fixes made so far * Fixes up until linking * Moved GetInterpreter() to a single function under the Engine.h * Updated shader files included with assets, added exception for Linux for including SDL2_net * Removed osSetTime stub(for now) * Adjustments to get it to compile + run * Decoupled GetInterpreter() from the GameEngine Class, corrected a invalid include in SpaghettiGui.cpp --------- Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> --- src/port/Engine.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/port/Engine.cpp') diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 440363efa..788af51ab 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -49,14 +49,11 @@ float gInterpolationStep = 0.0f; #include "audio/GameAudio.h" } -std::weak_ptr GameEngine::mInterpreter; - -std::shared_ptr GameEngine::GetInterpreter() { - auto intP = mInterpreter.lock(); - if (!intP) { - assert(false && "Lost reference to Fast::Interpreter"); - } - return intP; +Fast::Interpreter* GetInterpreter() { + return static_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock() + .get(); } GameEngine* GameEngine::Instance; @@ -543,7 +540,7 @@ extern "C" void GameEngine_UnloadSequence(const uint8_t seqId) { } extern "C" float GameEngine_GetAspectRatio() { - auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; + auto gfx_current_dimensions = GetInterpreter()->mCurDimensions; return gfx_current_dimensions.aspect_ratio; } @@ -617,8 +614,7 @@ extern "C" void Timer_SetValue(int32_t* address, int32_t value) { // } extern "C" float OTRGetAspectRatio() { - auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; - return gfx_current_dimensions.aspect_ratio; + return GetInterpreter()->mCurDimensions.aspect_ratio; } extern "C" float OTRGetDimensionFromLeftEdge(float v) { @@ -661,22 +657,18 @@ extern "C" uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center) { // Gets the width of the current render target area extern "C" uint32_t OTRGetGameRenderWidth() { - auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; - return gfx_current_dimensions.width; + return GetInterpreter()->mCurDimensions.width; } // Gets the height of the current render target area extern "C" uint32_t OTRGetGameRenderHeight() { - auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; - return gfx_current_dimensions.height; + return GetInterpreter()->mCurDimensions.height; } extern "C" uint32_t OTRGetGameViewportWidth() { - auto gfx_current_game_window_viewport = GameEngine::GetInterpreter().get()->mGameWindowViewport; - return gfx_current_game_window_viewport.width; + return GetInterpreter()->mGameWindowViewport.width; } extern "C" uint32_t OTRGetGameViewportHeight() { - auto gfx_current_game_window_viewport = GameEngine::GetInterpreter().get()->mGameWindowViewport; - return gfx_current_game_window_viewport.height; + return GetInterpreter()->mGameWindowViewport.height; } \ No newline at end of file -- cgit v1.2.3