Skip to content

Commit

Permalink
Merge branch 'main' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongGino committed Jan 4, 2025
2 parents 6f198fc + 7e35aac commit 2b80a68
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
21 changes: 15 additions & 6 deletions src/neroprefixsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ void NeroPrefixSettingsWindow::LoadSettings()
ui->gamescopeSetScalerBox->setCurrentIndex(settings.value("GamescopeScaler").toInt());
ui->gamescopeSetUpscalingBox->setCurrentIndex(settings.value("GamescopeFilter").toInt());
// general tab->services group
if(!settings.value("Gamemode").toString().isEmpty()) ui->toggleGamemode->setChecked(settings.value("Gamemode").toBool());
if(!settings.value("Mangohud").toString().isEmpty()) ui->toggleMangohud->setChecked(settings.value("Mangohud").toBool());
if(!settings.value("VKcapture").toString().isEmpty()) ui->toggleVKcap->setChecked(settings.value("VKcapture").toBool());
SetCheckboxState("Gamemode", ui->toggleGamemode);
SetCheckboxState("Mangohud", ui->toggleMangohud);
SetCheckboxState("VKcapture", ui->toggleVKcap);

// compatibility tab
if(!settings.value("DLLoverrides").toStringList().isEmpty()) {
Expand All @@ -227,9 +227,9 @@ void NeroPrefixSettingsWindow::LoadSettings()
// advanced tab
ui->debugBox->setCurrentIndex(settings.value("DebugOutput").toInt());
ui->fileSyncBox->setCurrentIndex(settings.value("FileSyncMode").toInt());
if(!settings.value("LimitGLextensions").isValid()) ui->toggleLimitGL->setChecked(settings.value("LimitGLextensions").toBool());
if(!settings.value("NoD8VK").isValid()) ui->toggleNoD8VK->setChecked(settings.value("NoD8VK").toBool());
if(!settings.value("ForceWineD3D").isValid()) ui->toggleWineD3D->setChecked(settings.value("ForceWineD3D").toBool());
SetCheckboxState("LimitGLextensions", ui->toggleLimitGL);
SetCheckboxState("NoD8VK", ui->toggleNoD8VK);
SetCheckboxState("ForceWineD3D", ui->toggleWineD3D);

if(currentShortcutHash.isEmpty()) {
// for prefix general settings, checkboxes are normal two-state
Expand Down Expand Up @@ -336,6 +336,15 @@ void NeroPrefixSettingsWindow::LoadSettings()
}


void NeroPrefixSettingsWindow::SetCheckboxState(const QString &varName, QCheckBox* checkBox)
{
if(!settings.value(varName).toString().isEmpty())
if(settings.value(varName).toBool()) checkBox->setCheckState(Qt::Checked);
else checkBox->setCheckState(Qt::Unchecked);
else checkBox->setCheckState(Qt::PartiallyChecked);
}


void NeroPrefixSettingsWindow::on_shortcutIco_clicked()
{
QString newIcon = QFileDialog::getOpenFileName(this,
Expand Down
3 changes: 3 additions & 0 deletions src/neroprefixsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <QMap>
#include <QCompleter>
#include <QToolButton>
#include <QCheckBox>
#include <QComboBox>
#include <QPushButton>
#include <QStandardItemModel>
Expand Down Expand Up @@ -103,6 +104,8 @@ private slots:
item->setEnabled(enabled);
}

void SetCheckboxState(const QString &, QCheckBox*);

QString currentShortcutHash;

QStringList existingShortcuts;
Expand Down
33 changes: 27 additions & 6 deletions src/nerorunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,26 @@ int NeroRunner::StartShortcut(const QString &hash, const bool &prefixAlreadyRunn

if(!settings->value("Shortcuts--"+hash+"/DebugOutput").toString().isEmpty()) {
switch(settings->value("Shortcuts--"+hash+"/DebugOutput").toInt()) {
case NeroConstant::DebugDisabled:
break;
case NeroConstant::DebugFull:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll,debugstr,mscoree,seh");
break;
case NeroConstant::DebugLoadDLL:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll");
break;
}
} else switch(settings->value("PrefixSettings/DebugOutput").toInt()) {
case NeroConstant::DebugDisabled:
break;
case NeroConstant::DebugFull:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll,debugstr,mscoree,seh");
break;
case NeroConstant::DebugLoadDLL:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll");
break;
}
Expand Down Expand Up @@ -364,9 +372,12 @@ int NeroRunner::StartShortcut(const QString &hash, const bool &prefixAlreadyRunn
if(!logsDir.exists(".logs"))
logsDir.mkdir(".logs");
logsDir.cd(".logs");

QFile log(logsDir.path()+'/'+settings->value("Shortcuts--"+hash+"/Name").toString()+'-'+hash+".txt");
log.open(QIODevice::WriteOnly);
log.resize(0);
if(loggingEnabled) {
log.open(QIODevice::WriteOnly);
log.resize(0);
}

runner.start(command, arguments);
runner.waitForStarted(-1);
Expand Down Expand Up @@ -441,10 +452,14 @@ int NeroRunner::StartOnetime(const QString &path, const bool &prefixAlreadyRunni
}

switch(settings->value("PrefixSettings/DebugOutput").toInt()) {
case NeroConstant::DebugDisabled:
break;
case NeroConstant::DebugFull:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll,debugstr,mscoree,seh");
break;
case NeroConstant::DebugLoadDLL:
loggingEnabled = true;
env.insert("WINEDEBUG", "+loaddll");
break;
}
Expand Down Expand Up @@ -579,9 +594,12 @@ int NeroRunner::StartOnetime(const QString &path, const bool &prefixAlreadyRunni
if(!logsDir.exists(".logs"))
logsDir.mkdir(".logs");
logsDir.cd(".logs");

QFile log(logsDir.path()+'/'+path.mid(path.lastIndexOf('/')+1)+".txt");
log.open(QIODevice::WriteOnly);
log.resize(0);
if(loggingEnabled) {
log.open(QIODevice::WriteOnly);
log.resize(0);
}

runner.start(command, arguments);
runner.waitForStarted(-1);
Expand All @@ -600,7 +618,9 @@ void NeroRunner::WaitLoop(QProcess &runner, QFile &log)
runner.waitForReadyRead(1000);
if(runner.canReadLine()) {
stdout = runner.readLine();
log.write(stdout);
if(loggingEnabled)
log.write(stdout);

if(stdout.contains("umu-launcher"))
emit StatusUpdate(NeroRunner::RunnerStarting);
else if(stdout.contains("steamrt is up to date"))
Expand All @@ -618,7 +638,8 @@ void NeroRunner::WaitLoop(QProcess &runner, QFile &log)

while(!runner.atEnd()) {
stdout = runner.readLine();
log.write(stdout);
if(loggingEnabled)
log.write(stdout);
}

log.close();
Expand Down
1 change: 1 addition & 0 deletions src/nerorunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class NeroRunner : public QObject
void StopProcess();

bool halt = false;
bool loggingEnabled = false;
QProcessEnvironment env;

enum {
Expand Down

0 comments on commit 2b80a68

Please sign in to comment.