summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2017-10-29 19:34:35 -0500
committerJeremy Rimpo <jeremy.rimpo@servermonkey.com>2017-10-29 19:34:35 -0500
commit88452e5d76467fc687a9c4d6b6aaf7381d2463e1 (patch)
tree0eebbdade85913be1109a03fd9847c694cb9bded /src
parent7e2811cb46443d11ef45e678433432a86a0b58b9 (diff)
Reimplement ScriptExtender handling by detecting USVFS arch
Diffstat (limited to 'src')
-rw-r--r--src/loadmechanism.cpp45
-rw-r--r--src/shared/appconfig.inc2
2 files changed, 34 insertions, 13 deletions
diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp
index e476c56d..a9d444d1 100644
--- a/src/loadmechanism.cpp
+++ b/src/loadmechanism.cpp
@@ -133,17 +133,23 @@ void LoadMechanism::deactivateScriptExtender()
#pragma message("implement this for usvfs")
- /*
- QString hookDLLName = ToQString(AppConfig::hookDLLName());
- if (QFile(pluginsDir.absoluteFilePath(hookDLLName)).exists()) {
+ QString vfsDLLName = "";
+ if (extender->getArch() == IMAGE_FILE_MACHINE_I386) {
+ vfsDLLName = ToQString(AppConfig::vfs32DLLName());
+ }
+ else if (extender->getArch() == IMAGE_FILE_MACHINE_AMD64)
+ {
+ vfsDLLName = ToQString(AppConfig::vfs64DLLName());
+ }
+ qDebug("USVFS DLL Name: " + vfsDLLName.toLatin1());
+ if (QFile(pluginsDir.absoluteFilePath(vfsDLLName)).exists()) {
// remove dll from SE plugins directory
- if (!pluginsDir.remove(hookDLLName)) {
- throw MyException(QObject::tr("Failed to delete %1").arg(pluginsDir.absoluteFilePath(hookDLLName)));
+ if (!pluginsDir.remove(vfsDLLName)) {
+ throw MyException(QObject::tr("Failed to delete %1").arg(pluginsDir.absoluteFilePath(vfsDLLName)));
}
}
removeHintFile(pluginsDir);
- */
} catch (const std::exception &e) {
QMessageBox::critical(nullptr, QObject::tr("Failed to deactivate script extender loading"), e.what());
}
@@ -195,27 +201,37 @@ void LoadMechanism::activateScriptExtender()
}
#pragma message("implement this for usvfs")
-/*
- QString targetPath = pluginsDir.absoluteFilePath(ToQString(AppConfig::hookDLLName()));
- QString hookDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::hookDLLName());
+ QString targetPath;
+ QString vfsDLLPath;
+ if (extender->getArch() == IMAGE_FILE_MACHINE_I386) {
+ targetPath = pluginsDir.absoluteFilePath(ToQString(AppConfig::vfs32DLLName()));
+ vfsDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::vfs32DLLName());
+ }
+ else if (extender->getArch() == IMAGE_FILE_MACHINE_AMD64)
+ {
+ targetPath = pluginsDir.absoluteFilePath(ToQString(AppConfig::vfs64DLLName()));
+ vfsDLLPath = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::vfs64DLLName());
+ }
+
+ qDebug("DLL USVFS Target Path: " + targetPath.toLatin1());
+ qDebug("DLL USVFS VFS DLL Path: " + vfsDLLPath.toLatin1());
QFile dllFile(targetPath);
if (dllFile.exists()) {
// may be outdated
- if (!hashIdentical(targetPath, hookDLLPath)) {
+ if (!hashIdentical(targetPath, vfsDLLPath)) {
dllFile.remove();
}
}
if (!dllFile.exists()) {
// install dll to SE plugins
- if (!QFile::copy(hookDLLPath, targetPath)) {
- throw MyException(QObject::tr("Failed to copy %1 to %2").arg(hookDLLPath, targetPath));
+ if (!QFile::copy(vfsDLLPath, targetPath)) {
+ throw MyException(QObject::tr("Failed to copy %1 to %2").arg(vfsDLLPath, targetPath));
}
}
writeHintFile(pluginsDir);
-*/
} catch (const std::exception &e) {
QMessageBox::critical(nullptr, QObject::tr("Failed to set up script extender loading"), e.what());
}
@@ -278,14 +294,17 @@ void LoadMechanism::activate(EMechanism mechanism)
{
switch (mechanism) {
case LOAD_MODORGANIZER: {
+ qDebug("Load Mechanism: Mod Organizer");
deactivateProxyDLL();
deactivateScriptExtender();
} break;
case LOAD_SCRIPTEXTENDER: {
+ qDebug("Load Mechanism: ScriptExtender");
deactivateProxyDLL();
activateScriptExtender();
} break;
case LOAD_PROXYDLL: {
+ qDebug("Load Mechanism: Proxy DLL");
deactivateScriptExtender();
activateProxyDLL();
} break;
diff --git a/src/shared/appconfig.inc b/src/shared/appconfig.inc
index ac6c210f..e98757d3 100644
--- a/src/shared/appconfig.inc
+++ b/src/shared/appconfig.inc
@@ -14,6 +14,8 @@ APPPARAM(std::wstring, iniFileName, L"ModOrganizer.ini")
APPPARAM(std::wstring, proxyDLLTarget, L"steam_api.dll")
APPPARAM(std::wstring, proxyDLLOrig, L"steam_api_orig.dll") // needs to be identical to the value used in proxydll-project
APPPARAM(std::wstring, proxyDLLSource, L"proxy.dll")
+APPPARAM(std::wstring, vfs32DLLName, L"usvfs_x86.dll")
+APPPARAM(std::wstring, vfs64DLLName, L"usvfs_x64.dll")
APPPARAM(const wchar_t*, localSavePlaceholder, L"__MOProfileSave__\\")
APPPARAM(std::wstring, firstStepsTutorial, L"tutorial_firststeps_main.js")