diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..6098e1f --- /dev/null +++ b/.clang-format @@ -0,0 +1,41 @@ +--- +# We'll use defaults from the LLVM style, but with 4 columns indentation. +BasedOnStyle: LLVM +IndentWidth: 2 +--- +Language: Cpp +DeriveLineEnding: false +UseCRLF: true +DerivePointerAlignment: false +PointerAlignment: Left +AlignConsecutiveAssignments: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Empty +AlwaysBreakTemplateDeclarations: Yes +AccessModifierOffset: -2 +AlignTrailingComments: true +SpacesBeforeTrailingComments: 2 +NamespaceIndentation: Inner +MaxEmptyLinesToKeep: 1 +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: false + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: true +ColumnLimit: 88 +ForEachMacros: ['Q_FOREACH', 'foreach'] diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..ebacef7 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +4f0d232b8fbedb307f486880d079eab5c014923e diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f869712 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.cpp text eol=crlf +*.h text eol=crlf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..22349a4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: Build Fallout 3 Plugin + +on: + push: + branches: master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: windows-2022 + steps: + - name: Build Fallout 3 Plugin + uses: ModOrganizer2/build-with-mob-action@master + with: + mo2-dependencies: cmake_common uibase game_gamebryo diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..e2caad9 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,16 @@ +name: Lint Fallout 3 Plugin + +on: + push: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check format + uses: ModOrganizer2/check-formatting-action@master + with: + check-path: "." diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b5abb0e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,40 +0,0 @@ -version: 1.0.{build} -skip_branch_with_pr: true -image: Visual Studio 2019 -environment: - WEBHOOK_URL: - secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1Vbg57wBaeLhi49uGjxPw5GVujHku6kxN6ab89zhbS5GVeluR76GM83IbKV4Sh7udXzoYZZdg6YudtYHzdhCgUeiedpswbuczTq9ceIkkfSEWZuh/lMAAVVwvcGsJAnoPFw= -build_script: -- pwsh: >- - $ErrorActionPreference = 'Stop' - - git clone --depth=1 --no-single-branch https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella - - New-Item -ItemType Directory -Path c:\projects\modorganizer-build - - cd c:\projects\modorganizer-umbrella - - ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH -eq $null) ? ($branch = $env:APPVEYOR_REPO_BRANCH) : ($branch = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) - - git checkout $(git show-ref --verify --quiet refs/remotes/origin/${branch} || echo '-b') ${branch} - - C:\Python37-x64\python.exe unimake.py -d c:\projects\modorganizer-build -s Appveyor_Build=True ${env:APPVEYOR_PROJECT_NAME} - - if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) } -artifacts: -- path: vsbuild\src\RelWithDebInfo\game_fallout3.dll - name: game_fallout3_dll -- path: vsbuild\src\RelWithDebInfo\game_fallout3.pdb - name: game_fallout3_pdb -- path: vsbuild\src\RelWithDebInfo\game_fallout3.lib - name: game_fallout3_lib -on_success: - - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER - - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1 - - ps: ./send.ps1 success $env:WEBHOOK_URL -on_failure: - - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER - - ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stdout.log - - ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stderr.log - - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1 - - ps: ./send.ps1 failure $env:WEBHOOK_URL \ No newline at end of file diff --git a/src/fallout3bsainvalidation.cpp b/src/fallout3bsainvalidation.cpp index 039ecf7..ce981fb 100644 --- a/src/fallout3bsainvalidation.cpp +++ b/src/fallout3bsainvalidation.cpp @@ -1,16 +1,16 @@ -#include "fallout3bsainvalidation.h" - -Fallout3BSAInvalidation::Fallout3BSAInvalidation(MOBase::DataArchives* dataArchives, MOBase::IPluginGame const* game) - : GamebryoBSAInvalidation(dataArchives, "fallout.ini", game) -{ -} - -QString Fallout3BSAInvalidation::invalidationBSAName() const -{ - return "Fallout - Invalidation.bsa"; -} - -unsigned long Fallout3BSAInvalidation::bsaVersion() const -{ - return 0x68; -} +#include "fallout3bsainvalidation.h" + +Fallout3BSAInvalidation::Fallout3BSAInvalidation(MOBase::DataArchives* dataArchives, + MOBase::IPluginGame const* game) + : GamebryoBSAInvalidation(dataArchives, "fallout.ini", game) +{} + +QString Fallout3BSAInvalidation::invalidationBSAName() const +{ + return "Fallout - Invalidation.bsa"; +} + +unsigned long Fallout3BSAInvalidation::bsaVersion() const +{ + return 0x68; +} diff --git a/src/fallout3bsainvalidation.h b/src/fallout3bsainvalidation.h index 1f3b988..f836073 100644 --- a/src/fallout3bsainvalidation.h +++ b/src/fallout3bsainvalidation.h @@ -1,23 +1,20 @@ -#ifndef FALLOUT3BSAINVALIDATION_H -#define FALLOUT3BSAINVALIDATION_H - - -#include "gamebryobsainvalidation.h" -#include "fallout3dataarchives.h" - -#include - -class Fallout3BSAInvalidation : public GamebryoBSAInvalidation -{ -public: - - Fallout3BSAInvalidation(MOBase::DataArchives* dataArchives, MOBase::IPluginGame const* game); - -private: - - virtual QString invalidationBSAName() const override; - virtual unsigned long bsaVersion() const override; - -}; - -#endif // FALLOUT3BSAINVALIDATION_H +#ifndef FALLOUT3BSAINVALIDATION_H +#define FALLOUT3BSAINVALIDATION_H + +#include "fallout3dataarchives.h" +#include "gamebryobsainvalidation.h" + +#include + +class Fallout3BSAInvalidation : public GamebryoBSAInvalidation +{ +public: + Fallout3BSAInvalidation(MOBase::DataArchives* dataArchives, + MOBase::IPluginGame const* game); + +private: + virtual QString invalidationBSAName() const override; + virtual unsigned long bsaVersion() const override; +}; + +#endif // FALLOUT3BSAINVALIDATION_H diff --git a/src/fallout3dataarchives.cpp b/src/fallout3dataarchives.cpp index c308dda..623b566 100644 --- a/src/fallout3dataarchives.cpp +++ b/src/fallout3dataarchives.cpp @@ -1,38 +1,37 @@ -#include "fallout3dataarchives.h" - -#include "iprofile.h" -#include - -Fallout3DataArchives::Fallout3DataArchives(const QDir &myGamesDir) : - GamebryoDataArchives(myGamesDir) -{ -} - -QStringList Fallout3DataArchives::vanillaArchives() const -{ - return { "Fallout - Textures.bsa" - , "Fallout - Meshes.bsa" - , "Fallout - Voices.bsa" - , "Fallout - Sound.bsa" - , "Fallout - MenuVoices.bsa" - , "Fallout - Misc.bsa" }; -} - - -QStringList Fallout3DataArchives::archives(const MOBase::IProfile *profile) const -{ - QStringList result; - - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini") : m_LocalGameDir.absoluteFilePath("fallout.ini"); - result.append(getArchivesFromKey(iniFile, "SArchiveList")); - - return result; -} - -void Fallout3DataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before) -{ - QString list = before.join(", "); - - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini") : m_LocalGameDir.absoluteFilePath("fallout.ini"); - setArchivesToKey(iniFile, "SArchiveList", list); -} +#include "fallout3dataarchives.h" + +#include "iprofile.h" +#include + +Fallout3DataArchives::Fallout3DataArchives(const QDir& myGamesDir) + : GamebryoDataArchives(myGamesDir) +{} + +QStringList Fallout3DataArchives::vanillaArchives() const +{ + return {"Fallout - Textures.bsa", "Fallout - Meshes.bsa", "Fallout - Voices.bsa", + "Fallout - Sound.bsa", "Fallout - MenuVoices.bsa", "Fallout - Misc.bsa"}; +} + +QStringList Fallout3DataArchives::archives(const MOBase::IProfile* profile) const +{ + QStringList result; + + QString iniFile = profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini") + : m_LocalGameDir.absoluteFilePath("fallout.ini"); + result.append(getArchivesFromKey(iniFile, "SArchiveList")); + + return result; +} + +void Fallout3DataArchives::writeArchiveList(MOBase::IProfile* profile, + const QStringList& before) +{ + QString list = before.join(", "); + + QString iniFile = profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini") + : m_LocalGameDir.absoluteFilePath("fallout.ini"); + setArchivesToKey(iniFile, "SArchiveList", list); +} diff --git a/src/fallout3dataarchives.h b/src/fallout3dataarchives.h index 7caf47f..5522e08 100644 --- a/src/fallout3dataarchives.h +++ b/src/fallout3dataarchives.h @@ -1,25 +1,22 @@ -#ifndef FALLOUT3DATAARCHIVES_H -#define FALLOUT3DATAARCHIVES_H - - -#include "gamebryodataarchives.h" -#include - -class Fallout3DataArchives : public GamebryoDataArchives -{ - -public: - Fallout3DataArchives(const QDir &myGamesDir); - -public: - - virtual QStringList vanillaArchives() const override; - virtual QStringList archives(const MOBase::IProfile *profile) const override; - -private: - - virtual void writeArchiveList(MOBase::IProfile *profile, const QStringList &before) override; - -}; - -#endif // FALLOUT3DATAARCHIVES_H +#ifndef FALLOUT3DATAARCHIVES_H +#define FALLOUT3DATAARCHIVES_H + +#include "gamebryodataarchives.h" +#include + +class Fallout3DataArchives : public GamebryoDataArchives +{ + +public: + Fallout3DataArchives(const QDir& myGamesDir); + +public: + virtual QStringList vanillaArchives() const override; + virtual QStringList archives(const MOBase::IProfile* profile) const override; + +private: + virtual void writeArchiveList(MOBase::IProfile* profile, + const QStringList& before) override; +}; + +#endif // FALLOUT3DATAARCHIVES_H diff --git a/src/fallout3moddatachecker.h b/src/fallout3moddatachecker.h index a91fdc6..0051137 100644 --- a/src/fallout3moddatachecker.h +++ b/src/fallout3moddatachecker.h @@ -9,21 +9,23 @@ public: using GamebryoModDataChecker::GamebryoModDataChecker; protected: - virtual const FileNameSet& possibleFolderNames() const override { + virtual const FileNameSet& possibleFolderNames() const override + { static FileNameSet result{ - "fonts", "interface", "menus", "meshes", "music", "scripts", "shaders", - "sound", "strings", "textures", "trees", "video", "facegen", "materials", - "fose", "distantlod", "asi", "Tools", "MCM", "distantland", "mits", - "dllplugins", "CalienteTools", "NetScriptFramework", "shadersfx" - }; + "fonts", "interface", "menus", "meshes", + "music", "scripts", "shaders", "sound", + "strings", "textures", "trees", "video", + "facegen", "materials", "fose", "distantlod", + "asi", "Tools", "MCM", "distantland", + "mits", "dllplugins", "CalienteTools", "NetScriptFramework", + "shadersfx"}; return result; } - virtual const FileNameSet& possibleFileExtensions() const override { - static FileNameSet result{ - "esp", "esm", "bsa", "modgroups", "ini" - }; + virtual const FileNameSet& possibleFileExtensions() const override + { + static FileNameSet result{"esp", "esm", "bsa", "modgroups", "ini"}; return result; } }; -#endif // FALLOUT3_MODATACHECKER_H +#endif // FALLOUT3_MODATACHECKER_H diff --git a/src/fallout3moddatacontent.h b/src/fallout3moddatacontent.h index 2a80584..bc314a9 100644 --- a/src/fallout3moddatacontent.h +++ b/src/fallout3moddatacontent.h @@ -4,18 +4,19 @@ #include #include -class Fallout3ModDataContent : public GamebryoModDataContent { +class Fallout3ModDataContent : public GamebryoModDataContent +{ public: - /** * */ - Fallout3ModDataContent(MOBase::IGameFeatures const* gameFeatures) : GamebryoModDataContent(gameFeatures) { + Fallout3ModDataContent(MOBase::IGameFeatures const* gameFeatures) + : GamebryoModDataContent(gameFeatures) + { // Just need to disable some contents: - m_Enabled[CONTENT_MCM] = false; + m_Enabled[CONTENT_MCM] = false; m_Enabled[CONTENT_SKYPROC] = false; } - }; -#endif // FALLOUT3_MODDATACONTENT_H +#endif // FALLOUT3_MODDATACONTENT_H diff --git a/src/fallout3savegame.cpp b/src/fallout3savegame.cpp index 765be18..60bba50 100644 --- a/src/fallout3savegame.cpp +++ b/src/fallout3savegame.cpp @@ -2,31 +2,30 @@ #include "gamefallout3.h" -Fallout3SaveGame::Fallout3SaveGame(QString const &fileName, GameFallout3 const *game) : - GamebryoSaveGame(fileName, game) +Fallout3SaveGame::Fallout3SaveGame(QString const& fileName, GameFallout3 const* game) + : GamebryoSaveGame(fileName, game) { FileWrapper file(getFilepath(), "FO3SAVEGAME"); unsigned long width, height; - fetchInformationFields(file, width, height, m_SaveNumber, m_PCName, m_PCLevel, m_PCLocation); + fetchInformationFields(file, width, height, m_SaveNumber, m_PCName, m_PCLevel, + m_PCLocation); } -void Fallout3SaveGame::fetchInformationFields( - FileWrapper& file, - unsigned long& width, - unsigned long& height, - unsigned long& saveNumber, - QString& playerName, - unsigned short& playerLevel, - QString& playerLocation) const +void Fallout3SaveGame::fetchInformationFields(FileWrapper& file, unsigned long& width, + unsigned long& height, + unsigned long& saveNumber, + QString& playerName, + unsigned short& playerLevel, + QString& playerLocation) const { - file.skip(); //Save header size + file.skip(); // Save header size file.setHasFieldMarkers(true); file.setPluginString(GamebryoSaveGame::StringType::TYPE_BZSTRING); - file.skip(); //File version ? - file.skip(); //delimiter + file.skip(); // File version ? + file.skip(); // delimiter file.read(width); file.read(height); @@ -55,8 +54,8 @@ std::unique_ptr Fallout3SaveGame::fetchDataFields( unsigned short dummyLevel; unsigned long dummySaveNumber; - fetchInformationFields(file, width, height, - dummySaveNumber, dummyName, dummyLevel, dummyLocation); + fetchInformationFields(file, width, height, dummySaveNumber, dummyName, dummyLevel, + dummyLocation); } QString playtime; @@ -64,7 +63,7 @@ std::unique_ptr Fallout3SaveGame::fetchDataFields( fields->Screenshot = file.readImage(width, height, 256); - file.skip(5); // unknown (1 byte), plugin size (4 bytes) + file.skip(5); // unknown (1 byte), plugin size (4 bytes) file.setPluginString(GamebryoSaveGame::StringType::TYPE_BSTRING); fields->Plugins = file.readPlugins(); diff --git a/src/fallout3savegame.h b/src/fallout3savegame.h index d325bb9..9ab5734 100644 --- a/src/fallout3savegame.h +++ b/src/fallout3savegame.h @@ -8,21 +8,16 @@ class GameFallout3; class Fallout3SaveGame : public GamebryoSaveGame { public: - Fallout3SaveGame(QString const &fileName, GameFallout3 const *game); + Fallout3SaveGame(QString const& fileName, GameFallout3 const* game); protected: - // Fetch easy-to-access information. - void fetchInformationFields( - FileWrapper& wrapper, - unsigned long& width, - unsigned long& height, - unsigned long& saveNumber, - QString& playerName, - unsigned short& playerLevel, - QString& playerLocation) const; + void fetchInformationFields(FileWrapper& wrapper, unsigned long& width, + unsigned long& height, unsigned long& saveNumber, + QString& playerName, unsigned short& playerLevel, + QString& playerLocation) const; std::unique_ptr fetchDataFields() const override; }; -#endif // FALLOUT3SAVEGAME_H +#endif // FALLOUT3SAVEGAME_H diff --git a/src/fallout3scriptextender.cpp b/src/fallout3scriptextender.cpp index b39e895..608a305 100644 --- a/src/fallout3scriptextender.cpp +++ b/src/fallout3scriptextender.cpp @@ -1,19 +1,18 @@ -#include "fallout3scriptextender.h" - -#include -#include - -Fallout3ScriptExtender::Fallout3ScriptExtender(GameGamebryo const *game) : - GamebryoScriptExtender(game) -{ -} - -QString Fallout3ScriptExtender::BinaryName() const -{ - return "fose_loader.exe"; -} - -QString Fallout3ScriptExtender::PluginPath() const -{ - return "fose/plugins"; -} +#include "fallout3scriptextender.h" + +#include +#include + +Fallout3ScriptExtender::Fallout3ScriptExtender(GameGamebryo const* game) + : GamebryoScriptExtender(game) +{} + +QString Fallout3ScriptExtender::BinaryName() const +{ + return "fose_loader.exe"; +} + +QString Fallout3ScriptExtender::PluginPath() const +{ + return "fose/plugins"; +} diff --git a/src/fallout3scriptextender.h b/src/fallout3scriptextender.h index 108196b..1769d6b 100644 --- a/src/fallout3scriptextender.h +++ b/src/fallout3scriptextender.h @@ -1,19 +1,17 @@ -#ifndef FALLOUT3SCRIPTEXTENDER_H -#define FALLOUT3SCRIPTEXTENDER_H - - -#include "gamebryoscriptextender.h" - -class GameGamebryo; - -class Fallout3ScriptExtender : public GamebryoScriptExtender -{ -public: - Fallout3ScriptExtender(GameGamebryo const *game); - - virtual QString BinaryName() const override; - virtual QString PluginPath() const override; - -}; - -#endif // FALLOUT3SCRIPTEXTENDER_H +#ifndef FALLOUT3SCRIPTEXTENDER_H +#define FALLOUT3SCRIPTEXTENDER_H + +#include "gamebryoscriptextender.h" + +class GameGamebryo; + +class Fallout3ScriptExtender : public GamebryoScriptExtender +{ +public: + Fallout3ScriptExtender(GameGamebryo const* game); + + virtual QString BinaryName() const override; + virtual QString PluginPath() const override; +}; + +#endif // FALLOUT3SCRIPTEXTENDER_H diff --git a/src/gamefallout3.cpp b/src/gamefallout3.cpp index 7d7bdcf..6de76cd 100644 --- a/src/gamefallout3.cpp +++ b/src/gamefallout3.cpp @@ -1,19 +1,19 @@ #include "gamefallout3.h" #include "fallout3bsainvalidation.h" -#include "fallout3scriptextender.h" #include "fallout3dataarchives.h" #include "fallout3moddatachecker.h" #include "fallout3moddatacontent.h" #include "fallout3savegame.h" +#include "fallout3scriptextender.h" #include "executableinfo.h" #include "pluginsetting.h" #include "versioninfo.h" -#include #include -#include +#include #include +#include #include #include @@ -27,9 +27,7 @@ using namespace MOBase; -GameFallout3::GameFallout3() -{ -} +GameFallout3::GameFallout3() {} bool GameFallout3::init(IOrganizer* moInfo) { @@ -42,9 +40,11 @@ bool GameFallout3::init(IOrganizer* moInfo) registerFeature(dataArchives); registerFeature(std::make_shared(dataArchives.get(), this)); registerFeature(std::make_shared(this)); - registerFeature(std::make_shared(myGamesPath(), "fallout.ini")); + registerFeature( + std::make_shared(myGamesPath(), "fallout.ini")); registerFeature(std::make_shared(this)); - registerFeature(std::make_shared(m_Organizer->gameFeatures())); + registerFeature( + std::make_shared(m_Organizer->gameFeatures())); registerFeature(std::make_shared(moInfo)); registerFeature(std::make_shared(this)); return true; @@ -56,11 +56,11 @@ QString GameFallout3::identifyGamePath() const // EPIC Game Store if (result.isEmpty()) { // Fallout 3: Game of the Year Edition: adeae8bbfc94427db57c7dfecce3f1d4 - result = parseEpicGamesLocation({ "adeae8bbfc94427db57c7dfecce3f1d4" }); + result = parseEpicGamesLocation({"adeae8bbfc94427db57c7dfecce3f1d4"}); if (QFileInfo(result).isDir()) { QDir startPath = QDir(result); - auto subDirs = startPath.entryList({ "Fallout 3 GOTY*" }, - QDir::Dirs | QDir::NoDotAndDotDot); + auto subDirs = + startPath.entryList({"Fallout 3 GOTY*"}, QDir::Dirs | QDir::NoDotAndDotDot); if (!subDirs.isEmpty()) result = startPath.absoluteFilePath(subDirs.first()); } @@ -75,21 +75,24 @@ QString GameFallout3::gameName() const void GameFallout3::detectGame() { - m_GamePath = identifyGamePath(); + m_GamePath = identifyGamePath(); m_MyGamesPath = determineMyGamesPath("Fallout3"); } QList GameFallout3::executables() const { return QList() - << ExecutableInfo("FOSE", findInGameFolder(m_Organizer->gameFeatures()->gameFeature()->loaderName())) - << ExecutableInfo("Fallout 3", findInGameFolder(binaryName())) - << ExecutableInfo("Fallout Mod Manager", findInGameFolder("fomm/fomm.exe")) - << ExecutableInfo("Construction Kit", findInGameFolder("geck.exe")) - << ExecutableInfo("Fallout Launcher", findInGameFolder(getLauncherName())) - << ExecutableInfo("BOSS", findInGameFolder("BOSS/BOSS.exe")) - << ExecutableInfo("LOOT", QFileInfo(getLootPath())).withArgument("--game=\"Fallout3\"") - ; + << ExecutableInfo("FOSE", + findInGameFolder(m_Organizer->gameFeatures() + ->gameFeature() + ->loaderName())) + << ExecutableInfo("Fallout 3", findInGameFolder(binaryName())) + << ExecutableInfo("Fallout Mod Manager", findInGameFolder("fomm/fomm.exe")) + << ExecutableInfo("Construction Kit", findInGameFolder("geck.exe")) + << ExecutableInfo("Fallout Launcher", findInGameFolder(getLauncherName())) + << ExecutableInfo("BOSS", findInGameFolder("BOSS/BOSS.exe")) + << ExecutableInfo("LOOT", QFileInfo(getLootPath())) + .withArgument("--game=\"Fallout3\""); } QList GameFallout3::executableForcedLoads() const @@ -122,13 +125,12 @@ MOBase::VersionInfo GameFallout3::version() const return VersionInfo(1, 4, 1, VersionInfo::RELEASE_FINAL); } - QList GameFallout3::settings() const { return QList(); } -void GameFallout3::initializeProfile(const QDir &path, ProfileSettings settings) const +void GameFallout3::initializeProfile(const QDir& path, ProfileSettings settings) const { if (settings.testFlag(IPluginGame::MODS)) { copyToProfile(localAppFolder() + "/Fallout3", path, "plugins.txt"); @@ -136,16 +138,17 @@ void GameFallout3::initializeProfile(const QDir &path, ProfileSettings settings) } if (settings.testFlag(IPluginGame::CONFIGURATION)) { - if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) - || !QFileInfo(myGamesPath() + "/fallout.ini").exists()) { - copyToProfile(gameDirectory().absolutePath(), path, "fallout_default.ini", "fallout.ini"); + if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) || + !QFileInfo(myGamesPath() + "/fallout.ini").exists()) { + copyToProfile(gameDirectory().absolutePath(), path, "fallout_default.ini", + "fallout.ini"); } else { copyToProfile(myGamesPath(), path, "fallout.ini"); } copyToProfile(myGamesPath(), path, "falloutprefs.ini"); - copyToProfile(myGamesPath(), path, "FalloutCustom.ini"); - copyToProfile(myGamesPath(), path, "custom.ini"); + copyToProfile(myGamesPath(), path, "FalloutCustom.ini"); + copyToProfile(myGamesPath(), path, "custom.ini"); copyToProfile(myGamesPath(), path, "GECKCustom.ini"); copyToProfile(myGamesPath(), path, "GECKPrefs.ini"); } @@ -161,7 +164,8 @@ QString GameFallout3::savegameSEExtension() const return ""; } -std::shared_ptr GameFallout3::makeSaveGame(QString filePath) const +std::shared_ptr +GameFallout3::makeSaveGame(QString filePath) const { return std::make_shared(filePath, this); } @@ -177,12 +181,12 @@ QString GameFallout3::steamAPPId() const QStringList GameFallout3::primaryPlugins() const { - return { "fallout3.esm" }; + return {"fallout3.esm"}; } QStringList GameFallout3::gameVariants() const { - return { "Regular", "Game Of The Year" }; + return {"Regular", "Game Of The Year"}; } QString GameFallout3::gameShortName() const @@ -192,7 +196,7 @@ QString GameFallout3::gameShortName() const QStringList GameFallout3::validShortNames() const { - return { "FalloutNV" }; + return {"FalloutNV"}; } QString GameFallout3::gameNexusName() const @@ -202,12 +206,14 @@ QString GameFallout3::gameNexusName() const QStringList GameFallout3::iniFiles() const { - return { "fallout.ini", "falloutprefs.ini", "custom.ini", "FalloutCustom.ini", "GECKCustom.ini", "GECKPrefs.ini" }; + return {"fallout.ini", "falloutprefs.ini", "custom.ini", + "FalloutCustom.ini", "GECKCustom.ini", "GECKPrefs.ini"}; } QStringList GameFallout3::DLCPlugins() const { - return { "ThePitt.esm", "Anchorage.esm", "BrokenSteel.esm", "PointLookout.esm", "Zeta.esm" }; + return {"ThePitt.esm", "Anchorage.esm", "BrokenSteel.esm", "PointLookout.esm", + "Zeta.esm"}; } int GameFallout3::nexusModOrganizerID() const diff --git a/src/gamefallout3.h b/src/gamefallout3.h index c3c92e5..8533f57 100644 --- a/src/gamefallout3.h +++ b/src/gamefallout3.h @@ -1,56 +1,54 @@ -#ifndef GAMEFALLOUT3_H -#define GAMEFALLOUT3_H - -#include "gamegamebryo.h" - -#include -#include - -class GameFallout3 : public GameGamebryo -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.tannin.GameFallout3" FILE "gamefallout3.json") - -public: - - GameFallout3(); - - virtual bool init(MOBase::IOrganizer *moInfo) override; - -public: // IPluginGame interface - - virtual QString gameName() const override; - virtual void detectGame() override; - virtual QList executables() const override; - virtual QList executableForcedLoads() const override; - virtual void initializeProfile(const QDir &path, ProfileSettings settings) const override; - virtual QString steamAPPId() const override; - virtual QStringList primaryPlugins() const override; - virtual QStringList gameVariants() const; - virtual QString gameShortName() const override; - virtual QStringList validShortNames() const override; - virtual QString gameNexusName() const override; - virtual QString getLauncherName() const override; - virtual QStringList iniFiles() const override; - virtual QStringList DLCPlugins() const override; - virtual int nexusModOrganizerID() const override; - virtual int nexusGameID() const override; - -public: // IPlugin interface - - virtual QString name() const override; - virtual QString localizedName() const override; - virtual QString author() const override; - virtual QString description() const override; - virtual MOBase::VersionInfo version() const override; - virtual QList settings() const override; - -protected: - virtual QString identifyGamePath() const override; - virtual QString savegameExtension() const override; - virtual QString savegameSEExtension() const override; - std::shared_ptr makeSaveGame(QString filePath) const override; - -}; - -#endif // GAMEFALLOUT3_H +#ifndef GAMEFALLOUT3_H +#define GAMEFALLOUT3_H + +#include "gamegamebryo.h" + +#include +#include + +class GameFallout3 : public GameGamebryo +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.tannin.GameFallout3" FILE "gamefallout3.json") + +public: + GameFallout3(); + + virtual bool init(MOBase::IOrganizer* moInfo) override; + +public: // IPluginGame interface + virtual QString gameName() const override; + virtual void detectGame() override; + virtual QList executables() const override; + virtual QList + executableForcedLoads() const override; + virtual void initializeProfile(const QDir& path, + ProfileSettings settings) const override; + virtual QString steamAPPId() const override; + virtual QStringList primaryPlugins() const override; + virtual QStringList gameVariants() const; + virtual QString gameShortName() const override; + virtual QStringList validShortNames() const override; + virtual QString gameNexusName() const override; + virtual QString getLauncherName() const override; + virtual QStringList iniFiles() const override; + virtual QStringList DLCPlugins() const override; + virtual int nexusModOrganizerID() const override; + virtual int nexusGameID() const override; + +public: // IPlugin interface + virtual QString name() const override; + virtual QString localizedName() const override; + virtual QString author() const override; + virtual QString description() const override; + virtual MOBase::VersionInfo version() const override; + virtual QList settings() const override; + +protected: + virtual QString identifyGamePath() const override; + virtual QString savegameExtension() const override; + virtual QString savegameSEExtension() const override; + std::shared_ptr makeSaveGame(QString filePath) const override; +}; + +#endif // GAMEFALLOUT3_H