From d004c688c279a3b508b88a2c2f7ba845707a5d7b Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 10 Jun 2026 00:35:39 +0000 Subject: [PATCH] add filter options --- docs/user/CommandLine.md | 1 + src/yuzu_cmd/emu_window/emu_window_sdl3.cpp | 51 ++++++++------------- src/yuzu_cmd/yuzu.cpp | 8 +++- tools/miniserver.js | 25 +++++----- 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/docs/user/CommandLine.md b/docs/user/CommandLine.md index 795d4d82a0..ae8dc0cd85 100644 --- a/docs/user/CommandLine.md +++ b/docs/user/CommandLine.md @@ -28,3 +28,4 @@ There are two main applications, an SDL-based app (`eden-cli`) and a Qt based ap - `--version/-v`: Display version and quit. - `--input-profile/-i`: Specifies input profile name to use (for player #0 only). - `--null-render/-n`: Forces the usage of the "Null" render backend irrespective of settings. +- `--filter/-F`: Sets the debug log filter irrespective of settings. diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl3.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl3.cpp index 789d93b564..3b8e357a5d 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl3.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl3.cpp @@ -167,69 +167,56 @@ void EmuWindow_SDL3::Fullscreen() { } void EmuWindow_SDL3::OnEvent(SDL_Event& event) { - // Called on main thread + // Notice how we skip the "update title" aspect on most events + // this is because some WMs do NOT like changing titles while resizing + // so let's just... not do that, thanks :) + // Afterall we don't really expect the user to pay attention to the titlebar + // while they're moving a lot of shit around... switch (event.type) { case SDL_EVENT_WINDOW_RESIZED: case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: case SDL_EVENT_WINDOW_MAXIMIZED: case SDL_EVENT_WINDOW_RESTORED: - OnResize(); - break; + return OnResize(); case SDL_EVENT_WINDOW_MINIMIZED: is_shown = false; - OnResize(); - break; + return OnResize(); case SDL_EVENT_WINDOW_EXPOSED: is_shown = true; - OnResize(); - break; + return OnResize(); case SDL_EVENT_WINDOW_CLOSE_REQUESTED: is_open = false; - break; + return; case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_UP: - OnKeyEvent(static_cast(event.key.scancode), event.key.down ? 1 : 0); - break; + return OnKeyEvent(int(event.key.scancode), event.key.down ? 1 : 0); case SDL_EVENT_MOUSE_MOTION: // ignore if it came from touch if (event.button.which != SDL_TOUCH_MOUSEID) OnMouseMotion(event.motion.x, event.motion.y); - break; + return; case SDL_EVENT_MOUSE_BUTTON_DOWN: case SDL_EVENT_MOUSE_BUTTON_UP: // ignore if it came from touch if (event.button.which != SDL_TOUCH_MOUSEID) { - OnMouseButton(event.button.button, event.button.down ? 1 : 0, - static_cast(event.button.x), static_cast(event.button.y)); + OnMouseButton(event.button.button, event.button.down ? 1 : 0, s32(event.button.x), s3>(event.button.y)); } - break; + return; case SDL_EVENT_FINGER_DOWN: - OnFingerDown(event.tfinger.x, event.tfinger.y, - static_cast(event.tfinger.touchID)); - break; + return OnFingerDown(event.tfinger.x, event.tfinger.y, std::size_t(event.tfinger.touchID)); case SDL_EVENT_FINGER_MOTION: - OnFingerMotion(event.tfinger.x, event.tfinger.y, - static_cast(event.tfinger.touchID)); - break; + return OnFingerMotion(event.tfinger.x, event.tfinger.y, std::size_t(event.tfinger.touchID)); case SDL_EVENT_FINGER_UP: - OnFingerUp(); - break; + return OnFingerUp(); case SDL_EVENT_QUIT: is_open = false; break; default: break; } - - const u32 current_time = SDL_GetTicks(); - if (current_time > last_time + 2000) { - const auto results = system.GetAndResetPerfStats(); - const auto title = fmt::format("{} | {}-{} | FPS: {:.0f} ({:.0f}%)", - Common::g_build_fullname, - Common::g_scm_branch, - Common::g_scm_desc, - results.average_game_fps, - results.emulation_speed * 100.0); + if (auto const current_time = SDL_GetTicks(); current_time > last_time + 2000) { + auto const results = system.GetAndResetPerfStats(); + auto const title = fmt::format("{} | {}-{} | FPS: {:.0f} ({:.0f}%)", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc, results.average_game_fps, results.emulation_speed * 100.0); SDL_SetWindowTitle(render_window, title.c_str()); last_time = current_time; } diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index b985a9e368..78b562baa3 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -220,6 +220,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { std::string password{}; std::string address{}; std::string input_profile{}; + std::optional log_filter{}; u16 port = Network::DefaultRoomPort; static struct option long_options[] = { @@ -235,6 +236,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { {"version", no_argument, 0, 'v'}, {"input-profile", no_argument, 0, 'i'}, {"null-render", no_argument, 0, 'n'}, + {"filter", no_argument, 0, 'F'}, {0, 0, 0, 0}, // clang-format on }; @@ -308,6 +310,10 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { case 'n': force_null_render = true; break; + case 'F': + log_filter = argv[optind]; + ++optind; + break; } } else { #ifdef _WIN32 @@ -324,7 +330,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { // apply the log_filter setting // the logger was initialized before and doesn't pick up the filter on its own Common::Log::Filter filter; - filter.ParseFilterString(Settings::values.log_filter.GetValue()); + filter.ParseFilterString(log_filter.value_or(Settings::values.log_filter.GetValue())); Common::Log::SetGlobalFilter(filter); if (!program_args.empty()) { diff --git a/tools/miniserver.js b/tools/miniserver.js index 96dee9aa3a..44a7d7ca30 100755 --- a/tools/miniserver.js +++ b/tools/miniserver.js @@ -8,7 +8,7 @@ import { join } from 'path'; // DO NOT RUN THIS IN ANY PRODUCTION ENVIRONMENT EVER const server = createServer((req, res) => { - console.log(`reuqest? ${req.url}`); + console.log(`get ${req.url}`); if (req.url === '/') { // https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running // If your browser doesn't support fetch... HAHA GET FUCKED @@ -22,40 +22,41 @@ const server = createServer((req, res) => { eden-cli - + +
+ +
+