]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Statefile save uae-configuration support
authorToni Wilen <twilen@winuae.net>
Sat, 14 Jan 2023 13:49:50 +0000 (15:49 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 14 Jan 2023 13:49:50 +0000 (15:49 +0200)
cfgfile.cpp
include/savestate.h
inputdevice.cpp
savestate.cpp

index 79268fd135eff21363c3bbcbb20a542983f47772..2f25ccdfc8c308b7027d91da8ac28c5a2b7c9561 100644 (file)
@@ -7680,6 +7680,19 @@ int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max)
 
 static bool cfgfile_parse_uaelib_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int type)
 {
+       TCHAR tmp[MAX_DPATH];
+       if (cfgfile_path(option, value, _T("statefile_save"), tmp, sizeof(tmp) / sizeof(TCHAR))) {
+               if (!savestate_state) {
+                       savestate_state = STATE_SAVE;
+                       fetch_statefilepath(savestate_fname, sizeof(savestate_fname) / sizeof(TCHAR));
+                       _tcscat(savestate_fname, tmp);
+                       if (_tcslen(savestate_fname) >= 4 && _tcsicmp(savestate_fname + _tcslen(savestate_fname) - 4, _T(".uss"))) {
+                               _tcscat(savestate_fname, _T(".uss"));
+                       }
+               }
+               return true;
+       }
+
        return false;
 }
 
index 4a0966d126c89d75b3d3194b5771dccfb4069eef..b295ac3d4c59cea64c1bc7ef3e1bace89b08919b 100644 (file)
@@ -230,24 +230,22 @@ extern uae_u8 *restore_expansion_info_old(uae_u8*);
 #endif
 extern void restore_expansion_finish(void);
 
-extern uae_u8 *restore_action_replay (uae_u8 *);
-extern uae_u8 *save_action_replay (size_t *, uae_u8 *);
-extern uae_u8 *restore_hrtmon (uae_u8 *);
-extern uae_u8 *save_hrtmon (size_t *, uae_u8 *);
-extern void restore_ar_finish (void);
-
-extern void savestate_initsave (const TCHAR *filename, int docompress, int nodialogs, bool save);
-extern int save_state (const TCHAR *filename, const TCHAR *description);
-extern void restore_state (const TCHAR *filename);
+extern uae_u8 *restore_action_replay(uae_u8 *);
+extern uae_u8 *save_action_replay(size_t *, uae_u8 *);
+extern uae_u8 *restore_hrtmon(uae_u8 *);
+extern uae_u8 *save_hrtmon(size_t *, uae_u8 *);
+extern void restore_ar_finish(void);
+
+extern void savestate_initsave(const TCHAR *filename, int docompress, int nodialogs, bool save);
+extern int save_state(const TCHAR *filename, const TCHAR *description);
+extern void restore_state(const TCHAR *filename);
 extern bool savestate_restore_finish(void);
 extern void savestate_restore_final(void);
-extern void savestate_memorysave (void);
+extern void savestate_memorysave(void);
 
+extern void custom_prepare_savestate(void);
 
-extern void custom_save_state (void);
-extern void custom_prepare_savestate (void);
-
-extern bool savestate_check (void);
+extern bool savestate_check(void);
 
 #define STATE_SAVE 1
 #define STATE_RESTORE 2
@@ -256,24 +254,26 @@ extern bool savestate_check (void);
 #define STATE_REWIND 16
 #define STATE_DOREWIND 32
 
+#define STATE_SAVE_DESCRIPTION _T("Description!")
+
 extern int savestate_state;
 extern TCHAR savestate_fname[MAX_DPATH];
 extern struct zfile *savestate_file;
 
-STATIC_INLINE bool isrestore (void)
+STATIC_INLINE bool isrestore(void)
 {
        return savestate_state == STATE_RESTORE || savestate_state == STATE_REWIND;
 }
 
-extern void savestate_quick (int slot, int save);
+extern void savestate_quick(int slot, int save);
 
-extern void savestate_capture (int);
-extern void savestate_free (void);
-extern void savestate_init (void);
-extern void savestate_rewind (void);
-extern int savestate_dorewind (int);
-extern void savestate_listrewind (void);
-extern void statefile_save_recording (const TCHAR*);
-extern void savestate_capture_request (void);
+extern void savestate_capture(int);
+extern void savestate_free(void);
+extern void savestate_init(void);
+extern void savestate_rewind(void);
+extern int savestate_dorewind(int);
+extern void savestate_listrewind(void);
+extern void statefile_save_recording(const TCHAR*);
+extern void savestate_capture_request(void);
 
 #endif /* UAE_SAVESTATE_H */
index e70f4b0e44b87bdbff75ff5dc075c8ef9f996e2d..7c5c92799352ac403f7739e0c497663516495cad 100644 (file)
@@ -4595,7 +4595,7 @@ static bool inputdevice_handle_inputcode2(int monid, int code, int state, const
        case AKS_STATESAVEDIALOG:
                if (s) {
                        savestate_initsave (s, 1, true, true);
-                       save_state (savestate_fname, _T("Description!"));
+                       save_state (savestate_fname, STATE_SAVE_DESCRIPTION);
                } else {
                        gui_display (5);
                }
index eafa765caba73a1daccbbcbc2fd31aa756fbc288..9f2dcc20afc8020b28c2f710695e86f928cfdfa3 100644 (file)
@@ -1294,7 +1294,7 @@ void savestate_quick (int slot, int save)
        }
 }
 
-bool savestate_check (void)
+bool savestate_check(void)
 {
        if (vpos == 0 && !savestate_state) {
                if (hsync_counter == 0 && input_play == INPREC_PLAY_NORMAL)
@@ -1307,6 +1307,10 @@ bool savestate_check (void)
        } else if (savestate_state == STATE_DOREWIND) {
                savestate_state = STATE_REWIND;
                return true;
+       } else if (savestate_state == STATE_SAVE) {
+               savestate_initsave(savestate_fname, 1, true, true);
+               save_state(savestate_fname, STATE_SAVE_DESCRIPTION);
+               return false;
        }
        return false;
 }