diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-23 17:44:12 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-23 17:44:12 -0600 |
| commit | c360dbf9c42f71e7931c56b7a396ba7f7e9982e6 (patch) | |
| tree | 12b44a194db2f8a44a3052b02fced46766a5deee /libs/uibase/src/registry.cpp | |
| parent | a8a287cd102001dddff30deec66140136da422d5 (diff) | |
Remove umu-run, keep game as child process for Steam tracking
- Remove umu-run entirely (crashed due to pressure-vessel/FUSE
incompatibility) — use raw `proton run` instead
- Replace startDetached() with QProcess::start() so the game stays in
Fluorine's process tree. This lets Steam track the game lifetime and
makes the "close game" button work when Fluorine is added as a
non-Steam game.
- Add writeIniValueDirect/readIniValueDirect for safe Bethesda INI
handling without QSettings corruption
- Fix prefix_setup.rs to skip umu-run bootstrapping
- Clean up settings UI, build scripts, and docs for umu-run removal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/uibase/src/registry.cpp')
| -rw-r--r-- | libs/uibase/src/registry.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/libs/uibase/src/registry.cpp b/libs/uibase/src/registry.cpp index 0b6834f..5832075 100644 --- a/libs/uibase/src/registry.cpp +++ b/libs/uibase/src/registry.cpp @@ -174,6 +174,87 @@ bool WriteRegistryValue(const QString& appName, const QString& keyName, return false; } +bool RemoveRegistryValue(const QString& section, const QString& key, + const QString& fileName) +{ + if (!QFileInfo::exists(fileName)) { + return true; // nothing to remove + } + + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + return false; + } + QStringList lines; + QTextStream in(&file); + while (!in.atEnd()) { + lines.append(in.readLine()); + } + file.close(); + + const QString sectionHeader = "[" + section + "]"; + int sectionStart = -1; + int sectionEnd = lines.size(); + + for (int i = 0; i < lines.size(); ++i) { + QString trimmed = lines[i].trimmed(); + if (trimmed.compare(sectionHeader, Qt::CaseInsensitive) == 0) { + sectionStart = i; + for (int j = i + 1; j < lines.size(); ++j) { + QString t = lines[j].trimmed(); + if (t.startsWith('[') && t.endsWith(']')) { + sectionEnd = j; + break; + } + } + break; + } + } + + if (sectionStart < 0) { + return true; // section not found, nothing to remove + } + + // Find and remove the key line + bool found = false; + for (int i = sectionStart + 1; i < sectionEnd; ++i) { + QString trimmed = lines[i].trimmed(); + if (trimmed.isEmpty() || trimmed.startsWith(';') || trimmed.startsWith('#')) { + continue; + } + int eqPos = trimmed.indexOf('='); + if (eqPos > 0) { + QString existingKey = trimmed.left(eqPos).trimmed(); + if (existingKey.compare(key, Qt::CaseInsensitive) == 0) { + lines.removeAt(i); + found = true; + break; + } + } + } + + if (!found) { + return true; // key not found, nothing to remove + } + + // Write back + QFile outFile(fileName); + if (!outFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + return false; + } + QTextStream out(&outFile); + for (int i = 0; i < lines.size(); ++i) { + out << lines[i]; + if (i < lines.size() - 1) { + out << '\n'; + } + } + out << '\n'; + outFile.close(); + + return true; +} + #ifdef _WIN32 bool WriteRegistryValue(const wchar_t* appName, const wchar_t* keyName, const wchar_t* value, const wchar_t* fileName) |
