diff --git a/src/neroprefixsettings.cpp b/src/neroprefixsettings.cpp index f0d9407..7709b0a 100644 --- a/src/neroprefixsettings.cpp +++ b/src/neroprefixsettings.cpp @@ -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()) { @@ -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 @@ -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, diff --git a/src/neroprefixsettings.h b/src/neroprefixsettings.h index eb9c5d5..5ec9173 100644 --- a/src/neroprefixsettings.h +++ b/src/neroprefixsettings.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -103,6 +104,8 @@ private slots: item->setEnabled(enabled); } + void SetCheckboxState(const QString &, QCheckBox*); + QString currentShortcutHash; QStringList existingShortcuts; diff --git a/src/nerorunner.cpp b/src/nerorunner.cpp index 80d3b8b..af3eef3 100644 --- a/src/nerorunner.cpp +++ b/src/nerorunner.cpp @@ -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; } @@ -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); @@ -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; } @@ -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); @@ -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")) @@ -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(); diff --git a/src/nerorunner.h b/src/nerorunner.h index 5b30e59..6f3218b 100644 --- a/src/nerorunner.h +++ b/src/nerorunner.h @@ -37,6 +37,7 @@ class NeroRunner : public QObject void StopProcess(); bool halt = false; + bool loggingEnabled = false; QProcessEnvironment env; enum {