Skip to content

Commit

Permalink
Plugin for Skyrim VR
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBrixLarsen committed Apr 3, 2018
1 parent 895f73e commit b6ad4de
Show file tree
Hide file tree
Showing 25 changed files with 269 additions and 280 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(PROJ_NAME game_skyrimse)
SET(PROJ_NAME game_skyrimvr)

PROJECT(${PROJ_NAME})

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ADD_LIBRARY(${PROJ_NAME} SHARED ${${PROJ_NAME}_HDRS} ${${PROJ_NAME}_SRCS} ${${PR
TARGET_LINK_LIBRARIES(${PROJ_NAME}
Qt5::Widgets
${Boost_LIBRARIES}
DbgHelp
DbgHelp
uibase
game_gamebryo
liblz4
Expand Down
4 changes: 2 additions & 2 deletions src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Import('qt_env')

env = qt_env.Clone()

env.AppendUnique(CPPDEFINES = [ 'GAMESKYRIMSE_LIBRARY' ])
env.AppendUnique(CPPDEFINES = [ 'GAMESKYRIMVR_LIBRARY' ])

env.RequiresGamebryo()

lib = env.SharedLibrary('gameSkyrimSE', env.Glob('*.cpp'))
lib = env.SharedLibrary('gameSkyrimVR', env.Glob('*.cpp'))
env.InstallModule(lib)

res = env['QT_USED_MODULES']
Expand Down
12 changes: 6 additions & 6 deletions src/game_skyrimse_en.ts → src/game_skyrimvr_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>GameSkyrimSE</name>
<name>GameSkyrimVR</name>
<message>
<location filename="gameskyrimse.cpp" line="215"/>
<source>Adds support for the game Skyrim Special Edition.</source>
<location filename="gameskyrimvr.cpp" line="214"/>
<source>Adds support for the game Skyrim VR.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="gameskyrimse.cpp" line="48"/>
<location filename="gameskyrimvr.cpp" line="48"/>
<source>failed to query registry path (preflight): %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gameskyrimse.cpp" line="55"/>
<location filename="gameskyrimvr.cpp" line="55"/>
<source>failed to query registry path (read): %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="skyrimsegameplugins.cpp" line="83"/>
<location filename="skyrimvrgameplugins.cpp" line="79"/>
<source>Some of your plugins have invalid names! These plugins can not be loaded by the game. Please see mo_interface.log for a list of affected plugins and rename them.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
133 changes: 67 additions & 66 deletions src/gameskyrimse.cpp → src/gameskyrimvr.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "gameskyrimse.h"
#include "gameskyrimvr.h"

#include "skyrimsedataarchives.h"
#include "skyrimsescriptextender.h"
#include "skyrimsesavegameinfo.h"
#include "skyrimsegameplugins.h"
#include "skyrimseunmanagedmods.h"
#include "skyrimvrdataarchives.h"
#include "skyrimvrscriptextender.h"
#include "skyrimvrsavegameinfo.h"
#include "skyrimvrgameplugins.h"
#include "skyrimvrunmanagedmods.h"

#include <pluginsetting.h>
#include "iplugingame.h"
Expand Down Expand Up @@ -121,185 +121,176 @@ namespace {

using namespace MOBase;

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

void GameSkyrimSE::setGamePath(const QString &path)
void GameSkyrimVR::setGamePath(const QString &path)
{
m_GamePath = path;
}

QDir GameSkyrimSE::documentsDirectory() const
QDir GameSkyrimVR::documentsDirectory() const
{
return m_MyGamesPath;
}

QString GameSkyrimSE::identifyGamePath() const
QString GameSkyrimVR::identifyGamePath() const
{
QString path = "Software\\Bethesda Softworks\\" + gameName();
return findInRegistry(HKEY_LOCAL_MACHINE, path.toStdWString().c_str(), L"Installed Path");
}

QDir GameSkyrimSE::savesDirectory() const
QDir GameSkyrimVR::savesDirectory() const
{
return QDir(m_MyGamesPath + "/Saves");
}

QString GameSkyrimSE::myGamesPath() const
QString GameSkyrimVR::myGamesPath() const
{
return m_MyGamesPath;
}

bool GameSkyrimSE::isInstalled() const
bool GameSkyrimVR::isInstalled() const
{
return !m_GamePath.isEmpty();
}

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

m_Organizer = moInfo;
m_GamePath = GameSkyrimSE::identifyGamePath();
m_GamePath = GameSkyrimVR::identifyGamePath();
m_MyGamesPath = determineMyGamesPath(gameName());


registerFeature<ScriptExtender>(new SkyrimSEScriptExtender(this));
registerFeature<DataArchives>(new SkyrimSEDataArchives(myGamesPath()));
registerFeature<LocalSavegames>(new GamebryoLocalSavegames(myGamesPath(), "Skyrim.ini"));
registerFeature<SaveGameInfo>(new SkyrimSESaveGameInfo(this));
registerFeature<GamePlugins>(new SkyrimSEGamePlugins(moInfo));
registerFeature<UnmanagedMods>(new SkyrimSEUnmangedMods(this));
registerFeature<ScriptExtender>(new SkyrimVRScriptExtender(this));
registerFeature<DataArchives>(new SkyrimVRDataArchives(myGamesPath()));
registerFeature<LocalSavegames>(new GamebryoLocalSavegames(myGamesPath(), "SkyrimPrefs.ini"));
registerFeature<SaveGameInfo>(new SkyrimVRSaveGameInfo(this));
registerFeature<GamePlugins>(new SkyrimVRGamePlugins(moInfo));
registerFeature<UnmanagedMods>(new SkyrimVRUnmangedMods(this));

return true;
}



QString GameSkyrimSE::gameName() const
QString GameSkyrimVR::gameName() const
{
return "Skyrim Special Edition";
return "Skyrim VR";
}

QList<ExecutableInfo> GameSkyrimSE::executables() const
QList<ExecutableInfo> GameSkyrimVR::executables() const
{
return QList<ExecutableInfo>()
<< ExecutableInfo("SKSE", findInGameFolder(feature<ScriptExtender>()->loaderName()))
<< ExecutableInfo("Skyrim Special Edition", findInGameFolder(binaryName()))
<< ExecutableInfo("Skyrim Special Edition Launcher", findInGameFolder(getLauncherName()))
<< ExecutableInfo("Skyrim VR", findInGameFolder(binaryName()))
<< ExecutableInfo("Creation Kit", findInGameFolder("CreationKit.exe"))
<< ExecutableInfo("LOOT", getLootPath()).withArgument("--game=\"Skyrim Special Edition\"")
;
}

QFileInfo GameSkyrimSE::findInGameFolder(const QString &relativePath) const
QFileInfo GameSkyrimVR::findInGameFolder(const QString &relativePath) const
{
return QFileInfo(m_GamePath + "/" + relativePath);
}

QString GameSkyrimSE::name() const
QString GameSkyrimVR::name() const
{
return "Skyrim Special Edition Support Plugin";
return "Skyrim VR Support Plugin";
}

QString GameSkyrimSE::author() const
QString GameSkyrimVR::author() const
{
return "Archost & ZachHaber";
return "Brixified";
}

QString GameSkyrimSE::description() const
QString GameSkyrimVR::description() const
{
return tr("Adds support for the game Skyrim Special Edition.");
return tr("Adds support for the game Skyrim VR.");
}

MOBase::VersionInfo GameSkyrimSE::version() const
MOBase::VersionInfo GameSkyrimVR::version() const
{
return VersionInfo(0, 1, 5, VersionInfo::RELEASE_ALPHA);
}

bool GameSkyrimSE::isActive() const
bool GameSkyrimVR::isActive() const
{
return qApp->property("managed_game").value<IPluginGame*>() == this;
}

QList<PluginSetting> GameSkyrimSE::settings() const
QList<PluginSetting> GameSkyrimVR::settings() const
{
return QList<PluginSetting>();
}

void GameSkyrimSE::initializeProfile(const QDir &path, ProfileSettings settings) const
void GameSkyrimVR::initializeProfile(const QDir &path, ProfileSettings settings) const
{
if (settings.testFlag(IPluginGame::MODS)) {
copyToProfile(localAppFolder() + "/Skyrim Special Edition", path, "plugins.txt");
copyToProfile(localAppFolder() + "/Skyrim Special Edition", path, "loadorder.txt");
copyToProfile(localAppFolder() + "/Skyrim VR", path, "plugins.txt");
copyToProfile(localAppFolder() + "/Skyrim VR", path, "loadorder.txt");
}

if (settings.testFlag(IPluginGame::CONFIGURATION)) {
if (settings.testFlag(IPluginGame::PREFER_DEFAULTS)
|| !QFileInfo(myGamesPath() + "/skyrim.ini").exists()) {
copyToProfile(gameDirectory().absolutePath(), path, "skyrim_default.ini", "skyrim.ini");
}
else {
copyToProfile(myGamesPath(), path, "skyrim.ini");
}

copyToProfile(myGamesPath(), path, "skyrimprefs.ini");
}
}

QString GameSkyrimSE::savegameExtension() const
QString GameSkyrimVR::savegameExtension() const
{
return "ess";
}

QString GameSkyrimSE::savegameSEExtension() const
QString GameSkyrimVR::savegameSEExtension() const
{
return "skse";
}

QString GameSkyrimSE::steamAPPId() const
QString GameSkyrimVR::steamAPPId() const
{
return "489830";
return "611670";
}

QStringList GameSkyrimSE::primaryPlugins() const {
QStringList plugins = { "skyrim.esm", "update.esm", "dawnguard.esm", "hearthfires.esm", "dragonborn.esm" };
QStringList GameSkyrimVR::primaryPlugins() const {
QStringList plugins = { "skyrim.esm", "update.esm", "dawnguard.esm", "hearthfires.esm", "dragonborn.esm", "skyrimvr.esm" };

plugins.append(CCPlugins());

return plugins;
}

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

QString GameSkyrimSE::gameShortName() const
QString GameSkyrimVR::gameShortName() const
{
return "skyrimse";
return "Skyrim VR";
}

QString GameSkyrimSE::gameNexusName() const
QString GameSkyrimVR::gameNexusName() const
{
return "skyrimspecialedition";
}


QStringList GameSkyrimSE::iniFiles() const
QStringList GameSkyrimVR::iniFiles() const
{
return{ "skyrim.ini", "skyrimprefs.ini" };
return{ "skyrimprefs.ini" };
}

QStringList GameSkyrimSE::DLCPlugins() const
QStringList GameSkyrimVR::DLCPlugins() const
{
return{ "dawnguard.esm", "hearthfires.esm", "dragonborn.esm" };
}

QStringList GameSkyrimSE::CCPlugins() const
QStringList GameSkyrimVR::CCPlugins() const
{
QStringList plugins = {};
QFile file(gameDirectory().filePath("Skyrim.ccc"));
Expand All @@ -326,28 +317,38 @@ QStringList GameSkyrimSE::CCPlugins() const
return plugins;
}

IPluginGame::LoadOrderMechanism GameSkyrimSE::loadOrderMechanism() const
IPluginGame::LoadOrderMechanism GameSkyrimVR::loadOrderMechanism() const
{
return IPluginGame::LoadOrderMechanism::PluginsTxt;
}

int GameSkyrimSE::nexusModOrganizerID() const
int GameSkyrimVR::nexusModOrganizerID() const
{
return 6194; //... Should be 0?
}

int GameSkyrimSE::nexusGameID() const
int GameSkyrimVR::nexusGameID() const
{
return 1704; //1704
}

QDir GameSkyrimSE::gameDirectory() const
QString GameSkyrimVR::getLauncherName() const
{
return binaryName(); // Skyrim VR has no Launcher, so we just return the name of the game binary
}

QDir GameSkyrimVR::gameDirectory() const
{
return QDir(m_GamePath);
}

QString GameSkyrimVR::binaryName() const
{
return "SkyrimVR.exe";
}

// Not to delete all the spaces...
MappingType GameSkyrimSE::mappings() const
MappingType GameSkyrimVR::mappings() const
{
MappingType result;

Expand Down
Loading

0 comments on commit b6ad4de

Please sign in to comment.