Skip to content

Commit

Permalink
Fix segfault on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
commonkestrel committed Jul 23, 2024
1 parent 3d82163 commit e8897cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/emulator/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand All @@ -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");
}

}

0 comments on commit e8897cc

Please sign in to comment.