diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/src/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/src/aboutdialog.cpp | 3 | ||||
| -rw-r--r-- | src/src/aboutdialog.ui | 2 | ||||
| -rw-r--r-- | src/src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/src/moapplication.cpp | 5 | ||||
| -rw-r--r-- | src/src/organizercore.cpp | 4 | ||||
| -rw-r--r-- | src/src/organizercore.h | 8 | ||||
| -rw-r--r-- | src/src/settings.h | 3 | ||||
| -rw-r--r-- | src/src/shared/appconfig.inc | 2 | ||||
| -rw-r--r-- | src/src/shared/util.cpp | 39 | ||||
| -rw-r--r-- | src/src/shared/util.h | 1 | ||||
| -rw-r--r-- | src/src/spawn.cpp | 1 | ||||
| -rw-r--r-- | src/src/usvfsconnector.cpp | 342 | ||||
| -rw-r--r-- | src/src/usvfsconnector.h | 102 |
14 files changed, 5 insertions, 516 deletions
diff --git a/src/src/CMakeLists.txt b/src/src/CMakeLists.txt index d618af7..c22442c 100644 --- a/src/src/CMakeLists.txt +++ b/src/src/CMakeLists.txt @@ -55,11 +55,6 @@ list(APPEND ORGANIZER_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/settingsdialogproton.h ${CMAKE_CURRENT_SOURCE_DIR}/wineprefix.h) -# Remove Windows-only sources (replaced by Linux equivalents) -list(REMOVE_ITEM ORGANIZER_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/usvfsconnector.cpp) -list(REMOVE_ITEM ORGANIZER_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/usvfsconnector.h) # Remove WebEngine-dependent sources when not available if(NOT Qt6WebEngineWidgets_FOUND) diff --git a/src/src/aboutdialog.cpp b/src/src/aboutdialog.cpp index 7c95990..94ccfcb 100644 --- a/src/src/aboutdialog.cpp +++ b/src/src/aboutdialog.cpp @@ -90,8 +90,7 @@ AboutDialog::AboutDialog(const QString& version, QWidget* parent) ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
- ui->usvfsLabel->setText(ui->usvfsLabel->text() + " " +
- MOShared::getUsvfsVersionString());
+ ui->usvfsLabel->setText(ui->usvfsLabel->text() + " FUSE 3");
ui->licenseText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
}
diff --git a/src/src/aboutdialog.ui b/src/src/aboutdialog.ui index 323e20a..042bdd8 100644 --- a/src/src/aboutdialog.ui +++ b/src/src/aboutdialog.ui @@ -107,7 +107,7 @@ <item>
<widget class="QLabel" name="usvfsLabel">
<property name="text">
- <string>usvfs:</string>
+ <string>VFS:</string>
</property>
</widget>
</item>
diff --git a/src/src/mainwindow.cpp b/src/src/mainwindow.cpp index f2ce67b..d61273c 100644 --- a/src/src/mainwindow.cpp +++ b/src/src/mainwindow.cpp @@ -81,11 +81,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <uibase/tutorialmanager.h>
#include <uibase/utility.h>
#include <uibase/versioninfo.h>
-#ifdef _WIN32
-#include <usvfs/usvfs.h>
-#else
#include "fluorinepaths.h"
-#endif
#include "directoryrefresher.h"
#include "shared/directoryentry.h"
diff --git a/src/src/moapplication.cpp b/src/src/moapplication.cpp index 45b79a8..96d9854 100644 --- a/src/src/moapplication.cpp +++ b/src/src/moapplication.cpp @@ -319,9 +319,8 @@ int MOApplication::setup(MOMultiProcess& multiProcess, bool forceSelect) #ifndef GITID
#define GITID "unknown"
#endif
- log::info("starting Mod Organizer version {} revision {} in {}, usvfs: {}",
- createVersionInfo().string(), GITID, QCoreApplication::applicationDirPath(),
- MOShared::getUsvfsVersionString());
+ log::info("starting Mod Organizer version {} revision {} in {}",
+ createVersionInfo().string(), GITID, QCoreApplication::applicationDirPath());
if (multiProcess.secondary()) {
log::debug("another instance of MO is running but --multiple was given");
diff --git a/src/src/organizercore.cpp b/src/src/organizercore.cpp index 3e3e7c9..0e1219d 100644 --- a/src/src/organizercore.cpp +++ b/src/src/organizercore.cpp @@ -39,12 +39,8 @@ #include <uibase/scopeguard.h>
#include <uibase/filesystemutilities.h>
#include <uibase/utility.h>
-#ifdef _WIN32
-#include <usvfs/usvfs.h>
-#else
#include "fluorineconfig.h"
#include "wineprefix.h"
-#endif
#include <chrono>
#include <cstdio>
diff --git a/src/src/organizercore.h b/src/src/organizercore.h index 99b0d86..dc3547e 100644 --- a/src/src/organizercore.h +++ b/src/src/organizercore.h @@ -35,11 +35,7 @@ #include "selfupdater.h"
#include "settings.h"
#include "uilocker.h"
-#ifdef _WIN32
-#include "usvfsconnector.h"
-#else
#include "fuseconnector.h"
-#endif
class ModListSortProxy;
class PluginListSortProxy;
@@ -596,11 +592,7 @@ private: bool m_ArchivesInit;
MOBase::DelayedFileWriter m_PluginListsWriter;
-#ifdef _WIN32
- UsvfsConnector m_USVFS;
-#else
FuseConnector m_USVFS;
-#endif
UILocker m_UILocker;
};
diff --git a/src/src/settings.h b/src/src/settings.h index f1ea342..a4a9e89 100644 --- a/src/src/settings.h +++ b/src/src/settings.h @@ -25,9 +25,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <questionboxmemory.h>
#include <uibase/filterwidget.h>
#include <uibase/log.h>
-#ifdef _WIN32
-#include <usvfs/usvfsparameters.h>
-#endif
#ifdef interface
#undef interface
diff --git a/src/src/shared/appconfig.inc b/src/src/shared/appconfig.inc index 9058bf1..ede9380 100644 --- a/src/src/shared/appconfig.inc +++ b/src/src/shared/appconfig.inc @@ -16,8 +16,6 @@ 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(std::wstring, nxmHandlerExe, L"nxmhandler.exe")
APPPARAM(std::wstring, nxmHandlerIni, L"nxmhandler.ini")
APPPARAM(std::wstring, portableLockFileName, L"portable.txt")
diff --git a/src/src/shared/util.cpp b/src/src/shared/util.cpp index 70c0aeb..b1df0a6 100644 --- a/src/src/shared/util.cpp +++ b/src/src/shared/util.cpp @@ -22,10 +22,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "../mainwindow.h"
#include "windows_error.h"
#include <uibase/log.h>
-#ifdef _WIN32
-#include <usvfs/usvfs.h>
-#include <usvfs/usvfs_version.h>
-#else
+#ifndef _WIN32
#include <pthread.h>
#include <filesystem>
#include <algorithm>
@@ -326,40 +323,6 @@ Version createVersionInfo() }
#endif
-#ifdef _WIN32
-QString getUsvfsDLLVersion()
-{
- QString s = usvfsVersionString();
- if (s.isEmpty()) {
- s = "?";
- }
- return s;
-}
-
-QString getUsvfsVersionString()
-{
- const QString dll = getUsvfsDLLVersion();
- const QString header = USVFS_VERSION_STRING;
-
- QString usvfsVersion;
-
- if (dll == header) {
- return dll;
- } else {
- return "dll is " + dll + ", compiled against " + header;
- }
-}
-#else
-QString getUsvfsDLLVersion()
-{
- return "N/A (Linux)";
-}
-
-QString getUsvfsVersionString()
-{
- return "N/A (Linux - using FUSE VFS)";
-}
-#endif
#ifdef _WIN32
void SetThisThreadName(const QString& s)
diff --git a/src/src/shared/util.h b/src/src/shared/util.h index c0dce75..fdb59d8 100644 --- a/src/src/shared/util.h +++ b/src/src/shared/util.h @@ -56,7 +56,6 @@ std::wstring ToLowerCopy(std::wstring_view text); bool CaseInsensitiveEqual(const std::wstring& lhs, const std::wstring& rhs);
MOBase::Version createVersionInfo();
-QString getUsvfsVersionString();
void SetThisThreadName(const QString& s);
void checkDuplicateShortcuts(const QMenu& m);
diff --git a/src/src/spawn.cpp b/src/src/spawn.cpp index 6cb925e..76c1787 100644 --- a/src/src/spawn.cpp +++ b/src/src/spawn.cpp @@ -40,7 +40,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "envwindows.h"
#include "shared/windows_error.h"
#include <Shellapi.h>
-#include <usvfs/usvfs.h>
#else
#include <QProcess>
#include <QStandardPaths>
diff --git a/src/src/usvfsconnector.cpp b/src/src/usvfsconnector.cpp deleted file mode 100644 index 83c1af1..0000000 --- a/src/src/usvfsconnector.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/*
-Copyright (C) 2015 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "usvfsconnector.h"
-#include "envmodule.h"
-#include "organizercore.h"
-#include "settings.h"
-#include "shared/util.h"
-#include <QCoreApplication>
-#include <QDateTime>
-#include <QProgressDialog>
-#include <QTemporaryFile>
-#include <iomanip>
-#include <memory>
-#include <qstandardpaths.h>
-#include <sstream>
-#include <usvfs/usvfs.h>
-
-static const char SHMID[] = "mod_organizer_instance";
-using namespace MOBase;
-
-std::string to_hex(void* bufferIn, size_t bufferSize)
-{
- unsigned char* buffer = static_cast<unsigned char*>(bufferIn);
- std::ostringstream temp;
- temp << std::hex;
- for (size_t i = 0; i < bufferSize; ++i) {
- temp << std::setfill('0') << std::setw(2) << (unsigned int)buffer[i];
- if ((i % 16) == 15) {
- temp << "\n";
- } else {
- temp << " ";
- }
- }
- return temp.str();
-}
-
-LogWorker::LogWorker()
- : m_Buffer(1024, '\0'), m_QuitRequested(false),
- m_LogFile(
- qApp->property("dataPath").toString() +
- QString("/logs/usvfs-%1.log")
- .arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd_hh-mm-ss")))
-{
- m_LogFile.open(QIODevice::WriteOnly);
- log::debug("usvfs log messages are written to {}", m_LogFile.fileName());
-}
-
-LogWorker::~LogWorker() {}
-
-void LogWorker::process()
-{
- MOShared::SetThisThreadName("LogWorker");
-
- int noLogCycles = 0;
- while (!m_QuitRequested) {
- if (usvfsGetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) {
- m_LogFile.write(m_Buffer.c_str());
- m_LogFile.write("\n");
- m_LogFile.flush();
- noLogCycles = 0;
- } else {
- QThread::msleep(std::min(40, noLogCycles) * 5);
- ++noLogCycles;
- }
- }
- emit finished();
-}
-
-void LogWorker::exit()
-{
- m_QuitRequested = true;
-}
-
-LogLevel toUsvfsLogLevel(log::Levels level)
-{
- switch (level) {
- case log::Info:
- return LogLevel::Info;
- case log::Warning:
- return LogLevel::Warning;
- case log::Error:
- return LogLevel::Error;
- case log::Debug: // fall-through
- default:
- return LogLevel::Debug;
- }
-}
-
-CrashDumpsType toUsvfsCrashDumpsType(env::CoreDumpTypes type)
-{
- switch (type) {
- case env::CoreDumpTypes::None:
- return CrashDumpsType::None;
-
- case env::CoreDumpTypes::Data:
- return CrashDumpsType::Data;
-
- case env::CoreDumpTypes::Full:
- return CrashDumpsType::Full;
-
- case env::CoreDumpTypes::Mini:
- default:
- return CrashDumpsType::Mini;
- }
-}
-
-UsvfsConnector::UsvfsConnector()
-{
- using namespace std::chrono;
-
- const auto& s = Settings::instance();
-
- const LogLevel logLevel = toUsvfsLogLevel(s.diagnostics().logLevel());
- const auto dumpType = toUsvfsCrashDumpsType(s.diagnostics().coreDumpType());
- const auto delay = duration_cast<milliseconds>(s.diagnostics().spawnDelay());
- std::string dumpPath =
- MOShared::ToString(OrganizerCore::getGlobalCoreDumpPath(), true);
-
- usvfsParameters* params = usvfsCreateParameters();
-
- usvfsSetInstanceName(params, SHMID);
- usvfsSetDebugMode(params, false);
- usvfsSetLogLevel(params, logLevel);
- usvfsSetCrashDumpType(params, dumpType);
- usvfsSetCrashDumpPath(params, dumpPath.c_str());
- usvfsSetProcessDelay(params, delay.count());
-
- usvfsInitLogging(false);
-
- log::debug("initializing usvfs:\n"
- " . instance: {}\n"
- " . log: {}\n"
- " . dump: {} ({})",
- SHMID, usvfsLogLevelToString(logLevel), dumpPath.c_str(),
- usvfsCrashDumpTypeToString(dumpType));
-
- usvfsCreateVFS(params);
- usvfsFreeParameters(params);
-
- usvfsClearExecutableBlacklist();
- for (auto exec : s.executablesBlacklist().split(";")) {
- std::wstring buf = exec.toStdWString();
- usvfsBlacklistExecutable(buf.data());
- }
-
- usvfsClearSkipFileSuffixes();
- for (auto& suffix : s.skipFileSuffixes()) {
- if (suffix.isEmpty()) {
- continue;
- }
- std::wstring buf = suffix.toStdWString();
- usvfsAddSkipFileSuffix(buf.data());
- }
-
- usvfsClearSkipDirectories();
- for (auto& dir : s.skipDirectories()) {
- std::wstring buf = dir.toStdWString();
- usvfsAddSkipDirectory(buf.data());
- }
-
- usvfsClearLibraryForceLoads();
-
- m_LogWorker.moveToThread(&m_WorkerThread);
-
- connect(&m_WorkerThread, SIGNAL(started()), &m_LogWorker, SLOT(process()));
- connect(&m_LogWorker, SIGNAL(finished()), &m_WorkerThread, SLOT(quit()));
-
- m_WorkerThread.start(QThread::LowestPriority);
-}
-
-UsvfsConnector::~UsvfsConnector()
-{
- usvfsDisconnectVFS();
- m_LogWorker.exit();
- m_WorkerThread.quit();
- m_WorkerThread.wait();
-}
-
-void UsvfsConnector::updateMapping(const MappingType& mapping)
-{
- const auto start = std::chrono::high_resolution_clock::now();
-
- QProgressDialog progress(qApp->activeWindow());
- progress.setLabelText(tr("Preparing vfs"));
- progress.setMaximum(static_cast<int>(mapping.size()));
- progress.show();
-
- int value = 0;
- int files = 0;
- int dirs = 0;
-
- log::debug("Updating VFS mappings...");
-
- usvfsClearVirtualMappings();
-
- for (auto map : mapping) {
- if (progress.wasCanceled()) {
- usvfsClearVirtualMappings();
- throw UsvfsConnectorException("VFS mapping canceled by user");
- }
- progress.setValue(value++);
- if (value % 10 == 0) {
- QCoreApplication::processEvents();
- }
-
- if (map.isDirectory) {
- usvfsVirtualLinkDirectoryStatic(
- map.source.toStdWString().c_str(), map.destination.toStdWString().c_str(),
- (map.createTarget ? LINKFLAG_CREATETARGET : 0) | LINKFLAG_RECURSIVE);
- ++dirs;
- } else {
- usvfsVirtualLinkFile(map.source.toStdWString().c_str(),
- map.destination.toStdWString().c_str(), 0);
- ++files;
- }
- }
-
- const auto end = std::chrono::high_resolution_clock::now();
- const auto time = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
-
- log::debug("VFS mappings updated, linked {} dirs and {} files in {}ms", dirs, files,
- time.count());
-}
-
-void UsvfsConnector::updateParams(MOBase::log::Levels logLevel,
- env::CoreDumpTypes coreDumpType,
- const QString& crashDumpsPath,
- std::chrono::seconds spawnDelay,
- QString executableBlacklist,
- const QStringList& skipFileSuffixes,
- const QStringList& skipDirectories)
-{
- using namespace std::chrono;
-
- usvfsParameters* p = usvfsCreateParameters();
-
- usvfsSetDebugMode(p, FALSE);
- usvfsSetLogLevel(p, toUsvfsLogLevel(logLevel));
- usvfsSetCrashDumpType(p, toUsvfsCrashDumpsType(coreDumpType));
- usvfsSetCrashDumpPath(p, crashDumpsPath.toStdString().c_str());
- usvfsSetProcessDelay(p, duration_cast<milliseconds>(spawnDelay).count());
-
- usvfsUpdateParameters(p);
- usvfsFreeParameters(p);
-
- usvfsClearExecutableBlacklist();
- for (auto exec : executableBlacklist.split(";")) {
- std::wstring buf = exec.toStdWString();
- usvfsBlacklistExecutable(buf.data());
- }
-
- usvfsClearSkipFileSuffixes();
- for (auto& suffix : skipFileSuffixes) {
- if (suffix.isEmpty()) {
- continue;
- }
- std::wstring buf = suffix.toStdWString();
- usvfsAddSkipFileSuffix(buf.data());
- }
-
- usvfsClearSkipDirectories();
- for (auto& dir : skipDirectories) {
- std::wstring buf = dir.toStdWString();
- usvfsAddSkipDirectory(buf.data());
- }
-}
-
-void UsvfsConnector::updateForcedLibraries(
- const QList<MOBase::ExecutableForcedLoadSetting>& forcedLibraries)
-{
- usvfsClearLibraryForceLoads();
- for (auto setting : forcedLibraries) {
- if (setting.enabled()) {
- usvfsForceLoadLibrary(setting.process().toStdWString().data(),
- setting.library().toStdWString().data());
- }
- }
-}
-
-std::vector<HANDLE> getRunningUSVFSProcesses()
-{
- std::vector<DWORD> pids;
-
- {
- size_t count = 0;
- DWORD* buffer = nullptr;
- if (!::usvfsGetVFSProcessList2(&count, &buffer)) {
- log::error("failed to get usvfs process list");
- return {};
- }
-
- if (buffer) {
- pids.assign(buffer, buffer + count);
- std::free(buffer);
- }
- }
-
- const auto thisPid = GetCurrentProcessId();
- std::vector<HANDLE> v;
-
- const auto rights =
- PROCESS_QUERY_LIMITED_INFORMATION | // exit code, image name, etc.
- SYNCHRONIZE | // wait functions
- PROCESS_SET_QUOTA | PROCESS_TERMINATE; // add to job
-
- for (auto&& pid : pids) {
- if (pid == thisPid) {
- continue; // obviously don't wait for MO process
- }
-
- HANDLE handle = ::OpenProcess(rights, FALSE, pid);
-
- if (handle == INVALID_HANDLE_VALUE) {
- const auto e = GetLastError();
-
- log::warn("failed to open usvfs process {}: {}", pid, formatSystemMessage(e));
-
- continue;
- }
-
- v.push_back(handle);
- }
-
- return v;
-}
diff --git a/src/src/usvfsconnector.h b/src/src/usvfsconnector.h deleted file mode 100644 index ce410e4..0000000 --- a/src/src/usvfsconnector.h +++ /dev/null @@ -1,102 +0,0 @@ -/*
-Copyright (C) 2015 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef USVFSCONNECTOR_H
-#define USVFSCONNECTOR_H
-
-#include "envdump.h"
-#include <QDebug>
-#include <QFile>
-#include <QList>
-#include <QString>
-#include <QThread>
-#include <exception>
-#include <uibase/executableinfo.h>
-#include <uibase/filemapping.h>
-#include <uibase/log.h>
-#include <usvfs/usvfsparameters.h>
-
-class LogWorker : public QThread
-{
-
- Q_OBJECT
-
-public:
- LogWorker();
- ~LogWorker();
-
-public slots:
-
- void process();
- void exit();
-
-signals:
-
- void outputLog(const QString& message);
- void finished();
-
-private:
- std::string m_Buffer;
- bool m_QuitRequested;
- QFile m_LogFile;
-};
-
-class UsvfsConnectorException : public std::exception
-{
-
-public:
- UsvfsConnectorException(const QString& text)
- : std::exception(), m_Message(text.toLocal8Bit())
- {}
-
- virtual const char* what() const throw() { return m_Message.constData(); }
-
-private:
- QByteArray m_Message;
-};
-
-class UsvfsConnector : public QObject
-{
-
- Q_OBJECT
-
-public:
- UsvfsConnector();
- ~UsvfsConnector();
-
- void updateMapping(const MappingType& mapping);
-
- void updateParams(MOBase::log::Levels logLevel, env::CoreDumpTypes coreDumpType,
- const QString& crashDumpsPath, std::chrono::seconds spawnDelay,
- QString executableBlacklist, const QStringList& skipFileSuffixes,
- const QStringList& skipDirectories);
-
- void updateForcedLibraries(
- const QList<MOBase::ExecutableForcedLoadSetting>& forcedLibraries);
-
-private:
- LogWorker m_LogWorker;
- QThread m_WorkerThread;
-};
-
-CrashDumpsType crashDumpsType(int type);
-
-std::vector<HANDLE> getRunningUSVFSProcesses();
-
-#endif // USVFSCONNECTOR_H
|
