Skip to content

Commit

Permalink
fix PC build, fix scripts not loading properly on android rsdks
Browse files Browse the repository at this point in the history
  • Loading branch information
SaturnSH2x2 committed Aug 20, 2021
1 parent 68cff59 commit dd46a7f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion RSDKv3/3ds/3ds-theoraplayer
2 changes: 1 addition & 1 deletion RSDKv3/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ size_t readVorbis(void *mem, size_t size, size_t nmemb, void *ptr)
}

MusicPlaybackInfo *info = (MusicPlaybackInfo *)ptr;
return FileRead2(&info->fileInfo, mem, (int)(size * nmemb));
return FileRead2(&info->fileInfo, mem, (int)(size * nmemb), true);
}
int seekVorbis(void *ptr, ogg_int64_t offset, int whence)
{
Expand Down
15 changes: 10 additions & 5 deletions RSDKv3/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,26 +266,27 @@ void RenderRenderDevice()
SDL_Rect destScreenPos_scaled;
SDL_Texture *texTarget = NULL;
// allows me to disable it to prevent blur on resolutions that match only on 1 axis
bool tmpEnhancedScaling = Engine.enhancedScaling;
//bool tmpEnhancedScaling = Engine.enhancedScaling;
SDL_GetWindowSize(Engine.window, &Engine.windowXSize, &Engine.windowYSize);
float screenxsize = SCREEN_XSIZE;
float screenysize = SCREEN_YSIZE;
// check if enhanced scaling is even necessary to be calculated by checking if the screen size is close enough on one axis
// unfortunately it has to be "close enough" because of floating point precision errors. dang it
/*
if (tmpEnhancedScaling) {
bool cond1 = (std::round((Engine.windowXSize / screenxsize) * 24) / 24 == std::floor(Engine.windowXSize / screenxsize)) ? true : false;
bool cond2 = (std::round((Engine.windowYSize / screenysize) * 24) / 24 == std::floor(Engine.windowYSize / screenysize)) ? true : false;
if (cond1 || cond2)
tmpEnhancedScaling = false;
}

*/
// get 2x resolution if HQ is enabled.
if (drawStageGFXHQ) {
screenxsize *= 2;
screenysize *= 2;
}

if (!tmpEnhancedScaling) {
// if (!tmpEnhancedScaling) {
// everything here remains the same except for assinging the rect to the switching pointer.
// the pointer has to be NULL when using enhanced scaling, or else the screen will be black.
SDL_Rect destScreenPosRect;
Expand All @@ -308,7 +309,8 @@ void RenderRenderDevice()
destScreenPosRect.h = videoH;
}
destScreenPos = &destScreenPosRect;
}
}
/*
}
else {
// set up integer scaled texture, which is scaled to the largest integer scale of the screen buffer
Expand All @@ -335,6 +337,7 @@ void RenderRenderDevice()
// fill the screen with the texture, making lerp work.
SDL_RenderSetLogicalSize(Engine.renderer, Engine.windowXSize, Engine.windowYSize);
}
*/
#endif

int pitch = 0;
Expand Down Expand Up @@ -476,6 +479,7 @@ void RenderRenderDevice()
}

#if RETRO_USING_SDL2
/*
if (tmpEnhancedScaling) {
// set render target back to the screen.
SDL_SetRenderTarget(Engine.renderer, NULL);
Expand All @@ -492,9 +496,10 @@ void RenderRenderDevice()
SDL_DestroyTexture(texTarget);
}
else {
*/
// no change here
SDL_RenderPresent(Engine.renderer);
}
//}
#endif
#if RETRO_USING_SDL1
ushort *px = (ushort *)Engine.screenBuffer->pixels;
Expand Down
1 change: 1 addition & 0 deletions RSDKv3/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ bool LoadFile2(const char *filePath, FileInfo *fileInfo)
addPath = false;
std::string fStr = std::string(filePathBuf);
fStr.erase(fStr.begin(), fStr.begin() + 5); // remove "Data/"
fStr.insert(0, BASE_PATH);
StrCopy(filePathBuf, fStr.c_str());
}
}
Expand Down
2 changes: 1 addition & 1 deletion RSDKv3/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void LoadStageFiles(void)
#if RETRO_USE_MOD_LOADER
char scriptPath[0x40];
if (Engine.bytecodeMode == BYTECODE_MOBILE)
StrCopy(scriptPath, "Bytecode/GlobalCode.bin");
StrCopy(scriptPath, "Data/Scripts/ByteCode/GlobalCode.bin");
else
StrCopy(scriptPath, "Data/Scripts/ByteCode/GS000.bin");

Expand Down
10 changes: 6 additions & 4 deletions RSDKv3/Userdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,16 @@ void InitUserdata()
if (!ini->GetInteger("Controller 1", "Start", &inputDevice[INPUT_START].contMappings))
inputDevice[7].contMappings = SDL_CONTROLLER_BUTTON_START;

if (!ini.GetFloat("Controller 1", "LStickDeadzone", &LSTICK_DEADZONE))
/*
if (!ini->GetFloat("Controller 1", "LStickDeadzone", &LSTICK_DEADZONE))
LSTICK_DEADZONE = 0.3;
if (!ini.GetFloat("Controller 1", "RStickDeadzone", &RSTICK_DEADZONE))
if (!ini->GetFloat("Controller 1", "RStickDeadzone", &RSTICK_DEADZONE))
RSTICK_DEADZONE = 0.3;
if (!ini.GetFloat("Controller 1", "LTriggerDeadzone", &LTRIGGER_DEADZONE))
if (!ini->GetFloat("Controller 1", "LTriggerDeadzone", &LTRIGGER_DEADZONE))
LTRIGGER_DEADZONE = 0.3;
if (!ini.GetFloat("Controller 1", "RTriggerDeadzone", &RTRIGGER_DEADZONE))
if (!ini->GetFloat("Controller 1", "RTriggerDeadzone", &RTRIGGER_DEADZONE))
RTRIGGER_DEADZONE = 0.3;
*/
#endif

#if RETRO_USING_SDL1
Expand Down
4 changes: 2 additions & 2 deletions RSDKv3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void awaitInput() {
int main(int argc, char *argv[])
{
#if RETRO_PLATFORM == RETRO_3DS
#if RETRO_RENDERTYPE == RETRO_SW_RENDER
#if RETRO_RENDERTYPE == RETRO_SW_RENDER && RETRO_PLATFORM == RETRO_3DS
osSetSpeedupEnable(true);
#endif

Expand Down Expand Up @@ -53,7 +53,7 @@ int main(int argc, char *argv[])
#endif


#if RETRO_RENDERTYPE == RETRO_SW_RENDER
#if RETRO_RENDERTYPE == RETRO_SW_RENDER && RETRO_PLATFORM == RETRO_3DS
osSetSpeedupEnable(false);
#endif

Expand Down

0 comments on commit dd46a7f

Please sign in to comment.