From e3bfde72c076ac756d966ec87d848f628ba73088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:27:34 +0200 Subject: [PATCH 1/3] Format files and add .gitattributes and .clang-format. --- .clang-format | 41 ++++++++ .gitattributes | 7 ++ src/fallout76dataarchives.cpp | 165 +++++++++++++++++--------------- src/fallout76dataarchives.h | 20 ++-- src/fallout76moddatachecker.h | 23 ++--- src/fallout76moddatacontent.h | 21 ++-- src/fallout76savegame.cpp | 48 +++++----- src/fallout76savegame.h | 14 +-- src/fallout76savegameinfo.cpp | 11 +-- src/fallout76savegameinfo.h | 4 +- src/fallout76scriptextender.cpp | 7 +- src/fallout76scriptextender.h | 4 +- src/fallout76unmanagedmods.cpp | 22 ++--- src/fallout76unmanagedmods.h | 15 ++- src/gamefallout76.cpp | 63 ++++++------ src/gamefallout76.h | 17 ++-- 16 files changed, 268 insertions(+), 214 deletions(-) create mode 100644 .clang-format create mode 100644 .gitattributes 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/.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/src/fallout76dataarchives.cpp b/src/fallout76dataarchives.cpp index 3148f03..d9bff8d 100644 --- a/src/fallout76dataarchives.cpp +++ b/src/fallout76dataarchives.cpp @@ -5,96 +5,88 @@ #include -Fallout76DataArchives::Fallout76DataArchives(const QDir &myGamesDir) : - GamebryoDataArchives(myGamesDir) +Fallout76DataArchives::Fallout76DataArchives(const QDir& myGamesDir) + : GamebryoDataArchives(myGamesDir) {} QStringList Fallout76DataArchives::vanillaArchives() const { - return { "SeventySix - Animations.ba2" - , "SeventySix - ATX_Main.ba2" - , "SeventySix - ATX_Textures.ba2" - , "SeventySix - EnlightenExteriors01.ba2" - , "SeventySix - EnlightenExteriors02.ba2" - , "SeventySix - EnlightenInteriors.ba2" - , "SeventySix - GeneratedMeshes.ba2" - , "SeventySix - GeneratedTextures.ba2" - , "SeventySix - Interface.ba2" - , "SeventySix - Localization.ba2" - , "SeventySix - Materials.ba2" - , "SeventySix - Meshes01.ba2" - , "SeventySix - Meshes02.ba2" - , "SeventySix - MeshesExtra.ba2" - , "SeventySix - MiscClient.ba2" - , "SeventySix - Shaders.ba2" - , "SeventySix - Sounds01.ba2" - , "SeventySix - Sounds02.ba2" - , "SeventySix - Startup.ba2" - , "SeventySix - Textures01.ba2" - , "SeventySix - Textures02.ba2" - , "SeventySix - Textures03.ba2" - , "SeventySix - Textures04.ba2" - , "SeventySix - Textures05.ba2" - , "SeventySix - Textures06.ba2" - , "SeventySix - Voices.ba2" }; + return {"SeventySix - Animations.ba2", + "SeventySix - ATX_Main.ba2", + "SeventySix - ATX_Textures.ba2", + "SeventySix - EnlightenExteriors01.ba2", + "SeventySix - EnlightenExteriors02.ba2", + "SeventySix - EnlightenInteriors.ba2", + "SeventySix - GeneratedMeshes.ba2", + "SeventySix - GeneratedTextures.ba2", + "SeventySix - Interface.ba2", + "SeventySix - Localization.ba2", + "SeventySix - Materials.ba2", + "SeventySix - Meshes01.ba2", + "SeventySix - Meshes02.ba2", + "SeventySix - MeshesExtra.ba2", + "SeventySix - MiscClient.ba2", + "SeventySix - Shaders.ba2", + "SeventySix - Sounds01.ba2", + "SeventySix - Sounds02.ba2", + "SeventySix - Startup.ba2", + "SeventySix - Textures01.ba2", + "SeventySix - Textures02.ba2", + "SeventySix - Textures03.ba2", + "SeventySix - Textures04.ba2", + "SeventySix - Textures05.ba2", + "SeventySix - Textures06.ba2", + "SeventySix - Voices.ba2"}; } QStringList Fallout76DataArchives::sResourceIndexFileList() const { - return { "SeventySix - Textures01.ba2" - , "SeventySix - Textures02.ba2" - , "SeventySix - Textures03.ba2" - , "SeventySix - Textures04.ba2" - , "SeventySix - Textures05.ba2" - , "SeventySix - Textures06.ba2" }; + return {"SeventySix - Textures01.ba2", "SeventySix - Textures02.ba2", + "SeventySix - Textures03.ba2", "SeventySix - Textures04.ba2", + "SeventySix - Textures05.ba2", "SeventySix - Textures06.ba2"}; } QStringList Fallout76DataArchives::sResourceStartUpArchiveList() const { - return { "SeventySix - Interface.ba2" - , "SeventySix - Localization.ba2" - , "SeventySix - Shaders.ba2" - , "SeventySix - Startup.ba2" }; + return {"SeventySix - Interface.ba2", "SeventySix - Localization.ba2", + "SeventySix - Shaders.ba2", "SeventySix - Startup.ba2"}; } -QStringList Fallout76DataArchives::SResourceArchiveMemoryCacheList() const { - return { "SeventySix - Interface.ba2" - , "SeventySix - Materials.ba2" - , "SeventySix - MiscClient.ba2" - , "SeventySix - Shaders.ba2" }; +QStringList Fallout76DataArchives::SResourceArchiveMemoryCacheList() const +{ + return {"SeventySix - Interface.ba2", "SeventySix - Materials.ba2", + "SeventySix - MiscClient.ba2", "SeventySix - Shaders.ba2"}; } -QStringList Fallout76DataArchives::SResourceArchiveList() const { - return { "SeventySix - GeneratedMeshes.ba2" - , "SeventySix - Materials.ba2" - , "SeventySix - Meshes01.ba2" - , "SeventySix - Meshes02.ba2" - , "SeventySix - MeshesExtra.ba2" - , "SeventySix - MiscClient.ba2" - , "SeventySix - Sounds01.ba2" - , "SeventySix - Sounds02.ba2" - , "SeventySix - Startup.ba2" - , "SeventySix - Voices.ba2" }; +QStringList Fallout76DataArchives::SResourceArchiveList() const +{ + return {"SeventySix - GeneratedMeshes.ba2", "SeventySix - Materials.ba2", + "SeventySix - Meshes01.ba2", "SeventySix - Meshes02.ba2", + "SeventySix - MeshesExtra.ba2", "SeventySix - MiscClient.ba2", + "SeventySix - Sounds01.ba2", "SeventySix - Sounds02.ba2", + "SeventySix - Startup.ba2", "SeventySix - Voices.ba2"}; } -QStringList Fallout76DataArchives::SResourceArchiveList2() const { - return { "SeventySix - Animations.ba2" - , "SeventySix - EnlightenInteriors.ba2" - , "SeventySix - GeneratedTextures.ba2" - , "SeventySix - EnlightenExteriors01.ba2" - , "SeventySix - EnlightenExteriors02.ba2" }; +QStringList Fallout76DataArchives::SResourceArchiveList2() const +{ + return {"SeventySix - Animations.ba2", "SeventySix - EnlightenInteriors.ba2", + "SeventySix - GeneratedTextures.ba2", "SeventySix - EnlightenExteriors01.ba2", + "SeventySix - EnlightenExteriors02.ba2"}; } -QStringList Fallout76DataArchives::sResourceArchive2List() const { - return { "SeventySix - ATX_Main.ba2" - , "SeventySix - ATX_Textures.ba2" }; +QStringList Fallout76DataArchives::sResourceArchive2List() const +{ + return {"SeventySix - ATX_Main.ba2", "SeventySix - ATX_Textures.ba2"}; } -QStringList Fallout76DataArchives::archives(const MOBase::IProfile *profile) const +QStringList Fallout76DataArchives::archives(const MOBase::IProfile* profile) const { QStringList result; - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("Fallout76.ini") : m_LocalGameDir.absoluteFilePath("Fallout76.ini"); + QString iniFile = + profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("Fallout76.ini") + : m_LocalGameDir.absoluteFilePath("Fallout76.ini"); result.append(getArchivesFromKey(iniFile, "sResourceIndexFileList")); result.append(getArchivesFromKey(iniFile, "sResourceStartUpArchiveList")); @@ -106,28 +98,40 @@ QStringList Fallout76DataArchives::archives(const MOBase::IProfile *profile) con return result; } -void Fallout76DataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before) +void Fallout76DataArchives::writeArchiveList(MOBase::IProfile* profile, + const QStringList& before) { - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("Fallout76.ini") : m_LocalGameDir.absoluteFilePath("Fallout76.ini"); + QString iniFile = + profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("Fallout76.ini") + : m_LocalGameDir.absoluteFilePath("Fallout76.ini"); - QStringList sResourceIndexFileList = {}; - QStringList sResourceStartUpArchiveList = {}; + QStringList sResourceIndexFileList = {}; + QStringList sResourceStartUpArchiveList = {}; QStringList SResourceArchiveMemoryCacheList = {}; - QStringList SResourceArchiveList = {}; - QStringList SResourceArchiveList2 = {}; - QStringList sResourceArchive2List = {}; + QStringList SResourceArchiveList = {}; + QStringList SResourceArchiveList2 = {}; + QStringList sResourceArchive2List = {}; for (int i = 0; i < before.size(); ++i) { QString archive = before[i]; if (archive.contains(QRegularExpression(" - Textures(\\d{2})\\.ba2$"))) { sResourceIndexFileList.append(archive); - } else if (archive.contains(QRegularExpression(" - (Interface|Localization|Shaders|Startup)\\.ba2$"))) { + } else if (archive.contains(QRegularExpression( + " - (Interface|Localization|Shaders|Startup)\\.ba2$"))) { sResourceStartUpArchiveList.append(archive); - } else if (archive.contains(QRegularExpression(" - (Interface|Materials|MiscClient|Shaders)\\.ba2$"))) { + } else if (archive.contains(QRegularExpression( + " - (Interface|Materials|MiscClient|Shaders)\\.ba2$"))) { SResourceArchiveMemoryCacheList.append(archive); - } else if (archive.contains(QRegularExpression(" - (GeneratedMeshes|Materials|Meshes(\\d{2}|\\w+)?|MiscClient|Sounds\\d{2}|Startup|Voices)\\.ba2$"))) { + } else if (archive.contains(QRegularExpression( + " - " + "(GeneratedMeshes|Materials|Meshes(\\d{2}|\\w+)?|MiscClient|" + "Sounds\\d{2}|Startup|Voices)\\.ba2$"))) { SResourceArchiveList.append(archive); - } else if (archive.contains(QRegularExpression(" - (Animations|Enlighten(Interiors|Exteriors\\d{2})|GeneratedTextures)\\.ba2$"))) { + } else if (archive.contains( + QRegularExpression(" - " + "(Animations|Enlighten(Interiors|Exteriors\\d{2})" + "|GeneratedTextures)\\.ba2$"))) { SResourceArchiveList2.append(archive); } else if (archive.contains(QRegularExpression(" - ATX_.*\\.ba2$"))) { // if it is named after DLC, it has to go here @@ -138,9 +142,12 @@ void Fallout76DataArchives::writeArchiveList(MOBase::IProfile *profile, const QS } } - setArchivesToKey(iniFile, "sResourceIndexFileList", sResourceIndexFileList.join(", ")); - setArchivesToKey(iniFile, "sResourceStartUpArchiveList", sResourceStartUpArchiveList.join(", ")); - setArchivesToKey(iniFile, "SResourceArchiveMemoryCacheList", SResourceArchiveMemoryCacheList.join(", ")); + setArchivesToKey(iniFile, "sResourceIndexFileList", + sResourceIndexFileList.join(", ")); + setArchivesToKey(iniFile, "sResourceStartUpArchiveList", + sResourceStartUpArchiveList.join(", ")); + setArchivesToKey(iniFile, "SResourceArchiveMemoryCacheList", + SResourceArchiveMemoryCacheList.join(", ")); setArchivesToKey(iniFile, "SResourceArchiveList", SResourceArchiveList.join(", ")); setArchivesToKey(iniFile, "SResourceArchiveList2", SResourceArchiveList2.join(", ")); setArchivesToKey(iniFile, "sResourceArchive2List", sResourceArchive2List.join(", ")); diff --git a/src/fallout76dataarchives.h b/src/fallout76dataarchives.h index 93fc5a3..b507d28 100644 --- a/src/fallout76dataarchives.h +++ b/src/fallout76dataarchives.h @@ -3,20 +3,21 @@ #include "gamebryodataarchives.h" -namespace MOBase { class IProfile; } +namespace MOBase +{ +class IProfile; +} -#include #include +#include class Fallout76DataArchives : public GamebryoDataArchives { public: - - Fallout76DataArchives(const QDir &myGamesDir); + Fallout76DataArchives(const QDir& myGamesDir); public: - virtual QStringList vanillaArchives() const override; virtual QStringList sResourceIndexFileList() const; virtual QStringList sResourceStartUpArchiveList() const; @@ -24,12 +25,11 @@ public: virtual QStringList SResourceArchiveList() const; virtual QStringList SResourceArchiveList2() const; virtual QStringList sResourceArchive2List() const; - virtual QStringList archives(const MOBase::IProfile *profile) const override; + virtual QStringList archives(const MOBase::IProfile* profile) const override; private: - - virtual void writeArchiveList(MOBase::IProfile *profile, const QStringList &before) override; - + virtual void writeArchiveList(MOBase::IProfile* profile, + const QStringList& before) override; }; -#endif // FALLOUT76DATAARCHIVES_H +#endif // FALLOUT76DATAARCHIVES_H diff --git a/src/fallout76moddatachecker.h b/src/fallout76moddatachecker.h index 3fd1730..4ccf6f3 100644 --- a/src/fallout76moddatachecker.h +++ b/src/fallout76moddatachecker.h @@ -9,21 +9,22 @@ public: using GamebryoModDataChecker::GamebryoModDataChecker; protected: - virtual const FileNameSet& possibleFolderNames() const override { + virtual const FileNameSet& possibleFolderNames() const override + { static FileNameSet result{ - "interface", "meshes", "music", "scripts", "sound", "strings", "textures", - "trees", "video", "materials", "f4se", "distantlod", "asi", "Tools", "MCM", - "distantland", "mits", "dllplugins", "CalienteTools", "NetScriptFramework", - "shadersfx", "aaf" - }; + "interface", "meshes", "music", "scripts", + "sound", "strings", "textures", "trees", + "video", "materials", "f4se", "distantlod", + "asi", "Tools", "MCM", "distantland", + "mits", "dllplugins", "CalienteTools", "NetScriptFramework", + "shadersfx", "aaf"}; return result; } - virtual const FileNameSet& possibleFileExtensions() const override { - static FileNameSet result{ - "esp", "esm", "esl", "ba2", "modgroups" - }; + virtual const FileNameSet& possibleFileExtensions() const override + { + static FileNameSet result{"esp", "esm", "esl", "ba2", "modgroups"}; return result; } }; -#endif // FALLOUT4_MODATACHECKER_H +#endif // FALLOUT4_MODATACHECKER_H diff --git a/src/fallout76moddatacontent.h b/src/fallout76moddatacontent.h index 3912927..54ba419 100644 --- a/src/fallout76moddatacontent.h +++ b/src/fallout76moddatacontent.h @@ -4,15 +4,17 @@ #include #include -class Fallout76ModDataContent : public GamebryoModDataContent { +class Fallout76ModDataContent : public GamebryoModDataContent +{ protected: - enum Fallout4Content { + enum Fallout4Content + { CONTENT_MATERIAL = CONTENT_NEXT_VALUE }; public: - Fallout76ModDataContent(MOBase::IGameFeatures const* gameFeatures) : - GamebryoModDataContent(gameFeatures) + Fallout76ModDataContent(MOBase::IGameFeatures const* gameFeatures) + : GamebryoModDataContent(gameFeatures) { m_Enabled[CONTENT_SKYPROC] = false; } @@ -20,22 +22,23 @@ public: std::vector getAllContents() const override { auto contents = GamebryoModDataContent::getAllContents(); - contents.push_back(Content(CONTENT_MATERIAL, "Materials", ":/MO/gui/content/material")); + contents.push_back( + Content(CONTENT_MATERIAL, "Materials", ":/MO/gui/content/material")); return contents; } - std::vector getContentsFor( - std::shared_ptr fileTree) const override + std::vector + getContentsFor(std::shared_ptr fileTree) const override { auto contents = GamebryoModDataContent::getContentsFor(fileTree); for (auto e : *fileTree) { if (e->compare("materials") == 0) { contents.push_back(CONTENT_MATERIAL); - break; // Early break if you have nothing else to check. + break; // Early break if you have nothing else to check. } } return contents; } }; -#endif // FALLOUT4_MODDATACONTENT_H \ No newline at end of file +#endif // FALLOUT4_MODDATACONTENT_H diff --git a/src/fallout76savegame.cpp b/src/fallout76savegame.cpp index ee33274..bdda883 100644 --- a/src/fallout76savegame.cpp +++ b/src/fallout76savegame.cpp @@ -2,32 +2,32 @@ #include "gamefallout76.h" -Fallout76SaveGame::Fallout76SaveGame(QString const& fileName, GameFallout76 const* game) : - GamebryoSaveGame(fileName, game, true) +Fallout76SaveGame::Fallout76SaveGame(QString const& fileName, GameFallout76 const* game) + : GamebryoSaveGame(fileName, game, true) { FileWrapper file(fileName, "FO76_SAVEGAME"); FILETIME ftime; fetchInformationFields(file, m_PCName, m_PCLevel, m_PCLocation, m_SaveNumber, ftime); - //A file time is a 64-bit value that represents the number of 100-nanosecond - //intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC). - //So we need to convert that to something useful + // A file time is a 64-bit value that represents the number of 100-nanosecond + // intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated Universal + // Time (UTC). So we need to convert that to something useful SYSTEMTIME ctime; ::FileTimeToSystemTime(&ftime, &ctime); setCreationTime(ctime); } -void Fallout76SaveGame::fetchInformationFields(FileWrapper& file, - QString playerName, - unsigned short playerLevel, - QString playerLocation, - unsigned long saveNumber, - FILETIME& creationTime) const { +void Fallout76SaveGame::fetchInformationFields(FileWrapper& file, QString playerName, + unsigned short playerLevel, + QString playerLocation, + unsigned long saveNumber, + FILETIME& creationTime) const +{ - file.skip(); // header size - file.skip(); // header version + file.skip(); // header size + file.skip(); // header version file.read(saveNumber); file.read(playerName); @@ -38,25 +38,25 @@ void Fallout76SaveGame::fetchInformationFields(FileWrapper& file, file.read(playerLocation); QString ignore; - file.read(ignore); // playtime as ascii hh.mm.ss - file.read(ignore); // race name (i.e. BretonRace) + file.read(ignore); // playtime as ascii hh.mm.ss + file.read(ignore); // race name (i.e. BretonRace) - file.skip(); // Player gender (0 = male) - file.skip(2); // experience gathered, experience required + file.skip(); // Player gender (0 = male) + file.skip(2); // experience gathered, experience required FILETIME ftime; file.read(ftime); - } -std::unique_ptr Fallout76SaveGame::fetchDataFields() const { +std::unique_ptr Fallout76SaveGame::fetchDataFields() const +{ - FileWrapper file(getFilepath(), "TESV_SAVEGAME"); //10bytes + FileWrapper file(getFilepath(), "TESV_SAVEGAME"); // 10bytes { FILETIME ftime; - fetchInformationFields(file, m_PCName, m_PCLevel, m_PCLocation, m_SaveNumber, ftime); - + fetchInformationFields(file, m_PCName, m_PCLevel, m_PCLocation, m_SaveNumber, + ftime); } std::unique_ptr fields = std::make_unique(); @@ -65,8 +65,8 @@ std::unique_ptr Fallout76SaveGame::fetchDataFields uint8_t saveGameVersion = file.readChar(); QString ignore; - file.read(ignore); // game version - file.skip(); // plugin info size + file.read(ignore); // game version + file.skip(); // plugin info size file.readPlugins(); if (saveGameVersion >= 68) { diff --git a/src/fallout76savegame.h b/src/fallout76savegame.h index 7358c3f..232e758 100644 --- a/src/fallout76savegame.h +++ b/src/fallout76savegame.h @@ -10,19 +10,15 @@ class GameFallout76; class Fallout76SaveGame : public GamebryoSaveGame { public: - Fallout76SaveGame(QString const &fileName, GameFallout76 const *game); + Fallout76SaveGame(QString const& fileName, GameFallout76 const* game); protected: - // Fetch easy-to-access information. - void fetchInformationFields(FileWrapper& wrapper, - QString playerName, - unsigned short playerLevel, - QString playerLocation, - unsigned long saveNumber, - FILETIME& creationTime) const; + void fetchInformationFields(FileWrapper& wrapper, QString playerName, + unsigned short playerLevel, QString playerLocation, + unsigned long saveNumber, FILETIME& creationTime) const; std::unique_ptr fetchDataFields() const override; }; -#endif // FALLOUT76SAVEGAME_H +#endif // FALLOUT76SAVEGAME_H diff --git a/src/fallout76savegameinfo.cpp b/src/fallout76savegameinfo.cpp index 9ba77dd..c6cb621 100644 --- a/src/fallout76savegameinfo.cpp +++ b/src/fallout76savegameinfo.cpp @@ -3,11 +3,8 @@ #include "fallout76savegame.h" #include "gamegamebryo.h" -Fallout76SaveGameInfo::Fallout76SaveGameInfo(GameGamebryo const *game) : - GamebryoSaveGameInfo(game) -{ -} +Fallout76SaveGameInfo::Fallout76SaveGameInfo(GameGamebryo const* game) + : GamebryoSaveGameInfo(game) +{} -Fallout76SaveGameInfo::~Fallout76SaveGameInfo() -{ -} +Fallout76SaveGameInfo::~Fallout76SaveGameInfo() {} diff --git a/src/fallout76savegameinfo.h b/src/fallout76savegameinfo.h index 3aa57e5..457777c 100644 --- a/src/fallout76savegameinfo.h +++ b/src/fallout76savegameinfo.h @@ -8,8 +8,8 @@ class GameGamebryo; class Fallout76SaveGameInfo : public GamebryoSaveGameInfo { public: - Fallout76SaveGameInfo(GameGamebryo const *game); + Fallout76SaveGameInfo(GameGamebryo const* game); ~Fallout76SaveGameInfo(); }; -#endif // FALLOUT76SAVEGAMEINFO_H +#endif // FALLOUT76SAVEGAMEINFO_H diff --git a/src/fallout76scriptextender.cpp b/src/fallout76scriptextender.cpp index 11b0e0c..8a46c5e 100644 --- a/src/fallout76scriptextender.cpp +++ b/src/fallout76scriptextender.cpp @@ -3,10 +3,9 @@ #include #include -Fallout76ScriptExtender::Fallout76ScriptExtender(GameGamebryo const *game) : - GamebryoScriptExtender(game) -{ -} +Fallout76ScriptExtender::Fallout76ScriptExtender(GameGamebryo const* game) + : GamebryoScriptExtender(game) +{} QString Fallout76ScriptExtender::BinaryName() const { diff --git a/src/fallout76scriptextender.h b/src/fallout76scriptextender.h index b8c1379..206d597 100644 --- a/src/fallout76scriptextender.h +++ b/src/fallout76scriptextender.h @@ -8,10 +8,10 @@ class GameGamebryo; class Fallout76ScriptExtender : public GamebryoScriptExtender { public: - Fallout76ScriptExtender(GameGamebryo const *game); + Fallout76ScriptExtender(GameGamebryo const* game); virtual QString BinaryName() const override; virtual QString PluginPath() const override; }; -#endif // FALLOUT76SCRIPTEXTENDER_H +#endif // FALLOUT76SCRIPTEXTENDER_H diff --git a/src/fallout76unmanagedmods.cpp b/src/fallout76unmanagedmods.cpp index 3eb4f45..1ddc21c 100644 --- a/src/fallout76unmanagedmods.cpp +++ b/src/fallout76unmanagedmods.cpp @@ -1,24 +1,23 @@ #include "fallout76unmanagedmods.h" - -Fallout76UnmangedMods::Fallout76UnmangedMods(const GameGamebryo *game) - : GamebryoUnmangedMods(game) +Fallout76UnmangedMods::Fallout76UnmangedMods(const GameGamebryo* game) + : GamebryoUnmangedMods(game) {} -Fallout76UnmangedMods::~Fallout76UnmangedMods() -{} +Fallout76UnmangedMods::~Fallout76UnmangedMods() {} -QStringList Fallout76UnmangedMods::mods(bool onlyOfficial) const { +QStringList Fallout76UnmangedMods::mods(bool onlyOfficial) const +{ QStringList result; - QStringList pluginList = game()->primaryPlugins(); + QStringList pluginList = game()->primaryPlugins(); QStringList otherPlugins = game()->DLCPlugins(); otherPlugins.append(game()->CCPlugins()); for (QString plugin : otherPlugins) { pluginList.removeAll(plugin); } QDir dataDir(game()->dataDirectory()); - for (const QString &fileName : dataDir.entryList({ "*.esp", "*.esl", "*.esm" })) { + for (const QString& fileName : dataDir.entryList({"*.esp", "*.esl", "*.esm"})) { if (!pluginList.contains(fileName, Qt::CaseInsensitive)) { if (!onlyOfficial || pluginList.contains(fileName, Qt::CaseInsensitive)) { QFileInfo file(fileName); @@ -30,17 +29,18 @@ QStringList Fallout76UnmangedMods::mods(bool onlyOfficial) const { return result; } -QStringList Fallout76UnmangedMods::secondaryFiles(const QString &modName) const { +QStringList Fallout76UnmangedMods::secondaryFiles(const QString& modName) const +{ // file extension in FO76 is .ba2 instead of bsa QStringList archives; QDir dataDir = game()->dataDirectory(); - for (const QString &archiveName : dataDir.entryList({modName + "*.ba2"})) { + for (const QString& archiveName : dataDir.entryList({modName + "*.ba2"})) { archives.append(dataDir.absoluteFilePath(archiveName)); } return archives; } -QString Fallout76UnmangedMods::displayName(const QString &modName) const +QString Fallout76UnmangedMods::displayName(const QString& modName) const { return modName; } diff --git a/src/fallout76unmanagedmods.h b/src/fallout76unmanagedmods.h index f0d6f94..17d476d 100644 --- a/src/fallout76unmanagedmods.h +++ b/src/fallout76unmanagedmods.h @@ -1,21 +1,18 @@ #ifndef FALLOUT76UNMANAGEDMODS_H #define FALLOUT76UNMANAGEDMODS_H - #include "gamebryounmanagedmods.h" #include - -class Fallout76UnmangedMods : public GamebryoUnmangedMods { +class Fallout76UnmangedMods : public GamebryoUnmangedMods +{ public: - Fallout76UnmangedMods(const GameGamebryo *game); + Fallout76UnmangedMods(const GameGamebryo* game); ~Fallout76UnmangedMods(); virtual QStringList mods(bool onlyOfficial) const override; - virtual QStringList secondaryFiles(const QString &modName) const override; - virtual QString displayName(const QString &modName) const override; + virtual QStringList secondaryFiles(const QString& modName) const override; + virtual QString displayName(const QString& modName) const override; }; - - -#endif // FALLOUT76UNMANAGEDMODS_H +#endif // FALLOUT76UNMANAGEDMODS_H diff --git a/src/gamefallout76.cpp b/src/gamefallout76.cpp index 559f466..1d7fd71 100644 --- a/src/gamefallout76.cpp +++ b/src/gamefallout76.cpp @@ -3,15 +3,15 @@ #include "fallout76dataarchives.h" #include "fallout76moddatachecker.h" #include "fallout76moddatacontent.h" -#include "fallout76scriptextender.h" #include "fallout76savegameinfo.h" +#include "fallout76scriptextender.h" #include "fallout76unmanagedmods.h" -#include +#include "versioninfo.h" +#include #include #include -#include -#include "versioninfo.h" +#include #include #include @@ -27,11 +27,9 @@ using namespace MOBase; -GameFallout76::GameFallout76() -{ -} +GameFallout76::GameFallout76() {} -bool GameFallout76::init(IOrganizer *moInfo) +bool GameFallout76::init(IOrganizer* moInfo) { if (!GameGamebryo::init(moInfo)) { return false; @@ -40,7 +38,8 @@ bool GameFallout76::init(IOrganizer *moInfo) registerFeature(std::make_shared(this)); registerFeature(std::make_shared(myGamesPath())); 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)); @@ -55,15 +54,19 @@ QString GameFallout76::gameName() const QList GameFallout76::executables() const { return QList() - << ExecutableInfo("F76SE", findInGameFolder(m_Organizer->gameFeatures()->gameFeature()->loaderName())) - << ExecutableInfo("Fallout 76", findInGameFolder(binaryName())) - << ExecutableInfo("Fallout Launcher", findInGameFolder(getLauncherName())) - << ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe")) - << ExecutableInfo("LOOT", QFileInfo(getLootPath())).withArgument("--game=\"Fallout76\"") - ; + << ExecutableInfo("F76SE", + findInGameFolder(m_Organizer->gameFeatures() + ->gameFeature() + ->loaderName())) + << ExecutableInfo("Fallout 76", findInGameFolder(binaryName())) + << ExecutableInfo("Fallout Launcher", findInGameFolder(getLauncherName())) + << ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe")) + << ExecutableInfo("LOOT", QFileInfo(getLootPath())) + .withArgument("--game=\"Fallout76\""); } -QList GameFallout76::executableForcedLoads() const { +QList GameFallout76::executableForcedLoads() const +{ return {}; } @@ -80,7 +83,8 @@ QString GameFallout76::author() const QString GameFallout76::description() const { return tr("Adds support for the game Fallout 76.\n" - "Splash by %1").arg("nekoyoubi"); + "Splash by %1") + .arg("nekoyoubi"); } MOBase::VersionInfo GameFallout76::version() const @@ -93,7 +97,7 @@ QList GameFallout76::settings() const return QList(); } -void GameFallout76::initializeProfile(const QDir &path, ProfileSettings settings) const +void GameFallout76::initializeProfile(const QDir& path, ProfileSettings settings) const { if (settings.testFlag(IPluginGame::MODS)) { copyToProfile(localAppFolder() + "/Fallout76", path, "plugins.txt"); @@ -101,15 +105,16 @@ void GameFallout76::initializeProfile(const QDir &path, ProfileSettings settings } if (settings.testFlag(IPluginGame::CONFIGURATION)) { - if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) - || !QFileInfo(myGamesPath() + "/Fallout76.ini").exists()) { - copyToProfile(gameDirectory().absolutePath(), path, "Fallout76_default.ini", "Fallout76.ini"); + if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) || + !QFileInfo(myGamesPath() + "/Fallout76.ini").exists()) { + copyToProfile(gameDirectory().absolutePath(), path, "Fallout76_default.ini", + "Fallout76.ini"); } else { copyToProfile(myGamesPath(), path, "Fallout76.ini"); } copyToProfile(myGamesPath(), path, "Fallout76Prefs.ini"); - copyToProfile(myGamesPath(), path, "Fallout76Custom.ini"); + copyToProfile(myGamesPath(), path, "Fallout76Custom.ini"); } } @@ -123,7 +128,8 @@ QString GameFallout76::savegameSEExtension() const return "f76se"; } -std::vector> GameFallout76::listSaves(QDir folder) const +std::vector> +GameFallout76::listSaves(QDir folder) const { return {}; } @@ -138,7 +144,8 @@ QString GameFallout76::steamAPPId() const return "n/a"; } -QStringList GameFallout76::primaryPlugins() const { +QStringList GameFallout76::primaryPlugins() const +{ QStringList plugins = {"SeventySix.esm"}; plugins.append(CCPlugins()); @@ -148,7 +155,7 @@ QStringList GameFallout76::primaryPlugins() const { QStringList GameFallout76::gameVariants() const { - return { "Regular" }; + return {"Regular"}; } QString GameFallout76::gameShortName() const @@ -163,7 +170,7 @@ QString GameFallout76::gameNexusName() const QStringList GameFallout76::iniFiles() const { - return { "Fallout76.ini", "Fallout76Prefs.ini", "Fallout76Custom.ini" }; + return {"Fallout76.ini", "Fallout76Prefs.ini", "Fallout76Custom.ini"}; } QStringList GameFallout76::DLCPlugins() const @@ -176,7 +183,9 @@ QStringList GameFallout76::CCPlugins() const QStringList plugins = {}; QFile file(gameDirectory().absoluteFilePath("Fallout76.ccc")); if (file.open(QIODevice::ReadOnly)) { - ON_BLOCK_EXIT([&file]() { file.close(); }); + ON_BLOCK_EXIT([&file]() { + file.close(); + }); if (file.size() == 0) { return plugins; diff --git a/src/gamefallout76.h b/src/gamefallout76.h index c21e29e..3386dc0 100644 --- a/src/gamefallout76.h +++ b/src/gamefallout76.h @@ -1,7 +1,6 @@ #ifndef GAMEFALLOUT76_H #define GAMEFALLOUT76_H - #include "gamegamebryo.h" #include @@ -14,17 +13,15 @@ class GameFallout76 : public GameGamebryo Q_PLUGIN_METADATA(IID "in.ejew.GameFallout76" FILE "gamefallout76.json") public: - GameFallout76(); - virtual bool init(MOBase::IOrganizer *moInfo) override; - -public: // IPluginGame interface + virtual bool init(MOBase::IOrganizer* moInfo) override; +public: // IPluginGame interface QString gameName() const override; QList executables() const override; QList executableForcedLoads() const override; - void initializeProfile(const QDir &path, ProfileSettings settings) const override; + void initializeProfile(const QDir& path, ProfileSettings settings) const override; QString steamAPPId() const override; QStringList primaryPlugins() const override; QStringList gameVariants() const override; @@ -36,10 +33,10 @@ public: // IPluginGame interface LoadOrderMechanism loadOrderMechanism() const override; int nexusModOrganizerID() const override; int nexusGameID() const override; - std::vector> listSaves(QDir folder) const override; - -public: // IPlugin interface + std::vector> + listSaves(QDir folder) const override; +public: // IPlugin interface QString name() const override; QString author() const override; QString description() const override; @@ -52,4 +49,4 @@ protected: QString savegameSEExtension() const override; }; -#endif // GAMEFallout76_H +#endif // GAMEFallout76_H From 1cb456f16fb09263168e6e41466c07a4bffdf7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:27:34 +0200 Subject: [PATCH 2/3] Add .git-blame-ignore-revs. --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..946b492 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +e3bfde72c076ac756d966ec87d848f628ba73088 From 8c7b9ff9ce27c2b6e85a6ff24e3016f53f21e086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:27:34 +0200 Subject: [PATCH 3/3] Add github actions. --- .github/workflows/build.yml | 16 ++++++++++++++++ .github/workflows/linting.yml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/linting.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7ba86be --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: Build Fallout 76 Plugin + +on: + push: + branches: master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: windows-2022 + steps: + - name: Build Fallout 76 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..d8353d7 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,16 @@ +name: Lint Fallout 76 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: "."