Cleanup
This commit is contained in:
parent
cd89a4c57d
commit
ea2fc95905
|
@ -9,23 +9,15 @@ function initialize_emulator() {
|
||||||
setTimeout(function refreshFrame() {
|
setTimeout(function refreshFrame() {
|
||||||
let current = performance.now();
|
let current = performance.now();
|
||||||
let diff = current - last_update;
|
let diff = current - last_update;
|
||||||
let realdiff = current - last_update;
|
|
||||||
//let remaining = Math.max((16 * Emulator.get_speed()) - diff, 0);
|
//let remaining = Math.max((16 * Emulator.get_speed()) - diff, 0);
|
||||||
last_update = current;
|
last_update = current;
|
||||||
|
|
||||||
let runtime = Emulator.run_system_for(system, diff * 1_000_000);
|
let runtime = Emulator.run_system_for(system, diff * 1_000_000);
|
||||||
if (Emulator.is_running()) {
|
if (Emulator.is_running()) {
|
||||||
let remaining = Math.max(diff - runtime - (diff * 0.1), 1);
|
let remaining = Math.max(diff - runtime - (diff * 0.1), 1);
|
||||||
console.log(realdiff, diff, runtime, remaining);
|
|
||||||
setTimeout(refreshFrame, remaining);
|
setTimeout(refreshFrame, remaining);
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
/*
|
|
||||||
setTimeout(function refreshFrame() {
|
|
||||||
let run_time = run_system_for(system, 66_000_000);
|
|
||||||
setTimeout(refreshFrame, 66 - run_time);
|
|
||||||
}, 0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
Emulator.host_run_loop(host);
|
Emulator.host_run_loop(host);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ pub fn run_system_for(handle: &mut SystemHandle, nanos: u32) -> usize {
|
||||||
log::error!("{:?}", err);
|
log::error!("{:?}", err);
|
||||||
}
|
}
|
||||||
let run_time = run_timer.elapsed().as_millis();
|
let run_time = run_timer.elapsed().as_millis();
|
||||||
log::warn!("ran simulation for {:?}ms in {:?}ms", nanoseconds_per_frame / 1_000_000, run_time);
|
log::debug!("ran simulation for {:?}ms in {:?}ms", nanoseconds_per_frame / 1_000_000, run_time);
|
||||||
run_time as usize
|
run_time as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
todo.txt
4
todo.txt
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
* can you refactor the update timeout to put it in rust? Would that make it faster? (the tricky part is the closure)
|
||||||
|
* re-enable sound on webassembly, see if it works (it does not. Very lagged and jittery with what sounds like repeated frames)
|
||||||
|
|
||||||
|
|
||||||
* can you somehow speed up the memory accessing through the sim? The dyn Addressable is causing a fair amount of overhead
|
* can you somehow speed up the memory accessing through the sim? The dyn Addressable is causing a fair amount of overhead
|
||||||
* can you somehow make devices have two step functions for running things at different times? (I'm thinking ym2612 audio gen vs timers)
|
* can you somehow make devices have two step functions for running things at different times? (I'm thinking ym2612 audio gen vs timers)
|
||||||
* should you rename devices.rs traits.rs?
|
* should you rename devices.rs traits.rs?
|
||||||
|
|
Loading…
Reference in New Issue