Mesen-X/apireference/index.xml

58 lines
No EOL
8.3 KiB
XML

<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Lua API reference on Mesen Documentation</title><link>/apireference.html</link><description>Recent content in Lua API reference on Mesen Documentation</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="/apireference/index.xml" rel="self" type="application/rss+xml"/><item><title>Changelog</title><link>/apireference/changelog.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/changelog.html</guid><description>Changes between 0.9.7 and 0.9.8 New Features New function to get a label&amp;rsquo;s current CPU address: getLabelAddress Changes between 0.9.6 and 0.9.7 No changes.
Changes between 0.9.5 and 0.9.6 New Features New event callback: scriptEnded. New functions to get PRG/CHR ROM offsets based on a CPU/PPU address: getPrgRomOffsetand getChrRomOffset. New function for use with the test runner mode: stop Changes The end address parameter for addMemoryCallbackand removeMemoryCallbackis now optional.</description></item><item><title>Callbacks</title><link>/apireference/callbacks.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/callbacks.html</guid><description>addEventCallback Syntax
emu.addEventCallback(function, type) Parameters
function - A Lua function.
type - Enum See eventType.
Return value
Returns an integer value that can be used to remove the callback by calling removeEventCallback.
Description
Registers a callback function to be called whenever the specified event occurs.
The callback function receives no parameters.
removeEventCallback Syntax
emu.removeEventCallback(reference, type) Parameters
reference - The value returned by the call to addEventCallback.
type - Enum See eventType.</description></item><item><title>Drawing</title><link>/apireference/drawing.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/drawing.html</guid><description>Drawing basics All drawing-related functions share a few properties:
(x, y) coordinates must be between (0, 0) and (255, 239)
The &amp;ldquo;duration&amp;rdquo; is specified as a number of frames during which the drawing must remain on the screen. This defaults to 1 frame when unspecified, and draw calls will be permanent (until a call to clearScreen) if duration is set to 0.
Colors are integers in ARGB format:</description></item><item><title>Emulation</title><link>/apireference/emulation.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/emulation.html</guid><description>getState Syntax
emu.getState() Return value
Table Current emulation state with the following structure:
region: int, clockRate: int, cpu: { status: int, a: int, irqFlag: int, cycleCount: int (64-bit, unsigned), pc: int, y: int, x: int, sp: int, nmiFlag: bool }, ppu: { cycle: int, scanline: int, frameCount: int, control: { backgroundEnabled: bool, intensifyBlue: bool, intensifyRed: bool, backgroundPatternAddr: int, grayscale: bool, verticalWrite: bool, intensifyGreen: bool, nmiOnVBlank: bool, spritesEnabled: bool, spritePatternAddr: int, spriteMask: bool, largeSprites: bool, backgroundMask: bool }, status: {, spriteOverflow: bool, verticalBlank: bool, sprite0Hit: bool }, state: { status: int, lowBitShift: int, xScroll: int, highBitShift: int, videoRamAddr: int, control: int, mask: int, tmpVideoRamAddr: int, writeToggle: bool, spriteRamAddr: int } }, apu: { square1: { outputVolume: int, frequency: float, duty: int, period: int, enabled: bool, dutyPosition: int, sweepShift: int, sweepPeriod: int, sweepEnabled: bool, sweepNegate: bool envelope: { counter: int, loop: bool, divider: int, volume: int, startFlag: bool, constantVolume: bool }, lengthCounter: { halt: bool, counter: int, reloadValue: int } }, square2: { outputVolume: int, frequency: float, duty: int, period: int, enabled: bool, dutyPosition: int, sweepShift: int, sweepPeriod: int, sweepEnabled: bool, sweepNegate: bool, envelope: { counter: int, loop: bool, divider: int volume: int, startFlag: bool, constantVolume: bool }, lengthCounter: { halt: bool, counter: int, reloadValue: int } }, triangle: { outputVolume: int, frequency: float, sequencePosition: int, period: int, enabled: bool, lengthCounter: { halt: bool, counter: int, reloadValue: int } }, noise: { modeFlag: bool, enabled: bool, outputVolume: int, frequency: float, period: int, shiftRegister: int, envelope: { counter: int, loop: bool, divider: int, volume: int, startFlag: bool, constantVolume: bool }, lengthCounter: { halt: bool, counter: int, reloadValue: int } }, dmc: { sampleLength: int, irqEnabled: bool, loop: bool, outputVolume: int, bytesRemaining: int, sampleAddr: int, period: int, sampleRate: float }, frameCounter: { fiveStepMode: int, irqEnabled: int, sequencePosition: int } }, cart: { selectedPrgPages: array, chrRomSize: int, chrRamSize: int, prgPageCount: int, chrPageSize: int, selectedChrPages: array, chrPageCount: int, prgRomSize: int, prgPageSize: int, } Description</description></item><item><title>Input</title><link>/apireference/input.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/input.html</guid><description>getInput Syntax
emu.getInput(port) Parameters
port - Integer The port number to read (0 to 3)
Return value
Table A table containing the status of all 8 buttons.
Description
Returns a table containing the status of all 8 buttons: { a, b, select, start, up, down, left, right }
setInput Syntax
emu.setInput(port, input) Parameters
port - Integer The port number to apply the input to (0 to 3)
input - Table A table containing the state of some (or all) of the 8 buttons (same format as returned by getInput)</description></item><item><title>Logging</title><link>/apireference/logging.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/logging.html</guid><description>displayMessage Syntax
emu.displayMessage(category, text) Parameters
category - String The category is the portion shown between brackets []
text - String Text to show on the screen
Return value
None
Description
Displays a message on the main window in the format &amp;ldquo;[category] text&amp;rdquo;
log Syntax
emu.log(text) Parameters
text - String Text to log
Return value
None
Description
Logs the given string in the script&amp;rsquo;s log window - useful for debugging scripts.</description></item><item><title>Memory Access</title><link>/apireference/memoryaccess.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/memoryaccess.html</guid><description>read / readWord Syntax
emu.read(address, type, signed = false) emu.readWord(address, type, signed = false) Parameters
address - Integer The address/offset to read from.
type - Enum The type of memory to read from. See memType.
signed - (optional) Boolean If true, the value returned will be interpreted as a signed value.
Return value
An 8-bit (read) or 16-bit (readWord) value.
Description
Reads a value from the specified memory type.</description></item><item><title>Miscellaneous</title><link>/apireference/misc.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/misc.html</guid><description>Save States There are 2 separate save state APIs.
The first one is synchronous and uses the saveSavestate and loadSavestate functions. Its main restriction is that it can only be used inside &amp;ldquo;startFrame&amp;rdquo; or &amp;ldquo;cpuExec&amp;rdquo; callback functions.
The second API is asynchronous and uses an internally-managed &amp;ldquo;save slot&amp;rdquo; system to hold states in memory. It uses the following functions: saveSavestateAsync, loadSavestateAsync, getSavestateData and clearSavestateData.
saveSavestate Syntax
emu.saveSavestate() Return value</description></item><item><title>Enums</title><link>/apireference/enums.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/apireference/enums.html</guid><description>eventType Syntax
emu.eventType.[value] Values
reset = 0, Triggered when a soft reset occurs nmi = 1, Triggered when an nmi occurs irq = 2, Triggered when an irq occurs startFrame = 3, Triggered at the start of a frame (cycle 0, scanline -1) endFrame = 4, Triggered at the end of a frame (cycle 0, scanline 240) codeBreak = 5, Triggered when code execution breaks (e.g due to a breakpoint, etc.</description></item></channel></rss>