Also use named initializers for null core
[lsnes.git] / manual.txt
blob8605c070e9ce0b64bad29e95481ef2c92da3e641
1 1 Introduction
3 lsnes is SNES rerecording emulator based on bsnes core.
5 2 Dependencies
7 1. bsnes libsnes (for bsnes SNES core)
9   (a) v084-v087 (v084 or v085 for delayreset support)
11   (b) accuracy or compatiblity core with debugger enabled.
13   (c) Patched version (using included 7 patches)
15 2. gambatte (for gambatte core)
17   (a) SVN r320, r358 or r364
19   (b) Patched with included patches
21 3. Zlib
23 4. boost_iostreams
25 5. boost_filesystem
27 6. boost_thread (if native std::thread is not available)
29 7. libsdl (SDL only)
31 8. sdlmain (SDL only, part of SDL)
33 9. boost_conversion (this is header-only library)
35 10. libswscale (wxwidgets graphics only)
37 11. Portaudio (portaudio sound only)
39 12. libao (libao sound only)
41 13. Lua version 5.1.X or 5.2.X
43 14. G++ 4.6 or 4.7
45 15. libopus (optional, for commentary track tool)
47 3 Building
49 • Copy bsnes sources (the bsnes subdirectory) to subdirectory 
50   'bsnes' (for bsnes core).
52 • Copy gambatte sources to subdirectory 'gambatte' (for gambatte 
53   core).
55 • Patch the bsnes sources with included patches (directory 
56   'bsnes-patches/<version>', bsnes core)
58 • Patch the gambatte sources with included patches (directory 
59   'gambatte-patches/<version>', gambatte core)
61 • Edit options.build (or copy of that file)
63 • Run make (passing 'OPTIONS=<filename>' if using something else 
64   than options.build).
66 4 Command line options
68 4.1 Wxwidgets options
70 4.1.1 --rom=<file>
72 Load <file> as ROM.
74 4.1.2 <file>
76 Load <file> as ROM.
78 4.1.3 --load=<file>
80 Load <file> as movie or savestate file on startup.
82 4.1.4 --settings
84 Instead of starting the emulator, only display the settings.
86 4.1.5 --lua=<file>
88 Run this Lua file on startup
90 4.2 dump options (lsnes-dumpavi only)
92 4.2.1 --rom=<file>
94 Load <file> as ROM. Required.
96 4.2.2 <filename>
98 Load <filename> as movie or savestate file on startup. Required.
100 4.2.3 --dumper=<dumper>
102 Set the dumper to use (required). Use 'list' for listing of known 
103 dumpers.
105 4.2.4 --firmware-path=<path>
107 Set path to look for firmware.
109 4.2.5 --mode=<mode>
111 Set the mode to use (required for dumpers with multiple modes, 
112 forbidden otherwise). Use 'list' for known modes.
114 4.2.6 --prefix=<prefix>
116 Set dump prefix. Default is “avidump”.
118 4.2.7 --option=<name>=<value>
120 Set option <name> to value <value>.
122 4.2.8 --length=<length>
124 Set number of frames to dump. Mandatory.
126 4.2.9 --lua=<script>
128 Run specified lua script (lsnes-dumpavi does not have 
129 initialization files).
131 4.2.10 --load-library=<library>
133 Load the specified shared object / dynamic library / dynamic link 
134 library.
136 4.3 lsnes settings directory
138 The lsnes settings directory is (in order of decreasing 
139 perference):
141 • Windows: %APPDATA%\lsnes (if %APPDATA% exists)
143 • Unix: $XDG_CONFIG_HOME/lsnes (if $XDG_CONFIG_HOME exists)
145 • Unix: $HOME/.config/lsnes (if $HOME exists)
147 • All: . (fallback default).
149 If leading directories do not exist, attempt to create them is 
150 made.
152 5 Internal commands
154 • Commands beginning with '*' invoke the corresponding command 
155   without alias expansion.
157 • If command starts with '+' (after possible '*'), the command is 
158   executed as-is when button is pressed, and when button is 
159   released, it is executed with '+' replaced by '-'.
161 • Commands without '+' execute only on negative edge (release).
163 5.1 run-script <script>
165 Run <script> as if commands were entered on the command line.
167 5.2 Memory manipulation
169 <address> may be decimal or hexadecimal (prefixed with '0x'). 
170 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
171 signed (prefixed with '-') decimal.
173 The available element <sizes> are:
175 • byte: 1 byte
177 • word: 2 bytes
179 • dword: 4 bytes
181 • qword: 8 bytes
183 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
184 When dealing with DSP memory, multi-byte reads/writes are 
185 native-endian (do not use operand sizes exceeding DSP bitness, 
186 except dword is OK for 24-bit memory).
188 5.2.1 read-<size> <address>
190 Read the value of byte in <address>.
192 5.2.2 read-s<size> <address>
194 Read the value of signed byte in <address>.
196 5.2.3 write-<size> <address> <value>
198 Write <value> to byte in address <address>.
200 5.3 Main commands
202 These commands are not available in lsnesrc, but are available 
203 after ROM has been loaded.
205 5.3.1 quit-emulator
207 Quits the emulator.
209 5.3.2 pause-emulator
211 Toggle paused/unpaused
213 5.3.3 +advance-frame 
215 Advance frame. If the button is still held after configurable 
216 timeout expires, game unpauses for the duration frame advance is 
217 held.
219 5.3.4 +advance-poll 
221 Advance subframe. If the button is still held after configurable 
222 timeout expires, game unpauses for the duration frame advance is 
223 held.
225 5.3.5 advance-skiplag 
227 Skip to first poll in frame after current.
229 5.3.6 reset 
231 Reset the SNES after this frame.
233 5.3.7 load <filename> 
235 Load savestate <filename> in current mode.
237 5.3.8 load-state <filename> 
239 Load savestate <filename> in readwrite mode.
241 5.3.9 load-readonly <filename> 
243 Load savestate <filename> in readonly mode.
245 5.3.10 load-preserve <filename> 
247 Load savestate <filename> in readonly mode, preserving current 
248 events.
250 5.3.11 load-movie <filename> 
252 Load savestate <filename>, ignoring save part in readonly mode.
254 5.3.12 save-state <filename> 
256 Save system state to <filename> as soon as possible.
258 5.3.13 save-movie <filename> 
260 Save movie to <filename>.
262 5.3.14 set-rwmode 
264 Set read-write mode.
266 5.3.15 set-romode 
268 Set read-only mode
270 5.3.16 toggle-rwmode 
272 Toggle between read-only and read-write modes.
274 5.3.17 test-1, test-2, test-3
276 Internal test commands. Don't use.
278 5.3.18 take-screenshot <filename> 
280 Save screenshot to <filename>.
282 5.3.19 +controller <class>-<#>-<button>
284 Press button <button> on controller <num> of class <class>.
286 • Class 'gamepad': A, B, X, Y, L, R, select, start, up, down, 
287   left, right, ext0, ext1, ext2, ext3
289 • Class 'mouse': L, R
291 • Class 'superscope': trigger, cursor, turbo, pause
293 • Class 'justifier': trigger, start
295 • Class 'gb': A, B, select, start, up, down, left, right
297 5.3.20 hold-controller <class>-<#>-<button>
299 Hold/unhold button <button> on controller <num> of class <class>.
301 5.3.21 type-controller <class>-<#>-<button>
303 Hold/unhold button <button> on controller <num> of class <class> 
304 for the next frame. See +controller for button names.
306 Cauntion: Does not work properly if outside frame advance.
308 5.3.22 +autofire-controller <class>-<#>-<button> [[<duty>] 
309   <cyclelen>]
311 Start autofire. If duty is not specified, defaults to 1. If 
312 <cyclelen> is not specified, defaults to 2.
314 5.3.23 -autofire-controller <class>-<#>-<button> [[<duty>] 
315   <cyclelen>]
317 End autofire.
319 5.3.24 autofire-controller <class>-<#>-<button> [[<duty>] 
320   <cyclelen>]
322 Toggle autofire. If autofire is turned on, specified cycle is 
323 used.
325 5.3.25 designate-position <class>-<#>-analog<n>
327 Designate position for analog pair. <n> is only there if there 
328 are multiple axis pairs.
330 5.3.26 repaint
332 Force a repaint.
334 5.3.27 toggle-pause-on-end
336 Toggle pause on end flag.
338 5.3.28 set-pause-on-end
340 Set pause on end flag.
342 5.3.29 clear-pause-on-end
344 Clear pause on end flag.
346 5.4 Save jukebox 
348 5.4.1 cycle-jukebox-backward
350 Cycle save jukebox backwards.
352 5.4.2 cycle-jukebox-forward
354 Cycle save jukebox forwards
356 5.4.3 load-jukebox
358 Do load from jukebox (current mode).
360 5.4.4 save-jukebox
362 Do state save to jukebox.
364 5.5 Lua 
366 Only available if lua support is compiled in.
368 5.5.1 evaluate-lua <luacode>
370 Run Lua code <luacode> using built-in Lua interpretter.
372 5.5.2 run-lua <script>
374 Run specified lua file using built-in Lua interpretter.
376 5.5.3 reset-lua
378 Clear the Lua VM state and restore to factory defaults.
380 5.6 Memory watch
382 5.6.1 add-watch <name> <expression>
384 Adds new watch (or modifies old one).
386 5.6.2 remove-watch <name>
388 Remove a watch.
390 5.7 Sound 
392 5.7.1 enable-sound <on/off> 
394 Enable/Disable sound.
396 5.8 Misc.
398 5.8.1 reload-rom [<file>]
400 Reloads the main ROM image from <file>.
402 5.8.2 +tangent
404 Tangent for recording voice for commentary track. While pressed, 
405 record a stream.
407 6 Settings
409 6.1 Core settings
411 6.2 AVI dumper settings
413 6.2.1 avi-large
415 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
416 the console outputs.
418 6.2.2 avi-left-border
420 AVI dumper: Set the default left border thickness (unless lua 
421 overrides) for dumps. Range 0-8191. Default is 0.
423 6.2.3 avi-right-border
425 AVI dumper: Set the default right border thickness (unless lua 
426 overrides) for dumps. Range 0-8191. Default is 0.
428 6.2.4 avi-top-border
430 AVI dumper: Set the default top border thickness (unless lua 
431 overrides) for dumps. Range 0-8191. Default is 0.
433 6.2.5 avi-bottom-border
435 AVI dumper: Set the default bottom border thickness (unless lua 
436 overrides) for dumps. Range 0-8191. Default is 0.
438 6.2.6 avi-maxframes
440 AVI dumper: Maximum number of frames per dump segment (0 => 
441 unlimited). Range 0-999999999. Default is 0.
443 6.2.7 avi-compresison
445 AVI dumper: Compression level (0-18).
447 • Compression levels 10 and above are not compatible with stock 
448   CSCD codec.
450 • Recomended level is 7.
452 6.2.8 avi-soundrate
454 AVI dumper: Set method of determining the sound rate.
456 • 0: Pick nearest of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 
457   64, 88.2, 96, 128, 176.4 and 192 kHz.
459 • 1: Round down to nearest integer.
461 • 2: Round up to nearest ingeter.
463 • 3: Multiply by denominator.
465 • 4: High quality 44.1kHz (SRC needed).
467 • 5: High quality 48kHz (SRC needed).
469 6.3 JMD options
471 6.3.1 jmd-compression
473 JMD dumper: Compression level (0-9).
475 7 Lua functions
477 7.1 Core (in main table)
479 7.1.1 print
481 Print line to message console.
483 7.1.2 exec(string command)
485 Run command as it was entered on the command line
487 7.1.3 utime()
489 Returns two values. First is time since some epoch in seconds, 
490 the second is microseconds mod 10^6 since that epoch.
492 7.1.4 emulator_ready()
494 Returns true if emulator has finished booting, false if not 
495 (on_startup() will be issued later).
497 7.1.5 set_idle_timeout(number timeout)
499 Set number of microseconds to block idle for. After this timeout 
500 has expired, on_idle() will be called once.
502 7.1.6 set_timer_timeout(number timeout)
504 Set number of microseconds to block timer for. After this timeout 
505 has expired, on_timer() will be called once.
507 7.1.7 bus_address(number snesaddr)
509 Returns virtual address corresponding to specified address on 
510 SNES bus.
512 7.1.8 loopwrapper(function fun, ...)
514 Calls function fun with function and specified arguments. The 
515 function passed suspends execution until the function returned is 
516 called. Handy for linear flow control among multiple invocations 
517 of a hook. Example code:
519 on_paint = loopwrapper(function(wait)
521   while true do
523     gui.text(0, 0, “Test!”);
525     wait();
527   end
529 end);
531 7.1.9 list_bindings([string cmd])
533 Get table of all keybindings, indexed by keyspec 
534 (modifiers|mask/key). If command is specified, the table is 
535 limited to that command. Also searches for controller keys.
537 7.1.10 get_alias(string aname)
539 Get expansion of given alias.
541 7.1.11 set_alias(string aname, string value)
543 Set expansion of given alias.
545 7.1.12 create_ibind(string name, string cmd)
547 Return object representing inverse binding with specified name 
548 and specified command.
550 • To create press/release commands, use aliases +foo and -foo .
552 • Keep the returned object around.
554 7.2 Table bit:
556 Bitwise logical functions and related.
558 7.2.1 bit.none(number...) / bit.bnot(number...)
560 48-bit bitwise NOT / NONE function (set bits that are set in none 
561 of the arguments).
563 7.2.2 bit.any(number...) / bit.bor(number...)
565 48-bit bitwise OR / ANY function (set bits that are set in any of 
566 the arguments).
568 7.2.3 bit.all(number...) / bit.band(number...)
570 48-bit bitwise AND / ALL function (set bits that are set in all 
571 of the arguments).
573 7.2.4 bit.parity(number...) / bit.bxor(number...)
575 48-bit bitwise XOR / PARITY function (set bits that are set in 
576 odd number of the arguments).
578 7.2.5 bit.lrotate(number base[, number amount[, number bits]])
580 Rotate bits-bit (max 48, default 48) number left by amount 
581 (default 1) places.
583 7.2.6 bit.rrotate(number base[, number amount[, number bits]])
585 Rotate bits-bit (max 48, default 48) number right by amount 
586 (default 1) places.
588 7.2.7 bit.lshift(number base[, number amount[, number bits]])
590 Shift bits-bit (max 48, default 48) number left by amount 
591 (default 1) places. The new bits are filled with zeroes.
593 7.2.8 bit.lrshift(number base[, number amount[, number bits]])
595 Shift bits-bit (max 48, default 48) number logically right by 
596 amount (default 1) places. The new bits are filled with zeroes.
598 7.2.9 bit.arshift(number base[, number amount[, number bits]])
600 Shift bits-bit (max 48, default 48) number arithmetically right 
601 by amount (default 1) places. The new bits are shifted in with 
602 copy of the high bit.
604 7.2.10 bit.extract(number base[, number bit0[, number bit1,...]])
606 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 
607 and so on.
609 Notes: 
611 • Bit numbers up to 51 should work reliably (then things start 
612   falling apart due to double precision issues).
614 • There are two special bit positions, true and false, standing 
615   for always set bit and always clear bit.
617 7.2.11 bit.value([number bit1[, number bit2,...]])
619 Returns bitwise OR of 1 left shifted by bit1 places, 1 left 
620 shifted by bit2 places and so on. As special value, nil argument 
621 is no-op.
623 7.2.12 bit.test_any(number a, number b)
625 Returns true if bitwise and of a and b is nonzero, otherwise 
626 false.
628 7.2.13 bit.test_all(number a, number b)
630 Returns true if bitwise and of a and b is equals b, otherwise 
631 false.
633 7.2.14 bit.popcount(number a)
635 Returns number of set bits in a.
637 7.2.15 bit.clshift(number a, number b, [number amount,[number 
638   bits]])
640 Does chained left shift on a, b by amount positions, assuming 
641 numbers to be of specified number of bits.
643 7.2.16 bit.crshift(number a, number b, [number amount,[number 
644   bits]])
646 Does chained right shift on a, b by amount positions, assuming 
647 numbers to be of specified number of bits.
649 7.2.17 bit.flagdecode(number a, number bits, [string on, [string 
650   off]])
652 Return string of length bits where ith character is ith character 
653 of on if bit i is on, otherwise ith character of off. Out of 
654 range reads give last character, or '*'/'-' if empty.
656 7.2.18 bit.rflagdecode(number a, number bits, [string on, [string 
657   off]])
659 Like bit.flagdecode, but outputs the string in the opposite order 
660 (most significant bit first).
662 7.3 Table gui:
664 Most of these functions can only be called in on_paint and 
665 on_video callbacks. Exceptions are noted.
667 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
668 the green component, bits 16-23 are the red component, bits 24-31 
669 are alpha component (0 is fully opaque, 255 is almost 
670 transparent). -1 is the fully transparent color. Alpha values 
671 greater than 127 do work.
673 Origin of coordinates is at top left corner of game display area. 
674 Left and top gaps correspond to negative coordinates.
676 7.3.1 gui.resolution()
678 Returns 2-tuple (hresolution, vresolution).
680 7.3.2 gui.<class>_gap(number gap)
682 Set the <class> (left, right, top, bottom) gap to specified value 
683 (max gap is 8191).
685 7.3.3 gui.text(number x, number y, string text[, number fgc[, 
686   number bgc]])
688 Draw specified text on the GUI (each character cell is 8 or 16 
689 wide and 16 high). Parameters:
691 • x: X-coordinate to start the drawing from (and x-coordinate at 
692   begining of the lines).
694 • y: Y-coordinate to start the drawing from.
696 • text: The text to draw.
698 • fgc: Text color (default is 0xFFFFFF (white))
700 • bgc: Background color (default is -1 (transparent))
702 7.3.4 gui.textH(number x, number y, string text[, number fgc[, 
703   number bgc]])
705 Like gui.text, but draw using double-width.
707 7.3.5 gui.textV(number x, number y, string text[, number fgc[, 
708   number bgc]])
710 Like gui.text, but draw using double-height.
712 7.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
713   number bgc]])
715 Like gui.text, but draw using double-width/double-height.
717 7.3.7 gui.rectangle(number x, number y, number width, number 
718   height[, number thickness[, number outline[, number fill]]])
720 Draw rectangle on the GUI. Parameters:
722 • x: X-coordinate of left edge.
724 • y: Y-coordinate of upper edge.
726 • width: Width of rectangle.
728 • height: Height of rectangle.
730 • thickness: Thickness of outline (default is 1).
732 • outline: Color of outline (default is 0xFFFFFF (white))
734 • fill: Color of fill (default is -1 (transparent))
736 7.3.8 gui.box(number x, number y, number width, number height[, 
737   number thickness[, number outline1[,number outline2[, number 
738   fill]]]])
740 Draw rectangle with 3D effect on the GUI. Parameters:
742 • x: X-coordinate of left edge.
744 • y: Y-coordinate of upper edge.
746 • width: Width of rectangle.
748 • height: Height of rectangle.
750 • thickness: Thickness of outline (default is 1).
752 • outline1: First color of outline (default is 0xFFFFFF (white))
754 • outline2: First color of outline (default is 0x808080 (dark 
755   gray))
757 • fill: Color of fill (default is 0xC0C0C0 (light grayy))
759 7.3.9 gui.pixel(number x, number y[, number color])
761 Draw one pixel on the GUI. Parameters:
763 • x: X-coordinate of the pixel
765 • y: Y-coordinate of the pixel
767 • color: Color of the pixel (default is 0xFFFFFF (white))
769 7.3.10 gui.crosshair(number x, number y[, number length[, number 
770   color]])
772 Draw a crosshair. Parameters:
774 • x: X-coordinate of the crosshair
776 • y: Y-coordinate of the crosshair
778 • length: Length of the crosshair lines (default 10).
780 • color: Color of the crosshair (default is 0xFFFFFF (white))
782 7.3.11 gui.line(number x1, number y1, number x2, number y2[, 
783   number color])
785 Draw a thin line. Parameters:
787 • x1: X-coordinate of one end.
789 • y1: Y-coordinate of one end.
791 • x2: X-coordinate of the other end.
793 • y2: Y-coordinate of the other end.
795 • color: Color of the line (default is 0xFFFFFF (white)).
797 7.3.12 gui.circle(number x, number y, number r[, number thick[, 
798   number border[, number fil]]])
800 Draw a circle. Parameters.
802 • x: X-coordinate of the center
804 • y: Y-coordinate of the center
806 • r: The radius of the circle
808 • thick: Border thickness
810 • border: Border color (default is 0xFFFFFF (white))
812 • fill: Fill color (default is -1 (transparent)).
814 7.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette 
815   palette)
817 Draw a bitmap on screen with specified palette. Parameters:
819 • x: X-coordinate of left edge.
821 • y: Y-coordinate of top edge.
823 • bitmap: The bitmap to draw
825 • palette: The palette to draw the bitmap using.
827 7.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
829 Draw a bitmap on screen. Parameters:
831 • x: X-coordinate of left edge.
833 • y: Y-coordinate of top edge.
835 • bitmap: The bitmap to draw
837 7.3.15 gui.palette_new()
839 Returns a new palette (initially all transparent). Can be used 
840 anywhere.
842 7.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool 
843   icolor])
845 Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
847 • w: The width of new bitmap
849 • h: The height of new bitmap
851 • direct: If true, the returned bitmap is dbitmap, otherwise 
852   bitmap.
854 • icolor: Initital fill color (defaults to 0 on BITMAP, -1 on 
855   DBITMAP)
857 7.3.17 gui.bitmap_load(string file)
859 Returns loaded bitmap/dbitmap (if bitmap, the second return value 
860 is palette for bitmap). Can be used anywhere. Parameters:
862 • file: The name of file to load.
864 7.3.18 gui.palette_set(palette palette, number index, number 
865   color)
867 Sets color in palette. Can be used anywhere. Parameters:
869 • palette: The palette to manipulate
871 • index: Index of color (0-65535).
873 • color: The color value.
875 7.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y, 
876   number color)
878 Sets specified pixel in bitmap. Can be used anywhere. Parameters:
880 • bitmap: The bitmap to manipulate
882 • x: The x-coordinate of the pixel.
884 • y: The y-coordinate of the pixel.
886 • color: If bitmap is a bitmap, color index (0-65535). Otherwise 
887   color value.
889 7.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
891 Get size of bitmap. Can be used anywhere. Parameters:
893 • bitmap: The bitmap to query.
895 The first return is the width, the second is the height.
897 7.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy, 
898   bitmap/dbitmap src, number sx, number sy, number w, number h[, 
899   number ck])
901 Blit a part of bitmap to another. Can be used anywhere. 
902 Parameters:
904 • dest: Destination to blit to.
906 • dx: left edge of target
908 • dy: Top edge of target
910 • src: The source to blit from. Must be of the same type as 
911   destination.
913 • sx: left edge of source
915 • sy: Top edge of source
917 • w: Width of region
919 • h: Height of region.
921 • ck: Color key. Pixels of this color are not blitted.
923   – If bitmaps are bitmaps, this is color index of colorkey. 
924     Values outside range 0-65535 cause no key to be used as 
925     colorkey.
927   – If bitmaps are dbitmaps, this color value of colorkey.
929   – May be absent or nil for no colorkey blit.
931 7.3.22 gui.repaint()
933 Request on_repaint() to happen as soon as possible. Can be used 
934 anywhere.
936 7.3.23 gui.subframe_update(boolean on)
938 Request subframe updates (calling on_paint() on subframes) to 
939 happen (on=true) or not happen (on=false). Can be used anywhere.
941 7.3.24 gui.screenshot(string filename)
943 Write PNG screenshot of the current frame (no drawings) to 
944 specified file. Can be used anywhere.
946 7.3.25 gui.color(number r, number g, number b[, number a])
948 Returns color (in notation Lua scripts use) corresponding to 
949 color (r,g,b), each component in scale 0-255. If a is specified, 
950 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
951 The default alpha is 256.
953 7.3.26 gui.status(string name, string value)
955 Set status field “L[<name>]” to <value> in status area. Can be 
956 used anywhere.
958 7.3.27 gui.rainbow(number step, number steps[, number color])
960 Perform hue rotation of color <color> (default bright red), by 
961 <step> steps. The number of steps per full rotation is given by 
962 absolute value of <steps>.
964 If <steps> is negative, the rotation will be counterclockwise.
966 7.3.28 gui.screenshot(string filename)
968 Saves a screenshot into specified file.
970 7.3.29 gui.renderq_new(number width, number height)
972 Create render queue with specified reported size and return it.
974 7.3.30 gui.renderq_clear(RENDERQUEUE queue)
976 Clear specified render queue.
978 7.3.31 gui.renderq_set(RENDERQUEUE queue)
980 Switch to specified render queue. Use nil as queue to switch to 
981 default queue.
983 • When switched to another queue, all drawing functions work and 
984   draw there, even outside on_video/on_paint.
986 7.3.32 gui.renderq_run(RENDERQUEUE queue)
988 Run specified render queue, copying the objects to current render 
989 queue. 
991 • Warning: Don't try to run the current render queue.
993 7.3.33 gui.loadfont(string filename)
995 Loads font from specified file (CUSTOMFONT object).
997 7.3.34 CUSTOMFONT(number x, number y, string text[, number fgc[, 
998   number bgc]])
1000 Draw string with custom font to screen. The parameters are the 
1001 same as in gui.text.
1003 7.4 table input
1005 Input handling. Only available in on_input callback.
1007 7.4.1 input.get(number controller, number index)
1009 Read the specified index (0-11) from specified controller (0-7). 
1010 Notes:
1012 • Uses physical controller numbering. Gamepad in port 2 is 
1013   controller 4, not 1!
1015 7.4.2 input.set(number controller, number index, number value)
1017 Write the specified index (0-11) from specified controller (0-7), 
1018 storing value. Notes:
1020 • Uses physical controller numbering. Gamepad in port 2 is 
1021   controller 4, not 1!
1023 7.4.3 input.get2(number port, number controller, number index)
1025 Read the specified input tuple.
1027 • Port 0 is system port.
1029 7.4.4 input.set2(number port, number controller, number index, 
1030   number value)
1032 Write the specified input tuple.
1034 • Port 0 is system port.
1036 7.4.5 input.lcid_to_pcid2(number lcid)
1038 Look up physical pcid pair (port, controller) corresponding to 
1039 specified logical controller (1-based). Returns nothing if 
1040 controller does not exist.
1042 7.4.6 input.port_type(number port)
1044 Return type of specified port.
1046 7.4.7 input.controller_info(number port, number controller)
1048 Get controller info for specified controller. If controller does 
1049 not exist, returns nil. Otherwise returns a table with following 
1050 fields:
1052 • type (string): Type of the controller.
1054 • class (string): Class of the controller.
1056 • classnum (number): Number of the controller within its class 
1057   (1-based)
1059 • lcid (number): Logical controller number of the controller.
1061 • button_count (number): Number of buttons on controller
1063 • buttons (array): Array of following info about each button:
1065   – type (string): Type of button. Currently one of “null”, “
1066     button”, “axis”, “raxis”.
1068   – name (string): Name of button.
1070   – symbol (string): Symbol of button. Only present for type “
1071     button”.
1073   – hidden (boolean): True if hidden button. 
1075 7.4.8 input.veto_button()
1077 Signals that the button event should be vetoed. Only valid in 
1078 on_button callback.
1080 7.4.9 input.geta(number controller)
1082 Get input state for entiere controller. Returns 13 return values.
1084 • 1st return value: Bitmask: bit i is set if i:th index is 
1085   nonzero
1087 • 2nd-13th return value: value of i:th index.
1089 7.4.10 input.seta(number controller, number bitmask, number 
1090   args...)
1092 Set state for entiere controller. args is up to 12 values for 
1093 indices (overriding values in bitmask if specified).
1095 7.4.11 input.controllertype(number controller)
1097 Get the type of controller as string. Valid values are:
1099 • gamepad
1101 • mouse
1103 • justifier
1105 • superscope
1107 7.4.12 input.reset([number cycles])
1109 Execute reset. If cycles is greater than zero, do delayed reset. 
1110 0 (or no value) causes immediate reset.
1112 • Only available with subframe flag false.
1114 7.4.13 input.raw()
1116 Returns table of tables of all available keys and axes. The first 
1117 table is indexed by key name (platform-dependent!), and the inner 
1118 table has the following fields:
1120 • value: Last reported value for control
1122   – For keys: 1 for pressed, 0 for released.
1124   – For axes: -32767...32767.
1126   – For presure-sensitive buttons: 0...32767.
1128   – For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
1130   – For mouse: Coordinates relative to game area.
1132 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1133   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1134   pressure-pm, pressure-p0).
1136 7.4.14 input.keyhook(string key, boolean state)
1138 Requests that keyhook events to be sent for key (state=true) or 
1139 not sent (state=false).
1141 7.4.15 input.joyget(number controller)
1143 Returns table for current controls for specified controller. The 
1144 names of fields vary by controller type.
1146 • The buttons have the same name as those are referred to in 
1147   other contexts in the emulator
1149 • The analog axes are “xaxis” and “yaxis”.
1151 7.4.16 input.joyset(number controller, table controls)
1153 Set the the state of specified controller to values specified in 
1154 specified table.
1156 7.4.17 input.lcid_to_pcid(number controller)
1158 Return the physical index, physical port and controller number in 
1159 port for specified (1-based) logical controller.
1161 7.5 Table keyboard
1163 Various keybinding-related functions
1165 7.5.1 keyboard.bind(string mod, string mask, string key, string 
1166   cmd)
1168 Bind specified key with specified modifers to specified command.
1170 7.5.2 keyboard.unbind(string mod, string mask, string key)
1172 Unbind specified key with specified modifers.
1174 7.5.3 keyboard.alias(string alias, string expansion)
1176 Set expansion of given command.
1178 7.6 Table subtitle
1180 Subtitle handling
1182 7.6.1 subtitle.byindex(number i)
1184 Read the frame and length of ith subtitle. Returns nothing if not 
1185 present.
1187 7.6.2 subtitle.set(number f, number l, string txt)
1189 Set the text of subtitle.
1191 7.6.3 subtitle.get(number f, number l)
1193 Get the text of subtitle.
1195 7.6.4 subtitle.delete(number f, number l)
1197 Delete specified subtitle.
1199 7.7 Table hostmemory
1201 Host memory handling (extra memory saved to savestates). Host 
1202 memory starts empty.
1204 7.7.1 hostmemory.read(number address)
1206 Reads hostmemory slot address. Slot numbers out of range return 
1207 false instead of numeric.
1209 7.7.2 hostmemory.write(number address, number value)
1211 Writes hostmemory slot with 0-255. Slot numbers out of range 
1212 cause extension of host memory slot space.
1214 7.7.3 hostmemory.readbyte(number address)
1216 Read unsigned byte (1 element) from given address. Slots out of 
1217 range return false.
1219 7.7.4 hostmemory.writebyte(number address, number value)
1221 Write unsigned byte (1 element) to given slot. Slot numbers out 
1222 of range cause extension.
1224 7.7.5 hostmemory.readsbyte(number address)
1226 Read signed byte (1 element) from given address. Slots out of 
1227 range return false.
1229 7.7.6 hostmemory.writesbyte(number address, number value)
1231 Write signed byte (1 element) to given slot. Slot numbers out of 
1232 range cause extension.
1234 7.7.7 hostmemory.readword(number address)
1236 Read unsigned word (2 elements) from given address. Slots out of 
1237 range return false.
1239 7.7.8 hostmemory.writeword(number address, number value)
1241 Write unsigned word (2 elements) to given slot. Slot numbers out 
1242 of range cause extension.
1244 7.7.9 hostmemory.readsword(number address)
1246 Read signed word (2 elements) from given address. Slots out of 
1247 range return false.
1249 7.7.10 hostmemory.writesword(number address, number value)
1251 Write signed word (2 elements) to given slot. Slot numbers out of 
1252 range cause extension.
1254 7.7.11 hostmemory.readdword(number address)
1256 Read unsigned doubleword (4 elements) from given address. Slots 
1257 out of range return false.
1259 7.7.12 hostmemory.writedword(number address, number value)
1261 Write unsigned doubleword (4 elements) to given slot. Slot 
1262 numbers out of range cause extension.
1264 7.7.13 hostmemory.readsdword(number address)
1266 Read signed doubleword (4 elements) from given address. Slots out 
1267 of range return false.
1269 7.7.14 hostmemory.writesdword(number address, number value)
1271 Write signed doubleword (4 elements) to given slot. Slot numbers 
1272 out of range cause extension.
1274 7.7.15 hostmemory.readqword(number address)
1276 Read unsigned quadword (8 elements) from given address. Slots out 
1277 of range return false.
1279 7.7.16 hostmemory.writeqword(number address, number value)
1281 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1282 out of range cause extension.
1284 7.7.17 hostmemory.readsqword(number address)
1286 Read signed quadword (8 elements) from given address. Slots out 
1287 of range return false.
1289 7.7.18 hostmemory.writesqword(number address, number value)
1291 Write signed quadword (8 elements) to given slot. Slot numbers 
1292 out of range cause extension.
1294 7.8 Table movie
1296 Movie handling
1298 7.8.1 movie.currentframe()
1300 Return number of current frame.
1302 7.8.2 movie.framecount()
1304 Return number of frames in movie.
1306 7.8.3 movie.readonly()
1308 Return true if in readonly mode, false if in readwrite.
1310 7.8.4 movie.rerecords()
1312 Returns the current value of rerecord count.
1314 7.8.5 movie.set_readwrite()
1316 Set readwrite mode (does not cause on_readwrite callback).
1318 7.8.6 movie.frame_subframes(number frame)
1320 Count number of subframes in specified frame (frame numbers are 
1321 1-based) and return that.
1323 7.8.7 movie.read_subframe(number frame, number subframe)
1325 Read specifed subframe in specified frame and return data as 
1326 array (100 elements, numbered 0-99 currently).
1328 7.8.8 movie.read_rtc()
1330 Returns the current value of the RTC as a pair (second, 
1331 subsecond).
1333 7.8.9 movie.unsafe_rewind([UNSAFEREWIND state])
1335 Start setting point for unsafe rewind or jump to point of unsafe 
1336 rewind.
1338 • If called without argument, causes emulator to start process of 
1339   setting unsafe rewind point. When this has finished, callback 
1340   on_set_rewind occurs, passing the rewind state to lua script.
1342 • If called with argument, causes emulator rewind to passed 
1343   rewind point as soon as possible. Readwrite mode is implicitly 
1344   activated.
1346 The following warnings apply to unsafe rewinding:
1348 • There are no safety checks against misuse (that's what “unsafe” 
1349   comes from)!
1351 • Only call rewind from timeline rewind point was set from.
1353 • Only call rewind from after the rewind point was set.
1355 7.9 Table settings
1357 Routines for settings manipulation
1359 7.9.1 settings.get(string name)
1361 Get value of setting. If setting is blank, returns false. If 
1362 setting value can't be obtained, returns (nil, error message).
1364 7.9.2 settings.set(string name, string value)
1366 Set value of setting. If setting can't be set, returns (nil, 
1367 error message).
1369 7.9.3 settings.is_set(string name)
1371 Returns if setting is set. If setting does not exist, returns 
1372 (nil, error message).
1374 7.9.4 settings.blank(string name)
1376 Blanks a setting and returns true. If setting can't be blanked, 
1377 returns (nil, error message).
1379 7.10 Table memory
1381 Contains various functions for managing memory
1383 7.10.1 memory.vma_count()
1385 Returns the number of VMAs
1387 7.10.2 memory.read_vma(number index)
1389 Reads the specified VMA (indices start from zero). Trying to read 
1390 invalid VMA gives nil. The read VMA is table with the following 
1391 fields:
1393 • region_name (string): The readable name of the VMA
1395 • baseaddr (number): Base address of the VMA
1397 • lastaddr (number): Last address in the VMA.
1399 • size (number): The size of VMA in bytes.
1401 • readonly (boolean): True of the VMA corresponds to ROM.
1403 • iospace (boolean): True if the VMA is I/O space.
1405 • native_endian (boolean): True if the VMA has native endian as 
1406   opposed to little endian.
1408 7.10.3 memory.find_vma(number address)
1410 Finds the VMA containing specified address. Returns table in the 
1411 same format as read_vma or nil if not found.
1413 7.10.4 memory.readbyte(number address)
1415 Reads the specified address as unsigned byte and returns the 
1416 result.
1418 7.10.5 memory.readsbyte(number address)
1420 Reads the specified address as signed byte and returns the 
1421 result.
1423 7.10.6 memory.writebyte(number address, number value)
1425 Writes the specified value (negative values undergo 2's 
1426 complement) to specified address (as a byte).
1428 7.10.7 memory.readword(number address)
1430 Reads the specified address as unsigned word and returns the 
1431 result.
1433 7.10.8 memory.readsword(number address)
1435 Reads the specified address as signed word and returns the 
1436 result.
1438 7.10.9 memory.writeword(number address, number value)
1440 Writes the specified value (negative values undergo 2's 
1441 complement) to specified address (as a word).
1443 7.10.10 memory.readdword(number address)
1445 Reads the specified address as unsigned doubleword and returns 
1446 the result.
1448 7.10.11 memory.readsdword(number address)
1450 Reads the specified address as signed doubleword and returns the 
1451 result.
1453 7.10.12 memory.writedword(number address, number value)
1455 Writes the specified value (negative values undergo 2's 
1456 complement) to specified address (as a doubleword).
1458 7.10.13 memory.readqword(number address)
1460 Reads the specified address as unsigned quadword and returns the 
1461 result.
1463 7.10.14 memory.readsqword(number address)
1465 Reads the specified address as signed quadword and returns the 
1466 result.
1468 7.10.15 memory.writeqword(number address, number value)
1470 Writes the specified value (negative values undergo 2's 
1471 complement) to specified address (as a quadword).
1473 7.10.16 memory.hash_region(number base, number size)
1475 Hash specified number of bytes starting from specified address 
1476 and return the SHA-256.
1478 7.10.17 memory.hash_state()
1480 Hash the current system state. Mainly useful for debugging 
1481 savestates.
1483 7.10.18 memory.readregion(number base, number size)
1485 Read a region of memory.
1487 • Warning: If the region crosses VMA boundary, the results are 
1488   undefined.
1490 7.10.19 memory.map<type>([number base, number size])
1492 Returns a table mapping specified memory aperture for read/write. 
1493 If parameters are omitted, entiere map space is the aperture.
1495 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1496   qword or sqword.
1498 7.10.20 memory.writeregion(number base, number size, table data)
1500 Write a region of memory.
1502 • Warning: If the region crosses VMA boundary, the results are 
1503   undefined.
1505 7.10.21 memory.map_structure()
1507 Returns a new mapping structure (MMAP_STRUCT)
1509 7.10.22 MMAP_STRUCT(string key, number address, string type)
1511 Bind key in mmap structure to specified address with specified 
1512 type.
1514 • Type may be one of: byte, sbyte, word, sword, dword, sdword, 
1515   qword or sqword.
1517 7.10.23 memory.read_expr(string expr)
1519 Evaluate specified watch expression and return result
1521 7.11 Table subtitle
1523 Contains functions for manipulating subtitles.
1525 7.11.1 subtitle.byindex(number index)
1527 Get (basetime, length) pair of specified subtitle index or 
1528 nothing if index isn't valid.
1530 7.11.2 subtitle.get(number basetime, number length)
1532 Read the specified subtitle. Returns “” if the subtitle does not 
1533 exist.
1535 7.11.3 subtitle.set(number basetime, number length, string 
1536   content)
1538 Set the specified subtitle.
1540 7.11.4 subtitle.deltete(number basetime, number length)
1542 Delete the specified subtitle.
1544 7.12 Table _SYSTEM
1546 Contains copy of global variables from time of Lua 
1547 initialization. Non-writeable.
1549 7.13 Callbacks
1551 Various callbacks to Lua that can occur.
1553 7.13.1 Callback: on_paint(bool not_synth)
1555 Called when screen is being painted. Any gui.* calls requiring 
1556 graphic context draw on the screen.
1558 not_synth is true if this hook is being called in response to 
1559 received frame, false otherwise.
1561 7.13.2 Callback: on_video()
1563 Called when video dump frame is being painted. Any gui.* calls 
1564 requiring graphic context draw on the video.
1566 7.13.3 Callback: on_frame_emulated()
1568 Called when emulating frame has completed and 
1569 on_paint()/on_video() calls are about to be issued.
1571 7.13.4 Callback: on_frame()
1573 Called on each starting whole frame.
1575 7.13.5 Callback: on_startup()
1577 Called when the emulator is starting (lsnes.rc and --run files 
1578 has been run).
1580 7.13.6 Callback: on_rewind()
1582 Called when rewind movie to beginning has completed.
1584 7.13.7 Callback: on_pre_load(string name)
1586 Called just before savestate/movie load occurs (note: loads are 
1587 always delayed, so this occurs even when load was initiated by 
1588 lua).
1590 7.13.8 Callback: on_err_load(string name)
1592 Called if loadstate goes wrong.
1594 7.13.9 Callback: on_post_load(string name, boolean was_savestate)
1596 Called on successful loadstate. was_savestate gives if this was a 
1597 savestate or a movie.
1599 7.13.10 Callback: on_pre_save(string name, boolean is_savestate)
1601 Called just before savestate save occurs (note: movie saves are 
1602 synchronous and won't trigger these callbacks if called from 
1603 Lua).
1605 7.13.11 Callback: on_err_save(string name)
1607 Called if savestate goes wrong.
1609 7.13.12 Callback: on_post_save(string name, boolean is_savestate)
1611 Called on successful savaestate. is_savestate gives if this was a 
1612 savestate or a movie.
1614 7.13.13 Callback: on_quit()
1616 Called when emulator is shutting down.
1618 7.13.14 Callback: on_input(boolean subframe)
1620 Called when emulator is just sending input to bsnes core. 
1621 Warning: This is called even in readonly mode, but the results 
1622 are ignored.
1624 7.13.15 Callback: on_reset()
1626 Called when SNES is reset.
1628 7.13.16 Callback: on_readwrite()
1630 Called when moving into readwrite mode as result of “set-rwmode” 
1631 command (note: moving to rwmode by Lua won't trigger this, as per 
1632 recursive entry protection).
1634 7.13.17 Callback: on_snoop(number port, number controller, number 
1635   index, number value)
1637 Called each time bsnes asks for input. The value is the final 
1638 value to be sent to bsnes core (readonly mode, autohold and 
1639 autofire have been taken into account). Might be useful when 
1640 translating movies to format suitable for console verification. 
1641 Note: There is no way to modify the value to be sent.
1643 • Not called if callback on_snoop2 is defined.
1645 7.13.18 Callback: on_snoop2(number port, number controller, 
1646   number index, number value)
1648 Like on_snoop, but reserves port 0 for system, having first user 
1649 port be port 1.
1651 7.13.19 Callback: on_keyhook(string keyname, table state)
1653 Sent when key that has keyhook events requested changes state. 
1654 Keyname is name of the key (group) and state is the state (same 
1655 kind as table values in input.raw).
1657 7.13.20 Callback: on_idle()
1659 Called when requested by set_idle_timeout(), the timeout has 
1660 expired and emulator is waiting.
1662 7.13.21 Callback: on_timer()
1664 Called when requested by set_idle_timeout() and the timeout has 
1665 expired (regardless if emulator is waiting).
1667 7.13.22 Callback: on_set_rewind(UNSAFEREWIND r)
1669 Called when unsafe rewind object has been constructed.
1671 7.13.23 Callback: on_pre_rewind() 
1673 Called just before unsafe rewind is about to occur.
1675 7.13.24 Callback: on_post_rewind() 
1677 Called just after unsafe rewind has occured.
1679 7.13.25 Callback: on_button(number port, number controller, 
1680   number index, string type)
1682 Called on controller button press, with following parameters:
1684 • port: Port number (0 is system)
1686 • controller: Controller within port
1688 • index: Index of button.
1690 • type: Type of event, one of:
1692   – “pressed”: Button was pressed.
1694   – “released”: Button was released.
1696   – “hold”: Held.
1698   – “unhold”: Released from hold.
1700   – “type”: Typing input on button.
1702   – “untype”: Typing input undone.
1704   – “autofire <duty> <cycle>”: Autofire with specifie duty and 
1705     cycle.
1707   – “autofire”: Stop autofire.
1709   – “analog”: Analog action on axis.
1711 8 Movie editor
1713 • The editor edits in-memory movie.
1715 • Because past can't be edited and readwrite mode doesn't allow 
1716   future, editing only works in read only mode.
1718 • Keyboard triggers the normal hotkeys and bindings.
1720 8.1 Left button actions
1722 • Clicking on cell in future (indicated by lack of redish 
1723   background) toggles it (if it is a button) or prompts for a 
1724   value (if it is an axis)
1726 • Dragging vertically toggles sequence of buttons or changes a 
1727   sequence of axis values.
1729 8.2 Right button actions
1731 The right mouse button pops up a context-sensitive menu:
1733 • Toggle <something>: Toggle this button
1735 • Change <something>: Change this axis value
1737 • Insert frame after: Insert a frame after this frame
1739 • Append frame: Append a frame to movie
1741 • Append frames: Append specified number of frames to movie
1743 • Delete frame: Delete this frame
1745 • Delete subframe: Delete this subframe
1747 • Truncate movie: Delete this subframe and everything after it.
1749 • Scroll to frame: Prompt for a frame and scroll the display to 
1750   that frame.
1752 • Scroll to current frame: Scroll the display to current position
1754 • Run to frame: Prompts for frame and runs the emulation to that 
1755   frame.
1757 • Change number of lines visible: Change the height of the movie 
1758   display (1 to 255).
1760 • Lock scroll to playback: While playing back or rewinding 
1761   movies, the display will follow if enabled.
1763 9 Memory watch expression syntax
1765 Memory watch expressions are in RPN (Reverse Polish Notation). At 
1766 the end of expression, the top entry on stack is taken as the 
1767 final result.
1769 Notations:
1771 • Evaluation order is strictly left to right.
1773 • a is the entry on top of stack
1775 • b is the entry immediately below top of stack
1777 • ; separates values to be pushed (no intermediate pop).
1779 • After end of element, all used stack slots are popped and all 
1780   results are pushed.
1782 • When pushing multiple values, the pushes occur in order shown.
1784 The following operators are available:
1786 • + : a + b
1788 • - : a - b
1790 • * : a * b
1792 • / : a / b
1794 • % : a % b
1796 • a : atan(a)
1798 • b : read_signed_byte(a)
1800 • c : cos(a)
1802 • d : read_signed_dword(a)
1804 • i : quotent(a / b)
1806 • p :\pi
1809 • q : read_signed_qword(a)
1811 • r : sqrt(a)
1813 • s : sin(a)
1815 • t : tan(a)
1817 • u : a; a
1819 • w : read_signed_word(a)
1821 • A : atan2(a, b)
1823 • B : read_unsigned_byte(a)
1825 • C<number>z : Push number <number> to stack.
1827 • D : read_unsigned_dword(a)
1829 • C0x<number>z : Push number <number> (hexadecimal) to stack.
1831 • H<digit> : Set hexadecimal mode with specified number of digits 
1832   (use A-G for 10-16 digits).
1834 • Q : read_unsigned_qword(a)
1836 • R<digit> : round a to <digit> digits.
1838 • W : read_unsigned_word(a)
1840 9.1 Example:
1842 C0x007e0878zWC0x007e002czW-
1844 1. Push value 0x7e0878 on top of stack (C0x007e0878z).
1846 2. Pop the value on top of stack (0x7e0878), read word value at 
1847   that address and push the result,call it x1 (W).
1849 3. Push value 0x7e002c on top of stack (C0x007e002cz).
1851 4. Pop the value on top of stack (0x7e002c), read word value at 
1852   that address and push the result,call it x2 (W).
1854 5. Pop the two top numbers on stack, x1 and x2, substract x1 from 
1855   x2 and push x2 - x1 (-).
1857 6. Since the expression ends, the final memory watch result is 
1858   the top one on stack, which is x2 - x1.
1860 10 Modifier and key names:
1862 10.1 wxWidgets platform
1864 10.1.1 Modifier names:
1866 Following modifier names are known:
1868 • alt
1870 • ctrl
1872 • shift 
1874 • meta
1876 • cmd (Mac OS X only)
1878 10.1.2 Key names:
1880 Following key names are known:
1882 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1883   dollar, percent, ampersand, quote, leftparen, rightparen, 
1884   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1885   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1886   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1887   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1888   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1889   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1890   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1891   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1892   home, lefT, up, right, down, select, print, execute, snapshot, 
1893   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1894   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1895   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1896   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1897   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1898   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1899   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1900   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1901   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1902   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1903   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1904   windows_right, windows_menu, command, special1, special2, 
1905   special3, special4, special5, special6, special7, special8, 
1906   special9, special10, special11, special12, special13, 
1907   special14, special15, special16, special17, special18, 
1908   special19, special20
1910 11 Movie file format
1912 Movie file is .zip archive in itself, normal ZIP archive tools 
1913 work on it (note: If you recompress it, do not use compression 
1914 methods other than store and deflate and especially do not use 
1915 encryption of any kind).
1917 11.1 Detecting clean start/SRAM/Savestate
1919 • If file has member “savestate” it is savestate, otherwise:
1921 • If file has members with names starting “moviesram.” it is 
1922   movie starting from SRAM, otherwise:
1924 • It is movie starting from clear state.
1926 11.2 Member: gametype
1928 Type of game ROM and region (as one line). Valid values are:
1931 +--------------+---------------------+--------+
1932 |    Value     |       System        | Region |
1933 +--------------+---------------------+--------+
1934 +--------------+---------------------+--------+
1935 |  snes_pal    |     Super NES       |  PAL   |
1936 +--------------+---------------------+--------+
1937 |   sgb_pal    |   Super Game Boy    |  PAL   |
1938 +--------------+---------------------+--------+
1939 |  snes_ntsc   |     Super NES       |  NTSC  |
1940 +--------------+---------------------+--------+
1941 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
1942 +--------------+---------------------+--------+
1943 |     bsx      | BS-X (non-slotted)  |  NTSC  |
1944 +--------------+---------------------+--------+
1945 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
1946 +--------------+---------------------+--------+
1947 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
1948 +--------------+---------------------+--------+
1951 Frame rates are:
1954 +---------+-----------------+
1955 | Region  | Framerate (fps) |
1956 +---------+-----------------+
1957 +---------+-----------------+
1958 |  PAL    |   322445/6448   |
1959 +---------+-----------------+
1960 |  NTSC   | 10738636/178683 |
1961 +---------+-----------------+
1964 11.3 Member: port1
1966 Contains type of port #1 (as one line). Valid values are 'none', 
1967 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
1968 'gamepad'.
1970 11.4 Member: port2
1972 Contains type of port #2 (as one line). Valid values are 'none', 
1973 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
1974 'justifiers'. If not present, defaults to 'none'.
1976 11.5 Member: gamename
1978 Contains name of the game (as one line).
1980 11.6 Member: authors
1982 Contains authors, one per line. Part before '|' is the full name, 
1983 part after is the nickname.
1985 11.7 Member: systemid
1987 Always “lsnes-rr1” (one line). Used to reject other saves.
1989 11.8 Member: controlsversion
1991 Always “0” (one line). Used to identify what controls are there.
1993 11.9 Member: “coreversion”
1995 Contains bsnes core version number (as one line).
1997 11.10 Member: projectid
1999 Contains project ID (as one line). Used to identify if two movies 
2000 are part of the same project.
2002 11.11 Member: {rom,slota,slotb}{,xml}.sha256
2004 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
2005 Absent if corresponding file is absent.
2007 11.12 Member: moviesram.<name>
2009 Raw binary startup SRAM of kind <name>. Only present in 
2010 savestates and movies starting from SRAM.
2012 11.13 Member: saveframe
2014 Contains frame number (as one line) of frame movie was saved on. 
2015 Only present in savestates.
2017 11.14 Member: lagcounter
2019 Current value of lag counter (as one line). Only present in 
2020 savestates.
2022 11.15 Member: pollcounters
2024 Contains poll counters (currently 100 of them), one per line. 
2025 Each line is raw poll count if DRDY is set for it. Otherwise it 
2026 is negative poll count minus one. Only present in savestates.
2028 11.16 Member: hostmemory
2030 Raw binary dump of host memory. Only present in savestates.
2032 11.17 Member: savestate
2034 The raw binary savestate itself. Savestate detection uses this 
2035 file, only present in savestates.
2037 11.18 Member: screenshot
2039 Screenshot of current frame. Only present in savestates. First 2 
2040 bytes are big-endian width of image, rest are 24-bit RGB image 
2041 data. Height of image is inferred from the width and size of 
2042 data.
2044 11.19 Member: sram.<name>
2046 Raw binary SRAM of kind <name> at time of savestate. Only present 
2047 in savestates.
2049 11.20 Member: input
2051 The actual input track, one line per subframe (blank lines are 
2052 skipped).
2054 • If the first byte of each line is '.', ' ', <tab> or '|', then 
2055   the line is part of same frame as previous, otherwise it starts 
2056   a new frame.
2058 • First subframe must start a new frame.
2060 Length of movie in frames is number of lines in input file that 
2061 start a new frame.
2063 11.21 Member: subtitles
2065 Subtitle track. Optional.
2067 • Each line is in form <firstframe> <numframes> <text>.
2069 • Linefeed is encoded as \n, backslash is encoded as \\.
2071 11.22 Member: rerecords
2073 Contains textual base-10 rerecord count (as one line; emulator 
2074 just writes this, it doesn't read it) + 1.
2076 11.23 Member: rrdata
2078 This member stores set of load IDs. There is one load ID per 
2079 rerecord (plus one corresponding to start of project).
2081 • This member constists of concatenation of records
2083 • Each record is 2-36 bytes long and can represent 1-16,843,009 
2084   consequtive IDs.
2086 • IDs are interpretted as 256-bit big-endian integers with 
2087   warparound.
2089 • Initial predicted ID is all zeroes.
2091 Format of each record is:
2093 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
2094   bits 5-6 are count length (countlen). Bit 7 is unused.
2096 • 32-prefixlen bytes of ID.
2098 • countlen bytes of big-endian count (count).
2100 Records are processed as follows:
2102 • To form the first ID encoded by record, take the first 
2103   prefixlen bytes predicted ID and append the read ID value to 
2104   it. The result is the first ID encoded.
2106 • If countlen is 0, record encodes 1 ID.
2108 • If countlen is 1, record encodes 2+count IDs.
2110 • If countlen is 2, record encodes 258+count IDs.
2112 • If countlen is 3, record encodes 65794+count IDs.
2114 • The new predicted ID is the next ID after last one encoded by 
2115   the record.
2117 The number of rerecords + 1 is equal to the sum of number of IDs 
2118 encoded by all records.
2120 11.24 Member: starttime.second
2122 Movie starting time, second part. Epoch is Unix epoch. Default is 
2123 1,000,000,000.
2125 11.25 Member: starttime.subsecond
2127 Movie starting time, subsecond part. Unit is CPU clocks. Default 
2128 is 0.
2130 11.26 Member: savetime.second
2132 Movie saving time, second part. Default is starttime.second. Only 
2133 present in savestates.
2135 11.27 Member: savetime.subsecond
2137 Movie saving time, subsecond part. Default is 
2138 starttime.subsecond. Only present in savestates.
2140 12 lsvs file format (commentary tracks)
2142 12.1 Clusters
2144 • Each cluster is 8kB (8192 bytes) in size.
2146 • Cluster n starts at offset 8192*n in file.
2148 • The following clusters are system special:
2150   – Cluster 0 and all clusters with number multiple of 2048 
2151     (cluster tables)
2153   – Cluster 1 (superblock)
2155 12.2 Cluster tables
2157 • The cluster table describing cluster n is stored in cluster n & 
2158   ~0x7FF (zero last 11 bits of n).
2160 • This cluster table consists of 2048 4-byte big-endian integers.
2162 • Each entry describes a cluster in 16MB supercluster, in order.
2164 • The valid values for entries are:
2166   – 0x00000000: Free cluster
2168   – 0x00000001: Last cluster in chain.
2170   – 0xFFFFFFFF: System cluster (cluster tables and superblock)
2172   – (anything else): Number of next cluster in chain. Must not be 
2173     multiple of 2048.
2175 • Due to limitations of the format, there can be at most 2097052 
2176   superclusters, giving maximum file size of 16TB.
2178 12.3 Stream table
2180 • The stream table chain always starts in cluster 2.
2182 • Otherwise, it follows normal chaining.
2184 • The stream table consists of 16-byte entries:
2186   – The first 8 bytes of entry give big-endian beginning position 
2187     of stream in units of 1/48000 s.
2189   – The next 4 bytes of entry give big-endian beginning cluster 
2190     for control data. 0 here marks the entry as not present.
2192   – The last 4 bytes of entry give big-endian beginning cluster 
2193     for codec data.
2195 • Stream table clusters are normal clusters, following normal 
2196   chaining.
2198 • The stream begnning position is not guarenteed unique. There 
2199   can be multiple streams with the same starting position in the 
2200   file.
2202 12.4 Stream control data
2204 • The stream control data consists of entries 4 bytes each:
2206   – The first 2 bytes of entry gives big-endian length of packet
2208   – The next byte of entry gives audio length of packet in units 
2209     of 1/400 s.
2211   – The last byte is control byte.
2213     ∗ 0 means this entry is not present and the control data 
2214       ends.
2216     ∗ 1 is valid control entry.
2218 • The stream control data can also end by running into end of the 
2219   readable chain.
2221   – This happens if there happens to be exact multiple of 2048 
2222     packets in stream and number of packets is nonzero.
2224 • These clusters follow normal chaining.
2226 12.5 Stream codec data
2228 • Stream codec data consists of raw Opus data packets packed back 
2229   to back with nothing in between.
2231 • Warning: Due to internal limitations, this data must reside in 
2232   the first 65536 superclusters (that is, the first 1TB of the 
2233   file).
2235 12.6 Superblock
2237 • The superblock is stored in cluster 1. 
2239 • The first 11 bytes are “sefs-magic”<NUL>.
2241 • The rest are unused.
2243 • This cluster 1 is marked as system special.
2245 13 Known ROM extensions
2247 • SNES cartridge ROMs: sfc, smc, swc, fig, ufo, sf2, gd3, gd7, 
2248   dx2, mgd, mgh.
2250 • DMG cartridge ROMs: dmg, gb.
2252 • GBC cartridge ROMs: cgb, gbc.
2254 14 Gamepack files
2256 • The first line must be: “[GAMEPACK FILE]”.
2258 • There is one needed line: “type <systype>”. This sets system 
2259   type to <systype>. The following system types are valid:
2261   – snes (SNES)
2263   – bsx (BS-X non-slotted)
2265   – bsxslotted (BS-X slotted)
2267   – sufamiturbo (Sufami Turbo)
2269   – sgb (Super Game Boy)
2271   – dmg (Game Boy)
2273   – gbc (Game Boy Color)
2275   – gbc_gba (Game Boy Color with GBA initial register values)
2277 • Optionally a region can be specified: “region <region>”. The 
2278   following values are valid:
2280   – autodetect (Autodetect region: snes and sgb only)
2282   – ntsc (NTSC: snes, bsx, bsxslotted, sufamiturbo, sgb)
2284   – pal (PAL: snes, sgb)
2286   – world (World: dmg, gbc, gbc_gba)
2288 • ROM images are loaded as: “rom <type> <file>”. The following 
2289   types are valid:
2291   – rom (Cartridge ROM in snes, dmg, gbc, gbc_gba. BIOS in bsx, 
2292     bsxslotted, sufamiturbo)
2294   – bsx (Cartridge ROM in bsx, bsxslotted)
2296   – slot-a (Cartridge ROM in sufamiturbo)
2298   – slot-b (Cartridge ROM in sufamiturbo)
2300 • ROM markup can be loaded as: “xml <type> <file>”. The types 
2301   valid are the same as for ROMs.
2303 • Patches can be loaded as “patch[<offset>] <type> <file>”. The 
2304   types are the same as for ROMs.
2306   – Offset is given in form [+-]<number>. Usually offset is 
2307     either +0 or -512.
2309   – Default offset is +0.
2311 14.1 Example:
2313 [GAMEPACK FILE]
2315 type snes
2317 rom rom speedygonzales.sfc
2319 patch-512 rom sonicthehedgehog.ips
2321 14.2 Example 2:
2323 [GAMEPACK FILE]
2325 type sgb
2327 rom rom supergameboy.sfc
2329 rom dmg megamanV.dmg
2331 15 Quick'n'dirty encode guide
2333 1. Start the emulator and load the ROM and movie file.
2335 2. Set large AVI option 'set-setting avi-large on'
2337 3. Enable dumping 'dump-avi tmpdump' 
2339 4. Unpause and let it run until you want to end dumping.
2341 5. Close the emulator (closing the window is the easiest way). Or 
2342   use 'end-avi'.
2344 6. For each tmpdump*.avi file created, on command prompt, do 
2345   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
2347 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
2349 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
2350   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
2351   tmpdump_<numbers>.mkv, with + in between).
2353 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
2354   final.mkv contains quick'n'dirty encode.
2356 16 Axis configurations for some gamepad types:
2358 16.1 XBox360 controller:
2360 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
2361 set to pressure-+.
2363 set-axis joystick0axis2 pressure-+
2365 set-axis joystick0axis5 pressure-+
2367 • This is needed for SDL only. EVDEV sets those types correctly.
2369 16.2 PS3 “sixaxis” controller:
2371 Axes 8-19 should be disabled.
2373 set-axis joystick0axis8 disabled
2375 set-axis joystick0axis9 disabled
2377 set-axis joystick0axis10 disabled
2379 set-axis joystick0axis11 disabled
2381 set-axis joystick0axis12 disabled
2383 set-axis joystick0axis13 disabled
2385 set-axis joystick0axis14 disabled
2387 set-axis joystick0axis15 disabled
2389 set-axis joystick0axis16 disabled
2391 set-axis joystick0axis17 disabled
2393 set-axis joystick0axis18 disabled
2395 set-axis joystick0axis19 disabled
2397 17 Errata:
2399 17.1 Problems from BSNES core:
2401 • The whole pending save stuff.
2403 • Lack of layer hiding.
2405 • It is slow (especially accuracy).
2407 • Firmwares can't be loaded from ZIP archives.
2409 17.2 Other problems:
2411 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2413 • Audio for last dumped frame is not itself dumped.
2415 • Audio in UI is pretty bad in quality if game doesn't run at 
2416   full speed.
2418 • No menus, command based interface (SDL).
2420 • Long commands don't scroll.
2422 18 Changelog:
2424 18.1 rr0-beta1
2426 • Fix -Wall warnings
2428 • Fix dumper video corruption with levels 10-18.
2430 18.2 rr0-beta2
2432 • Autofire
2434 • Lots of code cleanups
2436 • Lua interface to settings
2438 • Allow specifying AVI borders without Lua
2440 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2442 • on_snoop lua callback
2444 • Faster movie loading and saving.
2446 18.3 rr0-beta3
2448 • Joystick support
2450 18.4 rr0-beta4
2452 • Fix multi-buttons
2454 • Save jukebox functionality.
2456 18.5 rr0-beta5
2458 • Try to fix some nasty failing movie load edge cases
2460 • Allow specifying scripts to run on command line.
2462 18.6 rr0-beta6
2464 • Major source code reorganization.
2466 • Backup savestates before overwriting.
2468 • Don't crash if loading initial state fails.
2470 18.7 rr0-beta7
2472 • Fix firmware lookup
2474 • Fix author name parsing
2476 • Fix rerecord counting
2478 • (SDL) Print messages to console if SDL is uninitialized
2480 • Add movieinfo program
2482 • Fix loading movies starting from SRAM.
2484 18.8 rr0-beta8
2486 • Add support for unattended dumping
2488 • Fix compiling for Win32
2490 • Don't lock up if sound can't be initialized
2492 • Strip trailing CR from commands
2494 • Don't try to do dubious things in global ctors (fix crash on 
2495   startup)
2497 18.9 rr0-beta9
2499 • Small documentation tweaking
2501 • Fix make clean
2503 • Fix major bug in modifier matching
2505 18.10 rr0-beta10
2507 • Lots of documentation fixes
2509 • Use dedicated callbacks for event backcomm., not commands.
2511 • Ensure that the watchdog is not hit when executing delayed 
2512   reset.
2514 • Remove errant tab from joystick message.
2516 18.11 rr0-beta11
2518 • Make autofire operate in absolute time, not linear time
2520 • Reinitialize controls when resuming from loadstate
2522 • Some more code cleanups
2524 • If Lua allocator fails, call OOM_panic()
2526 • Byte/word/dword/qword sized host memory write/read functions.
2528 • Dump at correct framerate if dumping interlaced NTSC 
2529   (height=448).
2531 18.12 rr0-beta12
2533 • Actually include the complete source code
2535 • Keep track of RTC
2537 18.13 rr0-beta13
2539 • Document {save,start}time.{,sub}second.
2541 • Intercept time() from bsnes core.
2543 18.14 rr0-beta14
2545 • Allow disabling time() interception (allow build on Mac OS X)
2547 • Use SDLMain on Mac OS X (make SDL not crash)
2549 • Disable delayed resets (just plain too buggy for now).
2551 • Code cleanups
2553 • Use 16-bit for graphics/video instead of 32-bit.
2555 • gui.rectangle/gui.pixel
2557 • gui.crosshair
2559 • New CSCD writer implementation.
2561 18.15 rr0-beta15
2563 • Fix interaction of * and +.
2565 • Manual improvements
2567 • Use gettimeofday()/usleep(), these seem portable enough.
2569 • Move joystick axis manipulation to keymapper code.
2571 • Changes to how read-only works.
2573 • Refactor controller input code.
2575 18.16 rr0-beta16
2577 • Fix mouseclick scale compensation.
2579 • Draw area boundaries correctly in SDL code.
2581 • gui.screenshot.
2583 • Fix CSCD output (buffer overrun and race condition).
2585 18.17 rr0-beta17
2587 • JMD dumping support.
2589 • Allow unattended dumping to JMD.
2591 • Move to BSNES v083.
2593 • Switch back to 32-bit colors.
2595 • Add Lua function gui.color.
2597 • Use some new C++11 features in GCC 4.6.
2599 • Be prepared for core frequency changes.
2601 • Pass colors in one chunk from Lua.
2603 18.18 rr0-beta18
2605 • New lua functions gui.line(), gui.status() and gui.circle(), 
2606   memory.vma_count(), memory.read_vma() and memory.find_vma().
2608 • Numerious documentation fixups
2610 • RTC time format changed
2612 • Reformat flags display
2614 • Allow lua package name to be overridden
2616 • SDUMP (high-quality dumping).
2618 • Split platform support to plugins.
2620 • Make all sound plugins support basic sound commands
2622 • Support portaudio for sound.
2624 • Allow disable Lua/SDL searching.
2626 • Upconvert colors when copying lcscreen to screen.
2628 • Reorganize source tree.
2630 • Evdev joystick support.
2632 • Refactor more code into generic window code.
2634 18.19 rr0-beta19
2636 • Refactor message handling.
2638 • Rework makefile
2640 • Documentation fixes
2642 • Finish pending saves before load/quit.
2644 • Wxwidgets graphics plugin.
2646 18.20 rr0-beta20
2648 • Get rid of win32-crap.[ch]pp.
2650 • Move files around a lot.
2652 • Get rid of need for host C++ compiler.
2654 • Bsnes v084 core.
2656 • Refactor inter-component communication.
2658 • Fix zero luma.
2660 • Fix crash on multiline aliases.
2662 • Load/Save settings in wxwidgets gui.
2664 18.21 rr0-beta21
2666 • Patch problems in bsnes core
2668 • SNES is little-endian, not big-endian!
2670 • Fix memory corruption in lcscreen::load()
2672 18.22 rr0-beta22
2674 • Fix interpretting repeat counts in rrdata loading.
2676 • New lua callback: on_frame()
2678 • Remove calls to runtosave() that aren't supposed to be there
2680 • Lua function: movie.read_rtc()
2682 • Ignore src/fonts/font.cpp
2684 • Fix more bsnes core problems
2686 • Control bsnes random seeding
2688 • Pause-on-end
2690 • Some bsnes core debugging features (state dump and state hash)
2692 • Fix titlebar version number (no, the last version wasn't 
2693   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2695 18.23 rr0-beta23
2697 • Fix memory corruption due to macro/field mixup
2699 • search-memory update
2701 • Allow direct-mapped framebuffer
2703 • SDL: Use SDL_ANYFORMAT if possible
2705 • SDMP2SOX: 2s delay modes.
2707 • Wxwidgets: Cleanups
2709 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2711 • Wxwidgets: Save jukebox on exit
2713 • Fix RTC if using load-movie on savestate.
2715 • Fix crash related to full console mode.
2717 18.24 rr0-beta24
2719 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2720   X.
2722 • Wxwidgets: Allow compiling on Mac OS X.
2724 • Use movie compare instead of movie hashing (faster save/load).
2726 • Lua: _SYSTEM table.
2728 18.25 rr0-beta25
2730 • sdmp2sox: Pad soundtrack if using -l or -L.
2732 • sdmp2sox: Fix NTSC overscan.
2734 • sdmp2sox: Add AR correction mode.
2736 • call lua_close() when exiting.
2738 • Fix zip_writer bug causing warnings from info-zip and error 
2739   from advzip.
2741 18.26 rr0-beta26
2743 • Fix IPS patching code (use bsnes core IPS patcher).
2745 • Implement BPS patching (using bsnes core IPS patcher).
2747 • Add feature to load headered ROMs.
2749 18.27 rr0-beta27
2751 • Show command names when showing keybindings
2753 18.28 rr0
2755 • Fix pause-on-end to be actually controllable
2757 • SDL: Poll all events in queue, not just first one (fixes 
2758   slowness in command typing)
2760 • Wxwidgets: Fix ROM loading.
2762 18.29 rr1-beta0
2764 • Lua: Add gui.textH, gui.textV, gui.textHV
2766 • Fix text colors on SDL on Mac OS X
2768 • Mode 'F' for finished in readonly mode.
2770 • Fix some WS errors.
2772 • Reliably pause after skip poll
2774 • Split UI and core into their own threads
2776 18.30 rr1-beta1
2778 • Remove leftover dummy SRAM slot
2780 • Fix controller numbers.
2782 18.31 rr1-beta2
2784 • Fix lsnes-dumpavi after interface change.
2786 • Also give BSNES patches for v085.
2788 • Pack movie data in memory.
2790 18.32 rr1-beta3
2792 • Fix framecount/length given when loading movies.
2794 • Controller command memory leak fixes.
2796 • Don't leak palette if freeing screen object.
2798 18.33 rr1-beta4
2800 • Detect revisions.
2802 • Wxwidgets: Allow controlling dumper from the menu.
2804 18.34 rr1-beta5
2806 • Rewrite parts of manual
2808 • Lua: Make it work with Lua 5.2.
2810 18.35 rr1-beta6
2812 • Win32: Fix compile errors.
2814 18.36 rr1-beta7
2816 • Refactor controller input code.
2818 • Fix crash when using command line on SDL / Mac OS X.
2820 18.37 rr1-beta8
2822 • Delete core/coroutine (obsolete)
2824 • Lag input display by one frame.
2826 • Rewind movie to beginning function.
2828 • Fix wrong frame number reported to Lua when repainting after 
2829   loadstate
2831 • Support UI editing of jukebox
2833 • Wxwidgets: Save settings on exit.
2835 • Support ${project} for filenames
2837 • SDL: Fix command history
2839 18.38 rr1-beta9
2841 • Fix some order-of-global-ctor bugs.
2843 18.39 rr1-beta10
2845 • Fix crashes when quitting on Win32.
2847 18.40 rr1-beta11
2849 • EVDEV: Queue keypresses from joystick, don't send directly
2851 • Wxwidgets: Load-Preserve that actually works.
2853 18.41 rr1-beta12
2855 • Wxwidgets: GUI for memory search.
2857 • Warn about using synchronous queue in UI callback.
2859 18.42 rr1-beta13
2861 • Remember last saved file for each ROM
2863 • Support MT dumping via boost.
2865 • Lua: input.raw
2867 • Lua: input.keyhook
2869 • Make mouse be ordinary input instead of special-casing
2871 • SDL: Don't screw up commands with NUL codepoints.
2873 18.43 rr1-beta14
2875 • Merge status panel and main window
2877 • True movie slot support (the rest of it)
2879 • SDL: Fix compilation error
2881 • Elminate cross calls in dump menu code.
2883 18.44 rr1-beta15
2885 • Cancel pending saves command
2887 • Wxwidgets: Code refactoring
2889 • Wxwidgets: Fix system -> reset
2891 • Wxwidgets: Read watch expressions in the right thread
2893 18.45 rr1-beta16
2895 • Wxwidgets: Don't prompt for member when running Lua script (Lua 
2896   doesn't support that).
2898 • Wxwidgets: 128 -> 1024 Autohold slots (in case more are 
2899   needed).
2901 • Don't append trailing '-' to prefix when saving movie.
2903 • Fix ROM/savestate handling (don't let user mismatch ROM and 
2904   savestates).
2906 18.46 rr1
2908 • Document memory watch syntax.
2910 18.47 rr1-delta1
2912 • Fix unattended dumping (lsnes-dumpavi)
2914 • Support RAW dumping
2916 • Use adv_dumper instead of the old interface in lsnes-dumpavi 
2917   (changes syntax)
2919 • Add option to control sample rate preturbation in AVI dumper
2921 18.48 rr1-delta2
2923 • Wxwidgets: Fix dumper submodes
2925 • Set core controller types before loadstate
2927 18.49 rr1-delta2epsilon1
2929 • Fix compiling with bsnes v086.
2931 18.50 rr1-delta3
2933 • Don't prompt before quitting
2935 • Start unpaused, preserve pause/unpause over load.
2937 • Try to autodetect if ROM is headered.
2939 • Wxwidgets: Only bring up ROM patching screen if specifically 
2940   requested.
2942 • Allow configuring some hotkeys.
2944 18.51 rr1-delta4
2946 • Lots of code cleanups
2948 • Fix JMD compression (JMD dumping was broken)
2950 • Don't crash if Lua C function throws an exception.
2952 • Support bitmap drawing in Lua.
2954 • Fix bsnes v085/v086 patches.
2956 • Improve stability on win32.
2958 18.52 rr1-delta4epsilon1
2960 • Don't corrupt movie if movie length is integer multiple of 
2961   frames per page.
2963 18.53 rr1-delta5
2965 • New Lua hooks: on_rewind, on_frame_emulated, on_idle, on_timer
2967 • New Lua functions: emulator_ready(), utime(), 
2968   set_idle_timeout(), set_timer_timeout(), bit.extract(), 
2969   bit.value(), input.geta(), input.seta() and 
2970   input.controllertype()
2972 • Wxwidgets: Fix internal focus lost (hotkeys stop working)
2974 • Wxwidgets: Fix broken modifiers
2976 • on_paint has parameter now.
2978 • Optional initital fill for bitmaps
2980 • Fix palette changing.
2982 • Optimize rendering a bit.
2984 • Bsnes v087 support.
2986 18.54 rr1-delta5epsilon1
2988 • Movieinfo: Fix display of port #2 type.
2990 • Call on_input() after loadstate.
2992 18.55 rr1-delta5epsilon2
2994 • Fix writing port2 data to movie.
2996 • Fix SRAM handling with Bsnes v087.
2998 18.56 rr1-delta6
3000 • Library loading support
3002 • Built-in TSCC encoder
3004 • Hi-color (256T colors) dumping.
3006 • Dump over TCP/IP(v6)
3008 • Hidable status panel
3010 • Turbo toggle/hold
3012 • Adjustable sound volume
3014 • Screen scaling
3016 • Allow DnD into filename boxes
3018 • Configurable paths
3020 • Portaudio: Fix speaker popping at start
3022 • Lots of UI changes
3024 • Speed adjustment menu
3026 • Win32 joystick support
3028 • Lua: gui.rainbow and gui.box
3030 • Split key lists into classes (the key list was large!)
3032 • More save slots support
3034 • Wxwidgets (wxJoystick) joystick support
3036 18.57 rr1-delta7
3038 • Lots of internal joystick refactoring
3040 • Evdev: Add mapping for BTN_TOOL_QUINTTAP
3042 • Wxwidgets: Settings mode (open settings without ROM)
3044 • Wxwidgets: Prompt key to use option
3046 • Wxwidgets: Fix crash if key goes away underneath
3048 • Wxwidgets: Fix mouse position in presence of scaling
3050 • AVI dumper: Mode 4 (high-quality resampling to common rate 
3051   using SRC)
3053 • Wxwidgets: Redesign hotkeys dialog to avoid tree control (tree 
3054   control doesn't seem to work well on WinXP)
3056 • Start paused option.
3058 18.58 rr1-delta7epsilon1
3060 • AVI: ZMBV support
3062 • lsnes-dumpavi: Start Lua before starting dumper
3064 • AVI: Fix secondary audio in mode 4.
3066 18.59 rr1-delta7epsilon2
3068 • AVI: Refactor ZMBV a bit.
3070 • Fix error reading analog values from movie file
3072 18.60 rr1-delta8
3074 • Delayed reset support
3076 • Lua: memory.hash_region
3078 18.61 rr1-delta8epsilon1
3080 • Rework the build system
3082 • Typing input support
3084 • Fix building with bsnes v086 and v087.
3086 • SDL: Save settings on exit
3088 • SDL: Command to enter command line mode with given command.
3090 • SDL: More advanced command editing.
3092 18.62 rr1-delta9
3094 • wxMSW: Fix the “arrow keys and enter don't work” problem
3096 • MSU-1 support
3098 • Show mode changes due to rewinding.
3100 • Unsafe rewind support
3102 • Fix directory transversal.
3104 18.63 rr1-delta10
3106 • AVI: Sound mode 5 (48kHz high-quality)
3108 • Lua: Reset Lua VM
3110 • Map the SNES bus into address space
3112 • Fix loading memory watch files with CRLF line endings
3114 18.64 rr1-delta10epsilon1
3116 • Map bsnes internal state into memory space
3118 • Fix the “click on panel wedges the emulator” for real.
3120 • DnD movies/saves on the main window.
3122 18.65 rr1-delta11
3124 • Split core bindings into own module.
3126 • Remember invalid settings
3128 • Support for modified Gambatte core for GB/GBC emulation.
3130 • Reload/swap ROM function
3132 18.66 rr1-delta11epsilon1
3134 • Fix step poll function
3136 18.67 rr1-delta12
3138 • Non-insane savestate anchoring
3140 18.68 rr1-delta13
3142 • More Memory search methods
3144 • Preserve movie if loading in RO mode.
3146 • Fix a obscure case in timeline check
3148 • Revamp the entiere ROM loading code
3150 • Support DnD on ROMs
3152 • Revamp menu layout
3154 • Standalone hotkey config dialog
3156 • Show bindings in more user-friendly format
3158 18.69 rr1-delta13epsilon1
3160 • Pipedec support
3162 • Fix uninitialized variables in bsnes v085
3164 18.70 rr1-delta14
3166 • Merge gambatte core into mainline (from its own branch)
3168 • Wxwidgets: Show expected dump file formats
3170 • Memory watch: Data typing
3172 • lsnes internal MMIO area.
3174 • Wxwidgets: New memory watch editor
3176 • Hexadecimal memory watches
3178 • Wxwidgets: Monospaced panel
3180 • Wxwidgets: Split memory watches in panel
3182 • Wxwidgets: Disable VMAs in memory search
3184 • lsnes-dumpavi: Fix speed bug
3186 • Movie subtitle support
3188 • Fix rerecord count reporting
3190 • Don't trash movie when loading in readonly mode.
3192 18.71 rr1-delta14epsilon1
3194 • Wxwidgets: Fix crashes on closing settings dialogs on Mac OS X.
3196 • Fix build on Mac OS X.
3198 • Lua: loopwrapper
3200 • Wxwidgets: Hidable messages window
3202 • Lua: input.joyset
3204 • Bsnes: Support inconsistent saves
3206 • Bsnes: Allow simulating saving every frame
3208 • Fix desync if savestate is loaded in readonly mode in certain 
3209   conditions.
3211 • Wxwidgets: Fix save dialogs on Mac OS X.
3213 • Wxwidgets: Fix insane status width on Win32.
3215 • Wxwidgets: Fix autohold processing to be faster.
3217 • Wxwidgets: Allow loading ROMs and movies from commandline.
3219 18.72 rr1-delta15
3221 • Be a bit smarter with --load
3223 • Rewrote higher-level parts of audio system
3225 • Tool to build commentary tracks
3227 • Lua: input.joyget
3229 • Gambatte: Add support for SVN358
3231 • Use builtin font when rendering status panel.
3233 • Option to detach memory watch to its own window.
3235 • Recent ROMs/Movies menu
3237 • Libao support
3239 • Useful lag counter for SNES games that autopoll
3241 • Fix buffer overflow in gambatte sound output
3243 18.73 rr1-delta15epsilon1
3245 • Don't blow up on wxGTK if the window is hidden somehow
3247 • Support simultaneous drop of ROM and movie.
3249 • Gambatte: Don't save spurious SRAMs.
3251 • Make SGB ROMs actually usable.
3253 • Fix so that saved movies appear in recent movies.
3255 • Don't open multiple commentary editors at once.
3257 18.74 rr1-delta15epsilon2
3259 • Lua: memory.readregion/memory.writeregion
3261 • Lua: memory.map{,s}{byte,word,dword,qword}
3263 • Lua: memory.map_structure
3265 • Lua: Fix bus_address for gambatte
3267 • Fix features dependent of bsnes debugger
3269 • Cleanup bsnes debugger logic
3271 • Fix resets in presence of save every frame
3273 18.75 rr1-delta15epsilon3
3275 • Lua: input.lcid_to_pcid
3277 • Fix off-by-one bug with slot hashes
3279 • Fix crashes on certain memory watch expressions
3281 • Lua: memory.read_expr
3283 • Lua: Fix memory.read_expr on nil argument
3285 • Fix the code to compile on G++ 4.7
3287 • Change button_id to be a function pointer field, not a virtual 
3288   method
3290 • Add bsnes patches to fix libsnes to compile on GCC 4.7
3292 • Gambatte: Always use legacy lag counting
3294 • Memory commands: Memory addresses are up to 16 hex digits, not 
3295   up to 8
3297 • Fix analog controllers
3299 • Fix autohold menus
3301 • Fix button symbols in input display
3303 • Compensate for nuts bsnes superscope/justifier handling
3305 • Lua: Fix bit.extract boolean handling
3307 18.76 rr2-beta0
3309 • Split emulation cores more from the rest
3311 • Support having multiple emulation cores compiled at once
3313 • Support arbitrary number of ports (well, up to 31 anyway).
3315 • SNES debugger support
3317 • Support 16-button controllers
3319 • Remove old SDL front end
3321 • Data-driven controller buttons
3323 • Generate the port code from defines
3325 18.77 rr2-beta1
3327 • Update libgambatte to SVN364
3329 • Get rid of partial linking (building with MXE works)
3331 • Load XML even without gamepack files
3333 • Support screen rotate & flip
3335 • Fix bug when changing controller key to another subkey of the 
3336   same key
3338 18.78 rr1-delta16
3340 • Stop at movie end: Don't off-by-one
3342 • Fix crash closing lsnes with voice playback active.
3344 • Import/Export OggOpus for commentary tracks
3346 • 16-button controllers.
3348 • Don't show nonexistent controllers in input display
3350 • Set voice record/playback volume from UI
3352 • Patches for gambatte SVN364.
3354 • Load markup (if exists) even without gamepack file.
3356 • Screen rotation & flipping
3358 • Lua: Some new bit functions
3360 • Auto-refresh voice streams on change.
3362 • Auto-refresh subtitles on change & new subtitle editor.
3364 • Fix music volume adjustment.
3366 18.79 rr2-beta2
3368 • Use system threads instead of platform threads
3370 • Cleanup build by allowing dummy and real drivers to link 
3371   together.
3373 • Split duplex support
3375 18.80 rr1-delta16epsilon1
3377 • Wxwidgets: Fix memory watch rendering.
3379 • Wxwidgets: Allow setting voice stream gain.
3381 • Wxwidgets: VU meters and volume adjustment.
3383 • Lua: Custom fonts support.
3385 • Lua: Fix methods stopping working when resetting Lua.
3387 • Fix loading standard-format movies in preserve (readonly) mode.
3389 18.81 rr1-delta17
3391 • Primitive movie editor
3393 • Fix VU meter with no sound device.
3395 • Fix various undefined return values.
3397 • Show rates in VU meter window.
3399 18.82 rr2-beta3
3401 • Lua: Render queues as objects
3403 • Bsnes: support hard resets
3405 • Dedicated sound devices dialog
3407 • Change the default AVI sound mode to 2 or 5.
3409 • Fix totally borked movie saving.
3411 • Portaudio: Use split duplex with different devices.
3413 • Fix controls with gambatte core.
3415 • Modify save slot set handling.
3417 • lsnes-dumpavi: --firmware-path.
3419 • Fix lots of compiler warnings.
3421 18.83 rr1-delta17epsilon1
3423 • Commentary tool: Set nominal bit rate and limit max bit rate.
3425 • Lua: Unconditionally reload host memory on loadstate
3427 • Lua: Query bindings, manipulate aliases, create inverse 
3428   bindings
3430 • Lua: Fix crashes with resetting VM while some types of paint 
3431   requests are in flight.
3433 • Lua: gui.text: Clip the text properly instead of corrupting 
3434   memory in some cases.
3436 • Save screenshot header reliably
3438 • Lua: Backport input.get2 and input.set2
3440 • Lua: New controller info functions.
3442 • Movie editor: Fix reset delay counters to be the right way 
3443   around.
3445 • Lua: on_snoop2
3447 • Lua: on_button and input.veto_button.
3449 18.84 rr2-beta4
3451 • Revert memory leak fix breaking input
3453 • Refactor Opus handling
3455 • Restrict member picking only to .zip files
3457 • Fix reading of host-endian VMAs.
3459 • Fix rlow and rhigh to be the right way around.
3461 • Lua: Don't wedge VM if callback fails with an exception
3463 • Refactor Ogg handling.