]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Force restart if quickstart model or expansions are changed on the fly.
authorToni Wilen <twilen@winuae.net>
Sun, 15 Aug 2021 06:59:33 +0000 (09:59 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 15 Aug 2021 06:59:33 +0000 (09:59 +0300)
devices.cpp
include/devices.h
main.cpp
od-win32/win32gui.cpp

index c6de8950c715daa0b38916d00816091c32bf01b7..4c58a13ab3a03b9fb3cb1b24a6d1f37503123d95 100644 (file)
@@ -284,46 +284,38 @@ void devices_update_sync(double svpos, double syncadjust)
        cd32_fmv_set_sync(svpos, syncadjust);
 }
 
-void do_leave_program (void)
+void virtualdevice_free(void)
 {
 #ifdef WITH_PPC
        // must be first
        uae_ppc_free();
 #endif
        free_traps();
-       sampler_free ();
-       graphics_leave ();
-       inputdevice_close ();
-       DISK_free ();
-       close_sound ();
-       dump_counts ();
+       sampler_free();
+       inputdevice_close();
+       DISK_free();
+       dump_counts();
 #ifdef SERIAL_PORT
-       serial_exit ();
-#endif
-       if (! no_gui)
-               gui_exit ();
-#ifdef USE_SDL
-       SDL_Quit ();
+       serial_exit();
 #endif
 #ifdef AUTOCONFIG
-       expansion_cleanup ();
+       expansion_cleanup();
 #endif
 #ifdef FILESYS
-       filesys_cleanup ();
+       filesys_cleanup();
 #endif
 #ifdef BSDSOCKET
-       bsdlib_reset ();
+       bsdlib_reset();
 #endif
        device_func_free();
 #ifdef WITH_LUA
-       uae_lua_free ();
+       uae_lua_free();
 #endif
        gfxboard_free();
-       savestate_free ();
-       memory_cleanup ();
-       free_shm ();
-       cfgfile_addcfgparam (0);
-       machdep_free ();
+       savestate_free();
+       memory_cleanup();
+       free_shm();
+       cfgfile_addcfgparam(0);
        driveclick_free();
        ethernet_enumerate_free();
        rtarea_free();
@@ -331,6 +323,19 @@ void do_leave_program (void)
        execute_device_items(device_leaves, device_leave_cnt);
 }
 
+void do_leave_program (void)
+{
+       virtualdevice_free();
+       graphics_leave();
+       close_sound();
+       if (! no_gui)
+               gui_exit();
+#ifdef USE_SDL
+       SDL_Quit();
+#endif
+       machdep_free();
+}
+
 void virtualdevice_init (void)
 {
        reset_device_items();
index a1edf7ea6135e126371b622a9e0129ce62c6af1d..bc96a4e9055251b5b3f70f4cfde18457b1c10e09 100644 (file)
@@ -13,6 +13,7 @@ void devices_update_sound(double clk, double syncadjust);
 void devices_update_sync(double svpos, double syncadjust);
 void do_leave_program(void);
 void virtualdevice_init(void);
+void virtualdevice_free(void);
 void devices_restore_start(void);
 void device_check_config(void);
 void devices_pause(void);
index 791be8ab279608008d3bc813cfb9b7bae37db331..6304b5bc02203ede9a8abd5e54a32f095ef39c85 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -784,11 +784,11 @@ void uae_quit (void)
        target_quit ();
 }
 
-/* 0 = normal, 1 = nogui, -1 = disable nogui */
+/* 0 = normal, 1 = nogui, -1 = disable nogui, -2 = autorestart */
 void uae_restart (int opengui, const TCHAR *cfgfile)
 {
        uae_quit ();
-       restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3);
+       restart_program = opengui == -2 ? 4 : (opengui > 0 ? 1 : (opengui == 0 ? 2 : 3));
        restart_config[0] = 0;
        default_config = 0;
        if (cfgfile)
@@ -1110,7 +1110,7 @@ static int real_main2 (int argc, TCHAR **argv)
        copy_prefs(&currprefs, &changed_prefs);
 
        no_gui = ! currprefs.start_gui;
-       if (restart_program == 2)
+       if (restart_program == 2 || restart_program == 4)
                no_gui = 1;
        else if (restart_program == 3)
                no_gui = 0;
