added section for file loading + memory cleanup

Make sure to clean up any memory allocated to the sim in terms of
disassembly instructions etc
This commit is contained in:
2026-06-18 08:25:29 +02:00
parent 1a6346895a
commit 6f701560df
2 changed files with 34 additions and 32 deletions
+6 -2
View File
@@ -115,6 +115,9 @@ run_gui :: proc(sim: ^Simulator) {
rl.UnloadSound(beep)
rl.CloseAudioDevice()
rl.CloseWindow()
// Free any allocated memory for the simulator
delete(sim.disasm)
}
// @TODO: If this grows lets move it into its own file
@@ -128,6 +131,7 @@ calc_layout :: proc(screen_width: f32, screen_height: f32) -> Layout {
sidebar_width := screen_width * SIDEBAR_PERCENT
display_width := screen_width - (sidebar_width * 2) - sidebar_width
display_height := visible_height * DISPLAY_V_RATIO
keypad_height := (y_pos + visible_height - visible_height / 2)
x_center := sidebar_width
y_center := screen_width - sidebar_width * 2
@@ -144,11 +148,11 @@ calc_layout :: proc(screen_width: f32, screen_height: f32) -> Layout {
x = 0,
y = y_pos,
width = sidebar_width,
height = visible_height / 3
height = keypad_height - y_pos
},
keypad = rl.Rectangle{
x = 0,
y = (y_pos + visible_height - visible_height / 2),
y = keypad_height,
width = sidebar_width,
height = visible_height / 2
},