mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Display the number of cycles needed to load the frame
This commit is contained in:
parent
d94d9dbcf3
commit
06b6075a6a
|
@ -788,6 +788,9 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
let mut mixer = agb.mixer.mixer(&mut timer_controller.timer0);
|
let mut mixer = agb.mixer.mixer(&mut timer_controller.timer0);
|
||||||
|
|
||||||
let mut timer = timer_controller.timer1;
|
let mut timer = timer_controller.timer1;
|
||||||
|
let mut timer_cascade = timer_controller.timer2;
|
||||||
|
timer_cascade.set_cascade(true);
|
||||||
|
timer_cascade.set_enabled(true);
|
||||||
timer.set_enabled(true);
|
timer.set_enabled(true);
|
||||||
|
|
||||||
object.set_sprite_palettes(object_sheet::object_sheet.palettes);
|
object.set_sprite_palettes(object_sheet::object_sheet.palettes);
|
||||||
|
@ -880,16 +883,28 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
agb::input::ButtonController::new(),
|
agb::input::ButtonController::new(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let before_init_cycles = timer.get_value();
|
|
||||||
level.background.init_background(&mut vram);
|
|
||||||
let after_init_cycles = timer.get_value();
|
|
||||||
|
|
||||||
music_box.before_frame(&mut mixer);
|
music_box.before_frame(&mut mixer);
|
||||||
mixer.frame();
|
mixer.frame();
|
||||||
vblank.wait_for_vblank();
|
vblank.wait_for_vblank();
|
||||||
mixer.after_vblank();
|
mixer.after_vblank();
|
||||||
|
let (before_init_cycles, before_init_cycles_2) =
|
||||||
|
(timer.get_value(), timer_cascade.get_value());
|
||||||
|
|
||||||
|
level.background.init_background(&mut vram);
|
||||||
|
|
||||||
|
let (after_init_cycles, after_init_cycles_2) =
|
||||||
|
(timer.get_value(), timer_cascade.get_value());
|
||||||
|
let after_init_cycles =
|
||||||
|
(after_init_cycles as u32) | ((after_init_cycles_2 as u32) << 16);
|
||||||
|
let before_init_cycles =
|
||||||
|
(before_init_cycles as u32) | ((before_init_cycles_2 as u32) << 16);
|
||||||
|
|
||||||
|
music_box.before_frame(&mut mixer);
|
||||||
|
mixer.frame();
|
||||||
agb::println!("cycles for init {}", after_init_cycles - before_init_cycles);
|
agb::println!("cycles for init {}", after_init_cycles - before_init_cycles);
|
||||||
|
vblank.wait_for_vblank();
|
||||||
|
|
||||||
|
mixer.after_vblank();
|
||||||
|
|
||||||
level.background.init_foreground(&mut vram);
|
level.background.init_foreground(&mut vram);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue