From e8897cc2f4f973cfcb6eccce6544ec2dc5d6c78f Mon Sep 17 00:00:00 2001 From: commonkestrel Date: Tue, 23 Jul 2024 11:02:01 -0700 Subject: [PATCH] Fix segfault on linux --- src/emulator/display.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/emulator/display.rs b/src/emulator/display.rs index 8894f92..f5b10f9 100644 --- a/src/emulator/display.rs +++ b/src/emulator/display.rs @@ -41,10 +41,10 @@ impl TextBuffer { async fn run_handle(buffer: BufferPtr) { let mut opts = WindowOptions::default(); - opts.scale = Scale::FitScreen; - opts.scale_mode = ScaleMode::AspectRatioStretch; + // opts.scale = Scale::FitScreen; + opts.scale_mode = ScaleMode::UpperLeft; opts.resize = true; - + let mut window = minifb::Window::new("f8ful", WIDTH, HEIGHT, opts).expect("should be able to create window"); let mut fb = [0x00000000; WIDTH * HEIGHT]; @@ -58,6 +58,7 @@ async fn run_handle(buffer: BufferPtr) { let char_x = x / 8; let char_y = y / 16; let char_idx = char_x + char_y * WIDTH / 8; + let character = 0x10; let character = unsafe { (*buffer.0)[char_idx] }; let font_addr = ((character as usize) << 4) + font_y; @@ -71,6 +72,7 @@ async fn run_handle(buffer: BufferPtr) { window .update_with_buffer(&fb, WIDTH, HEIGHT) - .expect("should be able to update window"); + .expect("unable to write to window"); } + }