Make opus_packet_tick_count a common function
[lsnes.git] / manual.txt
blob4e135ad4c7e112f604de7a9a8c2a3967688d0a0d
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 designate-position <class>-<#>-analog<n>
310 Designate position for analog pair. <n> is only there if there 
311 are multiple axis pairs.
313 5.3.23 autofire (<pattern>|-)...
315 Set autofire pattern. Each parameter is comma-separated list of 
316 button names to hold on that frame. After reaching the end of 
317 pattern, the pattern restarts from the beginning.
319 5.3.24 repaint
321 Force a repaint.
323 5.3.25 toggle-pause-on-end
325 Toggle pause on end flag.
327 5.3.26 set-pause-on-end
329 Set pause on end flag.
331 5.3.27 clear-pause-on-end
333 Clear pause on end flag.
335 5.4 Save jukebox 
337 5.4.1 cycle-jukebox-backward
339 Cycle save jukebox backwards.
341 5.4.2 cycle-jukebox-forward
343 Cycle save jukebox forwards
345 5.4.3 load-jukebox
347 Do load from jukebox (current mode).
349 5.4.4 save-jukebox
351 Do state save to jukebox.
353 5.5 Lua 
355 Only available if lua support is compiled in.
357 5.5.1 evaluate-lua <luacode>
359 Run Lua code <luacode> using built-in Lua interpretter.
361 5.5.2 run-lua <script>
363 Run specified lua file using built-in Lua interpretter.
365 5.5.3 reset-lua
367 Clear the Lua VM state and restore to factory defaults.
369 5.6 Memory watch
371 5.6.1 add-watch <name> <expression>
373 Adds new watch (or modifies old one).
375 5.6.2 remove-watch <name>
377 Remove a watch.
379 5.7 Sound 
381 5.7.1 enable-sound <on/off> 
383 Enable/Disable sound.
385 5.8 Misc.
387 5.8.1 reload-rom [<file>]
389 Reloads the main ROM image from <file>.
391 5.8.2 +tangent
393 Tangent for recording voice for commentary track. While pressed, 
394 record a stream.
396 6 Settings
398 6.1 Core settings
400 6.2 AVI dumper settings
402 6.2.1 avi-large
404 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
405 the console outputs.
407 6.2.2 avi-left-border
409 AVI dumper: Set the default left border thickness (unless lua 
410 overrides) for dumps. Range 0-8191. Default is 0.
412 6.2.3 avi-right-border
414 AVI dumper: Set the default right border thickness (unless lua 
415 overrides) for dumps. Range 0-8191. Default is 0.
417 6.2.4 avi-top-border
419 AVI dumper: Set the default top border thickness (unless lua 
420 overrides) for dumps. Range 0-8191. Default is 0.
422 6.2.5 avi-bottom-border
424 AVI dumper: Set the default bottom border thickness (unless lua 
425 overrides) for dumps. Range 0-8191. Default is 0.
427 6.2.6 avi-maxframes
429 AVI dumper: Maximum number of frames per dump segment (0 => 
430 unlimited). Range 0-999999999. Default is 0.
432 6.2.7 avi-compresison
434 AVI dumper: Compression level (0-18).
436 • Compression levels 10 and above are not compatible with stock 
437   CSCD codec.
439 • Recomended level is 7.
441 6.2.8 avi-soundrate
443 AVI dumper: Set method of determining the sound rate.
445 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
446   64, 88.2, 96, 128, 176.4 and 192 kHz.
448 • 1: Round down to nearest integer.
450 • 2: Round up to nearest ingeter.
452 • 3: Multiply by denominator.
454 • 4: High quality 44.1kHz (SRC needed).
456 • 5: High quality 48kHz (SRC needed).
458 6.3 JMD options
460 6.3.1 jmd-compression
462 JMD dumper: Compression level (0-9).
464 7 Lua functions
466 7.1 Core (in main table)
468 7.1.1 print
470 Print line to message console.
472 7.1.2 exec(string command)
474 Run command as it was entered on the command line
476 7.1.3 utime()
478 Returns two values. First is time since some epoch in seconds, 
479 the second is microseconds mod 10^6 since that epoch.
481 7.1.4 emulator_ready()
483 Returns true if emulator has finished booting, false if not 
484 (on_startup() will be issued later).
486 7.1.5 set_idle_timeout(number timeout)
488 Set number of microseconds to block idle for. After this timeout 
489 has expired, on_idle() will be called once.
491 7.1.6 set_timer_timeout(number timeout)
493 Set number of microseconds to block timer for. After this timeout 
494 has expired, on_timer() will be called once.
496 7.1.7 bus_address(number snesaddr)
498 Returns virtual address corresponding to specified address on 
499 SNES bus.
501 7.1.8 loopwrapper(function fun, ...)
503 Calls function fun with function and specified arguments. The 
504 function passed suspends execution until the function returned is 
505 called. Handy for linear flow control among multiple invocations 
506 of a hook. Example code:
508 on_paint = loopwrapper(function(wait)
510   while true do
512     gui.text(0, 0, “Test!”);
514     wait();
516   end
518 end);
520 7.1.9 list_bindings([string cmd])
522 Get table of all keybindings, indexed by keyspec 
523 (modifiers|mask/key). If command is specified, the table is 
524 limited to that command. Also searches for controller keys.
526 7.1.10 get_alias(string aname)
528 Get expansion of given alias.
530 7.1.11 set_alias(string aname, string value)
532 Set expansion of given alias.
534 7.1.12 create_ibind(string name, string cmd)
536 Return object representing inverse binding with specified name 
537 and specified command.
539 • To create press/release commands, use aliases +foo and -foo .
541 • Keep the returned object around.
543 7.2 Table bit:
545 Bitwise logical functions and related.
547 7.2.1 bit.none(number...) / bit.bnot(number...)
549 48-bit bitwise NOT / NONE function (set bits that are set in none 
550 of the arguments).
552 7.2.2 bit.any(number...) / bit.bor(number...)
554 48-bit bitwise OR / ANY function (set bits that are set in any of 
555 the arguments).
557 7.2.3 bit.all(number...) / bit.band(number...)
559 48-bit bitwise AND / ALL function (set bits that are set in all 
560 of the arguments).
562 7.2.4 bit.parity(number...) / bit.bxor(number...)
564 48-bit bitwise XOR / PARITY function (set bits that are set in 
565 odd number of the arguments).
567 7.2.5 bit.lrotate(number base[, number amount[, number bits]])
569 Rotate bits-bit (max 48, default 48) number left by amount 
570 (default 1) places.
572 7.2.6 bit.rrotate(number base[, number amount[, number bits]])
574 Rotate bits-bit (max 48, default 48) number right by amount 
575 (default 1) places.
577 7.2.7 bit.lshift(number base[, number amount[, number bits]])
579 Shift bits-bit (max 48, default 48) number left by amount 
580 (default 1) places. The new bits are filled with zeroes.
582 7.2.8 bit.lrshift(number base[, number amount[, number bits]])
584 Shift bits-bit (max 48, default 48) number logically right by 
585 amount (default 1) places. The new bits are filled with zeroes.
587 7.2.9 bit.arshift(number base[, number amount[, number bits]])
589 Shift bits-bit (max 48, default 48) number arithmetically right 
590 by amount (default 1) places. The new bits are shifted in with 
591 copy of the high bit.
593 7.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
595 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
596 and so on.
598 Notes: 
600 • Bit numbers up to 51 should work reliably (then things start 
601   falling apart due to double precision issues).
603 • There are two special bit positions, true and false, standing 
604   for always set bit and always clear bit.
606 7.2.11 bit.value([number bit1[, number bit2,...]])
608 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
609 shifted by bit2 places and so on. As special value, nil argument 
610 is no-op.
612 7.2.12 bit.test_any(number a, number b)
614 Returns true if bitwise and of a and b is nonzero, otherwise 
615 false.
617 7.2.13 bit.test_all(number a, number b)
619 Returns true if bitwise and of a and b is equals b, otherwise 
620 false.
622 7.2.14 bit.popcount(number a)
624 Returns number of set bits in a.
626 7.2.15 bit.clshift(number a, number b, [number amount,[number 
627   bits]])
629 Does chained left shift on a, b by amount positions, assuming 
630 numbers to be of specified number of bits.
632 7.2.16 bit.crshift(number a, number b, [number amount,[number 
633   bits]])
635 Does chained right shift on a, b by amount positions, assuming 
636 numbers to be of specified number of bits.
638 7.2.17 bit.flagdecode(number a, number bits, [string on, [string 
639   off]])
641 Return string of length bits where ith character is ith character 
642 of on if bit i is on, otherwise ith character of off. Out of 
643 range reads give last character, or '*'/'-' if empty.
645 7.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
646   off]])
648 Like bit.flagdecode, but outputs the string in the opposite order 
649 (most significant bit first).
651 7.3 Table gui:
653 Most of these functions can only be called in on_paint and 
654 on_video callbacks. Exceptions are noted.
656 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
657 the green component, bits 16-23 are the red component, bits 24-31 
658 are alpha component (0 is fully opaque, 255 is almost 
659 transparent). -1 is the fully transparent color. Alpha values 
660 greater than 127 do work.
662 Origin of coordinates is at top left corner of game display area. 
663 Left and top gaps correspond to negative coordinates.
665 7.3.1 gui.resolution()
667 Returns 2-tuple (hresolution, vresolution).
669 7.3.2 gui.<class>_gap(number gap)
671 Set the <class> (left, right, top, bottom) gap to specified value 
672 (max gap is 8191).
674 7.3.3 gui.text(number x, number y, string text[, number fgc[, 
675   number bgc]])
677 Draw specified text on the GUI (each character cell is 8 or 16 
678 wide and 16 high). Parameters:
680 • x: X-coordinate to start the drawing from (and x-coordinate at 
681   begining of the lines).
683 • y: Y-coordinate to start the drawing from.
685 • text: The text to draw.
687 • fgc: Text color (default is 0xFFFFFF (white))
689 • bgc: Background color (default is -1 (transparent))
691 7.3.4 gui.textH(number x, number y, string text[, number fgc[, 
692   number bgc]])
694 Like gui.text, but draw using double-width.
696 7.3.5 gui.textV(number x, number y, string text[, number fgc[, 
697   number bgc]])
699 Like gui.text, but draw using double-height.
701 7.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
702   number bgc]])
704 Like gui.text, but draw using double-width/double-height.
706 7.3.7 gui.rectangle(number x, number y, number width, number 
707   height[, number thickness[, number outline[, number fill]]])
709 Draw rectangle on the GUI. Parameters:
711 • x: X-coordinate of left edge.
713 • y: Y-coordinate of upper edge.
715 • width: Width of rectangle.
717 • height: Height of rectangle.
719 • thickness: Thickness of outline (default is 1).
721 • outline: Color of outline (default is 0xFFFFFF (white))
723 • fill: Color of fill (default is -1 (transparent))
725 7.3.8 gui.box(number x, number y, number width, number height[, 
726   number thickness[, number outline1[,number outline2[, number 
727   fill]]]])
729 Draw rectangle with 3D effect on the GUI. Parameters:
731 • x: X-coordinate of left edge.
733 • y: Y-coordinate of upper edge.
735 • width: Width of rectangle.
737 • height: Height of rectangle.
739 • thickness: Thickness of outline (default is 1).
741 • outline1: First color of outline (default is 0xFFFFFF (white))
743 • outline2: First color of outline (default is 0x808080 (dark 
744   gray))
746 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
748 7.3.9 gui.pixel(number x, number y[, number color])
750 Draw one pixel on the GUI. Parameters:
752 • x: X-coordinate of the pixel
754 • y: Y-coordinate of the pixel
756 • color: Color of the pixel (default is 0xFFFFFF (white))
758 7.3.10 gui.crosshair(number x, number y[, number length[, number 
759   color]])
761 Draw a crosshair. Parameters:
763 • x: X-coordinate of the crosshair
765 • y: Y-coordinate of the crosshair
767 • length: Length of the crosshair lines (default 10).
769 • color: Color of the crosshair (default is 0xFFFFFF (white))
771 7.3.11 gui.line(number x1, number y1, number x2, number y2[, 
772   number color])
774 Draw a thin line. Parameters:
776 • x1: X-coordinate of one end.
778 • y1: Y-coordinate of one end.
780 • x2: X-coordinate of the other end.
782 • y2: Y-coordinate of the other end.
784 • color: Color of the line (default is 0xFFFFFF (white)).
786 7.3.12 gui.circle(number x, number y, number r[, number thick[, 
787   number border[, number fil]]])
789 Draw a circle. Parameters.
791 • x: X-coordinate of the center
793 • y: Y-coordinate of the center
795 • r: The radius of the circle
797 • thick: Border thickness
799 • border: Border color (default is 0xFFFFFF (white))
801 • fill: Fill color (default is -1 (transparent)).
803 7.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
804   palette)
806 Draw a bitmap on screen with specified palette. Parameters:
808 • x: X-coordinate of left edge.
810 • y: Y-coordinate of top edge.
812 • bitmap: The bitmap to draw
814 • palette: The palette to draw the bitmap using.
816 7.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
818 Draw a bitmap on screen. Parameters:
820 • x: X-coordinate of left edge.
822 • y: Y-coordinate of top edge.
824 • bitmap: The bitmap to draw
826 7.3.15 gui.palette_new()
828 Returns a new palette (initially all transparent). Can be used 
829 anywhere.
831 7.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool 
832   icolor])
834 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
836 • w: The width of new bitmap
838 • h: The height of new bitmap
840 • direct: If true, the returned bitmap is dbitmap, otherwise 
841   bitmap.
843 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
844   DBITMAP)
846 7.3.17 gui.bitmap_load(string file)
848 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
849 is palette for bitmap). Can be used anywhere. Parameters:
851 • file: The name of file to load.
853 7.3.18 gui.palette_set(palette palette, number index, number 
854   color)
856 Sets color in palette. Can be used anywhere. Parameters:
858 • palette: The palette to manipulate
860 • index: Index of color (0-65535).
862 • color: The color value.
864 7.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
865   number color)
867 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
869 • bitmap: The bitmap to manipulate
871 • x: The x-coordinate of the pixel.
873 • y: The y-coordinate of the pixel.
875 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
876   color value.
878 7.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
880 Get size of bitmap. Can be used anywhere. Parameters:
882 • bitmap: The bitmap to query.
884 The first return is the width, the second is the height.
886 7.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
887   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
888   number ck])
890 Blit a part of bitmap to another. Can be used anywhere. 
891 Parameters:
893 • dest: Destination to blit to.
895 • dx: left edge of target
897 • dy: Top edge of target
899 • src: The source to blit from. Must be of the same type as 
900   destination.
902 • sx: left edge of source
904 • sy: Top edge of source
906 • w: Width of region
908 • h: Height of region.
910 • ck: Color key. Pixels of this color are not blitted.
912   – If bitmaps are bitmaps, this is color index of colorkey. 
913     Values outside range 0-65535 cause no key to be used as 
914     colorkey.
916   – If bitmaps are dbitmaps, this color value of colorkey.
918   – May be absent or nil for no colorkey blit.
920 7.3.22 gui.repaint()
922 Request on_repaint() to happen as soon as possible. Can be used 
923 anywhere.
925 7.3.23 gui.subframe_update(boolean on)
927 Request subframe updates (calling on_paint() on subframes) to 
928 happen (on=true) or not happen (on=false). Can be used anywhere.
930 7.3.24 gui.screenshot(string filename)
932 Write PNG screenshot of the current frame (no drawings) to 
933 specified file. Can be used anywhere.
935 7.3.25 gui.color(number r, number g, number b[, number a])
937 Returns color (in notation Lua scripts use) corresponding to 
938 color (r,g,b), each component in scale 0-255. If a is specified, 
939 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
940 The default alpha is 256.
942 7.3.26 gui.status(string name, string value)
944 Set status field “L[<name>]” to <value> in status area. Can be 
945 used anywhere.
947 7.3.27 gui.rainbow(number step, number steps[, number color])
949 Perform hue rotation of color <color> (default bright red), by 
950 <step> steps. The number of steps per full rotation is given by 
951 absolute value of <steps>.
953 If <steps> is negative, the rotation will be counterclockwise.
955 7.3.28 gui.screenshot(string filename)
957 Saves a screenshot into specified file.
959 7.3.29 gui.renderq_new(number width, number height)
961 Create render queue with specified reported size and return it.
963 7.3.30 gui.renderq_clear(RENDERQUEUE queue)
965 Clear specified render queue.
967 7.3.31 gui.renderq_set(RENDERQUEUE queue)
969 Switch to specified render queue. Use nil as queue to switch to 
970 default queue.
972 • When switched to another queue, all drawing functions work and 
973   draw there, even outside on_video/on_paint.
975 7.3.32 gui.renderq_run(RENDERQUEUE queue)
977 Run specified render queue, copying the objects to current render 
978 queue. 
980 • Warning: Don't try to run the current render queue.
982 7.3.33 gui.loadfont(string filename)
984 Loads font from specified file (CUSTOMFONT object).
986 7.3.34 CUSTOMFONT(number x, number y, string text[, number fgc[, 
987   number bgc]])
989 Draw string with custom font to screen. The parameters are the 
990 same as in gui.text.
992 7.4 table input
994 Input handling. Only available in on_input callback.
996 7.4.1 input.get(number controller, number index)
998 Read the specified index (0-11) from specified controller (0-7). 
999 Notes:
1001 • Uses physical controller numbering. Gamepad in port 2 is 
1002   controller 4, not 1!
1004 7.4.2 input.set(number controller, number index, number value)
1006 Write the specified index (0-11) from specified controller (0-7), 
1007 storing value. Notes:
1009 • Uses physical controller numbering. Gamepad in port 2 is 
1010   controller 4, not 1!
1012 7.4.3 input.get2(number port, number controller, number index)
1014 Read the specified input tuple.
1016 • Port 0 is system port.
1018 7.4.4 input.set2(number port, number controller, number index, 
1019   number value)
1021 Write the specified input tuple.
1023 • Port 0 is system port.
1025 7.4.5 input.lcid_to_pcid2(number lcid)
1027 Look up physical pcid pair (port, controller) corresponding to 
1028 specified logical controller (1-based). Returns nothing if 
1029 controller does not exist.
1031 7.4.6 input.port_type(number port)
1033 Return type of specified port.
1035 7.4.7 input.controller_info(number port, number controller)
1037 Get controller info for specified controller. If controller does 
1038 not exist, returns nil. Otherwise returns a table with following 
1039 fields:
1041 • type (string): Type of the controller.
1043 • class (string): Class of the controller.
1045 • classnum (number): Number of the controller within its class 
1046   (1-based)
1048 • lcid (number): Logical controller number of the controller.
1050 • button_count (number): Number of buttons on controller
1052 • buttons (array): Array of following info about each button:
1054   – type (string): Type of button. Currently one of “null”, “
1055     button”, “axis”, “raxis”.
1057   – name (string): Name of button.
1059   – symbol (string): Symbol of button. Only present for type “
1060     button”.
1062   – hidden (boolean): True if hidden button. 
1064 7.4.8 input.veto_button()
1066 Signals that the button event should be vetoed. Only valid in 
1067 on_button callback.
1069 7.4.9 input.geta(number controller)
1071 Get input state for entiere controller. Returns 13 return values.
1073 • 1st return value: Bitmask: bit i is set if i:th index is 
1074   nonzero
1076 • 2nd-13th return value: value of i:th index.
1078 7.4.10 input.seta(number controller, number bitmask, number 
1079   args...)
1081 Set state for entiere controller. args is up to 12 values for 
1082 indices (overriding values in bitmask if specified).
1084 7.4.11 input.controllertype(number controller)
1086 Get the type of controller as string. Valid values are:
1088 • gamepad
1090 • mouse
1092 • justifier
1094 • superscope
1096 7.4.12 input.reset([number cycles])
1098 Execute reset. If cycles is greater than zero, do delayed reset. 
1099 0 (or no value) causes immediate reset.
1101 • Only available with subframe flag false.
1103 7.4.13 input.raw()
1105 Returns table of tables of all available keys and axes. The first 
1106 table is indexed by key name (platform-dependent!), and the inner 
1107 table has the following fields:
1109 • value: Last reported value for control
1111   – For keys: 1 for pressed, 0 for released.
1113   – For axes: -32767...32767.
1115   – For presure-sensitive buttons: 0...32767.
1117   – For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
1119   – For mouse: Coordinates relative to game area.
1121 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1122   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1123   pressure-pm, pressure-p0).
1125 7.4.14 input.keyhook(string key, boolean state)
1127 Requests that keyhook events to be sent for key (state=true) or 
1128 not sent (state=false).
1130 7.4.15 input.joyget(number controller)
1132 Returns table for current controls for specified controller. The 
1133 names of fields vary by controller type.
1135 • The buttons have the same name as those are referred to in 
1136   other contexts in the emulator
1138 • The analog axes are “xaxis” and “yaxis”.
1140 7.4.16 input.joyset(number controller, table controls)
1142 Set the the state of specified controller to values specified in 
1143 specified table.
1145 7.4.17 input.lcid_to_pcid(number controller)
1147 Return the physical index, physical port and controller number in 
1148 port for specified (1-based) logical controller.
1150 7.5 Table keyboard
1152 Various keybinding-related functions
1154 7.5.1 keyboard.bind(string mod, string mask, string key, string 
1155   cmd)
1157 Bind specified key with specified modifers to specified command.
1159 7.5.2 keyboard.unbind(string mod, string mask, string key)
1161 Unbind specified key with specified modifers.
1163 7.5.3 keyboard.alias(string alias, string expansion)
1165 Set expansion of given command.
1167 7.6 Table subtitle
1169 Subtitle handling
1171 7.6.1 subtitle.byindex(number i)
1173 Read the frame and length of ith subtitle. Returns nothing if not 
1174 present.
1176 7.6.2 subtitle.set(number f, number l, string txt)
1178 Set the text of subtitle.
1180 7.6.3 subtitle.get(number f, number l)
1182 Get the text of subtitle.
1184 7.6.4 subtitle.delete(number f, number l)
1186 Delete specified subtitle.
1188 7.7 Table hostmemory
1190 Host memory handling (extra memory saved to savestates). Host 
1191 memory starts empty.
1193 7.7.1 hostmemory.read(number address)
1195 Reads hostmemory slot address. Slot numbers out of range return 
1196 false instead of numeric.
1198 7.7.2 hostmemory.write(number address, number value)
1200 Writes hostmemory slot with 0-255. Slot numbers out of range 
1201 cause extension of host memory slot space.
1203 7.7.3 hostmemory.readbyte(number address)
1205 Read unsigned byte (1 element) from given address. Slots out of 
1206 range return false.
1208 7.7.4 hostmemory.writebyte(number address, number value)
1210 Write unsigned byte (1 element) to given slot. Slot numbers out 
1211 of range cause extension.
1213 7.7.5 hostmemory.readsbyte(number address)
1215 Read signed byte (1 element) from given address. Slots out of 
1216 range return false.
1218 7.7.6 hostmemory.writesbyte(number address, number value)
1220 Write signed byte (1 element) to given slot. Slot numbers out of 
1221 range cause extension.
1223 7.7.7 hostmemory.readword(number address)
1225 Read unsigned word (2 elements) from given address. Slots out of 
1226 range return false.
1228 7.7.8 hostmemory.writeword(number address, number value)
1230 Write unsigned word (2 elements) to given slot. Slot numbers out 
1231 of range cause extension.
1233 7.7.9 hostmemory.readsword(number address)
1235 Read signed word (2 elements) from given address. Slots out of 
1236 range return false.
1238 7.7.10 hostmemory.writesword(number address, number value)
1240 Write signed word (2 elements) to given slot. Slot numbers out of 
1241 range cause extension.
1243 7.7.11 hostmemory.readdword(number address)
1245 Read unsigned doubleword (4 elements) from given address. Slots 
1246 out of range return false.
1248 7.7.12 hostmemory.writedword(number address, number value)
1250 Write unsigned doubleword (4 elements) to given slot. Slot 
1251 numbers out of range cause extension.
1253 7.7.13 hostmemory.readsdword(number address)
1255 Read signed doubleword (4 elements) from given address. Slots out 
1256 of range return false.
1258 7.7.14 hostmemory.writesdword(number address, number value)
1260 Write signed doubleword (4 elements) to given slot. Slot numbers 
1261 out of range cause extension.
1263 7.7.15 hostmemory.readqword(number address)
1265 Read unsigned quadword (8 elements) from given address. Slots out 
1266 of range return false.
1268 7.7.16 hostmemory.writeqword(number address, number value)
1270 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1271 out of range cause extension.
1273 7.7.17 hostmemory.readsqword(number address)
1275 Read signed quadword (8 elements) from given address. Slots out 
1276 of range return false.
1278 7.7.18 hostmemory.writesqword(number address, number value)
1280 Write signed quadword (8 elements) to given slot. Slot numbers 
1281 out of range cause extension.
1283 7.8 Table movie
1285 Movie handling
1287 7.8.1 movie.currentframe()
1289 Return number of current frame.
1291 7.8.2 movie.framecount()
1293 Return number of frames in movie.
1295 7.8.3 movie.readonly()
1297 Return true if in readonly mode, false if in readwrite.
1299 7.8.4 movie.rerecords()
1301 Returns the current value of rerecord count.
1303 7.8.5 movie.set_readwrite()
1305 Set readwrite mode (does not cause on_readwrite callback).
1307 7.8.6 movie.frame_subframes(number frame)
1309 Count number of subframes in specified frame (frame numbers are 
1310 1-based) and return that.
1312 7.8.7 movie.read_subframe(number frame, number subframe)
1314 Read specifed subframe in specified frame and return data as 
1315 array (100 elements, numbered 0-99 currently).
1317 7.8.8 movie.read_rtc()
1319 Returns the current value of the RTC as a pair (second, 
1320 subsecond).
1322 7.8.9 movie.unsafe_rewind([UNSAFEREWIND state])
1324 Start setting point for unsafe rewind or jump to point of unsafe 
1325 rewind.
1327 • If called without argument, causes emulator to start process of 
1328   setting unsafe rewind point. When this has finished, callback 
1329   on_set_rewind occurs, passing the rewind state to lua script.
1331 • If called with argument, causes emulator rewind to passed 
1332   rewind point as soon as possible. Readwrite mode is implicitly 
1333   activated.
1335 The following warnings apply to unsafe rewinding:
1337 • There are no safety checks against misuse (that's what “unsafe” 
1338   comes from)!
1340 • Only call rewind from timeline rewind point was set from.
1342 • Only call rewind from after the rewind point was set.
1344 7.9 Table settings
1346 Routines for settings manipulation
1348 7.9.1 settings.get(string name)
1350 Get value of setting. If setting is blank, returns false. If 
1351 setting value can't be obtained, returns (nil, error message).
1353 7.9.2 settings.set(string name, string value)
1355 Set value of setting. If setting can't be set, returns (nil, 
1356 error message).
1358 7.9.3 settings.is_set(string name)
1360 Returns if setting is set. If setting does not exist, returns 
1361 (nil, error message).
1363 7.9.4 settings.blank(string name)
1365 Blanks a setting and returns true. If setting can't be blanked, 
1366 returns (nil, error message).
1368 7.10 Table memory
1370 Contains various functions for managing memory
1372 7.10.1 memory.vma_count()
1374 Returns the number of VMAs
1376 7.10.2 memory.read_vma(number index)
1378 Reads the specified VMA (indices start from zero). Trying to read 
1379 invalid VMA gives nil. The read VMA is table with the following 
1380 fields:
1382 • region_name (string): The readable name of the VMA
1384 • baseaddr (number): Base address of the VMA
1386 • lastaddr (number): Last address in the VMA.
1388 • size (number): The size of VMA in bytes.
1390 • readonly (boolean): True of the VMA corresponds to ROM.
1392 • iospace (boolean): True if the VMA is I/O space.
1394 • native_endian (boolean): True if the VMA has native endian as 
1395   opposed to little endian.
1397 7.10.3 memory.find_vma(number address)
1399 Finds the VMA containing specified address. Returns table in the 
1400 same format as read_vma or nil if not found.
1402 7.10.4 memory.readbyte(number address)
1404 Reads the specified address as unsigned byte and returns the 
1405 result.
1407 7.10.5 memory.readsbyte(number address)
1409 Reads the specified address as signed byte and returns the 
1410 result.
1412 7.10.6 memory.writebyte(number address, number value)
1414 Writes the specified value (negative values undergo 2's 
1415 complement) to specified address (as a byte).
1417 7.10.7 memory.readword(number address)
1419 Reads the specified address as unsigned word and returns the 
1420 result.
1422 7.10.8 memory.readsword(number address)
1424 Reads the specified address as signed word and returns the 
1425 result.
1427 7.10.9 memory.writeword(number address, number value)
1429 Writes the specified value (negative values undergo 2's 
1430 complement) to specified address (as a word).
1432 7.10.10 memory.readdword(number address)
1434 Reads the specified address as unsigned doubleword and returns 
1435 the result.
1437 7.10.11 memory.readsdword(number address)
1439 Reads the specified address as signed doubleword and returns the 
1440 result.
1442 7.10.12 memory.writedword(number address, number value)
1444 Writes the specified value (negative values undergo 2's 
1445 complement) to specified address (as a doubleword).
1447 7.10.13 memory.readqword(number address)
1449 Reads the specified address as unsigned quadword and returns the 
1450 result.
1452 7.10.14 memory.readsqword(number address)
1454 Reads the specified address as signed quadword and returns the 
1455 result.
1457 7.10.15 memory.writeqword(number address, number value)
1459 Writes the specified value (negative values undergo 2's 
1460 complement) to specified address (as a quadword).
1462 7.10.16 memory.hash_region(number base, number size)
1464 Hash specified number of bytes starting from specified address 
1465 and return the SHA-256.
1467 7.10.17 memory.hash_state()
1469 Hash the current system state. Mainly useful for debugging 
1470 savestates.
1472 7.10.18 memory.readregion(number base, number size)
1474 Read a region of memory.
1476 • Warning: If the region crosses VMA boundary, the results are 
1477   undefined.
1479 7.10.19 memory.map<type>([number base, number size])
1481 Returns a table mapping specified memory aperture for read/write. 
1482 If parameters are omitted, entiere map space is the aperture.
1484 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1485   qword or sqword.
1487 7.10.20 memory.writeregion(number base, number size, table data)
1489 Write a region of memory.
1491 • Warning: If the region crosses VMA boundary, the results are 
1492   undefined.
1494 7.10.21 memory.map_structure()
1496 Returns a new mapping structure (MMAP_STRUCT)
1498 7.10.22 MMAP_STRUCT(string key, number address, string type)
1500 Bind key in mmap structure to specified address with specified 
1501 type.
1503 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1504   qword or sqword.
1506 7.10.23 memory.read_expr(string expr)
1508 Evaluate specified watch expression and return result
1510 7.11 Table subtitle
1512 Contains functions for manipulating subtitles.
1514 7.11.1 subtitle.byindex(number index)
1516 Get (basetime, length) pair of specified subtitle index or 
1517 nothing if index isn't valid.
1519 7.11.2 subtitle.get(number basetime, number length)
1521 Read the specified subtitle. Returns “” if the subtitle does not 
1522 exist.
1524 7.11.3 subtitle.set(number basetime, number length, string 
1525   content)
1527 Set the specified subtitle.
1529 7.11.4 subtitle.deltete(number basetime, number length)
1531 Delete the specified subtitle.
1533 7.12 Table _SYSTEM
1535 Contains copy of global variables from time of Lua 
1536 initialization. Non-writeable.
1538 7.13 Callbacks
1540 Various callbacks to Lua that can occur.
1542 7.13.1 Callback: on_paint(bool not_synth)
1544 Called when screen is being painted. Any gui.* calls requiring 
1545 graphic context draw on the screen.
1547 not_synth is true if this hook is being called in response to 
1548 received frame, false otherwise.
1550 7.13.2 Callback: on_video()
1552 Called when video dump frame is being painted. Any gui.* calls 
1553 requiring graphic context draw on the video.
1555 7.13.3 Callback: on_frame_emulated()
1557 Called when emulating frame has completed and 
1558 on_paint()/on_video() calls are about to be issued.
1560 7.13.4 Callback: on_frame()
1562 Called on each starting whole frame.
1564 7.13.5 Callback: on_startup()
1566 Called when the emulator is starting (lsnes.rc and --run files 
1567 has been run).
1569 7.13.6 Callback: on_rewind()
1571 Called when rewind movie to beginning has completed.
1573 7.13.7 Callback: on_pre_load(string name)
1575 Called just before savestate/movie load occurs (note: loads are 
1576 always delayed, so this occurs even when load was initiated by 
1577 lua).
1579 7.13.8 Callback: on_err_load(string name)
1581 Called if loadstate goes wrong.
1583 7.13.9 Callback: on_post_load(string name, boolean was_savestate)
1585 Called on successful loadstate. was_savestate gives if this was a 
1586 savestate or a movie.
1588 7.13.10 Callback: on_pre_save(string name, boolean is_savestate)
1590 Called just before savestate save occurs (note: movie saves are 
1591 synchronous and won't trigger these callbacks if called from 
1592 Lua).
1594 7.13.11 Callback: on_err_save(string name)
1596 Called if savestate goes wrong.
1598 7.13.12 Callback: on_post_save(string name, boolean is_savestate)
1600 Called on successful savaestate. is_savestate gives if this was a 
1601 savestate or a movie.
1603 7.13.13 Callback: on_quit()
1605 Called when emulator is shutting down.
1607 7.13.14 Callback: on_input(boolean subframe)
1609 Called when emulator is just sending input to bsnes core. 
1610 Warning: This is called even in readonly mode, but the results 
1611 are ignored.
1613 7.13.15 Callback: on_reset()
1615 Called when SNES is reset.
1617 7.13.16 Callback: on_readwrite()
1619 Called when moving into readwrite mode as result of “set-rwmode” 
1620 command (note: moving to rwmode by Lua won't trigger this, as per 
1621 recursive entry protection).
1623 7.13.17 Callback: on_snoop(number port, number controller, number 
1624   index, number value)
1626 Called each time bsnes asks for input. The value is the final 
1627 value to be sent to bsnes core (readonly mode, autohold and 
1628 autofire have been taken into account). Might be useful when 
1629 translating movies to format suitable for console verification. 
1630 Note: There is no way to modify the value to be sent.
1632 • Not called if callback on_snoop2 is defined.
1634 7.13.18 Callback: on_snoop2(number port, number controller, 
1635   number index, number value)
1637 Like on_snoop, but reserves port 0 for system, having first user 
1638 port be port 1.
1640 7.13.19 Callback: on_keyhook(string keyname, table state)
1642 Sent when key that has keyhook events requested changes state. 
1643 Keyname is name of the key (group) and state is the state (same 
1644 kind as table values in input.raw).
1646 7.13.20 Callback: on_idle()
1648 Called when requested by set_idle_timeout(), the timeout has 
1649 expired and emulator is waiting.
1651 7.13.21 Callback: on_timer()
1653 Called when requested by set_idle_timeout() and the timeout has 
1654 expired (regardless if emulator is waiting).
1656 7.13.22 Callback: on_set_rewind(UNSAFEREWIND r)
1658 Called when unsafe rewind object has been constructed.
1660 7.13.23 Callback: on_pre_rewind() 
1662 Called just before unsafe rewind is about to occur.
1664 7.13.24 Callback: on_post_rewind() 
1666 Called just after unsafe rewind has occured.
1668 7.13.25 Callback: on_button(number port, number controller, 
1669   number index, string type)
1671 Called on controller button press, with following parameters:
1673 • port: Port number (0 is system)
1675 • controller: Controller within port
1677 • index: Index of button.
1679 • type: Type of event, one of:
1681   – “pressed”: Button was pressed.
1683   – “released”: Button was released.
1685   – “hold”: Held.
1687   – “unhold”: Released from hold.
1689   – “type”: Typing input on button.
1691   – “untype”: Typing input undone.
1693   – “analog”: Analog action on axis.
1695 8 Movie editor
1697 • The editor edits in-memory movie.
1699 • Because past can't be edited and readwrite mode doesn't allow 
1700   future, editing only works in read only mode.
1702 • Keyboard triggers the normal hotkeys and bindings.
1704 8.1 Left button actions
1706 • Clicking on cell in future (indicated by lack of redish 
1707   background) toggles it (if it is a button) or prompts for a 
1708   value (if it is an axis)
1710 • Dragging vertically toggles sequence of buttons or changes a 
1711   sequence of axis values.
1713 8.2 Right button actions
1715 The right mouse button pops up a context-sensitive menu:
1717 • Toggle <something>: Toggle this button
1719 • Change <something>: Change this axis value
1721 • Insert frame after: Insert a frame after this frame
1723 • Append frame: Append a frame to movie
1725 • Append frames: Append specified number of frames to movie
1727 • Delete frame: Delete this frame
1729 • Delete subframe: Delete this subframe
1731 • Truncate movie: Delete this subframe and everything after it.
1733 • Scroll to frame: Prompt for a frame and scroll the display to 
1734   that frame.
1736 • Scroll to current frame: Scroll the display to current position
1738 • Run to frame: Prompts for frame and runs the emulation to that 
1739   frame.
1741 • Change number of lines visible: Change the height of the movie 
1742   display (1 to 255).
1744 • Lock scroll to playback: While playing back or rewinding 
1745   movies, the display will follow if enabled.
1747 9 Memory watch expression syntax
1749 Memory watch expressions are in RPN (Reverse Polish Notation). At 
1750 the end of expression, the top entry on stack is taken as the 
1751 final result.
1753 Notations:
1755 • Evaluation order is strictly left to right.
1757 • a is the entry on top of stack
1759 • b is the entry immediately below top of stack
1761 • ; separates values to be pushed (no intermediate pop).
1763 • After end of element, all used stack slots are popped and all 
1764   results are pushed.
1766 • When pushing multiple values, the pushes occur in order shown.
1768 The following operators are available:
1770 • + : a + b
1772 • - : a - b
1774 • * : a * b
1776 • / : a / b
1778 • % : a % b
1780 • a : atan(a)
1782 • b : read_signed_byte(a)
1784 • c : cos(a)
1786 • d : read_signed_dword(a)
1788 • i : quotent(a / b)
1790 • p :\pi
1793 • q : read_signed_qword(a)
1795 • r : sqrt(a)
1797 • s : sin(a)
1799 • t : tan(a)
1801 • u : a; a
1803 • w : read_signed_word(a)
1805 • A : atan2(a, b)
1807 • B : read_unsigned_byte(a)
1809 • C<number>z : Push number <number> to stack.
1811 • D : read_unsigned_dword(a)
1813 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1815 • H<digit> : Set hexadecimal mode with specified number of digits 
1816   (use A-G for 10-16 digits).
1818 • Q : read_unsigned_qword(a)
1820 • R<digit> : round a to <digit> digits.
1822 • W : read_unsigned_word(a)
1824 9.1 Example:
1826 C0x007e0878zWC0x007e002czW-
1828 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1830 2. Pop the value on top of stack (0x7e0878), read word value at 
1831   that address and push the result,call it x1 (W).
1833 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1835 4. Pop the value on top of stack (0x7e002c), read word value at 
1836   that address and push the result,call it x2 (W).
1838 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
1839   x2 and push x2 - x1 (-).
1841 6. Since the expression ends, the final memory watch result is 
1842   the top one on stack, which is x2 - x1.
1844 10 Modifier and key names:
1846 10.1 wxWidgets platform
1848 10.1.1 Modifier names:
1850 Following modifier names are known:
1852 • alt
1854 • ctrl
1856 • shift 
1858 • meta
1860 • cmd (Mac OS X only)
1862 10.1.2 Key names:
1864 Following key names are known:
1866 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1867   dollar, percent, ampersand, quote, leftparen, rightparen, 
1868   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1869   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1870   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1871   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1872   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1873   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1874   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1875   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1876   home, lefT, up, right, down, select, print, execute, snapshot, 
1877   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1878   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1879   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1880   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1881   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1882   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1883   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1884   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1885   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1886   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1887   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1888   windows_right, windows_menu, command, special1, special2, 
1889   special3, special4, special5, special6, special7, special8, 
1890   special9, special10, special11, special12, special13, 
1891   special14, special15, special16, special17, special18, 
1892   special19, special20
1894 11 Movie file format
1896 Movie file is .zip archive in itself, normal ZIP archive tools 
1897 work on it (note: If you recompress it, do not use compression 
1898 methods other than store and deflate and especially do not use 
1899 encryption of any kind).
1901 11.1 Detecting clean start/SRAM/Savestate
1903 • If file has member “savestate” it is savestate, otherwise:
1905 • If file has members with names starting “moviesram.” it is 
1906   movie starting from SRAM, otherwise:
1908 • It is movie starting from clear state.
1910 11.2 Member: gametype
1912 Type of game ROM and region (as one line). Valid values are:
1915 +--------------+---------------------+--------+
1916 |    Value     |       System        | Region |
1917 +--------------+---------------------+--------+
1918 +--------------+---------------------+--------+
1919 |  snes_pal    |     Super NES       |  PAL   |
1920 +--------------+---------------------+--------+
1921 |   sgb_pal    |   Super Game Boy    |  PAL   |
1922 +--------------+---------------------+--------+
1923 |  snes_ntsc   |     Super NES       |  NTSC  |
1924 +--------------+---------------------+--------+
1925 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
1926 +--------------+---------------------+--------+
1927 |     bsx      | BS-X (non-slotted)  |  NTSC  |
1928 +--------------+---------------------+--------+
1929 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
1930 +--------------+---------------------+--------+
1931 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
1932 +--------------+---------------------+--------+
1935 Frame rates are:
1938 +---------+-----------------+
1939 | Region  | Framerate (fps) |
1940 +---------+-----------------+
1941 +---------+-----------------+
1942 |  PAL    |   322445/6448   |
1943 +---------+-----------------+
1944 |  NTSC   | 10738636/178683 |
1945 +---------+-----------------+
1948 11.3 Member: port1
1950 Contains type of port #1 (as one line). Valid values are 'none', 
1951 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
1952 'gamepad'.
1954 11.4 Member: port2
1956 Contains type of port #2 (as one line). Valid values are 'none', 
1957 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
1958 'justifiers'. If not present, defaults to 'none'.
1960 11.5 Member: gamename
1962 Contains name of the game (as one line).
1964 11.6 Member: authors
1966 Contains authors, one per line. Part before '|' is the full name, 
1967 part after is the nickname.
1969 11.7 Member: systemid
1971 Always “lsnes-rr1” (one line). Used to reject other saves.
1973 11.8 Member: controlsversion
1975 Always “0” (one line). Used to identify what controls are there.
1977 11.9 Member: “coreversion”
1979 Contains bsnes core version number (as one line).
1981 11.10 Member: projectid
1983 Contains project ID (as one line). Used to identify if two movies 
1984 are part of the same project.
1986 11.11 Member: {rom,slota,slotb}{,xml}.sha256
1988 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
1989 Absent if corresponding file is absent.
1991 11.12 Member: moviesram.<name>
1993 Raw binary startup SRAM of kind <name>. Only present in 
1994 savestates and movies starting from SRAM.
1996 11.13 Member: saveframe
1998 Contains frame number (as one line) of frame movie was saved on. 
1999 Only present in savestates.
2001 11.14 Member: lagcounter
2003 Current value of lag counter (as one line). Only present in 
2004 savestates.
2006 11.15 Member: pollcounters
2008 Contains poll counters (currently 100 of them), one per line. 
2009 Each line is raw poll count if DRDY is set for it. Otherwise it 
2010 is negative poll count minus one. Only present in savestates.
2012 11.16 Member: hostmemory
2014 Raw binary dump of host memory. Only present in savestates.
2016 11.17 Member: savestate
2018 The raw binary savestate itself. Savestate detection uses this 
2019 file, only present in savestates.
2021 11.18 Member: screenshot
2023 Screenshot of current frame. Only present in savestates. First 2 
2024 bytes are big-endian width of image, rest are 24-bit RGB image 
2025 data. Height of image is inferred from the width and size of 
2026 data.
2028 11.19 Member: sram.<name>
2030 Raw binary SRAM of kind <name> at time of savestate. Only present 
2031 in savestates.
2033 11.20 Member: input
2035 The actual input track, one line per subframe (blank lines are 
2036 skipped).
2038 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2039   the line is part of same frame as previous, otherwise it starts 
2040   a new frame.
2042 • First subframe must start a new frame.
2044 Length of movie in frames is number of lines in input file that 
2045 start a new frame.
2047 11.21 Member: subtitles
2049 Subtitle track. Optional.
2051 • Each line is in form <firstframe> <numframes> <text>.
2053 • Linefeed is encoded as \n, backslash is encoded as \\.
2055 11.22 Member: rerecords
2057 Contains textual base-10 rerecord count (as one line; emulator 
2058 just writes this, it doesn't read it) + 1.
2060 11.23 Member: rrdata
2062 This member stores set of load IDs. There is one load ID per 
2063 rerecord (plus one corresponding to start of project).
2065 • This member constists of concatenation of records
2067 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2068   consequtive IDs.
2070 • IDs are interpretted as 256-bit big-endian integers with 
2071   warparound.
2073 • Initial predicted ID is all zeroes.
2075 Format of each record is:
2077 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2078   bits 5-6 are count length (countlen). Bit 7 is unused.
2080 • 32-prefixlen bytes of ID.
2082 • countlen bytes of big-endian count (count).
2084 Records are processed as follows:
2086 • To form the first ID encoded by record, take the first 
2087   prefixlen bytes predicted ID and append the read ID value to 
2088   it. The result is the first ID encoded.
2090 • If countlen is 0, record encodes 1 ID.
2092 • If countlen is 1, record encodes 2+count IDs.
2094 • If countlen is 2, record encodes 258+count IDs.
2096 • If countlen is 3, record encodes 65794+count IDs.
2098 • The new predicted ID is the next ID after last one encoded by 
2099   the record.
2101 The number of rerecords + 1 is equal to the sum of number of IDs 
2102 encoded by all records.
2104 11.24 Member: starttime.second
2106 Movie starting time, second part. Epoch is Unix epoch. Default is 
2107 1,000,000,000.
2109 11.25 Member: starttime.subsecond
2111 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2112 is 0.
2114 11.26 Member: savetime.second
2116 Movie saving time, second part. Default is starttime.second. Only 
2117 present in savestates.
2119 11.27 Member: savetime.subsecond
2121 Movie saving time, subsecond part. Default is 
2122 starttime.subsecond. Only present in savestates.
2124 12 lsvs file format (commentary tracks)
2126 12.1 Clusters
2128 • Each cluster is 8kB (8192 bytes) in size.
2130 • Cluster n starts at offset 8192*n in file.
2132 • The following clusters are system special:
2134   – Cluster 0 and all clusters with number multiple of 2048 
2135     (cluster tables)
2137   – Cluster 1 (superblock)
2139 12.2 Cluster tables
2141 • The cluster table describing cluster n is stored in cluster n & 
2142   ~0x7FF (zero last 11 bits of n).
2144 • This cluster table consists of 2048 4-byte big-endian integers.
2146 • Each entry describes a cluster in 16MB supercluster, in order.
2148 • The valid values for entries are:
2150   – 0x00000000: Free cluster
2152   – 0x00000001: Last cluster in chain.
2154   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2156   – (anything else): Number of next cluster in chain. Must not be 
2157     multiple of 2048.
2159 • Due to limitations of the format, there can be at most 2097052 
2160   superclusters, giving maximum file size of 16TB.
2162 12.3 Stream table
2164 • The stream table chain always starts in cluster 2.
2166 • Otherwise, it follows normal chaining.
2168 • The stream table consists of 16-byte entries:
2170   – The first 8 bytes of entry give big-endian beginning position 
2171     of stream in units of 1/48000 s.
2173   – The next 4 bytes of entry give big-endian beginning cluster 
2174     for control data. 0 here marks the entry as not present.
2176   – The last 4 bytes of entry give big-endian beginning cluster 
2177     for codec data.
2179 • Stream table clusters are normal clusters, following normal 
2180   chaining.
2182 • The stream begnning position is not guarenteed unique. There 
2183   can be multiple streams with the same starting position in the 
2184   file.
2186 12.4 Stream control data
2188 • The stream control data consists of entries 4 bytes each:
2190   – The first 2 bytes of entry gives big-endian length of packet
2192   – The next byte of entry gives audio length of packet in units 
2193     of 1/400 s.
2195   – The last byte is control byte.
2197     ∗ 0 means this entry is not present and the control data 
2198       ends.
2200     ∗ 1 is valid control entry.
2202 • The stream control data can also end by running into end of the 
2203   readable chain.
2205   – This happens if there happens to be exact multiple of 2048 
2206     packets in stream and number of packets is nonzero.
2208 • These clusters follow normal chaining.
2210 12.5 Stream codec data
2212 • Stream codec data consists of raw Opus data packets packed back 
2213   to back with nothing in between.
2215 • Warning: Due to internal limitations, this data must reside in 
2216   the first 65536 superclusters (that is, the first 1TB of the 
2217   file).
2219 12.6 Superblock
2221 • The superblock is stored in cluster 1. 
2223 • The first 11 bytes are “sefs-magic”<NUL>.
2225 • The rest are unused.
2227 • This cluster 1 is marked as system special.
2229 13 Known ROM extensions
2231 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2232   dx2, mgd, mgh.
2234 • DMG cartridge ROMs: dmg, gb.
2236 • GBC cartridge ROMs: cgb, gbc.
2238 14 Gamepack files
2240 • The first line must be: “[GAMEPACK FILE]”.
2242 • There is one needed line: “type <systype>”. This sets system 
2243   type to <systype>. The following system types are valid:
2245   – snes (SNES)
2247   – bsx (BS-X non-slotted)
2249   – bsxslotted (BS-X slotted)
2251   – sufamiturbo (Sufami Turbo)
2253   – sgb (Super Game Boy)
2255   – dmg (Game Boy)
2257   – gbc (Game Boy Color)
2259   – gbc_gba (Game Boy Color with GBA initial register values)
2261 • Optionally a region can be specified: “region <region>”. The 
2262   following values are valid:
2264   – autodetect (Autodetect region: snes and sgb only)
2266   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2268   – pal (PAL: snes, sgb)
2270   – world (World: dmg, gbc, gbc_gba)
2272 • ROM images are loaded as: “rom <type> <file>”. The following 
2273   types are valid:
2275   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2276     bsxslotted, sufamiturbo)
2278   – bsx (Cartridge ROM in bsx, bsxslotted)
2280   – slot-a (Cartridge ROM in sufamiturbo)
2282   – slot-b (Cartridge ROM in sufamiturbo)
2284 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2285   valid are the same as for ROMs.
2287 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2288   types are the same as for ROMs.
2290   – Offset is given in form [+-]<number>. Usually offset is 
2291     either +0 or -512.
2293   – Default offset is +0.
2295 14.1 Example:
2297 [GAMEPACK FILE]
2299 type snes
2301 rom rom speedygonzales.sfc
2303 patch-512 rom sonicthehedgehog.ips
2305 14.2 Example 2:
2307 [GAMEPACK FILE]
2309 type sgb
2311 rom rom supergameboy.sfc
2313 rom dmg megamanV.dmg
2315 15 Quick'n'dirty encode guide
2317 1. Start the emulator and load the ROM and movie file.
2319 2. Set large AVI option 'set-setting avi-large on'
2321 3. Enable dumping 'dump-avi tmpdump' 
2323 4. Unpause and let it run until you want to end dumping.
2325 5. Close the emulator (closing the window is the easiest way). Or 
2326   use 'end-avi'.
2328 6. For each tmpdump*.avi file created, on command prompt, do 
2329   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2331 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2333 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2334   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2335   tmpdump_<numbers>.mkv, with + in between).
2337 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2338   final.mkv contains quick'n'dirty encode.
2340 16 Axis configurations for some gamepad types:
2342 16.1 XBox360 controller:
2344 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2345 set to pressure-+.
2347 set-axis joystick0axis2 pressure-+
2349 set-axis joystick0axis5 pressure-+
2351 • This is needed for SDL only. EVDEV sets those types correctly.
2353 16.2 PS3 “sixaxis” controller:
2355 Axes 8-19 should be disabled.
2357 set-axis joystick0axis8 disabled
2359 set-axis joystick0axis9 disabled
2361 set-axis joystick0axis10 disabled
2363 set-axis joystick0axis11 disabled
2365 set-axis joystick0axis12 disabled
2367 set-axis joystick0axis13 disabled
2369 set-axis joystick0axis14 disabled
2371 set-axis joystick0axis15 disabled
2373 set-axis joystick0axis16 disabled
2375 set-axis joystick0axis17 disabled
2377 set-axis joystick0axis18 disabled
2379 set-axis joystick0axis19 disabled
2381 17 Errata:
2383 17.1 Problems from BSNES core:
2385 • The whole pending save stuff.
2387 • Lack of layer hiding.
2389 • It is slow (especially accuracy).
2391 • Firmwares can't be loaded from ZIP archives.
2393 17.2 Other problems:
2395 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2397 • Audio for last dumped frame is not itself dumped.
2399 • Audio in UI is pretty bad in quality if game doesn't run at 
2400   full speed.
2402 • No menus, command based interface (SDL).
2404 • Long commands don't scroll.
2406 18 Changelog:
2408 18.1 rr0-beta1
2410 • Fix -Wall warnings
2412 • Fix dumper video corruption with levels 10-18.
2414 18.2 rr0-beta2
2416 • Autofire
2418 • Lots of code cleanups
2420 • Lua interface to settings
2422 • Allow specifying AVI borders without Lua
2424 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2426 • on_snoop lua callback
2428 • Faster movie loading and saving.
2430 18.3 rr0-beta3
2432 • Joystick support
2434 18.4 rr0-beta4
2436 • Fix multi-buttons
2438 • Save jukebox functionality.
2440 18.5 rr0-beta5
2442 • Try to fix some nasty failing movie load edge cases
2444 • Allow specifying scripts to run on command line.
2446 18.6 rr0-beta6
2448 • Major source code reorganization.
2450 • Backup savestates before overwriting.
2452 • Don't crash if loading initial state fails.
2454 18.7 rr0-beta7
2456 • Fix firmware lookup
2458 • Fix author name parsing
2460 • Fix rerecord counting
2462 • (SDL) Print messages to console if SDL is uninitialized
2464 • Add movieinfo program
2466 • Fix loading movies starting from SRAM.
2468 18.8 rr0-beta8
2470 • Add support for unattended dumping
2472 • Fix compiling for Win32
2474 • Don't lock up if sound can't be initialized
2476 • Strip trailing CR from commands
2478 • Don't try to do dubious things in global ctors (fix crash on 
2479   startup)
2481 18.9 rr0-beta9
2483 • Small documentation tweaking
2485 • Fix make clean
2487 • Fix major bug in modifier matching
2489 18.10 rr0-beta10
2491 • Lots of documentation fixes
2493 • Use dedicated callbacks for event backcomm., not commands.
2495 • Ensure that the watchdog is not hit when executing delayed 
2496   reset.
2498 • Remove errant tab from joystick message.
2500 18.11 rr0-beta11
2502 • Make autofire operate in absolute time, not linear time
2504 • Reinitialize controls when resuming from loadstate
2506 • Some more code cleanups
2508 • If Lua allocator fails, call OOM_panic()
2510 • Byte/word/dword/qword sized host memory write/read functions.
2512 • Dump at correct framerate if dumping interlaced NTSC 
2513   (height=448).
2515 18.12 rr0-beta12
2517 • Actually include the complete source code
2519 • Keep track of RTC
2521 18.13 rr0-beta13
2523 • Document {save,start}time.{,sub}second.
2525 • Intercept time() from bsnes core.
2527 18.14 rr0-beta14
2529 • Allow disabling time() interception (allow build on Mac OS X)
2531 • Use SDLMain on Mac OS X (make SDL not crash)
2533 • Disable delayed resets (just plain too buggy for now).
2535 • Code cleanups
2537 • Use 16-bit for graphics/video instead of 32-bit.
2539 • gui.rectangle/gui.pixel
2541 • gui.crosshair
2543 • New CSCD writer implementation.
2545 18.15 rr0-beta15
2547 • Fix interaction of * and +.
2549 • Manual improvements
2551 • Use gettimeofday()/usleep(), these seem portable enough.
2553 • Move joystick axis manipulation to keymapper code.
2555 • Changes to how read-only works.
2557 • Refactor controller input code.
2559 18.16 rr0-beta16
2561 • Fix mouseclick scale compensation.
2563 • Draw area boundaries correctly in SDL code.
2565 • gui.screenshot.
2567 • Fix CSCD output (buffer overrun and race condition).
2569 18.17 rr0-beta17
2571 • JMD dumping support.
2573 • Allow unattended dumping to JMD.
2575 • Move to BSNES v083.
2577 • Switch back to 32-bit colors.
2579 • Add Lua function gui.color.
2581 • Use some new C++11 features in GCC 4.6.
2583 • Be prepared for core frequency changes.
2585 • Pass colors in one chunk from Lua.
2587 18.18 rr0-beta18
2589 • New lua functions gui.line(), gui.status() and gui.circle(), 
2590   memory.vma_count(), memory.read_vma() and memory.find_vma().
2592 • Numerious documentation fixups
2594 • RTC time format changed
2596 • Reformat flags display
2598 • Allow lua package name to be overridden
2600 • SDUMP (high-quality dumping).
2602 • Split platform support to plugins.
2604 • Make all sound plugins support basic sound commands
2606 • Support portaudio for sound.
2608 • Allow disable Lua/SDL searching.
2610 • Upconvert colors when copying lcscreen to screen.
2612 • Reorganize source tree.
2614 • Evdev joystick support.
2616 • Refactor more code into generic window code.
2618 18.19 rr0-beta19
2620 • Refactor message handling.
2622 • Rework makefile
2624 • Documentation fixes
2626 • Finish pending saves before load/quit.
2628 • Wxwidgets graphics plugin.
2630 18.20 rr0-beta20
2632 • Get rid of win32-crap.[ch]pp.
2634 • Move files around a lot.
2636 • Get rid of need for host C++ compiler.
2638 • Bsnes v084 core.
2640 • Refactor inter-component communication.
2642 • Fix zero luma.
2644 • Fix crash on multiline aliases.
2646 • Load/Save settings in wxwidgets gui.
2648 18.21 rr0-beta21
2650 • Patch problems in bsnes core
2652 • SNES is little-endian, not big-endian!
2654 • Fix memory corruption in lcscreen::load()
2656 18.22 rr0-beta22
2658 • Fix interpretting repeat counts in rrdata loading.
2660 • New lua callback: on_frame()
2662 • Remove calls to runtosave() that aren't supposed to be there
2664 • Lua function: movie.read_rtc()
2666 • Ignore src/fonts/font.cpp
2668 • Fix more bsnes core problems
2670 • Control bsnes random seeding
2672 • Pause-on-end
2674 • Some bsnes core debugging features (state dump and state hash)
2676 • Fix titlebar version number (no, the last version wasn't 
2677   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2679 18.23 rr0-beta23
2681 • Fix memory corruption due to macro/field mixup
2683 • search-memory update
2685 • Allow direct-mapped framebuffer
2687 • SDL: Use SDL_ANYFORMAT if possible
2689 • SDMP2SOX: 2s delay modes.
2691 • Wxwidgets: Cleanups
2693 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2695 • Wxwidgets: Save jukebox on exit
2697 • Fix RTC if using load-movie on savestate.
2699 • Fix crash related to full console mode.
2701 18.24 rr0-beta24
2703 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2704   X.
2706 • Wxwidgets: Allow compiling on Mac OS X.
2708 • Use movie compare instead of movie hashing (faster save/load).
2710 • Lua: _SYSTEM table.
2712 18.25 rr0-beta25
2714 • sdmp2sox: Pad soundtrack if using -l or -L.
2716 • sdmp2sox: Fix NTSC overscan.
2718 • sdmp2sox: Add AR correction mode.
2720 • call lua_close() when exiting.
2722 • Fix zip_writer bug causing warnings from info-zip and error 
2723   from advzip.
2725 18.26 rr0-beta26
2727 • Fix IPS patching code (use bsnes core IPS patcher).
2729 • Implement BPS patching (using bsnes core IPS patcher).
2731 • Add feature to load headered ROMs.
2733 18.27 rr0-beta27
2735 • Show command names when showing keybindings
2737 18.28 rr0
2739 • Fix pause-on-end to be actually controllable
2741 • SDL: Poll all events in queue, not just first one (fixes 
2742   slowness in command typing)
2744 • Wxwidgets: Fix ROM loading.
2746 18.29 rr1-beta0
2748 • Lua: Add gui.textH, gui.textV, gui.textHV
2750 • Fix text colors on SDL on Mac OS X
2752 • Mode 'F' for finished in readonly mode.
2754 • Fix some WS errors.
2756 • Reliably pause after skip poll
2758 • Split UI and core into their own threads
2760 18.30 rr1-beta1
2762 • Remove leftover dummy SRAM slot
2764 • Fix controller numbers.
2766 18.31 rr1-beta2
2768 • Fix lsnes-dumpavi after interface change.
2770 • Also give BSNES patches for v085.
2772 • Pack movie data in memory.
2774 18.32 rr1-beta3
2776 • Fix framecount/length given when loading movies.
2778 • Controller command memory leak fixes.
2780 • Don't leak palette if freeing screen object.
2782 18.33 rr1-beta4
2784 • Detect revisions.
2786 • Wxwidgets: Allow controlling dumper from the menu.
2788 18.34 rr1-beta5
2790 • Rewrite parts of manual
2792 • Lua: Make it work with Lua 5.2.
2794 18.35 rr1-beta6
2796 • Win32: Fix compile errors.
2798 18.36 rr1-beta7
2800 • Refactor controller input code.
2802 • Fix crash when using command line on SDL / Mac OS X.
2804 18.37 rr1-beta8
2806 • Delete core/coroutine (obsolete)
2808 • Lag input display by one frame.
2810 • Rewind movie to beginning function.
2812 • Fix wrong frame number reported to Lua when repainting after 
2813   loadstate
2815 • Support UI editing of jukebox
2817 • Wxwidgets: Save settings on exit.
2819 • Support ${project} for filenames
2821 • SDL: Fix command history
2823 18.38 rr1-beta9
2825 • Fix some order-of-global-ctor bugs.
2827 18.39 rr1-beta10
2829 • Fix crashes when quitting on Win32.
2831 18.40 rr1-beta11
2833 • EVDEV: Queue keypresses from joystick, don't send directly
2835 • Wxwidgets: Load-Preserve that actually works.
2837 18.41 rr1-beta12
2839 • Wxwidgets: GUI for memory search.
2841 • Warn about using synchronous queue in UI callback.
2843 18.42 rr1-beta13
2845 • Remember last saved file for each ROM
2847 • Support MT dumping via boost.
2849 • Lua: input.raw
2851 • Lua: input.keyhook
2853 • Make mouse be ordinary input instead of special-casing
2855 • SDL: Don't screw up commands with NUL codepoints.
2857 18.43 rr1-beta14
2859 • Merge status panel and main window
2861 • True movie slot support (the rest of it)
2863 • SDL: Fix compilation error
2865 • Elminate cross calls in dump menu code.
2867 18.44 rr1-beta15
2869 • Cancel pending saves command
2871 • Wxwidgets: Code refactoring
2873 • Wxwidgets: Fix system -> reset
2875 • Wxwidgets: Read watch expressions in the right thread
2877 18.45 rr1-beta16
2879 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
2880   doesn't support that).
2882 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
2883   needed).
2885 • Don't append trailing '-' to prefix when saving movie.
2887 • Fix ROM/savestate handling (don't let user mismatch ROM and 
2888   savestates).
2890 18.46 rr1
2892 • Document memory watch syntax.
2894 18.47 rr1-delta1
2896 • Fix unattended dumping (lsnes-dumpavi)
2898 • Support RAW dumping
2900 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
2901   (changes syntax)
2903 • Add option to control sample rate preturbation in AVI dumper
2905 18.48 rr1-delta2
2907 • Wxwidgets: Fix dumper submodes
2909 • Set core controller types before loadstate
2911 18.49 rr1-delta2epsilon1
2913 • Fix compiling with bsnes v086.
2915 18.50 rr1-delta3
2917 • Don't prompt before quitting
2919 • Start unpaused, preserve pause/unpause over load.
2921 • Try to autodetect if ROM is headered.
2923 • Wxwidgets: Only bring up ROM patching screen if specifically 
2924   requested.
2926 • Allow configuring some hotkeys.
2928 18.51 rr1-delta4
2930 • Lots of code cleanups
2932 • Fix JMD compression (JMD dumping was broken)
2934 • Don't crash if Lua C function throws an exception.
2936 • Support bitmap drawing in Lua.
2938 • Fix bsnes v085/v086 patches.
2940 • Improve stability on win32.
2942 18.52 rr1-delta4epsilon1
2944 • Don't corrupt movie if movie length is integer multiple of 
2945   frames per page.
2947 18.53 rr1-delta5
2949 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2951 • New Lua functions: emulator_ready(), utime(), 
2952   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
2953   bit.value(), input.geta(), input.seta() and 
2954   input.controllertype()
2956 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2958 • Wxwidgets: Fix broken modifiers
2960 • on_paint has parameter now.
2962 • Optional initital fill for bitmaps
2964 • Fix palette changing.
2966 • Optimize rendering a bit.
2968 • Bsnes v087 support.
2970 18.54 rr1-delta5epsilon1
2972 • Movieinfo: Fix display of port #2 type.
2974 • Call on_input() after loadstate.
2976 18.55 rr1-delta5epsilon2
2978 • Fix writing port2 data to movie.
2980 • Fix SRAM handling with Bsnes v087.
2982 18.56 rr1-delta6
2984 • Library loading support
2986 • Built-in TSCC encoder
2988 • Hi-color (256T colors) dumping.
2990 • Dump over TCP/IP(v6)
2992 • Hidable status panel
2994 • Turbo toggle/hold
2996 • Adjustable sound volume
2998 • Screen scaling
3000 • Allow DnD into filename boxes
3002 • Configurable paths
3004 • Portaudio: Fix speaker popping at start
3006 • Lots of UI changes
3008 • Speed adjustment menu
3010 • Win32 joystick support
3012 • Lua: gui.rainbow and gui.box
3014 • Split key lists into classes (the key list was large!)
3016 • More save slots support
3018 • Wxwidgets (wxJoystick) joystick support
3020 18.57 rr1-delta7
3022 • Lots of internal joystick refactoring
3024 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3026 • Wxwidgets: Settings mode (open settings without ROM)
3028 • Wxwidgets: Prompt key to use option
3030 • Wxwidgets: Fix crash if key goes away underneath
3032 • Wxwidgets: Fix mouse position in presence of scaling
3034 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3035   using SRC)
3037 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3038   control doesn't seem to work well on WinXP)
3040 • Start paused option.
3042 18.58 rr1-delta7epsilon1
3044 • AVI: ZMBV support
3046 • lsnes-dumpavi: Start Lua before starting dumper
3048 • AVI: Fix secondary audio in mode 4.
3050 18.59 rr1-delta7epsilon2
3052 • AVI: Refactor ZMBV a bit.
3054 • Fix error reading analog values from movie file
3056 18.60 rr1-delta8
3058 • Delayed reset support
3060 • Lua: memory.hash_region
3062 18.61 rr1-delta8epsilon1
3064 • Rework the build system
3066 • Typing input support
3068 • Fix building with bsnes v086 and v087.
3070 • SDL: Save settings on exit
3072 • SDL: Command to enter command line mode with given command.
3074 • SDL: More advanced command editing.
3076 18.62 rr1-delta9
3078 • wxMSW: Fix the “arrow keys and enter don't work” problem
3080 • MSU-1 support
3082 • Show mode changes due to rewinding.
3084 • Unsafe rewind support
3086 • Fix directory transversal.
3088 18.63 rr1-delta10
3090 • AVI: Sound mode 5 (48kHz high-quality)
3092 • Lua: Reset Lua VM
3094 • Map the SNES bus into address space
3096 • Fix loading memory watch files with CRLF line endings
3098 18.64 rr1-delta10epsilon1
3100 • Map bsnes internal state into memory space
3102 • Fix the “click on panel wedges the emulator” for real.
3104 • DnD movies/saves on the main window.
3106 18.65 rr1-delta11
3108 • Split core bindings into own module.
3110 • Remember invalid settings
3112 • Support for modified Gambatte core for GB/GBC emulation.
3114 • Reload/swap ROM function
3116 18.66 rr1-delta11epsilon1
3118 • Fix step poll function
3120 18.67 rr1-delta12
3122 • Non-insane savestate anchoring
3124 18.68 rr1-delta13
3126 • More Memory search methods
3128 • Preserve movie if loading in RO mode.
3130 • Fix a obscure case in timeline check
3132 • Revamp the entiere ROM loading code
3134 • Support DnD on ROMs
3136 • Revamp menu layout
3138 • Standalone hotkey config dialog
3140 • Show bindings in more user-friendly format
3142 18.69 rr1-delta13epsilon1
3144 • Pipedec support
3146 • Fix uninitialized variables in bsnes v085
3148 18.70 rr1-delta14
3150 • Merge gambatte core into mainline (from its own branch)
3152 • Wxwidgets: Show expected dump file formats
3154 • Memory watch: Data typing
3156 • lsnes internal MMIO area.
3158 • Wxwidgets: New memory watch editor
3160 • Hexadecimal memory watches
3162 • Wxwidgets: Monospaced panel
3164 • Wxwidgets: Split memory watches in panel
3166 • Wxwidgets: Disable VMAs in memory search
3168 • lsnes-dumpavi: Fix speed bug
3170 • Movie subtitle support
3172 • Fix rerecord count reporting
3174 • Don't trash movie when loading in readonly mode.
3176 18.71 rr1-delta14epsilon1
3178 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3180 • Fix build on Mac OS X.
3182 • Lua: loopwrapper
3184 • Wxwidgets: Hidable messages window
3186 • Lua: input.joyset
3188 • Bsnes: Support inconsistent saves
3190 • Bsnes: Allow simulating saving every frame
3192 • Fix desync if savestate is loaded in readonly mode in certain 
3193   conditions.
3195 • Wxwidgets: Fix save dialogs on Mac OS X.
3197 • Wxwidgets: Fix insane status width on Win32.
3199 • Wxwidgets: Fix autohold processing to be faster.
3201 • Wxwidgets: Allow loading ROMs and movies from commandline.
3203 18.72 rr1-delta15
3205 • Be a bit smarter with --load
3207 • Rewrote higher-level parts of audio system
3209 • Tool to build commentary tracks
3211 • Lua: input.joyget
3213 • Gambatte: Add support for SVN358
3215 • Use builtin font when rendering status panel.
3217 • Option to detach memory watch to its own window.
3219 • Recent ROMs/Movies menu
3221 • Libao support
3223 • Useful lag counter for SNES games that autopoll
3225 • Fix buffer overflow in gambatte sound output
3227 18.73 rr1-delta15epsilon1
3229 • Don't blow up on wxGTK if the window is hidden somehow
3231 • Support simultaneous drop of ROM and movie.
3233 • Gambatte: Don't save spurious SRAMs.
3235 • Make SGB ROMs actually usable.
3237 • Fix so that saved movies appear in recent movies.
3239 • Don't open multiple commentary editors at once.
3241 18.74 rr1-delta15epsilon2
3243 • Lua: memory.readregion/memory.writeregion
3245 • Lua: memory.map{,s}{byte,word,dword,qword}
3247 • Lua: memory.map_structure
3249 • Lua: Fix bus_address for gambatte
3251 • Fix features dependent of bsnes debugger
3253 • Cleanup bsnes debugger logic
3255 • Fix resets in presence of save every frame
3257 18.75 rr1-delta15epsilon3
3259 • Lua: input.lcid_to_pcid
3261 • Fix off-by-one bug with slot hashes
3263 • Fix crashes on certain memory watch expressions
3265 • Lua: memory.read_expr
3267 • Lua: Fix memory.read_expr on nil argument
3269 • Fix the code to compile on G++ 4.7
3271 • Change button_id to be a function pointer field, not a virtual 
3272   method
3274 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3276 • Gambatte: Always use legacy lag counting
3278 • Memory commands: Memory addresses are up to 16 hex digits, not 
3279   up to 8
3281 • Fix analog controllers
3283 • Fix autohold menus
3285 • Fix button symbols in input display
3287 • Compensate for nuts bsnes superscope/justifier handling
3289 • Lua: Fix bit.extract boolean handling
3291 18.76 rr2-beta0
3293 • Split emulation cores more from the rest
3295 • Support having multiple emulation cores compiled at once
3297 • Support arbitrary number of ports (well, up to 31 anyway).
3299 • SNES debugger support
3301 • Support 16-button controllers
3303 • Remove old SDL front end
3305 • Data-driven controller buttons
3307 • Generate the port code from defines
3309 18.77 rr2-beta1
3311 • Update libgambatte to SVN364
3313 • Get rid of partial linking (building with MXE works)
3315 • Load XML even without gamepack files
3317 • Support screen rotate & flip
3319 • Fix bug when changing controller key to another subkey of the 
3320   same key
3322 18.78 rr1-delta16
3324 • Stop at movie end: Don't off-by-one
3326 • Fix crash closing lsnes with voice playback active.
3328 • Import/Export OggOpus for commentary tracks
3330 • 16-button controllers.
3332 • Don't show nonexistent controllers in input display
3334 • Set voice record/playback volume from UI
3336 • Patches for gambatte SVN364.
3338 • Load markup (if exists) even without gamepack file.
3340 • Screen rotation & flipping
3342 • Lua: Some new bit functions
3344 • Auto-refresh voice streams on change.
3346 • Auto-refresh subtitles on change & new subtitle editor.
3348 • Fix music volume adjustment.
3350 18.79 rr2-beta2
3352 • Use system threads instead of platform threads
3354 • Cleanup build by allowing dummy and real drivers to link 
3355   together.
3357 • Split duplex support
3359 18.80 rr1-delta16epsilon1
3361 • Wxwidgets: Fix memory watch rendering.
3363 • Wxwidgets: Allow setting voice stream gain.
3365 • Wxwidgets: VU meters and volume adjustment.
3367 • Lua: Custom fonts support.
3369 • Lua: Fix methods stopping working when resetting Lua.
3371 • Fix loading standard-format movies in preserve (readonly) mode.
3373 18.81 rr1-delta17
3375 • Primitive movie editor
3377 • Fix VU meter with no sound device.
3379 • Fix various undefined return values.
3381 • Show rates in VU meter window.
3383 18.82 rr2-beta3
3385 • Lua: Render queues as objects
3387 • Bsnes: support hard resets
3389 • Dedicated sound devices dialog
3391 • Change the default AVI sound mode to 2 or 5.
3393 • Fix totally borked movie saving.
3395 • Portaudio: Use split duplex with different devices.
3397 • Fix controls with gambatte core.
3399 • Modify save slot set handling.
3401 • lsnes-dumpavi: --firmware-path.
3403 • Fix lots of compiler warnings.
3405 18.83 rr1-delta17epsilon1
3407 • Commentary tool: Set nominal bit rate and limit max bit rate.
3409 • Lua: Unconditionally reload host memory on loadstate
3411 • Lua: Query bindings, manipulate aliases, create inverse 
3412   bindings
3414 • Lua: Fix crashes with resetting VM while some types of paint 
3415   requests are in flight.
3417 • Lua: gui.text: Clip the text properly instead of corrupting 
3418   memory in some cases.
3420 • Save screenshot header reliably
3422 • Lua: Backport input.get2 and input.set2
3424 • Lua: New controller info functions.
3426 • Movie editor: Fix reset delay counters to be the right way 
3427   around.
3429 • Lua: on_snoop2
3431 • Lua: on_button and input.veto_button.
3433 18.84 rr2-beta4
3435 • Revert memory leak fix breaking input
3437 • Refactor Opus handling
3439 • Restrict member picking only to .zip files
3441 • Fix reading of host-endian VMAs.
3443 • Fix rlow and rhigh to be the right way around.
3445 • Lua: Don't wedge VM if callback fails with an exception
3447 • Refactor Ogg handling.