One read-only bulk read in the shim, fly_gb_read_memory_image: the address space's memory in address order, the register windows (VRAM, OAM, I/O) read $FF because binjgb's catch-up on a register read moves the exported state. MemoryImage, Cartridge and ImageReader put an image and the ROM behind MemoryReader, so the same macro engine and adapter run over it; the emulator's bank reads go through the same Cartridge. ROM tests prove the read leaves the state byte-identical, equals the single and cached reads, changes nothing downstream, and measure its cost.
51 lines
1.8 KiB
Rust
51 lines
1.8 KiB
Rust
//! Game Boy half of `flysim`: the binjgb emulator core linked natively, plus
|
|
//! the game adapters that turn WRAM into reward and progress.
|
|
//!
|
|
//! ```text
|
|
//! ROM bytes -> Emulator::run_frame -> RGBA frame + PCM + WRAM
|
|
//! |
|
|
//! GameAdapter::sample -> RewardEvent
|
|
//! |
|
|
//! Ratchet::observe -> recover_game
|
|
//! ```
|
|
//!
|
|
//! The crate deliberately knows nothing about neurons. [`recovery`] takes the
|
|
//! neural side as closures so `flysim` can wire `flybrain-core` without this
|
|
//! crate depending on it.
|
|
//!
|
|
//! What is vendored, how to regenerate the symbol table, the exact audio format
|
|
//! and the save-state caveat are all in the crate README.
|
|
|
|
pub mod adapter;
|
|
pub mod compatibility;
|
|
pub mod emulator;
|
|
mod ffi;
|
|
pub mod image;
|
|
pub mod macros;
|
|
mod ordered;
|
|
pub mod platformer;
|
|
pub mod pokemon_red;
|
|
pub mod ratchet;
|
|
pub mod recovery;
|
|
|
|
pub use adapter::{
|
|
AdapterError, DecoderPresetId, GameAdapter, MemoryReader, ProgressSnapshot, RewardEvent,
|
|
adapter_for, adapter_for_with_rom_pin,
|
|
};
|
|
pub use compatibility::Compatibility;
|
|
pub use image::{
|
|
CAPTURED, Cartridge, ImageError, ImageReader, MEMORY_IMAGE_CONTENT_TYPE, MEMORY_IMAGE_LEN,
|
|
MemoryImage, NOT_CAPTURED, captured,
|
|
};
|
|
pub use emulator::{
|
|
DEFAULT_AUDIO_FRAMES, DEFAULT_AUDIO_FREQUENCY, Emulator, FRAMEBUFFER_LEN, GbError,
|
|
SCREEN_HEIGHT, SCREEN_WIDTH, buttons,
|
|
};
|
|
pub use macros::{
|
|
AdapterLedger, MacroPalette, NoLedger, Observed, Outcome, PaletteMode, RunLedger, SceneId,
|
|
SlotBinding, Started, macro_channels, palette_for,
|
|
};
|
|
pub use platformer::PlatformerAdapter;
|
|
pub use pokemon_red::PokemonRedReward;
|
|
pub use ratchet::{Ratchet, RatchetState, RecoveryPolicy, Snapshot};
|
|
pub use recovery::{ClosureRecovery, NeuralRecovery, recover_game};
|