Merge pull request #4 from ModOrganizer2/dev/format-and-gh-actions

This commit is contained in:
Mikaël Capelle
2024-06-09 13:41:12 +02:00
committed by GitHub
19 changed files with 301 additions and 214 deletions
+41
View File
@@ -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']
+1
View File
@@ -0,0 +1 @@
e3bfde72c076ac756d966ec87d848f628ba73088
+7
View File
@@ -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
+16
View File
@@ -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
+16
View File
@@ -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: "."
+86 -79
View File
@@ -5,96 +5,88 @@
#include <QRegularExpression>
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(", "));
+10 -10
View File
@@ -3,20 +3,21 @@
#include "gamebryodataarchives.h"
namespace MOBase { class IProfile; }
namespace MOBase
{
class IProfile;
}
#include <QStringList>
#include <QDir>
#include <QStringList>
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
+12 -11
View File
@@ -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
+12 -9
View File
@@ -4,15 +4,17 @@
#include <gamebryomoddatacontent.h>
#include <ifiletree.h>
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<Content> 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<int> getContentsFor(
std::shared_ptr<const MOBase::IFileTree> fileTree) const override
std::vector<int>
getContentsFor(std::shared_ptr<const MOBase::IFileTree> 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
#endif // FALLOUT4_MODDATACONTENT_H
+24 -24
View File
@@ -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<unsigned long>(); // header size
file.skip<uint32_t>(); // header version
file.skip<unsigned long>(); // header size
file.skip<uint32_t>(); // 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<unsigned short>(); // Player gender (0 = male)
file.skip<float>(2); // experience gathered, experience required
file.skip<unsigned short>(); // Player gender (0 = male)
file.skip<float>(2); // experience gathered, experience required
FILETIME ftime;
file.read(ftime);
}
std::unique_ptr<GamebryoSaveGame::DataFields> Fallout76SaveGame::fetchDataFields() const {
std::unique_ptr<GamebryoSaveGame::DataFields> 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<DataFields> fields = std::make_unique<DataFields>();
@@ -65,8 +65,8 @@ std::unique_ptr<GamebryoSaveGame::DataFields> Fallout76SaveGame::fetchDataFields
uint8_t saveGameVersion = file.readChar();
QString ignore;
file.read(ignore); // game version
file.skip<uint32_t>(); // plugin info size
file.read(ignore); // game version
file.skip<uint32_t>(); // plugin info size
file.readPlugins();
if (saveGameVersion >= 68) {
+5 -9
View File
@@ -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<DataFields> fetchDataFields() const override;
};
#endif // FALLOUT76SAVEGAME_H
#endif // FALLOUT76SAVEGAME_H
+4 -7
View File
@@ -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() {}
+2 -2
View File
@@ -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
+3 -4
View File
@@ -3,10 +3,9 @@
#include <QString>
#include <QStringList>
Fallout76ScriptExtender::Fallout76ScriptExtender(GameGamebryo const *game) :
GamebryoScriptExtender(game)
{
}
Fallout76ScriptExtender::Fallout76ScriptExtender(GameGamebryo const* game)
: GamebryoScriptExtender(game)
{}
QString Fallout76ScriptExtender::BinaryName() const
{
+2 -2
View File
@@ -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
+11 -11
View File
@@ -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;
}
+6 -9
View File
@@ -1,21 +1,18 @@
#ifndef FALLOUT76UNMANAGEDMODS_H
#define FALLOUT76UNMANAGEDMODS_H
#include "gamebryounmanagedmods.h"
#include <gamegamebryo.h>
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
+36 -27
View File
@@ -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 <pluginsetting.h>
#include "versioninfo.h"
#include <creationgameplugins.h>
#include <executableinfo.h>
#include <gamebryolocalsavegames.h>
#include <creationgameplugins.h>
#include "versioninfo.h"
#include <pluginsetting.h>
#include <QCoreApplication>
#include <QDir>
@@ -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<Fallout76ScriptExtender>(this));
registerFeature(std::make_shared<Fallout76DataArchives>(myGamesPath()));
registerFeature(std::make_shared<Fallout76ModDataChecker>(this));
registerFeature(std::make_shared<Fallout76ModDataContent>(m_Organizer->gameFeatures()));
registerFeature(
std::make_shared<Fallout76ModDataContent>(m_Organizer->gameFeatures()));
registerFeature(std::make_shared<CreationGamePlugins>(moInfo));
registerFeature(std::make_shared<Fallout76UnmangedMods>(this));
@@ -55,15 +54,19 @@ QString GameFallout76::gameName() const
QList<ExecutableInfo> GameFallout76::executables() const
{
return QList<ExecutableInfo>()
<< ExecutableInfo("F76SE", findInGameFolder(m_Organizer->gameFeatures()->gameFeature<MOBase::ScriptExtender>()->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<MOBase::ScriptExtender>()
->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<ExecutableForcedLoadSetting> GameFallout76::executableForcedLoads() const {
QList<ExecutableForcedLoadSetting> 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<PluginSetting> GameFallout76::settings() const
return QList<PluginSetting>();
}
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<std::shared_ptr<const MOBase::ISaveGame>> GameFallout76::listSaves(QDir folder) const
std::vector<std::shared_ptr<const MOBase::ISaveGame>>
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;
+7 -10
View File
@@ -1,7 +1,6 @@
#ifndef GAMEFALLOUT76_H
#define GAMEFALLOUT76_H
#include "gamegamebryo.h"
#include <QObject>
@@ -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<MOBase::ExecutableInfo> executables() const override;
QList<MOBase::ExecutableForcedLoadSetting> 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<std::shared_ptr<const MOBase::ISaveGame>> listSaves(QDir folder) const override;
public: // IPlugin interface
std::vector<std::shared_ptr<const MOBase::ISaveGame>>
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