diff --git a/Cargo.lock b/Cargo.lock index e330f73..2ac8515 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2655,6 +2655,7 @@ dependencies = [ "wasmtime", "wat", "webbrowser", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6b67f29..54eb4e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [features] default = ["native", "browser"] -native = ["wasmtime", "minifb", "cpal", "rubato"] +native = ["wasmtime", "minifb", "cpal", "rubato", "winapi" ] browser = ["warp", "tokio", "tokio-stream", "webbrowser"] [dependencies] @@ -26,4 +26,5 @@ tokio-stream = { version = "0.1.8", features = ["sync"], optional = true } webbrowser = { version = "0.6.0", optional = true } ansi_term = "0.12.1" cpal = { version = "0.13.5", optional = true } -rubato = { version = "0.11.0", optional = true } \ No newline at end of file +rubato = { version = "0.11.0", optional = true } +winapi = { version = "0.3.9", features = ["timeapi"], optional = true } \ No newline at end of file diff --git a/src/run_native.rs b/src/run_native.rs index 8502253..fcd142b 100644 --- a/src/run_native.rs +++ b/src/run_native.rs @@ -59,6 +59,9 @@ struct UW8WatchDog { impl MicroW8 { pub fn new() -> Result { + #[cfg(target_os = "windows")] + unsafe { winapi::um::timeapi::timeBeginPeriod(1); } + let engine = wasmtime::Engine::new(wasmtime::Config::new().interruptable(true))?; let loader_module =