3 lsnes is SNES rerecording emulator based on bsnes core.
7 1. bsnes libsnes (for bsnes SNES core)
9 (a) v084-v087 (v084 or v085 for delayreset support)
11 (b) accuracy or compatiblity core with debugger enabled.
13 (c) Patched version (using included 7 patches)
15 2. gambatte (for gambatte core)
19 (b) Patched with included patches
27 6. boost_thread (if native std::thread is not available)
31 8. sdlmain (SDL only, part of SDL)
33 9. boost_conversion (this is header-only library)
35 10. libswscale (wxwidgets graphics only)
37 11. Portaudio (portaudio sound only)
39 12. Lua (if Lua support is needed).
41 • Version 5.1.X or 5.2X.
43 13. G++ 4.6 (bsnes doesn't seem to like 4.7, status for gambatte
48 • Copy bsnes sources (the bsnes subdirectory) to subdirectory
49 'bsnes' (for bsnes core).
51 • Copy gambatte sources to subdirectory 'gambatte' (for gambatte
54 • Patch the bsnes sources with included patches (directory
55 'bsnes-patches/<version>', bsnes core)
57 • Patch the gambatte sources with included patches (directory
58 'gambatte-patches/<version>', gambatte core)
60 • Edit options.build (or copy of that file)
62 • Run make (passing 'OPTIONS=<filename>' if using something else
65 4 Command line options
69 <kind> in the following can be one of:
71 • rom: Cartridge ROM (BIOS for special carts). This is required.
74 • bsx: BS-X (non-slotted) Game flash ROM. (bsnes)
76 • bsxslotted: BS-X (slotted) Game flash ROM. (bsnes)
78 • dmg: DMG game ROM (bsnes)
80 • slot-a: Sufami Turbo Slot A ROM (bsnes)
82 • slot-b: Sufami Turbo Slot B ROM (bsnes)
84 • gbrom: Game Boy ROM (gambatte)
86 • gbcrom: Game Boy Color ROM (gambatte)
88 • gbcarom: Game Boy Color ROM (Use GBA initial registers,
91 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
93 Load <file> as specified ROM (SFC/BS/DMG/GB/GBC/ST file format).
95 4.1.2 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
97 Override hardware detection for ROM, reading the values from
98 <file> (BSNES XML format or gambatte extra flags).
100 4.1.3 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
102 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple
103 times, the patches are applied in order.
105 4.1.4 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
107 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified
108 multiple times, the patches are applied in order.
110 4.1.5 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
112 Set offset to apply to IPS patches. May be negative. Handy for
113 applying headered IPS patches (use offset of -512 for this). The
114 offset must be 0 for BPS patches.
116 4.1.6 --region=pal (BSNES core only)
118 Force ROM to be considered PAL-only.
120 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
122 • Attempting to load NTSC movie file will error out.
124 4.1.7 --region=ntsc (BSNES core only)
126 Force ROM to be considered NTSC-only.
128 • Attempting to load PAL movie file will error out.
136 4.2.2 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
138 Load <filename> as movie or savestate file. All other session
141 4.2.3 --port1=<device> (lsnes/SDL, bsnes core only)
143 Set type of port1. Valid values are:
145 • none: No device connected
147 • gamepad: One gamepad (the default)
149 • multitap: Four gamepads (warning: makes most games refuse to
154 4.2.4 --port2=<type> (lsnes/SDL, bsnes core only)
156 Set type of port2. Valid values are:
158 • none: No device connected (the default)
160 • gamepad: One gamepad
162 • multitap: Four gamepads.
166 • superscope: Super Scope
168 • justifier: One justifier
170 • justifiers: Two justifiers
172 4.2.5 --gamename=<name> (lsnes/SDL)
174 Set the name of game to <name>. Default is blank.
176 4.2.6 --author=<name> (lsnes/SDL)
178 Add author with full name of <name> (no nickname).
180 4.2.7 --author=|<name> (lsnes/SDL)
182 Add author with nickname of <name> (no full name).
184 4.2.8 --author=<fullname>|<nickname> (lsnes/SDL)
186 Add author with full name of <fullname> and nickname of
189 4.2.9 --rtc-second=<value> (lsnes/SDL)
191 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is
194 4.2.10 --rtc-subsecond=<value> (lsnes/SDL)
196 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
200 4.3.1 --run=<file> (lsnes/SDL)
202 After running main RC file, run this file. If multiple are
203 specified, these execute in order specified.
205 4.4 dump options (lsnes-dumpavi only)
207 4.4.1 --dumper=<dumper>
209 Set the dumper to use (required). Use 'list' for listing of known
214 Set the mode to use (required for dumpers with multiple modes,
215 forbidden otherwise). Use 'list' for known modes.
217 4.4.3 --prefix=<prefix>
219 Set dump prefix. Default is “avidump”.
221 4.4.4 --option=<name>=<value>
223 Set option <name> to value <value>.
225 4.4.5 --length=<length>
227 Set number of frames to dump. Mandatory.
231 Run specified lua script (lsnes-dumpavi does not have
232 initialization files).
234 4.4.7 --load-library=<library>
236 Load the specified shared object / dynamic library / dynamic link
239 5 Startup file lsnes.rc
241 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
242 commands. This file is located in:
244 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
246 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME
249 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
251 • All: ./lsnes.rc (fallback default).
253 If leading directories do not exist, attempt to create them is
258 • Commands beginning with '*' invoke the corresponding command
259 without alias expansion.
261 • If command starts with '+' (after possible '*'), the command is
262 executed as-is when button is pressed, and when button is
263 released, it is executed with '+' replaced by '-'.
265 • Commands without '+' execute only on negative edge (release).
269 Settings control various aspects of emulator behaviour.
271 6.1.1 set-setting <setting> <value>
273 Sets setting <setting> to value <value> (may be empty).
275 6.1.2 unset-setting <setting>
277 Try to unset setting <setting> (not all settings can be unset).
279 6.1.3 get-setting <setting>
281 Read value of setting <setting>
285 Print names and values of all settings.
289 Keybindings bind commands or aliases to keys (or pseudo-keys).
293 • Do not bind edge active (+/-) commands to keys with modifiers,
294 that won't work right!
296 • Names of keys and modifiers are platform-dependent.
298 • Be careful before binding pseudo-keys (such as joystick axes,
299 buttons or hats) with modifiers. That may or may not work
302 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
304 Bind <command> to key <key> (activating if modifiers in <modmask>
305 (comma-seperated list) are set as <mod> (comma-seperated list).
307 The names of keys and modifiers are platform-dependent.
309 6.2.2 unbind-key [<mod>/<modmask>] <key>
311 Unbind command from <key> (with specified <mod> and <modmask>).
313 6.2.3 set-axis <axis> [disabled | axis | axis-inverse |
314 pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0
315 | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>]
318 Set axis parameters for axis <axis>.
320 • disabled: Disable axis
324 • axis-inverse: Inverse axis
326 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
328 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
330 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
332 • pressure-+: Pressure sensitive. Released at -, pressed at +.
334 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
336 • pressure+-: Pressure sensitive. Released at +, pressed at -.
338 • minus=<val>: Calibration at extreme minus position
341 • zero=<val>: Calibration at neutral position (-32768-32767)
343 • plus=<val>: Calibration at extreme plus position (-32768-32767)
345 • tolerance=<value>: Center band tolerance (0<x<1). The smaller
346 the value, the more sensitive the control is.
350 Print all key bindings in effect.
354 Aliases bind command to sequence of commands. After alias has
355 been defined, it replaces the command it shadows.
359 • You can't alias command to itself.
361 • Aliases starting with +/- are edge active just like ordinary
362 commands starting with +/-.
364 • One command can be aliased to multiple commands.
366 6.3.1 alias-command <command> <expansion>
368 Append <expansion> to alias <command>. If alias does not already
369 exist, it is created.
371 6.3.2 unalias-command <command>
373 Clear alias expansion for <command>.
377 Print all aliases and their expansions in effect.
379 6.4 run-script <script>
381 Run <script> as if commands were entered on the command line.
385 Following commands control video dumping:
387 6.5.1 start-dump <dumper> [<mode>] <prefix/filename>
389 Start dumping using dumper <dumper>. If mode is present or not
390 and if prefix or filename is present depends on the dumper and
393 The following dumpers are available:
395 • INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
397 – Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes
400 – Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
402 • INTERNAL-JMD: Internal .jmd dumper.
404 – Does not take mode.
408 • INTERNAL-RAW: Internal RAW dumper.
410 – Does not take mode.
414 – Sound is big-endian signed 16-bit, usually at 32040.5Hz.
416 – Video is always upscaled to double resolution (512x448 / 512
419 – Video framerate is usually 322445/6448 fps for PAL and
420 10738636/178683 fps for NTSC.
422 • INTERNAL-SDMP: Internal SDMP dumper.
424 – Mode 'ms': Multi-segment. Takes prefix.
426 – Mode 'ss': Single-segment. Takes filename.
428 6.5.2 end-dump <dumper>
430 End dumping using <dumper>
432 6.5.3 show-dumpers [<dumper>]
434 Show the list of dumpers or list of modes for <dumper>
436 6.6 Memory manipulation
438 <address> may be decimal or hexadecimal (prefixed with '0x').
439 <value> can be hexadecimal (prefixed with '0x'), unsigned or
440 signed (prefixed with '-') decimal.
442 The available element <sizes> are:
452 When reading RAM and ROM, multi-byte reads/writes are big-endian.
453 When dealing with DSP memory, multi-byte reads/writes are
454 native-endian (do not use operand sizes exceeding DSP bitness,
455 except dword is OK for 24-bit memory).
457 6.6.1 read-<size> <address>
459 Read the value of byte in <address>.
461 6.6.2 read-s<size> <address>
463 Read the value of signed byte in <address>.
465 6.6.3 write-<size> <address> <value>
467 Write <value> to byte in address <address>.
469 6.6.4 search-memory reset
471 Reset the memory search
473 6.6.5 search-memory count
475 Print number of candidates remaining
477 6.6.6 search-memory print
479 Print all candidates remaining
481 6.6.7 search-memory <usflag><sizeflag><op>
483 Searches memory for addresses satisfying criteria.
503 • lt: < previous value.
505 • le: <= previous value.
507 • eq: = previous value.
509 • ne: != previous value.
511 • ge: >= previous value.
513 • gt: > previous value.
515 6.6.8 search-memory <sizeflag> <value>
517 Searches for addresses that currently have value <value>.
518 <sizeflag> is as in previous command.
522 These commands are not available in lsnesrc, but are available
523 after ROM has been loaded.
525 6.7.1 quit-emulator [/y]
527 Quits the emulator (asking for confirmation). If /y is given, no
528 confirmation is asked.
532 Toggle paused/unpaused
536 Advance frame. If the button is still held after configurable
537 timeout expires, game unpauses for the duration frame advance is
542 Advance subframe. If the button is still held after configurable
543 timeout expires, game unpauses for the duration frame advance is
546 6.7.5 advance-skiplag
548 Skip to first poll in frame after current.
552 Reset the SNES after this frame.
554 6.7.7 load <filename>
556 Load savestate <filename> in current mode.
558 6.7.8 load-state <filename>
560 Load savestate <filename> in readwrite mode.
562 6.7.9 load-readonly <filename>
564 Load savestate <filename> in readonly mode.
566 6.7.10 load-preserve <filename>
568 Load savestate <filename> in readonly mode, preserving current
571 6.7.11 load-movie <filename>
573 Load savestate <filename>, ignoring save part in readonly mode.
575 6.7.12 save-state <filename>
577 Save system state to <filename> as soon as possible.
579 6.7.13 save-movie <filename>
581 Save movie to <filename>.
593 Toggle between read-only and read-write modes.
595 6.7.17 set-gamename <name>
597 Set name of the game to <name>
601 Print the name of the game.
603 6.7.19 add-author <author>
605 Adds new author <author>. If <author> does not contain '|' it is
606 full name. If it contains '|', '|' splits the full name and
609 6.7.20 edit-author <num> <author>
611 Edit the author in slot <num> (0-based) to be <author> (see
612 add-author for format)
614 6.7.21 remove-author <num>
616 Remove author in slot <num>
622 6.7.23 test-1, test-2, test-3
624 Internal test commands. Don't use.
626 6.7.24 take-screenshot <filename>
628 Save screenshot to <filename>.
630 6.7.25 +controller<num><button>
632 Press button <button> on controller <num> (1-8). The following
633 button names are known:
667 6.7.26 controllerh<num><button>
669 Hold/unhold button <button> on controller <num> (1-8). See
670 +controller for button names.
672 6.7.27 controllerf<num><button>
674 Hold/unhold button <button> on controller <num> (1-8) for the
675 next frame. See +controller for button names.
677 Cauntion: Does not work properly if outside frame advance.
679 6.7.28 autofire (<pattern>|-)...
681 Set autofire pattern. Each parameter is comma-separated list of
682 button names (in form of 1start, 1A, 2B, etc..) to hold on that
683 frame. After reaching the end of pattern, the pattern restarts
692 6.8.1 cycle-jukebox-backward
694 Cycle save jukebox backwards.
696 6.8.2 cycle-jukebox-forward
698 Cycle save jukebox forwards
702 Do load from jukebox (current mode).
706 Do state save to jukebox.
710 Only available if lua support is compiled in.
712 6.9.1 evaluate-lua <luacode>
714 Run Lua code <luacode> using built-in Lua interpretter.
716 6.9.2 run-lua <script>
718 Run specified lua file using built-in Lua interpretter.
722 Clear the Lua VM state and restore to factory defaults.
726 6.10.1 add-watch <name> <expression>
728 Adds new watch (or modifies old one).
730 6.10.2 remove-watch <name>
736 6.11.1 enable-sound <on/off>
738 Enable/Disable sound.
740 6.11.2 set-sound-device <device>
742 Set sound device to <device>
744 6.11.3 show-sound-status
746 Show status of sound system.
748 6.11.4 show-sound-devices
750 Show all available devices.
752 6.11.5 set-volume <multiplier>
754 Set the volume multiplier to <multiplier>. 1 is normal volume,
755 and higher numbers are louder.
757 6.11.6 set-volume <multiplier>%
759 Set the volume multiplier to <multiplier> percent. 100 is normal
760 volume, and higher numbers are louder.
762 6.11.7 set-volume <multiplier>dB
764 Set the volume multiplier to <multiplier> dB. 0 is normal volume,
765 and higher numbers are louder. The value may be negative.
769 6.12.1 reload-rom [<file>]
771 Reloads the main ROM image from <file>.
773 6.13 SDL Platform commands
775 The following are valid on SDL platform.
779 Asks to press a key and then identifies that (pseudo-)key.
781 6.13.2 toggle-console
783 Toggle between windowed/fullscreen console.
787 Scroll messages window as far back as it goes.
789 6.13.4 scroll-fulldown
791 Scroll messages window as far forward as it goes.
795 Scroll messages window back one screenful.
799 Scroll messages window forward one screenful.
801 6.13.7 prompt-command <command>
803 Enter command prompt, with prompt prepopulated with specified
812 Set where bsnes looks for firmware files. Default is “.”.
816 Set the target . Numeric, range is 0.001 to “infinite”. Default
819 7.1.3 savecompression
821 Set save compression level (integer 0-9). Default is 7 (0 is no
824 7.1.4 advance-timeout
826 Set the frame advance timeout in milliseconds. Numeric integer,
827 range is 0-999999999. Default is 500.
829 7.2 AVI dumper settings
833 AVI dumper: Always dump at 512x448 or 512x478 regardless of what
836 7.2.2 avi-left-border
838 AVI dumper: Set the default left border thickness (unless lua
839 overrides) for dumps. Range 0-8191. Default is 0.
841 7.2.3 avi-right-border
843 AVI dumper: Set the default right border thickness (unless lua
844 overrides) for dumps. Range 0-8191. Default is 0.
848 AVI dumper: Set the default top border thickness (unless lua
849 overrides) for dumps. Range 0-8191. Default is 0.
851 7.2.5 avi-bottom-border
853 AVI dumper: Set the default bottom border thickness (unless lua
854 overrides) for dumps. Range 0-8191. Default is 0.
858 AVI dumper: Maximum number of frames per dump segment (0 =>
859 unlimited). Range 0-999999999. Default is 0.
861 7.2.7 avi-compresison
863 AVI dumper: Compression level (0-18).
865 • Compression levels 10 and above are not compatible with stock
868 • Recomended level is 7.
872 AVI dumper: Set method of determining the sound rate.
874 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48,
875 64, 88.2, 96, 128, 176.4 and 192 kHz.
877 • 1: Round down to nearest integer.
879 • 2: Round up to nearest ingeter.
885 JMD dumper: Compression level (0-9).
887 7.4 SDL platform settings
889 7.4.1 autorepeat-first-delay
891 Sets the delay for first character in typematic autorepeat.
893 7.4.2 autorepeat-subsequent-delay
895 Sets the delay for subsequent characters in typematic autorepeat.
899 8.1 Core (in main table)
903 Print line to message console.
905 8.1.2 exec(string command)
907 Run command as it was entered on the command line
911 Returns two values. First is time since some epoch in seconds,
912 the second is microseconds mod 10^6 since that epoch.
914 8.1.4 emulator_ready()
916 Returns true if emulator has finished booting, false if not
917 (on_startup() will be issued later).
919 8.1.5 set_idle_timeout(number timeout)
921 Set number of microseconds to block idle for. After this timeout
922 has expired, on_idle() will be called once.
924 8.1.6 set_timer_timeout(number timeout)
926 Set number of microseconds to block timer for. After this timeout
927 has expired, on_timer() will be called once.
929 8.1.7 bus_address(number snesaddr)
931 Returns virtual address corresponding to specified address on
936 Bitwise logical functions and related.
938 8.2.1 bit.none(number...) / bit.bnot(number...)
940 48-bit bitwise NOT / NONE function (set bits that are set in none
943 8.2.2 bit.any(number...) / bit.bor(number...)
945 48-bit bitwise OR / ANY function (set bits that are set in any of
948 8.2.3 bit.all(number...) / bit.band(number...)
950 48-bit bitwise AND / ALL function (set bits that are set in all
953 8.2.4 bit.parity(number...) / bit.bxor(number...)
955 48-bit bitwise XOR / PARITY function (set bits that are set in
956 odd number of the arguments).
958 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
960 Rotate bits-bit (max 48, default 48) number left by amount
963 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
965 Rotate bits-bit (max 48, default 48) number right by amount
968 8.2.7 bit.lshift(number base[, number amount[, number bits]])
970 Shift bits-bit (max 48, default 48) number left by amount
971 (default 1) places. The new bits are filled with zeroes.
973 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
975 Shift bits-bit (max 48, default 48) number logically right by
976 amount (default 1) places. The new bits are filled with zeroes.
978 8.2.9 bit.arshift(number base[, number amount[, number bits]])
980 Shift bits-bit (max 48, default 48) number arithmetically right
981 by amount (default 1) places. The new bits are shifted in with
982 copy of the high bit.
984 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
986 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1
991 • Bit numbers up to 51 should work reliably (then things start
992 falling apart due to double precision issues).
994 • There are two special bit positions, true and false, standing
995 for always set bit and always clear bit.
997 8.2.11 bit.value([number bit1[, number bit2,...]])
999 Returns bitwise OR of 1 left shifted by bit1 places, 1 left
1000 shifted by bit2 places and so on. As special value, nil argument
1005 Most of these functions can only be called in on_paint and
1006 on_video callbacks. Exceptions are noted.
1008 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are
1009 the green component, bits 16-23 are the red component, bits 24-31
1010 are alpha component (0 is fully opaque, 255 is almost
1011 transparent). -1 is the fully transparent color. Alpha values
1012 greater than 127 do work.
1014 Origin of coordinates is at top left corner of game display area.
1015 Left and top gaps correspond to negative coordinates.
1017 8.3.1 gui.resolution()
1019 Returns 2-tuple (hresolution, vresolution).
1021 8.3.2 gui.<class>_gap(number gap)
1023 Set the <class> (left, right, top, bottom) gap to specified value
1026 8.3.3 gui.text(number x, number y, string text[, number fgc[,
1029 Draw specified text on the GUI (each character cell is 8 or 16
1030 wide and 16 high). Parameters:
1032 • x: X-coordinate to start the drawing from (and x-coordinate at
1033 begining of the lines).
1035 • y: Y-coordinate to start the drawing from.
1037 • text: The text to draw.
1039 • fgc: Text color (default is 0xFFFFFF (white))
1041 • bgc: Background color (default is -1 (transparent))
1043 8.3.4 gui.textH(number x, number y, string text[, number fgc[,
1046 Like gui.text, but draw using double-width.
1048 8.3.5 gui.textV(number x, number y, string text[, number fgc[,
1051 Like gui.text, but draw using double-height.
1053 8.3.6 gui.textHV(number x, number y, string text[, number fgc[,
1056 Like gui.text, but draw using double-width/double-height.
1058 8.3.7 gui.rectangle(number x, number y, number width, number
1059 height[, number thickness[, number outline[, number fill]]])
1061 Draw rectangle on the GUI. Parameters:
1063 • x: X-coordinate of left edge.
1065 • y: Y-coordinate of upper edge.
1067 • width: Width of rectangle.
1069 • height: Height of rectangle.
1071 • thickness: Thickness of outline (default is 1).
1073 • outline: Color of outline (default is 0xFFFFFF (white))
1075 • fill: Color of fill (default is -1 (transparent))
1077 8.3.8 gui.box(number x, number y, number width, number height[,
1078 number thickness[, number outline1[,number outline2[, number
1081 Draw rectangle with 3D effect on the GUI. Parameters:
1083 • x: X-coordinate of left edge.
1085 • y: Y-coordinate of upper edge.
1087 • width: Width of rectangle.
1089 • height: Height of rectangle.
1091 • thickness: Thickness of outline (default is 1).
1093 • outline1: First color of outline (default is 0xFFFFFF (white))
1095 • outline2: First color of outline (default is 0x808080 (dark
1098 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1100 8.3.9 gui.pixel(number x, number y[, number color])
1102 Draw one pixel on the GUI. Parameters:
1104 • x: X-coordinate of the pixel
1106 • y: Y-coordinate of the pixel
1108 • color: Color of the pixel (default is 0xFFFFFF (white))
1110 8.3.10 gui.crosshair(number x, number y[, number length[, number
1113 Draw a crosshair. Parameters:
1115 • x: X-coordinate of the crosshair
1117 • y: Y-coordinate of the crosshair
1119 • length: Length of the crosshair lines (default 10).
1121 • color: Color of the crosshair (default is 0xFFFFFF (white))
1123 8.3.11 gui.line(number x1, number y1, number x2, number y2[,
1126 Draw a thin line. Parameters:
1128 • x1: X-coordinate of one end.
1130 • y1: Y-coordinate of one end.
1132 • x2: X-coordinate of the other end.
1134 • y2: Y-coordinate of the other end.
1136 • color: Color of the line (default is 0xFFFFFF (white)).
1138 8.3.12 gui.circle(number x, number y, number r[, number thick[,
1139 number border[, number fil]]])
1141 Draw a circle. Parameters.
1143 • x: X-coordinate of the center
1145 • y: Y-coordinate of the center
1147 • r: The radius of the circle
1149 • thick: Border thickness
1151 • border: Border color (default is 0xFFFFFF (white))
1153 • fill: Fill color (default is -1 (transparent)).
1155 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
1158 Draw a bitmap on screen with specified palette. Parameters:
1160 • x: X-coordinate of left edge.
1162 • y: Y-coordinate of top edge.
1164 • bitmap: The bitmap to draw
1166 • palette: The palette to draw the bitmap using.
1168 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1170 Draw a bitmap on screen. Parameters:
1172 • x: X-coordinate of left edge.
1174 • y: Y-coordinate of top edge.
1176 • bitmap: The bitmap to draw
1178 8.3.15 gui.palette_new()
1180 Returns a new palette (initially all transparent). Can be used
1183 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool
1186 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1188 • w: The width of new bitmap
1190 • h: The height of new bitmap
1192 • direct: If true, the returned bitmap is dbitmap, otherwise
1195 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
1198 8.3.17 gui.bitmap_load(string file)
1200 Returns loaded bitmap/dbitmap (if bitmap, the second return value
1201 is palette for bitmap). Can be used anywhere. Parameters:
1203 • file: The name of file to load.
1205 8.3.18 gui.palette_set(palette palette, number index, number
1208 Sets color in palette. Can be used anywhere. Parameters:
1210 • palette: The palette to manipulate
1212 • index: Index of color (0-65535).
1214 • color: The color value.
1216 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
1219 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1221 • bitmap: The bitmap to manipulate
1223 • x: The x-coordinate of the pixel.
1225 • y: The y-coordinate of the pixel.
1227 • color: If bitmap is a bitmap, color index (0-65535). Otherwise
1230 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1232 Get size of bitmap. Can be used anywhere. Parameters:
1234 • bitmap: The bitmap to query.
1236 The first return is the width, the second is the height.
1238 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
1239 bitmap/dbitmap src, number sx, number sy, number w, number h[,
1242 Blit a part of bitmap to another. Can be used anywhere.
1245 • dest: Destination to blit to.
1247 • dx: left edge of target
1249 • dy: Top edge of target
1251 • src: The source to blit from. Must be of the same type as
1254 • sx: left edge of source
1256 • sy: Top edge of source
1258 • w: Width of region
1260 • h: Height of region.
1262 • ck: Color key. Pixels of this color are not blitted.
1264 – If bitmaps are bitmaps, this is color index of colorkey.
1265 Values outside range 0-65535 cause no key to be used as
1268 – If bitmaps are dbitmaps, this color value of colorkey.
1270 – May be absent or nil for no colorkey blit.
1272 8.3.22 gui.repaint()
1274 Request on_repaint() to happen as soon as possible. Can be used
1277 8.3.23 gui.subframe_update(boolean on)
1279 Request subframe updates (calling on_paint() on subframes) to
1280 happen (on=true) or not happen (on=false). Can be used anywhere.
1282 8.3.24 gui.screenshot(string filename)
1284 Write PNG screenshot of the current frame (no drawings) to
1285 specified file. Can be used anywhere.
1287 8.3.25 gui.color(number r, number g, number b[, number a])
1289 Returns color (in notation Lua scripts use) corresponding to
1290 color (r,g,b), each component in scale 0-255. If a is specified,
1291 that is alpha (0 is fully transparent, 256(sic) is fully opaque).
1292 The default alpha is 256.
1294 8.3.26 gui.status(string name, string value)
1296 Set status field “L[<name>]” to <value> in status area. Can be
1299 8.3.27 gui.rainbow(number step, number steps[, number color])
1301 Perform hue rotation of color <color> (default bright red), by
1302 <step> steps. The number of steps per full rotation is given by
1303 absolute value of <steps>.
1305 If <steps> is negative, the rotation will be counterclockwise.
1309 Input handling. Only available in on_input callback.
1311 8.4.1 input.get(number controller, number index)
1313 Read the specified index (0-11) from specified controller (0-7).
1316 • Uses physical controller numbering. Gamepad in port 2 is
1317 controller 4, not 1!
1319 8.4.2 input.set(number controller, number index, number value)
1321 Write the specified index (0-11) from specified controller (0-7),
1322 storing value. Notes:
1324 • Uses physical controller numbering. Gamepad in port 2 is
1325 controller 4, not 1!
1327 8.4.3 input.geta(number controller)
1329 Get input state for entiere controller. Returns 13 return values.
1331 • 1st return value: Bitmask: bit i is set if i:th index is
1334 • 2nd-13th return value: value of i:th index.
1336 8.4.4 input.seta(number controller, number bitmask, number
1339 Set state for entiere controller. args is up to 12 values for
1340 indices (overriding values in bitmask if specified).
1342 8.4.5 input.controllertype(number controller)
1344 Get the type of controller as string. Valid values are:
1354 8.4.6 input.reset([number cycles])
1356 Execute reset. If cycles is greater than zero, do delayed reset.
1357 0 (or no value) causes immediate reset.
1359 • Only available with subframe flag false.
1363 Returns table of tables of all available keys and axes. The first
1364 table is indexed by key name (platform-dependent!), and the inner
1365 table has the following fields:
1367 • last_rawval: Last reported raw value for control.
1369 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse,
1370 hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p,
1371 pressure-pm, pressure-p0).
1373 • cal_left: Minimum calibration value. Only meaningful with axis
1376 • cal_center: Center calibration value. Only meaningful with axis
1379 • cal_right: Maximum calibration value. Only meaningful with axis
1382 • cal_tolerance: Dead zone tolerance. Only meaningful with axis
1385 8.4.8 input.keyhook(key, state)
1387 Requests that keyhook events to be sent for key (state=true) or
1388 not sent (state=false).
1390 8.5 Table hostmemory
1392 Host memory handling (extra memory saved to savestates). Host
1393 memory starts empty.
1395 8.5.1 hostmemory.read(number address)
1397 Reads hostmemory slot address. Slot numbers out of range return
1398 false instead of numeric.
1400 8.5.2 hostmemory.write(number address, number value)
1402 Writes hostmemory slot with 0-255. Slot numbers out of range
1403 cause extension of host memory slot space.
1405 8.5.3 hostmemory.readbyte(number address)
1407 Read unsigned byte (1 element) from given address. Slots out of
1410 8.5.4 hostmemory.writebyte(number address, number value)
1412 Write unsigned byte (1 element) to given slot. Slot numbers out
1413 of range cause extension.
1415 8.5.5 hostmemory.readsbyte(number address)
1417 Read signed byte (1 element) from given address. Slots out of
1420 8.5.6 hostmemory.writesbyte(number address, number value)
1422 Write signed byte (1 element) to given slot. Slot numbers out of
1423 range cause extension.
1425 8.5.7 hostmemory.readword(number address)
1427 Read unsigned word (2 elements) from given address. Slots out of
1430 8.5.8 hostmemory.writeword(number address, number value)
1432 Write unsigned word (2 elements) to given slot. Slot numbers out
1433 of range cause extension.
1435 8.5.9 hostmemory.readsword(number address)
1437 Read signed word (2 elements) from given address. Slots out of
1440 8.5.10 hostmemory.writesword(number address, number value)
1442 Write signed word (2 elements) to given slot. Slot numbers out of
1443 range cause extension.
1445 8.5.11 hostmemory.readdword(number address)
1447 Read unsigned doubleword (4 elements) from given address. Slots
1448 out of range return false.
1450 8.5.12 hostmemory.writedword(number address, number value)
1452 Write unsigned doubleword (4 elements) to given slot. Slot
1453 numbers out of range cause extension.
1455 8.5.13 hostmemory.readsdword(number address)
1457 Read signed doubleword (4 elements) from given address. Slots out
1458 of range return false.
1460 8.5.14 hostmemory.writesdword(number address, number value)
1462 Write signed doubleword (4 elements) to given slot. Slot numbers
1463 out of range cause extension.
1465 8.5.15 hostmemory.readqword(number address)
1467 Read unsigned quadword (8 elements) from given address. Slots out
1468 of range return false.
1470 8.5.16 hostmemory.writeqword(number address, number value)
1472 Write unsigned quadword (4 elements) to given slot. Slot numbers
1473 out of range cause extension.
1475 8.5.17 hostmemory.readsqword(number address)
1477 Read signed quadword (8 elements) from given address. Slots out
1478 of range return false.
1480 8.5.18 hostmemory.writesqword(number address, number value)
1482 Write signed quadword (8 elements) to given slot. Slot numbers
1483 out of range cause extension.
1489 8.6.1 movie.currentframe()
1491 Return number of current frame.
1493 8.6.2 movie.framecount()
1495 Return number of frames in movie.
1497 8.6.3 movie.readonly()
1499 Return true if in readonly mode, false if in readwrite.
1501 8.6.4 movie.set_readwrite()
1503 Set readwrite mode (does not cause on_readwrite callback).
1505 8.6.5 movie.frame_subframes(number frame)
1507 Count number of subframes in specified frame (frame numbers are
1508 1-based) and return that.
1510 8.6.6 movie.read_subframe(number frame, number subframe)
1512 Read specifed subframe in specified frame and return data as
1513 array (100 elements, numbered 0-99 currently).
1515 8.6.7 movie.unsafe_rewind([UNSAFEREWIND state])
1517 Start setting point for unsafe rewind or jump to point of unsafe
1520 • If called without argument, causes emulator to start process of
1521 setting unsafe rewind point. When this has finished, callback
1522 on_set_rewind occurs, passing the rewind state to lua script.
1524 • If called with argument, causes emulator rewind to passed
1525 rewind point as soon as possible. Readwrite mode is implicitly
1528 The following warnings apply to unsafe rewinding:
1530 • There are no safety checks against misuse (that's what “unsafe”
1533 • Only call rewind from timeline rewind point was set from.
1535 • Only call rewind from after the rewind point was set.
1539 Routines for settings manipulation
1541 8.7.1 settings.get(string name)
1543 Get value of setting. If setting is blank, returns false. If
1544 setting value can't be obtained, returns (nil, error message).
1546 8.7.2 settings.set(string name, string value)
1548 Set value of setting. If setting can't be set, returns (nil,
1551 8.7.3 settings.is_set(string name)
1553 Returns if setting is set. If setting does not exist, returns
1554 (nil, error message).
1556 8.7.4 settings.blank(string name)
1558 Blanks a setting and returns true. If setting can't be blanked,
1559 returns (nil, error message).
1563 Contains various functions for managing memory
1565 8.8.1 memory.vma_count()
1567 Returns the number of VMAs
1569 8.8.2 memory.read_vma(number index)
1571 Reads the specified VMA (indices start from zero). Trying to read
1572 invalid VMA gives nil. The read VMA is table with the following
1575 • region_name (string): The readable name of the VMA
1577 • baseaddr (number): Base address of the VMA
1579 • lastaddr (number): Last address in the VMA.
1581 • size (number): The size of VMA in bytes.
1583 • readonly (boolean): True of the VMA corresponds to ROM.
1585 • iospace (boolean): True if the VMA is I/O space.
1587 • native_endian (boolean): True if the VMA has native endian as
1588 opposed to little endian.
1590 8.8.3 memory.find_vma(number address)
1592 Finds the VMA containing specified address. Returns table in the
1593 same format as read_vma or nil if not found.
1595 8.8.4 memory.readbyte(number address)
1597 Reads the specified address as unsigned byte and returns the
1600 8.8.5 memory.readsbyte(number address)
1602 Reads the specified address as signed byte and returns the
1605 8.8.6 memory.writebyte(number address, number value)
1607 Writes the specified value (negative values undergo 2's
1608 complement) to specified address (as a byte).
1610 8.8.7 memory.readword(number address)
1612 Reads the specified address as unsigned word and returns the
1615 8.8.8 memory.readsword(number address)
1617 Reads the specified address as signed word and returns the
1620 8.8.9 memory.writeword(number address, number value)
1622 Writes the specified value (negative values undergo 2's
1623 complement) to specified address (as a word).
1625 8.8.10 memory.readdword(number address)
1627 Reads the specified address as unsigned doubleword and returns
1630 8.8.11 memory.readsdword(number address)
1632 Reads the specified address as signed doubleword and returns the
1635 8.8.12 memory.writedword(number address, number value)
1637 Writes the specified value (negative values undergo 2's
1638 complement) to specified address (as a doubleword).
1640 8.8.13 memory.readqword(number address)
1642 Reads the specified address as unsigned quadword and returns the
1645 8.8.14 memory.readsqword(number address)
1647 Reads the specified address as signed quadword and returns the
1650 8.8.15 memory.writeqword(number address, number value)
1652 Writes the specified value (negative values undergo 2's
1653 complement) to specified address (as a quadword).
1655 8.8.16 memory.hash_region(number base, number size)
1657 Hash specified number of bytes starting from specified address
1658 and return the SHA-256.
1662 Contains copy of global variables from time of Lua
1663 initialization. Non-writeable.
1667 Various callbacks to Lua that can occur.
1669 8.10.1 Callback: on_paint(bool not_synth)
1671 Called when screen is being painted. Any gui.* calls requiring
1672 graphic context draw on the screen.
1674 not_synth is true if this hook is being called in response to
1675 received frame, false otherwise.
1677 8.10.2 Callback: on_video()
1679 Called when video dump frame is being painted. Any gui.* calls
1680 requiring graphic context draw on the video.
1682 8.10.3 Callback: on_frame_emulated()
1684 Called when emulating frame has completed and
1685 on_paint()/on_video() calls are about to be issued.
1687 8.10.4 Callback: on_frame()
1689 Called on each starting whole frame.
1691 8.10.5 Callback: on_startup()
1693 Called when the emulator is starting (lsnes.rc and --run files
1696 8.10.6 Callback: on_rewind()
1698 Called when rewind movie to beginning has completed.
1700 8.10.7 Callback: on_pre_load(string name)
1702 Called just before savestate/movie load occurs (note: loads are
1703 always delayed, so this occurs even when load was initiated by
1706 8.10.8 Callback: on_err_load(string name)
1708 Called if loadstate goes wrong.
1710 8.10.9 Callback: on_post_load(string name, boolean was_savestate)
1712 Called on successful loadstate. was_savestate gives if this was a
1713 savestate or a movie.
1715 8.10.10 Callback: on_pre_save(string name, boolean is_savestate)
1717 Called just before savestate save occurs (note: movie saves are
1718 synchronous and won't trigger these callbacks if called from
1721 8.10.11 Callback: on_err_save(string name)
1723 Called if savestate goes wrong.
1725 8.10.12 Callback: on_post_save(string name, boolean is_savestate)
1727 Called on successful savaestate. is_savestate gives if this was a
1728 savestate or a movie.
1730 8.10.13 Callback: on_quit()
1732 Called when emulator is shutting down.
1734 8.10.14 Callback: on_input(boolean subframe)
1736 Called when emulator is just sending input to bsnes core.
1737 Warning: This is called even in readonly mode, but the results
1740 8.10.15 Callback: on_reset()
1742 Called when SNES is reset.
1744 8.10.16 Callback: on_readwrite()
1746 Called when moving into readwrite mode as result of “set-rwmode”
1747 command (note: moving to rwmode by Lua won't trigger this, as per
1748 recursive entry protection).
1750 8.10.17 Callback: on_snoop(number port, number controller, number
1751 index, number value)
1753 Called each time bsnes asks for input. The value is the final
1754 value to be sent to bsnes core (readonly mode, autohold and
1755 autofire have been taken into account). Might be useful when
1756 translating movies to format suitable for console verification.
1757 Note: There is no way to modify the value to be sent.
1759 8.10.18 Callback: on_keyhook(string keyname, table state)
1761 Sent when key that has keyhook events requested changes state.
1762 Keyname is name of the key (group) and state is the state (same
1763 kind as table values in input.raw).
1765 8.10.19 Callback: on_idle()
1767 Called when requested by set_idle_timeout(), the timeout has
1768 expired and emulator is waiting.
1770 8.10.20 Callback: on_timer()
1772 Called when requested by set_idle_timeout() and the timeout has
1773 expired (regardless if emulator is waiting).
1775 8.10.21 Callback: on_set_rewind(UNSAFEREWIND r)
1777 Called when unsafe rewind object has been constructed.
1779 8.10.22 Callback: on_pre_rewind()
1781 Called just before unsafe rewind is about to occur.
1783 8.10.23 Callback: on_post_rewind()
1785 Called just after unsafe rewind has occured.
1787 9 Memory watch expression syntax
1789 Memory watch expressions are in RPN (Reverse Polish Notation). At
1790 the end of expression, the top entry on stack is taken as the
1795 • Evaluation order is strictly left to right.
1797 • a is the entry on top of stack
1799 • b is the entry immediately below top of stack
1801 • ; separates values to be pushed (no intermediate pop).
1803 • After end of element, all used stack slots are popped and all
1806 • When pushing multiple values, the pushes occur in order shown.
1808 The following operators are available:
1822 • b : read_signed_byte(a)
1826 • d : read_signed_dword(a)
1828 • i : quotent(a / b)
1833 • q : read_signed_qword(a)
1843 • w : read_signed_word(a)
1847 • B : read_unsigned_byte(a)
1849 • C<number>z : Push number <number> to stack.
1851 • D : read_unsigned_dword(a)
1853 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1855 • Q : read_unsigned_qword(a)
1857 • R<digit> : round a to <digit> digits.
1859 • W : read_unsigned_word(a)
1863 C0x007e0878zWC0x007e002czW-
1865 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1867 2. Pop the value on top of stack (0x7e0878), read word value at
1868 that address and push the result,call it x1 (W).
1870 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1872 4. Pop the value on top of stack (0x7e002c), read word value at
1873 that address and push the result,call it x2 (W).
1875 5. Pop the two top numbers on stack, x1 and x2, substract x1 from
1876 x2 and push x2 - x1 (-).
1878 6. Since the expression ends, the final memory watch result is
1879 the top one on stack, which is x2 - x1.
1881 10 Modifier and key names:
1885 10.1.1 Modifier names
1887 Following modifier names are known:
1889 • ctrl, lctrl, rctrl: Control keys
1891 • alt, lalt, ralt: ALT keys.
1893 • shift, lshift, rshift: Shift keys.
1895 • meta, lmeta, rmeta: Meta keys.
1897 • num, caps: Numlock/Capslock (these are sticky!)
1899 • mode: Mode select.
1903 Following key names are known:
1905 • backspace, tab, clear, return, pause, escape, space, exclaim,
1906 quotedbl, hash, dollar, ampersand, quote, leftparen,
1907 rightparen, asterisk, plus, comma, minus, period, slash, 0, 1,
1908 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals,
1909 greater, question, at, leftbracket, backslash, rightbracket,
1910 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k,
1911 l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0,
1912 world_1, world_2, world_3, world_4, world_5, world_6, world_7,
1913 world_8, world_9, world_10, world_11, world_12, world_13,
1914 world_14, world_15, world_16, world_17, world_18, world_19,
1915 world_20, world_21, world_22, world_23, world_24, world_25,
1916 world_26, world_27, world_28, world_29, world_30, world_31,
1917 world_32, world_33, world_34, world_35, world_36, world_37,
1918 world_38, world_39, world_40, world_41, world_42, world_43,
1919 world_44, world_45, world_46, world_47, world_48, world_49,
1920 world_50, world_51, world_52, world_53, world_54, world_55,
1921 world_56, world_57, world_58, world_59, world_60, world_61,
1922 world_62, world_63, world_64, world_65, world_66, world_67,
1923 world_68, world_69, world_70, world_71, world_72, world_73,
1924 world_74, world_75, world_76, world_77, world_78, world_79,
1925 world_80, world_81, world_82, world_83, world_84, world_85,
1926 world_86, world_87, world_88, world_89, world_90, world_91,
1927 world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3,
1928 kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide,
1929 kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down,
1930 right, left, insert, home, end, pageup, pagedown, f1, f2, f3,
1931 f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock,
1932 capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt,
1933 rmeta, lmeta, lsuper, rsuper, mode, compose, help, print,
1934 sysreq, break, menu, power, euro, undo
1936 • Names of form 'key<n>' where <n> is 0-255 are interpretted as
1937 key having hardware-dependent scan code of <n> (useful to bind
1938 those keys that don't have symbolic names).
1940 10.1.3 Joystick pseudo-keys:
1942 • joystick<num>button<button>: Joystick <num> (0-based) button
1945 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat>
1948 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat>
1951 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat>
1954 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat>
1957 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis>
1958 negative position (axis modes axis and axis_inverse).
1960 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis>
1961 positive position (axis modes axis and axis_inverse).
1963 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis>
1964 pressure (axis modes pressure_*).
1966 10.1.4 Special buttons:
1968 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1970 • Return (also KPEnter): Execute command, ok modal dialog.
1972 • Pgup/Up (also KP8/9 if no num lock, CTRL+P; command mode):
1973 Previous command in command history
1975 • Pgdn/Down(also KP2/3 if no num lock, CTRL+N; command mode):
1976 Next command in command history
1978 • Home (also KP7 if no num lock, CTRL+A; command mode): Beginning
1981 • End (also KP1 if no num lock, CTRL+E; command mode): End of
1984 • Left (also KP4 if no num lock, CTRL+B; command mode): Move
1987 • Right (also KP6 if no num lock, CTRL+F; command mode): Move
1990 • Delete (also KP. if no num lock; command mode): Delete
1991 character to right of cursor.
1993 • Insert (also KP0 if no num lock; command mode): Toggle between
1994 insert / overwrite modes.
1996 • Backspace (command mode): Delete character to left of cursor.
1998 • CTRL+LEFT (also ALT+B; command mode): Previous word.
2000 • CTRL+RIGHT (also ALT+F; command mode): Next word.
2002 • ALT+D (also CTRL+W; command mode): Delete word.
2004 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump
2007 10.2 wxWidgets platform
2009 10.2.1 Modifier names:
2011 Following modifier names are known:
2021 • cmd (Mac OS X only)
2025 Following key names are known:
2027 • back, tab, return, escape, space, exclaim, quotedbl, hash,
2028 dollar, percent, ampersand, quote, leftparen, rightparen,
2029 asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5,
2030 6, 7, 8, 9, colon, semicolon, less, equals, greater, question,
2031 at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,
2032 u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret,
2033 underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m,
2034 n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe,
2035 rightcurly, tilde, delete, start, lbutton, rbutton, cancel,
2036 mbutton, clear, shift, alt, control, menu, pause, capital, end,
2037 home, lefT, up, right, down, select, print, execute, snapshot,
2038 insert, help, numpad0, numpad1, numpad2, numpad3, numpad4,
2039 numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add,
2040 separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6,
2041 f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19,
2042 f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown,
2043 numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2,
2044 numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up,
2045 numpad_right, numpad_down, numpad_pageup, numpad_pagedown,
2046 numpad_end, numpad_begin, numpad_insert, numpad_delete,
2047 numpad_equal, numpad_multiply, numpad_add, numpad_separator,
2048 numpad_subtract, numpad_decimal, numpad_divide, windows_left,
2049 windows_right, windows_menu, command, special1, special2,
2050 special3, special4, special5, special6, special7, special8,
2051 special9, special10, special11, special12, special13,
2052 special14, special15, special16, special17, special18,
2053 special19, special20
2055 11 Movie file format
2057 Movie file is .zip archive in itself, normal ZIP archive tools
2058 work on it (note: If you recompress it, do not use compression
2059 methods other than store and deflate and especially do not use
2060 encryption of any kind).
2062 11.1 Detecting clean start/SRAM/Savestate
2064 • If file has member “savestate” it is savestate, otherwise:
2066 • If file has members with names starting “moviesram.” it is
2067 movie starting from SRAM, otherwise:
2069 • It is movie starting from clear state.
2071 11.2 Member: gametype
2073 Type of game ROM and region (as one line). Valid values are:
2076 +--------------+---------------------+--------+
2077 | Value | System | Region |
2078 +--------------+---------------------+--------+
2079 +--------------+---------------------+--------+
2080 | snes_pal | Super NES | PAL |
2081 +--------------+---------------------+--------+
2082 | sgb_pal | Super Game Boy | PAL |
2083 +--------------+---------------------+--------+
2084 | snes_ntsc | Super NES | NTSC |
2085 +--------------+---------------------+--------+
2086 | sgb_ntsc | Super Game Boy | NTSC |
2087 +--------------+---------------------+--------+
2088 | bsx | BS-X (non-slotted) | NTSC |
2089 +--------------+---------------------+--------+
2090 | bsxslotted | BS-X (slotted) | NTSC |
2091 +--------------+---------------------+--------+
2092 | sufamiturbo | Sufami Turbo | NTSC |
2093 +--------------+---------------------+--------+
2099 +---------+-----------------+
2100 | Region | Framerate (fps) |
2101 +---------+-----------------+
2102 +---------+-----------------+
2103 | PAL | 322445/6448 |
2104 +---------+-----------------+
2105 | NTSC | 10738636/178683 |
2106 +---------+-----------------+
2111 Contains type of port #1 (as one line). Valid values are 'none',
2112 'gamepad', 'multitap' and 'mouse'. If not present, defaults to
2117 Contains type of port #2 (as one line). Valid values are 'none',
2118 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and
2119 'justifiers'. If not present, defaults to 'none'.
2121 11.5 Member: gamename
2123 Contains name of the game (as one line).
2125 11.6 Member: authors
2127 Contains authors, one per line. Part before '|' is the full name,
2128 part after is the nickname.
2130 11.7 Member: systemid
2132 Always “lsnes-rr1” (one line). Used to reject other saves.
2134 11.8 Member: controlsversion
2136 Always “0” (one line). Used to identify what controls are there.
2138 11.9 Member: “coreversion”
2140 Contains bsnes core version number (as one line).
2142 11.10 Member: projectid
2144 Contains project ID (as one line). Used to identify if two movies
2145 are part of the same project.
2147 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2149 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2150 Absent if corresponding file is absent.
2152 11.12 Member: moviesram.<name>
2154 Raw binary startup SRAM of kind <name>. Only present in
2155 savestates and movies starting from SRAM.
2157 11.13 Member: saveframe
2159 Contains frame number (as one line) of frame movie was saved on.
2160 Only present in savestates.
2162 11.14 Member: lagcounter
2164 Current value of lag counter (as one line). Only present in
2167 11.15 Member: pollcounters
2169 Contains poll counters (currently 100 of them), one per line.
2170 Each line is raw poll count if DRDY is set for it. Otherwise it
2171 is negative poll count minus one. Only present in savestates.
2173 11.16 Member: hostmemory
2175 Raw binary dump of host memory. Only present in savestates.
2177 11.17 Member: savestate
2179 The raw binary savestate itself. Savestate detection uses this
2180 file, only present in savestates.
2182 11.18 Member: screenshot
2184 Screenshot of current frame. Only present in savestates. First 2
2185 bytes are big-endian width of image, rest are 24-bit RGB image
2186 data. Height of image is inferred from the width and size of
2189 11.19 Member: sram.<name>
2191 Raw binary SRAM of kind <name> at time of savestate. Only present
2196 The actual input track, one line per subframe (blank lines are
2199 • If the first byte of each line is '.', ' ', <tab> or '|', then
2200 the line is part of same frame as previous, otherwise it starts
2203 • First subframe must start a new frame.
2205 Length of movie in frames is number of lines in input file that
2208 11.21 Member: rerecords
2210 Contains textual base-10 rerecord count (as one line; emulator
2211 just writes this, it doesn't read it) + 1.
2213 11.22 Member: rrdata
2215 This member stores set of load IDs. There is one load ID per
2216 rerecord (plus one corresponding to start of project).
2218 • This member constists of concatenation of records
2220 • Each record is 2-36 bytes long and can represent 1-16,843,009
2223 • IDs are interpretted as 256-bit big-endian integers with
2226 • Initial predicted ID is all zeroes.
2228 Format of each record is:
2230 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen),
2231 bits 5-6 are count length (countlen). Bit 7 is unused.
2233 • 32-prefixlen bytes of ID.
2235 • countlen bytes of big-endian count (count).
2237 Records are processed as follows:
2239 • To form the first ID encoded by record, take the first
2240 prefixlen bytes predicted ID and append the read ID value to
2241 it. The result is the first ID encoded.
2243 • If countlen is 0, record encodes 1 ID.
2245 • If countlen is 1, record encodes 2+count IDs.
2247 • If countlen is 2, record encodes 258+count IDs.
2249 • If countlen is 3, record encodes 65794+count IDs.
2251 • The new predicted ID is the next ID after last one encoded by
2254 The number of rerecords + 1 is equal to the sum of number of IDs
2255 encoded by all records.
2257 11.23 Member: starttime.second
2259 Movie starting time, second part. Epoch is Unix epoch. Default is
2262 11.24 Member: starttime.subsecond
2264 Movie starting time, subsecond part. Unit is CPU clocks. Default
2267 11.25 Member: savetime.second
2269 Movie saving time, second part. Default is starttime.second. Only
2270 present in savestates.
2272 11.26 Member: savetime.subsecond
2274 Movie saving time, subsecond part. Default is
2275 starttime.subsecond. Only present in savestates.
2277 12 Quick'n'dirty encode guide
2279 1. Start the emulator and load the movie file.
2281 2. Set large AVI option 'set-setting avi-large on'
2283 3. Enable dumping 'dump-avi tmpdump'
2285 4. Unpause and let it run until you want to end dumping.
2287 5. Close the emulator (closing the window is the easiest way). Or
2290 6. For each tmpdump*.avi file created, on command prompt, do
2291 'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2293 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2295 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv +
2296 tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every
2297 tmpdump_<numbers>.mkv, with + in between).
2299 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now
2300 final.mkv contains quick'n'dirty encode.
2302 13 Axis configurations for some gamepad types:
2304 13.1 XBox360 controller:
2306 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be
2309 set-axis joystick0axis2 pressure-+
2311 set-axis joystick0axis5 pressure-+
2313 • This is needed for SDL only. EVDEV sets those types correctly.
2315 13.2 PS3 “sixaxis” controller:
2317 Axes 8-19 should be disabled.
2319 set-axis joystick0axis8 disabled
2321 set-axis joystick0axis9 disabled
2323 set-axis joystick0axis10 disabled
2325 set-axis joystick0axis11 disabled
2327 set-axis joystick0axis12 disabled
2329 set-axis joystick0axis13 disabled
2331 set-axis joystick0axis14 disabled
2333 set-axis joystick0axis15 disabled
2335 set-axis joystick0axis16 disabled
2337 set-axis joystick0axis17 disabled
2339 set-axis joystick0axis18 disabled
2341 set-axis joystick0axis19 disabled
2345 14.1 Problems from BSNES core:
2347 • The whole pending save stuff.
2349 • Lack of layer hiding.
2351 • It is slow (especially accuracy).
2353 • Firmwares can't be loaded from ZIP archives.
2355 14.2 Other problems:
2357 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2359 • Audio for last dumped frame is not itself dumped.
2361 • Audio in UI is pretty bad in quality if game doesn't run at
2364 • AVI compression levels 10-18 are not compatible with AVISynth
2367 • No menus, command based interface (SDL).
2369 • Long commands don't scroll.
2371 • Wxwidgets UI is still buggy.
2377 • Fix -Wall warnings
2379 • Fix dumper video corruption with levels 10-18.
2385 • Lots of code cleanups
2387 • Lua interface to settings
2389 • Allow specifying AVI borders without Lua
2391 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2393 • on_snoop lua callback
2395 • Faster movie loading and saving.
2405 • Save jukebox functionality.
2409 • Try to fix some nasty failing movie load edge cases
2411 • Allow specifying scripts to run on command line.
2415 • Major source code reorganization.
2417 • Backup savestates before overwriting.
2419 • Don't crash if loading initial state fails.
2423 • Fix firmware lookup
2425 • Fix author name parsing
2427 • Fix rerecord counting
2429 • (SDL) Print messages to console if SDL is uninitialized
2431 • Add movieinfo program
2433 • Fix loading movies starting from SRAM.
2437 • Add support for unattended dumping
2439 • Fix compiling for Win32
2441 • Don't lock up if sound can't be initialized
2443 • Strip trailing CR from commands
2445 • Don't try to do dubious things in global ctors (fix crash on
2450 • Small documentation tweaking
2454 • Fix major bug in modifier matching
2458 • Lots of documentation fixes
2460 • Use dedicated callbacks for event backcomm., not commands.
2462 • Ensure that the watchdog is not hit when executing delayed
2465 • Remove errant tab from joystick message.
2469 • Make autofire operate in absolute time, not linear time
2471 • Reinitialize controls when resuming from loadstate
2473 • Some more code cleanups
2475 • If Lua allocator fails, call OOM_panic()
2477 • Byte/word/dword/qword sized host memory write/read functions.
2479 • Dump at correct framerate if dumping interlaced NTSC
2484 • Actually include the complete source code
2490 • Document {save,start}time.{,sub}second.
2492 • Intercept time() from bsnes core.
2496 • Allow disabling time() interception (allow build on Mac OS X)
2498 • Use SDLMain on Mac OS X (make SDL not crash)
2500 • Disable delayed resets (just plain too buggy for now).
2504 • Use 16-bit for graphics/video instead of 32-bit.
2506 • gui.rectangle/gui.pixel
2510 • New CSCD writer implementation.
2514 • Fix interaction of * and +.
2516 • Manual improvements
2518 • Use gettimeofday()/usleep(), these seem portable enough.
2520 • Move joystick axis manipulation to keymapper code.
2522 • Changes to how read-only works.
2524 • Refactor controller input code.
2528 • Fix mouseclick scale compensation.
2530 • Draw area boundaries correctly in SDL code.
2534 • Fix CSCD output (buffer overrun and race condition).
2538 • JMD dumping support.
2540 • Allow unattended dumping to JMD.
2542 • Move to BSNES v083.
2544 • Switch back to 32-bit colors.
2546 • Add Lua function gui.color.
2548 • Use some new C++11 features in GCC 4.6.
2550 • Be prepared for core frequency changes.
2552 • Pass colors in one chunk from Lua.
2556 • New lua functions gui.line(), gui.status() and gui.circle(),
2557 memory.vma_count(), memory.read_vma() and memory.find_vma().
2559 • Numerious documentation fixups
2561 • RTC time format changed
2563 • Reformat flags display
2565 • Allow lua package name to be overridden
2567 • SDUMP (high-quality dumping).
2569 • Split platform support to plugins.
2571 • Make all sound plugins support basic sound commands
2573 • Support portaudio for sound.
2575 • Allow disable Lua/SDL searching.
2577 • Upconvert colors when copying lcscreen to screen.
2579 • Reorganize source tree.
2581 • Evdev joystick support.
2583 • Refactor more code into generic window code.
2587 • Refactor message handling.
2591 • Documentation fixes
2593 • Finish pending saves before load/quit.
2595 • Wxwidgets graphics plugin.
2599 • Get rid of win32-crap.[ch]pp.
2601 • Move files around a lot.
2603 • Get rid of need for host C++ compiler.
2607 • Refactor inter-component communication.
2611 • Fix crash on multiline aliases.
2613 • Load/Save settings in wxwidgets gui.
2617 • Patch problems in bsnes core
2619 • SNES is little-endian, not big-endian!
2621 • Fix memory corruption in lcscreen::load()
2625 • Fix interpretting repeat counts in rrdata loading.
2627 • New lua callback: on_frame()
2629 • Remove calls to runtosave() that aren't supposed to be there
2631 • Lua function: movie.read_rtc()
2633 • Ignore src/fonts/font.cpp
2635 • Fix more bsnes core problems
2637 • Control bsnes random seeding
2641 • Some bsnes core debugging features (state dump and state hash)
2643 • Fix titlebar version number (no, the last version wasn't
2644 'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2648 • Fix memory corruption due to macro/field mixup
2650 • search-memory update
2652 • Allow direct-mapped framebuffer
2654 • SDL: Use SDL_ANYFORMAT if possible
2656 • SDMP2SOX: 2s delay modes.
2658 • Wxwidgets: Cleanups
2660 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2662 • Wxwidgets: Save jukebox on exit
2664 • Fix RTC if using load-movie on savestate.
2666 • Fix crash related to full console mode.
2670 • Wxwidgets: Allow bringing application to foreground on Mac OS
2673 • Wxwidgets: Allow compiling on Mac OS X.
2675 • Use movie compare instead of movie hashing (faster save/load).
2677 • Lua: _SYSTEM table.
2681 • sdmp2sox: Pad soundtrack if using -l or -L.
2683 • sdmp2sox: Fix NTSC overscan.
2685 • sdmp2sox: Add AR correction mode.
2687 • call lua_close() when exiting.
2689 • Fix zip_writer bug causing warnings from info-zip and error
2694 • Fix IPS patching code (use bsnes core IPS patcher).
2696 • Implement BPS patching (using bsnes core IPS patcher).
2698 • Add feature to load headered ROMs.
2702 • Show command names when showing keybindings
2706 • Fix pause-on-end to be actually controllable
2708 • SDL: Poll all events in queue, not just first one (fixes
2709 slowness in command typing)
2711 • Wxwidgets: Fix ROM loading.
2715 • Lua: Add gui.textH, gui.textV, gui.textHV
2717 • Fix text colors on SDL on Mac OS X
2719 • Mode 'F' for finished in readonly mode.
2721 • Fix some WS errors.
2723 • Reliably pause after skip poll
2725 • Split UI and core into their own threads
2729 • Remove leftover dummy SRAM slot
2731 • Fix controller numbers.
2735 • Fix lsnes-dumpavi after interface change.
2737 • Also give BSNES patches for v085.
2739 • Pack movie data in memory.
2743 • Fix framecount/length given when loading movies.
2745 • Controller command memory leak fixes.
2747 • Don't leak palette if freeing screen object.
2753 • Wxwidgets: Allow controlling dumper from the menu.
2757 • Rewrite parts of manual
2759 • Lua: Make it work with Lua 5.2.
2763 • Win32: Fix compile errors.
2767 • Refactor controller input code.
2769 • Fix crash when using command line on SDL / Mac OS X.
2773 • Delete core/coroutine (obsolete)
2775 • Lag input display by one frame.
2777 • Rewind movie to beginning function.
2779 • Fix wrong frame number reported to Lua when repainting after
2782 • Support UI editing of jukebox
2784 • Wxwidgets: Save settings on exit.
2786 • Support ${project} for filenames
2788 • SDL: Fix command history
2792 • Fix some order-of-global-ctor bugs.
2796 • Fix crashes when quitting on Win32.
2800 • EVDEV: Queue keypresses from joystick, don't send directly
2802 • Wxwidgets: Load-Preserve that actually works.
2806 • Wxwidgets: GUI for memory search.
2808 • Warn about using synchronous queue in UI callback.
2812 • Remember last saved file for each ROM
2814 • Support MT dumping via boost.
2818 • Lua: input.keyhook
2820 • Make mouse be ordinary input instead of special-casing
2822 • SDL: Don't screw up commands with NUL codepoints.
2826 • Merge status panel and main window
2828 • True movie slot support (the rest of it)
2830 • SDL: Fix compilation error
2832 • Elminate cross calls in dump menu code.
2836 • Cancel pending saves command
2838 • Wxwidgets: Code refactoring
2840 • Wxwidgets: Fix system -> reset
2842 • Wxwidgets: Read watch expressions in the right thread
2846 • Wxwidgets: Don't prompt for member when running Lua script (Lua
2847 doesn't support that).
2849 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are
2852 • Don't append trailing '-' to prefix when saving movie.
2854 • Fix ROM/savestate handling (don't let user mismatch ROM and
2859 • Document memory watch syntax.
2863 • Fix unattended dumping (lsnes-dumpavi)
2865 • Support RAW dumping
2867 • Use adv_dumper instead of the old interface in lsnes-dumpavi
2870 • Add option to control sample rate preturbation in AVI dumper
2874 • Wxwidgets: Fix dumper submodes
2876 • Set core controller types before loadstate
2878 15.49 rr1-delta2epsilon1
2880 • Fix compiling with bsnes v086.
2884 • Don't prompt before quitting
2886 • Start unpaused, preserve pause/unpause over load.
2888 • Try to autodetect if ROM is headered.
2890 • Wxwidgets: Only bring up ROM patching screen if specifically
2893 • Allow configuring some hotkeys.
2897 • Lots of code cleanups
2899 • Fix JMD compression (JMD dumping was broken)
2901 • Don't crash if Lua C function throws an exception.
2903 • Support bitmap drawing in Lua.
2905 • Fix bsnes v085/v086 patches.
2907 • Improve stability on win32.
2909 15.52 rr1-delta4epsilon1
2911 • Don't corrupt movie if movie length is integer multiple of
2916 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2918 • New Lua functions: emulator_ready(), utime(),
2919 set_idle_timeout(), set_timer_timeout(), bit.extract(),
2920 bit.value(), input.geta(), input.seta() and
2921 input.controllertype()
2923 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2925 • Wxwidgets: Fix broken modifiers
2927 • on_paint has parameter now.
2929 • Optional initital fill for bitmaps
2931 • Fix palette changing.
2933 • Optimize rendering a bit.
2935 • Bsnes v087 support.
2937 15.54 rr1-delta5epsilon1
2939 • Movieinfo: Fix display of port #2 type.
2941 • Call on_input() after loadstate.
2943 15.55 rr1-delta5epsilon2
2945 • Fix writing port2 data to movie.
2947 • Fix SRAM handling with Bsnes v087.
2951 • Library loading support
2953 • Built-in TSCC encoder
2955 • Hi-color (256T colors) dumping.
2957 • Dump over TCP/IP(v6)
2959 • Hidable status panel
2963 • Adjustable sound volume
2967 • Allow DnD into filename boxes
2969 • Configurable paths
2971 • Portaudio: Fix speaker popping at start
2973 • Lots of UI changes
2975 • Speed adjustment menu
2977 • Win32 joystick support
2979 • Lua: gui.rainbow and gui.box
2981 • Split key lists into classes (the key list was large!)
2983 • More save slots support
2985 • Wxwidgets (wxJoystick) joystick support
2989 • Lots of internal joystick refactoring
2991 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
2993 • Wxwidgets: Settings mode (open settings without ROM)
2995 • Wxwidgets: Prompt key to use option
2997 • Wxwidgets: Fix crash if key goes away underneath
2999 • Wxwidgets: Fix mouse position in presence of scaling
3001 • AVI dumper: Mode 4 (high-quality resampling to common rate
3004 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree
3005 control doesn't seem to work well on WinXP)
3007 • Start paused option.
3009 15.58 rr1-delta7epsilon1
3013 • lsnes-dumpavi: Start Lua before starting dumper
3015 • AVI: Fix secondary audio in mode 4.
3017 15.59 rr1-delta7epsilon2
3019 • AVI: Refactor ZMBV a bit.
3021 • Fix error reading analog values from movie file
3025 • Delayed reset support
3027 • Lua: memory.hash_region
3029 15.61 rr1-delta8epsilon1
3031 • Rework the build system
3033 • Typing input support
3035 • Fix building with bsnes v086 and v087.
3037 • SDL: Save settings on exit
3039 • SDL: Command to enter command line mode with given command.
3041 • SDL: More advanced command editing.
3045 • wxMSW: Fix the “arrow keys and enter don't work” problem
3049 • Show mode changes due to rewinding.
3051 • Unsafe rewind support
3053 • Fix directory transversal.
3057 • AVI: Sound mode 5 (48kHz high-quality)
3061 • Map the SNES bus into address space
3063 • Fix loading memory watch files with CRLF line endings
3065 15.64 rr1-delta10epsilon1
3067 • Map bsnes internal state into memory space
3069 • Fix the “click on panel wedges the emulator” for real.
3071 • DnD movies/saves on the main window.
3075 • Split core bindings into own module.
3077 • Remember invalid settings
3079 • Support for modified Gambatte core for GB/GBC emulation.
3081 • Reload/swap ROM function
3083 15.66 rr1-delta11epsilon1
3085 • Fix step poll function