diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index bcea2a3e3..0a1193d10 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -53,6 +53,8 @@ #include "slot2.h" +#include "utils/xstring.h" + #include "filter/videofilter.h" #ifdef GDB_STUB @@ -2172,9 +2174,17 @@ common_gtk_main( class configured_features *my_config) slot2_device_type = NDS_SLOT2_CFLASH; if(my_config->gbaslot_rom != "") { - strncpy(GBAgameName, my_config->gbaslot_rom.c_str(), MAX_PATH); + + //set the GBA rom and sav paths + GBACartridge_RomPath = my_config->gbaslot_rom.c_str(); + if(toupper(strright(GBACartridge_RomPath,4)) == ".GBA") + GBACartridge_SRAMPath = strright(GBACartridge_RomPath,4) + ".sav"; + else + //what to do? lets just do the same thing for now + GBACartridge_SRAMPath = strright(GBACartridge_RomPath,4) + ".sav"; + // Check if the file exists and can be opened - FILE * test = fopen(GBAgameName, "rb"); + FILE * test = fopen(GBACartridge_RomPath.c_str(), "rb"); if (test) { slot2_device_type = NDS_SLOT2_GBACART; fclose(test);