mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
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.
This commit is contained in:
@ -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}
|
||||
};
|
||||
|
@ -63,6 +63,8 @@ extern int AudioVolume;
|
||||
extern int MicInputType;
|
||||
extern char MicWavPath[512];
|
||||
|
||||
extern char LastROMFolder[512];
|
||||
|
||||
}
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
@ -259,6 +259,7 @@ void Channel::Start()
|
||||
if (((Cnt >> 29) & 0x3) != 3)
|
||||
{
|
||||
FIFO_BufferData();
|
||||
FIFO_BufferData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user