More cleanup via initializer lists
[lsnes.git] / manual.txt
blobc7a80508ef94ee47134962db271eef885ddc2c2d
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.3.30 action <action> [<parameters>]
348 Run specified core action.
350 5.4 Save jukebox 
352 5.4.1 cycle-jukebox-backward
354 Cycle save jukebox backwards.
356 5.4.2 cycle-jukebox-forward
358 Cycle save jukebox forwards
360 5.4.3 load-jukebox
362 Do load from jukebox (current mode).
364 5.4.4 save-jukebox
366 Do state save to jukebox.
368 5.5 Lua 
370 5.5.1 evaluate-lua <luacode>
372 Run Lua code <luacode> using built-in Lua interpretter.
374 5.5.2 run-lua <script>
376 Run specified lua file using built-in Lua interpretter.
378 5.5.3 reset-lua
380 Clear the Lua VM state and restore to factory defaults.
382 5.6 Memory watch
384 5.6.1 add-watch <name> <expression>
386 Adds new watch (or modifies old one).
388 5.6.2 remove-watch <name>
390 Remove a watch.
392 5.7 Sound 
394 5.7.1 enable-sound <on/off> 
396 Enable/Disable sound.
398 5.8 Misc.
400 5.8.1 reload-rom [<file>]
402 Reloads the main ROM image from <file>.
404 5.8.2 +tangent
406 Tangent for recording voice for commentary track. While pressed, 
407 record a stream.
409 5.8.3 advance-subframe-timeout
411 Subframe advance timeout in milliseconds. Default is 100.
413 6 Settings
415 6.1 Core settings
417 6.2 AVI dumper settings
419 6.2.1 avi-large
421 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
422 the console outputs.
424 6.2.2 avi-left-border
426 AVI dumper: Set the default left border thickness (unless lua 
427 overrides) for dumps. Range 0-8191. Default is 0.
429 6.2.3 avi-right-border
431 AVI dumper: Set the default right border thickness (unless lua 
432 overrides) for dumps. Range 0-8191. Default is 0.
434 6.2.4 avi-top-border
436 AVI dumper: Set the default top border thickness (unless lua 
437 overrides) for dumps. Range 0-8191. Default is 0.
439 6.2.5 avi-bottom-border
441 AVI dumper: Set the default bottom border thickness (unless lua 
442 overrides) for dumps. Range 0-8191. Default is 0.
444 6.2.6 avi-maxframes
446 AVI dumper: Maximum number of frames per dump segment (0 => 
447 unlimited). Range 0-999999999. Default is 0.
449 6.2.7 avi-compresison
451 AVI dumper: Compression level (0-18).
453 • Compression levels 10 and above are not compatible with stock 
454   CSCD codec.
456 • Recomended level is 7.
458 6.2.8 avi-soundrate
460 AVI dumper: Set method of determining the sound rate.
462 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
463   64, 88.2, 96, 128, 176.4 and 192 kHz.
465 • 1: Round down to nearest integer.
467 • 2: Round up to nearest ingeter.
469 • 3: Multiply by denominator.
471 • 4: High quality 44.1kHz (SRC needed).
473 • 5: High quality 48kHz (SRC needed).
475 6.3 JMD options
477 6.3.1 jmd-compression
479 JMD dumper: Compression level (0-9).
481 7 Lua functions
483 7.1 Core (in main table)
485 7.1.1 print
487 Print line to message console.
489 7.1.2 exec(string command)
491 Run command as it was entered on the command line
493 7.1.3 utime()
495 Returns two values. First is time since some epoch in seconds, 
496 the second is microseconds mod 10^6 since that epoch.
498 7.1.4 emulator_ready()
500 Returns true if emulator has finished booting, false if not 
501 (on_startup() will be issued later).
503 7.1.5 set_idle_timeout(number timeout)
505 Set number of microseconds to block idle for. After this timeout 
506 has expired, on_idle() will be called once.
508 7.1.6 set_timer_timeout(number timeout)
510 Set number of microseconds to block timer for. After this timeout 
511 has expired, on_timer() will be called once.
513 7.1.7 bus_address(number snesaddr)
515 Returns virtual address corresponding to specified address on 
516 SNES bus.
518 7.1.8 loopwrapper(function fun, ...)
520 Calls function fun with function and specified arguments. The 
521 function passed suspends execution until the function returned is 
522 called. Handy for linear flow control among multiple invocations 
523 of a hook. Example code:
525 on_paint = loopwrapper(function(wait)
527   while true do
529     gui.text(0, 0, “Test!”);
531     wait();
533   end
535 end);
537 7.1.9 list_bindings([string cmd])
539 Get table of all keybindings, indexed by keyspec 
540 (modifiers|mask/key). If command is specified, the table is 
541 limited to that command. Also searches for controller keys.
543 7.1.10 get_alias(string aname)
545 Get expansion of given alias.
547 7.1.11 set_alias(string aname, string value)
549 Set expansion of given alias.
551 7.1.12 create_ibind(string name, string cmd)
553 Return object representing inverse binding with specified name 
554 and specified command.
556 • To create press/release commands, use aliases +foo and -foo .
558 • Keep the returned object around.
560 7.1.13 create_command(string name, function a[, function b])
562 Return object representing a command (pair).
564 • If b is NIL, the command is level-sensitive, a is callback.
566 • If b is function, the function is edge-sensitive, a is positive 
567   edge callback and b is negative edge callback.
569 • All callbacks get single argument: The parameters passed.
571 • Keep the returned object around.
573 7.2 Table bit:
575 Bitwise logical functions and related.
577 7.2.1 bit.none(number...) / bit.bnot(number...)
579 48-bit bitwise NOT / NONE function (set bits that are set in none 
580 of the arguments).
582 7.2.2 bit.any(number...) / bit.bor(number...)
584 48-bit bitwise OR / ANY function (set bits that are set in any of 
585 the arguments).
587 7.2.3 bit.all(number...) / bit.band(number...)
589 48-bit bitwise AND / ALL function (set bits that are set in all 
590 of the arguments).
592 7.2.4 bit.parity(number...) / bit.bxor(number...)
594 48-bit bitwise XOR / PARITY function (set bits that are set in 
595 odd number of the arguments).
597 7.2.5 bit.lrotate(number base[, number amount[, number bits]])
599 Rotate bits-bit (max 48, default 48) number left by amount 
600 (default 1) places.
602 7.2.6 bit.rrotate(number base[, number amount[, number bits]])
604 Rotate bits-bit (max 48, default 48) number right by amount 
605 (default 1) places.
607 7.2.7 bit.lshift(number base[, number amount[, number bits]])
609 Shift bits-bit (max 48, default 48) number left by amount 
610 (default 1) places. The new bits are filled with zeroes.
612 7.2.8 bit.lrshift(number base[, number amount[, number bits]])
614 Shift bits-bit (max 48, default 48) number logically right by 
615 amount (default 1) places. The new bits are filled with zeroes.
617 7.2.9 bit.arshift(number base[, number amount[, number bits]])
619 Shift bits-bit (max 48, default 48) number arithmetically right 
620 by amount (default 1) places. The new bits are shifted in with 
621 copy of the high bit.
623 7.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
625 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
626 and so on.
628 Notes: 
630 • Bit numbers up to 51 should work reliably (then things start 
631   falling apart due to double precision issues).
633 • There are two special bit positions, true and false, standing 
634   for always set bit and always clear bit.
636 7.2.11 bit.value([number bit1[, number bit2,...]])
638 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
639 shifted by bit2 places and so on. As special value, nil argument 
640 is no-op.
642 7.2.12 bit.test_any(number a, number b)
644 Returns true if bitwise and of a and b is nonzero, otherwise 
645 false.
647 7.2.13 bit.test_all(number a, number b)
649 Returns true if bitwise and of a and b is equals b, otherwise 
650 false.
652 7.2.14 bit.popcount(number a)
654 Returns number of set bits in a.
656 7.2.15 bit.clshift(number a, number b, [number amount,[number 
657   bits]])
659 Does chained left shift on a, b by amount positions, assuming 
660 numbers to be of specified number of bits.
662 7.2.16 bit.crshift(number a, number b, [number amount,[number 
663   bits]])
665 Does chained right shift on a, b by amount positions, assuming 
666 numbers to be of specified number of bits.
668 7.2.17 bit.flagdecode(number a, number bits, [string on, [string 
669   off]])
671 Return string of length bits where ith character is ith character 
672 of on if bit i is on, otherwise ith character of off. Out of 
673 range reads give last character, or '*'/'-' if empty.
675 7.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
676   off]])
678 Like bit.flagdecode, but outputs the string in the opposite order 
679 (most significant bit first).
681 7.3 Table gui:
683 Most of these functions can only be called in on_paint and 
684 on_video callbacks. Exceptions are noted.
686 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
687 the green component, bits 16-23 are the red component, bits 24-31 
688 are alpha component (0 is fully opaque, 255 is almost 
689 transparent). -1 is the fully transparent color. Alpha values 
690 greater than 127 do work.
692 Origin of coordinates is at top left corner of game display area. 
693 Left and top gaps correspond to negative coordinates.
695 7.3.1 gui.resolution()
697 Returns 2-tuple (hresolution, vresolution).
699 7.3.2 gui.<class>_gap(number gap)
701 Set the <class> (left, right, top, bottom) gap to specified value 
702 (max gap is 8191). If successful, old gap is returned.
704 7.3.3 gui.delta_<class>_gap(number gap)
706 Increase the <class> (left, right, top, bottom) gap by specified 
707 value (max gap is 8191) and return the old gap (returns nothing 
708 on error).
710 7.3.4 gui.text(number x, number y, string text[, number fgc[, 
711   number bgc]])
713 Draw specified text on the GUI (each character cell is 8 or 16 
714 wide and 16 high). Parameters:
716 • x: X-coordinate to start the drawing from (and x-coordinate at 
717   begining of the lines).
719 • y: Y-coordinate to start the drawing from.
721 • text: The text to draw.
723 • fgc: Text color (default is 0xFFFFFF (white))
725 • bgc: Background color (default is -1 (transparent))
727 7.3.5 gui.textH(number x, number y, string text[, number fgc[, 
728   number bgc]])
730 Like gui.text, but draw using double-width.
732 7.3.6 gui.textV(number x, number y, string text[, number fgc[, 
733   number bgc]])
735 Like gui.text, but draw using double-height.
737 7.3.7 gui.textHV(number x, number y, string text[, number fgc[, 
738   number bgc]])
740 Like gui.text, but draw using double-width/double-height.
742 7.3.8 gui.rectangle(number x, number y, number width, number 
743   height[, number thickness[, number outline[, number fill]]])
745 Draw rectangle on the GUI. Parameters:
747 • x: X-coordinate of left edge.
749 • y: Y-coordinate of upper edge.
751 • width: Width of rectangle.
753 • height: Height of rectangle.
755 • thickness: Thickness of outline (default is 1).
757 • outline: Color of outline (default is 0xFFFFFF (white))
759 • fill: Color of fill (default is -1 (transparent))
761 7.3.9 gui.box(number x, number y, number width, number height[, 
762   number thickness[, number outline1[,number outline2[, number 
763   fill]]]])
765 Draw rectangle with 3D effect on the GUI. Parameters:
767 • x: X-coordinate of left edge.
769 • y: Y-coordinate of upper edge.
771 • width: Width of rectangle.
773 • height: Height of rectangle.
775 • thickness: Thickness of outline (default is 1).
777 • outline1: First color of outline (default is 0xFFFFFF (white))
779 • outline2: First color of outline (default is 0x808080 (dark 
780   gray))
782 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
784 7.3.10 gui.pixel(number x, number y[, number color])
786 Draw one pixel on the GUI. Parameters:
788 • x: X-coordinate of the pixel
790 • y: Y-coordinate of the pixel
792 • color: Color of the pixel (default is 0xFFFFFF (white))
794 7.3.11 gui.crosshair(number x, number y[, number length[, number 
795   color]])
797 Draw a crosshair. Parameters:
799 • x: X-coordinate of the crosshair
801 • y: Y-coordinate of the crosshair
803 • length: Length of the crosshair lines (default 10).
805 • color: Color of the crosshair (default is 0xFFFFFF (white))
807 7.3.12 gui.line(number x1, number y1, number x2, number y2[, 
808   number color])
810 Draw a thin line. Parameters:
812 • x1: X-coordinate of one end.
814 • y1: Y-coordinate of one end.
816 • x2: X-coordinate of the other end.
818 • y2: Y-coordinate of the other end.
820 • color: Color of the line (default is 0xFFFFFF (white)).
822 7.3.13 gui.circle(number x, number y, number r[, number thick[, 
823   number border[, number fil]]])
825 Draw a circle. Parameters.
827 • x: X-coordinate of the center
829 • y: Y-coordinate of the center
831 • r: The radius of the circle
833 • thick: Border thickness
835 • border: Border color (default is 0xFFFFFF (white))
837 • fill: Fill color (default is -1 (transparent)).
839 7.3.14 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
840   palette)
842 Draw a bitmap on screen with specified palette. Parameters:
844 • x: X-coordinate of left edge.
846 • y: Y-coordinate of top edge.
848 • bitmap: The bitmap to draw
850 • palette: The palette to draw the bitmap using.
852 7.3.15 gui.bitmap_draw(number x, number y, dbitmap bitmap)
854 Draw a bitmap on screen. Parameters:
856 • x: X-coordinate of left edge.
858 • y: Y-coordinate of top edge.
860 • bitmap: The bitmap to draw
862 7.3.16 gui.palette_new()
864 Returns a new palette (initially all transparent). Can be used 
865 anywhere.
867 7.3.17 gui.bitmap_new(number w, number h, boolean direct[, bool 
868   icolor])
870 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
872 • w: The width of new bitmap
874 • h: The height of new bitmap
876 • direct: If true, the returned bitmap is dbitmap, otherwise 
877   bitmap.
879 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
880   DBITMAP)
882 7.3.18 gui.bitmap_load(string file)
884 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
885 is palette for bitmap). Can be used anywhere. Parameters:
887 • file: The name of file to load.
889 7.3.19 gui.palette_set(palette palette, number index, number 
890   color)
892 Sets color in palette. Can be used anywhere. Parameters:
894 • palette: The palette to manipulate
896 • index: Index of color (0-65535).
898 • color: The color value.
900 7.3.20 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
901   number color)
903 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
905 • bitmap: The bitmap to manipulate
907 • x: The x-coordinate of the pixel.
909 • y: The y-coordinate of the pixel.
911 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
912   color value.
914 7.3.21 gui.bitmap_size(bitmap/dbitmap bitmap)
916 Get size of bitmap. Can be used anywhere. Parameters:
918 • bitmap: The bitmap to query.
920 The first return is the width, the second is the height.
922 7.3.22 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
923   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
924   number ck])
926 Blit a part of bitmap to another. Can be used anywhere. 
927 Parameters:
929 • dest: Destination to blit to.
931 • dx: left edge of target
933 • dy: Top edge of target
935 • src: The source to blit from. Must be of the same type as 
936   destination.
938 • sx: left edge of source
940 • sy: Top edge of source
942 • w: Width of region
944 • h: Height of region.
946 • ck: Color key. Pixels of this color are not blitted.
948   – If bitmaps are bitmaps, this is color index of colorkey. 
949     Values outside range 0-65535 cause no key to be used as 
950     colorkey.
952   – If bitmaps are dbitmaps, this color value of colorkey.
954   – May be absent or nil for no colorkey blit.
956 7.3.23 gui.repaint()
958 Request on_repaint() to happen as soon as possible. Can be used 
959 anywhere.
961 7.3.24 gui.subframe_update(boolean on)
963 Request subframe updates (calling on_paint() on subframes) to 
964 happen (on=true) or not happen (on=false). Can be used anywhere.
966 7.3.25 gui.screenshot(string filename)
968 Write PNG screenshot of the current frame (no drawings) to 
969 specified file. Can be used anywhere.
971 7.3.26 gui.color(number r, number g, number b[, number a])
973 Returns color (in notation Lua scripts use) corresponding to 
974 color (r,g,b), each component in scale 0-255. If a is specified, 
975 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
976 The default alpha is 256.
978 7.3.27 gui.status(string name, string value)
980 Set status field “L[<name>]” to <value> in status area. Can be 
981 used anywhere.
983 7.3.28 gui.rainbow(number step, number steps[, number color])
985 Perform hue rotation of color <color> (default bright red), by 
986 <step> steps. The number of steps per full rotation is given by 
987 absolute value of <steps>.
989 If <steps> is negative, the rotation will be counterclockwise.
991 7.3.29 gui.screenshot(string filename)
993 Saves a screenshot into specified file.
995 7.3.30 gui.renderq_new(number width, number height)
997 Create render queue with specified reported size and return it.
999 7.3.31 gui.renderq_clear(RENDERQUEUE queue)
1001 Clear specified render queue.
1003 7.3.32 gui.renderq_set(RENDERQUEUE queue)
1005 Switch to specified render queue. Use nil as queue to switch to 
1006 default queue.
1008 • When switched to another queue, all drawing functions work and 
1009   draw there, even outside on_video/on_paint.
1011 7.3.33 gui.renderq_run(RENDERQUEUE queue)
1013 Run specified render queue, copying the objects to current render 
1014 queue. 
1016 • Warning: Don't try to run the current render queue.
1018 7.3.34 gui.loadfont(string filename)
1020 Loads font from specified file (CUSTOMFONT object).
1022 7.3.35 CUSTOMFONT(number x, number y, string text[, number fgc[, 
1023   number bgc[, number hlc]]])
1025 Draw string with custom font to screen. The parameters are the 
1026 same as in gui.text, except hlc is the halo color (default is no 
1027 halo). 
1029 7.4 table input
1031 Input handling. Only available in on_input callback.
1033 7.4.1 input.get(number controller, number index)
1035 Read the specified index (0-11) from specified controller (0-7). 
1036 Notes:
1038 • Uses physical controller numbering. Gamepad in port 2 is 
1039   controller 4, not 1!
1041 7.4.2 input.set(number controller, number index, number value)
1043 Write the specified index (0-11) from specified controller (0-7), 
1044 storing value. Notes:
1046 • Uses physical controller numbering. Gamepad in port 2 is 
1047   controller 4, not 1!
1049 7.4.3 input.get2(number port, number controller, number index)
1051 Read the specified input tuple.
1053 • Port 0 is system port.
1055 7.4.4 input.set2(number port, number controller, number index, 
1056   number value)
1058 Write the specified input tuple.
1060 • Port 0 is system port.
1062 7.4.5 input.lcid_to_pcid2(number lcid)
1064 Look up physical pcid pair (port, controller) corresponding to 
1065 specified logical controller (1-based). Returns nothing if 
1066 controller does not exist.
1068 7.4.6 input.port_type(number port)
1070 Return type of specified port.
1072 7.4.7 input.controller_info(number port, number controller)
1074 Get controller info for specified controller. If controller does 
1075 not exist, returns nil. Otherwise returns a table with following 
1076 fields:
1078 • type (string): Type of the controller.
1080 • class (string): Class of the controller.
1082 • classnum (number): Number of the controller within its class 
1083   (1-based)
1085 • lcid (number): Logical controller number of the controller.
1087 • button_count (number): Number of buttons on controller
1089 • buttons (array): Array of following info about each button:
1091   – type (string): Type of button. Currently one of “null”, “
1092     button”, “axis”, “raxis”.
1094   – name (string): Name of button.
1096   – symbol (string): Symbol of button. Only present for type “
1097     button”.
1099   – hidden (boolean): True if hidden button. 
1101 7.4.8 input.veto_button()
1103 Signals that the button event should be vetoed. Only valid in 
1104 on_button callback.
1106 7.4.9 input.geta(number controller)
1108 Get input state for entiere controller. Returns 13 return values.
1110 • 1st return value: Bitmask: bit i is set if i:th index is 
1111   nonzero
1113 • 2nd-13th return value: value of i:th index.
1115 7.4.10 input.seta(number controller, number bitmask, number 
1116   args...)
1118 Set state for entiere controller. args is up to 12 values for 
1119 indices (overriding values in bitmask if specified).
1121 7.4.11 input.controllertype(number controller)
1123 Get the type of controller as string. Valid values are:
1125 • gamepad
1127 • mouse
1129 • justifier
1131 • superscope
1133 7.4.12 input.reset([number cycles])
1135 Execute reset. If cycles is greater than zero, do delayed reset. 
1136 0 (or no value) causes immediate reset.
1138 • Only available with subframe flag false.
1140 7.4.13 input.raw()
1142 Returns table of tables of all available keys and axes. The first 
1143 table is indexed by key name (platform-dependent!), and the inner 
1144 table has the following fields:
1146 • value: Last reported value for control
1148   – For keys: 1 for pressed, 0 for released.
1150   – For axes: -32767...32767.
1152   – For presure-sensitive buttons: 0...32767.
1154   – For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
1156   – For mouse: Coordinates relative to game area.
1158 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1159   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1160   pressure-pm, pressure-p0).
1162 7.4.14 input.keyhook(string key, boolean state)
1164 Requests that keyhook events to be sent for key (state=true) or 
1165 not sent (state=false).
1167 7.4.15 input.joyget(number controller)
1169 Returns table for current controls for specified controller. The 
1170 names of fields vary by controller type.
1172 • The buttons have the same name as those are referred to in 
1173   other contexts in the emulator
1175 • The analog axes are “xaxis” and “yaxis”.
1177 7.4.16 input.joyset(number controller, table controls)
1179 Set the the state of specified controller to values specified in 
1180 specified table.
1182 7.4.17 input.lcid_to_pcid(number controller)
1184 Return the physical index, physical port and controller number in 
1185 port for specified (1-based) logical controller.
1187 7.5 Table keyboard
1189 Various keybinding-related functions
1191 7.5.1 keyboard.bind(string mod, string mask, string key, string 
1192   cmd)
1194 Bind specified key with specified modifers to specified command.
1196 7.5.2 keyboard.unbind(string mod, string mask, string key)
1198 Unbind specified key with specified modifers.
1200 • nil does not change value
1202 • true/false (buttons) and integers (axes) force value.
1204 • string (button) inverts the input.
1206 7.5.3 keyboard.alias(string alias, string expansion)
1208 Set expansion of given command.
1210 7.6 Table subtitle
1212 Subtitle handling
1214 7.6.1 subtitle.byindex(number i)
1216 Read the frame and length of ith subtitle. Returns nothing if not 
1217 present.
1219 7.6.2 subtitle.set(number f, number l, string txt)
1221 Set the text of subtitle.
1223 7.6.3 subtitle.get(number f, number l)
1225 Get the text of subtitle.
1227 7.6.4 subtitle.delete(number f, number l)
1229 Delete specified subtitle.
1231 7.7 Table hostmemory
1233 Host memory handling (extra memory saved to savestates). Host 
1234 memory starts empty.
1236 7.7.1 hostmemory.read(number address)
1238 Reads hostmemory slot address. Slot numbers out of range return 
1239 false instead of numeric.
1241 7.7.2 hostmemory.write(number address, number value)
1243 Writes hostmemory slot with 0-255. Slot numbers out of range 
1244 cause extension of host memory slot space.
1246 7.7.3 hostmemory.readbyte(number address)
1248 Read unsigned byte (1 element) from given address. Slots out of 
1249 range return false.
1251 7.7.4 hostmemory.writebyte(number address, number value)
1253 Write unsigned byte (1 element) to given slot. Slot numbers out 
1254 of range cause extension.
1256 7.7.5 hostmemory.readsbyte(number address)
1258 Read signed byte (1 element) from given address. Slots out of 
1259 range return false.
1261 7.7.6 hostmemory.writesbyte(number address, number value)
1263 Write signed byte (1 element) to given slot. Slot numbers out of 
1264 range cause extension.
1266 7.7.7 hostmemory.readword(number address)
1268 Read unsigned word (2 elements) from given address. Slots out of 
1269 range return false.
1271 7.7.8 hostmemory.writeword(number address, number value)
1273 Write unsigned word (2 elements) to given slot. Slot numbers out 
1274 of range cause extension.
1276 7.7.9 hostmemory.readsword(number address)
1278 Read signed word (2 elements) from given address. Slots out of 
1279 range return false.
1281 7.7.10 hostmemory.writesword(number address, number value)
1283 Write signed word (2 elements) to given slot. Slot numbers out of 
1284 range cause extension.
1286 7.7.11 hostmemory.readdword(number address)
1288 Read unsigned doubleword (4 elements) from given address. Slots 
1289 out of range return false.
1291 7.7.12 hostmemory.writedword(number address, number value)
1293 Write unsigned doubleword (4 elements) to given slot. Slot 
1294 numbers out of range cause extension.
1296 7.7.13 hostmemory.readsdword(number address)
1298 Read signed doubleword (4 elements) from given address. Slots out 
1299 of range return false.
1301 7.7.14 hostmemory.writesdword(number address, number value)
1303 Write signed doubleword (4 elements) to given slot. Slot numbers 
1304 out of range cause extension.
1306 7.7.15 hostmemory.readqword(number address)
1308 Read unsigned quadword (8 elements) from given address. Slots out 
1309 of range return false.
1311 7.7.16 hostmemory.writeqword(number address, number value)
1313 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1314 out of range cause extension.
1316 7.7.17 hostmemory.readsqword(number address)
1318 Read signed quadword (8 elements) from given address. Slots out 
1319 of range return false.
1321 7.7.18 hostmemory.writesqword(number address, number value)
1323 Write signed quadword (8 elements) to given slot. Slot numbers 
1324 out of range cause extension.
1326 7.8 Table movie
1328 Movie handling
1330 7.8.1 movie.currentframe()
1332 Return number of current frame.
1334 7.8.2 movie.framecount()
1336 Return number of frames in movie.
1338 7.8.3 movie.readonly()
1340 Return true if in readonly mode, false if in readwrite.
1342 7.8.4 movie.rerecords()
1344 Returns the current value of rerecord count.
1346 7.8.5 movie.set_readwrite()
1348 Set readwrite mode (does not cause on_readwrite callback).
1350 7.8.6 movie.frame_subframes(number frame)
1352 Count number of subframes in specified frame (frame numbers are 
1353 1-based) and return that.
1355 7.8.7 movie.read_subframes(number frame, number subframe)
1357 Read specifed subframe in specified frame and return data as 
1358 array (100 elements, numbered 0-99 currently).
1360 7.8.8 movie.read_rtc()
1362 Returns the current value of the RTC as a pair (second, 
1363 subsecond).
1365 7.8.9 movie.unsafe_rewind([UNSAFEREWIND state])
1367 Start setting point for unsafe rewind or jump to point of unsafe 
1368 rewind.
1370 • If called without argument, causes emulator to start process of 
1371   setting unsafe rewind point. When this has finished, callback 
1372   on_set_rewind occurs, passing the rewind state to lua script.
1374 • If called with argument, causes emulator rewind to passed 
1375   rewind point as soon as possible. Readwrite mode is implicitly 
1376   activated.
1378 The following warnings apply to unsafe rewinding:
1380 • There are no safety checks against misuse (that's what “unsafe” 
1381   comes from)!
1383 • Only call rewind from timeline rewind point was set from.
1385 • Only call rewind from after the rewind point was set.
1387 7.9 Table settings
1389 Routines for settings manipulation
1391 7.9.1 settings.get(string name)
1393 Get value of setting. If setting is blank, returns false. If 
1394 setting value can't be obtained, returns (nil, error message).
1396 7.9.2 settings.set(string name, string value)
1398 Set value of setting. If setting can't be set, returns (nil, 
1399 error message).
1401 7.9.3 settings.is_set(string name)
1403 Returns if setting is set. If setting does not exist, returns 
1404 (nil, error message).
1406 7.9.4 settings.blank(string name)
1408 Blanks a setting and returns true. If setting can't be blanked, 
1409 returns (nil, error message).
1411 7.10 Table memory
1413 Contains various functions for managing memory
1415 7.10.1 memory.vma_count()
1417 Returns the number of VMAs
1419 7.10.2 memory.read_vma(number index)
1421 Reads the specified VMA (indices start from zero). Trying to read 
1422 invalid VMA gives nil. The read VMA is table with the following 
1423 fields:
1425 • region_name (string): The readable name of the VMA
1427 • baseaddr (number): Base address of the VMA
1429 • lastaddr (number): Last address in the VMA.
1431 • size (number): The size of VMA in bytes.
1433 • readonly (boolean): True of the VMA corresponds to ROM.
1435 • iospace (boolean): True if the VMA is I/O space.
1437 • native_endian (boolean): True if the VMA has native endian as 
1438   opposed to little endian.
1440 7.10.3 memory.find_vma(number address)
1442 Finds the VMA containing specified address. Returns table in the 
1443 same format as read_vma or nil if not found.
1445 7.10.4 memory.readbyte([string vma, ]number address)
1447 Reads the specified address as unsigned byte and returns the 
1448 result.
1450 7.10.5 memory.readsbyte([string vma, ]number address)
1452 Reads the specified address as signed byte and returns the 
1453 result.
1455 7.10.6 memory.writebyte([string vma, ]number address, number 
1456   value)
1458 Writes the specified value (negative values undergo 2's 
1459 complement) to specified address (as a byte).
1461 7.10.7 memory.readword([string vma, ]number address)
1463 Reads the specified address as unsigned word and returns the 
1464 result.
1466 7.10.8 memory.readsword([string vma, ]number address)
1468 Reads the specified address as signed word and returns the 
1469 result.
1471 7.10.9 memory.writeword([string vma, ]number address, number 
1472   value)
1474 Writes the specified value (negative values undergo 2's 
1475 complement) to specified address (as a word).
1477 7.10.10 memory.readdword([string vma, ]number address)
1479 Reads the specified address as unsigned doubleword and returns 
1480 the result.
1482 7.10.11 memory.readsdword([string vma, ]number address)
1484 Reads the specified address as signed doubleword and returns the 
1485 result.
1487 7.10.12 memory.writedword([string vma, ]number address, number 
1488   value)
1490 Writes the specified value (negative values undergo 2's 
1491 complement) to specified address (as a doubleword).
1493 7.10.13 memory.readqword([string vma, ]number address)
1495 Reads the specified address as unsigned quadword and returns the 
1496 result.
1498 7.10.14 memory.readsqword([string vma, ]number address)
1500 Reads the specified address as signed quadword and returns the 
1501 result.
1503 7.10.15 memory.writeqword([string vma, ]number address, number 
1504   value)
1506 Writes the specified value (negative values undergo 2's 
1507 complement) to specified address (as a quadword).
1509 7.10.16 memory.hash_region([string vma, ]number base, number 
1510   size)
1512 Hash specified number of bytes starting from specified address 
1513 and return the SHA-256.
1515 7.10.17 memory.hash_state()
1517 Hash the current system state. Mainly useful for debugging 
1518 savestates.
1520 7.10.18 memory.readregion([string vma, ]number base, number size)
1522 Read a region of memory.
1524 • Warning: If the region crosses VMA boundary, the results are 
1525   undefined.
1527 7.10.19 memory.map<type>([[string vma, ]number base, number 
1528   size])
1530 Returns a table mapping specified memory aperture for read/write. 
1531 If parameters are omitted, entiere map space is the aperture.
1533 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1534   qword or sqword.
1536 7.10.20 memory.writeregion([string vma, ]number base, number 
1537   size, table data)
1539 Write a region of memory.
1541 • Warning: If the region crosses VMA boundary, the results are 
1542   undefined.
1544 7.10.21 memory.map_structure()
1546 Returns a new mapping structure (MMAP_STRUCT)
1548 7.10.22 MMAP_STRUCT(string key, [string vma, ]number address, 
1549   string type)
1551 Bind key in mmap structure to specified address with specified 
1552 type.
1554 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1555   qword or sqword.
1557 7.10.23 memory.read_expr(string expr)
1559 Evaluate specified watch expression and return result
1561 7.10.24 memory.action(string action, [<params>])
1563 Run core action. The different models expect parameters as:
1565 • string: String
1567 • numeric: numeric
1569 • enumeration: String
1571 • boolean: String
1573 • toggle: None.
1575 7.11 Table memory2
1577 Contains newer memory functions.
1579 7.11.1 memory2()
1581 Returns array of all valid VMA names.
1583 7.11.2 memory2.<vma>:info()
1585 Return table describing given VMA. Includes fields address, size, 
1586 last, readonly, special and endian.
1588 7.11.3 memory2.<vma>:<op>(number offset)
1590 Read from given VMA at given offset (must be in-range). Op is of 
1591 form:
1593 • [i][s]<type>, where <type> is one of 'byte', 'word', 'dword', 
1594   'qword'. 'i' signifies that the value is treated as 
1595   opposite-to-normal endianess, 's' signifies that value is 
1596   treated as signed.
1598 7.11.4 memory2.<vma>:<op>(number offset, number value)
1600 Write value to given VMA at given offset (must be in-range). See 
1601 above for form of op.
1603 7.12 Table subtitle
1605 Contains functions for manipulating subtitles.
1607 7.12.1 subtitle.byindex(number index)
1609 Get (basetime, length) pair of specified subtitle index or 
1610 nothing if index isn't valid.
1612 7.12.2 subtitle.get(number basetime, number length)
1614 Read the specified subtitle. Returns “” if the subtitle does not 
1615 exist.
1617 7.12.3 subtitle.set(number basetime, number length, string 
1618   content)
1620 Set the specified subtitle.
1622 7.12.4 subtitle.deltete(number basetime, number length)
1624 Delete the specified subtitle.
1626 7.13 Table _SYSTEM
1628 Contains copy of global variables from time of Lua 
1629 initialization. Non-writeable.
1631 7.14 Callbacks
1633 Various callbacks to Lua that can occur.
1635 7.14.1 Callback: on_paint(bool not_synth)
1637 Called when screen is being painted. Any gui.* calls requiring 
1638 graphic context draw on the screen.
1640 not_synth is true if this hook is being called in response to 
1641 received frame, false otherwise.
1643 7.14.2 Callback: on_video()
1645 Called when video dump frame is being painted. Any gui.* calls 
1646 requiring graphic context draw on the video.
1648 7.14.3 Callback: on_frame_emulated()
1650 Called when emulating frame has completed and 
1651 on_paint()/on_video() calls are about to be issued.
1653 7.14.4 Callback: on_frame()
1655 Called on each starting whole frame.
1657 7.14.5 Callback: on_startup()
1659 Called when the emulator is starting (lsnes.rc and --run files 
1660 has been run).
1662 7.14.6 Callback: on_rewind()
1664 Called when rewind movie to beginning has completed.
1666 7.14.7 Callback: on_pre_load(string name)
1668 Called just before savestate/movie load occurs (note: loads are 
1669 always delayed, so this occurs even when load was initiated by 
1670 lua).
1672 7.14.8 Callback: on_err_load(string name)
1674 Called if loadstate goes wrong.
1676 7.14.9 Callback: on_post_load(string name, boolean was_savestate)
1678 Called on successful loadstate. was_savestate gives if this was a 
1679 savestate or a movie.
1681 7.14.10 Callback: on_pre_save(string name, boolean is_savestate)
1683 Called just before savestate save occurs (note: movie saves are 
1684 synchronous and won't trigger these callbacks if called from 
1685 Lua).
1687 7.14.11 Callback: on_err_save(string name)
1689 Called if savestate goes wrong.
1691 7.14.12 Callback: on_post_save(string name, boolean is_savestate)
1693 Called on successful savaestate. is_savestate gives if this was a 
1694 savestate or a movie.
1696 7.14.13 Callback: on_quit()
1698 Called when emulator is shutting down.
1700 7.14.14 Callback: on_input(boolean subframe)
1702 Called when emulator is just sending input to bsnes core. 
1703 Warning: This is called even in readonly mode, but the results 
1704 are ignored.
1706 7.14.15 Callback: on_reset()
1708 Called when SNES is reset.
1710 7.14.16 Callback: on_readwrite()
1712 Called when moving into readwrite mode as result of “set-rwmode” 
1713 command (note: moving to rwmode by Lua won't trigger this, as per 
1714 recursive entry protection).
1716 7.14.17 Callback: on_snoop(number port, number controller, number 
1717   index, number value)
1719 Called each time bsnes asks for input. The value is the final 
1720 value to be sent to bsnes core (readonly mode, autohold and 
1721 autofire have been taken into account). Might be useful when 
1722 translating movies to format suitable for console verification. 
1723 Note: There is no way to modify the value to be sent.
1725 • Not called if callback on_snoop2 is defined.
1727 7.14.18 Callback: on_snoop2(number port, number controller, 
1728   number index, number value)
1730 Like on_snoop, but reserves port 0 for system, having first user 
1731 port be port 1.
1733 7.14.19 Callback: on_keyhook(string keyname, table state)
1735 Sent when key that has keyhook events requested changes state. 
1736 Keyname is name of the key (group) and state is the state (same 
1737 kind as table values in input.raw).
1739 7.14.20 Callback: on_idle()
1741 Called when requested by set_idle_timeout(), the timeout has 
1742 expired and emulator is waiting.
1744 7.14.21 Callback: on_timer()
1746 Called when requested by set_idle_timeout() and the timeout has 
1747 expired (regardless if emulator is waiting).
1749 7.14.22 Callback: on_set_rewind(UNSAFEREWIND r)
1751 Called when unsafe rewind object has been constructed.
1753 7.14.23 Callback: on_pre_rewind() 
1755 Called just before unsafe rewind is about to occur.
1757 7.14.24 Callback: on_post_rewind() 
1759 Called just after unsafe rewind has occured.
1761 7.14.25 Callback: on_button(number port, number controller, 
1762   number index, string type)
1764 Called on controller button press, with following parameters:
1766 • port: Port number (0 is system)
1768 • controller: Controller within port
1770 • index: Index of button.
1772 • type: Type of event, one of:
1774   – “pressed”: Button was pressed.
1776   – “released”: Button was released.
1778   – “hold”: Held.
1780   – “unhold”: Released from hold.
1782   – “type”: Typing input on button.
1784   – “untype”: Typing input undone.
1786   – “autofire <duty> <cycle>”: Autofire with specifie duty and 
1787     cycle.
1789   – “autofire”: Stop autofire.
1791   – “analog”: Analog action on axis.
1793 8 Movie editor
1795 • The editor edits in-memory movie.
1797 • Because past can't be edited and readwrite mode doesn't allow 
1798   future, editing only works in read only mode.
1800 • Keyboard triggers the normal hotkeys and bindings.
1802 8.1 Left button actions
1804 • Clicking on cell in future (indicated by lack of redish 
1805   background) toggles it (if it is a button) or prompts for a 
1806   value (if it is an axis)
1808 • Dragging vertically toggles sequence of buttons or changes a 
1809   sequence of axis values.
1811 8.2 Right button actions
1813 The right mouse button pops up a context-sensitive menu:
1815 • Toggle <something>: Toggle this button
1817 • Change <something>: Change this axis value
1819 • Insert frame after: Insert a frame after this frame
1821 • Append frame: Append a frame to movie
1823 • Append frames: Append specified number of frames to movie
1825 • Delete frame: Delete this frame
1827 • Delete subframe: Delete this subframe
1829 • Truncate movie: Delete this subframe and everything after it.
1831 • Scroll to frame: Prompt for a frame and scroll the display to 
1832   that frame.
1834 • Scroll to current frame: Scroll the display to current position
1836 • Run to frame: Prompts for frame and runs the emulation to that 
1837   frame.
1839 • Change number of lines visible: Change the height of the movie 
1840   display (1 to 255).
1842 • Lock scroll to playback: While playing back or rewinding 
1843   movies, the display will follow if enabled.
1845 9 Memory watch expression syntax
1847 Memory watch expressions are in RPN (Reverse Polish Notation). At 
1848 the end of expression, the top entry on stack is taken as the 
1849 final result.
1851 Notations:
1853 • Evaluation order is strictly left to right.
1855 • a is the entry on top of stack
1857 • b is the entry immediately below top of stack
1859 • ; separates values to be pushed (no intermediate pop).
1861 • After end of element, all used stack slots are popped and all 
1862   results are pushed.
1864 • When pushing multiple values, the pushes occur in order shown.
1866 The following operators are available:
1868 • + : a + b
1870 • - : a - b
1872 • * : a * b
1874 • / : a / b
1876 • % : a % b
1878 • a : atan(a)
1880 • b : read_signed_byte(a)
1882 • c : cos(a)
1884 • d : read_signed_dword(a)
1886 • i : quotent(a / b)
1888 • p :\pi
1891 • q : read_signed_qword(a)
1893 • r : sqrt(a)
1895 • s : sin(a)
1897 • t : tan(a)
1899 • u : a; a
1901 • w : read_signed_word(a)
1903 • A : atan2(a, b)
1905 • B : read_unsigned_byte(a)
1907 • C<number>z : Push number <number> to stack.
1909 • D : read_unsigned_dword(a)
1911 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1913 • H<digit> : Set hexadecimal mode with specified number of digits 
1914   (use A-G for 10-16 digits).
1916 • Q : read_unsigned_qword(a)
1918 • R<digit> : round a to <digit> digits.
1920 • W : read_unsigned_word(a)
1922 9.1 Example:
1924 C0x007e0878zWC0x007e002czW-
1926 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1928 2. Pop the value on top of stack (0x7e0878), read word value at 
1929   that address and push the result,call it x1 (W).
1931 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1933 4. Pop the value on top of stack (0x7e002c), read word value at 
1934   that address and push the result,call it x2 (W).
1936 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
1937   x2 and push x2 - x1 (-).
1939 6. Since the expression ends, the final memory watch result is 
1940   the top one on stack, which is x2 - x1.
1942 10 Modifier and key names:
1944 10.1 wxWidgets platform
1946 10.1.1 Modifier names:
1948 Following modifier names are known:
1950 • alt
1952 • ctrl
1954 • shift 
1956 • meta
1958 • cmd (Mac OS X only)
1960 10.1.2 Key names:
1962 Following key names are known:
1964 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1965   dollar, percent, ampersand, quote, leftparen, rightparen, 
1966   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1967   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1968   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1969   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1970   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1971   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1972   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1973   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1974   home, lefT, up, right, down, select, print, execute, snapshot, 
1975   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1976   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1977   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1978   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1979   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1980   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1981   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1982   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1983   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1984   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1985   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1986   windows_right, windows_menu, command, special1, special2, 
1987   special3, special4, special5, special6, special7, special8, 
1988   special9, special10, special11, special12, special13, 
1989   special14, special15, special16, special17, special18, 
1990   special19, special20
1992 11 Movie file format
1994 Movie file is .zip archive in itself, normal ZIP archive tools 
1995 work on it (note: If you recompress it, do not use compression 
1996 methods other than store and deflate and especially do not use 
1997 encryption of any kind).
1999 11.1 Detecting clean start/SRAM/Savestate
2001 • If file has member “savestate” it is savestate, otherwise:
2003 • If file has members with names starting “moviesram.” it is 
2004   movie starting from SRAM, otherwise:
2006 • It is movie starting from clear state.
2008 11.2 Member: gametype
2010 Type of game ROM and region (as one line). Valid values are:
2013 +--------------+---------------------+--------+
2014 |    Value     |       System        | Region |
2015 +--------------+---------------------+--------+
2016 +--------------+---------------------+--------+
2017 |  snes_pal    |     Super NES       |  PAL   |
2018 +--------------+---------------------+--------+
2019 |   sgb_pal    |   Super Game Boy    |  PAL   |
2020 +--------------+---------------------+--------+
2021 |  snes_ntsc   |     Super NES       |  NTSC  |
2022 +--------------+---------------------+--------+
2023 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
2024 +--------------+---------------------+--------+
2025 |     bsx      | BS-X (non-slotted)  |  NTSC  |
2026 +--------------+---------------------+--------+
2027 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
2028 +--------------+---------------------+--------+
2029 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
2030 +--------------+---------------------+--------+
2033 Frame rates are:
2036 +---------+-----------------+
2037 | Region  | Framerate (fps) |
2038 +---------+-----------------+
2039 +---------+-----------------+
2040 |  PAL    |   322445/6448   |
2041 +---------+-----------------+
2042 |  NTSC   | 10738636/178683 |
2043 +---------+-----------------+
2046 11.3 Member: port1
2048 Contains type of port #1 (as one line). Valid values are 'none', 
2049 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
2050 'gamepad'.
2052 11.4 Member: port2
2054 Contains type of port #2 (as one line). Valid values are 'none', 
2055 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
2056 'justifiers'. If not present, defaults to 'none'.
2058 11.5 Member: gamename
2060 Contains name of the game (as one line).
2062 11.6 Member: authors
2064 Contains authors, one per line. Part before '|' is the full name, 
2065 part after is the nickname.
2067 11.7 Member: systemid
2069 Always “lsnes-rr1” (one line). Used to reject other saves.
2071 11.8 Member: controlsversion
2073 Always “0” (one line). Used to identify what controls are there.
2075 11.9 Member: “coreversion”
2077 Contains bsnes core version number (as one line).
2079 11.10 Member: projectid
2081 Contains project ID (as one line). Used to identify if two movies 
2082 are part of the same project.
2084 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2086 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2087 Absent if corresponding file is absent.
2089 11.12 Member: moviesram.<name>
2091 Raw binary startup SRAM of kind <name>. Only present in 
2092 savestates and movies starting from SRAM.
2094 11.13 Member: saveframe
2096 Contains frame number (as one line) of frame movie was saved on. 
2097 Only present in savestates.
2099 11.14 Member: lagcounter
2101 Current value of lag counter (as one line). Only present in 
2102 savestates.
2104 11.15 Member: pollcounters
2106 Contains poll counters (currently 100 of them), one per line. 
2107 Each line is raw poll count if DRDY is set for it. Otherwise it 
2108 is negative poll count minus one. Only present in savestates.
2110 11.16 Member: hostmemory
2112 Raw binary dump of host memory. Only present in savestates.
2114 11.17 Member: savestate
2116 The raw binary savestate itself. Savestate detection uses this 
2117 file, only present in savestates.
2119 11.18 Member: screenshot
2121 Screenshot of current frame. Only present in savestates. First 2 
2122 bytes are big-endian width of image, rest are 24-bit RGB image 
2123 data. Height of image is inferred from the width and size of 
2124 data.
2126 11.19 Member: sram.<name>
2128 Raw binary SRAM of kind <name> at time of savestate. Only present 
2129 in savestates.
2131 11.20 Member: input
2133 The actual input track, one line per subframe (blank lines are 
2134 skipped).
2136 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2137   the line is part of same frame as previous, otherwise it starts 
2138   a new frame.
2140 • First subframe must start a new frame.
2142 Length of movie in frames is number of lines in input file that 
2143 start a new frame.
2145 11.21 Member: subtitles
2147 Subtitle track. Optional.
2149 • Each line is in form <firstframe> <numframes> <text>.
2151 • Linefeed is encoded as \n, backslash is encoded as \\.
2153 11.22 Member: rerecords
2155 Contains textual base-10 rerecord count (as one line; emulator 
2156 just writes this, it doesn't read it) + 1.
2158 11.23 Member: rrdata
2160 This member stores set of load IDs. There is one load ID per 
2161 rerecord (plus one corresponding to start of project).
2163 • This member constists of concatenation of records
2165 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2166   consequtive IDs.
2168 • IDs are interpretted as 256-bit big-endian integers with 
2169   warparound.
2171 • Initial predicted ID is all zeroes.
2173 Format of each record is:
2175 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2176   bits 5-6 are count length (countlen). Bit 7 is unused.
2178 • 32-prefixlen bytes of ID.
2180 • countlen bytes of big-endian count (count).
2182 Records are processed as follows:
2184 • To form the first ID encoded by record, take the first 
2185   prefixlen bytes predicted ID and append the read ID value to 
2186   it. The result is the first ID encoded.
2188 • If countlen is 0, record encodes 1 ID.
2190 • If countlen is 1, record encodes 2+count IDs.
2192 • If countlen is 2, record encodes 258+count IDs.
2194 • If countlen is 3, record encodes 65794+count IDs.
2196 • The new predicted ID is the next ID after last one encoded by 
2197   the record.
2199 The number of rerecords + 1 is equal to the sum of number of IDs 
2200 encoded by all records.
2202 11.24 Member: starttime.second
2204 Movie starting time, second part. Epoch is Unix epoch. Default is 
2205 1,000,000,000.
2207 11.25 Member: starttime.subsecond
2209 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2210 is 0.
2212 11.26 Member: savetime.second
2214 Movie saving time, second part. Default is starttime.second. Only 
2215 present in savestates.
2217 11.27 Member: savetime.subsecond
2219 Movie saving time, subsecond part. Default is 
2220 starttime.subsecond. Only present in savestates.
2222 12 lsvs file format (commentary tracks)
2224 12.1 Clusters
2226 • Each cluster is 8kB (8192 bytes) in size.
2228 • Cluster n starts at offset 8192*n in file.
2230 • The following clusters are system special:
2232   – Cluster 0 and all clusters with number multiple of 2048 
2233     (cluster tables)
2235   – Cluster 1 (superblock)
2237 12.2 Cluster tables
2239 • The cluster table describing cluster n is stored in cluster n & 
2240   ~0x7FF (zero last 11 bits of n).
2242 • This cluster table consists of 2048 4-byte big-endian integers.
2244 • Each entry describes a cluster in 16MB supercluster, in order.
2246 • The valid values for entries are:
2248   – 0x00000000: Free cluster
2250   – 0x00000001: Last cluster in chain.
2252   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2254   – (anything else): Number of next cluster in chain. Must not be 
2255     multiple of 2048.
2257 • Due to limitations of the format, there can be at most 2097052 
2258   superclusters, giving maximum file size of 16TB.
2260 12.3 Stream table
2262 • The stream table chain always starts in cluster 2.
2264 • Otherwise, it follows normal chaining.
2266 • The stream table consists of 16-byte entries:
2268   – The first 8 bytes of entry give big-endian beginning position 
2269     of stream in units of 1/48000 s.
2271   – The next 4 bytes of entry give big-endian beginning cluster 
2272     for control data. 0 here marks the entry as not present.
2274   – The last 4 bytes of entry give big-endian beginning cluster 
2275     for codec data.
2277 • Stream table clusters are normal clusters, following normal 
2278   chaining.
2280 • The stream begnning position is not guarenteed unique. There 
2281   can be multiple streams with the same starting position in the 
2282   file.
2284 12.4 Stream control data
2286 • The stream control data consists of entries 4 bytes each:
2288   – The first 2 bytes of entry gives big-endian length of packet
2290   – The next byte of entry gives audio length of packet in units 
2291     of 1/400 s.
2293   – The last byte is control byte.
2295     ∗ 0 means this entry is not present and the control data 
2296       ends.
2298     ∗ 1 is valid control entry.
2300 • The stream control data can also end by running into end of the 
2301   readable chain.
2303   – This happens if there happens to be exact multiple of 2048 
2304     packets in stream and number of packets is nonzero.
2306 • These clusters follow normal chaining.
2308 12.5 Stream codec data
2310 • Stream codec data consists of raw Opus data packets packed back 
2311   to back with nothing in between.
2313 • Warning: Due to internal limitations, this data must reside in 
2314   the first 65536 superclusters (that is, the first 1TB of the 
2315   file).
2317 12.6 Superblock
2319 • The superblock is stored in cluster 1. 
2321 • The first 11 bytes are “sefs-magic”<NUL>.
2323 • The rest are unused.
2325 • This cluster 1 is marked as system special.
2327 13 Known ROM extensions
2329 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2330   dx2, mgd, mgh.
2332 • DMG cartridge ROMs: dmg, gb.
2334 • GBC cartridge ROMs: cgb, gbc.
2336 14 Gamepack files
2338 • The first line must be: “[GAMEPACK FILE]”.
2340 • There is one needed line: “type <systype>”. This sets system 
2341   type to <systype>. The following system types are valid:
2343   – snes (SNES)
2345   – bsx (BS-X non-slotted)
2347   – bsxslotted (BS-X slotted)
2349   – sufamiturbo (Sufami Turbo)
2351   – sgb (Super Game Boy)
2353   – dmg (Game Boy)
2355   – gbc (Game Boy Color)
2357   – gbc_gba (Game Boy Color with GBA initial register values)
2359 • Optionally a region can be specified: “region <region>”. The 
2360   following values are valid:
2362   – autodetect (Autodetect region: snes and sgb only)
2364   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2366   – pal (PAL: snes, sgb)
2368   – world (World: dmg, gbc, gbc_gba)
2370 • ROM images are loaded as: “rom <type> <file>”. The following 
2371   types are valid:
2373   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2374     bsxslotted, sufamiturbo)
2376   – bsx (Cartridge ROM in bsx, bsxslotted)
2378   – slot-a (Cartridge ROM in sufamiturbo)
2380   – slot-b (Cartridge ROM in sufamiturbo)
2382 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2383   valid are the same as for ROMs.
2385 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2386   types are the same as for ROMs.
2388   – Offset is given in form [+-]<number>. Usually offset is 
2389     either +0 or -512.
2391   – Default offset is +0.
2393 14.1 Example:
2395 [GAMEPACK FILE]
2397 type snes
2399 rom rom speedygonzales.sfc
2401 patch-512 rom sonicthehedgehog.ips
2403 14.2 Example 2:
2405 [GAMEPACK FILE]
2407 type sgb
2409 rom rom supergameboy.sfc
2411 rom dmg megamanV.dmg
2413 15 Quick'n'dirty encode guide
2415 1. Start the emulator and load the ROM and movie file.
2417 2. Set large AVI option 'set-setting avi-large on'
2419 3. Enable dumping 'dump-avi tmpdump' 
2421 4. Unpause and let it run until you want to end dumping.
2423 5. Close the emulator (closing the window is the easiest way). Or 
2424   use 'end-avi'.
2426 6. For each tmpdump*.avi file created, on command prompt, do 
2427   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2429 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2431 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2432   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2433   tmpdump_<numbers>.mkv, with + in between).
2435 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2436   final.mkv contains quick'n'dirty encode.
2438 16 Axis configurations for some gamepad types:
2440 16.1 XBox360 controller:
2442 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2443 set to pressure-+.
2445 set-axis joystick0axis2 pressure-+
2447 set-axis joystick0axis5 pressure-+
2449 • This is needed for SDL only. EVDEV sets those types correctly.
2451 16.2 PS3 “sixaxis” controller:
2453 Axes 8-19 should be disabled.
2455 set-axis joystick0axis8 disabled
2457 set-axis joystick0axis9 disabled
2459 set-axis joystick0axis10 disabled
2461 set-axis joystick0axis11 disabled
2463 set-axis joystick0axis12 disabled
2465 set-axis joystick0axis13 disabled
2467 set-axis joystick0axis14 disabled
2469 set-axis joystick0axis15 disabled
2471 set-axis joystick0axis16 disabled
2473 set-axis joystick0axis17 disabled
2475 set-axis joystick0axis18 disabled
2477 set-axis joystick0axis19 disabled
2479 17 Errata:
2481 17.1 Problems from BSNES core:
2483 • The whole pending save stuff.
2485 • Lack of layer hiding.
2487 • It is slow (especially accuracy).
2489 • Firmwares can't be loaded from ZIP archives.
2491 17.2 Other problems:
2493 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2495 • Audio for last dumped frame is not itself dumped.
2497 • Audio in UI is pretty bad in quality if game doesn't run at 
2498   full speed.
2500 • No menus, command based interface (SDL).
2502 • Long commands don't scroll.
2504 18 Changelog:
2506 18.1 rr0-beta1
2508 • Fix -Wall warnings
2510 • Fix dumper video corruption with levels 10-18.
2512 18.2 rr0-beta2
2514 • Autofire
2516 • Lots of code cleanups
2518 • Lua interface to settings
2520 • Allow specifying AVI borders without Lua
2522 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2524 • on_snoop lua callback
2526 • Faster movie loading and saving.
2528 18.3 rr0-beta3
2530 • Joystick support
2532 18.4 rr0-beta4
2534 • Fix multi-buttons
2536 • Save jukebox functionality.
2538 18.5 rr0-beta5
2540 • Try to fix some nasty failing movie load edge cases
2542 • Allow specifying scripts to run on command line.
2544 18.6 rr0-beta6
2546 • Major source code reorganization.
2548 • Backup savestates before overwriting.
2550 • Don't crash if loading initial state fails.
2552 18.7 rr0-beta7
2554 • Fix firmware lookup
2556 • Fix author name parsing
2558 • Fix rerecord counting
2560 • (SDL) Print messages to console if SDL is uninitialized
2562 • Add movieinfo program
2564 • Fix loading movies starting from SRAM.
2566 18.8 rr0-beta8
2568 • Add support for unattended dumping
2570 • Fix compiling for Win32
2572 • Don't lock up if sound can't be initialized
2574 • Strip trailing CR from commands
2576 • Don't try to do dubious things in global ctors (fix crash on 
2577   startup)
2579 18.9 rr0-beta9
2581 • Small documentation tweaking
2583 • Fix make clean
2585 • Fix major bug in modifier matching
2587 18.10 rr0-beta10
2589 • Lots of documentation fixes
2591 • Use dedicated callbacks for event backcomm., not commands.
2593 • Ensure that the watchdog is not hit when executing delayed 
2594   reset.
2596 • Remove errant tab from joystick message.
2598 18.11 rr0-beta11
2600 • Make autofire operate in absolute time, not linear time
2602 • Reinitialize controls when resuming from loadstate
2604 • Some more code cleanups
2606 • If Lua allocator fails, call OOM_panic()
2608 • Byte/word/dword/qword sized host memory write/read functions.
2610 • Dump at correct framerate if dumping interlaced NTSC 
2611   (height=448).
2613 18.12 rr0-beta12
2615 • Actually include the complete source code
2617 • Keep track of RTC
2619 18.13 rr0-beta13
2621 • Document {save,start}time.{,sub}second.
2623 • Intercept time() from bsnes core.
2625 18.14 rr0-beta14
2627 • Allow disabling time() interception (allow build on Mac OS X)
2629 • Use SDLMain on Mac OS X (make SDL not crash)
2631 • Disable delayed resets (just plain too buggy for now).
2633 • Code cleanups
2635 • Use 16-bit for graphics/video instead of 32-bit.
2637 • gui.rectangle/gui.pixel
2639 • gui.crosshair
2641 • New CSCD writer implementation.
2643 18.15 rr0-beta15
2645 • Fix interaction of * and +.
2647 • Manual improvements
2649 • Use gettimeofday()/usleep(), these seem portable enough.
2651 • Move joystick axis manipulation to keymapper code.
2653 • Changes to how read-only works.
2655 • Refactor controller input code.
2657 18.16 rr0-beta16
2659 • Fix mouseclick scale compensation.
2661 • Draw area boundaries correctly in SDL code.
2663 • gui.screenshot.
2665 • Fix CSCD output (buffer overrun and race condition).
2667 18.17 rr0-beta17
2669 • JMD dumping support.
2671 • Allow unattended dumping to JMD.
2673 • Move to BSNES v083.
2675 • Switch back to 32-bit colors.
2677 • Add Lua function gui.color.
2679 • Use some new C++11 features in GCC 4.6.
2681 • Be prepared for core frequency changes.
2683 • Pass colors in one chunk from Lua.
2685 18.18 rr0-beta18
2687 • New lua functions gui.line(), gui.status() and gui.circle(), 
2688   memory.vma_count(), memory.read_vma() and memory.find_vma().
2690 • Numerious documentation fixups
2692 • RTC time format changed
2694 • Reformat flags display
2696 • Allow lua package name to be overridden
2698 • SDUMP (high-quality dumping).
2700 • Split platform support to plugins.
2702 • Make all sound plugins support basic sound commands
2704 • Support portaudio for sound.
2706 • Allow disable Lua/SDL searching.
2708 • Upconvert colors when copying lcscreen to screen.
2710 • Reorganize source tree.
2712 • Evdev joystick support.
2714 • Refactor more code into generic window code.
2716 18.19 rr0-beta19
2718 • Refactor message handling.
2720 • Rework makefile
2722 • Documentation fixes
2724 • Finish pending saves before load/quit.
2726 • Wxwidgets graphics plugin.
2728 18.20 rr0-beta20
2730 • Get rid of win32-crap.[ch]pp.
2732 • Move files around a lot.
2734 • Get rid of need for host C++ compiler.
2736 • Bsnes v084 core.
2738 • Refactor inter-component communication.
2740 • Fix zero luma.
2742 • Fix crash on multiline aliases.
2744 • Load/Save settings in wxwidgets gui.
2746 18.21 rr0-beta21
2748 • Patch problems in bsnes core
2750 • SNES is little-endian, not big-endian!
2752 • Fix memory corruption in lcscreen::load()
2754 18.22 rr0-beta22
2756 • Fix interpretting repeat counts in rrdata loading.
2758 • New lua callback: on_frame()
2760 • Remove calls to runtosave() that aren't supposed to be there
2762 • Lua function: movie.read_rtc()
2764 • Ignore src/fonts/font.cpp
2766 • Fix more bsnes core problems
2768 • Control bsnes random seeding
2770 • Pause-on-end
2772 • Some bsnes core debugging features (state dump and state hash)
2774 • Fix titlebar version number (no, the last version wasn't 
2775   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2777 18.23 rr0-beta23
2779 • Fix memory corruption due to macro/field mixup
2781 • search-memory update
2783 • Allow direct-mapped framebuffer
2785 • SDL: Use SDL_ANYFORMAT if possible
2787 • SDMP2SOX: 2s delay modes.
2789 • Wxwidgets: Cleanups
2791 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2793 • Wxwidgets: Save jukebox on exit
2795 • Fix RTC if using load-movie on savestate.
2797 • Fix crash related to full console mode.
2799 18.24 rr0-beta24
2801 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2802   X.
2804 • Wxwidgets: Allow compiling on Mac OS X.
2806 • Use movie compare instead of movie hashing (faster save/load).
2808 • Lua: _SYSTEM table.
2810 18.25 rr0-beta25
2812 • sdmp2sox: Pad soundtrack if using -l or -L.
2814 • sdmp2sox: Fix NTSC overscan.
2816 • sdmp2sox: Add AR correction mode.
2818 • call lua_close() when exiting.
2820 • Fix zip_writer bug causing warnings from info-zip and error 
2821   from advzip.
2823 18.26 rr0-beta26
2825 • Fix IPS patching code (use bsnes core IPS patcher).
2827 • Implement BPS patching (using bsnes core IPS patcher).
2829 • Add feature to load headered ROMs.
2831 18.27 rr0-beta27
2833 • Show command names when showing keybindings
2835 18.28 rr0
2837 • Fix pause-on-end to be actually controllable
2839 • SDL: Poll all events in queue, not just first one (fixes 
2840   slowness in command typing)
2842 • Wxwidgets: Fix ROM loading.
2844 18.29 rr1-beta0
2846 • Lua: Add gui.textH, gui.textV, gui.textHV
2848 • Fix text colors on SDL on Mac OS X
2850 • Mode 'F' for finished in readonly mode.
2852 • Fix some WS errors.
2854 • Reliably pause after skip poll
2856 • Split UI and core into their own threads
2858 18.30 rr1-beta1
2860 • Remove leftover dummy SRAM slot
2862 • Fix controller numbers.
2864 18.31 rr1-beta2
2866 • Fix lsnes-dumpavi after interface change.
2868 • Also give BSNES patches for v085.
2870 • Pack movie data in memory.
2872 18.32 rr1-beta3
2874 • Fix framecount/length given when loading movies.
2876 • Controller command memory leak fixes.
2878 • Don't leak palette if freeing screen object.
2880 18.33 rr1-beta4
2882 • Detect revisions.
2884 • Wxwidgets: Allow controlling dumper from the menu.
2886 18.34 rr1-beta5
2888 • Rewrite parts of manual
2890 • Lua: Make it work with Lua 5.2.
2892 18.35 rr1-beta6
2894 • Win32: Fix compile errors.
2896 18.36 rr1-beta7
2898 • Refactor controller input code.
2900 • Fix crash when using command line on SDL / Mac OS X.
2902 18.37 rr1-beta8
2904 • Delete core/coroutine (obsolete)
2906 • Lag input display by one frame.
2908 • Rewind movie to beginning function.
2910 • Fix wrong frame number reported to Lua when repainting after 
2911   loadstate
2913 • Support UI editing of jukebox
2915 • Wxwidgets: Save settings on exit.
2917 • Support ${project} for filenames
2919 • SDL: Fix command history
2921 18.38 rr1-beta9
2923 • Fix some order-of-global-ctor bugs.
2925 18.39 rr1-beta10
2927 • Fix crashes when quitting on Win32.
2929 18.40 rr1-beta11
2931 • EVDEV: Queue keypresses from joystick, don't send directly
2933 • Wxwidgets: Load-Preserve that actually works.
2935 18.41 rr1-beta12
2937 • Wxwidgets: GUI for memory search.
2939 • Warn about using synchronous queue in UI callback.
2941 18.42 rr1-beta13
2943 • Remember last saved file for each ROM
2945 • Support MT dumping via boost.
2947 • Lua: input.raw
2949 • Lua: input.keyhook
2951 • Make mouse be ordinary input instead of special-casing
2953 • SDL: Don't screw up commands with NUL codepoints.
2955 18.43 rr1-beta14
2957 • Merge status panel and main window
2959 • True movie slot support (the rest of it)
2961 • SDL: Fix compilation error
2963 • Elminate cross calls in dump menu code.
2965 18.44 rr1-beta15
2967 • Cancel pending saves command
2969 • Wxwidgets: Code refactoring
2971 • Wxwidgets: Fix system -> reset
2973 • Wxwidgets: Read watch expressions in the right thread
2975 18.45 rr1-beta16
2977 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
2978   doesn't support that).
2980 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
2981   needed).
2983 • Don't append trailing '-' to prefix when saving movie.
2985 • Fix ROM/savestate handling (don't let user mismatch ROM and 
2986   savestates).
2988 18.46 rr1
2990 • Document memory watch syntax.
2992 18.47 rr1-delta1
2994 • Fix unattended dumping (lsnes-dumpavi)
2996 • Support RAW dumping
2998 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
2999   (changes syntax)
3001 • Add option to control sample rate preturbation in AVI dumper
3003 18.48 rr1-delta2
3005 • Wxwidgets: Fix dumper submodes
3007 • Set core controller types before loadstate
3009 18.49 rr1-delta2epsilon1
3011 • Fix compiling with bsnes v086.
3013 18.50 rr1-delta3
3015 • Don't prompt before quitting
3017 • Start unpaused, preserve pause/unpause over load.
3019 • Try to autodetect if ROM is headered.
3021 • Wxwidgets: Only bring up ROM patching screen if specifically 
3022   requested.
3024 • Allow configuring some hotkeys.
3026 18.51 rr1-delta4
3028 • Lots of code cleanups
3030 • Fix JMD compression (JMD dumping was broken)
3032 • Don't crash if Lua C function throws an exception.
3034 • Support bitmap drawing in Lua.
3036 • Fix bsnes v085/v086 patches.
3038 • Improve stability on win32.
3040 18.52 rr1-delta4epsilon1
3042 • Don't corrupt movie if movie length is integer multiple of 
3043   frames per page.
3045 18.53 rr1-delta5
3047 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
3049 • New Lua functions: emulator_ready(), utime(), 
3050   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
3051   bit.value(), input.geta(), input.seta() and 
3052   input.controllertype()
3054 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
3056 • Wxwidgets: Fix broken modifiers
3058 • on_paint has parameter now.
3060 • Optional initital fill for bitmaps
3062 • Fix palette changing.
3064 • Optimize rendering a bit.
3066 • Bsnes v087 support.
3068 18.54 rr1-delta5epsilon1
3070 • Movieinfo: Fix display of port #2 type.
3072 • Call on_input() after loadstate.
3074 18.55 rr1-delta5epsilon2
3076 • Fix writing port2 data to movie.
3078 • Fix SRAM handling with Bsnes v087.
3080 18.56 rr1-delta6
3082 • Library loading support
3084 • Built-in TSCC encoder
3086 • Hi-color (256T colors) dumping.
3088 • Dump over TCP/IP(v6)
3090 • Hidable status panel
3092 • Turbo toggle/hold
3094 • Adjustable sound volume
3096 • Screen scaling
3098 • Allow DnD into filename boxes
3100 • Configurable paths
3102 • Portaudio: Fix speaker popping at start
3104 • Lots of UI changes
3106 • Speed adjustment menu
3108 • Win32 joystick support
3110 • Lua: gui.rainbow and gui.box
3112 • Split key lists into classes (the key list was large!)
3114 • More save slots support
3116 • Wxwidgets (wxJoystick) joystick support
3118 18.57 rr1-delta7
3120 • Lots of internal joystick refactoring
3122 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3124 • Wxwidgets: Settings mode (open settings without ROM)
3126 • Wxwidgets: Prompt key to use option
3128 • Wxwidgets: Fix crash if key goes away underneath
3130 • Wxwidgets: Fix mouse position in presence of scaling
3132 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3133   using SRC)
3135 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3136   control doesn't seem to work well on WinXP)
3138 • Start paused option.
3140 18.58 rr1-delta7epsilon1
3142 • AVI: ZMBV support
3144 • lsnes-dumpavi: Start Lua before starting dumper
3146 • AVI: Fix secondary audio in mode 4.
3148 18.59 rr1-delta7epsilon2
3150 • AVI: Refactor ZMBV a bit.
3152 • Fix error reading analog values from movie file
3154 18.60 rr1-delta8
3156 • Delayed reset support
3158 • Lua: memory.hash_region
3160 18.61 rr1-delta8epsilon1
3162 • Rework the build system
3164 • Typing input support
3166 • Fix building with bsnes v086 and v087.
3168 • SDL: Save settings on exit
3170 • SDL: Command to enter command line mode with given command.
3172 • SDL: More advanced command editing.
3174 18.62 rr1-delta9
3176 • wxMSW: Fix the “arrow keys and enter don't work” problem
3178 • MSU-1 support
3180 • Show mode changes due to rewinding.
3182 • Unsafe rewind support
3184 • Fix directory transversal.
3186 18.63 rr1-delta10
3188 • AVI: Sound mode 5 (48kHz high-quality)
3190 • Lua: Reset Lua VM
3192 • Map the SNES bus into address space
3194 • Fix loading memory watch files with CRLF line endings
3196 18.64 rr1-delta10epsilon1
3198 • Map bsnes internal state into memory space
3200 • Fix the “click on panel wedges the emulator” for real.
3202 • DnD movies/saves on the main window.
3204 18.65 rr1-delta11
3206 • Split core bindings into own module.
3208 • Remember invalid settings
3210 • Support for modified Gambatte core for GB/GBC emulation.
3212 • Reload/swap ROM function
3214 18.66 rr1-delta11epsilon1
3216 • Fix step poll function
3218 18.67 rr1-delta12
3220 • Non-insane savestate anchoring
3222 18.68 rr1-delta13
3224 • More Memory search methods
3226 • Preserve movie if loading in RO mode.
3228 • Fix a obscure case in timeline check
3230 • Revamp the entiere ROM loading code
3232 • Support DnD on ROMs
3234 • Revamp menu layout
3236 • Standalone hotkey config dialog
3238 • Show bindings in more user-friendly format
3240 18.69 rr1-delta13epsilon1
3242 • Pipedec support
3244 • Fix uninitialized variables in bsnes v085
3246 18.70 rr1-delta14
3248 • Merge gambatte core into mainline (from its own branch)
3250 • Wxwidgets: Show expected dump file formats
3252 • Memory watch: Data typing
3254 • lsnes internal MMIO area.
3256 • Wxwidgets: New memory watch editor
3258 • Hexadecimal memory watches
3260 • Wxwidgets: Monospaced panel
3262 • Wxwidgets: Split memory watches in panel
3264 • Wxwidgets: Disable VMAs in memory search
3266 • lsnes-dumpavi: Fix speed bug
3268 • Movie subtitle support
3270 • Fix rerecord count reporting
3272 • Don't trash movie when loading in readonly mode.
3274 18.71 rr1-delta14epsilon1
3276 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3278 • Fix build on Mac OS X.
3280 • Lua: loopwrapper
3282 • Wxwidgets: Hidable messages window
3284 • Lua: input.joyset
3286 • Bsnes: Support inconsistent saves
3288 • Bsnes: Allow simulating saving every frame
3290 • Fix desync if savestate is loaded in readonly mode in certain 
3291   conditions.
3293 • Wxwidgets: Fix save dialogs on Mac OS X.
3295 • Wxwidgets: Fix insane status width on Win32.
3297 • Wxwidgets: Fix autohold processing to be faster.
3299 • Wxwidgets: Allow loading ROMs and movies from commandline.
3301 18.72 rr1-delta15
3303 • Be a bit smarter with --load
3305 • Rewrote higher-level parts of audio system
3307 • Tool to build commentary tracks
3309 • Lua: input.joyget
3311 • Gambatte: Add support for SVN358
3313 • Use builtin font when rendering status panel.
3315 • Option to detach memory watch to its own window.
3317 • Recent ROMs/Movies menu
3319 • Libao support
3321 • Useful lag counter for SNES games that autopoll
3323 • Fix buffer overflow in gambatte sound output
3325 18.73 rr1-delta15epsilon1
3327 • Don't blow up on wxGTK if the window is hidden somehow
3329 • Support simultaneous drop of ROM and movie.
3331 • Gambatte: Don't save spurious SRAMs.
3333 • Make SGB ROMs actually usable.
3335 • Fix so that saved movies appear in recent movies.
3337 • Don't open multiple commentary editors at once.
3339 18.74 rr1-delta15epsilon2
3341 • Lua: memory.readregion/memory.writeregion
3343 • Lua: memory.map{,s}{byte,word,dword,qword}
3345 • Lua: memory.map_structure
3347 • Lua: Fix bus_address for gambatte
3349 • Fix features dependent of bsnes debugger
3351 • Cleanup bsnes debugger logic
3353 • Fix resets in presence of save every frame
3355 18.75 rr1-delta15epsilon3
3357 • Lua: input.lcid_to_pcid
3359 • Fix off-by-one bug with slot hashes
3361 • Fix crashes on certain memory watch expressions
3363 • Lua: memory.read_expr
3365 • Lua: Fix memory.read_expr on nil argument
3367 • Fix the code to compile on G++ 4.7
3369 • Change button_id to be a function pointer field, not a virtual 
3370   method
3372 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3374 • Gambatte: Always use legacy lag counting
3376 • Memory commands: Memory addresses are up to 16 hex digits, not 
3377   up to 8
3379 • Fix analog controllers
3381 • Fix autohold menus
3383 • Fix button symbols in input display
3385 • Compensate for nuts bsnes superscope/justifier handling
3387 • Lua: Fix bit.extract boolean handling
3389 18.76 rr2-beta0
3391 • Split emulation cores more from the rest
3393 • Support having multiple emulation cores compiled at once
3395 • Support arbitrary number of ports (well, up to 31 anyway).
3397 • SNES debugger support
3399 • Support 16-button controllers
3401 • Remove old SDL front end
3403 • Data-driven controller buttons
3405 • Generate the port code from defines
3407 18.77 rr2-beta1
3409 • Update libgambatte to SVN364
3411 • Get rid of partial linking (building with MXE works)
3413 • Load XML even without gamepack files
3415 • Support screen rotate & flip
3417 • Fix bug when changing controller key to another subkey of the 
3418   same key
3420 18.78 rr1-delta16
3422 • Stop at movie end: Don't off-by-one
3424 • Fix crash closing lsnes with voice playback active.
3426 • Import/Export OggOpus for commentary tracks
3428 • 16-button controllers.
3430 • Don't show nonexistent controllers in input display
3432 • Set voice record/playback volume from UI
3434 • Patches for gambatte SVN364.
3436 • Load markup (if exists) even without gamepack file.
3438 • Screen rotation & flipping
3440 • Lua: Some new bit functions
3442 • Auto-refresh voice streams on change.
3444 • Auto-refresh subtitles on change & new subtitle editor.
3446 • Fix music volume adjustment.
3448 18.79 rr2-beta2
3450 • Use system threads instead of platform threads
3452 • Cleanup build by allowing dummy and real drivers to link 
3453   together.
3455 • Split duplex support
3457 18.80 rr1-delta16epsilon1
3459 • Wxwidgets: Fix memory watch rendering.
3461 • Wxwidgets: Allow setting voice stream gain.
3463 • Wxwidgets: VU meters and volume adjustment.
3465 • Lua: Custom fonts support.
3467 • Lua: Fix methods stopping working when resetting Lua.
3469 • Fix loading standard-format movies in preserve (readonly) mode.
3471 18.81 rr1-delta17
3473 • Primitive movie editor
3475 • Fix VU meter with no sound device.
3477 • Fix various undefined return values.
3479 • Show rates in VU meter window.
3481 18.82 rr2-beta3
3483 • Lua: Render queues as objects
3485 • Bsnes: support hard resets
3487 • Dedicated sound devices dialog
3489 • Change the default AVI sound mode to 2 or 5.
3491 • Fix totally borked movie saving.
3493 • Portaudio: Use split duplex with different devices.
3495 • Fix controls with gambatte core.
3497 • Modify save slot set handling.
3499 • lsnes-dumpavi: --firmware-path.
3501 • Fix lots of compiler warnings.
3503 18.83 rr1-delta17epsilon1
3505 • Commentary tool: Set nominal bit rate and limit max bit rate.
3507 • Lua: Unconditionally reload host memory on loadstate
3509 • Lua: Query bindings, manipulate aliases, create inverse 
3510   bindings
3512 • Lua: Fix crashes with resetting VM while some types of paint 
3513   requests are in flight.
3515 • Lua: gui.text: Clip the text properly instead of corrupting 
3516   memory in some cases.
3518 • Save screenshot header reliably
3520 • Lua: Backport input.get2 and input.set2
3522 • Lua: New controller info functions.
3524 • Movie editor: Fix reset delay counters to be the right way 
3525   around.
3527 • Lua: on_snoop2
3529 • Lua: on_button and input.veto_button.
3531 18.84 rr2-beta4
3533 • Revert memory leak fix breaking input
3535 • Refactor Opus handling
3537 • Restrict member picking only to .zip files
3539 • Fix reading of host-endian VMAs.
3541 • Fix rlow and rhigh to be the right way around.
3543 • Lua: Don't wedge VM if callback fails with an exception
3545 • Refactor Ogg handling.
3547 18.85 rr1-delta17epsilon2
3549 • Fix saving PNG screenshots on Win32.
3551 • Movie editor: Sweep axis.
3553 • Load selected slot in ro/rw/preserve/movie mode.
3555 • input.joyset: Preserve and invert user input.
3557 • Allow immediate saving at point of save (transfer saves).
3559 • Wxwidgets: Filter filenames in dialogs, autoappend extensions.
3561 • data/verysmall.font: Add missing glyph 70 (“F”).
3563 • Lua: Allow painting custom fonts with halo.
3565 • Fix memory value search to work on byte types.
3567 18.86 rr2-beta5
3569 • Reject oggopus files with incomplete pregap
3571 • Fix multistream and ogg demuxing
3573 • Workaround bug with screen >1024 pixels wide.
3575 • Allow on_input to force/veto system controls.
3577 • Dedicated autohold/autofire window.
3579 • Support per-button autofire.
3581 • Fix crash on trying to frameadvance/exit with no ROM loaded.
3583 • Fix nonexistent controller key warnings.
3585 • Movie editor: Fix mouse editing (TYPE_RAXIS)
3587 • TAS input plugin
3589 • Analog passthrough.
3591 • Add throttle axes (TYPE_TAXIS).
3593 • Fix movie reading with first port having multiple controllers.
3595 • Move some info from status panel to statusbar.
3597 18.87 rr1-delta17epsilon3
3599 • Fix status panel (and movie editor) flicker
3601 • Show effects of Lua in input display
3603 • Offer lsmv.backup as file filter too for load lsmv
3605 • Allow slowing down subframe advance 
3607 • Display current save slot information
3609 • Add snes9x fonts
3611 • Fix hotkeys stopping working after X-ing settings dialog
3613 • Movie editor: Fix bug if extending finished movie
3615 • Cap current_frame_first_subframe to movie size when recounting 
3616   movie
3618 • Movie editor: Interpret ctrl+click as right click 
3620 18.88 rr2-beta6
3622 • Autofire: Fix false status indications
3624 • Fix subframe counter
3626 • Fix print() after Lua reset
3628 • New settings framework
3630 • Remove some unused leftover stuff
3632 • Fix race condition causing possible crash on startup
3634 • Fix compiling if uint64_t and size_t are not compatible
3636 • Lua: Don't crash if input.[gs]et{,a} is called outside on_input
3638 18.89 rr2-beta7
3640 • Fix bug causing crash if triple has invalid button