From ca8fb4ab0837ac5845304ffc6658241b74358897 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 19 Oct 2011 07:12:10 +0000 Subject: [PATCH] gtk: now remembers last loaded lua script for loadLua dialog --- src/drivers/sdl/config.cpp | 1 + src/drivers/sdl/gui.cpp | 7 +++++-- src/drivers/sdl/input.cpp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/drivers/sdl/config.cpp b/src/drivers/sdl/config.cpp index 5d7de7a4..5ecedba2 100644 --- a/src/drivers/sdl/config.cpp +++ b/src/drivers/sdl/config.cpp @@ -224,6 +224,7 @@ InitConfig() config->addOption("_laststatefrom", "SDL.LastLoadStateFrom", home_dir); config->addOption("_lastopennsf", "SDL.LastOpenNSF", home_dir); config->addOption("_lastsavestateas", "SDL.LastSaveStateAs", home_dir); + config->addOption("_lastloadlua", "SDL.LastLoadLua", home_dir); #endif // fcm -> fm2 conversion diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp index 365230fc..2f5fa226 100644 --- a/src/drivers/sdl/gui.cpp +++ b/src/drivers/sdl/gui.cpp @@ -1324,14 +1324,17 @@ void loadLua () gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterLua); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterAll); - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fileChooser), getcwd(NULL, 0)); - + const char* last_file; + g_config->getOption("SDL.LastLoadLua", &last_file); + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fileChooser), last_file); if (gtk_dialog_run (GTK_DIALOG (fileChooser)) ==GTK_RESPONSE_ACCEPT) { char* filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fileChooser)); + g_config->setOption("SDL.LastLoadLua", filename); + g_config->save(); gtk_widget_destroy(fileChooser); if(FCEU_LoadLuaCode(filename) == 0) { diff --git a/src/drivers/sdl/input.cpp b/src/drivers/sdl/input.cpp index ee287476..cfe44b1e 100644 --- a/src/drivers/sdl/input.cpp +++ b/src/drivers/sdl/input.cpp @@ -756,6 +756,8 @@ GetMouseData(uint32 (&d)[3]) t = PtoV(x, y); d[0] = t & 0xFFFF; d[1] = (t >> 16) & 0xFFFF; + // debug print + // printf("mouse %d %d %d\n", d[0], d[1], d[2]); } /**