diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-12 07:20:42 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-12 07:20:42 -0500 |
| commit | 06826ca53dd54e73169514b3de2f81f2a7ca31f4 (patch) | |
| tree | dc2d91797aef6d3a979ae9e136684b73d7ea868a /libs/rootbuilder_native/src/rootbuilder.h | |
| parent | 755698f1adceef55f52c8e44c9746537885c9bf7 (diff) | |
Add native Root Builder and OMOD Installer plugins
- libs/rootbuilder_native/: Native C++ port of rootbuilder.py (IPluginTool)
- Root/ dir scanning, copy (reflink/CoW) and symlink modes
- JSON manifest tracking, backup/restore, auto-deploy hooks
- Legacy migration and third-party conflict detection
- libs/installer_omod_native/: Native C++ port of installer_omod.py
- Handles .omod archives (Oblivion Mod Manager format)
- Binary config parsing, .NET string format, CRC file parsing
- zlib raw deflate and LZMA decompression
- Repackages to zip for MO2's installation manager
- Added both to build-inner.sh plugin packaging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/rootbuilder_native/src/rootbuilder.h')
| -rw-r--r-- | libs/rootbuilder_native/src/rootbuilder.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/libs/rootbuilder_native/src/rootbuilder.h b/libs/rootbuilder_native/src/rootbuilder.h new file mode 100644 index 0000000..121bcc1 --- /dev/null +++ b/libs/rootbuilder_native/src/rootbuilder.h @@ -0,0 +1,79 @@ +#ifndef ROOTBUILDER_NATIVE_H +#define ROOTBUILDER_NATIVE_H + +#include <uibase/iplugintool.h> + +#include <QJsonObject> +#include <QString> + +class RootBuilderNative : public MOBase::IPluginTool +{ + Q_OBJECT + Q_INTERFACES(MOBase::IPlugin MOBase::IPluginTool) + Q_PLUGIN_METADATA(IID "com.tannin.ModOrganizer.PluginTool/1.0") + +public: + RootBuilderNative(); + + // IPlugin + bool init(MOBase::IOrganizer* organizer) override; + QString name() const override; + QString localizedName() const override; + QString author() const override; + QString description() const override; + MOBase::VersionInfo version() const override; + QList<MOBase::PluginSetting> settings() const override; + bool enabledByDefault() const override; + + // IPluginTool + QString displayName() const override; + QString tooltip() const override; + QIcon icon() const override; + +public slots: + void display() const override; + +private: + // Storage paths + QString storageDir() const; + QString backupDir() const; + QString manifestPath() const; + QString settingsPath() const; + + // Settings (own JSON, not pluginSetting) + QJsonObject loadSettings() const; + void saveSettings(const QJsonObject& settings) const; + bool isAutoEnabled() const; + + // Manifest + QJsonObject loadManifest() const; + void saveManifest(const QJsonObject& manifest) const; + void removeManifest() const; + + // Legacy migration + void migrateLegacy() const; + + // Third-party conflict detection + void checkThirdPartyRootBuilder() const; + + // Build / Clear + int build() const; + int clear() const; + + // File operations + static QString findRootDir(const QString& modPath); + static void reflinkCopy(const QString& src, const QString& dst); + static void ensureReadable(const QString& path); + static void ensureWritable(const QString& path); + static bool forceRemove(const QString& path); + static void cleanupEmptyDirs(const QString& baseDir, + const QStringList& paths); + + // Hooks + bool onAboutToRun(const QString& executable); + void onFinishedRun(const QString& executable, unsigned int exitCode); + + MOBase::IOrganizer* m_organizer = nullptr; +}; + +#endif // ROOTBUILDER_NATIVE_H |
