From d659ad7294af2bc67a3b569dc90a7920f5469b07 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Thu, 26 Oct 2017 16:28:15 -0500 Subject: Update master parsing and detect ESLs by extension --- src/organizer_en.ts | 173 +++++++++++++++++++++++++--------------------------- src/pluginlist.cpp | 26 ++++---- 2 files changed, 98 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 15785d1f..f8e6ffaa 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -2989,227 +2989,227 @@ p, li { white-space: pre-wrap; } - + &Delete - + &Rename - + &Hide - + &Unhide - + &Open - + &New Folder - - + + Save changes? - - + + Save changes to "%1"? - + File Exists - + A file with that name exists, please enter a new one - + failed to move file - + failed to create directory "optional" - - + + Info requested, please wait - + Main - + Update - + Optional - + Old - + Misc - + Unknown - + Current Version: %1 - + No update available - + (description incomplete, please visit nexus) - + <a href="%1">Visit on Nexus</a> - + Failed to delete %1 - - + + Confirm - + Are sure you want to delete "%1"? - + Are sure you want to delete the selected files? - - + + New Folder - + Failed to create "%1" - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - - + + failed to rename %1 to %2 - + There already is a visible version of this file. Replace it? - + Un-Hide - + Hide - + Name - + Please enter a name - - + + Error - + Invalid name. Must be a valid file name - + A tweak by that name exists - + Create Tweak @@ -4769,52 +4769,52 @@ Start elevated anyway? (you will be asked if you want to allow ModOrganizer.exe - + New update available (%1) - + Install - + Download failed - + Failed to find correct download, please try again later. - + Update - + Download in progress - + Download failed: %1 - + Failed to install update: %1 - + Failed to start %1: %2 - + Error @@ -5919,113 +5919,108 @@ Please open the "Nexus"-tab tutorial_primer_main - + This window shows all the mods that are installed. The column headers can be used for sorting. Only checked mods are active in the current profile. - + Each profile is a separate set of enabled mods and ini settings. - + The dropdown allows various ways of grouping the mods shown in the mod list. - + Show/hide the category pane. - + Quickly filter the mod list as you type. - + Switch between information views. - + This shows mod categories and some meta categories (in angle-brackets). Select some to filter the mod list. For example select "<Checked>" to show only active mods. - + Customizable list for choosing the program to run. - + When this button is clicked, Mod Organizer creates a virtual directory structure then runs the program selected to the left. - + Will create a shortcut for quick access. The shortcut can be placed in the toolbar at the top, in the Start Menu or on the Windows Desktop. - + Log messages produced by MO. Please note that messages with a light bulb usually don't require your attention. - + Configure Mod Organizer. - + Reports potential Problems about the current setup. - + Activates if there is an update for MO. Please note that if, for any reason, MO can't communicate with NMM, this will not work either. - + Plugins (esp/esm/esl files) of the mods in the current profile. They need to be checked to be loaded. Plugins (esp/esm files) of the mods in the current profile. They need to be checked to be loaded. - + Automatically sort plugins using the bundled LOOT application. - + Quickly filter plugin list as you type. - - All the asset archives (.bsa files) for all active mods. - - - - + The directory tree and all files that the program will see. - + Save game browser. Shows all the saves for the current profile and whether or not the current mod-load status is correct. - + Shows the mods that have been downloaded and if they’ve been installed. - + Click to quit diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a66a2fb4..4420bf17 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -686,18 +686,18 @@ void PluginList::testMasters() // emit layoutAboutToBeChanged(); std::set enabledMasters; - for (auto iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { - if (iter->m_Enabled) { - enabledMasters.insert(iter->m_Name.toLower()); + for (const auto& iter: m_ESPs) { + if (iter.m_Enabled) { + enabledMasters.insert(iter.m_Name.toLower()); } } - for (auto iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { - iter->m_MasterUnset.clear(); - if (iter->m_Enabled) { - for (auto master = iter->m_Masters.begin(); master != iter->m_Masters.end(); ++master) { - if (enabledMasters.find(master->toLower()) == enabledMasters.end()) { - iter->m_MasterUnset.insert(*master); + for (auto& iter: m_ESPs) { + iter.m_MasterUnset.clear(); + if (iter.m_Enabled) { + for (const auto& master: iter.m_Masters) { + if (enabledMasters.find(master.toLower()) == enabledMasters.end()) { + iter.m_MasterUnset.insert(master); } } } @@ -1138,8 +1138,10 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, { try { ESP::File file(ToWString(fullPath)); - m_IsMaster = file.isMaster() && !file.isLight(); - m_IsLight = file.isLight(); + m_IsMaster = file.isMaster(); + auto extension = name.right(3).toLower(); + m_IsLight = (extension == "esl"); // The .isLight() header is apparently meaningless. + m_Author = QString::fromLatin1(file.author().c_str()); m_Description = QString::fromLatin1(file.description().c_str()); std::set masters = file.masters(); @@ -1147,7 +1149,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, m_Masters.insert(QString(iter->c_str())); } } catch (const std::exception &e) { - qCritical("failed to parse esp file %s: %s", qPrintable(fullPath), e.what()); + qCritical("failed to parse plugin file %s: %s", qPrintable(fullPath), e.what()); m_IsMaster = false; m_IsLight = false; } -- cgit v1.3.1 From 88452e5d76467fc687a9c4d6b6aaf7381d2463e1 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sun, 29 Oct 2017 19:34:35 -0500 Subject: Reimplement ScriptExtender handling by detecting USVFS arch --- src/loadmechanism.cpp | 45 ++++++++++++++++++++++++++++++++------------- src/shared/appconfig.inc | 2 ++ 2 files changed, 34 insertions(+), 13 deletions(-) (limited to 'src') 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") -- cgit v1.3.1