diff options
author | StapleButter <thetotalworm@gmail.com> | 2018-12-14 22:03:34 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2018-12-14 22:03:34 +0100 |
commit | 2077642a92310d84062e6404687ca142cd83c671 (patch) | |
tree | c0df13f124b23ab387f118c801eba16953d4e12c /src | |
parent | 10ebae42db726655b6685550a1e9cf8fe99783b1 (diff) |
libui/GTK: remember directory in which the latest loaded ROM was, point file picker to it. behavior under Windows will likely stay unchanged as the Windows file picker already does that.
Diffstat (limited to 'src')
-rw-r--r-- | src/Config.cpp | 4 | ||||
-rw-r--r-- | src/Config.h | 2 | ||||
-rw-r--r-- | src/SPU.cpp | 1 | ||||
-rw-r--r-- | src/libui_sdl/libui/unix/stddialogs.c | 3 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 11 |
5 files changed, 18 insertions, 3 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index 7fb3aeb..4836cf5 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -58,6 +58,8 @@ int AudioVolume; int MicInputType; char MicWavPath[512]; +char LastROMFolder[512]; + typedef struct { char Name[16]; @@ -123,6 +125,8 @@ ConfigEntry ConfigFile[] = {"AudioVolume", 0, &AudioVolume, 255, NULL, 0}, {"MicInputType", 0, &MicInputType, 1, NULL, 0}, {"MicWavPath", 1, MicWavPath, 0, "", 511}, + + {"LastROMFolder", 1, LastROMFolder, 0, "", 511}, {"", -1, NULL, 0, NULL, 0} }; diff --git a/src/Config.h b/src/Config.h index 2e6728f..236c1a3 100644 --- a/src/Config.h +++ b/src/Config.h @@ -63,6 +63,8 @@ extern int AudioVolume; extern int MicInputType; extern char MicWavPath[512]; +extern char LastROMFolder[512]; + } #endif // CONFIG_H diff --git a/src/SPU.cpp b/src/SPU.cpp index 19eb98e..9862077 100644 --- a/src/SPU.cpp +++ b/src/SPU.cpp @@ -259,6 +259,7 @@ void Channel::Start() if (((Cnt >> 29) & 0x3) != 3) { FIFO_BufferData(); + FIFO_BufferData(); } } diff --git a/src/libui_sdl/libui/unix/stddialogs.c b/src/libui_sdl/libui/unix/stddialogs.c index b793d06..d2b89b9 100644 --- a/src/libui_sdl/libui/unix/stddialogs.c +++ b/src/libui_sdl/libui/unix/stddialogs.c @@ -70,6 +70,9 @@ static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gcha gtk_file_chooser_set_show_hidden(fc, TRUE); gtk_file_chooser_set_do_overwrite_confirmation(fc, TRUE); gtk_file_chooser_set_create_folders(fc, TRUE); + if (initpath && strlen(initpath)>0) + gtk_file_chooser_set_current_folder(fc, initpath); + response = gtk_dialog_run(GTK_DIALOG(fcd)); if (response != GTK_RESPONSE_ACCEPT) { gtk_widget_destroy(fcd); diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 7374ae6..b30c81b 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1118,7 +1118,7 @@ void LoadState(int slot) } else { - char* file = uiOpenFile(MainWindow, "melonDS savestate (any)|*.ml1;*.ml2;*.ml3;*.ml4;*.ml5;*.ml6;*.ml7;*.ml8;*.mln", NULL); + char* file = uiOpenFile(MainWindow, "melonDS savestate (any)|*.ml1;*.ml2;*.ml3;*.ml4;*.ml5;*.ml6;*.ml7;*.ml8;*.mln", Config::LastROMFolder); if (!file) { EmuRunning = prevstatus; @@ -1193,7 +1193,7 @@ void SaveState(int slot) } else { - char* file = uiSaveFile(MainWindow, "melonDS savestate (*.mln)|*.mln", NULL); + char* file = uiSaveFile(MainWindow, "melonDS savestate (*.mln)|*.mln", Config::LastROMFolder); if (!file) { EmuRunning = prevstatus; @@ -1310,12 +1310,17 @@ void OnOpenFile(uiMenuItem* item, uiWindow* window, void* blarg) EmuRunning = 2; while (EmuStatus != 2); - char* file = uiOpenFile(window, "DS ROM (*.nds)|*.nds;*.srl|Any file|*.*", NULL); + char* file = uiOpenFile(window, "DS ROM (*.nds)|*.nds;*.srl|Any file|*.*", Config::LastROMFolder); if (!file) { EmuRunning = prevstatus; return; } + + int pos = strlen(file)-1; + while (file[pos] != '/' && file[pos] != '\\' && pos > 0) pos--; + strncpy(Config::LastROMFolder, file, pos); + Config::LastROMFolder[pos] = '\0'; TryLoadROM(file, prevstatus); uiFreeText(file); |