diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2024-06-09 11:00:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-09 11:00:13 +0200 |
| commit | c43535f5bcf1043c3b9c00c77967267cf1acf60f (patch) | |
| tree | 455ed246fb7d6460c069573ad433e7b4cd667d17 | |
| parent | 3d18f0cd38dc8b7dc980772f986944e5f9327dba (diff) | |
Update for new USVFS function scheme. (#2044)
* Update for new USVFS function scheme.
* Fix call to usvfsVersionString().
* Move USVFS to mo2 dependencies instead of third party in CI.
| -rw-r--r-- | .github/workflows/build.yml | 4 | ||||
| -rw-r--r-- | src/shared/util.cpp | 23 | ||||
| -rw-r--r-- | src/spawn.cpp | 6 | ||||
| -rw-r--r-- | src/usvfsconnector.cpp | 34 |
4 files changed, 23 insertions, 44 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5aade280..89f3bc7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,5 +16,5 @@ jobs: qt-modules: qtpositioning qtwebchannel qtwebengine qtwebsockets mo2-third-parties: 7z zlib gtest libbsarch libloot openssl bzip2 python lz4 spdlog - boost boost-di sip pyqt pybind11 ss licenses explorerpp usvfs - mo2-dependencies: cmake_common uibase githubpp bsatk esptk archive lootcli game_gamebryo + boost boost-di sip pyqt pybind11 ss licenses explorerpp + mo2-dependencies: usvfs cmake_common uibase githubpp bsatk esptk archive lootcli game_gamebryo diff --git a/src/shared/util.cpp b/src/shared/util.cpp index c3b4d7aa..55a76c23 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -246,31 +246,10 @@ VersionInfo createVersionInfo() QString getUsvfsDLLVersion() { - // once 2.2.2 is released, this can be changed to call USVFSVersionString() - // directly; until then, using GetProcAddress() allows for mixing up devbuilds - // and usvfs dlls - - using USVFSVersionStringType = const char* WINAPI(); - - QString s; - - const auto m = ::LoadLibraryW(L"usvfs_x64.dll"); - - if (m) { - auto* f = reinterpret_cast<USVFSVersionStringType*>( - ::GetProcAddress(m, "USVFSVersionString")); - - if (f) { - s = f(); - } - - ::FreeLibrary(m); - } - + QString s = usvfsVersionString(); if (s.isEmpty()) { s = "?"; } - return s; } diff --git a/src/spawn.cpp b/src/spawn.cpp index ae5c86ee..83ac720e 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -457,9 +457,9 @@ DWORD spawn(const SpawnParameters& sp, HANDLE& processHandle) const DWORD flags = CREATE_BREAKAWAY_FROM_JOB; if (sp.hooked) { - success = ::CreateProcessHooked(nullptr, const_cast<wchar_t*>(wcommandLine.c_str()), - nullptr, nullptr, inheritHandles, flags, nullptr, - wcwd.c_str(), &si, &pi); + success = ::usvfsCreateProcessHooked( + nullptr, const_cast<wchar_t*>(wcommandLine.c_str()), nullptr, nullptr, + inheritHandles, flags, nullptr, wcwd.c_str(), &si, &pi); } else { success = ::CreateProcess(nullptr, const_cast<wchar_t*>(wcommandLine.c_str()), nullptr, nullptr, inheritHandles, flags, nullptr, diff --git a/src/usvfsconnector.cpp b/src/usvfsconnector.cpp index 940d0942..4a54f9fd 100644 --- a/src/usvfsconnector.cpp +++ b/src/usvfsconnector.cpp @@ -70,7 +70,7 @@ void LogWorker::process() int noLogCycles = 0; while (!m_QuitRequested) { - if (GetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) { + if (usvfsGetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) { m_LogFile.write(m_Buffer.c_str()); m_LogFile.write("\n"); m_LogFile.flush(); @@ -142,7 +142,7 @@ UsvfsConnector::UsvfsConnector() usvfsSetCrashDumpPath(params, dumpPath.c_str()); usvfsSetProcessDelay(params, delay.count()); - InitLogging(false); + usvfsInitLogging(false); log::debug("initializing usvfs:\n" " . instance: {}\n" @@ -154,13 +154,13 @@ UsvfsConnector::UsvfsConnector() usvfsCreateVFS(params); usvfsFreeParameters(params); - ClearExecutableBlacklist(); + usvfsClearExecutableBlacklist(); for (auto exec : s.executablesBlacklist().split(";")) { std::wstring buf = exec.toStdWString(); - BlacklistExecutable(buf.data()); + usvfsBlacklistExecutable(buf.data()); } - ClearLibraryForceLoads(); + usvfsClearLibraryForceLoads(); m_LogWorker.moveToThread(&m_WorkerThread); @@ -172,7 +172,7 @@ UsvfsConnector::UsvfsConnector() UsvfsConnector::~UsvfsConnector() { - DisconnectVFS(); + usvfsDisconnectVFS(); m_LogWorker.exit(); m_WorkerThread.quit(); m_WorkerThread.wait(); @@ -193,11 +193,11 @@ void UsvfsConnector::updateMapping(const MappingType& mapping) log::debug("Updating VFS mappings..."); - ClearVirtualMappings(); + usvfsClearVirtualMappings(); for (auto map : mapping) { if (progress.wasCanceled()) { - ClearVirtualMappings(); + usvfsClearVirtualMappings(); throw UsvfsConnectorException("VFS mapping canceled by user"); } progress.setValue(value++); @@ -206,13 +206,13 @@ void UsvfsConnector::updateMapping(const MappingType& mapping) } if (map.isDirectory) { - VirtualLinkDirectoryStatic( + usvfsVirtualLinkDirectoryStatic( map.source.toStdWString().c_str(), map.destination.toStdWString().c_str(), (map.createTarget ? LINKFLAG_CREATETARGET : 0) | LINKFLAG_RECURSIVE); ++dirs; } else { - VirtualLinkFile(map.source.toStdWString().c_str(), - map.destination.toStdWString().c_str(), 0); + usvfsVirtualLinkFile(map.source.toStdWString().c_str(), + map.destination.toStdWString().c_str(), 0); ++files; } } @@ -243,21 +243,21 @@ void UsvfsConnector::updateParams(MOBase::log::Levels logLevel, usvfsUpdateParameters(p); usvfsFreeParameters(p); - ClearExecutableBlacklist(); + usvfsClearExecutableBlacklist(); for (auto exec : executableBlacklist.split(";")) { std::wstring buf = exec.toStdWString(); - BlacklistExecutable(buf.data()); + usvfsBlacklistExecutable(buf.data()); } } void UsvfsConnector::updateForcedLibraries( const QList<MOBase::ExecutableForcedLoadSetting>& forcedLibraries) { - ClearLibraryForceLoads(); + usvfsClearLibraryForceLoads(); for (auto setting : forcedLibraries) { if (setting.enabled()) { - ForceLoadLibrary(setting.process().toStdWString().data(), - setting.library().toStdWString().data()); + usvfsForceLoadLibrary(setting.process().toStdWString().data(), + setting.library().toStdWString().data()); } } } @@ -269,7 +269,7 @@ std::vector<HANDLE> getRunningUSVFSProcesses() { size_t count = 0; DWORD* buffer = nullptr; - if (!::GetVFSProcessList2(&count, &buffer)) { + if (!::usvfsGetVFSProcessList2(&count, &buffer)) { log::error("failed to get usvfs process list"); return {}; } |
