From 839b02529e245a12597efd27a9dcff32aad6025b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:41:31 +0200 Subject: [PATCH 1/4] Remove appveyor.yml. --- appveyor.yml | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7707d70..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_skyrimvr.dll - name: game_skyrimvr_dll -- path: vsbuild\src\RelWithDebInfo\game_skyrimvr.pdb - name: game_skyrimvr_pdb -- path: vsbuild\src\RelWithDebInfo\game_skyrimvr.lib - name: game_skyrimvr_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 From 74d288c4ae0f507767a165936f154d5477079e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:41:31 +0200 Subject: [PATCH 2/4] Format files and add .gitattributes and .clang-format. --- .clang-format | 41 +++++++++++++++ .gitattributes | 7 +++ src/gameskyrimvr.cpp | 94 ++++++++++++++++++---------------- src/gameskyrimvr.h | 21 ++++---- src/skyrimvrdataarchives.cpp | 44 +++++++--------- src/skyrimvrdataarchives.h | 21 ++++---- src/skyrimvrgameplugins.cpp | 16 +++--- src/skyrimvrgameplugins.h | 9 ++-- src/skyrimvrmoddatachecker.h | 25 ++++----- src/skyrimvrmoddatacontent.h | 11 ++-- src/skyrimvrsavegame.cpp | 58 ++++++++++----------- src/skyrimvrsavegame.h | 16 +++--- src/skyrimvrscriptextender.cpp | 7 ++- src/skyrimvrscriptextender.h | 5 +- src/skyrimvrunmanagedmods.cpp | 16 +++--- src/skyrimvrunmanagedmods.h | 7 +-- 16 files changed, 217 insertions(+), 181 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/gameskyrimvr.cpp b/src/gameskyrimvr.cpp index 61f8a75..114ac31 100644 --- a/src/gameskyrimvr.cpp +++ b/src/gameskyrimvr.cpp @@ -1,18 +1,18 @@ #include "gameskyrimvr.h" #include "skyrimvrdataarchives.h" -#include "skyrimvrscriptextender.h" -#include "skyrimvrunmanagedmods.h" +#include "skyrimvrgameplugins.h" #include "skyrimvrmoddatachecker.h" #include "skyrimvrmoddatacontent.h" #include "skyrimvrsavegame.h" -#include "skyrimvrgameplugins.h" +#include "skyrimvrscriptextender.h" +#include "skyrimvrunmanagedmods.h" -#include +#include "versioninfo.h" #include #include #include -#include "versioninfo.h" +#include #include #include @@ -22,16 +22,14 @@ #include #include -#include #include "scopeguard.h" +#include using namespace MOBase; -GameSkyrimVR::GameSkyrimVR() -{ -} +GameSkyrimVR::GameSkyrimVR() {} -void GameSkyrimVR::setGamePath(const QString &path) +void GameSkyrimVR::setGamePath(const QString& path) { m_GamePath = path; } @@ -44,7 +42,8 @@ QDir GameSkyrimVR::documentsDirectory() const QString GameSkyrimVR::identifyGamePath() const { QString path = "Software\\Bethesda Softworks\\" + gameName(); - return findInRegistry(HKEY_LOCAL_MACHINE, path.toStdWString().c_str(), L"Installed Path"); + return findInRegistry(HKEY_LOCAL_MACHINE, path.toStdWString().c_str(), + L"Installed Path"); } QDir GameSkyrimVR::savesDirectory() const @@ -62,7 +61,7 @@ bool GameSkyrimVR::isInstalled() const return !m_GamePath.isEmpty(); } -bool GameSkyrimVR::init(IOrganizer *moInfo) +bool GameSkyrimVR::init(IOrganizer* moInfo) { if (!GameGamebryo::init(moInfo)) { return false; @@ -70,18 +69,18 @@ bool GameSkyrimVR::init(IOrganizer *moInfo) registerFeature(std::make_shared(this)); registerFeature(std::make_shared(myGamesPath())); - registerFeature(std::make_shared(myGamesPath(), "SkyrimVR.ini")); + registerFeature( + std::make_shared(myGamesPath(), "SkyrimVR.ini")); registerFeature(std::make_shared(this)); 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; } - - QString GameSkyrimVR::gameName() const { return "Skyrim VR"; @@ -90,11 +89,14 @@ QString GameSkyrimVR::gameName() const QList GameSkyrimVR::executables() const { return QList() - << ExecutableInfo("SKSE", findInGameFolder(m_Organizer->gameFeatures()->gameFeature()->loaderName())) - << ExecutableInfo("Skyrim VR", findInGameFolder(binaryName())) - << ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe")) - << ExecutableInfo("LOOT", QFileInfo(getLootPath())).withArgument("--game=\"Skyrim VR\"") - ; + << ExecutableInfo("SKSE", + findInGameFolder(m_Organizer->gameFeatures() + ->gameFeature() + ->loaderName())) + << ExecutableInfo("Skyrim VR", findInGameFolder(binaryName())) + << ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe")) + << ExecutableInfo("LOOT", QFileInfo(getLootPath())) + .withArgument("--game=\"Skyrim VR\""); } QList GameSkyrimVR::executableForcedLoads() const @@ -102,7 +104,7 @@ QList GameSkyrimVR::executableForcedLoads() const return QList(); } -QFileInfo GameSkyrimVR::findInGameFolder(const QString &relativePath) const +QFileInfo GameSkyrimVR::findInGameFolder(const QString& relativePath) const { return QFileInfo(m_GamePath + "/" + relativePath); } @@ -134,20 +136,19 @@ MOBase::VersionInfo GameSkyrimVR::version() const QList GameSkyrimVR::settings() const { - return { - PluginSetting("enderal_downloads", "allow Enderal and Enderal SE downloads", QVariant(false)) - }; + return {PluginSetting("enderal_downloads", "allow Enderal and Enderal SE downloads", + QVariant(false))}; } -void GameSkyrimVR::initializeProfile(const QDir &path, ProfileSettings settings) const +void GameSkyrimVR::initializeProfile(const QDir& path, ProfileSettings settings) const { if (settings.testFlag(IPluginGame::MODS)) { copyToProfile(localAppFolder() + "/Skyrim VR", path, "plugins.txt"); } if (settings.testFlag(IPluginGame::CONFIGURATION)) { - if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) - || !QFileInfo(myGamesPath() + "/skyrimvr.ini").exists()) { + if (settings.testFlag(IPluginGame::PREFER_DEFAULTS) || + !QFileInfo(myGamesPath() + "/skyrimvr.ini").exists()) { copyToProfile(gameDirectory().absolutePath(), path, "skyrim.ini", "skyrimvr.ini"); } else { copyToProfile(myGamesPath(), path, "skyrimvr.ini"); @@ -167,19 +168,21 @@ QString GameSkyrimVR::savegameSEExtension() const return "skse"; } -std::shared_ptr GameSkyrimVR::makeSaveGame(QString filePath) const +std::shared_ptr +GameSkyrimVR::makeSaveGame(QString filePath) const { return std::make_shared(filePath, this); } - QString GameSkyrimVR::steamAPPId() const { return "611670"; } -QStringList GameSkyrimVR::primaryPlugins() const { - QStringList plugins = { "skyrim.esm", "update.esm", "dawnguard.esm", "hearthfires.esm", "dragonborn.esm", "skyrimvr.esm" }; +QStringList GameSkyrimVR::primaryPlugins() const +{ + QStringList plugins = {"skyrim.esm", "update.esm", "dawnguard.esm", + "hearthfires.esm", "dragonborn.esm", "skyrimvr.esm"}; plugins.append(CCPlugins()); @@ -188,7 +191,7 @@ QStringList GameSkyrimVR::primaryPlugins() const { QStringList GameSkyrimVR::gameVariants() const { - return{ "Regular" }; + return {"Regular"}; } QString GameSkyrimVR::gameShortName() const @@ -198,14 +201,14 @@ QString GameSkyrimVR::gameShortName() const QStringList GameSkyrimVR::primarySources() const { - return { "SkyrimSE" }; + return {"SkyrimSE"}; } QStringList GameSkyrimVR::validShortNames() const { - QStringList shortNames{ "Skyrim", "SkyrimSE" }; + QStringList shortNames{"Skyrim", "SkyrimSE"}; if (m_Organizer->pluginSetting(name(), "enderal_downloads").toBool()) { - shortNames.append({ "Enderal", "EnderalSE" }); + shortNames.append({"Enderal", "EnderalSE"}); } return shortNames; } @@ -215,15 +218,14 @@ QString GameSkyrimVR::gameNexusName() const return QString(); } - QStringList GameSkyrimVR::iniFiles() const { - return{ "skyrimvr.ini", "skyrimprefs.ini" }; + return {"skyrimvr.ini", "skyrimprefs.ini"}; } QStringList GameSkyrimVR::DLCPlugins() const { - return{ "dawnguard.esm", "hearthfires.esm", "dragonborn.esm" }; + return {"dawnguard.esm", "hearthfires.esm", "dragonborn.esm"}; } QStringList GameSkyrimVR::CCPlugins() const @@ -231,7 +233,9 @@ QStringList GameSkyrimVR::CCPlugins() const QStringList plugins = {}; QFile file(gameDirectory().filePath("Skyrim.ccc")); if (file.open(QIODevice::ReadOnly)) { - ON_BLOCK_EXIT([&file]() { file.close(); }); + ON_BLOCK_EXIT([&file]() { + file.close(); + }); if (file.size() == 0) { return plugins; @@ -275,7 +279,8 @@ int GameSkyrimVR::nexusGameID() const QString GameSkyrimVR::getLauncherName() const { - return binaryName(); // Skyrim VR has no Launcher, so we just return the name of the game binary + return binaryName(); // Skyrim VR has no Launcher, so we just return the name of the + // game binary } QDir GameSkyrimVR::gameDirectory() const @@ -288,10 +293,9 @@ MappingType GameSkyrimVR::mappings() const { MappingType result; - for (const QString &profileFile : { "plugins.txt", "loadorder.txt" }) { - result.push_back({ m_Organizer->profilePath() + "/" + profileFile, - localAppFolder() + "/" + gameName() + "/" + profileFile, - false }); + for (const QString& profileFile : {"plugins.txt", "loadorder.txt"}) { + result.push_back({m_Organizer->profilePath() + "/" + profileFile, + localAppFolder() + "/" + gameName() + "/" + profileFile, false}); } return result; diff --git a/src/gameskyrimvr.h b/src/gameskyrimvr.h index 6fd19ba..ec4ccf8 100644 --- a/src/gameskyrimvr.h +++ b/src/gameskyrimvr.h @@ -14,14 +14,16 @@ class GameSkyrimVR : public GameGamebryo public: GameSkyrimVR(); - virtual bool init(MOBase::IOrganizer *moInfo) override; + virtual bool init(MOBase::IOrganizer* moInfo) override; -public: // IPluginGame interface +public: // IPluginGame interface virtual QString gameName() const override; virtual QList executables() const override; - virtual QList executableForcedLoads() const override; - virtual void initializeProfile(const QDir &path, ProfileSettings settings) 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 override; @@ -39,10 +41,10 @@ class GameSkyrimVR : public GameGamebryo virtual QString getLauncherName() const override; virtual bool isInstalled() const override; - virtual void setGamePath(const QString &path) override; + virtual void setGamePath(const QString& path) override; virtual QDir gameDirectory() const override; -public: // IPlugin interface +public: // IPlugin interface virtual QString name() const override; virtual QString localizedName() const override; virtual QString author() const override; @@ -50,20 +52,19 @@ class GameSkyrimVR : public GameGamebryo virtual MOBase::VersionInfo version() const override; virtual QList settings() const override; -public: // IPluginFileMapper +public: // IPluginFileMapper virtual MappingType mappings() const override; protected: - std::shared_ptr makeSaveGame(QString filePath) const override; QString savegameExtension() const override; QString savegameSEExtension() const override; QDir documentsDirectory() const; QDir savesDirectory() const; - QFileInfo findInGameFolder(const QString &relativePath) const; + QFileInfo findInGameFolder(const QString& relativePath) const; QString myGamesPath() const; virtual QString identifyGamePath() const override; }; -#endif // _GAMESKYRIMVR_H +#endif // _GAMESKYRIMVR_H diff --git a/src/skyrimvrdataarchives.cpp b/src/skyrimvrdataarchives.cpp index 423f624..40438f7 100644 --- a/src/skyrimvrdataarchives.cpp +++ b/src/skyrimvrdataarchives.cpp @@ -3,50 +3,42 @@ #include "iprofile.h" #include -SkyrimVRDataArchives::SkyrimVRDataArchives(const QDir &myGamesDir) : - GamebryoDataArchives(myGamesDir) +SkyrimVRDataArchives::SkyrimVRDataArchives(const QDir& myGamesDir) + : GamebryoDataArchives(myGamesDir) {} QStringList SkyrimVRDataArchives::vanillaArchives() const { - return{ "Skyrim - Textures0.bsa" - , "Skyrim - Textures1.bsa" - , "Skyrim - Textures2.bsa" - , "Skyrim - Textures3.bsa" - , "Skyrim - Textures4.bsa" - , "Skyrim - Textures5.bsa" - , "Skyrim - Textures6.bsa" - , "Skyrim - Textures7.bsa" - , "Skyrim - Textures8.bsa" - , "Skyrim - Meshes0.bsa" - , "Skyrim - Meshes1.bsa" - , "Skyrim - Voices_en0.bsa" - , "Skyrim - Sounds.bsa" - , "Skyrim - Interface.bsa" - , "Skyrim - Animations.bsa" - , "Skyrim - Shaders.bsa" - , "Skyrim - Misc.bsa" - , "Skyrim - Patch.bsa" - , "Skyrim_VR - Main.bsa" }; + return {"Skyrim - Textures0.bsa", "Skyrim - Textures1.bsa", "Skyrim - Textures2.bsa", + "Skyrim - Textures3.bsa", "Skyrim - Textures4.bsa", "Skyrim - Textures5.bsa", + "Skyrim - Textures6.bsa", "Skyrim - Textures7.bsa", "Skyrim - Textures8.bsa", + "Skyrim - Meshes0.bsa", "Skyrim - Meshes1.bsa", "Skyrim - Voices_en0.bsa", + "Skyrim - Sounds.bsa", "Skyrim - Interface.bsa", "Skyrim - Animations.bsa", + "Skyrim - Shaders.bsa", "Skyrim - Misc.bsa", "Skyrim - Patch.bsa", + "Skyrim_VR - Main.bsa"}; } - -QStringList SkyrimVRDataArchives::archives(const MOBase::IProfile *profile) const +QStringList SkyrimVRDataArchives::archives(const MOBase::IProfile* profile) const { QStringList result; - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("skyrimvr.ini") : m_LocalGameDir.absoluteFilePath("skyrimvr.ini"); + QString iniFile = profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("skyrimvr.ini") + : m_LocalGameDir.absoluteFilePath("skyrimvr.ini"); result.append(getArchivesFromKey(iniFile, "SResourceArchiveList")); result.append(getArchivesFromKey(iniFile, "SResourceArchiveList2")); return result; } -void SkyrimVRDataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before) +void SkyrimVRDataArchives::writeArchiveList(MOBase::IProfile* profile, + const QStringList& before) { QString list = before.join(", "); - QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("skyrimvr.ini") : m_LocalGameDir.absoluteFilePath("skyrimvr.ini"); + QString iniFile = profile->localSettingsEnabled() + ? QDir(profile->absolutePath()).absoluteFilePath("skyrimvr.ini") + : m_LocalGameDir.absoluteFilePath("skyrimvr.ini"); if (list.length() > 255) { int splitIdx = list.lastIndexOf(",", 256); setArchivesToKey(iniFile, "SResourceArchiveList", list.mid(0, splitIdx)); diff --git a/src/skyrimvrdataarchives.h b/src/skyrimvrdataarchives.h index 7ed603b..e1519ca 100644 --- a/src/skyrimvrdataarchives.h +++ b/src/skyrimvrdataarchives.h @@ -2,28 +2,27 @@ #define _SKYRIMVRDATAARCHIVES_H #include "gamebryodataarchives.h" -#include #include +#include -namespace MOBase { class IProfile; } - +namespace MOBase +{ +class IProfile; +} class SkyrimVRDataArchives : public GamebryoDataArchives { public: - - SkyrimVRDataArchives(const QDir &myGamesDir); + SkyrimVRDataArchives(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 // _SKYRIMVRDATAARCHIVES_H +#endif // _SKYRIMVRDATAARCHIVES_H diff --git a/src/skyrimvrgameplugins.cpp b/src/skyrimvrgameplugins.cpp index c5f5b55..1524ffe 100644 --- a/src/skyrimvrgameplugins.cpp +++ b/src/skyrimvrgameplugins.cpp @@ -2,14 +2,14 @@ using namespace MOBase; -SkyrimVRGamePlugins::SkyrimVRGamePlugins(MOBase::IOrganizer* organizer) : CreationGamePlugins(organizer) -{ -} +SkyrimVRGamePlugins::SkyrimVRGamePlugins(MOBase::IOrganizer* organizer) + : CreationGamePlugins(organizer) +{} bool SkyrimVRGamePlugins::lightPluginsAreSupported() { - auto files = m_Organizer->findFiles("skse\\plugins", { "skyrimvresl.dll" }); - if (files.isEmpty()) - return false; - return true; -} \ No newline at end of file + auto files = m_Organizer->findFiles("skse\\plugins", {"skyrimvresl.dll"}); + if (files.isEmpty()) + return false; + return true; +} diff --git a/src/skyrimvrgameplugins.h b/src/skyrimvrgameplugins.h index 97ee0fe..6f9676f 100644 --- a/src/skyrimvrgameplugins.h +++ b/src/skyrimvrgameplugins.h @@ -10,13 +10,10 @@ class SkyrimVRGamePlugins : public CreationGamePlugins { public: - - SkyrimVRGamePlugins(MOBase::IOrganizer* organizer); + SkyrimVRGamePlugins(MOBase::IOrganizer* organizer); protected: - - virtual bool lightPluginsAreSupported() override; - + virtual bool lightPluginsAreSupported() override; }; -#endif // _SKYRIMVRGAMEPLUGINS_H \ No newline at end of file +#endif // _SKYRIMVRGAMEPLUGINS_H diff --git a/src/skyrimvrmoddatachecker.h b/src/skyrimvrmoddatachecker.h index 377e8ce..0fef53f 100644 --- a/src/skyrimvrmoddatachecker.h +++ b/src/skyrimvrmoddatachecker.h @@ -9,22 +9,23 @@ class SkyrimVRModDataChecker : public GamebryoModDataChecker 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", - "skse", "distantlod", "asi", "Tools", "MCM", "distantland", "mits", - "dllplugins", "CalienteTools", "NetScriptFramework", "shadersfx", - "Nemesis_Engine" - }; + "fonts", "interface", "menus", "meshes", + "music", "scripts", "shaders", "sound", + "strings", "textures", "trees", "video", + "facegen", "materials", "skse", "distantlod", + "asi", "Tools", "MCM", "distantland", + "mits", "dllplugins", "CalienteTools", "NetScriptFramework", + "shadersfx", "Nemesis_Engine"}; 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 // SKYRIMVR_MODATACHECKER_H +#endif // SKYRIMVR_MODATACHECKER_H diff --git a/src/skyrimvrmoddatacontent.h b/src/skyrimvrmoddatacontent.h index 3a5dc9f..36f56ff 100644 --- a/src/skyrimvrmoddatacontent.h +++ b/src/skyrimvrmoddatacontent.h @@ -4,17 +4,18 @@ #include #include -class SkyrimVRModDataContent : public GamebryoModDataContent { +class SkyrimVRModDataContent : public GamebryoModDataContent +{ public: - /** * */ - SkyrimVRModDataContent(MOBase::IGameFeatures const* gameFeatures) : GamebryoModDataContent(gameFeatures) { + SkyrimVRModDataContent(MOBase::IGameFeatures const* gameFeatures) + : GamebryoModDataContent(gameFeatures) + { // Just need to disable some contents: m_Enabled[CONTENT_SKYPROC] = false; } - }; -#endif // SKYRIMVR_MODDATACONTENT_H +#endif // SKYRIMVR_MODDATACONTENT_H diff --git a/src/skyrimvrsavegame.cpp b/src/skyrimvrsavegame.cpp index 29d7a1c..c1c29c7 100644 --- a/src/skyrimvrsavegame.cpp +++ b/src/skyrimvrsavegame.cpp @@ -4,27 +4,28 @@ #include "gameskyrimvr.h" -SkyrimVRSaveGame::SkyrimVRSaveGame(QString const &fileName, GameSkyrimVR const *game) : - GamebryoSaveGame(fileName, game, true) +SkyrimVRSaveGame::SkyrimVRSaveGame(QString const& fileName, GameSkyrimVR const* game) + : GamebryoSaveGame(fileName, game, true) { - FileWrapper file(fileName, "TESV_SAVEGAME"); //10bytes + FileWrapper file(fileName, "TESV_SAVEGAME"); // 10bytes unsigned long version; FILETIME ftime; - fetchInformationFields(file, version, m_PCName, m_PCLevel, m_PCLocation, m_SaveNumber, ftime); + fetchInformationFields(file, version, 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 + // 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 // For some reason, the file time is off by about 6 hours. // So we need to subtract those 6 hours from the filetime. _ULARGE_INTEGER time; - time.LowPart = ftime.dwLowDateTime; + time.LowPart = ftime.dwLowDateTime; time.HighPart = ftime.dwHighDateTime; time.QuadPart -= 2.16e11; ftime.dwHighDateTime = time.HighPart; - ftime.dwLowDateTime = time.LowPart; + ftime.dwLowDateTime = time.LowPart; SYSTEMTIME ctime; ::FileTimeToSystemTime(&ftime, &ctime); @@ -32,19 +33,16 @@ SkyrimVRSaveGame::SkyrimVRSaveGame(QString const &fileName, GameSkyrimVR const * setCreationTime(ctime); } - -void SkyrimVRSaveGame::fetchInformationFields( - FileWrapper& file, - unsigned long& version, - QString& playerName, - unsigned short& playerLevel, - QString& playerLocation, - unsigned long& saveNumber, - FILETIME& creationTime) const +void SkyrimVRSaveGame::fetchInformationFields(FileWrapper& file, unsigned long& version, + QString& playerName, + unsigned short& playerLevel, + QString& playerLocation, + unsigned long& saveNumber, + FILETIME& creationTime) const { unsigned long headerSize; - file.read(headerSize); // header size "TESV_SAVEGAME" - file.read(version); // header version 74 (original Skyrim is 79) + file.read(headerSize); // header size "TESV_SAVEGAME" + file.read(version); // header version 74 (original Skyrim is 79) file.read(saveNumber); file.read(playerName); @@ -59,17 +57,17 @@ void SkyrimVRSaveGame::fetchInformationFields( file.read(timeOfDay); QString race; - file.read(race); // race name (i.e. BretonRace) + file.read(race); // 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 - file.read(creationTime); //filetime + file.read(creationTime); // filetime } std::unique_ptr SkyrimVRSaveGame::fetchDataFields() const { - FileWrapper file(getFilepath(), "TESV_SAVEGAME"); //10bytes + FileWrapper file(getFilepath(), "TESV_SAVEGAME"); // 10bytes unsigned long version = 0; { @@ -78,8 +76,8 @@ std::unique_ptr SkyrimVRSaveGame::fetchDataFields( unsigned long dummySaveNumber; FILETIME dummyTime; - fetchInformationFields(file, version, dummyName, dummyLevel, - dummyLocation, dummySaveNumber, dummyTime); + fetchInformationFields(file, version, dummyName, dummyLevel, dummyLocation, + dummySaveNumber, dummyTime); } std::unique_ptr fields = std::make_unique(); @@ -98,10 +96,10 @@ std::unique_ptr SkyrimVRSaveGame::fetchDataFields( file.openCompressedData(); uint8_t saveGameVersion = file.readChar(); - uint8_t pluginInfoSize = file.readChar(); - uint16_t other = file.readShort(); //Unknown + uint8_t pluginInfoSize = file.readChar(); + uint16_t other = file.readShort(); // Unknown - fields->Plugins = file.readPlugins(1); // Just empty data + fields->Plugins = file.readPlugins(1); // Just empty data if (saveGameVersion >= 78) { fields->LightPlugins = file.readLightPlugins(); @@ -110,4 +108,4 @@ std::unique_ptr SkyrimVRSaveGame::fetchDataFields( file.closeCompressedData(); return fields; -} \ No newline at end of file +} diff --git a/src/skyrimvrsavegame.h b/src/skyrimvrsavegame.h index db8b95d..5ed5e96 100644 --- a/src/skyrimvrsavegame.h +++ b/src/skyrimvrsavegame.h @@ -10,20 +10,16 @@ class GameSkyrimVR; class SkyrimVRSaveGame : public GamebryoSaveGame { public: - SkyrimVRSaveGame(QString const &fileName, GameSkyrimVR const *game); + SkyrimVRSaveGame(QString const& fileName, GameSkyrimVR const* game); protected: - // Fetch easy-to-access information. - void fetchInformationFields(FileWrapper& wrapper, - unsigned long& version, - QString& playerName, - unsigned short& playerLevel, - QString& playerLocation, - unsigned long& saveNumber, - FILETIME& creationTime) const; + void fetchInformationFields(FileWrapper& wrapper, unsigned long& version, + QString& playerName, unsigned short& playerLevel, + QString& playerLocation, unsigned long& saveNumber, + FILETIME& creationTime) const; std::unique_ptr fetchDataFields() const override; }; -#endif // _SKYRIMVRSAVEGAME_H +#endif // _SKYRIMVRSAVEGAME_H diff --git a/src/skyrimvrscriptextender.cpp b/src/skyrimvrscriptextender.cpp index 8668a7c..4d7433d 100644 --- a/src/skyrimvrscriptextender.cpp +++ b/src/skyrimvrscriptextender.cpp @@ -3,10 +3,9 @@ #include #include -SkyrimVRScriptExtender::SkyrimVRScriptExtender(GameGamebryo const *game) : - GamebryoScriptExtender(game) -{ -} +SkyrimVRScriptExtender::SkyrimVRScriptExtender(GameGamebryo const* game) + : GamebryoScriptExtender(game) +{} QString SkyrimVRScriptExtender::BinaryName() const { diff --git a/src/skyrimvrscriptextender.h b/src/skyrimvrscriptextender.h index a3a580d..9bf3168 100644 --- a/src/skyrimvrscriptextender.h +++ b/src/skyrimvrscriptextender.h @@ -8,11 +8,10 @@ class GameGamebryo; class SkyrimVRScriptExtender : public GamebryoScriptExtender { public: - SkyrimVRScriptExtender(GameGamebryo const *game); + SkyrimVRScriptExtender(GameGamebryo const* game); virtual QString BinaryName() const override; virtual QString PluginPath() const override; - }; -#endif // _SKYRIMVRSCRIPTEXTENDER_H +#endif // _SKYRIMVRSCRIPTEXTENDER_H diff --git a/src/skyrimvrunmanagedmods.cpp b/src/skyrimvrunmanagedmods.cpp index e79472e..dd6a158 100644 --- a/src/skyrimvrunmanagedmods.cpp +++ b/src/skyrimvrunmanagedmods.cpp @@ -1,26 +1,26 @@ #include "skyrimvrunmanagedmods.h" -SkyrimVRUnmangedMods::SkyrimVRUnmangedMods(const GameGamebryo *game) - : GamebryoUnmangedMods(game) +SkyrimVRUnmangedMods::SkyrimVRUnmangedMods(const GameGamebryo* game) + : GamebryoUnmangedMods(game) {} -SkyrimVRUnmangedMods::~SkyrimVRUnmangedMods() -{} +SkyrimVRUnmangedMods::~SkyrimVRUnmangedMods() {} -QStringList SkyrimVRUnmangedMods::mods(bool onlyOfficial) const { +QStringList SkyrimVRUnmangedMods::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)) { - result.append(fileName.chopped(4)); // trims the extension off + result.append(fileName.chopped(4)); // trims the extension off } } } diff --git a/src/skyrimvrunmanagedmods.h b/src/skyrimvrunmanagedmods.h index 67846b6..7b019f9 100644 --- a/src/skyrimvrunmanagedmods.h +++ b/src/skyrimvrunmanagedmods.h @@ -4,12 +4,13 @@ #include "gamebryounmanagedmods.h" #include -class SkyrimVRUnmangedMods : public GamebryoUnmangedMods { +class SkyrimVRUnmangedMods : public GamebryoUnmangedMods +{ public: - SkyrimVRUnmangedMods(const GameGamebryo *game); + SkyrimVRUnmangedMods(const GameGamebryo* game); ~SkyrimVRUnmangedMods(); virtual QStringList mods(bool onlyOfficial) const override; }; -#endif // _SKYRIMVRUNMANAGEDMODS_H +#endif // _SKYRIMVRUNMANAGEDMODS_H From d1fede3009e3546a115798e375936abbc2b0cfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:41:31 +0200 Subject: [PATCH 3/4] 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..deaf3b1 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +74d288c4ae0f507767a165936f154d5477079e8e From 50f8710522b1a07d6adfe7d45cfcca3e304f2c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 9 Jun 2024 13:41:31 +0200 Subject: [PATCH 4/4] 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..e659afc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: Build Installed Path Plugin + +on: + push: + branches: master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: windows-2022 + steps: + - name: Build Installed Path 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..240c316 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,16 @@ +name: Lint Installed Path 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: "."