From 495846534d560f825819b7ee391e8c461ce76e4f Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 7 Dec 2015 20:09:34 +0100 Subject: - no longer displaying "not logged in". This was too confusing for some - fixed files missing from vfs if parent directory exists in real destination dir - implemented plugin api to access current profile - steam game detection now also works for 64-bit games - removed reference to archive tab from tutorial - usvfs log level is now taken from config - some cleanup --- src/organizercore.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 83d468ef..89cdd4e6 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -13,6 +13,7 @@ #include "nxmaccessmanager.h" #include #include +#include #include #include #include @@ -279,7 +280,9 @@ bool OrganizerCore::testForSteam() bool success = false; while (!success) { processIDs.reset(new DWORD[currentSize]); - if (!::EnumProcesses(processIDs.get(), currentSize * sizeof(DWORD), &bytesReturned)) { + if (!::EnumProcesses(processIDs.get(), + static_cast(currentSize) * sizeof(DWORD), + &bytesReturned)) { qWarning("failed to determine if steam is running"); return true; } @@ -532,6 +535,11 @@ void OrganizerCore::createDefaultProfile() } } +void OrganizerCore::prepareVFS() +{ + m_USVFS.updateMapping(fileMapping()); +} + void OrganizerCore::setCurrentProfile(const QString &profileName) { if ((m_CurrentProfile != nullptr) && @@ -991,7 +999,7 @@ HANDLE OrganizerCore::spawnBinaryDirect(const QFileInfo &binary, const QString & // TODO: should also pass arguments if (m_AboutToRun(binary.absoluteFilePath())) { m_USVFS.updateMapping(fileMapping()); - return startBinary(binary, arguments, profileName, m_Settings.logLevel(), currentDirectory, true); + return startBinary(binary, arguments, currentDirectory, true); } else { qDebug("start of \"%s\" canceled by plugin", qPrintable(binary.absoluteFilePath())); return INVALID_HANDLE_VALUE; @@ -1562,16 +1570,35 @@ void OrganizerCore::prepareStart() { std::vector OrganizerCore::fileMapping() { + // need to wait until directory structure + while (m_DirectoryUpdate) { + ::Sleep(100); + QCoreApplication::processEvents(); + } + IPluginGame *game = qApp->property("managed_game").value(); MappingType result = fileMapping( QDir::toNativeSeparators(game->dataDirectory().absolutePath()), "\\", directoryStructure(), directoryStructure()); + if (m_CurrentProfile->localSavesEnabled()) { + LocalSavegames *localSaves = game->feature(); + + if (localSaves != nullptr) { + MappingType saveMap = localSaves->mappings(currentProfile()->absolutePath() + "/saves"); + result.reserve(result.size() + saveMap.size()); + result.insert(result.end(), saveMap.begin(), saveMap.end()); + } + } + for (MOBase::IPluginFileMapper *mapper : m_PluginContainer->plugins()) { - MappingType pluginMap = mapper->mappings(); - result.reserve(result.size() + pluginMap.size()); - result.insert(result.end(), pluginMap.begin(), pluginMap.end()); + IPlugin *plugin = dynamic_cast(mapper); + if (plugin->isActive()) { + MappingType pluginMap = mapper->mappings(); + result.reserve(result.size() + pluginMap.size()); + result.insert(result.end(), pluginMap.begin(), pluginMap.end()); + } } return result; @@ -1607,9 +1634,10 @@ std::vector OrganizerCore::fileMapping( directoryEntry->getSubDirectories(current, end); for (; current != end; ++current) { int origin = (*current)->anyOrigin(); + /* if (origin == 0) { continue; - } + }*/ QString originPath = QString::fromStdWString(base->getOriginByID(origin).getPath()); -- cgit v1.3.1