diff --git a/CMakeLists.txt b/CMakeLists.txt index 19748984..c5265d34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) # Optionally set things like CMAKE_CXX_STANDARD, CMAKE_POSITION_INDEPENDENT_CODE here - set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/src/core/src/core/gstreamer.hpp b/src/core/src/core/gstreamer.hpp index 116c5fa1..f6ebf2b9 100644 --- a/src/core/src/core/gstreamer.hpp +++ b/src/core/src/core/gstreamer.hpp @@ -86,10 +86,6 @@ static bool run_pipeline(const std::string &pipeline_desc, gst_element_set_state(pipeline.get(), GST_STATE_READY); gst_element_set_state(pipeline.get(), GST_STATE_NULL); - for (const auto &handler : handlers) { - handler->unregister(); - } - return true; } diff --git a/src/core/src/platforms/all/docker/docker/formatters.hpp b/src/core/src/platforms/all/docker/docker/formatters.hpp index ad943aec..7aa05ea3 100644 --- a/src/core/src/platforms/all/docker/docker/formatters.hpp +++ b/src/core/src/platforms/all/docker/docker/formatters.hpp @@ -30,7 +30,7 @@ template <> struct [[maybe_unused]] formatter { } template auto format(const docker::MountPoint &mount, FormatContext &ctx) const -> decltype(ctx.out()) { - return format_to(ctx.out(), "{}:{}:{}", mount.source, mount.destination, mount.mode); + return format_to(ctx.out(), fmt::runtime("{}:{}:{}"), mount.source, mount.destination, mount.mode); } }; @@ -41,7 +41,7 @@ template <> struct [[maybe_unused]] formatter { } template auto format(const docker::Device &dev, FormatContext &ctx) const -> decltype(ctx.out()) { - return format_to(ctx.out(), "{}:{}:{}", dev.path_on_host, dev.path_in_container, dev.cgroup_permission); + return format_to(ctx.out(), fmt::runtime("{}:{}:{}"), dev.path_on_host, dev.path_in_container, dev.cgroup_permission); } }; @@ -54,7 +54,7 @@ template <> struct [[maybe_unused]] formatter { auto format(const docker::Container &container, FormatContext &ctx) const -> decltype(ctx.out()) { return format_to( ctx.out(), - "{{\n id: {}\n name: {}\n image: {}\n status: {}\n ports: {}\n mounts: {}\n devices: {}\n env: {}\n}}", + fmt::runtime("{{\n id: {}\n name: {}\n image: {}\n status: {}\n ports: {}\n mounts: {}\n devices: {}\n env: {}\n}}"), container.id, container.name, container.image, diff --git a/src/core/src/platforms/all/helpers/helpers/logger.hpp b/src/core/src/platforms/all/helpers/helpers/logger.hpp index 39fe7ed7..421b2a4a 100644 --- a/src/core/src/platforms/all/helpers/helpers/logger.hpp +++ b/src/core/src/platforms/all/helpers/helpers/logger.hpp @@ -126,8 +126,9 @@ BOOST_LOG_INLINE_GLOBAL_LOGGER_INIT(my_logger, my_logger_mt) { * @param format_str: a valid fmt::format string * @param args: optional additional args to be formatted */ -template inline void log(severity_level lvl, const S &format_str, const Args &...args) { - auto msg = fmt::format(format_str, args...); +template +inline void log(severity_level lvl, fmt::format_string format_str, Args &&...args) { + auto msg = fmt::format(format_str, std::forward(args)...); BOOST_LOG_SEV(my_logger::get(), lvl) << msg; } diff --git a/src/moonlight-server/CMakeLists.txt b/src/moonlight-server/CMakeLists.txt index beac5c57..883a2e01 100644 --- a/src/moonlight-server/CMakeLists.txt +++ b/src/moonlight-server/CMakeLists.txt @@ -15,8 +15,8 @@ target_link_libraries_system(wolf_runner PUBLIC fmt::fmt-header-only) FetchContent_Declare( eventbus - GIT_REPOSITORY https://github.com/DeveloperPaul123/eventbus - GIT_TAG 0.10.1 + GIT_REPOSITORY https://github.com/games-on-whales/eventbus + GIT_TAG 8599ea2 ) set(EVENTBUS_BUILD_TESTS OFF) FetchContent_MakeAvailable(eventbus) diff --git a/src/moonlight-server/platforms/input.hpp b/src/moonlight-server/platforms/input.hpp index f5340cf1..37cd27c6 100644 --- a/src/moonlight-server/platforms/input.hpp +++ b/src/moonlight-server/platforms/input.hpp @@ -19,7 +19,9 @@ static std::string to_hex(const std::basic_string &str) { std::stringstream ss; ss << std::hex << std::setfill('0'); for (const auto &ch : str) { - ss << ch; + ss << (char)(ch >> 16); + ss << (char)(ch >> 8); + ss << (char)ch; } std::string hex_unicode(ss.str()); diff --git a/src/moonlight-server/streaming/streaming.cpp b/src/moonlight-server/streaming/streaming.cpp index 1e78829e..b80f5032 100644 --- a/src/moonlight-server/streaming/streaming.cpp +++ b/src/moonlight-server/streaming/streaming.cpp @@ -99,7 +99,7 @@ void start_streaming_video(const immer::box &video_session, break; } - auto pipeline = fmt::format(video_session->gst_pipeline, + auto pipeline = fmt::format(fmt::runtime(video_session->gst_pipeline), fmt::arg("width", video_session->display_mode.width), fmt::arg("height", video_session->display_mode.height), fmt::arg("fps", video_session->display_mode.refreshRate), @@ -203,7 +203,7 @@ void start_streaming_audio(const immer::box &audio_session, const std::string &sink_name, const std::string &server_name) { auto pipeline = fmt::format( - audio_session->gst_pipeline, + fmt::runtime(audio_session->gst_pipeline), fmt::arg("channels", audio_session->audio_mode.channels), fmt::arg("bitrate", audio_session->audio_mode.bitrate), // TODO: opusenc hardcodes those two diff --git a/src/moonlight-server/wolf.cpp b/src/moonlight-server/wolf.cpp index cc0e7a79..c9f1b273 100644 --- a/src/moonlight-server/wolf.cpp +++ b/src/moonlight-server/wolf.cpp @@ -440,6 +440,8 @@ void run() { auto p_key_file = utils::get_env("WOLF_PRIVATE_KEY_FILE", "key.pem"); auto p_cert_file = utils::get_env("WOLF_PRIVATE_CERT_FILE", "cert.pem"); auto local_state = initialize(config_file, p_key_file, p_cert_file); + auto global_ev_handler = local_state->event_bus->register_global_handler( + [](std::any ev) { logs::log(logs::trace, "Fired event: {}", ev.type().name()); }); // HTTP APIs auto http_thread = std::thread([local_state]() { @@ -467,10 +469,6 @@ void run() { auto sess_handlers = setup_sessions_handlers(local_state, runtime_dir, audio_server); http_thread.join(); // Let's park the main thread over here - - for (const auto &handler : sess_handlers) { - handler->unregister(); - } } int main(int argc, char *argv[]) try {