lsnes rr0-β10
[lsnes.git] / manual.lyx
blobe134cadc0e146c5f6fb7f014cb3c7cc6652f595e
1 #LyX 2.0 created this file. For more info see http://www.lyx.org/
2 \lyxformat 413
3 \begin_document
4 \begin_header
5 \textclass article
6 \use_default_options true
7 \maintain_unincluded_children false
8 \language finnish
9 \language_package default
10 \inputencoding auto
11 \fontencoding global
12 \font_roman default
13 \font_sans default
14 \font_typewriter default
15 \font_default_family default
16 \use_non_tex_fonts false
17 \font_sc false
18 \font_osf false
19 \font_sf_scale 100
20 \font_tt_scale 100
22 \graphics default
23 \default_output_format default
24 \output_sync 0
25 \bibtex_command default
26 \index_command default
27 \paperfontsize default
28 \use_hyperref false
29 \papersize default
30 \use_geometry false
31 \use_amsmath 1
32 \use_esint 1
33 \use_mhchem 1
34 \use_mathdots 1
35 \cite_engine basic
36 \use_bibtopic false
37 \use_indices false
38 \paperorientation portrait
39 \suppress_date false
40 \use_refstyle 1
41 \index Hakusana
42 \shortcut idx
43 \color #008000
44 \end_index
45 \secnumdepth 3
46 \tocdepth 3
47 \paragraph_separation indent
48 \paragraph_indentation default
49 \quotes_language english
50 \papercolumns 1
51 \papersides 1
52 \paperpagestyle default
53 \tracking_changes false
54 \output_changes false
55 \html_math_output 0
56 \html_css_as_file 0
57 \html_be_strict false
58 \end_header
60 \begin_body
62 \begin_layout Section
63 Introduction
64 \end_layout
66 \begin_layout Standard
67 lsnes is SNES rerecording emulator based on bsnes core.
68 \end_layout
70 \begin_layout Section
71 Command line options
72 \end_layout
74 \begin_layout Itemize
75 Syntax: lsnes.exe <rom-options> <misc-options> (<new-session-options>|<filename>)
76 \end_layout
78 \begin_layout Itemize
79 Syntax: lsnes-avidump <dump-options> <misc-options> <rom-options> <filename>
80 \end_layout
82 \begin_layout Itemize
83 Syntax: movieinfo.exe <filename>
84 \end_layout
86 \begin_layout Subsection
87 ROM options
88 \end_layout
90 \begin_layout Standard
91 These options control loading the ROM.
92 \end_layout
94 \begin_layout Subsubsection
95 --rom=<file>
96 \end_layout
98 \begin_layout Standard
99 Load <file> (SFC file format) as main SNES cartridge ROM.
100  This is the game ROM for SNES and cartridge BIOS for other types.
101  Required option.
102 \end_layout
104 \begin_layout Subsubsection
105 --rom-xml=<file>
106 \end_layout
108 \begin_layout Standard
109 Set the mapping XML file for main cartridge ROM.
110  If not specified, defaults are used.
111 \end_layout
113 \begin_layout Subsubsection
114 --bsx=<file>
115 \end_layout
117 \begin_layout Standard
118 Load <file> (BS file format) as BS-X non-slotted flash memory.
119  Also sets system type to BS-X non-slotted (not compatible with --bsxslotted=<fi
120 le>, --dmg=<file>, --slot-a=<file> nor --slot-b=<file>).
121 \end_layout
123 \begin_layout Subsubsection
124 --bsx-xml=<file>
125 \end_layout
127 \begin_layout Standard
128 Set mapping XML file for BS-X non-slotted flash memory.
129  If not specified, defaults are used.
130  Only can be used together with --bsx=<file>.
131 \end_layout
133 \begin_layout Subsubsection
134 --bsxslotted=<file>
135 \end_layout
137 \begin_layout Standard
138 Load <file> (BS file format) as BS-X slotted flash memory.
139  Also sets system type to BS-X slotted (not compatible with --bsx=<file>,
140  --dmg=<file>, --slot-a=<file> nor --slot-b=<file>).
141 \end_layout
143 \begin_layout Subsubsection
144 --bsxslotted-xml=<file>
145 \end_layout
147 \begin_layout Standard
148 Set mapping XML file for BS-X slotted flash memory.
149  If not specified, defaults are used.
150  Only can be used together with --bsxslotted=<file>.
151 \end_layout
153 \begin_layout Subsubsection
154 --dmg=<file>
155 \end_layout
157 \begin_layout Standard
158 Load <file> (GB file format) as Game Boy ROM.
159  Also sets system type to SGB (not compatible with --bsx=<file>, --bsxslotted=<f
160 ile>, --slot-a=<file> nor --slot-b=<file>).
161 \end_layout
163 \begin_layout Subsubsection
164 --dmg-xml=<file>
165 \end_layout
167 \begin_layout Standard
168 Set mapping XML file for Game Boy ROM.
169  If not specified, defaults are used.
170  Only can be used together with --dmg=<file>.
171 \end_layout
173 \begin_layout Subsubsection
174 --slot-a=<file>
175 \end_layout
177 \begin_layout Standard
178 Load <file> (ST file format) as Sufami turbo cartridge A ROM.
179  Also sets system type to Sufami Turbo (not compatible with --bsx=<file>,
180  --bsxslotted=<file> nor --dmg=<file>).
181 \end_layout
183 \begin_layout Subsubsection
184 --slot-a-xml=<file>
185 \end_layout
187 \begin_layout Standard
188 Set mapping XML file for Sufami turbo cartridge A ROM.
189  If not specified, defaults are used.
190  Only can be used together with --slot-a=<file>.
191 \end_layout
193 \begin_layout Subsubsection
194 --slot-b=<file>
195 \end_layout
197 \begin_layout Standard
198 Load <file> (ST file format) as Sufami turbo cartridge B ROM.
199  Also sets system type to Sufami Turbo (not compatible with --bsx=<file>,
200  --bsxslotted=<file> nor --dmg=<file>).
201 \end_layout
203 \begin_layout Subsubsection
204 --slot-b-xml=<file>
205 \end_layout
207 \begin_layout Standard
208 Set mapping XML file for Sufami turbo cartridge B ROM.
209  If not specified, defaults are used.
210  Only can be used together with --slot-b=<file>.
211 \end_layout
213 \begin_layout Subsubsection
214 --ips-rom=<file>
215 \end_layout
217 \begin_layout Standard
218 Apply IPS patch <file> to main cartridge ROM.
219  Requires --rom=<file>.
220 \end_layout
222 \begin_layout Subsubsection
223 --ips-rom-xml=<file>
224 \end_layout
226 \begin_layout Standard
227 Apply IPS patch <file> to main cartridge ROM mapping XML.
228  Requires --rom-xml=<file>.
229 \end_layout
231 \begin_layout Subsubsection
232 --ips-bsx=<file>
233 \end_layout
235 \begin_layout Standard
236 Apply IPS patch <file> to BS-X non-slotted flash.
237  Requires --bsx=<file>.
238 \end_layout
240 \begin_layout Subsubsection
241 --ips-bsx-xml=<file>
242 \end_layout
244 \begin_layout Standard
245 Apply IPS patch <file> to BS-X non-slotted flash mapping XML.
246  Requires --bsx-xml=<file>.
247 \end_layout
249 \begin_layout Subsubsection
250 --ips-bsxslotted=<file>
251 \end_layout
253 \begin_layout Standard
254 Apply IPS patch <file> to BS-X slotted flash.
255  Requires --bsxslotted=<file>.
256 \end_layout
258 \begin_layout Subsubsection
259 --ips-bsxslotted-xml=<file>
260 \end_layout
262 \begin_layout Standard
263 Apply IPS patch <file> to BS-X slotted flash mapping XML.
264  Requires --bsxslotted-xml=<file>.
265 \end_layout
267 \begin_layout Subsubsection
268 --ips-dmg=<file>
269 \end_layout
271 \begin_layout Standard
272 Apply IPS patch <file> to Game Boy ROM.
273  Requires --dmg=<file>.
274 \end_layout
276 \begin_layout Subsubsection
277 --ips-dmg-xml=<file>
278 \end_layout
280 \begin_layout Standard
281 Apply IPS patch <file> to Game Boy ROM mapping XML.
282  Requires --dmg-xml=<file>.
283 \end_layout
285 \begin_layout Subsubsection
286 --ips-slot-a=<file>
287 \end_layout
289 \begin_layout Standard
290 Apply IPS patch <file> to Sufami turbo cartridge A ROM.
291  Requires --slot-a=<file>.
292 \end_layout
294 \begin_layout Subsubsection
295 --ips-slot-a-xml=<file>
296 \end_layout
298 \begin_layout Standard
299 Apply IPS patch <file> to Sufami turbo cartridge A ROM mapping XML.
300  Requires --slot-a-xml=<file>.
301 \end_layout
303 \begin_layout Subsubsection
304 --ips-slot-b=<file>
305 \end_layout
307 \begin_layout Standard
308 Apply IPS patch <file> to Sufami turbo cartridge B ROM.
309  Requires --slot-b=<file>.
310 \end_layout
312 \begin_layout Subsubsection
313 --ips-slot-b-xml=<file>
314 \end_layout
316 \begin_layout Standard
317 Apply IPS patch <file> to Sufami turbo cartridge B ROM mapping XML.
318  Requires --slot-b-xml=<file>.
319 \end_layout
321 \begin_layout Subsubsection
322 --ips-offset=<offset>
323 \end_layout
325 \begin_layout Standard
326 Set IPS apply offset to <offset> (can be negative).
327  IPS apply offset is added to all addresses inside IPS file before applying.
328  If the resulting address is negative, write is ignored (with a warning).
329  If resulting address exceeds ROM size, the ROM is extended.
330 \end_layout
332 \begin_layout Subsubsection
333 --pal
334 \end_layout
336 \begin_layout Standard
337 Force ROM to be considered PAL-only (warning: Will cause error if used on
338  anything except SNES and SGB).
339 \end_layout
341 \begin_layout Subsubsection
342 --ntsc
343 \end_layout
345 \begin_layout Standard
346 Force ROM to be considered NTSC-only (default for everything except SNES
347  and SGB).
348 \end_layout
350 \begin_layout Subsection
351 New session options (lsnes.exe only)
352 \end_layout
354 \begin_layout Standard
355 If filename is not specified, new session is started.
356  These options control the properties of new session:
357 \end_layout
359 \begin_layout Subsubsection
360 --port1=<type>
361 \end_layout
363 \begin_layout Standard
364 Set type of port1.
365  Valid values are:
366 \end_layout
368 \begin_layout Itemize
369 none: No device connected
370 \end_layout
372 \begin_layout Itemize
373 gamepad: One gamepad (the default)
374 \end_layout
376 \begin_layout Itemize
377 multitap: Four gamepads (warning: makes most games refuse to start)
378 \end_layout
380 \begin_layout Itemize
381 mouse: Mouse.
382 \end_layout
384 \begin_layout Subsubsection
385 --port2=<type>
386 \end_layout
388 \begin_layout Standard
389 Set type of port2.
390  Valid values are:
391 \end_layout
393 \begin_layout Itemize
394 none: No device connected (the default)
395 \end_layout
397 \begin_layout Itemize
398 gamepad: One gamepad
399 \end_layout
401 \begin_layout Itemize
402 multitap: Four gamepads.
403 \end_layout
405 \begin_layout Itemize
406 mouse: Mouse
407 \end_layout
409 \begin_layout Itemize
410 superscope: Super Scope
411 \end_layout
413 \begin_layout Itemize
414 justifier: One justifier
415 \end_layout
417 \begin_layout Itemize
418 justifiers: Two justifiers
419 \end_layout
421 \begin_layout Subsubsection
422 --gamename=<name>
423 \end_layout
425 \begin_layout Standard
426 Set the name of game to <name>
427 \end_layout
429 \begin_layout Subsubsection
430 --author=<name>
431 \end_layout
433 \begin_layout Standard
434 Add author with full name of <name> (no nickname).
435 \end_layout
437 \begin_layout Subsubsection
438 --author=|<name>
439 \end_layout
441 \begin_layout Standard
442 Add author with nickname of <name> (no full name).
443 \end_layout
445 \begin_layout Subsubsection
446 --author=<fullname>|<nickname>
447 \end_layout
449 \begin_layout Standard
450 Add author with full name of <fullname> and nickname of <nickname>.
451 \end_layout
453 \begin_layout Subsection
454 <filename>
455 \end_layout
457 \begin_layout Standard
458 If filename is specified on command line, it is loaded as initial state
459  (instead of constructing one).
460  Mandatory for lsnes-avidump.exe and movieinfo.exe.
461 \end_layout
463 \begin_layout Subsection
464 Misc.
465  options
466 \end_layout
468 \begin_layout Subsubsection
469 --run=<file> (lsnes.exe only)
470 \end_layout
472 \begin_layout Standard
473 After running main RC file, run this file.
474  If multiple are specified, these execute in order specified.
475 \end_layout
477 \begin_layout Subsection
478 dump options (lsnes-avidump.exe only)
479 \end_layout
481 \begin_layout Subsubsection
482 --prefix=<prefix>
483 \end_layout
485 \begin_layout Standard
486 Set dump prefix.
487  Default is 
488 \begin_inset Quotes eld
489 \end_inset
491 avidump
492 \begin_inset Quotes erd
493 \end_inset
496 \end_layout
498 \begin_layout Subsubsection
499 --level=<level>
500 \end_layout
502 \begin_layout Standard
503 Set compression level (0-18).
504  Default is 7.
505 \end_layout
507 \begin_layout Subsubsection
508 --length=<length>
509 \end_layout
511 \begin_layout Standard
512 Set number of frames to dump.
513  Mandatory.
514 \end_layout
516 \begin_layout Subsubsection
517 --lua=<script>
518 \end_layout
520 \begin_layout Standard
521 Run specified lua script (lsnes-avidump.exe does not have initialization
522  files).
523 \end_layout
525 \begin_layout Section
526 Startup file lsnes.rc
527 \end_layout
529 \begin_layout Standard
530 Upon startup, lsnes (lsnes.exe only) executes file lsnes.rc as commands.
531  This file is located in:
532 \end_layout
534 \begin_layout Itemize
535 Windows: %APPDATA%
536 \backslash
537 lsnes
538 \backslash
539 lsnes.rc (if %APPDATA% exists)
540 \end_layout
542 \begin_layout Itemize
543 Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME exists)
544 \end_layout
546 \begin_layout Itemize
547 Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
548 \end_layout
550 \begin_layout Itemize
551 All: ./lsnes.rc (fallback default).
552 \end_layout
554 \begin_layout Standard
555 If leading directories do not exist, attempt to create them is made.
556 \end_layout
558 \begin_layout Section
559 Game internal commands
560 \end_layout
562 \begin_layout Itemize
563 Commands beginning with '*' invoke the corresponding command without alias
564  expansion.
565 \end_layout
567 \begin_layout Itemize
568 If command starts with '+', the command is executed as-is when button is
569  pressed, and when button is released, it is executed with '+' replaced
570  by '-'.
571 \end_layout
573 \begin_layout Subsection
574 Settings:
575 \end_layout
577 \begin_layout Standard
578 Settings control various aspects of emulator behaviour.
579 \end_layout
581 \begin_layout Subsubsection
582 set-setting <setting> <value>
583 \end_layout
585 \begin_layout Standard
586 Sets setting <setting> to value <value> (may be empty).
587 \end_layout
589 \begin_layout Subsubsection
590 unset-setting <setting>
591 \end_layout
593 \begin_layout Standard
594 Try to unset setting <setting> (not all settings can be unset).
595 \end_layout
597 \begin_layout Subsubsection
598 get-setting <setting>
599 \end_layout
601 \begin_layout Standard
602 Read value of setting <setting>
603 \end_layout
605 \begin_layout Subsubsection
606 print-settings
607 \end_layout
609 \begin_layout Standard
610 Print names and values of all settings.
611 \end_layout
613 \begin_layout Subsection
614 Keybindings
615 \end_layout
617 \begin_layout Standard
618 Keybindings bind commands or aliases to keys (or pseudo-keys).
620 \end_layout
622 \begin_layout Standard
623 Notes:
624 \end_layout
626 \begin_layout Itemize
627 Do not bind edge active (+/-) commands to keys with modifiers, that won't
628  work right!
629 \end_layout
631 \begin_layout Itemize
632 Names of keys and modifiers are platform-dependent.
633 \end_layout
635 \begin_layout Itemize
636 Be careful before binding pseudo-keys (such as joystick axes, buttons or
637  hats) with modifiers.
638  That may or may not work right.
639 \end_layout
641 \begin_layout Subsubsection
642 bind-key [<mod>/<modmask>] <key> <command>
643 \end_layout
645 \begin_layout Standard
646 Bind <command> to key <key> (activating if modifiers in <modmask> (comma-seperat
647 ed list) are set as <mod> (comma-seperated list).
648 \end_layout
650 \begin_layout Standard
651 The names of keys and modifiers are platform-dependent.
652 \end_layout
654 \begin_layout Subsubsection
655 unbind-key [<mod>/<modmask>] <key>
656 \end_layout
658 \begin_layout Standard
659 Unbind command from <key> (with specified <mod> and <modmask>).
660 \end_layout
662 \begin_layout Subsubsection
663 print-keybindings
664 \end_layout
666 \begin_layout Standard
667 Print all key bindings in effect.
668 \end_layout
670 \begin_layout Subsection
671 Aliases
672 \end_layout
674 \begin_layout Standard
675 Aliases bind command to sequence of commands.
676  After alias has been defined, it replaces the command it shadows.
677 \end_layout
679 \begin_layout Standard
680 Notes:
681 \end_layout
683 \begin_layout Itemize
684 You can't alias command to itself.
685 \end_layout
687 \begin_layout Itemize
688 Aliases starting with +/- are edge active just like ordinary commands starting
689  with +/-.
690 \end_layout
692 \begin_layout Itemize
693 One command can be aliased to multiple commands.
694 \end_layout
696 \begin_layout Subsubsection
697 alias-command <command> <expansion>
698 \end_layout
700 \begin_layout Standard
701 Append <expansion> to alias <command>.
702  If alias does not already exist, it is created.
703 \end_layout
705 \begin_layout Subsubsection
706 unalias-command <command>
707 \end_layout
709 \begin_layout Standard
710 Clear alias expansion for <command>.
711 \end_layout
713 \begin_layout Subsubsection
714 print-aliases
715 \end_layout
717 \begin_layout Standard
718 Print all aliases and their expansions in effect.
719 \end_layout
721 \begin_layout Subsection
722 run-script <script>
723 \end_layout
725 \begin_layout Standard
726 Run <script> as if commands were entered on the command line.
727 \end_layout
729 \begin_layout Subsection
730 AVI Video dumping
731 \end_layout
733 \begin_layout Standard
734 Following commands control AVI video dumping:
735 \end_layout
737 \begin_layout Subsubsection
738 dump-avi <level> <prefix>
739 \end_layout
741 \begin_layout Standard
742 Dump AVI video to prefix <prefix> at level <level> (0-18).
743  Notes:
744 \end_layout
746 \begin_layout Itemize
747 The codec is Camstudio Codec in gzip mode.
748 \end_layout
750 \begin_layout Itemize
751 Encoder and muxer are internal, available on all platforms.
752 \end_layout
754 \begin_layout Itemize
755 Audio enable/disable and framerate has no effect.
756 \end_layout
758 \begin_layout Itemize
759 Levels 10-18 are not compatible with AVISource.
760 \end_layout
762 \begin_layout Itemize
763 Recomended level is 7 if decoded by AVISource.
764 \end_layout
766 \begin_layout Itemize
767 Recomended level is 16 if decoded by ffmpeg, mencoder or FFMpegSource.
768 \end_layout
770 \begin_layout Itemize
771 Dumps of low-res PAL games are 256x239 (with all the consequences odd height
772  carries).
773 \end_layout
775 \begin_layout Itemize
776 The audio dumped to .avi is low-quality version.
777  The high-quality version is dumped to .sox file.
778 \end_layout
780 \begin_layout Subsubsection
781 end-avi
782 \end_layout
784 \begin_layout Standard
785 End current AVI video dump (closing the emulator also closes the dump).
786 \end_layout
788 \begin_layout Subsection
789 Memory manipulation
790 \end_layout
792 \begin_layout Standard
793 <address> may be decimal or hexadecimal (prefixed with '0x').
794  <value> can be hexadecimal (prefixed with '0x'), unsigned or signed (prefixed
795  with '-') decimal.
796 \end_layout
798 \begin_layout Standard
799 The available element <sizes> are:
800 \end_layout
802 \begin_layout Itemize
803 byte: 1 byte
804 \end_layout
806 \begin_layout Itemize
807 word: 2 bytes
808 \end_layout
810 \begin_layout Itemize
811 dword: 4 bytes
812 \end_layout
814 \begin_layout Itemize
815 qword: 8 bytes
816 \end_layout
818 \begin_layout Standard
819 When reading RAM and ROM, multi-byte reads/writes are big-endian.
820  When dealing with DSP memory, multi-byte reads/writes are native-endian
821  (do not use operand sizes exceeding DSP bitness, except dword is OK for
822  24-bit memory).
823 \end_layout
825 \begin_layout Subsubsection
826 read-<size> <address>
827 \end_layout
829 \begin_layout Standard
830 Read the value of byte in <address>.
831 \end_layout
833 \begin_layout Subsubsection
834 read-s<size> <address>
835 \end_layout
837 \begin_layout Standard
838 Read the value of signed byte in <address>.
839 \end_layout
841 \begin_layout Subsubsection
842 write-<size> <address> <value>
843 \end_layout
845 \begin_layout Standard
846 Write <value> to byte in address <address>.
847 \end_layout
849 \begin_layout Subsubsection
850 search-memory reset
851 \end_layout
853 \begin_layout Standard
854 Reset the memory search
855 \end_layout
857 \begin_layout Subsubsection
858 search-memory count
859 \end_layout
861 \begin_layout Standard
862 Print number of candidates remaining
863 \end_layout
865 \begin_layout Subsubsection
866 search-memory print
867 \end_layout
869 \begin_layout Standard
870 Print all candidates remaining
871 \end_layout
873 \begin_layout Subsubsection
874 search-memory <usflag><sizeflag><op>
875 \end_layout
877 \begin_layout Standard
878 Searches memory for addresses satisfying criteria.
879 \end_layout
881 \begin_layout Standard
882 <usflag> can be:
883 \end_layout
885 \begin_layout Itemize
886 u: unsigned
887 \end_layout
889 \begin_layout Itemize
890 s: signed
891 \end_layout
893 \begin_layout Standard
894 <sizeflag> can be:
895 \end_layout
897 \begin_layout Itemize
898 b: byte
899 \end_layout
901 \begin_layout Itemize
902 w: word
903 \end_layout
905 \begin_layout Itemize
906 d: dword
907 \end_layout
909 \begin_layout Itemize
910 q: qword
911 \end_layout
913 \begin_layout Standard
914 <op> can be:
915 \end_layout
917 \begin_layout Itemize
918 lt: < previous value.
919 \end_layout
921 \begin_layout Itemize
922 le: <= previous value.
923 \end_layout
925 \begin_layout Itemize
926 eq: = previous value.
927 \end_layout
929 \begin_layout Itemize
930 ne: != previous value.
931 \end_layout
933 \begin_layout Itemize
934 ge: >= previous value.
935 \end_layout
937 \begin_layout Itemize
938 gt: > previous value.
939 \end_layout
941 \begin_layout Subsubsection
942 search-memory <sizeflag> <value>
943 \end_layout
945 \begin_layout Standard
946 Searches for addresses that currently have value <value>.
947  <sizeflag> is as in previous command.
948 \end_layout
950 \begin_layout Subsection
951 Main commands
952 \end_layout
954 \begin_layout Standard
955 These commands are not available in lsnesrc, but are available after ROM
956  has been loaded.
957 \end_layout
959 \begin_layout Subsubsection
960 quit-emulator [/y]
961 \end_layout
963 \begin_layout Standard
964 Quits the emulator (asking for confirmation).
965  If /y is given, no confirmation is asked.
966 \end_layout
968 \begin_layout Subsubsection
969 pause-emulator
970 \end_layout
972 \begin_layout Standard
973 Toggle paused/unpaused
974 \end_layout
976 \begin_layout Subsubsection
977 +advance-frame
978 \end_layout
980 \begin_layout Standard
981 Advance frame.
982  If the button is still held after configurable timeout expires, game unpauses
983  for the duration frame advance is held.
984 \end_layout
986 \begin_layout Subsubsection
987 +advance-poll
988 \end_layout
990 \begin_layout Standard
991 Advance subframe.
992  If the button is still held after configurable timeout expires, game unpauses
993  for the duration frame advance is held.
994 \end_layout
996 \begin_layout Subsubsection
997 advance-skiplag
998 \end_layout
1000 \begin_layout Standard
1001 Skip to first poll in frame after current.
1002 \end_layout
1004 \begin_layout Subsubsection
1005 reset
1006 \end_layout
1008 \begin_layout Standard
1009 Reset the SNES after this frame.
1010 \end_layout
1012 \begin_layout Subsubsection
1013 load-state <filename>
1014 \end_layout
1016 \begin_layout Standard
1017 Load savestate <filename> in readwrite mode.
1018 \end_layout
1020 \begin_layout Subsubsection
1021 load-readonly <filename>
1022 \end_layout
1024 \begin_layout Standard
1025 Load savestate <filename> in readonly mode.
1026 \end_layout
1028 \begin_layout Subsubsection
1029 load-preserve <filename>
1030 \end_layout
1032 \begin_layout Standard
1033 Load savestate <filename> in readonly mode, preserving current events.
1034 \end_layout
1036 \begin_layout Subsubsection
1037 load-movie <filename>
1038 \end_layout
1040 \begin_layout Standard
1041 Load savestate <filename>, ignoring save part in readonly mode.
1042 \end_layout
1044 \begin_layout Subsubsection
1045 save-state <filename>
1046 \end_layout
1048 \begin_layout Standard
1049 Save system state to <filename> as soon as possible.
1050 \end_layout
1052 \begin_layout Subsubsection
1053 save-movie <filename>
1054 \end_layout
1056 \begin_layout Standard
1057 Save movie to <filename>.
1058 \end_layout
1060 \begin_layout Subsubsection
1061 set-rwmode
1062 \end_layout
1064 \begin_layout Standard
1065 Set read-write mode.
1066 \end_layout
1068 \begin_layout Subsubsection
1069 set-gamename <name>
1070 \end_layout
1072 \begin_layout Standard
1073 Set name of the game to <name>
1074 \end_layout
1076 \begin_layout Subsubsection
1077 get-gamename
1078 \end_layout
1080 \begin_layout Standard
1081 Print the name of the game.
1082 \end_layout
1084 \begin_layout Subsubsection
1085 add-author <author>
1086 \end_layout
1088 \begin_layout Standard
1089 Adds new author <author>.
1090  If <author> does not contain '|' it is full name.
1091  If it contains '|', '|' splits the full name and nickname.
1092 \end_layout
1094 \begin_layout Subsubsection
1095 edit-author <num> <author>
1096 \end_layout
1098 \begin_layout Standard
1099 Edit the author in slot <num> (0-based) to be <author> (see add-author for
1100  format)
1101 \end_layout
1103 \begin_layout Subsubsection
1104 remove-author <num>
1105 \end_layout
1107 \begin_layout Standard
1108 Remove author in slot <num>
1109 \end_layout
1111 \begin_layout Subsubsection
1112 print-authors
1113 \end_layout
1115 \begin_layout Standard
1116 Print authors.
1117 \end_layout
1119 \begin_layout Subsubsection
1120 test-1, test-2, test-3
1121 \end_layout
1123 \begin_layout Standard
1124 Internal test commands.
1125  Don't use.
1126 \end_layout
1128 \begin_layout Subsubsection
1129 take-screenshot <filename>
1130 \end_layout
1132 \begin_layout Standard
1133 Save screenshot to <filename>.
1134 \end_layout
1136 \begin_layout Subsubsection
1137 +controller<num><button>
1138 \end_layout
1140 \begin_layout Standard
1141 Press button <button> on controller <num> (1-8).
1142  The following button names are known:
1143 \end_layout
1145 \begin_layout Itemize
1146 left
1147 \end_layout
1149 \begin_layout Itemize
1150 right
1151 \end_layout
1153 \begin_layout Itemize
1155 \end_layout
1157 \begin_layout Itemize
1158 down
1159 \end_layout
1161 \begin_layout Itemize
1163 \end_layout
1165 \begin_layout Itemize
1167 \end_layout
1169 \begin_layout Itemize
1171 \end_layout
1173 \begin_layout Itemize
1175 \end_layout
1177 \begin_layout Itemize
1179 \end_layout
1181 \begin_layout Itemize
1183 \end_layout
1185 \begin_layout Itemize
1186 select
1187 \end_layout
1189 \begin_layout Itemize
1190 start
1191 \end_layout
1193 \begin_layout Itemize
1194 trigger
1195 \end_layout
1197 \begin_layout Itemize
1198 cursor
1199 \end_layout
1201 \begin_layout Itemize
1202 pause
1203 \end_layout
1205 \begin_layout Itemize
1206 turbo
1207 \end_layout
1209 \begin_layout Subsubsection
1210 controllerh<num><button>
1211 \end_layout
1213 \begin_layout Standard
1214 Hold/unhold button <button> on controller <num> (1-8).
1215  See +controller for button names.
1216 \end_layout
1218 \begin_layout Subsubsection
1219 autofire (<pattern>|-)...
1220 \end_layout
1222 \begin_layout Standard
1223 Set autofire pattern.
1224  Each parameter is comma-separated list of button names (in form of 1start,
1225  1A, 2B, etc..) to hold on that frame.
1226  After reaching the end of pattern, the pattern restarts from the beginning.
1227 \end_layout
1229 \begin_layout Subsubsection
1230 repaint
1231 \end_layout
1233 \begin_layout Standard
1234 Force a repaint.
1235 \end_layout
1237 \begin_layout Subsection
1238 Save jukebox
1239 \end_layout
1241 \begin_layout Subsubsection
1242 cycle-jukebox-backward
1243 \end_layout
1245 \begin_layout Standard
1246 Cycle save jukebox backwards.
1247 \end_layout
1249 \begin_layout Subsubsection
1250 cycle-jukebox-forward
1251 \end_layout
1253 \begin_layout Standard
1254 Cycle save jukebox forwards
1255 \end_layout
1257 \begin_layout Subsubsection
1258 add-jukebox-save <filename>
1259 \end_layout
1261 \begin_layout Standard
1262 Add <filename> to jukebox saves.
1263 \end_layout
1265 \begin_layout Subsubsection
1266 load-jukebox
1267 \end_layout
1269 \begin_layout Standard
1270 Do R/W load from jukebox.
1271 \end_layout
1273 \begin_layout Subsubsection
1274 save-jukebox
1275 \end_layout
1277 \begin_layout Standard
1278 Do state save to jukebox.
1279 \end_layout
1281 \begin_layout Subsection
1283 \end_layout
1285 \begin_layout Standard
1286 Only available if lua support is compiled in.
1287 \end_layout
1289 \begin_layout Subsubsection
1290 eval-lua <luacode>
1291 \end_layout
1293 \begin_layout Standard
1294 Run Lua code <luacode> using built-in Lua interpretter.
1295 \end_layout
1297 \begin_layout Subsubsection
1298 run-lua <script>
1299 \end_layout
1301 \begin_layout Standard
1302 Run specified lua file using built-in Lua interpretter.
1303 \end_layout
1305 \begin_layout Subsection
1306 Memory watch
1307 \end_layout
1309 \begin_layout Subsubsection
1310 add-watch <name> <expression>
1311 \end_layout
1313 \begin_layout Standard
1314 Adds new watch (or modifies old one).
1315 \end_layout
1317 \begin_layout Subsubsection
1318 remove-watch <name>
1319 \end_layout
1321 \begin_layout Standard
1322 Remove a watch.
1323 \end_layout
1325 \begin_layout Subsection
1326 SDL Platform commands
1327 \end_layout
1329 \begin_layout Standard
1330 The following are valid on SDL platform.
1331 \end_layout
1333 \begin_layout Subsubsection
1334 enable-sound on
1335 \end_layout
1337 \begin_layout Standard
1338 Enable sounds in GUI (has no effect on video dumping).
1339 \end_layout
1341 \begin_layout Subsubsection
1342 enable-sound off
1343 \end_layout
1345 \begin_layout Standard
1346 Disable sounds in GUI (has no effect on video dumping).
1347 \end_layout
1349 \begin_layout Subsubsection
1350 identify-key
1351 \end_layout
1353 \begin_layout Standard
1354 Asks to press a key and then identifies that (pseudo-)key.
1355 \end_layout
1357 \begin_layout Subsubsection
1358 toggle-console
1359 \end_layout
1361 \begin_layout Standard
1362 Toggle between windowed/fullscreen console.
1363 \end_layout
1365 \begin_layout Subsubsection
1366 scroll-fullup
1367 \end_layout
1369 \begin_layout Standard
1370 Scroll messages window as far back as it goes.
1371 \end_layout
1373 \begin_layout Subsubsection
1374 scroll-fulldown
1375 \end_layout
1377 \begin_layout Standard
1378 Scroll messages window as far forward as it goes.
1379 \end_layout
1381 \begin_layout Subsubsection
1382 scroll-up
1383 \end_layout
1385 \begin_layout Standard
1386 Scroll messages window back one screenful.
1387 \end_layout
1389 \begin_layout Subsubsection
1390 scroll-down
1391 \end_layout
1393 \begin_layout Standard
1394 Scroll messages window forward one screenful.
1395 \end_layout
1397 \begin_layout Subsubsection
1398 axismode <axis> <mode>
1399 \end_layout
1401 \begin_layout Standard
1402 Set joystick axis mode.
1403  <axis> is of form 
1404 \begin_inset Quotes eld
1405 \end_inset
1407 joystick<num>axis<axis>
1408 \begin_inset Quotes erd
1409 \end_inset
1411 , e.g.
1413 \begin_inset Quotes eld
1414 \end_inset
1416 joystick0axis5
1417 \begin_inset Quotes erd
1418 \end_inset
1421  Mode is one of:
1422 \end_layout
1424 \begin_layout Itemize
1425 axis: Normal axis mode
1426 \end_layout
1428 \begin_layout Itemize
1429 axis_inverse: Inverse axis mode.
1430 \end_layout
1432 \begin_layout Itemize
1433 pressure_0m: Pressure sensitive.
1434  Released at 0, pressed at full negative.
1435 \end_layout
1437 \begin_layout Itemize
1438 pressure_0p: Pressure sensitive.
1439  Released at 0, pressed at full positive.
1440 \end_layout
1442 \begin_layout Itemize
1443 pressure_m0: Pressure sensitive.
1444  Released at full negative, pressed at 0.
1445 \end_layout
1447 \begin_layout Itemize
1448 pressure_mp: Pressure sensitive.
1449  Released at full negative, pressed at full positive.
1450  E.g.
1451  XBox360 Pad axes 2 and 5.
1452 \end_layout
1454 \begin_layout Itemize
1455 pressure_p0: Pressure sensitive.
1456  Released at full positive, pressed at 0.
1457 \end_layout
1459 \begin_layout Itemize
1460 pressure_pm: Pressure sensitive.
1461  Released at full positive, pressed at full negative.
1462 \end_layout
1464 \begin_layout Itemize
1465 disabled: Disable the axis.
1466  On PS3 controller, axes 8-19 should be disabled since those controls are
1467  digital buttons as well.
1468 \end_layout
1470 \begin_layout Section
1471 Settings
1472 \end_layout
1474 \begin_layout Subsection
1475 Core settings
1476 \end_layout
1478 \begin_layout Subsubsection
1479 firmwarepath
1480 \end_layout
1482 \begin_layout Standard
1483 Set where bsnes looks for firmware files.
1484  Default is 
1485 \begin_inset Quotes eld
1486 \end_inset
1489 \begin_inset Quotes erd
1490 \end_inset
1493 \end_layout
1495 \begin_layout Subsubsection
1496 targetfps
1497 \end_layout
1499 \begin_layout Standard
1500 Set the target fps.
1501  Numeric, range is 0.001 to 
1502 \begin_inset Quotes eld
1503 \end_inset
1505 infinite
1506 \begin_inset Quotes erd
1507 \end_inset
1510  Default is native framerate.
1511 \end_layout
1513 \begin_layout Subsubsection
1514 savecompression
1515 \end_layout
1517 \begin_layout Standard
1518 Set save compression level (integer 0-9).
1519  Default is 7 (0 is no compression).
1520 \end_layout
1522 \begin_layout Subsubsection
1523 advance-timeout
1524 \end_layout
1526 \begin_layout Standard
1527 Set the frame advance timeout in milliseconds.
1528  Numeric integer, range is 0-999999999.
1529  Default is 500.
1530 \end_layout
1532 \begin_layout Subsection
1533 AVI dumper settings
1534 \end_layout
1536 \begin_layout Subsubsection
1537 avi-large
1538 \end_layout
1540 \begin_layout Standard
1541 AVI dumper: Always dump at 512x448 or 512x478 regardless of what the console
1542  outputs.
1543 \end_layout
1545 \begin_layout Subsubsection
1546 avi-left-border
1547 \end_layout
1549 \begin_layout Standard
1550 AVI dumper: Set the default left border thickness (unless lua overrides)
1551  for dumps.
1552  Range 0-8191.
1553  Default is 0.
1554 \end_layout
1556 \begin_layout Subsubsection
1557 avi-right-border
1558 \end_layout
1560 \begin_layout Standard
1561 AVI dumper: Set the default right border thickness (unless lua overrides)
1562  for dumps.
1563  Range 0-8191.
1564  Default is 0.
1565 \end_layout
1567 \begin_layout Subsubsection
1568 avi-top-border
1569 \end_layout
1571 \begin_layout Standard
1572 AVI dumper: Set the default top border thickness (unless lua overrides)
1573  for dumps.
1574  Range 0-8191.
1575  Default is 0.
1576 \end_layout
1578 \begin_layout Subsubsection
1579 avi-bottom-border
1580 \end_layout
1582 \begin_layout Standard
1583 AVI dumper: Set the default bottom border thickness (unless lua overrides)
1584  for dumps.
1585  Range 0-8191.
1586  Default is 0.
1587 \end_layout
1589 \begin_layout Subsubsection
1590 avi-maxframes
1591 \end_layout
1593 \begin_layout Standard
1594 AVI dumper: Maximum number of frames per dump segment (0 => unlimited).
1595  Range 0-999999999.
1596  Default is 0.
1597 \end_layout
1599 \begin_layout Subsection
1600 SDL platform settings
1601 \end_layout
1603 \begin_layout Subsubsection
1604 autorepeat-first-delay
1605 \end_layout
1607 \begin_layout Standard
1608 Sets the delay for first character in typematic autorepeat.
1609 \end_layout
1611 \begin_layout Subsubsection
1612 autorepeat-subsequent-delay
1613 \end_layout
1615 \begin_layout Standard
1616 Sets the delay for subsequent characters in typematic autorepeat.
1617 \end_layout
1619 \begin_layout Section
1620 Lua functions
1621 \end_layout
1623 \begin_layout Subsection
1624 Core (in main table)
1625 \end_layout
1627 \begin_layout Subsubsection
1628 print
1629 \end_layout
1631 \begin_layout Standard
1632 Print line to message console.
1633 \end_layout
1635 \begin_layout Subsubsection
1636 exec(string command)
1637 \end_layout
1639 \begin_layout Standard
1640 Run command as it was entered on the command line
1641 \end_layout
1643 \begin_layout Subsection
1644 Table bit:
1645 \end_layout
1647 \begin_layout Standard
1648 Bitwise logical functions and related.
1649 \end_layout
1651 \begin_layout Subsubsection
1652 none(number...) / bnot(number...)
1653 \end_layout
1655 \begin_layout Standard
1656 48-bit bitwise NOT / NONE function (set bits that are set in none of the
1657  arguments).
1658 \end_layout
1660 \begin_layout Subsubsection
1661 any(number...) / bor(number...)
1662 \end_layout
1664 \begin_layout Standard
1665 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
1666 \end_layout
1668 \begin_layout Subsubsection
1669 all(number...) / band(number...)
1670 \end_layout
1672 \begin_layout Standard
1673 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
1675 \end_layout
1677 \begin_layout Subsubsection
1678 parity(number...) / bxor(number...)
1679 \end_layout
1681 \begin_layout Standard
1682 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
1683  of the arguments).
1684 \end_layout
1686 \begin_layout Subsubsection
1687 lrotate(number base[, number amount[, number bits]])
1688 \end_layout
1690 \begin_layout Standard
1691 Rotate bits-bit (max 48, default 48) number left by amount (default 1) places.
1692 \end_layout
1694 \begin_layout Subsubsection
1695 rrotate(number base[, number amount[, number bits]])
1696 \end_layout
1698 \begin_layout Standard
1699 Rotate bits-bit (max 48, default 48) number right by amount (default 1)
1700  places.
1701 \end_layout
1703 \begin_layout Subsubsection
1704 lshift(number base[, number amount[, number bits]])
1705 \end_layout
1707 \begin_layout Standard
1708 Shift bits-bit (max 48, default 48) number left by amount (default 1) places.
1709  The new bits are filled with zeroes.
1710 \end_layout
1712 \begin_layout Subsubsection
1713 lrshift(number base[, number amount[, number bits]])
1714 \end_layout
1716 \begin_layout Standard
1717 Shift bits-bit (max 48, default 48) number logically right by amount (default
1718  1) places.
1719  The new bits are filled with zeroes.
1720 \end_layout
1722 \begin_layout Subsubsection
1723 arshift(number base[, number amount[, number bits]])
1724 \end_layout
1726 \begin_layout Standard
1727 Shift bits-bit (max 48, default 48) number arithmetically right by amount
1728  (default 1) places.
1729  The new bits are shifted in with copy of the high bit.
1730 \end_layout
1732 \begin_layout Subsection
1733 Table gui:
1734 \end_layout
1736 \begin_layout Standard
1737 Most of these functions can only be called in on_paint and on_video callbacks.
1738  Exceptions are noted.
1739 \end_layout
1741 \begin_layout Subsubsection
1742 gui.resolution()
1743 \end_layout
1745 \begin_layout Standard
1746 Returns 5-tuple (hresolution, vresolution, rshift, gshift, bshift).
1747 \end_layout
1749 \begin_layout Subsubsection
1750 gui.<class>_gap(number gap)
1751 \end_layout
1753 \begin_layout Standard
1754 Set the <class> (left, right, top, bottom) gap to specified value (max gap
1755  is 8191).
1756 \end_layout
1758 \begin_layout Subsubsection
1759 gui.text(number x, number y, string text[, number fgc[, number fga[, number
1760  bgc[, number bga]]]])
1761 \end_layout
1763 \begin_layout Standard
1764 Draw text on the GUI.
1765  Font size is 8 (or 16) by 16.
1766  Notes:
1767 \end_layout
1769 \begin_layout Itemize
1770 Coordinate origin is at top-left of the game area.
1771  Left and top gaps have negative coordinates.
1772 \end_layout
1774 \begin_layout Itemize
1775 Use gui.resolution() to discover how to layout colors.
1776 \end_layout
1778 \begin_layout Itemize
1779 Alpha range is 0(transparent)-256(opaque).
1780 \end_layout
1782 \begin_layout Itemize
1783 Only available in on_paint() and on_video() callbacks.
1784 \end_layout
1786 \begin_layout Subsubsection
1787 gui.repaint()
1788 \end_layout
1790 \begin_layout Standard
1791 Request on_repaint() to happen as soon as possible.
1792  Can be used anywhere.
1793 \end_layout
1795 \begin_layout Subsubsection
1796 gui.subframe_update(boolean on)
1797 \end_layout
1799 \begin_layout Standard
1800 Request subframe updates (calling on_paint() on subframes) to happen (on=true)
1801  or not happen (on=false).
1802  Can be used anywhere.
1803 \end_layout
1805 \begin_layout Subsection
1806 table input
1807 \end_layout
1809 \begin_layout Standard
1810 Input handling.
1811  Only available in on_input callback.
1812 \end_layout
1814 \begin_layout Subsection
1815 get(number controller, number index)
1816 \end_layout
1818 \begin_layout Standard
1819 Read the specified index (0-11) from specified controller (0-7).
1820  Notes:
1821 \end_layout
1823 \begin_layout Itemize
1824 Uses physical controller numbering.
1825  Gamepad in port 2 is controller 4, not 1!
1826 \end_layout
1828 \begin_layout Subsection
1829 set(number controller, number index, number value)
1830 \end_layout
1832 \begin_layout Standard
1833 Write the specified index (0-11) from specified controller (0-7), storing
1834  value.
1835  Notes:
1836 \end_layout
1838 \begin_layout Itemize
1839 Uses physical controller numbering.
1840  Gamepad in port 2 is controller 4, not 1!
1841 \end_layout
1843 \begin_layout Subsection
1844 reset([number cycles])
1845 \end_layout
1847 \begin_layout Standard
1848 Execute reset.
1849  If cycles is greater than zero, do delayed reset.
1850  0 (or no value) causes immediate reset.
1851 \end_layout
1853 \begin_layout Itemize
1854 Only available with subframe flag false.
1855 \end_layout
1857 \begin_layout Subsection
1858 Table hostmemory
1859 \end_layout
1861 \begin_layout Standard
1862 Host memory handling (extra memory saved to savestates).
1863  Host memory starts empty.
1864 \end_layout
1866 \begin_layout Subsubsection
1867 read(number address)
1868 \end_layout
1870 \begin_layout Standard
1871 Reads hostmemory slot address.
1872  Slot numbers out of range return false instead of numeric.
1873 \end_layout
1875 \begin_layout Subsubsection
1876 write(number address, number value)
1877 \end_layout
1879 \begin_layout Standard
1880 Writes hostmemory slot with 0-255.
1881  Slot numbers out of range cause extension of host memory slot space.
1882 \end_layout
1884 \begin_layout Subsection
1885 Table movie
1886 \end_layout
1888 \begin_layout Standard
1889 Movie handling
1890 \end_layout
1892 \begin_layout Subsubsection
1893 movie.currentframe()
1894 \end_layout
1896 \begin_layout Standard
1897 Return number of current frame.
1898 \end_layout
1900 \begin_layout Subsubsection
1901 movie.framecount()
1902 \end_layout
1904 \begin_layout Standard
1905 Return number of frames in movie.
1906 \end_layout
1908 \begin_layout Subsubsection
1909 movie.readonly()
1910 \end_layout
1912 \begin_layout Standard
1913 Return true if in readonly mode, false if in readwrite.
1914 \end_layout
1916 \begin_layout Subsubsection
1917 movie.set_readwrite()
1918 \end_layout
1920 \begin_layout Standard
1921 Set readwrite mode (does not cause on_readwrite callback).
1922 \end_layout
1924 \begin_layout Subsubsection
1925 movie.frame_subframes(number frame)
1926 \end_layout
1928 \begin_layout Standard
1929 Count number of subframes in specified frame (frame numbers are 1-based)
1930  and return that.
1931 \end_layout
1933 \begin_layout Subsubsection
1934 movie.read_subframe(number frame, number subframe)
1935 \end_layout
1937 \begin_layout Standard
1938 Read specifed subframe in specified frame and return data as array (100
1939  elements, numbered 0-99 currently).
1940 \end_layout
1942 \begin_layout Subsection
1943 Table settings
1944 \end_layout
1946 \begin_layout Standard
1947 Routines for settings manipulation
1948 \end_layout
1950 \begin_layout Subsubsection
1951 get(string name)
1952 \end_layout
1954 \begin_layout Standard
1955 Get value of setting.
1956  If setting is blank, returns false.
1957  If setting value can't be obtained, returns (nil, error message).
1958 \end_layout
1960 \begin_layout Subsubsection
1961 set(string name, string value)
1962 \end_layout
1964 \begin_layout Standard
1965 Set value of setting.
1966  If setting can't be set, returns (nil, error message).
1967 \end_layout
1969 \begin_layout Subsubsection
1970 is_set(string name)
1971 \end_layout
1973 \begin_layout Standard
1974 Returns if setting is set.
1975  If setting does not exist, returns (nil, error message).
1976 \end_layout
1978 \begin_layout Subsubsection
1979 blank(string name)
1980 \end_layout
1982 \begin_layout Standard
1983 Blanks a setting and returns true.
1984  If setting can't be blanked, returns (nil, error message).
1985 \end_layout
1987 \begin_layout Subsection
1988 Callbacks
1989 \end_layout
1991 \begin_layout Standard
1992 Various callbacks to Lua that can occur.
1993 \end_layout
1995 \begin_layout Subsubsection
1996 Callback: on_paint()
1997 \end_layout
1999 \begin_layout Standard
2000 Called when screen is being painted.
2001  Any gui.* calls requiring graphic context draw on the screen.
2002 \end_layout
2004 \begin_layout Subsubsection
2005 Callback: on_video()
2006 \end_layout
2008 \begin_layout Standard
2009 Called when video dump frame is being painted.
2010  Any gui.* calls requiring graphic context draw on the video.
2011 \end_layout
2013 \begin_layout Subsubsection
2014 Callback: on_startup()
2015 \end_layout
2017 \begin_layout Standard
2018 Called when the emulator is starting (lsnes.rc and --run files has been run).
2019 \end_layout
2021 \begin_layout Subsubsection
2022 Callback: on_pre_load(string name)
2023 \end_layout
2025 \begin_layout Standard
2026 Called just before savestate/movie load occurs (note: loads are always delayed,
2027  so this occurs even when load was initiated by lua).
2028 \end_layout
2030 \begin_layout Subsubsection
2031 Callback: on_err_load(string name)
2032 \end_layout
2034 \begin_layout Standard
2035 Called if loadstate goes wrong.
2036 \end_layout
2038 \begin_layout Subsubsection
2039 Callback: on_post_load(string name, boolean was_savestate)
2040 \end_layout
2042 \begin_layout Standard
2043 Called on successful loadstate.
2044  was_savestate gives if this was a savestate or a movie.
2045 \end_layout
2047 \begin_layout Subsubsection
2048 Callback: on_pre_save(string name, boolean is_savestate)
2049 \end_layout
2051 \begin_layout Standard
2052 Called just before savestate save occurs (note: movie saves are synchronous
2053  and won't trigger these callbacks if called from Lua).
2054 \end_layout
2056 \begin_layout Subsubsection
2057 Callback: on_err_save(string name)
2058 \end_layout
2060 \begin_layout Standard
2061 Called if savestate goes wrong.
2062 \end_layout
2064 \begin_layout Subsubsection
2065 Callback: on_post_save(string name, boolean is_savestate)
2066 \end_layout
2068 \begin_layout Standard
2069 Called on successful savaestate.
2070  is_savestate gives if this was a savestate or a movie.
2071 \end_layout
2073 \begin_layout Subsubsection
2074 Callback: on_quit()
2075 \end_layout
2077 \begin_layout Standard
2078 Called when emulator is shutting down.
2079 \end_layout
2081 \begin_layout Subsubsection
2082 Callback: on_input(boolean subframe)
2083 \end_layout
2085 \begin_layout Standard
2086 Called when emulator is just sending input to bsnes core.
2087  Warning: This is called even in readonly mode, but the results are ignored.
2088 \end_layout
2090 \begin_layout Subsubsection
2091 Callback: on_reset()
2092 \end_layout
2094 \begin_layout Standard
2095 Called when SNES is reset.
2096 \end_layout
2098 \begin_layout Subsubsection
2099 Callback: on_readwrite()
2100 \end_layout
2102 \begin_layout Standard
2103 Called when moving into readwrite mode as result of 
2104 \begin_inset Quotes eld
2105 \end_inset
2107 set-rwmode
2108 \begin_inset Quotes erd
2109 \end_inset
2111  command (note: moving to rwmode by Lua won't trigger this, as per recursive
2112  entry protection).
2113 \end_layout
2115 \begin_layout Subsubsection
2116 Callback: on_snoop(number port, number controller, number index, number
2117  value)
2118 \end_layout
2120 \begin_layout Standard
2121 Called each time bsnes asks for input.
2122  The value is the final value to be sent to bsnes core (readonly mode, autohold
2123  and autofire have been taken into account).
2124  Might be useful when translating movies to format suitable for console
2125  verification.
2126  Note: There is no way to modify the value to be sent.
2127 \end_layout
2129 \begin_layout Section
2130 Modifier and key names:
2131 \end_layout
2133 \begin_layout Subsection
2134 SDL Platform
2135 \end_layout
2137 \begin_layout Subsubsection
2138 Modifier names
2139 \end_layout
2141 \begin_layout Standard
2142 Following modifier names are known:
2143 \end_layout
2145 \begin_layout Itemize
2146 ctrl, lctrl, rctrl: Control keys
2147 \end_layout
2149 \begin_layout Itemize
2150 alt, lalt, ralt: ALT keys.
2151 \end_layout
2153 \begin_layout Itemize
2154 shift, lshift, rshift: Shift keys.
2155 \end_layout
2157 \begin_layout Itemize
2158 meta, lmeta, rmeta: Meta keys.
2159 \end_layout
2161 \begin_layout Itemize
2162 num, caps: Numlock/Capslock (these are sticky!)
2163 \end_layout
2165 \begin_layout Itemize
2166 mode: Mode select.
2167 \end_layout
2169 \begin_layout Subsubsection
2170 Key names
2171 \end_layout
2173 \begin_layout Standard
2174 Following key names are known:
2175 \end_layout
2177 \begin_layout Itemize
2178 backspace, tab, clear, return, pause, escape, space, exclaim, quotedbl,
2179  hash, dollar, ampersand, quote, leftparen, rightparen, asterisk, plus,
2180  comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon,
2181  less, equals, greater, question, at, leftbracket, backslash, rightbracket,
2182  caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, n,
2183  o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, world_1, world_2,
2184  world_3, world_4, world_5, world_6, world_7, world_8, world_9, world_10,
2185  world_11, world_12, world_13, world_14, world_15, world_16, world_17, world_18,
2186  world_19, world_20, world_21, world_22, world_23, world_24, world_25, world_26,
2187  world_27, world_28, world_29, world_30, world_31, world_32, world_33, world_34,
2188  world_35, world_36, world_37, world_38, world_39, world_40, world_41, world_42,
2189  world_43, world_44, world_45, world_46, world_47, world_48, world_49, world_50,
2190  world_51, world_52, world_53, world_54, world_55, world_56, world_57, world_58,
2191  world_59, world_60, world_61, world_62, world_63, world_64, world_65, world_66,
2192  world_67, world_68, world_69, world_70, world_71, world_72, world_73, world_74,
2193  world_75, world_76, world_77, world_78, world_79, world_80, world_81, world_82,
2194  world_83, world_84, world_85, world_86, world_87, world_88, world_89, world_90,
2195  world_91, world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, kp4,
2196  kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, kp_multiply, kp_minus, kp_plus,
2197  kp_enter, kp_equals, up, down, right, left, insert, home, end, pageup,
2198  pagedown, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
2199  f15, numlock, capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt,
2200  lalt, rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, sysreq,
2201  break, menu, power, euro, undo
2202 \end_layout
2204 \begin_layout Itemize
2205 Names of form 'key<n>' where <n> is 0-255 are interpretted as key having
2206  hardware-dependent scan code of <n> (useful to bind those keys that don't
2207  have symbolic names).
2208 \end_layout
2210 \begin_layout Standard
2211 In addition, following pseudo-keys are known (note: these do not work in
2212  conjunction with modifers):
2213 \end_layout
2215 \begin_layout Itemize
2216 joystick<num>button<button>: Joystick <num> (0-based) button <button> (0-based).
2217 \end_layout
2219 \begin_layout Itemize
2220 joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> (0-based) up.
2221 \end_layout
2223 \begin_layout Itemize
2224 joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> (0-based) left.
2225 \end_layout
2227 \begin_layout Itemize
2228 joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> (0-based) down.
2229 \end_layout
2231 \begin_layout Itemize
2232 joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> (0-based) right.
2233 \end_layout
2235 \begin_layout Itemize
2236 joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> negative
2237  position (axis modes axis and axis_inverse).
2238 \end_layout
2240 \begin_layout Itemize
2241 joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> positive
2242  position (axis modes axis and axis_inverse).
2243 \end_layout
2245 \begin_layout Itemize
2246 joystick<num>axis<axis>: Joystick <num> (0-based) axis <axis> pressure (axis
2247  modes pressure_*).
2248 \end_layout
2250 \begin_layout Subsubsection
2251 Special buttons:
2252 \end_layout
2254 \begin_layout Itemize
2255 Escape: Enter/Exit Command mode, cancel modal dialogs.
2256 \end_layout
2258 \begin_layout Itemize
2259 Return (also KPEnter): Execute command, ok modal dialog.
2260 \end_layout
2262 \begin_layout Itemize
2263 Pgup/Up (also KP8/9 if no num lock; command mode): Previous command in command
2264  history
2265 \end_layout
2267 \begin_layout Itemize
2268 Pgdn/Down(also KP2/3 if no num lock; command mode): Next command in command
2269  history
2270 \end_layout
2272 \begin_layout Itemize
2273 Home (also KP7 if no num lock; command mode): Beginning of command.
2274 \end_layout
2276 \begin_layout Itemize
2277 End (also KP1 if no num lock; command mode): End of command.
2278 \end_layout
2280 \begin_layout Itemize
2281 Left (also KP4 if no num lock; command mode): Move cursor left.
2282 \end_layout
2284 \begin_layout Itemize
2285 Right (also KP6 if no num lock; command mode): Move cursor right.
2286 \end_layout
2288 \begin_layout Itemize
2289 Delete (also KP.
2290  if no num lock; command mode): Delete character to right of cursor.
2291 \end_layout
2293 \begin_layout Itemize
2294 Insert (also KP0 if no num lock; command mode): Toggle between insert /
2295  overwrite modes.
2296 \end_layout
2298 \begin_layout Itemize
2299 Backspace (command mode): Delete character to left of cursor.
2300 \end_layout
2302 \begin_layout Itemize
2303 LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump corrupted!).
2304 \end_layout
2306 \begin_layout Subsubsection
2307 Watchdog timer:
2308 \end_layout
2310 \begin_layout Standard
2311 If emulator does not reach internal polling loop in 15 seconds after leaving
2312  it or 15 seconds after starting, the emulator instantly bombs out.
2313 \end_layout
2315 \begin_layout Section
2316 Movie file format
2317 \end_layout
2319 \begin_layout Standard
2320 Movie file is .zip archive in itself, normal ZIP archive tools work on it
2321  (note: If you recompress it, do not use compression methods other than
2322  store and deflate and especially do not use encryption of any kind).
2323 \end_layout
2325 \begin_layout Subsection
2326 Detecting clean start/SRAM/Savestate
2327 \end_layout
2329 \begin_layout Itemize
2330 If file has member 
2331 \begin_inset Quotes eld
2332 \end_inset
2334 savestate
2335 \begin_inset Quotes erd
2336 \end_inset
2338  it is savestate, otherwise:
2339 \end_layout
2341 \begin_layout Itemize
2342 If file has members with names starting 
2343 \begin_inset Quotes eld
2344 \end_inset
2346 moviesram.
2347 \begin_inset Quotes erd
2348 \end_inset
2350  it is movie starting from SRAM, otherwise:
2351 \end_layout
2353 \begin_layout Itemize
2354 It is movie starting from clear state.
2355 \end_layout
2357 \begin_layout Subsection
2358 Member: gametype
2359 \end_layout
2361 \begin_layout Standard
2362 Type of game ROM and region (as one line).
2363  Valid values are:
2364 \end_layout
2366 \begin_layout Standard
2367 \begin_inset Tabular
2368 <lyxtabular version="3" rows="8" columns="3">
2369 <features tabularvalignment="middle">
2370 <column alignment="center" valignment="top" width="0">
2371 <column alignment="center" valignment="top" width="0">
2372 <column alignment="center" valignment="top" width="0">
2373 <row>
2374 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2375 \begin_inset Text
2377 \begin_layout Plain Layout
2378 Value
2379 \end_layout
2381 \end_inset
2382 </cell>
2383 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2384 \begin_inset Text
2386 \begin_layout Plain Layout
2387 System
2388 \end_layout
2390 \end_inset
2391 </cell>
2392 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2393 \begin_inset Text
2395 \begin_layout Plain Layout
2396 Region
2397 \end_layout
2399 \end_inset
2400 </cell>
2401 </row>
2402 <row>
2403 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2404 \begin_inset Text
2406 \begin_layout Plain Layout
2407 snes_pal
2408 \end_layout
2410 \end_inset
2411 </cell>
2412 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2413 \begin_inset Text
2415 \begin_layout Plain Layout
2416 Super NES
2417 \end_layout
2419 \end_inset
2420 </cell>
2421 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2422 \begin_inset Text
2424 \begin_layout Plain Layout
2426 \end_layout
2428 \end_inset
2429 </cell>
2430 </row>
2431 <row>
2432 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2433 \begin_inset Text
2435 \begin_layout Plain Layout
2436 sgb_pal
2437 \end_layout
2439 \end_inset
2440 </cell>
2441 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2442 \begin_inset Text
2444 \begin_layout Plain Layout
2445 Super Game Boy
2446 \end_layout
2448 \end_inset
2449 </cell>
2450 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2451 \begin_inset Text
2453 \begin_layout Plain Layout
2455 \end_layout
2457 \end_inset
2458 </cell>
2459 </row>
2460 <row>
2461 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2462 \begin_inset Text
2464 \begin_layout Plain Layout
2465 snes_ntsc
2466 \end_layout
2468 \end_inset
2469 </cell>
2470 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2471 \begin_inset Text
2473 \begin_layout Plain Layout
2474 Super NES
2475 \end_layout
2477 \end_inset
2478 </cell>
2479 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2480 \begin_inset Text
2482 \begin_layout Plain Layout
2483 NTSC
2484 \end_layout
2486 \end_inset
2487 </cell>
2488 </row>
2489 <row>
2490 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2491 \begin_inset Text
2493 \begin_layout Plain Layout
2494 sgb_ntsc
2495 \end_layout
2497 \end_inset
2498 </cell>
2499 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2500 \begin_inset Text
2502 \begin_layout Plain Layout
2503 Super Game Boy
2504 \end_layout
2506 \end_inset
2507 </cell>
2508 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2509 \begin_inset Text
2511 \begin_layout Plain Layout
2512 NTSC
2513 \end_layout
2515 \end_inset
2516 </cell>
2517 </row>
2518 <row>
2519 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2520 \begin_inset Text
2522 \begin_layout Plain Layout
2524 \end_layout
2526 \end_inset
2527 </cell>
2528 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2529 \begin_inset Text
2531 \begin_layout Plain Layout
2532 BS-X (non-slotted)
2533 \end_layout
2535 \end_inset
2536 </cell>
2537 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2538 \begin_inset Text
2540 \begin_layout Plain Layout
2541 NTSC
2542 \end_layout
2544 \end_inset
2545 </cell>
2546 </row>
2547 <row>
2548 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2549 \begin_inset Text
2551 \begin_layout Plain Layout
2552 bsxslotted
2553 \end_layout
2555 \end_inset
2556 </cell>
2557 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2558 \begin_inset Text
2560 \begin_layout Plain Layout
2561 BS-X (slotted)
2562 \end_layout
2564 \end_inset
2565 </cell>
2566 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2567 \begin_inset Text
2569 \begin_layout Plain Layout
2570 NTSC
2571 \end_layout
2573 \end_inset
2574 </cell>
2575 </row>
2576 <row>
2577 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2578 \begin_inset Text
2580 \begin_layout Plain Layout
2581 sufamiturbo
2582 \end_layout
2584 \end_inset
2585 </cell>
2586 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2587 \begin_inset Text
2589 \begin_layout Plain Layout
2590 Sufami Turbo
2591 \end_layout
2593 \end_inset
2594 </cell>
2595 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2596 \begin_inset Text
2598 \begin_layout Plain Layout
2599 NTSC
2600 \end_layout
2602 \end_inset
2603 </cell>
2604 </row>
2605 </lyxtabular>
2607 \end_inset
2610 \end_layout
2612 \begin_layout Standard
2613 Frame rates are:
2614 \end_layout
2616 \begin_layout Standard
2617 \begin_inset Tabular
2618 <lyxtabular version="3" rows="3" columns="2">
2619 <features tabularvalignment="middle">
2620 <column alignment="center" valignment="top" width="0">
2621 <column alignment="center" valignment="top" width="0">
2622 <row>
2623 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2624 \begin_inset Text
2626 \begin_layout Plain Layout
2627 Region
2628 \end_layout
2630 \end_inset
2631 </cell>
2632 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2633 \begin_inset Text
2635 \begin_layout Plain Layout
2636 Framerate (fps)
2637 \end_layout
2639 \end_inset
2640 </cell>
2641 </row>
2642 <row>
2643 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2644 \begin_inset Text
2646 \begin_layout Plain Layout
2648 \end_layout
2650 \end_inset
2651 </cell>
2652 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2653 \begin_inset Text
2655 \begin_layout Plain Layout
2656 322445/6448
2657 \end_layout
2659 \end_inset
2660 </cell>
2661 </row>
2662 <row>
2663 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2664 \begin_inset Text
2666 \begin_layout Plain Layout
2667 NTSC
2668 \end_layout
2670 \end_inset
2671 </cell>
2672 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2673 \begin_inset Text
2675 \begin_layout Plain Layout
2676 10738636/178683
2677 \end_layout
2679 \end_inset
2680 </cell>
2681 </row>
2682 </lyxtabular>
2684 \end_inset
2687 \end_layout
2689 \begin_layout Subsection
2690 Member: port1
2691 \end_layout
2693 \begin_layout Standard
2694 Contains type of port #1 (as one line).
2695  Valid values are 'none', 'gamepad', 'multitap' and 'mouse'.
2696  If not present, defaults to 'gamepad'.
2697 \end_layout
2699 \begin_layout Subsection
2700 Member: port2
2701 \end_layout
2703 \begin_layout Standard
2704 Contains type of port #2 (as one line).
2705  Valid values are 'none', 'gamepad', 'multitap', 'mouse', 'superscope',
2706  'justifier' and 'justifiers'.
2707  If not present, defaults to 'none'.
2708 \end_layout
2710 \begin_layout Subsection
2711 Member: gamename
2712 \end_layout
2714 \begin_layout Standard
2715 Contains name of the game (as one line).
2716 \end_layout
2718 \begin_layout Subsection
2719 Member: authors
2720 \end_layout
2722 \begin_layout Standard
2723 Contains authors, one per line.
2724  Part before '|' is the full name, part after is the nickname.
2725 \end_layout
2727 \begin_layout Subsection
2728 Member: systemid
2729 \end_layout
2731 \begin_layout Standard
2732 Always 
2733 \begin_inset Quotes eld
2734 \end_inset
2736 lsnes-rr1
2737 \begin_inset Quotes erd
2738 \end_inset
2740  (one line).
2741  Used to reject other saves.
2742 \end_layout
2744 \begin_layout Subsection
2745 Member: controlsversion
2746 \end_layout
2748 \begin_layout Standard
2749 Always 
2750 \begin_inset Quotes eld
2751 \end_inset
2754 \begin_inset Quotes erd
2755 \end_inset
2757  (one line).
2758  Used to identify what controls are there.
2759 \end_layout
2761 \begin_layout Subsection
2762 Member: 
2763 \begin_inset Quotes eld
2764 \end_inset
2766 coreversion
2767 \begin_inset Quotes erd
2768 \end_inset
2771 \end_layout
2773 \begin_layout Standard
2774 Contains bsnes core version number (as one line).
2775 \end_layout
2777 \begin_layout Subsection
2778 Member: projectid
2779 \end_layout
2781 \begin_layout Standard
2782 Contains project ID (as one line).
2783  Used to identify if two movies are part of the same project.
2784 \end_layout
2786 \begin_layout Subsection
2787 Member: {rom,slota,slotb}{,xml}.sha256
2788 \end_layout
2790 \begin_layout Standard
2791 Contains SHA-256 of said ROM or ROM mapping file (as one line).
2792  Absent if corresponding file is absent.
2793 \end_layout
2795 \begin_layout Subsection
2796 Member: moviesram.<name>
2797 \end_layout
2799 \begin_layout Standard
2800 Raw binary startup SRAM of kind <name>.
2801  Only present in savestates and movies starting from SRAM.
2802 \end_layout
2804 \begin_layout Subsection
2805 Member: moviestate
2806 \end_layout
2808 \begin_layout Standard
2809 Raw binary movie state data.
2810  Only present in savestates.
2811 \end_layout
2813 \begin_layout Standard
2814 for version 0:
2815 \end_layout
2817 \begin_layout Itemize
2818 32 bytes: SHA-256 of project ID.
2819 \end_layout
2821 \begin_layout Itemize
2822 8 bytes: Big-endian current frame.
2823 \end_layout
2825 \begin_layout Itemize
2826 100x4 bytes: Poll counters for each control (bit31 of each is 
2827 \begin_inset Quotes eld
2828 \end_inset
2830 data ready
2831 \begin_inset Quotes erd
2832 \end_inset
2834  bit), big-endian.
2835 \end_layout
2837 \begin_layout Itemize
2838 8 bytes: Big-endian lag frame count.
2839 \end_layout
2841 \begin_layout Itemize
2842 32 bytes: SHA-256 of past input
2843 \end_layout
2845 \begin_layout Itemize
2846 32 bytes: SHA-256 of previous.
2847 \end_layout
2849 \begin_layout Itemize
2850 (total of 512 bytes)
2851 \end_layout
2853 \begin_layout Subsection
2854 Member: hostmemory
2855 \end_layout
2857 \begin_layout Standard
2858 Raw binary dump of host memory.
2859  Only present in savestates.
2860 \end_layout
2862 \begin_layout Subsection
2863 Member: savestate
2864 \end_layout
2866 \begin_layout Standard
2867 The raw binary savestate itself.
2868  Savestate detection uses this file, only present in savestates.
2869 \end_layout
2871 \begin_layout Subsection
2872 Member: screenshot
2873 \end_layout
2875 \begin_layout Standard
2876 Screenshot of current frame.
2877  Only present in savestates.
2878  First 2 bytes are big-endian width of image, rest are big-endian 15-bit
2879  image data (5 bits per channel*pixel, the MSB is unused).
2880  Height of image is inferred from the width and size of data.
2881 \end_layout
2883 \begin_layout Subsection
2884 Member: sram.<name>
2885 \end_layout
2887 \begin_layout Standard
2888 Raw binary SRAM of kind <name> at time of savestate.
2889  Only present in savestates.
2890 \end_layout
2892 \begin_layout Subsection
2893 Member: input
2894 \end_layout
2896 \begin_layout Standard
2897 The actual input track, one line per subframe (blank lines are skipped).
2898 \end_layout
2900 \begin_layout Itemize
2901 If the first byte of each line is '.', ' ', <tab> or '|', then the line is
2902  part of same frame as previous, otherwise it starts a new frame.
2903 \end_layout
2905 \begin_layout Itemize
2906 First subframe must start a new frame.
2907 \end_layout
2909 \begin_layout Standard
2910 Length of movie in frames is number of lines in input file that start a
2911  new frame.
2912 \end_layout
2914 \begin_layout Subsection
2915 Member: rerecords
2916 \end_layout
2918 \begin_layout Standard
2919 Contains textual base-10 rerecord count (as one line; emulator just writes
2920  this, it doesn't read it) + 1.
2921 \end_layout
2923 \begin_layout Subsection
2924 Member: rrdata
2925 \end_layout
2927 \begin_layout Standard
2928 This member stores set of load IDs.
2929  There is one load ID per rerecord (plus one corresponding to start of project).
2930 \end_layout
2932 \begin_layout Itemize
2933 This member constists of concatenation of records
2934 \end_layout
2936 \begin_layout Itemize
2937 Each record is 2-36 bytes long and can represent 1-16,843,009 consequtive
2938  IDs.
2939 \end_layout
2941 \begin_layout Itemize
2942 IDs are interpretted as 256-bit big-endian integers with warparound.
2943 \end_layout
2945 \begin_layout Itemize
2946 Initial predicted ID is all zeroes.
2947 \end_layout
2949 \begin_layout Standard
2950 Format of each record is:
2951 \end_layout
2953 \begin_layout Itemize
2954 1 byte: Opcode byte.
2955  Bits 0-4 are prefix length (prefixlen), bits 5-6 are count length (countlen).
2956  Bit 7 is unused.
2957 \end_layout
2959 \begin_layout Itemize
2960 32-prefixlen bytes of ID.
2961 \end_layout
2963 \begin_layout Itemize
2964 countlen bytes of big-endian count (count).
2965 \end_layout
2967 \begin_layout Standard
2968 Records are processed as follows:
2969 \end_layout
2971 \begin_layout Itemize
2972 To form the first ID encoded by record, take the first prefixlen bytes predicted
2973  ID and append the read ID value to it.
2974  The result is the first ID encoded.
2975 \end_layout
2977 \begin_layout Itemize
2978 If countlen is 0, record encodes 1 ID.
2979 \end_layout
2981 \begin_layout Itemize
2982 If countlen is 1, record encodes 2+count IDs.
2983 \end_layout
2985 \begin_layout Itemize
2986 If countlen is 2, record encodes 258+count IDs.
2987 \end_layout
2989 \begin_layout Itemize
2990 If countlen is 3, record encodes 65794+count IDs.
2991 \end_layout
2993 \begin_layout Itemize
2994 The new predicted ID is the next ID after last one encoded by the record.
2995 \end_layout
2997 \begin_layout Standard
2998 The number of rerecords + 1 is equal to the sum of number of IDs encoded
2999  by all records.
3000 \end_layout
3002 \begin_layout Section
3003 Compiling:
3004 \end_layout
3006 \begin_layout Subsection
3007 Building BSNES
3008 \end_layout
3010 \begin_layout Standard
3011 make ui=ui-libsnes options=debugger profile=accuracy
3012 \end_layout
3014 \begin_layout Itemize
3015 Yes, debugger is needed.
3016 \end_layout
3018 \begin_layout Subsection
3019 Prerequisite libraries:
3020 \end_layout
3022 \begin_layout Itemize
3023 zlib
3024 \end_layout
3026 \begin_layout Itemize
3027 SDL (SDL platform)
3028 \end_layout
3030 \begin_layout Itemize
3031 SDLmain (Windows only; Note you may have to extract the object out of archive)
3032 \end_layout
3034 \begin_layout Itemize
3035 boost_iostreams
3036 \end_layout
3038 \begin_layout Itemize
3039 boost_filesystem
3040 \end_layout
3042 \begin_layout Itemize
3043 boost conversion (header only)
3044 \end_layout
3046 \begin_layout Subsection
3047 Compile options to make:
3048 \end_layout
3050 \begin_layout Subsubsection
3051 BSNES_PATH=<path>
3052 \end_layout
3054 \begin_layout Standard
3055 Set path to BSNES bsnes directory to <path>.
3056 \end_layout
3058 \begin_layout Subsubsection
3059 NO_THREADS=1
3060 \end_layout
3062 \begin_layout Standard
3063 Don't use threads on Linux.
3064 \end_layout
3066 \begin_layout Subsubsection
3067 USE_THREADS=1
3068 \end_layout
3070 \begin_layout Standard
3071 Try to use threads even on non-Linux systems.
3072 \end_layout
3074 \begin_layout Subsubsection
3075 CC=<compiler>
3076 \end_layout
3078 \begin_layout Standard
3079 Target C++ compiler to use.
3080  Defaults to g++-4.5.
3081 \end_layout
3083 \begin_layout Standard
3084 Note: If crosscompiling, this has to be crosscompiler.
3085 \end_layout
3087 \begin_layout Subsubsection
3088 HOSTCC=<compiler>
3089 \end_layout
3091 \begin_layout Standard
3092 Host C++ compiler to use.
3093  Defaults to the same as CC.
3094 \end_layout
3096 \begin_layout Standard
3097 Note: If crosscompiling, that has to be host compiler (the files produced
3098  will be run in the build process!)
3099 \end_layout
3101 \begin_layout Subsubsection
3102 BSNES_IS_COMPAT=1
3103 \end_layout
3105 \begin_layout Standard
3106 Assume BSNES uses compatiblity core instead of accuracy core.
3107 \end_layout
3109 \begin_layout Subsubsection
3110 NO_LUA=1
3111 \end_layout
3113 \begin_layout Standard
3114 Don't compile in Lua support.
3115 \end_layout
3117 \begin_layout Section
3118 Quick'n'dirty encode guide
3119 \end_layout
3121 \begin_layout Enumerate
3122 Start the emulator and load the movie file.
3123 \end_layout
3125 \begin_layout Enumerate
3126 Set large AVI option 'set-setting avi-large on'
3127 \end_layout
3129 \begin_layout Enumerate
3130 If dumping PAL, set bottom border to 2 'set-setting avi-bottom-border 2'
3131 \end_layout
3133 \begin_layout Enumerate
3134 Enable dumping 'dump-avi 12 tmpdump' (note: Normally 10 and above are 
3135 \begin_inset Quotes eld
3136 \end_inset
3138 use only if you know what you are doing.
3139 \begin_inset Quotes erd
3140 \end_inset
3143  In this case, these can be safely used because of how x264 internally works.
3144 \end_layout
3146 \begin_layout Enumerate
3147 Unpause and let it run until you want to end dumping.
3148 \end_layout
3150 \begin_layout Enumerate
3151 Close the emulator (closing the window is the easiest way)
3152 \end_layout
3154 \begin_layout Enumerate
3155 For each tmpdump*.avi file created, on command prompt, do 'x264 --crf 10
3156  -o tmpdump_<numbers>.mkv tmpdump_<numbers>.avi'.
3157 \end_layout
3159 \begin_layout Enumerate
3160 Do 'sox tmpdump.sox tmpdump.ogg rate -v 32000'
3161 \end_layout
3163 \begin_layout Enumerate
3164 Do 'mkvmerge -o tmpdump_video.mkv tmpdump_0000000.mkv + tmpdump_0000001.mkv
3165  + tmpdump_0000002.mkv' (list every tmpdump_<numbers>.mkv, with + in between).
3166 \end_layout
3168 \begin_layout Enumerate
3169 Do 'mkvmerge -o final.mkv tmpdump_video.mkv tmpdump.ogg'.
3170  Now final.mkv contains quick'n'dirty encode.
3171 \end_layout
3173 \begin_layout Section
3174 Errata:
3175 \end_layout
3177 \begin_layout Subsection
3178 Problems from BSNES core:
3179 \end_layout
3181 \begin_layout Itemize
3182 The whole pending save stuff.
3183 \end_layout
3185 \begin_layout Itemize
3186 Delay resets are slow.
3187 \end_layout
3189 \begin_layout Itemize
3190 RTC is not emulated in sync-stable manner.
3191 \end_layout
3193 \begin_layout Itemize
3194 Lack of layer hiding.
3195 \end_layout
3197 \begin_layout Itemize
3198 It is slow.
3199 \end_layout
3201 \begin_layout Itemize
3202 Firmwares can't be loaded from ZIP archives.
3203 \end_layout
3205 \begin_layout Itemize
3206 Manual polls can be corrupted if savestate occurs during those.
3207 \end_layout
3209 \begin_layout Subsection
3210 Other problems:
3211 \end_layout
3213 \begin_layout Itemize
3214 Modifiers don't work with pseudo-keys (SDL).
3215 \end_layout
3217 \begin_layout Itemize
3218 Audio for last dumped frame is not itself dumped.
3219 \end_layout
3221 \begin_layout Itemize
3222 Audio in UI is pretty bad in quality.
3223 \end_layout
3225 \begin_layout Itemize
3226 UI itself is 30fps max.
3227 \end_layout
3229 \begin_layout Itemize
3230 AVI compression levels 10-18 are not compatible with AVISynth AVISource.
3231 \end_layout
3233 \begin_layout Itemize
3234 No menus, command based interface (SDL).
3235 \end_layout
3237 \begin_layout Itemize
3238 Long commands don't scroll.
3239 \end_layout
3241 \begin_layout Section
3242 Changelog:
3243 \end_layout
3245 \begin_layout Subsection
3246 rr0-beta1
3247 \end_layout
3249 \begin_layout Itemize
3250 Fix -Wall warnings
3251 \end_layout
3253 \begin_layout Itemize
3254 Fix dumper video corruption with levels 10-18.
3255 \end_layout
3257 \begin_layout Subsection
3258 rr0-beta2
3259 \end_layout
3261 \begin_layout Itemize
3262 Autofire
3263 \end_layout
3265 \begin_layout Itemize
3266 Lots of code cleanups
3267 \end_layout
3269 \begin_layout Itemize
3270 Lua interface to settings
3271 \end_layout
3273 \begin_layout Itemize
3274 Allow specifying AVI borders without Lua
3275 \end_layout
3277 \begin_layout Itemize
3278 Fix scaling if vscale > 1 and originx > 0 (left border exists)
3279 \end_layout
3281 \begin_layout Itemize
3282 on_snoop lua callback
3283 \end_layout
3285 \begin_layout Itemize
3286 Faster movie loading and saving.
3287 \end_layout
3289 \begin_layout Subsection
3290 rr0-beta3
3291 \end_layout
3293 \begin_layout Itemize
3294 Joystick support
3295 \end_layout
3297 \begin_layout Subsection
3298 rr0-beta4
3299 \end_layout
3301 \begin_layout Itemize
3302 Fix multi-buttons
3303 \end_layout
3305 \begin_layout Itemize
3306 Save jukebox functionality.
3307 \end_layout
3309 \begin_layout Subsection
3310 rr0-beta5
3311 \end_layout
3313 \begin_layout Itemize
3314 Try to fix some nasty failing movie load edge cases
3315 \end_layout
3317 \begin_layout Itemize
3318 Allow specifying scripts to run on command line.
3319 \end_layout
3321 \begin_layout Subsection
3322 rr0-beta6
3323 \end_layout
3325 \begin_layout Itemize
3326 Major source code reorganization.
3327 \end_layout
3329 \begin_layout Itemize
3330 Backup savestates before overwriting.
3331 \end_layout
3333 \begin_layout Itemize
3334 Don't crash if loading initial state fails.
3335 \end_layout
3337 \begin_layout Subsection
3338 rr0-beta7
3339 \end_layout
3341 \begin_layout Itemize
3342 Fix firmware lookup
3343 \end_layout
3345 \begin_layout Itemize
3346 Fix author name parsing
3347 \end_layout
3349 \begin_layout Itemize
3350 Fix rerecord counting
3351 \end_layout
3353 \begin_layout Itemize
3354 (SDL) Print messages to console if SDL is uninitialized
3355 \end_layout
3357 \begin_layout Itemize
3358 Add movieinfo program
3359 \end_layout
3361 \begin_layout Itemize
3362 Fix loading movies starting from SRAM.
3363 \end_layout
3365 \begin_layout Subsection
3366 rr0-beta8
3367 \end_layout
3369 \begin_layout Itemize
3370 Add support for unattended dumping
3371 \end_layout
3373 \begin_layout Itemize
3374 Fix compiling for Win32
3375 \end_layout
3377 \begin_layout Itemize
3378 Don't lock up if sound can't be initialized
3379 \end_layout
3381 \begin_layout Itemize
3382 Strip trailing CR from commands
3383 \end_layout
3385 \begin_layout Itemize
3386 Don't try to do dubious things in global ctors (fix crash on startup)
3387 \end_layout
3389 \begin_layout Subsection
3390 rr0-beta9
3391 \end_layout
3393 \begin_layout Itemize
3394 Small documentation tweaking
3395 \end_layout
3397 \begin_layout Itemize
3398 Fix make clean
3399 \end_layout
3401 \begin_layout Itemize
3402 Fix major bug in modifier matching
3403 \end_layout
3405 \begin_layout Subsection
3406 rr0-beta10
3407 \end_layout
3409 \begin_layout Itemize
3410 Lots of documentation fixes
3411 \end_layout
3413 \begin_layout Itemize
3414 Use dedicated callbacks for event backcomm., not commands.
3415 \end_layout
3417 \begin_layout Itemize
3418 Ensure that the watchdog is not hit when executing delayed reset.
3419 \end_layout
3421 \begin_layout Itemize
3422 Remove errant tab from joystick message.
3423 \end_layout
3425 \end_body
3426 \end_document