Added config reload via IPC pipes

This commit is contained in:
acidicoala
2023-01-12 00:25:36 +03:00
parent d52e752723
commit dfbce391a7
4 changed files with 21 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
#include <koalabox/dll_monitor.hpp> #include <koalabox/dll_monitor.hpp>
#include <koalabox/logger.hpp> #include <koalabox/logger.hpp>
#include <koalabox/win_util.hpp> #include <koalabox/win_util.hpp>
#include <koalabox/ipc.hpp>
namespace koalageddon { namespace koalageddon {
@@ -117,5 +118,21 @@ namespace koalageddon {
} }
} }
); );
NEW_THREAD({
koalabox::ipc::init_pipe_server("smoke_api.koalageddon", [](const koalabox::ipc::Request& request) {
koalabox::ipc::Response response;
if (request.name < equals > "config::reload") {
smoke_api::config::ReloadConfig();
response.success = true;
} else {
response.success = false;
response.data["error_message"] = "Invalid request name: " + request.name;
}
return response;
});
})
} }
} }

View File

@@ -54,4 +54,6 @@ namespace smoke_api::config {
Vector<DLC> get_extra_dlcs(AppId_t app_id); Vector<DLC> get_extra_dlcs(AppId_t app_id);
bool is_dlc_unlocked(uint32_t app_id, uint32_t dlc_id, const Function<bool()>& original_function); bool is_dlc_unlocked(uint32_t app_id, uint32_t dlc_id, const Function<bool()>& original_function);
DLL_EXPORT(void) ReloadConfig();
} }

View File

@@ -113,6 +113,7 @@ namespace smoke_api {
} else { } else {
init_proxy_mode(); init_proxy_mode();
} }
LOG_INFO("🚀 Initialization complete") LOG_INFO("🚀 Initialization complete")
} catch (const Exception& ex) { } catch (const Exception& ex) {
koalabox::util::panic(fmt::format("Initialization error: {}", ex.what())); koalabox::util::panic(fmt::format("Initialization error: {}", ex.what()));