Skip to content

Commit e8897cc

Browse files
committed
Fix segfault on linux
1 parent 3d82163 commit e8897cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/emulator/display.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ impl TextBuffer {
4141

4242
async fn run_handle(buffer: BufferPtr) {
4343
let mut opts = WindowOptions::default();
44-
opts.scale = Scale::FitScreen;
45-
opts.scale_mode = ScaleMode::AspectRatioStretch;
44+
// opts.scale = Scale::FitScreen;
45+
opts.scale_mode = ScaleMode::UpperLeft;
4646
opts.resize = true;
47-
47+
4848
let mut window =
4949
minifb::Window::new("f8ful", WIDTH, HEIGHT, opts).expect("should be able to create window");
5050
let mut fb = [0x00000000; WIDTH * HEIGHT];
@@ -58,6 +58,7 @@ async fn run_handle(buffer: BufferPtr) {
5858
let char_x = x / 8;
5959
let char_y = y / 16;
6060
let char_idx = char_x + char_y * WIDTH / 8;
61+
let character = 0x10;
6162
let character = unsafe { (*buffer.0)[char_idx] };
6263

6364
let font_addr = ((character as usize) << 4) + font_y;
@@ -71,6 +72,7 @@ async fn run_handle(buffer: BufferPtr) {
7172

7273
window
7374
.update_with_buffer(&fb, WIDTH, HEIGHT)
74-
.expect("should be able to update window");
75+
.expect("unable to write to window");
7576
}
77+
7678
}

0 commit comments

Comments
 (0)