From 324fa12a2d491be039c1cf720ee2786864d010bc Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 10 Oct 2019 10:25:46 -0400 Subject: uses new usvfsParameters, also updates spawn delay --- src/usvfsconnector.cpp | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'src/usvfsconnector.cpp') diff --git a/src/usvfsconnector.cpp b/src/usvfsconnector.cpp index 3ea811be..9a4fa742 100644 --- a/src/usvfsconnector.cpp +++ b/src/usvfsconnector.cpp @@ -162,15 +162,24 @@ QString toString(CrashDumpsType t) UsvfsConnector::UsvfsConnector() { + using namespace std::chrono; + const auto& s = Settings::instance(); - USVFSParameters params; - const LogLevel level = toUsvfsLogLevel(s.diagnostics().logLevel()); + const LogLevel logLevel = toUsvfsLogLevel(s.diagnostics().logLevel()); const CrashDumpsType dumpType = s.diagnostics().crashDumpsType(); - const auto delay = s.diagnostics().spawnDelay(); - + const auto delay = duration_cast(s.diagnostics().spawnDelay()); std::string dumpPath = MOShared::ToString(OrganizerCore::crashDumpsPath(), true); - USVFSInitParameters(¶ms, SHMID, false, level, dumpType, dumpPath.c_str(), delay); + + usvfsParameters* params = usvfsCreateParameters(); + + usvfsSetInstanceName(params, SHMID); + usvfsSetDebugMode(params, false); + usvfsSetLogLevel(params, logLevel); + usvfsSetCrashDumpType(params, dumpType); + usvfsSetCrashDumpPath(params, dumpPath.c_str()); + usvfsSetProcessDelay(params, delay.count()); + InitLogging(false); log::debug( @@ -178,12 +187,13 @@ UsvfsConnector::UsvfsConnector() " . instance: {}\n" " . log: {}\n" " . dump: {} ({})", - params.instanceName, - toString(params.logLevel), - params.crashDumpsPath, - toString(params.crashDumpsType)); + SHMID, + toString(logLevel), + dumpPath.c_str(), + toString(dumpType)); - CreateVFS(¶ms); + usvfsCreateVFS(params); + usvfsFreeParameters(params); ClearExecutableBlacklist(); for (auto exec : s.executablesBlacklist().split(";")) { @@ -253,9 +263,19 @@ void UsvfsConnector::updateMapping(const MappingType &mapping) void UsvfsConnector::updateParams( MOBase::log::Levels logLevel, CrashDumpsType crashDumpsType, - QString executableBlacklist) + std::chrono::seconds spawnDelay, QString executableBlacklist) { - USVFSUpdateParams(toUsvfsLogLevel(logLevel), crashDumpsType); + using namespace std::chrono; + + usvfsParameters* p = usvfsCreateParameters(); + + usvfsSetLogLevel(p, toUsvfsLogLevel(logLevel)); + usvfsSetCrashDumpType(p, crashDumpsType); + usvfsSetProcessDelay(p, duration_cast(spawnDelay).count()); + + usvfsUpdateParameters(p); + usvfsFreeParameters(p); + ClearExecutableBlacklist(); for (auto exec : executableBlacklist.split(";")) { std::wstring buf = exec.toStdWString(); -- cgit v1.3.1