aboutsummaryrefslogtreecommitdiff
path: root/libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
commit7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch)
tree27fb39be241fdb5ac2734c574de678977d1856d0 /libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp')
-rw-r--r--libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp b/libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp
new file mode 100644
index 0000000..3dcba8a
--- /dev/null
+++ b/libs/game_gamebryo/src/gamebryo/gamebryodataarchives.cpp
@@ -0,0 +1,80 @@
+#include "gamebryodataarchives.h"
+
+#include <Windows.h>
+
+#include <registry.h>
+#include <utility.h>
+
+#include "gamegamebryo.h"
+
+GamebryoDataArchives::GamebryoDataArchives(const GameGamebryo* game) : m_Game{game} {}
+
+QDir GamebryoDataArchives::gameDirectory() const
+{
+ return QDir(m_Game->gameDirectory()).absolutePath();
+}
+
+QDir GamebryoDataArchives::localGameDirectory() const
+{
+ return QDir(m_Game->myGamesPath()).absolutePath();
+}
+
+QStringList GamebryoDataArchives::getArchivesFromKey(const QString& iniFile,
+ const QString& key,
+ const int size) const
+{
+ wchar_t* buffer = new wchar_t[size];
+ QStringList result;
+ std::wstring iniFileW = QDir::toNativeSeparators(iniFile).toStdWString();
+
+ // epic ms fail: GetPrivateProfileString uses errno (for whatever reason) to signal a
+ // fail since the return value has a different meaning (number of bytes copied).
+ // HOWEVER, it will not set errno to 0 if NO error occured
+ errno = 0;
+
+ if (::GetPrivateProfileStringW(L"Archive", key.toStdWString().c_str(), L"", buffer,
+ size, iniFileW.c_str()) != 0) {
+ result.append(QString::fromStdWString(buffer).split(','));
+ }
+
+ for (int i = 0; i < result.count(); ++i) {
+ result[i] = result[i].trimmed();
+ }
+ delete[] buffer;
+ return result;
+}
+
+void GamebryoDataArchives::setArchivesToKey(const QString& iniFile, const QString& key,
+ const QString& value)
+{
+ if (!MOBase::WriteRegistryValue(L"Archive", key.toStdWString().c_str(),
+ value.toStdWString().c_str(),
+ iniFile.toStdWString().c_str())) {
+ qWarning("failed to set archives in \"%s\"", qUtf8Printable(iniFile));
+ }
+}
+
+void GamebryoDataArchives::addArchive(MOBase::IProfile* profile, int index,
+ const QString& archiveName)
+{
+ QStringList current = archives(profile);
+ if (current.contains(archiveName, Qt::CaseInsensitive)) {
+ return;
+ }
+
+ current.insert(index != INT_MAX ? index : current.size(), archiveName);
+
+ writeArchiveList(profile, current);
+}
+
+void GamebryoDataArchives::removeArchive(MOBase::IProfile* profile,
+ const QString& archiveName)
+{
+ QStringList current = archives(profile);
+ if (!current.contains(archiveName, Qt::CaseInsensitive)) {
+ return;
+ }
+ current.removeAll(archiveName);
+
+ writeArchiveList(profile, current);
+}