diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/nds/entry.cpp | 2 | ||||
-rw-r--r-- | source/nds/entry.h | 2 | ||||
-rw-r--r-- | source/nds/gui.c | 16 |
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(); |