mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-29 20:35:13 +01:00
add scheduler debug window
This commit is contained in:
parent
c9c5155333
commit
39f031adb5
2 changed files with 21 additions and 1 deletions
|
@ -7,6 +7,7 @@ class GBAController < Controller
|
|||
getter height : Int32 = 160
|
||||
|
||||
@debug_window = false
|
||||
@scheduler_window = false
|
||||
|
||||
def initialize(bios : String?, rom : String)
|
||||
@emu = GBA::GBA.new(bios || gba_bios, rom)
|
||||
|
@ -23,6 +24,7 @@ class GBAController < Controller
|
|||
|
||||
def render_debug_items : Nil
|
||||
ImGui.menu_item("Video", "", pointerof(@debug_window))
|
||||
ImGui.menu_item("Scheduler", "", pointerof(@scheduler_window))
|
||||
end
|
||||
|
||||
def render_windows : Nil
|
||||
|
@ -34,6 +36,24 @@ class GBAController < Controller
|
|||
end
|
||||
ImGui.end
|
||||
end
|
||||
if @scheduler_window
|
||||
cycles = @emu.scheduler.cycles
|
||||
ImGui.begin("Scheduler", pointerof(@scheduler_window))
|
||||
ImGui.text("Total cycles: #{cycles}")
|
||||
ImGui.begin_table("Table", 2)
|
||||
ImGui.table_setup_column("Cycles")
|
||||
ImGui.table_setup_column("Type")
|
||||
ImGui.table_headers_row
|
||||
@emu.scheduler.events.each do |event|
|
||||
ImGui.table_next_row
|
||||
ImGui.table_set_column_index 0
|
||||
ImGui.text_unformatted (event.cycles - cycles).to_s
|
||||
ImGui.table_set_column_index 1
|
||||
ImGui.text_unformatted event.type.to_s
|
||||
end
|
||||
ImGui.end_table
|
||||
ImGui.end
|
||||
end
|
||||
end
|
||||
|
||||
private def render_palettes_tab_item : Nil
|
||||
|
|
|
@ -19,7 +19,7 @@ class Scheduler
|
|||
|
||||
private record Event, cycles : UInt64, proc : Proc(Nil), type : EventType
|
||||
|
||||
@events : Deque(Event) = Deque(Event).new 10
|
||||
getter events : Deque(Event) = Deque(Event).new 10
|
||||
getter cycles : UInt64 = 0
|
||||
@next_event : UInt64 = UInt64::MAX
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue