Qt6 frontend #1
@@ -147,7 +147,6 @@ add_subdirectory(external/parallel-rdp)
|
|||||||
add_subdirectory(external/unarr)
|
add_subdirectory(external/unarr)
|
||||||
add_subdirectory(external/SDL)
|
add_subdirectory(external/SDL)
|
||||||
add_subdirectory(external/cflags)
|
add_subdirectory(external/cflags)
|
||||||
add_subdirectory(external/mINI)
|
|
||||||
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
|
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
|
||||||
set(CAPSTONE_MIPS_SUPPORT ON)
|
set(CAPSTONE_MIPS_SUPPORT ON)
|
||||||
set(CAPSTONE_X86_SUPPORT ON)
|
set(CAPSTONE_X86_SUPPORT ON)
|
||||||
|
|||||||
+10
-11
@@ -8,16 +8,15 @@ struct Core;
|
|||||||
}
|
}
|
||||||
|
|
||||||
class EmuThread final {
|
class EmuThread final {
|
||||||
bool started = false;
|
bool started = false;
|
||||||
public:
|
|
||||||
explicit EmuThread(double &, SettingsWindow &) noexcept;
|
|
||||||
~EmuThread() = default;
|
|
||||||
void run() const noexcept;
|
|
||||||
void TogglePause() const noexcept;
|
|
||||||
void Reset() const noexcept;
|
|
||||||
void Stop() const noexcept;
|
|
||||||
|
|
||||||
bool interruptionRequested = false, parallelRDPInitialized = false;
|
public:
|
||||||
SettingsWindow &settings;
|
explicit EmuThread() noexcept;
|
||||||
double& fps;
|
~EmuThread() = default;
|
||||||
|
void run() const noexcept;
|
||||||
|
void TogglePause() const noexcept;
|
||||||
|
void Reset() const noexcept;
|
||||||
|
void Stop() const noexcept;
|
||||||
|
|
||||||
|
bool interruptionRequested = false, parallelRDPInitialized = false;
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-12
@@ -1,23 +1,26 @@
|
|||||||
#include <KaizenGui.hpp>
|
#include <KaizenGui.hpp>
|
||||||
#include <backend/Core.hpp>
|
#include <backend/Core.hpp>
|
||||||
#include <ImGuiImpl/GUI.hpp>
|
#include <QMenuBar>
|
||||||
#include <ImGuiImpl/ProgressIndicators.hpp>
|
#include <QMenu>
|
||||||
#include <ImGuiImpl/StatusBar.hpp>
|
|
||||||
#include <resources/gamecontrollerdb.h>
|
#include <resources/gamecontrollerdb.h>
|
||||||
|
|
||||||
KaizenGui::KaizenGui() noexcept :
|
KaizenGui::KaizenGui() noexcept : vulkanWidget(windowHandle()) {
|
||||||
window("Kaizen " KAIZEN_VERSION_STR, 1280, 720), settingsWindow(window), vulkanWidget(window.getHandle()),
|
|
||||||
emuThread(fpsCounter, settingsWindow) {
|
|
||||||
gui::Initialize(n64::Core::GetInstance().parallel.wsi, window.getHandle());
|
|
||||||
SDL_InitSubSystem(SDL_INIT_GAMEPAD);
|
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() {
|
KaizenGui::~KaizenGui() { SDL_Quit(); }
|
||||||
gui::Cleanup();
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KaizenGui::QueryDevices(const SDL_Event &event) {
|
void KaizenGui::QueryDevices(const SDL_Event &event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <QMainWindow>
|
||||||
#include <RenderWidget.hpp>
|
#include <RenderWidget.hpp>
|
||||||
#include <EmuThread.hpp>
|
#include <EmuThread.hpp>
|
||||||
#include <SDL3/SDL_gamepad.h>
|
#include <SDL3/SDL_gamepad.h>
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
class KaizenGui final : QMainWindow {
|
class KaizenGui final : QMainWindow {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <ParallelRDPWrapper.hpp>
|
#include <ParallelRDPWrapper.hpp>
|
||||||
#include <QVulkanWindow>
|
#include <QVulkanWindow>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
struct InputSettings;
|
struct InputSettings;
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
AudioSettings::AudioSettings() {
|
AudioSettings::AudioSettings() {
|
||||||
v.addWidget(&volume);
|
volume = new QSlider();
|
||||||
volume.setRange(0, 100);
|
volume->setRange(0, 100);
|
||||||
volume.setValue(int(Options::GetVolume()) * 100.f);
|
volume->setValue(int(Options::GetVolume()) * 100.f);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
connect(&volume, &QSlider::valueChanged, this, [&] {
|
connect(volume, &QSlider::valueChanged, this, [&] {
|
||||||
float newValue = float(volume.value()) / 100.f;
|
float newValue = float(volume->value()) / 100.f;
|
||||||
Options::SetVolume(newValue);
|
Options::SetVolume(newValue);
|
||||||
settings.setValue("audio/volume", newValue);
|
settings.setValue("audio/volume", newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
setLayout(&v);
|
v = new QVBoxLayout();
|
||||||
|
v->addWidget(volume);
|
||||||
|
setLayout(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
|
|
||||||
class AudioSettings final : public QWidget {
|
class AudioSettings final : public QWidget {
|
||||||
QVBoxLayout v;
|
QVBoxLayout *v;
|
||||||
QSlider volume;
|
QSlider *volume;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AudioSettings();
|
explicit AudioSettings();
|
||||||
|
|||||||
@@ -4,30 +4,47 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
CPUSettings::CPUSettings() {
|
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;
|
QSettings settings;
|
||||||
connect(&types, &QComboBox::currentIndexChanged, this, [&] {
|
connect(types, &QComboBox::currentIndexChanged, this, [&] {
|
||||||
int index = types.currentIndex();
|
int index = types->currentIndex();
|
||||||
QString newValue{};
|
QString newValue{};
|
||||||
if (index == 0)
|
if (index == 0) {
|
||||||
|
idleSkip->hide();
|
||||||
newValue = "interpreter";
|
newValue = "interpreter";
|
||||||
if (index == 1)
|
}
|
||||||
|
if (index == 1) {
|
||||||
|
idleSkip->show();
|
||||||
newValue = "cached_interpreter";
|
newValue = "cached_interpreter";
|
||||||
|
}
|
||||||
|
|
||||||
Options::SetCpuType(newValue.toStdString());
|
Options::SetCpuType(newValue.toStdString());
|
||||||
settings.setValue("cpu/type", newValue);
|
settings.setValue("cpu/type", newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
idleSkipLabel.setText("Idle skip:");
|
connect(idleSkip, &QCheckBox::checkStateChanged, this, [&] {
|
||||||
connect(&idleSkip, &QCheckBox::checkStateChanged, this, [&] {
|
Options::SetIdleSkip(idleSkip->checkState());
|
||||||
Options::SetIdleSkip(idleSkip.checkState());
|
settings.setValue("cpu/idle_skip", idleSkip->checkState());
|
||||||
settings.setValue("cpu/idle_skip", idleSkip.checkState());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
h.addWidget(&idleSkipLabel);
|
h->addWidget(idleSkip);
|
||||||
h.addWidget(&idleSkip);
|
v->addWidget(types);
|
||||||
v.addWidget(&types);
|
v->addLayout(h);
|
||||||
v.addLayout(&h);
|
setLayout(v);
|
||||||
setLayout(&v);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,10 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
class CPUSettings final : public QWidget {
|
class CPUSettings final : public QWidget {
|
||||||
QComboBox types;
|
QComboBox *types;
|
||||||
QCheckBox idleSkip;
|
QCheckBox *idleSkip;
|
||||||
QVBoxLayout v;
|
QVBoxLayout *v;
|
||||||
QHBoxLayout h;
|
QHBoxLayout *h;
|
||||||
QLabel idleSkipLabel;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CPUSettings();
|
explicit CPUSettings();
|
||||||
|
|||||||
@@ -7,21 +7,27 @@
|
|||||||
|
|
||||||
GeneralSettings::GeneralSettings() {
|
GeneralSettings::GeneralSettings() {
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
description.setText("Saves path:");
|
description = new QLabel("Path:");
|
||||||
selectedFolderLabel.setDisabled(true);
|
description->setToolTip("Path where game saves are stored.");
|
||||||
selectedFolderLabel.setText(Options::GetSavesPath().c_str());
|
selectedFolderLabel = new QLabel(Options::GetSavesPath().c_str());
|
||||||
folderSelectButton.setText("Choose...");
|
selectedFolderLabel->setDisabled(true);
|
||||||
connect(&folderSelectButton, &QPushButton::clicked, this, [&] {
|
folderSelectButton = new QPushButton("Choose...");
|
||||||
|
|
||||||
|
connect(folderSelectButton, &QPushButton::clicked, this, [&] {
|
||||||
auto dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), QCoreApplication::applicationDirPath(),
|
auto dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), QCoreApplication::applicationDirPath(),
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
selectedFolderLabel.setText(dir);
|
selectedFolderLabel->setText(dir);
|
||||||
Options::SetSavesPath(dir.toStdString());
|
Options::SetSavesPath(dir.toStdString());
|
||||||
settings.setValue("general/saves_path", dir);
|
settings.setValue("general/saves_path", dir);
|
||||||
});
|
});
|
||||||
|
|
||||||
h.addWidget(&description);
|
h = new QHBoxLayout(this);
|
||||||
h.addWidget(&selectedFolderLabel);
|
|
||||||
h.addWidget(&folderSelectButton);
|
h->addWidget(description);
|
||||||
v.addLayout(&h);
|
h->addWidget(selectedFolderLabel);
|
||||||
setLayout(&v);
|
h->addWidget(folderSelectButton);
|
||||||
|
|
||||||
|
v = new QVBoxLayout(this);
|
||||||
|
v->addLayout(h);
|
||||||
|
setLayout(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
class GeneralSettings final : public QWidget {
|
class GeneralSettings final : public QWidget {
|
||||||
QLabel description;
|
QLabel *description;
|
||||||
QPushButton folderSelectButton;
|
QPushButton *folderSelectButton;
|
||||||
QLabel selectedFolderLabel;
|
QLabel *selectedFolderLabel;
|
||||||
QVBoxLayout v;
|
QVBoxLayout *v;
|
||||||
QHBoxLayout h;
|
QHBoxLayout *h;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneralSettings();
|
explicit GeneralSettings();
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
SettingsWindow::SettingsWindow() {
|
SettingsWindow::SettingsWindow() {
|
||||||
hide();
|
hide();
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
categories.addTab(&general, "General");
|
categories = new QTabWidget(this);
|
||||||
categories.addTab(&cpu, "MIPS VR4300i");
|
categories->addTab(&general, "General");
|
||||||
categories.addTab(&audio, "Audio");
|
categories->addTab(&cpu, "MIPS VR4300i");
|
||||||
|
categories->addTab(&audio, "Audio");
|
||||||
|
|
||||||
v.addWidget(&categories);
|
v = new QVBoxLayout(this);
|
||||||
setLayout(&v);
|
v->addWidget(categories);
|
||||||
|
setLayout(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,13 @@
|
|||||||
#include <CPUSettings.hpp>
|
#include <CPUSettings.hpp>
|
||||||
|
|
||||||
class SettingsWindow final : QWidget {
|
class SettingsWindow final : QWidget {
|
||||||
QTabWidget categories;
|
QTabWidget *categories;
|
||||||
GeneralSettings general;
|
GeneralSettings general;
|
||||||
AudioSettings audio;
|
AudioSettings audio;
|
||||||
CPUSettings cpu;
|
CPUSettings cpu;
|
||||||
QVBoxLayout v;
|
QVBoxLayout *v;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsWindow();
|
SettingsWindow();
|
||||||
|
void show() { QWidget::show(); }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user