mirror of
https://github.com/mattrberry/crab.git
synced 2024-12-28 09:58:49 +01:00
support halting + fast-forwarding the scheduler on halt
this improves performance dramatically in games that utilize halting, including pokemon ruby and golden sun. in both games, framerate was doubled or trippled in many cases
This commit is contained in:
parent
b8c64fa69d
commit
c584c29fd6
4 changed files with 13 additions and 6 deletions
|
@ -136,8 +136,10 @@ class CPU
|
|||
else
|
||||
arm_execute instr
|
||||
end
|
||||
@gba.scheduler.tick 1
|
||||
else
|
||||
@gba.scheduler.fast_forward
|
||||
end
|
||||
@gba.tick 1
|
||||
end
|
||||
|
||||
def check_cond(cond : Word) : Bool
|
||||
|
|
|
@ -83,8 +83,4 @@ class GBA
|
|||
cpu.tick
|
||||
end
|
||||
end
|
||||
|
||||
def tick(cycles : Int) : Nil
|
||||
scheduler.tick cycles
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,7 +67,11 @@ class MMIO
|
|||
mask = 0xFF00_u16 >> shift
|
||||
@waitcnt.value = (@waitcnt.value & mask) | value.to_u16 << shift
|
||||
elsif io_addr == 0x301
|
||||
@gba.cpu.halted = bit?(value, 7)
|
||||
if bit?(value, 7)
|
||||
abort "Stopping not supported"
|
||||
else
|
||||
@gba.cpu.halted = true
|
||||
end
|
||||
elsif not_used? io_addr
|
||||
else
|
||||
puts "Unmapped MMIO write ~ addr:#{hex_str index.to_u32}, val:#{hex_str value}".colorize(:yellow)
|
||||
|
|
|
@ -63,4 +63,9 @@ class Scheduler
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fast_forward : Nil
|
||||
@cycles = @next_event
|
||||
call_current
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue