From 3192b9621fbe09ee14afd6039dff64dcde350afa Mon Sep 17 00:00:00 2001 From: Arisotura Date: Thu, 15 Sep 2022 23:39:30 +0200 Subject: [PATCH] work some on the UI... make it not labelled Fart --- src/frontend/qt_sdl/Config.cpp | 16 ++-- .../qt_sdl/FirmwareSettingsDialog.cpp | 7 ++ src/frontend/qt_sdl/FirmwareSettingsDialog.ui | 9 ++- src/frontend/qt_sdl/main.cpp | 81 ++++++++++++------- src/frontend/qt_sdl/main.h | 4 +- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index 467a5349..90a1e48b 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -281,9 +281,9 @@ ConfigEntry ConfigFile[] = {"AudioInterp", 0, &AudioInterp, 0, false}, {"AudioBitrate", 0, &AudioBitrate, 0, false}, - {"AudioVolume", 0, &AudioVolume, 256, false}, - {"MicInputType", 0, &MicInputType, 1, false}, - {"MicWavPath", 2, &MicWavPath, (std::string)"", false}, + {"AudioVolume", 0, &AudioVolume, 256, true}, + {"MicInputType", 0, &MicInputType, 1, true}, + {"MicWavPath", 2, &MicWavPath, (std::string)"", true}, {"LastROMFolder", 2, &LastROMFolder, (std::string)"", true}, @@ -308,9 +308,9 @@ ConfigEntry ConfigFile[] = {"MouseHideSeconds", 0, &MouseHideSeconds, 5, false}, {"PauseLostFocus", 1, &PauseLostFocus, false, false}, - {"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, false}, - {"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, false}, - {"DSiBatteryCharging", 1, &DSiBatteryCharging, true, false}, + {"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, true}, + {"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, true}, + {"DSiBatteryCharging", 1, &DSiBatteryCharging, true, true}, {"", -1, nullptr, 0, false} }; @@ -322,7 +322,7 @@ void LoadFile(int inst) if (inst > 0) { char name[100] = {0}; - snprintf(name, 99, kUniqueConfigFile, inst); + snprintf(name, 99, kUniqueConfigFile, inst+1); f = Platform::OpenLocalFile(name, "r"); } else @@ -392,7 +392,7 @@ void Save() if (inst > 0) { char name[100] = {0}; - snprintf(name, 99, kUniqueConfigFile, inst); + snprintf(name, 99, kUniqueConfigFile, inst+1); f = Platform::OpenLocalFile(name, "w"); } else diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp index 69798d21..7643c1e4 100644 --- a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp +++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp @@ -19,6 +19,7 @@ #include #include "Config.h" +#include "Platform.h" #include "FirmwareSettingsDialog.h" #include "ui_FirmwareSettingsDialog.h" @@ -66,6 +67,12 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC)); on_overrideFirmwareBox_toggled(); + + int inst = Platform::InstanceID(); + if (inst > 0) + ui->lblInstanceNum->setText(QString("Configuring settings for instance %1").arg(inst+1)); + else + ui->lblInstanceNum->hide(); } FirmwareSettingsDialog::~FirmwareSettingsDialog() diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui index 245e6418..37146296 100644 --- a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui +++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui @@ -7,7 +7,7 @@ 0 0 511 - 338 + 357 @@ -23,6 +23,13 @@ QLayout::SetFixedSize + + + + Configuring settings for instance X + + + diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index ceb19b5f..986f2180 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1340,6 +1340,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) setAttribute(Qt::WA_DeleteOnClose); setAcceptDrops(true); + int inst = Platform::InstanceID(); + QMenuBar* menubar = new QMenuBar(); { QMenu* menu = menubar->addMenu("File"); @@ -1471,55 +1473,70 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) actEnableCheats->setCheckable(true); connect(actEnableCheats, &QAction::triggered, this, &MainWindow::onEnableCheats); - actSetupCheats = menu->addAction("Setup cheat codes"); - actSetupCheats->setMenuRole(QAction::NoRole); - connect(actSetupCheats, &QAction::triggered, this, &MainWindow::onSetupCheats); + //if (inst == 0) + { + actSetupCheats = menu->addAction("Setup cheat codes"); + actSetupCheats->setMenuRole(QAction::NoRole); + connect(actSetupCheats, &QAction::triggered, this, &MainWindow::onSetupCheats); - menu->addSeparator(); - actROMInfo = menu->addAction("ROM info"); - connect(actROMInfo, &QAction::triggered, this, &MainWindow::onROMInfo); + menu->addSeparator(); + actROMInfo = menu->addAction("ROM info"); + connect(actROMInfo, &QAction::triggered, this, &MainWindow::onROMInfo); - actRAMInfo = menu->addAction("RAM search"); - connect(actRAMInfo, &QAction::triggered, this, &MainWindow::onRAMInfo); + actRAMInfo = menu->addAction("RAM search"); + connect(actRAMInfo, &QAction::triggered, this, &MainWindow::onRAMInfo); - actTitleManager = menu->addAction("Manage DSi titles"); - connect(actTitleManager, &QAction::triggered, this, &MainWindow::onOpenTitleManager); + actTitleManager = menu->addAction("Manage DSi titles"); + connect(actTitleManager, &QAction::triggered, this, &MainWindow::onOpenTitleManager); + } - // TEST!! - menu->addSeparator(); - actTest = menu->addAction("Fart"); - connect(actTest, &QAction::triggered, this, &MainWindow::onTest); + { + menu->addSeparator(); + QMenu* submenu = menu->addMenu("Multiplayer"); + + actMPNewInstance = submenu->addAction("Launch new instance"); + connect(actMPNewInstance, &QAction::triggered, this, &MainWindow::onMPNewInstance); + } } { QMenu* menu = menubar->addMenu("Config"); - actEmuSettings = menu->addAction("Emu settings"); - connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); + //if (inst == 0) + { + actEmuSettings = menu->addAction("Emu settings"); + connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); #ifdef __APPLE__ - QAction* actPreferences = menu->addAction("Preferences..."); - connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); - actPreferences->setMenuRole(QAction::PreferencesRole); + QAction* actPreferences = menu->addAction("Preferences..."); + connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); + actPreferences->setMenuRole(QAction::PreferencesRole); #endif + } actInputConfig = menu->addAction("Input and hotkeys"); connect(actInputConfig, &QAction::triggered, this, &MainWindow::onOpenInputConfig); - actVideoSettings = menu->addAction("Video settings"); - connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings); + //if (inst == 0) + { + actVideoSettings = menu->addAction("Video settings"); + connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings); + } actAudioSettings = menu->addAction("Audio settings"); connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings); - actWifiSettings = menu->addAction("Wifi settings"); - connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings); - - actInterfaceSettings = menu->addAction("Interface settings"); - connect(actInterfaceSettings, &QAction::triggered, this, &MainWindow::onOpenInterfaceSettings); + //if (inst == 0) + { + actWifiSettings = menu->addAction("Wifi settings"); + connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings); + } actFirmwareSettings = menu->addAction("Firmware settings"); connect(actFirmwareSettings, &QAction::triggered, this, &MainWindow::onOpenFirmwareSettings); + actInterfaceSettings = menu->addAction("Interface settings"); + connect(actInterfaceSettings, &QAction::triggered, this, &MainWindow::onOpenInterfaceSettings); + actPathSettings = menu->addAction("Path settings"); connect(actPathSettings, &QAction::triggered, this, &MainWindow::onOpenPathSettings); @@ -2616,17 +2633,21 @@ void MainWindow::onOpenTitleManager() TitleManagerDialog* dlg = TitleManagerDialog::openDlg(this); } -void MainWindow::onTest() +void MainWindow::onMPNewInstance() { //QProcess::startDetached(QApplication::applicationFilePath()); - QProcess ass; + QProcess newinst; + newinst.setProgram(QApplication::applicationFilePath()); + newinst.setArguments(QApplication::arguments().mid(1, QApplication::arguments().length()-1)); + #ifdef __WIN32__ - ass.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args) + newinst.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args) { args->flags |= CREATE_NEW_CONSOLE; }); #endif - ass.startDetached(QApplication::applicationFilePath()); + + newinst.startDetached(); } void MainWindow::onOpenEmuSettings() diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h index 0af0798b..217128b8 100644 --- a/src/frontend/qt_sdl/main.h +++ b/src/frontend/qt_sdl/main.h @@ -255,7 +255,7 @@ private slots: void onROMInfo(); void onRAMInfo(); void onOpenTitleManager(); - void onTest(); + void onMPNewInstance(); void onOpenEmuSettings(); void onEmuSettingsDialogFinished(int res); @@ -345,7 +345,7 @@ public: QAction* actROMInfo; QAction* actRAMInfo; QAction* actTitleManager; - QAction* actTest; + QAction* actMPNewInstance; QAction* actEmuSettings; QAction* actPowerManagement;