A GameCube/Wii emulator and debugger written in Rust.
fix tinyapp renderer
Layle25a3a8bb9f61
diff --git a/.gitmodules b/.gitmodulesindex 501c542..04cd047 100644--- a/.gitmodules+++ b/.gitmodules@@ -7,3 +7,6 @@[submodule "submodules/gcwii-resources"]path = submodules/gcwii-resourcesurl = https://codeberg.org/hazelwiss/gcwii-resources+[submodule "submodules/gamecube-examples"]+ path = submodules/gamecube-examples+ url = https://github.com/devkitPro/gamecube-examplesdiff --git a/crates/gecko/src/flipper/gx/draw.rs b/crates/gecko/src/flipper/gx/draw.rsindex b5f08f1..073ff6e 100644--- a/crates/gecko/src/flipper/gx/draw.rs+++ b/crates/gecko/src/flipper/gx/draw.rs@@ -146,6 +146,20 @@ impl DrawCommands {}}+ /// Extract draw data for cross-thread rendering.+ ///+ /// Moves the accumulated `commands` into a new `DrawCommands` (along with+ /// a copy(!) of the current projection matrix) while preserving the+ /// projection matrix and vertex-buffer pool on `self` so the emulator can+ /// reuse them for the next frame.+ pub fn take_for_render(&mut self) -> DrawCommands {+ DrawCommands {+ projection: self.projection,+ commands: std::mem::take(&mut self.commands),+ vertex_pool: Vec::new(),+ }+ }+pub fn take_vertex_buf(&mut self, capacity: usize) -> Vec<Vertex> {if let Some(mut buf) = self.vertex_pool.pop() {buf.reserve(capacity.saturating_sub(buf.capacity()));diff --git a/crates/gecko/src/gamecube.rs b/crates/gecko/src/gamecube.rsindex a8a9bb6..4c5508a 100644--- a/crates/gecko/src/gamecube.rs+++ b/crates/gecko/src/gamecube.rs@@ -40,7 +40,7 @@ pub struct GameCube {idle: IdleDetector,#[cfg(feature = "hooks")]- pub hook_host: Option<Box<dyn Host>>,+ pub hook_host: Option<Box<dyn Host + Send>>,#[cfg(feature = "hooks")]pub hook_flags: HookFlags,#[cfg(feature = "hooks")]@@ -265,7 +265,7 @@ impl GameCube {}#[cfg(feature = "hooks")]- pub fn set_hook_host(&mut self, host: Box<dyn Host>) {+ pub fn set_hook_host(&mut self, host: Box<dyn Host + Send>) {self.apply_hook_state(host.hook_state());self.hook_host = Some(host);}diff --git a/crates/tinyapp/src/thread.rs b/crates/tinyapp/src/thread.rsindex 47bd3d3..b006d74 100644--- a/crates/tinyapp/src/thread.rs+++ b/crates/tinyapp/src/thread.rs@@ -38,7 +38,7 @@ pub fn emu_thread(let data = if !emulator.gx.draw_commands.commands.is_empty() {FrameData::Gx {- commands: std::mem::take(&mut emulator.gx.draw_commands),+ commands: emulator.gx.draw_commands.take_for_render(),ram: emulator.mmio.ram.clone(),}} else {diff --git a/submodules/gamecube-examples b/submodules/gamecube-examplesnew file mode 160000index 0000000..1fc3810--- /dev/null+++ b/submodules/gamecube-examples@@ -0,0 +1 @@+Subproject commit 1fc38100b1e8d06c743904f1b9d8f95a022ee7a1