Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

---

## [0.4.26] — 2026-11-03

### Added

- **Settings > Rendering > Disable hardware acceleration (Windows).** A workaround for a stutter affecting the whole display while WaveTrace has focus, seen so far on one PC with G-SYNC on. WaveTrace may feel slower and use more CPU with it on, so it's off by default.

---

## [0.4.25] — 2026-11-02

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wavetrace",
"private": true,
"version": "0.4.25",
"version": "0.4.26",
"license": "MIT",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wavetrace"
version = "0.4.25"
version = "0.4.26"
description = "WaveTrace — automatic per-wave tracking for The Tower"
edition = "2021"
license = "MIT"
Expand Down
11 changes: 11 additions & 0 deletions src-tauri/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@ pub fn spawn_and_replace(id: &str) -> Result<(), String> {
Ok(())
}

/// Replace this process with a fresh one on the same account.
pub fn respawn_current() -> Result<(), String> {
let id = current_id().ok_or("No account is open.")?;
release_lock();
if let Err(e) = spawn_with_account(&id) {
let _ = acquire_lock(&active_data_dir());
return Err(e);
}
Ok(())
}

fn release_lock() {
if let Ok(mut slot) = INSTANCE_LOCK.lock() {
*slot = None;
Expand Down
20 changes: 20 additions & 0 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ pub fn save_settings(new_settings: Settings) -> Result<(), String> {
Ok(())
}

#[tauri::command]
pub fn get_software_rendering() -> crate::webview_rendering::SoftwareRendering {
crate::webview_rendering::status()
}

#[tauri::command]
pub fn set_software_rendering(enabled: bool) -> Result<(), String> {
crate::webview_rendering::save(enabled)
}

#[tauri::command]
pub fn restart_app(app: AppHandle, state: State<AppState>) -> Result<(), String> {
if state.scanner.is_running() {
return Err("Stop the scanner before restarting WaveTrace.".into());
}
accounts::respawn_current()?;
crate::tray::exit_app(&app);
Ok(())
}

#[tauri::command]
pub fn send_test_ntfy(app: AppHandle) -> Result<(), String> {
crate::notifications::send_test_ntfy(&app)
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/debug_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ pub fn build_debug_package_zip(input: &DebugPackageBuildInput) -> Result<(Vec<u8
};

let system_info = format!(
"WaveTrace {}\nOS: {} {}\nInstall: {}\nCreated: {}\nAccount: {} ({})\nApp data: {}\nDatabase: {}\nLog: {}\nScanner running: {}\nCurrent run: {}\n",
"WaveTrace {}\nOS: {} {}\nInstall: {}\nCreated: {}\nAccount: {} ({})\nApp data: {}\nDatabase: {}\nLog: {}\nScanner running: {}\nCurrent run: {}\nSoftware rendering: {}\n",
manifest.app_version,
manifest.os,
manifest.arch,
Expand All @@ -341,6 +341,7 @@ pub fn build_debug_package_zip(input: &DebugPackageBuildInput) -> Result<(Vec<u8
.current_run_id
.as_deref()
.unwrap_or("(none)"),
crate::webview_rendering::active(),
);

let mut zip_bytes = Vec::new();
Expand Down
11 changes: 9 additions & 2 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod notifications;
pub mod ocr;
pub mod parser;
pub mod renderer_recovery;
pub mod webview_rendering;
pub mod scanner;
pub mod settings;
pub mod shutdown_hook;
Expand Down Expand Up @@ -103,8 +104,10 @@ pub fn run() {
log_panics();
let account = accounts::current_account();
db::append_app_log(&format!(
"app starting account={} ({})",
account.id, account.name
"app starting account={} ({}) software_rendering={}",
account.id,
account.name,
webview_rendering::active()
));

tauri::Builder::default()
Expand All @@ -118,6 +121,7 @@ pub fn run() {
pending_wave_milestone_ntfy: std::sync::Mutex::new(None),
})
.setup(|app| {
webview_rendering::main_window_builder(app.handle())?.build()?;
tray::setup(app)?;
app_icon::apply_branding(app)?;
if let Some(notify) = app.try_state::<NotifyState>() {
Expand Down Expand Up @@ -152,6 +156,9 @@ pub fn run() {
commands::quit_app,
commands::get_settings,
commands::save_settings,
commands::get_software_rendering,
commands::set_software_rendering,
commands::restart_app,
commands::send_test_ntfy,
commands::get_ntfy_status,
commands::clear_ntfy_rate_limit,
Expand Down
11 changes: 1 addition & 10 deletions src-tauri/src/renderer_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,7 @@ mod windows {
std::thread::sleep(Duration::from_millis(50));
}

let config = app
.config()
.app
.windows
.iter()
.find(|w| w.label == "main")
.cloned()
.ok_or("no \"main\" window in the app config")?;
let window = tauri::WebviewWindowBuilder::from_config(app, &config)
.map_err(|e| e.to_string())?
let window = crate::webview_rendering::main_window_builder(app)?
.visible(false)
.build()
.map_err(|e| format!("building the new window: {e}"))?;
Expand Down
136 changes: 136 additions & 0 deletions src-tauri/src/webview_rendering.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
//! The "Disable hardware acceleration" option, for PCs where WebView2's GPU rendering makes
//! the whole display stutter while WaveTrace has focus.
//!
//! It's one choice per PC, not per account, because it describes the machine. WebView2
//! refuses to start in a data folder whose running browser process has different flags, and
//! that browser process can briefly outlive a restart, so each mode has its own data folder.

use std::fs;
use std::io::ErrorKind;
use std::path::Path;
use std::sync::OnceLock;

use serde::Serialize;
use tauri::{AppHandle, WebviewWindowBuilder, Wry};

const SOFTWARE_RENDERING_FILE: &str = "software_rendering";
/// Under the app's local data folder, where WebView2 keeps its default data folder too.
#[cfg(windows)]
const SOFTWARE_RENDERING_DATA_DIR: &str = "software-rendering";
/// Setting browser args replaces wry's defaults, so they're repeated here.
#[cfg(windows)]
const SOFTWARE_RENDERING_BROWSER_ARGS: &str =
"--disable-gpu --disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection";

/// The mode this process started in. Fixed for its lifetime: changing the saved choice only
/// applies on restart, and a window rebuilt after a crash has to stay in the same mode.
static ACTIVE: OnceLock<bool> = OnceLock::new();

#[derive(Debug, Serialize)]
pub struct SoftwareRendering {
/// Whether this platform has the option at all.
pub supported: bool,
/// The choice to apply on the next start.
pub saved: bool,
/// The mode this process is running in.
pub active: bool,
}

pub fn status() -> SoftwareRendering {
SoftwareRendering {
supported: cfg!(windows),
saved: saved(),
active: active(),
}
}

pub fn active() -> bool {
*ACTIVE.get_or_init(saved)
}

fn saved() -> bool {
cfg!(windows) && read_choice(&crate::accounts::data_root())
}

pub fn save(enabled: bool) -> Result<(), String> {
if !cfg!(windows) {
return Err("This option is only available on Windows.".into());
}
// Pin the running mode before the saved choice changes under it.
active();
write_choice(&crate::accounts::data_root(), enabled).map_err(|e| e.to_string())
}

fn read_choice(root: &Path) -> bool {
root.join(SOFTWARE_RENDERING_FILE).exists()
}

fn write_choice(root: &Path, enabled: bool) -> std::io::Result<()> {
let path = root.join(SOFTWARE_RENDERING_FILE);
if enabled {
return fs::write(path, "");
}
match fs::remove_file(path) {
Err(e) if e.kind() != ErrorKind::NotFound => Err(e),
_ => Ok(()),
}
}

/// The main window as configured, in the mode this process started in.
pub fn main_window_builder(
app: &AppHandle,
) -> Result<WebviewWindowBuilder<'_, Wry, AppHandle>, String> {
let config = app
.config()
.app
.windows
.iter()
.find(|w| w.label == "main")
.cloned()
.ok_or("no \"main\" window in the app config")?;
let builder = WebviewWindowBuilder::from_config(app, &config).map_err(|e| e.to_string())?;
#[cfg(windows)]
if active() {
use tauri::Manager;
let data_dir = app
.path()
.app_local_data_dir()
.map_err(|e| e.to_string())?
.join(SOFTWARE_RENDERING_DATA_DIR);
return Ok(builder
.additional_browser_args(SOFTWARE_RENDERING_BROWSER_ARGS)
.data_directory(data_dir));
}
Ok(builder)
}

#[cfg(test)]
mod tests {
use super::*;

fn temp_root() -> std::path::PathBuf {
let dir = std::env::temp_dir().join(format!("wavetrace-render-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
dir
}

#[test]
fn the_choice_is_off_until_saved_and_can_be_saved_twice() {
let root = temp_root();
assert!(!read_choice(&root));
write_choice(&root, true).unwrap();
write_choice(&root, true).unwrap();
assert!(read_choice(&root));
write_choice(&root, false).unwrap();
assert!(!read_choice(&root));
fs::remove_dir_all(root).unwrap();
}

#[test]
fn turning_it_off_when_already_off_is_fine() {
let root = temp_root();
write_choice(&root, false).unwrap();
assert!(!read_choice(&root));
fs::remove_dir_all(root).unwrap();
}
}
3 changes: 2 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "WaveTrace",
"version": "0.4.25",
"version": "0.4.26",
"identifier": "com.wavetrace.app",
"build": {
"beforeDevCommand": "npm run dev",
Expand All @@ -12,6 +12,7 @@
"app": {
"windows": [
{
"create": false,
"title": "WaveTrace",
"width": 1150,
"height": 780,
Expand Down
13 changes: 13 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ export interface Settings {
capture_adb_device_id: string;
}

export interface SoftwareRendering {
/** Whether this platform has the option at all. */
supported: boolean;
/** The choice to apply on the next start. */
saved: boolean;
/** The mode the app is running in. */
active: boolean;
}

export interface AdbDeviceInfo {
serial: string;
/** Stable fingerprint (aid:.../avd:...); null when unreadable. */
Expand Down Expand Up @@ -269,6 +278,10 @@ export const api = {
getSettings: () => invoke<Settings>("get_settings"),
saveSettings: (newSettings: Settings) =>
invoke<void>("save_settings", { newSettings }),
getSoftwareRendering: () => invoke<SoftwareRendering>("get_software_rendering"),
setSoftwareRendering: (enabled: boolean) =>
invoke<void>("set_software_rendering", { enabled }),
restartApp: () => invoke<void>("restart_app"),
gameSaveStatus: () => invoke<GameSaveStatus>("game_save_status"),
pullGameSave: () => invoke<GameSavePullResult>("pull_game_save"),
pickSavePullDir: () => invoke<string | null>("pick_save_pull_dir"),
Expand Down
Loading
Loading