]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
od-unix: match Windows GUI button semantics in runtime (F12) UI
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Fri, 12 Jun 2026 04:58:38 +0000 (21:58 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Wed, 17 Jun 2026 19:24:40 +0000 (12:24 -0700)
The runtime GUI's bottom button row behaved like the pre-start launcher:
Quit and Cancel both just closed the dialog and resumed emulation, Reset
reverted the UI to A1200 quickstart defaults, and Restart was hidden.
Mirror the Windows GUI (IDC_RESETAMIGA/IDC_QUITEMU/IDC_RESTARTEMU):

- Quit requests uae_quit() and exits the emulator.
- Reset applies the edited configuration and hard-resets the Amiga
  (uae_reset(1,1)), then resumes.
- Restart is shown in runtime mode and returns to the launcher through
  uae_restart().
- Start is relabeled OK while emulation is running; Cancel and closing
  the window still resume without applying changes.

The launcher result carries the new quit/restart states and a hard-reset
flag through the bridge; pre-start behavior is unchanged.

Also write floppy paths and the first CD slot into the merged config
even when empty, so ejecting media in the runtime GUI reaches the
core's disk-change detection instead of silently keeping the old image.

README_unix.md
od-unix/gui.cpp
od-unix/qt/launcher.cpp
od-unix/qt/launcher.h
od-unix/qt/launcher_bridge.cpp
od-unix/qt/launcher_bridge.h

index 28680bec599f441b524f6fb13bcc70f5b35e7e96..c2933d0a2761ca1cab68ded42233519708fee8fc 100644 (file)
@@ -538,7 +538,7 @@ export WINUAE_SMOKE_LOG=/tmp/winuae_unix_smoke.log
 - Press `Ctrl+Q` or `Cmd+Q` to quit.
 - SDL3 gamepads use the standard SDL layout: left stick and D-pad map to joystick directions, South/East/West/North map to the first four buttons, and CD32 mode follows the Windows default button order where possible.
 - Non-gamepad SDL joysticks expose their native axes, hats, and buttons; hats also map to joystick directions by default.
-- Press `F12` to open the integrated Qt settings UI during emulation.
+- Press `F12` to open the integrated Qt settings UI during emulation. The button row matches the Windows GUI: `OK` applies the edited configuration and resumes (floppy/CD changes are picked up live, including ejects), `Reset` applies the configuration and hard-resets the Amiga, `Restart` quits the running Amiga and returns to the launcher, `Quit` exits the emulator, and `Cancel` resumes without applying changes.
 - The screenshot file input event and integrated runtime Qt Output-page button save under the configured Screenshots directory. Unix uses PNG when libpng is found at configure time and falls back to BMP otherwise. On macOS, libpng must also pass the configured deployment-target check; a newer Homebrew libpng is skipped so release builds stay compatible with the selected minimum macOS. SDL3 builds can also copy the screenshot event output to the host clipboard as BMP data, and clipboard sharing can exchange PNG plus macOS TIFF image data when the matching native codecs are available. Unix screenshots now cover autoclip, palette-indexed PNG when the framebuffer has 256 or fewer colors, continuous screenshot directories, and the savestate thumbnail byte helper. The Output page can also start internal DIB RGB AVI capture, PCM-in-AVI audio capture, and WAV audio capture.
 - SDL3 builds can enable an OpenGL shader presenter with `WINUAE_UNIX_WITH_OPENGL_SHADER_PIPELINE`. When OpenGL is available, the Filter page's portable color, blur, noise, scanline, bilinear, and geometry controls are applied by a native GLSL path. Direct3D shader preset files, mask/overlay chains, HDR, and Metal/Vulkan backends are still future work.
 - CHD hardfile and CD image support is built by default. CHD FLAC codecs require libFLAC that is compatible with the configured macOS deployment target; otherwise CHD remains enabled without FLAC-compressed CD codecs.
index 21ffc6239172bbb2b0ec3d2f0895162b44790c59..aef839ee7f308ed4934377bd54ba2203bde4ef84 100644 (file)
@@ -273,12 +273,19 @@ void gui_display(int shortcut)
             unlink(snapshot_path);
         }
 
