Docs: Updated Lua documentation with recent changes
This commit is contained in:
parent
512bf31acb
commit
eddfe2301c
5 changed files with 61 additions and 19 deletions
|
@ -9,16 +9,19 @@ chapter: false
|
|||
|
||||
### New Features ###
|
||||
|
||||
* New event callback: [**<kbd>scriptEnded</kbd>**](/apireference/enums.html#eventtype)
|
||||
* New event callback: <kbd>[scriptEnded](/apireference/enums.html#eventtype)</kbd>.
|
||||
* New functions to get PRG/CHR ROM offsets based on a CPU/PPU address: <kbd>[getPrgRomOffset](/apireference/memoryaccess.html#getprgromoffset)</kbd> and <kbd>[getChrRomOffset](/apireference/memoryaccess.html#getchrromoffset)</kbd>.
|
||||
|
||||
### Changes ###
|
||||
|
||||
* The end address parameter for <kbd>[addMemoryCallback](/apireference/callbacks.html#addmemorycallback)</kbd> and <kbd>[removeMemoryCallback](/apireference/callbacks.html#removememorycallback)</kbd> is now optional.
|
||||
* The <kbd>[drawRectangle](/apireference/drawing.html#drawrectangle)</kbd> function now accepts negative height/width values.
|
||||
* Added a new *delay* parameter to <kbd>[drawRectangle](/apireference/drawing.html#drawrectangle)</kbd>, <kbd>[drawLine](/apireference/drawing.html#drawline)</kbd>, <kbd>[drawString](/apireference/drawing.html#drawstring)</kbd> and <kbd>[drawPixel](/apireference/drawing.html#drawpixel)</kbd>.
|
||||
* The <kbd>[endFrame](/apireference/enums.html#eventtype)</kbd> event now triggers on scanline 240 instead of scanline 241.
|
||||
|
||||
### Bug Fixes ###
|
||||
|
||||
* <kbd>[addMemoryCallback](/apireference/callbacks.html#addmemorycallback)</kbd> and <kbd>[removeMemoryCallback](/apireference/callbacks.html#removememorycallback)</kbd> no longer exclude the end address from the range.
|
||||
* <kbd>[addMemoryCallback](/apireference/callbacks.html#addmemorycallback)</kbd> and <kbd>[removeMemoryCallback](/apireference/callbacks.html#removememorycallback)</kbd> no longer exclude the end address from the range.
|
||||
|
||||
|
||||
## Changes between 0.9.4 and 0.9.5 ##
|
||||
|
|
|
@ -27,13 +27,14 @@ All drawing-related functions share a few properties:
|
|||
|
||||
**Syntax**
|
||||
|
||||
emu.drawPixel(x, y, color, duration)
|
||||
emu.drawPixel(x, y, color [, duration, delay])
|
||||
|
||||
**Parameters**
|
||||
x - *Integer* X position
|
||||
y - *Integer* Y position
|
||||
color - *Integer* Color
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
delay - *Integer* Number of frames to wait before drawing the pixel (Default: 0 frames)
|
||||
|
||||
**Return value**
|
||||
*None*
|
||||
|
@ -45,7 +46,7 @@ Draws a pixel at the specified (x, y) coordinates using the specified color for
|
|||
|
||||
**Syntax**
|
||||
|
||||
emu.drawLine(x, y, x2, y2, color, duration)
|
||||
emu.drawLine(x, y, x2, y2, color [, duration, delay])
|
||||
|
||||
**Parameters**
|
||||
x - *Integer* X position (start of line)
|
||||
|
@ -53,7 +54,8 @@ y - *Integer* Y position (start of line)
|
|||
x2 - *Integer* X position (end of line)
|
||||
y2 - *Integer* Y position (end of line)
|
||||
color - *Integer* Color
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
delay - *Integer* Number of frames to wait before drawing the line (Default: 0 frames)
|
||||
|
||||
**Return value**
|
||||
*None*
|
||||
|
@ -65,7 +67,7 @@ Draws a line between (x, y) to (x2, y2) using the specified color for a specific
|
|||
|
||||
**Syntax**
|
||||
|
||||
emu.drawRectangle(x, y, width, height, color, fill, duration)
|
||||
emu.drawRectangle(x, y, width, height, color, fill [, duration, delay])
|
||||
|
||||
**Parameters**
|
||||
x - *Integer* X position
|
||||
|
@ -74,7 +76,8 @@ width - *Integer* The rectangle's width
|
|||
height - *Integer* The rectangle's height
|
||||
color - *Integer* Color
|
||||
fill - *Boolean* Whether or not to draw an outline, or a filled rectangle.
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
delay - *Integer* Number of frames to wait before drawing the rectangle (Default: 0 frames)
|
||||
|
||||
**Return value**
|
||||
*None*
|
||||
|
@ -87,7 +90,7 @@ If *fill* is false, only the rectangle's outline will be drawn.
|
|||
|
||||
**Syntax**
|
||||
|
||||
emu.drawString(x, y, text, textColor, backgroundColor, duration)
|
||||
emu.drawString(x, y, text, textColor, backgroundColor [, duration, delay])
|
||||
|
||||
**Parameters**
|
||||
x - *Integer* X position
|
||||
|
@ -95,7 +98,8 @@ y - *Integer* Y position
|
|||
text- *String* The text to display
|
||||
textColor - *Integer* Color to use for the text
|
||||
backgroundColor - *Integer* Color to use for the text's background color
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
duration - *Integer* Number of frames to display (Default: 1 frame)
|
||||
delay - *Integer* Number of frames to wait before drawing the text (Default: 0 frames)
|
||||
|
||||
**Return value**
|
||||
*None*
|
||||
|
|
|
@ -18,7 +18,7 @@ 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 241)
|
||||
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.)
|
||||
stateLoaded = 6, Triggered when a user manually loads a savestate
|
||||
stateSaved = 7, Triggered when a user manually saves a savestate
|
||||
|
|
|
@ -65,3 +65,35 @@ To avoid triggering side-effects, use the [memType.cpuDebug](/apireference/enums
|
|||
**Description**
|
||||
Reverts all modifications done to PRG-ROM and CHR-ROM via write/writeWord calls.
|
||||
|
||||
|
||||
## getPrgRomOffset ##
|
||||
|
||||
**Syntax**
|
||||
|
||||
emu.getPrgRomOffset(address)
|
||||
|
||||
**Parameters**
|
||||
address - *Integer* A CPU address (Valid range: $0000-$FFFF)
|
||||
|
||||
**Return value**
|
||||
*Integer* The corresponding byte offset in PRG ROM
|
||||
|
||||
**Description**
|
||||
Returns an integer representing the byte offset of the specified CPU address in PRG ROM based on the mapper's current configuration. Returns -1 when the specified address is not mapped to PRG ROM.
|
||||
|
||||
|
||||
## getChrRomOffset ##
|
||||
|
||||
**Syntax**
|
||||
|
||||
emu.getChrRomOffset(address)
|
||||
|
||||
**Parameters**
|
||||
address - *Integer* A PPU address (Valid range: $0000-$3FFF)
|
||||
|
||||
**Return value**
|
||||
*Integer* The corresponding byte offset in CHR ROM
|
||||
|
||||
**Description**
|
||||
Returns an integer representing the byte offset of the specified PPU address in CHR ROM based on the mapper's current configuration. Returns -1 when the specified address is not mapped to CHR ROM.
|
||||
|
||||
|
|
|
@ -467,20 +467,20 @@ namespace Mesen.GUI.Debugger
|
|||
static readonly List<List<string>> _availableFunctions = new List<List<string>>() {
|
||||
new List<string> {"enum", "emu", "", "", "", "", "" },
|
||||
new List<string> {"func","emu.addEventCallback","emu.addEventCallback(function, type)","function - A Lua function.\ntype - *Enum* See eventCallbackType.","Returns an integer value that can be used to remove the callback by calling removeEventCallback.","Registers a callback function to be called whenever the specified event occurs.",},
|
||||
new List<string> {"func","emu.removeEventCallback","emu.removeEventCallback(reference, type)","reference - The value returned by the call to[addEventCallback] (#addEventCallback).\ntype - *Enum* See eventCallbackType.","","Removes a previously registered callback function.",},
|
||||
new List<string> {"func","emu.addMemoryCallback","emu.addMemoryCallback(function, type, startAddress, endAddress)","function - A Lua function.\ntype - *Enum* See memCallbackType\nstartAddress - *Integer* Start of the CPU memory address range to register the callback on.\nendAddress - *Integer* End of the CPU memory address range to register the callback on.","Returns an integer value that can be used to remove the callback by callingremoveMemoryCallback.","Registers a callback function to be called whenever the specified event occurs."},
|
||||
new List<string> {"func","emu.removeMemoryCallback","emu.removeMemoryCallback(reference, type, startAddress, endAddress)","reference - The value returned by the call to[addMemoryCallback] (#addMemoryCallback).\ntype - *Enum* See memCallbackType.\nstartAddress - *Integer* Start of the CPU memory address range to unregister the callback from.\nendAddress - *Integer* End of the CPU memory address range to unregister the callback from.","","Removes a previously registered callback function."},
|
||||
new List<string> {"func","emu.removeEventCallback","emu.removeEventCallback(reference, type)","reference - The value returned by the call to addEventCallback.\ntype - *Enum* See eventCallbackType.","","Removes a previously registered callback function.",},
|
||||
new List<string> {"func","emu.addMemoryCallback","emu.addMemoryCallback(function, type, startAddress, endAddress)","function - A Lua function.\ntype - *Enum* See memCallbackType\nstartAddress - *Integer* Start of the CPU memory address range to register the callback on.\nendAddress - (optional) *Integer* End of the CPU memory address range to register the callback on.","Returns an integer value that can be used to remove the callback by callingremoveMemoryCallback.","Registers a callback function to be called whenever the specified event occurs."},
|
||||
new List<string> {"func","emu.removeMemoryCallback","emu.removeMemoryCallback(reference, type, startAddress, endAddress)","reference - The value returned by the call to addMemoryCallback.\ntype - *Enum* See memCallbackType.\nstartAddress - *Integer* Start of the CPU memory address range to unregister the callback from.\nendAddress - (optional) *Integer* End of the CPU memory address range to unregister the callback from.","","Removes a previously registered callback function."},
|
||||
new List<string> {"func","emu.read","emu.read(address, type, signed)","address - *Integer* The address/offset to read from.\ntype - *Enum* The type of memory to read from. See memType.\nsigned - (optional) *Boolean* If true, the value returned will be interpreted as a signed value.","An 8-bit (read) or 16-bit (readWord) value.","Reads a value from the specified memory type.\n\nWhen calling read / readWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.\nTo avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects."},
|
||||
new List<string> {"func","emu.readWord","emu.readWord(address, type, signed)","address - *Integer* The address/offset to read from.\ntype - *Enum* The type of memory to read from. See memType.\nsigned - (optional) *Boolean* If true, the value returned will be interpreted as a signed value.","An 8-bit (read) or 16-bit (readWord) value.","Reads a value from the specified memory type.\n\nWhen calling read / readWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.\nTo avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects."},
|
||||
new List<string> {"func","emu.write","emu.write(address, value, type)","address - *Integer* The address/offset to write to.\nvalue - *Integer* The value to write.\ntype - *Enum* The type of memory to write to. See memType.","","Writes an 8-bit or 16-bit value to the specified memory type.\n\nNormally read-only types such as PRG-ROM or CHR-ROM can be written to when using memType.prgRom or memType.chrRom.\nChanges will remain in effect until a power cycle occurs.\nTo revert changes done to ROM, see revertPrgChrChanges.\n\nWhen calling write / writeWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.\nTo avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects."},
|
||||
new List<string> {"func","emu.writeWord","emu.writeWord(address, value, type)","address - *Integer* The address/offset to write to.\nvalue - *Integer* The value to write.\ntype - *Enum* The type of memory to write to. See memType.","","Writes an 8-bit or 16-bit value to the specified memory type.\n\nNormally read-only types such as PRG-ROM or CHR-ROM can be written to when using memType.prgRom or memType.chrRom.\nChanges will remain in effect until a power cycle occurs.\nTo revert changes done to ROM, see revertPrgChrChanges.\n\nWhen calling write / writeWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.\nTo avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects."},
|
||||
new List<string> {"func","emu.revertPrgChrChanges","emu.revertPrgChrChanges()","","","Reverts all modifications done to PRG-ROM and CHR-ROM via write/writeWord calls."},
|
||||
new List<string> {"func","emu.drawPixel","emu.drawPixel(x, y, color, duration)","x - *Integer* X position\ny - *Integer* Y position\ncolor - *Integer* Color\nduration - *Integer* Number of frames to display(Default: 1 frame)","","Draws a pixel at the specified (x, y) coordinates using the specified color for a specific number of frames."},
|
||||
new List<string> {"func","emu.drawLine","emu.drawLine(x, y, x2, y2, color, duration)","x - *Integer* X position(start of line)\ny - *Integer* Y position(start of line)\nx2 - *Integer* X position(end of line)\ny2 - *Integer* Y position(end of line)\ncolor - *Integer* Color\nduration - *Integer* Number of frames to display(Default: 1 frame)","","Draws a line between(x, y) to(x2, y2) using the specified color for a specific number of frames."},
|
||||
new List<string> {"func","emu.drawRectangle","emu.drawRectangle(x, y, width, height, color, fill, duration)","x - *Integer* X position\ny - *Integer* Y position\nwidth - *Integer* The rectangle's width\nheight - *Integer* The rectangle's height\ncolor - *Integer* Color\nfill - * Boolean* Whether or not to draw an outline, or a filled rectangle.\nduration - *Integer* Number of frames to display(Default: 1 frame)","","Draws a rectangle between(x, y) to(x+width, y+height) using the specified color for a specific number of frames.\nIf *fill* is false, only the rectangle's outline will be drawn."},
|
||||
new List<string> {"func","emu.drawString","emu.drawString(x, y, text, textColor, backgroundColor, duration)","x - *Integer* X position\ny - *Integer* Y position\ntext- *String* The text to display\ntextColor - *Integer* Color to use for the text\nbackgroundColor - *Integer* Color to use for the text's background color\nduration - *Integer* Number of frames to display(Default: 1 frame)","","Draws text at(x, y) using the specified text and colors for a specific number of frames."},
|
||||
new List<string> {"func","emu.drawPixel","emu.drawPixel(x, y, color, duration, delay)","x - *Integer* X position\ny - *Integer* Y position\ncolor - *Integer* Color\nduration - *Integer* Number of frames to display (Default: 1 frame)\ndelay - *Integer* Number of frames to wait before drawing the pixel (Default: 0 frames)","","Draws a pixel at the specified (x, y) coordinates using the specified color for a specific number of frames."},
|
||||
new List<string> {"func","emu.drawLine","emu.drawLine(x, y, x2, y2, color, duration, delay)","x - *Integer* X position (start of line)\ny - *Integer* Y position (start of line)\nx2 - *Integer* X position (end of line)\ny2 - *Integer* Y position (end of line)\ncolor - *Integer* Color\nduration - *Integer* Number of frames to display (Default: 1 frame)\ndelay - *Integer* Number of frames to wait before drawing the line (Default: 0 frames)","","Draws a line between (x, y) to (x2, y2) using the specified color for a specific number of frames."},
|
||||
new List<string> {"func","emu.drawRectangle","emu.drawRectangle(x, y, width, height, color, fill, duration, delay)","x - *Integer* X position\ny - *Integer* Y position\nwidth - *Integer* The rectangle's width\nheight - *Integer* The rectangle's height\ncolor - *Integer* Color\nfill - *Boolean* Whether or not to draw an outline, or a filled rectangle.\nduration - *Integer* Number of frames to display (Default: 1 frame)\ndelay - *Integer* Number of frames to wait before drawing the rectangle (Default: 0 frames)","","Draws a rectangle between (x, y) to (x+width, y+height) using the specified color for a specific number of frames.\nIf *fill* is false, only the rectangle's outline will be drawn."},
|
||||
new List<string> {"func","emu.drawString","emu.drawString(x, y, text, textColor, backgroundColor, duration, delay)","x - *Integer* X position\ny - *Integer* Y position\ntext- *String* The text to display\ntextColor - *Integer* Color to use for the text\nbackgroundColor - *Integer* Color to use for the text's background color\nduration - *Integer* Number of frames to display (Default: 1 frame)\ndelay - *Integer* Number of frames to wait before drawing the text (Default: 0 frames)","","Draws text at (x, y) using the specified text and colors for a specific number of frames."},
|
||||
new List<string> {"func","emu.clearScreen","emu.clearScreen()","","","Removes all drawings from the screen."},
|
||||
new List<string> {"func","emu.getPixel","emu.getPixel(x, y)","x - *Integer* X position\ny - *Integer* Y position","*Integer* ARGB color","Returns the color(in ARGB format) of the PPU's output for the specified location."},
|
||||
new List<string> {"func","emu.getPixel","emu.getPixel(x, y)","x - *Integer* X position\ny - *Integer* Y position","*Integer* ARGB color","Returns the color (in ARGB format) of the PPU's output for the specified location."},
|
||||
new List<string> {"func","emu.displayMessage","emu.displayMessage(category, text)","category - *String* The category is the portion shown between brackets[]\ntext - *String* Text to show on the screen","","Displays a message on the main window in the format '[category] text'"},
|
||||
new List<string> {"func","emu.log","emu.log(text)","text - *String* Text to log","","Logs the given string in the script's log window - useful for debugging scripts."},
|
||||
new List<string> {"func","emu.getState","emu.getState()","","* Table* Current emulation state","Return a table containing information about the state of the CPU, PPU, APU and cartridge."},
|
||||
|
@ -497,6 +497,9 @@ namespace Mesen.GUI.Debugger
|
|||
new List<string> {"func","emu.getAccessCounters","emu.getAccessCounters(counterMemType, counterOpType)", "counterMemType - *Enum* A value from the emu.counterMemType enum\ncounterOpType - *Enum* A value from the emu.counterOpType enum", "*Array* 32-bit integers", "Returns an array of access counters for the specified memory and operation types."},
|
||||
new List<string> {"func","emu.resetAccessCounters","emu.resetAccessCounters()", "", "", "Resets all access counters."},
|
||||
|
||||
new List<string> {"func", "emu.getPrgRomOffset", "emu.getPrgRomOffset(address)", "address - *Integer* A CPU address (Valid range: $0000-$FFFF)", "*Integer* The corresponding byte offset in PRG ROM", "Returns an integer representing the byte offset of the specified CPU address in PRG ROM based on the mapper's current configuration.\nReturns -1 when the specified address is not mapped to PRG ROM."},
|
||||
new List<string> {"func", "emu.getChrRomOffset", "emu.getChrRomOffset(address)", "address - *Integer* A PPU address (Valid range: $0000-$3FFF)", "*Integer* The corresponding byte offset in CHR ROM", "Returns an integer representing the byte offset of the specified PPU address in CHR ROM based on the mapper's current configuration.\nReturns -1 when the specified address is not mapped to CHR ROM."},
|
||||
|
||||
new List<string> {"func","emu.saveSavestate","emu.saveSavestate()","","*String* A string containing a binary blob representing the emulation's current state.","Creates a savestate and returns it as a binary string. (The savestate is not saved on disk)\n Note: this can only be called from within a “startFrame” event callback or “cpuExec” memory callback."},
|
||||
new List<string> {"func","emu.loadSavestate","emu.loadSavestate(savestate)","savestate - *String* A binary blob representing a savestate, as returned by saveSavestate()","","Loads the specified savestate.\nNote: this can only be called from within a “startFrame” event callback or “cpuExec” memory callback."},
|
||||
new List<string> {"func","emu.saveSavestateAsync","emu.saveSavestateAsync()","slotNumber - *Integer* A slot number to which the savestate data will be stored (slotNumber must be >= 0)","","Queues a save savestate request. As soon at the emulator is able to process the request, it will be saved into the specified slot.\nThis API is asynchronous because save states can only be taken in-between 2 CPU instructions, not in the middle of an instruction.\nWhen called while the CPU is in-between 2 instructions (e.g: inside the callback of an cpuExec or startFrame event),\nthe save state will be taken immediately and its data will be available via getSavestateData right after the call to saveSavestateAsync.\nThe savestate can be loaded by calling the loadSavestateAsync function."},
|
||||
|
|
Loading…
Add table
Reference in a new issue