Skip to content

Commit

Permalink
Merge pull request #27 from ModOrganizer2/dev/format-and-gh-actions
Browse files Browse the repository at this point in the history
 Formatting and Github Actions
  • Loading branch information
Holt59 authored Jun 9, 2024
2 parents 796be48 + 4bb97ed commit 10a6432
Show file tree
Hide file tree
Showing 19 changed files with 249 additions and 205 deletions.
41 changes: 41 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ca290eff60953a6c4a395522694b83a92a6052ea
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build Fallout 4 Plugin

on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: windows-2022
steps:
- name: Build Fallout 4 Plugin
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-dependencies: cmake_common uibase game_gamebryo
16 changes: 16 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Fallout 4 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: "."
40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

5 changes: 3 additions & 2 deletions src/fallout4bsainvalidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class IPluginGame;
class Fallout4BSAInvalidation : public GamebryoBSAInvalidation
{
public:
Fallout4BSAInvalidation(MOBase::DataArchives* dataArchives, MOBase::IPluginGame const* game);
Fallout4BSAInvalidation(MOBase::DataArchives* dataArchives,
MOBase::IPluginGame const* game);
virtual bool isInvalidationBSA(const QString& bsaName) override;
virtual bool prepareProfile(MOBase::IProfile* profile) override;

Expand All @@ -29,4 +30,4 @@ class Fallout4BSAInvalidation : public GamebryoBSAInvalidation
MOBase::IPluginGame const* m_Game;
};

#endif // FALLOUT4BSAINVALIDATION_H
#endif // FALLOUT4BSAINVALIDATION_H
47 changes: 21 additions & 26 deletions src/fallout4dataarchives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,45 @@
#include "iprofile.h"
#include <utility.h>

Fallout4DataArchives::Fallout4DataArchives(const QDir &myGamesDir) :
GamebryoDataArchives(myGamesDir)
Fallout4DataArchives::Fallout4DataArchives(const QDir& myGamesDir)
: GamebryoDataArchives(myGamesDir)
{}

QStringList Fallout4DataArchives::vanillaArchives() const
{
return { "Fallout4 - Textures1.ba2"
, "Fallout4 - Textures2.ba2"
, "Fallout4 - Textures3.ba2"
, "Fallout4 - Textures4.ba2"
, "Fallout4 - Textures5.ba2"
, "Fallout4 - Textures6.ba2"
, "Fallout4 - Textures7.ba2"
, "Fallout4 - Textures8.ba2"
, "Fallout4 - Textures9.ba2"
, "Fallout4 - Meshes.ba2"
, "Fallout4 - MeshesExtra.ba2"
, "Fallout4 - Voices.ba2"
, "Fallout4 - Sounds.ba2"
, "Fallout4 - Interface.ba2"
, "Fallout4 - Animations.ba2"
, "Fallout4 - Materials.ba2"
, "Fallout4 - Shaders.ba2"
, "Fallout4 - Startup.ba2"
, "Fallout4 - Misc.ba2" };
return {"Fallout4 - Textures1.ba2", "Fallout4 - Textures2.ba2",
"Fallout4 - Textures3.ba2", "Fallout4 - Textures4.ba2",
"Fallout4 - Textures5.ba2", "Fallout4 - Textures6.ba2",
"Fallout4 - Textures7.ba2", "Fallout4 - Textures8.ba2",
"Fallout4 - Textures9.ba2", "Fallout4 - Meshes.ba2",
"Fallout4 - MeshesExtra.ba2", "Fallout4 - Voices.ba2",
"Fallout4 - Sounds.ba2", "Fallout4 - Interface.ba2",
"Fallout4 - Animations.ba2", "Fallout4 - Materials.ba2",
"Fallout4 - Shaders.ba2", "Fallout4 - Startup.ba2",
"Fallout4 - Misc.ba2"};
}


QStringList Fallout4DataArchives::archives(const MOBase::IProfile *profile) const
QStringList Fallout4DataArchives::archives(const MOBase::IProfile* profile) const
{
QStringList result;

QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("fallout4.ini") : m_LocalGameDir.absoluteFilePath("fallout4.ini");
QString iniFile = profile->localSettingsEnabled()
? QDir(profile->absolutePath()).absoluteFilePath("fallout4.ini")
: m_LocalGameDir.absoluteFilePath("fallout4.ini");
result.append(getArchivesFromKey(iniFile, "SResourceArchiveList"));
result.append(getArchivesFromKey(iniFile, "SResourceArchiveList2"));

return result;
}

void Fallout4DataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before)
void Fallout4DataArchives::writeArchiveList(MOBase::IProfile* profile,
const QStringList& before)
{
QString list = before.join(", ");

QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("fallout4.ini") : m_LocalGameDir.absoluteFilePath("fallout4.ini");
QString iniFile = profile->localSettingsEnabled()
? QDir(profile->absolutePath()).absoluteFilePath("fallout4.ini")
: m_LocalGameDir.absoluteFilePath("fallout4.ini");
if (list.length() > 255) {
int splitIdx = list.lastIndexOf(",", 256);
setArchivesToKey(iniFile, "SResourceArchiveList", list.mid(0, splitIdx));
Expand Down
20 changes: 10 additions & 10 deletions src/fallout4dataarchives.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

#include "gamebryodataarchives.h"

namespace MOBase { class IProfile; }
namespace MOBase
{
class IProfile;
}

#include <QStringList>
#include <QDir>
#include <QStringList>

class Fallout4DataArchives : public GamebryoDataArchives
{

public:

Fallout4DataArchives(const QDir &myGamesDir);
Fallout4DataArchives(const QDir& myGamesDir);

public:

virtual QStringList vanillaArchives() const override;
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 // FALLOUT4DATAARCHIVES_H
#endif // FALLOUT4DATAARCHIVES_H
21 changes: 11 additions & 10 deletions src/fallout4moddatachecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ class Fallout4ModDataChecker : public GamebryoModDataChecker
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", "shadersfx", "aaf"
};
"interface", "meshes", "music", "scripts", "sound", "strings",
"textures", "trees", "video", "materials", "f4se", "distantlod",
"asi", "Tools", "MCM", "distantland", "mits", "dllplugins",
"CalienteTools", "shadersfx", "aaf"};
return result;
}
virtual const FileNameSet& possibleFileExtensions() const override {
static FileNameSet result{
"esp", "esm", "esl", "ba2", "modgroups", "ini", "csg", "cdx"
};
virtual const FileNameSet& possibleFileExtensions() const override
{
static FileNameSet result{"esp", "esm", "esl", "ba2",
"modgroups", "ini", "csg", "cdx"};
return result;
}
};

#endif // FALLOUT4_MODATACHECKER_H
#endif // FALLOUT4_MODATACHECKER_H
21 changes: 12 additions & 9 deletions src/fallout4moddatacontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,41 @@
#include <gamebryomoddatacontent.h>
#include <ifiletree.h>

class Fallout4ModDataContent : public GamebryoModDataContent {
class Fallout4ModDataContent : public GamebryoModDataContent
{
protected:
enum Fallout4Content {
enum Fallout4Content
{
CONTENT_MATERIAL = CONTENT_NEXT_VALUE
};

public:
Fallout4ModDataContent(const MOBase::IGameFeatures* gameFeatures) :
GamebryoModDataContent(gameFeatures)
Fallout4ModDataContent(const MOBase::IGameFeatures* gameFeatures)
: GamebryoModDataContent(gameFeatures)
{
m_Enabled[CONTENT_SKYPROC] = false;
}

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
Loading

0 comments on commit 10a6432

Please sign in to comment.