Remove obsolete SDL stuff
[lsnes.git] / manual.txt
blobf402fd16064aa56009016f1645c6b651196900d8
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
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).
43   • Version 5.1.X or 5.2X.
45 14. G++ 4.6 (bsnes doesn't seem to like 4.7, status for gambatte 
46   is unknown).
48 3 Building
50 • Copy bsnes sources (the bsnes subdirectory) to subdirectory 
51   'bsnes' (for bsnes core).
53 • Copy gambatte sources to subdirectory 'gambatte' (for gambatte 
54   core).
56 • Patch the bsnes sources with included patches (directory 
57   'bsnes-patches/<version>', bsnes core)
59 • Patch the gambatte sources with included patches (directory 
60   'gambatte-patches/<version>', gambatte core)
62 • Edit options.build (or copy of that file)
64 • Run make (passing 'OPTIONS=<filename>' if using something else 
65   than options.build).
67 4 Command line options
69 4.1 ROM options
71 4.1.1 --rom=<file> (lsnes/SDL, lsnes/wxwidgets, lsnes-avidump)
73 Load <file> as ROM.
75 4.2 Session options
77 4.2.1 --pause
79 Start paused
81 4.2.2 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
83 Load <filename> as movie or savestate file. All other session 
84 options are ignored.
86 4.2.3 --port1=<device> (lsnes/SDL, bsnes core only)
88 Set type of port1. Valid values are:
90 • none: No device connected
92 • gamepad: One gamepad (the default)
94 • multitap: Four gamepads (warning: makes most games refuse to 
95   start)
97 • mouse: Mouse.
99 4.2.4 --port2=<type> (lsnes/SDL, bsnes core only)
101 Set type of port2. Valid values are:
103 • none: No device connected (the default)
105 • gamepad: One gamepad
107 • multitap: Four gamepads.
109 • mouse: Mouse
111 • superscope: Super Scope
113 • justifier: One justifier
115 • justifiers: Two justifiers
117 4.2.5 --gamename=<name> (lsnes/SDL)
119 Set the name of game to <name>. Default is blank.
121 4.2.6 --author=<name> (lsnes/SDL)
123 Add author with full name of <name> (no nickname).
125 4.2.7 --author=|<name> (lsnes/SDL)
127 Add author with nickname of <name> (no full name).
129 4.2.8 --author=<fullname>|<nickname> (lsnes/SDL)
131 Add author with full name of <fullname> and nickname of 
132 <nickname>.
134 4.2.9 --rtc-second=<value> (lsnes/SDL)
136 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is 
137 1,000,000,000.
139 4.2.10 --rtc-subsecond=<value> (lsnes/SDL)
141 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
143 4.2.11 --anchor-savestate=<file> (lsnes/SDL)
145 Set the anchor savestate file.
147 4.2.12 --load=<file> (lsnes/wxwidgets)
149 After loading the ROM, load <file> as savestate/movie.
151 4.3 Misc. options:
153 4.3.1 --run=<file> (lsnes/SDL)
155 After running main RC file, run this file. If multiple are 
156 specified, these execute in order specified.
158 4.4 dump options (lsnes-dumpavi only)
160 4.4.1 --dumper=<dumper>
162 Set the dumper to use (required). Use 'list' for listing of known 
163 dumpers.
165 4.4.2 --mode=<mode>
167 Set the mode to use (required for dumpers with multiple modes, 
168 forbidden otherwise). Use 'list' for known modes.
170 4.4.3 --prefix=<prefix>
172 Set dump prefix. Default is “avidump”.
174 4.4.4 --option=<name>=<value>
176 Set option <name> to value <value>.
178 4.4.5 --length=<length>
180 Set number of frames to dump. Mandatory.
182 4.4.6 --lua=<script>
184 Run specified lua script (lsnes-dumpavi does not have 
185 initialization files).
187 4.4.7 --load-library=<library>
189 Load the specified shared object / dynamic library / dynamic link 
190 library.
192 5 Startup file lsnes.rc
194 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as 
195 commands. This file is located in:
197 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
199 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME 
200   exists)
202 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
204 • All: ./lsnes.rc (fallback default).
206 If leading directories do not exist, attempt to create them is 
207 made.
209 6 Internal commands
211 • Commands beginning with '*' invoke the corresponding command 
212   without alias expansion.
214 • If command starts with '+' (after possible '*'), the command is 
215   executed as-is when button is pressed, and when button is 
216   released, it is executed with '+' replaced by '-'.
218 • Commands without '+' execute only on negative edge (release).
220 6.1 Settings:
222 Settings control various aspects of emulator behaviour.
224 6.1.1 set-setting <setting> <value>
226 Sets setting <setting> to value <value> (may be empty).
228 6.1.2 unset-setting <setting>
230 Try to unset setting <setting> (not all settings can be unset).
232 6.1.3 get-setting <setting>
234 Read value of setting <setting>
236 6.1.4 show-settings
238 Print names and values of all settings.
240 6.2 Keybindings
242 Keybindings bind commands or aliases to keys (or pseudo-keys). 
244 Notes:
246 • Do not bind edge active (+/-) commands to keys with modifiers, 
247   that won't work right!
249 • Names of keys and modifiers are platform-dependent.
251 • Be careful before binding pseudo-keys (such as joystick axes, 
252   buttons or hats) with modifiers. That may or may not work 
253   right.
255 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
257 Bind <command> to key <key> (activating if modifiers in <modmask> 
258 (comma-seperated list) are set as <mod> (comma-seperated list).
260 The names of keys and modifiers are platform-dependent.
262 6.2.2 unbind-key [<mod>/<modmask>] <key>
264 Unbind command from <key> (with specified <mod> and <modmask>).
266 6.2.3 set-axis <axis> [disabled | axis | axis-inverse | 
267   pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0 
268   | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>] 
269   [tolerance=<val>]
271 Set axis parameters for axis <axis>.
273 • disabled: Disable axis
275 • axis: Normal axis
277 • axis-inverse: Inverse axis
279 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
281 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
283 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
285 • pressure-+: Pressure sensitive. Released at -, pressed at +.
287 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
289 • pressure+-: Pressure sensitive. Released at +, pressed at -.
291 • minus=<val>: Calibration at extreme minus position 
292   (-32768-32767)
294 • zero=<val>: Calibration at neutral position (-32768-32767)
296 • plus=<val>: Calibration at extreme plus position (-32768-32767)
298 • tolerance=<value>: Center band tolerance (0<x<1). The smaller 
299   the value, the more sensitive the control is.
301 6.2.4 show-bindings
303 Print all key bindings in effect.
305 6.3 Aliases
307 Aliases bind command to sequence of commands. After alias has 
308 been defined, it replaces the command it shadows.
310 Notes:
312 • You can't alias command to itself.
314 • Aliases starting with +/- are edge active just like ordinary 
315   commands starting with +/-.
317 • One command can be aliased to multiple commands.
319 6.3.1 alias-command <command> <expansion>
321 Append <expansion> to alias <command>. If alias does not already 
322 exist, it is created.
324 6.3.2 unalias-command <command>
326 Clear alias expansion for <command>.
328 6.3.3 show-aliases
330 Print all aliases and their expansions in effect.
332 6.4 run-script <script>
334 Run <script> as if commands were entered on the command line.
336 6.5 Memory manipulation
338 <address> may be decimal or hexadecimal (prefixed with '0x'). 
339 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
340 signed (prefixed with '-') decimal.
342 The available element <sizes> are:
344 • byte: 1 byte
346 • word: 2 bytes
348 • dword: 4 bytes
350 • qword: 8 bytes
352 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
353 When dealing with DSP memory, multi-byte reads/writes are 
354 native-endian (do not use operand sizes exceeding DSP bitness, 
355 except dword is OK for 24-bit memory).
357 6.5.1 read-<size> <address>
359 Read the value of byte in <address>.
361 6.5.2 read-s<size> <address>
363 Read the value of signed byte in <address>.
365 6.5.3 write-<size> <address> <value>
367 Write <value> to byte in address <address>.
369 6.5.4 search-memory reset
371 Reset the memory search
373 6.5.5 search-memory count
375 Print number of candidates remaining
377 6.5.6 search-memory print
379 Print all candidates remaining
381 6.5.7 search-memory <usflag><sizeflag><op>
383 Searches memory for addresses satisfying criteria.
385 <usflag> can be:
387 • u: unsigned
389 • s: signed
391 <sizeflag> can be:
393 • b: byte
395 • w: word
397 • d: dword
399 • q: qword
401 <op> can be:
403 • lt: < previous value.
405 • le: <= previous value.
407 • eq: = previous value.
409 • ne: != previous value.
411 • ge: >= previous value.
413 • gt: > previous value.
415 6.5.8 search-memory <sizeflag> <value>
417 Searches for addresses that currently have value <value>. 
418 <sizeflag> is as in previous command.
420 6.6 Main commands
422 These commands are not available in lsnesrc, but are available 
423 after ROM has been loaded.
425 6.6.1 quit-emulator [/y]
427 Quits the emulator (asking for confirmation). If /y is given, no 
428 confirmation is asked.
430 6.6.2 pause-emulator
432 Toggle paused/unpaused
434 6.6.3 +advance-frame 
436 Advance frame. If the button is still held after configurable 
437 timeout expires, game unpauses for the duration frame advance is 
438 held.
440 6.6.4 +advance-poll 
442 Advance subframe. If the button is still held after configurable 
443 timeout expires, game unpauses for the duration frame advance is 
444 held.
446 6.6.5 advance-skiplag 
448 Skip to first poll in frame after current.
450 6.6.6 reset 
452 Reset the SNES after this frame.
454 6.6.7 load <filename> 
456 Load savestate <filename> in current mode.
458 6.6.8 load-state <filename> 
460 Load savestate <filename> in readwrite mode.
462 6.6.9 load-readonly <filename> 
464 Load savestate <filename> in readonly mode.
466 6.6.10 load-preserve <filename> 
468 Load savestate <filename> in readonly mode, preserving current 
469 events.
471 6.6.11 load-movie <filename> 
473 Load savestate <filename>, ignoring save part in readonly mode.
475 6.6.12 save-state <filename> 
477 Save system state to <filename> as soon as possible.
479 6.6.13 save-movie <filename> 
481 Save movie to <filename>.
483 6.6.14 set-rwmode 
485 Set read-write mode.
487 6.6.15 set-romode 
489 Set read-only mode
491 6.6.16 toggle-rwmode 
493 Toggle between read-only and read-write modes.
495 6.6.17 set-gamename <name> 
497 Set name of the game to <name>
499 6.6.18 get-gamename 
501 Print the name of the game.
503 6.6.19 add-author <author> 
505 Adds new author <author>. If <author> does not contain '|' it is 
506 full name. If it contains '|', '|' splits the full name and 
507 nickname.
509 6.6.20 edit-author <num> <author> 
511 Edit the author in slot <num> (0-based) to be <author> (see 
512 add-author for format)
514 6.6.21 remove-author <num> 
516 Remove author in slot <num>
518 6.6.22 print-authors 
520 Print authors.
522 6.6.23 test-1, test-2, test-3
524 Internal test commands. Don't use.
526 6.6.24 take-screenshot <filename> 
528 Save screenshot to <filename>.
530 6.6.25 +controller<num><button>
532 Press button <button> on controller <num> (1-8). The following 
533 button names are known:
535 • left
537 • right
539 • up
541 • down
543 • A
545 • B
547 • X
549 • Y
551 • L
553 • R
555 • select
557 • start
559 • trigger
561 • cursor
563 • pause
565 • turbo
567 6.6.26 controllerh<num><button>
569 Hold/unhold button <button> on controller <num> (1-8). See 
570 +controller for button names.
572 6.6.27 controllerf<num><button>
574 Hold/unhold button <button> on controller <num> (1-8) for the 
575 next frame. See +controller for button names.
577 Cauntion: Does not work properly if outside frame advance.
579 6.6.28 autofire (<pattern>|-)...
581 Set autofire pattern. Each parameter is comma-separated list of 
582 button names (in form of 1start, 1A, 2B, etc..) to hold on that 
583 frame. After reaching the end of pattern, the pattern restarts 
584 from the beginning.
586 6.6.29 repaint
588 Force a repaint.
590 6.7 Save jukebox 
592 6.7.1 cycle-jukebox-backward
594 Cycle save jukebox backwards.
596 6.7.2 cycle-jukebox-forward
598 Cycle save jukebox forwards
600 6.7.3 load-jukebox
602 Do load from jukebox (current mode).
604 6.7.4 save-jukebox
606 Do state save to jukebox.
608 6.8 Lua 
610 Only available if lua support is compiled in.
612 6.8.1 evaluate-lua <luacode>
614 Run Lua code <luacode> using built-in Lua interpretter.
616 6.8.2 run-lua <script>
618 Run specified lua file using built-in Lua interpretter.
620 6.8.3 reset-lua
622 Clear the Lua VM state and restore to factory defaults.
624 6.9 Memory watch
626 6.9.1 add-watch <name> <expression>
628 Adds new watch (or modifies old one).
630 6.9.2 remove-watch <name>
632 Remove a watch.
634 6.10 Sound 
636 6.10.1 enable-sound <on/off> 
638 Enable/Disable sound.
640 6.10.2 set-volume <multiplier>
642 Set the volume multiplier to <multiplier>. 1 is normal volume, 
643 and higher numbers are louder.
645 6.10.3 set-volume <multiplier>%
647 Set the volume multiplier to <multiplier> percent. 100 is normal 
648 volume, and higher numbers are louder.
650 6.10.4 set-volume <multiplier>dB
652 Set the volume multiplier to <multiplier> dB. 0 is normal volume, 
653 and higher numbers are louder. The value may be negative.
655 6.11 Misc.
657 6.11.1 reload-rom [<file>]
659 Reloads the main ROM image from <file>.
661 6.11.2 +tangent
663 Tangent for recording voice for commentary track. While pressed, 
664 record a stream.
666 7 Settings
668 7.1 Core settings
670 7.1.1 firmwarepath
672 Set where bsnes looks for firmware files. Default is “.”.
674 7.1.2 target
676 Set the target . Numeric, range is 0.001 to “infinite”. Default 
677 is native framerate.
679 7.1.3 savecompression
681 Set save compression level (integer 0-9). Default is 7 (0 is no 
682 compression).
684 7.1.4 advance-timeout
686 Set the frame advance timeout in milliseconds. Numeric integer, 
687 range is 0-999999999. Default is 500.
689 7.1.5 allow-inconsistent-saves (bsnes only)
691 If true, save without synchronization. Makes games seriously 
692 unstable.
694 7.1.6 save-every-frame (bsnes only)
696 If true, simulate saving on each frame. Trades off emulation 
697 accuracy for sync stability. Also needed if the movie assumes 
698 saving on each frame for rewind.
700 7.2 AVI dumper settings
702 7.2.1 avi-large
704 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
705 the console outputs.
707 7.2.2 avi-left-border
709 AVI dumper: Set the default left border thickness (unless lua 
710 overrides) for dumps. Range 0-8191. Default is 0.
712 7.2.3 avi-right-border
714 AVI dumper: Set the default right border thickness (unless lua 
715 overrides) for dumps. Range 0-8191. Default is 0.
717 7.2.4 avi-top-border
719 AVI dumper: Set the default top border thickness (unless lua 
720 overrides) for dumps. Range 0-8191. Default is 0.
722 7.2.5 avi-bottom-border
724 AVI dumper: Set the default bottom border thickness (unless lua 
725 overrides) for dumps. Range 0-8191. Default is 0.
727 7.2.6 avi-maxframes
729 AVI dumper: Maximum number of frames per dump segment (0 => 
730 unlimited). Range 0-999999999. Default is 0.
732 7.2.7 avi-compresison
734 AVI dumper: Compression level (0-18).
736 • Compression levels 10 and above are not compatible with stock 
737   CSCD codec.
739 • Recomended level is 7.
741 7.2.8 avi-soundrate
743 AVI dumper: Set method of determining the sound rate.
745 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
746   64, 88.2, 96, 128, 176.4 and 192 kHz.
748 • 1: Round down to nearest integer.
750 • 2: Round up to nearest ingeter.
752 7.3 JMD options
754 7.3.1 jmd-copression
756 JMD dumper: Compression level (0-9).
758 7.4 SDL platform settings
760 7.4.1 autorepeat-first-delay
762 Sets the delay for first character in typematic autorepeat.
764 7.4.2 autorepeat-subsequent-delay
766 Sets the delay for subsequent characters in typematic autorepeat.
768 8 Lua functions
770 8.1 Core (in main table)
772 8.1.1 print
774 Print line to message console.
776 8.1.2 exec(string command)
778 Run command as it was entered on the command line
780 8.1.3 utime()
782 Returns two values. First is time since some epoch in seconds, 
783 the second is microseconds mod 10^6 since that epoch.
785 8.1.4 emulator_ready()
787 Returns true if emulator has finished booting, false if not 
788 (on_startup() will be issued later).
790 8.1.5 set_idle_timeout(number timeout)
792 Set number of microseconds to block idle for. After this timeout 
793 has expired, on_idle() will be called once.
795 8.1.6 set_timer_timeout(number timeout)
797 Set number of microseconds to block timer for. After this timeout 
798 has expired, on_timer() will be called once.
800 8.1.7 bus_address(number snesaddr)
802 Returns virtual address corresponding to specified address on 
803 SNES bus.
805 8.1.8 loopwrapper(function fun, ...)
807 Calls function fun with function and specified arguments. The 
808 function passed suspends execution until the function returned is 
809 called. Handy for linear flow control among multiple invocations 
810 of a hook. Example code:
812 on_paint = loopwrapper(function(wait)
814   while true do
816     gui.text(0, 0, “Test!”);
818     wait();
820   end
822 end);
824 8.2 Table bit:
826 Bitwise logical functions and related.
828 8.2.1 bit.none(number...) / bit.bnot(number...)
830 48-bit bitwise NOT / NONE function (set bits that are set in none 
831 of the arguments).
833 8.2.2 bit.any(number...) / bit.bor(number...)
835 48-bit bitwise OR / ANY function (set bits that are set in any of 
836 the arguments).
838 8.2.3 bit.all(number...) / bit.band(number...)
840 48-bit bitwise AND / ALL function (set bits that are set in all 
841 of the arguments).
843 8.2.4 bit.parity(number...) / bit.bxor(number...)
845 48-bit bitwise XOR / PARITY function (set bits that are set in 
846 odd number of the arguments).
848 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
850 Rotate bits-bit (max 48, default 48) number left by amount 
851 (default 1) places.
853 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
855 Rotate bits-bit (max 48, default 48) number right by amount 
856 (default 1) places.
858 8.2.7 bit.lshift(number base[, number amount[, number bits]])
860 Shift bits-bit (max 48, default 48) number left by amount 
861 (default 1) places. The new bits are filled with zeroes.
863 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
865 Shift bits-bit (max 48, default 48) number logically right by 
866 amount (default 1) places. The new bits are filled with zeroes.
868 8.2.9 bit.arshift(number base[, number amount[, number bits]])
870 Shift bits-bit (max 48, default 48) number arithmetically right 
871 by amount (default 1) places. The new bits are shifted in with 
872 copy of the high bit.
874 8.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
876 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
877 and so on.
879 Notes: 
881 • Bit numbers up to 51 should work reliably (then things start 
882   falling apart due to double precision issues).
884 • There are two special bit positions, true and false, standing 
885   for always set bit and always clear bit.
887 8.2.11 bit.value([number bit1[, number bit2,...]])
889 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
890 shifted by bit2 places and so on. As special value, nil argument 
891 is no-op.
893 8.3 Table gui:
895 Most of these functions can only be called in on_paint and 
896 on_video callbacks. Exceptions are noted.
898 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
899 the green component, bits 16-23 are the red component, bits 24-31 
900 are alpha component (0 is fully opaque, 255 is almost 
901 transparent). -1 is the fully transparent color. Alpha values 
902 greater than 127 do work.
904 Origin of coordinates is at top left corner of game display area. 
905 Left and top gaps correspond to negative coordinates.
907 8.3.1 gui.resolution()
909 Returns 2-tuple (hresolution, vresolution).
911 8.3.2 gui.<class>_gap(number gap)
913 Set the <class> (left, right, top, bottom) gap to specified value 
914 (max gap is 8191).
916 8.3.3 gui.text(number x, number y, string text[, number fgc[, 
917   number bgc]])
919 Draw specified text on the GUI (each character cell is 8 or 16 
920 wide and 16 high). Parameters:
922 • x: X-coordinate to start the drawing from (and x-coordinate at 
923   begining of the lines).
925 • y: Y-coordinate to start the drawing from.
927 • text: The text to draw.
929 • fgc: Text color (default is 0xFFFFFF (white))
931 • bgc: Background color (default is -1 (transparent))
933 8.3.4 gui.textH(number x, number y, string text[, number fgc[, 
934   number bgc]])
936 Like gui.text, but draw using double-width.
938 8.3.5 gui.textV(number x, number y, string text[, number fgc[, 
939   number bgc]])
941 Like gui.text, but draw using double-height.
943 8.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
944   number bgc]])
946 Like gui.text, but draw using double-width/double-height.
948 8.3.7 gui.rectangle(number x, number y, number width, number 
949   height[, number thickness[, number outline[, number fill]]])
951 Draw rectangle on the GUI. Parameters:
953 • x: X-coordinate of left edge.
955 • y: Y-coordinate of upper edge.
957 • width: Width of rectangle.
959 • height: Height of rectangle.
961 • thickness: Thickness of outline (default is 1).
963 • outline: Color of outline (default is 0xFFFFFF (white))
965 • fill: Color of fill (default is -1 (transparent))
967 8.3.8 gui.box(number x, number y, number width, number height[, 
968   number thickness[, number outline1[,number outline2[, number 
969   fill]]]])
971 Draw rectangle with 3D effect on the GUI. Parameters:
973 • x: X-coordinate of left edge.
975 • y: Y-coordinate of upper edge.
977 • width: Width of rectangle.
979 • height: Height of rectangle.
981 • thickness: Thickness of outline (default is 1).
983 • outline1: First color of outline (default is 0xFFFFFF (white))
985 • outline2: First color of outline (default is 0x808080 (dark 
986   gray))
988 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
990 8.3.9 gui.pixel(number x, number y[, number color])
992 Draw one pixel on the GUI. Parameters:
994 • x: X-coordinate of the pixel
996 • y: Y-coordinate of the pixel
998 • color: Color of the pixel (default is 0xFFFFFF (white))
1000 8.3.10 gui.crosshair(number x, number y[, number length[, number 
1001   color]])
1003 Draw a crosshair. Parameters:
1005 • x: X-coordinate of the crosshair
1007 • y: Y-coordinate of the crosshair
1009 • length: Length of the crosshair lines (default 10).
1011 • color: Color of the crosshair (default is 0xFFFFFF (white))
1013 8.3.11 gui.line(number x1, number y1, number x2, number y2[, 
1014   number color])
1016 Draw a thin line. Parameters:
1018 • x1: X-coordinate of one end.
1020 • y1: Y-coordinate of one end.
1022 • x2: X-coordinate of the other end.
1024 • y2: Y-coordinate of the other end.
1026 • color: Color of the line (default is 0xFFFFFF (white)).
1028 8.3.12 gui.circle(number x, number y, number r[, number thick[, 
1029   number border[, number fil]]])
1031 Draw a circle. Parameters.
1033 • x: X-coordinate of the center
1035 • y: Y-coordinate of the center
1037 • r: The radius of the circle
1039 • thick: Border thickness
1041 • border: Border color (default is 0xFFFFFF (white))
1043 • fill: Fill color (default is -1 (transparent)).
1045 8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
1046   palette)
1048 Draw a bitmap on screen with specified palette. Parameters:
1050 • x: X-coordinate of left edge.
1052 • y: Y-coordinate of top edge.
1054 • bitmap: The bitmap to draw
1056 • palette: The palette to draw the bitmap using.
1058 8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
1060 Draw a bitmap on screen. Parameters:
1062 • x: X-coordinate of left edge.
1064 • y: Y-coordinate of top edge.
1066 • bitmap: The bitmap to draw
1068 8.3.15 gui.palette_new()
1070 Returns a new palette (initially all transparent). Can be used 
1071 anywhere.
1073 8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool 
1074   icolor])
1076 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
1078 • w: The width of new bitmap
1080 • h: The height of new bitmap
1082 • direct: If true, the returned bitmap is dbitmap, otherwise 
1083   bitmap.
1085 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
1086   DBITMAP)
1088 8.3.17 gui.bitmap_load(string file)
1090 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
1091 is palette for bitmap). Can be used anywhere. Parameters:
1093 • file: The name of file to load.
1095 8.3.18 gui.palette_set(palette palette, number index, number 
1096   color)
1098 Sets color in palette. Can be used anywhere. Parameters:
1100 • palette: The palette to manipulate
1102 • index: Index of color (0-65535).
1104 • color: The color value.
1106 8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
1107   number color)
1109 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
1111 • bitmap: The bitmap to manipulate
1113 • x: The x-coordinate of the pixel.
1115 • y: The y-coordinate of the pixel.
1117 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
1118   color value.
1120 8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
1122 Get size of bitmap. Can be used anywhere. Parameters:
1124 • bitmap: The bitmap to query.
1126 The first return is the width, the second is the height.
1128 8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
1129   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
1130   number ck])
1132 Blit a part of bitmap to another. Can be used anywhere. 
1133 Parameters:
1135 • dest: Destination to blit to.
1137 • dx: left edge of target
1139 • dy: Top edge of target
1141 • src: The source to blit from. Must be of the same type as 
1142   destination.
1144 • sx: left edge of source
1146 • sy: Top edge of source
1148 • w: Width of region
1150 • h: Height of region.
1152 • ck: Color key. Pixels of this color are not blitted.
1154   – If bitmaps are bitmaps, this is color index of colorkey. 
1155     Values outside range 0-65535 cause no key to be used as 
1156     colorkey.
1158   – If bitmaps are dbitmaps, this color value of colorkey.
1160   – May be absent or nil for no colorkey blit.
1162 8.3.22 gui.repaint()
1164 Request on_repaint() to happen as soon as possible. Can be used 
1165 anywhere.
1167 8.3.23 gui.subframe_update(boolean on)
1169 Request subframe updates (calling on_paint() on subframes) to 
1170 happen (on=true) or not happen (on=false). Can be used anywhere.
1172 8.3.24 gui.screenshot(string filename)
1174 Write PNG screenshot of the current frame (no drawings) to 
1175 specified file. Can be used anywhere.
1177 8.3.25 gui.color(number r, number g, number b[, number a])
1179 Returns color (in notation Lua scripts use) corresponding to 
1180 color (r,g,b), each component in scale 0-255. If a is specified, 
1181 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1182 The default alpha is 256.
1184 8.3.26 gui.status(string name, string value)
1186 Set status field “L[<name>]” to <value> in status area. Can be 
1187 used anywhere.
1189 8.3.27 gui.rainbow(number step, number steps[, number color])
1191 Perform hue rotation of color <color> (default bright red), by 
1192 <step> steps. The number of steps per full rotation is given by 
1193 absolute value of <steps>.
1195 If <steps> is negative, the rotation will be counterclockwise.
1197 8.3.28 gui.screenshot(string filename)
1199 Saves a screenshot into specified file.
1201 8.4 table input
1203 Input handling. Only available in on_input callback.
1205 8.4.1 input.get(number controller, number index)
1207 Read the specified index (0-11) from specified controller (0-7). 
1208 Notes:
1210 • Uses physical controller numbering. Gamepad in port 2 is 
1211   controller 4, not 1!
1213 8.4.2 input.set(number controller, number index, number value)
1215 Write the specified index (0-11) from specified controller (0-7), 
1216 storing value. Notes:
1218 • Uses physical controller numbering. Gamepad in port 2 is 
1219   controller 4, not 1!
1221 8.4.3 input.geta(number controller)
1223 Get input state for entiere controller. Returns 13 return values.
1225 • 1st return value: Bitmask: bit i is set if i:th index is 
1226   nonzero
1228 • 2nd-13th return value: value of i:th index.
1230 8.4.4 input.seta(number controller, number bitmask, number 
1231   args...)
1233 Set state for entiere controller. args is up to 12 values for 
1234 indices (overriding values in bitmask if specified).
1236 8.4.5 input.controllertype(number controller)
1238 Get the type of controller as string. Valid values are:
1240 • gamepad
1242 • mouse
1244 • justifier
1246 • superscope
1248 8.4.6 input.reset([number cycles])
1250 Execute reset. If cycles is greater than zero, do delayed reset. 
1251 0 (or no value) causes immediate reset.
1253 • Only available with subframe flag false.
1255 8.4.7 input.raw()
1257 Returns table of tables of all available keys and axes. The first 
1258 table is indexed by key name (platform-dependent!), and the inner 
1259 table has the following fields:
1261 • value: Last reported value for control
1263   – For keys: 1 for pressed, 0 for released.
1265   – For axes: -32767...32767.
1267   – For presure-sensitive buttons: 0...32767.
1269   – For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
1271   – For mouse: Coordinates relative to game area.
1273 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1274   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1275   pressure-pm, pressure-p0).
1277 8.4.8 input.keyhook(string key, boolean state)
1279 Requests that keyhook events to be sent for key (state=true) or 
1280 not sent (state=false).
1282 8.4.9 input.joyget(number controller)
1284 Returns table for current controls for specified controller. The 
1285 names of fields vary by controller type.
1287 • The buttons have the same name as those are referred to in 
1288   other contexts in the emulator
1290 • The analog axes are “xaxis” and “yaxis”.
1292 8.4.10 input.joyset(number controller, table controls)
1294 Set the the state of specified controller to values specified in 
1295 specified table.
1297 8.4.11 input.lcid_to_pcid(number controller)
1299 Return the physical index, physical port and controller number in 
1300 port for specified (1-based) logical controller.
1302 8.5 Table subtitle
1304 Subtitle handling
1306 8.5.1 subtitle.byindex(number i)
1308 Read the frame and length of ith subtitle. Returns nothing if not 
1309 present.
1311 8.5.2 subtitle.set(number f, number l, string txt)
1313 Set the text of subtitle.
1315 8.5.3 subtitle.get(number f, number l)
1317 Get the text of subtitle.
1319 8.5.4 subtitle.delete(number f, number l)
1321 Delete specified subtitle.
1323 8.6 Table hostmemory
1325 Host memory handling (extra memory saved to savestates). Host 
1326 memory starts empty.
1328 8.6.1 hostmemory.read(number address)
1330 Reads hostmemory slot address. Slot numbers out of range return 
1331 false instead of numeric.
1333 8.6.2 hostmemory.write(number address, number value)
1335 Writes hostmemory slot with 0-255. Slot numbers out of range 
1336 cause extension of host memory slot space.
1338 8.6.3 hostmemory.readbyte(number address)
1340 Read unsigned byte (1 element) from given address. Slots out of 
1341 range return false.
1343 8.6.4 hostmemory.writebyte(number address, number value)
1345 Write unsigned byte (1 element) to given slot. Slot numbers out 
1346 of range cause extension.
1348 8.6.5 hostmemory.readsbyte(number address)
1350 Read signed byte (1 element) from given address. Slots out of 
1351 range return false.
1353 8.6.6 hostmemory.writesbyte(number address, number value)
1355 Write signed byte (1 element) to given slot. Slot numbers out of 
1356 range cause extension.
1358 8.6.7 hostmemory.readword(number address)
1360 Read unsigned word (2 elements) from given address. Slots out of 
1361 range return false.
1363 8.6.8 hostmemory.writeword(number address, number value)
1365 Write unsigned word (2 elements) to given slot. Slot numbers out 
1366 of range cause extension.
1368 8.6.9 hostmemory.readsword(number address)
1370 Read signed word (2 elements) from given address. Slots out of 
1371 range return false.
1373 8.6.10 hostmemory.writesword(number address, number value)
1375 Write signed word (2 elements) to given slot. Slot numbers out of 
1376 range cause extension.
1378 8.6.11 hostmemory.readdword(number address)
1380 Read unsigned doubleword (4 elements) from given address. Slots 
1381 out of range return false.
1383 8.6.12 hostmemory.writedword(number address, number value)
1385 Write unsigned doubleword (4 elements) to given slot. Slot 
1386 numbers out of range cause extension.
1388 8.6.13 hostmemory.readsdword(number address)
1390 Read signed doubleword (4 elements) from given address. Slots out 
1391 of range return false.
1393 8.6.14 hostmemory.writesdword(number address, number value)
1395 Write signed doubleword (4 elements) to given slot. Slot numbers 
1396 out of range cause extension.
1398 8.6.15 hostmemory.readqword(number address)
1400 Read unsigned quadword (8 elements) from given address. Slots out 
1401 of range return false.
1403 8.6.16 hostmemory.writeqword(number address, number value)
1405 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1406 out of range cause extension.
1408 8.6.17 hostmemory.readsqword(number address)
1410 Read signed quadword (8 elements) from given address. Slots out 
1411 of range return false.
1413 8.6.18 hostmemory.writesqword(number address, number value)
1415 Write signed quadword (8 elements) to given slot. Slot numbers 
1416 out of range cause extension.
1418 8.7 Table movie
1420 Movie handling
1422 8.7.1 movie.currentframe()
1424 Return number of current frame.
1426 8.7.2 movie.framecount()
1428 Return number of frames in movie.
1430 8.7.3 movie.readonly()
1432 Return true if in readonly mode, false if in readwrite.
1434 8.7.4 movie.rerecords()
1436 Returns the current value of rerecord count.
1438 8.7.5 movie.set_readwrite()
1440 Set readwrite mode (does not cause on_readwrite callback).
1442 8.7.6 movie.frame_subframes(number frame)
1444 Count number of subframes in specified frame (frame numbers are 
1445 1-based) and return that.
1447 8.7.7 movie.read_subframe(number frame, number subframe)
1449 Read specifed subframe in specified frame and return data as 
1450 array (100 elements, numbered 0-99 currently).
1452 8.7.8 movie.read_rtc()
1454 Returns the current value of the RTC as a pair (second, 
1455 subsecond).
1457 8.7.9 movie.unsafe_rewind([UNSAFEREWIND state])
1459 Start setting point for unsafe rewind or jump to point of unsafe 
1460 rewind.
1462 • If called without argument, causes emulator to start process of 
1463   setting unsafe rewind point. When this has finished, callback 
1464   on_set_rewind occurs, passing the rewind state to lua script.
1466 • If called with argument, causes emulator rewind to passed 
1467   rewind point as soon as possible. Readwrite mode is implicitly 
1468   activated.
1470 The following warnings apply to unsafe rewinding:
1472 • There are no safety checks against misuse (that's what “unsafe” 
1473   comes from)!
1475 • Only call rewind from timeline rewind point was set from.
1477 • Only call rewind from after the rewind point was set.
1479 8.8 Table settings
1481 Routines for settings manipulation
1483 8.8.1 settings.get(string name)
1485 Get value of setting. If setting is blank, returns false. If 
1486 setting value can't be obtained, returns (nil, error message).
1488 8.8.2 settings.set(string name, string value)
1490 Set value of setting. If setting can't be set, returns (nil, 
1491 error message).
1493 8.8.3 settings.is_set(string name)
1495 Returns if setting is set. If setting does not exist, returns 
1496 (nil, error message).
1498 8.8.4 settings.blank(string name)
1500 Blanks a setting and returns true. If setting can't be blanked, 
1501 returns (nil, error message).
1503 8.9 Table memory
1505 Contains various functions for managing memory
1507 8.9.1 memory.vma_count()
1509 Returns the number of VMAs
1511 8.9.2 memory.read_vma(number index)
1513 Reads the specified VMA (indices start from zero). Trying to read 
1514 invalid VMA gives nil. The read VMA is table with the following 
1515 fields:
1517 • region_name (string): The readable name of the VMA
1519 • baseaddr (number): Base address of the VMA
1521 • lastaddr (number): Last address in the VMA.
1523 • size (number): The size of VMA in bytes.
1525 • readonly (boolean): True of the VMA corresponds to ROM.
1527 • iospace (boolean): True if the VMA is I/O space.
1529 • native_endian (boolean): True if the VMA has native endian as 
1530   opposed to little endian.
1532 8.9.3 memory.find_vma(number address)
1534 Finds the VMA containing specified address. Returns table in the 
1535 same format as read_vma or nil if not found.
1537 8.9.4 memory.readbyte(number address)
1539 Reads the specified address as unsigned byte and returns the 
1540 result.
1542 8.9.5 memory.readsbyte(number address)
1544 Reads the specified address as signed byte and returns the 
1545 result.
1547 8.9.6 memory.writebyte(number address, number value)
1549 Writes the specified value (negative values undergo 2's 
1550 complement) to specified address (as a byte).
1552 8.9.7 memory.readword(number address)
1554 Reads the specified address as unsigned word and returns the 
1555 result.
1557 8.9.8 memory.readsword(number address)
1559 Reads the specified address as signed word and returns the 
1560 result.
1562 8.9.9 memory.writeword(number address, number value)
1564 Writes the specified value (negative values undergo 2's 
1565 complement) to specified address (as a word).
1567 8.9.10 memory.readdword(number address)
1569 Reads the specified address as unsigned doubleword and returns 
1570 the result.
1572 8.9.11 memory.readsdword(number address)
1574 Reads the specified address as signed doubleword and returns the 
1575 result.
1577 8.9.12 memory.writedword(number address, number value)
1579 Writes the specified value (negative values undergo 2's 
1580 complement) to specified address (as a doubleword).
1582 8.9.13 memory.readqword(number address)
1584 Reads the specified address as unsigned quadword and returns the 
1585 result.
1587 8.9.14 memory.readsqword(number address)
1589 Reads the specified address as signed quadword and returns the 
1590 result.
1592 8.9.15 memory.writeqword(number address, number value)
1594 Writes the specified value (negative values undergo 2's 
1595 complement) to specified address (as a quadword).
1597 8.9.16 memory.hash_region(number base, number size)
1599 Hash specified number of bytes starting from specified address 
1600 and return the SHA-256.
1602 8.9.17 memory.hash_state()
1604 Hash the current system state. Mainly useful for debugging 
1605 savestates.
1607 8.9.18 memory.readregion(number base, number size)
1609 Read a region of memory.
1611 • Warning: If the region crosses VMA boundary, the results are 
1612   undefined.
1614 8.9.19 memory.map<type>([number base, number size])
1616 Returns a table mapping specified memory aperture for read/write. 
1617 If parameters are omitted, entiere map space is the aperture.
1619 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1620   qword or sqword.
1622 8.9.20 memory.writeregion(number base, number size, table data)
1624 Write a region of memory.
1626 • Warning: If the region crosses VMA boundary, the results are 
1627   undefined.
1629 8.9.21 memory.map_struct()
1631 Returns a new mapping structure (MMAP_STRUCT)
1633 8.9.22 MMAP_STRUCT(string key, number address, string type)
1635 Bind key in mmap structure to specified address with specified 
1636 type.
1638 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1639   qword or sqword.
1641 8.9.23 memory.read_expr(string expr)
1643 Evaluate specified watch expression and return result
1645 8.10 Table subtitle
1647 Contains functions for manipulating subtitles.
1649 8.10.1 subtitle.byindex(number index)
1651 Get (basetime, length) pair of specified subtitle index or 
1652 nothing if index isn't valid.
1654 8.10.2 subtitle.get(number basetime, number length)
1656 Read the specified subtitle. Returns “” if the subtitle does not 
1657 exist.
1659 8.10.3 subtitle.set(number basetime, number length, string 
1660   content)
1662 Set the specified subtitle.
1664 8.10.4 subtitle.deltete(number basetime, number length)
1666 Delete the specified subtitle.
1668 8.11 Table _SYSTEM
1670 Contains copy of global variables from time of Lua 
1671 initialization. Non-writeable.
1673 8.12 Callbacks
1675 Various callbacks to Lua that can occur.
1677 8.12.1 Callback: on_paint(bool not_synth)
1679 Called when screen is being painted. Any gui.* calls requiring 
1680 graphic context draw on the screen.
1682 not_synth is true if this hook is being called in response to 
1683 received frame, false otherwise.
1685 8.12.2 Callback: on_video()
1687 Called when video dump frame is being painted. Any gui.* calls 
1688 requiring graphic context draw on the video.
1690 8.12.3 Callback: on_frame_emulated()
1692 Called when emulating frame has completed and 
1693 on_paint()/on_video() calls are about to be issued.
1695 8.12.4 Callback: on_frame()
1697 Called on each starting whole frame.
1699 8.12.5 Callback: on_startup()
1701 Called when the emulator is starting (lsnes.rc and --run files 
1702 has been run).
1704 8.12.6 Callback: on_rewind()
1706 Called when rewind movie to beginning has completed.
1708 8.12.7 Callback: on_pre_load(string name)
1710 Called just before savestate/movie load occurs (note: loads are 
1711 always delayed, so this occurs even when load was initiated by 
1712 lua).
1714 8.12.8 Callback: on_err_load(string name)
1716 Called if loadstate goes wrong.
1718 8.12.9 Callback: on_post_load(string name, boolean was_savestate)
1720 Called on successful loadstate. was_savestate gives if this was a 
1721 savestate or a movie.
1723 8.12.10 Callback: on_pre_save(string name, boolean is_savestate)
1725 Called just before savestate save occurs (note: movie saves are 
1726 synchronous and won't trigger these callbacks if called from 
1727 Lua).
1729 8.12.11 Callback: on_err_save(string name)
1731 Called if savestate goes wrong.
1733 8.12.12 Callback: on_post_save(string name, boolean is_savestate)
1735 Called on successful savaestate. is_savestate gives if this was a 
1736 savestate or a movie.
1738 8.12.13 Callback: on_quit()
1740 Called when emulator is shutting down.
1742 8.12.14 Callback: on_input(boolean subframe)
1744 Called when emulator is just sending input to bsnes core. 
1745 Warning: This is called even in readonly mode, but the results 
1746 are ignored.
1748 8.12.15 Callback: on_reset()
1750 Called when SNES is reset.
1752 8.12.16 Callback: on_readwrite()
1754 Called when moving into readwrite mode as result of “set-rwmode” 
1755 command (note: moving to rwmode by Lua won't trigger this, as per 
1756 recursive entry protection).
1758 8.12.17 Callback: on_snoop(number port, number controller, number 
1759   index, number value)
1761 Called each time bsnes asks for input. The value is the final 
1762 value to be sent to bsnes core (readonly mode, autohold and 
1763 autofire have been taken into account). Might be useful when 
1764 translating movies to format suitable for console verification. 
1765 Note: There is no way to modify the value to be sent.
1767 8.12.18 Callback: on_keyhook(string keyname, table state)
1769 Sent when key that has keyhook events requested changes state. 
1770 Keyname is name of the key (group) and state is the state (same 
1771 kind as table values in input.raw).
1773 8.12.19 Callback: on_idle()
1775 Called when requested by set_idle_timeout(), the timeout has 
1776 expired and emulator is waiting.
1778 8.12.20 Callback: on_timer()
1780 Called when requested by set_idle_timeout() and the timeout has 
1781 expired (regardless if emulator is waiting).
1783 8.12.21 Callback: on_set_rewind(UNSAFEREWIND r)
1785 Called when unsafe rewind object has been constructed.
1787 8.12.22 Callback: on_pre_rewind() 
1789 Called just before unsafe rewind is about to occur.
1791 8.12.23 Callback: on_post_rewind() 
1793 Called just after unsafe rewind has occured.
1795 9 Memory watch expression syntax
1797 Memory watch expressions are in RPN (Reverse Polish Notation). At 
1798 the end of expression, the top entry on stack is taken as the 
1799 final result.
1801 Notations:
1803 • Evaluation order is strictly left to right.
1805 • a is the entry on top of stack
1807 • b is the entry immediately below top of stack
1809 • ; separates values to be pushed (no intermediate pop).
1811 • After end of element, all used stack slots are popped and all 
1812   results are pushed.
1814 • When pushing multiple values, the pushes occur in order shown.
1816 The following operators are available:
1818 • + : a + b
1820 • - : a - b
1822 • * : a * b
1824 • / : a / b
1826 • % : a % b
1828 • a : atan(a)
1830 • b : read_signed_byte(a)
1832 • c : cos(a)
1834 • d : read_signed_dword(a)
1836 • i : quotent(a / b)
1838 • p :\pi
1841 • q : read_signed_qword(a)
1843 • r : sqrt(a)
1845 • s : sin(a)
1847 • t : tan(a)
1849 • u : a; a
1851 • w : read_signed_word(a)
1853 • A : atan2(a, b)
1855 • B : read_unsigned_byte(a)
1857 • C<number>z : Push number <number> to stack.
1859 • D : read_unsigned_dword(a)
1861 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1863 • Q : read_unsigned_qword(a)
1865 • R<digit> : round a to <digit> digits.
1867 • W : read_unsigned_word(a)
1869 9.1 Example:
1871 C0x007e0878zWC0x007e002czW-
1873 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1875 2. Pop the value on top of stack (0x7e0878), read word value at 
1876   that address and push the result,call it x1 (W).
1878 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1880 4. Pop the value on top of stack (0x7e002c), read word value at 
1881   that address and push the result,call it x2 (W).
1883 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
1884   x2 and push x2 - x1 (-).
1886 6. Since the expression ends, the final memory watch result is 
1887   the top one on stack, which is x2 - x1.
1889 10 Modifier and key names:
1891 10.1 SDL Platform
1893 10.1.1 Modifier names
1895 Following modifier names are known:
1897 • ctrl, lctrl, rctrl: Control keys
1899 • alt, lalt, ralt: ALT keys.
1901 • shift, lshift, rshift: Shift keys.
1903 • meta, lmeta, rmeta: Meta keys.
1905 • num, caps: Numlock/Capslock (these are sticky!)
1907 • mode: Mode select.
1909 10.1.2 Key names
1911 Following key names are known:
1913 • backspace, tab, clear, return, pause, escape, space, exclaim, 
1914   quotedbl, hash, dollar, ampersand, quote, leftparen, 
1915   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
1916   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
1917   greater, question, at, leftbracket, backslash, rightbracket, 
1918   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
1919   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
1920   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
1921   world_8, world_9, world_10, world_11, world_12, world_13, 
1922   world_14, world_15, world_16, world_17, world_18, world_19, 
1923   world_20, world_21, world_22, world_23, world_24, world_25, 
1924   world_26, world_27, world_28, world_29, world_30, world_31, 
1925   world_32, world_33, world_34, world_35, world_36, world_37, 
1926   world_38, world_39, world_40, world_41, world_42, world_43, 
1927   world_44, world_45, world_46, world_47, world_48, world_49, 
1928   world_50, world_51, world_52, world_53, world_54, world_55, 
1929   world_56, world_57, world_58, world_59, world_60, world_61, 
1930   world_62, world_63, world_64, world_65, world_66, world_67, 
1931   world_68, world_69, world_70, world_71, world_72, world_73, 
1932   world_74, world_75, world_76, world_77, world_78, world_79, 
1933   world_80, world_81, world_82, world_83, world_84, world_85, 
1934   world_86, world_87, world_88, world_89, world_90, world_91, 
1935   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
1936   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
1937   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
1938   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
1939   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
1940   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
1941   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
1942   sysreq, break, menu, power, euro, undo
1944 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
1945   key having hardware-dependent scan code of <n> (useful to bind 
1946   those keys that don't have symbolic names).
1948 10.1.3 Joystick pseudo-keys:
1950 • joystick<num>button<button>: Joystick <num> (0-based) button 
1951   <button> (0-based).
1953 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
1954   (0-based) up.
1956 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
1957   (0-based) left.
1959 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
1960   (0-based) down.
1962 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
1963   (0-based) right.
1965 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
1966   negative position (axis modes axis and axis_inverse).
1968 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
1969   positive position (axis modes axis and axis_inverse).
1971 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
1972   pressure (axis modes pressure_*).
1974 10.1.4 Special buttons:
1976 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1978 • Return (also KPEnter): Execute command, ok modal dialog.
1980 • Pgup/Up (also KP8/9 if no num lock, CTRL+P; command mode): 
1981   Previous command in command history
1983 • Pgdn/Down(also KP2/3 if no num lock, CTRL+N; command mode): 
1984   Next command in command history
1986 • Home (also KP7 if no num lock, CTRL+A; command mode): Beginning 
1987   of command.
1989 • End (also KP1 if no num lock, CTRL+E; command mode): End of 
1990   command.
1992 • Left (also KP4 if no num lock, CTRL+B; command mode): Move 
1993   cursor left.
1995 • Right (also KP6 if no num lock, CTRL+F; command mode): Move 
1996   cursor right.
1998 • Delete (also KP. if no num lock; command mode): Delete 
1999   character to right of cursor.
2001 • Insert (also KP0 if no num lock; command mode): Toggle between 
2002   insert / overwrite modes.
2004 • Backspace (command mode): Delete character to left of cursor.
2006 • CTRL+LEFT (also ALT+B; command mode): Previous word.
2008 • CTRL+RIGHT (also ALT+F; command mode): Next word.
2010 • ALT+D (also CTRL+W; command mode): Delete word.
2012 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
2013   corrupted!).
2015 10.2 wxWidgets platform
2017 10.2.1 Modifier names:
2019 Following modifier names are known:
2021 • alt
2023 • ctrl
2025 • shift 
2027 • meta
2029 • cmd (Mac OS X only)
2031 10.2.2 Key names:
2033 Following key names are known:
2035 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
2036   dollar, percent, ampersand, quote, leftparen, rightparen, 
2037   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
2038   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
2039   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
2040   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
2041   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
2042   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
2043   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
2044   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
2045   home, lefT, up, right, down, select, print, execute, snapshot, 
2046   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
2047   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
2048   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
2049   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
2050   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
2051   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
2052   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
2053   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
2054   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
2055   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
2056   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
2057   windows_right, windows_menu, command, special1, special2, 
2058   special3, special4, special5, special6, special7, special8, 
2059   special9, special10, special11, special12, special13, 
2060   special14, special15, special16, special17, special18, 
2061   special19, special20
2063 11 Movie file format
2065 Movie file is .zip archive in itself, normal ZIP archive tools 
2066 work on it (note: If you recompress it, do not use compression 
2067 methods other than store and deflate and especially do not use 
2068 encryption of any kind).
2070 11.1 Detecting clean start/SRAM/Savestate
2072 • If file has member “savestate” it is savestate, otherwise:
2074 • If file has members with names starting “moviesram.” it is 
2075   movie starting from SRAM, otherwise:
2077 • It is movie starting from clear state.
2079 11.2 Member: gametype
2081 Type of game ROM and region (as one line). Valid values are:
2084 +--------------+---------------------+--------+
2085 |    Value     |       System        | Region |
2086 +--------------+---------------------+--------+
2087 +--------------+---------------------+--------+
2088 |  snes_pal    |     Super NES       |  PAL   |
2089 +--------------+---------------------+--------+
2090 |   sgb_pal    |   Super Game Boy    |  PAL   |
2091 +--------------+---------------------+--------+
2092 |  snes_ntsc   |     Super NES       |  NTSC  |
2093 +--------------+---------------------+--------+
2094 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
2095 +--------------+---------------------+--------+
2096 |     bsx      | BS-X (non-slotted)  |  NTSC  |
2097 +--------------+---------------------+--------+
2098 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
2099 +--------------+---------------------+--------+
2100 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
2101 +--------------+---------------------+--------+
2104 Frame rates are:
2107 +---------+-----------------+
2108 | Region  | Framerate (fps) |
2109 +---------+-----------------+
2110 +---------+-----------------+
2111 |  PAL    |   322445/6448   |
2112 +---------+-----------------+
2113 |  NTSC   | 10738636/178683 |
2114 +---------+-----------------+
2117 11.3 Member: port1
2119 Contains type of port #1 (as one line). Valid values are 'none', 
2120 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
2121 'gamepad'.
2123 11.4 Member: port2
2125 Contains type of port #2 (as one line). Valid values are 'none', 
2126 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
2127 'justifiers'. If not present, defaults to 'none'.
2129 11.5 Member: gamename
2131 Contains name of the game (as one line).
2133 11.6 Member: authors
2135 Contains authors, one per line. Part before '|' is the full name, 
2136 part after is the nickname.
2138 11.7 Member: systemid
2140 Always “lsnes-rr1” (one line). Used to reject other saves.
2142 11.8 Member: controlsversion
2144 Always “0” (one line). Used to identify what controls are there.
2146 11.9 Member: “coreversion”
2148 Contains bsnes core version number (as one line).
2150 11.10 Member: projectid
2152 Contains project ID (as one line). Used to identify if two movies 
2153 are part of the same project.
2155 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2157 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2158 Absent if corresponding file is absent.
2160 11.12 Member: moviesram.<name>
2162 Raw binary startup SRAM of kind <name>. Only present in 
2163 savestates and movies starting from SRAM.
2165 11.13 Member: saveframe
2167 Contains frame number (as one line) of frame movie was saved on. 
2168 Only present in savestates.
2170 11.14 Member: lagcounter
2172 Current value of lag counter (as one line). Only present in 
2173 savestates.
2175 11.15 Member: pollcounters
2177 Contains poll counters (currently 100 of them), one per line. 
2178 Each line is raw poll count if DRDY is set for it. Otherwise it 
2179 is negative poll count minus one. Only present in savestates.
2181 11.16 Member: hostmemory
2183 Raw binary dump of host memory. Only present in savestates.
2185 11.17 Member: savestate
2187 The raw binary savestate itself. Savestate detection uses this 
2188 file, only present in savestates.
2190 11.18 Member: screenshot
2192 Screenshot of current frame. Only present in savestates. First 2 
2193 bytes are big-endian width of image, rest are 24-bit RGB image 
2194 data. Height of image is inferred from the width and size of 
2195 data.
2197 11.19 Member: sram.<name>
2199 Raw binary SRAM of kind <name> at time of savestate. Only present 
2200 in savestates.
2202 11.20 Member: input
2204 The actual input track, one line per subframe (blank lines are 
2205 skipped).
2207 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2208   the line is part of same frame as previous, otherwise it starts 
2209   a new frame.
2211 • First subframe must start a new frame.
2213 Length of movie in frames is number of lines in input file that 
2214 start a new frame.
2216 11.21 Member: subtitles
2218 Subtitle track. Optional.
2220 • Each line is in form <firstframe> <numframes> <text>.
2222 • Linefeed is encoded as \n, backslash is encoded as \\.
2224 11.22 Member: rerecords
2226 Contains textual base-10 rerecord count (as one line; emulator 
2227 just writes this, it doesn't read it) + 1.
2229 11.23 Member: rrdata
2231 This member stores set of load IDs. There is one load ID per 
2232 rerecord (plus one corresponding to start of project).
2234 • This member constists of concatenation of records
2236 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2237   consequtive IDs.
2239 • IDs are interpretted as 256-bit big-endian integers with 
2240   warparound.
2242 • Initial predicted ID is all zeroes.
2244 Format of each record is:
2246 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2247   bits 5-6 are count length (countlen). Bit 7 is unused.
2249 • 32-prefixlen bytes of ID.
2251 • countlen bytes of big-endian count (count).
2253 Records are processed as follows:
2255 • To form the first ID encoded by record, take the first 
2256   prefixlen bytes predicted ID and append the read ID value to 
2257   it. The result is the first ID encoded.
2259 • If countlen is 0, record encodes 1 ID.
2261 • If countlen is 1, record encodes 2+count IDs.
2263 • If countlen is 2, record encodes 258+count IDs.
2265 • If countlen is 3, record encodes 65794+count IDs.
2267 • The new predicted ID is the next ID after last one encoded by 
2268   the record.
2270 The number of rerecords + 1 is equal to the sum of number of IDs 
2271 encoded by all records.
2273 11.24 Member: starttime.second
2275 Movie starting time, second part. Epoch is Unix epoch. Default is 
2276 1,000,000,000.
2278 11.25 Member: starttime.subsecond
2280 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2281 is 0.
2283 11.26 Member: savetime.second
2285 Movie saving time, second part. Default is starttime.second. Only 
2286 present in savestates.
2288 11.27 Member: savetime.subsecond
2290 Movie saving time, subsecond part. Default is 
2291 starttime.subsecond. Only present in savestates.
2293 12 lsvs file format (commentary tracks)
2295 12.1 Clusters
2297 • Each cluster is 8kB (8192 bytes) in size.
2299 • Cluster n starts at offset 8192*n in file.
2301 • The following clusters are system special:
2303   – Cluster 0 and all clusters with number multiple of 2048 
2304     (cluster tables)
2306   – Cluster 1 (superblock)
2308 12.2 Cluster tables
2310 • The cluster table describing cluster n is stored in cluster n & 
2311   ~0x7FF (zero last 11 bits of n).
2313 • This cluster table consists of 2048 4-byte big-endian integers.
2315 • Each entry describes a cluster in 16MB supercluster, in order.
2317 • The valid values for entries are:
2319   – 0x00000000: Free cluster
2321   – 0x00000001: Last cluster in chain.
2323   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2325   – (anything else): Number of next cluster in chain. Must not be 
2326     multiple of 2048.
2328 • Due to limitations of the format, there can be at most 2097052 
2329   superclusters, giving maximum file size of 16TB.
2331 12.3 Stream table
2333 • The stream table chain always starts in cluster 2.
2335 • Otherwise, it follows normal chaining.
2337 • The stream table consists of 16-byte entries:
2339   – The first 8 bytes of entry give big-endian beginning position 
2340     of stream in units of 1/48000 s.
2342   – The next 4 bytes of entry give big-endian beginning cluster 
2343     for control data. 0 here marks the entry as not present.
2345   – The last 4 bytes of entry give big-endian beginning cluster 
2346     for codec data.
2348 • Stream table clusters are normal clusters, following normal 
2349   chaining.
2351 • The stream begnning position is not guarenteed unique. There 
2352   can be multiple streams with the same starting position in the 
2353   file.
2355 12.4 Stream control data
2357 • The stream control data consists of entries 4 bytes each:
2359   – The first 2 bytes of entry gives big-endian length of packet
2361   – The next byte of entry gives audio length of packet in units 
2362     of 1/400 s.
2364   – The last byte is control byte.
2366     ∗ 0 means this entry is not present and the control data 
2367       ends.
2369     ∗ 1 is valid control entry.
2371 • The stream control data can also end by running into end of the 
2372   readable chain.
2374   – This happens if there happens to be exact multiple of 2048 
2375     packets in stream and number of packets is nonzero.
2377 • These clusters follow normal chaining.
2379 12.5 Stream codec data
2381 • Stream codec data consists of raw Opus data packets packed back 
2382   to back with nothing in between.
2384 • Warning: Due to internal limitations, this data must reside in 
2385   the first 65536 superclusters (that is, the first 1TB of the 
2386   file).
2388 12.6 Superblock
2390 • The superblock is stored in cluster 1. 
2392 • The first 11 bytes are “sefs-magic”<NUL>.
2394 • The rest are unused.
2396 • This cluster 1 is marked as system special.
2398 13 Known ROM extensions
2400 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2401   dx2, mgd, mgh.
2403 • DMG cartridge ROMs: dmg, gb.
2405 • GBC cartridge ROMs: cgb, gbc.
2407 14 Gamepack files
2409 • The first line must be: “[GAMEPACK FILE]”.
2411 • There is one needed line: “type <systype>”. This sets system 
2412   type to <systype>. The following system types are valid:
2414   – snes (SNES)
2416   – bsx (BS-X non-slotted)
2418   – bsxslotted (BS-X slotted)
2420   – sufamiturbo (Sufami Turbo)
2422   – sgb (Super Game Boy)
2424   – dmg (Game Boy)
2426   – gbc (Game Boy Color)
2428   – gbc_gba (Game Boy Color with GBA initial register values)
2430 • Optionally a region can be specified: “region <region>”. The 
2431   following values are valid:
2433   – autodetect (Autodetect region: snes and sgb only)
2435   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2437   – pal (PAL: snes, sgb)
2439   – world (World: dmg, gbc, gbc_gba)
2441 • ROM images are loaded as: “rom <type> <file>”. The following 
2442   types are valid:
2444   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2445     bsxslotted, sufamiturbo)
2447   – bsx (Cartridge ROM in bsx, bsxslotted)
2449   – slot-a (Cartridge ROM in sufamiturbo)
2451   – slot-b (Cartridge ROM in sufamiturbo)
2453 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2454   valid are the same as for ROMs.
2456 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2457   types are the same as for ROMs.
2459   – Offset is given in form [+-]<number>. Usually offset is 
2460     either +0 or -512.
2462   – Default offset is +0.
2464 14.1 Example:
2466 [GAMEPACK FILE]
2468 type snes
2470 rom rom speedygonzales.sfc
2472 patch-512 rom sonicthehedgehog.ips
2474 14.2 Example 2:
2476 [GAMEPACK FILE]
2478 type sgb
2480 rom rom supergameboy.sfc
2482 rom dmg megamanV.dmg
2484 15 Quick'n'dirty encode guide
2486 1. Start the emulator and load the ROM and movie file.
2488 2. Set large AVI option 'set-setting avi-large on'
2490 3. Enable dumping 'dump-avi tmpdump' 
2492 4. Unpause and let it run until you want to end dumping.
2494 5. Close the emulator (closing the window is the easiest way). Or 
2495   use 'end-avi'.
2497 6. For each tmpdump*.avi file created, on command prompt, do 
2498   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2500 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2502 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2503   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2504   tmpdump_<numbers>.mkv, with + in between).
2506 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2507   final.mkv contains quick'n'dirty encode.
2509 16 Axis configurations for some gamepad types:
2511 16.1 XBox360 controller:
2513 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2514 set to pressure-+.
2516 set-axis joystick0axis2 pressure-+
2518 set-axis joystick0axis5 pressure-+
2520 • This is needed for SDL only. EVDEV sets those types correctly.
2522 16.2 PS3 “sixaxis” controller:
2524 Axes 8-19 should be disabled.
2526 set-axis joystick0axis8 disabled
2528 set-axis joystick0axis9 disabled
2530 set-axis joystick0axis10 disabled
2532 set-axis joystick0axis11 disabled
2534 set-axis joystick0axis12 disabled
2536 set-axis joystick0axis13 disabled
2538 set-axis joystick0axis14 disabled
2540 set-axis joystick0axis15 disabled
2542 set-axis joystick0axis16 disabled
2544 set-axis joystick0axis17 disabled
2546 set-axis joystick0axis18 disabled
2548 set-axis joystick0axis19 disabled
2550 17 Errata:
2552 17.1 Problems from BSNES core:
2554 • The whole pending save stuff.
2556 • Lack of layer hiding.
2558 • It is slow (especially accuracy).
2560 • Firmwares can't be loaded from ZIP archives.
2562 17.2 Other problems:
2564 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2566 • Audio for last dumped frame is not itself dumped.
2568 • Audio in UI is pretty bad in quality if game doesn't run at 
2569   full speed.
2571 • No menus, command based interface (SDL).
2573 • Long commands don't scroll.
2575 18 Changelog:
2577 18.1 rr0-beta1
2579 • Fix -Wall warnings
2581 • Fix dumper video corruption with levels 10-18.
2583 18.2 rr0-beta2
2585 • Autofire
2587 • Lots of code cleanups
2589 • Lua interface to settings
2591 • Allow specifying AVI borders without Lua
2593 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2595 • on_snoop lua callback
2597 • Faster movie loading and saving.
2599 18.3 rr0-beta3
2601 • Joystick support
2603 18.4 rr0-beta4
2605 • Fix multi-buttons
2607 • Save jukebox functionality.
2609 18.5 rr0-beta5
2611 • Try to fix some nasty failing movie load edge cases
2613 • Allow specifying scripts to run on command line.
2615 18.6 rr0-beta6
2617 • Major source code reorganization.
2619 • Backup savestates before overwriting.
2621 • Don't crash if loading initial state fails.
2623 18.7 rr0-beta7
2625 • Fix firmware lookup
2627 • Fix author name parsing
2629 • Fix rerecord counting
2631 • (SDL) Print messages to console if SDL is uninitialized
2633 • Add movieinfo program
2635 • Fix loading movies starting from SRAM.
2637 18.8 rr0-beta8
2639 • Add support for unattended dumping
2641 • Fix compiling for Win32
2643 • Don't lock up if sound can't be initialized
2645 • Strip trailing CR from commands
2647 • Don't try to do dubious things in global ctors (fix crash on 
2648   startup)
2650 18.9 rr0-beta9
2652 • Small documentation tweaking
2654 • Fix make clean
2656 • Fix major bug in modifier matching
2658 18.10 rr0-beta10
2660 • Lots of documentation fixes
2662 • Use dedicated callbacks for event backcomm., not commands.
2664 • Ensure that the watchdog is not hit when executing delayed 
2665   reset.
2667 • Remove errant tab from joystick message.
2669 18.11 rr0-beta11
2671 • Make autofire operate in absolute time, not linear time
2673 • Reinitialize controls when resuming from loadstate
2675 • Some more code cleanups
2677 • If Lua allocator fails, call OOM_panic()
2679 • Byte/word/dword/qword sized host memory write/read functions.
2681 • Dump at correct framerate if dumping interlaced NTSC 
2682   (height=448).
2684 18.12 rr0-beta12
2686 • Actually include the complete source code
2688 • Keep track of RTC
2690 18.13 rr0-beta13
2692 • Document {save,start}time.{,sub}second.
2694 • Intercept time() from bsnes core.
2696 18.14 rr0-beta14
2698 • Allow disabling time() interception (allow build on Mac OS X)
2700 • Use SDLMain on Mac OS X (make SDL not crash)
2702 • Disable delayed resets (just plain too buggy for now).
2704 • Code cleanups
2706 • Use 16-bit for graphics/video instead of 32-bit.
2708 • gui.rectangle/gui.pixel
2710 • gui.crosshair
2712 • New CSCD writer implementation.
2714 18.15 rr0-beta15
2716 • Fix interaction of * and +.
2718 • Manual improvements
2720 • Use gettimeofday()/usleep(), these seem portable enough.
2722 • Move joystick axis manipulation to keymapper code.
2724 • Changes to how read-only works.
2726 • Refactor controller input code.
2728 18.16 rr0-beta16
2730 • Fix mouseclick scale compensation.
2732 • Draw area boundaries correctly in SDL code.
2734 • gui.screenshot.
2736 • Fix CSCD output (buffer overrun and race condition).
2738 18.17 rr0-beta17
2740 • JMD dumping support.
2742 • Allow unattended dumping to JMD.
2744 • Move to BSNES v083.
2746 • Switch back to 32-bit colors.
2748 • Add Lua function gui.color.
2750 • Use some new C++11 features in GCC 4.6.
2752 • Be prepared for core frequency changes.
2754 • Pass colors in one chunk from Lua.
2756 18.18 rr0-beta18
2758 • New lua functions gui.line(), gui.status() and gui.circle(), 
2759   memory.vma_count(), memory.read_vma() and memory.find_vma().
2761 • Numerious documentation fixups
2763 • RTC time format changed
2765 • Reformat flags display
2767 • Allow lua package name to be overridden
2769 • SDUMP (high-quality dumping).
2771 • Split platform support to plugins.
2773 • Make all sound plugins support basic sound commands
2775 • Support portaudio for sound.
2777 • Allow disable Lua/SDL searching.
2779 • Upconvert colors when copying lcscreen to screen.
2781 • Reorganize source tree.
2783 • Evdev joystick support.
2785 • Refactor more code into generic window code.
2787 18.19 rr0-beta19
2789 • Refactor message handling.
2791 • Rework makefile
2793 • Documentation fixes
2795 • Finish pending saves before load/quit.
2797 • Wxwidgets graphics plugin.
2799 18.20 rr0-beta20
2801 • Get rid of win32-crap.[ch]pp.
2803 • Move files around a lot.
2805 • Get rid of need for host C++ compiler.
2807 • Bsnes v084 core.
2809 • Refactor inter-component communication.
2811 • Fix zero luma.
2813 • Fix crash on multiline aliases.
2815 • Load/Save settings in wxwidgets gui.
2817 18.21 rr0-beta21
2819 • Patch problems in bsnes core
2821 • SNES is little-endian, not big-endian!
2823 • Fix memory corruption in lcscreen::load()
2825 18.22 rr0-beta22
2827 • Fix interpretting repeat counts in rrdata loading.
2829 • New lua callback: on_frame()
2831 • Remove calls to runtosave() that aren't supposed to be there
2833 • Lua function: movie.read_rtc()
2835 • Ignore src/fonts/font.cpp
2837 • Fix more bsnes core problems
2839 • Control bsnes random seeding
2841 • Pause-on-end
2843 • Some bsnes core debugging features (state dump and state hash)
2845 • Fix titlebar version number (no, the last version wasn't 
2846   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2848 18.23 rr0-beta23
2850 • Fix memory corruption due to macro/field mixup
2852 • search-memory update
2854 • Allow direct-mapped framebuffer
2856 • SDL: Use SDL_ANYFORMAT if possible
2858 • SDMP2SOX: 2s delay modes.
2860 • Wxwidgets: Cleanups
2862 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2864 • Wxwidgets: Save jukebox on exit
2866 • Fix RTC if using load-movie on savestate.
2868 • Fix crash related to full console mode.
2870 18.24 rr0-beta24
2872 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2873   X.
2875 • Wxwidgets: Allow compiling on Mac OS X.
2877 • Use movie compare instead of movie hashing (faster save/load).
2879 • Lua: _SYSTEM table.
2881 18.25 rr0-beta25
2883 • sdmp2sox: Pad soundtrack if using -l or -L.
2885 • sdmp2sox: Fix NTSC overscan.
2887 • sdmp2sox: Add AR correction mode.
2889 • call lua_close() when exiting.
2891 • Fix zip_writer bug causing warnings from info-zip and error 
2892   from advzip.
2894 18.26 rr0-beta26
2896 • Fix IPS patching code (use bsnes core IPS patcher).
2898 • Implement BPS patching (using bsnes core IPS patcher).
2900 • Add feature to load headered ROMs.
2902 18.27 rr0-beta27
2904 • Show command names when showing keybindings
2906 18.28 rr0
2908 • Fix pause-on-end to be actually controllable
2910 • SDL: Poll all events in queue, not just first one (fixes 
2911   slowness in command typing)
2913 • Wxwidgets: Fix ROM loading.
2915 18.29 rr1-beta0
2917 • Lua: Add gui.textH, gui.textV, gui.textHV
2919 • Fix text colors on SDL on Mac OS X
2921 • Mode 'F' for finished in readonly mode.
2923 • Fix some WS errors.
2925 • Reliably pause after skip poll
2927 • Split UI and core into their own threads
2929 18.30 rr1-beta1
2931 • Remove leftover dummy SRAM slot
2933 • Fix controller numbers.
2935 18.31 rr1-beta2
2937 • Fix lsnes-dumpavi after interface change.
2939 • Also give BSNES patches for v085.
2941 • Pack movie data in memory.
2943 18.32 rr1-beta3
2945 • Fix framecount/length given when loading movies.
2947 • Controller command memory leak fixes.
2949 • Don't leak palette if freeing screen object.
2951 18.33 rr1-beta4
2953 • Detect revisions.
2955 • Wxwidgets: Allow controlling dumper from the menu.
2957 18.34 rr1-beta5
2959 • Rewrite parts of manual
2961 • Lua: Make it work with Lua 5.2.
2963 18.35 rr1-beta6
2965 • Win32: Fix compile errors.
2967 18.36 rr1-beta7
2969 • Refactor controller input code.
2971 • Fix crash when using command line on SDL / Mac OS X.
2973 18.37 rr1-beta8
2975 • Delete core/coroutine (obsolete)
2977 • Lag input display by one frame.
2979 • Rewind movie to beginning function.
2981 • Fix wrong frame number reported to Lua when repainting after 
2982   loadstate
2984 • Support UI editing of jukebox
2986 • Wxwidgets: Save settings on exit.
2988 • Support ${project} for filenames
2990 • SDL: Fix command history
2992 18.38 rr1-beta9
2994 • Fix some order-of-global-ctor bugs.
2996 18.39 rr1-beta10
2998 • Fix crashes when quitting on Win32.
3000 18.40 rr1-beta11
3002 • EVDEV: Queue keypresses from joystick, don't send directly
3004 • Wxwidgets: Load-Preserve that actually works.
3006 18.41 rr1-beta12
3008 • Wxwidgets: GUI for memory search.
3010 • Warn about using synchronous queue in UI callback.
3012 18.42 rr1-beta13
3014 • Remember last saved file for each ROM
3016 • Support MT dumping via boost.
3018 • Lua: input.raw
3020 • Lua: input.keyhook
3022 • Make mouse be ordinary input instead of special-casing
3024 • SDL: Don't screw up commands with NUL codepoints.
3026 18.43 rr1-beta14
3028 • Merge status panel and main window
3030 • True movie slot support (the rest of it)
3032 • SDL: Fix compilation error
3034 • Elminate cross calls in dump menu code.
3036 18.44 rr1-beta15
3038 • Cancel pending saves command
3040 • Wxwidgets: Code refactoring
3042 • Wxwidgets: Fix system -> reset
3044 • Wxwidgets: Read watch expressions in the right thread
3046 18.45 rr1-beta16
3048 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
3049   doesn't support that).
3051 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
3052   needed).
3054 • Don't append trailing '-' to prefix when saving movie.
3056 • Fix ROM/savestate handling (don't let user mismatch ROM and 
3057   savestates).
3059 18.46 rr1
3061 • Document memory watch syntax.
3063 18.47 rr1-delta1
3065 • Fix unattended dumping (lsnes-dumpavi)
3067 • Support RAW dumping
3069 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
3070   (changes syntax)
3072 • Add option to control sample rate preturbation in AVI dumper
3074 18.48 rr1-delta2
3076 • Wxwidgets: Fix dumper submodes
3078 • Set core controller types before loadstate
3080 18.49 rr1-delta2epsilon1
3082 • Fix compiling with bsnes v086.
3084 18.50 rr1-delta3
3086 • Don't prompt before quitting
3088 • Start unpaused, preserve pause/unpause over load.
3090 • Try to autodetect if ROM is headered.
3092 • Wxwidgets: Only bring up ROM patching screen if specifically 
3093   requested.
3095 • Allow configuring some hotkeys.
3097 18.51 rr1-delta4
3099 • Lots of code cleanups
3101 • Fix JMD compression (JMD dumping was broken)
3103 • Don't crash if Lua C function throws an exception.
3105 • Support bitmap drawing in Lua.
3107 • Fix bsnes v085/v086 patches.
3109 • Improve stability on win32.
3111 18.52 rr1-delta4epsilon1
3113 • Don't corrupt movie if movie length is integer multiple of 
3114   frames per page.
3116 18.53 rr1-delta5
3118 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
3120 • New Lua functions: emulator_ready(), utime(), 
3121   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
3122   bit.value(), input.geta(), input.seta() and 
3123   input.controllertype()
3125 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
3127 • Wxwidgets: Fix broken modifiers
3129 • on_paint has parameter now.
3131 • Optional initital fill for bitmaps
3133 • Fix palette changing.
3135 • Optimize rendering a bit.
3137 • Bsnes v087 support.
3139 18.54 rr1-delta5epsilon1
3141 • Movieinfo: Fix display of port #2 type.
3143 • Call on_input() after loadstate.
3145 18.55 rr1-delta5epsilon2
3147 • Fix writing port2 data to movie.
3149 • Fix SRAM handling with Bsnes v087.
3151 18.56 rr1-delta6
3153 • Library loading support
3155 • Built-in TSCC encoder
3157 • Hi-color (256T colors) dumping.
3159 • Dump over TCP/IP(v6)
3161 • Hidable status panel
3163 • Turbo toggle/hold
3165 • Adjustable sound volume
3167 • Screen scaling
3169 • Allow DnD into filename boxes
3171 • Configurable paths
3173 • Portaudio: Fix speaker popping at start
3175 • Lots of UI changes
3177 • Speed adjustment menu
3179 • Win32 joystick support
3181 • Lua: gui.rainbow and gui.box
3183 • Split key lists into classes (the key list was large!)
3185 • More save slots support
3187 • Wxwidgets (wxJoystick) joystick support
3189 18.57 rr1-delta7
3191 • Lots of internal joystick refactoring
3193 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3195 • Wxwidgets: Settings mode (open settings without ROM)
3197 • Wxwidgets: Prompt key to use option
3199 • Wxwidgets: Fix crash if key goes away underneath
3201 • Wxwidgets: Fix mouse position in presence of scaling
3203 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3204   using SRC)
3206 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3207   control doesn't seem to work well on WinXP)
3209 • Start paused option.
3211 18.58 rr1-delta7epsilon1
3213 • AVI: ZMBV support
3215 • lsnes-dumpavi: Start Lua before starting dumper
3217 • AVI: Fix secondary audio in mode 4.
3219 18.59 rr1-delta7epsilon2
3221 • AVI: Refactor ZMBV a bit.
3223 • Fix error reading analog values from movie file
3225 18.60 rr1-delta8
3227 • Delayed reset support
3229 • Lua: memory.hash_region
3231 18.61 rr1-delta8epsilon1
3233 • Rework the build system
3235 • Typing input support
3237 • Fix building with bsnes v086 and v087.
3239 • SDL: Save settings on exit
3241 • SDL: Command to enter command line mode with given command.
3243 • SDL: More advanced command editing.
3245 18.62 rr1-delta9
3247 • wxMSW: Fix the “arrow keys and enter don't work” problem
3249 • MSU-1 support
3251 • Show mode changes due to rewinding.
3253 • Unsafe rewind support
3255 • Fix directory transversal.
3257 18.63 rr1-delta10
3259 • AVI: Sound mode 5 (48kHz high-quality)
3261 • Lua: Reset Lua VM
3263 • Map the SNES bus into address space
3265 • Fix loading memory watch files with CRLF line endings
3267 18.64 rr1-delta10epsilon1
3269 • Map bsnes internal state into memory space
3271 • Fix the “click on panel wedges the emulator” for real.
3273 • DnD movies/saves on the main window.
3275 18.65 rr1-delta11
3277 • Split core bindings into own module.
3279 • Remember invalid settings
3281 • Support for modified Gambatte core for GB/GBC emulation.
3283 • Reload/swap ROM function
3285 18.66 rr1-delta11epsilon1
3287 • Fix step poll function
3289 18.67 rr1-delta12
3291 • Non-insane savestate anchoring
3293 18.68 rr1-delta13
3295 • More Memory search methods
3297 • Preserve movie if loading in RO mode.
3299 • Fix a obscure case in timeline check
3301 • Revamp the entiere ROM loading code
3303 • Support DnD on ROMs
3305 • Revamp menu layout
3307 • Standalone hotkey config dialog
3309 • Show bindings in more user-friendly format
3311 18.69 rr1-delta13epsilon1
3313 • Pipedec support
3315 • Fix uninitialized variables in bsnes v085
3317 18.70 rr1-delta14
3319 • Merge gambatte core into mainline (from its own branch)
3321 • Wxwidgets: Show expected dump file formats
3323 • Memory watch: Data typing
3325 • lsnes internal MMIO area.
3327 • Wxwidgets: New memory watch editor
3329 • Hexadecimal memory watches
3331 • Wxwidgets: Monospaced panel
3333 • Wxwidgets: Split memory watches in panel
3335 • Wxwidgets: Disable VMAs in memory search
3337 • lsnes-dumpavi: Fix speed bug
3339 • Movie subtitle support
3341 • Fix rerecord count reporting
3343 • Don't trash movie when loading in readonly mode.
3345 18.71 rr1-delta14epsilon1
3347 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3349 • Fix build on Mac OS X.
3351 • Lua: loopwrapper
3353 • Wxwidgets: Hidable messages window
3355 • Lua: input.joyset
3357 • Bsnes: Support inconsistent saves
3359 • Bsnes: Allow simulating saving every frame
3361 • Fix desync if savestate is loaded in readonly mode in certain 
3362   conditions.
3364 • Wxwidgets: Fix save dialogs on Mac OS X.
3366 • Wxwidgets: Fix insane status width on Win32.
3368 • Wxwidgets: Fix autohold processing to be faster.
3370 • Wxwidgets: Allow loading ROMs and movies from commandline.
3372 18.72 rr1-delta15
3374 • Be a bit smarter with --load
3376 • Rewrote higher-level parts of audio system
3378 • Tool to build commentary tracks
3380 • Lua: input.joyget
3382 • Gambatte: Add support for SVN358
3384 • Use builtin font when rendering status panel.
3386 • Option to detach memory watch to its own window.
3388 • Recent ROMs/Movies menu
3390 • Libao support
3392 • Useful lag counter for SNES games that autopoll
3394 • Fix buffer overflow in gambatte sound output
3396 18.73 rr1-delta15epsilon1
3398 • Don't blow up on wxGTK if the window is hidden somehow
3400 • Support simultaneous drop of ROM and movie.
3402 • Gambatte: Don't save spurious SRAMs.
3404 • Make SGB ROMs actually usable.
3406 • Fix so that saved movies appear in recent movies.
3408 • Don't open multiple commentary editors at once.
3410 18.74 rr1-delta15epsilon2
3412 • Lua: memory.readregion/memory.writeregion
3414 • Lua: memory.map{,s}{byte,word,dword,qword}
3416 • Lua: memory.map_structure
3418 • Lua: Fix bus_address for gambatte
3420 • Fix features dependent of bsnes debugger
3422 • Cleanup bsnes debugger logic
3424 • Fix resets in presence of save every frame
3426 18.75 rr1-delta15epsilon3
3428 • Lua: input.lcid_to_pcid
3430 • Fix off-by-one bug with slot hashes
3432 • Fix crashes on certain memory watch expressions
3434 • Lua: memory.read_expr
3436 • Lua: Fix memory.read_expr on nil argument
3438 • Fix the code to compile on G++ 4.7
3440 • Change button_id to be a function pointer field, not a virtual 
3441   method
3443 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3445 • Gambatte: Always use legacy lag counting
3447 • Memory commands: Memory addresses are up to 16 hex digits, not 
3448   up to 8
3450 • Fix analog controllers
3452 • Fix autohold menus
3454 • Fix button symbols in input display
3456 • Compensate for nuts bsnes superscope/justifier handling
3458 • Lua: Fix bit.extract boolean handling