3 lsnes is SNES rerecording emulator based on bsnes core.
11 (b) accuracy or compatiblity core.
13 (c) Patched version (using included 6 patches)
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. std::thread and co (for threaded dumper only, not needed if
34 std::thread is available)
36 12. Lua (if Lua support is needed).
38 • Version 5.1.X or 5.2X.
42 Building is via makefile, the following options are available:
44 • CROSS_PREFIX=<prefix>
46 – Prefix to apply to commands when building executables /
47 object files for the target architecture.
53 – Name of C++ compiler.
55 – CROSS_PREFIX is prepended if compiling for target
58 – This needs to be at least GCC 4.6.
60 – Set to 'g++-mp-4.6' if compiling on Mac OS X using GCC 4.6
67 – Name of host C++ compiler.
69 – Default is value of 'CC' option.
71 • USER_HOSTCCFLAGS=<flags>:
73 – Compiler flags to pass when compiling/linking for host
80 – Extra flags to pass when compiling for target architecture
84 • USER_LDFLAGS=<flags>:
86 – Extra flags to pass when linking for target architecture.
90 • USER_PLATFORM_CFLAGS=<flags>
92 – Extra flags to pass when compiling files using
93 platform-dependent code for target architecture.
97 • USER_PLATFORM_LDFLAGS=<flags>
99 – Extra flags to pass when linking files using
100 platform-dependent code for target architecture.
106 – Set the font file to use.
108 – Currently the valid values are:
110 ∗ cp437.hex: Standard VGA font (256 characters).
112 ∗ unifontfull-5.1.20080820.hex: GNU unifont (covers most of
115 – Default is 'unifontfull-5.1.20080820.hex'
119 – Package to use for Lua support.
121 – Usually valid value is 'lua' or 'lua5.1'.
123 – Default is not to build Lua support.
127 – Override platform default for dumper threading support.
129 – Threading is default on Linux.
131 – 'YES' tries to use threading (std::thread).
133 – 'BOOST' tries to use threading (boost::thread).
135 – 'NO' disables threading.
137 – Note: This has absolutely nothing to do with platform
140 • BSNES_IS_COMPAT=<anything>
142 – Signals that BSNES core used is compatiblity core, not
145 – Default is to assume accuracy core.
147 • SECRET_RABBIT_CODE=<anything>
149 – Signals that SRC (a.k.a. libsamplerate) should be used for
150 high-quality samplerate conversions.
152 • JOYSTICK=<implementation>
154 – Set joystick implementation. Valid values are:
156 ∗ SDL: Use SDL for joystick (requires SDL graphics)
158 ∗ EVDEV: Use EVDEV for joystick (Linux only).
160 ∗ WIN32MM: Use Win32mm for joystick (Windows only).
162 ∗ WXWIDGETS: Use Wxwidgets for joystick (requires WXWIDGETS
165 ∗ DUMMY: Disable joystick support.
169 • SOUND=<implementation>
171 – Set sound implementation. Valid values are:
173 ∗ SDL: Use SDL for sound (requires SDL graphics)
175 ∗ PORTAUDIO: Use Portaudio for sound.
177 ∗ DUMMY: Disable sound support
181 • GRAPHICS=<implementation>
183 – Set windowing library to use. Valid values are:
185 ∗ SDL: Use SDL for graphics
187 ∗ WXWIDGETS: Use wxWidgets for graphics.
191 4 Command line options
195 <kind> in the following can be one of:
197 • rom: Cartridge ROM (BIOS for special carts). This is required.
199 • bsx: BS-X (non-slotted) Game flash ROM.
201 • bsxslotted: BS-X (slotted) Game flash ROM.
205 • slot-a: Sufami Turbo Slot A ROM
207 • slot-b: Sufami Turbo Slot B ROM
209 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
211 Load <file> as specified ROM (SFC/BS/DMG/ST file format).
213 4.1.2 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
215 Override hardware detection for ROM, reading the values from
216 <file> (BSNES XML format).
218 4.1.3 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
220 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple
221 times, the patches are applied in order.
223 4.1.4 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
225 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified
226 multiple times, the patches are applied in order.
228 4.1.5 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
230 Set offset to apply to IPS patches. May be negative. Handy for
231 applying headered IPS patches (use offset of -512 for this). The
232 offset must be 0 for BPS patches.
236 Force ROM to be considered PAL-only.
238 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
240 • Attempting to load NTSC movie file will error out.
244 Force ROM to be considered NTSC-only.
246 • Attempting to load PAL movie file will error out.
254 4.2.2 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
256 Load <filename> as movie or savestate file. All other session
259 4.2.3 --port1=<device> (lsnes/SDL)
261 Set type of port1. Valid values are:
263 • none: No device connected
265 • gamepad: One gamepad (the default)
267 • multitap: Four gamepads (warning: makes most games refuse to
272 4.2.4 --port2=<type> (lsnes/SDL)
274 Set type of port2. Valid values are:
276 • none: No device connected (the default)
278 • gamepad: One gamepad
280 • multitap: Four gamepads.
284 • superscope: Super Scope
286 • justifier: One justifier
288 • justifiers: Two justifiers
290 4.2.5 --gamename=<name> (lsnes/SDL)
292 Set the name of game to <name>. Default is blank.
294 4.2.6 --author=<name> (lsnes/SDL)
296 Add author with full name of <name> (no nickname).
298 4.2.7 --author=|<name> (lsnes/SDL)
300 Add author with nickname of <name> (no full name).
302 4.2.8 --author=<fullname>|<nickname> (lsnes/SDL)
304 Add author with full name of <fullname> and nickname of
307 4.2.9 --rtc-second=<value> (lsnes/SDL)
309 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
312 4.2.10 --rtc-subsecond=<value> (lsnes/SDL)
314 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
318 4.3.1 --run=<file> (lsnes/SDL)
320 After running main RC file, run this file. If multiple are
321 specified, these execute in order specified.
323 4.4 dump options (lsnes-dumpavi only)
325 4.4.1 --dumper=<dumper>
327 Set the dumper to use (required). Use 'list' for listing of known
332 Set the mode to use (required for dumpers with multiple modes,
333 forbidden otherwise). Use 'list' for known modes.
335 4.4.3 --prefix=<prefix>
337 Set dump prefix. Default is “avidump”.
339 4.4.4 --option=<name>=<value>
341 Set option <name> to value <value>.
343 4.4.5 --length=<length>
345 Set number of frames to dump. Mandatory.
349 Run specified lua script (lsnes-dumpavi does not have
350 initialization files).
352 4.4.7 --load-library=<library>
354 Load the specified shared object / dynamic library / dynamic link
357 5 Startup file lsnes.rc
359 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
360 commands. This file is located in:
362 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
364 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME
367 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
369 • All: ./lsnes.rc (fallback default).
371 If leading directories do not exist, attempt to create them is
376 • Commands beginning with '*' invoke the corresponding command
377 without alias expansion.
379 • If command starts with '+' (after possible '*'), the command is
380 executed as-is when button is pressed, and when button is
381 released, it is executed with '+' replaced by '-'.
383 • Commands without '+' execute only on negative edge (release).
387 Settings control various aspects of emulator behaviour.
389 6.1.1 set-setting <setting> <value>
391 Sets setting <setting> to value <value> (may be empty).
393 6.1.2 unset-setting <setting>
395 Try to unset setting <setting> (not all settings can be unset).
397 6.1.3 get-setting <setting>
399 Read value of setting <setting>
403 Print names and values of all settings.
407 Keybindings bind commands or aliases to keys (or pseudo-keys).
411 • Do not bind edge active (+/-) commands to keys with modifiers,
412 that won't work right!
414 • Names of keys and modifiers are platform-dependent.
416 • Be careful before binding pseudo-keys (such as joystick axes,
417 buttons or hats) with modifiers. That may or may not work
420 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
422 Bind <command> to key <key> (activating if modifiers in <modmask>
423 (comma-seperated list) are set as <mod> (comma-seperated list).
425 The names of keys and modifiers are platform-dependent.
427 6.2.2 unbind-key [<mod>/<modmask>] <key>
429 Unbind command from <key> (with specified <mod> and <modmask>).
431 6.2.3 set-axis <axis> [disabled | axis | axis-inverse |
432 pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0
433 | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>]
436 Set axis parameters for axis <axis>.
438 • disabled: Disable axis
442 • axis-inverse: Inverse axis
444 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
446 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
448 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
450 • pressure-+: Pressure sensitive. Released at -, pressed at +.
452 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
454 • pressure+-: Pressure sensitive. Released at +, pressed at -.
456 • minus=<val>: Calibration at extreme minus position
459 • zero=<val>: Calibration at neutral position (-32768-32767)
461 • plus=<val>: Calibration at extreme plus position (-32768-32767)
463 • tolerance=<value>: Center band tolerance (0<x<1). The smaller
464 the value, the more sensitive the control is.
468 Print all key bindings in effect.
472 Aliases bind command to sequence of commands. After alias has
473 been defined, it replaces the command it shadows.
477 • You can't alias command to itself.
479 • Aliases starting with +/- are edge active just like ordinary
480 commands starting with +/-.
482 • One command can be aliased to multiple commands.
484 6.3.1 alias-command <command> <expansion>
486 Append <expansion> to alias <command>. If alias does not already
487 exist, it is created.
489 6.3.2 unalias-command <command>
491 Clear alias expansion for <command>.
495 Print all aliases and their expansions in effect.
497 6.4 run-script <script>
499 Run <script> as if commands were entered on the command line.
503 Following commands control video dumping:
505 6.5.1 start-dump <dumper> [<mode>] <prefix/filename>
507 Start dumping using dumper <dumper>. If mode is present or not
508 and if prefix or filename is present depends on the dumper and
511 The following dumpers are available:
513 • INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
515 – Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes
518 – Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
520 • INTERNAL-JMD: Internal .jmd dumper.
522 – Does not take mode.
526 • INTERNAL-RAW: Internal RAW dumper.
528 – Does not take mode.
532 – Sound is big-endian signed 16-bit, usually at 32040.5Hz.
534 – Video is always upscaled to double resolution (512x448 / 512
537 – Video framerate is usually 322445/6448 fps for PAL and
538 10738636/178683 fps for NTSC.
540 • INTERNAL-SDMP: Internal SDMP dumper.
542 – Mode 'ms': Multi-segment. Takes prefix.
544 – Mode 'ss': Single-segment. Takes filename.
546 6.5.2 end-dump <dumper>
548 End dumping using <dumper>
550 6.5.3 show-dumpers [<dumper>]
552 Show the list of dumpers or list of modes for <dumper>
554 6.6 Memory manipulation
556 <address> may be decimal or hexadecimal (prefixed with '0x').
557 <value> can be hexadecimal (prefixed with '0x'), unsigned or
558 signed (prefixed with '-') decimal.
560 The available element <sizes> are:
570 When reading RAM and ROM, multi-byte reads/writes are big-endian.
571 When dealing with DSP memory, multi-byte reads/writes are
572 native-endian (do not use operand sizes exceeding DSP bitness,
573 except dword is OK for 24-bit memory).
575 6.6.1 read-<size> <address>
577 Read the value of byte in <address>.
579 6.6.2 read-s<size> <address>
581 Read the value of signed byte in <address>.
583 6.6.3 write-<size> <address> <value>
585 Write <value> to byte in address <address>.
587 6.6.4 search-memory reset
589 Reset the memory search
591 6.6.5 search-memory count
593 Print number of candidates remaining
595 6.6.6 search-memory print
597 Print all candidates remaining
599 6.6.7 search-memory <usflag><sizeflag><op>
601 Searches memory for addresses satisfying criteria.
621 • lt: < previous value.
623 • le: <= previous value.
625 • eq: = previous value.
627 • ne: != previous value.
629 • ge: >= previous value.
631 • gt: > previous value.
633 6.6.8 search-memory <sizeflag> <value>
635 Searches for addresses that currently have value <value>.
636 <sizeflag> is as in previous command.
640 These commands are not available in lsnesrc, but are available
641 after ROM has been loaded.
643 6.7.1 quit-emulator [/y]
645 Quits the emulator (asking for confirmation). If /y is given, no
646 confirmation is asked.
650 Toggle paused/unpaused
654 Advance frame. If the button is still held after configurable
655 timeout expires, game unpauses for the duration frame advance is
660 Advance subframe. If the button is still held after configurable
661 timeout expires, game unpauses for the duration frame advance is
664 6.7.5 advance-skiplag
666 Skip to first poll in frame after current.
670 Reset the SNES after this frame.
672 6.7.7 load <filename>
674 Load savestate <filename> in current mode.
676 6.7.8 load-state <filename>
678 Load savestate <filename> in readwrite mode.
680 6.7.9 load-readonly <filename>
682 Load savestate <filename> in readonly mode.
684 6.7.10 load-preserve <filename>
686 Load savestate <filename> in readonly mode, preserving current
689 6.7.11 load-movie <filename>
691 Load savestate <filename>, ignoring save part in readonly mode.
693 6.7.12 save-state <filename>
695 Save system state to <filename> as soon as possible.
697 6.7.13 save-movie <filename>
699 Save movie to <filename>.
711 Toggle between read-only and read-write modes.
713 6.7.17 set-gamename <name>
715 Set name of the game to <name>
719 Print the name of the game.
721 6.7.19 add-author <author>
723 Adds new author <author>. If <author> does not contain '|' it is
724 full name. If it contains '|', '|' splits the full name and
727 6.7.20 edit-author <num> <author>
729 Edit the author in slot <num> (0-based) to be <author> (see
730 add-author for format)
732 6.7.21 remove-author <num>
734 Remove author in slot <num>
740 6.7.23 test-1, test-2, test-3
742 Internal test commands. Don't use.
744 6.7.24 take-screenshot <filename>
746 Save screenshot to <filename>.
748 6.7.25 +controller<num><button>
750 Press button <button> on controller <num> (1-8). The following
751 button names are known:
785 6.7.26 controllerh<num><button>
787 Hold/unhold button <button> on controller <num> (1-8). See
788 +controller for button names.
790 6.7.27 autofire (<pattern>|-)...
792 Set autofire pattern. Each parameter is comma-separated list of
793 button names (in form of 1start, 1A, 2B, etc..) to hold on that
794 frame. After reaching the end of pattern, the pattern restarts
803 6.8.1 cycle-jukebox-backward
805 Cycle save jukebox backwards.
807 6.8.2 cycle-jukebox-forward
809 Cycle save jukebox forwards
813 Do load from jukebox (current mode).
817 Do state save to jukebox.
821 Only available if lua support is compiled in.
823 6.9.1 evaluate-lua <luacode>
825 Run Lua code <luacode> using built-in Lua interpretter.
827 6.9.2 run-lua <script>
829 Run specified lua file using built-in Lua interpretter.
833 6.10.1 add-watch <name> <expression>
835 Adds new watch (or modifies old one).
837 6.10.2 remove-watch <name>
843 6.11.1 enable-sound <on/off>
845 Enable/Disable sound.
847 6.11.2 set-sound-device <device>
849 Set sound device to <device>
851 6.11.3 show-sound-status
853 Show status of sound system.
855 6.11.4 show-sound-devices
857 Show all available devices.
859 6.11.5 set-volume <multiplier>
861 Set the volume multiplier to <multiplier>. 1 is normal volume,
862 and higher numbers are louder.
864 6.11.6 set-volume <multiplier>%
866 Set the volume multiplier to <multiplier> percent. 100 is normal
867 volume, and higher numbers are louder.
869 6.11.7 set-volume <multiplier>dB
871 Set the volume multiplier to <multiplier> dB. 0 is normal volume,
872 and higher numbers are louder. The value may be negative.
874 6.12 SDL Platform commands
876 The following are valid on SDL platform.
880 Asks to press a key and then identifies that (pseudo-)key.
882 6.12.2 toggle-console
884 Toggle between windowed/fullscreen console.
888 Scroll messages window as far back as it goes.
890 6.12.4 scroll-fulldown
892 Scroll messages window as far forward as it goes.
896 Scroll messages window back one screenful.
900 Scroll messages window forward one screenful.
908 Set where bsnes looks for firmware files. Default is “.”.
912 Set the target fps. Numeric, range is 0.001 to “infinite”.
913 Default is native framerate.
915 7.1.3 savecompression
917 Set save compression level (integer 0-9). Default is 7 (0 is no
920 7.1.4 advance-timeout
922 Set the frame advance timeout in milliseconds. Numeric integer,
923 range is 0-999999999. Default is 500.
925 7.2 AVI dumper settings
929 AVI dumper: Always dump at 512x448 or 512x478 regardless of what
932 7.2.2 avi-left-border
934 AVI dumper: Set the default left border thickness (unless lua
935 overrides) for dumps. Range 0-8191. Default is 0.
937 7.2.3 avi-right-border
939 AVI dumper: Set the default right border thickness (unless lua
940 overrides) for dumps. Range 0-8191. Default is 0.
944 AVI dumper: Set the default top border thickness (unless lua
945 overrides) for dumps. Range 0-8191. Default is 0.
947 7.2.5 avi-bottom-border
949 AVI dumper: Set the default bottom border thickness (unless lua
950 overrides) for dumps. Range 0-8191. Default is 0.
954 AVI dumper: Maximum number of frames per dump segment (0 =>
955 unlimited). Range 0-999999999. Default is 0.
957 7.2.7 avi-compresison
959 AVI dumper: Compression level (0-18).
961 • Compression levels 10 and above are not compatible with stock
964 • Recomended level is 7.
968 AVI dumper: Set method of determining the sound rate.
970 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48,
971 64, 88.2, 96, 128, 176.4 and 192 kHz.
973 • 1: Round down to nearest integer.
975 • 2: Round up to nearest ingeter.
981 JMD dumper: Compression level (0-9).
983 7.4 SDL platform settings
985 7.4.1 autorepeat-first-delay
987 Sets the delay for first character in typematic autorepeat.
989 7.4.2 autorepeat-subsequent-delay
991 Sets the delay for subsequent characters in typematic autorepeat.
995 8.1 Core (in main table)
999 Print line to message console.
1001 8.1.2 exec(string command)
1003 Run command as it was entered on the command line
1007 Returns two values. First is time since some epoch in seconds,
1008 the second is microseconds mod 10^6 since that epoch.
1010 8.1.4 emulator_ready()
1012 Returns true if emulator has finished booting, false if not
1013 (on_startup() will be issued later).
1015 8.1.5 set_idle_timeout(number timeout)
1017 Set number of microseconds to block idle for. After this timeout
1018 has expired, on_idle() will be called once.
1020 8.1.6 set_timer_timeout(number timeout)
1022 Set number of microseconds to block timer for. After this timeout
1023 has expired, on_timer() will be called once.
1027 Bitwise logical functions and related.
1029 8.2.1 bit.none(number...) / bit.bnot(number...)
1031 48-bit bitwise NOT / NONE function (set bits that are set in none
1034 8.2.2 bit.any(number...) / bit.bor(number...)
1036 48-bit bitwise OR / ANY function (set bits that are set in any of
1039 8.2.3 bit.all(number...) / bit.band(number...)
1041 48-bit bitwise AND / ALL function (set bits that are set in all
1044 8.2.4 bit.parity(number...) / bit.bxor(number...)
1046 48-bit bitwise XOR / PARITY function (set bits that are set in
1047 odd number of the arguments).
1049 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
1051 Rotate bits-bit (max 48, default 48) number left by amount
1054 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
1056 Rotate bits-bit (max 48, default 48) number right by amount
1059 8.2.7 bit.lshift(number base[, number amount[, number bits]])
1061 Shift bits-bit (max 48, default 48) number left by amount
1062 (default 1) places. The new bits are filled with zeroes.
1064 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1066 Shift bits-bit (max 48, default 48) number logically right by
1067 amount (default 1) places. The new bits are filled with zeroes.
1069 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1071 Shift bits-bit (max 48, default 48) number arithmetically right
1072 by amount (default 1) places. The new bits are shifted in with
1073 copy of the high bit.
1075 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
1077 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1
1082 • Bit numbers up to 51 should work reliably (then things start
1083 falling apart due to double precision issues).
1085 • There are two special bit positions, true and false, standing
1086 for always set bit and always clear bit.
1088 8.2.11 bit.value([number bit1[, number bit2,...]])
1090 Returns bitwise OR of 1 left shifted by bit1 places, 1 left
1091 shifted by bit2 places and so on. As special value, nil argument
1096 Most of these functions can only be called in on_paint and
1097 on_video callbacks. Exceptions are noted.
1099 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are
1100 the green component, bits 16-23 are the red component, bits 24-31
1101 are alpha component (0 is fully opaque, 255 is almost
1102 transparent). -1 is the fully transparent color. Alpha values
1103 greater than 127 do work.
1105 Origin of coordinates is at top left corner of game display area.
1106 Left and top gaps correspond to negative coordinates.
1108 8.3.1 gui.resolution()
1110 Returns 2-tuple (hresolution, vresolution).
1112 8.3.2 gui.<class>_gap(number gap)
1114 Set the <class> (left, right, top, bottom) gap to specified value
1117 8.3.3 gui.text(number x, number y, string text[, number fgc[,
1120 Draw specified text on the GUI (each character cell is 8 or 16
1121 wide and 16 high). Parameters:
1123 • x: X-coordinate to start the drawing from (and x-coordinate at
1124 begining of the lines).
1126 • y: Y-coordinate to start the drawing from.
1128 • text: The text to draw.
1130 • fgc: Text color (default is 0xFFFFFF (white))
1132 • bgc: Background color (default is -1 (transparent))
1134 8.3.4 gui.textH(number x, number y, string text[, number fgc[,
1137 Like gui.text, but draw using double-width.
1139 8.3.5 gui.textV(number x, number y, string text[, number fgc[,
1142 Like gui.text, but draw using double-height.
1144 8.3.6 gui.textHV(number x, number y, string text[, number fgc[,
1147 Like gui.text, but draw using double-width/double-height.
1149 8.3.7 gui.rectangle(number x, number y, number width, number
1150 height[, number thickness[, number outline[, number fill]]])
1152 Draw rectangle on the GUI. Parameters:
1154 • x: X-coordinate of left edge.
1156 • y: Y-coordinate of upper edge.
1158 • width: Width of rectangle.
1160 • height: Height of rectangle.
1162 • thickness: Thickness of outline (default is 1).
1164 • outline: Color of outline (default is 0xFFFFFF (white))
1166 • fill: Color of fill (default is -1 (transparent))
1168 8.3.8 gui.box(number x, number y, number width, number height[,
1169 number thickness[, number outline1[,number outline2[, number
1172 Draw rectangle with 3D effect on the GUI. Parameters:
1174 • x: X-coordinate of left edge.
1176 • y: Y-coordinate of upper edge.
1178 • width: Width of rectangle.
1180 • height: Height of rectangle.
1182 • thickness: Thickness of outline (default is 1).
1184 • outline1: First color of outline (default is 0xFFFFFF (white))
1186 • outline2: First color of outline (default is 0x808080 (dark
1189 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1191 8.3.9 gui.pixel(number x, number y[, number color])
1193 Draw one pixel on the GUI. Parameters:
1195 • x: X-coordinate of the pixel
1197 • y: Y-coordinate of the pixel
1199 • color: Color of the pixel (default is 0xFFFFFF (white))
1201 8.3.10 gui.crosshair(number x, number y[, number length[, number
1204 Draw a crosshair. Parameters:
1206 • x: X-coordinate of the crosshair
1208 • y: Y-coordinate of the crosshair
1210 • length: Length of the crosshair lines (default 10).
1212 • color: Color of the crosshair (default is 0xFFFFFF (white))
1214 8.3.11 gui.line(number x1, number y1, number x2, number y2[,
1217 Draw a thin line. Parameters:
1219 • x1: X-coordinate of one end.
1221 • y1: Y-coordinate of one end.
1223 • x2: X-coordinate of the other end.
1225 • y2: Y-coordinate of the other end.
1227 • color: Color of the line (default is 0xFFFFFF (white)).
1229 8.3.12 gui.circle(number x, number y, number r[, number thick[,
1230 number border[, number fil]]])
1232 Draw a circle. Parameters.
1234 • x: X-coordinate of the center
1236 • y: Y-coordinate of the center
1238 • r: The radius of the circle
1240 • thick: Border thickness
1242 • border: Border color (default is 0xFFFFFF (white))
1244 • fill: Fill color (default is -1 (transparent)).
1246 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
1249 Draw a bitmap on screen with specified palette. Parameters:
1251 • x: X-coordinate of left edge.
1253 • y: Y-coordinate of top edge.
1255 • bitmap: The bitmap to draw
1257 • palette: The palette to draw the bitmap using.
1259 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1261 Draw a bitmap on screen. Parameters:
1263 • x: X-coordinate of left edge.
1265 • y: Y-coordinate of top edge.
1267 • bitmap: The bitmap to draw
1269 8.3.15 gui.palette_new()
1271 Returns a new palette (initially all transparent). Can be used
1274 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool
1277 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1279 • w: The width of new bitmap
1281 • h: The height of new bitmap
1283 • direct: If true, the returned bitmap is dbitmap, otherwise
1286 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
1289 8.3.17 gui.bitmap_load(string file)
1291 Returns loaded bitmap/dbitmap (if bitmap, the second return value
1292 is palette for bitmap). Can be used anywhere. Parameters:
1294 • file: The name of file to load.
1296 8.3.18 gui.palette_set(palette palette, number index, number
1299 Sets color in palette. Can be used anywhere. Parameters:
1301 • palette: The palette to manipulate
1303 • index: Index of color (0-65535).
1305 • color: The color value.
1307 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
1310 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1312 • bitmap: The bitmap to manipulate
1314 • x: The x-coordinate of the pixel.
1316 • y: The y-coordinate of the pixel.
1318 • color: If bitmap is a bitmap, color index (0-65535). Otherwise
1321 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1323 Get size of bitmap. Can be used anywhere. Parameters:
1325 • bitmap: The bitmap to query.
1327 The first return is the width, the second is the height.
1329 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
1330 bitmap/dbitmap src, number sx, number sy, number w, number h[,
1333 Blit a part of bitmap to another. Can be used anywhere.
1336 • dest: Destination to blit to.
1338 • dx: left edge of target
1340 • dy: Top edge of target
1342 • src: The source to blit from. Must be of the same type as
1345 • sx: left edge of source
1347 • sy: Top edge of source
1349 • w: Width of region
1351 • h: Height of region.
1353 • ck: Color key. Pixels of this color are not blitted.
1355 – If bitmaps are bitmaps, this is color index of colorkey.
1356 Values outside range 0-65535 cause no key to be used as
1359 – If bitmaps are dbitmaps, this color value of colorkey.
1361 – May be absent or nil for no colorkey blit.
1363 8.3.22 gui.repaint()
1365 Request on_repaint() to happen as soon as possible. Can be used
1368 8.3.23 gui.subframe_update(boolean on)
1370 Request subframe updates (calling on_paint() on subframes) to
1371 happen (on=true) or not happen (on=false). Can be used anywhere.
1373 8.3.24 gui.screenshot(string filename)
1375 Write PNG screenshot of the current frame (no drawings) to
1376 specified file. Can be used anywhere.
1378 8.3.25 gui.color(number r, number g, number b[, number a])
1380 Returns color (in notation Lua scripts use) corresponding to
1381 color (r,g,b), each component in scale 0-255. If a is specified,
1382 that is alpha (0 is fully transparent, 256(sic) is fully opaque).
1383 The default alpha is 256.
1385 8.3.26 gui.status(string name, string value)
1387 Set status field “L[<name>]” to <value> in status area. Can be
1390 8.3.27 gui.rainbow(number step, number steps[, number color])
1392 Perform hue rotation of color <color> (default bright red), by
1393 <step> steps. The number of steps per full rotation is given by
1394 absolute value of <steps>.
1396 If <steps> is negative, the rotation will be counterclockwise.
1400 Input handling. Only available in on_input callback.
1402 8.4.1 input.get(number controller, number index)
1404 Read the specified index (0-11) from specified controller (0-7).
1407 • Uses physical controller numbering. Gamepad in port 2 is
1408 controller 4, not 1!
1410 8.4.2 input.set(number controller, number index, number value)
1412 Write the specified index (0-11) from specified controller (0-7),
1413 storing value. Notes:
1415 • Uses physical controller numbering. Gamepad in port 2 is
1416 controller 4, not 1!
1418 8.4.3 input.geta(number controller)
1420 Get input state for entiere controller. Returns 13 return values.
1422 • 1st return value: Bitmask: bit i is set if i:th index is
1425 • 2nd-13th return value: value of i:th index.
1427 8.4.4 input.seta(number controller, number bitmask, number
1430 Set state for entiere controller. args is up to 12 values for
1431 indices (overriding values in bitmask if specified).
1433 8.4.5 input.controllertype(number controller)
1435 Get the type of controller as string. Valid values are:
1445 8.4.6 input.reset([number cycles])
1447 Execute reset. If cycles is greater than zero, do delayed reset.
1448 0 (or no value) causes immediate reset.
1450 • Only available with subframe flag false.
1454 Returns table of tables of all available keys and axes. The first
1455 table is indexed by key name (platform-dependent!), and the inner
1456 table has the following fields:
1458 • last_rawval: Last reported raw value for control.
1460 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse,
1461 hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p,
1462 pressure-pm, pressure-p0).
1464 • cal_left: Minimum calibration value. Only meaningful with axis
1467 • cal_center: Center calibration value. Only meaningful with axis
1470 • cal_right: Maximum calibration value. Only meaningful with axis
1473 • cal_tolerance: Dead zone tolerance. Only meaningful with axis
1476 8.4.8 input.keyhook(key, state)
1478 Requests that keyhook events to be sent for key (state=true) or
1479 not sent (state=false).
1481 8.5 Table hostmemory
1483 Host memory handling (extra memory saved to savestates). Host
1484 memory starts empty.
1486 8.5.1 hostmemory.read(number address)
1488 Reads hostmemory slot address. Slot numbers out of range return
1489 false instead of numeric.
1491 8.5.2 hostmemory.write(number address, number value)
1493 Writes hostmemory slot with 0-255. Slot numbers out of range
1494 cause extension of host memory slot space.
1496 8.5.3 hostmemory.readbyte(number address)
1498 Read unsigned byte (1 element) from given address. Slots out of
1501 8.5.4 hostmemory.writebyte(number address, number value)
1503 Write unsigned byte (1 element) to given slot. Slot numbers out
1504 of range cause extension.
1506 8.5.5 hostmemory.readsbyte(number address)
1508 Read signed byte (1 element) from given address. Slots out of
1511 8.5.6 hostmemory.writesbyte(number address, number value)
1513 Write signed byte (1 element) to given slot. Slot numbers out of
1514 range cause extension.
1516 8.5.7 hostmemory.readword(number address)
1518 Read unsigned word (2 elements) from given address. Slots out of
1521 8.5.8 hostmemory.writeword(number address, number value)
1523 Write unsigned word (2 elements) to given slot. Slot numbers out
1524 of range cause extension.
1526 8.5.9 hostmemory.readsword(number address)
1528 Read signed word (2 elements) from given address. Slots out of
1531 8.5.10 hostmemory.writesword(number address, number value)
1533 Write signed word (2 elements) to given slot. Slot numbers out of
1534 range cause extension.
1536 8.5.11 hostmemory.readdword(number address)
1538 Read unsigned doubleword (4 elements) from given address. Slots
1539 out of range return false.
1541 8.5.12 hostmemory.writedword(number address, number value)
1543 Write unsigned doubleword (4 elements) to given slot. Slot
1544 numbers out of range cause extension.
1546 8.5.13 hostmemory.readsdword(number address)
1548 Read signed doubleword (4 elements) from given address. Slots out
1549 of range return false.
1551 8.5.14 hostmemory.writesdword(number address, number value)
1553 Write signed doubleword (4 elements) to given slot. Slot numbers
1554 out of range cause extension.
1556 8.5.15 hostmemory.readqword(number address)
1558 Read unsigned quadword (8 elements) from given address. Slots out
1559 of range return false.
1561 8.5.16 hostmemory.writeqword(number address, number value)
1563 Write unsigned quadword (4 elements) to given slot. Slot numbers
1564 out of range cause extension.
1566 8.5.17 hostmemory.readsqword(number address)
1568 Read signed quadword (8 elements) from given address. Slots out
1569 of range return false.
1571 8.5.18 hostmemory.writesqword(number address, number value)
1573 Write signed quadword (8 elements) to given slot. Slot numbers
1574 out of range cause extension.
1580 8.6.1 movie.currentframe()
1582 Return number of current frame.
1584 8.6.2 movie.framecount()
1586 Return number of frames in movie.
1588 8.6.3 movie.readonly()
1590 Return true if in readonly mode, false if in readwrite.
1592 8.6.4 movie.set_readwrite()
1594 Set readwrite mode (does not cause on_readwrite callback).
1596 8.6.5 movie.frame_subframes(number frame)
1598 Count number of subframes in specified frame (frame numbers are
1599 1-based) and return that.
1601 8.6.6 movie.read_subframe(number frame, number subframe)
1603 Read specifed subframe in specified frame and return data as
1604 array (100 elements, numbered 0-99 currently).
1608 Routines for settings manipulation
1610 8.7.1 settings.get(string name)
1612 Get value of setting. If setting is blank, returns false. If
1613 setting value can't be obtained, returns (nil, error message).
1615 8.7.2 settings.set(string name, string value)
1617 Set value of setting. If setting can't be set, returns (nil,
1620 8.7.3 settings.is_set(string name)
1622 Returns if setting is set. If setting does not exist, returns
1623 (nil, error message).
1625 8.7.4 settings.blank(string name)
1627 Blanks a setting and returns true. If setting can't be blanked,
1628 returns (nil, error message).
1632 Contains various functions for managing memory
1634 8.8.1 memory.vma_count()
1636 Returns the number of VMAs
1638 8.8.2 memory.read_vma(number index)
1640 Reads the specified VMA (indices start from zero). Trying to read
1641 invalid VMA gives nil. The read VMA is table with the following
1644 • region_name (string): The readable name of the VMA
1646 • baseaddr (number): Base address of the VMA
1648 • lastaddr (number): Last address in the VMA.
1650 • size (number): The size of VMA in bytes.
1652 • readonly (boolean): True of the VMA corresponds to ROM.
1654 • native_endian (boolean): True if the VMA has native endian as
1655 opposed to little endian.
1657 8.8.3 memory.find_vma(number address)
1659 Finds the VMA containing specified address. Returns table in the
1660 same format as read_vma or nil if not found.
1662 8.8.4 memory.readbyte(number address)
1664 Reads the specified address as unsigned byte and returns the
1667 8.8.5 memory.readsbyte(number address)
1669 Reads the specified address as signed byte and returns the
1672 8.8.6 memory.writebyte(number address, number value)
1674 Writes the specified value (negative values undergo 2's
1675 complement) to specified address (as a byte).
1677 8.8.7 memory.readword(number address)
1679 Reads the specified address as unsigned word and returns the
1682 8.8.8 memory.readsword(number address)
1684 Reads the specified address as signed word and returns the
1687 8.8.9 memory.writeword(number address, number value)
1689 Writes the specified value (negative values undergo 2's
1690 complement) to specified address (as a word).
1692 8.8.10 memory.readdword(number address)
1694 Reads the specified address as unsigned doubleword and returns
1697 8.8.11 memory.readsdword(number address)
1699 Reads the specified address as signed doubleword and returns the
1702 8.8.12 memory.writedword(number address, number value)
1704 Writes the specified value (negative values undergo 2's
1705 complement) to specified address (as a doubleword).
1707 8.8.13 memory.readqword(number address)
1709 Reads the specified address as unsigned quadword and returns the
1712 8.8.14 memory.readsqword(number address)
1714 Reads the specified address as signed quadword and returns the
1717 8.8.15 memory.writeqword(number address, number value)
1719 Writes the specified value (negative values undergo 2's
1720 complement) to specified address (as a quadword).
1724 Contains copy of global variables from time of Lua
1725 initialization. Non-writeable.
1729 Various callbacks to Lua that can occur.
1731 8.10.1 Callback: on_paint(bool not_synth)
1733 Called when screen is being painted. Any gui.* calls requiring
1734 graphic context draw on the screen.
1736 not_synth is true if this hook is being called in response to
1737 received frame, false otherwise.
1739 8.10.2 Callback: on_video()
1741 Called when video dump frame is being painted. Any gui.* calls
1742 requiring graphic context draw on the video.
1744 8.10.3 Callback: on_frame_emulated()
1746 Called when emulating frame has completed and
1747 on_paint()/on_video() calls are about to be issued.
1749 8.10.4 Callback: on_frame()
1751 Called on each starting whole frame.
1753 8.10.5 Callback: on_startup()
1755 Called when the emulator is starting (lsnes.rc and --run files
1758 8.10.6 Callback: on_rewind()
1760 Called when rewind movie to beginning has completed.
1762 8.10.7 Callback: on_pre_load(string name)
1764 Called just before savestate/movie load occurs (note: loads are
1765 always delayed, so this occurs even when load was initiated by
1768 8.10.8 Callback: on_err_load(string name)
1770 Called if loadstate goes wrong.
1772 8.10.9 Callback: on_post_load(string name, boolean was_savestate)
1774 Called on successful loadstate. was_savestate gives if this was a
1775 savestate or a movie.
1777 8.10.10 Callback: on_pre_save(string name, boolean is_savestate)
1779 Called just before savestate save occurs (note: movie saves are
1780 synchronous and won't trigger these callbacks if called from
1783 8.10.11 Callback: on_err_save(string name)
1785 Called if savestate goes wrong.
1787 8.10.12 Callback: on_post_save(string name, boolean is_savestate)
1789 Called on successful savaestate. is_savestate gives if this was a
1790 savestate or a movie.
1792 8.10.13 Callback: on_quit()
1794 Called when emulator is shutting down.
1796 8.10.14 Callback: on_input(boolean subframe)
1798 Called when emulator is just sending input to bsnes core.
1799 Warning: This is called even in readonly mode, but the results
1802 8.10.15 Callback: on_reset()
1804 Called when SNES is reset.
1806 8.10.16 Callback: on_readwrite()
1808 Called when moving into readwrite mode as result of “set-rwmode”
1809 command (note: moving to rwmode by Lua won't trigger this, as per
1810 recursive entry protection).
1812 8.10.17 Callback: on_snoop(number port, number controller, number
1813 index, number value)
1815 Called each time bsnes asks for input. The value is the final
1816 value to be sent to bsnes core (readonly mode, autohold and
1817 autofire have been taken into account). Might be useful when
1818 translating movies to format suitable for console verification.
1819 Note: There is no way to modify the value to be sent.
1821 8.10.18 Callback: on_keyhook(string keyname, table state)
1823 Sent when key that has keyhook events requested changes state.
1824 Keyname is name of the key (group) and state is the state (same
1825 kind as table values in input.raw).
1827 8.10.19 Callback: on_idle()
1829 Called when requested by set_idle_timeout(), the timeout has
1830 expired and emulator is waiting.
1832 8.10.20 Callback: on_timer()
1834 Called when requested by set_idle_timeout() and the timeout has
1835 expired (regardless if emulator is waiting).
1837 9 Memory watch expression syntax
1839 Memory watch expressions are in RPN (Reverse Polish Notation). At
1840 the end of expression, the top entry on stack is taken as the
1845 • Evaluation order is strictly left to right.
1847 • a is the entry on top of stack
1849 • b is the entry immediately below top of stack
1851 • ; separates values to be pushed (no intermediate pop).
1853 • After end of element, all used stack slots are popped and all
1856 • When pushing multiple values, the pushes occur in order shown.
1858 The following operators are available:
1872 • b : read_signed_byte(a)
1876 • d : read_signed_dword(a)
1878 • i : quotent(a / b)
1883 • q : read_signed_qword(a)
1893 • w : read_signed_word(a)
1897 • B : read_unsigned_byte(a)
1899 • C<number>z : Push number <number> to stack.
1901 • D : read_unsigned_dword(a)
1903 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1905 • Q : read_unsigned_qword(a)
1907 • R<digit> : round a to <digit> digits.
1909 • W : read_unsigned_word(a)
1913 C0x007e0878zWC0x007e002czW-
1915 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1917 2. Pop the value on top of stack (0x7e0878), read word value at
1918 that address and push the result,call it x1 (W).
1920 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1922 4. Pop the value on top of stack (0x7e002c), read word value at
1923 that address and push the result,call it x2 (W).
1925 5. Pop the two top numbers on stack, x1 and x2, substract x1 from
1926 x2 and push x2 - x1 (-).
1928 6. Since the expression ends, the final memory watch result is
1929 the top one on stack, which is x2 - x1.
1931 10 Modifier and key names:
1935 10.1.1 Modifier names
1937 Following modifier names are known:
1939 • ctrl, lctrl, rctrl: Control keys
1941 • alt, lalt, ralt: ALT keys.
1943 • shift, lshift, rshift: Shift keys.
1945 • meta, lmeta, rmeta: Meta keys.
1947 • num, caps: Numlock/Capslock (these are sticky!)
1949 • mode: Mode select.
1953 Following key names are known:
1955 • backspace, tab, clear, return, pause, escape, space, exclaim,
1956 quotedbl, hash, dollar, ampersand, quote, leftparen,
1957 rightparen, asterisk, plus, comma, minus, period, slash, 0, 1,
1958 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals,
1959 greater, question, at, leftbracket, backslash, rightbracket,
1960 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k,
1961 l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0,
1962 world_1, world_2, world_3, world_4, world_5, world_6, world_7,
1963 world_8, world_9, world_10, world_11, world_12, world_13,
1964 world_14, world_15, world_16, world_17, world_18, world_19,
1965 world_20, world_21, world_22, world_23, world_24, world_25,
1966 world_26, world_27, world_28, world_29, world_30, world_31,
1967 world_32, world_33, world_34, world_35, world_36, world_37,
1968 world_38, world_39, world_40, world_41, world_42, world_43,
1969 world_44, world_45, world_46, world_47, world_48, world_49,
1970 world_50, world_51, world_52, world_53, world_54, world_55,
1971 world_56, world_57, world_58, world_59, world_60, world_61,
1972 world_62, world_63, world_64, world_65, world_66, world_67,
1973 world_68, world_69, world_70, world_71, world_72, world_73,
1974 world_74, world_75, world_76, world_77, world_78, world_79,
1975 world_80, world_81, world_82, world_83, world_84, world_85,
1976 world_86, world_87, world_88, world_89, world_90, world_91,
1977 world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3,
1978 kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide,
1979 kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down,
1980 right, left, insert, home, end, pageup, pagedown, f1, f2, f3,
1981 f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock,
1982 capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt,
1983 rmeta, lmeta, lsuper, rsuper, mode, compose, help, print,
1984 sysreq, break, menu, power, euro, undo
1986 • Names of form 'key<n>' where <n> is 0-255 are interpretted as
1987 key having hardware-dependent scan code of <n> (useful to bind
1988 those keys that don't have symbolic names).
1990 10.1.3 Joystick pseudo-keys:
1992 • joystick<num>button<button>: Joystick <num> (0-based) button
1995 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat>
1998 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat>
2001 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat>
2004 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat>
2007 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis>
2008 negative position (axis modes axis and axis_inverse).
2010 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis>
2011 positive position (axis modes axis and axis_inverse).
2013 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis>
2014 pressure (axis modes pressure_*).
2016 10.1.4 Special buttons:
2018 • Escape: Enter/Exit Command mode, cancel modal dialogs.
2020 • Return (also KPEnter): Execute command, ok modal dialog.
2022 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous
2023 command in command history
2025 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next
2026 command in command history
2028 • Home (also KP7 if no num lock; command mode): Beginning of
2031 • End (also KP1 if no num lock; command mode): End of command.
2033 • Left (also KP4 if no num lock; command mode): Move cursor left.
2035 • Right (also KP6 if no num lock; command mode): Move cursor
2038 • Delete (also KP. if no num lock; command mode): Delete
2039 character to right of cursor.
2041 • Insert (also KP0 if no num lock; command mode): Toggle between
2042 insert / overwrite modes.
2044 • Backspace (command mode): Delete character to left of cursor.
2046 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump
2049 10.2 wxWidgets platform
2051 10.2.1 Modifier names:
2053 Following modifier names are known:
2063 • cmd (Mac OS X only)
2067 Following key names are known:
2069 • back, tab, return, escape, space, exclaim, quotedbl, hash,
2070 dollar, percent, ampersand, quote, leftparen, rightparen,
2071 asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5,
2072 6, 7, 8, 9, colon, semicolon, less, equals, greater, question,
2073 at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,
2074 u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret,
2075 underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m,
2076 n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe,
2077 rightcurly, tilde, delete, start, lbutton, rbutton, cancel,
2078 mbutton, clear, shift, alt, control, menu, pause, capital, end,
2079 home, lefT, up, right, down, select, print, execute, snapshot,
2080 insert, help, numpad0, numpad1, numpad2, numpad3, numpad4,
2081 numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add,
2082 separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6,
2083 f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19,
2084 f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown,
2085 numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2,
2086 numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up,
2087 numpad_right, numpad_down, numpad_pageup, numpad_pagedown,
2088 numpad_end, numpad_begin, numpad_insert, numpad_delete,
2089 numpad_equal, numpad_multiply, numpad_add, numpad_separator,
2090 numpad_subtract, numpad_decimal, numpad_divide, windows_left,
2091 windows_right, windows_menu, command, special1, special2,
2092 special3, special4, special5, special6, special7, special8,
2093 special9, special10, special11, special12, special13,
2094 special14, special15, special16, special17, special18,
2095 special19, special20
2097 11 Movie file format
2099 Movie file is .zip archive in itself, normal ZIP archive tools
2100 work on it (note: If you recompress it, do not use compression
2101 methods other than store and deflate and especially do not use
2102 encryption of any kind).
2104 11.1 Detecting clean start/SRAM/Savestate
2106 • If file has member “savestate” it is savestate, otherwise:
2108 • If file has members with names starting “moviesram.” it is
2109 movie starting from SRAM, otherwise:
2111 • It is movie starting from clear state.
2113 11.2 Member: gametype
2115 Type of game ROM and region (as one line). Valid values are:
2118 +--------------+---------------------+--------+
2119 | Value | System | Region |
2120 +--------------+---------------------+--------+
2121 +--------------+---------------------+--------+
2122 | snes_pal | Super NES | PAL |
2123 +--------------+---------------------+--------+
2124 | sgb_pal | Super Game Boy | PAL |
2125 +--------------+---------------------+--------+
2126 | snes_ntsc | Super NES | NTSC |
2127 +--------------+---------------------+--------+
2128 | sgb_ntsc | Super Game Boy | NTSC |
2129 +--------------+---------------------+--------+
2130 | bsx | BS-X (non-slotted) | NTSC |
2131 +--------------+---------------------+--------+
2132 | bsxslotted | BS-X (slotted) | NTSC |
2133 +--------------+---------------------+--------+
2134 | sufamiturbo | Sufami Turbo | NTSC |
2135 +--------------+---------------------+--------+
2141 +---------+-----------------+
2142 | Region | Framerate (fps) |
2143 +---------+-----------------+
2144 +---------+-----------------+
2145 | PAL | 322445/6448 |
2146 +---------+-----------------+
2147 | NTSC | 10738636/178683 |
2148 +---------+-----------------+
2153 Contains type of port #1 (as one line). Valid values are 'none',
2154 'gamepad', 'multitap' and 'mouse'. If not present, defaults to
2159 Contains type of port #2 (as one line). Valid values are 'none',
2160 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and
2161 'justifiers'. If not present, defaults to 'none'.
2163 11.5 Member: gamename
2165 Contains name of the game (as one line).
2167 11.6 Member: authors
2169 Contains authors, one per line. Part before '|' is the full name,
2170 part after is the nickname.
2172 11.7 Member: systemid
2174 Always “lsnes-rr1” (one line). Used to reject other saves.
2176 11.8 Member: controlsversion
2178 Always “0” (one line). Used to identify what controls are there.
2180 11.9 Member: “coreversion”
2182 Contains bsnes core version number (as one line).
2184 11.10 Member: projectid
2186 Contains project ID (as one line). Used to identify if two movies
2187 are part of the same project.
2189 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2191 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2192 Absent if corresponding file is absent.
2194 11.12 Member: moviesram.<name>
2196 Raw binary startup SRAM of kind <name>. Only present in
2197 savestates and movies starting from SRAM.
2199 11.13 Member: saveframe
2201 Contains frame number (as one line) of frame movie was saved on.
2202 Only present in savestates.
2204 11.14 Member: lagcounter
2206 Current value of lag counter (as one line). Only present in
2209 11.15 Member: pollcounters
2211 Contains poll counters (currently 100 of them), one per line.
2212 Each line is raw poll count if DRDY is set for it. Otherwise it
2213 is negative poll count minus one. Only present in savestates.
2215 11.16 Member: hostmemory
2217 Raw binary dump of host memory. Only present in savestates.
2219 11.17 Member: savestate
2221 The raw binary savestate itself. Savestate detection uses this
2222 file, only present in savestates.
2224 11.18 Member: screenshot
2226 Screenshot of current frame. Only present in savestates. First 2
2227 bytes are big-endian width of image, rest are 24-bit RGB image
2228 data. Height of image is inferred from the width and size of
2231 11.19 Member: sram.<name>
2233 Raw binary SRAM of kind <name> at time of savestate. Only present
2238 The actual input track, one line per subframe (blank lines are
2241 • If the first byte of each line is '.', ' ', <tab> or '|', then
2242 the line is part of same frame as previous, otherwise it starts
2245 • First subframe must start a new frame.
2247 Length of movie in frames is number of lines in input file that
2250 11.21 Member: rerecords
2252 Contains textual base-10 rerecord count (as one line; emulator
2253 just writes this, it doesn't read it) + 1.
2255 11.22 Member: rrdata
2257 This member stores set of load IDs. There is one load ID per
2258 rerecord (plus one corresponding to start of project).
2260 • This member constists of concatenation of records
2262 • Each record is 2-36 bytes long and can represent 1-16,843,009
2265 • IDs are interpretted as 256-bit big-endian integers with
2268 • Initial predicted ID is all zeroes.
2270 Format of each record is:
2272 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen),
2273 bits 5-6 are count length (countlen). Bit 7 is unused.
2275 • 32-prefixlen bytes of ID.
2277 • countlen bytes of big-endian count (count).
2279 Records are processed as follows:
2281 • To form the first ID encoded by record, take the first
2282 prefixlen bytes predicted ID and append the read ID value to
2283 it. The result is the first ID encoded.
2285 • If countlen is 0, record encodes 1 ID.
2287 • If countlen is 1, record encodes 2+count IDs.
2289 • If countlen is 2, record encodes 258+count IDs.
2291 • If countlen is 3, record encodes 65794+count IDs.
2293 • The new predicted ID is the next ID after last one encoded by
2296 The number of rerecords + 1 is equal to the sum of number of IDs
2297 encoded by all records.
2299 11.23 Member: starttime.second
2301 Movie starting time, second part. Epoch is Unix epoch. Default is
2304 11.24 Member: starttime.subsecond
2306 Movie starting time, subsecond part. Unit is CPU clocks. Default
2309 11.25 Member: savetime.second
2311 Movie saving time, second part. Default is starttime.second. Only
2312 present in savestates.
2314 11.26 Member: savetime.subsecond
2316 Movie saving time, subsecond part. Default is
2317 starttime.subsecond. Only present in savestates.
2319 12 Quick'n'dirty encode guide
2321 1. Start the emulator and load the movie file.
2323 2. Set large AVI option 'set-setting avi-large on'
2325 3. Enable dumping 'dump-avi tmpdump'
2327 4. Unpause and let it run until you want to end dumping.
2329 5. Close the emulator (closing the window is the easiest way). Or
2332 6. For each tmpdump*.avi file created, on command prompt, do
2333 'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2335 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2337 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv +
2338 tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every
2339 tmpdump_<numbers>.mkv, with + in between).
2341 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now
2342 final.mkv contains quick'n'dirty encode.
2344 13 Axis configurations for some gamepad types:
2346 13.1 XBox360 controller:
2348 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be
2351 set-axis joystick0axis2 pressure-+
2353 set-axis joystick0axis5 pressure-+
2355 • This is needed for SDL only. EVDEV sets those types correctly.
2357 13.2 PS3 “sixaxis” controller:
2359 Axes 8-19 should be disabled.
2361 set-axis joystick0axis8 disabled
2363 set-axis joystick0axis9 disabled
2365 set-axis joystick0axis10 disabled
2367 set-axis joystick0axis11 disabled
2369 set-axis joystick0axis12 disabled
2371 set-axis joystick0axis13 disabled
2373 set-axis joystick0axis14 disabled
2375 set-axis joystick0axis15 disabled
2377 set-axis joystick0axis16 disabled
2379 set-axis joystick0axis17 disabled
2381 set-axis joystick0axis18 disabled
2383 set-axis joystick0axis19 disabled
2387 14.1 Problems from BSNES core:
2389 • The whole pending save stuff.
2391 • Lack of layer hiding.
2393 • It is slow (especially accuracy).
2395 • Firmwares can't be loaded from ZIP archives.
2397 14.2 Other problems:
2399 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2401 • Audio for last dumped frame is not itself dumped.
2403 • Audio in UI is pretty bad in quality if game doesn't run at
2406 • AVI compression levels 10-18 are not compatible with AVISynth
2409 • No menus, command based interface (SDL).
2411 • Long commands don't scroll.
2413 • Wxwidgets UI is still buggy.
2419 • Fix -Wall warnings
2421 • Fix dumper video corruption with levels 10-18.
2427 • Lots of code cleanups
2429 • Lua interface to settings
2431 • Allow specifying AVI borders without Lua
2433 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2435 • on_snoop lua callback
2437 • Faster movie loading and saving.
2447 • Save jukebox functionality.
2451 • Try to fix some nasty failing movie load edge cases
2453 • Allow specifying scripts to run on command line.
2457 • Major source code reorganization.
2459 • Backup savestates before overwriting.
2461 • Don't crash if loading initial state fails.
2465 • Fix firmware lookup
2467 • Fix author name parsing
2469 • Fix rerecord counting
2471 • (SDL) Print messages to console if SDL is uninitialized
2473 • Add movieinfo program
2475 • Fix loading movies starting from SRAM.
2479 • Add support for unattended dumping
2481 • Fix compiling for Win32
2483 • Don't lock up if sound can't be initialized
2485 • Strip trailing CR from commands
2487 • Don't try to do dubious things in global ctors (fix crash on
2492 • Small documentation tweaking
2496 • Fix major bug in modifier matching
2500 • Lots of documentation fixes
2502 • Use dedicated callbacks for event backcomm., not commands.
2504 • Ensure that the watchdog is not hit when executing delayed
2507 • Remove errant tab from joystick message.
2511 • Make autofire operate in absolute time, not linear time
2513 • Reinitialize controls when resuming from loadstate
2515 • Some more code cleanups
2517 • If Lua allocator fails, call OOM_panic()
2519 • Byte/word/dword/qword sized host memory write/read functions.
2521 • Dump at correct framerate if dumping interlaced NTSC
2526 • Actually include the complete source code
2532 • Document {save,start}time.{,sub}second.
2534 • Intercept time() from bsnes core.
2538 • Allow disabling time() interception (allow build on Mac OS X)
2540 • Use SDLMain on Mac OS X (make SDL not crash)
2542 • Disable delayed resets (just plain too buggy for now).
2546 • Use 16-bit for graphics/video instead of 32-bit.
2548 • gui.rectangle/gui.pixel
2552 • New CSCD writer implementation.
2556 • Fix interaction of * and +.
2558 • Manual improvements
2560 • Use gettimeofday()/usleep(), these seem portable enough.
2562 • Move joystick axis manipulation to keymapper code.
2564 • Changes to how read-only works.
2566 • Refactor controller input code.
2570 • Fix mouseclick scale compensation.
2572 • Draw area boundaries correctly in SDL code.
2576 • Fix CSCD output (buffer overrun and race condition).
2580 • JMD dumping support.
2582 • Allow unattended dumping to JMD.
2584 • Move to BSNES v083.
2586 • Switch back to 32-bit colors.
2588 • Add Lua function gui.color.
2590 • Use some new C++11 features in GCC 4.6.
2592 • Be prepared for core frequency changes.
2594 • Pass colors in one chunk from Lua.
2598 • New lua functions gui.line(), gui.status() and gui.circle(),
2599 memory.vma_count(), memory.read_vma() and memory.find_vma().
2601 • Numerious documentation fixups
2603 • RTC time format changed
2605 • Reformat flags display
2607 • Allow lua package name to be overridden
2609 • SDUMP (high-quality dumping).
2611 • Split platform support to plugins.
2613 • Make all sound plugins support basic sound commands
2615 • Support portaudio for sound.
2617 • Allow disable Lua/SDL searching.
2619 • Upconvert colors when copying lcscreen to screen.
2621 • Reorganize source tree.
2623 • Evdev joystick support.
2625 • Refactor more code into generic window code.
2629 • Refactor message handling.
2633 • Documentation fixes
2635 • Finish pending saves before load/quit.
2637 • Wxwidgets graphics plugin.
2641 • Get rid of win32-crap.[ch]pp.
2643 • Move files around a lot.
2645 • Get rid of need for host C++ compiler.
2649 • Refactor inter-component communication.
2653 • Fix crash on multiline aliases.
2655 • Load/Save settings in wxwidgets gui.
2659 • Patch problems in bsnes core
2661 • SNES is little-endian, not big-endian!
2663 • Fix memory corruption in lcscreen::load()
2667 • Fix interpretting repeat counts in rrdata loading.
2669 • New lua callback: on_frame()
2671 • Remove calls to runtosave() that aren't supposed to be there
2673 • Lua function: movie.read_rtc()
2675 • Ignore src/fonts/font.cpp
2677 • Fix more bsnes core problems
2679 • Control bsnes random seeding
2683 • Some bsnes core debugging features (state dump and state hash)
2685 • Fix titlebar version number (no, the last version wasn't
2686 'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2690 • Fix memory corruption due to macro/field mixup
2692 • search-memory update
2694 • Allow direct-mapped framebuffer
2696 • SDL: Use SDL_ANYFORMAT if possible
2698 • SDMP2SOX: 2s delay modes.
2700 • Wxwidgets: Cleanups
2702 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2704 • Wxwidgets: Save jukebox on exit
2706 • Fix RTC if using load-movie on savestate.
2708 • Fix crash related to full console mode.
2712 • Wxwidgets: Allow bringing application to foreground on Mac OS
2715 • Wxwidgets: Allow compiling on Mac OS X.
2717 • Use movie compare instead of movie hashing (faster save/load).
2719 • Lua: _SYSTEM table.
2723 • sdmp2sox: Pad soundtrack if using -l or -L.
2725 • sdmp2sox: Fix NTSC overscan.
2727 • sdmp2sox: Add AR correction mode.
2729 • call lua_close() when exiting.
2731 • Fix zip_writer bug causing warnings from info-zip and error
2736 • Fix IPS patching code (use bsnes core IPS patcher).
2738 • Implement BPS patching (using bsnes core IPS patcher).
2740 • Add feature to load headered ROMs.
2744 • Show command names when showing keybindings
2748 • Fix pause-on-end to be actually controllable
2750 • SDL: Poll all events in queue, not just first one (fixes
2751 slowness in command typing)
2753 • Wxwidgets: Fix ROM loading.
2757 • Lua: Add gui.textH, gui.textV, gui.textHV
2759 • Fix text colors on SDL on Mac OS X
2761 • Mode 'F' for finished in readonly mode.
2763 • Fix some WS errors.
2765 • Reliably pause after skip poll
2767 • Split UI and core into their own threads
2771 • Remove leftover dummy SRAM slot
2773 • Fix controller numbers.
2777 • Fix lsnes-dumpavi after interface change.
2779 • Also give BSNES patches for v085.
2781 • Pack movie data in memory.
2785 • Fix framecount/length given when loading movies.
2787 • Controller command memory leak fixes.
2789 • Don't leak palette if freeing screen object.
2795 • Wxwidgets: Allow controlling dumper from the menu.
2799 • Rewrite parts of manual
2801 • Lua: Make it work with Lua 5.2.
2805 • Win32: Fix compile errors.
2809 • Refactor controller input code.
2811 • Fix crash when using command line on SDL / Mac OS X.
2815 • Delete core/coroutine (obsolete)
2817 • Lag input display by one frame.
2819 • Rewind movie to beginning function.
2821 • Fix wrong frame number reported to Lua when repainting after
2824 • Support UI editing of jukebox
2826 • Wxwidgets: Save settings on exit.
2828 • Support ${project} for filenames
2830 • SDL: Fix command history
2834 • Fix some order-of-global-ctor bugs.
2838 • Fix crashes when quitting on Win32.
2842 • EVDEV: Queue keypresses from joystick, don't send directly
2844 • Wxwidgets: Load-Preserve that actually works.
2848 • Wxwidgets: GUI for memory search.
2850 • Warn about using synchronous queue in UI callback.
2854 • Remember last saved file for each ROM
2856 • Support MT dumping via boost.
2860 • Lua: input.keyhook
2862 • Make mouse be ordinary input instead of special-casing
2864 • SDL: Don't screw up commands with NUL codepoints.
2868 • Merge status panel and main window
2870 • True movie slot support (the rest of it)
2872 • SDL: Fix compilation error
2874 • Elminate cross calls in dump menu code.
2878 • Cancel pending saves command
2880 • Wxwidgets: Code refactoring
2882 • Wxwidgets: Fix system -> reset
2884 • Wxwidgets: Read watch expressions in the right thread
2888 • Wxwidgets: Don't prompt for member when running Lua script (Lua
2889 doesn't support that).
2891 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are
2894 • Don't append trailing '-' to prefix when saving movie.
2896 • Fix ROM/savestate handling (don't let user mismatch ROM and
2901 • Document memory watch syntax.
2905 • Fix unattended dumping (lsnes-dumpavi)
2907 • Support RAW dumping
2909 • Use adv_dumper instead of the old interface in lsnes-dumpavi
2912 • Add option to control sample rate preturbation in AVI dumper
2916 • Wxwidgets: Fix dumper submodes
2918 • Set core controller types before loadstate
2920 15.49 rr1-delta2epsilon1
2922 • Fix compiling with bsnes v086.
2926 • Don't prompt before quitting
2928 • Start unpaused, preserve pause/unpause over load.
2930 • Try to autodetect if ROM is headered.
2932 • Wxwidgets: Only bring up ROM patching screen if specifically
2935 • Allow configuring some hotkeys.
2939 • Lots of code cleanups
2941 • Fix JMD compression (JMD dumping was broken)
2943 • Don't crash if Lua C function throws an exception.
2945 • Support bitmap drawing in Lua.
2947 • Fix bsnes v085/v086 patches.
2949 • Improve stability on win32.
2951 15.52 rr1-delta4epsilon1
2953 • Don't corrupt movie if movie length is integer multiple of
2958 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2960 • New Lua functions: emulator_ready(), utime(),
2961 set_idle_timeout(), set_timer_timeout(), bit.extract(),
2962 bit.value(), input.geta(), input.seta() and
2963 input.controllertype()
2965 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2967 • Wxwidgets: Fix broken modifiers
2969 • on_paint has parameter now.
2971 • Optional initital fill for bitmaps
2973 • Fix palette changing.
2975 • Optimize rendering a bit.
2977 • Bsnes v087 support.
2979 15.54 rr1-delta5epsilon1
2981 • Movieinfo: Fix display of port #2 type.
2983 • Call on_input() after loadstate.
2985 15.55 rr1-delta5epsilon2
2987 • Fix writing port2 data to movie.
2989 • Fix SRAM handling with Bsnes v087.
2993 • Library loading support
2995 • Built-in TSCC encoder
2997 • Hi-color (256T colors) dumping.
2999 • Dump over TCP/IP(v6)
3001 • Hidable status panel
3005 • Adjustable sound volume
3009 • Allow DnD into filename boxes
3011 • Configurable paths
3013 • Portaudio: Fix speaker popping at start
3015 • Lots of UI changes
3017 • Speed adjustment menu
3019 • Win32 joystick support
3021 • Lua: gui.rainbow and gui.box
3023 • Split key lists into classes (the key list was large!)
3025 • More save slots support
3027 • Wxwidgets (wxJoystick) joystick support
3031 • Lots of internal joystick refactoring
3033 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3035 • Wxwidgets: Settings mode (open settings without ROM)
3037 • Wxwidgets: Prompt key to use option
3039 • Wxwidgets: Fix crash if key goes away underneath
3041 • Wxwidgets: Fix mouse position in presence of scaling
3043 • AVI dumper: Mode 4 (high-quality resampling to common rate
3046 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree
3047 control doesn't seem to work well on WinXP)
3049 • Start paused option.