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 • JOYSTICK=<implementation>
149 – Set joystick implementation. Valid values are:
151 ∗ SDL: Use SDL for joystick (requires SDL graphics)
153 ∗ EVDEV: Use EVDEV for joystick (Linux only).
155 ∗ WIN32MM: Use Win32mm for joystick (Windows only).
157 ∗ WXWIDGETS: Use Wxwidgets for joystick (requires WXWIDGETS
160 ∗ DUMMY: Disable joystick support.
164 • SOUND=<implementation>
166 – Set sound implementation. Valid values are:
168 ∗ SDL: Use SDL for sound (requires SDL graphics)
170 ∗ PORTAUDIO: Use Portaudio for sound.
172 ∗ DUMMY: Disable sound support
176 • GRAPHICS=<implementation>
178 – Set windowing library to use. Valid values are:
180 ∗ SDL: Use SDL for graphics
182 ∗ WXWIDGETS: Use wxWidgets for graphics.
186 4 Command line options
190 <kind> in the following can be one of:
192 • rom: Cartridge ROM (BIOS for special carts). This is required.
194 • bsx: BS-X (non-slotted) Game flash ROM.
196 • bsxslotted: BS-X (slotted) Game flash ROM.
200 • slot-a: Sufami Turbo Slot A ROM
202 • slot-b: Sufami Turbo Slot B ROM
204 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
206 Load <file> as specified ROM (SFC/BS/DMG/ST file format).
208 4.1.2 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
210 Override hardware detection for ROM, reading the values from
211 <file> (BSNES XML format).
213 4.1.3 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
215 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple
216 times, the patches are applied in order.
218 4.1.4 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
220 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified
221 multiple times, the patches are applied in order.
223 4.1.5 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
225 Set offset to apply to IPS patches. May be negative. Handy for
226 applying headered IPS patches (use offset of -512 for this). The
227 offset must be 0 for BPS patches.
231 Force ROM to be considered PAL-only.
233 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
235 • Attempting to load NTSC movie file will error out.
239 Force ROM to be considered NTSC-only.
241 • Attempting to load PAL movie file will error out.
245 4.2.1 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
247 Load <filename> as movie or savestate file. All other session
250 4.2.2 --port1=<device> (lsnes/SDL)
252 Set type of port1. Valid values are:
254 • none: No device connected
256 • gamepad: One gamepad (the default)
258 • multitap: Four gamepads (warning: makes most games refuse to
263 4.2.3 --port2=<type> (lsnes/SDL)
265 Set type of port2. Valid values are:
267 • none: No device connected (the default)
269 • gamepad: One gamepad
271 • multitap: Four gamepads.
275 • superscope: Super Scope
277 • justifier: One justifier
279 • justifiers: Two justifiers
281 4.2.4 --gamename=<name> (lsnes/SDL)
283 Set the name of game to <name>. Default is blank.
285 4.2.5 --author=<name> (lsnes/SDL)
287 Add author with full name of <name> (no nickname).
289 4.2.6 --author=|<name> (lsnes/SDL)
291 Add author with nickname of <name> (no full name).
293 4.2.7 --author=<fullname>|<nickname> (lsnes/SDL)
295 Add author with full name of <fullname> and nickname of
298 4.2.8 --rtc-second=<value> (lsnes/SDL)
300 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
303 4.2.9 --rtc-subsecond=<value> (lsnes/SDL)
305 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
309 4.3.1 --run=<file> (lsnes/SDL)
311 After running main RC file, run this file. If multiple are
312 specified, these execute in order specified.
314 4.4 dump options (lsnes-dumpavi only)
316 4.4.1 --dumper=<dumper>
318 Set the dumper to use (required). Use 'list' for listing of known
323 Set the mode to use (required for dumpers with multiple modes,
324 forbidden otherwise). Use 'list' for known modes.
326 4.4.3 --prefix=<prefix>
328 Set dump prefix. Default is “avidump”.
330 4.4.4 --option=<name>=<value>
332 Set option <name> to value <value>.
334 4.4.5 --length=<length>
336 Set number of frames to dump. Mandatory.
340 Run specified lua script (lsnes-dumpavi does not have
341 initialization files).
343 4.4.7 --load-library=<library>
345 Load the specified shared object / dynamic library / dynamic link
348 5 Startup file lsnes.rc
350 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
351 commands. This file is located in:
353 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
355 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME
358 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
360 • All: ./lsnes.rc (fallback default).
362 If leading directories do not exist, attempt to create them is
367 • Commands beginning with '*' invoke the corresponding command
368 without alias expansion.
370 • If command starts with '+' (after possible '*'), the command is
371 executed as-is when button is pressed, and when button is
372 released, it is executed with '+' replaced by '-'.
374 • Commands without '+' execute only on negative edge (release).
378 Settings control various aspects of emulator behaviour.
380 6.1.1 set-setting <setting> <value>
382 Sets setting <setting> to value <value> (may be empty).
384 6.1.2 unset-setting <setting>
386 Try to unset setting <setting> (not all settings can be unset).
388 6.1.3 get-setting <setting>
390 Read value of setting <setting>
394 Print names and values of all settings.
398 Keybindings bind commands or aliases to keys (or pseudo-keys).
402 • Do not bind edge active (+/-) commands to keys with modifiers,
403 that won't work right!
405 • Names of keys and modifiers are platform-dependent.
407 • Be careful before binding pseudo-keys (such as joystick axes,
408 buttons or hats) with modifiers. That may or may not work
411 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
413 Bind <command> to key <key> (activating if modifiers in <modmask>
414 (comma-seperated list) are set as <mod> (comma-seperated list).
416 The names of keys and modifiers are platform-dependent.
418 6.2.2 unbind-key [<mod>/<modmask>] <key>
420 Unbind command from <key> (with specified <mod> and <modmask>).
422 6.2.3 set-axis <axis> [disabled | axis | axis-inverse |
423 pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0
424 | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>]
427 Set axis parameters for axis <axis>.
429 • disabled: Disable axis
433 • axis-inverse: Inverse axis
435 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
437 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
439 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
441 • pressure-+: Pressure sensitive. Released at -, pressed at +.
443 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
445 • pressure+-: Pressure sensitive. Released at +, pressed at -.
447 • minus=<val>: Calibration at extreme minus position
450 • zero=<val>: Calibration at neutral position (-32768-32767)
452 • plus=<val>: Calibration at extreme plus position (-32768-32767)
454 • tolerance=<value>: Center band tolerance (0<x<1). The smaller
455 the value, the more sensitive the control is.
459 Print all key bindings in effect.
463 Aliases bind command to sequence of commands. After alias has
464 been defined, it replaces the command it shadows.
468 • You can't alias command to itself.
470 • Aliases starting with +/- are edge active just like ordinary
471 commands starting with +/-.
473 • One command can be aliased to multiple commands.
475 6.3.1 alias-command <command> <expansion>
477 Append <expansion> to alias <command>. If alias does not already
478 exist, it is created.
480 6.3.2 unalias-command <command>
482 Clear alias expansion for <command>.
486 Print all aliases and their expansions in effect.
488 6.4 run-script <script>
490 Run <script> as if commands were entered on the command line.
494 Following commands control video dumping:
496 6.5.1 start-dump <dumper> [<mode>] <prefix/filename>
498 Start dumping using dumper <dumper>. If mode is present or not
499 and if prefix or filename is present depends on the dumper and
502 The following dumpers are available:
504 • INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
506 – Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes
509 – Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
511 • INTERNAL-JMD: Internal .jmd dumper.
513 – Does not take mode.
517 • INTERNAL-RAW: Internal RAW dumper.
519 – Does not take mode.
523 – Sound is big-endian signed 16-bit, usually at 32040.5Hz.
525 – Video is always upscaled to double resolution (512x448 / 512
528 – Video framerate is usually 322445/6448 fps for PAL and
529 10738636/178683 fps for NTSC.
531 • INTERNAL-SDMP: Internal SDMP dumper.
533 – Mode 'ms': Multi-segment. Takes prefix.
535 – Mode 'ss': Single-segment. Takes filename.
537 6.5.2 end-dump <dumper>
539 End dumping using <dumper>
541 6.5.3 show-dumpers [<dumper>]
543 Show the list of dumpers or list of modes for <dumper>
545 6.6 Memory manipulation
547 <address> may be decimal or hexadecimal (prefixed with '0x').
548 <value> can be hexadecimal (prefixed with '0x'), unsigned or
549 signed (prefixed with '-') decimal.
551 The available element <sizes> are:
561 When reading RAM and ROM, multi-byte reads/writes are big-endian.
562 When dealing with DSP memory, multi-byte reads/writes are
563 native-endian (do not use operand sizes exceeding DSP bitness,
564 except dword is OK for 24-bit memory).
566 6.6.1 read-<size> <address>
568 Read the value of byte in <address>.
570 6.6.2 read-s<size> <address>
572 Read the value of signed byte in <address>.
574 6.6.3 write-<size> <address> <value>
576 Write <value> to byte in address <address>.
578 6.6.4 search-memory reset
580 Reset the memory search
582 6.6.5 search-memory count
584 Print number of candidates remaining
586 6.6.6 search-memory print
588 Print all candidates remaining
590 6.6.7 search-memory <usflag><sizeflag><op>
592 Searches memory for addresses satisfying criteria.
612 • lt: < previous value.
614 • le: <= previous value.
616 • eq: = previous value.
618 • ne: != previous value.
620 • ge: >= previous value.
622 • gt: > previous value.
624 6.6.8 search-memory <sizeflag> <value>
626 Searches for addresses that currently have value <value>.
627 <sizeflag> is as in previous command.
631 These commands are not available in lsnesrc, but are available
632 after ROM has been loaded.
634 6.7.1 quit-emulator [/y]
636 Quits the emulator (asking for confirmation). If /y is given, no
637 confirmation is asked.
641 Toggle paused/unpaused
645 Advance frame. If the button is still held after configurable
646 timeout expires, game unpauses for the duration frame advance is
651 Advance subframe. If the button is still held after configurable
652 timeout expires, game unpauses for the duration frame advance is
655 6.7.5 advance-skiplag
657 Skip to first poll in frame after current.
661 Reset the SNES after this frame.
663 6.7.7 load <filename>
665 Load savestate <filename> in current mode.
667 6.7.8 load-state <filename>
669 Load savestate <filename> in readwrite mode.
671 6.7.9 load-readonly <filename>
673 Load savestate <filename> in readonly mode.
675 6.7.10 load-preserve <filename>
677 Load savestate <filename> in readonly mode, preserving current
680 6.7.11 load-movie <filename>
682 Load savestate <filename>, ignoring save part in readonly mode.
684 6.7.12 save-state <filename>
686 Save system state to <filename> as soon as possible.
688 6.7.13 save-movie <filename>
690 Save movie to <filename>.
702 Toggle between read-only and read-write modes.
704 6.7.17 set-gamename <name>
706 Set name of the game to <name>
710 Print the name of the game.
712 6.7.19 add-author <author>
714 Adds new author <author>. If <author> does not contain '|' it is
715 full name. If it contains '|', '|' splits the full name and
718 6.7.20 edit-author <num> <author>
720 Edit the author in slot <num> (0-based) to be <author> (see
721 add-author for format)
723 6.7.21 remove-author <num>
725 Remove author in slot <num>
731 6.7.23 test-1, test-2, test-3
733 Internal test commands. Don't use.
735 6.7.24 take-screenshot <filename>
737 Save screenshot to <filename>.
739 6.7.25 +controller<num><button>
741 Press button <button> on controller <num> (1-8). The following
742 button names are known:
776 6.7.26 controllerh<num><button>
778 Hold/unhold button <button> on controller <num> (1-8). See
779 +controller for button names.
781 6.7.27 autofire (<pattern>|-)...
783 Set autofire pattern. Each parameter is comma-separated list of
784 button names (in form of 1start, 1A, 2B, etc..) to hold on that
785 frame. After reaching the end of pattern, the pattern restarts
794 6.8.1 cycle-jukebox-backward
796 Cycle save jukebox backwards.
798 6.8.2 cycle-jukebox-forward
800 Cycle save jukebox forwards
804 Do load from jukebox (current mode).
808 Do state save to jukebox.
812 Only available if lua support is compiled in.
814 6.9.1 evaluate-lua <luacode>
816 Run Lua code <luacode> using built-in Lua interpretter.
818 6.9.2 run-lua <script>
820 Run specified lua file using built-in Lua interpretter.
824 6.10.1 add-watch <name> <expression>
826 Adds new watch (or modifies old one).
828 6.10.2 remove-watch <name>
834 6.11.1 enable-sound <on/off>
836 Enable/Disable sound.
838 6.11.2 set-sound-device <device>
840 Set sound device to <device>
842 6.11.3 show-sound-status
844 Show status of sound system.
846 6.11.4 show-sound-devices
848 Show all available devices.
850 6.11.5 set-volume <multiplier>
852 Set the volume multiplier to <multiplier>. 1 is normal volume,
853 and higher numbers are louder.
855 6.11.6 set-volume <multiplier>%
857 Set the volume multiplier to <multiplier> percent. 100 is normal
858 volume, and higher numbers are louder.
860 6.11.7 set-volume <multiplier>dB
862 Set the volume multiplier to <multiplier> dB. 0 is normal volume,
863 and higher numbers are louder. The value may be negative.
865 6.12 SDL Platform commands
867 The following are valid on SDL platform.
871 Asks to press a key and then identifies that (pseudo-)key.
873 6.12.2 toggle-console
875 Toggle between windowed/fullscreen console.
879 Scroll messages window as far back as it goes.
881 6.12.4 scroll-fulldown
883 Scroll messages window as far forward as it goes.
887 Scroll messages window back one screenful.
891 Scroll messages window forward one screenful.
899 Set where bsnes looks for firmware files. Default is “.”.
903 Set the target fps. Numeric, range is 0.001 to “infinite”.
904 Default is native framerate.
906 7.1.3 savecompression
908 Set save compression level (integer 0-9). Default is 7 (0 is no
911 7.1.4 advance-timeout
913 Set the frame advance timeout in milliseconds. Numeric integer,
914 range is 0-999999999. Default is 500.
916 7.2 AVI dumper settings
920 AVI dumper: Always dump at 512x448 or 512x478 regardless of what
923 7.2.2 avi-left-border
925 AVI dumper: Set the default left border thickness (unless lua
926 overrides) for dumps. Range 0-8191. Default is 0.
928 7.2.3 avi-right-border
930 AVI dumper: Set the default right border thickness (unless lua
931 overrides) for dumps. Range 0-8191. Default is 0.
935 AVI dumper: Set the default top border thickness (unless lua
936 overrides) for dumps. Range 0-8191. Default is 0.
938 7.2.5 avi-bottom-border
940 AVI dumper: Set the default bottom border thickness (unless lua
941 overrides) for dumps. Range 0-8191. Default is 0.
945 AVI dumper: Maximum number of frames per dump segment (0 =>
946 unlimited). Range 0-999999999. Default is 0.
948 7.2.7 avi-compresison
950 AVI dumper: Compression level (0-18).
952 • Compression levels 10 and above are not compatible with stock
955 • Recomended level is 7.
959 AVI dumper: Set method of determining the sound rate.
961 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48,
962 64, 88.2, 96, 128, 176.4 and 192 kHz.
964 • 1: Round down to nearest integer.
966 • 2: Round up to nearest ingeter.
972 JMD dumper: Compression level (0-9).
974 7.4 SDL platform settings
976 7.4.1 autorepeat-first-delay
978 Sets the delay for first character in typematic autorepeat.
980 7.4.2 autorepeat-subsequent-delay
982 Sets the delay for subsequent characters in typematic autorepeat.
986 8.1 Core (in main table)
990 Print line to message console.
992 8.1.2 exec(string command)
994 Run command as it was entered on the command line
998 Returns two values. First is time since some epoch in seconds,
999 the second is microseconds mod 10^6 since that epoch.
1001 8.1.4 emulator_ready()
1003 Returns true if emulator has finished booting, false if not
1004 (on_startup() will be issued later).
1006 8.1.5 set_idle_timeout(number timeout)
1008 Set number of microseconds to block idle for. After this timeout
1009 has expired, on_idle() will be called once.
1011 8.1.6 set_timer_timeout(number timeout)
1013 Set number of microseconds to block timer for. After this timeout
1014 has expired, on_timer() will be called once.
1018 Bitwise logical functions and related.
1020 8.2.1 bit.none(number...) / bit.bnot(number...)
1022 48-bit bitwise NOT / NONE function (set bits that are set in none
1025 8.2.2 bit.any(number...) / bit.bor(number...)
1027 48-bit bitwise OR / ANY function (set bits that are set in any of
1030 8.2.3 bit.all(number...) / bit.band(number...)
1032 48-bit bitwise AND / ALL function (set bits that are set in all
1035 8.2.4 bit.parity(number...) / bit.bxor(number...)
1037 48-bit bitwise XOR / PARITY function (set bits that are set in
1038 odd number of the arguments).
1040 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
1042 Rotate bits-bit (max 48, default 48) number left by amount
1045 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
1047 Rotate bits-bit (max 48, default 48) number right by amount
1050 8.2.7 bit.lshift(number base[, number amount[, number bits]])
1052 Shift bits-bit (max 48, default 48) number left by amount
1053 (default 1) places. The new bits are filled with zeroes.
1055 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1057 Shift bits-bit (max 48, default 48) number logically right by
1058 amount (default 1) places. The new bits are filled with zeroes.
1060 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1062 Shift bits-bit (max 48, default 48) number arithmetically right
1063 by amount (default 1) places. The new bits are shifted in with
1064 copy of the high bit.
1066 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
1068 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1
1073 • Bit numbers up to 51 should work reliably (then things start
1074 falling apart due to double precision issues).
1076 • There are two special bit positions, true and false, standing
1077 for always set bit and always clear bit.
1079 8.2.11 bit.value([number bit1[, number bit2,...]])
1081 Returns bitwise OR of 1 left shifted by bit1 places, 1 left
1082 shifted by bit2 places and so on. As special value, nil argument
1087 Most of these functions can only be called in on_paint and
1088 on_video callbacks. Exceptions are noted.
1090 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are
1091 the green component, bits 16-23 are the red component, bits 24-31
1092 are alpha component (0 is fully opaque, 255 is almost
1093 transparent). -1 is the fully transparent color. Alpha values
1094 greater than 127 do work.
1096 Origin of coordinates is at top left corner of game display area.
1097 Left and top gaps correspond to negative coordinates.
1099 8.3.1 gui.resolution()
1101 Returns 2-tuple (hresolution, vresolution).
1103 8.3.2 gui.<class>_gap(number gap)
1105 Set the <class> (left, right, top, bottom) gap to specified value
1108 8.3.3 gui.text(number x, number y, string text[, number fgc[,
1111 Draw specified text on the GUI (each character cell is 8 or 16
1112 wide and 16 high). Parameters:
1114 • x: X-coordinate to start the drawing from (and x-coordinate at
1115 begining of the lines).
1117 • y: Y-coordinate to start the drawing from.
1119 • text: The text to draw.
1121 • fgc: Text color (default is 0xFFFFFF (white))
1123 • bgc: Background color (default is -1 (transparent))
1125 8.3.4 gui.textH(number x, number y, string text[, number fgc[,
1128 Like gui.text, but draw using double-width.
1130 8.3.5 gui.textV(number x, number y, string text[, number fgc[,
1133 Like gui.text, but draw using double-height.
1135 8.3.6 gui.textHV(number x, number y, string text[, number fgc[,
1138 Like gui.text, but draw using double-width/double-height.
1140 8.3.7 gui.rectangle(number x, number y, number width, number
1141 height[, number thickness[, number outline[, number fill]]])
1143 Draw rectangle on the GUI. Parameters:
1145 • x: X-coordinate of left edge.
1147 • y: Y-coordinate of upper edge.
1149 • width: Width of rectangle.
1151 • height: Height of rectangle.
1153 • thickness: Thickness of outline (default is 1).
1155 • outline: Color of outline (default is 0xFFFFFF (white))
1157 • fill: Color of fill (default is -1 (transparent))
1159 8.3.8 gui.box(number x, number y, number width, number height[,
1160 number thickness[, number outline1[,number outline2[, number
1163 Draw rectangle with 3D effect on the GUI. Parameters:
1165 • x: X-coordinate of left edge.
1167 • y: Y-coordinate of upper edge.
1169 • width: Width of rectangle.
1171 • height: Height of rectangle.
1173 • thickness: Thickness of outline (default is 1).
1175 • outline1: First color of outline (default is 0xFFFFFF (white))
1177 • outline2: First color of outline (default is 0x808080 (dark
1180 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1182 8.3.9 gui.pixel(number x, number y[, number color])
1184 Draw one pixel on the GUI. Parameters:
1186 • x: X-coordinate of the pixel
1188 • y: Y-coordinate of the pixel
1190 • color: Color of the pixel (default is 0xFFFFFF (white))
1192 8.3.10 gui.crosshair(number x, number y[, number length[, number
1195 Draw a crosshair. Parameters:
1197 • x: X-coordinate of the crosshair
1199 • y: Y-coordinate of the crosshair
1201 • length: Length of the crosshair lines (default 10).
1203 • color: Color of the crosshair (default is 0xFFFFFF (white))
1205 8.3.11 gui.line(number x1, number y1, number x2, number y2[,
1208 Draw a thin line. Parameters:
1210 • x1: X-coordinate of one end.
1212 • y1: Y-coordinate of one end.
1214 • x2: X-coordinate of the other end.
1216 • y2: Y-coordinate of the other end.
1218 • color: Color of the line (default is 0xFFFFFF (white)).
1220 8.3.12 gui.circle(number x, number y, number r[, number thick[,
1221 number border[, number fil]]])
1223 Draw a circle. Parameters.
1225 • x: X-coordinate of the center
1227 • y: Y-coordinate of the center
1229 • r: The radius of the circle
1231 • thick: Border thickness
1233 • border: Border color (default is 0xFFFFFF (white))
1235 • fill: Fill color (default is -1 (transparent)).
1237 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
1240 Draw a bitmap on screen with specified palette. Parameters:
1242 • x: X-coordinate of left edge.
1244 • y: Y-coordinate of top edge.
1246 • bitmap: The bitmap to draw
1248 • palette: The palette to draw the bitmap using.
1250 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1252 Draw a bitmap on screen. Parameters:
1254 • x: X-coordinate of left edge.
1256 • y: Y-coordinate of top edge.
1258 • bitmap: The bitmap to draw
1260 8.3.15 gui.palette_new()
1262 Returns a new palette (initially all transparent). Can be used
1265 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool
1268 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1270 • w: The width of new bitmap
1272 • h: The height of new bitmap
1274 • direct: If true, the returned bitmap is dbitmap, otherwise
1277 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
1280 8.3.17 gui.bitmap_load(string file)
1282 Returns loaded bitmap/dbitmap (if bitmap, the second return value
1283 is palette for bitmap). Can be used anywhere. Parameters:
1285 • file: The name of file to load.
1287 8.3.18 gui.palette_set(palette palette, number index, number
1290 Sets color in palette. Can be used anywhere. Parameters:
1292 • palette: The palette to manipulate
1294 • index: Index of color (0-65535).
1296 • color: The color value.
1298 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
1301 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1303 • bitmap: The bitmap to manipulate
1305 • x: The x-coordinate of the pixel.
1307 • y: The y-coordinate of the pixel.
1309 • color: If bitmap is a bitmap, color index (0-65535). Otherwise
1312 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1314 Get size of bitmap. Can be used anywhere. Parameters:
1316 • bitmap: The bitmap to query.
1318 The first return is the width, the second is the height.
1320 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
1321 bitmap/dbitmap src, number sx, number sy, number w, number h[,
1324 Blit a part of bitmap to another. Can be used anywhere.
1327 • dest: Destination to blit to.
1329 • dx: left edge of target
1331 • dy: Top edge of target
1333 • src: The source to blit from. Must be of the same type as
1336 • sx: left edge of source
1338 • sy: Top edge of source
1340 • w: Width of region
1342 • h: Height of region.
1344 • ck: Color key. Pixels of this color are not blitted.
1346 – If bitmaps are bitmaps, this is color index of colorkey.
1347 Values outside range 0-65535 cause no key to be used as
1350 – If bitmaps are dbitmaps, this color value of colorkey.
1352 – May be absent or nil for no colorkey blit.
1354 8.3.22 gui.repaint()
1356 Request on_repaint() to happen as soon as possible. Can be used
1359 8.3.23 gui.subframe_update(boolean on)
1361 Request subframe updates (calling on_paint() on subframes) to
1362 happen (on=true) or not happen (on=false). Can be used anywhere.
1364 8.3.24 gui.screenshot(string filename)
1366 Write PNG screenshot of the current frame (no drawings) to
1367 specified file. Can be used anywhere.
1369 8.3.25 gui.color(number r, number g, number b[, number a])
1371 Returns color (in notation Lua scripts use) corresponding to
1372 color (r,g,b), each component in scale 0-255. If a is specified,
1373 that is alpha (0 is fully transparent, 256(sic) is fully opaque).
1374 The default alpha is 256.
1376 8.3.26 gui.status(string name, string value)
1378 Set status field “L[<name>]” to <value> in status area. Can be
1381 8.3.27 gui.rainbow(number step, number steps[, number color])
1383 Perform hue rotation of color <color> (default bright red), by
1384 <step> steps. The number of steps per full rotation is given by
1385 absolute value of <steps>.
1387 If <steps> is negative, the rotation will be counterclockwise.
1391 Input handling. Only available in on_input callback.
1393 8.4.1 input.get(number controller, number index)
1395 Read the specified index (0-11) from specified controller (0-7).
1398 • Uses physical controller numbering. Gamepad in port 2 is
1399 controller 4, not 1!
1401 8.4.2 input.set(number controller, number index, number value)
1403 Write the specified index (0-11) from specified controller (0-7),
1404 storing value. Notes:
1406 • Uses physical controller numbering. Gamepad in port 2 is
1407 controller 4, not 1!
1409 8.4.3 input.geta(number controller)
1411 Get input state for entiere controller. Returns 13 return values.
1413 • 1st return value: Bitmask: bit i is set if i:th index is
1416 • 2nd-13th return value: value of i:th index.
1418 8.4.4 input.seta(number controller, number bitmask, number
1421 Set state for entiere controller. args is up to 12 values for
1422 indices (overriding values in bitmask if specified).
1424 8.4.5 input.controllertype(number controller)
1426 Get the type of controller as string. Valid values are:
1436 8.4.6 input.reset([number cycles])
1438 Execute reset. If cycles is greater than zero, do delayed reset.
1439 0 (or no value) causes immediate reset.
1441 • Only available with subframe flag false.
1445 Returns table of tables of all available keys and axes. The first
1446 table is indexed by key name (platform-dependent!), and the inner
1447 table has the following fields:
1449 • last_rawval: Last reported raw value for control.
1451 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse,
1452 hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p,
1453 pressure-pm, pressure-p0).
1455 • cal_left: Minimum calibration value. Only meaningful with axis
1458 • cal_center: Center calibration value. Only meaningful with axis
1461 • cal_right: Maximum calibration value. Only meaningful with axis
1464 • cal_tolerance: Dead zone tolerance. Only meaningful with axis
1467 8.4.8 input.keyhook(key, state)
1469 Requests that keyhook events to be sent for key (state=true) or
1470 not sent (state=false).
1472 8.5 Table hostmemory
1474 Host memory handling (extra memory saved to savestates). Host
1475 memory starts empty.
1477 8.5.1 hostmemory.read(number address)
1479 Reads hostmemory slot address. Slot numbers out of range return
1480 false instead of numeric.
1482 8.5.2 hostmemory.write(number address, number value)
1484 Writes hostmemory slot with 0-255. Slot numbers out of range
1485 cause extension of host memory slot space.
1487 8.5.3 hostmemory.readbyte(number address)
1489 Read unsigned byte (1 element) from given address. Slots out of
1492 8.5.4 hostmemory.writebyte(number address, number value)
1494 Write unsigned byte (1 element) to given slot. Slot numbers out
1495 of range cause extension.
1497 8.5.5 hostmemory.readsbyte(number address)
1499 Read signed byte (1 element) from given address. Slots out of
1502 8.5.6 hostmemory.writesbyte(number address, number value)
1504 Write signed byte (1 element) to given slot. Slot numbers out of
1505 range cause extension.
1507 8.5.7 hostmemory.readword(number address)
1509 Read unsigned word (2 elements) from given address. Slots out of
1512 8.5.8 hostmemory.writeword(number address, number value)
1514 Write unsigned word (2 elements) to given slot. Slot numbers out
1515 of range cause extension.
1517 8.5.9 hostmemory.readsword(number address)
1519 Read signed word (2 elements) from given address. Slots out of
1522 8.5.10 hostmemory.writesword(number address, number value)
1524 Write signed word (2 elements) to given slot. Slot numbers out of
1525 range cause extension.
1527 8.5.11 hostmemory.readdword(number address)
1529 Read unsigned doubleword (4 elements) from given address. Slots
1530 out of range return false.
1532 8.5.12 hostmemory.writedword(number address, number value)
1534 Write unsigned doubleword (4 elements) to given slot. Slot
1535 numbers out of range cause extension.
1537 8.5.13 hostmemory.readsdword(number address)
1539 Read signed doubleword (4 elements) from given address. Slots out
1540 of range return false.
1542 8.5.14 hostmemory.writesdword(number address, number value)
1544 Write signed doubleword (4 elements) to given slot. Slot numbers
1545 out of range cause extension.
1547 8.5.15 hostmemory.readqword(number address)
1549 Read unsigned quadword (8 elements) from given address. Slots out
1550 of range return false.
1552 8.5.16 hostmemory.writeqword(number address, number value)
1554 Write unsigned quadword (4 elements) to given slot. Slot numbers
1555 out of range cause extension.
1557 8.5.17 hostmemory.readsqword(number address)
1559 Read signed quadword (8 elements) from given address. Slots out
1560 of range return false.
1562 8.5.18 hostmemory.writesqword(number address, number value)
1564 Write signed quadword (8 elements) to given slot. Slot numbers
1565 out of range cause extension.
1571 8.6.1 movie.currentframe()
1573 Return number of current frame.
1575 8.6.2 movie.framecount()
1577 Return number of frames in movie.
1579 8.6.3 movie.readonly()
1581 Return true if in readonly mode, false if in readwrite.
1583 8.6.4 movie.set_readwrite()
1585 Set readwrite mode (does not cause on_readwrite callback).
1587 8.6.5 movie.frame_subframes(number frame)
1589 Count number of subframes in specified frame (frame numbers are
1590 1-based) and return that.
1592 8.6.6 movie.read_subframe(number frame, number subframe)
1594 Read specifed subframe in specified frame and return data as
1595 array (100 elements, numbered 0-99 currently).
1599 Routines for settings manipulation
1601 8.7.1 settings.get(string name)
1603 Get value of setting. If setting is blank, returns false. If
1604 setting value can't be obtained, returns (nil, error message).
1606 8.7.2 settings.set(string name, string value)
1608 Set value of setting. If setting can't be set, returns (nil,
1611 8.7.3 settings.is_set(string name)
1613 Returns if setting is set. If setting does not exist, returns
1614 (nil, error message).
1616 8.7.4 settings.blank(string name)
1618 Blanks a setting and returns true. If setting can't be blanked,
1619 returns (nil, error message).
1623 Contains various functions for managing memory
1625 8.8.1 memory.vma_count()
1627 Returns the number of VMAs
1629 8.8.2 memory.read_vma(number index)
1631 Reads the specified VMA (indices start from zero). Trying to read
1632 invalid VMA gives nil. The read VMA is table with the following
1635 • region_name (string): The readable name of the VMA
1637 • baseaddr (number): Base address of the VMA
1639 • lastaddr (number): Last address in the VMA.
1641 • size (number): The size of VMA in bytes.
1643 • readonly (boolean): True of the VMA corresponds to ROM.
1645 • native_endian (boolean): True if the VMA has native endian as
1646 opposed to little endian.
1648 8.8.3 memory.find_vma(number address)
1650 Finds the VMA containing specified address. Returns table in the
1651 same format as read_vma or nil if not found.
1653 8.8.4 memory.readbyte(number address)
1655 Reads the specified address as unsigned byte and returns the
1658 8.8.5 memory.readsbyte(number address)
1660 Reads the specified address as signed byte and returns the
1663 8.8.6 memory.writebyte(number address, number value)
1665 Writes the specified value (negative values undergo 2's
1666 complement) to specified address (as a byte).
1668 8.8.7 memory.readword(number address)
1670 Reads the specified address as unsigned word and returns the
1673 8.8.8 memory.readsword(number address)
1675 Reads the specified address as signed word and returns the
1678 8.8.9 memory.writeword(number address, number value)
1680 Writes the specified value (negative values undergo 2's
1681 complement) to specified address (as a word).
1683 8.8.10 memory.readdword(number address)
1685 Reads the specified address as unsigned doubleword and returns
1688 8.8.11 memory.readsdword(number address)
1690 Reads the specified address as signed doubleword and returns the
1693 8.8.12 memory.writedword(number address, number value)
1695 Writes the specified value (negative values undergo 2's
1696 complement) to specified address (as a doubleword).
1698 8.8.13 memory.readqword(number address)
1700 Reads the specified address as unsigned quadword and returns the
1703 8.8.14 memory.readsqword(number address)
1705 Reads the specified address as signed quadword and returns the
1708 8.8.15 memory.writeqword(number address, number value)
1710 Writes the specified value (negative values undergo 2's
1711 complement) to specified address (as a quadword).
1715 Contains copy of global variables from time of Lua
1716 initialization. Non-writeable.
1720 Various callbacks to Lua that can occur.
1722 8.10.1 Callback: on_paint(bool not_synth)
1724 Called when screen is being painted. Any gui.* calls requiring
1725 graphic context draw on the screen.
1727 not_synth is true if this hook is being called in response to
1728 received frame, false otherwise.
1730 8.10.2 Callback: on_video()
1732 Called when video dump frame is being painted. Any gui.* calls
1733 requiring graphic context draw on the video.
1735 8.10.3 Callback: on_frame_emulated()
1737 Called when emulating frame has completed and
1738 on_paint()/on_video() calls are about to be issued.
1740 8.10.4 Callback: on_frame()
1742 Called on each starting whole frame.
1744 8.10.5 Callback: on_startup()
1746 Called when the emulator is starting (lsnes.rc and --run files
1749 8.10.6 Callback: on_rewind()
1751 Called when rewind movie to beginning has completed.
1753 8.10.7 Callback: on_pre_load(string name)
1755 Called just before savestate/movie load occurs (note: loads are
1756 always delayed, so this occurs even when load was initiated by
1759 8.10.8 Callback: on_err_load(string name)
1761 Called if loadstate goes wrong.
1763 8.10.9 Callback: on_post_load(string name, boolean was_savestate)
1765 Called on successful loadstate. was_savestate gives if this was a
1766 savestate or a movie.
1768 8.10.10 Callback: on_pre_save(string name, boolean is_savestate)
1770 Called just before savestate save occurs (note: movie saves are
1771 synchronous and won't trigger these callbacks if called from
1774 8.10.11 Callback: on_err_save(string name)
1776 Called if savestate goes wrong.
1778 8.10.12 Callback: on_post_save(string name, boolean is_savestate)
1780 Called on successful savaestate. is_savestate gives if this was a
1781 savestate or a movie.
1783 8.10.13 Callback: on_quit()
1785 Called when emulator is shutting down.
1787 8.10.14 Callback: on_input(boolean subframe)
1789 Called when emulator is just sending input to bsnes core.
1790 Warning: This is called even in readonly mode, but the results
1793 8.10.15 Callback: on_reset()
1795 Called when SNES is reset.
1797 8.10.16 Callback: on_readwrite()
1799 Called when moving into readwrite mode as result of “set-rwmode”
1800 command (note: moving to rwmode by Lua won't trigger this, as per
1801 recursive entry protection).
1803 8.10.17 Callback: on_snoop(number port, number controller, number
1804 index, number value)
1806 Called each time bsnes asks for input. The value is the final
1807 value to be sent to bsnes core (readonly mode, autohold and
1808 autofire have been taken into account). Might be useful when
1809 translating movies to format suitable for console verification.
1810 Note: There is no way to modify the value to be sent.
1812 8.10.18 Callback: on_keyhook(string keyname, table state)
1814 Sent when key that has keyhook events requested changes state.
1815 Keyname is name of the key (group) and state is the state (same
1816 kind as table values in input.raw).
1818 8.10.19 Callback: on_idle()
1820 Called when requested by set_idle_timeout(), the timeout has
1821 expired and emulator is waiting.
1823 8.10.20 Callback: on_timer()
1825 Called when requested by set_idle_timeout() and the timeout has
1826 expired (regardless if emulator is waiting).
1828 9 Memory watch expression syntax
1830 Memory watch expressions are in RPN (Reverse Polish Notation). At
1831 the end of expression, the top entry on stack is taken as the
1836 • Evaluation order is strictly left to right.
1838 • a is the entry on top of stack
1840 • b is the entry immediately below top of stack
1842 • ; separates values to be pushed (no intermediate pop).
1844 • After end of element, all used stack slots are popped and all
1847 • When pushing multiple values, the pushes occur in order shown.
1849 The following operators are available:
1863 • b : read_signed_byte(a)
1867 • d : read_signed_dword(a)
1869 • i : quotent(a / b)
1874 • q : read_signed_qword(a)
1884 • w : read_signed_word(a)
1888 • B : read_unsigned_byte(a)
1890 • C<number>z : Push number <number> to stack.
1892 • D : read_unsigned_dword(a)
1894 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1896 • Q : read_unsigned_qword(a)
1898 • R<digit> : round a to <digit> digits.
1900 • W : read_unsigned_word(a)
1904 C0x007e0878zWC0x007e002czW-
1906 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1908 2. Pop the value on top of stack (0x7e0878), read word value at
1909 that address and push the result,call it x1 (W).
1911 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1913 4. Pop the value on top of stack (0x7e002c), read word value at
1914 that address and push the result,call it x2 (W).
1916 5. Pop the two top numbers on stack, x1 and x2, substract x1 from
1917 x2 and push x2 - x1 (-).
1919 6. Since the expression ends, the final memory watch result is
1920 the top one on stack, which is x2 - x1.
1922 10 Modifier and key names:
1926 10.1.1 Modifier names
1928 Following modifier names are known:
1930 • ctrl, lctrl, rctrl: Control keys
1932 • alt, lalt, ralt: ALT keys.
1934 • shift, lshift, rshift: Shift keys.
1936 • meta, lmeta, rmeta: Meta keys.
1938 • num, caps: Numlock/Capslock (these are sticky!)
1940 • mode: Mode select.
1944 Following key names are known:
1946 • backspace, tab, clear, return, pause, escape, space, exclaim,
1947 quotedbl, hash, dollar, ampersand, quote, leftparen,
1948 rightparen, asterisk, plus, comma, minus, period, slash, 0, 1,
1949 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals,
1950 greater, question, at, leftbracket, backslash, rightbracket,
1951 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k,
1952 l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0,
1953 world_1, world_2, world_3, world_4, world_5, world_6, world_7,
1954 world_8, world_9, world_10, world_11, world_12, world_13,
1955 world_14, world_15, world_16, world_17, world_18, world_19,
1956 world_20, world_21, world_22, world_23, world_24, world_25,
1957 world_26, world_27, world_28, world_29, world_30, world_31,
1958 world_32, world_33, world_34, world_35, world_36, world_37,
1959 world_38, world_39, world_40, world_41, world_42, world_43,
1960 world_44, world_45, world_46, world_47, world_48, world_49,
1961 world_50, world_51, world_52, world_53, world_54, world_55,
1962 world_56, world_57, world_58, world_59, world_60, world_61,
1963 world_62, world_63, world_64, world_65, world_66, world_67,
1964 world_68, world_69, world_70, world_71, world_72, world_73,
1965 world_74, world_75, world_76, world_77, world_78, world_79,
1966 world_80, world_81, world_82, world_83, world_84, world_85,
1967 world_86, world_87, world_88, world_89, world_90, world_91,
1968 world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3,
1969 kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide,
1970 kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down,
1971 right, left, insert, home, end, pageup, pagedown, f1, f2, f3,
1972 f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock,
1973 capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt,
1974 rmeta, lmeta, lsuper, rsuper, mode, compose, help, print,
1975 sysreq, break, menu, power, euro, undo
1977 • Names of form 'key<n>' where <n> is 0-255 are interpretted as
1978 key having hardware-dependent scan code of <n> (useful to bind
1979 those keys that don't have symbolic names).
1981 10.1.3 Joystick pseudo-keys:
1983 • joystick<num>button<button>: Joystick <num> (0-based) button
1986 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat>
1989 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat>
1992 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat>
1995 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat>
1998 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis>
1999 negative position (axis modes axis and axis_inverse).
2001 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis>
2002 positive position (axis modes axis and axis_inverse).
2004 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis>
2005 pressure (axis modes pressure_*).
2007 10.1.4 Special buttons:
2009 • Escape: Enter/Exit Command mode, cancel modal dialogs.
2011 • Return (also KPEnter): Execute command, ok modal dialog.
2013 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous
2014 command in command history
2016 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next
2017 command in command history
2019 • Home (also KP7 if no num lock; command mode): Beginning of
2022 • End (also KP1 if no num lock; command mode): End of command.
2024 • Left (also KP4 if no num lock; command mode): Move cursor left.
2026 • Right (also KP6 if no num lock; command mode): Move cursor
2029 • Delete (also KP. if no num lock; command mode): Delete
2030 character to right of cursor.
2032 • Insert (also KP0 if no num lock; command mode): Toggle between
2033 insert / overwrite modes.
2035 • Backspace (command mode): Delete character to left of cursor.
2037 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump
2040 10.2 wxWidgets platform
2042 10.2.1 Modifier names:
2044 Following modifier names are known:
2054 • cmd (Mac OS X only)
2058 Following key names are known:
2060 • back, tab, return, escape, space, exclaim, quotedbl, hash,
2061 dollar, percent, ampersand, quote, leftparen, rightparen,
2062 asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5,
2063 6, 7, 8, 9, colon, semicolon, less, equals, greater, question,
2064 at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,
2065 u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret,
2066 underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m,
2067 n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe,
2068 rightcurly, tilde, delete, start, lbutton, rbutton, cancel,
2069 mbutton, clear, shift, alt, control, menu, pause, capital, end,
2070 home, lefT, up, right, down, select, print, execute, snapshot,
2071 insert, help, numpad0, numpad1, numpad2, numpad3, numpad4,
2072 numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add,
2073 separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6,
2074 f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19,
2075 f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown,
2076 numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2,
2077 numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up,
2078 numpad_right, numpad_down, numpad_pageup, numpad_pagedown,
2079 numpad_end, numpad_begin, numpad_insert, numpad_delete,
2080 numpad_equal, numpad_multiply, numpad_add, numpad_separator,
2081 numpad_subtract, numpad_decimal, numpad_divide, windows_left,
2082 windows_right, windows_menu, command, special1, special2,
2083 special3, special4, special5, special6, special7, special8,
2084 special9, special10, special11, special12, special13,
2085 special14, special15, special16, special17, special18,
2086 special19, special20
2088 11 Movie file format
2090 Movie file is .zip archive in itself, normal ZIP archive tools
2091 work on it (note: If you recompress it, do not use compression
2092 methods other than store and deflate and especially do not use
2093 encryption of any kind).
2095 11.1 Detecting clean start/SRAM/Savestate
2097 • If file has member “savestate” it is savestate, otherwise:
2099 • If file has members with names starting “moviesram.” it is
2100 movie starting from SRAM, otherwise:
2102 • It is movie starting from clear state.
2104 11.2 Member: gametype
2106 Type of game ROM and region (as one line). Valid values are:
2109 +--------------+---------------------+--------+
2110 | Value | System | Region |
2111 +--------------+---------------------+--------+
2112 +--------------+---------------------+--------+
2113 | snes_pal | Super NES | PAL |
2114 +--------------+---------------------+--------+
2115 | sgb_pal | Super Game Boy | PAL |
2116 +--------------+---------------------+--------+
2117 | snes_ntsc | Super NES | NTSC |
2118 +--------------+---------------------+--------+
2119 | sgb_ntsc | Super Game Boy | NTSC |
2120 +--------------+---------------------+--------+
2121 | bsx | BS-X (non-slotted) | NTSC |
2122 +--------------+---------------------+--------+
2123 | bsxslotted | BS-X (slotted) | NTSC |
2124 +--------------+---------------------+--------+
2125 | sufamiturbo | Sufami Turbo | NTSC |
2126 +--------------+---------------------+--------+
2132 +---------+-----------------+
2133 | Region | Framerate (fps) |
2134 +---------+-----------------+
2135 +---------+-----------------+
2136 | PAL | 322445/6448 |
2137 +---------+-----------------+
2138 | NTSC | 10738636/178683 |
2139 +---------+-----------------+
2144 Contains type of port #1 (as one line). Valid values are 'none',
2145 'gamepad', 'multitap' and 'mouse'. If not present, defaults to
2150 Contains type of port #2 (as one line). Valid values are 'none',
2151 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and
2152 'justifiers'. If not present, defaults to 'none'.
2154 11.5 Member: gamename
2156 Contains name of the game (as one line).
2158 11.6 Member: authors
2160 Contains authors, one per line. Part before '|' is the full name,
2161 part after is the nickname.
2163 11.7 Member: systemid
2165 Always “lsnes-rr1” (one line). Used to reject other saves.
2167 11.8 Member: controlsversion
2169 Always “0” (one line). Used to identify what controls are there.
2171 11.9 Member: “coreversion”
2173 Contains bsnes core version number (as one line).
2175 11.10 Member: projectid
2177 Contains project ID (as one line). Used to identify if two movies
2178 are part of the same project.
2180 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2182 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2183 Absent if corresponding file is absent.
2185 11.12 Member: moviesram.<name>
2187 Raw binary startup SRAM of kind <name>. Only present in
2188 savestates and movies starting from SRAM.
2190 11.13 Member: saveframe
2192 Contains frame number (as one line) of frame movie was saved on.
2193 Only present in savestates.
2195 11.14 Member: lagcounter
2197 Current value of lag counter (as one line). Only present in
2200 11.15 Member: pollcounters
2202 Contains poll counters (currently 100 of them), one per line.
2203 Each line is raw poll count if DRDY is set for it. Otherwise it
2204 is negative poll count minus one. Only present in savestates.
2206 11.16 Member: hostmemory
2208 Raw binary dump of host memory. Only present in savestates.
2210 11.17 Member: savestate
2212 The raw binary savestate itself. Savestate detection uses this
2213 file, only present in savestates.
2215 11.18 Member: screenshot
2217 Screenshot of current frame. Only present in savestates. First 2
2218 bytes are big-endian width of image, rest are 24-bit RGB image
2219 data. Height of image is inferred from the width and size of
2222 11.19 Member: sram.<name>
2224 Raw binary SRAM of kind <name> at time of savestate. Only present
2229 The actual input track, one line per subframe (blank lines are
2232 • If the first byte of each line is '.', ' ', <tab> or '|', then
2233 the line is part of same frame as previous, otherwise it starts
2236 • First subframe must start a new frame.
2238 Length of movie in frames is number of lines in input file that
2241 11.21 Member: rerecords
2243 Contains textual base-10 rerecord count (as one line; emulator
2244 just writes this, it doesn't read it) + 1.
2246 11.22 Member: rrdata
2248 This member stores set of load IDs. There is one load ID per
2249 rerecord (plus one corresponding to start of project).
2251 • This member constists of concatenation of records
2253 • Each record is 2-36 bytes long and can represent 1-16,843,009
2256 • IDs are interpretted as 256-bit big-endian integers with
2259 • Initial predicted ID is all zeroes.
2261 Format of each record is:
2263 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen),
2264 bits 5-6 are count length (countlen). Bit 7 is unused.
2266 • 32-prefixlen bytes of ID.
2268 • countlen bytes of big-endian count (count).
2270 Records are processed as follows:
2272 • To form the first ID encoded by record, take the first
2273 prefixlen bytes predicted ID and append the read ID value to
2274 it. The result is the first ID encoded.
2276 • If countlen is 0, record encodes 1 ID.
2278 • If countlen is 1, record encodes 2+count IDs.
2280 • If countlen is 2, record encodes 258+count IDs.
2282 • If countlen is 3, record encodes 65794+count IDs.
2284 • The new predicted ID is the next ID after last one encoded by
2287 The number of rerecords + 1 is equal to the sum of number of IDs
2288 encoded by all records.
2290 11.23 Member: starttime.second
2292 Movie starting time, second part. Epoch is Unix epoch. Default is
2295 11.24 Member: starttime.subsecond
2297 Movie starting time, subsecond part. Unit is CPU clocks. Default
2300 11.25 Member: savetime.second
2302 Movie saving time, second part. Default is starttime.second. Only
2303 present in savestates.
2305 11.26 Member: savetime.subsecond
2307 Movie saving time, subsecond part. Default is
2308 starttime.subsecond. Only present in savestates.
2310 12 Quick'n'dirty encode guide
2312 1. Start the emulator and load the movie file.
2314 2. Set large AVI option 'set-setting avi-large on'
2316 3. Enable dumping 'dump-avi tmpdump'
2318 4. Unpause and let it run until you want to end dumping.
2320 5. Close the emulator (closing the window is the easiest way). Or
2323 6. For each tmpdump*.avi file created, on command prompt, do
2324 'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2326 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2328 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv +
2329 tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every
2330 tmpdump_<numbers>.mkv, with + in between).
2332 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now
2333 final.mkv contains quick'n'dirty encode.
2335 13 Axis configurations for some gamepad types:
2337 13.1 XBox360 controller:
2339 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be
2342 set-axis joystick0axis2 pressure-+
2344 set-axis joystick0axis5 pressure-+
2346 • This is needed for SDL only. EVDEV sets those types correctly.
2348 13.2 PS3 “sixaxis” controller:
2350 Axes 8-19 should be disabled.
2352 set-axis joystick0axis8 disabled
2354 set-axis joystick0axis9 disabled
2356 set-axis joystick0axis10 disabled
2358 set-axis joystick0axis11 disabled
2360 set-axis joystick0axis12 disabled
2362 set-axis joystick0axis13 disabled
2364 set-axis joystick0axis14 disabled
2366 set-axis joystick0axis15 disabled
2368 set-axis joystick0axis16 disabled
2370 set-axis joystick0axis17 disabled
2372 set-axis joystick0axis18 disabled
2374 set-axis joystick0axis19 disabled
2378 14.1 Problems from BSNES core:
2380 • The whole pending save stuff.
2382 • Lack of layer hiding.
2384 • It is slow (especially accuracy).
2386 • Firmwares can't be loaded from ZIP archives.
2388 14.2 Other problems:
2390 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2392 • Audio for last dumped frame is not itself dumped.
2394 • Audio in UI is pretty bad in quality if game doesn't run at
2397 • AVI compression levels 10-18 are not compatible with AVISynth
2400 • No menus, command based interface (SDL).
2402 • Long commands don't scroll.
2404 • Wxwidgets UI is still buggy.
2410 • Fix -Wall warnings
2412 • Fix dumper video corruption with levels 10-18.
2418 • Lots of code cleanups
2420 • Lua interface to settings
2422 • Allow specifying AVI borders without Lua
2424 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2426 • on_snoop lua callback
2428 • Faster movie loading and saving.
2438 • Save jukebox functionality.
2442 • Try to fix some nasty failing movie load edge cases
2444 • Allow specifying scripts to run on command line.
2448 • Major source code reorganization.
2450 • Backup savestates before overwriting.
2452 • Don't crash if loading initial state fails.
2456 • Fix firmware lookup
2458 • Fix author name parsing
2460 • Fix rerecord counting
2462 • (SDL) Print messages to console if SDL is uninitialized
2464 • Add movieinfo program
2466 • Fix loading movies starting from SRAM.
2470 • Add support for unattended dumping
2472 • Fix compiling for Win32
2474 • Don't lock up if sound can't be initialized
2476 • Strip trailing CR from commands
2478 • Don't try to do dubious things in global ctors (fix crash on
2483 • Small documentation tweaking
2487 • Fix major bug in modifier matching
2491 • Lots of documentation fixes
2493 • Use dedicated callbacks for event backcomm., not commands.
2495 • Ensure that the watchdog is not hit when executing delayed
2498 • Remove errant tab from joystick message.
2502 • Make autofire operate in absolute time, not linear time
2504 • Reinitialize controls when resuming from loadstate
2506 • Some more code cleanups
2508 • If Lua allocator fails, call OOM_panic()
2510 • Byte/word/dword/qword sized host memory write/read functions.
2512 • Dump at correct framerate if dumping interlaced NTSC
2517 • Actually include the complete source code
2523 • Document {save,start}time.{,sub}second.
2525 • Intercept time() from bsnes core.
2529 • Allow disabling time() interception (allow build on Mac OS X)
2531 • Use SDLMain on Mac OS X (make SDL not crash)
2533 • Disable delayed resets (just plain too buggy for now).
2537 • Use 16-bit for graphics/video instead of 32-bit.
2539 • gui.rectangle/gui.pixel
2543 • New CSCD writer implementation.
2547 • Fix interaction of * and +.
2549 • Manual improvements
2551 • Use gettimeofday()/usleep(), these seem portable enough.
2553 • Move joystick axis manipulation to keymapper code.
2555 • Changes to how read-only works.
2557 • Refactor controller input code.
2561 • Fix mouseclick scale compensation.
2563 • Draw area boundaries correctly in SDL code.
2567 • Fix CSCD output (buffer overrun and race condition).
2571 • JMD dumping support.
2573 • Allow unattended dumping to JMD.
2575 • Move to BSNES v083.
2577 • Switch back to 32-bit colors.
2579 • Add Lua function gui.color.
2581 • Use some new C++11 features in GCC 4.6.
2583 • Be prepared for core frequency changes.
2585 • Pass colors in one chunk from Lua.
2589 • New lua functions gui.line(), gui.status() and gui.circle(),
2590 memory.vma_count(), memory.read_vma() and memory.find_vma().
2592 • Numerious documentation fixups
2594 • RTC time format changed
2596 • Reformat flags display
2598 • Allow lua package name to be overridden
2600 • SDUMP (high-quality dumping).
2602 • Split platform support to plugins.
2604 • Make all sound plugins support basic sound commands
2606 • Support portaudio for sound.
2608 • Allow disable Lua/SDL searching.
2610 • Upconvert colors when copying lcscreen to screen.
2612 • Reorganize source tree.
2614 • Evdev joystick support.
2616 • Refactor more code into generic window code.
2620 • Refactor message handling.
2624 • Documentation fixes
2626 • Finish pending saves before load/quit.
2628 • Wxwidgets graphics plugin.
2632 • Get rid of win32-crap.[ch]pp.
2634 • Move files around a lot.
2636 • Get rid of need for host C++ compiler.
2640 • Refactor inter-component communication.
2644 • Fix crash on multiline aliases.
2646 • Load/Save settings in wxwidgets gui.
2650 • Patch problems in bsnes core
2652 • SNES is little-endian, not big-endian!
2654 • Fix memory corruption in lcscreen::load()
2658 • Fix interpretting repeat counts in rrdata loading.
2660 • New lua callback: on_frame()
2662 • Remove calls to runtosave() that aren't supposed to be there
2664 • Lua function: movie.read_rtc()
2666 • Ignore src/fonts/font.cpp
2668 • Fix more bsnes core problems
2670 • Control bsnes random seeding
2674 • Some bsnes core debugging features (state dump and state hash)
2676 • Fix titlebar version number (no, the last version wasn't
2677 'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2681 • Fix memory corruption due to macro/field mixup
2683 • search-memory update
2685 • Allow direct-mapped framebuffer
2687 • SDL: Use SDL_ANYFORMAT if possible
2689 • SDMP2SOX: 2s delay modes.
2691 • Wxwidgets: Cleanups
2693 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2695 • Wxwidgets: Save jukebox on exit
2697 • Fix RTC if using load-movie on savestate.
2699 • Fix crash related to full console mode.
2703 • Wxwidgets: Allow bringing application to foreground on Mac OS
2706 • Wxwidgets: Allow compiling on Mac OS X.
2708 • Use movie compare instead of movie hashing (faster save/load).
2710 • Lua: _SYSTEM table.
2714 • sdmp2sox: Pad soundtrack if using -l or -L.
2716 • sdmp2sox: Fix NTSC overscan.
2718 • sdmp2sox: Add AR correction mode.
2720 • call lua_close() when exiting.
2722 • Fix zip_writer bug causing warnings from info-zip and error
2727 • Fix IPS patching code (use bsnes core IPS patcher).
2729 • Implement BPS patching (using bsnes core IPS patcher).
2731 • Add feature to load headered ROMs.
2735 • Show command names when showing keybindings
2739 • Fix pause-on-end to be actually controllable
2741 • SDL: Poll all events in queue, not just first one (fixes
2742 slowness in command typing)
2744 • Wxwidgets: Fix ROM loading.
2748 • Lua: Add gui.textH, gui.textV, gui.textHV
2750 • Fix text colors on SDL on Mac OS X
2752 • Mode 'F' for finished in readonly mode.
2754 • Fix some WS errors.
2756 • Reliably pause after skip poll
2758 • Split UI and core into their own threads
2762 • Remove leftover dummy SRAM slot
2764 • Fix controller numbers.
2768 • Fix lsnes-dumpavi after interface change.
2770 • Also give BSNES patches for v085.
2772 • Pack movie data in memory.
2776 • Fix framecount/length given when loading movies.
2778 • Controller command memory leak fixes.
2780 • Don't leak palette if freeing screen object.
2786 • Wxwidgets: Allow controlling dumper from the menu.
2790 • Rewrite parts of manual
2792 • Lua: Make it work with Lua 5.2.
2796 • Win32: Fix compile errors.
2800 • Refactor controller input code.
2802 • Fix crash when using command line on SDL / Mac OS X.
2806 • Delete core/coroutine (obsolete)
2808 • Lag input display by one frame.
2810 • Rewind movie to beginning function.
2812 • Fix wrong frame number reported to Lua when repainting after
2815 • Support UI editing of jukebox
2817 • Wxwidgets: Save settings on exit.
2819 • Support ${project} for filenames
2821 • SDL: Fix command history
2825 • Fix some order-of-global-ctor bugs.
2829 • Fix crashes when quitting on Win32.
2833 • EVDEV: Queue keypresses from joystick, don't send directly
2835 • Wxwidgets: Load-Preserve that actually works.
2839 • Wxwidgets: GUI for memory search.
2841 • Warn about using synchronous queue in UI callback.
2845 • Remember last saved file for each ROM
2847 • Support MT dumping via boost.
2851 • Lua: input.keyhook
2853 • Make mouse be ordinary input instead of special-casing
2855 • SDL: Don't screw up commands with NUL codepoints.
2859 • Merge status panel and main window
2861 • True movie slot support (the rest of it)
2863 • SDL: Fix compilation error
2865 • Elminate cross calls in dump menu code.
2869 • Cancel pending saves command
2871 • Wxwidgets: Code refactoring
2873 • Wxwidgets: Fix system -> reset
2875 • Wxwidgets: Read watch expressions in the right thread
2879 • Wxwidgets: Don't prompt for member when running Lua script (Lua
2880 doesn't support that).
2882 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are
2885 • Don't append trailing '-' to prefix when saving movie.
2887 • Fix ROM/savestate handling (don't let user mismatch ROM and
2892 • Document memory watch syntax.
2896 • Fix unattended dumping (lsnes-dumpavi)
2898 • Support RAW dumping
2900 • Use adv_dumper instead of the old interface in lsnes-dumpavi
2903 • Add option to control sample rate preturbation in AVI dumper
2907 • Wxwidgets: Fix dumper submodes
2909 • Set core controller types before loadstate
2911 15.49 rr1-delta2epsilon1
2913 • Fix compiling with bsnes v086.
2917 • Don't prompt before quitting
2919 • Start unpaused, preserve pause/unpause over load.
2921 • Try to autodetect if ROM is headered.
2923 • Wxwidgets: Only bring up ROM patching screen if specifically
2926 • Allow configuring some hotkeys.
2930 • Lots of code cleanups
2932 • Fix JMD compression (JMD dumping was broken)
2934 • Don't crash if Lua C function throws an exception.
2936 • Support bitmap drawing in Lua.
2938 • Fix bsnes v085/v086 patches.
2940 • Improve stability on win32.
2942 15.52 rr1-delta4epsilon1
2944 • Don't corrupt movie if movie length is integer multiple of
2949 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2951 • New Lua functions: emulator_ready(), utime(),
2952 set_idle_timeout(), set_timer_timeout(), bit.extract(),
2953 bit.value(), input.geta(), input.seta() and
2954 input.controllertype()
2956 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2958 • Wxwidgets: Fix broken modifiers
2960 • on_paint has parameter now.
2962 • Optional initital fill for bitmaps
2964 • Fix palette changing.
2966 • Optimize rendering a bit.
2968 • Bsnes v087 support.
2970 15.54 rr1-delta5epsilon1
2972 • Movieinfo: Fix display of port #2 type.
2974 • Call on_input() after loadstate.
2976 15.55 rr1-delta5epsilon2
2978 • Fix writing port2 data to movie.
2980 • Fix SRAM handling with Bsnes v087.
2984 • Library loading support
2986 • Built-in TSCC encoder
2988 • Hi-color (256T colors) dumping.
2990 • Dump over TCP/IP(v6)
2992 • Hidable status panel
2996 • Adjustable sound volume
3000 • Allow DnD into filename boxes
3002 • Configurable paths
3004 • Portaudio: Fix speaker popping at start
3006 • Lots of UI changes
3008 • Speed adjustment menu
3010 • Win32 joystick support
3012 • Lua: gui.rainbow and gui.box
3014 • Split key lists into classes (the key list was large!)
3016 • More save slots support
3018 • Wxwidgets (wxJoystick) joystick support