Fix compilation if wxString is wchar_t-based
[lsnes.git] / manual.txt
blob6f14ecf2cccb94d364a1f18ee6cfa9325e0b8443
1 1 Introduction
3 lsnes is SNES rerecording emulator based on bsnes core.
5 2 Dependencies
7 1. bsnes libsnes (for bsnes SNES core)
9   (a) v084-v087 (v084 or v085 for delayreset support)
11   (b) accuracy or compatiblity core with debugger enabled.
13   (c) Patched version (using included 7 patches)
15 2. gambatte (for gambatte core)
17   (a) SVN r320, r358 or r364
19   (b) Patched with included patches
21 3. Zlib
23 4. boost_iostreams
25 5. boost_filesystem
27 6. boost_thread (if native std::thread is not available)
29 7. libsdl (SDL only)
31 8. sdlmain (SDL only, part of SDL)
33 9. boost_conversion (this is header-only library)
35 10. libswscale (wxwidgets graphics only)
37 11. Portaudio (portaudio sound only)
39 12. libao (libao sound only)
41 13. Lua (if Lua support is needed) version 5.1.X or 5.2.X
43 14. G++ 4.6 or 4.7
45 15. libopus (optional, for commentary track tool)
47 3 Building
49 • Copy bsnes sources (the bsnes subdirectory) to subdirectory 
50   'bsnes' (for bsnes core).
52 • Copy gambatte sources to subdirectory 'gambatte' (for gambatte 
53   core).
55 • Patch the bsnes sources with included patches (directory 
56   'bsnes-patches/<version>', bsnes core)
58 • Patch the gambatte sources with included patches (directory 
59   'gambatte-patches/<version>', gambatte core)
61 • Edit options.build (or copy of that file)
63 • Run make (passing 'OPTIONS=<filename>' if using something else 
64   than options.build).
66 4 Command line options
68 4.1 ROM options
70 4.1.1 --rom=<file> (lsnes/SDL, lsnes/wxwidgets, lsnes-avidump)
72 Load <file> as ROM.
74 4.1.2 <file> (lsnes/wxwidgets)
76 Load <file> as ROM.
78 4.2 Session options
80 4.2.1 --pause
82 Start paused
84 4.2.2 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
86 Load <filename> as movie or savestate file. All other session 
87 options are ignored.
89 4.2.3 --port1=<device> (lsnes/SDL, bsnes core only)
91 Set type of port1. Valid values are:
93 • none: No device connected
95 • gamepad: One gamepad (the default)
97 • multitap: Four gamepads (warning: makes most games refuse to 
98   start)
100 • mouse: Mouse.
102 4.2.4 --port2=<type> (lsnes/SDL, bsnes core only)
104 Set type of port2. Valid values are:
106 • none: No device connected (the default)
108 • gamepad: One gamepad
110 • multitap: Four gamepads.
112 • mouse: Mouse
114 • superscope: Super Scope
116 • justifier: One justifier
118 • justifiers: Two justifiers
120 4.2.5 --gamename=<name> (lsnes/SDL)
122 Set the name of game to <name>. Default is blank.
124 4.2.6 --author=<name> (lsnes/SDL)
126 Add author with full name of <name> (no nickname).
128 4.2.7 --author=|<name> (lsnes/SDL)
130 Add author with nickname of <name> (no full name).
132 4.2.8 --author=<fullname>|<nickname> (lsnes/SDL)
134 Add author with full name of <fullname> and nickname of 
135 <nickname>.
137 4.2.9 --rtc-second=<value> (lsnes/SDL)
139 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is 
140 1,000,000,000.
142 4.2.10 --rtc-subsecond=<value> (lsnes/SDL)
144 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
146 4.2.11 --anchor-savestate=<file> (lsnes/SDL)
148 Set the anchor savestate file.
150 4.2.12 --load=<file> (lsnes/wxwidgets)
152 After loading the ROM, load <file> as savestate/movie.
154 4.3 Misc. options:
156 4.3.1 --run=<file> (lsnes/SDL)
158 After running main RC file, run this file. If multiple are 
159 specified, these execute in order specified.
161 4.3.2 --lua=<file> (lsnes/wxwidgets)
163 Run this Lua file on startup
165 4.4 dump options (lsnes-dumpavi only)
167 4.4.1 --dumper=<dumper>
169 Set the dumper to use (required). Use 'list' for listing of known 
170 dumpers.
172 4.4.2 --mode=<mode>
174 Set the mode to use (required for dumpers with multiple modes, 
175 forbidden otherwise). Use 'list' for known modes.
177 4.4.3 --prefix=<prefix>
179 Set dump prefix. Default is “avidump”.
181 4.4.4 --option=<name>=<value>
183 Set option <name> to value <value>.
185 4.4.5 --length=<length>
187 Set number of frames to dump. Mandatory.
189 4.4.6 --lua=<script>
191 Run specified lua script (lsnes-dumpavi does not have 
192 initialization files).
194 4.4.7 --load-library=<library>
196 Load the specified shared object / dynamic library / dynamic link 
197 library.
199 5 Startup file lsnes.rc
201 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as 
202 commands. This file is located in:
204 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
206 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME 
207   exists)
209 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
211 • All: ./lsnes.rc (fallback default).
213 If leading directories do not exist, attempt to create them is 
214 made.
216 6 Internal commands
218 • Commands beginning with '*' invoke the corresponding command 
219   without alias expansion.
221 • If command starts with '+' (after possible '*'), the command is 
222   executed as-is when button is pressed, and when button is 
223   released, it is executed with '+' replaced by '-'.
225 • Commands without '+' execute only on negative edge (release).
227 6.1 Settings:
229 Settings control various aspects of emulator behaviour.
231 6.1.1 set-setting <setting> <value>
233 Sets setting <setting> to value <value> (may be empty).
235 6.1.2 unset-setting <setting>
237 Try to unset setting <setting> (not all settings can be unset).
239 6.1.3 get-setting <setting>
241 Read value of setting <setting>
243 6.1.4 show-settings
245 Print names and values of all settings.
247 6.2 Keybindings
249 Keybindings bind commands or aliases to keys (or pseudo-keys). 
251 Notes:
253 • Do not bind edge active (+/-) commands to keys with modifiers, 
254   that won't work right!
256 • Names of keys and modifiers are platform-dependent.
258 • Be careful before binding pseudo-keys (such as joystick axes, 
259   buttons or hats) with modifiers. That may or may not work 
260   right.
262 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
264 Bind <command> to key <key> (activating if modifiers in <modmask> 
265 (comma-seperated list) are set as <mod> (comma-seperated list).
267 The names of keys and modifiers are platform-dependent.
269 6.2.2 unbind-key [<mod>/<modmask>] <key>
271 Unbind command from <key> (with specified <mod> and <modmask>).
273 6.2.3 set-axis <axis> [disabled | axis | axis-inverse | 
274   pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0 
275   | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>] 
276   [tolerance=<val>]
278 Set axis parameters for axis <axis>.
280 • disabled: Disable axis
282 • axis: Normal axis
284 • axis-inverse: Inverse axis
286 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
288 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
290 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
292 • pressure-+: Pressure sensitive. Released at -, pressed at +.
294 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
296 • pressure+-: Pressure sensitive. Released at +, pressed at -.
298 • minus=<val>: Calibration at extreme minus position 
299   (-32768-32767)
301 • zero=<val>: Calibration at neutral position (-32768-32767)
303 • plus=<val>: Calibration at extreme plus position (-32768-32767)
305 • tolerance=<value>: Center band tolerance (0<x<1). The smaller 
306   the value, the more sensitive the control is.
308 6.2.4 show-bindings
310 Print all key bindings in effect.
312 6.3 Aliases
314 Aliases bind command to sequence of commands. After alias has 
315 been defined, it replaces the command it shadows.
317 Notes:
319 • You can't alias command to itself.
321 • Aliases starting with +/- are edge active just like ordinary 
322   commands starting with +/-.
324 • One command can be aliased to multiple commands.
326 6.3.1 alias-command <command> <expansion>
328 Append <expansion> to alias <command>. If alias does not already 
329 exist, it is created.
331 6.3.2 unalias-command <command>
333 Clear alias expansion for <command>.
335 6.3.3 show-aliases
337 Print all aliases and their expansions in effect.
339 6.4 run-script <script>
341 Run <script> as if commands were entered on the command line.
343 6.5 Video dumping
345 Following commands control video dumping:
347 6.5.1 start-dump <dumper> [<mode>] <prefix/filename>
349 Start dumping using dumper <dumper>. If mode is present or not 
350 and if prefix or filename is present depends on the dumper and 
351 dumper mode.
353 The following dumpers are available:
355 • INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
357   – Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes 
358     prefix.
360   – Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
362 • INTERNAL-JMD: Internal .jmd dumper.
364   – Does not take mode.
366   – Takes a filename.
368 • INTERNAL-RAW: Internal RAW dumper.
370   – Does not take mode.
372   – Takes a prefix.
374   – Sound is big-endian signed 16-bit, usually at 32040.5Hz.
376   – Video is always upscaled to double resolution (512x448 / 512 
377     x 478).
379   – Video framerate is usually 322445/6448 fps for PAL and 
380     10738636/178683 fps for NTSC.
382 • INTERNAL-SDMP: Internal SDMP dumper.
384   – Mode 'ms': Multi-segment. Takes prefix.
386   – Mode 'ss': Single-segment. Takes filename.
388 6.5.2 end-dump <dumper>
390 End dumping using <dumper>
392 6.5.3 show-dumpers [<dumper>]
394 Show the list of dumpers or list of modes for <dumper>
396 6.6 Memory manipulation
398 <address> may be decimal or hexadecimal (prefixed with '0x'). 
399 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
400 signed (prefixed with '-') decimal.
402 The available element <sizes> are:
404 • byte: 1 byte
406 • word: 2 bytes
408 • dword: 4 bytes
410 • qword: 8 bytes
412 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
413 When dealing with DSP memory, multi-byte reads/writes are 
414 native-endian (do not use operand sizes exceeding DSP bitness, 
415 except dword is OK for 24-bit memory).
417 6.6.1 read-<size> <address>
419 Read the value of byte in <address>.
421 6.6.2 read-s<size> <address>
423 Read the value of signed byte in <address>.
425 6.6.3 write-<size> <address> <value>
427 Write <value> to byte in address <address>.
429 6.6.4 search-memory reset
431 Reset the memory search
433 6.6.5 search-memory count
435 Print number of candidates remaining
437 6.6.6 search-memory print
439 Print all candidates remaining
441 6.6.7 search-memory <usflag><sizeflag><op>
443 Searches memory for addresses satisfying criteria.
445 <usflag> can be:
447 • u: unsigned
449 • s: signed
451 <sizeflag> can be:
453 • b: byte
455 • w: word
457 • d: dword
459 • q: qword
461 <op> can be:
463 • lt: < previous value.
465 • le: <= previous value.
467 • eq: = previous value.
469 • ne: != previous value.
471 • ge: >= previous value.
473 • gt: > previous value.
475 6.6.8 search-memory <sizeflag> <value>
477 Searches for addresses that currently have value <value>. 
478 <sizeflag> is as in previous command.
480 6.7 Main commands
482 These commands are not available in lsnesrc, but are available 
483 after ROM has been loaded.
485 6.7.1 quit-emulator [/y]
487 Quits the emulator (asking for confirmation). If /y is given, no 
488 confirmation is asked.
490 6.7.2 pause-emulator
492 Toggle paused/unpaused
494 6.7.3 +advance-frame 
496 Advance frame. If the button is still held after configurable 
497 timeout expires, game unpauses for the duration frame advance is 
498 held.
500 6.7.4 +advance-poll 
502 Advance subframe. If the button is still held after configurable 
503 timeout expires, game unpauses for the duration frame advance is 
504 held.
506 6.7.5 advance-skiplag 
508 Skip to first poll in frame after current.
510 6.7.6 reset 
512 Reset the SNES after this frame.
514 6.7.7 load <filename> 
516 Load savestate <filename> in current mode.
518 6.7.8 load-state <filename> 
520 Load savestate <filename> in readwrite mode.
522 6.7.9 load-readonly <filename> 
524 Load savestate <filename> in readonly mode.
526 6.7.10 load-preserve <filename> 
528 Load savestate <filename> in readonly mode, preserving current 
529 events.
531 6.7.11 load-movie <filename> 
533 Load savestate <filename>, ignoring save part in readonly mode.
535 6.7.12 save-state <filename> 
537 Save system state to <filename> as soon as possible.
539 6.7.13 save-movie <filename> 
541 Save movie to <filename>.
543 6.7.14 set-rwmode 
545 Set read-write mode.
547 6.7.15 set-romode 
549 Set read-only mode
551 6.7.16 toggle-rwmode 
553 Toggle between read-only and read-write modes.
555 6.7.17 set-gamename <name> 
557 Set name of the game to <name>
559 6.7.18 get-gamename 
561 Print the name of the game.
563 6.7.19 add-author <author> 
565 Adds new author <author>. If <author> does not contain '|' it is 
566 full name. If it contains '|', '|' splits the full name and 
567 nickname.
569 6.7.20 edit-author <num> <author> 
571 Edit the author in slot <num> (0-based) to be <author> (see 
572 add-author for format)
574 6.7.21 remove-author <num> 
576 Remove author in slot <num>
578 6.7.22 print-authors 
580 Print authors.
582 6.7.23 test-1, test-2, test-3
584 Internal test commands. Don't use.
586 6.7.24 take-screenshot <filename> 
588 Save screenshot to <filename>.
590 6.7.25 +controller<num><button>
592 Press button <button> on controller <num> (1-8). The following 
593 button names are known:
595 • left
597 • right
599 • up
601 • down
603 • A
605 • B
607 • X
609 • Y
611 • L
613 • R
615 • select
617 • start
619 • trigger
621 • cursor
623 • pause
625 • turbo
627 6.7.26 controllerh<num><button>
629 Hold/unhold button <button> on controller <num> (1-8). See 
630 +controller for button names.
632 6.7.27 controllerf<num><button>
634 Hold/unhold button <button> on controller <num> (1-8) for the 
635 next frame. See +controller for button names.
637 Cauntion: Does not work properly if outside frame advance.
639 6.7.28 autofire (<pattern>|-)...
641 Set autofire pattern. Each parameter is comma-separated list of 
642 button names (in form of 1start, 1A, 2B, etc..) to hold on that 
643 frame. After reaching the end of pattern, the pattern restarts 
644 from the beginning.
646 6.7.29 repaint
648 Force a repaint.
650 6.8 Save jukebox 
652 6.8.1 cycle-jukebox-backward
654 Cycle save jukebox backwards.
656 6.8.2 cycle-jukebox-forward
658 Cycle save jukebox forwards
660 6.8.3 load-jukebox
662 Do load from jukebox (current mode).
664 6.8.4 save-jukebox
666 Do state save to jukebox.
668 6.9 Lua 
670 Only available if lua support is compiled in.
672 6.9.1 evaluate-lua <luacode>
674 Run Lua code <luacode> using built-in Lua interpretter.
676 6.9.2 L <luacode>
678 Synonym for evaluate-lua.
680 6.9.3 run-lua <script>
682 Run specified lua file using built-in Lua interpretter.
684 6.9.4 reset-lua
686 Clear the Lua VM state and restore to factory defaults.
688 6.10 Memory watch
690 6.10.1 add-watch <name> <expression>
692 Adds new watch (or modifies old one).
694 6.10.2 remove-watch <name>
696 Remove a watch.
698 6.11 Sound 
700 6.11.1 enable-sound <on/off> 
702 Enable/Disable sound.
704 6.11.2 set-sound-device <device> 
706 Set sound device to <device>
708 6.11.3 show-sound-status 
710 Show status of sound system.
712 6.11.4 show-sound-devices
714 Show all available devices.
716 6.11.5 set-volume <multiplier>
718 Set the volume multiplier to <multiplier>. 1 is normal volume, 
719 and higher numbers are louder.
721 6.11.6 set-volume <multiplier>%
723 Set the volume multiplier to <multiplier> percent. 100 is normal 
724 volume, and higher numbers are louder.
726 6.11.7 set-volume <multiplier>dB
728 Set the volume multiplier to <multiplier> dB. 0 is normal volume, 
729 and higher numbers are louder. The value may be negative.
731 6.12 Misc.
733 6.12.1 reload-rom [<file>]
735 Reloads the main ROM image from <file>.
737 6.12.2 edit-subtitle <firstframe> <length> [<text>]
739 Edit or delete a subtitle.
741 6.12.3 list-subtitle
743 List subtitles.
745 6.13 Commentary track
747 6.13.1 list-streams
749 List streams
751 6.13.2 play-stream <id>
753 Play stream <id>.
755 6.13.3 delete-stream <id>
757 Delete stream <id>
759 6.13.4 change-timebase <id> <newbase>
761 Change time base of <id> to <newbase>. The time base can be given 
762 as samples (integer) or second (postfix with s).
764 6.13.5 import-stream-opus <timebase> <file>
766 Import opus stream from <file>, placing it at <timebase>. This 
767 operation is lossless.
769 6.13.6 import-stream-pcm <timebase> <file>
771 Import PCM (.sox, 1ch@48kHz) stream from <file>, placing it at 
772 <timebase>.
774 6.13.7 export-stream-opus <id> <file>
776 Export stream <id> as opus stream to <file>. This operation is 
777 lossless.
779 6.13.8 export-stream-pcm <id> <file>
781 Export stream <id> as PCM (.sox) stream to <file>. 
783 6.13.9 export-superstream <file>
785 Export the entiere superstream as PCM (.sox) stream to <file>.
787 6.13.10 load-collection <file>
789 Load collection (if there is existing collection, unload it) from 
790 <file>
792 6.13.11 unload-collection
794 Unload collection.
796 6.13.12 +tangent
798 Tangent for recording voice for commentary track. While pressed, 
799 record a stream.
801 6.14 SDL Platform commands 
803 The following are valid on SDL platform.
805 6.14.1 identify-key
807 Asks to press a key and then identifies that (pseudo-)key.
809 6.14.2 toggle-console 
811 Toggle between windowed/fullscreen console.
813 6.14.3 scroll-fullup 
815 Scroll messages window as far back as it goes.
817 6.14.4 scroll-fulldown 
819 Scroll messages window as far forward as it goes.
821 6.14.5 scroll-up 
823 Scroll messages window back one screenful.
825 6.14.6 scroll-down 
827 Scroll messages window forward one screenful.
829 6.14.7 prompt-command <command>
831 Enter command prompt, with prompt prepopulated with specified 
832 command.
834 7 Settings
836 7.1 Core settings
838 7.1.1 firmwarepath
840 Set where bsnes looks for firmware files. Default is “.”.
842 7.1.2 target
844 Set the target . Numeric, range is 0.001 to “infinite”. Default 
845 is native framerate.
847 7.1.3 savecompression
849 Set save compression level (integer 0-9). Default is 7 (0 is no 
850 compression).
852 7.1.4 advance-timeout
854 Set the frame advance timeout in milliseconds. Numeric integer, 
855 range is 0-999999999. Default is 500.
857 7.1.5 advance-subframe-timeout
859 Subframe advance timeout in milliseconds. Default is 100.
861 7.1.6 save-every-frame (bsnes only)
863 If true, simulate saving on each frame. Trades off emulation 
864 accuracy for sync stability. Also needed if the movie assumes 
865 saving on each frame for rewind.
867 7.2 AVI dumper settings
869 7.2.1 avi-large
871 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
872 the console outputs.
874 7.2.2 avi-left-border
876 AVI dumper: Set the default left border thickness (unless lua 
877 overrides) for dumps. Range 0-8191. Default is 0.
879 7.2.3 avi-right-border
881 AVI dumper: Set the default right border thickness (unless lua 
882 overrides) for dumps. Range 0-8191. Default is 0.
884 7.2.4 avi-top-border
886 AVI dumper: Set the default top border thickness (unless lua 
887 overrides) for dumps. Range 0-8191. Default is 0.
889 7.2.5 avi-bottom-border
891 AVI dumper: Set the default bottom border thickness (unless lua 
892 overrides) for dumps. Range 0-8191. Default is 0.
894 7.2.6 avi-maxframes
896 AVI dumper: Maximum number of frames per dump segment (0 => 
897 unlimited). Range 0-999999999. Default is 0.
899 7.2.7 avi-compresison
901 AVI dumper: Compression level (0-18).
903 • Compression levels 10 and above are not compatible with stock 
904   CSCD codec.
906 • Recomended level is 7.
908 7.2.8 avi-soundrate
910 AVI dumper: Set method of determining the sound rate.
912 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
913   64, 88.2, 96, 128, 176.4 and 192 kHz.
915 • 1: Round down to nearest integer.
917 • 2: Round up to nearest ingeter.
919 7.3 JMD options
921 7.3.1 jmd-copression
923 JMD dumper: Compression level (0-9).
925 7.4 SDL platform settings
927 7.4.1 autorepeat-first-delay
929 Sets the delay for first character in typematic autorepeat.
931 7.4.2 autorepeat-subsequent-delay
933 Sets the delay for subsequent characters in typematic autorepeat.
935 8 Lua functions
937 8.1 Core (in main table)
939 8.1.1 print
941 Print line to message console.
943 8.1.2 exec(string command)
945 Run command as it was entered on the command line
947 8.1.3 utime()
949 Returns two values. First is time since some epoch in seconds, 
950 the second is microseconds mod 10^6 since that epoch.
952 8.1.4 emulator_ready()
954 Returns true if emulator has finished booting, false if not 
955 (on_startup() will be issued later).
957 8.1.5 set_idle_timeout(number timeout)
959 Set number of microseconds to block idle for. After this timeout 
960 has expired, on_idle() will be called once.
962 8.1.6 set_timer_timeout(number timeout)
964 Set number of microseconds to block timer for. After this timeout 
965 has expired, on_timer() will be called once.
967 8.1.7 bus_address(number snesaddr)
969 Returns virtual address corresponding to specified address on 
970 SNES bus.
972 8.1.8 loopwrapper(function fun, ...)
974 Calls function fun with function and specified arguments. The 
975 function passed suspends execution until the function returned is 
976 called. Handy for linear flow control among multiple invocations 
977 of a hook. Example code:
979 on_paint = loopwrapper(function(wait)
981   while true do
983     gui.text(0, 0, “Test!”);
985     wait();
987   end
989 end);
991 8.1.9 list_bindings([string cmd])
993 Get table of all keybindings, indexed by keyspec 
994 (modifiers|mask/key). If command is specified, the table is 
995 limited to that command.
997 8.1.10 get_alias(string aname)
999 Get expansion of given alias.
1001 8.1.11 set_alias(string aname, string value)
1003 Set expansion of given alias.
1005 8.1.12 create_ibind(string name, string cmd)
1007 Return object representing inverse binding with specified name 
1008 and specified command.
1010 • To create press/release commands, use aliases +foo and -foo .
1012 • Keep the returned object around.
1014 8.2 Table bit:
1016 Bitwise logical functions and related.
1018 8.2.1 bit.none(number...) / bit.bnot(number...)
1020 48-bit bitwise NOT / NONE function (set bits that are set in none 
1021 of the arguments).
1023 8.2.2 bit.any(number...) / bit.bor(number...)
1025 48-bit bitwise OR / ANY function (set bits that are set in any of 
1026 the arguments).
1028 8.2.3 bit.all(number...) / bit.band(number...)
1030 48-bit bitwise AND / ALL function (set bits that are set in all 
1031 of the arguments).
1033 8.2.4 bit.parity(number...) / bit.bxor(number...)
1035 48-bit bitwise XOR / PARITY function (set bits that are set in 
1036 odd number of the arguments).
1038 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
1040 Rotate bits-bit (max 48, default 48) number left by amount 
1041 (default 1) places.
1043 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
1045 Rotate bits-bit (max 48, default 48) number right by amount 
1046 (default 1) places.
1048 8.2.7 bit.lshift(number base[, number amount[, number bits]])
1050 Shift bits-bit (max 48, default 48) number left by amount 
1051 (default 1) places. The new bits are filled with zeroes.
1053 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1055 Shift bits-bit (max 48, default 48) number logically right by 
1056 amount (default 1) places. The new bits are filled with zeroes.
1058 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1060 Shift bits-bit (max 48, default 48) number arithmetically right 
1061 by amount (default 1) places. The new bits are shifted in with 
1062 copy of the high bit.
1064 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
1066 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
1067 and so on.
1069 Notes: 
1071 • Bit numbers up to 51 should work reliably (then things start 
1072   falling apart due to double precision issues).
1074 • There are two special bit positions, true and false, standing 
1075   for always set bit and always clear bit.
1077 8.2.11 bit.value([number bit1[, number bit2,...]])
1079 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
1080 shifted by bit2 places and so on. As special value, nil argument 
1081 is no-op.
1083 8.2.12 bit.test_any(number a, number b)
1085 Is there a common set bit in a and b?
1087 8.2.13 bit.test_all(number a, number b)
1089 Are all set bits in b also set in a?
1091 8.2.14 bit.popcount(number a)
1093 Population count of a.
1095 8.2.15 bit.clshift(number a, number b, [number amount,[number 
1096   bits]])
1098 Does chained left shift on a, b by amount positions, assuming 
1099 numbers to be of specified number of bits.
1101 8.2.16 bit.crshift(number a, number b, [number amount,[number 
1102   bits]])
1104 Does chained right shift on a, b by amount positions, assuming 
1105 numbers to be of specified number of bits.
1107 8.2.17 bit.flagdecode(number a, number bits, [string on, [string 
1108   off]])
1110 Return string of length bits where ith character is ith character 
1111 of on if bit i is on, otherwise ith character of off. Out of 
1112 range reads give last character, or '*'/'-' if empty.
1114 8.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
1115   off]])
1117 Like bit.flagdecode, but outputs the string in the opposite order 
1118 (most significant bit first).
1120 8.3 Table gui:
1122 Most of these functions can only be called in on_paint and 
1123 on_video callbacks. Exceptions are noted.
1125 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
1126 the green component, bits 16-23 are the red component, bits 24-31 
1127 are alpha component (0 is fully opaque, 255 is almost 
1128 transparent). -1 is the fully transparent color. Alpha values 
1129 greater than 127 do work.
1131 Origin of coordinates is at top left corner of game display area. 
1132 Left and top gaps correspond to negative coordinates.
1134 8.3.1 gui.resolution()
1136 Returns 2-tuple (hresolution, vresolution).
1138 8.3.2 gui.<class>_gap(number gap)
1140 Set the <class> (left, right, top, bottom) gap to specified value 
1141 (max gap is 8191). If successful, old gap is returned.
1143 8.3.3 gui.delta_<class>_gap(number gap)
1145 Increase the <class> (left, right, top, bottom) gap by specified 
1146 value (max gap is 8191) and return the old gap (returns nothing 
1147 on error).
1149 8.3.4 gui.text(number x, number y, string text[, number fgc[, 
1150   number bgc]])
1152 Draw specified text on the GUI (each character cell is 8 or 16 
1153 wide and 16 high). Parameters:
1155 • x: X-coordinate to start the drawing from (and x-coordinate at 
1156   begining of the lines).
1158 • y: Y-coordinate to start the drawing from.
1160 • text: The text to draw.
1162 • fgc: Text color (default is 0xFFFFFF (white))
1164 • bgc: Background color (default is -1 (transparent))
1166 8.3.5 gui.textH(number x, number y, string text[, number fgc[, 
1167   number bgc]])
1169 Like gui.text, but draw using double-width.
1171 8.3.6 gui.textV(number x, number y, string text[, number fgc[, 
1172   number bgc]])
1174 Like gui.text, but draw using double-height.
1176 8.3.7 gui.textHV(number x, number y, string text[, number fgc[, 
1177   number bgc]])
1179 Like gui.text, but draw using double-width/double-height.
1181 8.3.8 gui.rectangle(number x, number y, number width, number 
1182   height[, number thickness[, number outline[, number fill]]])
1184 Draw rectangle on the GUI. Parameters:
1186 • x: X-coordinate of left edge.
1188 • y: Y-coordinate of upper edge.
1190 • width: Width of rectangle.
1192 • height: Height of rectangle.
1194 • thickness: Thickness of outline (default is 1).
1196 • outline: Color of outline (default is 0xFFFFFF (white))
1198 • fill: Color of fill (default is -1 (transparent))
1200 8.3.9 gui.box(number x, number y, number width, number height[, 
1201   number thickness[, number outline1[,number outline2[, number 
1202   fill]]]])
1204 Draw rectangle with 3D effect on the GUI. Parameters:
1206 • x: X-coordinate of left edge.
1208 • y: Y-coordinate of upper edge.
1210 • width: Width of rectangle.
1212 • height: Height of rectangle.
1214 • thickness: Thickness of outline (default is 1).
1216 • outline1: First color of outline (default is 0xFFFFFF (white))
1218 • outline2: First color of outline (default is 0x808080 (dark 
1219   gray))
1221 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1223 8.3.10 gui.pixel(number x, number y[, number color])
1225 Draw one pixel on the GUI. Parameters:
1227 • x: X-coordinate of the pixel
1229 • y: Y-coordinate of the pixel
1231 • color: Color of the pixel (default is 0xFFFFFF (white))
1233 8.3.11 gui.crosshair(number x, number y[, number length[, number 
1234   color]])
1236 Draw a crosshair. Parameters:
1238 • x: X-coordinate of the crosshair
1240 • y: Y-coordinate of the crosshair
1242 • length: Length of the crosshair lines (default 10).
1244 • color: Color of the crosshair (default is 0xFFFFFF (white))
1246 8.3.12 gui.line(number x1, number y1, number x2, number y2[, 
1247   number color])
1249 Draw a thin line. Parameters:
1251 • x1: X-coordinate of one end.
1253 • y1: Y-coordinate of one end.
1255 • x2: X-coordinate of the other end.
1257 • y2: Y-coordinate of the other end.
1259 • color: Color of the line (default is 0xFFFFFF (white)).
1261 8.3.13 gui.circle(number x, number y, number r[, number thick[, 
1262   number border[, number fil]]])
1264 Draw a circle. Parameters.
1266 • x: X-coordinate of the center
1268 • y: Y-coordinate of the center
1270 • r: The radius of the circle
1272 • thick: Border thickness
1274 • border: Border color (default is 0xFFFFFF (white))
1276 • fill: Fill color (default is -1 (transparent)).
1278 8.3.14 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
1279   palette)
1281 Draw a bitmap on screen with specified palette. Parameters:
1283 • x: X-coordinate of left edge.
1285 • y: Y-coordinate of top edge.
1287 • bitmap: The bitmap to draw
1289 • palette: The palette to draw the bitmap using.
1291 8.3.15 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1293 Draw a bitmap on screen. Parameters:
1295 • x: X-coordinate of left edge.
1297 • y: Y-coordinate of top edge.
1299 • bitmap: The bitmap to draw
1301 8.3.16 gui.palette_new()
1303 Returns a new palette (initially all transparent). Can be used 
1304 anywhere.
1306 8.3.17 gui.bitmap_new(number w, number h, boolean direct[, bool 
1307   icolor])
1309 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1311 • w: The width of new bitmap
1313 • h: The height of new bitmap
1315 • direct: If true, the returned bitmap is dbitmap, otherwise 
1316   bitmap.
1318 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
1319   DBITMAP)
1321 8.3.18 gui.bitmap_load(string file)
1323 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
1324 is palette for bitmap). Can be used anywhere. Parameters:
1326 • file: The name of file to load.
1328 8.3.19 gui.palette_set(palette palette, number index, number 
1329   color)
1331 Sets color in palette. Can be used anywhere. Parameters:
1333 • palette: The palette to manipulate
1335 • index: Index of color (0-65535).
1337 • color: The color value.
1339 8.3.20 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
1340   number color)
1342 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1344 • bitmap: The bitmap to manipulate
1346 • x: The x-coordinate of the pixel.
1348 • y: The y-coordinate of the pixel.
1350 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
1351   color value.
1353 8.3.21 gui.bitmap_size(bitmap/dbitmap bitmap)
1355 Get size of bitmap. Can be used anywhere. Parameters:
1357 • bitmap: The bitmap to query.
1359 The first return is the width, the second is the height.
1361 8.3.22 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
1362   bitmap/dbitmap src, [palette pal, ]number sx, number sy, number 
1363   w, number h[, number ck])
1365 Blit a part of bitmap to another. Can be used anywhere. 
1366 Parameters:
1368 • dest: Destination to blit to.
1370 • dx: left edge of target
1372 • dy: Top edge of target
1374 • src: The source to blit from. If destination is paletted, must 
1375   be paletted.
1377 • pal: The palette. Only present if src is paletted, but dest is 
1378   not.
1380 • sx: left edge of source
1382 • sy: Top edge of source
1384 • w: Width of region
1386 • h: Height of region.
1388 • ck: Color key. Pixels of this color are not blitted.
1390   – If bitmaps are bitmaps, this is color index of colorkey. 
1391     Values outside range 0-65535 cause no key to be used as 
1392     colorkey.
1394   – If bitmaps are dbitmaps, this color value of colorkey.
1396   – May be absent or nil for no colorkey blit.
1398 8.3.23 gui.bitmap_load_png(string filename)
1400 Load a bitmap from PNG file. Parameters:
1402 • filename: The name of file to load the bitmap frame.
1404 Return value:
1406 • If the PNG is of color type 3 (PALETTE), returns two value. 
1407   First is BITMAP containing the image data from the PNG and 
1408   second is PALETTE containg the palette data from the PNG.
1410 • For color types 0 (GRAY), 2 (RGB), 4 (GRAY_ALPHA) and 6 (RGBA), 
1411   returns one DBITMAP containg the image data loaded from the 
1412   PNG.
1414 8.3.24 gui.bitmap_load_pal(string filename)
1416 Load a palette from file. Parameters:
1418 • filename: The name of the file.
1420 The kinds of lines supported
1422 • Blank or just whitespace: Ignored
1424 • First non-whitespace is '#': Ignored
1426 • <r> <g> <b>: Fully opaque color with specified RGB values 
1427   (0-255)
1429 • <r> <g> <b> <a>: Color with specified RGB values (0-255) and 
1430   specified alpha (0-256, 0 being fully transparent and 256 fully 
1431   opaque).
1433 • transparent: Fully transparent color
1435 8.3.25 gui.bitmap_load_str(string content)
1437 Like gui.bitmap_load, but reads the specified string directly as 
1438 content.
1440 8.3.26 gui.bitmap_load_png_str(string base64content)
1442 Like gui.bitmap_load_png, but reads the specified string (as 
1443 base64-encoded) directly as content.
1445 8.3.27 gui.bitmap_load_pal_str(string content)
1447 Like gui.bitmap_load_pal, but reads the specified string directly 
1448 as content.
1450 8.3.28 gui.repaint()
1452 Request on_repaint() to happen as soon as possible. Can be used 
1453 anywhere.
1455 8.3.29 gui.subframe_update(boolean on)
1457 Request subframe updates (calling on_paint() on subframes) to 
1458 happen (on=true) or not happen (on=false). Can be used anywhere.
1460 8.3.30 gui.screenshot(string filename)
1462 Write PNG screenshot of the current frame (no drawings) to 
1463 specified file. Can be used anywhere.
1465 8.3.31 gui.color(number r, number g, number b[, number a])
1467 Returns color (in notation Lua scripts use) corresponding to 
1468 color (r,g,b), each component in scale 0-255. If a is specified, 
1469 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1470 The default alpha is 256.
1472 8.3.32 gui.status(string name, string value)
1474 Set status field “L[<name>]” to <value> in status area. Can be 
1475 used anywhere.
1477 8.3.33 gui.rainbow(number step, number steps[, number color])
1479 Perform hue rotation of color <color> (default bright red), by 
1480 <step> steps. The number of steps per full rotation is given by 
1481 absolute value of <steps>.
1483 If <steps> is negative, the rotation will be counterclockwise.
1485 8.3.34 gui.screenshot(string filename)
1487 Saves a screenshot into specified file.
1489 8.3.35 gui.loadfont(string filename)
1491 Loads font from specified file (CUSTOMFONT object).
1493 8.3.36 CUSTOMFONT(number x, number y, string text[, number fgc[, 
1494   number bgc[, number hlc]]])
1496 Draw string with custom font to screen. The parameters are the 
1497 same as in gui.text, except hlc is the halo color (default is no 
1498 halo). 
1500 8.4 table input
1502 Input handling. Only available in on_input callback.
1504 8.4.1 input.get(number controller, number index)
1506 Read the specified index (0-11) from specified controller (0-7). 
1507 Notes:
1509 • Uses physical controller numbering. Gamepad in port 2 is 
1510   controller 4, not 1!
1512 8.4.2 input.set(number controller, number index, number value)
1514 Write the specified index (0-11) from specified controller (0-7), 
1515 storing value. Notes:
1517 • Uses physical controller numbering. Gamepad in port 2 is 
1518   controller 4, not 1!
1520 8.4.3 input.get2(number port, number controller, number index)
1522 Read the specified input tuple.
1524 • Port 0 is system port.
1526 8.4.4 input.set2(number port, number controller, number index, 
1527   number value)
1529 Write the specified input tuple.
1531 • Port 0 is system port.
1533 8.4.5 input.lcid_to_pcid2(number lcid)
1535 Look up physical pcid pair (port, controller) corresponding to 
1536 specified logical controller (1-based). Returns nothing if 
1537 controller does not exist.
1539 8.4.6 input.port_type(number port)
1541 Return type of specified port.
1543 8.4.7 input.controller_info(number port, number controller)
1545 Get controller info for specified controller. If controller does 
1546 not exist, returns nil. Otherwise returns a table with following 
1547 fields:
1549 • type (string): Type of the controller.
1551 • class (string): Class of the controller.
1553 • classnum (number): Number of the controller within its class 
1554   (1-based)
1556 • lcid (number): Logical controller number of the controller.
1558 • button_count (number): Number of buttons on controller
1560 • buttons (array): Array of following info about each button:
1562   – type (string): Type of button. Currently one of “null”, “
1563     button”, “axis”, “raxis”.
1565   – name (string): Name of button.
1567   – symbol (string): Symbol of button. Only present for type “
1568     button”.
1570   – hidden (boolean): True if hidden button. 
1572 8.4.8 input.veto_button()
1574 Signals that the button event should be vetoed. Only valid in 
1575 on_button callback.
1577 8.4.9 input.geta(number controller)
1579 Get input state for entiere controller. Returns 13 return values.
1581 • 1st return value: Bitmask: bit i is set if i:th index is 
1582   nonzero
1584 • 2nd-13th return value: value of i:th index.
1586 8.4.10 input.seta(number controller, number bitmask, number 
1587   args...)
1589 Set state for entiere controller. args is up to 12 values for 
1590 indices (overriding values in bitmask if specified).
1592 8.4.11 input.controllertype(number controller)
1594 Get the type of controller as string. Valid values are:
1596 • gamepad
1598 • mouse
1600 • justifier
1602 • superscope
1604 8.4.12 input.reset([number cycles])
1606 Execute reset. If cycles is greater than zero, do delayed reset. 
1607 0 (or no value) causes immediate reset.
1609 • Only available with subframe flag false.
1611 8.4.13 input.raw()
1613 Returns table of tables of all available keys and axes. The first 
1614 table is indexed by key name (platform-dependent!), and the inner 
1615 table has the following fields:
1617 • last_rawval: Last reported raw value for control.
1619 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1620   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1621   pressure-pm, pressure-p0).
1623 • cal_left: Minimum calibration value. Only meaningful with axis 
1624   and pressure types.
1626 • cal_center: Center calibration value. Only meaningful with axis 
1627   and pressure types.
1629 • cal_right: Maximum calibration value. Only meaningful with axis 
1630   and pressure types.
1632 • cal_tolerance: Dead zone tolerance. Only meaningful with axis 
1633   and pressure types.
1635 8.4.14 input.keyhook(string key, boolean state)
1637 Requests that keyhook events to be sent for key (state=true) or 
1638 not sent (state=false).
1640 8.4.15 input.joyget(number controller)
1642 Returns table for current controls for specified controller. The 
1643 names of fields vary by controller type.
1645 • The buttons have the same name as those are referred to in 
1646   other contexts in the emulator
1648 • The analog axes are “xaxis” and “yaxis”.
1650 8.4.16 input.joyset(number controller, table controls)
1652 Set the the state of specified controller to values specified in 
1653 specified table.
1655 • nil does not change value
1657 • true/false (buttons) and integers (axes) force value.
1659 • string (button) inverts the input.
1661 8.4.17 input.lcid_to_pcid(number controller)
1663 Return the physical index, physical port and controller number in 
1664 port for specified (1-based) logical controller.
1666 8.5 Table subtitle
1668 Subtitle handling
1670 8.5.1 subtitle.byindex(number i)
1672 Read the frame and length of ith subtitle. Returns nothing if not 
1673 present.
1675 8.5.2 subtitle.set(number f, number l, string txt)
1677 Set the text of subtitle.
1679 8.5.3 subtitle.get(number f, number l)
1681 Get the text of subtitle.
1683 8.5.4 subtitle.delete(number f, number l)
1685 Delete specified subtitle.
1687 8.6 Table hostmemory
1689 Host memory handling (extra memory saved to savestates). Host 
1690 memory starts empty.
1692 8.6.1 hostmemory.read(number address)
1694 Reads hostmemory slot address. Slot numbers out of range return 
1695 false instead of numeric.
1697 8.6.2 hostmemory.write(number address, number value)
1699 Writes hostmemory slot with 0-255. Slot numbers out of range 
1700 cause extension of host memory slot space.
1702 8.6.3 hostmemory.readbyte(number address)
1704 Read unsigned byte (1 element) from given address. Slots out of 
1705 range return false.
1707 8.6.4 hostmemory.writebyte(number address, number value)
1709 Write unsigned byte (1 element) to given slot. Slot numbers out 
1710 of range cause extension.
1712 8.6.5 hostmemory.readsbyte(number address)
1714 Read signed byte (1 element) from given address. Slots out of 
1715 range return false.
1717 8.6.6 hostmemory.writesbyte(number address, number value)
1719 Write signed byte (1 element) to given slot. Slot numbers out of 
1720 range cause extension.
1722 8.6.7 hostmemory.readword(number address)
1724 Read unsigned word (2 elements) from given address. Slots out of 
1725 range return false.
1727 8.6.8 hostmemory.writeword(number address, number value)
1729 Write unsigned word (2 elements) to given slot. Slot numbers out 
1730 of range cause extension.
1732 8.6.9 hostmemory.readsword(number address)
1734 Read signed word (2 elements) from given address. Slots out of 
1735 range return false.
1737 8.6.10 hostmemory.writesword(number address, number value)
1739 Write signed word (2 elements) to given slot. Slot numbers out of 
1740 range cause extension.
1742 8.6.11 hostmemory.readdword(number address)
1744 Read unsigned doubleword (4 elements) from given address. Slots 
1745 out of range return false.
1747 8.6.12 hostmemory.writedword(number address, number value)
1749 Write unsigned doubleword (4 elements) to given slot. Slot 
1750 numbers out of range cause extension.
1752 8.6.13 hostmemory.readsdword(number address)
1754 Read signed doubleword (4 elements) from given address. Slots out 
1755 of range return false.
1757 8.6.14 hostmemory.writesdword(number address, number value)
1759 Write signed doubleword (4 elements) to given slot. Slot numbers 
1760 out of range cause extension.
1762 8.6.15 hostmemory.readqword(number address)
1764 Read unsigned quadword (8 elements) from given address. Slots out 
1765 of range return false.
1767 8.6.16 hostmemory.writeqword(number address, number value)
1769 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1770 out of range cause extension.
1772 8.6.17 hostmemory.readsqword(number address)
1774 Read signed quadword (8 elements) from given address. Slots out 
1775 of range return false.
1777 8.6.18 hostmemory.writesqword(number address, number value)
1779 Write signed quadword (8 elements) to given slot. Slot numbers 
1780 out of range cause extension.
1782 8.7 Table movie
1784 Movie handling
1786 8.7.1 movie.currentframe()
1788 Return number of current frame.
1790 8.7.2 movie.framecount()
1792 Return number of frames in movie.
1794 8.7.3 movie.readonly()
1796 Return true if in readonly mode, false if in readwrite.
1798 8.7.4 movie.rerecords()
1800 Returns the current value of rerecord count.
1802 8.7.5 movie.set_readwrite()
1804 Set readwrite mode (does not cause on_readwrite callback).
1806 8.7.6 movie.frame_subframes(number frame)
1808 Count number of subframes in specified frame (frame numbers are 
1809 1-based) and return that.
1811 8.7.7 movie.read_subframes(number frame, number subframe)
1813 Read specifed subframe in specified frame and return data as 
1814 array (100 elements, numbered 0-99 currently).
1816 8.7.8 movie.read_rtc()
1818 Returns the current value of the RTC as a pair (second, 
1819 subsecond).
1821 8.7.9 movie.unsafe_rewind([UNSAFEREWIND state])
1823 Start setting point for unsafe rewind or jump to point of unsafe 
1824 rewind.
1826 • If called without argument, causes emulator to start process of 
1827   setting unsafe rewind point. When this has finished, callback 
1828   on_set_rewind occurs, passing the rewind state to lua script.
1830 • If called with argument, causes emulator rewind to passed 
1831   rewind point as soon as possible. Readwrite mode is implicitly 
1832   activated.
1834 The following warnings apply to unsafe rewinding:
1836 • There are no safety checks against misuse (that's what “unsafe” 
1837   comes from)!
1839 • Only call rewind from timeline rewind point was set from.
1841 • Only call rewind from after the rewind point was set.
1843 8.7.10 movie.copy_movie([INPUTMOVIE movie])
1845 Copies specified movie (if none or nil, the active movie) as new 
1846 movie object (INPUTMOVIE).
1848 Also available as method in INPUTFRAME.
1850 8.7.11 movie.get_frame([INPUTMOVIE movie,] number frame)
1852 Get INPUTFRAME object corresponding to specified frame in 
1853 specified movie.
1855 Also available as method in INPUTFRAME.
1857 8.7.12 movie.set_frame([INPUTMOVIE movie,] number frame, 
1858   INPUTFRAME data)
1860 Set data in specified frame. Note: Past can't be edited in active 
1861 movie.
1863 Also available as method in INPUTFRAME.
1865 8.7.13 movie.get_size([INPUTMOVIE movie])
1867 Return number of subframes in specified movie.
1869 Also available as method in INPUTFRAME.
1871 8.7.14 movie.count_frames([INPUTMOVIE movie])
1873 Return number of frames in movie.
1875 Also available as method in INPUTFRAME.
1877 8.7.15 movie.find_frame([INPUTMOVIE movie], number frame)
1879 Returns starting subframe of given frame (frame numbers are 
1880 1-based). Returns -1 if frame number is bad.
1882 Also available as method in INPUTFRAME.
1884 8.7.16 movie.blank_frame([INPUTMOVIE movie])
1886 Return blank INPUTFRAME with frame type from specified movie.
1888 Also available as method in INPUTFRAME.
1890 8.7.17 movie.append_frames([INPUTMOVIE movie,] number frames)
1892 Append specified number of frames.
1894 Also available as method in INPUTFRAME.
1896 8.7.18 movie.append_frame([INPUTMOVIE movie,] INPUTFRAME frame)
1898 Append specified frame. Past of current movie can't be edited.
1900 Also available as method in INPUTFRAME.
1902 8.7.19 movie.truncate([INPUTMOVIE movie,] number frames)
1904 Truncate the specified movie to specified number of frames.
1906 Also available as method in INPUTFRAME.
1908 8.7.20 movie.edit([INPUTMOVIE movie,] number frame, number port, 
1909   number controller, number control, number/bool value)
1911 Change specified control in specified frame in specified movie. 
1912 Past can't be edited in active movie.
1914 Also available as method in INPUTFRAME.
1916 8.7.21 movie.copy_frames2([INPUTMOVIE dstmov,] number dst, 
1917   [INPUTMOVIE srcmov,] number src, number count)
1919 Copy specified number of frames between two movies. The copy 
1920 proceeeds in forward direction.
1922 8.7.22 movie.copy_frames([INPUTMOVIE mov,] number dst, number 
1923   src, number count, bool backwards)
1925 Copy specified number of frames from one point in movie to 
1926 another. If backwards is true, the copy will be done backwards.
1928 Also available as method in INPUTFRAME.
1930 8.7.23 movie.serialize([INPUTMOVIE movie,] string filename, bool 
1931   binary)
1933 Serialize given movie into file. If binary is true, binary format 
1934 (more compact and much faster) is used.
1936 Also available as method in INPUTFRAME.
1938 8.7.24 movie.unserialize(INPUTFRAME template, string filename, 
1939   bool binary)
1941 Unserialize movie from file. The given frame is used as template 
1942 to decide the frame type. If binary is true, binary format is 
1943 decoded (much faster).
1945 Also available as method in INPUTFRAME.
1947 8.7.25 movie.current_first_subframe()
1949 Returns first subframe in current frame.
1951 8.7.26 movie.pollcounter(number port, number controller, number 
1952   control)
1954 Returns number of times the specified control has been polled 
1955 this frame.
1957 8.7.27 INPUTFRAME::get_button(number port, number controller, 
1958   number control)
1960 Returns state of given button as boolean.
1962 8.7.28 INPUTFRAME::get_axis(number port, number controller, 
1963   number control)
1965 Returns state of given axis as number.
1967 8.7.29 INPUTFRAME::set_button(number port, number controller, 
1968   number control, number/bool value)
1970 Set the given button/axis to given value.
1972 8.7.30 INPUTFRAME::set_axis(number port, number controller, 
1973   number control)
1975 Same as set_button.
1977 8.7.31 INPUTFRAME::serialize()
1979 Return string representation of frame.
1981 8.7.32 INPUTFRAME::unserialize(string data)
1983 Set current frame from given data.
1985 8.7.33 INPUTFRAME::get_stride()
1987 Return number of bytes needed to store the input frame. Mainly 
1988 useful for some debugging.
1990 8.8 Table settings
1992 Routines for settings manipulation
1994 8.8.1 settings.get(string name)
1996 Get value of setting. If setting is blank, returns false. If 
1997 setting value can't be obtained, returns (nil, error message).
1999 8.8.2 settings.set(string name, string value)
2001 Set value of setting. If setting can't be set, returns (nil, 
2002 error message).
2004 8.8.3 settings.is_set(string name)
2006 Returns if setting is set. If setting does not exist, returns 
2007 (nil, error message).
2009 8.8.4 settings.blank(string name)
2011 Blanks a setting and returns true. If setting can't be blanked, 
2012 returns (nil, error message).
2014 8.9 Table memory
2016 Contains various functions for managing memory
2018 8.9.1 memory.vma_count()
2020 Returns the number of VMAs
2022 8.9.2 memory.read_vma(number index)
2024 Reads the specified VMA (indices start from zero). Trying to read 
2025 invalid VMA gives nil. The read VMA is table with the following 
2026 fields:
2028 • region_name (string): The readable name of the VMA
2030 • baseaddr (number): Base address of the VMA
2032 • lastaddr (number): Last address in the VMA.
2034 • size (number): The size of VMA in bytes.
2036 • readonly (boolean): True of the VMA corresponds to ROM.
2038 • iospace (boolean): True if the VMA is I/O space.
2040 • native_endian (boolean): True if the VMA has native endian as 
2041   opposed to little endian.
2043 8.9.3 memory.find_vma(number address)
2045 Finds the VMA containing specified address. Returns table in the 
2046 same format as read_vma or nil if not found.
2048 8.9.4 memory.readbyte(number address)
2050 Reads the specified address as unsigned byte and returns the 
2051 result.
2053 8.9.5 memory.readsbyte(number address)
2055 Reads the specified address as signed byte and returns the 
2056 result.
2058 8.9.6 memory.writebyte(number address, number value)
2060 Writes the specified value (negative values undergo 2's 
2061 complement) to specified address (as a byte).
2063 8.9.7 memory.readword(number address)
2065 Reads the specified address as unsigned word and returns the 
2066 result.
2068 8.9.8 memory.readsword(number address)
2070 Reads the specified address as signed word and returns the 
2071 result.
2073 8.9.9 memory.writeword(number address, number value)
2075 Writes the specified value (negative values undergo 2's 
2076 complement) to specified address (as a word).
2078 8.9.10 memory.readdword(number address)
2080 Reads the specified address as unsigned doubleword and returns 
2081 the result.
2083 8.9.11 memory.readsdword(number address)
2085 Reads the specified address as signed doubleword and returns the 
2086 result.
2088 8.9.12 memory.writedword(number address, number value)
2090 Writes the specified value (negative values undergo 2's 
2091 complement) to specified address (as a doubleword).
2093 8.9.13 memory.readqword(number address)
2095 Reads the specified address as unsigned quadword and returns the 
2096 result.
2098 8.9.14 memory.readsqword(number address)
2100 Reads the specified address as signed quadword and returns the 
2101 result.
2103 8.9.15 memory.writeqword(number address, number value)
2105 Writes the specified value (negative values undergo 2's 
2106 complement) to specified address (as a quadword).
2108 8.9.16 memory.hash_region(number base, number size)
2110 Hash specified number of bytes starting from specified address 
2111 and return the SHA-256.
2113 8.9.17 memory.hash_state()
2115 Hash the current system state. Mainly useful for debugging 
2116 savestates.
2118 8.9.18 memory.readregion(number base, number size)
2120 Read a region of memory.
2122 • Warning: If the region crosses VMA boundary, the results are 
2123   undefined.
2125 8.9.19 memory.map<type>([number base, number size])
2127 Returns a table mapping specified memory aperture for read/write. 
2128 If parameters are omitted, entiere map space is the aperture.
2130 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
2131   qword or sqword.
2133 8.9.20 memory.writeregion(number base, number size, table data)
2135 Write a region of memory.
2137 • Warning: If the region crosses VMA boundary, the results are 
2138   undefined.
2140 8.9.21 memory.map_structure()
2142 Returns a new mapping structure (MMAP_STRUCT)
2144 8.9.22 MMAP_STRUCT(string key, number address, string type)
2146 Bind key in mmap structure to specified address with specified 
2147 type.
2149 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
2150   qword or sqword.
2152 8.9.23 memory.read_expr(string expr)
2154 Evaluate specified watch expression and return result
2156 8.10 Table subtitle
2158 Contains functions for manipulating subtitles.
2160 8.10.1 subtitle.byindex(number index)
2162 Get (basetime, length) pair of specified subtitle index or 
2163 nothing if index isn't valid.
2165 8.10.2 subtitle.get(number basetime, number length)
2167 Read the specified subtitle. Returns “” if the subtitle does not 
2168 exist.
2170 8.10.3 subtitle.set(number basetime, number length, string 
2171   content)
2173 Set the specified subtitle.
2175 8.10.4 subtitle.deltete(number basetime, number length)
2177 Delete the specified subtitle.
2179 8.11 Table _SYSTEM
2181 Contains copy of global variables from time of Lua 
2182 initialization. Non-writeable.
2184 8.12 Callbacks
2186 Various callbacks to Lua that can occur.
2188 8.12.1 Callback: on_paint(bool not_synth)
2190 Called when screen is being painted. Any gui.* calls requiring 
2191 graphic context draw on the screen.
2193 not_synth is true if this hook is being called in response to 
2194 received frame, false otherwise.
2196 8.12.2 Callback: on_video()
2198 Called when video dump frame is being painted. Any gui.* calls 
2199 requiring graphic context draw on the video.
2201 8.12.3 Callback: on_frame_emulated()
2203 Called when emulating frame has completed and 
2204 on_paint()/on_video() calls are about to be issued.
2206 8.12.4 Callback: on_frame()
2208 Called on each starting whole frame.
2210 8.12.5 Callback: on_startup()
2212 Called when the emulator is starting (lsnes.rc and --run files 
2213 has been run).
2215 8.12.6 Callback: on_rewind()
2217 Called when rewind movie to beginning has completed.
2219 8.12.7 Callback: on_pre_load(string name)
2221 Called just before savestate/movie load occurs (note: loads are 
2222 always delayed, so this occurs even when load was initiated by 
2223 lua).
2225 8.12.8 Callback: on_err_load(string name)
2227 Called if loadstate goes wrong.
2229 8.12.9 Callback: on_post_load(string name, boolean was_savestate)
2231 Called on successful loadstate. was_savestate gives if this was a 
2232 savestate or a movie.
2234 8.12.10 Callback: on_pre_save(string name, boolean is_savestate)
2236 Called just before savestate save occurs (note: movie saves are 
2237 synchronous and won't trigger these callbacks if called from 
2238 Lua).
2240 8.12.11 Callback: on_err_save(string name)
2242 Called if savestate goes wrong.
2244 8.12.12 Callback: on_post_save(string name, boolean is_savestate)
2246 Called on successful savaestate. is_savestate gives if this was a 
2247 savestate or a movie.
2249 8.12.13 Callback: on_quit()
2251 Called when emulator is shutting down.
2253 8.12.14 Callback: on_input(boolean subframe)
2255 Called when emulator is just sending input to bsnes core. 
2256 Warning: This is called even in readonly mode, but the results 
2257 are ignored.
2259 8.12.15 Callback: on_reset()
2261 Called when SNES is reset.
2263 8.12.16 Callback: on_readwrite()
2265 Called when moving into readwrite mode as result of “set-rwmode” 
2266 command (note: moving to rwmode by Lua won't trigger this, as per 
2267 recursive entry protection).
2269 8.12.17 Callback: on_snoop(number port, number controller, number 
2270   index, number value)
2272 Called each time bsnes asks for input. The value is the final 
2273 value to be sent to bsnes core (readonly mode, autohold and 
2274 autofire have been taken into account). Might be useful when 
2275 translating movies to format suitable for console verification. 
2276 Note: There is no way to modify the value to be sent.
2278 • Not called if callback on_snoop2 is defined.
2280 8.12.18 Callback: on_snoop2(number port, number controller, 
2281   number index, number value)
2283 Like on_snoop, but reserves port 0 for system, having first user 
2284 port be port 1.
2286 8.12.19 Callback: on_keyhook(string keyname, table state)
2288 Sent when key that has keyhook events requested changes state. 
2289 Keyname is name of the key (group) and state is the state (same 
2290 kind as table values in input.raw).
2292 8.12.20 Callback: on_idle()
2294 Called when requested by set_idle_timeout(), the timeout has 
2295 expired and emulator is waiting.
2297 8.12.21 Callback: on_timer()
2299 Called when requested by set_idle_timeout() and the timeout has 
2300 expired (regardless if emulator is waiting).
2302 8.12.22 Callback: on_set_rewind(UNSAFEREWIND r)
2304 Called when unsafe rewind object has been constructed.
2306 8.12.23 Callback: on_pre_rewind() 
2308 Called just before unsafe rewind is about to occur.
2310 8.12.24 Callback: on_post_rewind() 
2312 Called just after unsafe rewind has occured.
2314 8.12.25 Callback: on_button(number port, number controller, 
2315   number index, string type)
2317 Called on controller button press, with following parameters:
2319 • port: Port number (0 is system)
2321 • controller: Controller within port
2323 • index: Index of button.
2325 • type: Type of event, one of:
2327   – “pressed”: Button was pressed.
2329   – “released”: Button was released.
2331   – “hold”: Held.
2333   – “unhold”: Released from hold.
2335   – “type”: Typing input on button.
2337   – “untype”: Typing input undone.
2339   – “analog”: Analog action on axis.
2341 8.12.26 Callback: on_movie_lost(STRING kind)
2343 Called just before something would happen that could lose movie 
2344 data. Kind can be:
2346 • readwrite: Switching to readwrite mode.
2348 • reload: ROM is being reloaded in readwrite mode.
2350 • load: New movie is being loaded.
2352 • unsaferewind: Unsafe rewind is happening.
2354 9 Movie editor
2356 • The editor edits in-memory movie.
2358 • Because past can't be edited and readwrite mode doesn't allow 
2359   future, editing only works in read only mode.
2361 • Keyboard triggers the normal hotkeys and bindings.
2363 9.1 Left button actions
2365 • Clicking on cell in future (indicated by lack of redish 
2366   background) toggles it (if it is a button) or prompts for a 
2367   value (if it is an axis)
2369 • Dragging vertically toggles sequence of buttons or changes a 
2370   sequence of axis values.
2372 9.2 Right button actions
2374 The right mouse button pops up a context-sensitive menu:
2376 • Toggle <something>: Toggle this button
2378 • Change <something>: Change this axis value
2380 • Insert frame after: Insert a frame after this frame
2382 • Append frame: Append a frame to movie
2384 • Append frames: Append specified number of frames to movie
2386 • Delete frame: Delete this frame
2388 • Delete subframe: Delete this subframe
2390 • Truncate movie: Delete this subframe and everything after it.
2392 • Scroll to frame: Prompt for a frame and scroll the display to 
2393   that frame.
2395 • Scroll to current frame: Scroll the display to current position
2397 • Run to frame: Prompts for frame and runs the emulation to that 
2398   frame.
2400 • Change number of lines visible: Change the height of the movie 
2401   display (1 to 255).
2403 • Lock scroll to playback: While playing back or rewinding 
2404   movies, the display will follow if enabled.
2406 10 Memory watch expression syntax
2408 Memory watch expressions are in RPN (Reverse Polish Notation). At 
2409 the end of expression, the top entry on stack is taken as the 
2410 final result.
2412 Notations:
2414 • Evaluation order is strictly left to right.
2416 • a is the entry on top of stack
2418 • b is the entry immediately below top of stack
2420 • ; separates values to be pushed (no intermediate pop).
2422 • After end of element, all used stack slots are popped and all 
2423   results are pushed.
2425 • When pushing multiple values, the pushes occur in order shown.
2427 The following operators are available:
2429 • + : a + b
2431 • - : a - b
2433 • * : a * b
2435 • / : a / b
2437 • % : a % b
2439 • a : atan(a)
2441 • b : read_signed_byte(a)
2443 • c : cos(a)
2445 • d : read_signed_dword(a)
2447 • i : quotent(a / b)
2449 • p :\pi
2452 • q : read_signed_qword(a)
2454 • r : sqrt(a)
2456 • s : sin(a)
2458 • t : tan(a)
2460 • u : a; a
2462 • w : read_signed_word(a)
2464 • A : atan2(a, b)
2466 • B : read_unsigned_byte(a)
2468 • C<number>z : Push number <number> to stack.
2470 • D : read_unsigned_dword(a)
2472 • C0x<number>z : Push number <number> (hexadecimal) to stack.
2474 • H<digit> : Set hexadecimal mode with specified number of digits 
2475   (use A-G for 10-16 digits).
2477 • Q : read_unsigned_qword(a)
2479 • R<digit> : round a to <digit> digits.
2481 • W : read_unsigned_word(a)
2483 10.1 Example:
2485 C0x007e0878zWC0x007e002czW-
2487 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
2489 2. Pop the value on top of stack (0x7e0878), read word value at 
2490   that address and push the result,call it x1 (W).
2492 3. Push value 0x7e002c on top of stack (C0x007e002cz).
2494 4. Pop the value on top of stack (0x7e002c), read word value at 
2495   that address and push the result,call it x2 (W).
2497 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
2498   x2 and push x2 - x1 (-).
2500 6. Since the expression ends, the final memory watch result is 
2501   the top one on stack, which is x2 - x1.
2503 11 Modifier and key names:
2505 11.1 SDL Platform
2507 11.1.1 Modifier names
2509 Following modifier names are known:
2511 • ctrl, lctrl, rctrl: Control keys
2513 • alt, lalt, ralt: ALT keys.
2515 • shift, lshift, rshift: Shift keys.
2517 • meta, lmeta, rmeta: Meta keys.
2519 • num, caps: Numlock/Capslock (these are sticky!)
2521 • mode: Mode select.
2523 11.1.2 Key names
2525 Following key names are known:
2527 • backspace, tab, clear, return, pause, escape, space, exclaim, 
2528   quotedbl, hash, dollar, ampersand, quote, leftparen, 
2529   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
2530   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
2531   greater, question, at, leftbracket, backslash, rightbracket, 
2532   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
2533   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
2534   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
2535   world_8, world_9, world_10, world_11, world_12, world_13, 
2536   world_14, world_15, world_16, world_17, world_18, world_19, 
2537   world_20, world_21, world_22, world_23, world_24, world_25, 
2538   world_26, world_27, world_28, world_29, world_30, world_31, 
2539   world_32, world_33, world_34, world_35, world_36, world_37, 
2540   world_38, world_39, world_40, world_41, world_42, world_43, 
2541   world_44, world_45, world_46, world_47, world_48, world_49, 
2542   world_50, world_51, world_52, world_53, world_54, world_55, 
2543   world_56, world_57, world_58, world_59, world_60, world_61, 
2544   world_62, world_63, world_64, world_65, world_66, world_67, 
2545   world_68, world_69, world_70, world_71, world_72, world_73, 
2546   world_74, world_75, world_76, world_77, world_78, world_79, 
2547   world_80, world_81, world_82, world_83, world_84, world_85, 
2548   world_86, world_87, world_88, world_89, world_90, world_91, 
2549   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
2550   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
2551   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
2552   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
2553   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
2554   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
2555   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
2556   sysreq, break, menu, power, euro, undo
2558 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
2559   key having hardware-dependent scan code of <n> (useful to bind 
2560   those keys that don't have symbolic names).
2562 11.1.3 Joystick pseudo-keys:
2564 • joystick<num>button<button>: Joystick <num> (0-based) button 
2565   <button> (0-based).
2567 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
2568   (0-based) up.
2570 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
2571   (0-based) left.
2573 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
2574   (0-based) down.
2576 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
2577   (0-based) right.
2579 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
2580   negative position (axis modes axis and axis_inverse).
2582 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
2583   positive position (axis modes axis and axis_inverse).
2585 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
2586   pressure (axis modes pressure_*).
2588 11.1.4 Special buttons:
2590 • Escape: Enter/Exit Command mode, cancel modal dialogs.
2592 • Return (also KPEnter): Execute command, ok modal dialog.
2594 • Pgup/Up (also KP8/9 if no num lock, CTRL+P; command mode): 
2595   Previous command in command history
2597 • Pgdn/Down(also KP2/3 if no num lock, CTRL+N; command mode): 
2598   Next command in command history
2600 • Home (also KP7 if no num lock, CTRL+A; command mode): Beginning 
2601   of command.
2603 • End (also KP1 if no num lock, CTRL+E; command mode): End of 
2604   command.
2606 • Left (also KP4 if no num lock, CTRL+B; command mode): Move 
2607   cursor left.
2609 • Right (also KP6 if no num lock, CTRL+F; command mode): Move 
2610   cursor right.
2612 • Delete (also KP. if no num lock; command mode): Delete 
2613   character to right of cursor.
2615 • Insert (also KP0 if no num lock; command mode): Toggle between 
2616   insert / overwrite modes.
2618 • Backspace (command mode): Delete character to left of cursor.
2620 • CTRL+LEFT (also ALT+B; command mode): Previous word.
2622 • CTRL+RIGHT (also ALT+F; command mode): Next word.
2624 • ALT+D (also CTRL+W; command mode): Delete word.
2626 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
2627   corrupted!).
2629 11.2 wxWidgets platform
2631 11.2.1 Modifier names:
2633 Following modifier names are known:
2635 • alt
2637 • ctrl
2639 • shift 
2641 • meta
2643 • cmd (Mac OS X only)
2645 11.2.2 Key names:
2647 Following key names are known:
2649 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
2650   dollar, percent, ampersand, quote, leftparen, rightparen, 
2651   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
2652   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
2653   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
2654   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
2655   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
2656   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
2657   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
2658   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
2659   home, lefT, up, right, down, select, print, execute, snapshot, 
2660   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
2661   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
2662   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
2663   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
2664   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
2665   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
2666   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
2667   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
2668   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
2669   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
2670   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
2671   windows_right, windows_menu, command, special1, special2, 
2672   special3, special4, special5, special6, special7, special8, 
2673   special9, special10, special11, special12, special13, 
2674   special14, special15, special16, special17, special18, 
2675   special19, special20
2677 12 Movie file format
2679 Movie file is .zip archive in itself, normal ZIP archive tools 
2680 work on it (note: If you recompress it, do not use compression 
2681 methods other than store and deflate and especially do not use 
2682 encryption of any kind).
2684 12.1 Detecting clean start/SRAM/Savestate
2686 • If file has member “savestate” it is savestate, otherwise:
2688 • If file has members with names starting “moviesram.” it is 
2689   movie starting from SRAM, otherwise:
2691 • It is movie starting from clear state.
2693 12.2 Member: gametype
2695 Type of game ROM and region (as one line). Valid values are:
2698 +--------------+---------------------+--------+
2699 |    Value     |       System        | Region |
2700 +--------------+---------------------+--------+
2701 +--------------+---------------------+--------+
2702 |  snes_pal    |     Super NES       |  PAL   |
2703 +--------------+---------------------+--------+
2704 |   sgb_pal    |   Super Game Boy    |  PAL   |
2705 +--------------+---------------------+--------+
2706 |  snes_ntsc   |     Super NES       |  NTSC  |
2707 +--------------+---------------------+--------+
2708 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
2709 +--------------+---------------------+--------+
2710 |     bsx      | BS-X (non-slotted)  |  NTSC  |
2711 +--------------+---------------------+--------+
2712 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
2713 +--------------+---------------------+--------+
2714 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
2715 +--------------+---------------------+--------+
2718 Frame rates are:
2721 +---------+-----------------+
2722 | Region  | Framerate (fps) |
2723 +---------+-----------------+
2724 +---------+-----------------+
2725 |  PAL    |   322445/6448   |
2726 +---------+-----------------+
2727 |  NTSC   | 10738636/178683 |
2728 +---------+-----------------+
2731 12.3 Member: port1
2733 Contains type of port #1 (as one line). Valid values are 'none', 
2734 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
2735 'gamepad'.
2737 12.4 Member: port2
2739 Contains type of port #2 (as one line). Valid values are 'none', 
2740 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
2741 'justifiers'. If not present, defaults to 'none'.
2743 12.5 Member: gamename
2745 Contains name of the game (as one line).
2747 12.6 Member: authors
2749 Contains authors, one per line. Part before '|' is the full name, 
2750 part after is the nickname.
2752 12.7 Member: systemid
2754 Always “lsnes-rr1” (one line). Used to reject other saves.
2756 12.8 Member: controlsversion
2758 Always “0” (one line). Used to identify what controls are there.
2760 12.9 Member: “coreversion”
2762 Contains bsnes core version number (as one line).
2764 12.10 Member: projectid
2766 Contains project ID (as one line). Used to identify if two movies 
2767 are part of the same project.
2769 12.11 Member: {rom,slota,slotb}{,xml}.sha256
2771 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2772 Absent if corresponding file is absent.
2774 12.12 Member: moviesram.<name>
2776 Raw binary startup SRAM of kind <name>. Only present in 
2777 savestates and movies starting from SRAM.
2779 12.13 Member: saveframe
2781 Contains frame number (as one line) of frame movie was saved on. 
2782 Only present in savestates.
2784 12.14 Member: lagcounter
2786 Current value of lag counter (as one line). Only present in 
2787 savestates.
2789 12.15 Member: pollcounters
2791 Contains poll counters (currently 100 of them), one per line. 
2792 Each line is raw poll count if DRDY is set for it. Otherwise it 
2793 is negative poll count minus one. Only present in savestates.
2795 12.16 Member: hostmemory
2797 Raw binary dump of host memory. Only present in savestates.
2799 12.17 Member: savestate
2801 The raw binary savestate itself. Savestate detection uses this 
2802 file, only present in savestates.
2804 12.18 Member: screenshot
2806 Screenshot of current frame. Only present in savestates. First 2 
2807 bytes are big-endian width of image, rest are 24-bit RGB image 
2808 data. Height of image is inferred from the width and size of 
2809 data.
2811 12.19 Member: sram.<name>
2813 Raw binary SRAM of kind <name> at time of savestate. Only present 
2814 in savestates.
2816 12.20 Member: input
2818 The actual input track, one line per subframe (blank lines are 
2819 skipped).
2821 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2822   the line is part of same frame as previous, otherwise it starts 
2823   a new frame.
2825 • First subframe must start a new frame.
2827 Length of movie in frames is number of lines in input file that 
2828 start a new frame.
2830 12.21 Member: subtitles
2832 Subtitle track. Optional.
2834 • Each line is in form <firstframe> <numframes> <text>.
2836 • Linefeed is encoded as \n, backslash is encoded as \\.
2838 12.22 Member: rerecords
2840 Contains textual base-10 rerecord count (as one line; emulator 
2841 just writes this, it doesn't read it) + 1.
2843 12.23 Member: rrdata
2845 This member stores set of load IDs. There is one load ID per 
2846 rerecord (plus one corresponding to start of project).
2848 • This member constists of concatenation of records
2850 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2851   consequtive IDs.
2853 • IDs are interpretted as 256-bit big-endian integers with 
2854   warparound.
2856 • Initial predicted ID is all zeroes.
2858 Format of each record is:
2860 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2861   bits 5-6 are count length (countlen). Bit 7 is unused.
2863 • 32-prefixlen bytes of ID.
2865 • countlen bytes of big-endian count (count).
2867 Records are processed as follows:
2869 • To form the first ID encoded by record, take the first 
2870   prefixlen bytes predicted ID and append the read ID value to 
2871   it. The result is the first ID encoded.
2873 • If countlen is 0, record encodes 1 ID.
2875 • If countlen is 1, record encodes 2+count IDs.
2877 • If countlen is 2, record encodes 258+count IDs.
2879 • If countlen is 3, record encodes 65794+count IDs.
2881 • The new predicted ID is the next ID after last one encoded by 
2882   the record.
2884 The number of rerecords + 1 is equal to the sum of number of IDs 
2885 encoded by all records.
2887 12.24 Member: starttime.second
2889 Movie starting time, second part. Epoch is Unix epoch. Default is 
2890 1,000,000,000.
2892 12.25 Member: starttime.subsecond
2894 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2895 is 0.
2897 12.26 Member: savetime.second
2899 Movie saving time, second part. Default is starttime.second. Only 
2900 present in savestates.
2902 12.27 Member: savetime.subsecond
2904 Movie saving time, subsecond part. Default is 
2905 starttime.subsecond. Only present in savestates.
2907 13 lsvs file format (commentary tracks)
2909 13.1 Clusters
2911 • Each cluster is 8kB (8192 bytes) in size.
2913 • Cluster n starts at offset 8192*n in file.
2915 • The following clusters are system special:
2917   – Cluster 0 and all clusters with number multiple of 2048 
2918     (cluster tables)
2920   – Cluster 1 (superblock)
2922 13.2 Cluster tables
2924 • The cluster table describing cluster n is stored in cluster n & 
2925   ~0x7FF (zero last 11 bits of n).
2927 • This cluster table consists of 2048 4-byte big-endian integers.
2929 • Each entry describes a cluster in 16MB supercluster, in order.
2931 • The valid values for entries are:
2933   – 0x00000000: Free cluster
2935   – 0x00000001: Last cluster in chain.
2937   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2939   – (anything else): Number of next cluster in chain. Must not be 
2940     multiple of 2048.
2942 • Due to limitations of the format, there can be at most 2097052 
2943   superclusters, giving maximum file size of 16TB.
2945 13.3 Stream table
2947 • The stream table chain always starts in cluster 2.
2949 • Otherwise, it follows normal chaining.
2951 • The stream table consists of 16-byte entries:
2953   – The first 8 bytes of entry give big-endian beginning position 
2954     of stream in units of 1/48000 s.
2956   – The next 4 bytes of entry give big-endian beginning cluster 
2957     for control data. 0 here marks the entry as not present.
2959   – The last 4 bytes of entry give big-endian beginning cluster 
2960     for codec data.
2962 • Stream table clusters are normal clusters, following normal 
2963   chaining.
2965 • The stream begnning position is not guarenteed unique. There 
2966   can be multiple streams with the same starting position in the 
2967   file.
2969 13.4 Stream control data
2971 • The stream control data consists of entries 4 bytes each:
2973   – The first 2 bytes of entry gives big-endian length of packet
2975   – The next byte of entry gives audio length of packet in units 
2976     of 1/400 s.
2978   – The last byte is control byte.
2980     ∗ 0 means this entry is not present and the control data 
2981       ends.
2983     ∗ 1 is valid control entry.
2985 • The stream control data can also end by running into end of the 
2986   readable chain.
2988   – This happens if there happens to be exact multiple of 2048 
2989     packets in stream and number of packets is nonzero.
2991 • These clusters follow normal chaining.
2993 13.5 Stream codec data
2995 • Stream codec data consists of raw Opus data packets packed back 
2996   to back with nothing in between.
2998 • Warning: Due to internal limitations, this data must reside in 
2999   the first 65536 superclusters (that is, the first 1TB of the 
3000   file).
3002 13.6 Superblock
3004 • The superblock is stored in cluster 1. 
3006 • The first 11 bytes are “sefs-magic”<NUL>.
3008 • The rest are unused.
3010 • This cluster 1 is marked as system special.
3012 14 Known ROM extensions
3014 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
3015   dx2, mgd, mgh.
3017 • DMG cartridge ROMs: dmg, gb.
3019 • GBC cartridge ROMs: cgb, gbc.
3021 15 Gamepack files
3023 • The first line must be: “[GAMEPACK FILE]”.
3025 • There is one needed line: “type <systype>”. This sets system 
3026   type to <systype>. The following system types are valid:
3028   – snes (SNES)
3030   – bsx (BS-X non-slotted)
3032   – bsxslotted (BS-X slotted)
3034   – sufamiturbo (Sufami Turbo)
3036   – sgb (Super Game Boy)
3038   – dmg (Game Boy)
3040   – gbc (Game Boy Color)
3042   – gbc_gba (Game Boy Color with GBA initial register values)
3044 • Optionally a region can be specified: “region <region>”. The 
3045   following values are valid:
3047   – autodetect (Autodetect region: snes and sgb only)
3049   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
3051   – pal (PAL: snes, sgb)
3053   – world (World: dmg, gbc, gbc_gba)
3055 • ROM images are loaded as: “rom <type> <file>”. The following 
3056   types are valid:
3058   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
3059     bsxslotted, sufamiturbo)
3061   – bsx (Cartridge ROM in bsx, bsxslotted)
3063   – slot-a (Cartridge ROM in sufamiturbo)
3065   – slot-b (Cartridge ROM in sufamiturbo)
3067 • ROM markup can be loaded as: “xml <type> <file>”. The types 
3068   valid are the same as for ROMs.
3070 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
3071   types are the same as for ROMs.
3073   – Offset is given in form [+-]<number>. Usually offset is 
3074     either +0 or -512.
3076   – Default offset is +0.
3078 15.1 Example:
3080 [GAMEPACK FILE]
3082 type snes
3084 rom rom speedygonzales.sfc
3086 patch-512 rom sonicthehedgehog.ips
3088 15.2 Example 2:
3090 [GAMEPACK FILE]
3092 type sgb
3094 rom rom supergameboy.sfc
3096 rom dmg megamanV.dmg
3098 16 Quick'n'dirty encode guide
3100 1. Start the emulator and load the ROM and movie file.
3102 2. Set large AVI option 'set-setting avi-large on'
3104 3. Enable dumping 'dump-avi tmpdump' 
3106 4. Unpause and let it run until you want to end dumping.
3108 5. Close the emulator (closing the window is the easiest way). Or 
3109   use 'end-avi'.
3111 6. For each tmpdump*.avi file created, on command prompt, do 
3112   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
3114 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
3116 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
3117   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
3118   tmpdump_<numbers>.mkv, with + in between).
3120 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
3121   final.mkv contains quick'n'dirty encode.
3123 17 Axis configurations for some gamepad types:
3125 17.1 XBox360 controller:
3127 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
3128 set to pressure-+.
3130 set-axis joystick0axis2 pressure-+
3132 set-axis joystick0axis5 pressure-+
3134 • This is needed for SDL only. EVDEV sets those types correctly.
3136 17.2 PS3 “sixaxis” controller:
3138 Axes 8-19 should be disabled.
3140 set-axis joystick0axis8 disabled
3142 set-axis joystick0axis9 disabled
3144 set-axis joystick0axis10 disabled
3146 set-axis joystick0axis11 disabled
3148 set-axis joystick0axis12 disabled
3150 set-axis joystick0axis13 disabled
3152 set-axis joystick0axis14 disabled
3154 set-axis joystick0axis15 disabled
3156 set-axis joystick0axis16 disabled
3158 set-axis joystick0axis17 disabled
3160 set-axis joystick0axis18 disabled
3162 set-axis joystick0axis19 disabled
3164 18 Errata:
3166 18.1 Problems from BSNES core:
3168 • The whole pending save stuff.
3170 • Lack of layer hiding.
3172 • It is slow (especially accuracy).
3174 • Firmwares can't be loaded from ZIP archives.
3176 18.2 Other problems:
3178 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
3180 • Audio for last dumped frame is not itself dumped.
3182 • Audio in UI is pretty bad in quality if game doesn't run at 
3183   full speed.
3185 • No menus, command based interface (SDL).
3187 • Long commands don't scroll.
3189 19 Changelog:
3191 19.1 rr0-beta1
3193 • Fix -Wall warnings
3195 • Fix dumper video corruption with levels 10-18.
3197 19.2 rr0-beta2
3199 • Autofire
3201 • Lots of code cleanups
3203 • Lua interface to settings
3205 • Allow specifying AVI borders without Lua
3207 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
3209 • on_snoop lua callback
3211 • Faster movie loading and saving.
3213 19.3 rr0-beta3
3215 • Joystick support
3217 19.4 rr0-beta4
3219 • Fix multi-buttons
3221 • Save jukebox functionality.
3223 19.5 rr0-beta5
3225 • Try to fix some nasty failing movie load edge cases
3227 • Allow specifying scripts to run on command line.
3229 19.6 rr0-beta6
3231 • Major source code reorganization.
3233 • Backup savestates before overwriting.
3235 • Don't crash if loading initial state fails.
3237 19.7 rr0-beta7
3239 • Fix firmware lookup
3241 • Fix author name parsing
3243 • Fix rerecord counting
3245 • (SDL) Print messages to console if SDL is uninitialized
3247 • Add movieinfo program
3249 • Fix loading movies starting from SRAM.
3251 19.8 rr0-beta8
3253 • Add support for unattended dumping
3255 • Fix compiling for Win32
3257 • Don't lock up if sound can't be initialized
3259 • Strip trailing CR from commands
3261 • Don't try to do dubious things in global ctors (fix crash on 
3262   startup)
3264 19.9 rr0-beta9
3266 • Small documentation tweaking
3268 • Fix make clean
3270 • Fix major bug in modifier matching
3272 19.10 rr0-beta10
3274 • Lots of documentation fixes
3276 • Use dedicated callbacks for event backcomm., not commands.
3278 • Ensure that the watchdog is not hit when executing delayed 
3279   reset.
3281 • Remove errant tab from joystick message.
3283 19.11 rr0-beta11
3285 • Make autofire operate in absolute time, not linear time
3287 • Reinitialize controls when resuming from loadstate
3289 • Some more code cleanups
3291 • If Lua allocator fails, call OOM_panic()
3293 • Byte/word/dword/qword sized host memory write/read functions.
3295 • Dump at correct framerate if dumping interlaced NTSC 
3296   (height=448).
3298 19.12 rr0-beta12
3300 • Actually include the complete source code
3302 • Keep track of RTC
3304 19.13 rr0-beta13
3306 • Document {save,start}time.{,sub}second.
3308 • Intercept time() from bsnes core.
3310 19.14 rr0-beta14
3312 • Allow disabling time() interception (allow build on Mac OS X)
3314 • Use SDLMain on Mac OS X (make SDL not crash)
3316 • Disable delayed resets (just plain too buggy for now).
3318 • Code cleanups
3320 • Use 16-bit for graphics/video instead of 32-bit.
3322 • gui.rectangle/gui.pixel
3324 • gui.crosshair
3326 • New CSCD writer implementation.
3328 19.15 rr0-beta15
3330 • Fix interaction of * and +.
3332 • Manual improvements
3334 • Use gettimeofday()/usleep(), these seem portable enough.
3336 • Move joystick axis manipulation to keymapper code.
3338 • Changes to how read-only works.
3340 • Refactor controller input code.
3342 19.16 rr0-beta16
3344 • Fix mouseclick scale compensation.
3346 • Draw area boundaries correctly in SDL code.
3348 • gui.screenshot.
3350 • Fix CSCD output (buffer overrun and race condition).
3352 19.17 rr0-beta17
3354 • JMD dumping support.
3356 • Allow unattended dumping to JMD.
3358 • Move to BSNES v083.
3360 • Switch back to 32-bit colors.
3362 • Add Lua function gui.color.
3364 • Use some new C++11 features in GCC 4.6.
3366 • Be prepared for core frequency changes.
3368 • Pass colors in one chunk from Lua.
3370 19.18 rr0-beta18
3372 • New lua functions gui.line(), gui.status() and gui.circle(), 
3373   memory.vma_count(), memory.read_vma() and memory.find_vma().
3375 • Numerious documentation fixups
3377 • RTC time format changed
3379 • Reformat flags display
3381 • Allow lua package name to be overridden
3383 • SDUMP (high-quality dumping).
3385 • Split platform support to plugins.
3387 • Make all sound plugins support basic sound commands
3389 • Support portaudio for sound.
3391 • Allow disable Lua/SDL searching.
3393 • Upconvert colors when copying lcscreen to screen.
3395 • Reorganize source tree.
3397 • Evdev joystick support.
3399 • Refactor more code into generic window code.
3401 19.19 rr0-beta19
3403 • Refactor message handling.
3405 • Rework makefile
3407 • Documentation fixes
3409 • Finish pending saves before load/quit.
3411 • Wxwidgets graphics plugin.
3413 19.20 rr0-beta20
3415 • Get rid of win32-crap.[ch]pp.
3417 • Move files around a lot.
3419 • Get rid of need for host C++ compiler.
3421 • Bsnes v084 core.
3423 • Refactor inter-component communication.
3425 • Fix zero luma.
3427 • Fix crash on multiline aliases.
3429 • Load/Save settings in wxwidgets gui.
3431 19.21 rr0-beta21
3433 • Patch problems in bsnes core
3435 • SNES is little-endian, not big-endian!
3437 • Fix memory corruption in lcscreen::load()
3439 19.22 rr0-beta22
3441 • Fix interpretting repeat counts in rrdata loading.
3443 • New lua callback: on_frame()
3445 • Remove calls to runtosave() that aren't supposed to be there
3447 • Lua function: movie.read_rtc()
3449 • Ignore src/fonts/font.cpp
3451 • Fix more bsnes core problems
3453 • Control bsnes random seeding
3455 • Pause-on-end
3457 • Some bsnes core debugging features (state dump and state hash)
3459 • Fix titlebar version number (no, the last version wasn't 
3460   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
3462 19.23 rr0-beta23
3464 • Fix memory corruption due to macro/field mixup
3466 • search-memory update
3468 • Allow direct-mapped framebuffer
3470 • SDL: Use SDL_ANYFORMAT if possible
3472 • SDMP2SOX: 2s delay modes.
3474 • Wxwidgets: Cleanups
3476 • Use sed -E, not sed -r. Fixes building on Mac OS X.
3478 • Wxwidgets: Save jukebox on exit
3480 • Fix RTC if using load-movie on savestate.
3482 • Fix crash related to full console mode.
3484 19.24 rr0-beta24
3486 • Wxwidgets: Allow bringing application to foreground on Mac OS 
3487   X.
3489 • Wxwidgets: Allow compiling on Mac OS X.
3491 • Use movie compare instead of movie hashing (faster save/load).
3493 • Lua: _SYSTEM table.
3495 19.25 rr0-beta25
3497 • sdmp2sox: Pad soundtrack if using -l or -L.
3499 • sdmp2sox: Fix NTSC overscan.
3501 • sdmp2sox: Add AR correction mode.
3503 • call lua_close() when exiting.
3505 • Fix zip_writer bug causing warnings from info-zip and error 
3506   from advzip.
3508 19.26 rr0-beta26
3510 • Fix IPS patching code (use bsnes core IPS patcher).
3512 • Implement BPS patching (using bsnes core IPS patcher).
3514 • Add feature to load headered ROMs.
3516 19.27 rr0-beta27
3518 • Show command names when showing keybindings
3520 19.28 rr0
3522 • Fix pause-on-end to be actually controllable
3524 • SDL: Poll all events in queue, not just first one (fixes 
3525   slowness in command typing)
3527 • Wxwidgets: Fix ROM loading.
3529 19.29 rr1-beta0
3531 • Lua: Add gui.textH, gui.textV, gui.textHV
3533 • Fix text colors on SDL on Mac OS X
3535 • Mode 'F' for finished in readonly mode.
3537 • Fix some WS errors.
3539 • Reliably pause after skip poll
3541 • Split UI and core into their own threads
3543 19.30 rr1-beta1
3545 • Remove leftover dummy SRAM slot
3547 • Fix controller numbers.
3549 19.31 rr1-beta2
3551 • Fix lsnes-dumpavi after interface change.
3553 • Also give BSNES patches for v085.
3555 • Pack movie data in memory.
3557 19.32 rr1-beta3
3559 • Fix framecount/length given when loading movies.
3561 • Controller command memory leak fixes.
3563 • Don't leak palette if freeing screen object.
3565 19.33 rr1-beta4
3567 • Detect revisions.
3569 • Wxwidgets: Allow controlling dumper from the menu.
3571 19.34 rr1-beta5
3573 • Rewrite parts of manual
3575 • Lua: Make it work with Lua 5.2.
3577 19.35 rr1-beta6
3579 • Win32: Fix compile errors.
3581 19.36 rr1-beta7
3583 • Refactor controller input code.
3585 • Fix crash when using command line on SDL / Mac OS X.
3587 19.37 rr1-beta8
3589 • Delete core/coroutine (obsolete)
3591 • Lag input display by one frame.
3593 • Rewind movie to beginning function.
3595 • Fix wrong frame number reported to Lua when repainting after 
3596   loadstate
3598 • Support UI editing of jukebox
3600 • Wxwidgets: Save settings on exit.
3602 • Support ${project} for filenames
3604 • SDL: Fix command history
3606 19.38 rr1-beta9
3608 • Fix some order-of-global-ctor bugs.
3610 19.39 rr1-beta10
3612 • Fix crashes when quitting on Win32.
3614 19.40 rr1-beta11
3616 • EVDEV: Queue keypresses from joystick, don't send directly
3618 • Wxwidgets: Load-Preserve that actually works.
3620 19.41 rr1-beta12
3622 • Wxwidgets: GUI for memory search.
3624 • Warn about using synchronous queue in UI callback.
3626 19.42 rr1-beta13
3628 • Remember last saved file for each ROM
3630 • Support MT dumping via boost.
3632 • Lua: input.raw
3634 • Lua: input.keyhook
3636 • Make mouse be ordinary input instead of special-casing
3638 • SDL: Don't screw up commands with NUL codepoints.
3640 19.43 rr1-beta14
3642 • Merge status panel and main window
3644 • True movie slot support (the rest of it)
3646 • SDL: Fix compilation error
3648 • Elminate cross calls in dump menu code.
3650 19.44 rr1-beta15
3652 • Cancel pending saves command
3654 • Wxwidgets: Code refactoring
3656 • Wxwidgets: Fix system -> reset
3658 • Wxwidgets: Read watch expressions in the right thread
3660 19.45 rr1-beta16
3662 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
3663   doesn't support that).
3665 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
3666   needed).
3668 • Don't append trailing '-' to prefix when saving movie.
3670 • Fix ROM/savestate handling (don't let user mismatch ROM and 
3671   savestates).
3673 19.46 rr1
3675 • Document memory watch syntax.
3677 19.47 rr1-delta1
3679 • Fix unattended dumping (lsnes-dumpavi)
3681 • Support RAW dumping
3683 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
3684   (changes syntax)
3686 • Add option to control sample rate preturbation in AVI dumper
3688 19.48 rr1-delta2
3690 • Wxwidgets: Fix dumper submodes
3692 • Set core controller types before loadstate
3694 19.49 rr1-delta2epsilon1
3696 • Fix compiling with bsnes v086.
3698 19.50 rr1-delta3
3700 • Don't prompt before quitting
3702 • Start unpaused, preserve pause/unpause over load.
3704 • Try to autodetect if ROM is headered.
3706 • Wxwidgets: Only bring up ROM patching screen if specifically 
3707   requested.
3709 • Allow configuring some hotkeys.
3711 19.51 rr1-delta4
3713 • Lots of code cleanups
3715 • Fix JMD compression (JMD dumping was broken)
3717 • Don't crash if Lua C function throws an exception.
3719 • Support bitmap drawing in Lua.
3721 • Fix bsnes v085/v086 patches.
3723 • Improve stability on win32.
3725 19.52 rr1-delta4epsilon1
3727 • Don't corrupt movie if movie length is integer multiple of 
3728   frames per page.
3730 19.53 rr1-delta5
3732 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
3734 • New Lua functions: emulator_ready(), utime(), 
3735   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
3736   bit.value(), input.geta(), input.seta() and 
3737   input.controllertype()
3739 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
3741 • Wxwidgets: Fix broken modifiers
3743 • on_paint has parameter now.
3745 • Optional initital fill for bitmaps
3747 • Fix palette changing.
3749 • Optimize rendering a bit.
3751 • Bsnes v087 support.
3753 19.54 rr1-delta5epsilon1
3755 • Movieinfo: Fix display of port #2 type.
3757 • Call on_input() after loadstate.
3759 19.55 rr1-delta5epsilon2
3761 • Fix writing port2 data to movie.
3763 • Fix SRAM handling with Bsnes v087.
3765 19.56 rr1-delta6
3767 • Library loading support
3769 • Built-in TSCC encoder
3771 • Hi-color (256T colors) dumping.
3773 • Dump over TCP/IP(v6)
3775 • Hidable status panel
3777 • Turbo toggle/hold
3779 • Adjustable sound volume
3781 • Screen scaling
3783 • Allow DnD into filename boxes
3785 • Configurable paths
3787 • Portaudio: Fix speaker popping at start
3789 • Lots of UI changes
3791 • Speed adjustment menu
3793 • Win32 joystick support
3795 • Lua: gui.rainbow and gui.box
3797 • Split key lists into classes (the key list was large!)
3799 • More save slots support
3801 • Wxwidgets (wxJoystick) joystick support
3803 19.57 rr1-delta7
3805 • Lots of internal joystick refactoring
3807 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3809 • Wxwidgets: Settings mode (open settings without ROM)
3811 • Wxwidgets: Prompt key to use option
3813 • Wxwidgets: Fix crash if key goes away underneath
3815 • Wxwidgets: Fix mouse position in presence of scaling
3817 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3818   using SRC)
3820 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3821   control doesn't seem to work well on WinXP)
3823 • Start paused option.
3825 19.58 rr1-delta7epsilon1
3827 • AVI: ZMBV support
3829 • lsnes-dumpavi: Start Lua before starting dumper
3831 • AVI: Fix secondary audio in mode 4.
3833 19.59 rr1-delta7epsilon2
3835 • AVI: Refactor ZMBV a bit.
3837 • Fix error reading analog values from movie file
3839 19.60 rr1-delta8
3841 • Delayed reset support
3843 • Lua: memory.hash_region
3845 19.61 rr1-delta8epsilon1
3847 • Rework the build system
3849 • Typing input support
3851 • Fix building with bsnes v086 and v087.
3853 • SDL: Save settings on exit
3855 • SDL: Command to enter command line mode with given command.
3857 • SDL: More advanced command editing.
3859 19.62 rr1-delta9
3861 • wxMSW: Fix the “arrow keys and enter don't work” problem
3863 • MSU-1 support
3865 • Show mode changes due to rewinding.
3867 • Unsafe rewind support
3869 • Fix directory transversal.
3871 19.63 rr1-delta10
3873 • AVI: Sound mode 5 (48kHz high-quality)
3875 • Lua: Reset Lua VM
3877 • Map the SNES bus into address space
3879 • Fix loading memory watch files with CRLF line endings
3881 19.64 rr1-delta10epsilon1
3883 • Map bsnes internal state into memory space
3885 • Fix the “click on panel wedges the emulator” for real.
3887 • DnD movies/saves on the main window.
3889 19.65 rr1-delta11
3891 • Split core bindings into own module.
3893 • Remember invalid settings
3895 • Support for modified Gambatte core for GB/GBC emulation.
3897 • Reload/swap ROM function
3899 19.66 rr1-delta11epsilon1
3901 • Fix step poll function
3903 19.67 rr1-delta12
3905 • Non-insane savestate anchoring
3907 19.68 rr1-delta13
3909 • More Memory search methods
3911 • Preserve movie if loading in RO mode.
3913 • Fix a obscure case in timeline check
3915 • Revamp the entiere ROM loading code
3917 • Support DnD on ROMs
3919 • Revamp menu layout
3921 • Standalone hotkey config dialog
3923 • Show bindings in more user-friendly format
3925 19.69 rr1-delta13epsilon1
3927 • Pipedec support
3929 • Fix uninitialized variables in bsnes v085
3931 19.70 rr1-delta14
3933 • Merge gambatte core into mainline (from its own branch)
3935 • Wxwidgets: Show expected dump file formats
3937 • Memory watch: Data typing
3939 • lsnes internal MMIO area.
3941 • Wxwidgets: New memory watch editor
3943 • Hexadecimal memory watches
3945 • Wxwidgets: Monospaced panel
3947 • Wxwidgets: Split memory watches in panel
3949 • Wxwidgets: Disable VMAs in memory search
3951 • lsnes-dumpavi: Fix speed bug
3953 • Movie subtitle support
3955 • Fix rerecord count reporting
3957 • Don't trash movie when loading in readonly mode.
3959 19.71 rr1-delta14epsilon1
3961 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3963 • Fix build on Mac OS X.
3965 • Lua: loopwrapper
3967 • Wxwidgets: Hidable messages window
3969 • Lua: input.joyset
3971 • Bsnes: Support inconsistent saves
3973 • Bsnes: Allow simulating saving every frame
3975 • Fix desync if savestate is loaded in readonly mode in certain 
3976   conditions.
3978 • Wxwidgets: Fix save dialogs on Mac OS X.
3980 • Wxwidgets: Fix insane status width on Win32.
3982 • Wxwidgets: Fix autohold processing to be faster.
3984 • Wxwidgets: Allow loading ROMs and movies from commandline.
3986 19.72 rr1-delta15
3988 • Be a bit smarter with --load
3990 • Rewrote higher-level parts of audio system
3992 • Tool to build commentary tracks
3994 • Lua: input.joyget
3996 • Gambatte: Add support for SVN358
3998 • Use builtin font when rendering status panel.
4000 • Option to detach memory watch to its own window.
4002 • Recent ROMs/Movies menu
4004 • Libao support
4006 • Useful lag counter for SNES games that autopoll
4008 • Fix buffer overflow in gambatte sound output
4010 19.73 rr1-delta15epsilon1
4012 • Don't blow up on wxGTK if the window is hidden somehow
4014 • Support simultaneous drop of ROM and movie.
4016 • Gambatte: Don't save spurious SRAMs.
4018 • Make SGB ROMs actually usable.
4020 • Fix so that saved movies appear in recent movies.
4022 • Don't open multiple commentary editors at once.
4024 19.74 rr1-delta15epsilon2
4026 • Lua: memory.readregion/memory.writeregion
4028 • Lua: memory.map{,s}{byte,word,dword,qword}
4030 • Lua: memory.map_structure
4032 • Lua: Fix bus_address for gambatte
4034 • Fix features dependent of bsnes debugger
4036 • Cleanup bsnes debugger logic
4038 • Fix resets in presence of save every frame
4040 19.75 rr1-delta15epsilon3
4042 • Lua: input.lcid_to_pcid
4044 • Fix off-by-one bug with slot hashes
4046 • Fix crashes on certain memory watch expressions
4048 • Lua: memory.read_expr
4050 • Lua: Fix memory.read_expr on nil argument
4052 • Fix the code to compile on G++ 4.7
4054 • Change button_id to be a function pointer field, not a virtual 
4055   method
4057 • Add bsnes patches to fix libsnes to compile on GCC 4.7
4059 • Gambatte: Always use legacy lag counting
4061 • Memory commands: Memory addresses are up to 16 hex digits, not 
4062   up to 8
4064 • Fix analog controllers
4066 • Fix autohold menus
4068 • Fix button symbols in input display
4070 • Compensate for nuts bsnes superscope/justifier handling
4072 • Lua: Fix bit.extract boolean handling
4074 19.76 rr1-delta16
4076 • Stop at movie end: Don't off-by-one
4078 • Fix crash closing lsnes with voice playback active.
4080 • Import/Export OggOpus for commentary tracks
4082 • 16-button controllers.
4084 • Don't show nonexistent controllers in input display
4086 • Set voice record/playback volume from UI
4088 • Patches for gambatte SVN364.
4090 • Load markup (if exists) even without gamepack file.
4092 • Screen rotation & flipping
4094 • Lua: Some new bit functions
4096 • Auto-refresh voice streams on change.
4098 • Auto-refresh subtitles on change & new subtitle editor.
4100 • Fix music volume adjustment.
4102 19.77 rr1-delta16epsilon1
4104 • Wxwidgets: Fix memory watch rendering.
4106 • Wxwidgets: Allow setting voice stream gain.
4108 • Wxwidgets: VU meters and volume adjustment.
4110 • Lua: Custom fonts support.
4112 • Lua: Fix methods stopping working when resetting Lua.
4114 • Fix loading standard-format movies in preserve (readonly) mode.
4116 19.78 rr1-delta17
4118 • Primitive movie editor
4120 • Fix VU meter with no sound device.
4122 • Fix various undefined return values.
4124 • Show rates in VU meter window.
4126 19.79 rr1-delta17epsilon1
4128 • Commentary tool: Set nominal bit rate and limit max bit rate.
4130 • Lua: Unconditionally reload host memory on loadstate
4132 • Lua: Query bindings, manipulate aliases, create inverse 
4133   bindings
4135 • Lua: Fix crashes with resetting VM while some types of paint 
4136   requests are in flight.
4138 • Lua: gui.text: Clip the text properly instead of corrupting 
4139   memory in some cases.
4141 • Save screenshot header reliably
4143 • Lua: Backport input.get2 and input.set2
4145 • Lua: New controller info functions.
4147 • Movie editor: Fix reset delay counters to be the right way 
4148   around.
4150 • Lua: on_snoop2
4152 • Lua: on_button and input.veto_button.
4154 19.80 rr1-delta17epsilon2
4156 • Fix saving PNG screenshots on Win32.
4158 • Movie editor: Sweep axis.
4160 • Load selected slot in ro/rw/preserve/movie mode.
4162 • input.joyset: Preserve and invert user input.
4164 • Allow immediate saving at point of save (transfer saves).
4166 • Wxwidgets: Filter filenames in dialogs, autoappend extensions.
4168 • data/verysmall.font: Add missing glyph 70 (“F”).
4170 • Lua: Allow painting custom fonts with halo.
4172 • Fix memory value search to work on byte types.
4174 19.81 rr1-delta17epsilon3
4176 • Fix status panel (and movie editor) flicker
4178 • Show effects of Lua in input display
4180 • Offer lsmv.backup as file filter too for load lsmv
4182 • Allow slowing down subframe advance 
4184 • Display current save slot information
4186 • Add snes9x fonts
4188 • Fix hotkeys stopping working after X-ing settings dialog
4190 • Movie editor: Fix bug if extending finished movie
4192 • Cap current_frame_first_subframe to movie size when recounting 
4193   movie
4195 • Movie editor: Interpret ctrl+click as right click