LiveSplit / asr

Helper crate to write auto splitters for LiveSplit One's auto splitting runtime.
https://livesplit.org/asr/asr
Apache License 2.0
10 stars 10 forks source link

Added support for `future` for emulators #84

Closed Jujstme closed 10 months ago

Jujstme commented 10 months ago

This commit adds support for future when coding autosplitters for emulators, allowing to code similarly compared to native pc games. The internal update() function, which is usually necessary in emulators to ensure correct updating of the main ram_base address, gets called automatically in this case, so this also removes the need to manually call said function on every iteration of the main loop.

The downside is using a internal mutability for the main state and ram_base variable, however they are not publicly accessible so this should not raise many concerns.

async fn main() {
    loop {
        let emulator = ps1::Emulator::wait_attach().await;
        emulator.until_closes(async {
            loop {
                // TODO: Do something on every tick.
               next_tick().await;
            }
        }).await;
    }
}