Qt6 frontend #1

Merged
iris merged 5 commits from qt6 into dev 2026-06-09 17:14:08 +02:00
13 changed files with 104 additions and 75 deletions
Showing only changes of commit 4b9b26f8af - Show all commits
-1
View File
@@ -147,7 +147,6 @@ add_subdirectory(external/parallel-rdp)
add_subdirectory(external/unarr)
add_subdirectory(external/SDL)
add_subdirectory(external/cflags)
add_subdirectory(external/mINI)
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
set(CAPSTONE_MIPS_SUPPORT ON)
set(CAPSTONE_X86_SUPPORT ON)
+3 -4
View File
@@ -9,8 +9,9 @@ struct Core;
class EmuThread final {
bool started = false;
public:
explicit EmuThread(double &, SettingsWindow &) noexcept;
public:
explicit EmuThread() noexcept;
~EmuThread() = default;
void run() const noexcept;
void TogglePause() const noexcept;
@@ -18,6 +19,4 @@ public:
void Stop() const noexcept;
bool interruptionRequested = false, parallelRDPInitialized = false;
SettingsWindow &settings;
double& fps;
};
+15 -12
View File
@@ -1,23 +1,26 @@
#include <KaizenGui.hpp>
#include <backend/Core.hpp>
#include <ImGuiImpl/GUI.hpp>
#include <ImGuiImpl/ProgressIndicators.hpp>
#include <ImGuiImpl/StatusBar.hpp>
#include <QMenuBar>
#include <QMenu>
#include <resources/gamecontrollerdb.h>
KaizenGui::KaizenGui() noexcept :
window("Kaizen " KAIZEN_VERSION_STR, 1280, 720), settingsWindow(window), vulkanWidget(window.getHandle()),
emuThread(fpsCounter, settingsWindow) {
gui::Initialize(n64::Core::GetInstance().parallel.wsi, window.getHandle());
KaizenGui::KaizenGui() noexcept : vulkanWidget(windowHandle()) {
SDL_InitSubSystem(SDL_INIT_GAMEPAD);
auto fileMenu = menuBar()->addMenu("File");
auto open = fileMenu->addMenu("Open");
auto exit = fileMenu->addMenu("Exit");
auto emulationMenu = menuBar()->addMenu("Emulation");
auto settingsMenu = emulationMenu->addMenu("Settings");
connect(settingsMenu, &QMenu::triggered, this, [&] { settingsWindow.show(); });
SDL_AddGamepadMapping(gamecontrollerdb_str);
emulationMenu->addSeparator();
auto pause = emulationMenu->addMenu("Pause");
auto reset = emulationMenu->addMenu("Reset");
auto stop = emulationMenu->addMenu("Stop");
auto helpMenu = menuBar()->addMenu("Help");
}
KaizenGui::~KaizenGui() {
gui::Cleanup();
SDL_Quit();
}
KaizenGui::~KaizenGui() { SDL_Quit(); }
void KaizenGui::QueryDevices(const SDL_Event &event) {
switch (event.type) {
+1 -1
View File
@@ -1,8 +1,8 @@
#pragma once
#include <QMainWindow>
#include <RenderWidget.hpp>
#include <EmuThread.hpp>
#include <SDL3/SDL_gamepad.h>
#include <QMainWindow>
class KaizenGui final : QMainWindow {
public:
+1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <ParallelRDPWrapper.hpp>
#include <QVulkanWindow>
#include <QMainWindow>
struct InputSettings;
+8 -6
View File
@@ -3,15 +3,17 @@
#include <QSettings>
AudioSettings::AudioSettings() {
v.addWidget(&volume);
volume.setRange(0, 100);
volume.setValue(int(Options::GetVolume()) * 100.f);
volume = new QSlider();
volume->setRange(0, 100);
volume->setValue(int(Options::GetVolume()) * 100.f);
QSettings settings;
connect(&volume, &QSlider::valueChanged, this, [&] {
float newValue = float(volume.value()) / 100.f;
connect(volume, &QSlider::valueChanged, this, [&] {
float newValue = float(volume->value()) / 100.f;
Options::SetVolume(newValue);
settings.setValue("audio/volume", newValue);
});
setLayout(&v);
v = new QVBoxLayout();
v->addWidget(volume);
setLayout(v);
}
+2 -2
View File
@@ -4,8 +4,8 @@
#include <QSlider>
class AudioSettings final : public QWidget {
QVBoxLayout v;
QSlider volume;
QVBoxLayout *v;
QSlider *volume;
public:
explicit AudioSettings();
+31 -14
View File
@@ -4,30 +4,47 @@
#include <QSettings>
CPUSettings::CPUSettings() {
types.addItems({"Interpreter", "Cached Interpreter"});
types = new QComboBox();
idleSkip = new QCheckBox("Idle skipping");
idleSkip->setToolTip("Whether to enable idle skipping.<br><br>"
"Note: idle skipping is a technique used in emulators<br>"
"that enables skipping the execution of certain blocks of guest code<br>"
"when it's determined that the aforementioned is used to wait on a certain<br>"
"event to occur; the code gets skipped, the event is executed immediately by<br>"
"the emulator so that the game never actually waits, progressing immediately<br>"
"and making emulation much faster.<br><br>"
"This feature is not available when the pure interpreter is selected<br>"
"because the information regarding instructions would be too limited to perform<br>"
"the evaluation above described.");
v = new QVBoxLayout();
h = new QHBoxLayout();
types->addItems({"Interpreter", "Cached Interpreter"});
QSettings settings;
connect(&types, &QComboBox::currentIndexChanged, this, [&] {
int index = types.currentIndex();
connect(types, &QComboBox::currentIndexChanged, this, [&] {
int index = types->currentIndex();
QString newValue{};
if (index == 0)
if (index == 0) {
idleSkip->hide();
newValue = "interpreter";
if (index == 1)
}
if (index == 1) {
idleSkip->show();
newValue = "cached_interpreter";
}
Options::SetCpuType(newValue.toStdString());
settings.setValue("cpu/type", newValue);
});
idleSkipLabel.setText("Idle skip:");
connect(&idleSkip, &QCheckBox::checkStateChanged, this, [&] {
Options::SetIdleSkip(idleSkip.checkState());
settings.setValue("cpu/idle_skip", idleSkip.checkState());
connect(idleSkip, &QCheckBox::checkStateChanged, this, [&] {
Options::SetIdleSkip(idleSkip->checkState());
settings.setValue("cpu/idle_skip", idleSkip->checkState());
});
h.addWidget(&idleSkipLabel);
h.addWidget(&idleSkip);
v.addWidget(&types);
v.addLayout(&h);
setLayout(&v);
h->addWidget(idleSkip);
v->addWidget(types);
v->addLayout(h);
setLayout(v);
}
+4 -5
View File
@@ -6,11 +6,10 @@
#include <QLabel>
class CPUSettings final : public QWidget {
QComboBox types;
QCheckBox idleSkip;
QVBoxLayout v;
QHBoxLayout h;
QLabel idleSkipLabel;
QComboBox *types;
QCheckBox *idleSkip;
QVBoxLayout *v;
QHBoxLayout *h;
public:
explicit CPUSettings();
+17 -11
View File
@@ -7,21 +7,27 @@
GeneralSettings::GeneralSettings() {
QSettings settings;
description.setText("Saves path:");
selectedFolderLabel.setDisabled(true);
selectedFolderLabel.setText(Options::GetSavesPath().c_str());
folderSelectButton.setText("Choose...");
connect(&folderSelectButton, &QPushButton::clicked, this, [&] {
description = new QLabel("Path:");
description->setToolTip("Path where game saves are stored.");
selectedFolderLabel = new QLabel(Options::GetSavesPath().c_str());
selectedFolderLabel->setDisabled(true);
folderSelectButton = new QPushButton("Choose...");
connect(folderSelectButton, &QPushButton::clicked, this, [&] {
auto dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), QCoreApplication::applicationDirPath(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
selectedFolderLabel.setText(dir);
selectedFolderLabel->setText(dir);
Options::SetSavesPath(dir.toStdString());
settings.setValue("general/saves_path", dir);
});
h.addWidget(&description);
h.addWidget(&selectedFolderLabel);
h.addWidget(&folderSelectButton);
v.addLayout(&h);
setLayout(&v);
h = new QHBoxLayout(this);
h->addWidget(description);
h->addWidget(selectedFolderLabel);
h->addWidget(folderSelectButton);
v = new QVBoxLayout(this);
v->addLayout(h);
setLayout(v);
}
+5 -5
View File
@@ -5,11 +5,11 @@
#include <QLabel>
class GeneralSettings final : public QWidget {
QLabel description;
QPushButton folderSelectButton;
QLabel selectedFolderLabel;
QVBoxLayout v;
QHBoxLayout h;
QLabel *description;
QPushButton *folderSelectButton;
QLabel *selectedFolderLabel;
QVBoxLayout *v;
QHBoxLayout *h;
public:
explicit GeneralSettings();
+7 -5
View File
@@ -5,10 +5,12 @@
SettingsWindow::SettingsWindow() {
hide();
QSettings settings;
categories.addTab(&general, "General");
categories.addTab(&cpu, "MIPS VR4300i");
categories.addTab(&audio, "Audio");
categories = new QTabWidget(this);
categories->addTab(&general, "General");
categories->addTab(&cpu, "MIPS VR4300i");
categories->addTab(&audio, "Audio");
v.addWidget(&categories);
setLayout(&v);
v = new QVBoxLayout(this);
v->addWidget(categories);
setLayout(v);
}
+3 -2
View File
@@ -8,12 +8,13 @@
#include <CPUSettings.hpp>
class SettingsWindow final : QWidget {
QTabWidget categories;
QTabWidget *categories;
GeneralSettings general;
AudioSettings audio;
CPUSettings cpu;
QVBoxLayout v;
QVBoxLayout *v;
public:
SettingsWindow();
void show() { QWidget::show(); }
};