Skip to content

Commit

Permalink
Merge pull request #37 from ModOrganizer2/ci/gh-action
Browse files Browse the repository at this point in the history
* Fix formatting.
* Ignore formatting revision.
* Add github action for build and formatting.
* Remove old build files.
  • Loading branch information
Holt59 authored May 26, 2024
2 parents e1a0b1e + b03e137 commit 66bfb1e
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 343 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f40a37e2704e7b9ec0376ec0f04dd6eff7f3950b
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 TTW Plugin

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

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

This file was deleted.

13 changes: 0 additions & 13 deletions src/SConscript

This file was deleted.

8 changes: 4 additions & 4 deletions src/falloutttwbsainvalidation.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "falloutttwbsainvalidation.h"

FalloutTTWBSAInvalidation::FalloutTTWBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game)
: GamebryoBSAInvalidation(dataArchives, "fallout.ini", game)
{
}
FalloutTTWBSAInvalidation::FalloutTTWBSAInvalidation(DataArchives* dataArchives,
MOBase::IPluginGame const* game)
: GamebryoBSAInvalidation(dataArchives, "fallout.ini", game)
{}

QString FalloutTTWBSAInvalidation::invalidationBSAName() const
{
Expand Down
11 changes: 4 additions & 7 deletions src/falloutttwbsainvalidation.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#ifndef FALLOUTTTWBSAINVALIDATION_H
#define FALLOUTTTWBSAINVALIDATION_H


#include "gamebryobsainvalidation.h"
#include "falloutttwdataarchives.h"
#include "gamebryobsainvalidation.h"

#include <memory>

class FalloutTTWBSAInvalidation : public GamebryoBSAInvalidation
{
public:

FalloutTTWBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game);
FalloutTTWBSAInvalidation(DataArchives* dataArchives,
MOBase::IPluginGame const* game);

private:

virtual QString invalidationBSAName() const override;
virtual unsigned long bsaVersion() const override;

};

#endif // FALLOUTTTWBSAINVALIDATION_H
#endif // FALLOUTTTWBSAINVALIDATION_H
28 changes: 14 additions & 14 deletions src/falloutttwdataarchives.cpp
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
#include "falloutttwdataarchives.h"
#include <utility.h>

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

QStringList FalloutTTWDataArchives::vanillaArchives() const
{
return { "Fallout - Textures.bsa"
, "Fallout - Textures2.bsa"
, "Fallout - Meshes.bsa"
, "Fallout - Voices1.bsa"
, "Fallout - Sound.bsa"
, "Fallout - Misc.bsa" };
return {"Fallout - Textures.bsa", "Fallout - Textures2.bsa", "Fallout - Meshes.bsa",
"Fallout - Voices1.bsa", "Fallout - Sound.bsa", "Fallout - Misc.bsa"};
}

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

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

return result;
}

void FalloutTTWDataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before)
void FalloutTTWDataArchives::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");
QString iniFile = profile->localSettingsEnabled()
? QDir(profile->absolutePath()).absoluteFilePath("fallout.ini")
: m_LocalGameDir.absoluteFilePath("fallout.ini");
setArchivesToKey(iniFile, "SArchiveList", list);
}
17 changes: 8 additions & 9 deletions src/falloutttwdataarchives.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#ifndef FALLOUTTTWDATAARCHIVES_H
#define FALLOUTTTWDATAARCHIVES_H


#include <gamebryodataarchives.h>
#include <iprofile.h>
#include <QDir>
#include <QString>
#include <QStringList>
#include <QDir>
#include <gamebryodataarchives.h>
#include <iprofile.h>

