Pack movie data in memory
[lsnes.git] / manual.txt
bloba85df9bbd4d45ec313de8406bda6f99884c6fe5c
1 1 Introduction
3 lsnes is SNES rerecording emulator based on bsnes core.
5 2 Command line options
7 • Syntax: lsnes.exe <rom-options> <misc-options> 
8   (<new-session-options>|<filename>)
10 • Syntax: lsnes-avidump <dump-options> <misc-options> 
11   <rom-options> <filename>
13 • Syntax: movieinfo.exe <filename>
15 2.1 ROM options
17 These options control loading the ROM.
19 2.1.1 --rom=<file>
21 Load <file> (SFC file format) as main SNES cartridge ROM. This is 
22 the game ROM for SNES and cartridge BIOS for other types. 
23 Required option.
25 2.1.2 --headered-rom=<file>
27 Same as --rom, but strips first 512 bytes off the file as copier 
28 header. Handy for loading .smc and .fig (also some others) files.
30 2.1.3 --rom-xml=<file>
32 Set the mapping XML file for main cartridge ROM. If not 
33 specified, defaults are used.
35 2.1.4 --bsx=<file>
37 Load <file> (BS file format) as BS-X non-slotted flash memory. 
38 Also sets system type to BS-X non-slotted (not compatible with 
39 --bsxslotted=<file>, --dmg=<file>, --slot-a=<file> nor 
40 --slot-b=<file>).
42 2.1.5 --headered-bsx=<file>
44 Same as --bsx but strips first 512 bytes off the file as copier 
45 header. Handy for loading .smc and .fig (also some others) files.
47 2.1.6 --bsx-xml=<file>
49 Set mapping XML file for BS-X non-slotted flash memory. If not 
50 specified, defaults are used. Only can be used together with 
51 --bsx=<file>.
53 2.1.7 --bsxslotted=<file>
55 Load <file> (BS file format) as BS-X slotted flash memory. Also 
56 sets system type to BS-X slotted (not compatible with 
57 --bsx=<file>, --dmg=<file>, --slot-a=<file> nor --slot-b=<file>).
59 2.1.8 --headered-bsxslotted=<file>
61 Same as --bsxslotted but strips first 512 bytes off the file as 
62 copier header. Handy for loading .smc and .fig (also some others) 
63 files.
65 2.1.9 --bsxslotted-xml=<file>
67 Set mapping XML file for BS-X slotted flash memory. If not 
68 specified, defaults are used. Only can be used together with 
69 --bsxslotted=<file>.
71 2.1.10 --dmg=<file>
73 Load <file> (GB file format) as Game Boy ROM. Also sets system 
74 type to SGB (not compatible with --bsx=<file>, 
75 --bsxslotted=<file>, --slot-a=<file> nor --slot-b=<file>).
77 2.1.11 --headered-dmg=<file>
79 Same as --dmg but strips first 512 bytes off the file as copier 
80 header. Handy for loading .smc and .fig (also some others) files.
82 2.1.12 --dmg-xml=<file>
84 Set mapping XML file for Game Boy ROM. If not specified, defaults 
85 are used. Only can be used together with --dmg=<file>.
87 2.1.13 --slot-a=<file>
89 Load <file> (ST file format) as Sufami turbo cartridge A ROM. 
90 Also sets system type to Sufami Turbo (not compatible with 
91 --bsx=<file>, --bsxslotted=<file> nor --dmg=<file>).
93 2.1.14 --headered-slot-a=<file>
95 Same as --slot-a but strips first 512 bytes off the file as 
96 copier header. Handy for loading .smc and .fig (also some others) 
97 files.
99 2.1.15 --slot-a-xml=<file>
101 Set mapping XML file for Sufami turbo cartridge A ROM. If not 
102 specified, defaults are used. Only can be used together with 
103 --slot-a=<file>.
105 2.1.16 --slot-b=<file>
107 Load <file> (ST file format) as Sufami turbo cartridge B ROM. 
108 Also sets system type to Sufami Turbo (not compatible with 
109 --bsx=<file>, --bsxslotted=<file> nor --dmg=<file>).
111 2.1.17 --headered-slot-b=<file>
113 Same as --slot-b but strips first 512 bytes off the file as 
114 copier header. Handy for loading .smc and .fig (also some others) 
115 files.
117 2.1.18 --slot-b-xml=<file>
119 Set mapping XML file for Sufami turbo cartridge B ROM. If not 
120 specified, defaults are used. Only can be used together with 
121 --slot-b=<file>.
123 2.1.19 --ips-rom=<file>
125 Apply IPS patch <file> to main cartridge ROM. Requires 
126 --rom=<file>.
128 2.1.20 --ips-rom-xml=<file>
130 Apply IPS patch <file> to main cartridge ROM mapping XML. 
131 Requires --rom-xml=<file>.
133 2.1.21 --ips-bsx=<file>
135 Apply IPS patch <file> to BS-X non-slotted flash. Requires 
136 --bsx=<file>.
138 2.1.22 --ips-bsx-xml=<file>
140 Apply IPS patch <file> to BS-X non-slotted flash mapping XML. 
141 Requires --bsx-xml=<file>.
143 2.1.23 --ips-bsxslotted=<file>
145 Apply IPS patch <file> to BS-X slotted flash. Requires 
146 --bsxslotted=<file>.
148 2.1.24 --ips-bsxslotted-xml=<file>
150 Apply IPS patch <file> to BS-X slotted flash mapping XML. 
151 Requires --bsxslotted-xml=<file>.
153 2.1.25 --ips-dmg=<file>
155 Apply IPS patch <file> to Game Boy ROM. Requires --dmg=<file>.
157 2.1.26 --ips-dmg-xml=<file>
159 Apply IPS patch <file> to Game Boy ROM mapping XML. Requires 
160 --dmg-xml=<file>.
162 2.1.27 --ips-slot-a=<file>
164 Apply IPS patch <file> to Sufami turbo cartridge A ROM. Requires 
165 --slot-a=<file>.
167 2.1.28 --ips-slot-a-xml=<file>
169 Apply IPS patch <file> to Sufami turbo cartridge A ROM mapping 
170 XML. Requires --slot-a-xml=<file>.
172 2.1.29 --ips-slot-b=<file>
174 Apply IPS patch <file> to Sufami turbo cartridge B ROM. Requires 
175 --slot-b=<file>.
177 2.1.30 --ips-slot-b-xml=<file>
179 Apply IPS patch <file> to Sufami turbo cartridge B ROM mapping 
180 XML. Requires --slot-b-xml=<file>.
182 2.1.31 --ips-offset=<offset>
184 Set IPS apply offset to <offset> (can be negative). IPS apply 
185 offset is added to all addresses inside IPS file before applying. 
186 If the resulting address is negative, write is ignored (with a 
187 warning). If resulting address exceeds ROM size, the ROM is 
188 extended.
190 Using offset of -512 is handy for applying IPS patches meant for 
191 SMC/FIG or such files.
193 2.1.32 --pal
195 Force ROM to be considered PAL-only (warning: Will cause error if 
196 used on anything except SNES and SGB).
198 2.1.33 --ntsc
200 Force ROM to be considered NTSC-only (default for everything 
201 except SNES and SGB).
203 2.2 New session options (lsnes.exe only)
205 If filename is not specified, new session is started. These 
206 options control the properties of new session:
208 2.2.1 --port1=<type>
210 Set type of port1. Valid values are:
212 • none: No device connected
214 • gamepad: One gamepad (the default)
216 • multitap: Four gamepads (warning: makes most games refuse to 
217   start)
219 • mouse: Mouse.
221 2.2.2 --port2=<type>
223 Set type of port2. Valid values are:
225 • none: No device connected (the default)
227 • gamepad: One gamepad
229 • multitap: Four gamepads.
231 • mouse: Mouse
233 • superscope: Super Scope
235 • justifier: One justifier
237 • justifiers: Two justifiers
239 2.2.3 --gamename=<name>
241 Set the name of game to <name>
243 2.2.4 --author=<name>
245 Add author with full name of <name> (no nickname).
247 2.2.5 --author=|<name>
249 Add author with nickname of <name> (no full name).
251 2.2.6 --author=<fullname>|<nickname>
253 Add author with full name of <fullname> and nickname of 
254 <nickname>.
256 2.2.7 --rtc-second=<value>
258 Set RTC second (0 is 1st January 1970 00:00:00Z).
260 2.2.8 --rtc-subsecond=<value>
262 Set RTC subsecond. Range is 0-. Unit is CPU cycle.
264 2.3 <filename>
266 If filename is specified on command line, it is loaded as initial 
267 state (instead of constructing one). Mandatory for 
268 lsnes-avidump.exe and movieinfo.exe.
270 2.4 Misc. options
272 2.4.1 --run=<file> (lsnes.exe only)
274 After running main RC file, run this file. If multiple are 
275 specified, these execute in order specified.
277 2.5 dump options (lsnes-avidump.exe only)
279 2.5.1 --prefix=<prefix>
281 Set dump prefix. Default is “avidump”.
283 2.5.2 --level=<level>
285 Set compression level (0-18). Default is 7.
287 2.5.3 --length=<length>
289 Set number of frames to dump. Mandatory.
291 2.5.4 --lua=<script>
293 Run specified lua script (lsnes-avidump.exe does not have 
294 initialization files).
296 2.5.5 --jmd
298 Use JMD dumping instead of AVI dumping.
300 3 Startup file lsnes.rc
302 Upon startup, lsnes (lsnes.exe only) executes file lsnes.rc as 
303 commands. This file is located in:
305 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
307 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME 
308   exists)
310 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
312 • All: ./lsnes.rc (fallback default).
314 If leading directories do not exist, attempt to create them is 
315 made.
317 4 Game internal commands
319 • Commands beginning with '*' invoke the corresponding command 
320   without alias expansion.
322 • If command starts with '+' (after possible '*'), the command is 
323   executed as-is when button is pressed, and when button is 
324   released, it is executed with '+' replaced by '-'.
326 4.1 Settings:
328 Settings control various aspects of emulator behaviour.
330 4.1.1 set-setting <setting> <value>
332 Sets setting <setting> to value <value> (may be empty).
334 4.1.2 unset-setting <setting>
336 Try to unset setting <setting> (not all settings can be unset).
338 4.1.3 get-setting <setting>
340 Read value of setting <setting>
342 4.1.4 show-settings
344 Print names and values of all settings.
346 4.2 Keybindings
348 Keybindings bind commands or aliases to keys (or pseudo-keys). 
350 Notes:
352 • Do not bind edge active (+/-) commands to keys with modifiers, 
353   that won't work right!
355 • Names of keys and modifiers are platform-dependent.
357 • Be careful before binding pseudo-keys (such as joystick axes, 
358   buttons or hats) with modifiers. That may or may not work 
359   right.
361 4.2.1 bind-key [<mod>/<modmask>] <key> <command>
363 Bind <command> to key <key> (activating if modifiers in <modmask> 
364 (comma-seperated list) are set as <mod> (comma-seperated list).
366 The names of keys and modifiers are platform-dependent.
368 4.2.2 unbind-key [<mod>/<modmask>] <key>
370 Unbind command from <key> (with specified <mod> and <modmask>).
372 4.2.3 set-axis <axis> [disabled | axis | axis-inverse | 
373   pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0 
374   | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>] 
375   [tolerance=<val>]
377 Set axis parameters for axis <axis>.
379 • disabled: Disable axis
381 • axis: Normal axis
383 • axis-inverse: Inverse axis
385 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
387 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
389 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
391 • pressure-+: Pressure sensitive. Released at -, pressed at +.
393 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
395 • pressure+-: Pressure sensitive. Released at +, pressed at -.
397 • minus=<val>: Calibration at extreme minus position 
398   (-32768-32767)
400 • zero=<val>: Calibration at neutral position (-32768-32767)
402 • plus=<val>: Calibration at extreme plus position (-32768-32767)
404 • tolerance=<value>: Center band tolerance (0<x<1). The smaller 
405   the value, the more sensitive the control is.
407 4.2.4 show-bindings
409 Print all key bindings in effect.
411 4.3 Aliases
413 Aliases bind command to sequence of commands. After alias has 
414 been defined, it replaces the command it shadows.
416 Notes:
418 • You can't alias command to itself.
420 • Aliases starting with +/- are edge active just like ordinary 
421   commands starting with +/-.
423 • One command can be aliased to multiple commands.
425 4.3.1 alias-command <command> <expansion>
427 Append <expansion> to alias <command>. If alias does not already 
428 exist, it is created.
430 4.3.2 unalias-command <command>
432 Clear alias expansion for <command>.
434 4.3.3 show-aliases
436 Print all aliases and their expansions in effect.
438 4.4 run-script <script> (implemented for wxwidgets)
440 Run <script> as if commands were entered on the command line.
442 4.5 AVI Video dumping
444 Following commands control AVI video dumping:
446 4.5.1 dump-avi <prefix>
448 Dump AVI video to prefix <prefix> Notes:
450 • The codec is Camstudio Codec in gzip mode.
452 • Encoder and muxer are internal, available on all platforms.
454 • Audio enable/disable and framerate has no effect.
456 • Levels 10-18 are not compatible with AVISource.
458 • Recomended level is 7 if decoded by AVISource.
460 • Recomended level is 16 if decoded by ffmpeg, mencoder or 
461   FFMpegSource.
463 • Dumps of low-res PAL games are 256x239 (with all the 
464   consequences odd height carries).
466 • The audio dumped to .avi is low-quality version. The 
467   high-quality version is dumped to .sox file.
469 4.5.2 end-avi
471 End current AVI video dump (closing the emulator also closes the 
472 dump).
474 4.6 JMD video dumping
476 Following commands control JMD video dumping:
478 4.6.1 dump-jmd <file>
480 Dump JMD video to file <file>.
482 4.6.2 end-jmd
484 End the current JMD dump in progress.
486 4.7 Memory manipulation
488 <address> may be decimal or hexadecimal (prefixed with '0x'). 
489 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
490 signed (prefixed with '-') decimal.
492 The available element <sizes> are:
494 • byte: 1 byte
496 • word: 2 bytes
498 • dword: 4 bytes
500 • qword: 8 bytes
502 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
503 When dealing with DSP memory, multi-byte reads/writes are 
504 native-endian (do not use operand sizes exceeding DSP bitness, 
505 except dword is OK for 24-bit memory).
507 4.7.1 read-<size> <address>
509 Read the value of byte in <address>.
511 4.7.2 read-s<size> <address>
513 Read the value of signed byte in <address>.
515 4.7.3 write-<size> <address> <value>
517 Write <value> to byte in address <address>.
519 4.7.4 search-memory reset
521 Reset the memory search
523 4.7.5 search-memory count
525 Print number of candidates remaining
527 4.7.6 search-memory print
529 Print all candidates remaining
531 4.7.7 search-memory <usflag><sizeflag><op>
533 Searches memory for addresses satisfying criteria.
535 <usflag> can be:
537 • u: unsigned
539 • s: signed
541 <sizeflag> can be:
543 • b: byte
545 • w: word
547 • d: dword
549 • q: qword
551 <op> can be:
553 • lt: < previous value.
555 • le: <= previous value.
557 • eq: = previous value.
559 • ne: != previous value.
561 • ge: >= previous value.
563 • gt: > previous value.
565 4.7.8 search-memory <sizeflag> <value>
567 Searches for addresses that currently have value <value>. 
568 <sizeflag> is as in previous command.
570 4.8 Main commands
572 These commands are not available in lsnesrc, but are available 
573 after ROM has been loaded.
575 4.8.1 quit-emulator [/y] (implemented for wxwidgets)
577 Quits the emulator (asking for confirmation). If /y is given, no 
578 confirmation is asked.
580 4.8.2 pause-emulator (implemented for wxwidgets)
582 Toggle paused/unpaused
584 4.8.3 +advance-frame (implemented for wxwidgets)
586 Advance frame. If the button is still held after configurable 
587 timeout expires, game unpauses for the duration frame advance is 
588 held.
590 4.8.4 +advance-poll (implemented for wxwidgets)
592 Advance subframe. If the button is still held after configurable 
593 timeout expires, game unpauses for the duration frame advance is 
594 held.
596 4.8.5 advance-skiplag (implemented for wxwidgets)
598 Skip to first poll in frame after current.
600 4.8.6 reset (implemented for wxwidgets)
602 Reset the SNES after this frame.
604 4.8.7 load <filename> (implemented for wxwidgets)
606 Load savestate <filename> in current mode.
608 4.8.8 load-state <filename> (implemented for wxwidgets)
610 Load savestate <filename> in readwrite mode.
612 4.8.9 load-readonly <filename> (implemented for wxwidgets)
614 Load savestate <filename> in readonly mode.
616 4.8.10 load-preserve <filename> (implemented for wxwidgets)
618 Load savestate <filename> in readonly mode, preserving current 
619 events.
621 4.8.11 load-movie <filename> (implemented for wxwidgets)
623 Load savestate <filename>, ignoring save part in readonly mode.
625 4.8.12 save-state <filename> (implemented for wxwidgets)
627 Save system state to <filename> as soon as possible.
629 4.8.13 save-movie <filename> (implemented for wxwidgets)
631 Save movie to <filename>.
633 4.8.14 set-rwmode (implemented for wxwidgets)
635 Set read-write mode.
637 4.8.15 set-romode (implemented for wxwidgets)
639 Set read-only mode
641 4.8.16 toggle-rwmode (implemented for wxwidgets)
643 Toggle between read-only and read-write modes.
645 4.8.17 set-gamename <name> (implemented for wxwidgets)
647 Set name of the game to <name>
649 4.8.18 get-gamename (implemented for wxwidgets)
651 Print the name of the game.
653 4.8.19 add-author <author> (implemented for wxwidgets)
655 Adds new author <author>. If <author> does not contain '|' it is 
656 full name. If it contains '|', '|' splits the full name and 
657 nickname.
659 4.8.20 edit-author <num> <author> (implemented for wxwidgets)
661 Edit the author in slot <num> (0-based) to be <author> (see 
662 add-author for format)
664 4.8.21 remove-author <num> (implemented for wxwidgets)
666 Remove author in slot <num>
668 4.8.22 print-authors (implemented for wxwidgets)
670 Print authors.
672 4.8.23 test-1, test-2, test-3 (N/A for wxwidgets)
674 Internal test commands. Don't use.
676 4.8.24 take-screenshot <filename> (implemented for wxwidgets)
678 Save screenshot to <filename>.
680 4.8.25 +controller<num><button> (N/A for wxwidgets)
682 Press button <button> on controller <num> (1-8). The following 
683 button names are known:
685 • left
687 • right
689 • up
691 • down
693 • A
695 • B
697 • X
699 • Y
701 • L
703 • R
705 • select
707 • start
709 • trigger
711 • cursor
713 • pause
715 • turbo
717 4.8.26 controllerh<num><button>
719 Hold/unhold button <button> on controller <num> (1-8). See 
720 +controller for button names.
722 4.8.27 autofire (<pattern>|-)... (N/A for wxwidgets)
724 Set autofire pattern. Each parameter is comma-separated list of 
725 button names (in form of 1start, 1A, 2B, etc..) to hold on that 
726 frame. After reaching the end of pattern, the pattern restarts 
727 from the beginning.
729 4.8.28 repaint (N/A for wxwidgets)
731 Force a repaint.
733 4.9 Save jukebox (implemented for wxwidgets)
735 4.9.1 cycle-jukebox-backward (N/A for wxwidgets)
737 Cycle save jukebox backwards.
739 4.9.2 cycle-jukebox-forward (N/A for wxwidgets)
741 Cycle save jukebox forwards
743 4.9.3 add-jukebox-save <filename> (N/A for wxwidgets)
745 Add <filename> to jukebox saves.
747 4.9.4 load-jukebox (N/A for wxwidgets)
749 Do load from jukebox (current mode).
751 4.9.5 save-jukebox (N/A for wxwidgets)
753 Do state save to jukebox.
755 4.10 Lua (implemented for wxwidgets)
757 Only available if lua support is compiled in.
759 4.10.1 <<<<<<< HEADevaluate-lua <luacode>=======eval-lua 
760   <luacode> (implemented for wxwidgets)>>>>>>> Wxwidgets Graphics 
761   plugin WIP
763 Run Lua code <luacode> using built-in Lua interpretter.
765 4.10.2 run-lua <script> (implemented for wxwidgets)
767 Run specified lua file using built-in Lua interpretter.
769 4.11 Memory watch
771 4.11.1 add-watch <name> <expression>
773 Adds new watch (or modifies old one).
775 4.11.2 remove-watch <name>
777 Remove a watch.
779 4.12 Sound (implemented for wxwidgets)
781 4.12.1 enable-sound <on/off> (implemented for wxwidgets)
783 Enable/Disable sound.
785 4.12.2 set-sound-device <device> (implemented for wxwidgets)
787 Set sound device to <device>
789 4.12.3 show-sound-status (implemented for wxwidgets)
791 Show status of sound system.
793 4.12.4 show-sound-devices (N/A for wxwidgets)
795 Show all available devices.
797 4.13 SDL Platform commands (implemented for wxwidgets)
799 The following are valid on SDL platform.
801 4.13.1 identify-key (N/A for wxwidgets)
803 Asks to press a key and then identifies that (pseudo-)key.
805 4.13.2 toggle-console (N/A for wxwidgets)
807 Toggle between windowed/fullscreen console.
809 4.13.3 scroll-fullup (N/A for wxwidgets)
811 Scroll messages window as far back as it goes.
813 4.13.4 scroll-fulldown (N/A for wxwidgets)
815 Scroll messages window as far forward as it goes.
817 4.13.5 scroll-up (N/A for wxwidgets)
819 Scroll messages window back one screenful.
821 4.13.6 scroll-down (N/A for wxwidgets)
823 Scroll messages window forward one screenful.
825 5 Settings
827 5.1 Core settings
829 5.1.1 firmwarepath
831 Set where bsnes looks for firmware files. Default is “.”.
833 5.1.2 targetfps
835 Set the target fps. Numeric, range is 0.001 to “infinite”. 
836 Default is native framerate.
838 5.1.3 savecompression
840 Set save compression level (integer 0-9). Default is 7 (0 is no 
841 compression).
843 5.1.4 advance-timeout
845 Set the frame advance timeout in milliseconds. Numeric integer, 
846 range is 0-999999999. Default is 500.
848 5.2 AVI dumper settings
850 5.2.1 avi-large
852 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
853 the console outputs.
855 5.2.2 avi-left-border
857 AVI dumper: Set the default left border thickness (unless lua 
858 overrides) for dumps. Range 0-8191. Default is 0.
860 5.2.3 avi-right-border
862 AVI dumper: Set the default right border thickness (unless lua 
863 overrides) for dumps. Range 0-8191. Default is 0.
865 5.2.4 avi-top-border
867 AVI dumper: Set the default top border thickness (unless lua 
868 overrides) for dumps. Range 0-8191. Default is 0.
870 5.2.5 avi-bottom-border
872 AVI dumper: Set the default bottom border thickness (unless lua 
873 overrides) for dumps. Range 0-8191. Default is 0.
875 5.2.6 avi-maxframes
877 AVI dumper: Maximum number of frames per dump segment (0 => 
878 unlimited). Range 0-999999999. Default is 0.
880 5.3 SDL platform settings
882 5.3.1 autorepeat-first-delay
884 Sets the delay for first character in typematic autorepeat.
886 5.3.2 autorepeat-subsequent-delay
888 Sets the delay for subsequent characters in typematic autorepeat.
890 6 Lua functions
892 6.1 Core (in main table)
894 6.1.1 print
896 Print line to message console.
898 6.1.2 exec(string command)
900 Run command as it was entered on the command line
902 6.2 Table bit:
904 Bitwise logical functions and related.
906 6.2.1 bit.none(number...) / bit.bnot(number...)
908 48-bit bitwise NOT / NONE function (set bits that are set in none 
909 of the arguments).
911 6.2.2 bit.any(number...) / bit.bor(number...)
913 48-bit bitwise OR / ANY function (set bits that are set in any of 
914 the arguments).
916 6.2.3 bit.all(number...) / bit.band(number...)
918 48-bit bitwise AND / ALL function (set bits that are set in all 
919 of the arguments).
921 6.2.4 bit.parity(number...) / bit.bxor(number...)
923 48-bit bitwise XOR / PARITY function (set bits that are set in 
924 odd number of the arguments).
926 6.2.5 bit.lrotate(number base[, number amount[, number bits]])
928 Rotate bits-bit (max 48, default 48) number left by amount 
929 (default 1) places.
931 6.2.6 bit.rrotate(number base[, number amount[, number bits]])
933 Rotate bits-bit (max 48, default 48) number right by amount 
934 (default 1) places.
936 6.2.7 bit.lshift(number base[, number amount[, number bits]])
938 Shift bits-bit (max 48, default 48) number left by amount 
939 (default 1) places. The new bits are filled with zeroes.
941 6.2.8 bit.lrshift(number base[, number amount[, number bits]])
943 Shift bits-bit (max 48, default 48) number logically right by 
944 amount (default 1) places. The new bits are filled with zeroes.
946 6.2.9 bit.arshift(number base[, number amount[, number bits]])
948 Shift bits-bit (max 48, default 48) number arithmetically right 
949 by amount (default 1) places. The new bits are shifted in with 
950 copy of the high bit.
952 6.3 Table gui:
954 Most of these functions can only be called in on_paint and 
955 on_video callbacks. Exceptions are noted.
957 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
958 the green component, bits 16-23 are the red component, bits 24-31 
959 are alpha component (0 is fully opaque, 255 is almost 
960 transparent). -1 is the fully transparent color. Alpha values 
961 greater than 127 do work.
963 Origin of coordinates is at top left corner of game display area. 
964 Left and top gaps correspond to negative coordinates.
966 6.3.1 gui.resolution()
968 Returns 2-tuple (hresolution, vresolution).
970 6.3.2 gui.<class>_gap(number gap)
972 Set the <class> (left, right, top, bottom) gap to specified value 
973 (max gap is 8191).
975 6.3.3 gui.text(number x, number y, string text[, number fgc[, 
976   number bgc]])
978 Draw specified text on the GUI (each character cell is 8 or 16 
979 wide and 16 high). Parameters:
981 • x: X-coordinate to start the drawing from (and x-coordinate at 
982   begining of the lines).
984 • y: Y-coordinate to start the drawing from.
986 • text: The text to draw.
988 • fgc: Text color (default is 0xFFFFFF (white))
990 • bgc: Background color (default is -1 (transparent))
992 6.3.4 gui.textH(number x, number y, string text[, number fgc[, 
993   number bgc]])
995 Like gui.text, but draw using double-width.
997 6.3.5 gui.textV(number x, number y, string text[, number fgc[, 
998   number bgc]])
1000 Like gui.text, but draw using double-height.
1002 6.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
1003   number bgc]])
1005 Like gui.text, but draw using double-width/double-height.
1007 6.3.7 gui.rectangle(number x, number y, number width, number 
1008   height[, number thickness[, number outline[, number fill]]])
1010 Draw rectangle on the GUI. Parameters:
1012 • x: X-coordinate of left edge.
1014 • y: Y-coordinate of upper edge.
1016 • width: Width of rectangle.
1018 • height: Height of rectangle.
1020 • thickness: Thickness of outline (default is 1).
1022 • outline: Color of outline (default is 0xFFFFFF (white))
1024 • fill: Color of fil (default is -1 (transparent))
1026 6.3.8 gui.pixel(number x, number y[, number color])
1028 Draw one pixel on the GUI. Parameters:
1030 • x: X-coordinate of the pixel
1032 • y: Y-coordinate of the pixel
1034 • color: Color of the pixel (default is 0xFFFFFF (white))
1036 6.3.9 gui.crosshair(number x, number y[, number length[, number 
1037   color]])
1039 Draw a crosshair. Parameters:
1041 • x: X-coordinate of the crosshair
1043 • y: Y-coordinate of the crosshair
1045 • length: Length of the crosshair lines (default 10).
1047 • color: Color of the crosshair (default is 0xFFFFFF (white))
1049 6.3.10 gui.line(number x1, number y1, number x2, number y2[, 
1050   number color])
1052 Draw a thin line. Parameters:
1054 • x1: X-coordinate of one end.
1056 • y1: Y-coordinate of one end.
1058 • x2: X-coordinate of the other end.
1060 • y2: Y-coordinate of the other end.
1062 • color: Color of the line (default is 0xFFFFFF (white)).
1064 6.3.11 gui.circle(number x, number y, number r[, number thick[, 
1065   number border[, number fil]]])
1067 Draw a circle. Parameters.
1069 • x: X-coordinate of the center
1071 • y: Y-coordinate of the center
1073 • r: The radius of the circle
1075 • thick: Border thickness
1077 • border: Border color (default is 0xFFFFFF (white))
1079 • fill: Fill color (default is -1 (transparent)).
1081 6.3.12 gui.repaint()
1083 Request on_repaint() to happen as soon as possible. Can be used 
1084 anywhere.
1086 6.3.13 gui.subframe_update(boolean on)
1088 Request subframe updates (calling on_paint() on subframes) to 
1089 happen (on=true) or not happen (on=false). Can be used anywhere.
1091 6.3.14 gui.screenshot(string filename)
1093 Write PNG screenshot of the current frame (no drawings) to 
1094 specified file. Can be used anywhere.
1096 6.3.15 gui.color(number r, number g, number b[, number a])
1098 Returns color (in notation Lua scripts use) corresponding to 
1099 color (r,g,b), each component in scale 0-255. If a is specified, 
1100 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1101 The default alpha is 256.
1103 6.3.16 gui.status(string name, string value)
1105 Set status field “L[<name>]” to <value> in status area. Can be 
1106 used anywhere.
1108 6.4 table input
1110 Input handling. Only available in on_input callback.
1112 6.4.1 input.get(number controller, number index)
1114 Read the specified index (0-11) from specified controller (0-7). 
1115 Notes:
1117 • Uses physical controller numbering. Gamepad in port 2 is 
1118   controller 4, not 1!
1120 6.4.2 input.set(number controller, number index, number value)
1122 Write the specified index (0-11) from specified controller (0-7), 
1123 storing value. Notes:
1125 • Uses physical controller numbering. Gamepad in port 2 is 
1126   controller 4, not 1!
1128 6.4.3 input.reset([number cycles])
1130 Execute reset. If cycles is greater than zero, do delayed reset. 
1131 0 (or no value) causes immediate reset.
1133 • Only available with subframe flag false.
1135 6.5 Table hostmemory
1137 Host memory handling (extra memory saved to savestates). Host 
1138 memory starts empty.
1140 6.5.1 hostmemory.read(number address)
1142 Reads hostmemory slot address. Slot numbers out of range return 
1143 false instead of numeric.
1145 6.5.2 hostmemory.write(number address, number value)
1147 Writes hostmemory slot with 0-255. Slot numbers out of range 
1148 cause extension of host memory slot space.
1150 6.5.3 hostmemory.readbyte(number address)
1152 Read unsigned byte (1 element) from given address. Slots out of 
1153 range return false.
1155 6.5.4 hostmemory.writebyte(number address, number value)
1157 Write unsigned byte (1 element) to given slot. Slot numbers out 
1158 of range cause extension.
1160 6.5.5 hostmemory.readsbyte(number address)
1162 Read signed byte (1 element) from given address. Slots out of 
1163 range return false.
1165 6.5.6 hostmemory.writesbyte(number address, number value)
1167 Write signed byte (1 element) to given slot. Slot numbers out of 
1168 range cause extension.
1170 6.5.7 hostmemory.readword(number address)
1172 Read unsigned word (2 elements) from given address. Slots out of 
1173 range return false.
1175 6.5.8 hostmemory.writeword(number address, number value)
1177 Write unsigned word (2 elements) to given slot. Slot numbers out 
1178 of range cause extension.
1180 6.5.9 hostmemory.readsword(number address)
1182 Read signed word (2 elements) from given address. Slots out of 
1183 range return false.
1185 6.5.10 hostmemory.writesword(number address, number value)
1187 Write signed word (2 elements) to given slot. Slot numbers out of 
1188 range cause extension.
1190 6.5.11 hostmemory.readdword(number address)
1192 Read unsigned doubleword (4 elements) from given address. Slots 
1193 out of range return false.
1195 6.5.12 hostmemory.writedword(number address, number value)
1197 Write unsigned doubleword (4 elements) to given slot. Slot 
1198 numbers out of range cause extension.
1200 6.5.13 hostmemory.readsdword(number address)
1202 Read signed doubleword (4 elements) from given address. Slots out 
1203 of range return false.
1205 6.5.14 hostmemory.writesdword(number address, number value)
1207 Write signed doubleword (4 elements) to given slot. Slot numbers 
1208 out of range cause extension.
1210 6.5.15 hostmemory.readqword(number address)
1212 Read unsigned quadword (8 elements) from given address. Slots out 
1213 of range return false.
1215 6.5.16 hostmemory.writeqword(number address, number value)
1217 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1218 out of range cause extension.
1220 6.5.17 hostmemory.readsqword(number address)
1222 Read signed quadword (8 elements) from given address. Slots out 
1223 of range return false.
1225 6.5.18 hostmemory.writesqword(number address, number value)
1227 Write signed quadword (8 elements) to given slot. Slot numbers 
1228 out of range cause extension.
1230 6.6 Table movie
1232 Movie handling
1234 6.6.1 movie.currentframe()
1236 Return number of current frame.
1238 6.6.2 movie.framecount()
1240 Return number of frames in movie.
1242 6.6.3 movie.readonly()
1244 Return true if in readonly mode, false if in readwrite.
1246 6.6.4 movie.set_readwrite()
1248 Set readwrite mode (does not cause on_readwrite callback).
1250 6.6.5 movie.frame_subframes(number frame)
1252 Count number of subframes in specified frame (frame numbers are 
1253 1-based) and return that.
1255 6.6.6 movie.read_subframe(number frame, number subframe)
1257 Read specifed subframe in specified frame and return data as 
1258 array (100 elements, numbered 0-99 currently).
1260 6.7 Table settings
1262 Routines for settings manipulation
1264 6.7.1 settings.get(string name)
1266 Get value of setting. If setting is blank, returns false. If 
1267 setting value can't be obtained, returns (nil, error message).
1269 6.7.2 settings.set(string name, string value)
1271 Set value of setting. If setting can't be set, returns (nil, 
1272 error message).
1274 6.7.3 settings.is_set(string name)
1276 Returns if setting is set. If setting does not exist, returns 
1277 (nil, error message).
1279 6.7.4 settings.blank(string name)
1281 Blanks a setting and returns true. If setting can't be blanked, 
1282 returns (nil, error message).
1284 6.8 Table memory
1286 Contains various functions for managing memory
1288 6.8.1 memory.vma_count()
1290 Returns the number of VMAs
1292 6.8.2 memory.read_vma(number index)
1294 Reads the specified VMA (indices start from zero). Trying to read 
1295 invalid VMA gives nil. The read VMA is table with the following 
1296 fields:
1298 • region_name (string): The readable name of the VMA
1300 • baseaddr (number): Base address of the VMA
1302 • lastaddr (number): Last address in the VMA.
1304 • size (number): The size of VMA in bytes.
1306 • readonly (boolean): True of the VMA corresponds to ROM.
1308 • native_endian (boolean): True if the VMA has native endian as 
1309   opposed to little endian.
1311 6.8.3 memory.find_vma(number address)
1313 Finds the VMA containing specified address. Returns table in the 
1314 same format as read_vma or nil if not found.
1316 6.8.4 memory.readbyte(number address)
1318 Reads the specified address as unsigned byte and returns the 
1319 result.
1321 6.8.5 memory.readsbyte(number address)
1323 Reads the specified address as signed byte and returns the 
1324 result.
1326 6.8.6 memory.writebyte(number address, number value)
1328 Writes the specified value (negative values undergo 2's 
1329 complement) to specified address (as a byte).
1331 6.8.7 memory.readword(number address)
1333 Reads the specified address as unsigned word and returns the 
1334 result.
1336 6.8.8 memory.readsword(number address)
1338 Reads the specified address as signed word and returns the 
1339 result.
1341 6.8.9 memory.writeword(number address, number value)
1343 Writes the specified value (negative values undergo 2's 
1344 complement) to specified address (as a word).
1346 6.8.10 memory.readdword(number address)
1348 Reads the specified address as unsigned doubleword and returns 
1349 the result.
1351 6.8.11 memory.readsdword(number address)
1353 Reads the specified address as signed doubleword and returns the 
1354 result.
1356 6.8.12 memory.writedword(number address, number value)
1358 Writes the specified value (negative values undergo 2's 
1359 complement) to specified address (as a doubleword).
1361 6.8.13 memory.readqword(number address)
1363 Reads the specified address as unsigned quadword and returns the 
1364 result.
1366 6.8.14 memory.readsqword(number address)
1368 Reads the specified address as signed quadword and returns the 
1369 result.
1371 6.8.15 memory.writeqword(number address, number value)
1373 Writes the specified value (negative values undergo 2's 
1374 complement) to specified address (as a quadword).
1376 6.9 Table _SYSTEM
1378 Contains copy of global variables from time of Lua 
1379 initialization. Non-writeable.
1381 6.10 Callbacks
1383 Various callbacks to Lua that can occur.
1385 6.10.1 Callback: on_paint()
1387 Called when screen is being painted. Any gui.* calls requiring 
1388 graphic context draw on the screen.
1390 6.10.2 Callback: on_video()
1392 Called when video dump frame is being painted. Any gui.* calls 
1393 requiring graphic context draw on the video.
1395 6.10.3 Callback: on_frame()
1397 Called on each starting whole frame.
1399 6.10.4 Callback: on_startup()
1401 Called when the emulator is starting (lsnes.rc and --run files 
1402 has been run).
1404 6.10.5 Callback: on_pre_load(string name)
1406 Called just before savestate/movie load occurs (note: loads are 
1407 always delayed, so this occurs even when load was initiated by 
1408 lua).
1410 6.10.6 Callback: on_err_load(string name)
1412 Called if loadstate goes wrong.
1414 6.10.7 Callback: on_post_load(string name, boolean was_savestate)
1416 Called on successful loadstate. was_savestate gives if this was a 
1417 savestate or a movie.
1419 6.10.8 Callback: on_pre_save(string name, boolean is_savestate)
1421 Called just before savestate save occurs (note: movie saves are 
1422 synchronous and won't trigger these callbacks if called from 
1423 Lua).
1425 6.10.9 Callback: on_err_save(string name)
1427 Called if savestate goes wrong.
1429 6.10.10 Callback: on_post_save(string name, boolean is_savestate)
1431 Called on successful savaestate. is_savestate gives if this was a 
1432 savestate or a movie.
1434 6.10.11 Callback: on_quit()
1436 Called when emulator is shutting down.
1438 6.10.12 Callback: on_input(boolean subframe)
1440 Called when emulator is just sending input to bsnes core. 
1441 Warning: This is called even in readonly mode, but the results 
1442 are ignored.
1444 6.10.13 Callback: on_reset()
1446 Called when SNES is reset.
1448 6.10.14 Callback: on_readwrite()
1450 Called when moving into readwrite mode as result of “set-rwmode” 
1451 command (note: moving to rwmode by Lua won't trigger this, as per 
1452 recursive entry protection).
1454 6.10.15 Callback: on_snoop(number port, number controller, number 
1455   index, number value)
1457 Called each time bsnes asks for input. The value is the final 
1458 value to be sent to bsnes core (readonly mode, autohold and 
1459 autofire have been taken into account). Might be useful when 
1460 translating movies to format suitable for console verification. 
1461 Note: There is no way to modify the value to be sent.
1463 7 Modifier and key names:
1465 7.1 SDL Platform
1467 7.1.1 Modifier names
1469 Following modifier names are known:
1471 • ctrl, lctrl, rctrl: Control keys
1473 • alt, lalt, ralt: ALT keys.
1475 • shift, lshift, rshift: Shift keys.
1477 • meta, lmeta, rmeta: Meta keys.
1479 • num, caps: Numlock/Capslock (these are sticky!)
1481 • mode: Mode select.
1483 7.1.2 Key names
1485 Following key names are known:
1487 • backspace, tab, clear, return, pause, escape, space, exclaim, 
1488   quotedbl, hash, dollar, ampersand, quote, leftparen, 
1489   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
1490   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
1491   greater, question, at, leftbracket, backslash, rightbracket, 
1492   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
1493   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
1494   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
1495   world_8, world_9, world_10, world_11, world_12, world_13, 
1496   world_14, world_15, world_16, world_17, world_18, world_19, 
1497   world_20, world_21, world_22, world_23, world_24, world_25, 
1498   world_26, world_27, world_28, world_29, world_30, world_31, 
1499   world_32, world_33, world_34, world_35, world_36, world_37, 
1500   world_38, world_39, world_40, world_41, world_42, world_43, 
1501   world_44, world_45, world_46, world_47, world_48, world_49, 
1502   world_50, world_51, world_52, world_53, world_54, world_55, 
1503   world_56, world_57, world_58, world_59, world_60, world_61, 
1504   world_62, world_63, world_64, world_65, world_66, world_67, 
1505   world_68, world_69, world_70, world_71, world_72, world_73, 
1506   world_74, world_75, world_76, world_77, world_78, world_79, 
1507   world_80, world_81, world_82, world_83, world_84, world_85, 
1508   world_86, world_87, world_88, world_89, world_90, world_91, 
1509   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
1510   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
1511   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
1512   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
1513   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
1514   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
1515   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
1516   sysreq, break, menu, power, euro, undo
1518 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
1519   key having hardware-dependent scan code of <n> (useful to bind 
1520   those keys that don't have symbolic names).
1522 In addition, following pseudo-keys are known (note: these do not 
1523 work in conjunction with modifers):
1525 • joystick<num>button<button>: Joystick <num> (0-based) button 
1526   <button> (0-based).
1528 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
1529   (0-based) up.
1531 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
1532   (0-based) left.
1534 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
1535   (0-based) down.
1537 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
1538   (0-based) right.
1540 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
1541   negative position (axis modes axis and axis_inverse).
1543 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
1544   positive position (axis modes axis and axis_inverse).
1546 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
1547   pressure (axis modes pressure_*).
1549 7.1.3 Special buttons:
1551 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1553 • Return (also KPEnter): Execute command, ok modal dialog.
1555 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous 
1556   command in command history
1558 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next 
1559   command in command history
1561 • Home (also KP7 if no num lock; command mode): Beginning of 
1562   command.
1564 • End (also KP1 if no num lock; command mode): End of command.
1566 • Left (also KP4 if no num lock; command mode): Move cursor left.
1568 • Right (also KP6 if no num lock; command mode): Move cursor 
1569   right.
1571 • Delete (also KP. if no num lock; command mode): Delete 
1572   character to right of cursor.
1574 • Insert (also KP0 if no num lock; command mode): Toggle between 
1575   insert / overwrite modes.
1577 • Backspace (command mode): Delete character to left of cursor.
1579 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
1580   corrupted!).
1582 7.1.4 Watchdog timer:
1584 If emulator does not reach internal polling loop in 15 seconds 
1585 after leaving it or 15 seconds after starting, the emulator 
1586 instantly bombs out.
1588 8 Movie file format
1590 Movie file is .zip archive in itself, normal ZIP archive tools 
1591 work on it (note: If you recompress it, do not use compression 
1592 methods other than store and deflate and especially do not use 
1593 encryption of any kind).
1595 8.1 Detecting clean start/SRAM/Savestate
1597 • If file has member “savestate” it is savestate, otherwise:
1599 • If file has members with names starting “moviesram.” it is 
1600   movie starting from SRAM, otherwise:
1602 • It is movie starting from clear state.
1604 8.2 Member: gametype
1606 Type of game ROM and region (as one line). Valid values are:
1609 +--------------+---------------------+--------+
1610 |    Value     |       System        | Region |
1611 +--------------+---------------------+--------+
1612 +--------------+---------------------+--------+
1613 |  snes_pal    |     Super NES       |  PAL   |
1614 +--------------+---------------------+--------+
1615 |   sgb_pal    |   Super Game Boy    |  PAL   |
1616 +--------------+---------------------+--------+
1617 |  snes_ntsc   |     Super NES       |  NTSC  |
1618 +--------------+---------------------+--------+
1619 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
1620 +--------------+---------------------+--------+
1621 |     bsx      | BS-X (non-slotted)  |  NTSC  |
1622 +--------------+---------------------+--------+
1623 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
1624 +--------------+---------------------+--------+
1625 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
1626 +--------------+---------------------+--------+
1629 Frame rates are:
1632 +---------+-----------------+
1633 | Region  | Framerate (fps) |
1634 +---------+-----------------+
1635 +---------+-----------------+
1636 |  PAL    |   322445/6448   |
1637 +---------+-----------------+
1638 |  NTSC   | 10738636/178683 |
1639 +---------+-----------------+
1642 8.3 Member: port1
1644 Contains type of port #1 (as one line). Valid values are 'none', 
1645 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
1646 'gamepad'.
1648 8.4 Member: port2
1650 Contains type of port #2 (as one line). Valid values are 'none', 
1651 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
1652 'justifiers'. If not present, defaults to 'none'.
1654 8.5 Member: gamename
1656 Contains name of the game (as one line).
1658 8.6 Member: authors
1660 Contains authors, one per line. Part before '|' is the full name, 
1661 part after is the nickname.
1663 8.7 Member: systemid
1665 Always “lsnes-rr1” (one line). Used to reject other saves.
1667 8.8 Member: controlsversion
1669 Always “0” (one line). Used to identify what controls are there.
1671 8.9 Member: “coreversion”
1673 Contains bsnes core version number (as one line).
1675 8.10 Member: projectid
1677 Contains project ID (as one line). Used to identify if two movies 
1678 are part of the same project.
1680 8.11 Member: {rom,slota,slotb}{,xml}.sha256
1682 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
1683 Absent if corresponding file is absent.
1685 8.12 Member: moviesram.<name>
1687 Raw binary startup SRAM of kind <name>. Only present in 
1688 savestates and movies starting from SRAM.
1690 8.13 Member: saveframe
1692 Contains frame number (as one line) of frame movie was saved on. 
1693 Only present in savestates.
1695 8.14 Member: lagcounter
1697 Current value of lag counter (as one line). Only present in 
1698 savestates.
1700 8.15 Member: pollcounters
1702 Contains poll counters (currently 100 of them), one per line. 
1703 Each line is raw poll count if DRDY is set for it. Otherwise it 
1704 is negative poll count minus one. Only present in savestates.
1706 8.16 Member: hostmemory
1708 Raw binary dump of host memory. Only present in savestates.
1710 8.17 Member: savestate
1712 The raw binary savestate itself. Savestate detection uses this 
1713 file, only present in savestates.
1715 8.18 Member: screenshot
1717 Screenshot of current frame. Only present in savestates. First 2 
1718 bytes are big-endian width of image, rest are 24-bit RGB image 
1719 data. Height of image is inferred from the width and size of 
1720 data.
1722 8.19 Member: sram.<name>
1724 Raw binary SRAM of kind <name> at time of savestate. Only present 
1725 in savestates.
1727 8.20 Member: input
1729 The actual input track, one line per subframe (blank lines are 
1730 skipped).
1732 • If the first byte of each line is '.', ' ', <tab> or '|', then 
1733   the line is part of same frame as previous, otherwise it starts 
1734   a new frame.
1736 • First subframe must start a new frame.
1738 Length of movie in frames is number of lines in input file that 
1739 start a new frame.
1741 8.21 Member: rerecords
1743 Contains textual base-10 rerecord count (as one line; emulator 
1744 just writes this, it doesn't read it) + 1.
1746 8.22 Member: rrdata
1748 This member stores set of load IDs. There is one load ID per 
1749 rerecord (plus one corresponding to start of project).
1751 • This member constists of concatenation of records
1753 • Each record is 2-36 bytes long and can represent 1-16,843,009 
1754   consequtive IDs.
1756 • IDs are interpretted as 256-bit big-endian integers with 
1757   warparound.
1759 • Initial predicted ID is all zeroes.
1761 Format of each record is:
1763 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
1764   bits 5-6 are count length (countlen). Bit 7 is unused.
1766 • 32-prefixlen bytes of ID.
1768 • countlen bytes of big-endian count (count).
1770 Records are processed as follows:
1772 • To form the first ID encoded by record, take the first 
1773   prefixlen bytes predicted ID and append the read ID value to 
1774   it. The result is the first ID encoded.
1776 • If countlen is 0, record encodes 1 ID.
1778 • If countlen is 1, record encodes 2+count IDs.
1780 • If countlen is 2, record encodes 258+count IDs.
1782 • If countlen is 3, record encodes 65794+count IDs.
1784 • The new predicted ID is the next ID after last one encoded by 
1785   the record.
1787 The number of rerecords + 1 is equal to the sum of number of IDs 
1788 encoded by all records.
1790 8.23 Member: starttime.second
1792 Movie starting time, second part. Epoch is Unix epoch. Default is 
1793 1,000,000,000.
1795 8.24 Member: starttime.subsecond
1797 Movie starting time, subsecond part. Unit is CPU clocks. Default 
1798 is 0.
1800 8.25 Member: savetime.second
1802 Movie saving time, second part. Default is starttime.second. Only 
1803 present in savestates.
1805 8.26 Member: savetime.subsecond
1807 Movie saving time, subsecond part. Default is 
1808 starttime.subsecond. Only present in savestates.
1810 9 Compiling:
1812 9.1 Building BSNES
1814 make ui=ui-libsnes profile=accuracy
1816 For Bsnes v084 You need to apply the six patches in 
1817 bsnes-patches/. These fix the following:
1819 1. Make libsnes actually compile (it won't compile without!)
1821 2. Bump the version number to be correct (nice to have)
1823 3. Make RTC emulation time cleanly overridable (needed by games 
1824   using RTC)
1826 4. Save/Load controller state on savestate/loadstate (many games 
1827   screw up without)
1829 5. Fix unserialization of 64-bit integers (needed)
1831 6. Allow frontend to control random number seed (just nice to 
1832   have)
1834 9.2 Prerequisite libraries:
1836 • zlib
1838 • SDL (SDL platform)
1840 • SDLmain (Windows/Mac OS X only; Note you may have to extract 
1841   the object out of archive)
1843 • boost_iostreams
1845 • boost_filesystem
1847 • boost conversion (header only)
1849 9.3 Compile options to make:
1851 9.3.1 BSNES_PATH=<path>
1853 Set path to BSNES bsnes directory to <path>.
1855 9.3.2 THREADS=NO
1857 Don't use threads on Linux.
1859 9.3.3 THREADS=YES
1861 Try to use threads even on non-Linux systems.
1863 9.3.4 CROSS_PREFIX=<prefix>
1865 Prepend this to all commands refering to cross-compiling 
1866 environment with this.
1868 9.3.5 CC=<compiler>
1870 Target C++ compiler to use. Defaults to g++
1872 Note: If crosscompiling, this has to be crosscompiler, and 
1873 CROSS_PREFIX is prepended.
1875 9.3.6 BSNES_IS_COMPAT=1
1877 Assume BSNES uses compatiblity core instead of accuracy core.
1879 9.3.7 LUA=<package>
1881 Compile lua support, using package <package>
1883 9.3.8 GRAPHICS=<plat>
1885 Set graphics platform. Currently available choices are “SDL” and “
1886 WXWIDGETS”.
1888 9.3.9 SOUND=<plat>
1890 Set sound platform. Currently available choices are “SDL” 
1891 (requires SDL graphics), “PORTAUDIO” and “DUMMY”.
1893 9.3.10 JOYSTICK=<plat>
1895 Set joystick platform. Currently available choices are “SDL” 
1896 (requires SDL graphics), “EVDEV” and “DUMMY”.
1898 10 Quick'n'dirty encode guide
1900 1. Start the emulator and load the movie file.
1902 2. Set large AVI option 'set-setting avi-large on'
1904 3. Enable dumping 'dump-avi tmpdump' 
1906 4. Unpause and let it run until you want to end dumping.
1908 5. Close the emulator (closing the window is the easiest way). Or 
1909   use 'end-avi'.
1911 6. For each tmpdump*.avi file created, on command prompt, do 
1912   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
1914 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
1916 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
1917   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
1918   tmpdump_<numbers>.mkv, with + in between).
1920 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
1921   final.mkv contains quick'n'dirty encode.
1923 11 Axis configurations for some gamepad types:
1925 11.1 XBox360 controller:
1927 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
1928 set to pressure-+.
1930 set-axis joystick0axis2 pressure-+
1932 set-axis joystick0axis5 pressure-+
1934 11.2 PS3 “sixaxis” controller:
1936 Axes 8-19 should be disabled.
1938 set-axis joystick0axis8 disabled
1940 set-axis joystick0axis9 disabled
1942 set-axis joystick0axis10 disabled
1944 set-axis joystick0axis11 disabled
1946 set-axis joystick0axis12 disabled
1948 set-axis joystick0axis13 disabled
1950 set-axis joystick0axis14 disabled
1952 set-axis joystick0axis15 disabled
1954 set-axis joystick0axis16 disabled
1956 set-axis joystick0axis17 disabled
1958 set-axis joystick0axis18 disabled
1960 set-axis joystick0axis19 disabled
1962 12 Errata:
1964 12.1 Problems from BSNES core:
1966 • The whole pending save stuff.
1968 • Lack of layer hiding.
1970 • It is slow.
1972 • Firmwares can't be loaded from ZIP archives.
1974 12.2 Other problems:
1976 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
1978 • Audio for last dumped frame is not itself dumped.
1980 • Audio in UI is pretty bad in quality.
1982 • UI itself is 30fps max (SDL).
1984 • AVI compression levels 10-18 are not compatible with AVISynth 
1985   AVISource.
1987 • No menus, command based interface (SDL).
1989 • Long commands don't scroll.
1991 • The SDL screen drawing is slow.
1993 • Wxwidgets UI slows down with time.
1995 • Movies use way too much (like at least 10x what would be 
1996   needed) memory.
1998 13 Changelog:
2000 13.1 rr0-beta1
2002 • Fix -Wall warnings
2004 • Fix dumper video corruption with levels 10-18.
2006 13.2 rr0-beta2
2008 • Autofire
2010 • Lots of code cleanups
2012 • Lua interface to settings
2014 • Allow specifying AVI borders without Lua
2016 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2018 • on_snoop lua callback
2020 • Faster movie loading and saving.
2022 13.3 rr0-beta3
2024 • Joystick support
2026 13.4 rr0-beta4
2028 • Fix multi-buttons
2030 • Save jukebox functionality.
2032 13.5 rr0-beta5
2034 • Try to fix some nasty failing movie load edge cases
2036 • Allow specifying scripts to run on command line.
2038 13.6 rr0-beta6
2040 • Major source code reorganization.
2042 • Backup savestates before overwriting.
2044 • Don't crash if loading initial state fails.
2046 13.7 rr0-beta7
2048 • Fix firmware lookup
2050 • Fix author name parsing
2052 • Fix rerecord counting
2054 • (SDL) Print messages to console if SDL is uninitialized
2056 • Add movieinfo program
2058 • Fix loading movies starting from SRAM.
2060 13.8 rr0-beta8
2062 • Add support for unattended dumping
2064 • Fix compiling for Win32
2066 • Don't lock up if sound can't be initialized
2068 • Strip trailing CR from commands
2070 • Don't try to do dubious things in global ctors (fix crash on 
2071   startup)
2073 13.9 rr0-beta9
2075 • Small documentation tweaking
2077 • Fix make clean
2079 • Fix major bug in modifier matching
2081 13.10 rr0-beta10
2083 • Lots of documentation fixes
2085 • Use dedicated callbacks for event backcomm., not commands.
2087 • Ensure that the watchdog is not hit when executing delayed 
2088   reset.
2090 • Remove errant tab from joystick message.
2092 13.11 rr0-beta11
2094 • Make autofire operate in absolute time, not linear time
2096 • Reinitialize controls when resuming from loadstate
2098 • Some more code cleanups
2100 • If Lua allocator fails, call OOM_panic()
2102 • Byte/word/dword/qword sized host memory write/read functions.
2104 • Dump at correct framerate if dumping interlaced NTSC 
2105   (height=448).
2107 13.12 rr0-beta12
2109 • Actually include the complete source code
2111 • Keep track of RTC
2113 13.13 rr0-beta13
2115 • Document {save,start}time.{,sub}second.
2117 • Intercept time() from bsnes core.
2119 13.14 rr0-beta14
2121 • Allow disabling time() interception (allow build on Mac OS X)
2123 • Use SDLMain on Mac OS X (make SDL not crash)
2125 • Disable delayed resets (just plain too buggy for now).
2127 • Code cleanups
2129 • Use 16-bit for graphics/video instead of 32-bit.
2131 • gui.rectangle/gui.pixel
2133 • gui.crosshair
2135 • New CSCD writer implementation.
2137 13.15 rr0-beta15
2139 • Fix interaction of * and +.
2141 • Manual improvements
2143 • Use gettimeofday()/usleep(), these seem portable enough.
2145 • Move joystick axis manipulation to keymapper code.
2147 • Changes to how read-only works.
2149 • Refactor controller input code.
2151 13.16 rr0-beta16
2153 • Fix mouseclick scale compensation.
2155 • Draw area boundaries correctly in SDL code.
2157 • gui.screenshot.
2159 • Fix CSCD output (buffer overrun and race condition).
2161 13.17 rr0-beta17
2163 • JMD dumping support.
2165 • Allow unattended dumping to JMD.
2167 • Move to BSNES v083.
2169 • Switch back to 32-bit colors.
2171 • Add Lua function gui.color.
2173 • Use some new C++11 features in GCC 4.6.
2175 • Be prepared for core frequency changes.
2177 • Pass colors in one chunk from Lua.
2179 13.18 rr0-beta18
2181 • New lua functions gui.line(), gui.status() and gui.circle(), 
2182   memory.vma_count(), memory.read_vma() and memory.find_vma().
2184 • Numerious documentation fixups
2186 • RTC time format changed
2188 • Reformat flags display
2190 • Allow lua package name to be overridden
2192 • SDUMP (high-quality dumping).
2194 • Split platform support to plugins.
2196 • Make all sound plugins support basic sound commands
2198 • Support portaudio for sound.
2200 • Allow disable Lua/SDL searching.
2202 • Upconvert colors when copying lcscreen to screen.
2204 • Reorganize source tree.
2206 • Evdev joystick support.
2208 • Refactor more code into generic window code.
2210 13.19 rr0-beta19
2212 • Refactor message handling.
2214 • Rework makefile
2216 • Documentation fixes
2218 • Finish pending saves before load/quit.
2220 • Wxwidgets graphics plugin.
2222 13.20 rr0-beta20
2224 • Get rid of win32-crap.[ch]pp.
2226 • Move files around a lot.
2228 • Get rid of need for host C++ compiler.
2230 • Bsnes v084 core.
2232 • Refactor inter-component communication.
2234 • Fix zero luma.
2236 • Fix crash on multiline aliases.
2238 • Load/Save settings in wxwidgets gui.
2240 13.21 rr0-beta21
2242 • Patch problems in bsnes core
2244 • SNES is little-endian, not big-endian!
2246 • Fix memory corruption in lcscreen::load()
2248 13.22 rr0-beta22
2250 • Fix interpretting repeat counts in rrdata loading.
2252 • New lua callback: on_frame()
2254 • Remove calls to runtosave() that aren't supposed to be there
2256 • Lua function: movie.read_rtc()
2258 • Ignore src/fonts/font.cpp
2260 • Fix more bsnes core problems
2262 • Control bsnes random seeding
2264 • Pause-on-end
2266 • Some bsnes core debugging features (state dump and state hash)
2268 • Fix titlebar version number (no, the last version wasn't 
2269   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2271 13.23 rr0-beta23
2273 • Fix memory corruption due to macro/field mixup
2275 • search-memory update
2277 • Allow direct-mapped framebuffer
2279 • SDL: Use SDL_ANYFORMAT if possible
2281 • SDMP2SOX: 2s delay modes.
2283 • Wxwidgets: Cleanups
2285 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2287 • Wxwidgets: Save jukebox on exit
2289 • Fix RTC if using load-movie on savestate.
2291 • Fix crash related to full console mode.
2293 13.24 rr0-beta24
2295 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2296   X.
2298 • Wxwidgets: Allow compiling on Mac OS X.
2300 • Use movie compare instead of movie hashing (faster save/load).
2302 • Lua: _SYSTEM table.
2304 13.25 rr0-beta25
2306 • sdmp2sox: Pad soundtrack if using -l or -L.
2308 • sdmp2sox: Fix NTSC overscan.
2310 • sdmp2sox: Add AR correction mode.
2312 • call lua_close() when exiting.
2314 • Fix zip_writer bug causing warnings from info-zip and error 
2315   from advzip.
2317 13.26 rr0-beta26
2319 • Fix IPS patching code (use bsnes core IPS patcher).
2321 • Implement BPS patching (using bsnes core IPS patcher).
2323 • Add feature to load headered ROMs.
2325 13.27 rr0-beta27
2327 • Show command names when showing keybindings
2329 13.28 rr0
2331 • Fix pause-on-end to be actually controllable
2333 • SDL: Poll all events in queue, not just first one (fixes 
2334   slowness in command typing)
2336 • Wxwidgets: Fix ROM loading.
2338 13.29 rr1-beta0
2340 • Lua: Add gui.textH, gui.textV, gui.textHV
2342 • Fix text colors on SDL on Mac OS X
2344 • Mode 'F' for finished in readonly mode.
2346 • Fix some WS errors.
2348 • Reliably pause after skip poll
2350 • Split UI and core into their own threads
2352 13.30 rr1-beta1
2354 • Remove leftover dummy SRAM slot
2356 • Fix controller numbers.
2358 13.31 rr1-beta2
2360 • Fix lsnes-dumpavi after interface change.
2362 • Also give BSNES patches for v085.
2364 • Pack movie data in memory.