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 ∗ DUMMY: Disable joystick support.
159 • SOUND=<implementation>
161 – Set sound implementation. Valid values are:
163 ∗ SDL: Use SDL for sound (requires SDL graphics)
165 ∗ PORTAUDIO: Use Portaudio for sound.
167 ∗ DUMMY: Disable sound support
171 • GRAPHICS=<implementation>
173 – Set windowing library to use. Valid values are:
175 ∗ SDL: Use SDL for graphics
177 ∗ WXWIDGETS: Use wxWidgets for graphics.
181 4 Command line options
185 <kind> in the following can be one of:
187 • rom: Cartridge ROM (BIOS for special carts). This is required.
189 • bsx: BS-X (non-slotted) Game flash ROM.
191 • bsxslotted: BS-X (slotted) Game flash ROM.
195 • slot-a: Sufami Turbo Slot A ROM
197 • slot-b: Sufami Turbo Slot B ROM
199 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
201 Load <file> as specified ROM (SFC/BS/DMG/ST file format).
203 4.1.2 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
205 Override hardware detection for ROM, reading the values from
206 <file> (BSNES XML format).
208 4.1.3 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
210 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple
211 times, the patches are applied in order.
213 4.1.4 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
215 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified
216 multiple times, the patches are applied in order.
218 4.1.5 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
220 Set offset to apply to IPS patches. May be negative. Handy for
221 applying headered IPS patches (use offset of -512 for this). The
222 offset must be 0 for BPS patches.
226 Force ROM to be considered PAL-only.
228 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
230 • Attempting to load NTSC movie file will error out.
234 Force ROM to be considered NTSC-only.
236 • Attempting to load PAL movie file will error out.
240 4.2.1 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
242 Load <filename> as movie or savestate file. All other session
245 4.2.2 --port1=<device> (lsnes/SDL)
247 Set type of port1. Valid values are:
249 • none: No device connected
251 • gamepad: One gamepad (the default)
253 • multitap: Four gamepads (warning: makes most games refuse to
258 4.2.3 --port2=<type> (lsnes/SDL)
260 Set type of port2. Valid values are:
262 • none: No device connected (the default)
264 • gamepad: One gamepad
266 • multitap: Four gamepads.
270 • superscope: Super Scope
272 • justifier: One justifier
274 • justifiers: Two justifiers
276 4.2.4 --gamename=<name> (lsnes/SDL)
278 Set the name of game to <name>. Default is blank.
280 4.2.5 --author=<name> (lsnes/SDL)
282 Add author with full name of <name> (no nickname).
284 4.2.6 --author=|<name> (lsnes/SDL)
286 Add author with nickname of <name> (no full name).
288 4.2.7 --author=<fullname>|<nickname> (lsnes/SDL)
290 Add author with full name of <fullname> and nickname of
293 4.2.8 --rtc-second=<value> (lsnes/SDL)
295 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
298 4.2.9 --rtc-subsecond=<value> (lsnes/SDL)
300 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
304 4.3.1 --run=<file> (lsnes/SDL)
306 After running main RC file, run this file. If multiple are
307 specified, these execute in order specified.
309 4.4 dump options (lsnes-dumpavi only)
311 4.4.1 --dumper=<dumper>
313 Set the dumper to use (required). Use 'list' for listing of known
318 Set the mode to use (required for dumpers with multiple modes,
319 forbidden otherwise). Use 'list' for known modes.
321 4.4.3 --prefix=<prefix>
323 Set dump prefix. Default is “avidump”.
325 4.4.4 --option=<name>=<value>
327 Set option <name> to value <value>.
329 4.4.5 --length=<length>
331 Set number of frames to dump. Mandatory.
335 Run specified lua script (lsnes-dumpavi does not have
336 initialization files).
338 5 Startup file lsnes.rc
340 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
341 commands. This file is located in:
343 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
345 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME
348 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
350 • All: ./lsnes.rc (fallback default).
352 If leading directories do not exist, attempt to create them is
357 • Commands beginning with '*' invoke the corresponding command
358 without alias expansion.
360 • If command starts with '+' (after possible '*'), the command is
361 executed as-is when button is pressed, and when button is
362 released, it is executed with '+' replaced by '-'.
364 • Commands without '+' execute only on negative edge (release).
368 Settings control various aspects of emulator behaviour.
370 6.1.1 set-setting <setting> <value>
372 Sets setting <setting> to value <value> (may be empty).
374 6.1.2 unset-setting <setting>
376 Try to unset setting <setting> (not all settings can be unset).
378 6.1.3 get-setting <setting>
380 Read value of setting <setting>
384 Print names and values of all settings.
388 Keybindings bind commands or aliases to keys (or pseudo-keys).
392 • Do not bind edge active (+/-) commands to keys with modifiers,
393 that won't work right!
395 • Names of keys and modifiers are platform-dependent.
397 • Be careful before binding pseudo-keys (such as joystick axes,
398 buttons or hats) with modifiers. That may or may not work
401 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
403 Bind <command> to key <key> (activating if modifiers in <modmask>
404 (comma-seperated list) are set as <mod> (comma-seperated list).
406 The names of keys and modifiers are platform-dependent.
408 6.2.2 unbind-key [<mod>/<modmask>] <key>
410 Unbind command from <key> (with specified <mod> and <modmask>).
412 6.2.3 set-axis <axis> [disabled | axis | axis-inverse |
413 pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0
414 | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>]
417 Set axis parameters for axis <axis>.
419 • disabled: Disable axis
423 • axis-inverse: Inverse axis
425 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
427 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
429 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
431 • pressure-+: Pressure sensitive. Released at -, pressed at +.
433 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
435 • pressure+-: Pressure sensitive. Released at +, pressed at -.
437 • minus=<val>: Calibration at extreme minus position
440 • zero=<val>: Calibration at neutral position (-32768-32767)
442 • plus=<val>: Calibration at extreme plus position (-32768-32767)
444 • tolerance=<value>: Center band tolerance (0<x<1). The smaller
445 the value, the more sensitive the control is.
449 Print all key bindings in effect.
453 Aliases bind command to sequence of commands. After alias has
454 been defined, it replaces the command it shadows.
458 • You can't alias command to itself.
460 • Aliases starting with +/- are edge active just like ordinary
461 commands starting with +/-.
463 • One command can be aliased to multiple commands.
465 6.3.1 alias-command <command> <expansion>
467 Append <expansion> to alias <command>. If alias does not already
468 exist, it is created.
470 6.3.2 unalias-command <command>
472 Clear alias expansion for <command>.
476 Print all aliases and their expansions in effect.
478 6.4 run-script <script>
480 Run <script> as if commands were entered on the command line.
484 Following commands control video dumping:
486 6.5.1 dump-avi <prefix>
488 Dump AVI video to prefix <prefix> Notes:
490 • The codec is Camstudio Codec in gzip mode.
492 • Encoder and muxer are internal, available on all platforms.
494 • Audio enable/disable and framerate has no effect.
496 • The audio dumped to .avi is low-quality version. The
497 high-quality version is dumped to .sox file.
501 End current AVI video dump (closing the emulator also closes the
504 6.5.3 dump-jmd <file>
506 Dump JMD video to file <file>.
510 End the current JMD dump in progress.
512 6.5.5 dump-sdmp <prefix>
514 Dump SDMP to <prefix>, splitting at 2GB.
516 6.5.6 dump-sdmp-ss <file>
518 Dump SDMP to <file>, no splitting
522 End the current SDMP dump in progress.
524 6.5.8 dump-raw <prefix>
526 Dump raw audio (to <prefix>.audio, at 32040.5Hz) and video (to
527 <prefix>.video>, at nominal framerate and 512x448 / 512x478
532 End the current RAW dump in progress.
534 6.6 Memory manipulation
536 <address> may be decimal or hexadecimal (prefixed with '0x').
537 <value> can be hexadecimal (prefixed with '0x'), unsigned or
538 signed (prefixed with '-') decimal.
540 The available element <sizes> are:
550 When reading RAM and ROM, multi-byte reads/writes are big-endian.
551 When dealing with DSP memory, multi-byte reads/writes are
552 native-endian (do not use operand sizes exceeding DSP bitness,
553 except dword is OK for 24-bit memory).
555 6.6.1 read-<size> <address>
557 Read the value of byte in <address>.
559 6.6.2 read-s<size> <address>
561 Read the value of signed byte in <address>.
563 6.6.3 write-<size> <address> <value>
565 Write <value> to byte in address <address>.
567 6.6.4 search-memory reset
569 Reset the memory search
571 6.6.5 search-memory count
573 Print number of candidates remaining
575 6.6.6 search-memory print
577 Print all candidates remaining
579 6.6.7 search-memory <usflag><sizeflag><op>
581 Searches memory for addresses satisfying criteria.
601 • lt: < previous value.
603 • le: <= previous value.
605 • eq: = previous value.
607 • ne: != previous value.
609 • ge: >= previous value.
611 • gt: > previous value.
613 6.6.8 search-memory <sizeflag> <value>
615 Searches for addresses that currently have value <value>.
616 <sizeflag> is as in previous command.
620 These commands are not available in lsnesrc, but are available
621 after ROM has been loaded.
623 6.7.1 quit-emulator [/y]
625 Quits the emulator (asking for confirmation). If /y is given, no
626 confirmation is asked.
630 Toggle paused/unpaused
634 Advance frame. If the button is still held after configurable
635 timeout expires, game unpauses for the duration frame advance is
640 Advance subframe. If the button is still held after configurable
641 timeout expires, game unpauses for the duration frame advance is
644 6.7.5 advance-skiplag
646 Skip to first poll in frame after current.
650 Reset the SNES after this frame.
652 6.7.7 load <filename>
654 Load savestate <filename> in current mode.
656 6.7.8 load-state <filename>
658 Load savestate <filename> in readwrite mode.
660 6.7.9 load-readonly <filename>
662 Load savestate <filename> in readonly mode.
664 6.7.10 load-preserve <filename>
666 Load savestate <filename> in readonly mode, preserving current
669 6.7.11 load-movie <filename>
671 Load savestate <filename>, ignoring save part in readonly mode.
673 6.7.12 save-state <filename>
675 Save system state to <filename> as soon as possible.
677 6.7.13 save-movie <filename>
679 Save movie to <filename>.
691 Toggle between read-only and read-write modes.
693 6.7.17 set-gamename <name>
695 Set name of the game to <name>
699 Print the name of the game.
701 6.7.19 add-author <author>
703 Adds new author <author>. If <author> does not contain '|' it is
704 full name. If it contains '|', '|' splits the full name and
707 6.7.20 edit-author <num> <author>
709 Edit the author in slot <num> (0-based) to be <author> (see
710 add-author for format)
712 6.7.21 remove-author <num>
714 Remove author in slot <num>
720 6.7.23 test-1, test-2, test-3
722 Internal test commands. Don't use.
724 6.7.24 take-screenshot <filename>
726 Save screenshot to <filename>.
728 6.7.25 +controller<num><button>
730 Press button <button> on controller <num> (1-8). The following
731 button names are known:
765 6.7.26 controllerh<num><button>
767 Hold/unhold button <button> on controller <num> (1-8). See
768 +controller for button names.
770 6.7.27 autofire (<pattern>|-)...
772 Set autofire pattern. Each parameter is comma-separated list of
773 button names (in form of 1start, 1A, 2B, etc..) to hold on that
774 frame. After reaching the end of pattern, the pattern restarts
783 6.8.1 cycle-jukebox-backward
785 Cycle save jukebox backwards.
787 6.8.2 cycle-jukebox-forward
789 Cycle save jukebox forwards
791 6.8.3 add-jukebox-save <filename>
793 Add <filename> to jukebox saves.
797 Do load from jukebox (current mode).
801 Do state save to jukebox.
805 Only available if lua support is compiled in.
807 6.9.1 evaluate-lua <luacode>
809 Run Lua code <luacode> using built-in Lua interpretter.
811 6.9.2 run-lua <script>
813 Run specified lua file using built-in Lua interpretter.
817 6.10.1 add-watch <name> <expression>
819 Adds new watch (or modifies old one).
821 6.10.2 remove-watch <name>
827 6.11.1 enable-sound <on/off>
829 Enable/Disable sound.
831 6.11.2 set-sound-device <device>
833 Set sound device to <device>
835 6.11.3 show-sound-status
837 Show status of sound system.
839 6.11.4 show-sound-devices
841 Show all available devices.
843 6.11.5 set-volume <multiplier>
845 Set the volume multiplier to <multiplier>. 1 is normal volume,
846 and higher numbers are louder.
848 6.11.6 set-volume <multiplier>%
850 Set the volume multiplier to <multiplier> percent. 100 is normal
851 volume, and higher numbers are louder.
853 6.11.7 set-volume <multiplier>dB
855 Set the volume multiplier to <multiplier> dB. 0 is normal volume,
856 and higher numbers are louder. The value may be negative.
858 6.12 SDL Platform commands
860 The following are valid on SDL platform.
864 Asks to press a key and then identifies that (pseudo-)key.
866 6.12.2 toggle-console
868 Toggle between windowed/fullscreen console.
872 Scroll messages window as far back as it goes.
874 6.12.4 scroll-fulldown
876 Scroll messages window as far forward as it goes.
880 Scroll messages window back one screenful.
884 Scroll messages window forward one screenful.
892 Set where bsnes looks for firmware files. Default is “.”.
896 Set the target fps. Numeric, range is 0.001 to “infinite”.
897 Default is native framerate.
899 7.1.3 savecompression
901 Set save compression level (integer 0-9). Default is 7 (0 is no
904 7.1.4 advance-timeout
906 Set the frame advance timeout in milliseconds. Numeric integer,
907 range is 0-999999999. Default is 500.
909 7.2 AVI dumper settings
913 AVI dumper: Always dump at 512x448 or 512x478 regardless of what
916 7.2.2 avi-left-border
918 AVI dumper: Set the default left border thickness (unless lua
919 overrides) for dumps. Range 0-8191. Default is 0.
921 7.2.3 avi-right-border
923 AVI dumper: Set the default right border thickness (unless lua
924 overrides) for dumps. Range 0-8191. Default is 0.
928 AVI dumper: Set the default top border thickness (unless lua
929 overrides) for dumps. Range 0-8191. Default is 0.
931 7.2.5 avi-bottom-border
933 AVI dumper: Set the default bottom border thickness (unless lua
934 overrides) for dumps. Range 0-8191. Default is 0.
938 AVI dumper: Maximum number of frames per dump segment (0 =>
939 unlimited). Range 0-999999999. Default is 0.
941 7.2.7 avi-compresison
943 AVI dumper: Compression level (0-18).
945 • Compression levels 10 and above are not compatible with stock
948 • Recomended level is 7.
952 AVI dumper: Set method of determining the sound rate.
954 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48,
955 64, 88.2, 96, 128, 176.4 and 192 kHz.
957 • 1: Round down to nearest integer.
959 • 2: Round up to nearest ingeter.
965 JMD dumper: Compression level (0-9).
967 7.4 SDL platform settings
969 7.4.1 autorepeat-first-delay
971 Sets the delay for first character in typematic autorepeat.
973 7.4.2 autorepeat-subsequent-delay
975 Sets the delay for subsequent characters in typematic autorepeat.
979 8.1 Core (in main table)
983 Print line to message console.
985 8.1.2 exec(string command)
987 Run command as it was entered on the command line
991 Returns two values. First is time since some epoch in seconds,
992 the second is microseconds mod 10^6 since that epoch.
994 8.1.4 emulator_ready()
996 Returns true if emulator has finished booting, false if not
997 (on_startup() will be issued later).
999 8.1.5 set_idle_timeout(number timeout)
1001 Set number of microseconds to block idle for. After this timeout
1002 has expired, on_idle() will be called once.
1004 8.1.6 set_timer_timeout(number timeout)
1006 Set number of microseconds to block timer for. After this timeout
1007 has expired, on_timer() will be called once.
1011 Bitwise logical functions and related.
1013 8.2.1 bit.none(number...) / bit.bnot(number...)
1015 48-bit bitwise NOT / NONE function (set bits that are set in none
1018 8.2.2 bit.any(number...) / bit.bor(number...)
1020 48-bit bitwise OR / ANY function (set bits that are set in any of
1023 8.2.3 bit.all(number...) / bit.band(number...)
1025 48-bit bitwise AND / ALL function (set bits that are set in all
1028 8.2.4 bit.parity(number...) / bit.bxor(number...)
1030 48-bit bitwise XOR / PARITY function (set bits that are set in
1031 odd number of the arguments).
1033 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
1035 Rotate bits-bit (max 48, default 48) number left by amount
1038 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
1040 Rotate bits-bit (max 48, default 48) number right by amount
1043 8.2.7 bit.lshift(number base[, number amount[, number bits]])
1045 Shift bits-bit (max 48, default 48) number left by amount
1046 (default 1) places. The new bits are filled with zeroes.
1048 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1050 Shift bits-bit (max 48, default 48) number logically right by
1051 amount (default 1) places. The new bits are filled with zeroes.
1053 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1055 Shift bits-bit (max 48, default 48) number arithmetically right
1056 by amount (default 1) places. The new bits are shifted in with
1057 copy of the high bit.
1059 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
1061 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1
1066 • Bit numbers up to 51 should work reliably (then things start
1067 falling apart due to double precision issues).
1069 • There are two special bit positions, true and false, standing
1070 for always set bit and always clear bit.
1072 8.2.11 bit.value([number bit1[, number bit2,...]])
1074 Returns bitwise OR of 1 left shifted by bit1 places, 1 left
1075 shifted by bit2 places and so on. As special value, nil argument
1080 Most of these functions can only be called in on_paint and
1081 on_video callbacks. Exceptions are noted.
1083 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are
1084 the green component, bits 16-23 are the red component, bits 24-31
1085 are alpha component (0 is fully opaque, 255 is almost
1086 transparent). -1 is the fully transparent color. Alpha values
1087 greater than 127 do work.
1089 Origin of coordinates is at top left corner of game display area.
1090 Left and top gaps correspond to negative coordinates.
1092 8.3.1 gui.resolution()
1094 Returns 2-tuple (hresolution, vresolution).
1096 8.3.2 gui.<class>_gap(number gap)
1098 Set the <class> (left, right, top, bottom) gap to specified value
1101 8.3.3 gui.text(number x, number y, string text[, number fgc[,
1104 Draw specified text on the GUI (each character cell is 8 or 16
1105 wide and 16 high). Parameters:
1107 • x: X-coordinate to start the drawing from (and x-coordinate at
1108 begining of the lines).
1110 • y: Y-coordinate to start the drawing from.
1112 • text: The text to draw.
1114 • fgc: Text color (default is 0xFFFFFF (white))
1116 • bgc: Background color (default is -1 (transparent))
1118 8.3.4 gui.textH(number x, number y, string text[, number fgc[,
1121 Like gui.text, but draw using double-width.
1123 8.3.5 gui.textV(number x, number y, string text[, number fgc[,
1126 Like gui.text, but draw using double-height.
1128 8.3.6 gui.textHV(number x, number y, string text[, number fgc[,
1131 Like gui.text, but draw using double-width/double-height.
1133 8.3.7 gui.rectangle(number x, number y, number width, number
1134 height[, number thickness[, number outline[, number fill]]])
1136 Draw rectangle on the GUI. Parameters:
1138 • x: X-coordinate of left edge.
1140 • y: Y-coordinate of upper edge.
1142 • width: Width of rectangle.
1144 • height: Height of rectangle.
1146 • thickness: Thickness of outline (default is 1).
1148 • outline: Color of outline (default is 0xFFFFFF (white))
1150 • fill: Color of fil (default is -1 (transparent))
1152 8.3.8 gui.pixel(number x, number y[, number color])
1154 Draw one pixel on the GUI. Parameters:
1156 • x: X-coordinate of the pixel
1158 • y: Y-coordinate of the pixel
1160 • color: Color of the pixel (default is 0xFFFFFF (white))
1162 8.3.9 gui.crosshair(number x, number y[, number length[, number
1165 Draw a crosshair. Parameters:
1167 • x: X-coordinate of the crosshair
1169 • y: Y-coordinate of the crosshair
1171 • length: Length of the crosshair lines (default 10).
1173 • color: Color of the crosshair (default is 0xFFFFFF (white))
1175 8.3.10 gui.line(number x1, number y1, number x2, number y2[,
1178 Draw a thin line. Parameters:
1180 • x1: X-coordinate of one end.
1182 • y1: Y-coordinate of one end.
1184 • x2: X-coordinate of the other end.
1186 • y2: Y-coordinate of the other end.
1188 • color: Color of the line (default is 0xFFFFFF (white)).
1190 8.3.11 gui.circle(number x, number y, number r[, number thick[,
1191 number border[, number fil]]])
1193 Draw a circle. Parameters.
1195 • x: X-coordinate of the center
1197 • y: Y-coordinate of the center
1199 • r: The radius of the circle
1201 • thick: Border thickness
1203 • border: Border color (default is 0xFFFFFF (white))
1205 • fill: Fill color (default is -1 (transparent)).
1207 8.3.12 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
1210 Draw a bitmap on screen with specified palette. Parameters:
1212 • x: X-coordinate of left edge.
1214 • y: Y-coordinate of top edge.
1216 • bitmap: The bitmap to draw
1218 • palette: The palette to draw the bitmap using.
1220 8.3.13 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1222 Draw a bitmap on screen. Parameters:
1224 • x: X-coordinate of left edge.
1226 • y: Y-coordinate of top edge.
1228 • bitmap: The bitmap to draw
1230 8.3.14 gui.palette_new()
1232 Returns a new palette (initially all transparent). Can be used
1235 8.3.15 gui.bitmap_new(number w, number h, boolean direct[, bool
1238 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1240 • w: The width of new bitmap
1242 • h: The height of new bitmap
1244 • direct: If true, the returned bitmap is dbitmap, otherwise
1247 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
1250 8.3.16 gui.bitmap_load(string file)
1252 Returns loaded bitmap/dbitmap (if bitmap, the second return value
1253 is palette for bitmap). Can be used anywhere. Parameters:
1255 • file: The name of file to load.
1257 8.3.17 gui.palette_set(palette palette, number index, number
1260 Sets color in palette. Can be used anywhere. Parameters:
1262 • palette: The palette to manipulate
1264 • index: Index of color (0-65535).
1266 • color: The color value.
1268 8.3.18 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
1271 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1273 • bitmap: The bitmap to manipulate
1275 • x: The x-coordinate of the pixel.
1277 • y: The y-coordinate of the pixel.
1279 • color: If bitmap is a bitmap, color index (0-65535). Otherwise
1282 8.3.19 gui.bitmap_size(bitmap/dbitmap bitmap)
1284 Get size of bitmap. Can be used anywhere. Parameters:
1286 • bitmap: The bitmap to query.
1288 The first return is the width, the second is the height.
1290 8.3.20 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
1291 bitmap/dbitmap src, number sx, number sy, number w, number h[,
1294 Blit a part of bitmap to another. Can be used anywhere.
1297 • dest: Destination to blit to.
1299 • dx: left edge of target
1301 • dy: Top edge of target
1303 • src: The source to blit from. Must be of the same type as
1306 • sx: left edge of source
1308 • sy: Top edge of source
1310 • w: Width of region
1312 • h: Height of region.
1314 • ck: Color key. Pixels of this color are not blitted.
1316 – If bitmaps are bitmaps, this is color index of colorkey.
1317 Values outside range 0-65535 cause no key to be used as
1320 – If bitmaps are dbitmaps, this color value of colorkey.
1322 – May be absent or nil for no colorkey blit.
1324 8.3.21 gui.repaint()
1326 Request on_repaint() to happen as soon as possible. Can be used
1329 8.3.22 gui.subframe_update(boolean on)
1331 Request subframe updates (calling on_paint() on subframes) to
1332 happen (on=true) or not happen (on=false). Can be used anywhere.
1334 8.3.23 gui.screenshot(string filename)
1336 Write PNG screenshot of the current frame (no drawings) to
1337 specified file. Can be used anywhere.
1339 8.3.24 gui.color(number r, number g, number b[, number a])
1341 Returns color (in notation Lua scripts use) corresponding to
1342 color (r,g,b), each component in scale 0-255. If a is specified,
1343 that is alpha (0 is fully transparent, 256(sic) is fully opaque).
1344 The default alpha is 256.
1346 8.3.25 gui.status(string name, string value)
1348 Set status field “L[<name>]” to <value> in status area. Can be
1351 8.3.26 gui.rainbow(number step, number steps[, number color])
1353 Perform hue rotation of color <color> (default bright red), by
1354 <step> steps. The number of steps per full rotation is given by
1355 absolute value of <steps>.
1357 If <steps> is negative, the rotation will be counterclockwise.
1361 Input handling. Only available in on_input callback.
1363 8.4.1 input.get(number controller, number index)
1365 Read the specified index (0-11) from specified controller (0-7).
1368 • Uses physical controller numbering. Gamepad in port 2 is
1369 controller 4, not 1!
1371 8.4.2 input.set(number controller, number index, number value)
1373 Write the specified index (0-11) from specified controller (0-7),
1374 storing value. Notes:
1376 • Uses physical controller numbering. Gamepad in port 2 is
1377 controller 4, not 1!
1379 8.4.3 input.geta(number controller)
1381 Get input state for entiere controller. Returns 13 return values.
1383 • 1st return value: Bitmask: bit i is set if i:th index is
1386 • 2nd-13th return value: value of i:th index.
1388 8.4.4 input.seta(number controller, number bitmask, number
1391 Set state for entiere controller. args is up to 12 values for
1392 indices (overriding values in bitmask if specified).
1394 8.4.5 input.controllertype(number controller)
1396 Get the type of controller as string. Valid values are:
1406 8.4.6 input.reset([number cycles])
1408 Execute reset. If cycles is greater than zero, do delayed reset.
1409 0 (or no value) causes immediate reset.
1411 • Only available with subframe flag false.
1415 Returns table of tables of all available keys and axes. The first
1416 table is indexed by key name (platform-dependent!), and the inner
1417 table has the following fields:
1419 • last_rawval: Last reported raw value for control.
1421 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse,
1422 hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p,
1423 pressure-pm, pressure-p0).
1425 • cal_left: Minimum calibration value. Only meaningful with axis
1428 • cal_center: Center calibration value. Only meaningful with axis
1431 • cal_right: Maximum calibration value. Only meaningful with axis
1434 • cal_tolerance: Dead zone tolerance. Only meaningful with axis
1437 8.4.8 input.keyhook(key, state)
1439 Requests that keyhook events to be sent for key (state=true) or
1440 not sent (state=false).
1442 8.5 Table hostmemory
1444 Host memory handling (extra memory saved to savestates). Host
1445 memory starts empty.
1447 8.5.1 hostmemory.read(number address)
1449 Reads hostmemory slot address. Slot numbers out of range return
1450 false instead of numeric.
1452 8.5.2 hostmemory.write(number address, number value)
1454 Writes hostmemory slot with 0-255. Slot numbers out of range
1455 cause extension of host memory slot space.
1457 8.5.3 hostmemory.readbyte(number address)
1459 Read unsigned byte (1 element) from given address. Slots out of
1462 8.5.4 hostmemory.writebyte(number address, number value)
1464 Write unsigned byte (1 element) to given slot. Slot numbers out
1465 of range cause extension.
1467 8.5.5 hostmemory.readsbyte(number address)
1469 Read signed byte (1 element) from given address. Slots out of
1472 8.5.6 hostmemory.writesbyte(number address, number value)
1474 Write signed byte (1 element) to given slot. Slot numbers out of
1475 range cause extension.
1477 8.5.7 hostmemory.readword(number address)
1479 Read unsigned word (2 elements) from given address. Slots out of
1482 8.5.8 hostmemory.writeword(number address, number value)
1484 Write unsigned word (2 elements) to given slot. Slot numbers out
1485 of range cause extension.
1487 8.5.9 hostmemory.readsword(number address)
1489 Read signed word (2 elements) from given address. Slots out of
1492 8.5.10 hostmemory.writesword(number address, number value)
1494 Write signed word (2 elements) to given slot. Slot numbers out of
1495 range cause extension.
1497 8.5.11 hostmemory.readdword(number address)
1499 Read unsigned doubleword (4 elements) from given address. Slots
1500 out of range return false.
1502 8.5.12 hostmemory.writedword(number address, number value)
1504 Write unsigned doubleword (4 elements) to given slot. Slot
1505 numbers out of range cause extension.
1507 8.5.13 hostmemory.readsdword(number address)
1509 Read signed doubleword (4 elements) from given address. Slots out
1510 of range return false.
1512 8.5.14 hostmemory.writesdword(number address, number value)
1514 Write signed doubleword (4 elements) to given slot. Slot numbers
1515 out of range cause extension.
1517 8.5.15 hostmemory.readqword(number address)
1519 Read unsigned quadword (8 elements) from given address. Slots out
1520 of range return false.
1522 8.5.16 hostmemory.writeqword(number address, number value)
1524 Write unsigned quadword (4 elements) to given slot. Slot numbers
1525 out of range cause extension.
1527 8.5.17 hostmemory.readsqword(number address)
1529 Read signed quadword (8 elements) from given address. Slots out
1530 of range return false.
1532 8.5.18 hostmemory.writesqword(number address, number value)
1534 Write signed quadword (8 elements) to given slot. Slot numbers
1535 out of range cause extension.
1541 8.6.1 movie.currentframe()
1543 Return number of current frame.
1545 8.6.2 movie.framecount()
1547 Return number of frames in movie.
1549 8.6.3 movie.readonly()
1551 Return true if in readonly mode, false if in readwrite.
1553 8.6.4 movie.set_readwrite()
1555 Set readwrite mode (does not cause on_readwrite callback).
1557 8.6.5 movie.frame_subframes(number frame)
1559 Count number of subframes in specified frame (frame numbers are
1560 1-based) and return that.
1562 8.6.6 movie.read_subframe(number frame, number subframe)
1564 Read specifed subframe in specified frame and return data as
1565 array (100 elements, numbered 0-99 currently).
1569 Routines for settings manipulation
1571 8.7.1 settings.get(string name)
1573 Get value of setting. If setting is blank, returns false. If
1574 setting value can't be obtained, returns (nil, error message).
1576 8.7.2 settings.set(string name, string value)
1578 Set value of setting. If setting can't be set, returns (nil,
1581 8.7.3 settings.is_set(string name)
1583 Returns if setting is set. If setting does not exist, returns
1584 (nil, error message).
1586 8.7.4 settings.blank(string name)
1588 Blanks a setting and returns true. If setting can't be blanked,
1589 returns (nil, error message).
1593 Contains various functions for managing memory
1595 8.8.1 memory.vma_count()
1597 Returns the number of VMAs
1599 8.8.2 memory.read_vma(number index)
1601 Reads the specified VMA (indices start from zero). Trying to read
1602 invalid VMA gives nil. The read VMA is table with the following
1605 • region_name (string): The readable name of the VMA
1607 • baseaddr (number): Base address of the VMA
1609 • lastaddr (number): Last address in the VMA.
1611 • size (number): The size of VMA in bytes.
1613 • readonly (boolean): True of the VMA corresponds to ROM.
1615 • native_endian (boolean): True if the VMA has native endian as
1616 opposed to little endian.
1618 8.8.3 memory.find_vma(number address)
1620 Finds the VMA containing specified address. Returns table in the
1621 same format as read_vma or nil if not found.
1623 8.8.4 memory.readbyte(number address)
1625 Reads the specified address as unsigned byte and returns the
1628 8.8.5 memory.readsbyte(number address)
1630 Reads the specified address as signed byte and returns the
1633 8.8.6 memory.writebyte(number address, number value)
1635 Writes the specified value (negative values undergo 2's
1636 complement) to specified address (as a byte).
1638 8.8.7 memory.readword(number address)
1640 Reads the specified address as unsigned word and returns the
1643 8.8.8 memory.readsword(number address)
1645 Reads the specified address as signed word and returns the
1648 8.8.9 memory.writeword(number address, number value)
1650 Writes the specified value (negative values undergo 2's
1651 complement) to specified address (as a word).
1653 8.8.10 memory.readdword(number address)
1655 Reads the specified address as unsigned doubleword and returns
1658 8.8.11 memory.readsdword(number address)
1660 Reads the specified address as signed doubleword and returns the
1663 8.8.12 memory.writedword(number address, number value)
1665 Writes the specified value (negative values undergo 2's
1666 complement) to specified address (as a doubleword).
1668 8.8.13 memory.readqword(number address)
1670 Reads the specified address as unsigned quadword and returns the
1673 8.8.14 memory.readsqword(number address)
1675 Reads the specified address as signed quadword and returns the
1678 8.8.15 memory.writeqword(number address, number value)
1680 Writes the specified value (negative values undergo 2's
1681 complement) to specified address (as a quadword).
1685 Contains copy of global variables from time of Lua
1686 initialization. Non-writeable.
1690 Various callbacks to Lua that can occur.
1692 8.10.1 Callback: on_paint(bool not_synth)
1694 Called when screen is being painted. Any gui.* calls requiring
1695 graphic context draw on the screen.
1697 not_synth is true if this hook is being called in response to
1698 received frame, false otherwise.
1700 8.10.2 Callback: on_video()
1702 Called when video dump frame is being painted. Any gui.* calls
1703 requiring graphic context draw on the video.
1705 8.10.3 Callback: on_frame_emulated()
1707 Called when emulating frame has completed and
1708 on_paint()/on_video() calls are about to be issued.
1710 8.10.4 Callback: on_frame()
1712 Called on each starting whole frame.
1714 8.10.5 Callback: on_startup()
1716 Called when the emulator is starting (lsnes.rc and --run files
1719 8.10.6 Callback: on_rewind()
1721 Called when rewind movie to beginning has completed.
1723 8.10.7 Callback: on_pre_load(string name)
1725 Called just before savestate/movie load occurs (note: loads are
1726 always delayed, so this occurs even when load was initiated by
1729 8.10.8 Callback: on_err_load(string name)
1731 Called if loadstate goes wrong.
1733 8.10.9 Callback: on_post_load(string name, boolean was_savestate)
1735 Called on successful loadstate. was_savestate gives if this was a
1736 savestate or a movie.
1738 8.10.10 Callback: on_pre_save(string name, boolean is_savestate)
1740 Called just before savestate save occurs (note: movie saves are
1741 synchronous and won't trigger these callbacks if called from
1744 8.10.11 Callback: on_err_save(string name)
1746 Called if savestate goes wrong.
1748 8.10.12 Callback: on_post_save(string name, boolean is_savestate)
1750 Called on successful savaestate. is_savestate gives if this was a
1753 8.10.13 Callback: on_quit()
1755 Called when emulator is shutting down.
1757 8.10.14 Callback: on_input(boolean subframe)
1759 Called when emulator is just sending input to bsnes core.
1760 Warning: This is called even in readonly mode, but the results
1763 8.10.15 Callback: on_reset()
1765 Called when SNES is reset.
1767 8.10.16 Callback: on_readwrite()
1769 Called when moving into readwrite mode as result of “set-rwmode”
1770 command (note: moving to rwmode by Lua won't trigger this, as per
1771 recursive entry protection).
1773 8.10.17 Callback: on_snoop(number port, number controller, number
1774 index, number value)
1776 Called each time bsnes asks for input. The value is the final
1777 value to be sent to bsnes core (readonly mode, autohold and
1778 autofire have been taken into account). Might be useful when
1779 translating movies to format suitable for console verification.
1780 Note: There is no way to modify the value to be sent.
1782 8.10.18 Callback: on_keyhook(string keyname, table state)
1784 Sent when key that has keyhook events requested changes state.
1785 Keyname is name of the key (group) and state is the state (same
1786 kind as table values in input.raw).
1788 8.10.19 Callback: on_idle()
1790 Called when requested by set_idle_timeout(), the timeout has
1791 expired and emulator is waiting.
1793 8.10.20 Callback: on_timer()
1795 Called when requested by set_idle_timeout() and the timeout has
1796 expired (regardless if emulator is waiting).
1798 9 Memory watch expression syntax
1800 Memory watch expressions are in RPN (Reverse Polish Notation). At
1801 the end of expression, the top entry on stack is taken as the
1806 • Evaluation order is strictly left to right.
1808 • a is the entry on top of stack
1810 • b is the entry immediately below top of stack
1812 • ; separates values to be pushed (no intermediate pop).
1814 • After end of element, all used stack slots are popped and all
1817 • When pushing multiple values, the pushes occur in order shown.
1819 The following operators are available:
1833 • b : read_signed_byte(a)
1837 • d : read_signed_dword(a)
1839 • i : quotent(a / b)
1844 • q : read_signed_qword(a)
1854 • w : read_signed_word(a)
1858 • B : read_unsigned_byte(a)
1860 • C<number>z : Push number <number> to stack.
1862 • D : read_unsigned_dword(a)
1864 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1866 • Q : read_unsigned_qword(a)
1868 • R<digit> : round a to <digit> digits.
1870 • W : read_unsigned_word(a)
1874 C0x007e0878zWC0x007e002czW-
1876 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1878 2. Pop the value on top of stack (0x7e0878), read word value at
1879 that address and push the result,call it x1 (W).
1881 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1883 4. Pop the value on top of stack (0x7e002c), read word value at
1884 that address and push the result,call it x2 (W).
1886 5. Pop the two top numbers on stack, x1 and x2, substract x1 from
1887 x2 and push x2 - x1 (-).
1889 6. Since the expression ends, the final memory watch result is
1890 the top one on stack, which is x2 - x1.
1892 10 Modifier and key names:
1896 10.1.1 Modifier names
1898 Following modifier names are known:
1900 • ctrl, lctrl, rctrl: Control keys
1902 • alt, lalt, ralt: ALT keys.
1904 • shift, lshift, rshift: Shift keys.
1906 • meta, lmeta, rmeta: Meta keys.
1908 • num, caps: Numlock/Capslock (these are sticky!)
1910 • mode: Mode select.
1914 Following key names are known:
1916 • backspace, tab, clear, return, pause, escape, space, exclaim,
1917 quotedbl, hash, dollar, ampersand, quote, leftparen,
1918 rightparen, asterisk, plus, comma, minus, period, slash, 0, 1,
1919 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals,
1920 greater, question, at, leftbracket, backslash, rightbracket,
1921 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k,
1922 l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0,
1923 world_1, world_2, world_3, world_4, world_5, world_6, world_7,
1924 world_8, world_9, world_10, world_11, world_12, world_13,
1925 world_14, world_15, world_16, world_17, world_18, world_19,
1926 world_20, world_21, world_22, world_23, world_24, world_25,
1927 world_26, world_27, world_28, world_29, world_30, world_31,
1928 world_32, world_33, world_34, world_35, world_36, world_37,
1929 world_38, world_39, world_40, world_41, world_42, world_43,
1930 world_44, world_45, world_46, world_47, world_48, world_49,
1931 world_50, world_51, world_52, world_53, world_54, world_55,
1932 world_56, world_57, world_58, world_59, world_60, world_61,
1933 world_62, world_63, world_64, world_65, world_66, world_67,
1934 world_68, world_69, world_70, world_71, world_72, world_73,
1935 world_74, world_75, world_76, world_77, world_78, world_79,
1936 world_80, world_81, world_82, world_83, world_84, world_85,
1937 world_86, world_87, world_88, world_89, world_90, world_91,
1938 world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3,
1939 kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide,
1940 kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down,
1941 right, left, insert, home, end, pageup, pagedown, f1, f2, f3,
1942 f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock,
1943 capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt,
1944 rmeta, lmeta, lsuper, rsuper, mode, compose, help, print,
1945 sysreq, break, menu, power, euro, undo
1947 • Names of form 'key<n>' where <n> is 0-255 are interpretted as
1948 key having hardware-dependent scan code of <n> (useful to bind
1949 those keys that don't have symbolic names).
1951 10.1.3 Joystick pseudo-keys:
1953 • joystick<num>button<button>: Joystick <num> (0-based) button
1956 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat>
1959 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat>
1962 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat>
1965 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat>
1968 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis>
1969 negative position (axis modes axis and axis_inverse).
1971 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis>
1972 positive position (axis modes axis and axis_inverse).
1974 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis>
1975 pressure (axis modes pressure_*).
1977 10.1.4 Special buttons:
1979 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1981 • Return (also KPEnter): Execute command, ok modal dialog.
1983 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous
1984 command in command history
1986 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next
1987 command in command history
1989 • Home (also KP7 if no num lock; command mode): Beginning of
1992 • End (also KP1 if no num lock; command mode): End of command.
1994 • Left (also KP4 if no num lock; command mode): Move cursor left.
1996 • Right (also KP6 if no num lock; command mode): Move cursor
1999 • Delete (also KP. if no num lock; command mode): Delete
2000 character to right of cursor.
2002 • Insert (also KP0 if no num lock; command mode): Toggle between
2003 insert / overwrite modes.
2005 • Backspace (command mode): Delete character to left of cursor.
2007 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump
2010 10.2 wxWidgets platform
2012 10.2.1 Modifier names:
2014 Following modifier names are known:
2024 • cmd (Mac OS X only)
2028 Following key names are known:
2030 • back, tab, return, escape, space, exclaim, quotedbl, hash,
2031 dollar, percent, ampersand, quote, leftparen, rightparen,
2032 asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5,
2033 6, 7, 8, 9, colon, semicolon, less, equals, greater, question,
2034 at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,
2035 u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret,
2036 underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m,
2037 n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe,
2038 rightcurly, tilde, delete, start, lbutton, rbutton, cancel,
2039 mbutton, clear, shift, alt, control, menu, pause, capital, end,
2040 home, lefT, up, right, down, select, print, execute, snapshot,
2041 insert, help, numpad0, numpad1, numpad2, numpad3, numpad4,
2042 numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add,
2043 separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6,
2044 f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19,
2045 f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown,
2046 numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2,
2047 numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up,
2048 numpad_right, numpad_down, numpad_pageup, numpad_pagedown,
2049 numpad_end, numpad_begin, numpad_insert, numpad_delete,
2050 numpad_equal, numpad_multiply, numpad_add, numpad_separator,
2051 numpad_subtract, numpad_decimal, numpad_divide, windows_left,
2052 windows_right, windows_menu, command, special1, special2,
2053 special3, special4, special5, special6, special7, special8,
2054 special9, special10, special11, special12, special13,
2055 special14, special15, special16, special17, special18,
2056 special19, special20
2058 11 Movie file format
2060 Movie file is .zip archive in itself, normal ZIP archive tools
2061 work on it (note: If you recompress it, do not use compression
2062 methods other than store and deflate and especially do not use
2063 encryption of any kind).
2065 11.1 Detecting clean start/SRAM/Savestate
2067 • If file has member “savestate” it is savestate, otherwise:
2069 • If file has members with names starting “moviesram.” it is
2070 movie starting from SRAM, otherwise:
2072 • It is movie starting from clear state.
2074 11.2 Member: gametype
2076 Type of game ROM and region (as one line). Valid values are:
2079 +--------------+---------------------+--------+
2080 | Value | System | Region |
2081 +--------------+---------------------+--------+
2082 +--------------+---------------------+--------+
2083 | snes_pal | Super NES | PAL |
2084 +--------------+---------------------+--------+
2085 | sgb_pal | Super Game Boy | PAL |
2086 +--------------+---------------------+--------+
2087 | snes_ntsc | Super NES | NTSC |
2088 +--------------+---------------------+--------+
2089 | sgb_ntsc | Super Game Boy | NTSC |
2090 +--------------+---------------------+--------+
2091 | bsx | BS-X (non-slotted) | NTSC |
2092 +--------------+---------------------+--------+
2093 | bsxslotted | BS-X (slotted) | NTSC |
2094 +--------------+---------------------+--------+
2095 | sufamiturbo | Sufami Turbo | NTSC |
2096 +--------------+---------------------+--------+
2102 +---------+-----------------+
2103 | Region | Framerate (fps) |
2104 +---------+-----------------+
2105 +---------+-----------------+
2106 | PAL | 322445/6448 |
2107 +---------+-----------------+
2108 | NTSC | 10738636/178683 |
2109 +---------+-----------------+
2114 Contains type of port #1 (as one line). Valid values are 'none',
2115 'gamepad', 'multitap' and 'mouse'. If not present, defaults to
2120 Contains type of port #2 (as one line). Valid values are 'none',
2121 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and
2122 'justifiers'. If not present, defaults to 'none'.
2124 11.5 Member: gamename
2126 Contains name of the game (as one line).
2128 11.6 Member: authors
2130 Contains authors, one per line. Part before '|' is the full name,
2131 part after is the nickname.
2133 11.7 Member: systemid
2135 Always “lsnes-rr1” (one line). Used to reject other saves.
2137 11.8 Member: controlsversion
2139 Always “0” (one line). Used to identify what controls are there.
2141 11.9 Member: “coreversion”
2143 Contains bsnes core version number (as one line).
2145 11.10 Member: projectid
2147 Contains project ID (as one line). Used to identify if two movies
2148 are part of the same project.
2150 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2152 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2153 Absent if corresponding file is absent.
2155 11.12 Member: moviesram.<name>
2157 Raw binary startup SRAM of kind <name>. Only present in
2158 savestates and movies starting from SRAM.
2160 11.13 Member: saveframe
2162 Contains frame number (as one line) of frame movie was saved on.
2163 Only present in savestates.
2165 11.14 Member: lagcounter
2167 Current value of lag counter (as one line). Only present in
2170 11.15 Member: pollcounters
2172 Contains poll counters (currently 100 of them), one per line.
2173 Each line is raw poll count if DRDY is set for it. Otherwise it
2174 is negative poll count minus one. Only present in savestates.
2176 11.16 Member: hostmemory
2178 Raw binary dump of host memory. Only present in savestates.
2180 11.17 Member: savestate
2182 The raw binary savestate itself. Savestate detection uses this
2183 file, only present in savestates.
2185 11.18 Member: screenshot
2187 Screenshot of current frame. Only present in savestates. First 2
2188 bytes are big-endian width of image, rest are 24-bit RGB image
2189 data. Height of image is inferred from the width and size of
2192 11.19 Member: sram.<name>
2194 Raw binary SRAM of kind <name> at time of savestate. Only present
2199 The actual input track, one line per subframe (blank lines are
2202 • If the first byte of each line is '.', ' ', <tab> or '|', then
2203 the line is part of same frame as previous, otherwise it starts
2206 • First subframe must start a new frame.
2208 Length of movie in frames is number of lines in input file that
2211 11.21 Member: rerecords
2213 Contains textual base-10 rerecord count (as one line; emulator
2214 just writes this, it doesn't read it) + 1.
2216 11.22 Member: rrdata
2218 This member stores set of load IDs. There is one load ID per
2219 rerecord (plus one corresponding to start of project).
2221 • This member constists of concatenation of records
2223 • Each record is 2-36 bytes long and can represent 1-16,843,009
2226 • IDs are interpretted as 256-bit big-endian integers with
2229 • Initial predicted ID is all zeroes.
2231 Format of each record is:
2233 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen),
2234 bits 5-6 are count length (countlen). Bit 7 is unused.
2236 • 32-prefixlen bytes of ID.
2238 • countlen bytes of big-endian count (count).
2240 Records are processed as follows:
2242 • To form the first ID encoded by record, take the first
2243 prefixlen bytes predicted ID and append the read ID value to
2244 it. The result is the first ID encoded.
2246 • If countlen is 0, record encodes 1 ID.
2248 • If countlen is 1, record encodes 2+count IDs.
2250 • If countlen is 2, record encodes 258+count IDs.
2252 • If countlen is 3, record encodes 65794+count IDs.
2254 • The new predicted ID is the next ID after last one encoded by
2257 The number of rerecords + 1 is equal to the sum of number of IDs
2258 encoded by all records.
2260 11.23 Member: starttime.second
2262 Movie starting time, second part. Epoch is Unix epoch. Default is
2265 11.24 Member: starttime.subsecond
2267 Movie starting time, subsecond part. Unit is CPU clocks. Default
2270 11.25 Member: savetime.second
2272 Movie saving time, second part. Default is starttime.second. Only
2273 present in savestates.
2275 11.26 Member: savetime.subsecond
2277 Movie saving time, subsecond part. Default is
2278 starttime.subsecond. Only present in savestates.
2280 12 Quick'n'dirty encode guide
2282 1. Start the emulator and load the movie file.
2284 2. Set large AVI option 'set-setting avi-large on'
2286 3. Enable dumping 'dump-avi tmpdump'
2288 4. Unpause and let it run until you want to end dumping.
2290 5. Close the emulator (closing the window is the easiest way). Or
2293 6. For each tmpdump*.avi file created, on command prompt, do
2294 'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2296 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2298 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv +
2299 tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every
2300 tmpdump_<numbers>.mkv, with + in between).
2302 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now
2303 final.mkv contains quick'n'dirty encode.
2305 13 Axis configurations for some gamepad types:
2307 13.1 XBox360 controller:
2309 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be
2312 set-axis joystick0axis2 pressure-+
2314 set-axis joystick0axis5 pressure-+
2316 • This is needed for SDL only. EVDEV sets those types correctly.
2318 13.2 PS3 “sixaxis” controller:
2320 Axes 8-19 should be disabled.
2322 set-axis joystick0axis8 disabled
2324 set-axis joystick0axis9 disabled
2326 set-axis joystick0axis10 disabled
2328 set-axis joystick0axis11 disabled
2330 set-axis joystick0axis12 disabled
2332 set-axis joystick0axis13 disabled
2334 set-axis joystick0axis14 disabled
2336 set-axis joystick0axis15 disabled
2338 set-axis joystick0axis16 disabled
2340 set-axis joystick0axis17 disabled
2342 set-axis joystick0axis18 disabled
2344 set-axis joystick0axis19 disabled
2348 14.1 Problems from BSNES core:
2350 • The whole pending save stuff.
2352 • Lack of layer hiding.
2354 • It is slow (especially accuracy).
2356 • Firmwares can't be loaded from ZIP archives.
2358 14.2 Other problems:
2360 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2362 • Audio for last dumped frame is not itself dumped.
2364 • Audio in UI is pretty bad in quality if game doesn't run at
2367 • AVI compression levels 10-18 are not compatible with AVISynth
2370 • No menus, command based interface (SDL).
2372 • Long commands don't scroll.
2374 • Wxwidgets UI is still buggy.
2380 • Fix -Wall warnings
2382 • Fix dumper video corruption with levels 10-18.
2388 • Lots of code cleanups
2390 • Lua interface to settings
2392 • Allow specifying AVI borders without Lua
2394 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2396 • on_snoop lua callback
2398 • Faster movie loading and saving.
2408 • Save jukebox functionality.
2412 • Try to fix some nasty failing movie load edge cases
2414 • Allow specifying scripts to run on command line.
2418 • Major source code reorganization.
2420 • Backup savestates before overwriting.
2422 • Don't crash if loading initial state fails.
2426 • Fix firmware lookup
2428 • Fix author name parsing
2430 • Fix rerecord counting
2432 • (SDL) Print messages to console if SDL is uninitialized
2434 • Add movieinfo program
2436 • Fix loading movies starting from SRAM.
2440 • Add support for unattended dumping
2442 • Fix compiling for Win32
2444 • Don't lock up if sound can't be initialized
2446 • Strip trailing CR from commands
2448 • Don't try to do dubious things in global ctors (fix crash on
2453 • Small documentation tweaking
2457 • Fix major bug in modifier matching
2461 • Lots of documentation fixes
2463 • Use dedicated callbacks for event backcomm., not commands.
2465 • Ensure that the watchdog is not hit when executing delayed
2468 • Remove errant tab from joystick message.
2472 • Make autofire operate in absolute time, not linear time
2474 • Reinitialize controls when resuming from loadstate
2476 • Some more code cleanups
2478 • If Lua allocator fails, call OOM_panic()
2480 • Byte/word/dword/qword sized host memory write/read functions.
2482 • Dump at correct framerate if dumping interlaced NTSC
2487 • Actually include the complete source code
2493 • Document {save,start}time.{,sub}second.
2495 • Intercept time() from bsnes core.
2499 • Allow disabling time() interception (allow build on Mac OS X)
2501 • Use SDLMain on Mac OS X (make SDL not crash)
2503 • Disable delayed resets (just plain too buggy for now).
2507 • Use 16-bit for graphics/video instead of 32-bit.
2509 • gui.rectangle/gui.pixel
2513 • New CSCD writer implementation.
2517 • Fix interaction of * and +.
2519 • Manual improvements
2521 • Use gettimeofday()/usleep(), these seem portable enough.
2523 • Move joystick axis manipulation to keymapper code.
2525 • Changes to how read-only works.
2527 • Refactor controller input code.
2531 • Fix mouseclick scale compensation.
2533 • Draw area boundaries correctly in SDL code.
2537 • Fix CSCD output (buffer overrun and race condition).
2541 • JMD dumping support.
2543 • Allow unattended dumping to JMD.
2545 • Move to BSNES v083.
2547 • Switch back to 32-bit colors.
2549 • Add Lua function gui.color.
2551 • Use some new C++11 features in GCC 4.6.
2553 • Be prepared for core frequency changes.
2555 • Pass colors in one chunk from Lua.
2559 • New lua functions gui.line(), gui.status() and gui.circle(),
2560 memory.vma_count(), memory.read_vma() and memory.find_vma().
2562 • Numerious documentation fixups
2564 • RTC time format changed
2566 • Reformat flags display
2568 • Allow lua package name to be overridden
2570 • SDUMP (high-quality dumping).
2572 • Split platform support to plugins.
2574 • Make all sound plugins support basic sound commands
2576 • Support portaudio for sound.
2578 • Allow disable Lua/SDL searching.
2580 • Upconvert colors when copying lcscreen to screen.
2582 • Reorganize source tree.
2584 • Evdev joystick support.
2586 • Refactor more code into generic window code.
2590 • Refactor message handling.
2594 • Documentation fixes
2596 • Finish pending saves before load/quit.
2598 • Wxwidgets graphics plugin.
2602 • Get rid of win32-crap.[ch]pp.
2604 • Move files around a lot.
2606 • Get rid of need for host C++ compiler.
2610 • Refactor inter-component communication.
2614 • Fix crash on multiline aliases.
2616 • Load/Save settings in wxwidgets gui.
2620 • Patch problems in bsnes core
2622 • SNES is little-endian, not big-endian!
2624 • Fix memory corruption in lcscreen::load()
2628 • Fix interpretting repeat counts in rrdata loading.
2630 • New lua callback: on_frame()
2632 • Remove calls to runtosave() that aren't supposed to be there
2634 • Lua function: read_rtc()
2636 • Ignore src/fonts/font.cpp
2638 • Fix more bsnes core problems
2640 • Control bsnes random seeding
2644 • Some bsnes core debugging features (state dump and state hash)
2646 • Fix titlebar version number (no, the last version wasn't
2647 'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2651 • Fix memory corruption due to macro/field mixup
2653 • search-memory update
2655 • Allow direct-mapped framebuffer
2657 • SDL: Use SDL_ANYFORMAT if possible
2659 • SDMP2SOX: 2s delay modes.
2661 • Wxwidgets: Cleanups
2663 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2665 • Wxwidgets: Save jukebox on exit
2667 • Fix RTC if using load-movie on savestate.
2669 • Fix crash related to full console mode.
2673 • Wxwidgets: Allow bringing application to foreground on Mac OS
2676 • Wxwidgets: Allow compiling on Mac OS X.
2678 • Use movie compare instead of movie hashing (faster save/load).
2680 • Lua: _SYSTEM table.
2684 • sdmp2sox: Pad soundtrack if using -l or -L.
2686 • sdmp2sox: Fix NTSC overscan.
2688 • sdmp2sox: Add AR correction mode.
2690 • call lua_close() when exiting.
2692 • Fix zip_writer bug causing warnings from info-zip and error
2697 • Fix IPS patching code (use bsnes core IPS patcher).
2699 • Implement BPS patching (using bsnes core IPS patcher).
2701 • Add feature to load headered ROMs.
2705 • Show command names when showing keybindings
2709 • Fix pause-on-end to be actually controllable
2711 • SDL: Poll all events in queue, not just first one (fixes
2712 slowness in command typing)
2714 • Wxwidgets: Fix ROM loading.
2718 • Lua: Add gui.textH, gui.textV, gui.textHV
2720 • Fix text colors on SDL on Mac OS X
2722 • Mode 'F' for finished in readonly mode.
2724 • Fix some WS errors.
2726 • Reliably pause after skip poll
2728 • Split UI and core into their own threads
2732 • Remove leftover dummy SRAM slot
2734 • Fix controller numbers.
2738 • Fix lsnes-dumpavi after interface change.
2740 • Also give BSNES patches for v085.
2742 • Pack movie data in memory.
2746 • Fix framecount/length given when loading movies.
2748 • Controller command memory leak fixes.
2750 • Don't leak palette if freeing screen object.
2756 • Wxwidgets: Allow controlling dumper from the menu.
2760 • Rewrite parts of manual
2762 • Lua: Make it work with Lua 5.2.
2766 • Win32: Fix compile errors.
2770 • Refactor controller input code.
2772 • Fix crash when using command line on SDL / Mac OS X.
2776 • Delete core/coroutine (obsolete)
2778 • Lag input display by one frame.
2780 • Rewind movie to beginning function.
2782 • Fix wrong frame number reported to Lua when repainting after
2785 • Support UI editing of jukebox
2787 • Wxwidgets: Save settings on exit.
2789 • Support ${project} for filenames
2791 • SDL: Fix command history
2795 • Fix some order-of-global-ctor bugs.
2799 • Fix crashes when quitting on Win32.
2803 • EVDEV: Queue keypresses from joystick, don't send directly
2805 • Wxwidgets: Load-Preserve that actually works.
2809 • Wxwidgets: GUI for memory search.
2811 • Warn about using synchronous queue in UI callback.
2815 • Remember last saved file for each ROM
2817 • Support MT dumping via boost.
2821 • Lua: input.keyhook
2823 • Make mouse be ordinary input instead of special-casing
2825 • SDL: Don't screw up commands with NUL codepoints.
2829 • Merge status panel and main window
2831 • True movie slot support (the rest of it)
2833 • SDL: Fix compilation error
2835 • Elminate cross calls in dump menu code.
2839 • Cancel pending saves command
2841 • Wxwidgets: Code refactoring
2843 • Wxwidgets: Fix system -> reset
2845 • Wxwidgets: Read watch expressions in the right thread
2849 • Wxwidgets: Don't prompt for member when running Lua script (Lua
2850 doesn't support that).
2852 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are
2855 • Don't append trailing '-' to prefix when saving
2857 • Fix ROM/savestate handling (don't let user mismatch ROM and
2862 • Document memory watch syntax.
2866 • Fix unattended dumping (lsnes-dumpavi)
2868 • Support RAW dumping
2870 • Use adv_dumper instead of the old interface in lsnes-dumpavi
2873 • Add option to control sample rate preturbation in AVI dumper
2877 • Wxwidgets: Fix dumper submodes
2879 • Set core controller types before loadstate
2881 15.49 rr1-delta2epsilon1
2883 • Fix compiling with bsnes v086.
2887 • Don't prompt before quitting
2889 • Start unpaused, preserve pause/unpause over load.
2891 • Try to autodetect if ROM is headered.
2893 • Wxwidgets: Only bring up ROM patching screen if specifically
2896 • Allow configuring some hotkeys.
2900 • Lots of code cleanups
2902 • Fix JMD compression (JMD dumping was broken)
2904 • Don't crash if Lua C function throws an exception.
2906 • Support bitmap drawing in Lua.
2908 • Fix bsnes v085/v086 patches.
2910 • Improve stability on win32.
2912 15.52 rr1-delta4epsilon1
2914 • Don't corrupt movie if movie length is integer multiple of
2919 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2921 • New Lua functions: emulator_ready(), utime(),
2922 set_idle_timeout(), set_timer_timeout(), bit.extract(),
2923 bit.value(), input.geta(), input.seta() and
2924 input.controllertype()
2926 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2928 • Wxwidgets: Fix broken modifiers
2930 • on_paint has parameter now.
2932 • Optional initital fill for bitmaps
2934 • Fix palette changing.
2936 • Optimize rendering a bit.
2938 • Bsnes v087 support.
2940 15.54 rr1-delta5epsilon1
2942 • Movieinfo: Fix display of port #2 type.
2944 • Call on_input() after loadstate.
2946 15.55 rr1-delta5epsilon2
2948 • Fix writing port2 data to movie.
2950 • Fix SRAM handling with Bsnes v087.