3 lsnes is SNES rerecording emulator based on bsnes core.
9 (a) v084-v087 (v084 or v085 for delayreset support)
11 (b) accuracy or compatiblity core with debugger enabled.
13 (c) Patched version (using included 7 patches)
21 5. boost_thread (if native std::thread is not available)
25 7. sdlmain (SDL only, part of SDL)
27 8. boost_conversion (this is header-only library)
29 9. libswscale (wxwidgets graphics only)
31 10. Portaudio (portaudio sound only)
33 11. Lua (if Lua support is needed).
35 • Version 5.1.X or 5.2X.
37 12. G++ 4.6 (bsnes doesn't seem to like 4.7).
41 • Copy bsnes sources (the bsnes subdirectory) to subdirectory
44 • Patch the bsnes sources with included patches (directory
45 'bsnes-patches/<version>')
47 • Edit options.build (or copy of that file)
49 • Run make (passing 'OPTIONS=<filename>' if using something else
52 4 Command line options
56 <kind> in the following can be one of:
58 • rom: Cartridge ROM (BIOS for special carts). This is required.
60 • bsx: BS-X (non-slotted) Game flash ROM.
62 • bsxslotted: BS-X (slotted) Game flash ROM.
66 • slot-a: Sufami Turbo Slot A ROM
68 • slot-b: Sufami Turbo Slot B ROM
70 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
72 Load <file> as specified ROM (SFC/BS/DMG/ST file format).
74 4.1.2 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
76 Override hardware detection for ROM, reading the values from
77 <file> (BSNES XML format).
79 4.1.3 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
81 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple
82 times, the patches are applied in order.
84 4.1.4 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
86 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified
87 multiple times, the patches are applied in order.
89 4.1.5 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
91 Set offset to apply to IPS patches. May be negative. Handy for
92 applying headered IPS patches (use offset of -512 for this). The
93 offset must be 0 for BPS patches.
97 Force ROM to be considered PAL-only.
99 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
101 • Attempting to load NTSC movie file will error out.
105 Force ROM to be considered NTSC-only.
107 • Attempting to load PAL movie file will error out.
115 4.2.2 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
117 Load <filename> as movie or savestate file. All other session
120 4.2.3 --port1=<device> (lsnes/SDL)
122 Set type of port1. Valid values are:
124 • none: No device connected
126 • gamepad: One gamepad (the default)
128 • multitap: Four gamepads (warning: makes most games refuse to
133 4.2.4 --port2=<type> (lsnes/SDL)
135 Set type of port2. Valid values are:
137 • none: No device connected (the default)
139 • gamepad: One gamepad
141 • multitap: Four gamepads.
145 • superscope: Super Scope
147 • justifier: One justifier
149 • justifiers: Two justifiers
151 4.2.5 --gamename=<name> (lsnes/SDL)
153 Set the name of game to <name>. Default is blank.
155 4.2.6 --author=<name> (lsnes/SDL)
157 Add author with full name of <name> (no nickname).
159 4.2.7 --author=|<name> (lsnes/SDL)
161 Add author with nickname of <name> (no full name).
163 4.2.8 --author=<fullname>|<nickname> (lsnes/SDL)
165 Add author with full name of <fullname> and nickname of
168 4.2.9 --rtc-second=<value> (lsnes/SDL)
170 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
173 4.2.10 --rtc-subsecond=<value> (lsnes/SDL)
175 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
179 4.3.1 --run=<file> (lsnes/SDL)
181 After running main RC file, run this file. If multiple are
182 specified, these execute in order specified.
184 4.4 dump options (lsnes-dumpavi only)
186 4.4.1 --dumper=<dumper>
188 Set the dumper to use (required). Use 'list' for listing of known
193 Set the mode to use (required for dumpers with multiple modes,
194 forbidden otherwise). Use 'list' for known modes.
196 4.4.3 --prefix=<prefix>
198 Set dump prefix. Default is “avidump”.
200 4.4.4 --option=<name>=<value>
202 Set option <name> to value <value>.
204 4.4.5 --length=<length>
206 Set number of frames to dump. Mandatory.
210 Run specified lua script (lsnes-dumpavi does not have
211 initialization files).
213 4.4.7 --load-library=<library>
215 Load the specified shared object / dynamic library / dynamic link
218 5 Startup file lsnes.rc
220 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
221 commands. This file is located in:
223 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
225 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME
228 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
230 • All: ./lsnes.rc (fallback default).
232 If leading directories do not exist, attempt to create them is
237 • Commands beginning with '*' invoke the corresponding command
238 without alias expansion.
240 • If command starts with '+' (after possible '*'), the command is
241 executed as-is when button is pressed, and when button is
242 released, it is executed with '+' replaced by '-'.
244 • Commands without '+' execute only on negative edge (release).
248 Settings control various aspects of emulator behaviour.
250 6.1.1 set-setting <setting> <value>
252 Sets setting <setting> to value <value> (may be empty).
254 6.1.2 unset-setting <setting>
256 Try to unset setting <setting> (not all settings can be unset).
258 6.1.3 get-setting <setting>
260 Read value of setting <setting>
264 Print names and values of all settings.
268 Keybindings bind commands or aliases to keys (or pseudo-keys).
272 • Do not bind edge active (+/-) commands to keys with modifiers,
273 that won't work right!
275 • Names of keys and modifiers are platform-dependent.
277 • Be careful before binding pseudo-keys (such as joystick axes,
278 buttons or hats) with modifiers. That may or may not work
281 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
283 Bind <command> to key <key> (activating if modifiers in <modmask>
284 (comma-seperated list) are set as <mod> (comma-seperated list).
286 The names of keys and modifiers are platform-dependent.
288 6.2.2 unbind-key [<mod>/<modmask>] <key>
290 Unbind command from <key> (with specified <mod> and <modmask>).
292 6.2.3 set-axis <axis> [disabled | axis | axis-inverse |
293 pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0
294 | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>]
297 Set axis parameters for axis <axis>.
299 • disabled: Disable axis
303 • axis-inverse: Inverse axis
305 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
307 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
309 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
311 • pressure-+: Pressure sensitive. Released at -, pressed at +.
313 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
315 • pressure+-: Pressure sensitive. Released at +, pressed at -.
317 • minus=<val>: Calibration at extreme minus position
320 • zero=<val>: Calibration at neutral position (-32768-32767)
322 • plus=<val>: Calibration at extreme plus position (-32768-32767)
324 • tolerance=<value>: Center band tolerance (0<x<1). The smaller
325 the value, the more sensitive the control is.
329 Print all key bindings in effect.
333 Aliases bind command to sequence of commands. After alias has
334 been defined, it replaces the command it shadows.
338 • You can't alias command to itself.
340 • Aliases starting with +/- are edge active just like ordinary
341 commands starting with +/-.
343 • One command can be aliased to multiple commands.
345 6.3.1 alias-command <command> <expansion>
347 Append <expansion> to alias <command>. If alias does not already
348 exist, it is created.
350 6.3.2 unalias-command <command>
352 Clear alias expansion for <command>.
356 Print all aliases and their expansions in effect.
358 6.4 run-script <script>
360 Run <script> as if commands were entered on the command line.
364 Following commands control video dumping:
366 6.5.1 start-dump <dumper> [<mode>] <prefix/filename>
368 Start dumping using dumper <dumper>. If mode is present or not
369 and if prefix or filename is present depends on the dumper and
372 The following dumpers are available:
374 • INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
376 – Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes
379 – Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
381 • INTERNAL-JMD: Internal .jmd dumper.
383 – Does not take mode.
387 • INTERNAL-RAW: Internal RAW dumper.
389 – Does not take mode.
393 – Sound is big-endian signed 16-bit, usually at 32040.5Hz.
395 – Video is always upscaled to double resolution (512x448 / 512
398 – Video framerate is usually 322445/6448 fps for PAL and
399 10738636/178683 fps for NTSC.
401 • INTERNAL-SDMP: Internal SDMP dumper.
403 – Mode 'ms': Multi-segment. Takes prefix.
405 – Mode 'ss': Single-segment. Takes filename.
407 6.5.2 end-dump <dumper>
409 End dumping using <dumper>
411 6.5.3 show-dumpers [<dumper>]
413 Show the list of dumpers or list of modes for <dumper>
415 6.6 Memory manipulation
417 <address> may be decimal or hexadecimal (prefixed with '0x').
418 <value> can be hexadecimal (prefixed with '0x'), unsigned or
419 signed (prefixed with '-') decimal.
421 The available element <sizes> are:
431 When reading RAM and ROM, multi-byte reads/writes are big-endian.
432 When dealing with DSP memory, multi-byte reads/writes are
433 native-endian (do not use operand sizes exceeding DSP bitness,
434 except dword is OK for 24-bit memory).
436 6.6.1 read-<size> <address>
438 Read the value of byte in <address>.
440 6.6.2 read-s<size> <address>
442 Read the value of signed byte in <address>.
444 6.6.3 write-<size> <address> <value>
446 Write <value> to byte in address <address>.
448 6.6.4 search-memory reset
450 Reset the memory search
452 6.6.5 search-memory count
454 Print number of candidates remaining
456 6.6.6 search-memory print
458 Print all candidates remaining
460 6.6.7 search-memory <usflag><sizeflag><op>
462 Searches memory for addresses satisfying criteria.
482 • lt: < previous value.
484 • le: <= previous value.
486 • eq: = previous value.
488 • ne: != previous value.
490 • ge: >= previous value.
492 • gt: > previous value.
494 6.6.8 search-memory <sizeflag> <value>
496 Searches for addresses that currently have value <value>.
497 <sizeflag> is as in previous command.
501 These commands are not available in lsnesrc, but are available
502 after ROM has been loaded.
504 6.7.1 quit-emulator [/y]
506 Quits the emulator (asking for confirmation). If /y is given, no
507 confirmation is asked.
511 Toggle paused/unpaused
515 Advance frame. If the button is still held after configurable
516 timeout expires, game unpauses for the duration frame advance is
521 Advance subframe. If the button is still held after configurable
522 timeout expires, game unpauses for the duration frame advance is
525 6.7.5 advance-skiplag
527 Skip to first poll in frame after current.
531 Reset the SNES after this frame.
533 6.7.7 load <filename>
535 Load savestate <filename> in current mode.
537 6.7.8 load-state <filename>
539 Load savestate <filename> in readwrite mode.
541 6.7.9 load-readonly <filename>
543 Load savestate <filename> in readonly mode.
545 6.7.10 load-preserve <filename>
547 Load savestate <filename> in readonly mode, preserving current
550 6.7.11 load-movie <filename>
552 Load savestate <filename>, ignoring save part in readonly mode.
554 6.7.12 save-state <filename>
556 Save system state to <filename> as soon as possible.
558 6.7.13 save-movie <filename>
560 Save movie to <filename>.
572 Toggle between read-only and read-write modes.
574 6.7.17 set-gamename <name>
576 Set name of the game to <name>
580 Print the name of the game.
582 6.7.19 add-author <author>
584 Adds new author <author>. If <author> does not contain '|' it is
585 full name. If it contains '|', '|' splits the full name and
588 6.7.20 edit-author <num> <author>
590 Edit the author in slot <num> (0-based) to be <author> (see
591 add-author for format)
593 6.7.21 remove-author <num>
595 Remove author in slot <num>
601 6.7.23 test-1, test-2, test-3
603 Internal test commands. Don't use.
605 6.7.24 take-screenshot <filename>
607 Save screenshot to <filename>.
609 6.7.25 +controller<num><button>
611 Press button <button> on controller <num> (1-8). The following
612 button names are known:
646 6.7.26 controllerh<num><button>
648 Hold/unhold button <button> on controller <num> (1-8). See
649 +controller for button names.
651 6.7.27 controllerf<num><button>
653 Hold/unhold button <button> on controller <num> (1-8) for the
654 next frame. See +controller for button names.
656 Cauntion: Does not work properly if outside frame advance.
658 6.7.28 autofire (<pattern>|-)...
660 Set autofire pattern. Each parameter is comma-separated list of
661 button names (in form of 1start, 1A, 2B, etc..) to hold on that
662 frame. After reaching the end of pattern, the pattern restarts
671 6.8.1 cycle-jukebox-backward
673 Cycle save jukebox backwards.
675 6.8.2 cycle-jukebox-forward
677 Cycle save jukebox forwards
681 Do load from jukebox (current mode).
685 Do state save to jukebox.
689 Only available if lua support is compiled in.
691 6.9.1 evaluate-lua <luacode>
693 Run Lua code <luacode> using built-in Lua interpretter.
695 6.9.2 run-lua <script>
697 Run specified lua file using built-in Lua interpretter.
701 Clear the Lua VM state and restore to factory defaults.
705 6.10.1 add-watch <name> <expression>
707 Adds new watch (or modifies old one).
709 6.10.2 remove-watch <name>
715 6.11.1 enable-sound <on/off>
717 Enable/Disable sound.
719 6.11.2 set-sound-device <device>
721 Set sound device to <device>
723 6.11.3 show-sound-status
725 Show status of sound system.
727 6.11.4 show-sound-devices
729 Show all available devices.
731 6.11.5 set-volume <multiplier>
733 Set the volume multiplier to <multiplier>. 1 is normal volume,
734 and higher numbers are louder.
736 6.11.6 set-volume <multiplier>%
738 Set the volume multiplier to <multiplier> percent. 100 is normal
739 volume, and higher numbers are louder.
741 6.11.7 set-volume <multiplier>dB
743 Set the volume multiplier to <multiplier> dB. 0 is normal volume,
744 and higher numbers are louder. The value may be negative.
746 6.12 SDL Platform commands
748 The following are valid on SDL platform.
752 Asks to press a key and then identifies that (pseudo-)key.
754 6.12.2 toggle-console
756 Toggle between windowed/fullscreen console.
760 Scroll messages window as far back as it goes.
762 6.12.4 scroll-fulldown
764 Scroll messages window as far forward as it goes.
768 Scroll messages window back one screenful.
772 Scroll messages window forward one screenful.
774 6.12.7 prompt-command <command>
776 Enter command prompt, with prompt prepopulated with specified
785 Set where bsnes looks for firmware files. Default is “.”.
789 Set the target . Numeric, range is 0.001 to “infinite”. Default
792 7.1.3 savecompression
794 Set save compression level (integer 0-9). Default is 7 (0 is no
797 7.1.4 advance-timeout
799 Set the frame advance timeout in milliseconds. Numeric integer,
800 range is 0-999999999. Default is 500.
802 7.2 AVI dumper settings
806 AVI dumper: Always dump at 512x448 or 512x478 regardless of what
809 7.2.2 avi-left-border
811 AVI dumper: Set the default left border thickness (unless lua
812 overrides) for dumps. Range 0-8191. Default is 0.
814 7.2.3 avi-right-border
816 AVI dumper: Set the default right border thickness (unless lua
817 overrides) for dumps. Range 0-8191. Default is 0.
821 AVI dumper: Set the default top border thickness (unless lua
822 overrides) for dumps. Range 0-8191. Default is 0.
824 7.2.5 avi-bottom-border
826 AVI dumper: Set the default bottom border thickness (unless lua
827 overrides) for dumps. Range 0-8191. Default is 0.
831 AVI dumper: Maximum number of frames per dump segment (0 =>
832 unlimited). Range 0-999999999. Default is 0.
834 7.2.7 avi-compresison
836 AVI dumper: Compression level (0-18).
838 • Compression levels 10 and above are not compatible with stock
841 • Recomended level is 7.
845 AVI dumper: Set method of determining the sound rate.
847 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48,
848 64, 88.2, 96, 128, 176.4 and 192 kHz.
850 • 1: Round down to nearest integer.
852 • 2: Round up to nearest ingeter.
858 JMD dumper: Compression level (0-9).
860 7.4 SDL platform settings
862 7.4.1 autorepeat-first-delay
864 Sets the delay for first character in typematic autorepeat.
866 7.4.2 autorepeat-subsequent-delay
868 Sets the delay for subsequent characters in typematic autorepeat.
872 8.1 Core (in main table)
876 Print line to message console.
878 8.1.2 exec(string command)
880 Run command as it was entered on the command line
884 Returns two values. First is time since some epoch in seconds,
885 the second is microseconds mod 10^6 since that epoch.
887 8.1.4 emulator_ready()
889 Returns true if emulator has finished booting, false if not
890 (on_startup() will be issued later).
892 8.1.5 set_idle_timeout(number timeout)
894 Set number of microseconds to block idle for. After this timeout
895 has expired, on_idle() will be called once.
897 8.1.6 set_timer_timeout(number timeout)
899 Set number of microseconds to block timer for. After this timeout
900 has expired, on_timer() will be called once.
902 8.1.7 bus_address(number snesaddr)
904 Returns virtual address corresponding to specified address on
909 Bitwise logical functions and related.
911 8.2.1 bit.none(number...) / bit.bnot(number...)
913 48-bit bitwise NOT / NONE function (set bits that are set in none
916 8.2.2 bit.any(number...) / bit.bor(number...)
918 48-bit bitwise OR / ANY function (set bits that are set in any of
921 8.2.3 bit.all(number...) / bit.band(number...)
923 48-bit bitwise AND / ALL function (set bits that are set in all
926 8.2.4 bit.parity(number...) / bit.bxor(number...)
928 48-bit bitwise XOR / PARITY function (set bits that are set in
929 odd number of the arguments).
931 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
933 Rotate bits-bit (max 48, default 48) number left by amount
936 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
938 Rotate bits-bit (max 48, default 48) number right by amount
941 8.2.7 bit.lshift(number base[, number amount[, number bits]])
943 Shift bits-bit (max 48, default 48) number left by amount
944 (default 1) places. The new bits are filled with zeroes.
946 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
948 Shift bits-bit (max 48, default 48) number logically right by
949 amount (default 1) places. The new bits are filled with zeroes.
951 8.2.9 bit.arshift(number base[, number amount[, number bits]])
953 Shift bits-bit (max 48, default 48) number arithmetically right
954 by amount (default 1) places. The new bits are shifted in with
955 copy of the high bit.
957 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
959 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1
964 • Bit numbers up to 51 should work reliably (then things start
965 falling apart due to double precision issues).
967 • There are two special bit positions, true and false, standing
968 for always set bit and always clear bit.
970 8.2.11 bit.value([number bit1[, number bit2,...]])
972 Returns bitwise OR of 1 left shifted by bit1 places, 1 left
973 shifted by bit2 places and so on. As special value, nil argument
978 Most of these functions can only be called in on_paint and
979 on_video callbacks. Exceptions are noted.
981 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are
982 the green component, bits 16-23 are the red component, bits 24-31
983 are alpha component (0 is fully opaque, 255 is almost
984 transparent). -1 is the fully transparent color. Alpha values
985 greater than 127 do work.
987 Origin of coordinates is at top left corner of game display area.
988 Left and top gaps correspond to negative coordinates.
990 8.3.1 gui.resolution()
992 Returns 2-tuple (hresolution, vresolution).
994 8.3.2 gui.<class>_gap(number gap)
996 Set the <class> (left, right, top, bottom) gap to specified value
999 8.3.3 gui.text(number x, number y, string text[, number fgc[,
1002 Draw specified text on the GUI (each character cell is 8 or 16
1003 wide and 16 high). Parameters:
1005 • x: X-coordinate to start the drawing from (and x-coordinate at
1006 begining of the lines).
1008 • y: Y-coordinate to start the drawing from.
1010 • text: The text to draw.
1012 • fgc: Text color (default is 0xFFFFFF (white))
1014 • bgc: Background color (default is -1 (transparent))
1016 8.3.4 gui.textH(number x, number y, string text[, number fgc[,
1019 Like gui.text, but draw using double-width.
1021 8.3.5 gui.textV(number x, number y, string text[, number fgc[,
1024 Like gui.text, but draw using double-height.
1026 8.3.6 gui.textHV(number x, number y, string text[, number fgc[,
1029 Like gui.text, but draw using double-width/double-height.
1031 8.3.7 gui.rectangle(number x, number y, number width, number
1032 height[, number thickness[, number outline[, number fill]]])
1034 Draw rectangle on the GUI. Parameters:
1036 • x: X-coordinate of left edge.
1038 • y: Y-coordinate of upper edge.
1040 • width: Width of rectangle.
1042 • height: Height of rectangle.
1044 • thickness: Thickness of outline (default is 1).
1046 • outline: Color of outline (default is 0xFFFFFF (white))
1048 • fill: Color of fill (default is -1 (transparent))
1050 8.3.8 gui.box(number x, number y, number width, number height[,
1051 number thickness[, number outline1[,number outline2[, number
1054 Draw rectangle with 3D effect on the GUI. Parameters:
1056 • x: X-coordinate of left edge.
1058 • y: Y-coordinate of upper edge.
1060 • width: Width of rectangle.
1062 • height: Height of rectangle.
1064 • thickness: Thickness of outline (default is 1).
1066 • outline1: First color of outline (default is 0xFFFFFF (white))
1068 • outline2: First color of outline (default is 0x808080 (dark
1071 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1073 8.3.9 gui.pixel(number x, number y[, number color])
1075 Draw one pixel on the GUI. Parameters:
1077 • x: X-coordinate of the pixel
1079 • y: Y-coordinate of the pixel
1081 • color: Color of the pixel (default is 0xFFFFFF (white))
1083 8.3.10 gui.crosshair(number x, number y[, number length[, number
1086 Draw a crosshair. Parameters:
1088 • x: X-coordinate of the crosshair
1090 • y: Y-coordinate of the crosshair
1092 • length: Length of the crosshair lines (default 10).
1094 • color: Color of the crosshair (default is 0xFFFFFF (white))
1096 8.3.11 gui.line(number x1, number y1, number x2, number y2[,
1099 Draw a thin line. Parameters:
1101 • x1: X-coordinate of one end.
1103 • y1: Y-coordinate of one end.
1105 • x2: X-coordinate of the other end.
1107 • y2: Y-coordinate of the other end.
1109 • color: Color of the line (default is 0xFFFFFF (white)).
1111 8.3.12 gui.circle(number x, number y, number r[, number thick[,
1112 number border[, number fil]]])
1114 Draw a circle. Parameters.
1116 • x: X-coordinate of the center
1118 • y: Y-coordinate of the center
1120 • r: The radius of the circle
1122 • thick: Border thickness
1124 • border: Border color (default is 0xFFFFFF (white))
1126 • fill: Fill color (default is -1 (transparent)).
1128 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
1131 Draw a bitmap on screen with specified palette. Parameters:
1133 • x: X-coordinate of left edge.
1135 • y: Y-coordinate of top edge.
1137 • bitmap: The bitmap to draw
1139 • palette: The palette to draw the bitmap using.
1141 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1143 Draw a bitmap on screen. Parameters:
1145 • x: X-coordinate of left edge.
1147 • y: Y-coordinate of top edge.
1149 • bitmap: The bitmap to draw
1151 8.3.15 gui.palette_new()
1153 Returns a new palette (initially all transparent). Can be used
1156 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool
1159 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1161 • w: The width of new bitmap
1163 • h: The height of new bitmap
1165 • direct: If true, the returned bitmap is dbitmap, otherwise
1168 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
1171 8.3.17 gui.bitmap_load(string file)
1173 Returns loaded bitmap/dbitmap (if bitmap, the second return value
1174 is palette for bitmap). Can be used anywhere. Parameters:
1176 • file: The name of file to load.
1178 8.3.18 gui.palette_set(palette palette, number index, number
1181 Sets color in palette. Can be used anywhere. Parameters:
1183 • palette: The palette to manipulate
1185 • index: Index of color (0-65535).
1187 • color: The color value.
1189 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
1192 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1194 • bitmap: The bitmap to manipulate
1196 • x: The x-coordinate of the pixel.
1198 • y: The y-coordinate of the pixel.
1200 • color: If bitmap is a bitmap, color index (0-65535). Otherwise
1203 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1205 Get size of bitmap. Can be used anywhere. Parameters:
1207 • bitmap: The bitmap to query.
1209 The first return is the width, the second is the height.
1211 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
1212 bitmap/dbitmap src, number sx, number sy, number w, number h[,
1215 Blit a part of bitmap to another. Can be used anywhere.
1218 • dest: Destination to blit to.
1220 • dx: left edge of target
1222 • dy: Top edge of target
1224 • src: The source to blit from. Must be of the same type as
1227 • sx: left edge of source
1229 • sy: Top edge of source
1231 • w: Width of region
1233 • h: Height of region.
1235 • ck: Color key. Pixels of this color are not blitted.
1237 – If bitmaps are bitmaps, this is color index of colorkey.
1238 Values outside range 0-65535 cause no key to be used as
1241 – If bitmaps are dbitmaps, this color value of colorkey.
1243 – May be absent or nil for no colorkey blit.
1245 8.3.22 gui.repaint()
1247 Request on_repaint() to happen as soon as possible. Can be used
1250 8.3.23 gui.subframe_update(boolean on)
1252 Request subframe updates (calling on_paint() on subframes) to
1253 happen (on=true) or not happen (on=false). Can be used anywhere.
1255 8.3.24 gui.screenshot(string filename)
1257 Write PNG screenshot of the current frame (no drawings) to
1258 specified file. Can be used anywhere.
1260 8.3.25 gui.color(number r, number g, number b[, number a])
1262 Returns color (in notation Lua scripts use) corresponding to
1263 color (r,g,b), each component in scale 0-255. If a is specified,
1264 that is alpha (0 is fully transparent, 256(sic) is fully opaque).
1265 The default alpha is 256.
1267 8.3.26 gui.status(string name, string value)
1269 Set status field “L[<name>]” to <value> in status area. Can be
1272 8.3.27 gui.rainbow(number step, number steps[, number color])
1274 Perform hue rotation of color <color> (default bright red), by
1275 <step> steps. The number of steps per full rotation is given by
1276 absolute value of <steps>.
1278 If <steps> is negative, the rotation will be counterclockwise.
1282 Input handling. Only available in on_input callback.
1284 8.4.1 input.get(number controller, number index)
1286 Read the specified index (0-11) from specified controller (0-7).
1289 • Uses physical controller numbering. Gamepad in port 2 is
1290 controller 4, not 1!
1292 8.4.2 input.set(number controller, number index, number value)
1294 Write the specified index (0-11) from specified controller (0-7),
1295 storing value. Notes:
1297 • Uses physical controller numbering. Gamepad in port 2 is
1298 controller 4, not 1!
1300 8.4.3 input.geta(number controller)
1302 Get input state for entiere controller. Returns 13 return values.
1304 • 1st return value: Bitmask: bit i is set if i:th index is
1307 • 2nd-13th return value: value of i:th index.
1309 8.4.4 input.seta(number controller, number bitmask, number
1312 Set state for entiere controller. args is up to 12 values for
1313 indices (overriding values in bitmask if specified).
1315 8.4.5 input.controllertype(number controller)
1317 Get the type of controller as string. Valid values are:
1327 8.4.6 input.reset([number cycles])
1329 Execute reset. If cycles is greater than zero, do delayed reset.
1330 0 (or no value) causes immediate reset.
1332 • Only available with subframe flag false.
1336 Returns table of tables of all available keys and axes. The first
1337 table is indexed by key name (platform-dependent!), and the inner
1338 table has the following fields:
1340 • last_rawval: Last reported raw value for control.
1342 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse,
1343 hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p,
1344 pressure-pm, pressure-p0).
1346 • cal_left: Minimum calibration value. Only meaningful with axis
1349 • cal_center: Center calibration value. Only meaningful with axis
1352 • cal_right: Maximum calibration value. Only meaningful with axis
1355 • cal_tolerance: Dead zone tolerance. Only meaningful with axis
1358 8.4.8 input.keyhook(key, state)
1360 Requests that keyhook events to be sent for key (state=true) or
1361 not sent (state=false).
1363 8.5 Table hostmemory
1365 Host memory handling (extra memory saved to savestates). Host
1366 memory starts empty.
1368 8.5.1 hostmemory.read(number address)
1370 Reads hostmemory slot address. Slot numbers out of range return
1371 false instead of numeric.
1373 8.5.2 hostmemory.write(number address, number value)
1375 Writes hostmemory slot with 0-255. Slot numbers out of range
1376 cause extension of host memory slot space.
1378 8.5.3 hostmemory.readbyte(number address)
1380 Read unsigned byte (1 element) from given address. Slots out of
1383 8.5.4 hostmemory.writebyte(number address, number value)
1385 Write unsigned byte (1 element) to given slot. Slot numbers out
1386 of range cause extension.
1388 8.5.5 hostmemory.readsbyte(number address)
1390 Read signed byte (1 element) from given address. Slots out of
1393 8.5.6 hostmemory.writesbyte(number address, number value)
1395 Write signed byte (1 element) to given slot. Slot numbers out of
1396 range cause extension.
1398 8.5.7 hostmemory.readword(number address)
1400 Read unsigned word (2 elements) from given address. Slots out of
1403 8.5.8 hostmemory.writeword(number address, number value)
1405 Write unsigned word (2 elements) to given slot. Slot numbers out
1406 of range cause extension.
1408 8.5.9 hostmemory.readsword(number address)
1410 Read signed word (2 elements) from given address. Slots out of
1413 8.5.10 hostmemory.writesword(number address, number value)
1415 Write signed word (2 elements) to given slot. Slot numbers out of
1416 range cause extension.
1418 8.5.11 hostmemory.readdword(number address)
1420 Read unsigned doubleword (4 elements) from given address. Slots
1421 out of range return false.
1423 8.5.12 hostmemory.writedword(number address, number value)
1425 Write unsigned doubleword (4 elements) to given slot. Slot
1426 numbers out of range cause extension.
1428 8.5.13 hostmemory.readsdword(number address)
1430 Read signed doubleword (4 elements) from given address. Slots out
1431 of range return false.
1433 8.5.14 hostmemory.writesdword(number address, number value)
1435 Write signed doubleword (4 elements) to given slot. Slot numbers
1436 out of range cause extension.
1438 8.5.15 hostmemory.readqword(number address)
1440 Read unsigned quadword (8 elements) from given address. Slots out
1441 of range return false.
1443 8.5.16 hostmemory.writeqword(number address, number value)
1445 Write unsigned quadword (4 elements) to given slot. Slot numbers
1446 out of range cause extension.
1448 8.5.17 hostmemory.readsqword(number address)
1450 Read signed quadword (8 elements) from given address. Slots out
1451 of range return false.
1453 8.5.18 hostmemory.writesqword(number address, number value)
1455 Write signed quadword (8 elements) to given slot. Slot numbers
1456 out of range cause extension.
1462 8.6.1 movie.currentframe()
1464 Return number of current frame.
1466 8.6.2 movie.framecount()
1468 Return number of frames in movie.
1470 8.6.3 movie.readonly()
1472 Return true if in readonly mode, false if in readwrite.
1474 8.6.4 movie.set_readwrite()
1476 Set readwrite mode (does not cause on_readwrite callback).
1478 8.6.5 movie.frame_subframes(number frame)
1480 Count number of subframes in specified frame (frame numbers are
1481 1-based) and return that.
1483 8.6.6 movie.read_subframe(number frame, number subframe)
1485 Read specifed subframe in specified frame and return data as
1486 array (100 elements, numbered 0-99 currently).
1488 8.6.7 movie.unsafe_rewind([UNSAFEREWIND state])
1490 Start setting point for unsafe rewind or jump to point of unsafe
1493 • If called without argument, causes emulator to start process of
1494 setting unsafe rewind point. When this has finished, callback
1495 on_set_rewind occurs, passing the rewind state to lua script.
1497 • If called with argument, causes emulator rewind to passed
1498 rewind point as soon as possible. Readwrite mode is implicitly
1501 The following warnings apply to unsafe rewinding:
1503 • There are no safety checks against misuse (that's what “unsafe”
1506 • Only call rewind from timeline rewind point was set from.
1508 • Only call rewind from after the rewind point was set.
1512 Routines for settings manipulation
1514 8.7.1 settings.get(string name)
1516 Get value of setting. If setting is blank, returns false. If
1517 setting value can't be obtained, returns (nil, error message).
1519 8.7.2 settings.set(string name, string value)
1521 Set value of setting. If setting can't be set, returns (nil,
1524 8.7.3 settings.is_set(string name)
1526 Returns if setting is set. If setting does not exist, returns
1527 (nil, error message).
1529 8.7.4 settings.blank(string name)
1531 Blanks a setting and returns true. If setting can't be blanked,
1532 returns (nil, error message).
1536 Contains various functions for managing memory
1538 8.8.1 memory.vma_count()
1540 Returns the number of VMAs
1542 8.8.2 memory.read_vma(number index)
1544 Reads the specified VMA (indices start from zero). Trying to read
1545 invalid VMA gives nil. The read VMA is table with the following
1548 • region_name (string): The readable name of the VMA
1550 • baseaddr (number): Base address of the VMA
1552 • lastaddr (number): Last address in the VMA.
1554 • size (number): The size of VMA in bytes.
1556 • readonly (boolean): True of the VMA corresponds to ROM.
1558 • iospace (boolean): True if the VMA is I/O space.
1560 • native_endian (boolean): True if the VMA has native endian as
1561 opposed to little endian.
1563 8.8.3 memory.find_vma(number address)
1565 Finds the VMA containing specified address. Returns table in the
1566 same format as read_vma or nil if not found.
1568 8.8.4 memory.readbyte(number address)
1570 Reads the specified address as unsigned byte and returns the
1573 8.8.5 memory.readsbyte(number address)
1575 Reads the specified address as signed byte and returns the
1578 8.8.6 memory.writebyte(number address, number value)
1580 Writes the specified value (negative values undergo 2's
1581 complement) to specified address (as a byte).
1583 8.8.7 memory.readword(number address)
1585 Reads the specified address as unsigned word and returns the
1588 8.8.8 memory.readsword(number address)
1590 Reads the specified address as signed word and returns the
1593 8.8.9 memory.writeword(number address, number value)
1595 Writes the specified value (negative values undergo 2's
1596 complement) to specified address (as a word).
1598 8.8.10 memory.readdword(number address)
1600 Reads the specified address as unsigned doubleword and returns
1603 8.8.11 memory.readsdword(number address)
1605 Reads the specified address as signed doubleword and returns the
1608 8.8.12 memory.writedword(number address, number value)
1610 Writes the specified value (negative values undergo 2's
1611 complement) to specified address (as a doubleword).
1613 8.8.13 memory.readqword(number address)
1615 Reads the specified address as unsigned quadword and returns the
1618 8.8.14 memory.readsqword(number address)
1620 Reads the specified address as signed quadword and returns the
1623 8.8.15 memory.writeqword(number address, number value)
1625 Writes the specified value (negative values undergo 2's
1626 complement) to specified address (as a quadword).
1628 8.8.16 memory.hash_region(number base, number size)
1630 Hash specified number of bytes starting from specified address
1631 and return the SHA-256.
1635 Contains copy of global variables from time of Lua
1636 initialization. Non-writeable.
1640 Various callbacks to Lua that can occur.
1642 8.10.1 Callback: on_paint(bool not_synth)
1644 Called when screen is being painted. Any gui.* calls requiring
1645 graphic context draw on the screen.
1647 not_synth is true if this hook is being called in response to
1648 received frame, false otherwise.
1650 8.10.2 Callback: on_video()
1652 Called when video dump frame is being painted. Any gui.* calls
1653 requiring graphic context draw on the video.
1655 8.10.3 Callback: on_frame_emulated()
1657 Called when emulating frame has completed and
1658 on_paint()/on_video() calls are about to be issued.
1660 8.10.4 Callback: on_frame()
1662 Called on each starting whole frame.
1664 8.10.5 Callback: on_startup()
1666 Called when the emulator is starting (lsnes.rc and --run files
1669 8.10.6 Callback: on_rewind()
1671 Called when rewind movie to beginning has completed.
1673 8.10.7 Callback: on_pre_load(string name)
1675 Called just before savestate/movie load occurs (note: loads are
1676 always delayed, so this occurs even when load was initiated by
1679 8.10.8 Callback: on_err_load(string name)
1681 Called if loadstate goes wrong.
1683 8.10.9 Callback: on_post_load(string name, boolean was_savestate)
1685 Called on successful loadstate. was_savestate gives if this was a
1686 savestate or a movie.
1688 8.10.10 Callback: on_pre_save(string name, boolean is_savestate)
1690 Called just before savestate save occurs (note: movie saves are
1691 synchronous and won't trigger these callbacks if called from
1694 8.10.11 Callback: on_err_save(string name)
1696 Called if savestate goes wrong.
1698 8.10.12 Callback: on_post_save(string name, boolean is_savestate)
1700 Called on successful savaestate. is_savestate gives if this was a
1701 savestate or a movie.
1703 8.10.13 Callback: on_quit()
1705 Called when emulator is shutting down.
1707 8.10.14 Callback: on_input(boolean subframe)
1709 Called when emulator is just sending input to bsnes core.
1710 Warning: This is called even in readonly mode, but the results
1713 8.10.15 Callback: on_reset()
1715 Called when SNES is reset.
1717 8.10.16 Callback: on_readwrite()
1719 Called when moving into readwrite mode as result of “set-rwmode”
1720 command (note: moving to rwmode by Lua won't trigger this, as per
1721 recursive entry protection).
1723 8.10.17 Callback: on_snoop(number port, number controller, number
1724 index, number value)
1726 Called each time bsnes asks for input. The value is the final
1727 value to be sent to bsnes core (readonly mode, autohold and
1728 autofire have been taken into account). Might be useful when
1729 translating movies to format suitable for console verification.
1730 Note: There is no way to modify the value to be sent.
1732 8.10.18 Callback: on_keyhook(string keyname, table state)
1734 Sent when key that has keyhook events requested changes state.
1735 Keyname is name of the key (group) and state is the state (same
1736 kind as table values in input.raw).
1738 8.10.19 Callback: on_idle()
1740 Called when requested by set_idle_timeout(), the timeout has
1741 expired and emulator is waiting.
1743 8.10.20 Callback: on_timer()
1745 Called when requested by set_idle_timeout() and the timeout has
1746 expired (regardless if emulator is waiting).
1748 8.10.21 Callback: on_set_rewind(UNSAFEREWIND r)
1750 Called when unsafe rewind object has been constructed.
1752 8.10.22 Callback: on_pre_rewind()
1754 Called just before unsafe rewind is about to occur.
1756 8.10.23 Callback: on_post_rewind()
1758 Called just after unsafe rewind has occured.
1760 9 Memory watch expression syntax
1762 Memory watch expressions are in RPN (Reverse Polish Notation). At
1763 the end of expression, the top entry on stack is taken as the
1768 • Evaluation order is strictly left to right.
1770 • a is the entry on top of stack
1772 • b is the entry immediately below top of stack
1774 • ; separates values to be pushed (no intermediate pop).
1776 • After end of element, all used stack slots are popped and all
1779 • When pushing multiple values, the pushes occur in order shown.
1781 The following operators are available:
1795 • b : read_signed_byte(a)
1799 • d : read_signed_dword(a)
1801 • i : quotent(a / b)
1806 • q : read_signed_qword(a)
1816 • w : read_signed_word(a)
1820 • B : read_unsigned_byte(a)
1822 • C<number>z : Push number <number> to stack.
1824 • D : read_unsigned_dword(a)
1826 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1828 • Q : read_unsigned_qword(a)
1830 • R<digit> : round a to <digit> digits.
1832 • W : read_unsigned_word(a)
1836 C0x007e0878zWC0x007e002czW-
1838 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1840 2. Pop the value on top of stack (0x7e0878), read word value at
1841 that address and push the result,call it x1 (W).
1843 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1845 4. Pop the value on top of stack (0x7e002c), read word value at
1846 that address and push the result,call it x2 (W).
1848 5. Pop the two top numbers on stack, x1 and x2, substract x1 from
1849 x2 and push x2 - x1 (-).
1851 6. Since the expression ends, the final memory watch result is
1852 the top one on stack, which is x2 - x1.
1854 10 Modifier and key names:
1858 10.1.1 Modifier names
1860 Following modifier names are known:
1862 • ctrl, lctrl, rctrl: Control keys
1864 • alt, lalt, ralt: ALT keys.
1866 • shift, lshift, rshift: Shift keys.
1868 • meta, lmeta, rmeta: Meta keys.
1870 • num, caps: Numlock/Capslock (these are sticky!)
1872 • mode: Mode select.
1876 Following key names are known:
1878 • backspace, tab, clear, return, pause, escape, space, exclaim,
1879 quotedbl, hash, dollar, ampersand, quote, leftparen,
1880 rightparen, asterisk, plus, comma, minus, period, slash, 0, 1,
1881 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals,
1882 greater, question, at, leftbracket, backslash, rightbracket,
1883 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k,
1884 l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0,
1885 world_1, world_2, world_3, world_4, world_5, world_6, world_7,
1886 world_8, world_9, world_10, world_11, world_12, world_13,
1887 world_14, world_15, world_16, world_17, world_18, world_19,
1888 world_20, world_21, world_22, world_23, world_24, world_25,
1889 world_26, world_27, world_28, world_29, world_30, world_31,
1890 world_32, world_33, world_34, world_35, world_36, world_37,
1891 world_38, world_39, world_40, world_41, world_42, world_43,
1892 world_44, world_45, world_46, world_47, world_48, world_49,
1893 world_50, world_51, world_52, world_53, world_54, world_55,
1894 world_56, world_57, world_58, world_59, world_60, world_61,
1895 world_62, world_63, world_64, world_65, world_66, world_67,
1896 world_68, world_69, world_70, world_71, world_72, world_73,
1897 world_74, world_75, world_76, world_77, world_78, world_79,
1898 world_80, world_81, world_82, world_83, world_84, world_85,
1899 world_86, world_87, world_88, world_89, world_90, world_91,
1900 world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3,
1901 kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide,
1902 kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down,
1903 right, left, insert, home, end, pageup, pagedown, f1, f2, f3,
1904 f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock,
1905 capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt,
1906 rmeta, lmeta, lsuper, rsuper, mode, compose, help, print,
1907 sysreq, break, menu, power, euro, undo
1909 • Names of form 'key<n>' where <n> is 0-255 are interpretted as
1910 key having hardware-dependent scan code of <n> (useful to bind
1911 those keys that don't have symbolic names).
1913 10.1.3 Joystick pseudo-keys:
1915 • joystick<num>button<button>: Joystick <num> (0-based) button
1918 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat>
1921 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat>
1924 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat>
1927 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat>
1930 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis>
1931 negative position (axis modes axis and axis_inverse).
1933 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis>
1934 positive position (axis modes axis and axis_inverse).
1936 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis>
1937 pressure (axis modes pressure_*).
1939 10.1.4 Special buttons:
1941 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1943 • Return (also KPEnter): Execute command, ok modal dialog.
1945 • Pgup/Up (also KP8/9 if no num lock, CTRL+P; command mode):
1946 Previous command in command history
1948 • Pgdn/Down(also KP2/3 if no num lock, CTRL+N; command mode):
1949 Next command in command history
1951 • Home (also KP7 if no num lock, CTRL+A; command mode): Beginning
1954 • End (also KP1 if no num lock, CTRL+E; command mode): End of
1957 • Left (also KP4 if no num lock, CTRL+B; command mode): Move
1960 • Right (also KP6 if no num lock, CTRL+F; command mode): Move
1963 • Delete (also KP. if no num lock; command mode): Delete
1964 character to right of cursor.
1966 • Insert (also KP0 if no num lock; command mode): Toggle between
1967 insert / overwrite modes.
1969 • Backspace (command mode): Delete character to left of cursor.
1971 • CTRL+LEFT (also ALT+B; command mode): Previous word.
1973 • CTRL+RIGHT (also ALT+F; command mode): Next word.
1975 • ALT+D (also CTRL+W; command mode): Delete word.
1977 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump
1980 10.2 wxWidgets platform
1982 10.2.1 Modifier names:
1984 Following modifier names are known:
1994 • cmd (Mac OS X only)
1998 Following key names are known:
2000 • back, tab, return, escape, space, exclaim, quotedbl, hash,
2001 dollar, percent, ampersand, quote, leftparen, rightparen,
2002 asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5,
2003 6, 7, 8, 9, colon, semicolon, less, equals, greater, question,
2004 at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,
2005 u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret,
2006 underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m,
2007 n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe,
2008 rightcurly, tilde, delete, start, lbutton, rbutton, cancel,
2009 mbutton, clear, shift, alt, control, menu, pause, capital, end,
2010 home, lefT, up, right, down, select, print, execute, snapshot,
2011 insert, help, numpad0, numpad1, numpad2, numpad3, numpad4,
2012 numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add,
2013 separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6,
2014 f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19,
2015 f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown,
2016 numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2,
2017 numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up,
2018 numpad_right, numpad_down, numpad_pageup, numpad_pagedown,
2019 numpad_end, numpad_begin, numpad_insert, numpad_delete,
2020 numpad_equal, numpad_multiply, numpad_add, numpad_separator,
2021 numpad_subtract, numpad_decimal, numpad_divide, windows_left,
2022 windows_right, windows_menu, command, special1, special2,
2023 special3, special4, special5, special6, special7, special8,
2024 special9, special10, special11, special12, special13,
2025 special14, special15, special16, special17, special18,
2026 special19, special20
2028 11 Movie file format
2030 Movie file is .zip archive in itself, normal ZIP archive tools
2031 work on it (note: If you recompress it, do not use compression
2032 methods other than store and deflate and especially do not use
2033 encryption of any kind).
2035 11.1 Detecting clean start/SRAM/Savestate
2037 • If file has member “savestate” it is savestate, otherwise:
2039 • If file has members with names starting “moviesram.” it is
2040 movie starting from SRAM, otherwise:
2042 • It is movie starting from clear state.
2044 11.2 Member: gametype
2046 Type of game ROM and region (as one line). Valid values are:
2049 +--------------+---------------------+--------+
2050 | Value | System | Region |
2051 +--------------+---------------------+--------+
2052 +--------------+---------------------+--------+
2053 | snes_pal | Super NES | PAL |
2054 +--------------+---------------------+--------+
2055 | sgb_pal | Super Game Boy | PAL |
2056 +--------------+---------------------+--------+
2057 | snes_ntsc | Super NES | NTSC |
2058 +--------------+---------------------+--------+
2059 | sgb_ntsc | Super Game Boy | NTSC |
2060 +--------------+---------------------+--------+
2061 | bsx | BS-X (non-slotted) | NTSC |
2062 +--------------+---------------------+--------+
2063 | bsxslotted | BS-X (slotted) | NTSC |
2064 +--------------+---------------------+--------+
2065 | sufamiturbo | Sufami Turbo | NTSC |
2066 +--------------+---------------------+--------+
2072 +---------+-----------------+
2073 | Region | Framerate (fps) |
2074 +---------+-----------------+
2075 +---------+-----------------+
2076 | PAL | 322445/6448 |
2077 +---------+-----------------+
2078 | NTSC | 10738636/178683 |
2079 +---------+-----------------+
2084 Contains type of port #1 (as one line). Valid values are 'none',
2085 'gamepad', 'multitap' and 'mouse'. If not present, defaults to
2090 Contains type of port #2 (as one line). Valid values are 'none',
2091 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and
2092 'justifiers'. If not present, defaults to 'none'.
2094 11.5 Member: gamename
2096 Contains name of the game (as one line).
2098 11.6 Member: authors
2100 Contains authors, one per line. Part before '|' is the full name,
2101 part after is the nickname.
2103 11.7 Member: systemid
2105 Always “lsnes-rr1” (one line). Used to reject other saves.
2107 11.8 Member: controlsversion
2109 Always “0” (one line). Used to identify what controls are there.
2111 11.9 Member: “coreversion”
2113 Contains bsnes core version number (as one line).
2115 11.10 Member: projectid
2117 Contains project ID (as one line). Used to identify if two movies
2118 are part of the same project.
2120 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2122 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2123 Absent if corresponding file is absent.
2125 11.12 Member: moviesram.<name>
2127 Raw binary startup SRAM of kind <name>. Only present in
2128 savestates and movies starting from SRAM.
2130 11.13 Member: saveframe
2132 Contains frame number (as one line) of frame movie was saved on.
2133 Only present in savestates.
2135 11.14 Member: lagcounter
2137 Current value of lag counter (as one line). Only present in
2140 11.15 Member: pollcounters
2142 Contains poll counters (currently 100 of them), one per line.
2143 Each line is raw poll count if DRDY is set for it. Otherwise it
2144 is negative poll count minus one. Only present in savestates.
2146 11.16 Member: hostmemory
2148 Raw binary dump of host memory. Only present in savestates.
2150 11.17 Member: savestate
2152 The raw binary savestate itself. Savestate detection uses this
2153 file, only present in savestates.
2155 11.18 Member: screenshot
2157 Screenshot of current frame. Only present in savestates. First 2
2158 bytes are big-endian width of image, rest are 24-bit RGB image
2159 data. Height of image is inferred from the width and size of
2162 11.19 Member: sram.<name>
2164 Raw binary SRAM of kind <name> at time of savestate. Only present
2169 The actual input track, one line per subframe (blank lines are
2172 • If the first byte of each line is '.', ' ', <tab> or '|', then
2173 the line is part of same frame as previous, otherwise it starts
2176 • First subframe must start a new frame.
2178 Length of movie in frames is number of lines in input file that
2181 11.21 Member: rerecords
2183 Contains textual base-10 rerecord count (as one line; emulator
2184 just writes this, it doesn't read it) + 1.
2186 11.22 Member: rrdata
2188 This member stores set of load IDs. There is one load ID per
2189 rerecord (plus one corresponding to start of project).
2191 • This member constists of concatenation of records
2193 • Each record is 2-36 bytes long and can represent 1-16,843,009
2196 • IDs are interpretted as 256-bit big-endian integers with
2199 • Initial predicted ID is all zeroes.
2201 Format of each record is:
2203 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen),
2204 bits 5-6 are count length (countlen). Bit 7 is unused.
2206 • 32-prefixlen bytes of ID.
2208 • countlen bytes of big-endian count (count).
2210 Records are processed as follows:
2212 • To form the first ID encoded by record, take the first
2213 prefixlen bytes predicted ID and append the read ID value to
2214 it. The result is the first ID encoded.
2216 • If countlen is 0, record encodes 1 ID.
2218 • If countlen is 1, record encodes 2+count IDs.
2220 • If countlen is 2, record encodes 258+count IDs.
2222 • If countlen is 3, record encodes 65794+count IDs.
2224 • The new predicted ID is the next ID after last one encoded by
2227 The number of rerecords + 1 is equal to the sum of number of IDs
2228 encoded by all records.
2230 11.23 Member: starttime.second
2232 Movie starting time, second part. Epoch is Unix epoch. Default is
2235 11.24 Member: starttime.subsecond
2237 Movie starting time, subsecond part. Unit is CPU clocks. Default
2240 11.25 Member: savetime.second
2242 Movie saving time, second part. Default is starttime.second. Only
2243 present in savestates.
2245 11.26 Member: savetime.subsecond
2247 Movie saving time, subsecond part. Default is
2248 starttime.subsecond. Only present in savestates.
2250 12 Quick'n'dirty encode guide
2252 1. Start the emulator and load the movie file.
2254 2. Set large AVI option 'set-setting avi-large on'
2256 3. Enable dumping 'dump-avi tmpdump'
2258 4. Unpause and let it run until you want to end dumping.
2260 5. Close the emulator (closing the window is the easiest way). Or
2263 6. For each tmpdump*.avi file created, on command prompt, do
2264 'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2266 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2268 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv +
2269 tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every
2270 tmpdump_<numbers>.mkv, with + in between).
2272 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now
2273 final.mkv contains quick'n'dirty encode.
2275 13 Axis configurations for some gamepad types:
2277 13.1 XBox360 controller:
2279 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be
2282 set-axis joystick0axis2 pressure-+
2284 set-axis joystick0axis5 pressure-+
2286 • This is needed for SDL only. EVDEV sets those types correctly.
2288 13.2 PS3 “sixaxis” controller:
2290 Axes 8-19 should be disabled.
2292 set-axis joystick0axis8 disabled
2294 set-axis joystick0axis9 disabled
2296 set-axis joystick0axis10 disabled
2298 set-axis joystick0axis11 disabled
2300 set-axis joystick0axis12 disabled
2302 set-axis joystick0axis13 disabled
2304 set-axis joystick0axis14 disabled
2306 set-axis joystick0axis15 disabled
2308 set-axis joystick0axis16 disabled
2310 set-axis joystick0axis17 disabled
2312 set-axis joystick0axis18 disabled
2314 set-axis joystick0axis19 disabled
2318 14.1 Problems from BSNES core:
2320 • The whole pending save stuff.
2322 • Lack of layer hiding.
2324 • It is slow (especially accuracy).
2326 • Firmwares can't be loaded from ZIP archives.
2328 14.2 Other problems:
2330 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2332 • Audio for last dumped frame is not itself dumped.
2334 • Audio in UI is pretty bad in quality if game doesn't run at
2337 • AVI compression levels 10-18 are not compatible with AVISynth
2340 • No menus, command based interface (SDL).
2342 • Long commands don't scroll.
2344 • Wxwidgets UI is still buggy.
2350 • Fix -Wall warnings
2352 • Fix dumper video corruption with levels 10-18.
2358 • Lots of code cleanups
2360 • Lua interface to settings
2362 • Allow specifying AVI borders without Lua
2364 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2366 • on_snoop lua callback
2368 • Faster movie loading and saving.
2378 • Save jukebox functionality.
2382 • Try to fix some nasty failing movie load edge cases
2384 • Allow specifying scripts to run on command line.
2388 • Major source code reorganization.
2390 • Backup savestates before overwriting.
2392 • Don't crash if loading initial state fails.
2396 • Fix firmware lookup
2398 • Fix author name parsing
2400 • Fix rerecord counting
2402 • (SDL) Print messages to console if SDL is uninitialized
2404 • Add movieinfo program
2406 • Fix loading movies starting from SRAM.
2410 • Add support for unattended dumping
2412 • Fix compiling for Win32
2414 • Don't lock up if sound can't be initialized
2416 • Strip trailing CR from commands
2418 • Don't try to do dubious things in global ctors (fix crash on
2423 • Small documentation tweaking
2427 • Fix major bug in modifier matching
2431 • Lots of documentation fixes
2433 • Use dedicated callbacks for event backcomm., not commands.
2435 • Ensure that the watchdog is not hit when executing delayed
2438 • Remove errant tab from joystick message.
2442 • Make autofire operate in absolute time, not linear time
2444 • Reinitialize controls when resuming from loadstate
2446 • Some more code cleanups
2448 • If Lua allocator fails, call OOM_panic()
2450 • Byte/word/dword/qword sized host memory write/read functions.
2452 • Dump at correct framerate if dumping interlaced NTSC
2457 • Actually include the complete source code
2463 • Document {save,start}time.{,sub}second.
2465 • Intercept time() from bsnes core.
2469 • Allow disabling time() interception (allow build on Mac OS X)
2471 • Use SDLMain on Mac OS X (make SDL not crash)
2473 • Disable delayed resets (just plain too buggy for now).
2477 • Use 16-bit for graphics/video instead of 32-bit.
2479 • gui.rectangle/gui.pixel
2483 • New CSCD writer implementation.
2487 • Fix interaction of * and +.
2489 • Manual improvements
2491 • Use gettimeofday()/usleep(), these seem portable enough.
2493 • Move joystick axis manipulation to keymapper code.
2495 • Changes to how read-only works.
2497 • Refactor controller input code.
2501 • Fix mouseclick scale compensation.
2503 • Draw area boundaries correctly in SDL code.
2507 • Fix CSCD output (buffer overrun and race condition).
2511 • JMD dumping support.
2513 • Allow unattended dumping to JMD.
2515 • Move to BSNES v083.
2517 • Switch back to 32-bit colors.
2519 • Add Lua function gui.color.
2521 • Use some new C++11 features in GCC 4.6.
2523 • Be prepared for core frequency changes.
2525 • Pass colors in one chunk from Lua.
2529 • New lua functions gui.line(), gui.status() and gui.circle(),
2530 memory.vma_count(), memory.read_vma() and memory.find_vma().
2532 • Numerious documentation fixups
2534 • RTC time format changed
2536 • Reformat flags display
2538 • Allow lua package name to be overridden
2540 • SDUMP (high-quality dumping).
2542 • Split platform support to plugins.
2544 • Make all sound plugins support basic sound commands
2546 • Support portaudio for sound.
2548 • Allow disable Lua/SDL searching.
2550 • Upconvert colors when copying lcscreen to screen.
2552 • Reorganize source tree.
2554 • Evdev joystick support.
2556 • Refactor more code into generic window code.
2560 • Refactor message handling.
2564 • Documentation fixes
2566 • Finish pending saves before load/quit.
2568 • Wxwidgets graphics plugin.
2572 • Get rid of win32-crap.[ch]pp.
2574 • Move files around a lot.
2576 • Get rid of need for host C++ compiler.
2580 • Refactor inter-component communication.
2584 • Fix crash on multiline aliases.
2586 • Load/Save settings in wxwidgets gui.
2590 • Patch problems in bsnes core
2592 • SNES is little-endian, not big-endian!
2594 • Fix memory corruption in lcscreen::load()
2598 • Fix interpretting repeat counts in rrdata loading.
2600 • New lua callback: on_frame()
2602 • Remove calls to runtosave() that aren't supposed to be there
2604 • Lua function: movie.read_rtc()
2606 • Ignore src/fonts/font.cpp
2608 • Fix more bsnes core problems
2610 • Control bsnes random seeding
2614 • Some bsnes core debugging features (state dump and state hash)
2616 • Fix titlebar version number (no, the last version wasn't
2617 'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2621 • Fix memory corruption due to macro/field mixup
2623 • search-memory update
2625 • Allow direct-mapped framebuffer
2627 • SDL: Use SDL_ANYFORMAT if possible
2629 • SDMP2SOX: 2s delay modes.
2631 • Wxwidgets: Cleanups
2633 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2635 • Wxwidgets: Save jukebox on exit
2637 • Fix RTC if using load-movie on savestate.
2639 • Fix crash related to full console mode.
2643 • Wxwidgets: Allow bringing application to foreground on Mac OS
2646 • Wxwidgets: Allow compiling on Mac OS X.
2648 • Use movie compare instead of movie hashing (faster save/load).
2650 • Lua: _SYSTEM table.
2654 • sdmp2sox: Pad soundtrack if using -l or -L.
2656 • sdmp2sox: Fix NTSC overscan.
2658 • sdmp2sox: Add AR correction mode.
2660 • call lua_close() when exiting.
2662 • Fix zip_writer bug causing warnings from info-zip and error
2667 • Fix IPS patching code (use bsnes core IPS patcher).
2669 • Implement BPS patching (using bsnes core IPS patcher).
2671 • Add feature to load headered ROMs.
2675 • Show command names when showing keybindings
2679 • Fix pause-on-end to be actually controllable
2681 • SDL: Poll all events in queue, not just first one (fixes
2682 slowness in command typing)
2684 • Wxwidgets: Fix ROM loading.
2688 • Lua: Add gui.textH, gui.textV, gui.textHV
2690 • Fix text colors on SDL on Mac OS X
2692 • Mode 'F' for finished in readonly mode.
2694 • Fix some WS errors.
2696 • Reliably pause after skip poll
2698 • Split UI and core into their own threads
2702 • Remove leftover dummy SRAM slot
2704 • Fix controller numbers.
2708 • Fix lsnes-dumpavi after interface change.
2710 • Also give BSNES patches for v085.
2712 • Pack movie data in memory.
2716 • Fix framecount/length given when loading movies.
2718 • Controller command memory leak fixes.
2720 • Don't leak palette if freeing screen object.
2726 • Wxwidgets: Allow controlling dumper from the menu.
2730 • Rewrite parts of manual
2732 • Lua: Make it work with Lua 5.2.
2736 • Win32: Fix compile errors.
2740 • Refactor controller input code.
2742 • Fix crash when using command line on SDL / Mac OS X.
2746 • Delete core/coroutine (obsolete)
2748 • Lag input display by one frame.
2750 • Rewind movie to beginning function.
2752 • Fix wrong frame number reported to Lua when repainting after
2755 • Support UI editing of jukebox
2757 • Wxwidgets: Save settings on exit.
2759 • Support ${project} for filenames
2761 • SDL: Fix command history
2765 • Fix some order-of-global-ctor bugs.
2769 • Fix crashes when quitting on Win32.
2773 • EVDEV: Queue keypresses from joystick, don't send directly
2775 • Wxwidgets: Load-Preserve that actually works.
2779 • Wxwidgets: GUI for memory search.
2781 • Warn about using synchronous queue in UI callback.
2785 • Remember last saved file for each ROM
2787 • Support MT dumping via boost.
2791 • Lua: input.keyhook
2793 • Make mouse be ordinary input instead of special-casing
2795 • SDL: Don't screw up commands with NUL codepoints.
2799 • Merge status panel and main window
2801 • True movie slot support (the rest of it)
2803 • SDL: Fix compilation error
2805 • Elminate cross calls in dump menu code.
2809 • Cancel pending saves command
2811 • Wxwidgets: Code refactoring
2813 • Wxwidgets: Fix system -> reset
2815 • Wxwidgets: Read watch expressions in the right thread
2819 • Wxwidgets: Don't prompt for member when running Lua script (Lua
2820 doesn't support that).
2822 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are
2825 • Don't append trailing '-' to prefix when saving movie.
2827 • Fix ROM/savestate handling (don't let user mismatch ROM and
2832 • Document memory watch syntax.
2836 • Fix unattended dumping (lsnes-dumpavi)
2838 • Support RAW dumping
2840 • Use adv_dumper instead of the old interface in lsnes-dumpavi
2843 • Add option to control sample rate preturbation in AVI dumper
2847 • Wxwidgets: Fix dumper submodes
2849 • Set core controller types before loadstate
2851 15.49 rr1-delta2epsilon1
2853 • Fix compiling with bsnes v086.
2857 • Don't prompt before quitting
2859 • Start unpaused, preserve pause/unpause over load.
2861 • Try to autodetect if ROM is headered.
2863 • Wxwidgets: Only bring up ROM patching screen if specifically
2866 • Allow configuring some hotkeys.
2870 • Lots of code cleanups
2872 • Fix JMD compression (JMD dumping was broken)
2874 • Don't crash if Lua C function throws an exception.
2876 • Support bitmap drawing in Lua.
2878 • Fix bsnes v085/v086 patches.
2880 • Improve stability on win32.
2882 15.52 rr1-delta4epsilon1
2884 • Don't corrupt movie if movie length is integer multiple of
2889 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2891 • New Lua functions: emulator_ready(), utime(),
2892 set_idle_timeout(), set_timer_timeout(), bit.extract(),
2893 bit.value(), input.geta(), input.seta() and
2894 input.controllertype()
2896 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2898 • Wxwidgets: Fix broken modifiers
2900 • on_paint has parameter now.
2902 • Optional initital fill for bitmaps
2904 • Fix palette changing.
2906 • Optimize rendering a bit.
2908 • Bsnes v087 support.
2910 15.54 rr1-delta5epsilon1
2912 • Movieinfo: Fix display of port #2 type.
2914 • Call on_input() after loadstate.
2916 15.55 rr1-delta5epsilon2
2918 • Fix writing port2 data to movie.
2920 • Fix SRAM handling with Bsnes v087.
2924 • Library loading support
2926 • Built-in TSCC encoder
2928 • Hi-color (256T colors) dumping.
2930 • Dump over TCP/IP(v6)
2932 • Hidable status panel
2936 • Adjustable sound volume
2940 • Allow DnD into filename boxes
2942 • Configurable paths
2944 • Portaudio: Fix speaker popping at start
2946 • Lots of UI changes
2948 • Speed adjustment menu
2950 • Win32 joystick support
2952 • Lua: gui.rainbow and gui.box
2954 • Split key lists into classes (the key list was large!)
2956 • More save slots support
2958 • Wxwidgets (wxJoystick) joystick support
2962 • Lots of internal joystick refactoring
2964 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
2966 • Wxwidgets: Settings mode (open settings without ROM)
2968 • Wxwidgets: Prompt key to use option
2970 • Wxwidgets: Fix crash if key goes away underneath
2972 • Wxwidgets: Fix mouse position in presence of scaling
2974 • AVI dumper: Mode 4 (high-quality resampling to common rate
2977 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree
2978 control doesn't seem to work well on WinXP)
2980 • Start paused option.
2982 15.58 rr1-delta7epsilon1
2986 • lsnes-dumpavi: Start Lua before starting dumper
2988 • AVI: Fix secondary audio in mode 4.
2990 15.59 rr1-delta7epsilon2
2992 • AVI: Refactor ZMBV a bit.
2994 • Fix error reading analog values from movie file
2998 • Delayed reset support
3000 • Lua: memory.hash_region
3002 15.61 rr1-delta8epsilon1
3004 • Rework the build system
3006 • Typing input support
3008 • Fix building with bsnes v086 and v087.
3010 • SDL: Save settings on exit
3012 • SDL: Command to enter command line mode with given command.
3014 • SDL: More advanced command editing.
3018 • wxMSW: Fix the “arrow keys and enter don't work” problem
3022 • Show mode changes due to rewinding.
3024 • Unsafe rewind support
3026 • Fix directory transversal.
3030 • AVI: Sound mode 5 (48kHz high-quality)
3034 • Map the SNES bus into address space
3036 • Fix loading memory watch files with CRLF line endings