diff --git a/src/Context.cpp b/src/Context.cpp index 1eb464a58..f6095d512 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -44,11 +44,11 @@ Context::~Context() { std::shared_ptr Context::CreateInstance(const std::string name, const std::string shortName, const std::string configFilePath, const std::vector& archivePaths, const std::unordered_set& validHashes, - uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window) { + uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window, std::shared_ptr controlDeck) { if (mContext.expired()) { auto shared = std::make_shared(name, shortName, configFilePath); mContext = shared; - if (shared->Init(archivePaths, validHashes, reservedThreadCount, audioSettings, window)) { + if (shared->Init(archivePaths, validHashes, reservedThreadCount, audioSettings, window, controlDeck)) { return shared; } else { SPDLOG_ERROR("Failed to initialize"); @@ -79,9 +79,9 @@ Context::Context(std::string name, std::string shortName, std::string configFile } bool Context::Init(const std::vector& archivePaths, const std::unordered_set& validHashes, - uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window) { + uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window, std::shared_ptr controlDeck) { return InitLogging() && InitConfiguration() && InitConsoleVariables() && - InitResourceManager(archivePaths, validHashes, reservedThreadCount) && InitControlDeck() && + InitResourceManager(archivePaths, validHashes, reservedThreadCount) && InitControlDeck(controlDeck) && InitCrashHandler() && InitConsole() && InitWindow(window) && InitAudio(audioSettings) && InitGfxDebugger(); } @@ -228,12 +228,12 @@ bool Context::InitResourceManager(const std::vector& archivePaths, return true; } -bool Context::InitControlDeck(std::vector additionalBitmasks) { +bool Context::InitControlDeck(std::shared_ptr controlDeck) { if (GetControlDeck() != nullptr) { return true; } - mControlDeck = std::make_shared(additionalBitmasks); + mControlDeck = controlDeck; if (GetControlDeck() == nullptr) { SPDLOG_ERROR("Failed to initialize control deck"); diff --git a/src/Context.h b/src/Context.h index 73bf01dac..ad711cb5d 100644 --- a/src/Context.h +++ b/src/Context.h @@ -26,7 +26,7 @@ class Context { const std::vector& archivePaths = {}, const std::unordered_set& validHashes = {}, uint32_t reservedThreadCount = 1, AudioSettings audioSettings = {}, - std::shared_ptr window = nullptr); + std::shared_ptr window = nullptr, std::shared_ptr controlDeck = nullptr); static std::shared_ptr CreateUninitializedInstance(const std::string name, const std::string shortName, const std::string configFilePath); static std::string GetAppBundlePath(); @@ -39,7 +39,7 @@ class Context { ~Context(); bool Init(const std::vector& archivePaths, const std::unordered_set& validHashes, - uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window = nullptr); + uint32_t reservedThreadCount, AudioSettings audioSettings, std::shared_ptr window = nullptr, std::shared_ptr controlDeck = nullptr); std::shared_ptr GetLogger(); std::shared_ptr GetConfig(); @@ -60,7 +60,7 @@ class Context { bool InitConsoleVariables(); bool InitResourceManager(const std::vector& archivePaths = {}, const std::unordered_set& validHashes = {}, uint32_t reservedThreadCount = 1); - bool InitControlDeck(std::vector additionalBitmasks = {}); + bool InitControlDeck(std::shared_ptr controlDeck = nullptr); bool InitCrashHandler(); bool InitAudio(AudioSettings settings); bool InitGfxDebugger();