first batch of dependency updates

This commit is contained in:
2023-01-26 22:45:34 +01:00
parent daf2a02cd8
commit 5efa8b3465
5 changed files with 842 additions and 960 deletions

1737
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,21 +11,21 @@ native = ["wasmtime", "uw8-window", "cpal", "rubato" ]
browser = ["warp", "tokio", "tokio-stream", "webbrowser"] browser = ["warp", "tokio", "tokio-stream", "webbrowser"]
[dependencies] [dependencies]
wasmtime = { version = "0.37.0", optional = true } wasmtime = { version = "5.0.0", optional = true }
anyhow = "1" anyhow = "1"
env_logger = "0.9" env_logger = "0.10"
log = "0.4" log = "0.4"
uw8-window = { path = "uw8-window", optional = true } uw8-window = { path = "uw8-window", optional = true }
notify = "4" notify = "5"
pico-args = "0.4" pico-args = "0.5"
curlywas = { git = "https://github.com/exoticorn/curlywas.git", rev = "0e7ea50" } curlywas = { git = "https://github.com/exoticorn/curlywas.git", rev = "0e7ea50" }
wat = "1" wat = "1"
uw8-tool = { path = "uw8-tool" } uw8-tool = { path = "uw8-tool" }
same-file = "1" same-file = "1"
warp = { version = "0.3.2", optional = true } warp = { version = "0.3.3", optional = true }
tokio = { version = "1.17.0", features = ["sync", "rt"], optional = true } tokio = { version = "1.24.0", features = ["sync", "rt"], optional = true }
tokio-stream = { version = "0.1.8", features = ["sync"], optional = true } tokio-stream = { version = "0.1.11", features = ["sync"], optional = true }
webbrowser = { version = "0.6.0", optional = true } webbrowser = { version = "0.8.6", optional = true }
ansi_term = "0.12.1" ansi_term = "0.12.1"
cpal = { version = "0.14.1", optional = true } cpal = { version = "0.14.2", optional = true }
rubato = { version = "0.11.0", optional = true } rubato = { version = "0.12.0", optional = true }

View File

@@ -1,18 +1,21 @@
use anyhow::{anyhow, bail, Result}; use anyhow::{anyhow, bail, Result};
use notify::{DebouncedEvent, RecommendedWatcher, Watcher}; use notify::{Event, EventKind, RecommendedWatcher, Watcher};
use std::{collections::BTreeSet, path::PathBuf, sync::mpsc, time::Duration}; use std::{collections::BTreeSet, path::PathBuf, sync::mpsc};
pub struct FileWatcher { pub struct FileWatcher {
watcher: RecommendedWatcher, watcher: RecommendedWatcher,
watched_files: BTreeSet<PathBuf>, watched_files: BTreeSet<PathBuf>,
directories: BTreeSet<PathBuf>, directories: BTreeSet<PathBuf>,
rx: mpsc::Receiver<DebouncedEvent>, rx: mpsc::Receiver<Event>,
} }
impl FileWatcher { impl FileWatcher {
pub fn new() -> Result<FileWatcher> { pub fn new() -> Result<FileWatcher> {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
let watcher = notify::watcher(tx, Duration::from_millis(100))?; let watcher = notify::recommended_watcher(move |res| match res {
Ok(event) => _ = tx.send(event),
Err(err) => eprintln!("Error watching for file changes: {err}"),
})?;
Ok(FileWatcher { Ok(FileWatcher {
watcher, watcher,
watched_files: BTreeSet::new(), watched_files: BTreeSet::new(),
@@ -36,16 +39,20 @@ impl FileWatcher {
} }
pub fn poll_changed_file(&self) -> Result<Option<PathBuf>> { pub fn poll_changed_file(&self) -> Result<Option<PathBuf>> {
let event = self.rx.try_recv(); match self.rx.try_recv() {
match event { Ok(event) => match event.kind {
Ok(DebouncedEvent::Create(path) | DebouncedEvent::Write(path)) => { EventKind::Create(_) | EventKind::Modify(_) => {
let handle = same_file::Handle::from_path(&path)?; for path in event.paths {
for file in &self.watched_files { let handle = same_file::Handle::from_path(&path)?;
if handle == same_file::Handle::from_path(file)? { for file in &self.watched_files {
return Ok(Some(path)); if handle == same_file::Handle::from_path(file)? {
return Ok(Some(path));
}
}
} }
} }
} _ => (),
},
Err(mpsc::TryRecvError::Disconnected) => bail!("File watcher disconnected"), Err(mpsc::TryRecvError::Disconnected) => bail!("File watcher disconnected"),
_ => (), _ => (),
} }

View File

@@ -93,7 +93,7 @@ impl super::Runtime for MicroW8 {
linker.define("env", "memory", memory)?; linker.define("env", "memory", memory)?;
let loader_instance = linker.instantiate(&mut store, &self.loader_module)?; let loader_instance = linker.instantiate(&mut store, &self.loader_module)?;
let load_uw8 = loader_instance.get_typed_func::<i32, i32, _>(&mut store, "load_uw8")?; let load_uw8 = loader_instance.get_typed_func::<i32, i32>(&mut store, "load_uw8")?;
let platform_data = include_bytes!("../platform/bin/platform.uw8"); let platform_data = include_bytes!("../platform/bin/platform.uw8");
memory.data_mut(&mut store)[..platform_data.len()].copy_from_slice(platform_data); memory.data_mut(&mut store)[..platform_data.len()].copy_from_slice(platform_data);
@@ -131,8 +131,8 @@ impl super::Runtime for MicroW8 {
} }
let instance = linker.instantiate(&mut store, &module)?; let instance = linker.instantiate(&mut store, &module)?;
let end_frame = platform_instance.get_typed_func::<(), (), _>(&mut store, "endFrame")?; let end_frame = platform_instance.get_typed_func::<(), ()>(&mut store, "endFrame")?;
let update = instance.get_typed_func::<(), (), _>(&mut store, "upd").ok(); let update = instance.get_typed_func::<(), ()>(&mut store, "upd").ok();
let (sound_tx, stream) = if self.disable_audio { let (sound_tx, stream) = if self.disable_audio {
(None, None) (None, None)
@@ -313,8 +313,8 @@ fn init_sound(
let instance = linker.instantiate(&mut store, module)?; let instance = linker.instantiate(&mut store, module)?;
let snd = instance let snd = instance
.get_typed_func::<(i32,), f32, _>(&mut store, "snd") .get_typed_func::<(i32,), f32>(&mut store, "snd")
.or_else(|_| platform_instance.get_typed_func::<(i32,), f32, _>(&mut store, "sndGes"))?; .or_else(|_| platform_instance.get_typed_func::<(i32,), f32>(&mut store, "sndGes"))?;
let host = cpal::default_host(); let host = cpal::default_host();
let device = host let device = host

View File

@@ -7,9 +7,9 @@ edition = "2021"
[dependencies] [dependencies]
winit = "0.26.1" winit = "0.26.1"
env_logger = "0.9" env_logger = "0.10"
log = "0.4" log = "0.4"
pico-args = "0.4" pico-args = "0.5"
wgpu = "0.13.1" wgpu = "0.13.1"
pollster = "0.2" pollster = "0.2"
bytemuck = { version = "1.4", features = [ "derive" ] } bytemuck = { version = "1.4", features = [ "derive" ] }