Skip to main content

Module facade

Module facade 

Source
Expand description

The pure emulation-core facade: load a ROM, step a frame, expose the framebuffer + audio.

std-only (#[cfg(feature = "std")]) since it needs heap collections beyond alloc alone (zip archive extraction) and is meant for a real host process — every consumer that embeds this crate as a library (the native/wasm frontend, rustysnes-libretro, any future host) drives the emulator through EmuCore rather than reaching into crate::scheduler::System directly. Debugger-only concerns (breakpoints, single-step, register/VRAM/CGRAM/OAM snapshots) deliberately stay OUTSIDE this facade — those are frontend-owned (built on EmuCore::system_mut’s raw access), not something every consumer needs.

v1.2.0: relocated here from rustysnes-frontend::emu (that crate’s dependency weight — winit/wgpu/cpal/egui — is wrong for a libretro core or any other headless embedding). The frontend keeps a thin wrapper (rustysnes-frontend::emu::EmuCore) around this type that adds the debugger fields; zero behavior change for existing frontend call sites.

Structs§

EmuCore
The pure emulation-core facade: load a ROM, step a frame, expose the framebuffer + audio.

Enums§

EmuError
ROM-load / emulation errors surfaced to a host.

Constants§

MAX_H
The maximum framebuffer height (see MAX_W).
MAX_W
The maximum framebuffer size a consumer’s texture/surface needs to be sized for (hi-res worst case), so a video-mode change never needs a realloc. Sub-modes occupy the top-left sub-rect.
SNES_H_HIRES
SNES hi-res / interlace height (448 = 224 active * 2 fields).
SNES_H_NTSC
SNES NTSC active-region height (224 visible scanlines).
SNES_H_PAL
SNES PAL active-region height (239 visible scanlines).
SNES_W
SNES native width (constant across the NTSC/PAL active-region heights and the lo-res mode).
SNES_W_HIRES
SNES hi-res / pseudo-hi-res width (mode 5/6 + interlace double the base dims).

Functions§

active_height
The active-region framebuffer height for a region (256 wide always).
bgr555_to_rgba8
Expand a 15-bit SNES BGR555 color word (0bbbbbgggggrrrrr) to a packed little-endian RGBA8 (0xAABBGGRR) value suitable for an RGBA8 framebuffer / texture upload.