-        if (action == WINUAE_QT_LAUNCHER_START) {
+        if (action == WINUAE_QT_LAUNCHER_START || action == WINUAE_QT_LAUNCHER_RESET) {
             fixup_prefs(&changed_prefs, true);
             reset_sound();
             inputdevice_copyconfig(&changed_prefs, &currprefs);
             inputdevice_config_change_test();
             set_config_changed();
+            if (action == WINUAE_QT_LAUNCHER_RESET) {
+                uae_reset(1, 1);
+            }
+        } else if (action == WINUAE_QT_LAUNCHER_QUIT) {
+            uae_quit();
+        } else if (action == WINUAE_QT_LAUNCHER_RESTART) {
+            uae_restart(&changed_prefs, -1, nullptr);
         } else if (action == WINUAE_QT_LAUNCHER_ERROR) {
             write_log("Unix Qt runtime UI exited with error code %d\n", exit_code);
         }
index d3708c883fd07245ff4f2c48eec4dced383df40d..79b79e12e6dd9c72247937334c454e4e9e5f4528 100644 (file)
@@ -5349,19 +5349,35 @@ public:
         content->addWidget(navigation);
         content->addWidget(outerFrame, 1);
 
+        runtimeMode = hardwareProvider.pollHostWindowEvents != nullptr;
         QPushButton *reset = new QPushButton(QStringLiteral("Reset"));
         QPushButton *quit = new QPushButton(QStringLiteral("Quit"));
         QPushButton *restart = new QPushButton(QStringLiteral("Restart"));
         QPushButton *errorLog = new QPushButton(QStringLiteral("Error log"));
-        QPushButton *start = new QPushButton(QStringLiteral("Start"));
+        QPushButton *start = new QPushButton(runtimeMode ? QStringLiteral("OK") : QStringLiteral("Start"));
         QPushButton *cancel = new QPushButton(QStringLiteral("Cancel"));
         QPushButton *help = new QPushButton(QStringLiteral("Help"));
-        restart->setVisible(false);
+        restart->setVisible(runtimeMode);
         errorLog->setVisible(false);
         start->setDefault(true);
 
-        connect(reset, &QPushButton::clicked, this, [this]() { resetDefaults(); });
-        connect(quit, &QPushButton::clicked, this, &QDialog::reject);
+        connect(reset, &QPushButton::clicked, this, [this]() {
+            if (runtimeMode) {
+                /* Windows: hard-reset the Amiga with the edited config and
+                 * resume (IDC_RESETAMIGA sends IDOK after uae_reset). */
+                requestStart(true);
+            } else {
+                resetDefaults();
+            }
+        });
+        connect(quit, &QPushButton::clicked, this, [this]() {
+            result.status = WinUaeQtLauncherStatus::QuitRequested;
+            accept();
+        });
+        connect(restart, &QPushButton::clicked, this, [this]() {
+            result.status = WinUaeQtLauncherStatus::RestartRequested;
+            accept();
+        });
         connect(cancel, &QPushButton::clicked, this, &QDialog::reject);
         connect(start, &QPushButton::clicked, this, [this]() { startEmulator(); });
         connect(help, &QPushButton::clicked, this, [this]() { openHelp(); });
@@ -5425,6 +5441,7 @@ private:
     QTreeWidget *navigation = nullptr;
     QStackedWidget *pageStack = nullptr;
     QLabel *status = nullptr;
+    bool runtimeMode = false;
 
     QComboBox *configName = nullptr;
     QLineEdit *configPath = nullptr;
@@ -14636,9 +14653,9 @@ private:
             const int driveType = dfEnable[i]->isChecked() ? floppyTypeConfigValue(dfType[i]->currentText()) : -1;
             settings.insert(QStringLiteral("floppy%1type").arg(i), QString::number(driveType));
             settings.insert(QStringLiteral("floppy%1wp").arg(i), dfWriteProtect[i]->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
-            if (driveType >= 0 && !dfPath[i]->currentText().isEmpty()) {
-                settings.insert(QStringLiteral("floppy%1").arg(i), dfPath[i]->currentText());
-            }
+            /* Always write the path, empty included, so ejecting a disk in
+             * the runtime GUI reaches the core's disk-change detection. */
+            settings.insert(QStringLiteral("floppy%1").arg(i), driveType >= 0 ? dfPath[i]->currentText() : QString());
         }
         settings.insert(QStringLiteral("nr_floppies"), QString::number(enabledFloppyCount()));
         settings.insert(QStringLiteral("floppy_speed"), QString::number(floppySpeedConfigValue(floppySpeed->value())));
@@ -15042,7 +15059,9 @@ private:
         settings.insert(QStringLiteral("gfx_filter_enable_lace"), filterStateFromUi(2).enable ? QStringLiteral("1") : QStringLiteral("0"));
         for (int i = 0; i < MaxCdSlots; i++) {
             const QString value = cdSlotConfigValue(cdSlotState(i));
-            if (!value.isEmpty()) {
+            /* Slot 0 is always written, empty included, so ejecting the CD
+             * in the runtime GUI reaches the core. */
+            if (!value.isEmpty() || i == 0) {
                 settings.insert(QStringLiteral("cdimage%1").arg(i), value);
             }
         }
@@ -16701,6 +16720,11 @@ private:
     }
 
     void startEmulator()
+    {
+        requestStart(false);
+    }
+
+    void requestStart(bool hardReset)
     {
         const WinUaeQtConfig config = mergedConfig();
         const QStringList validationErrors = config.validateForLaunch();
@@ -16711,6 +16735,7 @@ private:
         }
 
         result.status = WinUaeQtLauncherStatus::StartRequested;
+        result.hardReset = hardReset;
         result.config = config;
         accept();
     }
