Documentation
¶
Index ¶
Constants ¶
const ( MemorySaveRAM = iota // Maps to RETRO_MEMORY_SAVE_RAM MemorySystemRAM // Maps to RETRO_MEMORY_SYSTEM_RAM )
Memory region type constants for MemoryMapper.
const ( ButtonUp = 0 ButtonDown = 1 ButtonLeft = 2 ButtonRight = 3 )
Standard d-pad button bit positions (always bits 0-3).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatterySaver ¶
type BatterySaver interface {
// HasSRAM reports whether the loaded ROM uses battery-backed save.
HasSRAM() bool
// GetSRAM returns a copy of the current SRAM contents.
GetSRAM() []byte
// SetSRAM loads SRAM contents into the emulator.
SetSRAM(data []byte)
}
BatterySaver enables SRAM persistence for battery-backed saves.
type Button ¶
type Button struct {
Name string
ID int // Bit position in the uint32 bitmask (4+)
DefaultKey string // Default keyboard key for standalone UI (e.g., "J", "Enter")
DefaultPad string // Default gamepad button for standalone UI (e.g., "A", "Start")
}
Button describes a system-specific button with its display name and bit position in the input bitmask.
type CoreFactory ¶
type CoreFactory interface {
// SystemInfo returns system metadata for UI configuration.
SystemInfo() SystemInfo
// CreateEmulator creates a new emulator instance with the given ROM and region.
CreateEmulator(rom []byte, region Region) (Emulator, error)
// DetectRegion auto-detects the region from ROM data.
// The bool return indicates whether the region was found in the database.
DetectRegion(rom []byte) (Region, bool)
}
CoreFactory creates emulator instances and provides system metadata.
type CoreOption ¶
type CoreOption struct {
Key string
Label string
Description string
Type CoreOptionType
Default string
Values []string // Options for Select type
Min int // Minimum for Range type
Max int // Maximum for Range type
Step int // Step size for Range type
Category CoreOptionCategory // Settings section routing
PerGame bool // Whether this can be overridden per game
}
CoreOption describes a configurable core setting.
type CoreOptionCategory ¶ added in v0.2.0
type CoreOptionCategory int
CoreOptionCategory identifies the settings section for a core option.
const ( CoreOptionCategoryAudio CoreOptionCategory = iota CoreOptionCategoryVideo CoreOptionCategoryInput CoreOptionCategoryCore )
type CoreOptionType ¶
type CoreOptionType int
CoreOptionType identifies the kind of core option.
const ( CoreOptionBool CoreOptionType = iota CoreOptionSelect CoreOptionRange )
type Emulator ¶
type Emulator interface {
// RunFrame executes one frame of emulation.
RunFrame()
// GetFramebuffer returns the current frame as RGBA pixel data.
GetFramebuffer() []byte
// GetFramebufferStride returns bytes per row in the framebuffer.
GetFramebufferStride() int
// GetActiveHeight returns the current active display height in pixels.
GetActiveHeight() int
// GetAudioSamples returns stereo 16-bit PCM audio samples for the frame.
GetAudioSamples() []int16
// SetInput sets controller state as a button bitmask for the given player.
SetInput(player int, buttons uint32)
// GetRegion returns the current video region.
GetRegion() Region
// SetRegion changes the video region.
SetRegion(region Region)
// GetTiming returns FPS and scanline count for the current region.
GetTiming() Timing
// SetOption applies a core option change identified by key.
SetOption(key string, value string)
// Close releases any resources held by the emulator.
Close()
}
Emulator is the core interface that every emulator adapter must implement.
type MemoryInspector ¶
type MemoryInspector interface {
// ReadMemory reads from a flat address into buf and returns the number
// of bytes read. The core adapter maps flat addresses to internal memory.
ReadMemory(addr uint32, buf []byte) uint32
}
MemoryInspector enables flat address-based memory reads for RetroAchievements.
type MemoryMapper ¶
type MemoryMapper interface {
// MemoryMap returns a list of available memory regions with sizes.
MemoryMap() []MemoryRegion
// ReadRegion returns a copy of the specified memory region.
ReadRegion(regionType int) []byte
// WriteRegion writes data to the specified memory region.
WriteRegion(regionType int, data []byte)
}
MemoryMapper enables libretro-style named memory region access.
type MemoryRegion ¶
MemoryRegion describes a named memory region and its size.
type SaveStater ¶
type SaveStater interface {
// Serialize captures the complete emulator state.
Serialize() ([]byte, error)
// Deserialize restores emulator state from previously serialized data.
Deserialize(data []byte) error
}
SaveStater enables save states, rewind, and auto-save.
type SystemInfo ¶
type SystemInfo struct {
Name string
ConsoleName string
Extensions []string
ScreenWidth int
MaxScreenHeight int
AspectRatio float64
SampleRate int
Buttons []Button
Players int
CoreOptions []CoreOption
RDBName string
ThumbnailRepo string
DataDirName string
ConsoleID int
CoreName string
CoreVersion string
SerializeSize int
}
SystemInfo describes an emulator system for UI configuration.