mirror of
https://github.com/ModOrganizer2/modorganizer-game_enderal.git
synced 2026-07-27 14:05:41 -07:00
Add formatting and CI
This commit is contained in:
@@ -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']
|
||||
@@ -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
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Build Nehrim Plugin
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Build Nehrim Plugin
|
||||
uses: ModOrganizer2/build-with-mob-action@master
|
||||
with:
|
||||
mo2-third-parties: fmt gtest spdlog boost lz4
|
||||
mo2-dependencies: cmake_common uibase game_gamebryo
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Lint Nehrim Plugin
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run clang-format
|
||||
uses: jidicula/clang-format-action@v4.11.0
|
||||
with:
|
||||
clang-format-version: "15"
|
||||
check-path: "."
|
||||
@@ -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_enderal.dll
|
||||
name: game_enderal_dll
|
||||
- path: vsbuild\src\RelWithDebInfo\game_enderal.pdb
|
||||
name: game_enderal_pdb
|
||||
- path: vsbuild\src\RelWithDebInfo\game_enderale.lib
|
||||
name: game_enderal_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
|
||||
@@ -1,15 +0,0 @@
|
||||
Import('qt_env')
|
||||
|
||||
env = qt_env.Clone()
|
||||
|
||||
env.AppendUnique(CPPDEFINES = [ 'GAMEENDERAL_LIBRARY' ])
|
||||
|
||||
env.RequiresGamebryo()
|
||||
|
||||
env.AppendUnique(LIBS = [ 'Version' ])
|
||||
|
||||
lib = env.SharedLibrary('gameEnderal', env.Glob('*.cpp'))
|
||||
env.InstallModule(lib)
|
||||
|
||||
res = env['QT_USED_MODULES']
|
||||
Return('res')
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "enderalbsainvalidation.h"
|
||||
|
||||
EnderalBSAInvalidation::EnderalBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game)
|
||||
: GamebryoBSAInvalidation(dataArchives, "enderal.ini", game)
|
||||
{
|
||||
}
|
||||
EnderalBSAInvalidation::EnderalBSAInvalidation(DataArchives* dataArchives,
|
||||
MOBase::IPluginGame const* game)
|
||||
: GamebryoBSAInvalidation(dataArchives, "enderal.ini", game)
|
||||
{}
|
||||
|
||||
QString EnderalBSAInvalidation::invalidationBSAName() const
|
||||
{
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
#ifndef ENDERALBSAINVALIDATION_H
|
||||
#define ENDERALBSAINVALIDATION_H
|
||||
|
||||
|
||||
#include "gamebryobsainvalidation.h"
|
||||
#include "enderaldataarchives.h"
|
||||
#include "gamebryobsainvalidation.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class EnderalBSAInvalidation : public GamebryoBSAInvalidation
|
||||
{
|
||||
public:
|
||||
|
||||
EnderalBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game);
|
||||
EnderalBSAInvalidation(DataArchives* dataArchives, MOBase::IPluginGame const* game);
|
||||
|
||||
private:
|
||||
|
||||
virtual QString invalidationBSAName() const override;
|
||||
virtual unsigned long bsaVersion() const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENDERALBSAINVALIDATION_H
|
||||
#endif // ENDERALBSAINVALIDATION_H
|
||||
|
||||
+18
-26
@@ -1,49 +1,41 @@
|
||||
#include "enderaldataarchives.h"
|
||||
#include <utility.h>
|
||||
|
||||
EnderalDataArchives::EnderalDataArchives(const QDir &myGamesDir) :
|
||||
GamebryoDataArchives(myGamesDir)
|
||||
{
|
||||
}
|
||||
EnderalDataArchives::EnderalDataArchives(const QDir& myGamesDir)
|
||||
: GamebryoDataArchives(myGamesDir)
|
||||
{}
|
||||
|
||||
QStringList EnderalDataArchives::vanillaArchives() const
|
||||
{
|
||||
return { "Skyrim - Misc.bsa"
|
||||
, "Skyrim - Shaders.bsa"
|
||||
, "Skyrim - Textures.bsa"
|
||||
, "Skyrim - Interface.bsa"
|
||||
, "Skyrim - Animations.bsa"
|
||||
, "Skyrim - Meshes.bsa"
|
||||
, "Skyrim - Sounds.bsa"
|
||||
, "E - Meshes.bsa"
|
||||
, "E - Music.bsa"
|
||||
, "E - Scripts.bsa"
|
||||
, "E - Sounds.bsa"
|
||||
, "E - Textures1.bsa"
|
||||
, "E - Textures2.bsa"
|
||||
, "E - Textures3.bsa"
|
||||
, "L - Textures.bsa"
|
||||
, "L - Voices.bsa"
|
||||
};
|
||||
return {"Skyrim - Misc.bsa", "Skyrim - Shaders.bsa", "Skyrim - Textures.bsa",
|
||||
"Skyrim - Interface.bsa", "Skyrim - Animations.bsa", "Skyrim - Meshes.bsa",
|
||||
"Skyrim - Sounds.bsa", "E - Meshes.bsa", "E - Music.bsa",
|
||||
"E - Scripts.bsa", "E - Sounds.bsa", "E - Textures1.bsa",
|
||||
"E - Textures2.bsa", "E - Textures3.bsa", "L - Textures.bsa",
|
||||
"L - Voices.bsa"};
|
||||
}
|
||||
|
||||
|
||||
QStringList EnderalDataArchives::archives(const MOBase::IProfile *profile) const
|
||||
QStringList EnderalDataArchives::archives(const MOBase::IProfile* profile) const
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("enderal.ini") : m_LocalGameDir.absoluteFilePath("enderal.ini");
|
||||
QString iniFile = profile->localSettingsEnabled()
|
||||
? QDir(profile->absolutePath()).absoluteFilePath("enderal.ini")
|
||||
: m_LocalGameDir.absoluteFilePath("enderal.ini");
|
||||
result.append(getArchivesFromKey(iniFile, "SResourceArchiveList"));
|
||||
result.append(getArchivesFromKey(iniFile, "SResourceArchiveList2"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void EnderalDataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before)
|
||||
void EnderalDataArchives::writeArchiveList(MOBase::IProfile* profile,
|
||||
const QStringList& before)
|
||||
{
|
||||
QString list = before.join(", ");
|
||||
|
||||
QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("enderal.ini") : m_LocalGameDir.absoluteFilePath("enderal.ini");
|
||||
QString iniFile = profile->localSettingsEnabled()
|
||||
? QDir(profile->absolutePath()).absoluteFilePath("enderal.ini")
|
||||
: m_LocalGameDir.absoluteFilePath("enderal.ini");
|
||||
if (list.length() > 255) {
|
||||
int splitIdx = list.lastIndexOf(",", 256);
|
||||
setArchivesToKey(iniFile, "SResourceArchiveList", list.mid(0, splitIdx));
|
||||
|
||||
@@ -1,28 +1,25 @@
|
||||
#ifndef ENDERALDATAARCHIVES_H
|
||||
#define ENDERALDATAARCHIVES_H
|
||||
|
||||
|
||||
#include <gamebryodataarchives.h>
|
||||
#include <iprofile.h>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
#include <gamebryodataarchives.h>
|
||||
#include <iprofile.h>
|
||||
|
||||
class EnderalDataArchives : public GamebryoDataArchives
|
||||
{
|
||||
|
||||
public:
|
||||
EnderalDataArchives(const QDir &myGamesDir);
|
||||
EnderalDataArchives(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 // ENDERALDATAARCHIVES_H
|
||||
#endif // ENDERALDATAARCHIVES_H
|
||||
|
||||
+80
-78
@@ -1,44 +1,44 @@
|
||||
#include "enderalgameplugins.h"
|
||||
#include <safewritefile.h>
|
||||
#include <report.h>
|
||||
#include <ipluginlist.h>
|
||||
#include <report.h>
|
||||
#include <safewritefile.h>
|
||||
#include <scopeguard.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
#include <QStringEncoder>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
using MOBase::IOrganizer;
|
||||
using MOBase::IPluginGame;
|
||||
using MOBase::IPluginList;
|
||||
using MOBase::IOrganizer;
|
||||
using MOBase::SafeWriteFile;
|
||||
using MOBase::reportError;
|
||||
using MOBase::SafeWriteFile;
|
||||
|
||||
EnderalGamePlugins::EnderalGamePlugins(IOrganizer *organizer)
|
||||
EnderalGamePlugins::EnderalGamePlugins(IOrganizer* organizer)
|
||||
: GamebryoGamePlugins(organizer)
|
||||
{}
|
||||
|
||||
void EnderalGamePlugins::readPluginLists(MOBase::IPluginList *pluginList) {
|
||||
QString loadOrderPath =
|
||||
organizer()->profile()->absolutePath() + "/loadorder.txt";
|
||||
QString pluginsPath = organizer()->profile()->absolutePath() + "/plugins.txt";
|
||||
void EnderalGamePlugins::readPluginLists(MOBase::IPluginList* pluginList)
|
||||
{
|
||||
QString loadOrderPath = organizer()->profile()->absolutePath() + "/loadorder.txt";
|
||||
QString pluginsPath = organizer()->profile()->absolutePath() + "/plugins.txt";
|
||||
|
||||
bool loadOrderIsNew = !m_LastRead.isValid() ||
|
||||
!QFileInfo(loadOrderPath).exists() ||
|
||||
QFileInfo(loadOrderPath).lastModified() > m_LastRead;
|
||||
bool pluginsIsNew = !m_LastRead.isValid() ||
|
||||
QFileInfo(pluginsPath).lastModified() > m_LastRead;
|
||||
bool loadOrderIsNew = !m_LastRead.isValid() || !QFileInfo(loadOrderPath).exists() ||
|
||||
QFileInfo(loadOrderPath).lastModified() > m_LastRead;
|
||||
bool pluginsIsNew =
|
||||
!m_LastRead.isValid() || QFileInfo(pluginsPath).lastModified() > m_LastRead;
|
||||
|
||||
if (pluginsIsNew && !loadOrderIsNew) {
|
||||
// If the plugins is new but not loadorder, we must reparse the load order from the plugin files
|
||||
// If the plugins is new but not loadorder, we must reparse the load order from the
|
||||
// plugin files
|
||||
|
||||
//removed because returned loadorder was incorrect and did not account for plugins that were already disabled before.
|
||||
// removed because returned loadorder was incorrect and did not account for plugins
|
||||
// that were already disabled before.
|
||||
/*QStringList loadOrder = readPluginList(pluginList);
|
||||
pluginList->setLoadOrder(loadOrder);*/
|
||||
|
||||
//Fix me: we are ignoring order changes in plugins.txt favouring loadorder.txt in all cases (plugins.txt should have precedence)
|
||||
// Fix me: we are ignoring order changes in plugins.txt favouring loadorder.txt in
|
||||
// all cases (plugins.txt should have precedence)
|
||||
QStringList loadOrder = readLoadOrderList(pluginList, loadOrderPath);
|
||||
pluginList->setLoadOrder(loadOrder);
|
||||
readPluginList(pluginList);
|
||||
@@ -52,70 +52,72 @@ void EnderalGamePlugins::readPluginLists(MOBase::IPluginList *pluginList) {
|
||||
m_LastRead = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
//TODO: return value is incorrect and should be ignored (it's not currently used
|
||||
QStringList EnderalGamePlugins::readPluginList(MOBase::IPluginList *pluginList)
|
||||
// TODO: return value is incorrect and should be ignored (it's not currently used
|
||||
QStringList EnderalGamePlugins::readPluginList(MOBase::IPluginList* pluginList)
|
||||
{
|
||||
QStringList plugins = pluginList->pluginNames();
|
||||
QStringList primaryPlugins = organizer()->managedGame()->primaryPlugins();
|
||||
QStringList loadOrder(plugins);
|
||||
QStringList plugins = pluginList->pluginNames();
|
||||
QStringList primaryPlugins = organizer()->managedGame()->primaryPlugins();
|
||||
QStringList loadOrder(plugins);
|
||||
|
||||
for (const QString &pluginName : primaryPlugins) {
|
||||
if (pluginList->state(pluginName) != IPluginList::STATE_MISSING) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_ACTIVE);
|
||||
}
|
||||
for (const QString& pluginName : primaryPlugins) {
|
||||
if (pluginList->state(pluginName) != IPluginList::STATE_MISSING) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not sort the primary plugins. Their load order should be locked as defined in
|
||||
// "primaryPlugins".
|
||||
const QStringList pluginsClone(plugins);
|
||||
for (QString plugin : pluginsClone) {
|
||||
if (primaryPlugins.contains(plugin, Qt::CaseInsensitive))
|
||||
plugins.removeAll(plugin);
|
||||
}
|
||||
|
||||
// Determine plugin active state by the plugins.txt file.
|
||||
bool pluginsTxtExists = true;
|
||||
QString filePath = organizer()->profile()->absolutePath() + "/plugins.txt";
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
pluginsTxtExists = false;
|
||||
}
|
||||
ON_BLOCK_EXIT([&]() {
|
||||
qDebug("close %s", qUtf8Printable(filePath));
|
||||
file.close();
|
||||
});
|
||||
|
||||
if (file.size() == 0) {
|
||||
// MO stores at least a header in the file. if it's completely empty the
|
||||
// file is broken
|
||||
pluginsTxtExists = false;
|
||||
}
|
||||
|
||||
if (pluginsTxtExists) {
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
QString pluginName;
|
||||
if ((line.size() > 0) && (line.at(0) != '#')) {
|
||||
pluginName = QStringEncoder(QStringConverter::Encoding::System)
|
||||
.encode(line.trimmed().constData());
|
||||
}
|
||||
if (pluginName.size() > 0) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_ACTIVE);
|
||||
plugins.removeAll(pluginName);
|
||||
// we already have the old loadorder and we ignore the positions in plugins.txt
|
||||
// (needs fix) loadOrder.append(pluginName);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not sort the primary plugins. Their load order should be locked as defined in "primaryPlugins".
|
||||
const QStringList pluginsClone(plugins);
|
||||
for (QString plugin : pluginsClone) {
|
||||
if (primaryPlugins.contains(plugin, Qt::CaseInsensitive))
|
||||
plugins.removeAll(plugin);
|
||||
file.close();
|
||||
|
||||
// we removed each plugin found in the file, so what's left are inactive mods
|
||||
for (const QString& pluginName : plugins) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_INACTIVE);
|
||||
}
|
||||
|
||||
// Determine plugin active state by the plugins.txt file.
|
||||
bool pluginsTxtExists = true;
|
||||
QString filePath = organizer()->profile()->absolutePath() + "/plugins.txt";
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
pluginsTxtExists = false;
|
||||
} else {
|
||||
for (const QString& pluginName : plugins) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_INACTIVE);
|
||||
}
|
||||
ON_BLOCK_EXIT([&]() {
|
||||
qDebug("close %s", qUtf8Printable(filePath));
|
||||
file.close();
|
||||
});
|
||||
}
|
||||
|
||||
if (file.size() == 0) {
|
||||
// MO stores at least a header in the file. if it's completely empty the
|
||||
// file is broken
|
||||
pluginsTxtExists = false;
|
||||
}
|
||||
|
||||
if (pluginsTxtExists) {
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
QString pluginName;
|
||||
if ((line.size() > 0) && (line.at(0) != '#')) {
|
||||
pluginName = QStringEncoder(QStringConverter::Encoding::System).encode(line.trimmed().constData());
|
||||
}
|
||||
if (pluginName.size() > 0) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_ACTIVE);
|
||||
plugins.removeAll(pluginName);
|
||||
//we already have the old loadorder and we ignore the positions in plugins.txt (needs fix)
|
||||
//loadOrder.append(pluginName);
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
// we removed each plugin found in the file, so what's left are inactive mods
|
||||
for (const QString &pluginName : plugins) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_INACTIVE);
|
||||
}
|
||||
} else {
|
||||
for (const QString &pluginName : plugins) {
|
||||
pluginList->setState(pluginName, IPluginList::STATE_INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
return loadOrder;
|
||||
return loadOrder;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
#ifndef _ENDERALGAMEPLUGINS_H
|
||||
#define _ENDERALGAMEPLUGINS_H
|
||||
|
||||
|
||||
#include <gamebryogameplugins.h>
|
||||
#include <iplugingame.h>
|
||||
#include <imoinfo.h>
|
||||
#include <iplugingame.h>
|
||||
#include <map>
|
||||
|
||||
|
||||
class EnderalGamePlugins : public GamebryoGamePlugins
|
||||
{
|
||||
public:
|
||||
EnderalGamePlugins(MOBase::IOrganizer *organizer);
|
||||
EnderalGamePlugins(MOBase::IOrganizer* organizer);
|
||||
|
||||
virtual void readPluginLists(MOBase::IPluginList *pluginList) override;
|
||||
virtual void readPluginLists(MOBase::IPluginList* pluginList) override;
|
||||
|
||||
protected:
|
||||
virtual QStringList readPluginList(MOBase::IPluginList *pluginList) override;
|
||||
virtual QStringList readPluginList(MOBase::IPluginList* pluginList) override;
|
||||
|
||||
private:
|
||||
std::map<QString, QByteArray> m_LastSaveHash;
|
||||
std::map<QString, QByteArray> m_LastSaveHash;
|
||||
};
|
||||
|
||||
#endif // _ENDERALSEGAMEPLUGINS_H
|
||||
#endif // _ENDERALSEGAMEPLUGINS_H
|
||||
|
||||
@@ -16,57 +16,48 @@ License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "enderallocalsavegames.h"
|
||||
#include "registry.h"
|
||||
#include <iprofile.h>
|
||||
#include <QtDebug>
|
||||
#include <windows.h>
|
||||
#include <iprofile.h>
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static const QString LocalSavesDummy = "..\\Enderal\\__MO_Saves\\";
|
||||
|
||||
|
||||
EnderalLocalSavegames::EnderalLocalSavegames(const QDir &myGamesDir,
|
||||
const QString &iniFileName)
|
||||
: m_LocalSavesDir(myGamesDir.absoluteFilePath(LocalSavesDummy))
|
||||
, m_LocalGameDir(myGamesDir.absolutePath())
|
||||
, m_IniFileName(iniFileName)
|
||||
EnderalLocalSavegames::EnderalLocalSavegames(const QDir& myGamesDir,
|
||||
const QString& iniFileName)
|
||||
: m_LocalSavesDir(myGamesDir.absoluteFilePath(LocalSavesDummy)),
|
||||
m_LocalGameDir(myGamesDir.absolutePath()), m_IniFileName(iniFileName)
|
||||
{}
|
||||
|
||||
|
||||
MappingType EnderalLocalSavegames::mappings(const QDir &profileSaveDir) const
|
||||
MappingType EnderalLocalSavegames::mappings(const QDir& profileSaveDir) const
|
||||
{
|
||||
return {{
|
||||
profileSaveDir.absolutePath(),
|
||||
m_LocalSavesDir.absolutePath(),
|
||||
true,
|
||||
true
|
||||
}};
|
||||
return {{profileSaveDir.absolutePath(), m_LocalSavesDir.absolutePath(), true, true}};
|
||||
}
|
||||
|
||||
|
||||
bool EnderalLocalSavegames::prepareProfile(MOBase::IProfile *profile)
|
||||
bool EnderalLocalSavegames::prepareProfile(MOBase::IProfile* profile)
|
||||
{
|
||||
bool enable = profile->localSavesEnabled();
|
||||
|
||||
QString basePath
|
||||
= profile->localSettingsEnabled()
|
||||
? profile->absolutePath()
|
||||
: m_LocalGameDir.absolutePath();
|
||||
QString basePath = profile->localSettingsEnabled() ? profile->absolutePath()
|
||||
: m_LocalGameDir.absolutePath();
|
||||
QString iniFilePath = basePath + "/" + m_IniFileName;
|
||||
QString saveIni = profile->absolutePath() + "/" + "savepath.ini";
|
||||
QString saveIni = profile->absolutePath() + "/" + "savepath.ini";
|
||||
|
||||
// Get the current sLocalSavePath
|
||||
WCHAR currentPath[MAX_PATH];
|
||||
GetPrivateProfileStringW(L"General", L"sLocalSavePath", L"SKIP_ME", currentPath, MAX_PATH, iniFilePath.toStdWString().c_str());
|
||||
bool alreadyEnabled = wcscmp(currentPath, LocalSavesDummy.toStdWString().c_str()) == 0;
|
||||
GetPrivateProfileStringW(L"General", L"sLocalSavePath", L"SKIP_ME", currentPath,
|
||||
MAX_PATH, iniFilePath.toStdWString().c_str());
|
||||
bool alreadyEnabled =
|
||||
wcscmp(currentPath, LocalSavesDummy.toStdWString().c_str()) == 0;
|
||||
|
||||
// Get the current bUseMyGamesDirectory
|
||||
WCHAR currentMyGames[MAX_PATH];
|
||||
GetPrivateProfileStringW(L"General", L"bUseMyGamesDirectory", L"SKIP_ME", currentMyGames, MAX_PATH, iniFilePath.toStdWString().c_str());
|
||||
GetPrivateProfileStringW(L"General", L"bUseMyGamesDirectory", L"SKIP_ME",
|
||||
currentMyGames, MAX_PATH,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
|
||||
// Create the __MO_Saves directory if local saves are enabled and it doesn't exist
|
||||
if (enable) {
|
||||
@@ -80,13 +71,18 @@ bool EnderalLocalSavegames::prepareProfile(MOBase::IProfile *profile)
|
||||
if (enable && !alreadyEnabled) {
|
||||
// If the path is not blank, save it to savepath.ini
|
||||
if (wcscmp(currentPath, L"SKIP_ME") != 0) {
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", currentPath, saveIni.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", currentPath,
|
||||
saveIni.toStdWString().c_str());
|
||||
}
|
||||
if (wcscmp(currentMyGames, L"SKIP_ME") != 0) {
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", currentMyGames, saveIni.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", currentMyGames,
|
||||
saveIni.toStdWString().c_str());
|
||||
}
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", LocalSavesDummy.toStdWString().c_str(), iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", L"1", iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath",
|
||||
LocalSavesDummy.toStdWString().c_str(),
|
||||
iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", L"1",
|
||||
iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
|
||||
// Get rid of the local saves setting if it's still there
|
||||
@@ -95,26 +91,32 @@ bool EnderalLocalSavegames::prepareProfile(MOBase::IProfile *profile)
|
||||
if (QFile::exists(saveIni)) {
|
||||
WCHAR savedPath[MAX_PATH];
|
||||
WCHAR savedMyGames[MAX_PATH];
|
||||
GetPrivateProfileStringW(L"General", L"sLocalSavePath", L"DELETE_ME", savedPath, MAX_PATH, saveIni.toStdWString().c_str());
|
||||
GetPrivateProfileStringW(L"General", L"bUseMyGamesDirectory", L"DELETE_ME", savedMyGames, MAX_PATH, saveIni.toStdWString().c_str());
|
||||
GetPrivateProfileStringW(L"General", L"sLocalSavePath", L"DELETE_ME", savedPath,
|
||||
MAX_PATH, saveIni.toStdWString().c_str());
|
||||
GetPrivateProfileStringW(L"General", L"bUseMyGamesDirectory", L"DELETE_ME",
|
||||
savedMyGames, MAX_PATH, saveIni.toStdWString().c_str());
|
||||
if (wcscmp(savedPath, L"DELETE_ME") != 0) {
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", savedPath, iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
else {
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", NULL, iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", savedPath,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
} else {
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", NULL,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
if (wcscmp(savedMyGames, L"DELETE_ME") != 0) {
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", savedMyGames, iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
else {
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", NULL, iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", savedMyGames,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
} else {
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", NULL,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
QFile::remove(saveIni);
|
||||
}
|
||||
// Otherwise just delete the setting
|
||||
else {
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", NULL, iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", NULL, iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"sLocalSavePath", NULL,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
MOBase::WriteRegistryValue(L"General", L"bUseMyGamesDirectory", NULL,
|
||||
iniFilePath.toStdWString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,9 @@ License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ENDERALLOCALSAVEGAMES_H
|
||||
#define ENDERALLOCALSAVEGAMES_H
|
||||
|
||||
|
||||
#include <localsavegames.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -30,18 +28,15 @@ class EnderalLocalSavegames : public LocalSavegames
|
||||
{
|
||||
|
||||
public:
|
||||
EnderalLocalSavegames(const QDir &myGamesDir, const QString &iniFileName);
|
||||
EnderalLocalSavegames(const QDir& myGamesDir, const QString& iniFileName);
|
||||
|
||||
virtual MappingType mappings(const QDir &profileSaveDir) const override;
|
||||
virtual bool prepareProfile(MOBase::IProfile *profile) override;
|
||||
virtual MappingType mappings(const QDir& profileSaveDir) const override;
|
||||
virtual bool prepareProfile(MOBase::IProfile* profile) override;
|
||||
|
||||
private:
|
||||
|
||||
QDir m_LocalSavesDir;
|
||||
QDir m_LocalGameDir;
|
||||
QString m_IniFileName;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // ENDERALLOCALSAVEGAMES_H
|
||||
#endif // ENDERALLOCALSAVEGAMES_H
|
||||
|
||||
+32
-12
@@ -9,21 +9,41 @@ public:
|
||||
using GamebryoModDataChecker::GamebryoModDataChecker;
|
||||
|
||||
protected:
|
||||
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", "SkyProc Patchers", "CalienteTools", "NetScriptFramework", "shadersfx"
|
||||
};
|
||||
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",
|
||||
"SkyProc Patchers",
|
||||
"CalienteTools",
|
||||
"NetScriptFramework",
|
||||
"shadersfx"};
|
||||
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 // ENDERAL_MODATACHECKER_H
|
||||
#endif // ENDERAL_MODATACHECKER_H
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
#include <ifiletree.h>
|
||||
|
||||
// Like Skyrim, Enderal does not need any change from the default feature:
|
||||
class EnderalModDataContent : public GamebryoModDataContent {
|
||||
class EnderalModDataContent : public GamebryoModDataContent
|
||||
{
|
||||
public:
|
||||
|
||||
using GamebryoModDataContent::GamebryoModDataContent;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENDERAL_MODDATACONTENT_H
|
||||
#endif // ENDERAL_MODDATACONTENT_H
|
||||
|
||||
+17
-21
@@ -4,32 +4,28 @@
|
||||
|
||||
#include "gameenderal.h"
|
||||
|
||||
EnderalSaveGame::EnderalSaveGame(QString const &fileName, GameEnderal const *game) :
|
||||
GamebryoSaveGame(fileName, game)
|
||||
EnderalSaveGame::EnderalSaveGame(QString const& fileName, GameEnderal const* game)
|
||||
: GamebryoSaveGame(fileName, game)
|
||||
{
|
||||
FileWrapper file(getFilepath(), "TESV_SAVEGAME");
|
||||
|
||||
FILETIME ftime;
|
||||
fetchInformationFields(file, m_SaveNumber, m_PCName, m_PCLevel, m_PCLocation, 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 EnderalSaveGame::fetchInformationFields(FileWrapper& file,
|
||||
unsigned long& saveNumber,
|
||||
QString& playerName,
|
||||
unsigned short& playerLevel,
|
||||
QString& playerLocation,
|
||||
FILETIME& creationTime) const
|
||||
void EnderalSaveGame::fetchInformationFields(
|
||||
FileWrapper& file, unsigned long& saveNumber, QString& playerName,
|
||||
unsigned short& playerLevel, QString& playerLocation, FILETIME& creationTime) const
|
||||
{
|
||||
file.skip<unsigned long>(); // header size
|
||||
file.skip<unsigned long>(); // header version
|
||||
file.skip<unsigned long>(); // header size
|
||||
file.skip<unsigned long>(); // header version
|
||||
file.read(saveNumber);
|
||||
|
||||
file.read(playerName);
|
||||
@@ -44,10 +40,10 @@ void EnderalSaveGame::fetchInformationFields(FileWrapper& file,
|
||||
file.read(timeOfDay);
|
||||
|
||||
QString race;
|
||||
file.read(race); // race name (i.e. BretonRace)
|
||||
file.read(race); // 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
|
||||
|
||||
file.read(creationTime);
|
||||
}
|
||||
@@ -63,14 +59,14 @@ std::unique_ptr<GamebryoSaveGame::DataFields> EnderalSaveGame::fetchDataFields()
|
||||
unsigned long dummySaveNumber;
|
||||
FILETIME dummyTime;
|
||||
|
||||
fetchInformationFields(file, dummySaveNumber, dummyName, dummyLevel,
|
||||
dummyLocation, dummyTime);
|
||||
fetchInformationFields(file, dummySaveNumber, dummyName, dummyLevel, dummyLocation,
|
||||
dummyTime);
|
||||
}
|
||||
|
||||
fields->Screenshot = file.readImage();
|
||||
|
||||
file.skip<unsigned char>(); // form version
|
||||
file.skip<unsigned long>(); // plugin info size
|
||||
file.skip<unsigned char>(); // form version
|
||||
file.skip<unsigned long>(); // plugin info size
|
||||
|
||||
fields->Plugins = file.readPlugins();
|
||||
|
||||
|
||||
@@ -10,19 +10,15 @@ class GameEnderal;
|
||||
class EnderalSaveGame : public GamebryoSaveGame
|
||||
{
|
||||
public:
|
||||
EnderalSaveGame(QString const &fileName, GameEnderal const *game);
|
||||
EnderalSaveGame(QString const& fileName, GameEnderal const* game);
|
||||
|
||||
protected:
|
||||
|
||||
// Fetch easy-to-access information.
|
||||
void fetchInformationFields(FileWrapper& wrapper,
|
||||
unsigned long& saveNumber,
|
||||
QString& playerName,
|
||||
unsigned short& playerLevel,
|
||||
QString& playerLocation,
|
||||
FILETIME& creationTime) const;
|
||||
void fetchInformationFields(FileWrapper& wrapper, unsigned long& saveNumber,
|
||||
QString& playerName, unsigned short& playerLevel,
|
||||
QString& playerLocation, FILETIME& creationTime) const;
|
||||
|
||||
std::unique_ptr<DataFields> fetchDataFields() const override;
|
||||
};
|
||||
|
||||
#endif // ENDERALSAVEGAME_H
|
||||
#endif // ENDERALSAVEGAME_H
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
EnderalScriptExtender::EnderalScriptExtender(GameGamebryo const *game) :
|
||||
GamebryoScriptExtender(game)
|
||||
{
|
||||
}
|
||||
EnderalScriptExtender::EnderalScriptExtender(GameGamebryo const* game)
|
||||
: GamebryoScriptExtender(game)
|
||||
{}
|
||||
|
||||
QString EnderalScriptExtender::BinaryName() const
|
||||
{
|
||||
|
||||
@@ -8,11 +8,10 @@ class GameGamebryo;
|
||||
class EnderalScriptExtender : public GamebryoScriptExtender
|
||||
{
|
||||
public:
|
||||
EnderalScriptExtender(const GameGamebryo *game);
|
||||
EnderalScriptExtender(const GameGamebryo* game);
|
||||
|
||||
virtual QString BinaryName() const override;
|
||||
virtual QString PluginPath() const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENDERALSCRIPTEXTENDER_H
|
||||
#endif // ENDERALSCRIPTEXTENDER_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user