index d0362fc8bfd03a1f5c86c091ce2ac783d20eb49e..2ceaae8e1ed30ca297b7c9e166ec4c2bdd628f60 100644 (file)
@@ -9,11 +9,14 @@ class QApplication;
 enum class WinUaeQtLauncherStatus {
     Canceled,
     StartRequested,
+    QuitRequested,
+    RestartRequested,
     Error
 };
 
 struct WinUaeQtLauncherResult {
     WinUaeQtLauncherStatus status = WinUaeQtLauncherStatus::Canceled;
+    bool hardReset = false;
     int exitCode = 0;
     QString error;
     WinUaeQtConfig config;
index 7a5764207dd53f5e4aabd82c711ff5f2511ea2dc..92844d30564efb9d3a34adde104fde9d3418371b 100644 (file)
@@ -539,7 +539,19 @@ int runWinUaeQtLauncherForPrefsWithConfig(int argc, char **argv, struct uae_pref
             }
             return WINUAE_QT_LAUNCHER_ERROR;
         }
-        return WINUAE_QT_LAUNCHER_START;
+        return result.hardReset ? WINUAE_QT_LAUNCHER_RESET : WINUAE_QT_LAUNCHER_START;
+    }
+    if (result.status == WinUaeQtLauncherStatus::QuitRequested) {
+        if (exitCode) {
+            *exitCode = 0;
+        }
+        return WINUAE_QT_LAUNCHER_QUIT;
+    }
+    if (result.status == WinUaeQtLauncherStatus::RestartRequested) {
+        if (exitCode) {
+            *exitCode = 0;
+        }
+        return WINUAE_QT_LAUNCHER_RESTART;
     }
     if (result.status == WinUaeQtLauncherStatus::Error) {
         QByteArray error = result.error.toLocal8Bit();
index ba6bf4d1550a1df210c524088ce34be7b1f1a96b..2c04e9b3132a6527763c21e1bc8f12639d6cc43d 100644 (file)
@@ -7,7 +7,12 @@ struct uae_prefs;
 enum {
     WINUAE_QT_LAUNCHER_EXIT = 1,
     WINUAE_QT_LAUNCHER_START = 2,
-    WINUAE_QT_LAUNCHER_ERROR = 3
+    WINUAE_QT_LAUNCHER_ERROR = 3,
+    /* Runtime (F12) GUI results, matching the Windows GUI buttons. */
+    WINUAE_QT_LAUNCHER_QUIT = 4,
+    WINUAE_QT_LAUNCHER_RESTART = 5,
+    /* Apply the edited config like START, then hard-reset the Amiga. */
+    WINUAE_QT_LAUNCHER_RESET = 6
 };
 
 int winUaeQtLauncherArgumentsSpecifyConfig(int argc, char **argv);