summaryrefslogtreecommitdiff
path: root/src/organizercore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/organizercore.cpp')
-rw-r--r--src/organizercore.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index c4029a6d..39cb4d13 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -1199,10 +1199,15 @@ QStringList OrganizerCore::modsSortedByProfilePriority() const
return res;
}
-void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &arguments, const QDir &currentDirectory, const QString &steamAppID, const QString &customOverwrite)
+void OrganizerCore::spawnBinary(const QFileInfo &binary,
+ const QString &arguments,
+ const QDir &currentDirectory,
+ const QString &steamAppID,
+ const QString &customOverwrite,
+ const QList<MOBase::ExecutableForcedLoadSetting> &forcedLibraries)
{
DWORD processExitCode = 0;
- HANDLE processHandle = spawnBinaryDirect(binary, arguments, m_CurrentProfile->name(), currentDirectory, steamAppID, customOverwrite, &processExitCode);
+ HANDLE processHandle = spawnBinaryDirect(binary, arguments, m_CurrentProfile->name(), currentDirectory, steamAppID, customOverwrite, forcedLibraries, &processExitCode);
if (processHandle != INVALID_HANDLE_VALUE) {
refreshDirectoryStructure();
// need to remove our stored load order because it may be outdated if a foreign tool changed the
@@ -1227,9 +1232,10 @@ HANDLE OrganizerCore::spawnBinaryDirect(const QFileInfo &binary,
const QDir &currentDirectory,
const QString &steamAppID,
const QString &customOverwrite,
+ const QList<MOBase::ExecutableForcedLoadSetting> &forcedLibraries,
LPDWORD exitCode)
{
- HANDLE processHandle = spawnBinaryProcess(binary, arguments, profileName, currentDirectory, steamAppID, customOverwrite);
+ HANDLE processHandle = spawnBinaryProcess(binary, arguments, profileName, currentDirectory, steamAppID, customOverwrite, forcedLibraries);
if (Settings::instance().lockGUI() && processHandle != INVALID_HANDLE_VALUE) {
std::unique_ptr<LockedDialog> dlg;
ILockedWaitingForProcess* uilock = nullptr;
@@ -1264,7 +1270,8 @@ HANDLE OrganizerCore::spawnBinaryProcess(const QFileInfo &binary,
const QString &profileName,
const QDir &currentDirectory,
const QString &steamAppID,
- const QString &customOverwrite)
+ const QString &customOverwrite,
+ const QList<MOBase::ExecutableForcedLoadSetting> &forcedLibraries)
{
prepareStart();
@@ -1324,6 +1331,8 @@ HANDLE OrganizerCore::spawnBinaryProcess(const QFileInfo &binary,
if (m_AboutToRun(binary.absoluteFilePath())) {
try {
m_USVFS.updateMapping(fileMapping(profileName, customOverwrite));
+ m_USVFS.updateForcedLibraries(forcedLibraries);
+
} catch (const UsvfsConnectorException &e) {
qDebug(e.what());
return INVALID_HANDLE_VALUE;
@@ -1416,6 +1425,10 @@ HANDLE OrganizerCore::runShortcut(const MOShortcut& shortcut)
.toLocal8Bit().constData());
Executable& exe = m_ExecutablesList.find(shortcut.executable());
+ auto forcedLibaries = m_CurrentProfile->determineForcedLibraries(shortcut.executable());
+ if (!m_CurrentProfile->forcedLibrariesEnabled(exe.m_BinaryInfo.fileName())) {
+ forcedLibaries.clear();
+ }
return spawnBinaryDirect(
exe.m_BinaryInfo, exe.m_Arguments,
@@ -1423,7 +1436,9 @@ HANDLE OrganizerCore::runShortcut(const MOShortcut& shortcut)
exe.m_WorkingDirectory.length() != 0
? exe.m_WorkingDirectory
: exe.m_BinaryInfo.absolutePath(),
- exe.m_SteamAppID, "");
+ exe.m_SteamAppID,
+ "",
+ forcedLibaries);
}
HANDLE OrganizerCore::startApplication(const QString &executable,
@@ -1444,6 +1459,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
}
QString steamAppID;
QString customOverwrite;
+ QList<ExecutableForcedLoadSetting> forcedLibraries;
if (executable.contains('\\') || executable.contains('/')) {
// file path
@@ -1462,6 +1478,9 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
customOverwrite
= m_CurrentProfile->setting("custom_overwrites", exe.m_Title)
.toString();
+ if (m_CurrentProfile->forcedLibrariesEnabled(exe.m_Title)) {
+ forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.m_Title);
+ }
} catch (const std::runtime_error &) {
// nop
}
@@ -1473,6 +1492,9 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
customOverwrite
= m_CurrentProfile->setting("custom_overwrites", exe.m_Title)
.toString();
+ if (m_CurrentProfile->forcedLibrariesEnabled(exe.m_Title)) {
+ forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.m_Title);
+ }
if (arguments == "") {
arguments = exe.m_Arguments;
}
@@ -1487,7 +1509,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
}
}
- return spawnBinaryDirect(binary, arguments, profileName, currentDirectory, steamAppID, customOverwrite);
+ return spawnBinaryDirect(binary, arguments, profileName, currentDirectory, steamAppID, customOverwrite, forcedLibraries);
}
bool OrganizerCore::waitForApplication(HANDLE handle, LPDWORD exitCode)