From ea330e8f79c16894deda51509e769cbd02ff83df Mon Sep 17 00:00:00 2001 From: BassAceGold Date: Wed, 6 Feb 2013 02:04:39 -0500 Subject: Fix settings not getting loaded with a ROM provided by plugin arguments. --- source/nds/gui.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/nds/gui.c') 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(); -- cgit v1.2.3