class FalloutTTWDataArchives : public GamebryoDataArchives
{
public:
FalloutTTWDataArchives(const QDir &myGamesDir);
FalloutTTWDataArchives(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 // FALLOUTTTWDATAARCHIVES_H
#endif // FALLOUTTTWDATAARCHIVES_H
13 changes: 7 additions & 6 deletions src/falloutttwmoddatacontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
#include <gamebryomoddatacontent.h>
#include <ifiletree.h>

class FalloutTTWModDataContent : public GamebryoModDataContent {
class FalloutTTWModDataContent : public GamebryoModDataContent
{
public:

/**
*
*/
FalloutTTWModDataContent(GameGamebryo const* gamePlugin) : GamebryoModDataContent(gamePlugin) {
FalloutTTWModDataContent(GameGamebryo const* gamePlugin)
: GamebryoModDataContent(gamePlugin)
{
// Just need to disable some contents:
m_Enabled[CONTENT_MCM] = false;
m_Enabled[CONTENT_MCM] = false;
m_Enabled[CONTENT_SKYPROC] = false;
}

};

#endif // FALLOUTTTW_MODDATACONTENT_H
#endif // FALLOUTTTW_MODDATACONTENT_H
48 changes: 24 additions & 24 deletions src/falloutttwsavegame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,33 @@

#include "gamefalloutttw.h"

FalloutTTWSaveGame::FalloutTTWSaveGame(QString const &fileName, GameFalloutTTW const *game) :
GamebryoSaveGame(fileName, game)
FalloutTTWSaveGame::FalloutTTWSaveGame(QString const& fileName,
GameFalloutTTW 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 FalloutTTWSaveGame::fetchInformationFields(
FileWrapper& file,
unsigned long& width,
unsigned long& height,
unsigned long& saveNumber,
QString& playerName,
unsigned short& playerLevel,
QString& playerLocation) const
void FalloutTTWSaveGame::fetchInformationFields(FileWrapper& file, unsigned long& width,
unsigned long& height,
unsigned long& saveNumber,
QString& playerName,
unsigned short& playerLevel,
QString& playerLocation) const
{
file.skip<unsigned long>(); //Save header size
file.skip<unsigned long>(); // Save header size

file.skip<unsigned long>(); //File version?
file.skip<unsigned char>(); //Delimiter
file.skip<unsigned long>(); // File version?
file.skip<unsigned char>(); // Delimiter

//A huge wodge of text with no length but a delimiter. Given the null bytes
//in it I presume it's fixed length (64 bytes + delim) but I have no
//definite spec
for (unsigned char ignore = 0; ignore != 0x7c; ) {
file.read(ignore); // unknown
// A huge wodge of text with no length but a delimiter. Given the null bytes
// in it I presume it's fixed length (64 bytes + delim) but I have no
// definite spec
for (unsigned char ignore = 0; ignore != 0x7c;) {
file.read(ignore); // unknown
}

file.setHasFieldMarkers(true);
Expand All @@ -49,7 +48,8 @@ void FalloutTTWSaveGame::fetchInformationFields(
file.read(playerLocation);
}

std::unique_ptr<GamebryoSaveGame::DataFields> FalloutTTWSaveGame::fetchDataFields() const
std::unique_ptr<GamebryoSaveGame::DataFields>
FalloutTTWSaveGame::fetchDataFields() const
{
FileWrapper file(getFilepath(), "FO3SAVEGAME");

Expand All @@ -61,16 +61,16 @@ std::unique_ptr<GamebryoSaveGame::DataFields> FalloutTTWSaveGame::fetchDataField
unsigned short dummyLevel;
unsigned long dummySaveNumber;

fetchInformationFields(file, width, height,
dummySaveNumber, dummyName, dummyLevel, dummyLocation);
fetchInformationFields(file, width, height, dummySaveNumber, dummyName, dummyLevel,
dummyLocation);
}

QString playtime;
file.read(playtime);

fields->Screenshot = file.readImage(width, height, 256);

file.skip<char>(5); // unknown (1 byte), plugin size (4 bytes)
file.skip<char>(5); // unknown (1 byte), plugin size (4 bytes)

file.setPluginString(GamebryoSaveGame::StringType::TYPE_BSTRING);
fields->Plugins = file.readPlugins();
Expand Down
17 changes: 6 additions & 11 deletions src/falloutttwsavegame.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@ class GameFalloutTTW;
class FalloutTTWSaveGame : public GamebryoSaveGame
{
public:
FalloutTTWSaveGame(QString const &fileName, GameFalloutTTW const *game);
FalloutTTWSaveGame(QString const& fileName, GameFalloutTTW 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<DataFields> fetchDataFields() const override;
};

#endif // FALLOUTTTWSAVEGAME_H
#endif // FALLOUTTTWSAVEGAME_H
7 changes: 3 additions & 4 deletions src/falloutttwscriptextender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
#include <QString>
#include <QStringList>

FalloutTTWScriptExtender::FalloutTTWScriptExtender(GameGamebryo const *game) :
GamebryoScriptExtender(game)
{
}
FalloutTTWScriptExtender::FalloutTTWScriptExtender(GameGamebryo const* game)
: GamebryoScriptExtender(game)
{}

QString FalloutTTWScriptExtender::BinaryName() const
{
Expand Down
5 changes: 2 additions & 3 deletions src/falloutttwscriptextender.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ class GameGamebryo;
class FalloutTTWScriptExtender : public GamebryoScriptExtender
{
public:
FalloutTTWScriptExtender(const GameGamebryo *game);
FalloutTTWScriptExtender(const GameGamebryo* game);

virtual QString BinaryName() const override;
virtual QString PluginPath() const override;

};

#endif // FALLOUTTTWSCRIPTEXTENDER_H
#endif // FALLOUTTTWSCRIPTEXTENDER_H
Loading

0 comments on commit 66bfb1e

Please sign in to comment.