From 7697fff03e0e9ba448c0fab63e53c3e4dcf0987d Mon Sep 17 00:00:00 2001 From: Lukas Thomann Date: Thu, 22 Oct 2026 18:48:57 +0200 Subject: [PATCH 1/3] fix(win): map F1-F12 virtual keys to_key_state_generic returned Key::NONE for VK_F1-VK_F12, the reverse mapping already existed. Co-Authored-By: Claude Opus 5.5 --- cth_win/src/io/win_key_convert.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cth_win/src/io/win_key_convert.hpp b/cth_win/src/io/win_key_convert.hpp index 9167d00..9cfa577 100644 --- a/cth_win/src/io/win_key_convert.hpp +++ b/cth_win/src/io/win_key_convert.hpp @@ -284,7 +284,9 @@ struct win_key_params { break; default: - if(p.vkCode >= 'A' && p.vkCode <= 'Z') + if(p.vkCode >= VK_F1 && p.vkCode <= VK_F12) + key = static_cast(static_cast(Key::F1) + (p.vkCode - VK_F1)); + else if(p.vkCode >= 'A' && p.vkCode <= 'Z') key = static_cast(static_cast(Key::A) + (p.vkCode - 'A')); else if(p.vkCode >= '0' && p.vkCode <= '9') key = static_cast(static_cast(Key::DIGIT_0) + (p.vkCode - '0')); From 4f2c0c1a4e03443b9e8e24daf051fb15fadaea24 Mon Sep 17 00:00:00 2001 From: Lukas Thomann Date: Thu, 22 Oct 2026 18:48:57 +0200 Subject: [PATCH 2/3] fix(build): /Zc:preprocessor only for MSVC C++, forwarded to nvcc cth::cth passed /Zc:preprocessor to every language, nvcc takes it for a second input file. CUDA gets -Xcompiler=/Zc:preprocessor for its MSVC host compiler instead. Co-Authored-By: Claude Opus 5.5 --- cth/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cth/CMakeLists.txt b/cth/CMakeLists.txt index 3c69052..6cc5bf1 100644 --- a/cth/CMakeLists.txt +++ b/cth/CMakeLists.txt @@ -9,7 +9,13 @@ cth_pkg_target_include_directories( INTERFACE incl ) -target_compile_options(cth INTERFACE $<$:/Zc:preprocessor>) +# nvcc rejects cl flags, it forwards them to its MSVC host compiler with -Xcompiler +target_compile_options( + cth + INTERFACE + $<$:/Zc:preprocessor> + $<$,$>:-Xcompiler=/Zc:preprocessor> +) # cth/hash/hash_aggregates.hpp includes boost/pfr.hpp cth_pkg_target_find_package(cth boost_pfr CONFIG REQUIRED) From 9518084a1e14d9ec126ad0745d868f0080012dd0 Mon Sep 17 00:00:00 2001 From: Lukas Thomann Date: Thu, 22 Oct 2026 18:48:57 +0200 Subject: [PATCH 3/3] fix(net): route libhv's log to cth::log instead of libhv..log libhv's default logger wrote its INFO messages into a file in the working directory. websocket_server forwards libhv warnings and errors to cth::log, no file is written. Co-Authored-By: Claude Opus 5.5 --- cth_net/src/websocket_server.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cth_net/src/websocket_server.cpp b/cth_net/src/websocket_server.cpp index 4181504..5eb53bd 100644 --- a/cth_net/src/websocket_server.cpp +++ b/cth_net/src/websocket_server.cpp @@ -4,17 +4,44 @@ #include "websocket_connection_state.hpp" #include "cth/data/hash_map.hpp" +#include "cth/io/log.hpp" #include +#include #include #include #include +#include #include +#include #include #include namespace cth::net { +namespace { + void forward_libhv_log(int level, char const* message, int length) { + std::string_view text{message, static_cast(length)}; + while(text.ends_with('\n') || text.ends_with('\r')) + text.remove_suffix(1); + + auto const severity = level >= LOG_LEVEL_ERROR ? except::ERR : except::WARNING; + log::msg(severity, std::format("libhv: {}", text)); + } + + /** + * libhv's default logger writes libhv..log into the working directory, + * its warnings and errors go to cth::log instead + */ + void route_libhv_log() { + static std::once_flag once; + std::call_once(once, [] { + hlog_set_format("%s"); + hlog_set_level(LOG_LEVEL_WARN); + hlog_set_handler(forward_libhv_log); + }); + } +} struct websocket_server::impl { hv::WebSocketService service; @@ -48,6 +75,7 @@ websocket_server::impl::impl(std::uint16_t port, std::size_t maxMessageSize) : maxMessageSize{maxMessageSize} { CTH_CRITICAL(maxMessageSize == 0, "WebSocket maximum message size must be positive") {} + route_libhv_log(); configure_callbacks(); auto const listenFd = Listen(port, "127.0.0.1");