Skip to content

Commit

Permalink
Store Origins check as a variable
Browse files Browse the repository at this point in the history
Helps to reduce lag on lower-end platforms
  • Loading branch information
MegAmi24 committed Jun 24, 2024
1 parent 3541d09 commit 88e8aba
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion RSDKv4/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ void DrawStageGFX()
#if RETRO_REV03
#if !RETRO_USE_ORIGINAL_CODE
// Hacky fix for Tails Object not working properly in special stages on non-Origins bytecode
if (forceUseScripts || GetGlobalVariableID("game.playMode") != 0xFF)
if (forceUseScripts || Engine.usingOrigins)
#endif
DrawObjectList(7);
#endif
Expand Down
4 changes: 4 additions & 0 deletions RSDKv4/RetroEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,10 @@ bool RetroEngine::LoadGameConfig(const char *filePath)
startList_Game = STAGELIST_BONUS;
startStage_Game = 0xFE;
}

#if RETRO_REV03
Engine.usingOrigins = GetGlobalVariableID("game.playMode") != 0xFF;
#endif
#endif

return loaded;
Expand Down
3 changes: 3 additions & 0 deletions RSDKv4/RetroEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ class RetroEngine
#endif
bool usingDataFile = false;
bool usingBytecode = false;
#if RETRO_REV03 && !RETRO_USE_ORIGINAL_CODE
bool usingOrigins = false;
#endif

char dataFile[RETRO_PACKFILE_COUNT][0x80];

Expand Down
4 changes: 2 additions & 2 deletions RSDKv4/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void ProcessStage(void)
#if RETRO_REV03
#if !RETRO_USE_ORIGINAL_CODE
// Hacky fix for Tails Object not working properly in special stages on non-Origins bytecode
if (forceUseScripts || GetGlobalVariableID("game.playMode") != 0xFF)
if (forceUseScripts || Engine.usingOrigins)
#endif
DrawObjectList(7);
#endif
Expand Down Expand Up @@ -482,7 +482,7 @@ void ProcessStage(void)
#if RETRO_REV03
#if !RETRO_USE_ORIGINAL_CODE
// Hacky fix for Tails Object not working properly in special stages on non-Origins bytecode
if (forceUseScripts || GetGlobalVariableID("game.playMode") != 0xFF)
if (forceUseScripts || Engine.usingOrigins)
#endif
DrawObjectList(7);
#endif
Expand Down
4 changes: 2 additions & 2 deletions RSDKv4/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3392,7 +3392,7 @@ void ProcessScript(int scriptCodeStart, int jumpTableStart, byte scriptEvent)
#if RETRO_REV03 && !RETRO_USE_ORIGINAL_CODE
bool inputCheck = true; // Default to true for mobile bytecode
// If we're using the scripts or an Origins datafile, check the array value
if (forceUseScripts || GetGlobalVariableID("game.playMode") != 0xFF)
if (forceUseScripts || Engine.usingOrigins)
inputCheck = arrayVal <= 1;
#endif

Expand Down Expand Up @@ -5677,7 +5677,7 @@ void ProcessScript(int scriptCodeStart, int jumpTableStart, byte scriptEvent)
#if RETRO_REV03 && !RETRO_USE_ORIGINAL_CODE
bool inputCheck = true; // Default to true for mobile bytecode
// If we're using the scripts or an Origins datafile, check the array value
if (forceUseScripts || GetGlobalVariableID("game.playMode") != 0xFF)
if (forceUseScripts || Engine.usingOrigins)
inputCheck = arrayVal <= 1;
#endif

Expand Down

0 comments on commit 88e8aba

Please sign in to comment.