diff options
| author | SND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-11-28 16:05:45 +0000 |
|---|---|---|
| committer | SND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-11-28 16:05:45 +0000 |
| commit | 5ffd1f6301f77a5b8dbfcc76f1d55693911c9fd1 (patch) | |
| tree | 99462bfec79d04fe39c19a9c540f92358152b140 /gui/GtkGui.c | |
| parent | ab3d13f1e74f78404f9c723b58728bcd4a5cd53c (diff) | |
| download | pcsxr-5ffd1f6301f77a5b8dbfcc76f1d55693911c9fd1.tar.gz | |
GTK: improved cheat file automatic loading / name generation.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@88007 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'gui/GtkGui.c')
| -rwxr-xr-x | gui/GtkGui.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gui/GtkGui.c b/gui/GtkGui.c index f9f1f183..946a34a9 100755 --- a/gui/GtkGui.c +++ b/gui/GtkGui.c @@ -195,6 +195,14 @@ void ResetMenuSlots() { } } +static void clear_change_image() { + g_free(reset_load_info); + reset_load_info = NULL; + autoloadCheats(); + g_free(cheat_last_filename); + cheat_last_filename = NULL; +} + int match(const char *string, char *pattern) { int status; regex_t re; @@ -252,7 +260,10 @@ gchar* get_cdrom_label_id(const gchar* suffix) { g_free(trimlabel); - return g_strdup(buf); + if (strlen(buf) <= (2+strlen(dot_extension_cht))) + return g_strconcat("psx-default", dot_extension_cht, NULL); + else + return g_strdup(buf); } void UpdateMenuSlots() { @@ -267,6 +278,7 @@ void UpdateMenuSlots() { } void autoloadCheats() { + ClearAllCheats(); gchar *chtfile = get_cdrom_label_id(dot_extension_cht); gchar *defaultChtFilePath = g_build_filename (getenv("HOME"), CHEATS_DIR, chtfile, NULL); LoadCheats(defaultChtFilePath); // file existence/access check in LoadCheats() @@ -624,9 +636,7 @@ void OnFile_RunCd() { SysRunGui(); } - g_free(reset_load_info); - reset_load_info = NULL; - autoloadCheats(); + clear_change_image(); psxCpu->Execute(); } @@ -657,8 +667,7 @@ void OnFile_RunBios() { CdromId[0] = '\0'; CdromLabel[0] = '\0'; - g_free(reset_load_info); - reset_load_info = NULL; + clear_change_image(); psxCpu->Execute(); } @@ -802,9 +811,7 @@ void OnFile_RunImage() { SysRunGui(); } - g_free(reset_load_info); - reset_load_info = NULL; - autoloadCheats(); + clear_change_image(); psxCpu->Execute(); } |
