]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Default statefile name = config file name
authorToni Wilen <twilen@winuae.net>
Sat, 16 Mar 2024 10:21:10 +0000 (12:21 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 16 Mar 2024 10:21:10 +0000 (12:21 +0200)
cfgfile.cpp
include/uae.h
od-win32/win32.cpp
od-win32/win32gui.cpp

index 315c647115ec5fec71b8e1eab2975bfcd1695e8e..ae26dbaac33aeb4a833cd75f6db2ececad80206c 100644 (file)
@@ -7201,6 +7201,7 @@ int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ign
                        fetch_configurationpath(tmp, sizeof(tmp) / sizeof(TCHAR));
                        _tcsncat(tmp, p->config_all_path, sizeof(tmp) / sizeof(TCHAR) - _tcslen(tmp) - 1);
                        type2 = CONFIG_TYPE_HOST | CONFIG_TYPE_HARDWARE;
+                       target_setdefaultstatefilename(filename);
                        cfgfile_load(p, tmp, &type2, 1, 0);
                }
                if (p->config_hardware_path[0]) {
@@ -7213,6 +7214,7 @@ int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ign
                        fetch_configurationpath (tmp, sizeof (tmp) / sizeof (TCHAR));
                        _tcsncat (tmp, p->config_host_path, sizeof (tmp) / sizeof (TCHAR) - _tcslen(tmp) - 1);
                        type2 = CONFIG_TYPE_HOST;
+                       target_setdefaultstatefilename(filename);
                        cfgfile_load (p, tmp, &type2, 1, 0);
                }
        }
index 3d5be5f4ce417ce0a9081aa9be7b0739196b6561..2f0a918402c153ba689562a5e8b09ee9053e0790 100644 (file)
@@ -38,6 +38,7 @@ extern void target_restart (void);
 extern void target_getdate(int *y, int *m, int *d);
 extern void target_cpu_speed(void);
 extern int target_sleep_nanos(int);
+void target_setdefaultstatefilename(const TCHAR*);
 extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path);
 extern void stripslashes (TCHAR *p);
 extern void fixtrailing (TCHAR *p);
index 8b66890d39b4177cbcdbecedc82ae82120c27d73..de3cbe4b223372af1c4e5558da7e0a06d7a17b37 100644 (file)
@@ -5981,6 +5981,23 @@ static void WIN32_HandleRegistryStuff (void)
        target_load_debugger_config();
 }
 
+void target_setdefaultstatefilename(const TCHAR *name)
+{
+       TCHAR path[MAX_DPATH];
+       fetch_path(_T("StatefilePath"), path, sizeof(path) / sizeof(TCHAR));
+       if (!name || !name[0]) {
+               _tcscat(path, _T("default.uss"));
+       } else {
+               _tcscat(path, name);
+               const TCHAR *p = _tcsrchr(name, '.');
+               if (p) {
+                       path[_tcslen(path) - ((name + _tcslen(name)) - p)] = 0;
+                       _tcscat(path, _T(".uss"));
+               }
+       }
+       _tcscpy(savestate_fname, path);
+}
+
 #if WINUAEPUBLICBETA > 0
 static const TCHAR *BETAMESSAGE = {
        _T("This is unstable beta software. Click cancel if you are not comfortable using software that is incomplete and can have serious programming errors.")
index 5e7084c21bc8b6369afaa11ac39f7018c03a7775..d6d45a43f1c03bdf252eb8c2a77d6bd299f394f9 100644 (file)
@@ -4247,6 +4247,7 @@ static TCHAR *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *con
                        WIN32GUI_LoadUIString (IDS_MUSTSELECTCONFIG, szMessage, MAX_DPATH);
                        pre_gui_message (szMessage);
                } else {
+                       target_setdefaultstatefilename(config_filename);
                        if (target_cfgfile_load (&workprefs, path, configtypepanel, 0) == 0) {
                                TCHAR szMessage[MAX_DPATH];
                                WIN32GUI_LoadUIString (IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH);
@@ -4335,7 +4336,7 @@ static TCHAR *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *con
                break;
        }
 
-       setguititle (NULL);
+       setguititle(NULL);
        return ok ? full_path : NULL;
 }
 
@@ -7356,6 +7357,7 @@ static void load_quickstart (HWND hDlg, int romcheck)
        addfloppyhistory (hDlg);
        config_filename[0] = 0;
        setguititle (NULL);
+       target_setdefaultstatefilename(config_filename);
 }
 
 static void quickstarthost (HWND hDlg, TCHAR *name)