Initial files copied from Oblivion and renamed

This commit is contained in:
Chris Bessent
2021-08-22 09:05:55 -07:00
commit 7436a726bb
21 changed files with 703 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
edit
CMakeLists.txt.user
/msbuild.log
/*std*.log
/*build
+12
View File
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.16)
project(game_oblivion)
set(project_type plugin)
set(enable_warnings OFF)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake)
else()
include(../cmake_common/project.cmake)
endif()
add_subdirectory(src)
+40
View File
@@ -0,0 +1,40 @@
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_oblivion.dll
name: game_oblivion_dll
- path: vsbuild\src\RelWithDebInfo\game_oblivion.pdb
name: game_oblivion_pdb
- path: vsbuild\src\RelWithDebInfo\game_oblivion.lib
name: game_oblivion_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
+7
View File
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/src.cmake)
else()
include(../../cmake_common/src.cmake)
endif()
requires_project(game_gamebryo game_features)
+13
View File
@@ -0,0 +1,13 @@
Import('qt_env')
env = qt_env.Clone()
env.AppendUnique(CPPDEFINES = [ 'GAMEOBLIVION_LIBRARY' ])
env.RequiresGamebryo()
lib = env.SharedLibrary('gameOblivion', env.Glob('*.cpp'))
env.InstallModule(lib)
res = env['QT_USED_MODULES']
Return('res')
+50
View File
@@ -0,0 +1,50 @@
#-------------------------------------------------
#
# Project created by QtCreator 2014-11-15T15:36:33
#
#-------------------------------------------------
TARGET = gameOblivion
TEMPLATE = lib
CONFIG += plugins
CONFIG += dll
DEFINES += GAMEOBLIVION_LIBRARY
SOURCES += gameoblivion.cpp \
oblivionbsainvalidation.cpp \
oblivionscriptextender.cpp \
obliviondataarchives.cpp \
oblivionsavegame.cpp \
oblivionsavegameinfo.cpp
HEADERS += gameoblivion.h \
oblivionbsainvalidation.h \
oblivionscriptextender.h \
obliviondataarchives.h \
oblivionsavegame.h \
oblivionsavegameinfo.h
CONFIG(debug, debug|release) {
LIBS += -L"$${OUT_PWD}/../gameGamebryo/debug"
PRE_TARGETDEPS += \
$$OUT_PWD/../gameGamebryo/debug/gameGamebryo.lib
} else {
LIBS += -L"$${OUT_PWD}/../gameGamebryo/release"
PRE_TARGETDEPS += \
$$OUT_PWD/../gameGamebryo/release/gameGamebryo.lib
}
include(../plugin_template.pri)
INCLUDEPATH += "$${BOOSTPATH}" "$${PWD}/../gamefeatures" "$${PWD}/../gamegamebryo"
LIBS += -ladvapi32 -lole32 -lgameGamebryo
OTHER_FILES += \
gameoblivion.json\
SConscript \
CMakeLists.txt
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>GameOblivion</name>
<message>
<location filename="gameoblivion.cpp" line="80"/>
<source>Oblivion Support Plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gameoblivion.cpp" line="90"/>
<source>Adds support for the game Oblivion</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
+52
View File
@@ -0,0 +1,52 @@
#ifndef GAMEOBLIVION_H
#define GAMEOBLIVION_H
#include "gamegamebryo.h"
#include <QObject>
#include <QtGlobal>
class GameOblivion : public GameGamebryo
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.tannin.GameOblivion" FILE "gameoblivion.json")
public:
GameOblivion();
virtual bool init(MOBase::IOrganizer *moInfo) override;
public: // IPluginGame interface
virtual QString gameName() const override;
virtual QList<MOBase::ExecutableInfo> executables() const override;
virtual QList<MOBase::ExecutableForcedLoadSetting> executableForcedLoads() const override;
virtual void initializeProfile(const QDir &path, ProfileSettings settings) const override;
virtual QString steamAPPId() const override;
virtual QStringList primaryPlugins() const override;
virtual QString gameShortName() const override;
virtual QString gameNexusName() const override;
virtual QStringList iniFiles() const override;
virtual QStringList DLCPlugins() const override;
virtual int nexusModOrganizerID() const override;
virtual int nexusGameID() const override;
public: // IPlugin interface
virtual QString name() const override;
virtual QString localizedName() const override;
virtual QString author() const override;
virtual QString description() const override;
virtual MOBase::VersionInfo version() const override;
virtual QList<MOBase::PluginSetting> settings() const override;
protected:
std::shared_ptr<const GamebryoSaveGame> makeSaveGame(QString filePath) const override;
QString savegameExtension() const override;
QString savegameSEExtension() const override;
};
#endif // GAMEOBLIVION_H
+1
View File
@@ -0,0 +1 @@
{}
+179
View File
@@ -0,0 +1,179 @@
#include "gameoblivion.h"
#include "oblivionbsainvalidation.h"
#include "obliviondataarchives.h"
#include "oblivionscriptextender.h"
#include "oblivionmoddatachecker.h"
#include "oblivionmoddatacontent.h"
#include "oblivionsavegame.h"
#include "pluginsetting.h"
#include "executableinfo.h"
#include <gamebryolocalsavegames.h>
#include <gamebryogameplugins.h>
#include <gamebryounmanagedmods.h>
#include <gamebryosavegameinfo.h>
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <memory>
using namespace MOBase;
GameOblivion::GameOblivion()
{
}
bool GameOblivion::init(IOrganizer *moInfo)
{
if (!GameGamebryo::init(moInfo)) {
return false;
}
registerFeature<ScriptExtender>(new OblivionScriptExtender(this));
registerFeature<DataArchives>(new OblivionDataArchives(myGamesPath()));
registerFeature<BSAInvalidation>(new OblivionBSAInvalidation(feature<DataArchives>(), this));
registerFeature<SaveGameInfo>(new GamebryoSaveGameInfo(this));
registerFeature<LocalSavegames>(new GamebryoLocalSavegames(myGamesPath(), "oblivion.ini"));
registerFeature<ModDataChecker>(new OblivionModDataChecker(this));
registerFeature<ModDataContent>(new OblivionModDataContent(this));
registerFeature<GamePlugins>(new GamebryoGamePlugins(moInfo));
registerFeature<UnmanagedMods>(new GamebryoUnmangedMods(this));
return true;
}
QString GameOblivion::gameName() const
{
return "Oblivion";
}
QList<ExecutableInfo> GameOblivion::executables() const
{
return QList<ExecutableInfo>()
<< ExecutableInfo("OBSE", findInGameFolder(feature<ScriptExtender>()->loaderName()))
<< ExecutableInfo("Oblivion", findInGameFolder(binaryName()))
<< ExecutableInfo("Oblivion Launcher", findInGameFolder(getLauncherName()))
<< ExecutableInfo("Oblivion Mod Manager", findInGameFolder("OblivionModManager.exe"))
<< ExecutableInfo("BOSS", findInGameFolder("BOSS/BOSS.exe"))
<< ExecutableInfo("LOOT", getLootPath()).withArgument("--game=\"Oblivion\"")
<< ExecutableInfo("Construction Set", findInGameFolder("TESConstructionSet.exe"))
;
}
QList<ExecutableForcedLoadSetting> GameOblivion::executableForcedLoads() const
{
//TODO Search game directory for OBSE DLLs
return QList<ExecutableForcedLoadSetting>()
<< ExecutableForcedLoadSetting("Oblivion.exe", "obse_1_2_416.dll").withForced()
<< ExecutableForcedLoadSetting("TESConstructionSet.exe", "obse_editor_1_2.dll").withForced()
;
}
QString GameOblivion::name() const
{
return "Oblivion Support Plugin";
}
QString GameOblivion::localizedName() const
{
return tr("Oblivion Support Plugin");
}
QString GameOblivion::author() const
{
return "Tannin";
}
QString GameOblivion::description() const
{
return tr("Adds support for the game Oblivion");
}
MOBase::VersionInfo GameOblivion::version() const
{
return VersionInfo(1, 4, 1, VersionInfo::RELEASE_FINAL);
}
QList<PluginSetting> GameOblivion::settings() const
{
return QList<PluginSetting>();
}
void GameOblivion::initializeProfile(const QDir &path, ProfileSettings settings) const
{
if (settings.testFlag(IPluginGame::MODS)) {
copyToProfile(localAppFolder() + "/Oblivion", path, "plugins.txt");
copyToProfile(localAppFolder() + "/Oblivion", path, "loadorder.txt");
}
if (settings.testFlag(IPluginGame::CONFIGURATION)) {
if (settings.testFlag(IPluginGame::PREFER_DEFAULTS)
|| !QFileInfo(myGamesPath() + "/oblivion.ini").exists()) {
copyToProfile(gameDirectory().absolutePath(), path, "oblivion_default.ini", "oblivion.ini");
} else {
copyToProfile(myGamesPath(), path, "oblivion.ini");
}
copyToProfile(myGamesPath(), path, "oblivionprefs.ini");
}
}
QString GameOblivion::savegameExtension() const
{
return "ess";
}
QString GameOblivion::savegameSEExtension() const
{
return "obse";
}
std::shared_ptr<const GamebryoSaveGame> GameOblivion::makeSaveGame(QString filePath) const
{
return std::make_shared<const OblivionSaveGame>(filePath, this);
}
QString GameOblivion::steamAPPId() const
{
return "22330";
}
QStringList GameOblivion::primaryPlugins() const
{
return { "oblivion.esm", "update.esm" };
}
QString GameOblivion::gameShortName() const
{
return "Oblivion";
}
QString GameOblivion::gameNexusName() const
{
return "Oblivion";
}
QStringList GameOblivion::iniFiles() const
{
return { "oblivion.ini", "oblivionprefs.ini" };
}
QStringList GameOblivion::DLCPlugins() const
{
return { "DLCBattlehornCastle.esp", "DLCShiveringIsles.esp", "Knights.esp", "DLCFrostcrag.esp",
"DLCSpellTomes.esp", "DLCMehrunesRazor.esp", "DLCOrrery.esp",
"DLCThievesDen.esp", "DLCVileLair.esp", "DLCHorseArmor.esp" };
}
int GameOblivion::nexusModOrganizerID() const
{
return 38277;
}
int GameOblivion::nexusGameID() const
{
return 101;
}
+17
View File
@@ -0,0 +1,17 @@
#include "oblivionbsainvalidation.h"
OblivionBSAInvalidation::OblivionBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game)
: GamebryoBSAInvalidation(dataArchives, "oblivion.ini", game)
{
}
QString OblivionBSAInvalidation::invalidationBSAName() const
{
return "Oblivion - Invalidation.bsa";
}
unsigned long OblivionBSAInvalidation::bsaVersion() const
{
return 0x67;
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef OBLIVIONBSAINVALIDATION_H
#define OBLIVIONBSAINVALIDATION_H
#include "gamebryobsainvalidation.h"
#include "obliviondataarchives.h"
#include <memory>
class OblivionBSAInvalidation : public GamebryoBSAInvalidation
{
public:
OblivionBSAInvalidation(DataArchives *dataArchives, MOBase::IPluginGame const *game);
private:
virtual QString invalidationBSAName() const override;
virtual unsigned long bsaVersion() const override;
};
#endif // OBLIVIONBSAINVALIDATION_H
+36
View File
@@ -0,0 +1,36 @@
#include "obliviondataarchives.h"
#include <utility.h>
OblivionDataArchives::OblivionDataArchives(const QDir &myGamesDir) :
GamebryoDataArchives(myGamesDir)
{
}
QStringList OblivionDataArchives::vanillaArchives() const
{
return { "Oblivion - Misc.bsa"
, "Oblivion - Textures - Compressed.bsa"
, "Oblivion - Meshes.bsa"
, "Oblivion - Sounds.bsa"
, "Oblivion - Voices1.bsa"
, "Oblivion - Voices2.bsa"
};
}
QStringList OblivionDataArchives::archives(const MOBase::IProfile *profile) const
{
QStringList result;
QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("oblivion.ini") : m_LocalGameDir.absoluteFilePath("oblivion.ini");
result.append(getArchivesFromKey(iniFile, "SArchiveList"));
return result;
}
void OblivionDataArchives::writeArchiveList(MOBase::IProfile *profile, const QStringList &before)
{
QString list = before.join(", ");
QString iniFile = profile->localSettingsEnabled() ? QDir(profile->absolutePath()).absoluteFilePath("oblivion.ini") : m_LocalGameDir.absoluteFilePath("oblivion.ini");
setArchivesToKey(iniFile, "SArchiveList", list);
}
+28
View File
@@ -0,0 +1,28 @@
#ifndef OBLIVIONDATAARCHIVES_H
#define OBLIVIONDATAARCHIVES_H
#include <gamebryodataarchives.h>
#include <iprofile.h>
#include <QString>
#include <QStringList>
#include <QDir>
class OblivionDataArchives : public GamebryoDataArchives
{
public:
OblivionDataArchives(const QDir &myGamesDir);
public:
virtual QStringList vanillaArchives() const override;
virtual QStringList archives(const MOBase::IProfile *profile) const override;
private:
virtual void writeArchiveList(MOBase::IProfile *profile, const QStringList &before) override;
};
#endif // OBLIVIONDATAARCHIVES_H
+30
View File
@@ -0,0 +1,30 @@
#include "oblivionmoddatachecker.h"
ModDataChecker::CheckReturn OblivionModDataChecker::dataLooksValid(
std::shared_ptr<const MOBase::IFileTree> fileTree) const
{
// Check with Gamebryo stuff:
auto check = GamebryoModDataChecker::dataLooksValid(fileTree);
if (check == CheckReturn::VALID) {
return check;
}
// Check for OBSE_ files:
for (auto const& entry : *fileTree) {
if (entry->isDir() || !entry->name().startsWith("OBSE", Qt::CaseInsensitive)) {
return CheckReturn::INVALID;
}
}
return CheckReturn::FIXABLE;
}
std::shared_ptr<MOBase::IFileTree> OblivionModDataChecker::fix(
std::shared_ptr<MOBase::IFileTree> fileTree) const
{
// If we arrive here, it means all files starts with OBSE.
auto data = fileTree->createOrphanTree();
auto obse = data->addDirectory("OBSE/Plugins");
obse->merge(fileTree);
return data;
}
+32
View File
@@ -0,0 +1,32 @@
#ifndef OBLIVION_MODATACHECKER_H
#define OBLIVION_MODATACHECKER_H
#include <gamebryomoddatachecker.h>
class OblivionModDataChecker : public GamebryoModDataChecker
{
public:
using GamebryoModDataChecker::GamebryoModDataChecker;
CheckReturn dataLooksValid(std::shared_ptr<const MOBase::IFileTree> fileTree) const override;
std::shared_ptr<MOBase::IFileTree> fix(std::shared_ptr<MOBase::IFileTree> fileTree) const override;
protected:
virtual const FileNameSet& possibleFolderNames() const override {
static FileNameSet result{
"fonts", "interface", "menus", "meshes", "music", "scripts", "shaders",
"sound", "strings", "textures", "trees", "video", "facegen",
"obse", "distantlod", "asi", "distantland", "mits", "dllplugins", "CalienteTools",
"NetScriptFramework"
};
return result;
}
virtual const FileNameSet& possibleFileExtensions() const override {
static FileNameSet result{
"esp", "esm", "bsa", "modgroups", "ini"
};
return result;
}
};
#endif // OBLIVION_MODATACHECKER_H
+21
View File
@@ -0,0 +1,21 @@
#ifndef OBLIVION_MODDATACONTENT_H
#define OBLIVION_MODDATACONTENT_H
#include <gamebryomoddatacontent.h>
#include <ifiletree.h>
class OblivionModDataContent : public GamebryoModDataContent {
public:
/**
*
*/
OblivionModDataContent(GameGamebryo const* gamePlugin) : GamebryoModDataContent(gamePlugin) {
// Just need to disable some contents:
m_Enabled[CONTENT_MCM] = false;
m_Enabled[CONTENT_SKYPROC] = false;
}
};
#endif // OBLIVION_MODDATACONTENT_H
+73
View File
@@ -0,0 +1,73 @@
#include "oblivionsavegame.h"
#include <Windows.h>
OblivionSaveGame::OblivionSaveGame(QString const &fileName, GameOblivion const *game) :
GamebryoSaveGame(fileName, game)
{
FileWrapper file(getFilepath(), "TES4SAVEGAME");
file.setPluginString(GamebryoSaveGame::StringType::TYPE_BSTRING);
SYSTEMTIME creationTime;
fetchInformationFields(file, m_SaveNumber, m_PCName, m_PCLevel, m_PCLocation, creationTime);
setCreationTime(creationTime);
}
void OblivionSaveGame::fetchInformationFields(FileWrapper& file,
unsigned long& saveNumber,
QString& playerName,
unsigned short& playerLevel,
QString& playerLocation,
SYSTEMTIME& creationTime) const
{
file.skip<unsigned char>(); //Major version
file.skip<unsigned char>(); //Minor version
file.skip<SYSTEMTIME>(); // exe last modified (!)
file.skip<unsigned long>(); //Header version
file.skip<unsigned long>(); //Header size
file.read(saveNumber);
file.read(playerName);
file.read(playerLevel);
file.read(playerLocation);
file.skip<float>(); //game days
file.skip<unsigned long>(); //game ticks
//there is a save time stored here. So use it rather than the file time, which
//could have been copied.
//Note: This says it uses getlocaltime api to obtain it which is u/s - if so
//we should ignore this.
file.read(creationTime);
}
std::unique_ptr<GamebryoSaveGame::DataFields> OblivionSaveGame::fetchDataFields() const
{
FileWrapper file(getFilepath(), "TES4SAVEGAME");
file.setPluginString(GamebryoSaveGame::StringType::TYPE_BSTRING);
std::unique_ptr<DataFields> fields = std::make_unique<DataFields>();
{
QString dummyName, dummyLocation;
unsigned short dummyLevel;
unsigned long dummySaveNumber;
SYSTEMTIME dummyTime;
fetchInformationFields(file, dummySaveNumber, dummyName, dummyLevel,
dummyLocation, dummyTime);
}
//Note that screenshot size, width, height and data are apparently the same
//structure
file.skip<unsigned long>(); //Screenshot size.
fields->Screenshot = file.readImage();
fields->Plugins = file.readPlugins();
return fields;
}
+25
View File
@@ -0,0 +1,25 @@
#ifndef OBLIVIONSAVEGAME_H
#define OBLIVIONSAVEGAME_H
#include "gamebryosavegame.h"
#include "gameoblivion.h"
class OblivionSaveGame : public GamebryoSaveGame
{
public:
OblivionSaveGame(QString const &fileName, GameOblivion const *game);
protected:
// Fetch easy-to-access information.
void fetchInformationFields(FileWrapper& wrapper,
unsigned long& saveNumber,
QString& playerName,
unsigned short& playerLevel,
QString& playerLocation,
SYSTEMTIME& creationTime) const;
std::unique_ptr<DataFields> fetchDataFields() const override;
};
#endif // OBLIVIONSAVEGAME_H
+23
View File
@@ -0,0 +1,23 @@
#include "oblivionscriptextender.h"
#include <QString>
#include <QStringList>
OblivionScriptExtender::OblivionScriptExtender(GameGamebryo const *game) :
GamebryoScriptExtender(game)
{
}
OblivionScriptExtender::~OblivionScriptExtender()
{
}
QString OblivionScriptExtender::BinaryName() const
{
return "obse_loader.exe";
}
QString OblivionScriptExtender::PluginPath() const
{
return "obse/plugins";
}

Some files were not shown because too many files have changed in this diff Show More