Skip to content

Commit

Permalink
Merge pull request #32 from ModOrganizer2/dev/format-and-gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 authored Jun 9, 2024
2 parents 17db11d + 50f8710 commit b2e1ecf
Show file tree
Hide file tree
Showing 20 changed files with 250 additions and 221 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 @@
74d288c4ae0f507767a165936f154d5477079e8e
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 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
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 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: "."
40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

94 changes: 49 additions & 45 deletions src/gameskyrimvr.cpp
Original file line number Diff line number Diff line change
@@ -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 <pluginsetting.h>
#include "versioninfo.h"
#include <executableinfo.h>
#include <gamebryolocalsavegames.h>
#include <gamebryosavegameinfo.h>
#include "versioninfo.h"
#include <pluginsetting.h>

#include <QCoreApplication>
#include <QDir>
Expand All @@ -22,16 +22,14 @@
#include <QString>
#include <QStringList>

#include <memory>
#include "scopeguard.h"
#include <memory>

using namespace MOBase;

GameSkyrimVR::GameSkyrimVR()
{
}
GameSkyrimVR::GameSkyrimVR() {}

void GameSkyrimVR::setGamePath(const QString &path)
void GameSkyrimVR::setGamePath(const QString& path)
{
m_GamePath = path;
}
Expand All @@ -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
Expand All @@ -62,26 +61,26 @@ bool GameSkyrimVR::isInstalled() const
return !m_GamePath.isEmpty();
}

bool GameSkyrimVR::init(IOrganizer *moInfo)
bool GameSkyrimVR::init(IOrganizer* moInfo)
{
if (!GameGamebryo::init(moInfo)) {
return false;
}

registerFeature(std::make_shared<SkyrimVRScriptExtender>(this));
registerFeature(std::make_shared<SkyrimVRDataArchives>(myGamesPath()));
registerFeature(std::make_shared<GamebryoLocalSavegames>(myGamesPath(), "SkyrimVR.ini"));
registerFeature(
std::make_shared<GamebryoLocalSavegames>(myGamesPath(), "SkyrimVR.ini"));
registerFeature(std::make_shared<SkyrimVRModDataChecker>(this));
registerFeature(std::make_shared<GamebryoSaveGameInfo>(this));
registerFeature(std::make_shared<SkyrimVRModDataContent>(m_Organizer->gameFeatures()));
registerFeature(
std::make_shared<SkyrimVRModDataContent>(m_Organizer->gameFeatures()));
registerFeature(std::make_shared<SkyrimVRGamePlugins>(moInfo));
registerFeature(std::make_shared<SkyrimVRUnmangedMods>(this));

return true;
}



QString GameSkyrimVR::gameName() const
{
return "Skyrim VR";
Expand All @@ -90,19 +89,22 @@ QString GameSkyrimVR::gameName() const
QList<ExecutableInfo> GameSkyrimVR::executables() const
{
return QList<ExecutableInfo>()
<< ExecutableInfo("SKSE", findInGameFolder(m_Organizer->gameFeatures()->gameFeature<MOBase::ScriptExtender>()->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<MOBase::ScriptExtender>()
->loaderName()))
<< ExecutableInfo("Skyrim VR", findInGameFolder(binaryName()))
<< ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe"))
<< ExecutableInfo("LOOT", QFileInfo(getLootPath()))
.withArgument("--game=\"Skyrim VR\"");
}

QList<ExecutableForcedLoadSetting> GameSkyrimVR::executableForcedLoads() const
{
return QList<ExecutableForcedLoadSetting>();
}

QFileInfo GameSkyrimVR::findInGameFolder(const QString &relativePath) const
QFileInfo GameSkyrimVR::findInGameFolder(const QString& relativePath) const
{
return QFileInfo(m_GamePath + "/" + relativePath);
}
Expand Down Expand Up @@ -134,20 +136,19 @@ MOBase::VersionInfo GameSkyrimVR::version() const

QList<PluginSetting> 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");
Expand All @@ -167,19 +168,21 @@ QString GameSkyrimVR::savegameSEExtension() const
return "skse";
}

std::shared_ptr<const GamebryoSaveGame> GameSkyrimVR::makeSaveGame(QString filePath) const
std::shared_ptr<const GamebryoSaveGame>
GameSkyrimVR::makeSaveGame(QString filePath) const
{
return std::make_shared<const SkyrimVRSaveGame>(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());

Expand All @@ -188,7 +191,7 @@ QStringList GameSkyrimVR::primaryPlugins() const {

QStringList GameSkyrimVR::gameVariants() const
{
return{ "Regular" };
return {"Regular"};
}

QString GameSkyrimVR::gameShortName() const
Expand All @@ -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;
}
Expand All @@ -215,23 +218,24 @@ 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
{
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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
Loading

0 comments on commit b2e1ecf

Please sign in to comment.