index 713ade3c7b7dff65520db685e3a842ec70023d14..4cadd56c4999141cd1e21489825c877b3f526334 100644 (file)
@@ -7060,21 +7060,22 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
 struct amigamodels {
        int compalevels;
        int id;
+       int resetlevels[6];
 };
 static struct amigamodels amodels[] = {
-       { 4, IDS_QS_MODEL_A500 }, // "Amiga 500"
-       { 4, IDS_QS_MODEL_A500P }, // "Amiga 500+"
-       { 4, IDS_QS_MODEL_A600 }, // "Amiga 600"
-       { 4, IDS_QS_MODEL_A1000 }, // "Amiga 1000"
-       { 5, IDS_QS_MODEL_A1200 }, // "Amiga 1200"
-       { 2, IDS_QS_MODEL_A3000 }, // "Amiga 3000"
-       { 1, IDS_QS_MODEL_A4000 }, // "Amiga 4000"
+       { 4, IDS_QS_MODEL_A500, { 0, 0, 0, 0, 0, 0 } }, // "Amiga 500"
+       { 4, IDS_QS_MODEL_A500P,  { 0, 0, 0, 0, 0, 0 } }, // "Amiga 500+"
+       { 4, IDS_QS_MODEL_A600,  { 0, 0, 1, 0, 0, 0 } }, // "Amiga 600"
+       { 4, IDS_QS_MODEL_A1000,  { 0, 0, 0, 0, 0, 0 } }, // "Amiga 1000"
+       { 5, IDS_QS_MODEL_A1200,  { 0, 1, 2, 3, 4, 5 } }, // "Amiga 1200"
+       { 2, IDS_QS_MODEL_A3000,  { 0, 0, 0, 0, 0, 0 } }, // "Amiga 3000"
+       { 1, IDS_QS_MODEL_A4000,  { 0, 0, 1, 0, 0, 0 } }, // "Amiga 4000"
        { 0, }, //{ 1, IDS_QS_MODEL_A4000T }, // "Amiga 4000T"
-       { 4, IDS_QS_MODEL_CD32 }, // "CD32"
-       { 4, IDS_QS_MODEL_CDTV }, // "CDTV"
-       { 4, IDS_QS_MODEL_ARCADIA }, // "Arcadia"
-       { 1, IDS_QS_MODEL_MACROSYSTEM },
-       { 1, IDS_QS_MODEL_UAE }, // "Expanded UAE example configuration"
+       { 4, IDS_QS_MODEL_CD32,  { 0, 0, 1, 0, 0, 0 } }, // "CD32"
+       { 4, IDS_QS_MODEL_CDTV,  { 0, 0, 1, 0, 0, 0 } }, // "CDTV"
+       { 4, IDS_QS_MODEL_ARCADIA,  { 0, 0, 0, 0, 0, 0 } }, // "Arcadia"
+       { 1, IDS_QS_MODEL_MACROSYSTEM,  { 0, 0, 0, 0, 0, 0 } },
+       { 1, IDS_QS_MODEL_UAE,  { 0, 0, 0, 0, 0, 0 } }, // "Expanded UAE example configuration"
        { -1 }
 };
 
@@ -7430,20 +7431,24 @@ static INT_PTR CALLBACK QuickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, L
                                                if (quickstart)
                                                        load_quickstart (hDlg, 1);
                                                if (quickstart && !full_property_sheet)
-                                                       qs_request_reset = 2;
+                                                       qs_request_reset |= 4;
                                        }
                                }
                                break;
                        case IDC_QUICKSTART_CONFIGURATION:
                                val = SendDlgItemMessage (hDlg, IDC_QUICKSTART_CONFIGURATION, CB_GETCURSEL, 0, 0L);
                                if (val != CB_ERR && val != quickstart_conf) {
+                                       int rslevel = amodels[quickstart_model].resetlevels[quickstart_conf];
                                        quickstart_conf = val;
+                                       if (!full_property_sheet && amodels[quickstart_model].resetlevels[quickstart_conf] != rslevel) {
+                                               qs_request_reset |= 4;
+                                       }
                                        quickstart_model_confstore[quickstart_model] = quickstart_conf;
                                        init_quickstartdlg (hDlg);
                                        if (quickstart)
                                                load_quickstart (hDlg, 1);
                                        if (quickstart && !full_property_sheet)
-                                               qs_request_reset = 2;
+                                               qs_request_reset |= 2;
                                }
                                break;
                        case IDC_QUICKSTART_HOSTCONFIG:
@@ -22195,7 +22200,12 @@ gui_exit:
        if (quit_program) {
                psresult = -2;
        } else if (qs_request_reset && quickstart) {
-               uae_reset(qs_request_reset == 2 ? 1 : 0, 1);
+               if (qs_request_reset & 4) {
+                       copy_prefs(&changed_prefs, &currprefs);
+                       uae_restart(-2, NULL);
+               } else {
+                       uae_reset((qs_request_reset & 2) ? 1 : 0, 1);
+               }
        }
        if (psresult > 0 && config_pathfilename[0]) {
                DISK_history_add(config_pathfilename, -1, HISTORY_CONFIGFILE, false);