diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-05-15 15:25:18 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-15 15:25:18 -0600 |
| commit | 7cc9894aa12175f10ad91174cff41ef1701df166 (patch) | |
| tree | 8a24f90b69a06ed36d5aa8e53a003ae4f0f8aaa6 /src/port/Engine.cpp | |
| parent | e7415ec072ee1cdc99a49db658062d4de0b3301c (diff) | |
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>
Diffstat (limited to 'src/port/Engine.cpp')
| -rw-r--r-- | src/port/Engine.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
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<Fast::Interpreter> GameEngine::mInterpreter; - -std::shared_ptr<Fast::Interpreter> GameEngine::GetInterpreter() { - auto intP = mInterpreter.lock(); - if (!intP) { - assert(false && "Lost reference to Fast::Interpreter"); - } - return intP; +Fast::Interpreter* GetInterpreter() { + return static_pointer_cast<Fast::Fast3dWindow>(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 |
