From: Stefan Reinauer Date: Fri, 12 Jun 2026 04:58:38 +0000 (-0700) Subject: od-unix: match Windows GUI button semantics in runtime (F12) UI X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=af9633a6e02e0de1cdb244f77052f1e9877ff795;p=francis%2Fwinuae.git od-unix: match Windows GUI button semantics in runtime (F12) UI 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. --- diff --git a/README_unix.md b/README_unix.md index 28680bec..c2933d0a 100644 --- a/README_unix.md +++ b/README_unix.md @@ -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. diff --git a/od-unix/gui.cpp b/od-unix/gui.cpp index 21ffc623..aef839ee 100644 --- a/od-unix/gui.cpp +++ b/od-unix/gui.cpp @@ -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); } diff --git a/od-unix/qt/launcher.cpp b/od-unix/qt/launcher.cpp index d3708c88..79b79e12 100644 --- a/od-unix/qt/launcher.cpp +++ b/od-unix/qt/launcher.cpp @@ -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(); } diff --git a/od-unix/qt/launcher.h b/od-unix/qt/launcher.h index d0362fc8..2ceaae8e 100644 --- a/od-unix/qt/launcher.h +++ b/od-unix/qt/launcher.h @@ -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; diff --git a/od-unix/qt/launcher_bridge.cpp b/od-unix/qt/launcher_bridge.cpp index 7a576420..92844d30 100644 --- a/od-unix/qt/launcher_bridge.cpp +++ b/od-unix/qt/launcher_bridge.cpp @@ -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(); diff --git a/od-unix/qt/launcher_bridge.h b/od-unix/qt/launcher_bridge.h index ba6bf4d1..2c04e9b3 100644 --- a/od-unix/qt/launcher_bridge.h +++ b/od-unix/qt/launcher_bridge.h @@ -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);