summaryrefslogtreecommitdiff
path: root/src/organizercore.cpp
diff options
context:
space:
mode:
authorTannin <sherb@gmx.net>2015-12-07 20:09:34 +0100
committerTannin <sherb@gmx.net>2015-12-07 20:09:34 +0100
commit495846534d560f825819b7ee391e8c461ce76e4f (patch)
treecd6b5c03cce72aaba8489ea61876313829c44a3a /src/organizercore.cpp
parentfe8c3aaea58400425b9195bb670a1b4e8c9db10d (diff)
- 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
Diffstat (limited to 'src/organizercore.cpp')
-rw-r--r--src/organizercore.cpp40
1 files changed, 34 insertions, 6 deletions
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 <ipluginmodpage.h>
#include <dataarchives.h>
+#include <localsavegames.h>
#include <directoryentry.h>
#include <scopeguard.h>
#include <utility.h>
@@ -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<DWORD>(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<Mapping> OrganizerCore::fileMapping()
{
+ // need to wait until directory structure
+ while (m_DirectoryUpdate) {
+ ::Sleep(100);
+ QCoreApplication::processEvents();
+ }
+
IPluginGame *game = qApp->property("managed_game").value<IPluginGame *>();
MappingType result = fileMapping(
QDir::toNativeSeparators(game->dataDirectory().absolutePath()),
"\\",
directoryStructure(), directoryStructure());
+ if (m_CurrentProfile->localSavesEnabled()) {
+ LocalSavegames *localSaves = game->feature<LocalSavegames>();
+
+ 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<MOBase::IPluginFileMapper>()) {
- MappingType pluginMap = mapper->mappings();
- result.reserve(result.size() + pluginMap.size());
- result.insert(result.end(), pluginMap.begin(), pluginMap.end());
+ IPlugin *plugin = dynamic_cast<IPlugin*>(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<Mapping> 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());