Initial Options tab, CVar dialog

This commit is contained in:
Luke Street 2020-04-15 02:13:11 -04:00
parent 4c178bee84
commit 3487423d78
12 changed files with 742 additions and 192 deletions

View File

@ -1,12 +1,11 @@
#include "ArgumentEditor.hpp" #include "ArgumentEditor.hpp"
#include "ui_ArgumentEditor.h" #include "ui_ArgumentEditor.h"
#include "CVarDialog.hpp"
#include <QSettings> #include <QSettings>
#include <QInputDialog> #include <QInputDialog>
#include <QDebug> #include <QDebug>
ArgumentEditor::ArgumentEditor(QWidget* parent) ArgumentEditor::ArgumentEditor(QWidget* parent) : QDialog(parent), m_ui(std::make_unique<Ui::ArgumentEditor>()) {
: QDialog(parent)
, m_ui(std::make_unique<Ui::ArgumentEditor>()) {
m_ui->setupUi(this); m_ui->setupUi(this);
m_model.setStringList(QSettings().value(QStringLiteral("urde_arguments")).toStringList()); m_model.setStringList(QSettings().value(QStringLiteral("urde_arguments")).toStringList());
m_ui->argumentEditor->setModel(&m_model); m_ui->argumentEditor->setModel(&m_model);
@ -24,10 +23,21 @@ void ArgumentEditor::on_addButton_clicked() {
} }
} }
void ArgumentEditor::on_addCvarButton_clicked() {
CVarDialog input(this);
int code = input.exec();
if (code == DialogCode::Accepted) {
QStringList list = m_model.stringList();
list << input.textValue();
m_model.setStringList(list);
}
}
void ArgumentEditor::on_editButton_clicked() { void ArgumentEditor::on_editButton_clicked() {
QModelIndex index = m_ui->argumentEditor->currentIndex(); QModelIndex index = m_ui->argumentEditor->currentIndex();
if (!index.isValid()) if (!index.isValid()) {
return; return;
}
QInputDialog input(this); QInputDialog input(this);
input.setTextValue(m_model.stringList().value(index.row())); input.setTextValue(m_model.stringList().value(index.row()));
@ -41,12 +51,13 @@ void ArgumentEditor::on_editButton_clicked() {
void ArgumentEditor::on_deleteButton_clicked() { void ArgumentEditor::on_deleteButton_clicked() {
QModelIndex index = m_ui->argumentEditor->currentIndex(); QModelIndex index = m_ui->argumentEditor->currentIndex();
if (index.isValid()) if (index.isValid()) {
m_model.removeRows(index.row(), 1); m_model.removeRows(index.row(), 1);
}
} }
void ArgumentEditor::on_buttonBox_clicked(QAbstractButton* button) { void ArgumentEditor::on_buttonBox_clicked(QAbstractButton* button) {
QDialogButtonBox* buttonBox = qobject_cast<QDialogButtonBox*>(sender()); auto* buttonBox = qobject_cast<QDialogButtonBox*>(sender());
if (button == buttonBox->button(QDialogButtonBox::Ok)) { if (button == buttonBox->button(QDialogButtonBox::Ok)) {
QSettings().setValue(QStringLiteral("urde_arguments"), m_model.stringList()); QSettings().setValue(QStringLiteral("urde_arguments"), m_model.stringList());
accept(); accept();

View File

@ -9,21 +9,22 @@ class QAbstractButton;
namespace Ui { namespace Ui {
class ArgumentEditor; class ArgumentEditor;
} } // namespace Ui
class ArgumentEditor : public QDialog { class ArgumentEditor : public QDialog {
Q_OBJECT Q_OBJECT
std::unique_ptr<Ui::ArgumentEditor> m_ui; std::unique_ptr<Ui::ArgumentEditor> m_ui;
QStringListModel m_model; QStringListModel m_model;
public: public:
explicit ArgumentEditor(QWidget* parent = nullptr); explicit ArgumentEditor(QWidget* parent = nullptr);
~ArgumentEditor() override; ~ArgumentEditor() override;
private slots: private slots:
void on_addButton_clicked(); void on_addButton_clicked();
void on_addCvarButton_clicked();
void on_editButton_clicked(); void on_editButton_clicked();
void on_deleteButton_clicked(); void on_deleteButton_clicked();
void on_buttonBox_clicked(QAbstractButton*); void on_buttonBox_clicked(QAbstractButton*);
}; };

View File

@ -14,14 +14,38 @@
<string>Argument Editor</string> <string>Argument Editor</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="5">
<widget class="QListView" name="argumentEditor"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="addCvarButton">
<property name="text">
<string>Add &amp;CVar</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QPushButton" name="editButton">
<property name="text">
<string>&amp;Edit</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="deleteButton"> <widget class="QPushButton" name="deleteButton">
<property name="text"> <property name="text">
<string>&amp;Delete</string> <string>&amp;Delete</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -34,7 +58,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
@ -44,23 +68,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" rowspan="4">
<widget class="QListView" name="argumentEditor"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="editButton">
<property name="text">
<string>&amp;Edit</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -21,6 +21,9 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE
ArgumentEditor.ui ArgumentEditor.ui
Common.cpp Common.cpp
Common.hpp Common.hpp
CVarDialog.cpp
CVarDialog.hpp
CVarDialog.ui
DownloadManager.cpp DownloadManager.cpp
DownloadManager.hpp DownloadManager.hpp
ErrorLabel.hpp ErrorLabel.hpp
@ -80,6 +83,7 @@ target_link_libraries(hecl-gui PRIVATE
xxhash xxhash
z z
zeus zeus
RetroDataSpec
) )
target_include_directories(hecl-gui PRIVATE quazip/quazip) target_include_directories(hecl-gui PRIVATE quazip/quazip)

79
hecl-gui/CVarDialog.cpp Normal file
View File

@ -0,0 +1,79 @@
#include "CVarDialog.hpp"
#include "ui_CVarDialog.h"
#include <QSettings>
#include <utility>
enum class CVarType {
String,
Boolean,
};
struct CVarItem {
QString m_name;
CVarType m_type;
QVariant m_defaultValue;
CVarItem(QString name, CVarType type, QVariant defaultValue)
: m_name(std::move(name)), m_type(type), m_defaultValue(std::move(defaultValue)) {}
};
static std::array cvarList{
CVarItem{QStringLiteral("tweak.game.FieldOfView"), CVarType::String, 55},
CVarItem{QStringLiteral("debugOverlay.playerInfo"), CVarType::Boolean, false},
CVarItem{QStringLiteral("debugOverlay.areaInfo"), CVarType::Boolean, false},
// TODO expand
};
CVarDialog::CVarDialog(QWidget* parent) : QDialog(parent), m_ui(std::make_unique<Ui::CVarDialog>()) {
m_ui->setupUi(this);
QStringList list;
for (const auto& item : cvarList) {
list << item.m_name;
}
m_model.setStringList(list);
m_ui->cvarList->setModel(&m_model);
connect(m_ui->cvarList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(handleSelectionChanged(QItemSelection)));
}
CVarDialog::~CVarDialog() = default;
void CVarDialog::on_buttonBox_accepted() {
const QModelIndexList& list = m_ui->cvarList->selectionModel()->selectedIndexes();
if (list.isEmpty()) {
reject();
} else {
accept();
}
}
void CVarDialog::on_buttonBox_rejected() { reject(); }
void CVarDialog::handleSelectionChanged(const QItemSelection& selection) {
const QModelIndexList& list = selection.indexes();
if (list.isEmpty()) {
return;
}
const auto item = cvarList[(*list.begin()).row()];
m_ui->valueStack->setCurrentIndex(static_cast<int>(item.m_type));
if (item.m_type == CVarType::String) {
m_ui->stringValueField->setText(item.m_defaultValue.toString());
} else if (item.m_type == CVarType::Boolean) {
m_ui->booleanValueField->setChecked(item.m_defaultValue.toBool());
}
}
QString CVarDialog::textValue() {
const QModelIndexList& list = m_ui->cvarList->selectionModel()->selectedIndexes();
if (list.isEmpty()) {
return QStringLiteral("");
}
const auto item = cvarList[(*list.begin()).row()];
QVariant value;
if (item.m_type == CVarType::String) {
value = m_ui->stringValueField->text();
} else if (item.m_type == CVarType::Boolean) {
value = m_ui->booleanValueField->isChecked();
}
return QStringLiteral("+") + item.m_name + QStringLiteral("=") + value.toString();
}

32
hecl-gui/CVarDialog.hpp Normal file
View File

@ -0,0 +1,32 @@
#ifndef CVARDIALOG_H
#define CVARDIALOG_H
#include <QDialog>
#include <QStringListModel>
#include <QAbstractButton>
#include <QItemSelection>
namespace Ui {
class CVarDialog;
} // namespace Ui
class CVarDialog : public QDialog {
Q_OBJECT
public:
explicit CVarDialog(QWidget* parent = nullptr);
~CVarDialog() override;
QString textValue();
private:
std::unique_ptr<Ui::CVarDialog> m_ui;
QStringListModel m_model;
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void handleSelectionChanged(const QItemSelection& selection);
};
#endif // CVARDIALOG_H

139
hecl-gui/CVarDialog.ui Normal file
View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CVarDialog</class>
<widget class="QDialog" name="CVarDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>613</width>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
<string>Add CVar</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" rowspan="6">
<widget class="QListView" name="cvarList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QStackedWidget" name="valueStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="stringPage">
<layout class="QVBoxLayout" name="stringPageLayout">
<item>
<widget class="QLabel" name="stringLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Value</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="stringValueField">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="boolPage">
<layout class="QVBoxLayout" name="boolPageLayout">
<item>
<widget class="QCheckBox" name="booleanValueField">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -47,7 +47,7 @@ static const QString Domain = QStringLiteral("https://releases.axiodl.com/");
static const QString Index = QStringLiteral("index.txt"); static const QString Index = QStringLiteral("index.txt");
void DownloadManager::fetchIndex() { void DownloadManager::fetchIndex() {
if (m_indexInProgress) { if (m_indexInProgress != nullptr) {
return; return;
} }
@ -64,7 +64,7 @@ void DownloadManager::fetchIndex() {
} }
void DownloadManager::fetchBinary(const QString& str, const QString& outPath) { void DownloadManager::fetchBinary(const QString& str, const QString& outPath) {
if (m_binaryInProgress) { if (m_binaryInProgress != nullptr) {
return; return;
} }
@ -80,7 +80,7 @@ void DownloadManager::fetchBinary(const QString& str, const QString& outPath) {
connect(m_binaryInProgress, &QNetworkReply::encrypted, this, &DownloadManager::binaryValidateCert); connect(m_binaryInProgress, &QNetworkReply::encrypted, this, &DownloadManager::binaryValidateCert);
connect(m_binaryInProgress, &QNetworkReply::downloadProgress, this, &DownloadManager::binaryDownloadProgress); connect(m_binaryInProgress, &QNetworkReply::downloadProgress, this, &DownloadManager::binaryDownloadProgress);
if (m_progBar) { if (m_progBar != nullptr) {
m_progBar->setEnabled(true); m_progBar->setEnabled(true);
m_progBar->setValue(0); m_progBar->setValue(0);
} }

View File

@ -3,8 +3,6 @@
#include "ArgumentEditor.hpp" #include "ArgumentEditor.hpp"
#include <QList> #include <QList>
extern hecl::CVar* hecl::com_developer;
LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent) LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
: QMenu(tr("Launch Menu"), parent) : QMenu(tr("Launch Menu"), parent)
, m_commons(commons) , m_commons(commons)
@ -12,6 +10,7 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
, m_msaaMenu(tr("Anti-Aliasing"), this) , m_msaaMenu(tr("Anti-Aliasing"), this)
, m_anisoMenu(tr("Anisotropic Filtering"), this) , m_anisoMenu(tr("Anisotropic Filtering"), this)
, m_experimentalMenu(tr("Experimental Features"), this) , m_experimentalMenu(tr("Experimental Features"), this)
, m_developerMenu(tr("Developer Options"), this)
, m_apiGroup(this) , m_apiGroup(this)
, m_msaaGroup(this) , m_msaaGroup(this)
, m_anisoGroup(this) { , m_anisoGroup(this) {
@ -40,11 +39,14 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
m_apiMenu.addActions(m_apiGroup.actions()); m_apiMenu.addActions(m_apiGroup.actions());
m_msaaMenu.addActions(m_msaaGroup.actions()); m_msaaMenu.addActions(m_msaaGroup.actions());
m_anisoMenu.addActions(m_anisoGroup.actions()); m_anisoMenu.addActions(m_anisoGroup.actions());
initExperimental(); initExperimentalMenu();
initDeveloperMenu();
addMenu(&m_apiMenu)->setToolTip(QString::fromUtf8(m_commons.m_graphicsApi->rawHelp().data())); addMenu(&m_apiMenu)->setToolTip(QString::fromUtf8(m_commons.m_graphicsApi->rawHelp().data()));
addMenu(&m_msaaMenu)->setToolTip(QString::fromUtf8(m_commons.m_drawSamples->rawHelp().data())); addMenu(&m_msaaMenu)->setToolTip(QString::fromUtf8(m_commons.m_drawSamples->rawHelp().data()));
addMenu(&m_anisoMenu)->setToolTip(QString::fromUtf8(m_commons.m_texAnisotropy->rawHelp().data())); addMenu(&m_anisoMenu)->setToolTip(QString::fromUtf8(m_commons.m_texAnisotropy->rawHelp().data()));
addMenu(&m_experimentalMenu)->setToolTip(QString::fromUtf8(hecl::com_variableDt->rawHelp().data())); addMenu(&m_experimentalMenu);
m_developerMenuAction = addMenu(&m_developerMenu);
m_developerMenuAction->setVisible(hecl::com_developer->toBoolean());
const QAction* argumentEditor = addAction(tr("Edit Runtime Arguments")); const QAction* argumentEditor = addAction(tr("Edit Runtime Arguments"));
connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs); connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs);
initDeepColor(); initDeepColor();
@ -58,24 +60,27 @@ void LaunchMenu::initApiAction(const QString& action) {
QAction* act = m_apiGroup.addAction(action); QAction* act = m_apiGroup.addAction(action);
connect(act, &QAction::triggered, this, &LaunchMenu::apiTriggered); connect(act, &QAction::triggered, this, &LaunchMenu::apiTriggered);
act->setCheckable(true); act->setCheckable(true);
if (!action.compare(QString::fromStdString(m_commons.getGraphicsApi()), Qt::CaseInsensitive)) if (action.compare(QString::fromStdString(m_commons.getGraphicsApi()), Qt::CaseInsensitive) == 0) {
act->setChecked(true); act->setChecked(true);
}
} }
void LaunchMenu::initMsaaAction(const QString& action) { void LaunchMenu::initMsaaAction(const QString& action) {
QAction* act = m_msaaGroup.addAction(action); QAction* act = m_msaaGroup.addAction(action);
connect(act, &QAction::triggered, this, &LaunchMenu::msaaTriggered); connect(act, &QAction::triggered, this, &LaunchMenu::msaaTriggered);
act->setCheckable(true); act->setCheckable(true);
if (!action.compare(QString::number(m_commons.getSamples()), Qt::CaseInsensitive)) if (action.compare(QString::number(m_commons.getSamples()), Qt::CaseInsensitive) == 0) {
act->setChecked(true); act->setChecked(true);
}
} }
void LaunchMenu::initAnisoAction(const QString& action) { void LaunchMenu::initAnisoAction(const QString& action) {
QAction* act = m_anisoGroup.addAction(action); QAction* act = m_anisoGroup.addAction(action);
connect(act, &QAction::triggered, this, &LaunchMenu::anisoTriggered); connect(act, &QAction::triggered, this, &LaunchMenu::anisoTriggered);
act->setCheckable(true); act->setCheckable(true);
if (!action.compare(QString::number(m_commons.getAnisotropy()), Qt::CaseInsensitive)) if (action.compare(QString::number(m_commons.getAnisotropy()), Qt::CaseInsensitive) == 0) {
act->setChecked(true); act->setChecked(true);
}
} }
void LaunchMenu::initDeepColor() { void LaunchMenu::initDeepColor() {
@ -102,12 +107,17 @@ void LaunchMenu::initCheats() {
connect(m_enableCheats, &QAction::triggered, this, &LaunchMenu::cheatsTriggered); connect(m_enableCheats, &QAction::triggered, this, &LaunchMenu::cheatsTriggered);
} }
void LaunchMenu::initExperimental() { void LaunchMenu::initExperimentalMenu() {
m_variableDt = m_experimentalMenu.addAction(tr("Variable delta time")); initCVarAction(m_experimentalMenu.addAction(tr("Variable delta time")), m_commons.m_variableDt);
m_variableDt->setToolTip(QString::fromUtf8(hecl::com_variableDt->rawHelp().data())); }
m_variableDt->setCheckable(true);
m_variableDt->setChecked(hecl::com_variableDt->toBoolean()); void LaunchMenu::initDeveloperMenu() {
connect(m_variableDt, &QAction::triggered, this, &LaunchMenu::variableDtTriggered); initCVarAction(m_developerMenu.addAction(tr("Area Info Overlay")), m_commons.m_debugOverlayAreaInfo);
initCVarAction(m_developerMenu.addAction(tr("Player Info Overlay")), m_commons.m_debugOverlayPlayerInfo);
initCVarAction(m_developerMenu.addAction(tr("World Info Overlay")), m_commons.m_debugOverlayWorldInfo);
initCVarAction(m_developerMenu.addAction(tr("Show Frame Counter")), m_commons.m_debugOverlayShowFrameCounter);
initCVarAction(m_developerMenu.addAction(tr("Show In-Game time")), m_commons.m_debugOverlayShowInGameTime);
initCVarAction(m_developerMenu.addAction(tr("Show Resource Stats")), m_commons.m_debugOverlayShowResourceStats);
} }
void LaunchMenu::apiTriggered() { void LaunchMenu::apiTriggered() {
@ -138,6 +148,7 @@ void LaunchMenu::developerModeTriggered() {
if (hecl::com_enableCheats->toBoolean() && !isChecked) { if (hecl::com_enableCheats->toBoolean() && !isChecked) {
m_enableCheats->setChecked(false); m_enableCheats->setChecked(false);
} }
m_developerMenuAction->setVisible(isChecked);
hecl::CVarManager::instance()->setDeveloperMode(isChecked, true); hecl::CVarManager::instance()->setDeveloperMode(isChecked, true);
m_commons.serialize(); m_commons.serialize();
@ -147,25 +158,32 @@ void LaunchMenu::cheatsTriggered() {
const bool isChecked = qobject_cast<QAction*>(sender())->isChecked(); const bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
if (!hecl::com_developer->toBoolean() && isChecked) { if (!hecl::com_developer->toBoolean() && isChecked) {
m_developerMode->setChecked(false); m_developerMode->setChecked(true);
m_developerMenuAction->setVisible(true);
} }
hecl::CVarManager::instance()->setCheatsEnabled(isChecked, true); hecl::CVarManager::instance()->setCheatsEnabled(isChecked, true);
m_commons.serialize(); m_commons.serialize();
} }
void LaunchMenu::variableDtTriggered() {
const bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
if (!hecl::com_variableDt->toBoolean() && isChecked) {
m_variableDt->setChecked(false);
}
hecl::CVarManager::instance()->setVariableDtEnabled(isChecked, true);
m_commons.serialize();
}
void LaunchMenu::editRuntimeArgs() { void LaunchMenu::editRuntimeArgs() {
ArgumentEditor editor(this); ArgumentEditor editor(this);
editor.exec(); editor.exec();
} }
void LaunchMenu::initCVarAction(QAction* action, hecl::CVar* cvar) const {
action->setData(QString::fromUtf8(cvar->name().data()));
action->setToolTip(QString::fromUtf8(cvar->rawHelp().data()));
action->setCheckable(true);
action->setChecked(cvar->toBoolean());
connect(action, &QAction::triggered, this, &LaunchMenu::cvarTriggered);
}
void LaunchMenu::cvarTriggered() {
auto* action = qobject_cast<QAction*>(sender());
hecl::CVar* cVar = hecl::CVarManager::instance()->findCVar(action->data().toString().toStdString());
if (cVar != nullptr) {
cVar->fromBoolean(action->isChecked());
m_commons.serialize();
}
}

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <QMenu> #include <QMenu>
#include <hecl/CVar.hpp>
namespace hecl { namespace hecl {
struct CVarCommons; struct CVarCommons;
@ -16,22 +17,29 @@ class LaunchMenu : public QMenu {
QMenu m_msaaMenu; QMenu m_msaaMenu;
QMenu m_anisoMenu; QMenu m_anisoMenu;
QMenu m_experimentalMenu; QMenu m_experimentalMenu;
QMenu m_developerMenu;
QActionGroup m_apiGroup; QActionGroup m_apiGroup;
QActionGroup m_msaaGroup; QActionGroup m_msaaGroup;
QActionGroup m_anisoGroup; QActionGroup m_anisoGroup;
QAction* m_developerMode = nullptr; QAction* m_developerMode = nullptr;
QAction* m_developerMenuAction = nullptr;
QAction* m_enableCheats = nullptr; QAction* m_enableCheats = nullptr;
QAction* m_variableDt = nullptr; QAction* m_variableDt = nullptr;
QAction* m_debugOverlayAreaInfo = nullptr;
QAction* m_debugOverlayPlayerInfo = nullptr;
void initApiAction(const QString& action); void initApiAction(const QString& action);
void initMsaaAction(const QString& action); void initMsaaAction(const QString& action);
void initAnisoAction(const QString& action); void initAnisoAction(const QString& action);
void initDeepColor(); void initDeepColor();
void initDeveloperMode(); void initDeveloperMode();
void initCheats(); void initCheats();
void initExperimental(); void initExperimentalMenu();
void initDeveloperMenu();
void initCVarAction(QAction* action, hecl::CVar* cvar) const;
public: public:
explicit LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR); explicit LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR);
@ -44,6 +52,6 @@ public slots:
void deepColorTriggered(); void deepColorTriggered();
void developerModeTriggered(); void developerModeTriggered();
void cheatsTriggered(); void cheatsTriggered();
void variableDtTriggered();
void editRuntimeArgs(); void editRuntimeArgs();
void cvarTriggered();
}; };

View File

@ -299,6 +299,7 @@ void MainWindow::disableOperations() {
m_ui->pathEdit->setEnabled(false); m_ui->pathEdit->setEnabled(false);
m_ui->browseBtn->setEnabled(false); m_ui->browseBtn->setEnabled(false);
m_ui->downloadButton->setEnabled(false); m_ui->downloadButton->setEnabled(false);
m_ui->warpBtn->setEnabled(false);
} }
void MainWindow::enableOperations() { void MainWindow::enableOperations() {
@ -306,6 +307,12 @@ void MainWindow::enableOperations() {
m_ui->pathEdit->setEnabled(true); m_ui->pathEdit->setEnabled(true);
m_ui->browseBtn->setEnabled(true); m_ui->browseBtn->setEnabled(true);
if (hecl::com_enableCheats->toBoolean()) {
m_ui->warpBtn->show();
} else {
m_ui->warpBtn->hide();
}
if (m_path.isEmpty()) if (m_path.isEmpty())
return; return;
@ -321,8 +328,12 @@ void MainWindow::enableOperations() {
m_ui->extractBtn->setEnabled(true); m_ui->extractBtn->setEnabled(true);
if (QFile::exists(m_path + QStringLiteral("/MP1/URDE/texture_cache.yaml"))) { if (QFile::exists(m_path + QStringLiteral("/MP1/URDE/texture_cache.yaml"))) {
m_ui->packageBtn->setEnabled(true); m_ui->packageBtn->setEnabled(true);
if (isPackageComplete()) if (isPackageComplete()) {
m_ui->launchBtn->setEnabled(true); m_ui->launchBtn->setEnabled(true);
if (hecl::com_enableCheats->toBoolean()) {
m_ui->warpBtn->setEnabled(true);
}
}
} }
if (!m_ui->sysReqTable->isBlenderVersionOk()) { if (!m_ui->sysReqTable->isBlenderVersionOk()) {

View File

@ -21,133 +21,7 @@
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="3"> <item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="launchBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Launch</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="launchMenuBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>15</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="extractBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Extract</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="packageBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Package</string>
</property>
</widget>
</item>
<item row="2" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>167</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="6">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@ -158,7 +32,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Wor&amp;king Directory:</string> <string>Extract Directory:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>pathEdit</cstring> <cstring>pathEdit</cstring>
@ -202,11 +76,8 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="6"> <item row="1" column="0">
<widget class="QTabWidget" name="heclTabs"> <widget class="QTabWidget" name="heclTabs">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="dataTab"> <widget class="QWidget" name="dataTab">
<attribute name="title"> <attribute name="title">
<string>&amp;Data</string> <string>&amp;Data</string>
@ -315,6 +186,235 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="optionsTab">
<attribute name="title">
<string>Options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QGroupBox" name="graphicsOptionsGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Graphics</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="2" column="1">
<widget class="QComboBox" name="antialiasingBox"/>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="graphicsApiBox">
<item>
<widget class="QRadioButton" name="vulkanOption">
<property name="text">
<string>Vulkan</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="metalOption">
<property name="text">
<string>Metal</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="d3d11Option">
<property name="text">
<string>D3D11</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="anistropicFilteringBox"/>
</item>
<item row="3" column="1">
<widget class="QLabel" name="anistropicFilteringLabel">
<property name="text">
<string>Anistropic Filtering</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="antialiasingLabel">
<property name="text">
<string>Anti-Aliasing</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="deepColor">
<property name="text">
<string>Deep Color</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="gameOptionsGroup">
<property name="title">
<string>Game</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="developerModeBox">
<property name="text">
<string>Developer Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableCheatsBox">
<property name="text">
<string>Enable Cheats</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="developerOptionsGroup">
<property name="title">
<string>Developer</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="areaInfoOverlayBox">
<property name="text">
<string>Area Info Overlay</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="playerInfoOverlayBox">
<property name="text">
<string>Player Info Overlay</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="worldInfoOverlayBox">
<property name="text">
<string>World Info Overlay</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="frameCounterBox">
<property name="text">
<string>Show Frame Counter</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="inGameTimeBox">
<property name="text">
<string>Show In-Game Time</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="resourceStatsOverlayBox">
<property name="text">
<string>Show Resource Stats</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="experimentalOptionsGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Experimental</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QCheckBox" name="variableDtBox">
<property name="text">
<string>Variable Delta Time</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="5">
<widget class="QGroupBox" name="launchOptionsGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Launch Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="2">
<widget class="QPushButton" name="launchOptionDeleteButton">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QListView" name="launchOptionsList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="launchOptionAddButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="launchOptionEditButton">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="sysCheckTab"> <widget class="QWidget" name="sysCheckTab">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -919,6 +1019,146 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="4" column="0" rowspan="3">
<layout class="QHBoxLayout" name="bottomButtonBox">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>167</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="extractBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Extract</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="packageBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Package</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="launchBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Launch</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="launchMenuBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>15</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="warpBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Launch &amp;&amp; &amp;Warp</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>