Make mouse be ordinary keys instead of being special
[lsnes.git] / manual.txt
blobc28b1b231edcc7ef8fe3fdbfed80b7d897aabba5
1 1 Introduction
3 lsnes is SNES rerecording emulator based on bsnes core.
5 2 Dependencies
7 1. bsnes libsnes
9   (a) v084 or 085
11   (b) accuracy or compatiblity core.
13   (c) Patched version (using included 6 patches)
15 2. Zlib
17 3. boost_iostreams
19 4. boost_filesystem
21 5. boost_thread
23 6. libsdl (SDL only)
25 7. sdlmain (SDL only, part of SDL)
27 8. boost_conversion (this is header-only library)
29 9. libswscale (wxwidgets graphics only)
31 10. Portaudio (portaudio sound only)
33 11. std::thread and co (for threaded dumper only, not needed if 
34   std::thread is available)
36 12. Lua (if Lua support is needed).
38 • Version 5.1.X or 5.2X.
40 3 Building
42 Building is via makefile, the following options are available:
44 • CROSS_PREFIX=<prefix>
46   – Prefix to apply to commands when building executables / 
47     object files for the target architecture. 
49   – Default is blank.
51 • CC=<name>
53   – Name of C++ compiler.
55   – CROSS_PREFIX is prepended if compiling for target 
56     architecture.
58   – This needs to be at least GCC 4.6.
60   – Set to 'g++-mp-4.6' if compiling on Mac OS X using GCC 4.6 
61     from Macports.
63   – Default is 'g++'.
65 • HOSTCC=<name>
67   – Name of host C++ compiler.
69   – Default is value of 'CC' option.
71 • USER_HOSTCCFLAGS=<flags>:
73   – Compiler flags to pass when compiling/linking for host 
74     architecture.
76   – Default is blank.
78 • USER_CFLAGS=<flags>
80   – Extra flags to pass when compiling for target architecture
82   – Default is blank.
84 • USER_LDFLAGS=<flags>: 
86   – Extra flags to pass when linking for target architecture.
88   – Default is blank.
90 • USER_PLATFORM_CFLAGS=<flags>
92   – Extra flags to pass when compiling files using 
93     platform-dependent code for target architecture.
95   – Default is blank.
97 • USER_PLATFORM_LDFLAGS=<flags>
99   – Extra flags to pass when linking files using 
100     platform-dependent code for target architecture.
102   – Default is blank.
104 • FONT_SRC=<file>
106   – Set the font file to use.
108   – Currently the valid values are:
110     ∗ cp437.hex: Standard VGA font (256 characters).
112     ∗ unifontfull-5.1.20080820.hex: GNU unifont (covers most of 
113       Unicode BMP)
115   – Default is 'unifontfull-5.1.20080820.hex'
117 • LUA=<package>
119   – Package to use for Lua support.
121   – Usually valid value is 'lua' or 'lua5.1'.
123   – Default is not to build Lua support.
125 • THREADS=<value>
127   – Override platform default for dumper threading support.
129   – Threading is default on Linux.
131   – 'YES' tries to use threading (std::thread).
133   – 'BOOST' tries to use threading (boost::thread).
135   – 'NO' disables threading.
137   – Note: This has absolutely nothing to do with platform 
138     threading.
140 • BSNES_IS_COMPAT=<anything>
142   – Signals that BSNES core used is compatiblity core, not 
143     accuracy core.
145   – Default is to assume accuracy core.
147 • JOYSTICK=<implementation>
149   – Set joystick implementation. Valid values are:
151     ∗ SDL: Use SDL for joystick (requires SDL graphics)
153     ∗ EVDEV: Use EVDEV for joystick (Linux only).
155     ∗ DUMMY: Disable joystick support.
157   – Default is SDL.
159 • SOUND=<implementation>
161   – Set sound implementation. Valid values are:
163     ∗ SDL: Use SDL for sound (requires SDL graphics)
165     ∗ PORTAUDIO: Use Portaudio for sound.
167     ∗ DUMMY: Disable sound support
169   – Default is SDL.
171 • GRAPHICS=<implementation>
173   – Set windowing library to use. Valid values are:
175     ∗ SDL: Use SDL for graphics
177     ∗ WXWIDGETS: Use wxWidgets for graphics.
179   – Default is SDL.
181 4 Command line options
183 4.1 ROM options
185 <kind> in the following can be one of:
187 • rom: Cartridge ROM (BIOS for special carts). This is required.
189 • bsx: BS-X (non-slotted) Game flash ROM.
191 • bsxslotted: BS-X (slotted) Game flash ROM.
193 • dmg: DMG game ROM
195 • slot-a: Sufami Turbo Slot A ROM
197 • slot-b: Sufami Turbo Slot B ROM
199 4.1.1 --<kind>=<file> (lsnes/SDL, lsnes-avidump)
201 Load <file> as specified ROM (SFC/BS/DMG/ST file format).
203 4.1.2 --headered-<kind>=<file> (lsnes/SDL, lsnes-avidump)
205 Load <file> as specified ROM, stripping first 512 bytes. Handy 
206 for loading SMC / FIG and such files.
208 4.1.3 --<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
210 Override hardware detection for ROM, reading the values from 
211 <file> (BSNES XML format).
213 4.1.4 --ips-<kind>=<file> (lsnes/SDL, lsnes-avidump)
215 Apply BPS/IPS patch <file> to ROM <kind>. If specified multiple 
216 times, the patches are applied in order.
218 4.1.5 --ips-<kind>-xml=<file> (lsnes/SDL, lsnes-avidump)
220 Apply BPS/IPS patch <file> to XML of ROM <kind>. If specified 
221 multiple times, the patches are applied in order.
223 4.1.6 --ips-offset=<offset> (lsnes/SDL, lsnes-avidump)
225 Set offset to apply to IPS patches. May be negative. Handy for 
226 applying headered IPS patches (use offset of -512 for this). The 
227 offset must be 0 for BPS patches.
229 4.1.7 --pal
231 Force ROM to be considered PAL-only.
233 • Only works on SNES and SGB ROMs (not BS-X or Sufami Turbo).
235 • Attempting to load NTSC movie file will error out.
237 4.1.8 --ntsc
239 Force ROM to be considered NTSC-only.
241 • Attempting to load PAL movie file will error out.
243 4.2 Session options
245 4.2.1 <filename> (lsnes/SDL, lsnes-avidump, movieinfo)
247 Load <filename> as movie or savestate file. All other session 
248 options are ignored.
250 4.2.2 --port1=<device> (lsnes/SDL)
252 Set type of port1. Valid values are:
254 • none: No device connected
256 • gamepad: One gamepad (the default)
258 • multitap: Four gamepads (warning: makes most games refuse to 
259   start)
261 • mouse: Mouse.
263 4.2.3 --port2=<type> (lsnes/SDL)
265 Set type of port2. Valid values are:
267 • none: No device connected (the default)
269 • gamepad: One gamepad
271 • multitap: Four gamepads.
273 • mouse: Mouse
275 • superscope: Super Scope
277 • justifier: One justifier
279 • justifiers: Two justifiers
281 4.2.4 --gamename=<name> (lsnes/SDL)
283 Set the name of game to <name>. Default is blank.
285 4.2.5 --author=<name> (lsnes/SDL)
287 Add author with full name of <name> (no nickname).
289 4.2.6 --author=|<name> (lsnes/SDL)
291 Add author with nickname of <name> (no full name).
293 4.2.7 --author=<fullname>|<nickname> (lsnes/SDL)
295 Add author with full name of <fullname> and nickname of 
296 <nickname>.
298 4.2.8 --rtc-second=<value> (lsnes/SDL)
300 Set RTC second (0 is 1st January 1970 00:00:00Z). Default is 
301 1,000,000,000.
303 4.2.9 --rtc-subsecond=<value> (lsnes/SDL)
305 Set RTC subsecond. Range is 0-. Unit is CPU cycle. Default is 0.
307 4.3 Misc. options:
309 4.3.1 --run=<file> (lsnes/SDL)
311 After running main RC file, run this file. If multiple are 
312 specified, these execute in order specified.
314 4.4 dump options (lsnes-dumpavi only)
316 4.4.1 --prefix=<prefix>
318 Set dump prefix. Default is “avidump”.
320 4.4.2 --level=<level>
322 Set compression level (0-18). Default is 7.
324 4.4.3 --length=<length>
326 Set number of frames to dump. Mandatory.
328 4.4.4 --lua=<script>
330 Run specified lua script (lsnes-dumpavi does not have 
331 initialization files).
333 4.4.5 --jmd
335 Use JMD dumping instead of AVI dumping.
337 4.4.6 --sdmp
339 Use SDMP dumping instead of AVI dumping.
341 4.4.7 --ss
343 Dump in single segment (SDMP only).
345 5 Startup file lsnes.rc
347 Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as 
348 commands. This file is located in:
350 • Windows: %APPDATA%\lsnes\lsnes.rc (if %APPDATA% exists)
352 • Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME 
353   exists)
355 • Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
357 • All: ./lsnes.rc (fallback default).
359 If leading directories do not exist, attempt to create them is 
360 made.
362 6 Internal commands
364 • Commands beginning with '*' invoke the corresponding command 
365   without alias expansion.
367 • If command starts with '+' (after possible '*'), the command is 
368   executed as-is when button is pressed, and when button is 
369   released, it is executed with '+' replaced by '-'.
371 • Commands without '+' execute only on negative edge (release).
373 6.1 Settings:
375 Settings control various aspects of emulator behaviour.
377 6.1.1 set-setting <setting> <value>
379 Sets setting <setting> to value <value> (may be empty).
381 6.1.2 unset-setting <setting>
383 Try to unset setting <setting> (not all settings can be unset).
385 6.1.3 get-setting <setting>
387 Read value of setting <setting>
389 6.1.4 show-settings
391 Print names and values of all settings.
393 6.2 Keybindings
395 Keybindings bind commands or aliases to keys (or pseudo-keys). 
397 Notes:
399 • Do not bind edge active (+/-) commands to keys with modifiers, 
400   that won't work right!
402 • Names of keys and modifiers are platform-dependent.
404 • Be careful before binding pseudo-keys (such as joystick axes, 
405   buttons or hats) with modifiers. That may or may not work 
406   right.
408 6.2.1 bind-key [<mod>/<modmask>] <key> <command>
410 Bind <command> to key <key> (activating if modifiers in <modmask> 
411 (comma-seperated list) are set as <mod> (comma-seperated list).
413 The names of keys and modifiers are platform-dependent.
415 6.2.2 unbind-key [<mod>/<modmask>] <key>
417 Unbind command from <key> (with specified <mod> and <modmask>).
419 6.2.3 set-axis <axis> [disabled | axis | axis-inverse | 
420   pressure0- | pressure0+ | pressure-0 | pressure-+ | pressure+0 
421   | pressure+-] [minus=<val>] [zero=<val>] [plus=<val>] 
422   [tolerance=<val>]
424 Set axis parameters for axis <axis>.
426 • disabled: Disable axis
428 • axis: Normal axis
430 • axis-inverse: Inverse axis
432 • pressure0-: Pressure sensitive. Released at 0, pressed at -.
434 • pressure0+: Pressure sensitive. Released at 0, pressed at +.
436 • pressure-0: Pressure sensitive. Released at -, pressed at 0.
438 • pressure-+: Pressure sensitive. Released at -, pressed at +.
440 • pressure+0: Pressure sensitive. Released at +, pressed at 0.
442 • pressure+-: Pressure sensitive. Released at +, pressed at -.
444 • minus=<val>: Calibration at extreme minus position 
445   (-32768-32767)
447 • zero=<val>: Calibration at neutral position (-32768-32767)
449 • plus=<val>: Calibration at extreme plus position (-32768-32767)
451 • tolerance=<value>: Center band tolerance (0<x<1). The smaller 
452   the value, the more sensitive the control is.
454 6.2.4 show-bindings
456 Print all key bindings in effect.
458 6.3 Aliases
460 Aliases bind command to sequence of commands. After alias has 
461 been defined, it replaces the command it shadows.
463 Notes:
465 • You can't alias command to itself.
467 • Aliases starting with +/- are edge active just like ordinary 
468   commands starting with +/-.
470 • One command can be aliased to multiple commands.
472 6.3.1 alias-command <command> <expansion>
474 Append <expansion> to alias <command>. If alias does not already 
475 exist, it is created.
477 6.3.2 unalias-command <command>
479 Clear alias expansion for <command>.
481 6.3.3 show-aliases
483 Print all aliases and their expansions in effect.
485 6.4 run-script <script>
487 Run <script> as if commands were entered on the command line.
489 6.5 Video dumping
491 Following commands control video dumping:
493 6.5.1 dump-avi <prefix>
495 Dump AVI video to prefix <prefix> Notes:
497 • The codec is Camstudio Codec in gzip mode.
499 • Encoder and muxer are internal, available on all platforms.
501 • Audio enable/disable and framerate has no effect.
503 • The audio dumped to .avi is low-quality version. The 
504   high-quality version is dumped to .sox file.
506 6.5.2 end-avi
508 End current AVI video dump (closing the emulator also closes the 
509 dump).
511 6.5.3 dump-jmd <file>
513 Dump JMD video to file <file>.
515 6.5.4 end-jmd
517 End the current JMD dump in progress.
519 6.5.5 dump-sdmp <prefix>
521 Dump SDMP to <prefix>, splitting at 2GB.
523 6.5.6 dump-sdmp-ss <file>
525 Dump SDMP to <file>, no splitting
527 6.5.7 end-sdmp
529 End the current SDMP dump in progress.
531 6.6 Memory manipulation
533 <address> may be decimal or hexadecimal (prefixed with '0x'). 
534 <value> can be hexadecimal (prefixed with '0x'), unsigned or 
535 signed (prefixed with '-') decimal.
537 The available element <sizes> are:
539 • byte: 1 byte
541 • word: 2 bytes
543 • dword: 4 bytes
545 • qword: 8 bytes
547 When reading RAM and ROM, multi-byte reads/writes are big-endian. 
548 When dealing with DSP memory, multi-byte reads/writes are 
549 native-endian (do not use operand sizes exceeding DSP bitness, 
550 except dword is OK for 24-bit memory).
552 6.6.1 read-<size> <address>
554 Read the value of byte in <address>.
556 6.6.2 read-s<size> <address>
558 Read the value of signed byte in <address>.
560 6.6.3 write-<size> <address> <value>
562 Write <value> to byte in address <address>.
564 6.6.4 search-memory reset
566 Reset the memory search
568 6.6.5 search-memory count
570 Print number of candidates remaining
572 6.6.6 search-memory print
574 Print all candidates remaining
576 6.6.7 search-memory <usflag><sizeflag><op>
578 Searches memory for addresses satisfying criteria.
580 <usflag> can be:
582 • u: unsigned
584 • s: signed
586 <sizeflag> can be:
588 • b: byte
590 • w: word
592 • d: dword
594 • q: qword
596 <op> can be:
598 • lt: < previous value.
600 • le: <= previous value.
602 • eq: = previous value.
604 • ne: != previous value.
606 • ge: >= previous value.
608 • gt: > previous value.
610 6.6.8 search-memory <sizeflag> <value>
612 Searches for addresses that currently have value <value>. 
613 <sizeflag> is as in previous command.
615 6.7 Main commands
617 These commands are not available in lsnesrc, but are available 
618 after ROM has been loaded.
620 6.7.1 quit-emulator [/y]
622 Quits the emulator (asking for confirmation). If /y is given, no 
623 confirmation is asked.
625 6.7.2 pause-emulator
627 Toggle paused/unpaused
629 6.7.3 +advance-frame 
631 Advance frame. If the button is still held after configurable 
632 timeout expires, game unpauses for the duration frame advance is 
633 held.
635 6.7.4 +advance-poll 
637 Advance subframe. If the button is still held after configurable 
638 timeout expires, game unpauses for the duration frame advance is 
639 held.
641 6.7.5 advance-skiplag 
643 Skip to first poll in frame after current.
645 6.7.6 reset 
647 Reset the SNES after this frame.
649 6.7.7 load <filename> 
651 Load savestate <filename> in current mode.
653 6.7.8 load-state <filename> 
655 Load savestate <filename> in readwrite mode.
657 6.7.9 load-readonly <filename> 
659 Load savestate <filename> in readonly mode.
661 6.7.10 load-preserve <filename> 
663 Load savestate <filename> in readonly mode, preserving current 
664 events.
666 6.7.11 load-movie <filename> 
668 Load savestate <filename>, ignoring save part in readonly mode.
670 6.7.12 save-state <filename> 
672 Save system state to <filename> as soon as possible.
674 6.7.13 save-movie <filename> 
676 Save movie to <filename>.
678 6.7.14 set-rwmode 
680 Set read-write mode.
682 6.7.15 set-romode 
684 Set read-only mode
686 6.7.16 toggle-rwmode 
688 Toggle between read-only and read-write modes.
690 6.7.17 set-gamename <name> 
692 Set name of the game to <name>
694 6.7.18 get-gamename 
696 Print the name of the game.
698 6.7.19 add-author <author> 
700 Adds new author <author>. If <author> does not contain '|' it is 
701 full name. If it contains '|', '|' splits the full name and 
702 nickname.
704 6.7.20 edit-author <num> <author> 
706 Edit the author in slot <num> (0-based) to be <author> (see 
707 add-author for format)
709 6.7.21 remove-author <num> 
711 Remove author in slot <num>
713 6.7.22 print-authors 
715 Print authors.
717 6.7.23 test-1, test-2, test-3
719 Internal test commands. Don't use.
721 6.7.24 take-screenshot <filename> 
723 Save screenshot to <filename>.
725 6.7.25 +controller<num><button>
727 Press button <button> on controller <num> (1-8). The following 
728 button names are known:
730 • left
732 • right
734 • up
736 • down
738 • A
740 • B
742 • X
744 • Y
746 • L
748 • R
750 • select
752 • start
754 • trigger
756 • cursor
758 • pause
760 • turbo
762 6.7.26 controllerh<num><button>
764 Hold/unhold button <button> on controller <num> (1-8). See 
765 +controller for button names.
767 6.7.27 autofire (<pattern>|-)...
769 Set autofire pattern. Each parameter is comma-separated list of 
770 button names (in form of 1start, 1A, 2B, etc..) to hold on that 
771 frame. After reaching the end of pattern, the pattern restarts 
772 from the beginning.
774 6.7.28 repaint
776 Force a repaint.
778 6.8 Save jukebox 
780 6.8.1 cycle-jukebox-backward
782 Cycle save jukebox backwards.
784 6.8.2 cycle-jukebox-forward
786 Cycle save jukebox forwards
788 6.8.3 add-jukebox-save <filename>
790 Add <filename> to jukebox saves.
792 6.8.4 load-jukebox
794 Do load from jukebox (current mode).
796 6.8.5 save-jukebox
798 Do state save to jukebox.
800 6.9 Lua 
802 Only available if lua support is compiled in.
804 6.9.1 evaluate-lua <luacode>
806 Run Lua code <luacode> using built-in Lua interpretter.
808 6.9.2 run-lua <script>
810 Run specified lua file using built-in Lua interpretter.
812 6.10 Memory watch
814 6.10.1 add-watch <name> <expression>
816 Adds new watch (or modifies old one).
818 6.10.2 remove-watch <name>
820 Remove a watch.
822 6.11 Sound 
824 6.11.1 enable-sound <on/off> 
826 Enable/Disable sound.
828 6.11.2 set-sound-device <device> 
830 Set sound device to <device>
832 6.11.3 show-sound-status 
834 Show status of sound system.
836 6.11.4 show-sound-devices
838 Show all available devices.
840 6.12 SDL Platform commands 
842 The following are valid on SDL platform.
844 6.12.1 identify-key
846 Asks to press a key and then identifies that (pseudo-)key.
848 6.12.2 toggle-console 
850 Toggle between windowed/fullscreen console.
852 6.12.3 scroll-fullup 
854 Scroll messages window as far back as it goes.
856 6.12.4 scroll-fulldown 
858 Scroll messages window as far forward as it goes.
860 6.12.5 scroll-up 
862 Scroll messages window back one screenful.
864 6.12.6 scroll-down 
866 Scroll messages window forward one screenful.
868 7 Settings
870 7.1 Core settings
872 7.1.1 firmwarepath
874 Set where bsnes looks for firmware files. Default is “.”.
876 7.1.2 targetfps
878 Set the target fps. Numeric, range is 0.001 to “infinite”. 
879 Default is native framerate.
881 7.1.3 savecompression
883 Set save compression level (integer 0-9). Default is 7 (0 is no 
884 compression).
886 7.1.4 advance-timeout
888 Set the frame advance timeout in milliseconds. Numeric integer, 
889 range is 0-999999999. Default is 500.
891 7.2 AVI dumper settings
893 7.2.1 avi-large
895 AVI dumper: Always dump at 512x448 or 512x478 regardless of what 
896 the console outputs.
898 7.2.2 avi-left-border
900 AVI dumper: Set the default left border thickness (unless lua 
901 overrides) for dumps. Range 0-8191. Default is 0.
903 7.2.3 avi-right-border
905 AVI dumper: Set the default right border thickness (unless lua 
906 overrides) for dumps. Range 0-8191. Default is 0.
908 7.2.4 avi-top-border
910 AVI dumper: Set the default top border thickness (unless lua 
911 overrides) for dumps. Range 0-8191. Default is 0.
913 7.2.5 avi-bottom-border
915 AVI dumper: Set the default bottom border thickness (unless lua 
916 overrides) for dumps. Range 0-8191. Default is 0.
918 7.2.6 avi-maxframes
920 AVI dumper: Maximum number of frames per dump segment (0 => 
921 unlimited). Range 0-999999999. Default is 0.
923 7.2.7 avi-compresison
925 AVI dumper: Compression level (0-18).
927 • Compression levels 10 and above are not compatible with stock 
928   CSCD codec.
930 • Recomended level is 7.
932 7.3 JMD options
934 7.3.1 jmd-copression
936 JMD dumper: Compression level (0-9).
938 7.4 SDL platform settings
940 7.4.1 autorepeat-first-delay
942 Sets the delay for first character in typematic autorepeat.
944 7.4.2 autorepeat-subsequent-delay
946 Sets the delay for subsequent characters in typematic autorepeat.
948 8 Lua functions
950 8.1 Core (in main table)
952 8.1.1 print
954 Print line to message console.
956 8.1.2 exec(string command)
958 Run command as it was entered on the command line
960 8.2 Table bit:
962 Bitwise logical functions and related.
964 8.2.1 bit.none(number...) / bit.bnot(number...)
966 48-bit bitwise NOT / NONE function (set bits that are set in none 
967 of the arguments).
969 8.2.2 bit.any(number...) / bit.bor(number...)
971 48-bit bitwise OR / ANY function (set bits that are set in any of 
972 the arguments).
974 8.2.3 bit.all(number...) / bit.band(number...)
976 48-bit bitwise AND / ALL function (set bits that are set in all 
977 of the arguments).
979 8.2.4 bit.parity(number...) / bit.bxor(number...)
981 48-bit bitwise XOR / PARITY function (set bits that are set in 
982 odd number of the arguments).
984 8.2.5 bit.lrotate(number base[, number amount[, number bits]])
986 Rotate bits-bit (max 48, default 48) number left by amount 
987 (default 1) places.
989 8.2.6 bit.rrotate(number base[, number amount[, number bits]])
991 Rotate bits-bit (max 48, default 48) number right by amount 
992 (default 1) places.
994 8.2.7 bit.lshift(number base[, number amount[, number bits]])
996 Shift bits-bit (max 48, default 48) number left by amount 
997 (default 1) places. The new bits are filled with zeroes.
999 8.2.8 bit.lrshift(number base[, number amount[, number bits]])
1001 Shift bits-bit (max 48, default 48) number logically right by 
1002 amount (default 1) places. The new bits are filled with zeroes.
1004 8.2.9 bit.arshift(number base[, number amount[, number bits]])
1006 Shift bits-bit (max 48, default 48) number arithmetically right 
1007 by amount (default 1) places. The new bits are shifted in with 
1008 copy of the high bit.
1010 8.3 Table gui:
1012 Most of these functions can only be called in on_paint and 
1013 on_video callbacks. Exceptions are noted.
1015 Colors are 32-bit. Bits 0-7 are the blue component, bits 8-15 are 
1016 the green component, bits 16-23 are the red component, bits 24-31 
1017 are alpha component (0 is fully opaque, 255 is almost 
1018 transparent). -1 is the fully transparent color. Alpha values 
1019 greater than 127 do work.
1021 Origin of coordinates is at top left corner of game display area. 
1022 Left and top gaps correspond to negative coordinates.
1024 8.3.1 gui.resolution()
1026 Returns 2-tuple (hresolution, vresolution).
1028 8.3.2 gui.<class>_gap(number gap)
1030 Set the <class> (left, right, top, bottom) gap to specified value 
1031 (max gap is 8191).
1033 8.3.3 gui.text(number x, number y, string text[, number fgc[, 
1034   number bgc]])
1036 Draw specified text on the GUI (each character cell is 8 or 16 
1037 wide and 16 high). Parameters:
1039 • x: X-coordinate to start the drawing from (and x-coordinate at 
1040   begining of the lines).
1042 • y: Y-coordinate to start the drawing from.
1044 • text: The text to draw.
1046 • fgc: Text color (default is 0xFFFFFF (white))
1048 • bgc: Background color (default is -1 (transparent))
1050 8.3.4 gui.textH(number x, number y, string text[, number fgc[, 
1051   number bgc]])
1053 Like gui.text, but draw using double-width.
1055 8.3.5 gui.textV(number x, number y, string text[, number fgc[, 
1056   number bgc]])
1058 Like gui.text, but draw using double-height.
1060 8.3.6 gui.textHV(number x, number y, string text[, number fgc[, 
1061   number bgc]])
1063 Like gui.text, but draw using double-width/double-height.
1065 8.3.7 gui.rectangle(number x, number y, number width, number 
1066   height[, number thickness[, number outline[, number fill]]])
1068 Draw rectangle on the GUI. Parameters:
1070 • x: X-coordinate of left edge.
1072 • y: Y-coordinate of upper edge.
1074 • width: Width of rectangle.
1076 • height: Height of rectangle.
1078 • thickness: Thickness of outline (default is 1).
1080 • outline: Color of outline (default is 0xFFFFFF (white))
1082 • fill: Color of fil (default is -1 (transparent))
1084 8.3.8 gui.pixel(number x, number y[, number color])
1086 Draw one pixel on the GUI. Parameters:
1088 • x: X-coordinate of the pixel
1090 • y: Y-coordinate of the pixel
1092 • color: Color of the pixel (default is 0xFFFFFF (white))
1094 8.3.9 gui.crosshair(number x, number y[, number length[, number 
1095   color]])
1097 Draw a crosshair. Parameters:
1099 • x: X-coordinate of the crosshair
1101 • y: Y-coordinate of the crosshair
1103 • length: Length of the crosshair lines (default 10).
1105 • color: Color of the crosshair (default is 0xFFFFFF (white))
1107 8.3.10 gui.line(number x1, number y1, number x2, number y2[, 
1108   number color])
1110 Draw a thin line. Parameters:
1112 • x1: X-coordinate of one end.
1114 • y1: Y-coordinate of one end.
1116 • x2: X-coordinate of the other end.
1118 • y2: Y-coordinate of the other end.
1120 • color: Color of the line (default is 0xFFFFFF (white)).
1122 8.3.11 gui.circle(number x, number y, number r[, number thick[, 
1123   number border[, number fil]]])
1125 Draw a circle. Parameters.
1127 • x: X-coordinate of the center
1129 • y: Y-coordinate of the center
1131 • r: The radius of the circle
1133 • thick: Border thickness
1135 • border: Border color (default is 0xFFFFFF (white))
1137 • fill: Fill color (default is -1 (transparent)).
1139 8.3.12 gui.repaint()
1141 Request on_repaint() to happen as soon as possible. Can be used 
1142 anywhere.
1144 8.3.13 gui.subframe_update(boolean on)
1146 Request subframe updates (calling on_paint() on subframes) to 
1147 happen (on=true) or not happen (on=false). Can be used anywhere.
1149 8.3.14 gui.screenshot(string filename)
1151 Write PNG screenshot of the current frame (no drawings) to 
1152 specified file. Can be used anywhere.
1154 8.3.15 gui.color(number r, number g, number b[, number a])
1156 Returns color (in notation Lua scripts use) corresponding to 
1157 color (r,g,b), each component in scale 0-255. If a is specified, 
1158 that is alpha (0 is fully transparent, 256(sic) is fully opaque). 
1159 The default alpha is 256.
1161 8.3.16 gui.status(string name, string value)
1163 Set status field “L[<name>]” to <value> in status area. Can be 
1164 used anywhere.
1166 8.4 table input
1168 Input handling. Only available in on_input callback.
1170 8.4.1 input.get(number controller, number index)
1172 Read the specified index (0-11) from specified controller (0-7). 
1173 Notes:
1175 • Uses physical controller numbering. Gamepad in port 2 is 
1176   controller 4, not 1!
1178 8.4.2 input.set(number controller, number index, number value)
1180 Write the specified index (0-11) from specified controller (0-7), 
1181 storing value. Notes:
1183 • Uses physical controller numbering. Gamepad in port 2 is 
1184   controller 4, not 1!
1186 8.4.3 input.reset([number cycles])
1188 Execute reset. If cycles is greater than zero, do delayed reset. 
1189 0 (or no value) causes immediate reset.
1191 • Only available with subframe flag false.
1193 8.4.4 input.raw()
1195 Returns table of tables of all available keys and axes. The first 
1196 table is indexed by key name (platform-dependent!), and the inner 
1197 table has the following fields:
1199 • last_rawval: Last reported raw value for control.
1201 • ktype: Type of key (disabled, key, mouse, axis, axis-inverse, 
1202   hat, pressure-m0, pressure-mp, pressure-0m, pressure-0p, 
1203   pressure-pm, pressure-p0).
1205 • cal_left: Minimum calibration value. Only meaningful with axis 
1206   and pressure types.
1208 • cal_center: Center calibration value. Only meaningful with axis 
1209   and pressure types.
1211 • cal_right: Maximum calibration value. Only meaningful with axis 
1212   and pressure types.
1214 • cal_tolerance: Dead zone tolerance. Only meaningful with axis 
1215   and pressure types.
1217 8.4.5 input.keyhook(key, state)
1219 Requests that keyhook events to be sent for key (state=true) or 
1220 not sent (state=false).
1222 8.5 Table hostmemory
1224 Host memory handling (extra memory saved to savestates). Host 
1225 memory starts empty.
1227 8.5.1 hostmemory.read(number address)
1229 Reads hostmemory slot address. Slot numbers out of range return 
1230 false instead of numeric.
1232 8.5.2 hostmemory.write(number address, number value)
1234 Writes hostmemory slot with 0-255. Slot numbers out of range 
1235 cause extension of host memory slot space.
1237 8.5.3 hostmemory.readbyte(number address)
1239 Read unsigned byte (1 element) from given address. Slots out of 
1240 range return false.
1242 8.5.4 hostmemory.writebyte(number address, number value)
1244 Write unsigned byte (1 element) to given slot. Slot numbers out 
1245 of range cause extension.
1247 8.5.5 hostmemory.readsbyte(number address)
1249 Read signed byte (1 element) from given address. Slots out of 
1250 range return false.
1252 8.5.6 hostmemory.writesbyte(number address, number value)
1254 Write signed byte (1 element) to given slot. Slot numbers out of 
1255 range cause extension.
1257 8.5.7 hostmemory.readword(number address)
1259 Read unsigned word (2 elements) from given address. Slots out of 
1260 range return false.
1262 8.5.8 hostmemory.writeword(number address, number value)
1264 Write unsigned word (2 elements) to given slot. Slot numbers out 
1265 of range cause extension.
1267 8.5.9 hostmemory.readsword(number address)
1269 Read signed word (2 elements) from given address. Slots out of 
1270 range return false.
1272 8.5.10 hostmemory.writesword(number address, number value)
1274 Write signed word (2 elements) to given slot. Slot numbers out of 
1275 range cause extension.
1277 8.5.11 hostmemory.readdword(number address)
1279 Read unsigned doubleword (4 elements) from given address. Slots 
1280 out of range return false.
1282 8.5.12 hostmemory.writedword(number address, number value)
1284 Write unsigned doubleword (4 elements) to given slot. Slot 
1285 numbers out of range cause extension.
1287 8.5.13 hostmemory.readsdword(number address)
1289 Read signed doubleword (4 elements) from given address. Slots out 
1290 of range return false.
1292 8.5.14 hostmemory.writesdword(number address, number value)
1294 Write signed doubleword (4 elements) to given slot. Slot numbers 
1295 out of range cause extension.
1297 8.5.15 hostmemory.readqword(number address)
1299 Read unsigned quadword (8 elements) from given address. Slots out 
1300 of range return false.
1302 8.5.16 hostmemory.writeqword(number address, number value)
1304 Write unsigned quadword (4 elements) to given slot. Slot numbers 
1305 out of range cause extension.
1307 8.5.17 hostmemory.readsqword(number address)
1309 Read signed quadword (8 elements) from given address. Slots out 
1310 of range return false.
1312 8.5.18 hostmemory.writesqword(number address, number value)
1314 Write signed quadword (8 elements) to given slot. Slot numbers 
1315 out of range cause extension.
1317 8.6 Table movie
1319 Movie handling
1321 8.6.1 movie.currentframe()
1323 Return number of current frame.
1325 8.6.2 movie.framecount()
1327 Return number of frames in movie.
1329 8.6.3 movie.readonly()
1331 Return true if in readonly mode, false if in readwrite.
1333 8.6.4 movie.set_readwrite()
1335 Set readwrite mode (does not cause on_readwrite callback).
1337 8.6.5 movie.frame_subframes(number frame)
1339 Count number of subframes in specified frame (frame numbers are 
1340 1-based) and return that.
1342 8.6.6 movie.read_subframe(number frame, number subframe)
1344 Read specifed subframe in specified frame and return data as 
1345 array (100 elements, numbered 0-99 currently).
1347 8.7 Table settings
1349 Routines for settings manipulation
1351 8.7.1 settings.get(string name)
1353 Get value of setting. If setting is blank, returns false. If 
1354 setting value can't be obtained, returns (nil, error message).
1356 8.7.2 settings.set(string name, string value)
1358 Set value of setting. If setting can't be set, returns (nil, 
1359 error message).
1361 8.7.3 settings.is_set(string name)
1363 Returns if setting is set. If setting does not exist, returns 
1364 (nil, error message).
1366 8.7.4 settings.blank(string name)
1368 Blanks a setting and returns true. If setting can't be blanked, 
1369 returns (nil, error message).
1371 8.8 Table memory
1373 Contains various functions for managing memory
1375 8.8.1 memory.vma_count()
1377 Returns the number of VMAs
1379 8.8.2 memory.read_vma(number index)
1381 Reads the specified VMA (indices start from zero). Trying to read 
1382 invalid VMA gives nil. The read VMA is table with the following 
1383 fields:
1385 • region_name (string): The readable name of the VMA
1387 • baseaddr (number): Base address of the VMA
1389 • lastaddr (number): Last address in the VMA.
1391 • size (number): The size of VMA in bytes.
1393 • readonly (boolean): True of the VMA corresponds to ROM.
1395 • native_endian (boolean): True if the VMA has native endian as 
1396   opposed to little endian.
1398 8.8.3 memory.find_vma(number address)
1400 Finds the VMA containing specified address. Returns table in the 
1401 same format as read_vma or nil if not found.
1403 8.8.4 memory.readbyte(number address)
1405 Reads the specified address as unsigned byte and returns the 
1406 result.
1408 8.8.5 memory.readsbyte(number address)
1410 Reads the specified address as signed byte and returns the 
1411 result.
1413 8.8.6 memory.writebyte(number address, number value)
1415 Writes the specified value (negative values undergo 2's 
1416 complement) to specified address (as a byte).
1418 8.8.7 memory.readword(number address)
1420 Reads the specified address as unsigned word and returns the 
1421 result.
1423 8.8.8 memory.readsword(number address)
1425 Reads the specified address as signed word and returns the 
1426 result.
1428 8.8.9 memory.writeword(number address, number value)
1430 Writes the specified value (negative values undergo 2's 
1431 complement) to specified address (as a word).
1433 8.8.10 memory.readdword(number address)
1435 Reads the specified address as unsigned doubleword and returns 
1436 the result.
1438 8.8.11 memory.readsdword(number address)
1440 Reads the specified address as signed doubleword and returns the 
1441 result.
1443 8.8.12 memory.writedword(number address, number value)
1445 Writes the specified value (negative values undergo 2's 
1446 complement) to specified address (as a doubleword).
1448 8.8.13 memory.readqword(number address)
1450 Reads the specified address as unsigned quadword and returns the 
1451 result.
1453 8.8.14 memory.readsqword(number address)
1455 Reads the specified address as signed quadword and returns the 
1456 result.
1458 8.8.15 memory.writeqword(number address, number value)
1460 Writes the specified value (negative values undergo 2's 
1461 complement) to specified address (as a quadword).
1463 8.9 Table _SYSTEM
1465 Contains copy of global variables from time of Lua 
1466 initialization. Non-writeable.
1468 8.10 Callbacks
1470 Various callbacks to Lua that can occur.
1472 8.10.1 Callback: on_paint()
1474 Called when screen is being painted. Any gui.* calls requiring 
1475 graphic context draw on the screen.
1477 8.10.2 Callback: on_video()
1479 Called when video dump frame is being painted. Any gui.* calls 
1480 requiring graphic context draw on the video.
1482 8.10.3 Callback: on_frame()
1484 Called on each starting whole frame.
1486 8.10.4 Callback: on_startup()
1488 Called when the emulator is starting (lsnes.rc and --run files 
1489 has been run).
1491 8.10.5 Callback: on_pre_load(string name)
1493 Called just before savestate/movie load occurs (note: loads are 
1494 always delayed, so this occurs even when load was initiated by 
1495 lua).
1497 8.10.6 Callback: on_err_load(string name)
1499 Called if loadstate goes wrong.
1501 8.10.7 Callback: on_post_load(string name, boolean was_savestate)
1503 Called on successful loadstate. was_savestate gives if this was a 
1504 savestate or a movie.
1506 8.10.8 Callback: on_pre_save(string name, boolean is_savestate)
1508 Called just before savestate save occurs (note: movie saves are 
1509 synchronous and won't trigger these callbacks if called from 
1510 Lua).
1512 8.10.9 Callback: on_err_save(string name)
1514 Called if savestate goes wrong.
1516 8.10.10 Callback: on_post_save(string name, boolean is_savestate)
1518 Called on successful savaestate. is_savestate gives if this was a 
1519 savestate or a movie.
1521 8.10.11 Callback: on_quit()
1523 Called when emulator is shutting down.
1525 8.10.12 Callback: on_input(boolean subframe)
1527 Called when emulator is just sending input to bsnes core. 
1528 Warning: This is called even in readonly mode, but the results 
1529 are ignored.
1531 8.10.13 Callback: on_reset()
1533 Called when SNES is reset.
1535 8.10.14 Callback: on_readwrite()
1537 Called when moving into readwrite mode as result of “set-rwmode” 
1538 command (note: moving to rwmode by Lua won't trigger this, as per 
1539 recursive entry protection).
1541 8.10.15 Callback: on_snoop(number port, number controller, number 
1542   index, number value)
1544 Called each time bsnes asks for input. The value is the final 
1545 value to be sent to bsnes core (readonly mode, autohold and 
1546 autofire have been taken into account). Might be useful when 
1547 translating movies to format suitable for console verification. 
1548 Note: There is no way to modify the value to be sent.
1550 8.10.16 Callback: on_keyhook(string keyname, table state)
1552 Sent when key that has keyhook events requested changes state. 
1553 Keyname is name of the key (group) and state is the state (same 
1554 kind as table values in input.raw).
1556 9 Modifier and key names:
1558 9.1 SDL Platform
1560 9.1.1 Modifier names
1562 Following modifier names are known:
1564 • ctrl, lctrl, rctrl: Control keys
1566 • alt, lalt, ralt: ALT keys.
1568 • shift, lshift, rshift: Shift keys.
1570 • meta, lmeta, rmeta: Meta keys.
1572 • num, caps: Numlock/Capslock (these are sticky!)
1574 • mode: Mode select.
1576 9.1.2 Key names
1578 Following key names are known:
1580 • backspace, tab, clear, return, pause, escape, space, exclaim, 
1581   quotedbl, hash, dollar, ampersand, quote, leftparen, 
1582   rightparen, asterisk, plus, comma, minus, period, slash, 0, 1, 
1583   2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon, less, equals, 
1584   greater, question, at, leftbracket, backslash, rightbracket, 
1585   caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, 
1586   l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, 
1587   world_1, world_2, world_3, world_4, world_5, world_6, world_7, 
1588   world_8, world_9, world_10, world_11, world_12, world_13, 
1589   world_14, world_15, world_16, world_17, world_18, world_19, 
1590   world_20, world_21, world_22, world_23, world_24, world_25, 
1591   world_26, world_27, world_28, world_29, world_30, world_31, 
1592   world_32, world_33, world_34, world_35, world_36, world_37, 
1593   world_38, world_39, world_40, world_41, world_42, world_43, 
1594   world_44, world_45, world_46, world_47, world_48, world_49, 
1595   world_50, world_51, world_52, world_53, world_54, world_55, 
1596   world_56, world_57, world_58, world_59, world_60, world_61, 
1597   world_62, world_63, world_64, world_65, world_66, world_67, 
1598   world_68, world_69, world_70, world_71, world_72, world_73, 
1599   world_74, world_75, world_76, world_77, world_78, world_79, 
1600   world_80, world_81, world_82, world_83, world_84, world_85, 
1601   world_86, world_87, world_88, world_89, world_90, world_91, 
1602   world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, 
1603   kp4, kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, 
1604   kp_multiply, kp_minus, kp_plus, kp_enter, kp_equals, up, down, 
1605   right, left, insert, home, end, pageup, pagedown, f1, f2, f3, 
1606   f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, numlock, 
1607   capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt, lalt, 
1608   rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, 
1609   sysreq, break, menu, power, euro, undo
1611 • Names of form 'key<n>' where <n> is 0-255 are interpretted as 
1612   key having hardware-dependent scan code of <n> (useful to bind 
1613   those keys that don't have symbolic names).
1615 9.1.3 Joystick pseudo-keys:
1617 • joystick<num>button<button>: Joystick <num> (0-based) button 
1618   <button> (0-based).
1620 • joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> 
1621   (0-based) up.
1623 • joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> 
1624   (0-based) left.
1626 • joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> 
1627   (0-based) down.
1629 • joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> 
1630   (0-based) right.
1632 • joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> 
1633   negative position (axis modes axis and axis_inverse).
1635 • joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> 
1636   positive position (axis modes axis and axis_inverse).
1638 • joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> 
1639   pressure (axis modes pressure_*).
1641 9.1.4 Special buttons:
1643 • Escape: Enter/Exit Command mode, cancel modal dialogs.
1645 • Return (also KPEnter): Execute command, ok modal dialog.
1647 • Pgup/Up (also KP8/9 if no num lock; command mode): Previous 
1648   command in command history
1650 • Pgdn/Down(also KP2/3 if no num lock; command mode): Next 
1651   command in command history
1653 • Home (also KP7 if no num lock; command mode): Beginning of 
1654   command.
1656 • End (also KP1 if no num lock; command mode): End of command.
1658 • Left (also KP4 if no num lock; command mode): Move cursor left.
1660 • Right (also KP6 if no num lock; command mode): Move cursor 
1661   right.
1663 • Delete (also KP. if no num lock; command mode): Delete 
1664   character to right of cursor.
1666 • Insert (also KP0 if no num lock; command mode): Toggle between 
1667   insert / overwrite modes.
1669 • Backspace (command mode): Delete character to left of cursor.
1671 • LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump 
1672   corrupted!).
1674 9.2 wxWidgets platform
1676 9.2.1 Modifier names:
1678 Following modifier names are known:
1680 • alt
1682 • ctrl
1684 • shift 
1686 • meta
1688 • cmd (Mac OS X only)
1690 9.2.2 Key names:
1692 Following key names are known:
1694 • back, tab, return, escape, space, exclaim, quotedbl, hash, 
1695   dollar, percent, ampersand, quote, leftparen, rightparen, 
1696   asterisk, plus, comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 
1697   6, 7, 8, 9, colon, semicolon, less, equals, greater, question, 
1698   at, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, 
1699   u, v, w, x, y, z, leftbracket, backslash, rightbracket, caret, 
1700   underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, 
1701   n, o, p, q, r, s, t, u, v, w, x, y, z, leftcurly, pipe, 
1702   rightcurly, tilde, delete, start, lbutton, rbutton, cancel, 
1703   mbutton, clear, shift, alt, control, menu, pause, capital, end, 
1704   home, lefT, up, right, down, select, print, execute, snapshot, 
1705   insert, help, numpad0, numpad1, numpad2, numpad3, numpad4, 
1706   numpad5, numpad6, numpad7, numpad8, numpad9, multiply, add, 
1707   separator, subtract, decimal, divide, f1, f2, f3, f4, f5, f6, 
1708   f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, 
1709   f20, f21, f22, f23, f24, numlock, scroll, pageup, pagedown, 
1710   numpad_space, numpad_tab, numpad_enter, numpad_f1, numpad_f2, 
1711   numpad_f3, numpad_f4, numpad_home, numpad_left, numpad_up, 
1712   numpad_right, numpad_down, numpad_pageup, numpad_pagedown, 
1713   numpad_end, numpad_begin, numpad_insert, numpad_delete, 
1714   numpad_equal, numpad_multiply, numpad_add, numpad_separator, 
1715   numpad_subtract, numpad_decimal, numpad_divide, windows_left, 
1716   windows_right, windows_menu, command, special1, special2, 
1717   special3, special4, special5, special6, special7, special8, 
1718   special9, special10, special11, special12, special13, 
1719   special14, special15, special16, special17, special18, 
1720   special19, special20
1722 10 Movie file format
1724 Movie file is .zip archive in itself, normal ZIP archive tools 
1725 work on it (note: If you recompress it, do not use compression 
1726 methods other than store and deflate and especially do not use 
1727 encryption of any kind).
1729 10.1 Detecting clean start/SRAM/Savestate
1731 • If file has member “savestate” it is savestate, otherwise:
1733 • If file has members with names starting “moviesram.” it is 
1734   movie starting from SRAM, otherwise:
1736 • It is movie starting from clear state.
1738 10.2 Member: gametype
1740 Type of game ROM and region (as one line). Valid values are:
1743 +--------------+---------------------+--------+
1744 |    Value     |       System        | Region |
1745 +--------------+---------------------+--------+
1746 +--------------+---------------------+--------+
1747 |  snes_pal    |     Super NES       |  PAL   |
1748 +--------------+---------------------+--------+
1749 |   sgb_pal    |   Super Game Boy    |  PAL   |
1750 +--------------+---------------------+--------+
1751 |  snes_ntsc   |     Super NES       |  NTSC  |
1752 +--------------+---------------------+--------+
1753 |  sgb_ntsc    |   Super Game Boy    |  NTSC  |
1754 +--------------+---------------------+--------+
1755 |     bsx      | BS-X (non-slotted)  |  NTSC  |
1756 +--------------+---------------------+--------+
1757 | bsxslotted   |   BS-X (slotted)    |  NTSC  |
1758 +--------------+---------------------+--------+
1759 | sufamiturbo  |    Sufami Turbo     |  NTSC  |
1760 +--------------+---------------------+--------+
1763 Frame rates are:
1766 +---------+-----------------+
1767 | Region  | Framerate (fps) |
1768 +---------+-----------------+
1769 +---------+-----------------+
1770 |  PAL    |   322445/6448   |
1771 +---------+-----------------+
1772 |  NTSC   | 10738636/178683 |
1773 +---------+-----------------+
1776 10.3 Member: port1
1778 Contains type of port #1 (as one line). Valid values are 'none', 
1779 'gamepad', 'multitap' and 'mouse'. If not present, defaults to 
1780 'gamepad'.
1782 10.4 Member: port2
1784 Contains type of port #2 (as one line). Valid values are 'none', 
1785 'gamepad', 'multitap', 'mouse', 'superscope', 'justifier' and 
1786 'justifiers'. If not present, defaults to 'none'.
1788 10.5 Member: gamename
1790 Contains name of the game (as one line).
1792 10.6 Member: authors
1794 Contains authors, one per line. Part before '|' is the full name, 
1795 part after is the nickname.
1797 10.7 Member: systemid
1799 Always “lsnes-rr1” (one line). Used to reject other saves.
1801 10.8 Member: controlsversion
1803 Always “0” (one line). Used to identify what controls are there.
1805 10.9 Member: “coreversion”
1807 Contains bsnes core version number (as one line).
1809 10.10 Member: projectid
1811 Contains project ID (as one line). Used to identify if two movies 
1812 are part of the same project.
1814 10.11 Member: {rom,slota,slotb}{,xml}.sha256
1816 Contains SHA-256 of said ROM or ROM mapping file (as one line). 
1817 Absent if corresponding file is absent.
1819 10.12 Member: moviesram.<name>
1821 Raw binary startup SRAM of kind <name>. Only present in 
1822 savestates and movies starting from SRAM.
1824 10.13 Member: saveframe
1826 Contains frame number (as one line) of frame movie was saved on. 
1827 Only present in savestates.
1829 10.14 Member: lagcounter
1831 Current value of lag counter (as one line). Only present in 
1832 savestates.
1834 10.15 Member: pollcounters
1836 Contains poll counters (currently 100 of them), one per line. 
1837 Each line is raw poll count if DRDY is set for it. Otherwise it 
1838 is negative poll count minus one. Only present in savestates.
1840 10.16 Member: hostmemory
1842 Raw binary dump of host memory. Only present in savestates.
1844 10.17 Member: savestate
1846 The raw binary savestate itself. Savestate detection uses this 
1847 file, only present in savestates.
1849 10.18 Member: screenshot
1851 Screenshot of current frame. Only present in savestates. First 2 
1852 bytes are big-endian width of image, rest are 24-bit RGB image 
1853 data. Height of image is inferred from the width and size of 
1854 data.
1856 10.19 Member: sram.<name>
1858 Raw binary SRAM of kind <name> at time of savestate. Only present 
1859 in savestates.
1861 10.20 Member: input
1863 The actual input track, one line per subframe (blank lines are 
1864 skipped).
1866 • If the first byte of each line is '.', ' ', <tab> or '|', then 
1867   the line is part of same frame as previous, otherwise it starts 
1868   a new frame.
1870 • First subframe must start a new frame.
1872 Length of movie in frames is number of lines in input file that 
1873 start a new frame.
1875 10.21 Member: rerecords
1877 Contains textual base-10 rerecord count (as one line; emulator 
1878 just writes this, it doesn't read it) + 1.
1880 10.22 Member: rrdata
1882 This member stores set of load IDs. There is one load ID per 
1883 rerecord (plus one corresponding to start of project).
1885 • This member constists of concatenation of records
1887 • Each record is 2-36 bytes long and can represent 1-16,843,009 
1888   consequtive IDs.
1890 • IDs are interpretted as 256-bit big-endian integers with 
1891   warparound.
1893 • Initial predicted ID is all zeroes.
1895 Format of each record is:
1897 • 1 byte: Opcode byte. Bits 0-4 are prefix length (prefixlen), 
1898   bits 5-6 are count length (countlen). Bit 7 is unused.
1900 • 32-prefixlen bytes of ID.
1902 • countlen bytes of big-endian count (count).
1904 Records are processed as follows:
1906 • To form the first ID encoded by record, take the first 
1907   prefixlen bytes predicted ID and append the read ID value to 
1908   it. The result is the first ID encoded.
1910 • If countlen is 0, record encodes 1 ID.
1912 • If countlen is 1, record encodes 2+count IDs.
1914 • If countlen is 2, record encodes 258+count IDs.
1916 • If countlen is 3, record encodes 65794+count IDs.
1918 • The new predicted ID is the next ID after last one encoded by 
1919   the record.
1921 The number of rerecords + 1 is equal to the sum of number of IDs 
1922 encoded by all records.
1924 10.23 Member: starttime.second
1926 Movie starting time, second part. Epoch is Unix epoch. Default is 
1927 1,000,000,000.
1929 10.24 Member: starttime.subsecond
1931 Movie starting time, subsecond part. Unit is CPU clocks. Default 
1932 is 0.
1934 10.25 Member: savetime.second
1936 Movie saving time, second part. Default is starttime.second. Only 
1937 present in savestates.
1939 10.26 Member: savetime.subsecond
1941 Movie saving time, subsecond part. Default is 
1942 starttime.subsecond. Only present in savestates.
1944 11 Quick'n'dirty encode guide
1946 1. Start the emulator and load the movie file.
1948 2. Set large AVI option 'set-setting avi-large on'
1950 3. Enable dumping 'dump-avi tmpdump' 
1952 4. Unpause and let it run until you want to end dumping.
1954 5. Close the emulator (closing the window is the easiest way). Or 
1955   use 'end-avi'.
1957 6. For each tmpdump*.avi file created, on command prompt, do 
1958   'x264 --crf 10 -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
1960 7. Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
1962 8. Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + 
1963   tmpdump_0000001.mkv + tmpdump_0000002.mkv' (list every 
1964   tmpdump_<numbers>.mkv, with + in between).
1966 9. Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'. Now 
1967   final.mkv contains quick'n'dirty encode.
1969 12 Axis configurations for some gamepad types:
1971 12.1 XBox360 controller:
1973 Axes 2 and 5 (joystick<n>axis2 and joystick<n>axis5) should be 
1974 set to pressure-+.
1976 set-axis joystick0axis2 pressure-+
1978 set-axis joystick0axis5 pressure-+
1980 • This is needed for SDL only. EVDEV sets those types correctly.
1982 12.2 PS3 “sixaxis” controller:
1984 Axes 8-19 should be disabled.
1986 set-axis joystick0axis8 disabled
1988 set-axis joystick0axis9 disabled
1990 set-axis joystick0axis10 disabled
1992 set-axis joystick0axis11 disabled
1994 set-axis joystick0axis12 disabled
1996 set-axis joystick0axis13 disabled
1998 set-axis joystick0axis14 disabled
2000 set-axis joystick0axis15 disabled
2002 set-axis joystick0axis16 disabled
2004 set-axis joystick0axis17 disabled
2006 set-axis joystick0axis18 disabled
2008 set-axis joystick0axis19 disabled
2010 13 Errata:
2012 13.1 Problems from BSNES core:
2014 • The whole pending save stuff.
2016 • Lack of layer hiding.
2018 • It is slow (especially accuracy).
2020 • Firmwares can't be loaded from ZIP archives.
2022 13.2 Other problems:
2024 • Modifiers don't work with pseudo-keys (SDL, EVDEV).
2026 • Audio for last dumped frame is not itself dumped.
2028 • Audio in UI is pretty bad in quality if game doesn't run at 
2029   full speed.
2031 • AVI compression levels 10-18 are not compatible with AVISynth 
2032   AVISource.
2034 • No menus, command based interface (SDL).
2036 • Long commands don't scroll.
2038 • The SDL screen drawing is slow.
2040 • Wxwidgets UI is still pretty buggy.
2042 14 Changelog:
2044 14.1 rr0-beta1
2046 • Fix -Wall warnings
2048 • Fix dumper video corruption with levels 10-18.
2050 14.2 rr0-beta2
2052 • Autofire
2054 • Lots of code cleanups
2056 • Lua interface to settings
2058 • Allow specifying AVI borders without Lua
2060 • Fix scaling if vscale > 1 and originx > 0 (left border exists)
2062 • on_snoop lua callback
2064 • Faster movie loading and saving.
2066 14.3 rr0-beta3
2068 • Joystick support
2070 14.4 rr0-beta4
2072 • Fix multi-buttons
2074 • Save jukebox functionality.
2076 14.5 rr0-beta5
2078 • Try to fix some nasty failing movie load edge cases
2080 • Allow specifying scripts to run on command line.
2082 14.6 rr0-beta6
2084 • Major source code reorganization.
2086 • Backup savestates before overwriting.
2088 • Don't crash if loading initial state fails.
2090 14.7 rr0-beta7
2092 • Fix firmware lookup
2094 • Fix author name parsing
2096 • Fix rerecord counting
2098 • (SDL) Print messages to console if SDL is uninitialized
2100 • Add movieinfo program
2102 • Fix loading movies starting from SRAM.
2104 14.8 rr0-beta8
2106 • Add support for unattended dumping
2108 • Fix compiling for Win32
2110 • Don't lock up if sound can't be initialized
2112 • Strip trailing CR from commands
2114 • Don't try to do dubious things in global ctors (fix crash on 
2115   startup)
2117 14.9 rr0-beta9
2119 • Small documentation tweaking
2121 • Fix make clean
2123 • Fix major bug in modifier matching
2125 14.10 rr0-beta10
2127 • Lots of documentation fixes
2129 • Use dedicated callbacks for event backcomm., not commands.
2131 • Ensure that the watchdog is not hit when executing delayed 
2132   reset.
2134 • Remove errant tab from joystick message.
2136 14.11 rr0-beta11
2138 • Make autofire operate in absolute time, not linear time
2140 • Reinitialize controls when resuming from loadstate
2142 • Some more code cleanups
2144 • If Lua allocator fails, call OOM_panic()
2146 • Byte/word/dword/qword sized host memory write/read functions.
2148 • Dump at correct framerate if dumping interlaced NTSC 
2149   (height=448).
2151 14.12 rr0-beta12
2153 • Actually include the complete source code
2155 • Keep track of RTC
2157 14.13 rr0-beta13
2159 • Document {save,start}time.{,sub}second.
2161 • Intercept time() from bsnes core.
2163 14.14 rr0-beta14
2165 • Allow disabling time() interception (allow build on Mac OS X)
2167 • Use SDLMain on Mac OS X (make SDL not crash)
2169 • Disable delayed resets (just plain too buggy for now).
2171 • Code cleanups
2173 • Use 16-bit for graphics/video instead of 32-bit.
2175 • gui.rectangle/gui.pixel
2177 • gui.crosshair
2179 • New CSCD writer implementation.
2181 14.15 rr0-beta15
2183 • Fix interaction of * and +.
2185 • Manual improvements
2187 • Use gettimeofday()/usleep(), these seem portable enough.
2189 • Move joystick axis manipulation to keymapper code.
2191 • Changes to how read-only works.
2193 • Refactor controller input code.
2195 14.16 rr0-beta16
2197 • Fix mouseclick scale compensation.
2199 • Draw area boundaries correctly in SDL code.
2201 • gui.screenshot.
2203 • Fix CSCD output (buffer overrun and race condition).
2205 14.17 rr0-beta17
2207 • JMD dumping support.
2209 • Allow unattended dumping to JMD.
2211 • Move to BSNES v083.
2213 • Switch back to 32-bit colors.
2215 • Add Lua function gui.color.
2217 • Use some new C++11 features in GCC 4.6.
2219 • Be prepared for core frequency changes.
2221 • Pass colors in one chunk from Lua.
2223 14.18 rr0-beta18
2225 • New lua functions gui.line(), gui.status() and gui.circle(), 
2226   memory.vma_count(), memory.read_vma() and memory.find_vma().
2228 • Numerious documentation fixups
2230 • RTC time format changed
2232 • Reformat flags display
2234 • Allow lua package name to be overridden
2236 • SDUMP (high-quality dumping).
2238 • Split platform support to plugins.
2240 • Make all sound plugins support basic sound commands
2242 • Support portaudio for sound.
2244 • Allow disable Lua/SDL searching.
2246 • Upconvert colors when copying lcscreen to screen.
2248 • Reorganize source tree.
2250 • Evdev joystick support.
2252 • Refactor more code into generic window code.
2254 14.19 rr0-beta19
2256 • Refactor message handling.
2258 • Rework makefile
2260 • Documentation fixes
2262 • Finish pending saves before load/quit.
2264 • Wxwidgets graphics plugin.
2266 14.20 rr0-beta20
2268 • Get rid of win32-crap.[ch]pp.
2270 • Move files around a lot.
2272 • Get rid of need for host C++ compiler.
2274 • Bsnes v084 core.
2276 • Refactor inter-component communication.
2278 • Fix zero luma.
2280 • Fix crash on multiline aliases.
2282 • Load/Save settings in wxwidgets gui.
2284 14.21 rr0-beta21
2286 • Patch problems in bsnes core
2288 • SNES is little-endian, not big-endian!
2290 • Fix memory corruption in lcscreen::load()
2292 14.22 rr0-beta22
2294 • Fix interpretting repeat counts in rrdata loading.
2296 • New lua callback: on_frame()
2298 • Remove calls to runtosave() that aren't supposed to be there
2300 • Lua function: movie.read_rtc()
2302 • Ignore src/fonts/font.cpp
2304 • Fix more bsnes core problems
2306 • Control bsnes random seeding
2308 • Pause-on-end
2310 • Some bsnes core debugging features (state dump and state hash)
2312 • Fix titlebar version number (no, the last version wasn't 
2313   'lsnes-0-beta21', it was 'lsnes rr0-beta21').
2315 14.23 rr0-beta23
2317 • Fix memory corruption due to macro/field mixup
2319 • search-memory update
2321 • Allow direct-mapped framebuffer
2323 • SDL: Use SDL_ANYFORMAT if possible
2325 • SDMP2SOX: 2s delay modes.
2327 • Wxwidgets: Cleanups
2329 • Use sed -E, not sed -r. Fixes building on Mac OS X.
2331 • Wxwidgets: Save jukebox on exit
2333 • Fix RTC if using load-movie on savestate.
2335 • Fix crash related to full console mode.
2337 14.24 rr0-beta24
2339 • Wxwidgets: Allow bringing application to foreground on Mac OS 
2340   X.
2342 • Wxwidgets: Allow compiling on Mac OS X.
2344 • Use movie compare instead of movie hashing (faster save/load).
2346 • Lua: _SYSTEM table.
2348 14.25 rr0-beta25
2350 • sdmp2sox: Pad soundtrack if using -l or -L.
2352 • sdmp2sox: Fix NTSC overscan.
2354 • sdmp2sox: Add AR correction mode.
2356 • call lua_close() when exiting.
2358 • Fix zip_writer bug causing warnings from info-zip and error 
2359   from advzip.
2361 14.26 rr0-beta26
2363 • Fix IPS patching code (use bsnes core IPS patcher).
2365 • Implement BPS patching (using bsnes core IPS patcher).
2367 • Add feature to load headered ROMs.
2369 14.27 rr0-beta27
2371 • Show command names when showing keybindings
2373 14.28 rr0
2375 • Fix pause-on-end to be actually controllable
2377 • SDL: Poll all events in queue, not just first one (fixes 
2378   slowness in command typing)
2380 • Wxwidgets: Fix ROM loading.
2382 14.29 rr1-beta0
2384 • Lua: Add gui.textH, gui.textV, gui.textHV
2386 • Fix text colors on SDL on Mac OS X
2388 • Mode 'F' for finished in readonly mode.
2390 • Fix some WS errors.
2392 • Reliably pause after skip poll
2394 • Split UI and core into their own threads
2396 14.30 rr1-beta1
2398 • Remove leftover dummy SRAM slot
2400 • Fix controller numbers.
2402 14.31 rr1-beta2
2404 • Fix lsnes-dumpavi after interface change.
2406 • Also give BSNES patches for v085.
2408 • Pack movie data in memory.
2410 14.32 rr1-beta3
2412 • Fix framecount/length given when loading movies.
2414 • Controller command memory leak fixes.
2416 • Don't leak palette if freeing screen object.
2418 14.33 rr1-beta4
2420 • Detect revisions.
2422 • Wxwidgets: Allow controlling dumper from the menu.
2424 14.34 rr1-beta5
2426 • Rewrite parts of manual
2428 • Lua: Make it work with Lua 5.2.
2430 14.35 rr1-beta6
2432 • Win32: Fix compile errors.
2434 14.36 rr1-beta7
2436 • Refactor controller input code.
2438 • Fix crash when using command line on SDL / Mac OS X.
2440 14.37 rr1-beta8
2442 • Delete core/coroutine (obsolete)
2444 • Lag input display by one frame.
2446 • Rewind movie to beginning function.
2448 • Fix wrong frame number reported to Lua when repainting after 
2449   loadstate
2451 • Support UI editing of jukebox
2453 • Wxwidgets: Save settings on exit.
2455 • Support ${project} for filenames
2457 • SDL: Fix command history
2459 14.38 rr1-beta9
2461 • Fix some order-of-global-ctor bugs.
2463 14.39 rr1-beta10
2465 • Fix crashes when quitting on Win32.
2467 14.40 rr1-beta11
2469 • EVDEV: Queue keypresses from joystick, don't send directly
2471 • Wxwidgets: Load-Preserve that actually works.
2473 14.41 rr1-beta12
2475 • Wxwidgets: GUI for memory search.
2477 • Warn about using synchronous queue in UI callback.