From: Malik Olivier Boussejra Date: Sat, 5 May 2018 09:24:51 +0000 (+0900) Subject: libretro.c: Use common memory card 2 for all games X-Git-Tag: r24l~766^2~1 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d833bd305f300362200a78f3ee80af54684865;p=pcsx_rearmed.git libretro.c: Use common memory card 2 for all games Memory card 2 is in the same folder as the loaded game. --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 634242fe..1e888e19 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) {