Files
kaizen/src/frontend/Settings/CPUSettings.cpp
T

56 lines
2.2 KiB
C++

#include <CPUSettings.hpp>
#include <Options.hpp>
#include <ircolib/log.hpp>
CPUSettings::CPUSettings() : settings(QSettings::UserScope) {
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 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<br>"
"perform the evaluation described above.");
idleSkip->setChecked(settings.value("cpu/idle_skip", false).value<bool>());
v = new QVBoxLayout();
h = new QHBoxLayout();
types->addItems({"Interpreter", "Cached Interpreter"});
if (Options::GetCpuType() == n64::PlainInterpreter) {
idleSkip->hide();
} else {
idleSkip->show();
}
types->setCurrentIndex((int)Options::GetCpuType());
connect(types, &QComboBox::currentIndexChanged, this, [&] {
int index = types->currentIndex();
if (index == 0)
idleSkip->hide();
else
idleSkip->show();
Options::SetCpuType((n64::CPUType)index);
settings.setValue("cpu/type", (n64::CPUType)index);
settings.sync();
emit cpuTypeChanged();
});
connect(idleSkip, &QCheckBox::checkStateChanged, this, [&] {
Options::SetIdleSkip(idleSkip->checkState());
settings.setValue("cpu/idle_skip", idleSkip->checkState());
settings.sync();
emit idleSkipChanged();
});
h->addWidget(idleSkip);
v->addWidget(types);
v->addLayout(h);
setLayout(v);
}