Lua: Fix drawing lines in certain angles
[lsnes.git] / manual.txt
blob65c0fe911c56bc7d41e235efdc2000c485083a92
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 run-lua <script>
678 Run specified lua file using built-in Lua interpretter.
680 6.9.3 reset-lua
682 Clear the Lua VM state and restore to factory defaults.
684 6.10 Memory watch
686 6.10.1 add-watch <name> <expression>
688 Adds new watch (or modifies old one).
690 6.10.2 remove-watch <name>
692 Remove a watch.
694 6.11 Sound 
696 6.11.1 enable-sound <on/off> 
698 Enable/Disable sound.
700 6.11.2 set-sound-device <device> 
702 Set sound device to <device>
704 6.11.3 show-sound-status 
706 Show status of sound system.
708 6.11.4 show-sound-devices
710 Show all available devices.
712 6.11.5 set-volume <multiplier>
714 Set the volume multiplier to <multiplier>. 1 is normal volume, 
715 and higher numbers are louder.
717 6.11.6 set-volume <multiplier>%
719 Set the volume multiplier to <multiplier> percent. 100 is normal 
720 volume, and higher numbers are louder.
722 6.11.7 set-volume <multiplier>dB
724 Set the volume multiplier to <multiplier> dB. 0 is normal volume, 
725 and higher numbers are louder. The value may be negative.
727 6.12 Misc.
729 6.12.1 reload-rom [<file>]
731 Reloads the main ROM image from <file>.
733 6.12.2 edit-subtitle <firstframe> <length> [<text>]
735 Edit or delete a subtitle.
737 6.12.3 list-subtitle
739 List subtitles.
741 6.13 Commentary track
743 6.13.1 list-streams
745 List streams
747 6.13.2 play-stream <id>
749 Play stream <id>.
751 6.13.3 delete-stream <id>
753 Delete stream <id>
755 6.13.4 change-timebase <id> <newbase>
757 Change time base of <id> to <newbase>. The time base can be given 
758 as samples (integer) or second (postfix with s).
760 6.13.5 import-stream-opus <timebase> <file>
762 Import opus stream from <file>, placing it at <timebase>. This 
763 operation is lossless.
765 6.13.6 import-stream-pcm <timebase> <file>
767 Import PCM (.sox, 1ch@48kHz) stream from <file>, placing it at 
768 <timebase>.
770 6.13.7 export-stream-opus <id> <file>
772 Export stream <id> as opus stream to <file>. This operation is 
773 lossless.
775 6.13.8 export-stream-pcm <id> <file>
777 Export stream <id> as PCM (.sox) stream to <file>. 
779 6.13.9 export-superstream <file>
781 Export the entiere superstream as PCM (.sox) stream to <file>.
783 6.13.10 load-collection <file>
785 Load collection (if there is existing collection, unload it) from 
786 <file>
788 6.13.11 unload-collection
790 Unload collection.
792 6.13.12 +tangent
794 Tangent for recording voice for commentary track. While pressed, 
795 record a stream.
797 6.14 SDL Platform commands 
799 The following are valid on SDL platform.
801 6.14.1 identify-key
803 Asks to press a key and then identifies that (pseudo-)key.
805 6.14.2 toggle-console 
807 Toggle between windowed/fullscreen console.
809 6.14.3 scroll-fullup 
811 Scroll messages window as far back as it goes.
813 6.14.4 scroll-fulldown 
815 Scroll messages window as far forward as it goes.
817 6.14.5 scroll-up 
819 Scroll messages window back one screenful.
821 6.14.6 scroll-down 
823 Scroll messages window forward one screenful.
825 6.14.7 prompt-command <command>
827 Enter command prompt, with prompt prepopulated with specified 
828 command.
830 7 Settings
832 7.1 Core settings
834 7.1.1 firmwarepath
836 Set where bsnes looks for firmware files. Default is “.”.
838 7.1.2 target
840 Set the target . Numeric, range is 0.001 to “infinite”. Default 
841 is native framerate.
843 7.1.3 savecompression
845 Set save compression level (integer 0-9). Default is 7 (0 is no 
846 compression).
848 7.1.4 advance-timeout
850 Set the frame advance timeout in milliseconds. Numeric integer, 
851 range is 0-999999999. Default is 500.
853 7.1.5 advance-subframe-timeout
855 Subframe advance timeout in milliseconds. Default is 100.
857 7.1.6 save-every-frame (bsnes only)
859 If true, simulate saving on each frame. Trades off emulation 
860 accuracy for sync stability. Also needed if the movie assumes 
861 saving on each frame for rewind.
863 7.2 AVI dumper settings
865 7.2.1 avi-large
867 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
868 the console outputs.
870 7.2.2 avi-left-border
872 AVI dumper: Set the default left border thickness (unless lua 
873 overrides) for dumps. Range 0-8191. Default is 0.
875 7.2.3 avi-right-border
877 AVI dumper: Set the default right border thickness (unless lua 
878 overrides) for dumps. Range 0-8191. Default is 0.
880 7.2.4 avi-top-border
882 AVI dumper: Set the default top border thickness (unless lua 
883 overrides) for dumps. Range 0-8191. Default is 0.
885 7.2.5 avi-bottom-border
887 AVI dumper: Set the default bottom border thickness (unless lua 
888 overrides) for dumps. Range 0-8191. Default is 0.
890 7.2.6 avi-maxframes
892 AVI dumper: Maximum number of frames per dump segment (0 => 
893 unlimited). Range 0-999999999. Default is 0.
895 7.2.7 avi-compresison
897 AVI dumper: Compression level (0-18).
899 • Compression levels 10 and above are not compatible with stock 
900   CSCD codec.
902 • Recomended level is 7.
904 7.2.8 avi-soundrate
906 AVI dumper: Set method of determining the sound rate.
908 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
909   64, 88.2, 96, 128, 176.4 and 192 kHz.
911 • 1: Round down to nearest integer.
913 • 2: Round up to nearest ingeter.
915 7.3 JMD options
917 7.3.1 jmd-copression
919 JMD dumper: Compression level (0-9).
921 7.4 SDL platform settings
923 7.4.1 autorepeat-first-delay
925 Sets the delay for first character in typematic autorepeat.
927 7.4.2 autorepeat-subsequent-delay
929 Sets the delay for subsequent characters in typematic autorepeat.
931 8 Lua functions
933 8.1 Core (in main table)
935 8.1.1 print
937 Print line to message console.
939 8.1.2 exec(string command)
941 Run command as it was entered on the command line
943 8.1.3 utime()
945 Returns two values. First is time since some epoch in seconds, 
946 the second is microseconds mod 10^6 since that epoch.
948 8.1.4 emulator_ready()
950 Returns true if emulator has finished booting, false if not 
951 (on_startup() will be issued later).
953 8.1.5 set_idle_timeout(number timeout)
955 Set number of microseconds to block idle for. After this timeout 
956 has expired, on_idle() will be called once.
958 8.1.6 set_timer_timeout(number timeout)
960 Set number of microseconds to block timer for. After this timeout 
961 has expired, on_timer() will be called once.
963 8.1.7 bus_address(number snesaddr)
965 Returns virtual address corresponding to specified address on 
966 SNES bus.
968 8.1.8 loopwrapper(function fun, ...)
970 Calls function fun with function and specified arguments. The 
971 function passed suspends execution until the function returned is 
972 called. Handy for linear flow control among multiple invocations 
973 of a hook. Example code:
975 on_paint = loopwrapper(function(wait)
977   while true do
979     gui.text(0, 0, “Test!”);
981     wait();
983   end
985 end);
987 8.1.9 list_bindings([string cmd])
989 Get table of all keybindings, indexed by keyspec 
990 (modifiers|mask/key). If command is specified, the table is 
991 limited to that command.
993 8.1.10 get_alias(string aname)
995 Get expansion of given alias.
997 8.1.11 set_alias(string aname, string value)
999 Set expansion of given alias.
1001 8.1.12 create_ibind(string name, string cmd)
1003 Return object representing inverse binding with specified name 
1004 and specified command.
1006 • To create press/release commands, use aliases +foo and -foo .
1008 • Keep the returned object around.
1010 8.2 Table bit:
1012 Bitwise logical functions and related.
1014 8.2.1 bit.none(number...) / bit.bnot(number...)
1016 48-bit bitwise NOT / NONE function (set bits that are set in none 
1017 of the arguments).
1019 8.2.2 bit.any(number...) / bit.bor(number...)
1021 48-bit bitwise OR / ANY function (set bits that are set in any of 
1022 the arguments).
1024 8.2.3 bit.all(number...) / bit.band(number...)
1026 48-bit bitwise AND / ALL function (set bits that are set in all 
1027 of the arguments).
1029 8.2.4 bit.parity(number...) / bit.bxor(number...)
1031 48-bit bitwise XOR / PARITY function (set bits that are set in 
1032 odd number of the arguments).
1034 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
1036 Rotate bits-bit (max 48, default 48) number left by amount 
1037 (default 1) places.
1039 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
1041 Rotate bits-bit (max 48, default 48) number right by amount 
1042 (default 1) places.
1044 8.2.7 bit.lshift(number base[, number amount[, number bits]])
1046 Shift bits-bit (max 48, default 48) number left by amount 
1047 (default 1) places. The new bits are filled with zeroes.
1049 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1051 Shift bits-bit (max 48, default 48) number logically right by 
1052 amount (default 1) places. The new bits are filled with zeroes.
1054 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1056 Shift bits-bit (max 48, default 48) number arithmetically right 
1057 by amount (default 1) places. The new bits are shifted in with 
1058 copy of the high bit.
1060 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
1062 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
1063 and so on.
1065 Notes: 
1067 • Bit numbers up to 51 should work reliably (then things start 
1068   falling apart due to double precision issues).
1070 • There are two special bit positions, true and false, standing 
1071   for always set bit and always clear bit.
1073 8.2.11 bit.value([number bit1[, number bit2,...]])
1075 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
1076 shifted by bit2 places and so on. As special value, nil argument 
1077 is no-op.
1079 8.2.12 bit.test_any(number a, number b)
1081 Is there a common set bit in a and b?
1083 8.2.13 bit.test_all(number a, number b)
1085 Are all set bits in b also set in a?
1087 8.2.14 bit.popcount(number a)
1089 Population count of a.
1091 8.2.15 bit.clshift(number a, number b, [number amount,[number 
1092   bits]])
1094 Does chained left shift on a, b by amount positions, assuming 
1095 numbers to be of specified number of bits.
1097 8.2.16 bit.crshift(number a, number b, [number amount,[number 
1098   bits]])
1100 Does chained right shift on a, b by amount positions, assuming 
1101 numbers to be of specified number of bits.
1103 8.2.17 bit.flagdecode(number a, number bits, [string on, [string 
1104   off]])
1106 Return string of length bits where ith character is ith character 
1107 of on if bit i is on, otherwise ith character of off. Out of 
1108 range reads give last character, or '*'/'-' if empty.
1110 8.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
1111   off]])
1113 Like bit.flagdecode, but outputs the string in the opposite order 
1114 (most significant bit first).
1116 8.3 Table gui:
1118 Most of these functions can only be called in on_paint and 
1119 on_video callbacks. Exceptions are noted.
1121 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
1122 the green component, bits 16-23 are the red component, bits 24-31 
1123 are alpha component (0 is fully opaque, 255 is almost 
1124 transparent). -1 is the fully transparent color. Alpha values 
1125 greater than 127 do work.
1127 Origin of coordinates is at top left corner of game display area. 
1128 Left and top gaps correspond to negative coordinates.
1130 8.3.1 gui.resolution()
1132 Returns 2-tuple (hresolution, vresolution).
1134 8.3.2 gui.<class>_gap(number gap)
1136 Set the <class> (left, right, top, bottom) gap to specified value 
1137 (max gap is 8191).
1139 8.3.3 gui.text(number x, number y, string text[, number fgc[, 
1140   number bgc]])
1142 Draw specified text on the GUI (each character cell is 8 or 16 
1143 wide and 16 high). Parameters:
1145 • x: X-coordinate to start the drawing from (and x-coordinate at 
1146   begining of the lines).
1148 • y: Y-coordinate to start the drawing from.
1150 • text: The text to draw.
1152 • fgc: Text color (default is 0xFFFFFF (white))
1154 • bgc: Background color (default is -1 (transparent))
1156 8.3.4 gui.textH(number x, number y, string text[, number fgc[, 
1157   number bgc]])
1159 Like gui.text, but draw using double-width.
1161 8.3.5 gui.textV(number x, number y, string text[, number fgc[, 
1162   number bgc]])
1164 Like gui.text, but draw using double-height.
1166 8.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
1167   number bgc]])
1169 Like gui.text, but draw using double-width/double-height.
1171 8.3.7 gui.rectangle(number x, number y, number width, number 
1172   height[, number thickness[, number outline[, number fill]]])
1174 Draw rectangle on the GUI. Parameters:
1176 • x: X-coordinate of left edge.
1178 • y: Y-coordinate of upper edge.
1180 • width: Width of rectangle.
1182 • height: Height of rectangle.
1184 • thickness: Thickness of outline (default is 1).
1186 • outline: Color of outline (default is 0xFFFFFF (white))
1188 • fill: Color of fill (default is -1 (transparent))
1190 8.3.8 gui.box(number x, number y, number width, number height[, 
1191   number thickness[, number outline1[,number outline2[, number 
1192   fill]]]])
1194 Draw rectangle with 3D effect on the GUI. Parameters:
1196 • x: X-coordinate of left edge.
1198 • y: Y-coordinate of upper edge.
1200 • width: Width of rectangle.
1202 • height: Height of rectangle.
1204 • thickness: Thickness of outline (default is 1).
1206 • outline1: First color of outline (default is 0xFFFFFF (white))
1208 • outline2: First color of outline (default is 0x808080 (dark 
1209   gray))
1211 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
1213 8.3.9 gui.pixel(number x, number y[, number color])
1215 Draw one pixel on the GUI. Parameters:
1217 • x: X-coordinate of the pixel
1219 • y: Y-coordinate of the pixel
1221 • color: Color of the pixel (default is 0xFFFFFF (white))
1223 8.3.10 gui.crosshair(number x, number y[, number length[, number 
1224   color]])
1226 Draw a crosshair. Parameters:
1228 • x: X-coordinate of the crosshair
1230 • y: Y-coordinate of the crosshair
1232 • length: Length of the crosshair lines (default 10).
1234 • color: Color of the crosshair (default is 0xFFFFFF (white))
1236 8.3.11 gui.line(number x1, number y1, number x2, number y2[, 
1237   number color])
1239 Draw a thin line. Parameters:
1241 • x1: X-coordinate of one end.
1243 • y1: Y-coordinate of one end.
1245 • x2: X-coordinate of the other end.
1247 • y2: Y-coordinate of the other end.
1249 • color: Color of the line (default is 0xFFFFFF (white)).
1251 8.3.12 gui.circle(number x, number y, number r[, number thick[, 
1252   number border[, number fil]]])
1254 Draw a circle. Parameters.
1256 • x: X-coordinate of the center
1258 • y: Y-coordinate of the center
1260 • r: The radius of the circle
1262 • thick: Border thickness
1264 • border: Border color (default is 0xFFFFFF (white))
1266 • fill: Fill color (default is -1 (transparent)).
1268 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
1269   palette)
1271 Draw a bitmap on screen with specified palette. Parameters:
1273 • x: X-coordinate of left edge.
1275 • y: Y-coordinate of top edge.
1277 • bitmap: The bitmap to draw
1279 • palette: The palette to draw the bitmap using.
1281 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1283 Draw a bitmap on screen. Parameters:
1285 • x: X-coordinate of left edge.
1287 • y: Y-coordinate of top edge.
1289 • bitmap: The bitmap to draw
1291 8.3.15 gui.palette_new()
1293 Returns a new palette (initially all transparent). Can be used 
1294 anywhere.
1296 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool 
1297   icolor])
1299 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1301 • w: The width of new bitmap
1303 • h: The height of new bitmap
1305 • direct: If true, the returned bitmap is dbitmap, otherwise 
1306   bitmap.
1308 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
1309   DBITMAP)
1311 8.3.17 gui.bitmap_load(string file)
1313 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
1314 is palette for bitmap). Can be used anywhere. Parameters:
1316 • file: The name of file to load.
1318 8.3.18 gui.palette_set(palette palette, number index, number 
1319   color)
1321 Sets color in palette. Can be used anywhere. Parameters:
1323 • palette: The palette to manipulate
1325 • index: Index of color (0-65535).
1327 • color: The color value.
1329 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
1330   number color)
1332 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1334 • bitmap: The bitmap to manipulate
1336 • x: The x-coordinate of the pixel.
1338 • y: The y-coordinate of the pixel.
1340 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
1341   color value.
1343 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1345 Get size of bitmap. Can be used anywhere. Parameters:
1347 • bitmap: The bitmap to query.
1349 The first return is the width, the second is the height.
1351 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
1352   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
1353   number ck])
1355 Blit a part of bitmap to another. Can be used anywhere. 
1356 Parameters:
1358 • dest: Destination to blit to.
1360 • dx: left edge of target
1362 • dy: Top edge of target
1364 • src: The source to blit from. Must be of the same type as 
1365   destination.
1367 • sx: left edge of source
1369 • sy: Top edge of source
1371 • w: Width of region
1373 • h: Height of region.
1375 • ck: Color key. Pixels of this color are not blitted.
1377   – If bitmaps are bitmaps, this is color index of colorkey. 
1378     Values outside range 0-65535 cause no key to be used as 
1379     colorkey.
1381   – If bitmaps are dbitmaps, this color value of colorkey.
1383   – May be absent or nil for no colorkey blit.
1385 8.3.22 gui.repaint()
1387 Request on_repaint() to happen as soon as possible. Can be used 
1388 anywhere.
1390 8.3.23 gui.subframe_update(boolean on)
1392 Request subframe updates (calling on_paint() on subframes) to 
1393 happen (on=true) or not happen (on=false). Can be used anywhere.
1395 8.3.24 gui.screenshot(string filename)
1397 Write PNG screenshot of the current frame (no drawings) to 
1398 specified file. Can be used anywhere.
1400 8.3.25 gui.color(number r, number g, number b[, number a])
1402 Returns color (in notation Lua scripts use) corresponding to 
1403 color (r,g,b), each component in scale 0-255. If a is specified, 
1404 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1405 The default alpha is 256.
1407 8.3.26 gui.status(string name, string value)
1409 Set status field “L[<name>]” to <value> in status area. Can be 
1410 used anywhere.
1412 8.3.27 gui.rainbow(number step, number steps[, number color])
1414 Perform hue rotation of color <color> (default bright red), by 
1415 <step> steps. The number of steps per full rotation is given by 
1416 absolute value of <steps>.
1418 If <steps> is negative, the rotation will be counterclockwise.
1420 8.3.28 gui.screenshot(string filename)
1422 Saves a screenshot into specified file.
1424 8.3.29 gui.loadfont(string filename)
1426 Loads font from specified file (CUSTOMFONT object).
1428 8.3.30 CUSTOMFONT(number x, number y, string text[, number fgc[, 
1429   number bgc[, number hlc]]])
1431 Draw string with custom font to screen. The parameters are the 
1432 same as in gui.text, except hlc is the halo color (default is no 
1433 halo). 
1435 8.4 table input
1437 Input handling. Only available in on_input callback.
1439 8.4.1 input.get(number controller, number index)
1441 Read the specified index (0-11) from specified controller (0-7). 
1442 Notes:
1444 • Uses physical controller numbering. Gamepad in port 2 is 
1445   controller 4, not 1!
1447 8.4.2 input.set(number controller, number index, number value)
1449 Write the specified index (0-11) from specified controller (0-7), 
1450 storing value. Notes:
1452 • Uses physical controller numbering. Gamepad in port 2 is 
1453   controller 4, not 1!
1455 8.4.3 input.get2(number port, number controller, number index)
1457 Read the specified input tuple.
1459 • Port 0 is system port.
1461 8.4.4 input.set2(number port, number controller, number index, 
1462   number value)
1464 Write the specified input tuple.
1466 • Port 0 is system port.
1468 8.4.5 input.lcid_to_pcid2(number lcid)
1470 Look up physical pcid pair (port, controller) corresponding to 
1471 specified logical controller (1-based). Returns nothing if 
1472 controller does not exist.
1474 8.4.6 input.port_type(number port)
1476 Return type of specified port.
1478 8.4.7 input.controller_info(number port, number controller)
1480 Get controller info for specified controller. If controller does 
1481 not exist, returns nil. Otherwise returns a table with following 
1482 fields:
1484 • type (string): Type of the controller.
1486 • class (string): Class of the controller.
1488 • classnum (number): Number of the controller within its class 
1489   (1-based)
1491 • lcid (number): Logical controller number of the controller.
1493 • button_count (number): Number of buttons on controller
1495 • buttons (array): Array of following info about each button:
1497   – type (string): Type of button. Currently one of “null”, “
1498     button”, “axis”, “raxis”.
1500   – name (string): Name of button.
1502   – symbol (string): Symbol of button. Only present for type “
1503     button”.
1505   – hidden (boolean): True if hidden button. 
1507 8.4.8 input.veto_button()
1509 Signals that the button event should be vetoed. Only valid in 
1510 on_button callback.
1512 8.4.9 input.geta(number controller)
1514 Get input state for entiere controller. Returns 13 return values.
1516 • 1st return value: Bitmask: bit i is set if i:th index is 
1517   nonzero
1519 • 2nd-13th return value: value of i:th index.
1521 8.4.10 input.seta(number controller, number bitmask, number 
1522   args...)
1524 Set state for entiere controller. args is up to 12 values for 
1525 indices (overriding values in bitmask if specified).
1527 8.4.11 input.controllertype(number controller)
1529 Get the type of controller as string. Valid values are:
1531 • gamepad
1533 • mouse
1535 • justifier
1537 • superscope
1539 8.4.12 input.reset([number cycles])
1541 Execute reset. If cycles is greater than zero, do delayed reset. 
1542 0 (or no value) causes immediate reset.
1544 • Only available with subframe flag false.
1546 8.4.13 input.raw()
1548 Returns table of tables of all available keys and axes. The first 
1549 table is indexed by key name (platform-dependent!), and the inner 
1550 table has the following fields:
1552 • last_rawval: Last reported raw value for control.
1554 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1555   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1556   pressure-pm, pressure-p0).
1558 • cal_left: Minimum calibration value. Only meaningful with axis 
1559   and pressure types.
1561 • cal_center: Center calibration value. Only meaningful with axis 
1562   and pressure types.
1564 • cal_right: Maximum calibration value. Only meaningful with axis 
1565   and pressure types.
1567 • cal_tolerance: Dead zone tolerance. Only meaningful with axis 
1568   and pressure types.
1570 8.4.14 input.keyhook(string key, boolean state)
1572 Requests that keyhook events to be sent for key (state=true) or 
1573 not sent (state=false).
1575 8.4.15 input.joyget(number controller)
1577 Returns table for current controls for specified controller. The 
1578 names of fields vary by controller type.
1580 • The buttons have the same name as those are referred to in 
1581   other contexts in the emulator
1583 • The analog axes are “xaxis” and “yaxis”.
1585 8.4.16 input.joyset(number controller, table controls)
1587 Set the the state of specified controller to values specified in 
1588 specified table.
1590 • nil does not change value
1592 • true/false (buttons) and integers (axes) force value.
1594 • string (button) inverts the input.
1596 8.4.17 input.lcid_to_pcid(number controller)
1598 Return the physical index, physical port and controller number in 
1599 port for specified (1-based) logical controller.
1601 8.5 Table subtitle
1603 Subtitle handling
1605 8.5.1 subtitle.byindex(number i)
1607 Read the frame and length of ith subtitle. Returns nothing if not 
1608 present.
1610 8.5.2 subtitle.set(number f, number l, string txt)
1612 Set the text of subtitle.
1614 8.5.3 subtitle.get(number f, number l)
1616 Get the text of subtitle.
1618 8.5.4 subtitle.delete(number f, number l)
1620 Delete specified subtitle.
1622 8.6 Table hostmemory
1624 Host memory handling (extra memory saved to savestates). Host 
1625 memory starts empty.
1627 8.6.1 hostmemory.read(number address)
1629 Reads hostmemory slot address. Slot numbers out of range return 
1630 false instead of numeric.
1632 8.6.2 hostmemory.write(number address, number value)
1634 Writes hostmemory slot with 0-255. Slot numbers out of range 
1635 cause extension of host memory slot space.
1637 8.6.3 hostmemory.readbyte(number address)
1639 Read unsigned byte (1 element) from given address. Slots out of 
1640 range return false.
1642 8.6.4 hostmemory.writebyte(number address, number value)
1644 Write unsigned byte (1 element) to given slot. Slot numbers out 
1645 of range cause extension.
1647 8.6.5 hostmemory.readsbyte(number address)
1649 Read signed byte (1 element) from given address. Slots out of 
1650 range return false.
1652 8.6.6 hostmemory.writesbyte(number address, number value)
1654 Write signed byte (1 element) to given slot. Slot numbers out of 
1655 range cause extension.
1657 8.6.7 hostmemory.readword(number address)
1659 Read unsigned word (2 elements) from given address. Slots out of 
1660 range return false.
1662 8.6.8 hostmemory.writeword(number address, number value)
1664 Write unsigned word (2 elements) to given slot. Slot numbers out 
1665 of range cause extension.
1667 8.6.9 hostmemory.readsword(number address)
1669 Read signed word (2 elements) from given address. Slots out of 
1670 range return false.
1672 8.6.10 hostmemory.writesword(number address, number value)
1674 Write signed word (2 elements) to given slot. Slot numbers out of 
1675 range cause extension.
1677 8.6.11 hostmemory.readdword(number address)
1679 Read unsigned doubleword (4 elements) from given address. Slots 
1680 out of range return false.
1682 8.6.12 hostmemory.writedword(number address, number value)
1684 Write unsigned doubleword (4 elements) to given slot. Slot 
1685 numbers out of range cause extension.
1687 8.6.13 hostmemory.readsdword(number address)
1689 Read signed doubleword (4 elements) from given address. Slots out 
1690 of range return false.
1692 8.6.14 hostmemory.writesdword(number address, number value)
1694 Write signed doubleword (4 elements) to given slot. Slot numbers 
1695 out of range cause extension.
1697 8.6.15 hostmemory.readqword(number address)
1699 Read unsigned quadword (8 elements) from given address. Slots out 
1700 of range return false.
1702 8.6.16 hostmemory.writeqword(number address, number value)
1704 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1705 out of range cause extension.
1707 8.6.17 hostmemory.readsqword(number address)
1709 Read signed quadword (8 elements) from given address. Slots out 
1710 of range return false.
1712 8.6.18 hostmemory.writesqword(number address, number value)
1714 Write signed quadword (8 elements) to given slot. Slot numbers 
1715 out of range cause extension.
1717 8.7 Table movie
1719 Movie handling
1721 8.7.1 movie.currentframe()
1723 Return number of current frame.
1725 8.7.2 movie.framecount()
1727 Return number of frames in movie.
1729 8.7.3 movie.readonly()
1731 Return true if in readonly mode, false if in readwrite.
1733 8.7.4 movie.rerecords()
1735 Returns the current value of rerecord count.
1737 8.7.5 movie.set_readwrite()
1739 Set readwrite mode (does not cause on_readwrite callback).
1741 8.7.6 movie.frame_subframes(number frame)
1743 Count number of subframes in specified frame (frame numbers are 
1744 1-based) and return that.
1746 8.7.7 movie.read_subframes(number frame, number subframe)
1748 Read specifed subframe in specified frame and return data as 
1749 array (100 elements, numbered 0-99 currently).
1751 8.7.8 movie.read_rtc()
1753 Returns the current value of the RTC as a pair (second, 
1754 subsecond).
1756 8.7.9 movie.unsafe_rewind([UNSAFEREWIND state])
1758 Start setting point for unsafe rewind or jump to point of unsafe 
1759 rewind.
1761 • If called without argument, causes emulator to start process of 
1762   setting unsafe rewind point. When this has finished, callback 
1763   on_set_rewind occurs, passing the rewind state to lua script.
1765 • If called with argument, causes emulator rewind to passed 
1766   rewind point as soon as possible. Readwrite mode is implicitly 
1767   activated.
1769 The following warnings apply to unsafe rewinding:
1771 • There are no safety checks against misuse (that's what “unsafe” 
1772   comes from)!
1774 • Only call rewind from timeline rewind point was set from.
1776 • Only call rewind from after the rewind point was set.
1778 8.8 Table settings
1780 Routines for settings manipulation
1782 8.8.1 settings.get(string name)
1784 Get value of setting. If setting is blank, returns false. If 
1785 setting value can't be obtained, returns (nil, error message).
1787 8.8.2 settings.set(string name, string value)
1789 Set value of setting. If setting can't be set, returns (nil, 
1790 error message).
1792 8.8.3 settings.is_set(string name)
1794 Returns if setting is set. If setting does not exist, returns 
1795 (nil, error message).
1797 8.8.4 settings.blank(string name)
1799 Blanks a setting and returns true. If setting can't be blanked, 
1800 returns (nil, error message).
1802 8.9 Table memory
1804 Contains various functions for managing memory
1806 8.9.1 memory.vma_count()
1808 Returns the number of VMAs
1810 8.9.2 memory.read_vma(number index)
1812 Reads the specified VMA (indices start from zero). Trying to read 
1813 invalid VMA gives nil. The read VMA is table with the following 
1814 fields:
1816 • region_name (string): The readable name of the VMA
1818 • baseaddr (number): Base address of the VMA
1820 • lastaddr (number): Last address in the VMA.
1822 • size (number): The size of VMA in bytes.
1824 • readonly (boolean): True of the VMA corresponds to ROM.
1826 • iospace (boolean): True if the VMA is I/O space.
1828 • native_endian (boolean): True if the VMA has native endian as 
1829   opposed to little endian.
1831 8.9.3 memory.find_vma(number address)
1833 Finds the VMA containing specified address. Returns table in the 
1834 same format as read_vma or nil if not found.
1836 8.9.4 memory.readbyte(number address)
1838 Reads the specified address as unsigned byte and returns the 
1839 result.
1841 8.9.5 memory.readsbyte(number address)
1843 Reads the specified address as signed byte and returns the 
1844 result.
1846 8.9.6 memory.writebyte(number address, number value)
1848 Writes the specified value (negative values undergo 2's 
1849 complement) to specified address (as a byte).
1851 8.9.7 memory.readword(number address)
1853 Reads the specified address as unsigned word and returns the 
1854 result.
1856 8.9.8 memory.readsword(number address)
1858 Reads the specified address as signed word and returns the 
1859 result.
1861 8.9.9 memory.writeword(number address, number value)
1863 Writes the specified value (negative values undergo 2's 
1864 complement) to specified address (as a word).
1866 8.9.10 memory.readdword(number address)
1868 Reads the specified address as unsigned doubleword and returns 
1869 the result.
1871 8.9.11 memory.readsdword(number address)
1873 Reads the specified address as signed doubleword and returns the 
1874 result.
1876 8.9.12 memory.writedword(number address, number value)
1878 Writes the specified value (negative values undergo 2's 
1879 complement) to specified address (as a doubleword).
1881 8.9.13 memory.readqword(number address)
1883 Reads the specified address as unsigned quadword and returns the 
1884 result.
1886 8.9.14 memory.readsqword(number address)
1888 Reads the specified address as signed quadword and returns the 
1889 result.
1891 8.9.15 memory.writeqword(number address, number value)
1893 Writes the specified value (negative values undergo 2's 
1894 complement) to specified address (as a quadword).
1896 8.9.16 memory.hash_region(number base, number size)
1898 Hash specified number of bytes starting from specified address 
1899 and return the SHA-256.
1901 8.9.17 memory.hash_state()
1903 Hash the current system state. Mainly useful for debugging 
1904 savestates.
1906 8.9.18 memory.readregion(number base, number size)
1908 Read a region of memory.
1910 • Warning: If the region crosses VMA boundary, the results are 
1911   undefined.
1913 8.9.19 memory.map<type>([number base, number size])
1915 Returns a table mapping specified memory aperture for read/write. 
1916 If parameters are omitted, entiere map space is the aperture.
1918 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1919   qword or sqword.
1921 8.9.20 memory.writeregion(number base, number size, table data)
1923 Write a region of memory.
1925 • Warning: If the region crosses VMA boundary, the results are 
1926   undefined.
1928 8.9.21 memory.map_structure()
1930 Returns a new mapping structure (MMAP_STRUCT)
1932 8.9.22 MMAP_STRUCT(string key, number address, string type)
1934 Bind key in mmap structure to specified address with specified 
1935 type.
1937 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1938   qword or sqword.
1940 8.9.23 memory.read_expr(string expr)
1942 Evaluate specified watch expression and return result
1944 8.10 Table subtitle
1946 Contains functions for manipulating subtitles.
1948 8.10.1 subtitle.byindex(number index)
1950 Get (basetime, length) pair of specified subtitle index or 
1951 nothing if index isn't valid.
1953 8.10.2 subtitle.get(number basetime, number length)
1955 Read the specified subtitle. Returns “” if the subtitle does not 
1956 exist.
1958 8.10.3 subtitle.set(number basetime, number length, string 
1959   content)
1961 Set the specified subtitle.
1963 8.10.4 subtitle.deltete(number basetime, number length)
1965 Delete the specified subtitle.
1967 8.11 Table _SYSTEM
1969 Contains copy of global variables from time of Lua 
1970 initialization. Non-writeable.
1972 8.12 Callbacks
1974 Various callbacks to Lua that can occur.
1976 8.12.1 Callback: on_paint(bool not_synth)
1978 Called when screen is being painted. Any gui.* calls requiring 
1979 graphic context draw on the screen.
1981 not_synth is true if this hook is being called in response to 
1982 received frame, false otherwise.
1984 8.12.2 Callback: on_video()
1986 Called when video dump frame is being painted. Any gui.* calls 
1987 requiring graphic context draw on the video.
1989 8.12.3 Callback: on_frame_emulated()
1991 Called when emulating frame has completed and 
1992 on_paint()/on_video() calls are about to be issued.
1994 8.12.4 Callback: on_frame()
1996 Called on each starting whole frame.
1998 8.12.5 Callback: on_startup()
2000 Called when the emulator is starting (lsnes.rc and --run files 
2001 has been run).
2003 8.12.6 Callback: on_rewind()
2005 Called when rewind movie to beginning has completed.
2007 8.12.7 Callback: on_pre_load(string name)
2009 Called just before savestate/movie load occurs (note: loads are 
2010 always delayed, so this occurs even when load was initiated by 
2011 lua).
2013 8.12.8 Callback: on_err_load(string name)
2015 Called if loadstate goes wrong.
2017 8.12.9 Callback: on_post_load(string name, boolean was_savestate)
2019 Called on successful loadstate. was_savestate gives if this was a 
2020 savestate or a movie.
2022 8.12.10 Callback: on_pre_save(string name, boolean is_savestate)
2024 Called just before savestate save occurs (note: movie saves are 
2025 synchronous and won't trigger these callbacks if called from 
2026 Lua).
2028 8.12.11 Callback: on_err_save(string name)
2030 Called if savestate goes wrong.
2032 8.12.12 Callback: on_post_save(string name, boolean is_savestate)
2034 Called on successful savaestate. is_savestate gives if this was a 
2035 savestate or a movie.
2037 8.12.13 Callback: on_quit()
2039 Called when emulator is shutting down.
2041 8.12.14 Callback: on_input(boolean subframe)
2043 Called when emulator is just sending input to bsnes core. 
2044 Warning: This is called even in readonly mode, but the results 
2045 are ignored.
2047 8.12.15 Callback: on_reset()
2049 Called when SNES is reset.
2051 8.12.16 Callback: on_readwrite()
2053 Called when moving into readwrite mode as result of “set-rwmode” 
2054 command (note: moving to rwmode by Lua won't trigger this, as per 
2055 recursive entry protection).
2057 8.12.17 Callback: on_snoop(number port, number controller, number 
2058   index, number value)
2060 Called each time bsnes asks for input. The value is the final 
2061 value to be sent to bsnes core (readonly mode, autohold and 
2062 autofire have been taken into account). Might be useful when 
2063 translating movies to format suitable for console verification. 
2064 Note: There is no way to modify the value to be sent.
2066 • Not called if callback on_snoop2 is defined.
2068 8.12.18 Callback: on_snoop2(number port, number controller, 
2069   number index, number value)
2071 Like on_snoop, but reserves port 0 for system, having first user 
2072 port be port 1.
2074 8.12.19 Callback: on_keyhook(string keyname, table state)
2076 Sent when key that has keyhook events requested changes state. 
2077 Keyname is name of the key (group) and state is the state (same 
2078 kind as table values in input.raw).
2080 8.12.20 Callback: on_idle()
2082 Called when requested by set_idle_timeout(), the timeout has 
2083 expired and emulator is waiting.
2085 8.12.21 Callback: on_timer()
2087 Called when requested by set_idle_timeout() and the timeout has 
2088 expired (regardless if emulator is waiting).
2090 8.12.22 Callback: on_set_rewind(UNSAFEREWIND r)
2092 Called when unsafe rewind object has been constructed.
2094 8.12.23 Callback: on_pre_rewind() 
2096 Called just before unsafe rewind is about to occur.
2098 8.12.24 Callback: on_post_rewind() 
2100 Called just after unsafe rewind has occured.
2102 8.12.25 Callback: on_button(number port, number controller, 
2103   number index, string type)
2105 Called on controller button press, with following parameters:
2107 • port: Port number (0 is system)
2109 • controller: Controller within port
2111 • index: Index of button.
2113 • type: Type of event, one of:
2115   – “pressed”: Button was pressed.
2117   – “released”: Button was released.
2119   – “hold”: Held.
2121   – “unhold”: Released from hold.
2123   – “type”: Typing input on button.
2125   – “untype”: Typing input undone.
2127   – “analog”: Analog action on axis.
2129 9 Movie editor
2131 • The editor edits in-memory movie.
2133 • Because past can't be edited and readwrite mode doesn't allow 
2134   future, editing only works in read only mode.
2136 • Keyboard triggers the normal hotkeys and bindings.
2138 9.1 Left button actions
2140 • Clicking on cell in future (indicated by lack of redish 
2141   background) toggles it (if it is a button) or prompts for a 
2142   value (if it is an axis)
2144 • Dragging vertically toggles sequence of buttons or changes a 
2145   sequence of axis values.
2147 9.2 Right button actions
2149 The right mouse button pops up a context-sensitive menu:
2151 • Toggle <something>: Toggle this button
2153 • Change <something>: Change this axis value
2155 • Insert frame after: Insert a frame after this frame
2157 • Append frame: Append a frame to movie
2159 • Append frames: Append specified number of frames to movie
2161 • Delete frame: Delete this frame
2163 • Delete subframe: Delete this subframe
2165 • Truncate movie: Delete this subframe and everything after it.
2167 • Scroll to frame: Prompt for a frame and scroll the display to 
2168   that frame.
2170 • Scroll to current frame: Scroll the display to current position
2172 • Run to frame: Prompts for frame and runs the emulation to that 
2173   frame.
2175 • Change number of lines visible: Change the height of the movie 
2176   display (1 to 255).
2178 • Lock scroll to playback: While playing back or rewinding 
2179   movies, the display will follow if enabled.
2181 10 Memory watch expression syntax
2183 Memory watch expressions are in RPN (Reverse Polish Notation). At 
2184 the end of expression, the top entry on stack is taken as the 
2185 final result.
2187 Notations:
2189 • Evaluation order is strictly left to right.
2191 • a is the entry on top of stack
2193 • b is the entry immediately below top of stack
2195 • ; separates values to be pushed (no intermediate pop).
2197 • After end of element, all used stack slots are popped and all 
2198   results are pushed.
2200 • When pushing multiple values, the pushes occur in order shown.
2202 The following operators are available:
2204 • + : a + b
2206 • - : a - b
2208 • * : a * b
2210 • / : a / b
2212 • % : a % b
2214 • a : atan(a)
2216 • b : read_signed_byte(a)
2218 • c : cos(a)
2220 • d : read_signed_dword(a)
2222 • i : quotent(a / b)
2224 • p :\pi
2227 • q : read_signed_qword(a)
2229 • r : sqrt(a)
2231 • s : sin(a)
2233 • t : tan(a)
2235 • u : a; a
2237 • w : read_signed_word(a)
2239 • A : atan2(a, b)
2241 • B : read_unsigned_byte(a)
2243 • C<number>z : Push number <number> to stack.
2245 • D : read_unsigned_dword(a)
2247 • C0x<number>z : Push number <number> (hexadecimal) to stack.
2249 • H<digit> : Set hexadecimal mode with specified number of digits 
2250   (use A-G for 10-16 digits).
2252 • Q : read_unsigned_qword(a)
2254 • R<digit> : round a to <digit> digits.
2256 • W : read_unsigned_word(a)
2258 10.1 Example:
2260 C0x007e0878zWC0x007e002czW-
2262 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
2264 2. Pop the value on top of stack (0x7e0878), read word value at 
2265   that address and push the result,call it x1 (W).
2267 3. Push value 0x7e002c on top of stack (C0x007e002cz).
2269 4. Pop the value on top of stack (0x7e002c), read word value at 
2270   that address and push the result,call it x2 (W).
2272 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
2273   x2 and push x2 - x1 (-).
2275 6. Since the expression ends, the final memory watch result is 
2276   the top one on stack, which is x2 - x1.
2278 11 Modifier and key names:
2280 11.1 SDL Platform
2282 11.1.1 Modifier names
2284 Following modifier names are known:
2286 • ctrl, lctrl, rctrl: Control keys
2288 • alt, lalt, ralt: ALT keys.
2290 • shift, lshift, rshift: Shift keys.
2292 • meta, lmeta, rmeta: Meta keys.
2294 • num, caps: Numlock/Capslock (these are sticky!)
2296 • mode: Mode select.
2298 11.1.2 Key names
2300 Following key names are known:
2302 • backspace, tab, clear, return, pause, escape, space, exclaim, 
2303   quotedbl, hash, dollar, ampersand, quote, leftparen, 
2304   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
2305   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
2306   greater, question, at, leftbracket, backslash, rightbracket, 
2307   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
2308   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
2309   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
2310   world_8, world_9, world_10, world_11, world_12, world_13, 
2311   world_14, world_15, world_16, world_17, world_18, world_19, 
2312   world_20, world_21, world_22, world_23, world_24, world_25, 
2313   world_26, world_27, world_28, world_29, world_30, world_31, 
2314   world_32, world_33, world_34, world_35, world_36, world_37, 
2315   world_38, world_39, world_40, world_41, world_42, world_43, 
2316   world_44, world_45, world_46, world_47, world_48, world_49, 
2317   world_50, world_51, world_52, world_53, world_54, world_55, 
2318   world_56, world_57, world_58, world_59, world_60, world_61, 
2319   world_62, world_63, world_64, world_65, world_66, world_67, 
2320   world_68, world_69, world_70, world_71, world_72, world_73, 
2321   world_74, world_75, world_76, world_77, world_78, world_79, 
2322   world_80, world_81, world_82, world_83, world_84, world_85, 
2323   world_86, world_87, world_88, world_89, world_90, world_91, 
2324   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
2325   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
2326   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
2327   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
2328   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
2329   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
2330   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
2331   sysreq, break, menu, power, euro, undo
2333 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
2334   key having hardware-dependent scan code of <n> (useful to bind 
2335   those keys that don't have symbolic names).
2337 11.1.3 Joystick pseudo-keys:
2339 • joystick<num>button<button>: Joystick <num> (0-based) button 
2340   <button> (0-based).
2342 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
2343   (0-based) up.
2345 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
2346   (0-based) left.
2348 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
2349   (0-based) down.
2351 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
2352   (0-based) right.
2354 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
2355   negative position (axis modes axis and axis_inverse).
2357 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
2358   positive position (axis modes axis and axis_inverse).
2360 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
2361   pressure (axis modes pressure_*).
2363 11.1.4 Special buttons:
2365 • Escape: Enter/Exit Command mode, cancel modal dialogs.
2367 • Return (also KPEnter): Execute command, ok modal dialog.
2369 • Pgup/Up (also KP8/9 if no num lock, CTRL+P; command mode): 
2370   Previous command in command history
2372 • Pgdn/Down(also KP2/3 if no num lock, CTRL+N; command mode): 
2373   Next command in command history
2375 • Home (also KP7 if no num lock, CTRL+A; command mode): Beginning 
2376   of command.
2378 • End (also KP1 if no num lock, CTRL+E; command mode): End of 
2379   command.
2381 • Left (also KP4 if no num lock, CTRL+B; command mode): Move 
2382   cursor left.
2384 • Right (also KP6 if no num lock, CTRL+F; command mode): Move 
2385   cursor right.
2387 • Delete (also KP. if no num lock; command mode): Delete 
2388   character to right of cursor.
2390 • Insert (also KP0 if no num lock; command mode): Toggle between 
2391   insert / overwrite modes.
2393 • Backspace (command mode): Delete character to left of cursor.
2395 • CTRL+LEFT (also ALT+B; command mode): Previous word.
2397 • CTRL+RIGHT (also ALT+F; command mode): Next word.
2399 • ALT+D (also CTRL+W; command mode): Delete word.
2401 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
2402   corrupted!).
2404 11.2 wxWidgets platform
2406 11.2.1 Modifier names:
2408 Following modifier names are known:
2410 • alt
2412 • ctrl
2414 • shift 
2416 • meta
2418 • cmd (Mac OS X only)
2420 11.2.2 Key names:
2422 Following key names are known:
2424 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
2425   dollar, percent, ampersand, quote, leftparen, rightparen, 
2426   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
2427   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
2428   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
2429   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
2430   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
2431   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
2432   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
2433   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
2434   home, lefT, up, right, down, select, print, execute, snapshot, 
2435   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
2436   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
2437   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
2438   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
2439   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
2440   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
2441   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
2442   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
2443   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
2444   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
2445   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
2446   windows_right, windows_menu, command, special1, special2, 
2447   special3, special4, special5, special6, special7, special8, 
2448   special9, special10, special11, special12, special13, 
2449   special14, special15, special16, special17, special18, 
2450   special19, special20
2452 12 Movie file format
2454 Movie file is .zip archive in itself, normal ZIP archive tools 
2455 work on it (note: If you recompress it, do not use compression 
2456 methods other than store and deflate and especially do not use 
2457 encryption of any kind).
2459 12.1 Detecting clean start/SRAM/Savestate
2461 • If file has member “savestate” it is savestate, otherwise:
2463 • If file has members with names starting “moviesram.” it is 
2464   movie starting from SRAM, otherwise:
2466 • It is movie starting from clear state.
2468 12.2 Member: gametype
2470 Type of game ROM and region (as one line). Valid values are:
2473 +--------------+---------------------+--------+
2474 |    Value     |       System        | Region |
2475 +--------------+---------------------+--------+
2476 +--------------+---------------------+--------+
2477 |  snes_pal    |     Super NES       |  PAL   |
2478 +--------------+---------------------+--------+
2479 |   sgb_pal    |   Super Game Boy    |  PAL   |
2480 +--------------+---------------------+--------+
2481 |  snes_ntsc   |     Super NES       |  NTSC  |
2482 +--------------+---------------------+--------+
2483 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
2484 +--------------+---------------------+--------+
2485 |     bsx      | BS-X (non-slotted)  |  NTSC  |
2486 +--------------+---------------------+--------+
2487 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
2488 +--------------+---------------------+--------+
2489 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
2490 +--------------+---------------------+--------+
2493 Frame rates are:
2496 +---------+-----------------+
2497 | Region  | Framerate (fps) |
2498 +---------+-----------------+
2499 +---------+-----------------+
2500 |  PAL    |   322445/6448   |
2501 +---------+-----------------+
2502 |  NTSC   | 10738636/178683 |
2503 +---------+-----------------+
2506 12.3 Member: port1
2508 Contains type of port #1 (as one line). Valid values are 'none', 
2509 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
2510 'gamepad'.
2512 12.4 Member: port2
2514 Contains type of port #2 (as one line). Valid values are 'none', 
2515 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
2516 'justifiers'. If not present, defaults to 'none'.
2518 12.5 Member: gamename
2520 Contains name of the game (as one line).
2522 12.6 Member: authors
2524 Contains authors, one per line. Part before '|' is the full name, 
2525 part after is the nickname.
2527 12.7 Member: systemid
2529 Always “lsnes-rr1” (one line). Used to reject other saves.
2531 12.8 Member: controlsversion
2533 Always “0” (one line). Used to identify what controls are there.
2535 12.9 Member: “coreversion”
2537 Contains bsnes core version number (as one line).
2539 12.10 Member: projectid
2541 Contains project ID (as one line). Used to identify if two movies 
2542 are part of the same project.
2544 12.11 Member: {rom,slota,slotb}{,xml}.sha256
2546 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2547 Absent if corresponding file is absent.
2549 12.12 Member: moviesram.<name>
2551 Raw binary startup SRAM of kind <name>. Only present in 
2552 savestates and movies starting from SRAM.
2554 12.13 Member: saveframe
2556 Contains frame number (as one line) of frame movie was saved on. 
2557 Only present in savestates.
2559 12.14 Member: lagcounter
2561 Current value of lag counter (as one line). Only present in 
2562 savestates.
2564 12.15 Member: pollcounters
2566 Contains poll counters (currently 100 of them), one per line. 
2567 Each line is raw poll count if DRDY is set for it. Otherwise it 
2568 is negative poll count minus one. Only present in savestates.
2570 12.16 Member: hostmemory
2572 Raw binary dump of host memory. Only present in savestates.
2574 12.17 Member: savestate
2576 The raw binary savestate itself. Savestate detection uses this 
2577 file, only present in savestates.
2579 12.18 Member: screenshot
2581 Screenshot of current frame. Only present in savestates. First 2 
2582 bytes are big-endian width of image, rest are 24-bit RGB image 
2583 data. Height of image is inferred from the width and size of 
2584 data.
2586 12.19 Member: sram.<name>
2588 Raw binary SRAM of kind <name> at time of savestate. Only present 
2589 in savestates.
2591 12.20 Member: input
2593 The actual input track, one line per subframe (blank lines are 
2594 skipped).
2596 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2597   the line is part of same frame as previous, otherwise it starts 
2598   a new frame.
2600 • First subframe must start a new frame.
2602 Length of movie in frames is number of lines in input file that 
2603 start a new frame.
2605 12.21 Member: subtitles
2607 Subtitle track. Optional.
2609 • Each line is in form <firstframe> <numframes> <text>.
2611 • Linefeed is encoded as \n, backslash is encoded as \\.
2613 12.22 Member: rerecords
2615 Contains textual base-10 rerecord count (as one line; emulator 
2616 just writes this, it doesn't read it) + 1.
2618 12.23 Member: rrdata
2620 This member stores set of load IDs. There is one load ID per 
2621 rerecord (plus one corresponding to start of project).
2623 • This member constists of concatenation of records
2625 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2626   consequtive IDs.
2628 • IDs are interpretted as 256-bit big-endian integers with 
2629   warparound.
2631 • Initial predicted ID is all zeroes.
2633 Format of each record is:
2635 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2636   bits 5-6 are count length (countlen). Bit 7 is unused.
2638 • 32-prefixlen bytes of ID.
2640 • countlen bytes of big-endian count (count).
2642 Records are processed as follows:
2644 • To form the first ID encoded by record, take the first 
2645   prefixlen bytes predicted ID and append the read ID value to 
2646   it. The result is the first ID encoded.
2648 • If countlen is 0, record encodes 1 ID.
2650 • If countlen is 1, record encodes 2+count IDs.
2652 • If countlen is 2, record encodes 258+count IDs.
2654 • If countlen is 3, record encodes 65794+count IDs.
2656 • The new predicted ID is the next ID after last one encoded by 
2657   the record.
2659 The number of rerecords + 1 is equal to the sum of number of IDs 
2660 encoded by all records.
2662 12.24 Member: starttime.second
2664 Movie starting time, second part. Epoch is Unix epoch. Default is 
2665 1,000,000,000.
2667 12.25 Member: starttime.subsecond
2669 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2670 is 0.
2672 12.26 Member: savetime.second
2674 Movie saving time, second part. Default is starttime.second. Only 
2675 present in savestates.
2677 12.27 Member: savetime.subsecond
2679 Movie saving time, subsecond part. Default is 
2680 starttime.subsecond. Only present in savestates.
2682 13 lsvs file format (commentary tracks)
2684 13.1 Clusters
2686 • Each cluster is 8kB (8192 bytes) in size.
2688 • Cluster n starts at offset 8192*n in file.
2690 • The following clusters are system special:
2692   – Cluster 0 and all clusters with number multiple of 2048 
2693     (cluster tables)
2695   – Cluster 1 (superblock)
2697 13.2 Cluster tables
2699 • The cluster table describing cluster n is stored in cluster n & 
2700   ~0x7FF (zero last 11 bits of n).
2702 • This cluster table consists of 2048 4-byte big-endian integers.
2704 • Each entry describes a cluster in 16MB supercluster, in order.
2706 • The valid values for entries are:
2708   – 0x00000000: Free cluster
2710   – 0x00000001: Last cluster in chain.
2712   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2714   – (anything else): Number of next cluster in chain. Must not be 
2715     multiple of 2048.
2717 • Due to limitations of the format, there can be at most 2097052 
2718   superclusters, giving maximum file size of 16TB.
2720 13.3 Stream table
2722 • The stream table chain always starts in cluster 2.
2724 • Otherwise, it follows normal chaining.
2726 • The stream table consists of 16-byte entries:
2728   – The first 8 bytes of entry give big-endian beginning position 
2729     of stream in units of 1/48000 s.
2731   – The next 4 bytes of entry give big-endian beginning cluster 
2732     for control data. 0 here marks the entry as not present.
2734   – The last 4 bytes of entry give big-endian beginning cluster 
2735     for codec data.
2737 • Stream table clusters are normal clusters, following normal 
2738   chaining.
2740 • The stream begnning position is not guarenteed unique. There 
2741   can be multiple streams with the same starting position in the 
2742   file.
2744 13.4 Stream control data
2746 • The stream control data consists of entries 4 bytes each:
2748   – The first 2 bytes of entry gives big-endian length of packet
2750   – The next byte of entry gives audio length of packet in units 
2751     of 1/400 s.
2753   – The last byte is control byte.
2755     ∗ 0 means this entry is not present and the control data 
2756       ends.
2758     ∗ 1 is valid control entry.
2760 • The stream control data can also end by running into end of the 
2761   readable chain.
2763   – This happens if there happens to be exact multiple of 2048 
2764     packets in stream and number of packets is nonzero.
2766 • These clusters follow normal chaining.
2768 13.5 Stream codec data
2770 • Stream codec data consists of raw Opus data packets packed back 
2771   to back with nothing in between.
2773 • Warning: Due to internal limitations, this data must reside in 
2774   the first 65536 superclusters (that is, the first 1TB of the 
2775   file).
2777 13.6 Superblock
2779 • The superblock is stored in cluster 1. 
2781 • The first 11 bytes are “sefs-magic”<NUL>.
2783 • The rest are unused.
2785 • This cluster 1 is marked as system special.
2787 14 Known ROM extensions
2789 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2790   dx2, mgd, mgh.
2792 • DMG cartridge ROMs: dmg, gb.
2794 • GBC cartridge ROMs: cgb, gbc.
2796 15 Gamepack files
2798 • The first line must be: “[GAMEPACK FILE]”.
2800 • There is one needed line: “type <systype>”. This sets system 
2801   type to <systype>. The following system types are valid:
2803   – snes (SNES)
2805   – bsx (BS-X non-slotted)
2807   – bsxslotted (BS-X slotted)
2809   – sufamiturbo (Sufami Turbo)
2811   – sgb (Super Game Boy)
2813   – dmg (Game Boy)
2815   – gbc (Game Boy Color)
2817   – gbc_gba (Game Boy Color with GBA initial register values)
2819 • Optionally a region can be specified: “region <region>”. The 
2820   following values are valid:
2822   – autodetect (Autodetect region: snes and sgb only)
2824   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2826   – pal (PAL: snes, sgb)
2828   – world (World: dmg, gbc, gbc_gba)
2830 • ROM images are loaded as: “rom <type> <file>”. The following 
2831   types are valid:
2833   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2834     bsxslotted, sufamiturbo)
2836   – bsx (Cartridge ROM in bsx, bsxslotted)
2838   – slot-a (Cartridge ROM in sufamiturbo)
2840   – slot-b (Cartridge ROM in sufamiturbo)
2842 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2843   valid are the same as for ROMs.
2845 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2846   types are the same as for ROMs.
2848   – Offset is given in form [+-]<number>. Usually offset is 
2849     either +0 or -512.
2851   – Default offset is +0.
2853 15.1 Example:
2855 [GAMEPACK FILE]
2857 type snes
2859 rom rom speedygonzales.sfc
2861 patch-512 rom sonicthehedgehog.ips
2863 15.2 Example 2:
2865 [GAMEPACK FILE]
2867 type sgb
2869 rom rom supergameboy.sfc
2871 rom dmg megamanV.dmg
2873 16 Quick'n'dirty encode guide
2875 1. Start the emulator and load the ROM and movie file.
2877 2. Set large AVI option 'set-setting avi-large on'
2879 3. Enable dumping 'dump-avi tmpdump' 
2881 4. Unpause and let it run until you want to end dumping.
2883 5. Close the emulator (closing the window is the easiest way). Or 
2884   use 'end-avi'.
2886 6. For each tmpdump*.avi file created, on command prompt, do 
2887   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2889 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2891 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2892   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2893   tmpdump_<numbers>.mkv, with + in between).
2895 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2896   final.mkv contains quick'n'dirty encode.
2898 17 Axis configurations for some gamepad types:
2900 17.1 XBox360 controller:
2902 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2903 set to pressure-+.
2905 set-axis joystick0axis2 pressure-+
2907 set-axis joystick0axis5 pressure-+
2909 • This is needed for SDL only. EVDEV sets those types correctly.
2911 17.2 PS3 “sixaxis” controller:
2913 Axes 8-19 should be disabled.
2915 set-axis joystick0axis8 disabled
2917 set-axis joystick0axis9 disabled
2919 set-axis joystick0axis10 disabled
2921 set-axis joystick0axis11 disabled
2923 set-axis joystick0axis12 disabled
2925 set-axis joystick0axis13 disabled
2927 set-axis joystick0axis14 disabled
2929 set-axis joystick0axis15 disabled
2931 set-axis joystick0axis16 disabled
2933 set-axis joystick0axis17 disabled
2935 set-axis joystick0axis18 disabled
2937 set-axis joystick0axis19 disabled
2939 18 Errata:
2941 18.1 Problems from BSNES core:
2943 • The whole pending save stuff.
2945 • Lack of layer hiding.
2947 • It is slow (especially accuracy).
2949 • Firmwares can't be loaded from ZIP archives.
2951 18.2 Other problems:
2953 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2955 • Audio for last dumped frame is not itself dumped.
2957 • Audio in UI is pretty bad in quality if game doesn't run at 
2958   full speed.
2960 • No menus, command based interface (SDL).
2962 • Long commands don't scroll.
2964 19 Changelog:
2966 19.1 rr0-beta1
2968 • Fix -Wall warnings
2970 • Fix dumper video corruption with levels 10-18.
2972 19.2 rr0-beta2
2974 • Autofire
2976 • Lots of code cleanups
2978 • Lua interface to settings
2980 • Allow specifying AVI borders without Lua
2982 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2984 • on_snoop lua callback
2986 • Faster movie loading and saving.
2988 19.3 rr0-beta3
2990 • Joystick support
2992 19.4 rr0-beta4
2994 • Fix multi-buttons
2996 • Save jukebox functionality.
2998 19.5 rr0-beta5
3000 • Try to fix some nasty failing movie load edge cases
3002 • Allow specifying scripts to run on command line.
3004 19.6 rr0-beta6
3006 • Major source code reorganization.
3008 • Backup savestates before overwriting.
3010 • Don't crash if loading initial state fails.
3012 19.7 rr0-beta7
3014 • Fix firmware lookup
3016 • Fix author name parsing
3018 • Fix rerecord counting
3020 • (SDL) Print messages to console if SDL is uninitialized
3022 • Add movieinfo program
3024 • Fix loading movies starting from SRAM.
3026 19.8 rr0-beta8
3028 • Add support for unattended dumping
3030 • Fix compiling for Win32
3032 • Don't lock up if sound can't be initialized
3034 • Strip trailing CR from commands
3036 • Don't try to do dubious things in global ctors (fix crash on 
3037   startup)
3039 19.9 rr0-beta9
3041 • Small documentation tweaking
3043 • Fix make clean
3045 • Fix major bug in modifier matching
3047 19.10 rr0-beta10
3049 • Lots of documentation fixes
3051 • Use dedicated callbacks for event backcomm., not commands.
3053 • Ensure that the watchdog is not hit when executing delayed 
3054   reset.
3056 • Remove errant tab from joystick message.
3058 19.11 rr0-beta11
3060 • Make autofire operate in absolute time, not linear time
3062 • Reinitialize controls when resuming from loadstate
3064 • Some more code cleanups
3066 • If Lua allocator fails, call OOM_panic()
3068 • Byte/word/dword/qword sized host memory write/read functions.
3070 • Dump at correct framerate if dumping interlaced NTSC 
3071   (height=448).
3073 19.12 rr0-beta12
3075 • Actually include the complete source code
3077 • Keep track of RTC
3079 19.13 rr0-beta13
3081 • Document {save,start}time.{,sub}second.
3083 • Intercept time() from bsnes core.
3085 19.14 rr0-beta14
3087 • Allow disabling time() interception (allow build on Mac OS X)
3089 • Use SDLMain on Mac OS X (make SDL not crash)
3091 • Disable delayed resets (just plain too buggy for now).
3093 • Code cleanups
3095 • Use 16-bit for graphics/video instead of 32-bit.
3097 • gui.rectangle/gui.pixel
3099 • gui.crosshair
3101 • New CSCD writer implementation.
3103 19.15 rr0-beta15
3105 • Fix interaction of * and +.
3107 • Manual improvements
3109 • Use gettimeofday()/usleep(), these seem portable enough.
3111 • Move joystick axis manipulation to keymapper code.
3113 • Changes to how read-only works.
3115 • Refactor controller input code.
3117 19.16 rr0-beta16
3119 • Fix mouseclick scale compensation.
3121 • Draw area boundaries correctly in SDL code.
3123 • gui.screenshot.
3125 • Fix CSCD output (buffer overrun and race condition).
3127 19.17 rr0-beta17
3129 • JMD dumping support.
3131 • Allow unattended dumping to JMD.
3133 • Move to BSNES v083.
3135 • Switch back to 32-bit colors.
3137 • Add Lua function gui.color.
3139 • Use some new C++11 features in GCC 4.6.
3141 • Be prepared for core frequency changes.
3143 • Pass colors in one chunk from Lua.
3145 19.18 rr0-beta18
3147 • New lua functions gui.line(), gui.status() and gui.circle(), 
3148   memory.vma_count(), memory.read_vma() and memory.find_vma().
3150 • Numerious documentation fixups
3152 • RTC time format changed
3154 • Reformat flags display
3156 • Allow lua package name to be overridden
3158 • SDUMP (high-quality dumping).
3160 • Split platform support to plugins.
3162 • Make all sound plugins support basic sound commands
3164 • Support portaudio for sound.
3166 • Allow disable Lua/SDL searching.
3168 • Upconvert colors when copying lcscreen to screen.
3170 • Reorganize source tree.
3172 • Evdev joystick support.
3174 • Refactor more code into generic window code.
3176 19.19 rr0-beta19
3178 • Refactor message handling.
3180 • Rework makefile
3182 • Documentation fixes
3184 • Finish pending saves before load/quit.
3186 • Wxwidgets graphics plugin.
3188 19.20 rr0-beta20
3190 • Get rid of win32-crap.[ch]pp.
3192 • Move files around a lot.
3194 • Get rid of need for host C++ compiler.
3196 • Bsnes v084 core.
3198 • Refactor inter-component communication.
3200 • Fix zero luma.
3202 • Fix crash on multiline aliases.
3204 • Load/Save settings in wxwidgets gui.
3206 19.21 rr0-beta21
3208 • Patch problems in bsnes core
3210 • SNES is little-endian, not big-endian!
3212 • Fix memory corruption in lcscreen::load()
3214 19.22 rr0-beta22
3216 • Fix interpretting repeat counts in rrdata loading.
3218 • New lua callback: on_frame()
3220 • Remove calls to runtosave() that aren't supposed to be there
3222 • Lua function: movie.read_rtc()
3224 • Ignore src/fonts/font.cpp
3226 • Fix more bsnes core problems
3228 • Control bsnes random seeding
3230 • Pause-on-end
3232 • Some bsnes core debugging features (state dump and state hash)
3234 • Fix titlebar version number (no, the last version wasn't 
3235   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
3237 19.23 rr0-beta23
3239 • Fix memory corruption due to macro/field mixup
3241 • search-memory update
3243 • Allow direct-mapped framebuffer
3245 • SDL: Use SDL_ANYFORMAT if possible
3247 • SDMP2SOX: 2s delay modes.
3249 • Wxwidgets: Cleanups
3251 • Use sed -E, not sed -r. Fixes building on Mac OS X.
3253 • Wxwidgets: Save jukebox on exit
3255 • Fix RTC if using load-movie on savestate.
3257 • Fix crash related to full console mode.
3259 19.24 rr0-beta24
3261 • Wxwidgets: Allow bringing application to foreground on Mac OS 
3262   X.
3264 • Wxwidgets: Allow compiling on Mac OS X.
3266 • Use movie compare instead of movie hashing (faster save/load).
3268 • Lua: _SYSTEM table.
3270 19.25 rr0-beta25
3272 • sdmp2sox: Pad soundtrack if using -l or -L.
3274 • sdmp2sox: Fix NTSC overscan.
3276 • sdmp2sox: Add AR correction mode.
3278 • call lua_close() when exiting.
3280 • Fix zip_writer bug causing warnings from info-zip and error 
3281   from advzip.
3283 19.26 rr0-beta26
3285 • Fix IPS patching code (use bsnes core IPS patcher).
3287 • Implement BPS patching (using bsnes core IPS patcher).
3289 • Add feature to load headered ROMs.
3291 19.27 rr0-beta27
3293 • Show command names when showing keybindings
3295 19.28 rr0
3297 • Fix pause-on-end to be actually controllable
3299 • SDL: Poll all events in queue, not just first one (fixes 
3300   slowness in command typing)
3302 • Wxwidgets: Fix ROM loading.
3304 19.29 rr1-beta0
3306 • Lua: Add gui.textH, gui.textV, gui.textHV
3308 • Fix text colors on SDL on Mac OS X
3310 • Mode 'F' for finished in readonly mode.
3312 • Fix some WS errors.
3314 • Reliably pause after skip poll
3316 • Split UI and core into their own threads
3318 19.30 rr1-beta1
3320 • Remove leftover dummy SRAM slot
3322 • Fix controller numbers.
3324 19.31 rr1-beta2
3326 • Fix lsnes-dumpavi after interface change.
3328 • Also give BSNES patches for v085.
3330 • Pack movie data in memory.
3332 19.32 rr1-beta3
3334 • Fix framecount/length given when loading movies.
3336 • Controller command memory leak fixes.
3338 • Don't leak palette if freeing screen object.
3340 19.33 rr1-beta4
3342 • Detect revisions.
3344 • Wxwidgets: Allow controlling dumper from the menu.
3346 19.34 rr1-beta5
3348 • Rewrite parts of manual
3350 • Lua: Make it work with Lua 5.2.
3352 19.35 rr1-beta6
3354 • Win32: Fix compile errors.
3356 19.36 rr1-beta7
3358 • Refactor controller input code.
3360 • Fix crash when using command line on SDL / Mac OS X.
3362 19.37 rr1-beta8
3364 • Delete core/coroutine (obsolete)
3366 • Lag input display by one frame.
3368 • Rewind movie to beginning function.
3370 • Fix wrong frame number reported to Lua when repainting after 
3371   loadstate
3373 • Support UI editing of jukebox
3375 • Wxwidgets: Save settings on exit.
3377 • Support ${project} for filenames
3379 • SDL: Fix command history
3381 19.38 rr1-beta9
3383 • Fix some order-of-global-ctor bugs.
3385 19.39 rr1-beta10
3387 • Fix crashes when quitting on Win32.
3389 19.40 rr1-beta11
3391 • EVDEV: Queue keypresses from joystick, don't send directly
3393 • Wxwidgets: Load-Preserve that actually works.
3395 19.41 rr1-beta12
3397 • Wxwidgets: GUI for memory search.
3399 • Warn about using synchronous queue in UI callback.
3401 19.42 rr1-beta13
3403 • Remember last saved file for each ROM
3405 • Support MT dumping via boost.
3407 • Lua: input.raw
3409 • Lua: input.keyhook
3411 • Make mouse be ordinary input instead of special-casing
3413 • SDL: Don't screw up commands with NUL codepoints.
3415 19.43 rr1-beta14
3417 • Merge status panel and main window
3419 • True movie slot support (the rest of it)
3421 • SDL: Fix compilation error
3423 • Elminate cross calls in dump menu code.
3425 19.44 rr1-beta15
3427 • Cancel pending saves command
3429 • Wxwidgets: Code refactoring
3431 • Wxwidgets: Fix system -> reset
3433 • Wxwidgets: Read watch expressions in the right thread
3435 19.45 rr1-beta16
3437 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
3438   doesn't support that).
3440 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
3441   needed).
3443 • Don't append trailing '-' to prefix when saving movie.
3445 • Fix ROM/savestate handling (don't let user mismatch ROM and 
3446   savestates).
3448 19.46 rr1
3450 • Document memory watch syntax.
3452 19.47 rr1-delta1
3454 • Fix unattended dumping (lsnes-dumpavi)
3456 • Support RAW dumping
3458 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
3459   (changes syntax)
3461 • Add option to control sample rate preturbation in AVI dumper
3463 19.48 rr1-delta2
3465 • Wxwidgets: Fix dumper submodes
3467 • Set core controller types before loadstate
3469 19.49 rr1-delta2epsilon1
3471 • Fix compiling with bsnes v086.
3473 19.50 rr1-delta3
3475 • Don't prompt before quitting
3477 • Start unpaused, preserve pause/unpause over load.
3479 • Try to autodetect if ROM is headered.
3481 • Wxwidgets: Only bring up ROM patching screen if specifically 
3482   requested.
3484 • Allow configuring some hotkeys.
3486 19.51 rr1-delta4
3488 • Lots of code cleanups
3490 • Fix JMD compression (JMD dumping was broken)
3492 • Don't crash if Lua C function throws an exception.
3494 • Support bitmap drawing in Lua.
3496 • Fix bsnes v085/v086 patches.
3498 • Improve stability on win32.
3500 19.52 rr1-delta4epsilon1
3502 • Don't corrupt movie if movie length is integer multiple of 
3503   frames per page.
3505 19.53 rr1-delta5
3507 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
3509 • New Lua functions: emulator_ready(), utime(), 
3510   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
3511   bit.value(), input.geta(), input.seta() and 
3512   input.controllertype()
3514 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
3516 • Wxwidgets: Fix broken modifiers
3518 • on_paint has parameter now.
3520 • Optional initital fill for bitmaps
3522 • Fix palette changing.
3524 • Optimize rendering a bit.
3526 • Bsnes v087 support.
3528 19.54 rr1-delta5epsilon1
3530 • Movieinfo: Fix display of port #2 type.
3532 • Call on_input() after loadstate.
3534 19.55 rr1-delta5epsilon2
3536 • Fix writing port2 data to movie.
3538 • Fix SRAM handling with Bsnes v087.
3540 19.56 rr1-delta6
3542 • Library loading support
3544 • Built-in TSCC encoder
3546 • Hi-color (256T colors) dumping.
3548 • Dump over TCP/IP(v6)
3550 • Hidable status panel
3552 • Turbo toggle/hold
3554 • Adjustable sound volume
3556 • Screen scaling
3558 • Allow DnD into filename boxes
3560 • Configurable paths
3562 • Portaudio: Fix speaker popping at start
3564 • Lots of UI changes
3566 • Speed adjustment menu
3568 • Win32 joystick support
3570 • Lua: gui.rainbow and gui.box
3572 • Split key lists into classes (the key list was large!)
3574 • More save slots support
3576 • Wxwidgets (wxJoystick) joystick support
3578 19.57 rr1-delta7
3580 • Lots of internal joystick refactoring
3582 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3584 • Wxwidgets: Settings mode (open settings without ROM)
3586 • Wxwidgets: Prompt key to use option
3588 • Wxwidgets: Fix crash if key goes away underneath
3590 • Wxwidgets: Fix mouse position in presence of scaling
3592 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3593   using SRC)
3595 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3596   control doesn't seem to work well on WinXP)
3598 • Start paused option.
3600 19.58 rr1-delta7epsilon1
3602 • AVI: ZMBV support
3604 • lsnes-dumpavi: Start Lua before starting dumper
3606 • AVI: Fix secondary audio in mode 4.
3608 19.59 rr1-delta7epsilon2
3610 • AVI: Refactor ZMBV a bit.
3612 • Fix error reading analog values from movie file
3614 19.60 rr1-delta8
3616 • Delayed reset support
3618 • Lua: memory.hash_region
3620 19.61 rr1-delta8epsilon1
3622 • Rework the build system
3624 • Typing input support
3626 • Fix building with bsnes v086 and v087.
3628 • SDL: Save settings on exit
3630 • SDL: Command to enter command line mode with given command.
3632 • SDL: More advanced command editing.
3634 19.62 rr1-delta9
3636 • wxMSW: Fix the “arrow keys and enter don't work” problem
3638 • MSU-1 support
3640 • Show mode changes due to rewinding.
3642 • Unsafe rewind support
3644 • Fix directory transversal.
3646 19.63 rr1-delta10
3648 • AVI: Sound mode 5 (48kHz high-quality)
3650 • Lua: Reset Lua VM
3652 • Map the SNES bus into address space
3654 • Fix loading memory watch files with CRLF line endings
3656 19.64 rr1-delta10epsilon1
3658 • Map bsnes internal state into memory space
3660 • Fix the “click on panel wedges the emulator” for real.
3662 • DnD movies/saves on the main window.
3664 19.65 rr1-delta11
3666 • Split core bindings into own module.
3668 • Remember invalid settings
3670 • Support for modified Gambatte core for GB/GBC emulation.
3672 • Reload/swap ROM function
3674 19.66 rr1-delta11epsilon1
3676 • Fix step poll function
3678 19.67 rr1-delta12
3680 • Non-insane savestate anchoring
3682 19.68 rr1-delta13
3684 • More Memory search methods
3686 • Preserve movie if loading in RO mode.
3688 • Fix a obscure case in timeline check
3690 • Revamp the entiere ROM loading code
3692 • Support DnD on ROMs
3694 • Revamp menu layout
3696 • Standalone hotkey config dialog
3698 • Show bindings in more user-friendly format
3700 19.69 rr1-delta13epsilon1
3702 • Pipedec support
3704 • Fix uninitialized variables in bsnes v085
3706 19.70 rr1-delta14
3708 • Merge gambatte core into mainline (from its own branch)
3710 • Wxwidgets: Show expected dump file formats
3712 • Memory watch: Data typing
3714 • lsnes internal MMIO area.
3716 • Wxwidgets: New memory watch editor
3718 • Hexadecimal memory watches
3720 • Wxwidgets: Monospaced panel
3722 • Wxwidgets: Split memory watches in panel
3724 • Wxwidgets: Disable VMAs in memory search
3726 • lsnes-dumpavi: Fix speed bug
3728 • Movie subtitle support
3730 • Fix rerecord count reporting
3732 • Don't trash movie when loading in readonly mode.
3734 19.71 rr1-delta14epsilon1
3736 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3738 • Fix build on Mac OS X.
3740 • Lua: loopwrapper
3742 • Wxwidgets: Hidable messages window
3744 • Lua: input.joyset
3746 • Bsnes: Support inconsistent saves
3748 • Bsnes: Allow simulating saving every frame
3750 • Fix desync if savestate is loaded in readonly mode in certain 
3751   conditions.
3753 • Wxwidgets: Fix save dialogs on Mac OS X.
3755 • Wxwidgets: Fix insane status width on Win32.
3757 • Wxwidgets: Fix autohold processing to be faster.
3759 • Wxwidgets: Allow loading ROMs and movies from commandline.
3761 19.72 rr1-delta15
3763 • Be a bit smarter with --load
3765 • Rewrote higher-level parts of audio system
3767 • Tool to build commentary tracks
3769 • Lua: input.joyget
3771 • Gambatte: Add support for SVN358
3773 • Use builtin font when rendering status panel.
3775 • Option to detach memory watch to its own window.
3777 • Recent ROMs/Movies menu
3779 • Libao support
3781 • Useful lag counter for SNES games that autopoll
3783 • Fix buffer overflow in gambatte sound output
3785 19.73 rr1-delta15epsilon1
3787 • Don't blow up on wxGTK if the window is hidden somehow
3789 • Support simultaneous drop of ROM and movie.
3791 • Gambatte: Don't save spurious SRAMs.
3793 • Make SGB ROMs actually usable.
3795 • Fix so that saved movies appear in recent movies.
3797 • Don't open multiple commentary editors at once.
3799 19.74 rr1-delta15epsilon2
3801 • Lua: memory.readregion/memory.writeregion
3803 • Lua: memory.map{,s}{byte,word,dword,qword}
3805 • Lua: memory.map_structure
3807 • Lua: Fix bus_address for gambatte
3809 • Fix features dependent of bsnes debugger
3811 • Cleanup bsnes debugger logic
3813 • Fix resets in presence of save every frame
3815 19.75 rr1-delta15epsilon3
3817 • Lua: input.lcid_to_pcid
3819 • Fix off-by-one bug with slot hashes
3821 • Fix crashes on certain memory watch expressions
3823 • Lua: memory.read_expr
3825 • Lua: Fix memory.read_expr on nil argument
3827 • Fix the code to compile on G++ 4.7
3829 • Change button_id to be a function pointer field, not a virtual 
3830   method
3832 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3834 • Gambatte: Always use legacy lag counting
3836 • Memory commands: Memory addresses are up to 16 hex digits, not 
3837   up to 8
3839 • Fix analog controllers
3841 • Fix autohold menus
3843 • Fix button symbols in input display
3845 • Compensate for nuts bsnes superscope/justifier handling
3847 • Lua: Fix bit.extract boolean handling
3849 19.76 rr1-delta16
3851 • Stop at movie end: Don't off-by-one
3853 • Fix crash closing lsnes with voice playback active.
3855 • Import/Export OggOpus for commentary tracks
3857 • 16-button controllers.
3859 • Don't show nonexistent controllers in input display
3861 • Set voice record/playback volume from UI
3863 • Patches for gambatte SVN364.
3865 • Load markup (if exists) even without gamepack file.
3867 • Screen rotation & flipping
3869 • Lua: Some new bit functions
3871 • Auto-refresh voice streams on change.
3873 • Auto-refresh subtitles on change & new subtitle editor.
3875 • Fix music volume adjustment.
3877 19.77 rr1-delta16epsilon1
3879 • Wxwidgets: Fix memory watch rendering.
3881 • Wxwidgets: Allow setting voice stream gain.
3883 • Wxwidgets: VU meters and volume adjustment.
3885 • Lua: Custom fonts support.
3887 • Lua: Fix methods stopping working when resetting Lua.
3889 • Fix loading standard-format movies in preserve (readonly) mode.
3891 19.78 rr1-delta17
3893 • Primitive movie editor
3895 • Fix VU meter with no sound device.
3897 • Fix various undefined return values.
3899 • Show rates in VU meter window.
3901 19.79 rr1-delta17epsilon1
3903 • Commentary tool: Set nominal bit rate and limit max bit rate.
3905 • Lua: Unconditionally reload host memory on loadstate
3907 • Lua: Query bindings, manipulate aliases, create inverse 
3908   bindings
3910 • Lua: Fix crashes with resetting VM while some types of paint 
3911   requests are in flight.
3913 • Lua: gui.text: Clip the text properly instead of corrupting 
3914   memory in some cases.
3916 • Save screenshot header reliably
3918 • Lua: Backport input.get2 and input.set2
3920 • Lua: New controller info functions.
3922 • Movie editor: Fix reset delay counters to be the right way 
3923   around.
3925 • Lua: on_snoop2
3927 • Lua: on_button and input.veto_button.
3929 19.80 rr1-delta17epsilon2
3931 • Fix saving PNG screenshots on Win32.
3933 • Movie editor: Sweep axis.
3935 • Load selected slot in ro/rw/preserve/movie mode.
3937 • input.joyset: Preserve and invert user input.
3939 • Allow immediate saving at point of save (transfer saves).
3941 • Wxwidgets: Filter filenames in dialogs, autoappend extensions.
3943 • data/verysmall.font: Add missing glyph 70 (“F”).
3945 • Lua: Allow painting custom fonts with halo.
3947 • Fix memory value search to work on byte types.
3949 19.81 rr1-delta17epsilon3
3951 • Fix status panel (and movie editor) flicker
3953 • Show effects of Lua in input display
3955 • Offer lsmv.backup as file filter too for load lsmv
3957 • Allow slowing down subframe advance 
3959 • Display current save slot information
3961 • Add snes9x fonts
3963 • Fix hotkeys stopping working after X-ing settings dialog
3965 • Movie editor: Fix bug if extending finished movie
3967 • Cap current_frame_first_subframe to movie size when recounting 
3968   movie
3970 • Movie editor: Interpret ctrl+click as right click