aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorMalik Olivier Boussejra2018-05-05 18:24:51 +0900
committerMalik Olivier Boussejra2018-05-05 18:24:51 +0900
commitd0d833bd305f300362200a78f3ee80af54684865 (patch)
tree85c642b346f3677cea5eb2048b3a988b775d03a9 /frontend
parent35be2fb56b2f014db7f3ea6a86cebcaf6000560a (diff)
downloadpcsx_rearmed-d0d833bd305f300362200a78f3ee80af54684865.tar.gz
pcsx_rearmed-d0d833bd305f300362200a78f3ee80af54684865.tar.bz2
pcsx_rearmed-d0d833bd305f300362200a78f3ee80af54684865.zip
libretro.c: Use common memory card 2 for all games
Memory card 2 is in the same folder as the loaded game.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/libretro.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 634242f..1e888e1 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -1667,7 +1667,15 @@ void retro_init(void)
if(!__ctr_svchax)
Config.Cpu = CPU_INTERPRETER;
#endif
- strcpy(Config.Mcd2, "memcard2.mcd");
+ if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir) {
+ const char CARD_FILE[] = "pcsx-card2.mcd";
+ if (strlen(dir) + strlen(CARD_FILE) + 2 > sizeof(Config.Mcd2)) {
+ SysPrintf("Path '%s' is too long. Cannot use memcard 2. Use a shorter path.\n", dir);
+ } else {
+ snprintf(Config.Mcd2, sizeof(Config.Mcd2), "%s/%s", dir, CARD_FILE);
+ SysPrintf("Use memory card2: %s\n", Config.Mcd2);
+ }
+ }
ret |= emu_core_init();
if (ret != 0) {