mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
keyboard input is working for cpu window again
This commit is contained in:
@@ -35,7 +35,7 @@ fn main() -> Result<()> {
|
||||
println!();
|
||||
println!("Usage:");
|
||||
#[cfg(any(feature = "native", feature = "browser"))]
|
||||
println!(" uw8 run [-t/--timeout <frames>] [--b/--browser] [-w/--watch] [-p/--pack] [-u/--uncompressed] [-l/--level] [-o/--output <out-file>] <file>");
|
||||
println!(" uw8 run [-t/--timeout <frames>] [--no-gpu] [--b/--browser] [-w/--watch] [-p/--pack] [-u/--uncompressed] [-l/--level] [-o/--output <out-file>] <file>");
|
||||
println!(" uw8 pack [-u/--uncompressed] [-l/--level] <in-file> <out-file>");
|
||||
println!(" uw8 unpack <in-file> <out-file>");
|
||||
println!(" uw8 compile [-d/--debug] <in-file> <out-file>");
|
||||
@@ -54,6 +54,8 @@ fn run(mut args: Arguments) -> Result<()> {
|
||||
let watch_mode = args.contains(["-w", "--watch"]);
|
||||
#[allow(unused)]
|
||||
let timeout: Option<u32> = args.opt_value_from_str(["-t", "--timeout"])?;
|
||||
#[allow(unused)]
|
||||
let gpu = !args.contains("--no-gpu");
|
||||
|
||||
let mut config = Config::default();
|
||||
if args.contains(["-p", "--pack"]) {
|
||||
@@ -93,7 +95,7 @@ fn run(mut args: Arguments) -> Result<()> {
|
||||
unimplemented!();
|
||||
#[cfg(feature = "native")]
|
||||
{
|
||||
let mut microw8 = MicroW8::new(timeout)?;
|
||||
let mut microw8 = MicroW8::new(timeout, gpu)?;
|
||||
if disable_audio {
|
||||
microw8.disable_audio();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ struct UW8WatchDog {
|
||||
}
|
||||
|
||||
impl MicroW8 {
|
||||
pub fn new(timeout: Option<u32>) -> Result<MicroW8> {
|
||||
pub fn new(timeout: Option<u32>, gpu: bool) -> Result<MicroW8> {
|
||||
let mut config = wasmtime::Config::new();
|
||||
config.cranelift_opt_level(wasmtime::OptLevel::Speed);
|
||||
if timeout.is_some() {
|
||||
@@ -68,7 +68,7 @@ impl MicroW8 {
|
||||
timeout: timeout.unwrap_or(0),
|
||||
};
|
||||
|
||||
uw8_window::run(move |framebuffer, gamepad, reset| {
|
||||
uw8_window::run(gpu, move |framebuffer, gamepad, reset| {
|
||||
while let Ok(instance) = to_ui_rx.try_recv() {
|
||||
state.instance = instance;
|
||||
}
|
||||
@@ -245,10 +245,10 @@ impl State {
|
||||
let mut sound_regs = [0u8; 32];
|
||||
sound_regs.copy_from_slice(&memory[80..112]);
|
||||
if let Some(ref sound_tx) = instance.sound_tx {
|
||||
sound_tx.send(RegisterUpdate {
|
||||
let _ = sound_tx.send(RegisterUpdate {
|
||||
time,
|
||||
data: sound_regs,
|
||||
})?;
|
||||
});
|
||||
}
|
||||
|
||||
let framebuffer_mem = &memory[120..(120 + 320 * 240)];
|
||||
|
||||
Reference in New Issue
Block a user