Suppost boost threads for MT dumping
[lsnes.git] / manual.txt
blobc370ff373a45283034dcc83be7e34d85230076db
1 1 Introduction
3 lsnes is SNES rerecording emulator based on bsnes core.
5 2 Dependencies
7 1. bsnes libsnes
9   (a) v084 or 085
11   (b) accuracy or compatiblity core.
13   (c) Patched version (using included 6 patches)
15 2. Zlib
17 3. boost_iostreams
19 4. boost_filesystem
21 5. boost_thread
23 6. libsdl (SDL only)
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.
40 3 Building
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. 
49   – Default is blank.
51 • CC=<name>
53   – Name of C++ compiler.
55   – CROSS_PREFIX is prepended if compiling for target 
56     architecture.
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 
61     from Macports.
63   – Default is 'g++'.
65 • HOSTCC=<name>
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 
74     architecture.
76   – Default is blank.
78 • USER_CFLAGS=<flags>
80   – Extra flags to pass when compiling for target architecture
82   – Default is blank.
84 • USER_LDFLAGS=<flags>: 
86   – Extra flags to pass when linking for target architecture.
88   – Default is blank.
90 • USER_PLATFORM_CFLAGS=<flags>
92   – Extra flags to pass when compiling files using 
93     platform-dependent code for target architecture.
95   – Default is blank.
97 • USER_PLATFORM_LDFLAGS=<flags>
99   – Extra flags to pass when linking files using 
100     platform-dependent code for target architecture.
102   – Default is blank.
104 • FONT_SRC=<file>
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 
113       Unicode BMP)
115   – Default is 'unifontfull-5.1.20080820.hex'
117 • LUA=<package>
119   – Package to use for Lua support.
121   – Usually valid value is 'lua' or 'lua5.1'.
123   – Default is not to build Lua support.
125 • THREADS=<value>
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 
138     threading.
140 • BSNES_IS_COMPAT=<anything>
142   – Signals that BSNES core used is compatiblity core, not 
143     accuracy core.
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.
157   – Default is SDL.
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
169   – Default is SDL.
171 • GRAPHICS=<implementation>
173   – Set windowing library to use. Valid values are:
175     ∗ SDL: Use SDL for graphics
177     ∗ WXWIDGETS: Use wxWidgets for graphics.
179   – Default is SDL.
181 4 Command line options
183 4.1 ROM 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.
193 • dmg: DMG game 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 --headered-<kind>=<file> (lsnes/SDL, lsnes-avidump)
205 Load <file> as specified ROM, stripping first 512 bytes. Handy 
206 for loading SMC / FIG and such files.
208 4.1.3 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
210 Override hardware detection for ROM, reading the values from 
211 <file> (BSNES XML format).
213 4.1.4 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
215 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple 
216 times, the patches are applied in order.
218 4.1.5 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
220 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified 
221 multiple times, the patches are applied in order.
223 4.1.6 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
225 Set offset to apply to IPS patches. May be negative. Handy for 
226 applying headered IPS patches (use offset of -512 for this). The 
227 offset must be 0 for BPS patches.
229 4.1.7 --pal
231 Force ROM to be considered PAL-only.
233 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
235 • Attempting to load NTSC movie file will error out.
237 4.1.8 --ntsc
239 Force ROM to be considered NTSC-only.
241 • Attempting to load PAL movie file will error out.
243 4.2 Session options
245 4.2.1 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
247 Load <filename> as movie or savestate file. All other session 
248 options are ignored.
250 4.2.2 --port1=<device> (lsnes/SDL)
252 Set type of port1. Valid values are:
254 • none: No device connected
256 • gamepad: One gamepad (the default)
258 • multitap: Four gamepads (warning: makes most games refuse to 
259   start)
261 • mouse: Mouse.
263 4.2.3 --port2=<type> (lsnes/SDL)
265 Set type of port2. Valid values are:
267 • none: No device connected (the default)
269 • gamepad: One gamepad
271 • multitap: Four gamepads.
273 • mouse: Mouse
275 • superscope: Super Scope
277 • justifier: One justifier
279 • justifiers: Two justifiers
281 4.2.4 --gamename=<name> (lsnes/SDL)
283 Set the name of game to <name>. Default is blank.
285 4.2.5 --author=<name> (lsnes/SDL)
287 Add author with full name of <name> (no nickname).
289 4.2.6 --author=|<name> (lsnes/SDL)
291 Add author with nickname of <name> (no full name).
293 4.2.7 --author=<fullname>|<nickname> (lsnes/SDL)
295 Add author with full name of <fullname> and nickname of 
296 <nickname>.
298 4.2.8 --rtc-second=<value> (lsnes/SDL)
300 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is 
301 1,000,000,000.
303 4.2.9 --rtc-subsecond=<value> (lsnes/SDL)
305 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
307 4.3 Misc. options:
309 4.3.1 --run=<file> (lsnes/SDL)
311 After running main RC file, run this file. If multiple are 
312 specified, these execute in order specified.
314 4.4 dump options (lsnes-dumpavi only)
316 4.4.1 --prefix=<prefix>
318 Set dump prefix. Default is “avidump”.
320 4.4.2 --level=<level>
322 Set compression level (0-18). Default is 7.
324 4.4.3 --length=<length>
326 Set number of frames to dump. Mandatory.
328 4.4.4 --lua=<script>
330 Run specified lua script (lsnes-dumpavi does not have 
331 initialization files).
333 4.4.5 --jmd
335 Use JMD dumping instead of AVI dumping.
337 4.4.6 --sdmp
339 Use SDMP dumping instead of AVI dumping.
341 4.4.7 --ss
343 Dump in single segment (SDMP only).
345 5 Startup file lsnes.rc
347 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as 
348 commands. This file is located in:
350 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
352 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME 
353   exists)
355 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
357 • All: ./lsnes.rc (fallback default).
359 If leading directories do not exist, attempt to create them is 
360 made.
362 6 Internal commands
364 • Commands beginning with '*' invoke the corresponding command 
365   without alias expansion.
367 • If command starts with '+' (after possible '*'), the command is 
368   executed as-is when button is pressed, and when button is 
369   released, it is executed with '+' replaced by '-'.
371 • Commands without '+' execute only on negative edge (release).
373 6.1 Settings:
375 Settings control various aspects of emulator behaviour.
377 6.1.1 set-setting <setting> <value>
379 Sets setting <setting> to value <value> (may be empty).
381 6.1.2 unset-setting <setting>
383 Try to unset setting <setting> (not all settings can be unset).
385 6.1.3 get-setting <setting>
387 Read value of setting <setting>
389 6.1.4 show-settings
391 Print names and values of all settings.
393 6.2 Keybindings
395 Keybindings bind commands or aliases to keys (or pseudo-keys). 
397 Notes:
399 • Do not bind edge active (+/-) commands to keys with modifiers, 
400   that won't work right!
402 • Names of keys and modifiers are platform-dependent.
404 • Be careful before binding pseudo-keys (such as joystick axes, 
405   buttons or hats) with modifiers. That may or may not work 
406   right.
408 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
410 Bind <command> to key <key> (activating if modifiers in <modmask> 
411 (comma-seperated list) are set as <mod> (comma-seperated list).
413 The names of keys and modifiers are platform-dependent.
415 6.2.2 unbind-key [<mod>/<modmask>] <key>
417 Unbind command from <key> (with specified <mod> and <modmask>).
419 6.2.3 set-axis <axis> [disabled | axis | axis-inverse | 
420   pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0 
421   | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>] 
422   [tolerance=<val>]
424 Set axis parameters for axis <axis>.
426 • disabled: Disable axis
428 • axis: Normal axis
430 • axis-inverse: Inverse axis
432 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
434 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
436 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
438 • pressure-+: Pressure sensitive. Released at -, pressed at +.
440 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
442 • pressure+-: Pressure sensitive. Released at +, pressed at -.
444 • minus=<val>: Calibration at extreme minus position 
445   (-32768-32767)
447 • zero=<val>: Calibration at neutral position (-32768-32767)
449 • plus=<val>: Calibration at extreme plus position (-32768-32767)
451 • tolerance=<value>: Center band tolerance (0<x<1). The smaller 
452   the value, the more sensitive the control is.
454 6.2.4 show-bindings
456 Print all key bindings in effect.
458 6.3 Aliases
460 Aliases bind command to sequence of commands. After alias has 
461 been defined, it replaces the command it shadows.
463 Notes:
465 • You can't alias command to itself.
467 • Aliases starting with +/- are edge active just like ordinary 
468   commands starting with +/-.
470 • One command can be aliased to multiple commands.
472 6.3.1 alias-command <command> <expansion>
474 Append <expansion> to alias <command>. If alias does not already 
475 exist, it is created.
477 6.3.2 unalias-command <command>
479 Clear alias expansion for <command>.
481 6.3.3 show-aliases
483 Print all aliases and their expansions in effect.
485 6.4 run-script <script>
487 Run <script> as if commands were entered on the command line.
489 6.5 Video dumping
491 Following commands control video dumping:
493 6.5.1 dump-avi <prefix>
495 Dump AVI video to prefix <prefix> Notes:
497 • The codec is Camstudio Codec in gzip mode.
499 • Encoder and muxer are internal, available on all platforms.
501 • Audio enable/disable and framerate has no effect.
503 • The audio dumped to .avi is low-quality version. The 
504   high-quality version is dumped to .sox file.
506 6.5.2 end-avi
508 End current AVI video dump (closing the emulator also closes the 
509 dump).
511 6.5.3 dump-jmd <file>
513 Dump JMD video to file <file>.
515 6.5.4 end-jmd
517 End the current JMD dump in progress.
519 6.5.5 dump-sdmp <prefix>
521 Dump SDMP to <prefix>, splitting at 2GB.
523 6.5.6 dump-sdmp-ss <file>
525 Dump SDMP to <file>, no splitting
527 6.5.7 end-sdmp
529 End the current SDMP dump in progress.
531 6.6 Memory manipulation
533 <address> may be decimal or hexadecimal (prefixed with '0x'). 
534 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
535 signed (prefixed with '-') decimal.
537 The available element <sizes> are:
539 • byte: 1 byte
541 • word: 2 bytes
543 • dword: 4 bytes
545 • qword: 8 bytes
547 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
548 When dealing with DSP memory, multi-byte reads/writes are 
549 native-endian (do not use operand sizes exceeding DSP bitness, 
550 except dword is OK for 24-bit memory).
552 6.6.1 read-<size> <address>
554 Read the value of byte in <address>.
556 6.6.2 read-s<size> <address>
558 Read the value of signed byte in <address>.
560 6.6.3 write-<size> <address> <value>
562 Write <value> to byte in address <address>.
564 6.6.4 search-memory reset
566 Reset the memory search
568 6.6.5 search-memory count
570 Print number of candidates remaining
572 6.6.6 search-memory print
574 Print all candidates remaining
576 6.6.7 search-memory <usflag><sizeflag><op>
578 Searches memory for addresses satisfying criteria.
580 <usflag> can be:
582 • u: unsigned
584 • s: signed
586 <sizeflag> can be:
588 • b: byte
590 • w: word
592 • d: dword
594 • q: qword
596 <op> can be:
598 • lt: < previous value.
600 • le: <= previous value.
602 • eq: = previous value.
604 • ne: != previous value.
606 • ge: >= previous value.
608 • gt: > previous value.
610 6.6.8 search-memory <sizeflag> <value>
612 Searches for addresses that currently have value <value>. 
613 <sizeflag> is as in previous command.
615 6.7 Main commands
617 These commands are not available in lsnesrc, but are available 
618 after ROM has been loaded.
620 6.7.1 quit-emulator [/y]
622 Quits the emulator (asking for confirmation). If /y is given, no 
623 confirmation is asked.
625 6.7.2 pause-emulator
627 Toggle paused/unpaused
629 6.7.3 +advance-frame 
631 Advance frame. If the button is still held after configurable 
632 timeout expires, game unpauses for the duration frame advance is 
633 held.
635 6.7.4 +advance-poll 
637 Advance subframe. If the button is still held after configurable 
638 timeout expires, game unpauses for the duration frame advance is 
639 held.
641 6.7.5 advance-skiplag 
643 Skip to first poll in frame after current.
645 6.7.6 reset 
647 Reset the SNES after this frame.
649 6.7.7 load <filename> 
651 Load savestate <filename> in current mode.
653 6.7.8 load-state <filename> 
655 Load savestate <filename> in readwrite mode.
657 6.7.9 load-readonly <filename> 
659 Load savestate <filename> in readonly mode.
661 6.7.10 load-preserve <filename> 
663 Load savestate <filename> in readonly mode, preserving current 
664 events.
666 6.7.11 load-movie <filename> 
668 Load savestate <filename>, ignoring save part in readonly mode.
670 6.7.12 save-state <filename> 
672 Save system state to <filename> as soon as possible.
674 6.7.13 save-movie <filename> 
676 Save movie to <filename>.
678 6.7.14 set-rwmode 
680 Set read-write mode.
682 6.7.15 set-romode 
684 Set read-only mode
686 6.7.16 toggle-rwmode 
688 Toggle between read-only and read-write modes.
690 6.7.17 set-gamename <name> 
692 Set name of the game to <name>
694 6.7.18 get-gamename 
696 Print the name of the game.
698 6.7.19 add-author <author> 
700 Adds new author <author>. If <author> does not contain '|' it is 
701 full name. If it contains '|', '|' splits the full name and 
702 nickname.
704 6.7.20 edit-author <num> <author> 
706 Edit the author in slot <num> (0-based) to be <author> (see 
707 add-author for format)
709 6.7.21 remove-author <num> 
711 Remove author in slot <num>
713 6.7.22 print-authors 
715 Print authors.
717 6.7.23 test-1, test-2, test-3
719 Internal test commands. Don't use.
721 6.7.24 take-screenshot <filename> 
723 Save screenshot to <filename>.
725 6.7.25 +controller<num><button>
727 Press button <button> on controller <num> (1-8). The following 
728 button names are known:
730 • left
732 • right
734 • up
736 • down
738 • A
740 • B
742 • X
744 • Y
746 • L
748 • R
750 • select
752 • start
754 • trigger
756 • cursor
758 • pause
760 • turbo
762 6.7.26 controllerh<num><button>
764 Hold/unhold button <button> on controller <num> (1-8). See 
765 +controller for button names.
767 6.7.27 autofire (<pattern>|-)...
769 Set autofire pattern. Each parameter is comma-separated list of 
770 button names (in form of 1start, 1A, 2B, etc..) to hold on that 
771 frame. After reaching the end of pattern, the pattern restarts 
772 from the beginning.
774 6.7.28 repaint
776 Force a repaint.
778 6.8 Save jukebox 
780 6.8.1 cycle-jukebox-backward
782 Cycle save jukebox backwards.
784 6.8.2 cycle-jukebox-forward
786 Cycle save jukebox forwards
788 6.8.3 add-jukebox-save <filename>
790 Add <filename> to jukebox saves.
792 6.8.4 load-jukebox
794 Do load from jukebox (current mode).
796 6.8.5 save-jukebox
798 Do state save to jukebox.
800 6.9 Lua 
802 Only available if lua support is compiled in.
804 6.9.1 evaluate-lua <luacode>
806 Run Lua code <luacode> using built-in Lua interpretter.
808 6.9.2 run-lua <script>
810 Run specified lua file using built-in Lua interpretter.
812 6.10 Memory watch
814 6.10.1 add-watch <name> <expression>
816 Adds new watch (or modifies old one).
818 6.10.2 remove-watch <name>
820 Remove a watch.
822 6.11 Sound 
824 6.11.1 enable-sound <on/off> 
826 Enable/Disable sound.
828 6.11.2 set-sound-device <device> 
830 Set sound device to <device>
832 6.11.3 show-sound-status 
834 Show status of sound system.
836 6.11.4 show-sound-devices
838 Show all available devices.
840 6.12 SDL Platform commands 
842 The following are valid on SDL platform.
844 6.12.1 identify-key
846 Asks to press a key and then identifies that (pseudo-)key.
848 6.12.2 toggle-console 
850 Toggle between windowed/fullscreen console.
852 6.12.3 scroll-fullup 
854 Scroll messages window as far back as it goes.
856 6.12.4 scroll-fulldown 
858 Scroll messages window as far forward as it goes.
860 6.12.5 scroll-up 
862 Scroll messages window back one screenful.
864 6.12.6 scroll-down 
866 Scroll messages window forward one screenful.
868 7 Settings
870 7.1 Core settings
872 7.1.1 firmwarepath
874 Set where bsnes looks for firmware files. Default is “.”.
876 7.1.2 targetfps
878 Set the target fps. Numeric, range is 0.001 to “infinite”. 
879 Default is native framerate.
881 7.1.3 savecompression
883 Set save compression level (integer 0-9). Default is 7 (0 is no 
884 compression).
886 7.1.4 advance-timeout
888 Set the frame advance timeout in milliseconds. Numeric integer, 
889 range is 0-999999999. Default is 500.
891 7.2 AVI dumper settings
893 7.2.1 avi-large
895 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
896 the console outputs.
898 7.2.2 avi-left-border
900 AVI dumper: Set the default left border thickness (unless lua 
901 overrides) for dumps. Range 0-8191. Default is 0.
903 7.2.3 avi-right-border
905 AVI dumper: Set the default right border thickness (unless lua 
906 overrides) for dumps. Range 0-8191. Default is 0.
908 7.2.4 avi-top-border
910 AVI dumper: Set the default top border thickness (unless lua 
911 overrides) for dumps. Range 0-8191. Default is 0.
913 7.2.5 avi-bottom-border
915 AVI dumper: Set the default bottom border thickness (unless lua 
916 overrides) for dumps. Range 0-8191. Default is 0.
918 7.2.6 avi-maxframes
920 AVI dumper: Maximum number of frames per dump segment (0 => 
921 unlimited). Range 0-999999999. Default is 0.
923 7.2.7 avi-compresison
925 AVI dumper: Compression level (0-18).
927 • Compression levels 10 and above are not compatible with stock 
928   CSCD codec.
930 • Recomended level is 7.
932 7.3 JMD options
934 7.3.1 jmd-copression
936 JMD dumper: Compression level (0-9).
938 7.4 SDL platform settings
940 7.4.1 autorepeat-first-delay
942 Sets the delay for first character in typematic autorepeat.
944 7.4.2 autorepeat-subsequent-delay
946 Sets the delay for subsequent characters in typematic autorepeat.
948 8 Lua functions
950 8.1 Core (in main table)
952 8.1.1 print
954 Print line to message console.
956 8.1.2 exec(string command)
958 Run command as it was entered on the command line
960 8.2 Table bit:
962 Bitwise logical functions and related.
964 8.2.1 bit.none(number...) / bit.bnot(number...)
966 48-bit bitwise NOT / NONE function (set bits that are set in none 
967 of the arguments).
969 8.2.2 bit.any(number...) / bit.bor(number...)
971 48-bit bitwise OR / ANY function (set bits that are set in any of 
972 the arguments).
974 8.2.3 bit.all(number...) / bit.band(number...)
976 48-bit bitwise AND / ALL function (set bits that are set in all 
977 of the arguments).
979 8.2.4 bit.parity(number...) / bit.bxor(number...)
981 48-bit bitwise XOR / PARITY function (set bits that are set in 
982 odd number of the arguments).
984 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
986 Rotate bits-bit (max 48, default 48) number left by amount 
987 (default 1) places.
989 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
991 Rotate bits-bit (max 48, default 48) number right by amount 
992 (default 1) places.
994 8.2.7 bit.lshift(number base[, number amount[, number bits]])
996 Shift bits-bit (max 48, default 48) number left by amount 
997 (default 1) places. The new bits are filled with zeroes.
999 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1001 Shift bits-bit (max 48, default 48) number logically right by 
1002 amount (default 1) places. The new bits are filled with zeroes.
1004 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1006 Shift bits-bit (max 48, default 48) number arithmetically right 
1007 by amount (default 1) places. The new bits are shifted in with 
1008 copy of the high bit.
1010 8.3 Table gui:
1012 Most of these functions can only be called in on_paint and 
1013 on_video callbacks. Exceptions are noted.
1015 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
1016 the green component, bits 16-23 are the red component, bits 24-31 
1017 are alpha component (0 is fully opaque, 255 is almost 
1018 transparent). -1 is the fully transparent color. Alpha values 
1019 greater than 127 do work.
1021 Origin of coordinates is at top left corner of game display area. 
1022 Left and top gaps correspond to negative coordinates.
1024 8.3.1 gui.resolution()
1026 Returns 2-tuple (hresolution, vresolution).
1028 8.3.2 gui.<class>_gap(number gap)
1030 Set the <class> (left, right, top, bottom) gap to specified value 
1031 (max gap is 8191).
1033 8.3.3 gui.text(number x, number y, string text[, number fgc[, 
1034   number bgc]])
1036 Draw specified text on the GUI (each character cell is 8 or 16 
1037 wide and 16 high). Parameters:
1039 • x: X-coordinate to start the drawing from (and x-coordinate at 
1040   begining of the lines).
1042 • y: Y-coordinate to start the drawing from.
1044 • text: The text to draw.
1046 • fgc: Text color (default is 0xFFFFFF (white))
1048 • bgc: Background color (default is -1 (transparent))
1050 8.3.4 gui.textH(number x, number y, string text[, number fgc[, 
1051   number bgc]])
1053 Like gui.text, but draw using double-width.
1055 8.3.5 gui.textV(number x, number y, string text[, number fgc[, 
1056   number bgc]])
1058 Like gui.text, but draw using double-height.
1060 8.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
1061   number bgc]])
1063 Like gui.text, but draw using double-width/double-height.
1065 8.3.7 gui.rectangle(number x, number y, number width, number 
1066   height[, number thickness[, number outline[, number fill]]])
1068 Draw rectangle on the GUI. Parameters:
1070 • x: X-coordinate of left edge.
1072 • y: Y-coordinate of upper edge.
1074 • width: Width of rectangle.
1076 • height: Height of rectangle.
1078 • thickness: Thickness of outline (default is 1).
1080 • outline: Color of outline (default is 0xFFFFFF (white))
1082 • fill: Color of fil (default is -1 (transparent))
1084 8.3.8 gui.pixel(number x, number y[, number color])
1086 Draw one pixel on the GUI. Parameters:
1088 • x: X-coordinate of the pixel
1090 • y: Y-coordinate of the pixel
1092 • color: Color of the pixel (default is 0xFFFFFF (white))
1094 8.3.9 gui.crosshair(number x, number y[, number length[, number 
1095   color]])
1097 Draw a crosshair. Parameters:
1099 • x: X-coordinate of the crosshair
1101 • y: Y-coordinate of the crosshair
1103 • length: Length of the crosshair lines (default 10).
1105 • color: Color of the crosshair (default is 0xFFFFFF (white))
1107 8.3.10 gui.line(number x1, number y1, number x2, number y2[, 
1108   number color])
1110 Draw a thin line. Parameters:
1112 • x1: X-coordinate of one end.
1114 • y1: Y-coordinate of one end.
1116 • x2: X-coordinate of the other end.
1118 • y2: Y-coordinate of the other end.
1120 • color: Color of the line (default is 0xFFFFFF (white)).
1122 8.3.11 gui.circle(number x, number y, number r[, number thick[, 
1123   number border[, number fil]]])
1125 Draw a circle. Parameters.
1127 • x: X-coordinate of the center
1129 • y: Y-coordinate of the center
1131 • r: The radius of the circle
1133 • thick: Border thickness
1135 • border: Border color (default is 0xFFFFFF (white))
1137 • fill: Fill color (default is -1 (transparent)).
1139 8.3.12 gui.repaint()
1141 Request on_repaint() to happen as soon as possible. Can be used 
1142 anywhere.
1144 8.3.13 gui.subframe_update(boolean on)
1146 Request subframe updates (calling on_paint() on subframes) to 
1147 happen (on=true) or not happen (on=false). Can be used anywhere.
1149 8.3.14 gui.screenshot(string filename)
1151 Write PNG screenshot of the current frame (no drawings) to 
1152 specified file. Can be used anywhere.
1154 8.3.15 gui.color(number r, number g, number b[, number a])
1156 Returns color (in notation Lua scripts use) corresponding to 
1157 color (r,g,b), each component in scale 0-255. If a is specified, 
1158 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1159 The default alpha is 256.
1161 8.3.16 gui.status(string name, string value)
1163 Set status field “L[<name>]” to <value> in status area. Can be 
1164 used anywhere.
1166 8.4 table input
1168 Input handling. Only available in on_input callback.
1170 8.4.1 input.get(number controller, number index)
1172 Read the specified index (0-11) from specified controller (0-7). 
1173 Notes:
1175 • Uses physical controller numbering. Gamepad in port 2 is 
1176   controller 4, not 1!
1178 8.4.2 input.set(number controller, number index, number value)
1180 Write the specified index (0-11) from specified controller (0-7), 
1181 storing value. Notes:
1183 • Uses physical controller numbering. Gamepad in port 2 is 
1184   controller 4, not 1!
1186 8.4.3 input.reset([number cycles])
1188 Execute reset. If cycles is greater than zero, do delayed reset. 
1189 0 (or no value) causes immediate reset.
1191 • Only available with subframe flag false.
1193 8.5 Table hostmemory
1195 Host memory handling (extra memory saved to savestates). Host 
1196 memory starts empty.
1198 8.5.1 hostmemory.read(number address)
1200 Reads hostmemory slot address. Slot numbers out of range return 
1201 false instead of numeric.
1203 8.5.2 hostmemory.write(number address, number value)
1205 Writes hostmemory slot with 0-255. Slot numbers out of range 
1206 cause extension of host memory slot space.
1208 8.5.3 hostmemory.readbyte(number address)
1210 Read unsigned byte (1 element) from given address. Slots out of 
1211 range return false.
1213 8.5.4 hostmemory.writebyte(number address, number value)
1215 Write unsigned byte (1 element) to given slot. Slot numbers out 
1216 of range cause extension.
1218 8.5.5 hostmemory.readsbyte(number address)
1220 Read signed byte (1 element) from given address. Slots out of 
1221 range return false.
1223 8.5.6 hostmemory.writesbyte(number address, number value)
1225 Write signed byte (1 element) to given slot. Slot numbers out of 
1226 range cause extension.
1228 8.5.7 hostmemory.readword(number address)
1230 Read unsigned word (2 elements) from given address. Slots out of 
1231 range return false.
1233 8.5.8 hostmemory.writeword(number address, number value)
1235 Write unsigned word (2 elements) to given slot. Slot numbers out 
1236 of range cause extension.
1238 8.5.9 hostmemory.readsword(number address)
1240 Read signed word (2 elements) from given address. Slots out of 
1241 range return false.
1243 8.5.10 hostmemory.writesword(number address, number value)
1245 Write signed word (2 elements) to given slot. Slot numbers out of 
1246 range cause extension.
1248 8.5.11 hostmemory.readdword(number address)
1250 Read unsigned doubleword (4 elements) from given address. Slots 
1251 out of range return false.
1253 8.5.12 hostmemory.writedword(number address, number value)
1255 Write unsigned doubleword (4 elements) to given slot. Slot 
1256 numbers out of range cause extension.
1258 8.5.13 hostmemory.readsdword(number address)
1260 Read signed doubleword (4 elements) from given address. Slots out 
1261 of range return false.
1263 8.5.14 hostmemory.writesdword(number address, number value)
1265 Write signed doubleword (4 elements) to given slot. Slot numbers 
1266 out of range cause extension.
1268 8.5.15 hostmemory.readqword(number address)
1270 Read unsigned quadword (8 elements) from given address. Slots out 
1271 of range return false.
1273 8.5.16 hostmemory.writeqword(number address, number value)
1275 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1276 out of range cause extension.
1278 8.5.17 hostmemory.readsqword(number address)
1280 Read signed quadword (8 elements) from given address. Slots out 
1281 of range return false.
1283 8.5.18 hostmemory.writesqword(number address, number value)
1285 Write signed quadword (8 elements) to given slot. Slot numbers 
1286 out of range cause extension.
1288 8.6 Table movie
1290 Movie handling
1292 8.6.1 movie.currentframe()
1294 Return number of current frame.
1296 8.6.2 movie.framecount()
1298 Return number of frames in movie.
1300 8.6.3 movie.readonly()
1302 Return true if in readonly mode, false if in readwrite.
1304 8.6.4 movie.set_readwrite()
1306 Set readwrite mode (does not cause on_readwrite callback).
1308 8.6.5 movie.frame_subframes(number frame)
1310 Count number of subframes in specified frame (frame numbers are 
1311 1-based) and return that.
1313 8.6.6 movie.read_subframe(number frame, number subframe)
1315 Read specifed subframe in specified frame and return data as 
1316 array (100 elements, numbered 0-99 currently).
1318 8.7 Table settings
1320 Routines for settings manipulation
1322 8.7.1 settings.get(string name)
1324 Get value of setting. If setting is blank, returns false. If 
1325 setting value can't be obtained, returns (nil, error message).
1327 8.7.2 settings.set(string name, string value)
1329 Set value of setting. If setting can't be set, returns (nil, 
1330 error message).
1332 8.7.3 settings.is_set(string name)
1334 Returns if setting is set. If setting does not exist, returns 
1335 (nil, error message).
1337 8.7.4 settings.blank(string name)
1339 Blanks a setting and returns true. If setting can't be blanked, 
1340 returns (nil, error message).
1342 8.8 Table memory
1344 Contains various functions for managing memory
1346 8.8.1 memory.vma_count()
1348 Returns the number of VMAs
1350 8.8.2 memory.read_vma(number index)
1352 Reads the specified VMA (indices start from zero). Trying to read 
1353 invalid VMA gives nil. The read VMA is table with the following 
1354 fields:
1356 • region_name (string): The readable name of the VMA
1358 • baseaddr (number): Base address of the VMA
1360 • lastaddr (number): Last address in the VMA.
1362 • size (number): The size of VMA in bytes.
1364 • readonly (boolean): True of the VMA corresponds to ROM.
1366 • native_endian (boolean): True if the VMA has native endian as 
1367   opposed to little endian.
1369 8.8.3 memory.find_vma(number address)
1371 Finds the VMA containing specified address. Returns table in the 
1372 same format as read_vma or nil if not found.
1374 8.8.4 memory.readbyte(number address)
1376 Reads the specified address as unsigned byte and returns the 
1377 result.
1379 8.8.5 memory.readsbyte(number address)
1381 Reads the specified address as signed byte and returns the 
1382 result.
1384 8.8.6 memory.writebyte(number address, number value)
1386 Writes the specified value (negative values undergo 2's 
1387 complement) to specified address (as a byte).
1389 8.8.7 memory.readword(number address)
1391 Reads the specified address as unsigned word and returns the 
1392 result.
1394 8.8.8 memory.readsword(number address)
1396 Reads the specified address as signed word and returns the 
1397 result.
1399 8.8.9 memory.writeword(number address, number value)
1401 Writes the specified value (negative values undergo 2's 
1402 complement) to specified address (as a word).
1404 8.8.10 memory.readdword(number address)
1406 Reads the specified address as unsigned doubleword and returns 
1407 the result.
1409 8.8.11 memory.readsdword(number address)
1411 Reads the specified address as signed doubleword and returns the 
1412 result.
1414 8.8.12 memory.writedword(number address, number value)
1416 Writes the specified value (negative values undergo 2's 
1417 complement) to specified address (as a doubleword).
1419 8.8.13 memory.readqword(number address)
1421 Reads the specified address as unsigned quadword and returns the 
1422 result.
1424 8.8.14 memory.readsqword(number address)
1426 Reads the specified address as signed quadword and returns the 
1427 result.
1429 8.8.15 memory.writeqword(number address, number value)
1431 Writes the specified value (negative values undergo 2's 
1432 complement) to specified address (as a quadword).
1434 8.9 Table _SYSTEM
1436 Contains copy of global variables from time of Lua 
1437 initialization. Non-writeable.
1439 8.10 Callbacks
1441 Various callbacks to Lua that can occur.
1443 8.10.1 Callback: on_paint()
1445 Called when screen is being painted. Any gui.* calls requiring 
1446 graphic context draw on the screen.
1448 8.10.2 Callback: on_video()
1450 Called when video dump frame is being painted. Any gui.* calls 
1451 requiring graphic context draw on the video.
1453 8.10.3 Callback: on_frame()
1455 Called on each starting whole frame.
1457 8.10.4 Callback: on_startup()
1459 Called when the emulator is starting (lsnes.rc and --run files 
1460 has been run).
1462 8.10.5 Callback: on_pre_load(string name)
1464 Called just before savestate/movie load occurs (note: loads are 
1465 always delayed, so this occurs even when load was initiated by 
1466 lua).
1468 8.10.6 Callback: on_err_load(string name)
1470 Called if loadstate goes wrong.
1472 8.10.7 Callback: on_post_load(string name, boolean was_savestate)
1474 Called on successful loadstate. was_savestate gives if this was a 
1475 savestate or a movie.
1477 8.10.8 Callback: on_pre_save(string name, boolean is_savestate)
1479 Called just before savestate save occurs (note: movie saves are 
1480 synchronous and won't trigger these callbacks if called from 
1481 Lua).
1483 8.10.9 Callback: on_err_save(string name)
1485 Called if savestate goes wrong.
1487 8.10.10 Callback: on_post_save(string name, boolean is_savestate)
1489 Called on successful savaestate. is_savestate gives if this was a 
1490 savestate or a movie.
1492 8.10.11 Callback: on_quit()
1494 Called when emulator is shutting down.
1496 8.10.12 Callback: on_input(boolean subframe)
1498 Called when emulator is just sending input to bsnes core. 
1499 Warning: This is called even in readonly mode, but the results 
1500 are ignored.
1502 8.10.13 Callback: on_reset()
1504 Called when SNES is reset.
1506 8.10.14 Callback: on_readwrite()
1508 Called when moving into readwrite mode as result of “set-rwmode” 
1509 command (note: moving to rwmode by Lua won't trigger this, as per 
1510 recursive entry protection).
1512 8.10.15 Callback: on_snoop(number port, number controller, number 
1513   index, number value)
1515 Called each time bsnes asks for input. The value is the final 
1516 value to be sent to bsnes core (readonly mode, autohold and 
1517 autofire have been taken into account). Might be useful when 
1518 translating movies to format suitable for console verification. 
1519 Note: There is no way to modify the value to be sent.
1521 9 Modifier and key names:
1523 9.1 SDL Platform
1525 9.1.1 Modifier names
1527 Following modifier names are known:
1529 • ctrl, lctrl, rctrl: Control keys
1531 • alt, lalt, ralt: ALT keys.
1533 • shift, lshift, rshift: Shift keys.
1535 • meta, lmeta, rmeta: Meta keys.
1537 • num, caps: Numlock/Capslock (these are sticky!)
1539 • mode: Mode select.
1541 9.1.2 Key names
1543 Following key names are known:
1545 • backspace, tab, clear, return, pause, escape, space, exclaim, 
1546   quotedbl, hash, dollar, ampersand, quote, leftparen, 
1547   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
1548   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
1549   greater, question, at, leftbracket, backslash, rightbracket, 
1550   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
1551   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
1552   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
1553   world_8, world_9, world_10, world_11, world_12, world_13, 
1554   world_14, world_15, world_16, world_17, world_18, world_19, 
1555   world_20, world_21, world_22, world_23, world_24, world_25, 
1556   world_26, world_27, world_28, world_29, world_30, world_31, 
1557   world_32, world_33, world_34, world_35, world_36, world_37, 
1558   world_38, world_39, world_40, world_41, world_42, world_43, 
1559   world_44, world_45, world_46, world_47, world_48, world_49, 
1560   world_50, world_51, world_52, world_53, world_54, world_55, 
1561   world_56, world_57, world_58, world_59, world_60, world_61, 
1562   world_62, world_63, world_64, world_65, world_66, world_67, 
1563   world_68, world_69, world_70, world_71, world_72, world_73, 
1564   world_74, world_75, world_76, world_77, world_78, world_79, 
1565   world_80, world_81, world_82, world_83, world_84, world_85, 
1566   world_86, world_87, world_88, world_89, world_90, world_91, 
1567   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
1568   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
1569   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
1570   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
1571   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
1572   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
1573   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
1574   sysreq, break, menu, power, euro, undo
1576 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
1577   key having hardware-dependent scan code of <n> (useful to bind 
1578   those keys that don't have symbolic names).
1580 9.1.3 Joystick pseudo-keys:
1582 • joystick<num>button<button>: Joystick <num> (0-based) button 
1583   <button> (0-based).
1585 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
1586   (0-based) up.
1588 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
1589   (0-based) left.
1591 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
1592   (0-based) down.
1594 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
1595   (0-based) right.
1597 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
1598   negative position (axis modes axis and axis_inverse).
1600 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
1601   positive position (axis modes axis and axis_inverse).
1603 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
1604   pressure (axis modes pressure_*).
1606 9.1.4 Special buttons:
1608 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1610 • Return (also KPEnter): Execute command, ok modal dialog.
1612 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous 
1613   command in command history
1615 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next 
1616   command in command history
1618 • Home (also KP7 if no num lock; command mode): Beginning of 
1619   command.
1621 • End (also KP1 if no num lock; command mode): End of command.
1623 • Left (also KP4 if no num lock; command mode): Move cursor left.
1625 • Right (also KP6 if no num lock; command mode): Move cursor 
1626   right.
1628 • Delete (also KP. if no num lock; command mode): Delete 
1629   character to right of cursor.
1631 • Insert (also KP0 if no num lock; command mode): Toggle between 
1632   insert / overwrite modes.
1634 • Backspace (command mode): Delete character to left of cursor.
1636 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
1637   corrupted!).
1639 9.2 wxWidgets platform
1641 9.2.1 Modifier names:
1643 Following modifier names are known:
1645 • alt
1647 • ctrl
1649 • shift 
1651 • meta
1653 • cmd (Mac OS X only)
1655 9.2.2 Key names:
1657 Following key names are known:
1659 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1660   dollar, percent, ampersand, quote, leftparen, rightparen, 
1661   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1662   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1663   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1664   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1665   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1666   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1667   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1668   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1669   home, lefT, up, right, down, select, print, execute, snapshot, 
1670   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1671   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1672   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1673   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1674   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1675   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1676   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1677   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1678   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1679   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1680   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1681   windows_right, windows_menu, command, special1, special2, 
1682   special3, special4, special5, special6, special7, special8, 
1683   special9, special10, special11, special12, special13, 
1684   special14, special15, special16, special17, special18, 
1685   special19, special20
1687 10 Movie file format
1689 Movie file is .zip archive in itself, normal ZIP archive tools 
1690 work on it (note: If you recompress it, do not use compression 
1691 methods other than store and deflate and especially do not use 
1692 encryption of any kind).
1694 10.1 Detecting clean start/SRAM/Savestate
1696 • If file has member “savestate” it is savestate, otherwise:
1698 • If file has members with names starting “moviesram.” it is 
1699   movie starting from SRAM, otherwise:
1701 • It is movie starting from clear state.
1703 10.2 Member: gametype
1705 Type of game ROM and region (as one line). Valid values are:
1708 +--------------+---------------------+--------+
1709 |    Value     |       System        | Region |
1710 +--------------+---------------------+--------+
1711 +--------------+---------------------+--------+
1712 |  snes_pal    |     Super NES       |  PAL   |
1713 +--------------+---------------------+--------+
1714 |   sgb_pal    |   Super Game Boy    |  PAL   |
1715 +--------------+---------------------+--------+
1716 |  snes_ntsc   |     Super NES       |  NTSC  |
1717 +--------------+---------------------+--------+
1718 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
1719 +--------------+---------------------+--------+
1720 |     bsx      | BS-X (non-slotted)  |  NTSC  |
1721 +--------------+---------------------+--------+
1722 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
1723 +--------------+---------------------+--------+
1724 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
1725 +--------------+---------------------+--------+
1728 Frame rates are:
1731 +---------+-----------------+
1732 | Region  | Framerate (fps) |
1733 +---------+-----------------+
1734 +---------+-----------------+
1735 |  PAL    |   322445/6448   |
1736 +---------+-----------------+
1737 |  NTSC   | 10738636/178683 |
1738 +---------+-----------------+
1741 10.3 Member: port1
1743 Contains type of port #1 (as one line). Valid values are 'none', 
1744 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
1745 'gamepad'.
1747 10.4 Member: port2
1749 Contains type of port #2 (as one line). Valid values are 'none', 
1750 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
1751 'justifiers'. If not present, defaults to 'none'.
1753 10.5 Member: gamename
1755 Contains name of the game (as one line).
1757 10.6 Member: authors
1759 Contains authors, one per line. Part before '|' is the full name, 
1760 part after is the nickname.
1762 10.7 Member: systemid
1764 Always “lsnes-rr1” (one line). Used to reject other saves.
1766 10.8 Member: controlsversion
1768 Always “0” (one line). Used to identify what controls are there.
1770 10.9 Member: “coreversion”
1772 Contains bsnes core version number (as one line).
1774 10.10 Member: projectid
1776 Contains project ID (as one line). Used to identify if two movies 
1777 are part of the same project.
1779 10.11 Member: {rom,slota,slotb}{,xml}.sha256
1781 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
1782 Absent if corresponding file is absent.
1784 10.12 Member: moviesram.<name>
1786 Raw binary startup SRAM of kind <name>. Only present in 
1787 savestates and movies starting from SRAM.
1789 10.13 Member: saveframe
1791 Contains frame number (as one line) of frame movie was saved on. 
1792 Only present in savestates.
1794 10.14 Member: lagcounter
1796 Current value of lag counter (as one line). Only present in 
1797 savestates.
1799 10.15 Member: pollcounters
1801 Contains poll counters (currently 100 of them), one per line. 
1802 Each line is raw poll count if DRDY is set for it. Otherwise it 
1803 is negative poll count minus one. Only present in savestates.
1805 10.16 Member: hostmemory
1807 Raw binary dump of host memory. Only present in savestates.
1809 10.17 Member: savestate
1811 The raw binary savestate itself. Savestate detection uses this 
1812 file, only present in savestates.
1814 10.18 Member: screenshot
1816 Screenshot of current frame. Only present in savestates. First 2 
1817 bytes are big-endian width of image, rest are 24-bit RGB image 
1818 data. Height of image is inferred from the width and size of 
1819 data.
1821 10.19 Member: sram.<name>
1823 Raw binary SRAM of kind <name> at time of savestate. Only present 
1824 in savestates.
1826 10.20 Member: input
1828 The actual input track, one line per subframe (blank lines are 
1829 skipped).
1831 • If the first byte of each line is '.', ' ', <tab> or '|', then 
1832   the line is part of same frame as previous, otherwise it starts 
1833   a new frame.
1835 • First subframe must start a new frame.
1837 Length of movie in frames is number of lines in input file that 
1838 start a new frame.
1840 10.21 Member: rerecords
1842 Contains textual base-10 rerecord count (as one line; emulator 
1843 just writes this, it doesn't read it) + 1.
1845 10.22 Member: rrdata
1847 This member stores set of load IDs. There is one load ID per 
1848 rerecord (plus one corresponding to start of project).
1850 • This member constists of concatenation of records
1852 • Each record is 2-36 bytes long and can represent 1-16,843,009 
1853   consequtive IDs.
1855 • IDs are interpretted as 256-bit big-endian integers with 
1856   warparound.
1858 • Initial predicted ID is all zeroes.
1860 Format of each record is:
1862 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
1863   bits 5-6 are count length (countlen). Bit 7 is unused.
1865 • 32-prefixlen bytes of ID.
1867 • countlen bytes of big-endian count (count).
1869 Records are processed as follows:
1871 • To form the first ID encoded by record, take the first 
1872   prefixlen bytes predicted ID and append the read ID value to 
1873   it. The result is the first ID encoded.
1875 • If countlen is 0, record encodes 1 ID.
1877 • If countlen is 1, record encodes 2+count IDs.
1879 • If countlen is 2, record encodes 258+count IDs.
1881 • If countlen is 3, record encodes 65794+count IDs.
1883 • The new predicted ID is the next ID after last one encoded by 
1884   the record.
1886 The number of rerecords + 1 is equal to the sum of number of IDs 
1887 encoded by all records.
1889 10.23 Member: starttime.second
1891 Movie starting time, second part. Epoch is Unix epoch. Default is 
1892 1,000,000,000.
1894 10.24 Member: starttime.subsecond
1896 Movie starting time, subsecond part. Unit is CPU clocks. Default 
1897 is 0.
1899 10.25 Member: savetime.second
1901 Movie saving time, second part. Default is starttime.second. Only 
1902 present in savestates.
1904 10.26 Member: savetime.subsecond
1906 Movie saving time, subsecond part. Default is 
1907 starttime.subsecond. Only present in savestates.
1909 11 Quick'n'dirty encode guide
1911 1. Start the emulator and load the movie file.
1913 2. Set large AVI option 'set-setting avi-large on'
1915 3. Enable dumping 'dump-avi tmpdump' 
1917 4. Unpause and let it run until you want to end dumping.
1919 5. Close the emulator (closing the window is the easiest way). Or 
1920   use 'end-avi'.
1922 6. For each tmpdump*.avi file created, on command prompt, do 
1923   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
1925 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
1927 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
1928   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
1929   tmpdump_<numbers>.mkv, with + in between).
1931 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
1932   final.mkv contains quick'n'dirty encode.
1934 12 Axis configurations for some gamepad types:
1936 12.1 XBox360 controller:
1938 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
1939 set to pressure-+.
1941 set-axis joystick0axis2 pressure-+
1943 set-axis joystick0axis5 pressure-+
1945 • This is needed for SDL only. EVDEV sets those types correctly.
1947 12.2 PS3 “sixaxis” controller:
1949 Axes 8-19 should be disabled.
1951 set-axis joystick0axis8 disabled
1953 set-axis joystick0axis9 disabled
1955 set-axis joystick0axis10 disabled
1957 set-axis joystick0axis11 disabled
1959 set-axis joystick0axis12 disabled
1961 set-axis joystick0axis13 disabled
1963 set-axis joystick0axis14 disabled
1965 set-axis joystick0axis15 disabled
1967 set-axis joystick0axis16 disabled
1969 set-axis joystick0axis17 disabled
1971 set-axis joystick0axis18 disabled
1973 set-axis joystick0axis19 disabled
1975 13 Errata:
1977 13.1 Problems from BSNES core:
1979 • The whole pending save stuff.
1981 • Lack of layer hiding.
1983 • It is slow (especially accuracy).
1985 • Firmwares can't be loaded from ZIP archives.
1987 13.2 Other problems:
1989 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
1991 • Audio for last dumped frame is not itself dumped.
1993 • Audio in UI is pretty bad in quality if game doesn't run at 
1994   full speed.
1996 • AVI compression levels 10-18 are not compatible with AVISynth 
1997   AVISource.
1999 • No menus, command based interface (SDL).
2001 • Long commands don't scroll.
2003 • The SDL screen drawing is slow.
2005 • Wxwidgets UI is still pretty buggy.
2007 14 Changelog:
2009 14.1 rr0-beta1
2011 • Fix -Wall warnings
2013 • Fix dumper video corruption with levels 10-18.
2015 14.2 rr0-beta2
2017 • Autofire
2019 • Lots of code cleanups
2021 • Lua interface to settings
2023 • Allow specifying AVI borders without Lua
2025 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2027 • on_snoop lua callback
2029 • Faster movie loading and saving.
2031 14.3 rr0-beta3
2033 • Joystick support
2035 14.4 rr0-beta4
2037 • Fix multi-buttons
2039 • Save jukebox functionality.
2041 14.5 rr0-beta5
2043 • Try to fix some nasty failing movie load edge cases
2045 • Allow specifying scripts to run on command line.
2047 14.6 rr0-beta6
2049 • Major source code reorganization.
2051 • Backup savestates before overwriting.
2053 • Don't crash if loading initial state fails.
2055 14.7 rr0-beta7
2057 • Fix firmware lookup
2059 • Fix author name parsing
2061 • Fix rerecord counting
2063 • (SDL) Print messages to console if SDL is uninitialized
2065 • Add movieinfo program
2067 • Fix loading movies starting from SRAM.
2069 14.8 rr0-beta8
2071 • Add support for unattended dumping
2073 • Fix compiling for Win32
2075 • Don't lock up if sound can't be initialized
2077 • Strip trailing CR from commands
2079 • Don't try to do dubious things in global ctors (fix crash on 
2080   startup)
2082 14.9 rr0-beta9
2084 • Small documentation tweaking
2086 • Fix make clean
2088 • Fix major bug in modifier matching
2090 14.10 rr0-beta10
2092 • Lots of documentation fixes
2094 • Use dedicated callbacks for event backcomm., not commands.
2096 • Ensure that the watchdog is not hit when executing delayed 
2097   reset.
2099 • Remove errant tab from joystick message.
2101 14.11 rr0-beta11
2103 • Make autofire operate in absolute time, not linear time
2105 • Reinitialize controls when resuming from loadstate
2107 • Some more code cleanups
2109 • If Lua allocator fails, call OOM_panic()
2111 • Byte/word/dword/qword sized host memory write/read functions.
2113 • Dump at correct framerate if dumping interlaced NTSC 
2114   (height=448).
2116 14.12 rr0-beta12
2118 • Actually include the complete source code
2120 • Keep track of RTC
2122 14.13 rr0-beta13
2124 • Document {save,start}time.{,sub}second.
2126 • Intercept time() from bsnes core.
2128 14.14 rr0-beta14
2130 • Allow disabling time() interception (allow build on Mac OS X)
2132 • Use SDLMain on Mac OS X (make SDL not crash)
2134 • Disable delayed resets (just plain too buggy for now).
2136 • Code cleanups
2138 • Use 16-bit for graphics/video instead of 32-bit.
2140 • gui.rectangle/gui.pixel
2142 • gui.crosshair
2144 • New CSCD writer implementation.
2146 14.15 rr0-beta15
2148 • Fix interaction of * and +.
2150 • Manual improvements
2152 • Use gettimeofday()/usleep(), these seem portable enough.
2154 • Move joystick axis manipulation to keymapper code.
2156 • Changes to how read-only works.
2158 • Refactor controller input code.
2160 14.16 rr0-beta16
2162 • Fix mouseclick scale compensation.
2164 • Draw area boundaries correctly in SDL code.
2166 • gui.screenshot.
2168 • Fix CSCD output (buffer overrun and race condition).
2170 14.17 rr0-beta17
2172 • JMD dumping support.
2174 • Allow unattended dumping to JMD.
2176 • Move to BSNES v083.
2178 • Switch back to 32-bit colors.
2180 • Add Lua function gui.color.
2182 • Use some new C++11 features in GCC 4.6.
2184 • Be prepared for core frequency changes.
2186 • Pass colors in one chunk from Lua.
2188 14.18 rr0-beta18
2190 • New lua functions gui.line(), gui.status() and gui.circle(), 
2191   memory.vma_count(), memory.read_vma() and memory.find_vma().
2193 • Numerious documentation fixups
2195 • RTC time format changed
2197 • Reformat flags display
2199 • Allow lua package name to be overridden
2201 • SDUMP (high-quality dumping).
2203 • Split platform support to plugins.
2205 • Make all sound plugins support basic sound commands
2207 • Support portaudio for sound.
2209 • Allow disable Lua/SDL searching.
2211 • Upconvert colors when copying lcscreen to screen.
2213 • Reorganize source tree.
2215 • Evdev joystick support.
2217 • Refactor more code into generic window code.
2219 14.19 rr0-beta19
2221 • Refactor message handling.
2223 • Rework makefile
2225 • Documentation fixes
2227 • Finish pending saves before load/quit.
2229 • Wxwidgets graphics plugin.
2231 14.20 rr0-beta20
2233 • Get rid of win32-crap.[ch]pp.
2235 • Move files around a lot.
2237 • Get rid of need for host C++ compiler.
2239 • Bsnes v084 core.
2241 • Refactor inter-component communication.
2243 • Fix zero luma.
2245 • Fix crash on multiline aliases.
2247 • Load/Save settings in wxwidgets gui.
2249 14.21 rr0-beta21
2251 • Patch problems in bsnes core
2253 • SNES is little-endian, not big-endian!
2255 • Fix memory corruption in lcscreen::load()
2257 14.22 rr0-beta22
2259 • Fix interpretting repeat counts in rrdata loading.
2261 • New lua callback: on_frame()
2263 • Remove calls to runtosave() that aren't supposed to be there
2265 • Lua function: movie.read_rtc()
2267 • Ignore src/fonts/font.cpp
2269 • Fix more bsnes core problems
2271 • Control bsnes random seeding
2273 • Pause-on-end
2275 • Some bsnes core debugging features (state dump and state hash)
2277 • Fix titlebar version number (no, the last version wasn't 
2278   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2280 14.23 rr0-beta23
2282 • Fix memory corruption due to macro/field mixup
2284 • search-memory update
2286 • Allow direct-mapped framebuffer
2288 • SDL: Use SDL_ANYFORMAT if possible
2290 • SDMP2SOX: 2s delay modes.
2292 • Wxwidgets: Cleanups
2294 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2296 • Wxwidgets: Save jukebox on exit
2298 • Fix RTC if using load-movie on savestate.
2300 • Fix crash related to full console mode.
2302 14.24 rr0-beta24
2304 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2305   X.
2307 • Wxwidgets: Allow compiling on Mac OS X.
2309 • Use movie compare instead of movie hashing (faster save/load).
2311 • Lua: _SYSTEM table.
2313 14.25 rr0-beta25
2315 • sdmp2sox: Pad soundtrack if using -l or -L.
2317 • sdmp2sox: Fix NTSC overscan.
2319 • sdmp2sox: Add AR correction mode.
2321 • call lua_close() when exiting.
2323 • Fix zip_writer bug causing warnings from info-zip and error 
2324   from advzip.
2326 14.26 rr0-beta26
2328 • Fix IPS patching code (use bsnes core IPS patcher).
2330 • Implement BPS patching (using bsnes core IPS patcher).
2332 • Add feature to load headered ROMs.
2334 14.27 rr0-beta27
2336 • Show command names when showing keybindings
2338 14.28 rr0
2340 • Fix pause-on-end to be actually controllable
2342 • SDL: Poll all events in queue, not just first one (fixes 
2343   slowness in command typing)
2345 • Wxwidgets: Fix ROM loading.
2347 14.29 rr1-beta0
2349 • Lua: Add gui.textH, gui.textV, gui.textHV
2351 • Fix text colors on SDL on Mac OS X
2353 • Mode 'F' for finished in readonly mode.
2355 • Fix some WS errors.
2357 • Reliably pause after skip poll
2359 • Split UI and core into their own threads
2361 14.30 rr1-beta1
2363 • Remove leftover dummy SRAM slot
2365 • Fix controller numbers.
2367 14.31 rr1-beta2
2369 • Fix lsnes-dumpavi after interface change.
2371 • Also give BSNES patches for v085.
2373 • Pack movie data in memory.
2375 14.32 rr1-beta3
2377 • Fix framecount/length given when loading movies.
2379 • Controller command memory leak fixes.
2381 • Don't leak palette if freeing screen object.
2383 14.33 rr1-beta4
2385 • Detect revisions.
2387 • Wxwidgets: Allow controlling dumper from the menu.
2389 14.34 rr1-beta5
2391 • Rewrite parts of manual
2393 • Lua: Make it work with Lua 5.2.
2395 14.35 rr1-beta6
2397 • Win32: Fix compile errors.
2399 14.36 rr1-beta7
2401 • Refactor controller input code.
2403 • Fix crash when using command line on SDL / Mac OS X.
2405 14.37 rr1-beta8
2407 • Delete core/coroutine (obsolete)
2409 • Lag input display by one frame.
2411 • Rewind movie to beginning function.
2413 • Fix wrong frame number reported to Lua when repainting after 
2414   loadstate
2416 • Support UI editing of jukebox
2418 • Wxwidgets: Save settings on exit.
2420 • Support ${project} for filenames
2422 • SDL: Fix command history
2424 14.38 rr1-beta9
2426 • Fix some order-of-global-ctor bugs.
2428 14.39 rr1-beta10
2430 • Fix crashes when quitting on Win32.
2432 14.40 rr1-beta11
2434 • EVDEV: Queue keypresses from joystick, don't send directly
2436 • Wxwidgets: Load-Preserve that actually works.
2438 14.41 rr1-beta12
2440 • Wxwidgets: GUI for memory search.
2442 • Warn about using synchronous queue in UI callback.