summaryrefslogtreecommitdiff
path: root/src/loadmechanism.cpp
diff options
context:
space:
mode:
authorBrian Munro <brian.alexander.munro@gmail.com>2017-10-30 12:41:05 +0200
committerGitHub <noreply@github.com>2017-10-30 12:41:05 +0200
commitd15262b903f5d9fb0fb5ad0ebd2c0d9703eaaeb0 (patch)
treed81eef71631ec7a80d86eb62f4475eca93468af4 /src/loadmechanism.cpp
parentcabffa23a9b1ec053a7a573ed71883c44d7a5b6a (diff)
parent88452e5d76467fc687a9c4d6b6aaf7381d2463e1 (diff)
Merge pull request #113 from Silarn/mainline_dev
Updates for script extender usvfs loading
Diffstat (limited to 'src/loadmechanism.cpp')
-rw-r--r--src/loadmechanism.cpp45
1 files changed, 32 insertions, 13 deletions
diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp
index 35aedfed..a2050512 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;