From 9a7d087948fe061c7e3435130cdcba8e5dbffa15 Mon Sep 17 00:00:00 2001 From: Kenix3 Date: Wed, 11 Dec 2024 21:57:34 -0500 Subject: [PATCH] otrFiles -> archiveFiles Resolves #709 --- src/Context.cpp | 14 +++++++------- src/Context.h | 6 +++--- src/resource/ResourceManager.cpp | 6 +++--- src/resource/ResourceManager.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 9b0baeaa1..5906a86c8 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -44,13 +44,13 @@ Context::~Context() { std::shared_ptr Context::CreateInstance(const std::string name, const std::string shortName, const std::string configFilePath, - const std::vector& otrFiles, + const std::vector& archivePaths, const std::unordered_set& validHashes, uint32_t reservedThreadCount, AudioSettings audioSettings) { if (mContext.expired()) { auto shared = std::make_shared(name, shortName, configFilePath); mContext = shared; - shared->Init(otrFiles, validHashes, reservedThreadCount, audioSettings); + shared->Init(archivePaths, validHashes, reservedThreadCount, audioSettings); return shared; } @@ -76,12 +76,12 @@ Context::Context(std::string name, std::string shortName, std::string configFile : mConfigFilePath(std::move(configFilePath)), mName(std::move(name)), mShortName(std::move(shortName)) { } -void Context::Init(const std::vector& otrFiles, const std::unordered_set& validHashes, +void Context::Init(const std::vector& archivePaths, const std::unordered_set& validHashes, uint32_t reservedThreadCount, AudioSettings audioSettings) { InitLogging(); InitConfiguration(); InitConsoleVariables(); - InitResourceManager(otrFiles, validHashes, reservedThreadCount); + InitResourceManager(archivePaths, validHashes, reservedThreadCount); InitControlDeck(); InitCrashHandler(); InitConsole(); @@ -181,7 +181,7 @@ void Context::InitConsoleVariables() { mConsoleVariables = std::make_shared(); } -void Context::InitResourceManager(const std::vector& otrFiles, +void Context::InitResourceManager(const std::vector& archivePaths, const std::unordered_set& validHashes, uint32_t reservedThreadCount) { if (GetResourceManager() != nullptr) { return; @@ -189,7 +189,7 @@ void Context::InitResourceManager(const std::vector& otrFiles, mMainPath = GetConfig()->GetString("Game.Main Archive", GetAppDirectoryPath()); mPatchesPath = GetConfig()->GetString("Game.Patches Archive", GetAppDirectoryPath() + "/mods"); - if (otrFiles.empty()) { + if (archivePaths.empty()) { std::vector paths = std::vector(); paths.push_back(mMainPath); paths.push_back(mPatchesPath); @@ -198,7 +198,7 @@ void Context::InitResourceManager(const std::vector& otrFiles, GetResourceManager()->Init(paths, validHashes, reservedThreadCount); } else { mResourceManager = std::make_shared(); - GetResourceManager()->Init(otrFiles, validHashes, reservedThreadCount); + GetResourceManager()->Init(archivePaths, validHashes, reservedThreadCount); } if (!GetResourceManager()->DidLoadSuccessfully()) { diff --git a/src/Context.h b/src/Context.h index 5d64fcf9a..3e9dc5bf2 100644 --- a/src/Context.h +++ b/src/Context.h @@ -23,7 +23,7 @@ class Context { static std::shared_ptr GetInstance(); static std::shared_ptr CreateInstance(const std::string name, const std::string shortName, const std::string configFilePath, - const std::vector& otrFiles = {}, + const std::vector& archivePaths = {}, const std::unordered_set& validHashes = {}, uint32_t reservedThreadCount = 1, AudioSettings audioSettings = {}); static std::shared_ptr CreateUninitializedInstance(const std::string name, const std::string shortName, @@ -37,7 +37,7 @@ class Context { Context(std::string name, std::string shortName, std::string configFilePath); ~Context(); - void Init(const std::vector& otrFiles, const std::unordered_set& validHashes, + void Init(const std::vector& archivePaths, const std::unordered_set& validHashes, uint32_t reservedThreadCount, AudioSettings audioSettings); std::shared_ptr GetLogger(); @@ -58,7 +58,7 @@ class Context { void InitLogging(); void InitConfiguration(); void InitConsoleVariables(); - void InitResourceManager(const std::vector& otrFiles = {}, + void InitResourceManager(const std::vector& archivePaths = {}, const std::unordered_set& validHashes = {}, uint32_t reservedThreadCount = 1); void InitControlDeck(std::vector additionalBitmasks = {}); void InitCrashHandler(); diff --git a/src/resource/ResourceManager.cpp b/src/resource/ResourceManager.cpp index dfbda537f..ba84dcbb7 100644 --- a/src/resource/ResourceManager.cpp +++ b/src/resource/ResourceManager.cpp @@ -40,11 +40,11 @@ size_t ResourceIdentifierHash::operator()(const ResourceIdentifier& rcd) const { ResourceManager::ResourceManager() { } -void ResourceManager::Init(const std::vector& otrFiles, const std::unordered_set& validHashes, - int32_t reservedThreadCount) { +void ResourceManager::Init(const std::vector& archivePaths, + const std::unordered_set& validHashes, int32_t reservedThreadCount) { mResourceLoader = std::make_shared(); mArchiveManager = std::make_shared(); - GetArchiveManager()->Init(otrFiles, validHashes); + GetArchiveManager()->Init(archivePaths, validHashes); // the extra `- 1` is because we reserve an extra thread for spdlog size_t threadCount = std::max(1, (int32_t)(std::thread::hardware_concurrency() - reservedThreadCount - 1)); diff --git a/src/resource/ResourceManager.h b/src/resource/ResourceManager.h index 717abdaae..c5af06e9c 100644 --- a/src/resource/ResourceManager.h +++ b/src/resource/ResourceManager.h @@ -44,7 +44,7 @@ class ResourceManager { public: ResourceManager(); - void Init(const std::vector& otrFiles, const std::unordered_set& validHashes, + void Init(const std::vector& archivePaths, const std::unordered_set& validHashes, int32_t reservedThreadCount = 1); ~ResourceManager();