Skip to content

Commit 8e39ff7

Browse files
committed
Create RetroArch directories if they don't exist in switch-bootstrap builds
This fixes an error that occurs if the user's device doesn't already have RetroArch's directory structure on the SD card.
1 parent 30bd30d commit 8e39ff7

2 files changed

Lines changed: 53 additions & 25 deletions

File tree

libretro/switch-bootstrap/romfs/retroarch/retroarch.cfg

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1+
# Change RetroArch's directories to be in ROMFS,
2+
# except for the save file, save state, screenshot, recording and log directories since those should be writable locations
3+
libretro_directory = "romfs:/retroarch/cores"
4+
libretro_info_path = "romfs:/retroarch/info"
5+
playlist_directory = "romfs:/retroarch/playlists"
6+
cheat_database_path = "romfs:/retroarch/cheats"
7+
system_directory = "romfs:/retroarch/cores/system"
8+
audio_filter_dir = ""
9+
video_shader_dir = "romfs:/retroarch/shaders"
10+
video_filter_dir = "romfs:/retroarch/filters"
11+
input_remapping_directory = "romfs:/retroarch/config/remaps"
12+
core_assets_directory = "romfs:/retroarch/downloads"
13+
assets_directory = "romfs:/retroarch/assets"
14+
dynamic_wallpapers_directory = ""
15+
thumbnails_directory = "romfs:/retroarch/thumbnails"
16+
runtime_log_directory = ""
17+
joypad_autoconfig_dir = "romfs:/retroarch/autoconfig"
18+
savefile_directory = "default"
19+
savestate_directory = "default"
20+
screenshot_directory = "default"
21+
recording_output_directory = "default"
22+
recording_config_directory = "romfs:/retroarch/records_config"
23+
content_database_path = "romfs:/retroarch/database/rdb"
24+
content_favorites_path = "romfs:/retroarch/playlists/builtin/content_favorites.lpl"
25+
content_history_path = "romfs:/retroarch/playlists/builtin/content_history.lpl"
26+
content_image_history_path = "romfs:/retroarch/playlists/builtin/content_image_history.lpl"
27+
content_music_history_path = "romfs:/retroarch/playlists/builtin/content_music_history.lpl"
28+
content_video_history_path = "romfs:/retroarch/playlists/builtin/content_video_history.lpl"
29+
content_favorites_directory = ""
30+
content_history_directory = ""
31+
content_image_history_directory = ""
32+
content_music_history_directory = ""
33+
content_video_directory = ""
34+
log_dir = "default"
35+
136
# Change the user interface to RGUI instead of the default Ozone user interface since RGUI looks better without RetroArch's assets installed
237
menu_driver = "rgui"
3-
4-
# Change the save file, save state, screenshot and log directories to writable storage locations
5-
# They default to being in ROMFS which is read-only
6-
savefile_directory = "/retroarch/cores/savefiles"
7-
savestate_directory = "/retroarch/cores/savestates"
8-
screenshot_directory = "/retroarch/screenshots"
9-
log_dir = "/retroarch/logs"
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c
2-
index b3893afd58..1fb9831c30 100644
2+
index b3893afd58..58b94e67f9 100644
33
--- a/frontend/drivers/platform_switch.c
44
+++ b/frontend/drivers/platform_switch.c
5-
@@ -66,7 +66,7 @@
6-
#endif
5+
@@ -303,7 +303,7 @@ static void frontend_switch_get_env(
6+
}
7+
8+
fill_pathname_join(g_defaults.path_config,
9+
- g_defaults.dirs[DEFAULT_DIR_PORT],
10+
+ "romfs:/retroarch",
11+
FILE_PATH_MAIN_CONFIG,
12+
sizeof(g_defaults.path_config));
713

8-
#ifdef HAVE_LIBNX
9-
-#define SD_PREFIX
10-
+#define SD_PREFIX "romfs:"
11-
#include "../../gfx/common/switch_defines.h"
12-
#else
13-
#define SD_PREFIX "/sd"
1414
diff --git a/retroarch.c b/retroarch.c
15-
index b16728310b..37182bce3d 100644
15+
index b16728310b..6deedb3ab9 100644
1616
--- a/retroarch.c
1717
+++ b/retroarch.c
18-
@@ -5942,7 +5942,7 @@ void main_exit(void *args)
19-
* Returns: varies per platform.
20-
**/
21-
int rarch_main(int argc, char *argv[], void *data)
18+
@@ -6191,7 +6191,7 @@ void emscripten_mainloop(void)
19+
extern "C"
20+
#endif
21+
int main(int argc, char *argv[])
2222
-{
23-
+{ static char *bootstrap_argv[] = {NULL, NULL, NULL}; bootstrap_argv[0] = strdup("retroarch"); bootstrap_argv[1] = strdup("romfs:/Game.mkxpz"); romfsInit(); argc = 2; argv = bootstrap_argv; data = NULL;
24-
settings_t *settings;
25-
struct rarch_state *p_rarch = &rarch_st;
26-
runloop_state_t *runloop_st = runloop_state_get_ptr();
23+
+{ { static char *bootstrap_argv[] = {NULL, NULL, NULL}; bootstrap_argv[0] = strdup("retroarch"); bootstrap_argv[1] = strdup("romfs:/Game.mkxpz"); romfsInit(); argc = 2; argv = bootstrap_argv; }
24+
return rarch_main(argc, argv, NULL);
25+
}
26+
#endif

0 commit comments

Comments
 (0)