aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBassAceGold2013-02-06 02:04:39 -0500
committerNebuleon Fumika2013-02-06 02:05:03 -0500
commitea330e8f79c16894deda51509e769cbd02ff83df (patch)
tree8381b7cd37adefa1a606dd484bbc057b77e6498e
parent4ac61d443d5786db1b1e365e0005a1d5740183b0 (diff)
downloadsnes9x2005-ea330e8f79c16894deda51509e769cbd02ff83df.tar.gz
snes9x2005-ea330e8f79c16894deda51509e769cbd02ff83df.tar.bz2
snes9x2005-ea330e8f79c16894deda51509e769cbd02ff83df.zip
Fix settings not getting loaded with a ROM provided by plugin arguments.
-rw-r--r--source/nds/entry.cpp2
-rw-r--r--source/nds/entry.h2
-rw-r--r--source/nds/gui.c16
3 files changed, 17 insertions, 3 deletions
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 5cca41e..8b1724e 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -499,7 +499,7 @@ void game_restart(void)
S9xReset ();
}
-int load_gamepak(char* file)
+int load_gamepak(const char* file)
{
CPU.Flags = 0;
// mdelay(50); // Delete this delay
diff --git a/source/nds/entry.h b/source/nds/entry.h
index 2d3f7db..0728768 100644
--- a/source/nds/entry.h
+++ b/source/nds/entry.h
@@ -7,7 +7,7 @@ extern "C" {
void game_restart(void);
- int load_gamepak(char* file);
+ int load_gamepak(const char* file);
extern unsigned int AutoCPUFrequency;
#ifdef __cplusplus
diff --git a/source/nds/gui.c b/source/nds/gui.c
index 495e3c8..427f7d7 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -1853,7 +1853,21 @@ u32 menu(u16 *screen, bool8 FirstInvocation)
return 0;
}
- strcpy(gamepak_name, filename);
+ char tempPath[MAX_PATH];
+ strcpy(tempPath, filename);
+
+ //update folders and names for settings/config uses
+ char *dirEnd = strrchr(tempPath, '/');
+ //make sure a valid path was provided
+ if(!dirEnd)
+ return 0;
+
+ //copy file name as gamepak_name
+ strcpy(gamepak_name, dirEnd+1);
+ //then strip filename from directory path and set it
+ *dirEnd = '\0';
+ strcpy(g_default_rom_dir, tempPath);
+
first_load = 0;
load_game_config_file();