Log inGet started
Package

emulatorCore.assetType

README.md

emulatorCore (asset type)

A pluggable console emulator: the machine spec the RetroConsole cabinet discovers and boots. Publishing a new <name>.emulatorCore asset (in any package) makes that console appear in every cabinet in the world — the cabinet enumerates asset.list("emulatorCore") live, so cores install like any other content, with no cabinet changes.

Instance shape

<name>.emulatorCore/init.luau returns the core spec:

return {
	id = "nes",                     -- stable key: save/store namespaces derive from it
	name = "NES",                   -- select-screen label
	cover = "cover_nes",            -- optional: texture reference shown on the select screen
	extensions = { "nes" },         -- cartridge extensions, lowercase, first = default
	width = 256,                    -- native framebuffer size
	height = 240,
	fps = 60.0988,                  -- hardware frame rate
	romsDir = "/zero/source/nes_roms",
	storePrefix = "nes_roms/",      -- runtime-data cartridge library namespace
	savesPrefix = "nes_saves/",     -- battery-save namespace; omit if the console has none
	make = function(bytes) ... end, -- romBytes -> machine; raises on a bad ROM
	validate = function(bytes) ... end, -- ok, err — gate for uploads/URL fetches
	framebuffer = function(m) ... end,  -- machine -> RGBA8 buffer (width*height*4)
	applyInput = function(m) ... end,   -- read the keyboard, set machine input
	neutralInput = function(m) ... end, -- release every button (called on disengage)
	voices = function(m) ... end,   -- optional: { {active, hz, vol, noise} } for MIDI
	statusFor = function(m) ... end,-- optional one-line status; defaults to m.title
	ram = {                         -- optional battery accessors
		isDirty = function(m) ... end,
		clearDirty = function(m) ... end,
		get = function(m) ... end,
		set = function(m, bytes) ... end,
	},
}

The machine contract behind make is the retro.host one: m:runFrame() advances one video frame; m.title keys battery saves and the status line.

Reading a spec

asset.resolve("<name>", "emulatorCore"):spec() loads and caches the spec (the type's behavior.luau provides :spec() on every reference).