Fix bug causing ext0...ext3 to sometimes appear pressed on 12btn gamepad
[lsnes.git] / manual.txt
bloba72d31b4c21d4ceec3cd53cdb18c85a3ed0bd9d5
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 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 Wxwidgets options
70 4.1.1 --rom=<file>
72 Load <file> as ROM.
74 4.1.2 <file>
76 Load <file> as ROM.
78 4.1.3 --load=<file>
80 Load <file> as movie or savestate file on startup.
82 4.1.4 --settings
84 Instead of starting the emulator, only display the settings.
86 4.1.5 --lua=<file>
88 Run this Lua file on startup
90 4.2 dump options (lsnes-dumpavi only)
92 4.2.1 --rom=<file>
94 Load <file> as ROM. Required.
96 4.2.2 <filename>
98 Load <filename> as movie or savestate file on startup. Required.
100 4.2.3 --dumper=<dumper>
102 Set the dumper to use (required). Use 'list' for listing of known 
103 dumpers.
105 4.2.4 --firmware-path=<path>
107 Set path to look for firmware.
109 4.2.5 --mode=<mode>
111 Set the mode to use (required for dumpers with multiple modes, 
112 forbidden otherwise). Use 'list' for known modes.
114 4.2.6 --prefix=<prefix>
116 Set dump prefix. Default is “avidump”.
118 4.2.7 --option=<name>=<value>
120 Set option <name> to value <value>.
122 4.2.8 --length=<length>
124 Set number of frames to dump. Mandatory.
126 4.2.9 --lua=<script>
128 Run specified lua script (lsnes-dumpavi does not have 
129 initialization files).
131 4.2.10 --load-library=<library>
133 Load the specified shared object / dynamic library / dynamic link 
134 library.
136 4.3 lsnes settings directory
138 The lsnes settings directory is (in order of decreasing 
139 perference):
141 • Windows: %APPDATA%\lsnes (if %APPDATA% exists)
143 • Unix: $XDG_CONFIG_HOME/lsnes (if $XDG_CONFIG_HOME exists)
145 • Unix: $HOME/.config/lsnes (if $HOME exists)
147 • All: . (fallback default).
149 If leading directories do not exist, attempt to create them is 
150 made.
152 5 Internal commands
154 • Commands beginning with '*' invoke the corresponding command 
155   without alias expansion.
157 • If command starts with '+' (after possible '*'), the command is 
158   executed as-is when button is pressed, and when button is 
159   released, it is executed with '+' replaced by '-'.
161 • Commands without '+' execute only on negative edge (release).
163 5.1 run-script <script>
165 Run <script> as if commands were entered on the command line.
167 5.2 Memory manipulation
169 <address> may be decimal or hexadecimal (prefixed with '0x'). 
170 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
171 signed (prefixed with '-') decimal.
173 The available element <sizes> are:
175 • byte: 1 byte
177 • word: 2 bytes
179 • dword: 4 bytes
181 • qword: 8 bytes
183 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
184 When dealing with DSP memory, multi-byte reads/writes are 
185 native-endian (do not use operand sizes exceeding DSP bitness, 
186 except dword is OK for 24-bit memory).
188 5.2.1 read-<size> <address>
190 Read the value of byte in <address>.
192 5.2.2 read-s<size> <address>
194 Read the value of signed byte in <address>.
196 5.2.3 write-<size> <address> <value>
198 Write <value> to byte in address <address>.
200 5.3 Main commands
202 These commands are not available in lsnesrc, but are available 
203 after ROM has been loaded.
205 5.3.1 quit-emulator
207 Quits the emulator.
209 5.3.2 pause-emulator
211 Toggle paused/unpaused
213 5.3.3 +advance-frame 
215 Advance frame. If the button is still held after configurable 
216 timeout expires, game unpauses for the duration frame advance is 
217 held.
219 5.3.4 +advance-poll 
221 Advance subframe. If the button is still held after configurable 
222 timeout expires, game unpauses for the duration frame advance is 
223 held.
225 5.3.5 advance-skiplag 
227 Skip to first poll in frame after current.
229 5.3.6 reset 
231 Reset the SNES after this frame.
233 5.3.7 load <filename> 
235 Load savestate <filename> in current mode.
237 5.3.8 load-state <filename> 
239 Load savestate <filename> in readwrite mode.
241 5.3.9 load-readonly <filename> 
243 Load savestate <filename> in readonly mode.
245 5.3.10 load-preserve <filename> 
247 Load savestate <filename> in readonly mode, preserving current 
248 events.
250 5.3.11 load-movie <filename> 
252 Load savestate <filename>, ignoring save part in readonly mode.
254 5.3.12 save-state <filename> 
256 Save system state to <filename> as soon as possible.
258 5.3.13 save-movie <filename> 
260 Save movie to <filename>.
262 5.3.14 set-rwmode 
264 Set read-write mode.
266 5.3.15 set-romode 
268 Set read-only mode
270 5.3.16 toggle-rwmode 
272 Toggle between read-only and read-write modes.
274 5.3.17 test-1, test-2, test-3
276 Internal test commands. Don't use.
278 5.3.18 take-screenshot <filename> 
280 Save screenshot to <filename>.
282 5.3.19 +controller <class>-<#>-<button>
284 Press button <button> on controller <num> of class <class>.
286 • Class 'gamepad': A, B, X, Y, L, R, select, start, up, down, 
287   left, right, ext0, ext1, ext2, ext3
289 • Class 'mouse': L, R
291 • Class 'superscope': trigger, cursor, turbo, pause
293 • Class 'justifier': trigger, start
295 • Class 'gb': A, B, select, start, up, down, left, right
297 5.3.20 hold-controller <class>-<#>-<button>
299 Hold/unhold button <button> on controller <num> of class <class>.
301 5.3.21 type-controller <class>-<#>-<button>
303 Hold/unhold button <button> on controller <num> of class <class> 
304 for the next frame. See +controller for button names.
306 Cauntion: Does not work properly if outside frame advance.
308 5.3.22 +autofire-controller <class>-<#>-<button> [[<duty>] 
309   <cyclelen>]
311 Start autofire. If duty is not specified, defaults to 1. If 
312 <cyclelen> is not specified, defaults to 2.
314 5.3.23 -autofire-controller <class>-<#>-<button> [[<duty>] 
315   <cyclelen>]
317 End autofire.
319 5.3.24 autofire-controller <class>-<#>-<button> [[<duty>] 
320   <cyclelen>]
322 Toggle autofire. If autofire is turned on, specified cycle is 
323 used.
325 5.3.25 designate-position <class>-<#>-analog<n>
327 Designate position for analog pair. <n> is only there if there 
328 are multiple axis pairs.
330 5.3.26 repaint
332 Force a repaint.
334 5.3.27 toggle-pause-on-end
336 Toggle pause on end flag.
338 5.3.28 set-pause-on-end
340 Set pause on end flag.
342 5.3.29 clear-pause-on-end
344 Clear pause on end flag.
346 5.4 Save jukebox 
348 5.4.1 cycle-jukebox-backward
350 Cycle save jukebox backwards.
352 5.4.2 cycle-jukebox-forward
354 Cycle save jukebox forwards
356 5.4.3 load-jukebox
358 Do load from jukebox (current mode).
360 5.4.4 save-jukebox
362 Do state save to jukebox.
364 5.5 Lua 
366 Only available if lua support is compiled in.
368 5.5.1 evaluate-lua <luacode>
370 Run Lua code <luacode> using built-in Lua interpretter.
372 5.5.2 run-lua <script>
374 Run specified lua file using built-in Lua interpretter.
376 5.5.3 reset-lua
378 Clear the Lua VM state and restore to factory defaults.
380 5.6 Memory watch
382 5.6.1 add-watch <name> <expression>
384 Adds new watch (or modifies old one).
386 5.6.2 remove-watch <name>
388 Remove a watch.
390 5.7 Sound 
392 5.7.1 enable-sound <on/off> 
394 Enable/Disable sound.
396 5.8 Misc.
398 5.8.1 reload-rom [<file>]
400 Reloads the main ROM image from <file>.
402 5.8.2 +tangent
404 Tangent for recording voice for commentary track. While pressed, 
405 record a stream.
407 5.8.3 advance-subframe-timeout
409 Subframe advance timeout in milliseconds. Default is 100.
411 6 Settings
413 6.1 Core settings
415 6.2 AVI dumper settings
417 6.2.1 avi-large
419 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
420 the console outputs.
422 6.2.2 avi-left-border
424 AVI dumper: Set the default left border thickness (unless lua 
425 overrides) for dumps. Range 0-8191. Default is 0.
427 6.2.3 avi-right-border
429 AVI dumper: Set the default right border thickness (unless lua 
430 overrides) for dumps. Range 0-8191. Default is 0.
432 6.2.4 avi-top-border
434 AVI dumper: Set the default top border thickness (unless lua 
435 overrides) for dumps. Range 0-8191. Default is 0.
437 6.2.5 avi-bottom-border
439 AVI dumper: Set the default bottom border thickness (unless lua 
440 overrides) for dumps. Range 0-8191. Default is 0.
442 6.2.6 avi-maxframes
444 AVI dumper: Maximum number of frames per dump segment (0 => 
445 unlimited). Range 0-999999999. Default is 0.
447 6.2.7 avi-compresison
449 AVI dumper: Compression level (0-18).
451 • Compression levels 10 and above are not compatible with stock 
452   CSCD codec.
454 • Recomended level is 7.
456 6.2.8 avi-soundrate
458 AVI dumper: Set method of determining the sound rate.
460 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
461   64, 88.2, 96, 128, 176.4 and 192 kHz.
463 • 1: Round down to nearest integer.
465 • 2: Round up to nearest ingeter.
467 • 3: Multiply by denominator.
469 • 4: High quality 44.1kHz (SRC needed).
471 • 5: High quality 48kHz (SRC needed).
473 6.3 JMD options
475 6.3.1 jmd-compression
477 JMD dumper: Compression level (0-9).
479 7 Lua functions
481 7.1 Core (in main table)
483 7.1.1 print
485 Print line to message console.
487 7.1.2 exec(string command)
489 Run command as it was entered on the command line
491 7.1.3 utime()
493 Returns two values. First is time since some epoch in seconds, 
494 the second is microseconds mod 10^6 since that epoch.
496 7.1.4 emulator_ready()
498 Returns true if emulator has finished booting, false if not 
499 (on_startup() will be issued later).
501 7.1.5 set_idle_timeout(number timeout)
503 Set number of microseconds to block idle for. After this timeout 
504 has expired, on_idle() will be called once.
506 7.1.6 set_timer_timeout(number timeout)
508 Set number of microseconds to block timer for. After this timeout 
509 has expired, on_timer() will be called once.
511 7.1.7 bus_address(number snesaddr)
513 Returns virtual address corresponding to specified address on 
514 SNES bus.
516 7.1.8 loopwrapper(function fun, ...)
518 Calls function fun with function and specified arguments. The 
519 function passed suspends execution until the function returned is 
520 called. Handy for linear flow control among multiple invocations 
521 of a hook. Example code:
523 on_paint = loopwrapper(function(wait)
525   while true do
527     gui.text(0, 0, “Test!”);
529     wait();
531   end
533 end);
535 7.1.9 list_bindings([string cmd])
537 Get table of all keybindings, indexed by keyspec 
538 (modifiers|mask/key). If command is specified, the table is 
539 limited to that command. Also searches for controller keys.
541 7.1.10 get_alias(string aname)
543 Get expansion of given alias.
545 7.1.11 set_alias(string aname, string value)
547 Set expansion of given alias.
549 7.1.12 create_ibind(string name, string cmd)
551 Return object representing inverse binding with specified name 
552 and specified command.
554 • To create press/release commands, use aliases +foo and -foo .
556 • Keep the returned object around.
558 7.1.13 create_command(string name, function a[, function b])
560 Return object representing a command (pair).
562 • If b is NIL, the command is level-sensitive, a is callback.
564 • If b is function, the function is edge-sensitive, a is positive 
565   edge callback and b is negative edge callback.
567 • All callbacks get single argument: The parameters passed.
569 • Keep the returned object around.
571 7.2 Table bit:
573 Bitwise logical functions and related.
575 7.2.1 bit.none(number...) / bit.bnot(number...)
577 48-bit bitwise NOT / NONE function (set bits that are set in none 
578 of the arguments).
580 7.2.2 bit.any(number...) / bit.bor(number...)
582 48-bit bitwise OR / ANY function (set bits that are set in any of 
583 the arguments).
585 7.2.3 bit.all(number...) / bit.band(number...)
587 48-bit bitwise AND / ALL function (set bits that are set in all 
588 of the arguments).
590 7.2.4 bit.parity(number...) / bit.bxor(number...)
592 48-bit bitwise XOR / PARITY function (set bits that are set in 
593 odd number of the arguments).
595 7.2.5 bit.lrotate(number base[, number amount[, number bits]])
597 Rotate bits-bit (max 48, default 48) number left by amount 
598 (default 1) places.
600 7.2.6 bit.rrotate(number base[, number amount[, number bits]])
602 Rotate bits-bit (max 48, default 48) number right by amount 
603 (default 1) places.
605 7.2.7 bit.lshift(number base[, number amount[, number bits]])
607 Shift bits-bit (max 48, default 48) number left by amount 
608 (default 1) places. The new bits are filled with zeroes.
610 7.2.8 bit.lrshift(number base[, number amount[, number bits]])
612 Shift bits-bit (max 48, default 48) number logically right by 
613 amount (default 1) places. The new bits are filled with zeroes.
615 7.2.9 bit.arshift(number base[, number amount[, number bits]])
617 Shift bits-bit (max 48, default 48) number arithmetically right 
618 by amount (default 1) places. The new bits are shifted in with 
619 copy of the high bit.
621 7.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
623 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
624 and so on.
626 Notes: 
628 • Bit numbers up to 51 should work reliably (then things start 
629   falling apart due to double precision issues).
631 • There are two special bit positions, true and false, standing 
632   for always set bit and always clear bit.
634 7.2.11 bit.value([number bit1[, number bit2,...]])
636 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
637 shifted by bit2 places and so on. As special value, nil argument 
638 is no-op.
640 7.2.12 bit.test_any(number a, number b)
642 Returns true if bitwise and of a and b is nonzero, otherwise 
643 false.
645 7.2.13 bit.test_all(number a, number b)
647 Returns true if bitwise and of a and b is equals b, otherwise 
648 false.
650 7.2.14 bit.popcount(number a)
652 Returns number of set bits in a.
654 7.2.15 bit.clshift(number a, number b, [number amount,[number 
655   bits]])
657 Does chained left shift on a, b by amount positions, assuming 
658 numbers to be of specified number of bits.
660 7.2.16 bit.crshift(number a, number b, [number amount,[number 
661   bits]])
663 Does chained right shift on a, b by amount positions, assuming 
664 numbers to be of specified number of bits.
666 7.2.17 bit.flagdecode(number a, number bits, [string on, [string 
667   off]])
669 Return string of length bits where ith character is ith character 
670 of on if bit i is on, otherwise ith character of off. Out of 
671 range reads give last character, or '*'/'-' if empty.
673 7.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
674   off]])
676 Like bit.flagdecode, but outputs the string in the opposite order 
677 (most significant bit first).
679 7.3 Table gui:
681 Most of these functions can only be called in on_paint and 
682 on_video callbacks. Exceptions are noted.
684 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
685 the green component, bits 16-23 are the red component, bits 24-31 
686 are alpha component (0 is fully opaque, 255 is almost 
687 transparent). -1 is the fully transparent color. Alpha values 
688 greater than 127 do work.
690 Origin of coordinates is at top left corner of game display area. 
691 Left and top gaps correspond to negative coordinates.
693 7.3.1 gui.resolution()
695 Returns 2-tuple (hresolution, vresolution).
697 7.3.2 gui.<class>_gap(number gap)
699 Set the <class> (left, right, top, bottom) gap to specified value 
700 (max gap is 8191).
702 7.3.3 gui.text(number x, number y, string text[, number fgc[, 
703   number bgc]])
705 Draw specified text on the GUI (each character cell is 8 or 16 
706 wide and 16 high). Parameters:
708 • x: X-coordinate to start the drawing from (and x-coordinate at 
709   begining of the lines).
711 • y: Y-coordinate to start the drawing from.
713 • text: The text to draw.
715 • fgc: Text color (default is 0xFFFFFF (white))
717 • bgc: Background color (default is -1 (transparent))
719 7.3.4 gui.textH(number x, number y, string text[, number fgc[, 
720   number bgc]])
722 Like gui.text, but draw using double-width.
724 7.3.5 gui.textV(number x, number y, string text[, number fgc[, 
725   number bgc]])
727 Like gui.text, but draw using double-height.
729 7.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
730   number bgc]])
732 Like gui.text, but draw using double-width/double-height.
734 7.3.7 gui.rectangle(number x, number y, number width, number 
735   height[, number thickness[, number outline[, number fill]]])
737 Draw rectangle on the GUI. Parameters:
739 • x: X-coordinate of left edge.
741 • y: Y-coordinate of upper edge.
743 • width: Width of rectangle.
745 • height: Height of rectangle.
747 • thickness: Thickness of outline (default is 1).
749 • outline: Color of outline (default is 0xFFFFFF (white))
751 • fill: Color of fill (default is -1 (transparent))
753 7.3.8 gui.box(number x, number y, number width, number height[, 
754   number thickness[, number outline1[,number outline2[, number 
755   fill]]]])
757 Draw rectangle with 3D effect on the GUI. Parameters:
759 • x: X-coordinate of left edge.
761 • y: Y-coordinate of upper edge.
763 • width: Width of rectangle.
765 • height: Height of rectangle.
767 • thickness: Thickness of outline (default is 1).
769 • outline1: First color of outline (default is 0xFFFFFF (white))
771 • outline2: First color of outline (default is 0x808080 (dark 
772   gray))
774 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
776 7.3.9 gui.pixel(number x, number y[, number color])
778 Draw one pixel on the GUI. Parameters:
780 • x: X-coordinate of the pixel
782 • y: Y-coordinate of the pixel
784 • color: Color of the pixel (default is 0xFFFFFF (white))
786 7.3.10 gui.crosshair(number x, number y[, number length[, number 
787   color]])
789 Draw a crosshair. Parameters:
791 • x: X-coordinate of the crosshair
793 • y: Y-coordinate of the crosshair
795 • length: Length of the crosshair lines (default 10).
797 • color: Color of the crosshair (default is 0xFFFFFF (white))
799 7.3.11 gui.line(number x1, number y1, number x2, number y2[, 
800   number color])
802 Draw a thin line. Parameters:
804 • x1: X-coordinate of one end.
806 • y1: Y-coordinate of one end.
808 • x2: X-coordinate of the other end.
810 • y2: Y-coordinate of the other end.
812 • color: Color of the line (default is 0xFFFFFF (white)).
814 7.3.12 gui.circle(number x, number y, number r[, number thick[, 
815   number border[, number fil]]])
817 Draw a circle. Parameters.
819 • x: X-coordinate of the center
821 • y: Y-coordinate of the center
823 • r: The radius of the circle
825 • thick: Border thickness
827 • border: Border color (default is 0xFFFFFF (white))
829 • fill: Fill color (default is -1 (transparent)).
831 7.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
832   palette)
834 Draw a bitmap on screen with specified palette. Parameters:
836 • x: X-coordinate of left edge.
838 • y: Y-coordinate of top edge.
840 • bitmap: The bitmap to draw
842 • palette: The palette to draw the bitmap using.
844 7.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
846 Draw a bitmap on screen. Parameters:
848 • x: X-coordinate of left edge.
850 • y: Y-coordinate of top edge.
852 • bitmap: The bitmap to draw
854 7.3.15 gui.palette_new()
856 Returns a new palette (initially all transparent). Can be used 
857 anywhere.
859 7.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool 
860   icolor])
862 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
864 • w: The width of new bitmap
866 • h: The height of new bitmap
868 • direct: If true, the returned bitmap is dbitmap, otherwise 
869   bitmap.
871 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
872   DBITMAP)
874 7.3.17 gui.bitmap_load(string file)
876 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
877 is palette for bitmap). Can be used anywhere. Parameters:
879 • file: The name of file to load.
881 7.3.18 gui.palette_set(palette palette, number index, number 
882   color)
884 Sets color in palette. Can be used anywhere. Parameters:
886 • palette: The palette to manipulate
888 • index: Index of color (0-65535).
890 • color: The color value.
892 7.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
893   number color)
895 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
897 • bitmap: The bitmap to manipulate
899 • x: The x-coordinate of the pixel.
901 • y: The y-coordinate of the pixel.
903 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
904   color value.
906 7.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
908 Get size of bitmap. Can be used anywhere. Parameters:
910 • bitmap: The bitmap to query.
912 The first return is the width, the second is the height.
914 7.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
915   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
916   number ck])
918 Blit a part of bitmap to another. Can be used anywhere. 
919 Parameters:
921 • dest: Destination to blit to.
923 • dx: left edge of target
925 • dy: Top edge of target
927 • src: The source to blit from. Must be of the same type as 
928   destination.
930 • sx: left edge of source
932 • sy: Top edge of source
934 • w: Width of region
936 • h: Height of region.
938 • ck: Color key. Pixels of this color are not blitted.
940   – If bitmaps are bitmaps, this is color index of colorkey. 
941     Values outside range 0-65535 cause no key to be used as 
942     colorkey.
944   – If bitmaps are dbitmaps, this color value of colorkey.
946   – May be absent or nil for no colorkey blit.
948 7.3.22 gui.repaint()
950 Request on_repaint() to happen as soon as possible. Can be used 
951 anywhere.
953 7.3.23 gui.subframe_update(boolean on)
955 Request subframe updates (calling on_paint() on subframes) to 
956 happen (on=true) or not happen (on=false). Can be used anywhere.
958 7.3.24 gui.screenshot(string filename)
960 Write PNG screenshot of the current frame (no drawings) to 
961 specified file. Can be used anywhere.
963 7.3.25 gui.color(number r, number g, number b[, number a])
965 Returns color (in notation Lua scripts use) corresponding to 
966 color (r,g,b), each component in scale 0-255. If a is specified, 
967 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
968 The default alpha is 256.
970 7.3.26 gui.status(string name, string value)
972 Set status field “L[<name>]” to <value> in status area. Can be 
973 used anywhere.
975 7.3.27 gui.rainbow(number step, number steps[, number color])
977 Perform hue rotation of color <color> (default bright red), by 
978 <step> steps. The number of steps per full rotation is given by 
979 absolute value of <steps>.
981 If <steps> is negative, the rotation will be counterclockwise.
983 7.3.28 gui.screenshot(string filename)
985 Saves a screenshot into specified file.
987 7.3.29 gui.renderq_new(number width, number height)
989 Create render queue with specified reported size and return it.
991 7.3.30 gui.renderq_clear(RENDERQUEUE queue)
993 Clear specified render queue.
995 7.3.31 gui.renderq_set(RENDERQUEUE queue)
997 Switch to specified render queue. Use nil as queue to switch to 
998 default queue.
1000 • When switched to another queue, all drawing functions work and 
1001   draw there, even outside on_video/on_paint.
1003 7.3.32 gui.renderq_run(RENDERQUEUE queue)
1005 Run specified render queue, copying the objects to current render 
1006 queue. 
1008 • Warning: Don't try to run the current render queue.
1010 7.3.33 gui.loadfont(string filename)
1012 Loads font from specified file (CUSTOMFONT object).
1014 7.3.34 CUSTOMFONT(number x, number y, string text[, number fgc[, 
1015   number bgc[, number hlc]]])
1017 Draw string with custom font to screen. The parameters are the 
1018 same as in gui.text, except hlc is the halo color (default is no 
1019 halo). 
1021 7.4 table input
1023 Input handling. Only available in on_input callback.
1025 7.4.1 input.get(number controller, number index)
1027 Read the specified index (0-11) from specified controller (0-7). 
1028 Notes:
1030 • Uses physical controller numbering. Gamepad in port 2 is 
1031   controller 4, not 1!
1033 7.4.2 input.set(number controller, number index, number value)
1035 Write the specified index (0-11) from specified controller (0-7), 
1036 storing value. Notes:
1038 • Uses physical controller numbering. Gamepad in port 2 is 
1039   controller 4, not 1!
1041 7.4.3 input.get2(number port, number controller, number index)
1043 Read the specified input tuple.
1045 • Port 0 is system port.
1047 7.4.4 input.set2(number port, number controller, number index, 
1048   number value)
1050 Write the specified input tuple.
1052 • Port 0 is system port.
1054 7.4.5 input.lcid_to_pcid2(number lcid)
1056 Look up physical pcid pair (port, controller) corresponding to 
1057 specified logical controller (1-based). Returns nothing if 
1058 controller does not exist.
1060 7.4.6 input.port_type(number port)
1062 Return type of specified port.
1064 7.4.7 input.controller_info(number port, number controller)
1066 Get controller info for specified controller. If controller does 
1067 not exist, returns nil. Otherwise returns a table with following 
1068 fields:
1070 • type (string): Type of the controller.
1072 • class (string): Class of the controller.
1074 • classnum (number): Number of the controller within its class 
1075   (1-based)
1077 • lcid (number): Logical controller number of the controller.
1079 • button_count (number): Number of buttons on controller
1081 • buttons (array): Array of following info about each button:
1083   – type (string): Type of button. Currently one of “null”, “
1084     button”, “axis”, “raxis”.
1086   – name (string): Name of button.
1088   – symbol (string): Symbol of button. Only present for type “
1089     button”.
1091   – hidden (boolean): True if hidden button. 
1093 7.4.8 input.veto_button()
1095 Signals that the button event should be vetoed. Only valid in 
1096 on_button callback.
1098 7.4.9 input.geta(number controller)
1100 Get input state for entiere controller. Returns 13 return values.
1102 • 1st return value: Bitmask: bit i is set if i:th index is 
1103   nonzero
1105 • 2nd-13th return value: value of i:th index.
1107 7.4.10 input.seta(number controller, number bitmask, number 
1108   args...)
1110 Set state for entiere controller. args is up to 12 values for 
1111 indices (overriding values in bitmask if specified).
1113 7.4.11 input.controllertype(number controller)
1115 Get the type of controller as string. Valid values are:
1117 • gamepad
1119 • mouse
1121 • justifier
1123 • superscope
1125 7.4.12 input.reset([number cycles])
1127 Execute reset. If cycles is greater than zero, do delayed reset. 
1128 0 (or no value) causes immediate reset.
1130 • Only available with subframe flag false.
1132 7.4.13 input.raw()
1134 Returns table of tables of all available keys and axes. The first 
1135 table is indexed by key name (platform-dependent!), and the inner 
1136 table has the following fields:
1138 • value: Last reported value for control
1140   – For keys: 1 for pressed, 0 for released.
1142   – For axes: -32767...32767.
1144   – For presure-sensitive buttons: 0...32767.
1146   – For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
1148   – For mouse: Coordinates relative to game area.
1150 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1151   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1152   pressure-pm, pressure-p0).
1154 7.4.14 input.keyhook(string key, boolean state)
1156 Requests that keyhook events to be sent for key (state=true) or 
1157 not sent (state=false).
1159 7.4.15 input.joyget(number controller)
1161 Returns table for current controls for specified controller. The 
1162 names of fields vary by controller type.
1164 • The buttons have the same name as those are referred to in 
1165   other contexts in the emulator
1167 • The analog axes are “xaxis” and “yaxis”.
1169 7.4.16 input.joyset(number controller, table controls)
1171 Set the the state of specified controller to values specified in 
1172 specified table.
1174 7.4.17 input.lcid_to_pcid(number controller)
1176 Return the physical index, physical port and controller number in 
1177 port for specified (1-based) logical controller.
1179 7.5 Table keyboard
1181 Various keybinding-related functions
1183 7.5.1 keyboard.bind(string mod, string mask, string key, string 
1184   cmd)
1186 Bind specified key with specified modifers to specified command.
1188 7.5.2 keyboard.unbind(string mod, string mask, string key)
1190 Unbind specified key with specified modifers.
1192 • nil does not change value
1194 • true/false (buttons) and integers (axes) force value.
1196 • string (button) inverts the input.
1198 7.5.3 keyboard.alias(string alias, string expansion)
1200 Set expansion of given command.
1202 7.6 Table subtitle
1204 Subtitle handling
1206 7.6.1 subtitle.byindex(number i)
1208 Read the frame and length of ith subtitle. Returns nothing if not 
1209 present.
1211 7.6.2 subtitle.set(number f, number l, string txt)
1213 Set the text of subtitle.
1215 7.6.3 subtitle.get(number f, number l)
1217 Get the text of subtitle.
1219 7.6.4 subtitle.delete(number f, number l)
1221 Delete specified subtitle.
1223 7.7 Table hostmemory
1225 Host memory handling (extra memory saved to savestates). Host 
1226 memory starts empty.
1228 7.7.1 hostmemory.read(number address)
1230 Reads hostmemory slot address. Slot numbers out of range return 
1231 false instead of numeric.
1233 7.7.2 hostmemory.write(number address, number value)
1235 Writes hostmemory slot with 0-255. Slot numbers out of range 
1236 cause extension of host memory slot space.
1238 7.7.3 hostmemory.readbyte(number address)
1240 Read unsigned byte (1 element) from given address. Slots out of 
1241 range return false.
1243 7.7.4 hostmemory.writebyte(number address, number value)
1245 Write unsigned byte (1 element) to given slot. Slot numbers out 
1246 of range cause extension.
1248 7.7.5 hostmemory.readsbyte(number address)
1250 Read signed byte (1 element) from given address. Slots out of 
1251 range return false.
1253 7.7.6 hostmemory.writesbyte(number address, number value)
1255 Write signed byte (1 element) to given slot. Slot numbers out of 
1256 range cause extension.
1258 7.7.7 hostmemory.readword(number address)
1260 Read unsigned word (2 elements) from given address. Slots out of 
1261 range return false.
1263 7.7.8 hostmemory.writeword(number address, number value)
1265 Write unsigned word (2 elements) to given slot. Slot numbers out 
1266 of range cause extension.
1268 7.7.9 hostmemory.readsword(number address)
1270 Read signed word (2 elements) from given address. Slots out of 
1271 range return false.
1273 7.7.10 hostmemory.writesword(number address, number value)
1275 Write signed word (2 elements) to given slot. Slot numbers out of 
1276 range cause extension.
1278 7.7.11 hostmemory.readdword(number address)
1280 Read unsigned doubleword (4 elements) from given address. Slots 
1281 out of range return false.
1283 7.7.12 hostmemory.writedword(number address, number value)
1285 Write unsigned doubleword (4 elements) to given slot. Slot 
1286 numbers out of range cause extension.
1288 7.7.13 hostmemory.readsdword(number address)
1290 Read signed doubleword (4 elements) from given address. Slots out 
1291 of range return false.
1293 7.7.14 hostmemory.writesdword(number address, number value)
1295 Write signed doubleword (4 elements) to given slot. Slot numbers 
1296 out of range cause extension.
1298 7.7.15 hostmemory.readqword(number address)
1300 Read unsigned quadword (8 elements) from given address. Slots out 
1301 of range return false.
1303 7.7.16 hostmemory.writeqword(number address, number value)
1305 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1306 out of range cause extension.
1308 7.7.17 hostmemory.readsqword(number address)
1310 Read signed quadword (8 elements) from given address. Slots out 
1311 of range return false.
1313 7.7.18 hostmemory.writesqword(number address, number value)
1315 Write signed quadword (8 elements) to given slot. Slot numbers 
1316 out of range cause extension.
1318 7.8 Table movie
1320 Movie handling
1322 7.8.1 movie.currentframe()
1324 Return number of current frame.
1326 7.8.2 movie.framecount()
1328 Return number of frames in movie.
1330 7.8.3 movie.readonly()
1332 Return true if in readonly mode, false if in readwrite.
1334 7.8.4 movie.rerecords()
1336 Returns the current value of rerecord count.
1338 7.8.5 movie.set_readwrite()
1340 Set readwrite mode (does not cause on_readwrite callback).
1342 7.8.6 movie.frame_subframes(number frame)
1344 Count number of subframes in specified frame (frame numbers are 
1345 1-based) and return that.
1347 7.8.7 movie.read_subframes(number frame, number subframe)
1349 Read specifed subframe in specified frame and return data as 
1350 array (100 elements, numbered 0-99 currently).
1352 7.8.8 movie.read_rtc()
1354 Returns the current value of the RTC as a pair (second, 
1355 subsecond).
1357 7.8.9 movie.unsafe_rewind([UNSAFEREWIND state])
1359 Start setting point for unsafe rewind or jump to point of unsafe 
1360 rewind.
1362 • If called without argument, causes emulator to start process of 
1363   setting unsafe rewind point. When this has finished, callback 
1364   on_set_rewind occurs, passing the rewind state to lua script.
1366 • If called with argument, causes emulator rewind to passed 
1367   rewind point as soon as possible. Readwrite mode is implicitly 
1368   activated.
1370 The following warnings apply to unsafe rewinding:
1372 • There are no safety checks against misuse (that's what “unsafe” 
1373   comes from)!
1375 • Only call rewind from timeline rewind point was set from.
1377 • Only call rewind from after the rewind point was set.
1379 7.9 Table settings
1381 Routines for settings manipulation
1383 7.9.1 settings.get(string name)
1385 Get value of setting. If setting is blank, returns false. If 
1386 setting value can't be obtained, returns (nil, error message).
1388 7.9.2 settings.set(string name, string value)
1390 Set value of setting. If setting can't be set, returns (nil, 
1391 error message).
1393 7.9.3 settings.is_set(string name)
1395 Returns if setting is set. If setting does not exist, returns 
1396 (nil, error message).
1398 7.9.4 settings.blank(string name)
1400 Blanks a setting and returns true. If setting can't be blanked, 
1401 returns (nil, error message).
1403 7.10 Table memory
1405 Contains various functions for managing memory
1407 7.10.1 memory.vma_count()
1409 Returns the number of VMAs
1411 7.10.2 memory.read_vma(number index)
1413 Reads the specified VMA (indices start from zero). Trying to read 
1414 invalid VMA gives nil. The read VMA is table with the following 
1415 fields:
1417 • region_name (string): The readable name of the VMA
1419 • baseaddr (number): Base address of the VMA
1421 • lastaddr (number): Last address in the VMA.
1423 • size (number): The size of VMA in bytes.
1425 • readonly (boolean): True of the VMA corresponds to ROM.
1427 • iospace (boolean): True if the VMA is I/O space.
1429 • native_endian (boolean): True if the VMA has native endian as 
1430   opposed to little endian.
1432 7.10.3 memory.find_vma(number address)
1434 Finds the VMA containing specified address. Returns table in the 
1435 same format as read_vma or nil if not found.
1437 7.10.4 memory.readbyte([string vma, ]number address)
1439 Reads the specified address as unsigned byte and returns the 
1440 result.
1442 7.10.5 memory.readsbyte([string vma, ]number address)
1444 Reads the specified address as signed byte and returns the 
1445 result.
1447 7.10.6 memory.writebyte([string vma, ]number address, number 
1448   value)
1450 Writes the specified value (negative values undergo 2's 
1451 complement) to specified address (as a byte).
1453 7.10.7 memory.readword([string vma, ]number address)
1455 Reads the specified address as unsigned word and returns the 
1456 result.
1458 7.10.8 memory.readsword([string vma, ]number address)
1460 Reads the specified address as signed word and returns the 
1461 result.
1463 7.10.9 memory.writeword([string vma, ]number address, number 
1464   value)
1466 Writes the specified value (negative values undergo 2's 
1467 complement) to specified address (as a word).
1469 7.10.10 memory.readdword([string vma, ]number address)
1471 Reads the specified address as unsigned doubleword and returns 
1472 the result.
1474 7.10.11 memory.readsdword([string vma, ]number address)
1476 Reads the specified address as signed doubleword and returns the 
1477 result.
1479 7.10.12 memory.writedword([string vma, ]number address, number 
1480   value)
1482 Writes the specified value (negative values undergo 2's 
1483 complement) to specified address (as a doubleword).
1485 7.10.13 memory.readqword([string vma, ]number address)
1487 Reads the specified address as unsigned quadword and returns the 
1488 result.
1490 7.10.14 memory.readsqword([string vma, ]number address)
1492 Reads the specified address as signed quadword and returns the 
1493 result.
1495 7.10.15 memory.writeqword([string vma, ]number address, number 
1496   value)
1498 Writes the specified value (negative values undergo 2's 
1499 complement) to specified address (as a quadword).
1501 7.10.16 memory.hash_region([string vma, ]number base, number 
1502   size)
1504 Hash specified number of bytes starting from specified address 
1505 and return the SHA-256.
1507 7.10.17 memory.hash_state()
1509 Hash the current system state. Mainly useful for debugging 
1510 savestates.
1512 7.10.18 memory.readregion([string vma, ]number base, number size)
1514 Read a region of memory.
1516 • Warning: If the region crosses VMA boundary, the results are 
1517   undefined.
1519 7.10.19 memory.map<type>([[string vma, ]number base, number 
1520   size])
1522 Returns a table mapping specified memory aperture for read/write. 
1523 If parameters are omitted, entiere map space is the aperture.
1525 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1526   qword or sqword.
1528 7.10.20 memory.writeregion([string vma, ]number base, number 
1529   size, table data)
1531 Write a region of memory.
1533 • Warning: If the region crosses VMA boundary, the results are 
1534   undefined.
1536 7.10.21 memory.map_structure()
1538 Returns a new mapping structure (MMAP_STRUCT)
1540 7.10.22 MMAP_STRUCT(string key, [string vma, ]number address, 
1541   string type)
1543 Bind key in mmap structure to specified address with specified 
1544 type.
1546 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1547   qword or sqword.
1549 7.10.23 memory.read_expr(string expr)
1551 Evaluate specified watch expression and return result
1553 7.11 Table memory2
1555 Contains newer memory functions.
1557 7.11.1 memory2()
1559 Returns array of all valid VMA names.
1561 7.11.2 memory2.<vma>:info()
1563 Return table describing given VMA. Includes fields address, size, 
1564 last, readonly, special and endian.
1566 7.11.3 memory2.<vma>:<op>(number offset)
1568 Read from given VMA at given offset (must be in-range). Op is of 
1569 form:
1571 • [i][s]<type>, where <type> is one of 'byte', 'word', 'dword', 
1572   'qword'. 'i' signifies that the value is treated as 
1573   opposite-to-normal endianess, 's' signifies that value is 
1574   treated as signed.
1576 7.11.4 memory2.<vma>:<op>(number offset, number value)
1578 Write value to given VMA at given offset (must be in-range). See 
1579 above for form of op.
1581 7.12 Table subtitle
1583 Contains functions for manipulating subtitles.
1585 7.12.1 subtitle.byindex(number index)
1587 Get (basetime, length) pair of specified subtitle index or 
1588 nothing if index isn't valid.
1590 7.12.2 subtitle.get(number basetime, number length)
1592 Read the specified subtitle. Returns “” if the subtitle does not 
1593 exist.
1595 7.12.3 subtitle.set(number basetime, number length, string 
1596   content)
1598 Set the specified subtitle.
1600 7.12.4 subtitle.deltete(number basetime, number length)
1602 Delete the specified subtitle.
1604 7.13 Table _SYSTEM
1606 Contains copy of global variables from time of Lua 
1607 initialization. Non-writeable.
1609 7.14 Callbacks
1611 Various callbacks to Lua that can occur.
1613 7.14.1 Callback: on_paint(bool not_synth)
1615 Called when screen is being painted. Any gui.* calls requiring 
1616 graphic context draw on the screen.
1618 not_synth is true if this hook is being called in response to 
1619 received frame, false otherwise.
1621 7.14.2 Callback: on_video()
1623 Called when video dump frame is being painted. Any gui.* calls 
1624 requiring graphic context draw on the video.
1626 7.14.3 Callback: on_frame_emulated()
1628 Called when emulating frame has completed and 
1629 on_paint()/on_video() calls are about to be issued.
1631 7.14.4 Callback: on_frame()
1633 Called on each starting whole frame.
1635 7.14.5 Callback: on_startup()
1637 Called when the emulator is starting (lsnes.rc and --run files 
1638 has been run).
1640 7.14.6 Callback: on_rewind()
1642 Called when rewind movie to beginning has completed.
1644 7.14.7 Callback: on_pre_load(string name)
1646 Called just before savestate/movie load occurs (note: loads are 
1647 always delayed, so this occurs even when load was initiated by 
1648 lua).
1650 7.14.8 Callback: on_err_load(string name)
1652 Called if loadstate goes wrong.
1654 7.14.9 Callback: on_post_load(string name, boolean was_savestate)
1656 Called on successful loadstate. was_savestate gives if this was a 
1657 savestate or a movie.
1659 7.14.10 Callback: on_pre_save(string name, boolean is_savestate)
1661 Called just before savestate save occurs (note: movie saves are 
1662 synchronous and won't trigger these callbacks if called from 
1663 Lua).
1665 7.14.11 Callback: on_err_save(string name)
1667 Called if savestate goes wrong.
1669 7.14.12 Callback: on_post_save(string name, boolean is_savestate)
1671 Called on successful savaestate. is_savestate gives if this was a 
1672 savestate or a movie.
1674 7.14.13 Callback: on_quit()
1676 Called when emulator is shutting down.
1678 7.14.14 Callback: on_input(boolean subframe)
1680 Called when emulator is just sending input to bsnes core. 
1681 Warning: This is called even in readonly mode, but the results 
1682 are ignored.
1684 7.14.15 Callback: on_reset()
1686 Called when SNES is reset.
1688 7.14.16 Callback: on_readwrite()
1690 Called when moving into readwrite mode as result of “set-rwmode” 
1691 command (note: moving to rwmode by Lua won't trigger this, as per 
1692 recursive entry protection).
1694 7.14.17 Callback: on_snoop(number port, number controller, number 
1695   index, number value)
1697 Called each time bsnes asks for input. The value is the final 
1698 value to be sent to bsnes core (readonly mode, autohold and 
1699 autofire have been taken into account). Might be useful when 
1700 translating movies to format suitable for console verification. 
1701 Note: There is no way to modify the value to be sent.
1703 • Not called if callback on_snoop2 is defined.
1705 7.14.18 Callback: on_snoop2(number port, number controller, 
1706   number index, number value)
1708 Like on_snoop, but reserves port 0 for system, having first user 
1709 port be port 1.
1711 7.14.19 Callback: on_keyhook(string keyname, table state)
1713 Sent when key that has keyhook events requested changes state. 
1714 Keyname is name of the key (group) and state is the state (same 
1715 kind as table values in input.raw).
1717 7.14.20 Callback: on_idle()
1719 Called when requested by set_idle_timeout(), the timeout has 
1720 expired and emulator is waiting.
1722 7.14.21 Callback: on_timer()
1724 Called when requested by set_idle_timeout() and the timeout has 
1725 expired (regardless if emulator is waiting).
1727 7.14.22 Callback: on_set_rewind(UNSAFEREWIND r)
1729 Called when unsafe rewind object has been constructed.
1731 7.14.23 Callback: on_pre_rewind() 
1733 Called just before unsafe rewind is about to occur.
1735 7.14.24 Callback: on_post_rewind() 
1737 Called just after unsafe rewind has occured.
1739 7.14.25 Callback: on_button(number port, number controller, 
1740   number index, string type)
1742 Called on controller button press, with following parameters:
1744 • port: Port number (0 is system)
1746 • controller: Controller within port
1748 • index: Index of button.
1750 • type: Type of event, one of:
1752   – “pressed”: Button was pressed.
1754   – “released”: Button was released.
1756   – “hold”: Held.
1758   – “unhold”: Released from hold.
1760   – “type”: Typing input on button.
1762   – “untype”: Typing input undone.
1764   – “autofire <duty> <cycle>”: Autofire with specifie duty and 
1765     cycle.
1767   – “autofire”: Stop autofire.
1769   – “analog”: Analog action on axis.
1771 8 Movie editor
1773 • The editor edits in-memory movie.
1775 • Because past can't be edited and readwrite mode doesn't allow 
1776   future, editing only works in read only mode.
1778 • Keyboard triggers the normal hotkeys and bindings.
1780 8.1 Left button actions
1782 • Clicking on cell in future (indicated by lack of redish 
1783   background) toggles it (if it is a button) or prompts for a 
1784   value (if it is an axis)
1786 • Dragging vertically toggles sequence of buttons or changes a 
1787   sequence of axis values.
1789 8.2 Right button actions
1791 The right mouse button pops up a context-sensitive menu:
1793 • Toggle <something>: Toggle this button
1795 • Change <something>: Change this axis value
1797 • Insert frame after: Insert a frame after this frame
1799 • Append frame: Append a frame to movie
1801 • Append frames: Append specified number of frames to movie
1803 • Delete frame: Delete this frame
1805 • Delete subframe: Delete this subframe
1807 • Truncate movie: Delete this subframe and everything after it.
1809 • Scroll to frame: Prompt for a frame and scroll the display to 
1810   that frame.
1812 • Scroll to current frame: Scroll the display to current position
1814 • Run to frame: Prompts for frame and runs the emulation to that 
1815   frame.
1817 • Change number of lines visible: Change the height of the movie 
1818   display (1 to 255).
1820 • Lock scroll to playback: While playing back or rewinding 
1821   movies, the display will follow if enabled.
1823 9 Memory watch expression syntax
1825 Memory watch expressions are in RPN (Reverse Polish Notation). At 
1826 the end of expression, the top entry on stack is taken as the 
1827 final result.
1829 Notations:
1831 • Evaluation order is strictly left to right.
1833 • a is the entry on top of stack
1835 • b is the entry immediately below top of stack
1837 • ; separates values to be pushed (no intermediate pop).
1839 • After end of element, all used stack slots are popped and all 
1840   results are pushed.
1842 • When pushing multiple values, the pushes occur in order shown.
1844 The following operators are available:
1846 • + : a + b
1848 • - : a - b
1850 • * : a * b
1852 • / : a / b
1854 • % : a % b
1856 • a : atan(a)
1858 • b : read_signed_byte(a)
1860 • c : cos(a)
1862 • d : read_signed_dword(a)
1864 • i : quotent(a / b)
1866 • p :\pi
1869 • q : read_signed_qword(a)
1871 • r : sqrt(a)
1873 • s : sin(a)
1875 • t : tan(a)
1877 • u : a; a
1879 • w : read_signed_word(a)
1881 • A : atan2(a, b)
1883 • B : read_unsigned_byte(a)
1885 • C<number>z : Push number <number> to stack.
1887 • D : read_unsigned_dword(a)
1889 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1891 • H<digit> : Set hexadecimal mode with specified number of digits 
1892   (use A-G for 10-16 digits).
1894 • Q : read_unsigned_qword(a)
1896 • R<digit> : round a to <digit> digits.
1898 • W : read_unsigned_word(a)
1900 9.1 Example:
1902 C0x007e0878zWC0x007e002czW-
1904 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1906 2. Pop the value on top of stack (0x7e0878), read word value at 
1907   that address and push the result,call it x1 (W).
1909 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1911 4. Pop the value on top of stack (0x7e002c), read word value at 
1912   that address and push the result,call it x2 (W).
1914 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
1915   x2 and push x2 - x1 (-).
1917 6. Since the expression ends, the final memory watch result is 
1918   the top one on stack, which is x2 - x1.
1920 10 Modifier and key names:
1922 10.1 wxWidgets platform
1924 10.1.1 Modifier names:
1926 Following modifier names are known:
1928 • alt
1930 • ctrl
1932 • shift 
1934 • meta
1936 • cmd (Mac OS X only)
1938 10.1.2 Key names:
1940 Following key names are known:
1942 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1943   dollar, percent, ampersand, quote, leftparen, rightparen, 
1944   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1945   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1946   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1947   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1948   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1949   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1950   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1951   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1952   home, lefT, up, right, down, select, print, execute, snapshot, 
1953   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1954   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1955   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1956   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1957   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1958   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1959   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1960   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1961   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1962   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1963   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1964   windows_right, windows_menu, command, special1, special2, 
1965   special3, special4, special5, special6, special7, special8, 
1966   special9, special10, special11, special12, special13, 
1967   special14, special15, special16, special17, special18, 
1968   special19, special20
1970 11 Movie file format
1972 Movie file is .zip archive in itself, normal ZIP archive tools 
1973 work on it (note: If you recompress it, do not use compression 
1974 methods other than store and deflate and especially do not use 
1975 encryption of any kind).
1977 11.1 Detecting clean start/SRAM/Savestate
1979 • If file has member “savestate” it is savestate, otherwise:
1981 • If file has members with names starting “moviesram.” it is 
1982   movie starting from SRAM, otherwise:
1984 • It is movie starting from clear state.
1986 11.2 Member: gametype
1988 Type of game ROM and region (as one line). Valid values are:
1991 +--------------+---------------------+--------+
1992 |    Value     |       System        | Region |
1993 +--------------+---------------------+--------+
1994 +--------------+---------------------+--------+
1995 |  snes_pal    |     Super NES       |  PAL   |
1996 +--------------+---------------------+--------+
1997 |   sgb_pal    |   Super Game Boy    |  PAL   |
1998 +--------------+---------------------+--------+
1999 |  snes_ntsc   |     Super NES       |  NTSC  |
2000 +--------------+---------------------+--------+
2001 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
2002 +--------------+---------------------+--------+
2003 |     bsx      | BS-X (non-slotted)  |  NTSC  |
2004 +--------------+---------------------+--------+
2005 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
2006 +--------------+---------------------+--------+
2007 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
2008 +--------------+---------------------+--------+
2011 Frame rates are:
2014 +---------+-----------------+
2015 | Region  | Framerate (fps) |
2016 +---------+-----------------+
2017 +---------+-----------------+
2018 |  PAL    |   322445/6448   |
2019 +---------+-----------------+
2020 |  NTSC   | 10738636/178683 |
2021 +---------+-----------------+
2024 11.3 Member: port1
2026 Contains type of port #1 (as one line). Valid values are 'none', 
2027 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
2028 'gamepad'.
2030 11.4 Member: port2
2032 Contains type of port #2 (as one line). Valid values are 'none', 
2033 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
2034 'justifiers'. If not present, defaults to 'none'.
2036 11.5 Member: gamename
2038 Contains name of the game (as one line).
2040 11.6 Member: authors
2042 Contains authors, one per line. Part before '|' is the full name, 
2043 part after is the nickname.
2045 11.7 Member: systemid
2047 Always “lsnes-rr1” (one line). Used to reject other saves.
2049 11.8 Member: controlsversion
2051 Always “0” (one line). Used to identify what controls are there.
2053 11.9 Member: “coreversion”
2055 Contains bsnes core version number (as one line).
2057 11.10 Member: projectid
2059 Contains project ID (as one line). Used to identify if two movies 
2060 are part of the same project.
2062 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2064 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2065 Absent if corresponding file is absent.
2067 11.12 Member: moviesram.<name>
2069 Raw binary startup SRAM of kind <name>. Only present in 
2070 savestates and movies starting from SRAM.
2072 11.13 Member: saveframe
2074 Contains frame number (as one line) of frame movie was saved on. 
2075 Only present in savestates.
2077 11.14 Member: lagcounter
2079 Current value of lag counter (as one line). Only present in 
2080 savestates.
2082 11.15 Member: pollcounters
2084 Contains poll counters (currently 100 of them), one per line. 
2085 Each line is raw poll count if DRDY is set for it. Otherwise it 
2086 is negative poll count minus one. Only present in savestates.
2088 11.16 Member: hostmemory
2090 Raw binary dump of host memory. Only present in savestates.
2092 11.17 Member: savestate
2094 The raw binary savestate itself. Savestate detection uses this 
2095 file, only present in savestates.
2097 11.18 Member: screenshot
2099 Screenshot of current frame. Only present in savestates. First 2 
2100 bytes are big-endian width of image, rest are 24-bit RGB image 
2101 data. Height of image is inferred from the width and size of 
2102 data.
2104 11.19 Member: sram.<name>
2106 Raw binary SRAM of kind <name> at time of savestate. Only present 
2107 in savestates.
2109 11.20 Member: input
2111 The actual input track, one line per subframe (blank lines are 
2112 skipped).
2114 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2115   the line is part of same frame as previous, otherwise it starts 
2116   a new frame.
2118 • First subframe must start a new frame.
2120 Length of movie in frames is number of lines in input file that 
2121 start a new frame.
2123 11.21 Member: subtitles
2125 Subtitle track. Optional.
2127 • Each line is in form <firstframe> <numframes> <text>.
2129 • Linefeed is encoded as \n, backslash is encoded as \\.
2131 11.22 Member: rerecords
2133 Contains textual base-10 rerecord count (as one line; emulator 
2134 just writes this, it doesn't read it) + 1.
2136 11.23 Member: rrdata
2138 This member stores set of load IDs. There is one load ID per 
2139 rerecord (plus one corresponding to start of project).
2141 • This member constists of concatenation of records
2143 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2144   consequtive IDs.
2146 • IDs are interpretted as 256-bit big-endian integers with 
2147   warparound.
2149 • Initial predicted ID is all zeroes.
2151 Format of each record is:
2153 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2154   bits 5-6 are count length (countlen). Bit 7 is unused.
2156 • 32-prefixlen bytes of ID.
2158 • countlen bytes of big-endian count (count).
2160 Records are processed as follows:
2162 • To form the first ID encoded by record, take the first 
2163   prefixlen bytes predicted ID and append the read ID value to 
2164   it. The result is the first ID encoded.
2166 • If countlen is 0, record encodes 1 ID.
2168 • If countlen is 1, record encodes 2+count IDs.
2170 • If countlen is 2, record encodes 258+count IDs.
2172 • If countlen is 3, record encodes 65794+count IDs.
2174 • The new predicted ID is the next ID after last one encoded by 
2175   the record.
2177 The number of rerecords + 1 is equal to the sum of number of IDs 
2178 encoded by all records.
2180 11.24 Member: starttime.second
2182 Movie starting time, second part. Epoch is Unix epoch. Default is 
2183 1,000,000,000.
2185 11.25 Member: starttime.subsecond
2187 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2188 is 0.
2190 11.26 Member: savetime.second
2192 Movie saving time, second part. Default is starttime.second. Only 
2193 present in savestates.
2195 11.27 Member: savetime.subsecond
2197 Movie saving time, subsecond part. Default is 
2198 starttime.subsecond. Only present in savestates.
2200 12 lsvs file format (commentary tracks)
2202 12.1 Clusters
2204 • Each cluster is 8kB (8192 bytes) in size.
2206 • Cluster n starts at offset 8192*n in file.
2208 • The following clusters are system special:
2210   – Cluster 0 and all clusters with number multiple of 2048 
2211     (cluster tables)
2213   – Cluster 1 (superblock)
2215 12.2 Cluster tables
2217 • The cluster table describing cluster n is stored in cluster n & 
2218   ~0x7FF (zero last 11 bits of n).
2220 • This cluster table consists of 2048 4-byte big-endian integers.
2222 • Each entry describes a cluster in 16MB supercluster, in order.
2224 • The valid values for entries are:
2226   – 0x00000000: Free cluster
2228   – 0x00000001: Last cluster in chain.
2230   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2232   – (anything else): Number of next cluster in chain. Must not be 
2233     multiple of 2048.
2235 • Due to limitations of the format, there can be at most 2097052 
2236   superclusters, giving maximum file size of 16TB.
2238 12.3 Stream table
2240 • The stream table chain always starts in cluster 2.
2242 • Otherwise, it follows normal chaining.
2244 • The stream table consists of 16-byte entries:
2246   – The first 8 bytes of entry give big-endian beginning position 
2247     of stream in units of 1/48000 s.
2249   – The next 4 bytes of entry give big-endian beginning cluster 
2250     for control data. 0 here marks the entry as not present.
2252   – The last 4 bytes of entry give big-endian beginning cluster 
2253     for codec data.
2255 • Stream table clusters are normal clusters, following normal 
2256   chaining.
2258 • The stream begnning position is not guarenteed unique. There 
2259   can be multiple streams with the same starting position in the 
2260   file.
2262 12.4 Stream control data
2264 • The stream control data consists of entries 4 bytes each:
2266   – The first 2 bytes of entry gives big-endian length of packet
2268   – The next byte of entry gives audio length of packet in units 
2269     of 1/400 s.
2271   – The last byte is control byte.
2273     ∗ 0 means this entry is not present and the control data 
2274       ends.
2276     ∗ 1 is valid control entry.
2278 • The stream control data can also end by running into end of the 
2279   readable chain.
2281   – This happens if there happens to be exact multiple of 2048 
2282     packets in stream and number of packets is nonzero.
2284 • These clusters follow normal chaining.
2286 12.5 Stream codec data
2288 • Stream codec data consists of raw Opus data packets packed back 
2289   to back with nothing in between.
2291 • Warning: Due to internal limitations, this data must reside in 
2292   the first 65536 superclusters (that is, the first 1TB of the 
2293   file).
2295 12.6 Superblock
2297 • The superblock is stored in cluster 1. 
2299 • The first 11 bytes are “sefs-magic”<NUL>.
2301 • The rest are unused.
2303 • This cluster 1 is marked as system special.
2305 13 Known ROM extensions
2307 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2308   dx2, mgd, mgh.
2310 • DMG cartridge ROMs: dmg, gb.
2312 • GBC cartridge ROMs: cgb, gbc.
2314 14 Gamepack files
2316 • The first line must be: “[GAMEPACK FILE]”.
2318 • There is one needed line: “type <systype>”. This sets system 
2319   type to <systype>. The following system types are valid:
2321   – snes (SNES)
2323   – bsx (BS-X non-slotted)
2325   – bsxslotted (BS-X slotted)
2327   – sufamiturbo (Sufami Turbo)
2329   – sgb (Super Game Boy)
2331   – dmg (Game Boy)
2333   – gbc (Game Boy Color)
2335   – gbc_gba (Game Boy Color with GBA initial register values)
2337 • Optionally a region can be specified: “region <region>”. The 
2338   following values are valid:
2340   – autodetect (Autodetect region: snes and sgb only)
2342   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2344   – pal (PAL: snes, sgb)
2346   – world (World: dmg, gbc, gbc_gba)
2348 • ROM images are loaded as: “rom <type> <file>”. The following 
2349   types are valid:
2351   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2352     bsxslotted, sufamiturbo)
2354   – bsx (Cartridge ROM in bsx, bsxslotted)
2356   – slot-a (Cartridge ROM in sufamiturbo)
2358   – slot-b (Cartridge ROM in sufamiturbo)
2360 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2361   valid are the same as for ROMs.
2363 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2364   types are the same as for ROMs.
2366   – Offset is given in form [+-]<number>. Usually offset is 
2367     either +0 or -512.
2369   – Default offset is +0.
2371 14.1 Example:
2373 [GAMEPACK FILE]
2375 type snes
2377 rom rom speedygonzales.sfc
2379 patch-512 rom sonicthehedgehog.ips
2381 14.2 Example 2:
2383 [GAMEPACK FILE]
2385 type sgb
2387 rom rom supergameboy.sfc
2389 rom dmg megamanV.dmg
2391 15 Quick'n'dirty encode guide
2393 1. Start the emulator and load the ROM and movie file.
2395 2. Set large AVI option 'set-setting avi-large on'
2397 3. Enable dumping 'dump-avi tmpdump' 
2399 4. Unpause and let it run until you want to end dumping.
2401 5. Close the emulator (closing the window is the easiest way). Or 
2402   use 'end-avi'.
2404 6. For each tmpdump*.avi file created, on command prompt, do 
2405   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2407 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2409 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2410   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2411   tmpdump_<numbers>.mkv, with + in between).
2413 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2414   final.mkv contains quick'n'dirty encode.
2416 16 Axis configurations for some gamepad types:
2418 16.1 XBox360 controller:
2420 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2421 set to pressure-+.
2423 set-axis joystick0axis2 pressure-+
2425 set-axis joystick0axis5 pressure-+
2427 • This is needed for SDL only. EVDEV sets those types correctly.
2429 16.2 PS3 “sixaxis” controller:
2431 Axes 8-19 should be disabled.
2433 set-axis joystick0axis8 disabled
2435 set-axis joystick0axis9 disabled
2437 set-axis joystick0axis10 disabled
2439 set-axis joystick0axis11 disabled
2441 set-axis joystick0axis12 disabled
2443 set-axis joystick0axis13 disabled
2445 set-axis joystick0axis14 disabled
2447 set-axis joystick0axis15 disabled
2449 set-axis joystick0axis16 disabled
2451 set-axis joystick0axis17 disabled
2453 set-axis joystick0axis18 disabled
2455 set-axis joystick0axis19 disabled
2457 17 Errata:
2459 17.1 Problems from BSNES core:
2461 • The whole pending save stuff.
2463 • Lack of layer hiding.
2465 • It is slow (especially accuracy).
2467 • Firmwares can't be loaded from ZIP archives.
2469 17.2 Other problems:
2471 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2473 • Audio for last dumped frame is not itself dumped.
2475 • Audio in UI is pretty bad in quality if game doesn't run at 
2476   full speed.
2478 • No menus, command based interface (SDL).
2480 • Long commands don't scroll.
2482 18 Changelog:
2484 18.1 rr0-beta1
2486 • Fix -Wall warnings
2488 • Fix dumper video corruption with levels 10-18.
2490 18.2 rr0-beta2
2492 • Autofire
2494 • Lots of code cleanups
2496 • Lua interface to settings
2498 • Allow specifying AVI borders without Lua
2500 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2502 • on_snoop lua callback
2504 • Faster movie loading and saving.
2506 18.3 rr0-beta3
2508 • Joystick support
2510 18.4 rr0-beta4
2512 • Fix multi-buttons
2514 • Save jukebox functionality.
2516 18.5 rr0-beta5
2518 • Try to fix some nasty failing movie load edge cases
2520 • Allow specifying scripts to run on command line.
2522 18.6 rr0-beta6
2524 • Major source code reorganization.
2526 • Backup savestates before overwriting.
2528 • Don't crash if loading initial state fails.
2530 18.7 rr0-beta7
2532 • Fix firmware lookup
2534 • Fix author name parsing
2536 • Fix rerecord counting
2538 • (SDL) Print messages to console if SDL is uninitialized
2540 • Add movieinfo program
2542 • Fix loading movies starting from SRAM.
2544 18.8 rr0-beta8
2546 • Add support for unattended dumping
2548 • Fix compiling for Win32
2550 • Don't lock up if sound can't be initialized
2552 • Strip trailing CR from commands
2554 • Don't try to do dubious things in global ctors (fix crash on 
2555   startup)
2557 18.9 rr0-beta9
2559 • Small documentation tweaking
2561 • Fix make clean
2563 • Fix major bug in modifier matching
2565 18.10 rr0-beta10
2567 • Lots of documentation fixes
2569 • Use dedicated callbacks for event backcomm., not commands.
2571 • Ensure that the watchdog is not hit when executing delayed 
2572   reset.
2574 • Remove errant tab from joystick message.
2576 18.11 rr0-beta11
2578 • Make autofire operate in absolute time, not linear time
2580 • Reinitialize controls when resuming from loadstate
2582 • Some more code cleanups
2584 • If Lua allocator fails, call OOM_panic()
2586 • Byte/word/dword/qword sized host memory write/read functions.
2588 • Dump at correct framerate if dumping interlaced NTSC 
2589   (height=448).
2591 18.12 rr0-beta12
2593 • Actually include the complete source code
2595 • Keep track of RTC
2597 18.13 rr0-beta13
2599 • Document {save,start}time.{,sub}second.
2601 • Intercept time() from bsnes core.
2603 18.14 rr0-beta14
2605 • Allow disabling time() interception (allow build on Mac OS X)
2607 • Use SDLMain on Mac OS X (make SDL not crash)
2609 • Disable delayed resets (just plain too buggy for now).
2611 • Code cleanups
2613 • Use 16-bit for graphics/video instead of 32-bit.
2615 • gui.rectangle/gui.pixel
2617 • gui.crosshair
2619 • New CSCD writer implementation.
2621 18.15 rr0-beta15
2623 • Fix interaction of * and +.
2625 • Manual improvements
2627 • Use gettimeofday()/usleep(), these seem portable enough.
2629 • Move joystick axis manipulation to keymapper code.
2631 • Changes to how read-only works.
2633 • Refactor controller input code.
2635 18.16 rr0-beta16
2637 • Fix mouseclick scale compensation.
2639 • Draw area boundaries correctly in SDL code.
2641 • gui.screenshot.
2643 • Fix CSCD output (buffer overrun and race condition).
2645 18.17 rr0-beta17
2647 • JMD dumping support.
2649 • Allow unattended dumping to JMD.
2651 • Move to BSNES v083.
2653 • Switch back to 32-bit colors.
2655 • Add Lua function gui.color.
2657 • Use some new C++11 features in GCC 4.6.
2659 • Be prepared for core frequency changes.
2661 • Pass colors in one chunk from Lua.
2663 18.18 rr0-beta18
2665 • New lua functions gui.line(), gui.status() and gui.circle(), 
2666   memory.vma_count(), memory.read_vma() and memory.find_vma().
2668 • Numerious documentation fixups
2670 • RTC time format changed
2672 • Reformat flags display
2674 • Allow lua package name to be overridden
2676 • SDUMP (high-quality dumping).
2678 • Split platform support to plugins.
2680 • Make all sound plugins support basic sound commands
2682 • Support portaudio for sound.
2684 • Allow disable Lua/SDL searching.
2686 • Upconvert colors when copying lcscreen to screen.
2688 • Reorganize source tree.
2690 • Evdev joystick support.
2692 • Refactor more code into generic window code.
2694 18.19 rr0-beta19
2696 • Refactor message handling.
2698 • Rework makefile
2700 • Documentation fixes
2702 • Finish pending saves before load/quit.
2704 • Wxwidgets graphics plugin.
2706 18.20 rr0-beta20
2708 • Get rid of win32-crap.[ch]pp.
2710 • Move files around a lot.
2712 • Get rid of need for host C++ compiler.
2714 • Bsnes v084 core.
2716 • Refactor inter-component communication.
2718 • Fix zero luma.
2720 • Fix crash on multiline aliases.
2722 • Load/Save settings in wxwidgets gui.
2724 18.21 rr0-beta21
2726 • Patch problems in bsnes core
2728 • SNES is little-endian, not big-endian!
2730 • Fix memory corruption in lcscreen::load()
2732 18.22 rr0-beta22
2734 • Fix interpretting repeat counts in rrdata loading.
2736 • New lua callback: on_frame()
2738 • Remove calls to runtosave() that aren't supposed to be there
2740 • Lua function: movie.read_rtc()
2742 • Ignore src/fonts/font.cpp
2744 • Fix more bsnes core problems
2746 • Control bsnes random seeding
2748 • Pause-on-end
2750 • Some bsnes core debugging features (state dump and state hash)
2752 • Fix titlebar version number (no, the last version wasn't 
2753   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2755 18.23 rr0-beta23
2757 • Fix memory corruption due to macro/field mixup
2759 • search-memory update
2761 • Allow direct-mapped framebuffer
2763 • SDL: Use SDL_ANYFORMAT if possible
2765 • SDMP2SOX: 2s delay modes.
2767 • Wxwidgets: Cleanups
2769 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2771 • Wxwidgets: Save jukebox on exit
2773 • Fix RTC if using load-movie on savestate.
2775 • Fix crash related to full console mode.
2777 18.24 rr0-beta24
2779 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2780   X.
2782 • Wxwidgets: Allow compiling on Mac OS X.
2784 • Use movie compare instead of movie hashing (faster save/load).
2786 • Lua: _SYSTEM table.
2788 18.25 rr0-beta25
2790 • sdmp2sox: Pad soundtrack if using -l or -L.
2792 • sdmp2sox: Fix NTSC overscan.
2794 • sdmp2sox: Add AR correction mode.
2796 • call lua_close() when exiting.
2798 • Fix zip_writer bug causing warnings from info-zip and error 
2799   from advzip.
2801 18.26 rr0-beta26
2803 • Fix IPS patching code (use bsnes core IPS patcher).
2805 • Implement BPS patching (using bsnes core IPS patcher).
2807 • Add feature to load headered ROMs.
2809 18.27 rr0-beta27
2811 • Show command names when showing keybindings
2813 18.28 rr0
2815 • Fix pause-on-end to be actually controllable
2817 • SDL: Poll all events in queue, not just first one (fixes 
2818   slowness in command typing)
2820 • Wxwidgets: Fix ROM loading.
2822 18.29 rr1-beta0
2824 • Lua: Add gui.textH, gui.textV, gui.textHV
2826 • Fix text colors on SDL on Mac OS X
2828 • Mode 'F' for finished in readonly mode.
2830 • Fix some WS errors.
2832 • Reliably pause after skip poll
2834 • Split UI and core into their own threads
2836 18.30 rr1-beta1
2838 • Remove leftover dummy SRAM slot
2840 • Fix controller numbers.
2842 18.31 rr1-beta2
2844 • Fix lsnes-dumpavi after interface change.
2846 • Also give BSNES patches for v085.
2848 • Pack movie data in memory.
2850 18.32 rr1-beta3
2852 • Fix framecount/length given when loading movies.
2854 • Controller command memory leak fixes.
2856 • Don't leak palette if freeing screen object.
2858 18.33 rr1-beta4
2860 • Detect revisions.
2862 • Wxwidgets: Allow controlling dumper from the menu.
2864 18.34 rr1-beta5
2866 • Rewrite parts of manual
2868 • Lua: Make it work with Lua 5.2.
2870 18.35 rr1-beta6
2872 • Win32: Fix compile errors.
2874 18.36 rr1-beta7
2876 • Refactor controller input code.
2878 • Fix crash when using command line on SDL / Mac OS X.
2880 18.37 rr1-beta8
2882 • Delete core/coroutine (obsolete)
2884 • Lag input display by one frame.
2886 • Rewind movie to beginning function.
2888 • Fix wrong frame number reported to Lua when repainting after 
2889   loadstate
2891 • Support UI editing of jukebox
2893 • Wxwidgets: Save settings on exit.
2895 • Support ${project} for filenames
2897 • SDL: Fix command history
2899 18.38 rr1-beta9
2901 • Fix some order-of-global-ctor bugs.
2903 18.39 rr1-beta10
2905 • Fix crashes when quitting on Win32.
2907 18.40 rr1-beta11
2909 • EVDEV: Queue keypresses from joystick, don't send directly
2911 • Wxwidgets: Load-Preserve that actually works.
2913 18.41 rr1-beta12
2915 • Wxwidgets: GUI for memory search.
2917 • Warn about using synchronous queue in UI callback.
2919 18.42 rr1-beta13
2921 • Remember last saved file for each ROM
2923 • Support MT dumping via boost.
2925 • Lua: input.raw
2927 • Lua: input.keyhook
2929 • Make mouse be ordinary input instead of special-casing
2931 • SDL: Don't screw up commands with NUL codepoints.
2933 18.43 rr1-beta14
2935 • Merge status panel and main window
2937 • True movie slot support (the rest of it)
2939 • SDL: Fix compilation error
2941 • Elminate cross calls in dump menu code.
2943 18.44 rr1-beta15
2945 • Cancel pending saves command
2947 • Wxwidgets: Code refactoring
2949 • Wxwidgets: Fix system -> reset
2951 • Wxwidgets: Read watch expressions in the right thread
2953 18.45 rr1-beta16
2955 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
2956   doesn't support that).
2958 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
2959   needed).
2961 • Don't append trailing '-' to prefix when saving movie.
2963 • Fix ROM/savestate handling (don't let user mismatch ROM and 
2964   savestates).
2966 18.46 rr1
2968 • Document memory watch syntax.
2970 18.47 rr1-delta1
2972 • Fix unattended dumping (lsnes-dumpavi)
2974 • Support RAW dumping
2976 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
2977   (changes syntax)
2979 • Add option to control sample rate preturbation in AVI dumper
2981 18.48 rr1-delta2
2983 • Wxwidgets: Fix dumper submodes
2985 • Set core controller types before loadstate
2987 18.49 rr1-delta2epsilon1
2989 • Fix compiling with bsnes v086.
2991 18.50 rr1-delta3
2993 • Don't prompt before quitting
2995 • Start unpaused, preserve pause/unpause over load.
2997 • Try to autodetect if ROM is headered.
2999 • Wxwidgets: Only bring up ROM patching screen if specifically 
3000   requested.
3002 • Allow configuring some hotkeys.
3004 18.51 rr1-delta4
3006 • Lots of code cleanups
3008 • Fix JMD compression (JMD dumping was broken)
3010 • Don't crash if Lua C function throws an exception.
3012 • Support bitmap drawing in Lua.
3014 • Fix bsnes v085/v086 patches.
3016 • Improve stability on win32.
3018 18.52 rr1-delta4epsilon1
3020 • Don't corrupt movie if movie length is integer multiple of 
3021   frames per page.
3023 18.53 rr1-delta5
3025 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
3027 • New Lua functions: emulator_ready(), utime(), 
3028   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
3029   bit.value(), input.geta(), input.seta() and 
3030   input.controllertype()
3032 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
3034 • Wxwidgets: Fix broken modifiers
3036 • on_paint has parameter now.
3038 • Optional initital fill for bitmaps
3040 • Fix palette changing.
3042 • Optimize rendering a bit.
3044 • Bsnes v087 support.
3046 18.54 rr1-delta5epsilon1
3048 • Movieinfo: Fix display of port #2 type.
3050 • Call on_input() after loadstate.
3052 18.55 rr1-delta5epsilon2
3054 • Fix writing port2 data to movie.
3056 • Fix SRAM handling with Bsnes v087.
3058 18.56 rr1-delta6
3060 • Library loading support
3062 • Built-in TSCC encoder
3064 • Hi-color (256T colors) dumping.
3066 • Dump over TCP/IP(v6)
3068 • Hidable status panel
3070 • Turbo toggle/hold
3072 • Adjustable sound volume
3074 • Screen scaling
3076 • Allow DnD into filename boxes
3078 • Configurable paths
3080 • Portaudio: Fix speaker popping at start
3082 • Lots of UI changes
3084 • Speed adjustment menu
3086 • Win32 joystick support
3088 • Lua: gui.rainbow and gui.box
3090 • Split key lists into classes (the key list was large!)
3092 • More save slots support
3094 • Wxwidgets (wxJoystick) joystick support
3096 18.57 rr1-delta7
3098 • Lots of internal joystick refactoring
3100 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3102 • Wxwidgets: Settings mode (open settings without ROM)
3104 • Wxwidgets: Prompt key to use option
3106 • Wxwidgets: Fix crash if key goes away underneath
3108 • Wxwidgets: Fix mouse position in presence of scaling
3110 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3111   using SRC)
3113 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3114   control doesn't seem to work well on WinXP)
3116 • Start paused option.
3118 18.58 rr1-delta7epsilon1
3120 • AVI: ZMBV support
3122 • lsnes-dumpavi: Start Lua before starting dumper
3124 • AVI: Fix secondary audio in mode 4.
3126 18.59 rr1-delta7epsilon2
3128 • AVI: Refactor ZMBV a bit.
3130 • Fix error reading analog values from movie file
3132 18.60 rr1-delta8
3134 • Delayed reset support
3136 • Lua: memory.hash_region
3138 18.61 rr1-delta8epsilon1
3140 • Rework the build system
3142 • Typing input support
3144 • Fix building with bsnes v086 and v087.
3146 • SDL: Save settings on exit
3148 • SDL: Command to enter command line mode with given command.
3150 • SDL: More advanced command editing.
3152 18.62 rr1-delta9
3154 • wxMSW: Fix the “arrow keys and enter don't work” problem
3156 • MSU-1 support
3158 • Show mode changes due to rewinding.
3160 • Unsafe rewind support
3162 • Fix directory transversal.
3164 18.63 rr1-delta10
3166 • AVI: Sound mode 5 (48kHz high-quality)
3168 • Lua: Reset Lua VM
3170 • Map the SNES bus into address space
3172 • Fix loading memory watch files with CRLF line endings
3174 18.64 rr1-delta10epsilon1
3176 • Map bsnes internal state into memory space
3178 • Fix the “click on panel wedges the emulator” for real.
3180 • DnD movies/saves on the main window.
3182 18.65 rr1-delta11
3184 • Split core bindings into own module.
3186 • Remember invalid settings
3188 • Support for modified Gambatte core for GB/GBC emulation.
3190 • Reload/swap ROM function
3192 18.66 rr1-delta11epsilon1
3194 • Fix step poll function
3196 18.67 rr1-delta12
3198 • Non-insane savestate anchoring
3200 18.68 rr1-delta13
3202 • More Memory search methods
3204 • Preserve movie if loading in RO mode.
3206 • Fix a obscure case in timeline check
3208 • Revamp the entiere ROM loading code
3210 • Support DnD on ROMs
3212 • Revamp menu layout
3214 • Standalone hotkey config dialog
3216 • Show bindings in more user-friendly format
3218 18.69 rr1-delta13epsilon1
3220 • Pipedec support
3222 • Fix uninitialized variables in bsnes v085
3224 18.70 rr1-delta14
3226 • Merge gambatte core into mainline (from its own branch)
3228 • Wxwidgets: Show expected dump file formats
3230 • Memory watch: Data typing
3232 • lsnes internal MMIO area.
3234 • Wxwidgets: New memory watch editor
3236 • Hexadecimal memory watches
3238 • Wxwidgets: Monospaced panel
3240 • Wxwidgets: Split memory watches in panel
3242 • Wxwidgets: Disable VMAs in memory search
3244 • lsnes-dumpavi: Fix speed bug
3246 • Movie subtitle support
3248 • Fix rerecord count reporting
3250 • Don't trash movie when loading in readonly mode.
3252 18.71 rr1-delta14epsilon1
3254 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3256 • Fix build on Mac OS X.
3258 • Lua: loopwrapper
3260 • Wxwidgets: Hidable messages window
3262 • Lua: input.joyset
3264 • Bsnes: Support inconsistent saves
3266 • Bsnes: Allow simulating saving every frame
3268 • Fix desync if savestate is loaded in readonly mode in certain 
3269   conditions.
3271 • Wxwidgets: Fix save dialogs on Mac OS X.
3273 • Wxwidgets: Fix insane status width on Win32.
3275 • Wxwidgets: Fix autohold processing to be faster.
3277 • Wxwidgets: Allow loading ROMs and movies from commandline.
3279 18.72 rr1-delta15
3281 • Be a bit smarter with --load
3283 • Rewrote higher-level parts of audio system
3285 • Tool to build commentary tracks
3287 • Lua: input.joyget
3289 • Gambatte: Add support for SVN358
3291 • Use builtin font when rendering status panel.
3293 • Option to detach memory watch to its own window.
3295 • Recent ROMs/Movies menu
3297 • Libao support
3299 • Useful lag counter for SNES games that autopoll
3301 • Fix buffer overflow in gambatte sound output
3303 18.73 rr1-delta15epsilon1
3305 • Don't blow up on wxGTK if the window is hidden somehow
3307 • Support simultaneous drop of ROM and movie.
3309 • Gambatte: Don't save spurious SRAMs.
3311 • Make SGB ROMs actually usable.
3313 • Fix so that saved movies appear in recent movies.
3315 • Don't open multiple commentary editors at once.
3317 18.74 rr1-delta15epsilon2
3319 • Lua: memory.readregion/memory.writeregion
3321 • Lua: memory.map{,s}{byte,word,dword,qword}
3323 • Lua: memory.map_structure
3325 • Lua: Fix bus_address for gambatte
3327 • Fix features dependent of bsnes debugger
3329 • Cleanup bsnes debugger logic
3331 • Fix resets in presence of save every frame
3333 18.75 rr1-delta15epsilon3
3335 • Lua: input.lcid_to_pcid
3337 • Fix off-by-one bug with slot hashes
3339 • Fix crashes on certain memory watch expressions
3341 • Lua: memory.read_expr
3343 • Lua: Fix memory.read_expr on nil argument
3345 • Fix the code to compile on G++ 4.7
3347 • Change button_id to be a function pointer field, not a virtual 
3348   method
3350 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3352 • Gambatte: Always use legacy lag counting
3354 • Memory commands: Memory addresses are up to 16 hex digits, not 
3355   up to 8
3357 • Fix analog controllers
3359 • Fix autohold menus
3361 • Fix button symbols in input display
3363 • Compensate for nuts bsnes superscope/justifier handling
3365 • Lua: Fix bit.extract boolean handling
3367 18.76 rr2-beta0
3369 • Split emulation cores more from the rest
3371 • Support having multiple emulation cores compiled at once
3373 • Support arbitrary number of ports (well, up to 31 anyway).
3375 • SNES debugger support
3377 • Support 16-button controllers
3379 • Remove old SDL front end
3381 • Data-driven controller buttons
3383 • Generate the port code from defines
3385 18.77 rr2-beta1
3387 • Update libgambatte to SVN364
3389 • Get rid of partial linking (building with MXE works)
3391 • Load XML even without gamepack files
3393 • Support screen rotate & flip
3395 • Fix bug when changing controller key to another subkey of the 
3396   same key
3398 18.78 rr1-delta16
3400 • Stop at movie end: Don't off-by-one
3402 • Fix crash closing lsnes with voice playback active.
3404 • Import/Export OggOpus for commentary tracks
3406 • 16-button controllers.
3408 • Don't show nonexistent controllers in input display
3410 • Set voice record/playback volume from UI
3412 • Patches for gambatte SVN364.
3414 • Load markup (if exists) even without gamepack file.
3416 • Screen rotation & flipping
3418 • Lua: Some new bit functions
3420 • Auto-refresh voice streams on change.
3422 • Auto-refresh subtitles on change & new subtitle editor.
3424 • Fix music volume adjustment.
3426 18.79 rr2-beta2
3428 • Use system threads instead of platform threads
3430 • Cleanup build by allowing dummy and real drivers to link 
3431   together.
3433 • Split duplex support
3435 18.80 rr1-delta16epsilon1
3437 • Wxwidgets: Fix memory watch rendering.
3439 • Wxwidgets: Allow setting voice stream gain.
3441 • Wxwidgets: VU meters and volume adjustment.
3443 • Lua: Custom fonts support.
3445 • Lua: Fix methods stopping working when resetting Lua.
3447 • Fix loading standard-format movies in preserve (readonly) mode.
3449 18.81 rr1-delta17
3451 • Primitive movie editor
3453 • Fix VU meter with no sound device.
3455 • Fix various undefined return values.
3457 • Show rates in VU meter window.
3459 18.82 rr2-beta3
3461 • Lua: Render queues as objects
3463 • Bsnes: support hard resets
3465 • Dedicated sound devices dialog
3467 • Change the default AVI sound mode to 2 or 5.
3469 • Fix totally borked movie saving.
3471 • Portaudio: Use split duplex with different devices.
3473 • Fix controls with gambatte core.
3475 • Modify save slot set handling.
3477 • lsnes-dumpavi: --firmware-path.
3479 • Fix lots of compiler warnings.
3481 18.83 rr1-delta17epsilon1
3483 • Commentary tool: Set nominal bit rate and limit max bit rate.
3485 • Lua: Unconditionally reload host memory on loadstate
3487 • Lua: Query bindings, manipulate aliases, create inverse 
3488   bindings
3490 • Lua: Fix crashes with resetting VM while some types of paint 
3491   requests are in flight.
3493 • Lua: gui.text: Clip the text properly instead of corrupting 
3494   memory in some cases.
3496 • Save screenshot header reliably
3498 • Lua: Backport input.get2 and input.set2
3500 • Lua: New controller info functions.
3502 • Movie editor: Fix reset delay counters to be the right way 
3503   around.
3505 • Lua: on_snoop2
3507 • Lua: on_button and input.veto_button.
3509 18.84 rr2-beta4
3511 • Revert memory leak fix breaking input
3513 • Refactor Opus handling
3515 • Restrict member picking only to .zip files
3517 • Fix reading of host-endian VMAs.
3519 • Fix rlow and rhigh to be the right way around.
3521 • Lua: Don't wedge VM if callback fails with an exception
3523 • Refactor Ogg handling.
3525 18.85 rr1-delta17epsilon2
3527 • Fix saving PNG screenshots on Win32.
3529 • Movie editor: Sweep axis.
3531 • Load selected slot in ro/rw/preserve/movie mode.
3533 • input.joyset: Preserve and invert user input.
3535 • Allow immediate saving at point of save (transfer saves).
3537 • Wxwidgets: Filter filenames in dialogs, autoappend extensions.
3539 • data/verysmall.font: Add missing glyph 70 (“F”).
3541 • Lua: Allow painting custom fonts with halo.
3543 • Fix memory value search to work on byte types.
3545 18.86 rr2-beta5
3547 • Reject oggopus files with incomplete pregap
3549 • Fix multistream and ogg demuxing
3551 • Workaround bug with screen >1024 pixels wide.
3553 • Allow on_input to force/veto system controls.
3555 • Dedicated autohold/autofire window.
3557 • Support per-button autofire.
3559 • Fix crash on trying to frameadvance/exit with no ROM loaded.
3561 • Fix nonexistent controller key warnings.
3563 • Movie editor: Fix mouse editing (TYPE_RAXIS)
3565 • TAS input plugin
3567 • Analog passthrough.
3569 • Add throttle axes (TYPE_TAXIS).
3571 • Fix movie reading with first port having multiple controllers.
3573 • Move some info from status panel to statusbar.
3575 18.87 rr1-delta17epsilon3
3577 • Fix status panel (and movie editor) flicker
3579 • Show effects of Lua in input display
3581 • Offer lsmv.backup as file filter too for load lsmv
3583 • Allow slowing down subframe advance 
3585 • Display current save slot information
3587 • Add snes9x fonts
3589 • Fix hotkeys stopping working after X-ing settings dialog
3591 • Movie editor: Fix bug if extending finished movie
3593 • Cap current_frame_first_subframe to movie size when recounting 
3594   movie
3596 • Movie editor: Interpret ctrl+click as right click 
3598 18.88 rr2-beta6
3600 • Autofire: Fix false status indications
3602 • Fix subframe counter
3604 • Fix print() after Lua reset
3606 • New settings framework
3608 • Remove some unused leftover stuff
3610 • Fix race condition causing possible crash on startup
3612 • Fix compiling if uint64_t and size_t are not compatible
3614 • Lua: Don't crash if input.[gs]et{,a} is called outside on_input
3616 18.89 rr2-beta7
3618 • Fix bug causing crash if triple has invalid button