@@ -86,6 +86,7 @@ static LPALCLOOPBACKOPENDEVICESOFT alcLoopbackOpenDeviceSOFT = NULL;
8686static int16_t *sound_buf;
8787static bool retro_framebuffer_supported;
8888static bool shared_state_initialized;
89+ static PHYSFS_File *rgssad = NULL ;
8990
9091static void fallback_log (enum retro_log_level level, const char *fmt, ...) {
9192 std::va_list va;
@@ -169,6 +170,10 @@ static void deinit_sandbox() {
169170 alcCloseDevice (al_device);
170171 al_device = NULL ;
171172 }
173+ if (rgssad != NULL ) {
174+ PHYSFS_close (rgssad);
175+ rgssad = NULL ;
176+ }
172177 fs.reset ();
173178 input.reset ();
174179}
@@ -204,6 +209,15 @@ static bool init_sandbox() {
204209 }
205210
206211 fs->addPath (parsed_game_path.c_str (), " /mkxp-retro-game" );
212+
213+ // TODO: use execName from config instead of hardcoding "Game" as the filename
214+ if ((rgssad = PHYSFS_openRead (" /mkxp-retro-game/Game.rgssad" )) != NULL ) {
215+ PHYSFS_mountHandle (rgssad, " Game.rgssad" , " /mkxp-retro-game" , 1 );
216+ } else if ((rgssad = PHYSFS_openRead (" /mkxp-retro-game/Game.rgss2a" )) != NULL ) {
217+ PHYSFS_mountHandle (rgssad, " Game.rgss2a" , " /mkxp-retro-game" , 1 );
218+ } else if ((rgssad = PHYSFS_openRead (" /mkxp-retro-game/Game.rgss3a" )) != NULL ) {
219+ PHYSFS_mountHandle (rgssad, " Game.rgss3a" , " /mkxp-retro-game" , 1 );
220+ }
207221 }
208222
209223 fs->createPathCache ();
0 commit comments