Make joysticks actually work
[lsnes.git] / manual.lyx
blob63d458916c31dc0ed127ddd3bc85555799501193
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 Command line options
64 \end_layout
66 \begin_layout Subsection
67 ROM options
68 \end_layout
70 \begin_layout Standard
71 These options control loading the ROM.
72  <kind> can be one of following:
73 \end_layout
75 \begin_layout Itemize
76 rom: main cart ROM.
77 \end_layout
79 \begin_layout Itemize
80 bsx: BS-X flash ROM in non-slotted mode.
81 \end_layout
83 \begin_layout Itemize
84 bsxslotted: BS-X flash ROM in slotted mode.
85 \end_layout
87 \begin_layout Itemize
88 dmg: Game Boy ROM
89 \end_layout
91 \begin_layout Itemize
92 slot-a: Sufami Turbo Slot A.
93 \end_layout
95 \begin_layout Itemize
96 slot-b: Sufami Turbo Slot B.
97 \end_layout
99 \begin_layout Subsubsection
100 --<kind>=<file>
101 \end_layout
103 \begin_layout Standard
104 Set the <file> to use as ROM of <kind>.
105 \end_layout
107 \begin_layout Subsubsection
108 --ips-<kind>=<file>
109 \end_layout
111 \begin_layout Standard
112 Apply IPS patch <file> to ROM of <kind>
113 \end_layout
115 \begin_layout Subsubsection
116 --<kind>-xml=<file>
117 \end_layout
119 \begin_layout Standard
120 Set the <file> to use as ROM mapping for <kind>.
121  If no mapping file is specified, defaults are used.
122 \end_layout
124 \begin_layout Subsubsection
125 --ips-<kind>-xml=<file>
126 \end_layout
128 \begin_layout Standard
129 Apply IPS patch <file> to ROM mapping for <kind>.
130 \end_layout
132 \begin_layout Subsubsection
133 --ips-offset=<offset>
134 \end_layout
136 \begin_layout Standard
137 Set IPS apply offset to <offset> (can be negative).
138  In practicular, <offset> of -512 might be handy for applying headered IPS
139  patches.
140 \end_layout
142 \begin_layout Subsubsection
143 --pal
144 \end_layout
146 \begin_layout Standard
147 Force ROM to be considered PAL-only (warning: Will cause error if used on
148  anything except SNES and SGB).
149 \end_layout
151 \begin_layout Subsubsection
152 --ntsc
153 \end_layout
155 \begin_layout Standard
156 Force ROM to be considered NTSC-only (default for everything except SNES
157  and SGB).
158 \end_layout
160 \begin_layout Subsection
161 New session options
162 \end_layout
164 \begin_layout Standard
165 If filename is not specified, new session is started.
166  These options control properties of that:
167 \end_layout
169 \begin_layout Subsubsection
170 --port1=<type>
171 \end_layout
173 \begin_layout Standard
174 Set type of port1 (default is 'gamepad').
175  Valid values are 'none', 'gamepad', 'multitap' (warning: makes most games
176  refuse to start) and 'mouse'.
177 \end_layout
179 \begin_layout Subsubsection
180 --port2=<type>
181 \end_layout
183 \begin_layout Standard
184 Set type of port2 (default is 'none').
185  Valid values are 'none', 'gamepad', 'multitap', 'mouse', 'superscope',
186  'justifier' and 'justifiers'.
187 \end_layout
189 \begin_layout Subsubsection
190 --gamename=<name>
191 \end_layout
193 \begin_layout Standard
194 Set the name of game to <name>
195 \end_layout
197 \begin_layout Subsubsection
198 --author=<name>
199 \end_layout
201 \begin_layout Standard
202 Add author with full name of <name> (no nickname).
203 \end_layout
205 \begin_layout Subsubsection
206 --author=|<name>
207 \end_layout
209 \begin_layout Standard
210 Add author with nickname of <name> (no full name).
211 \end_layout
213 \begin_layout Subsubsection
214 --author=<fullname>|<nickname>
215 \end_layout
217 \begin_layout Standard
218 Add author with full name of <fullname> and nickname of <nickname>.
219 \end_layout
221 \begin_layout Subsection
222 <filename>
223 \end_layout
225 \begin_layout Standard
226 If filename is specified on command line, it is loaded as initial state
227  (instead of constructing one).
228 \end_layout
230 \begin_layout Section
231 Startup file lsnes.rc
232 \end_layout
234 \begin_layout Standard
235 Upon startup, lsnes executes file lsnes.rc as commands.
236  This file is located in:
237 \end_layout
239 \begin_layout Itemize
240 Windows: %APPDATA%
241 \backslash
242 lsnes
243 \backslash
244 lsnes.rc (if %APPDATA% exists)
245 \end_layout
247 \begin_layout Itemize
248 Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME exists)
249 \end_layout
251 \begin_layout Itemize
252 Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
253 \end_layout
255 \begin_layout Itemize
256 All: ./lsnes.rc (fallback default).
257 \end_layout
259 \begin_layout Standard
260 If leading directories do not exist, attempt to create them is made.
261 \end_layout
263 \begin_layout Section
264 Game internal commands
265 \end_layout
267 \begin_layout Itemize
268 Commands beginning with '*' invoke the corresponding command without alias
269  expansion.
270 \end_layout
272 \begin_layout Itemize
273 If command starts with '+', the command is executed as-is when button is
274  pressed, and when button is released, it is executed with '+' replaced
275  by '-'.
276 \end_layout
278 \begin_layout Subsection
279 Settings:
280 \end_layout
282 \begin_layout Standard
283 Settings control various aspects of emulator behaviour.
284 \end_layout
286 \begin_layout Subsubsection
287 set-setting <setting> <value>
288 \end_layout
290 \begin_layout Standard
291 Sets setting <setting> to value <value> (may be empty).
292 \end_layout
294 \begin_layout Subsubsection
295 unset-setting <setting>
296 \end_layout
298 \begin_layout Standard
299 Try to unset setting <setting> (not all settings can be unset).
300 \end_layout
302 \begin_layout Subsubsection
303 get-setting <setting>
304 \end_layout
306 \begin_layout Standard
307 Read value of setting <setting>
308 \end_layout
310 \begin_layout Subsubsection
311 print-settings
312 \end_layout
314 \begin_layout Standard
315 Print names and values of all settings.
316 \end_layout
318 \begin_layout Subsection
319 Keybindings
320 \end_layout
322 \begin_layout Standard
323 Keybindings bind commands or aliases to keys (or pseudo-keys).
325 \end_layout
327 \begin_layout Standard
328 Notes:
329 \end_layout
331 \begin_layout Itemize
332 Do not bind edge active (+/-) commands to keys with modifiers, that won't
333  work right!
334 \end_layout
336 \begin_layout Itemize
337 Names of keys and modifiers are platform-dependent.
338 \end_layout
340 \begin_layout Subsubsection
341 bind-key [<mod>/<modmask>] <key> <command>
342 \end_layout
344 \begin_layout Standard
345 Bind <command> to key <key> (activating if modifiers in <modmask> (comma-seperat
346 ed list) are set as <mod> (comma-seperated list).
348 \end_layout
350 \begin_layout Subsubsection
351 unbind-key [<mod>/<modmask>] <key>
352 \end_layout
354 \begin_layout Standard
355 Unbind command from <key> (with specified <mod> and <modmask>).
356 \end_layout
358 \begin_layout Subsubsection
359 print-keybindings
360 \end_layout
362 \begin_layout Standard
363 Print all key bindings in effect.
364 \end_layout
366 \begin_layout Subsection
367 Aliases
368 \end_layout
370 \begin_layout Standard
371 Aliases bind command to sequence of commands.
372  After alias has been defined, it replaces the command it shadows.
373 \end_layout
375 \begin_layout Standard
376 Notes:
377 \end_layout
379 \begin_layout Itemize
380 You can't alias command to itself.
381 \end_layout
383 \begin_layout Itemize
384 Aliases starting with +/- are edge active just like ordinary commands starting
385  with +/-.
386 \end_layout
388 \begin_layout Itemize
389 One command can be aliased to multiple commands.
390 \end_layout
392 \begin_layout Subsubsection
393 alias-command <command> <expansion>
394 \end_layout
396 \begin_layout Standard
397 Append <expansion> to alias <command>.
398 \end_layout
400 \begin_layout Subsubsection
401 unalias-command <command>
402 \end_layout
404 \begin_layout Standard
405 Clear alias expansion for <command>.
406 \end_layout
408 \begin_layout Subsubsection
409 print-aliases
410 \end_layout
412 \begin_layout Standard
413 Print all aliases and their expansions in effect.
414 \end_layout
416 \begin_layout Subsection
417 run-script <script>
418 \end_layout
420 \begin_layout Standard
421 Run <script> as if commands were entered on command line.
422 \end_layout
424 \begin_layout Subsection
425 Video dumping
426 \end_layout
428 \begin_layout Standard
429 Following commands control video dumping:
430 \end_layout
432 \begin_layout Subsubsection
433 dump-avi <level> <prefix>
434 \end_layout
436 \begin_layout Standard
437 Dump AVI video to prefix <prefix> at level <level> (0-18).
438 \end_layout
440 \begin_layout Itemize
441 The codec is Camstudio Codec in gzip mode.
442 \end_layout
444 \begin_layout Itemize
445 Encoder and muxer are internal, available on all platforms.
446 \end_layout
448 \begin_layout Itemize
449 Audio enable/disable and framerate has no effect.
450 \end_layout
452 \begin_layout Itemize
453 Warning: Levels 10-18 are not compatible with AVISource.
454 \end_layout
456 \begin_layout Itemize
457 Recomended level is 7 if decoded by AVISource.
458 \end_layout
460 \begin_layout Itemize
461 Recomended level is 16 if decoded by ffmpeg, mencoder or FFMpegSource.
462 \end_layout
464 \begin_layout Standard
465 Note: The audio dumped to .avi is low-quality version.
466  The high-quality version is dumped to .sox file.
467 \end_layout
469 \begin_layout Subsubsection
470 end-avi
471 \end_layout
473 \begin_layout Standard
474 End current AVI video dump.
475 \end_layout
477 \begin_layout Subsection
478 Memory manipulation
479 \end_layout
481 \begin_layout Standard
482 <address> may be decimal or hexadecimal (prefixed with '0x').
483  <value> can be hexadecimal (prefixed with '0x'), unsigned or signed (prefixed
484  with '-') decimal.
485 \end_layout
487 \begin_layout Standard
488 The available element <sizes> are:
489 \end_layout
491 \begin_layout Itemize
492 byte: 1 byte
493 \end_layout
495 \begin_layout Itemize
496 word: 2 bytes
497 \end_layout
499 \begin_layout Itemize
500 dword: 4 bytes
501 \end_layout
503 \begin_layout Itemize
504 qword: 8 bytes
505 \end_layout
507 \begin_layout Standard
508 When reading RAM and ROM, multi-byte reads/writes are big-endian.
509  When dealing with DSP memory, multi-byte reads/writes are native-endian
510  (do not use operand sizes exceeding DSP bitness, except dword is OK for
511  24-bit memory).
512 \end_layout
514 \begin_layout Subsubsection
515 read-<size> <address>
516 \end_layout
518 \begin_layout Standard
519 Read the value of byte in <address>.
520 \end_layout
522 \begin_layout Subsubsection
523 read-s<size> <address>
524 \end_layout
526 \begin_layout Standard
527 Read the value of signed byte in <address>.
528 \end_layout
530 \begin_layout Subsubsection
531 write-<size> <address> <value>
532 \end_layout
534 \begin_layout Standard
535 Write <value> to byte in address <address>.
536 \end_layout
538 \begin_layout Subsubsection
539 search-memory reset
540 \end_layout
542 \begin_layout Standard
543 Reset the memory search
544 \end_layout
546 \begin_layout Subsubsection
547 search-memory count
548 \end_layout
550 \begin_layout Standard
551 Print number of candidates remaining
552 \end_layout
554 \begin_layout Subsubsection
555 search-memory print
556 \end_layout
558 \begin_layout Standard
559 Print all candidates remaining
560 \end_layout
562 \begin_layout Subsubsection
563 search-memory <usflag><sizeflag><op>
564 \end_layout
566 \begin_layout Standard
567 Searches memory for addresses satisfying criteria.
568 \end_layout
570 \begin_layout Standard
571 <usflag> can be:
572 \end_layout
574 \begin_layout Itemize
575 u: unsigned
576 \end_layout
578 \begin_layout Itemize
579 s: signed
580 \end_layout
582 \begin_layout Standard
583 <sizeflag> can be:
584 \end_layout
586 \begin_layout Itemize
587 b: byte
588 \end_layout
590 \begin_layout Itemize
591 w: word
592 \end_layout
594 \begin_layout Itemize
595 d: dword
596 \end_layout
598 \begin_layout Itemize
599 q: qword
600 \end_layout
602 \begin_layout Standard
603 <op> can be:
604 \end_layout
606 \begin_layout Itemize
607 lt: < previous value.
608 \end_layout
610 \begin_layout Itemize
611 le: <= previous value.
612 \end_layout
614 \begin_layout Itemize
615 eq: = previous value.
616 \end_layout
618 \begin_layout Itemize
619 ne: != previous value.
620 \end_layout
622 \begin_layout Itemize
623 ge: >= previous value.
624 \end_layout
626 \begin_layout Itemize
627 gt: > previous value.
628 \end_layout
630 \begin_layout Subsubsection
631 search-memory <sizeflag> <value>
632 \end_layout
634 \begin_layout Standard
635 Searches for addresses that currently have value <value>.
636  <sizeflag> is as in previous command.
637 \end_layout
639 \begin_layout Subsection
640 Main commands
641 \end_layout
643 \begin_layout Standard
644 These commands are not available in lsnesrc, but are available after ROM
645  has been loaded.
646 \end_layout
648 \begin_layout Subsubsection
649 quit-emulator [/y]
650 \end_layout
652 \begin_layout Standard
653 Quits the emulator (asking for confirmation).
654  If /y is given, no confirmation is asked.
655 \end_layout
657 \begin_layout Subsubsection
658 pause-emulator
659 \end_layout
661 \begin_layout Standard
662 Toggle paused/unpaused
663 \end_layout
665 \begin_layout Subsubsection
666 +advance-frame
667 \end_layout
669 \begin_layout Standard
670 Advance frame.
671  If the button is still held after configurable timeout expires, game unpauses
672  for the duration frame advance is held.
673 \end_layout
675 \begin_layout Subsubsection
676 +advance-poll
677 \end_layout
679 \begin_layout Standard
680 Advance subframe.
681  If the button is still held after configurable timeout expires, game unpauses
682  for the duration frame advance is held.
683 \end_layout
685 \begin_layout Subsubsection
686 advance-skiplag
687 \end_layout
689 \begin_layout Standard
690 Skip to first poll in frame after current.
691 \end_layout
693 \begin_layout Subsubsection
694 reset
695 \end_layout
697 \begin_layout Standard
698 Reset the SNES after this frame.
699 \end_layout
701 \begin_layout Subsubsection
702 load-state <filename>
703 \end_layout
705 \begin_layout Standard
706 Load savestate <filename> in readwrite mode.
707 \end_layout
709 \begin_layout Subsubsection
710 load-readonly <filename>
711 \end_layout
713 \begin_layout Standard
714 Load savestate <filename> in readonly mode.
715 \end_layout
717 \begin_layout Subsubsection
718 load-preserve <filename>
719 \end_layout
721 \begin_layout Standard
722 Load savestate <filename> in readonly mode, preserving current events.
723 \end_layout
725 \begin_layout Subsubsection
726 load-movie <filename>
727 \end_layout
729 \begin_layout Standard
730 Load savestate <filename>, ignoring save part in readonly mode.
731 \end_layout
733 \begin_layout Subsubsection
734 save-state <filename>
735 \end_layout
737 \begin_layout Standard
738 Save system state to <filename> as soon as possible.
739 \end_layout
741 \begin_layout Subsubsection
742 save-movie <filename>
743 \end_layout
745 \begin_layout Standard
746 Save movie to <filename>.
747 \end_layout
749 \begin_layout Subsubsection
750 set-rwmode
751 \end_layout
753 \begin_layout Standard
754 Set read-write mode.
755 \end_layout
757 \begin_layout Subsubsection
758 set-gamename <name>
759 \end_layout
761 \begin_layout Standard
762 Set name of the game to <name>
763 \end_layout
765 \begin_layout Subsubsection
766 get-gamename
767 \end_layout
769 \begin_layout Standard
770 Print the name of the game.
771 \end_layout
773 \begin_layout Subsubsection
774 add-author <author>
775 \end_layout
777 \begin_layout Standard
778 Adds new author <author>.
779  If <author> does not contain '|' it is full name.
780  If it contains '|', '|' splits the full name and nickname.
781 \end_layout
783 \begin_layout Subsubsection
784 edit-author <num> <author>
785 \end_layout
787 \begin_layout Standard
788 Edit the author in slot <num> (0-based) to be <author> (see add-author for
789  format)
790 \end_layout
792 \begin_layout Subsubsection
793 remove-author <num>
794 \end_layout
796 \begin_layout Standard
797 Remove author in slot <num>
798 \end_layout
800 \begin_layout Subsubsection
801 print-authors
802 \end_layout
804 \begin_layout Standard
805 Print authors.
806 \end_layout
808 \begin_layout Subsubsection
809 test-1, test-2, test-3
810 \end_layout
812 \begin_layout Standard
813 Internal test commands
814 \end_layout
816 \begin_layout Subsubsection
817 take-screenshot <filename>
818 \end_layout
820 \begin_layout Standard
821 Save screenshot to <filename>.
822 \end_layout
824 \begin_layout Subsubsection
825 +controller<num><button>
826 \end_layout
828 \begin_layout Standard
829 Press button <button> on controller <num> (1-8).
830  The following button names are known:
831 \end_layout
833 \begin_layout Itemize
834 left
835 \end_layout
837 \begin_layout Itemize
838 right
839 \end_layout
841 \begin_layout Itemize
843 \end_layout
845 \begin_layout Itemize
846 down
847 \end_layout
849 \begin_layout Itemize
851 \end_layout
853 \begin_layout Itemize
855 \end_layout
857 \begin_layout Itemize
859 \end_layout
861 \begin_layout Itemize
863 \end_layout
865 \begin_layout Itemize
867 \end_layout
869 \begin_layout Itemize
871 \end_layout
873 \begin_layout Itemize
874 select
875 \end_layout
877 \begin_layout Itemize
878 start
879 \end_layout
881 \begin_layout Itemize
882 trigger
883 \end_layout
885 \begin_layout Itemize
886 cursor
887 \end_layout
889 \begin_layout Itemize
890 pause
891 \end_layout
893 \begin_layout Itemize
894 turbo
895 \end_layout
897 \begin_layout Subsubsection
898 controllerh<num><button>
899 \end_layout
901 \begin_layout Standard
902 Hold/unhold button <button> on controller <num> (1-8).
903  See +controller for button names.
904 \end_layout
906 \begin_layout Subsubsection
907 autofire (<pattern>|-)...
908 \end_layout
910 \begin_layout Standard
911 Set autofire pattern.
912  Each parameter is comma-separated list of button names (in form of 1start,
913  1A, 2B, etc..) to hold on that frame.
914  After reaching the end of pattern, the pattern restarts from the beginning.
915 \end_layout
917 \begin_layout Subsubsection
918 repaint
919 \end_layout
921 \begin_layout Standard
922 Force a repaint.
923 \end_layout
925 \begin_layout Subsection
927 \end_layout
929 \begin_layout Standard
930 Only available if lua support is compiled in.
931 \end_layout
933 \begin_layout Subsubsection
934 eval-lua <luacode>
935 \end_layout
937 \begin_layout Standard
938 Run Lua code <luacode> using built-in Lua interpretter.
939 \end_layout
941 \begin_layout Subsubsection
942 run-lua <script>
943 \end_layout
945 \begin_layout Standard
946 Run specified lua file using built-in Lua interpretter.
947 \end_layout
949 \begin_layout Subsection
950 Memory watch
951 \end_layout
953 \begin_layout Subsubsection
954 add-watch <name> <expression>
955 \end_layout
957 \begin_layout Standard
958 Adds new watch (or modifies old one).
959 \end_layout
961 \begin_layout Subsubsection
962 remove-watch <name>
963 \end_layout
965 \begin_layout Standard
966 Remove a watch.
967 \end_layout
969 \begin_layout Section
970 Settings
971 \end_layout
973 \begin_layout Subsection
974 firmwarepath
975 \end_layout
977 \begin_layout Standard
978 Set where bsnes looks for firmware files.
979  Default is 
980 \begin_inset Quotes eld
981 \end_inset
984 \begin_inset Quotes erd
985 \end_inset
988 \end_layout
990 \begin_layout Subsection
991 targetfps
992 \end_layout
994 \begin_layout Standard
995 Set the target fps.
996  Numeric, range is 0.001 to 
997 \begin_inset Quotes eld
998 \end_inset
1000 infinite
1001 \begin_inset Quotes erd
1002 \end_inset
1005  Default is native framerate.
1006 \end_layout
1008 \begin_layout Subsection
1009 savecompression
1010 \end_layout
1012 \begin_layout Standard
1013 Set save compression level (integer 0-9).
1014  Default is 7 (0 is no compression).
1015 \end_layout
1017 \begin_layout Subsection
1018 advance-timeout
1019 \end_layout
1021 \begin_layout Standard
1022 Set the frame advance timeout in milliseconds.
1023  Numeric integer, range is 0-999999999.
1024  Default is 500.
1025 \end_layout
1027 \begin_layout Subsection
1028 avi-large
1029 \end_layout
1031 \begin_layout Standard
1032 AVI dumper: Always dump at 512x448 or 512x478 regardless of what the console
1033  outputs.
1034 \end_layout
1036 \begin_layout Subsection
1037 avi-left-border
1038 \end_layout
1040 \begin_layout Standard
1041 AVI dumper: Set the default left border thickness (unless lua overrides)
1042  for dumps.
1043  Range 0-8191.
1044  Default is 0.
1045 \end_layout
1047 \begin_layout Subsection
1048 avi-right-border
1049 \end_layout
1051 \begin_layout Standard
1052 AVI dumper: Set the default right border thickness (unless lua overrides)
1053  for dumps.
1054  Range 0-8191.
1055  Default is 0.
1056 \end_layout
1058 \begin_layout Subsection
1059 avi-top-border
1060 \end_layout
1062 \begin_layout Standard
1063 AVI dumper: Set the default top border thickness (unless lua overrides)
1064  for dumps.
1065  Range 0-8191.
1066  Default is 0.
1067 \end_layout
1069 \begin_layout Subsection
1070 avi-bottom-border
1071 \end_layout
1073 \begin_layout Standard
1074 AVI dumper: Set the default bottom border thickness (unless lua overrides)
1075  for dumps.
1076  Range 0-8191.
1077  Default is 0.
1078 \end_layout
1080 \begin_layout Subsection
1081 avi-maxframes
1082 \end_layout
1084 \begin_layout Standard
1085 AVI dumper: Maximum number of frames per dump segment (0 => unlimited).
1086  Range 0-999999999.
1087  Default is 0.
1088 \end_layout
1090 \begin_layout Section
1091 Lua functions
1092 \end_layout
1094 \begin_layout Subsection
1095 Core (in main table)
1096 \end_layout
1098 \begin_layout Subsubsection
1099 print
1100 \end_layout
1102 \begin_layout Standard
1103 Print line to message console.
1104 \end_layout
1106 \begin_layout Subsubsection
1107 exec(string command)
1108 \end_layout
1110 \begin_layout Standard
1111 Run command as it was entered on the command line
1112 \end_layout
1114 \begin_layout Subsection
1115 Table bit:
1116 \end_layout
1118 \begin_layout Standard
1119 Bitwise logical functions and related.
1120 \end_layout
1122 \begin_layout Subsubsection
1123 none(number...) / bnot(number...)
1124 \end_layout
1126 \begin_layout Standard
1127 48-bit bitwise NOT / NONE function (set bits that are set in none of the
1128  arguments).
1129 \end_layout
1131 \begin_layout Subsubsection
1132 any(number...) / bor(number...)
1133 \end_layout
1135 \begin_layout Standard
1136 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
1137 \end_layout
1139 \begin_layout Subsubsection
1140 all(number...) / band(number...)
1141 \end_layout
1143 \begin_layout Standard
1144 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
1146 \end_layout
1148 \begin_layout Subsubsection
1149 parity(number...) / bxor(number...)
1150 \end_layout
1152 \begin_layout Standard
1153 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
1154  of the arguments).
1155 \end_layout
1157 \begin_layout Subsubsection
1158 lrotate(number base[, number amount[, number bits]])
1159 \end_layout
1161 \begin_layout Standard
1162 Rotate bits-bit (max 48, default 48) number left by amount (default 1) places.
1163 \end_layout
1165 \begin_layout Subsubsection
1166 rrotate(number base[, number amount[, number bits]])
1167 \end_layout
1169 \begin_layout Standard
1170 Rotate bits-bit (max 48, default 48) number right by amount (default 1)
1171  places.
1172 \end_layout
1174 \begin_layout Subsubsection
1175 lshift(number base[, number amount[, number bits]])
1176 \end_layout
1178 \begin_layout Standard
1179 Shift bits-bit (max 48, default 48) number left by amount (default 1) places.
1180  The new bits are filled with zeroes.
1181 \end_layout
1183 \begin_layout Subsubsection
1184 lrshift(number base[, number amount[, number bits]])
1185 \end_layout
1187 \begin_layout Standard
1188 Shift bits-bit (max 48, default 48) number logically right by amount (default
1189  1) places.
1190  The new bits are filled with zeroes.
1191 \end_layout
1193 \begin_layout Subsubsection
1194 arshift(number base[, number amount[, number bits]])
1195 \end_layout
1197 \begin_layout Standard
1198 Shift bits-bit (max 48, default 48) number arithmetically right by amount
1199  (default 1) places.
1200  The new bits are shifted in with copy of the high bit.
1201 \end_layout
1203 \begin_layout Subsection
1204 Table gui:
1205 \end_layout
1207 \begin_layout Standard
1208 Most of these functions can only be called in on_paint and on_video callbacks.
1209  Exceptions are noted.
1210 \end_layout
1212 \begin_layout Subsubsection
1213 gui.resolution()
1214 \end_layout
1216 \begin_layout Standard
1217 Returns 5-tuple (hresolution, vresolution, rshift, gshift, bshift).
1218 \end_layout
1220 \begin_layout Subsubsection
1221 gui.<class>_gap(number gap)
1222 \end_layout
1224 \begin_layout Standard
1225 Set the <class> (left, right, top, bottom) gap to specified value (max gap
1226  is 8191).
1227 \end_layout
1229 \begin_layout Subsubsection
1230 gui.text(number x, number y, string text[, number fgc[, number fga[, number
1231  bgc[, number bga]]]])
1232 \end_layout
1234 \begin_layout Standard
1235 Draw text on the GUI.
1236  Font size is 8(or 16) by 16.
1237  Notes:
1238 \end_layout
1240 \begin_layout Itemize
1241 Coordinate origin is at top-left of the game area.
1242  Left and top gaps have negative coordinates.
1243 \end_layout
1245 \begin_layout Itemize
1246 Use gui.resolution() to discover how to layout colors.
1247 \end_layout
1249 \begin_layout Itemize
1250 Alpha range is 0(transparent)-256(opaque).
1251 \end_layout
1253 \begin_layout Itemize
1254 Only available in on_paint() and on_video() callbacks.
1255 \end_layout
1257 \begin_layout Subsubsection
1258 gui.repaint()
1259 \end_layout
1261 \begin_layout Standard
1262 Request on_repaint() to happen as soon as possible.
1263  Can be used anywhere.
1264 \end_layout
1266 \begin_layout Subsubsection
1267 gui.subframe_update(boolean on)
1268 \end_layout
1270 \begin_layout Standard
1271 Request subframe updates (calling on_paint() on subframes) to happen (on=true)
1272  or not happen (on=false).
1273  Can be used anywhere.
1274 \end_layout
1276 \begin_layout Subsection
1277 table input
1278 \end_layout
1280 \begin_layout Standard
1281 Input handling.
1282  Only available in on_input callback.
1283 \end_layout
1285 \begin_layout Subsection
1286 get(number controller, number index)
1287 \end_layout
1289 \begin_layout Standard
1290 Read the specified index (0-11) from specified controller (0-7).
1291  Notes:
1292 \end_layout
1294 \begin_layout Itemize
1295 Uses physical controller numbering.
1296  Gamepad in port 2 is controller 4, not 1!
1297 \end_layout
1299 \begin_layout Subsection
1300 set(number controller, number index, number value)
1301 \end_layout
1303 \begin_layout Standard
1304 Write the specified index (0-11) from specified controller (0-7), storing
1305  value.
1306  Notes:
1307 \end_layout
1309 \begin_layout Itemize
1310 Uses physical controller numbering.
1311  Gamepad in port 2 is controller 4, not 1!
1312 \end_layout
1314 \begin_layout Subsection
1315 reset([number cycles])
1316 \end_layout
1318 \begin_layout Standard
1319 Execute reset.
1320  If cycles is greater than zero, do delayed reset.
1321 \end_layout
1323 \begin_layout Itemize
1324 Only available with subframe flag false.
1325 \end_layout
1327 \begin_layout Subsection
1328 Table hostmemory
1329 \end_layout
1331 \begin_layout Standard
1332 Host memory handling (extra memory saved to savestates).
1333  Host memory starts empty.
1334 \end_layout
1336 \begin_layout Subsubsection
1337 read(number address)
1338 \end_layout
1340 \begin_layout Standard
1341 Reads hostmemory slot address.
1342  Slot numbers out of range return false instead of numeric.
1343 \end_layout
1345 \begin_layout Subsubsection
1346 write(number address, number value)
1347 \end_layout
1349 \begin_layout Standard
1350 Writes hostmemory slot with 0-255.
1351  Slot numbers out of range cause extension of host memory slot space.
1352 \end_layout
1354 \begin_layout Subsection
1355 Table movie
1356 \end_layout
1358 \begin_layout Standard
1359 Movie handling
1360 \end_layout
1362 \begin_layout Subsubsection
1363 movie.currentframe()
1364 \end_layout
1366 \begin_layout Standard
1367 Return number of current frame.
1368 \end_layout
1370 \begin_layout Subsubsection
1371 movie.framecount()
1372 \end_layout
1374 \begin_layout Standard
1375 Return number of frames in movie.
1376 \end_layout
1378 \begin_layout Subsubsection
1379 movie.readonly()
1380 \end_layout
1382 \begin_layout Standard
1383 Return true if in readonly mode, false if in readwrite.
1384 \end_layout
1386 \begin_layout Subsubsection
1387 movie.set_readwrite()
1388 \end_layout
1390 \begin_layout Standard
1391 Set readwrite mode (does not cause on_readwrite callback).
1392 \end_layout
1394 \begin_layout Subsubsection
1395 movie.frame_subframes(number frame)
1396 \end_layout
1398 \begin_layout Standard
1399 Count number of subframes in specified frame (frame numbers are 1-based)
1400  and return that.
1401 \end_layout
1403 \begin_layout Subsubsection
1404 movie.read_subframe(number frame, number subframe)
1405 \end_layout
1407 \begin_layout Standard
1408 Read specifed subframe in specified frame and return data as array (100
1409  elements, numbered 0-99 currently).
1410 \end_layout
1412 \begin_layout Subsection
1413 Table settings
1414 \end_layout
1416 \begin_layout Standard
1417 Routines for settings manipulation
1418 \end_layout
1420 \begin_layout Subsubsection
1421 get(string name)
1422 \end_layout
1424 \begin_layout Standard
1425 Get value of setting.
1426  If setting is blank, returns false.
1427  If setting value can't be obtained, returns (nil, error message).
1428 \end_layout
1430 \begin_layout Subsubsection
1431 set(string name, string value)
1432 \end_layout
1434 \begin_layout Standard
1435 Set value of setting.
1436  If setting can't be set, returns (nil, error message).
1437 \end_layout
1439 \begin_layout Subsubsection
1440 is_set(string name)
1441 \end_layout
1443 \begin_layout Standard
1444 Returns if setting is set.
1445  If setting does not exist, returns (nil, error message).
1446 \end_layout
1448 \begin_layout Subsubsection
1449 blank(string name)
1450 \end_layout
1452 \begin_layout Standard
1453 Blanks a setting and returns true.
1454  If setting can't be blanked, returns (nil, error message).
1455 \end_layout
1457 \begin_layout Subsection
1458 Callbacks
1459 \end_layout
1461 \begin_layout Standard
1462 Various callbacks to Lua that can occur.
1463 \end_layout
1465 \begin_layout Subsubsection
1466 Callback: on_paint()
1467 \end_layout
1469 \begin_layout Standard
1470 Called when screen is being painted.
1471  Any gui.* calls requiring graphic context draw on the screen.
1472 \end_layout
1474 \begin_layout Subsubsection
1475 Callback: on_video()
1476 \end_layout
1478 \begin_layout Standard
1479 Called when video dump frame is being painted.
1480  Any gui.* calls requiring graphic context draw on the video.
1481 \end_layout
1483 \begin_layout Subsubsection
1484 Callback: on_startup()
1485 \end_layout
1487 \begin_layout Standard
1488 Called when the emulator is starting (lsnes.rc has been run).
1489 \end_layout
1491 \begin_layout Subsubsection
1492 Callback: on_pre_load(string name)
1493 \end_layout
1495 \begin_layout Standard
1496 Called just before savestate/movie load occurs (note: loads are always delayed,
1497  so this occurs even when load was initiated by lua).
1498 \end_layout
1500 \begin_layout Subsubsection
1501 Callback: on_err_load(string name)
1502 \end_layout
1504 \begin_layout Standard
1505 Called if loadstate goes wrong.
1506 \end_layout
1508 \begin_layout Subsubsection
1509 Callback: on_post_load(string name, boolean was_savestate)
1510 \end_layout
1512 \begin_layout Standard
1513 Called on successful loadstate.
1514  was_savestate gives if this was a savestate or a movie.
1515 \end_layout
1517 \begin_layout Subsubsection
1518 Callback: on_pre_save(string name, boolean is_savestate)
1519 \end_layout
1521 \begin_layout Standard
1522 Called just before savestate save occurs (note: movie saves are synchronous
1523  and won't trigger these callbacks if called from Lua).
1524 \end_layout
1526 \begin_layout Subsubsection
1527 Callback: on_err_save(string name)
1528 \end_layout
1530 \begin_layout Standard
1531 Called if savestate goes wrong.
1532 \end_layout
1534 \begin_layout Subsubsection
1535 Callback: on_post_save(string name, boolean is_savestate)
1536 \end_layout
1538 \begin_layout Standard
1539 Called on successful savaestate.
1540  is_savestate gives if this was a savestate or a movie.
1541 \end_layout
1543 \begin_layout Subsubsection
1544 Callback: on_quit()
1545 \end_layout
1547 \begin_layout Standard
1548 Called when emulator is shutting down.
1549 \end_layout
1551 \begin_layout Subsubsection
1552 Callback: on_input(boolean subframe)
1553 \end_layout
1555 \begin_layout Standard
1556 Called when emulator is just sending input to bsnes core.
1557  Warning: This is called even in readonly mode, but the results are ignored.
1558 \end_layout
1560 \begin_layout Subsubsection
1561 Callback: on_reset()
1562 \end_layout
1564 \begin_layout Standard
1565 Called when SNES is reset.
1566 \end_layout
1568 \begin_layout Subsubsection
1569 Callback: on_readwrite()
1570 \end_layout
1572 \begin_layout Standard
1573 Called when moving into readwrite mode as result of 
1574 \begin_inset Quotes eld
1575 \end_inset
1577 set-rwmode
1578 \begin_inset Quotes erd
1579 \end_inset
1581  command (note: moving to rwmode by Lua won't trigger this, as per recursive
1582  entry protection).
1583 \end_layout
1585 \begin_layout Subsubsection
1586 Callback: on_snoop(number port, number controller, number index, number
1587  value)
1588 \end_layout
1590 \begin_layout Standard
1591 Called each time bsnes asks for input.
1592  The value is the final value to be sent to bsnes core.
1593  Might be useful when translating movies to format suitable for console
1594  verification.
1595 \end_layout
1597 \begin_layout Section
1598 SDL platform:
1599 \end_layout
1601 \begin_layout Subsection
1602 Platform-specific commands:
1603 \end_layout
1605 \begin_layout Subsubsection
1606 enable-sound on
1607 \end_layout
1609 \begin_layout Standard
1610 Enable sounds in GUI (has no effect on video dumping).
1611 \end_layout
1613 \begin_layout Subsubsection
1614 enable-sound off
1615 \end_layout
1617 \begin_layout Standard
1618 Disable sounds in GUI (has no effect on video dumping).
1619 \end_layout
1621 \begin_layout Subsubsection
1622 identify-key
1623 \end_layout
1625 \begin_layout Standard
1626 Asks to press a key and then identifies that key.
1627 \end_layout
1629 \begin_layout Subsubsection
1630 toggle-console
1631 \end_layout
1633 \begin_layout Standard
1634 Toggle between windowed/fullscreen console.
1635 \end_layout
1637 \begin_layout Subsubsection
1638 scroll-fullup
1639 \end_layout
1641 \begin_layout Standard
1642 Scroll messages window as far back as it goes.
1643 \end_layout
1645 \begin_layout Subsubsection
1646 scroll-fulldown
1647 \end_layout
1649 \begin_layout Standard
1650 Scroll messages window as far forward as it goes.
1651 \end_layout
1653 \begin_layout Subsubsection
1654 scroll-up
1655 \end_layout
1657 \begin_layout Standard
1658 Scroll messages window back one screenful.
1659 \end_layout
1661 \begin_layout Subsubsection
1662 scroll-down
1663 \end_layout
1665 \begin_layout Standard
1666 Scroll messages window forward one screenful.
1667 \end_layout
1669 \begin_layout Subsubsection
1670 axismode <axis> <mode>
1671 \end_layout
1673 \begin_layout Standard
1674 Set joystick axis mode.
1675  <axis> is of form 
1676 \begin_inset Quotes eld
1677 \end_inset
1679 joystick<num>axis<axis>
1680 \begin_inset Quotes erd
1681 \end_inset
1683 , e.g.
1685 \begin_inset Quotes eld
1686 \end_inset
1688 joystick0axis5
1689 \begin_inset Quotes erd
1690 \end_inset
1693  Mode is one of:
1694 \end_layout
1696 \begin_layout Itemize
1697 axis: Normal axis mode
1698 \end_layout
1700 \begin_layout Itemize
1701 axis_inverse: Inverse axis mode.
1702 \end_layout
1704 \begin_layout Itemize
1705 pressure_0m: Pressure sensitive.
1706  Released at 0, pressed at full negative.
1707 \end_layout
1709 \begin_layout Itemize
1710 pressure_0p: Pressure sensitive.
1711  Released at 0, pressed at full positive.
1712 \end_layout
1714 \begin_layout Itemize
1715 pressure_m0: Pressure sensitive.
1716  Released at full negative, pressed at 0.
1717 \end_layout
1719 \begin_layout Itemize
1720 pressure_mp: Pressure sensitive.
1721  Released at full negative, pressed at full positive.
1722 \end_layout
1724 \begin_layout Itemize
1725 pressure_p0: Pressure sensitive.
1726  Released at full positive, pressed at 0.
1727 \end_layout
1729 \begin_layout Itemize
1730 pressure_pm: Pressure sensitive.
1731  Released at full positive, pressed at full negative.
1732 \end_layout
1734 \begin_layout Standard
1735 Note that if you have Wired Microsoft XBox 360 controller (works great in
1736  Linux, BTW), you might want to do the following:
1737 \end_layout
1739 \begin_layout Itemize
1740 axismode joystick0axis2 pressure_mp
1741 \end_layout
1743 \begin_layout Itemize
1744 axismode joystick0axis5 pressure_mp
1745 \end_layout
1747 \begin_layout Standard
1748 Since axes 2 and 5 are LT/RT, which are pressure sensitive.
1749 \end_layout
1751 \begin_layout Subsection
1752 Settings
1753 \end_layout
1755 \begin_layout Subsubsection
1756 autorepeat-first-delay
1757 \end_layout
1759 \begin_layout Standard
1760 Sets the delay for first character in typematic autorepeat.
1761 \end_layout
1763 \begin_layout Subsubsection
1764 autorepeat-subsequent-delay
1765 \end_layout
1767 \begin_layout Standard
1768 Sets the delay for subsequent characters in typematic autorepeat.
1769 \end_layout
1771 \begin_layout Subsection
1772 Modifier names
1773 \end_layout
1775 \begin_layout Standard
1776 Following modifier names are known:
1777 \end_layout
1779 \begin_layout Itemize
1780 ctrl, lctrl, rctrl: Control keys
1781 \end_layout
1783 \begin_layout Itemize
1784 alt, lalt, ralt: ALT keys.
1785 \end_layout
1787 \begin_layout Itemize
1788 shift, lshift, rshift: Shift keys.
1789 \end_layout
1791 \begin_layout Itemize
1792 meta, lmeta, rmeta: Meta keys.
1793 \end_layout
1795 \begin_layout Itemize
1796 num, caps: Numlock/Capslock (these are sticky!)
1797 \end_layout
1799 \begin_layout Itemize
1800 mode: Mode select.
1801 \end_layout
1803 \begin_layout Subsection
1804 Key names
1805 \end_layout
1807 \begin_layout Standard
1808 Following key names are known:
1809 \end_layout
1811 \begin_layout Itemize
1812 backspace, tab, clear, return, pause, escape, space, exclaim, quotedbl,
1813  hash, dollar, ampersand, quote, leftparen, rightparen, asterisk, plus,
1814  comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon,
1815  less, equals, greater, question, at, leftbracket, backslash, rightbracket,
1816  caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, n,
1817  o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, world_1, world_2,
1818  world_3, world_4, world_5, world_6, world_7, world_8, world_9, world_10,
1819  world_11, world_12, world_13, world_14, world_15, world_16, world_17, world_18,
1820  world_19, world_20, world_21, world_22, world_23, world_24, world_25, world_26,
1821  world_27, world_28, world_29, world_30, world_31, world_32, world_33, world_34,
1822  world_35, world_36, world_37, world_38, world_39, world_40, world_41, world_42,
1823  world_43, world_44, world_45, world_46, world_47, world_48, world_49, world_50,
1824  world_51, world_52, world_53, world_54, world_55, world_56, world_57, world_58,
1825  world_59, world_60, world_61, world_62, world_63, world_64, world_65, world_66,
1826  world_67, world_68, world_69, world_70, world_71, world_72, world_73, world_74,
1827  world_75, world_76, world_77, world_78, world_79, world_80, world_81, world_82,
1828  world_83, world_84, world_85, world_86, world_87, world_88, world_89, world_90,
1829  world_91, world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, kp4,
1830  kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, kp_multiply, kp_minus, kp_plus,
1831  kp_enter, kp_equals, up, down, right, left, insert, home, end, pageup,
1832  pagedown, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
1833  f15, numlock, capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt,
1834  lalt, rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, sysreq,
1835  break, menu, power, euro, undo
1836 \end_layout
1838 \begin_layout Itemize
1839 Names of form 'key<n>' where <n> is 0-255 are interpretted as key having
1840  hardware-dependent scan code of <n> (useful to bind those keys that don't
1841  have symbolic names).
1842 \end_layout
1844 \begin_layout Standard
1845 In addition, following pseudo-keys are known (note: these do not work yet,
1846  and especially do not work in conjunction with modifers):
1847 \end_layout
1849 \begin_layout Itemize
1850 joystick<num>button<button>: Joystick <num> (0-based) button <button> (0-based).
1851 \end_layout
1853 \begin_layout Itemize
1854 joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> (0-based) up.
1855 \end_layout
1857 \begin_layout Itemize
1858 joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> (0-based) left.
1859 \end_layout
1861 \begin_layout Itemize
1862 joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> (0-based) down.
1863 \end_layout
1865 \begin_layout Itemize
1866 joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> (0-based) right.
1867 \end_layout
1869 \begin_layout Itemize
1870 joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> negative
1871  position.
1872 \end_layout
1874 \begin_layout Itemize
1875 joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> positive
1876  position.
1877 \end_layout
1879 \begin_layout Subsection
1880 Special buttons:
1881 \end_layout
1883 \begin_layout Itemize
1884 Escape: Enter/Exit Command mode, cancel modal dialogs.
1885 \end_layout
1887 \begin_layout Itemize
1888 Return (also KPEnter): Execute command, ok modal dialog.
1889 \end_layout
1891 \begin_layout Itemize
1892 Pgup/Up (also KP8/9 if no num lock; command mode): Previous command in command
1893  history
1894 \end_layout
1896 \begin_layout Itemize
1897 Pgdn/Down(also KP2/3 if no num lock; command mode): Next command in command
1898  history
1899 \end_layout
1901 \begin_layout Itemize
1902 Home (also KP7 if no num lock; command mode): Beginning of command.
1903 \end_layout
1905 \begin_layout Itemize
1906 End (also KP1 if no num lock; command mode): End of command.
1907 \end_layout
1909 \begin_layout Itemize
1910 Left (also KP4 if no num lock; command mode): Move cursor left.
1911 \end_layout
1913 \begin_layout Itemize
1914 Right (also KP6 if no num lock; command mode): Move cursor right.
1915 \end_layout
1917 \begin_layout Itemize
1918 Delete (also KP.
1919  if no num lock; command mode): Delete character to right of cursor.
1920 \end_layout
1922 \begin_layout Itemize
1923 Insert (also KP0 if no num lock; command mode): Toggle between insert /
1924  overwrite modes.
1925 \end_layout
1927 \begin_layout Itemize
1928 Backspace (command mode): Delete character to left of cursor.
1929 \end_layout
1931 \begin_layout Itemize
1932 LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump corrupted!).
1933 \end_layout
1935 \begin_layout Subsection
1936 Watchdog timer:
1937 \end_layout
1939 \begin_layout Standard
1940 If emulator does not reach internal polling loop in 15 seconds after leaving
1941  it or 15 seconds after starting, the emulator instantly bombs out.
1942 \end_layout
1944 \begin_layout Section
1945 Movie file format
1946 \end_layout
1948 \begin_layout Standard
1949 Movie file is .zip archive in itself, normal ZIP archive tools work on it
1950  (note: If you recompress it, do not use compression methods other than
1951  store and deflate and especially do not use encryption of any kind).
1952 \end_layout
1954 \begin_layout Subsection
1955 Detecting clean start/SRAM/Savestate
1956 \end_layout
1958 \begin_layout Itemize
1959 If file has member 
1960 \begin_inset Quotes eld
1961 \end_inset
1963 savestate
1964 \begin_inset Quotes erd
1965 \end_inset
1967  it is savestate, otherwise:
1968 \end_layout
1970 \begin_layout Itemize
1971 If file has members with names starting 
1972 \begin_inset Quotes eld
1973 \end_inset
1975 moviesram.
1976 \begin_inset Quotes erd
1977 \end_inset
1979  it is movie starting from SRAM, otherwise:
1980 \end_layout
1982 \begin_layout Itemize
1983 It is movie starting from clear state.
1984 \end_layout
1986 \begin_layout Subsection
1987 Member: gametype
1988 \end_layout
1990 \begin_layout Standard
1991 Type of game ROM and region.
1992  Valid values are:
1993 \end_layout
1995 \begin_layout Standard
1996 \begin_inset Tabular
1997 <lyxtabular version="3" rows="8" columns="3">
1998 <features tabularvalignment="middle">
1999 <column alignment="center" valignment="top" width="0">
2000 <column alignment="center" valignment="top" width="0">
2001 <column alignment="center" valignment="top" width="0">
2002 <row>
2003 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2004 \begin_inset Text
2006 \begin_layout Plain Layout
2007 Value
2008 \end_layout
2010 \end_inset
2011 </cell>
2012 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2013 \begin_inset Text
2015 \begin_layout Plain Layout
2016 System
2017 \end_layout
2019 \end_inset
2020 </cell>
2021 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2022 \begin_inset Text
2024 \begin_layout Plain Layout
2025 Region
2026 \end_layout
2028 \end_inset
2029 </cell>
2030 </row>
2031 <row>
2032 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2033 \begin_inset Text
2035 \begin_layout Plain Layout
2036 snes_pal
2037 \end_layout
2039 \end_inset
2040 </cell>
2041 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2042 \begin_inset Text
2044 \begin_layout Plain Layout
2045 Super NES
2046 \end_layout
2048 \end_inset
2049 </cell>
2050 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2051 \begin_inset Text
2053 \begin_layout Plain Layout
2055 \end_layout
2057 \end_inset
2058 </cell>
2059 </row>
2060 <row>
2061 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2062 \begin_inset Text
2064 \begin_layout Plain Layout
2065 sgb_pal
2066 \end_layout
2068 \end_inset
2069 </cell>
2070 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2071 \begin_inset Text
2073 \begin_layout Plain Layout
2074 Super Game Boy
2075 \end_layout
2077 \end_inset
2078 </cell>
2079 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2080 \begin_inset Text
2082 \begin_layout Plain Layout
2084 \end_layout
2086 \end_inset
2087 </cell>
2088 </row>
2089 <row>
2090 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2091 \begin_inset Text
2093 \begin_layout Plain Layout
2094 snes_ntsc
2095 \end_layout
2097 \end_inset
2098 </cell>
2099 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2100 \begin_inset Text
2102 \begin_layout Plain Layout
2103 Super NES
2104 \end_layout
2106 \end_inset
2107 </cell>
2108 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2109 \begin_inset Text
2111 \begin_layout Plain Layout
2112 NTSC
2113 \end_layout
2115 \end_inset
2116 </cell>
2117 </row>
2118 <row>
2119 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2120 \begin_inset Text
2122 \begin_layout Plain Layout
2123 sgb_ntsc
2124 \end_layout
2126 \end_inset
2127 </cell>
2128 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2129 \begin_inset Text
2131 \begin_layout Plain Layout
2132 Super Game Boy
2133 \end_layout
2135 \end_inset
2136 </cell>
2137 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2138 \begin_inset Text
2140 \begin_layout Plain Layout
2141 NTSC
2142 \end_layout
2144 \end_inset
2145 </cell>
2146 </row>
2147 <row>
2148 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2149 \begin_inset Text
2151 \begin_layout Plain Layout
2153 \end_layout
2155 \end_inset
2156 </cell>
2157 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2158 \begin_inset Text
2160 \begin_layout Plain Layout
2161 BS-X (non-slotted)
2162 \end_layout
2164 \end_inset
2165 </cell>
2166 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2167 \begin_inset Text
2169 \begin_layout Plain Layout
2170 NTSC
2171 \end_layout
2173 \end_inset
2174 </cell>
2175 </row>
2176 <row>
2177 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2178 \begin_inset Text
2180 \begin_layout Plain Layout
2181 bsxslotted
2182 \end_layout
2184 \end_inset
2185 </cell>
2186 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2187 \begin_inset Text
2189 \begin_layout Plain Layout
2190 BS-X (slotted)
2191 \end_layout
2193 \end_inset
2194 </cell>
2195 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2196 \begin_inset Text
2198 \begin_layout Plain Layout
2199 NTSC
2200 \end_layout
2202 \end_inset
2203 </cell>
2204 </row>
2205 <row>
2206 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2207 \begin_inset Text
2209 \begin_layout Plain Layout
2210 sufamiturbo
2211 \end_layout
2213 \end_inset
2214 </cell>
2215 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2216 \begin_inset Text
2218 \begin_layout Plain Layout
2219 Sufami Turbo
2220 \end_layout
2222 \end_inset
2223 </cell>
2224 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2225 \begin_inset Text
2227 \begin_layout Plain Layout
2228 NTSC
2229 \end_layout
2231 \end_inset
2232 </cell>
2233 </row>
2234 </lyxtabular>
2236 \end_inset
2239 \end_layout
2241 \begin_layout Standard
2242 Frame rates are:
2243 \end_layout
2245 \begin_layout Standard
2246 \begin_inset Tabular
2247 <lyxtabular version="3" rows="3" columns="2">
2248 <features tabularvalignment="middle">
2249 <column alignment="center" valignment="top" width="0">
2250 <column alignment="center" valignment="top" width="0">
2251 <row>
2252 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2253 \begin_inset Text
2255 \begin_layout Plain Layout
2256 Region
2257 \end_layout
2259 \end_inset
2260 </cell>
2261 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2262 \begin_inset Text
2264 \begin_layout Plain Layout
2265 Framerate
2266 \end_layout
2268 \end_inset
2269 </cell>
2270 </row>
2271 <row>
2272 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2273 \begin_inset Text
2275 \begin_layout Plain Layout
2277 \end_layout
2279 \end_inset
2280 </cell>
2281 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2282 \begin_inset Text
2284 \begin_layout Plain Layout
2285 322445/6448
2286 \end_layout
2288 \end_inset
2289 </cell>
2290 </row>
2291 <row>
2292 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2293 \begin_inset Text
2295 \begin_layout Plain Layout
2296 NTSC
2297 \end_layout
2299 \end_inset
2300 </cell>
2301 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2302 \begin_inset Text
2304 \begin_layout Plain Layout
2305 10738636/178683
2306 \end_layout
2308 \end_inset
2309 </cell>
2310 </row>
2311 </lyxtabular>
2313 \end_inset
2316 \end_layout
2318 \begin_layout Subsection
2319 Member: port1
2320 \end_layout
2322 \begin_layout Standard
2323 Contains type of port #1.
2324  Valid values are 'none', 'gamepad', 'multitap' and 'mouse'.
2325  If not present, defaults to 'gamepad'.
2326 \end_layout
2328 \begin_layout Subsection
2329 Member: port2
2330 \end_layout
2332 \begin_layout Standard
2333 Contains type of port #2.
2334  Valid values are 'none', 'gamepad', 'multitap', 'mouse', 'superscope',
2335  'justifier' and 'justifiers'.
2336  If not present, defaults to 'none'.
2337 \end_layout
2339 \begin_layout Subsection
2340 Member: gamename
2341 \end_layout
2343 \begin_layout Standard
2344 Contains name of the game.
2345 \end_layout
2347 \begin_layout Subsection
2348 Member: authors
2349 \end_layout
2351 \begin_layout Standard
2352 Contains authors, one per line.
2353  Part before '|' is the full name, part after is the nickname.
2354 \end_layout
2356 \begin_layout Subsection
2357 Member: systemid
2358 \end_layout
2360 \begin_layout Standard
2361 Always 
2362 \begin_inset Quotes eld
2363 \end_inset
2365 lsnes-rr1
2366 \begin_inset Quotes erd
2367 \end_inset
2370  Used to reject other saves.
2371 \end_layout
2373 \begin_layout Subsection
2374 Member: controlsversion
2375 \end_layout
2377 \begin_layout Standard
2378 Always 
2379 \begin_inset Quotes eld
2380 \end_inset
2383 \begin_inset Quotes erd
2384 \end_inset
2387  Used to identify what controls are there.
2388 \end_layout
2390 \begin_layout Subsection
2391 Member: 
2392 \begin_inset Quotes eld
2393 \end_inset
2395 coreversion
2396 \begin_inset Quotes erd
2397 \end_inset
2400 \end_layout
2402 \begin_layout Standard
2403 Contains bsnes core version number.
2404 \end_layout
2406 \begin_layout Subsection
2407 Member: projectid
2408 \end_layout
2410 \begin_layout Standard
2411 Contains project ID.
2412  Used to identify if two movies are part of the same project.
2413 \end_layout
2415 \begin_layout Subsection
2416 Member: {rom,slota,slotb}{,xml}.sha256
2417 \end_layout
2419 \begin_layout Standard
2420 Contains SHA-256 of said ROM or ROM mapping file.
2421  Absent if corresponding file is absent.
2422 \end_layout
2424 \begin_layout Subsection
2425 Member: moviesram.<name>
2426 \end_layout
2428 \begin_layout Standard
2429 Raw binary startup SRAM of kind <name>.
2430  Only present in savestates and movies starting from SRAM.
2431 \end_layout
2433 \begin_layout Subsection
2434 Member: moviestate
2435 \end_layout
2437 \begin_layout Standard
2438 Raw binary movie state data.
2439  Only present in savestates.
2440 \end_layout
2442 \begin_layout Standard
2443 for version 0:
2444 \end_layout
2446 \begin_layout Itemize
2447 32 bytes: SHA-256 of project ID.
2448 \end_layout
2450 \begin_layout Itemize
2451 8 bytes: Big-endian current frame.
2452 \end_layout
2454 \begin_layout Itemize
2455 100x4 bytes: Poll counters for each control (bit31 of each is 
2456 \begin_inset Quotes eld
2457 \end_inset
2459 data ready
2460 \begin_inset Quotes erd
2461 \end_inset
2463  bit), big-endian.
2464 \end_layout
2466 \begin_layout Itemize
2467 8 bytes: Big-endian lag frame count.
2468 \end_layout
2470 \begin_layout Itemize
2471 32 bytes: SHA-256 of past input
2472 \end_layout
2474 \begin_layout Itemize
2475 32 bytes: SHA-256 of previous.
2476 \end_layout
2478 \begin_layout Subsection
2479 Member: hostmemory
2480 \end_layout
2482 \begin_layout Standard
2483 Raw binary dump of host memory.
2484  Only present in savestates.
2485 \end_layout
2487 \begin_layout Subsection
2488 Member: savestate
2489 \end_layout
2491 \begin_layout Standard
2492 The savestate itself.
2493  Savestate detection uses this file, only present in savestates.
2494 \end_layout
2496 \begin_layout Subsection
2497 Member: screenshot
2498 \end_layout
2500 \begin_layout Standard
2501 Screenshot of current frame.
2502  Only present in savestates.
2503 \end_layout
2505 \begin_layout Subsection
2506 Member: sram.<name>
2507 \end_layout
2509 \begin_layout Standard
2510 Raw binary SRAM of kind <name> at time of savestate.
2511  Only present in savestates.
2512 \end_layout
2514 \begin_layout Subsection
2515 Member: input
2516 \end_layout
2518 \begin_layout Standard
2519 The actual input track, one line per subframe (blank lines are skipped).
2520 \end_layout
2522 \begin_layout Itemize
2523 If the first byte of each line is '.', ' ', <tab> or '|', then the line is
2524  part of same frame as previous, otherwise it starts a new frame.
2525 \end_layout
2527 \begin_layout Itemize
2528 First subframe must start a new frame.
2529 \end_layout
2531 \begin_layout Standard
2532 Length of movie in frames is number of lines in input file that start a
2533  new frame.
2534 \end_layout
2536 \begin_layout Subsection
2537 Member: rerecords
2538 \end_layout
2540 \begin_layout Standard
2541 Contains textual base-10 rerecord count (emulator just writes this, it doesn't
2542  read it) + 1.
2543 \end_layout
2545 \begin_layout Subsection
2546 Member: rrdata
2547 \end_layout
2549 \begin_layout Standard
2550 This member stores set of load IDs.
2551  There is one load ID per rerecord (plus one corresponding to start of project).
2552 \end_layout
2554 \begin_layout Itemize
2555 This member constists of concatenation of records
2556 \end_layout
2558 \begin_layout Itemize
2559 Each record is 2-36 bytes long and can represent 1-16,843,009 consequtive
2560  IDs.
2561 \end_layout
2563 \begin_layout Itemize
2564 IDs are interpretted as 256-bit big-endian integers with warparound.
2565 \end_layout
2567 \begin_layout Itemize
2568 Initial predicted ID is all zeroes.
2569 \end_layout
2571 \begin_layout Standard
2572 Format of each record is:
2573 \end_layout
2575 \begin_layout Itemize
2576 1 byte: Opcode byte.
2577  Bits 0-4 are prefix length (prefixlen), bits 5-6 are count length (countlen).
2578  Bit 7 is unused.
2579 \end_layout
2581 \begin_layout Itemize
2582 32-prefixlen bytes of ID.
2583 \end_layout
2585 \begin_layout Itemize
2586 countlen bytes of big-endian count (count).
2587 \end_layout
2589 \begin_layout Standard
2590 Records are processed as follows:
2591 \end_layout
2593 \begin_layout Itemize
2594 To form the first ID encoded by record, take the first prefixlen bytes predicted
2595  ID and append the read ID value to it.
2596  The result is the first ID encoded.
2597 \end_layout
2599 \begin_layout Itemize
2600 If countlen is 0, record encodes 1 ID.
2601 \end_layout
2603 \begin_layout Itemize
2604 If countlen is 1, record encodes 2+count IDs.
2605 \end_layout
2607 \begin_layout Itemize
2608 If countlen is 2, record encodes 258+count IDs.
2609 \end_layout
2611 \begin_layout Itemize
2612 If countlen is 3, record encodes 65794+count IDs.
2613 \end_layout
2615 \begin_layout Itemize
2616 The new predicted ID is the next ID after last one encoded by the record.
2617 \end_layout
2619 \begin_layout Standard
2620 The number of rerecords + 1 is equal to the sum of number of IDs encoded
2621  by all records.
2622 \end_layout
2624 \begin_layout Section
2625 Compiling:
2626 \end_layout
2628 \begin_layout Subsection
2629 Building BSNES
2630 \end_layout
2632 \begin_layout Standard
2633 make ui=ui-libsnes options=debugger profile=accuracy
2634 \end_layout
2636 \begin_layout Itemize
2637 Yes, debugger is needed.
2638 \end_layout
2640 \begin_layout Subsection
2641 Prerequisite libraries:
2642 \end_layout
2644 \begin_layout Itemize
2645 zlib
2646 \end_layout
2648 \begin_layout Itemize
2649 SDL (SDL platform)
2650 \end_layout
2652 \begin_layout Itemize
2653 boost_iostreams
2654 \end_layout
2656 \begin_layout Itemize
2657 boost_filesystem
2658 \end_layout
2660 \begin_layout Itemize
2661 boost (conversion)
2662 \end_layout
2664 \begin_layout Subsection
2665 Compile options to make:
2666 \end_layout
2668 \begin_layout Subsubsection
2669 BSNES_PATH=<path>
2670 \end_layout
2672 \begin_layout Standard
2673 Set path to BSNES bsnes directory to <path>.
2674 \end_layout
2676 \begin_layout Subsubsection
2677 NO_THREADS=1
2678 \end_layout
2680 \begin_layout Standard
2681 Don't use threads (makes dumping slower, but threads probably only work
2682  on Linux).
2683 \end_layout
2685 \begin_layout Subsubsection
2686 CC=<compiler>
2687 \end_layout
2689 \begin_layout Standard
2690 (cross) C++ compiler to use.
2691  Defaults to g++-4.5
2692 \end_layout
2694 \begin_layout Subsubsection
2695 HOSTCC=<compiler>
2696 \end_layout
2698 \begin_layout Standard
2699 (host) C++ compiler to use.
2700  Defaults to the same as CC.
2701 \end_layout
2703 \begin_layout Subsubsection
2704 BSNES_IS_COMPAT=1
2705 \end_layout
2707 \begin_layout Standard
2708 Assume BSNES uses compatiblity core instead of accuracy core.
2709 \end_layout
2711 \begin_layout Subsubsection
2712 NO_LUA=1
2713 \end_layout
2715 \begin_layout Standard
2716 Don't compile in Lua support.
2717 \end_layout
2719 \begin_layout Section
2720 Errata:
2721 \end_layout
2723 \begin_layout Subsection
2724 Problems from BSNES core:
2725 \end_layout
2727 \begin_layout Itemize
2728 The whole pending save stuff.
2729 \end_layout
2731 \begin_layout Itemize
2732 Delay resets are slow.
2733 \end_layout
2735 \begin_layout Itemize
2736 RTC is not emulated in sync-stable manner.
2737 \end_layout
2739 \begin_layout Itemize
2740 Lack of layer hiding.
2741 \end_layout
2743 \begin_layout Itemize
2744 It is slow.
2745 \end_layout
2747 \begin_layout Itemize
2748 Firmwares can't be loaded from ZIP archives.
2749 \end_layout
2751 \begin_layout Itemize
2752 Manual polls can be corrupted if savestate occurs during those.
2753 \end_layout
2755 \begin_layout Subsection
2756 TODO For rr0:
2757 \end_layout
2759 \begin_layout Itemize
2760 Make it build on Windows (and build binaries).
2761  Not todo for rr0-β0.
2762 \end_layout
2764 \begin_layout Subsection
2765 Other problems:
2766 \end_layout
2768 \begin_layout Itemize
2769 Audio for last dumped frame is not itself dumped.
2770 \end_layout
2772 \begin_layout Itemize
2773 Audio in UI is pretty bad in quality.
2774 \end_layout
2776 \begin_layout Itemize
2777 UI itself is 30fps max.
2778 \end_layout
2780 \begin_layout Itemize
2781 AVI compression levels 10-18 are not compatible with AVISynth AVISource.
2782 \end_layout
2784 \begin_layout Itemize
2785 No menus, command based interface (SDL).
2786 \end_layout
2788 \begin_layout Itemize
2789 Long commands don't scroll.
2790 \end_layout
2792 \begin_layout Itemize
2793 No autofire
2794 \end_layout
2796 \begin_layout Itemize
2797 Joysticks don't work.
2798 \end_layout
2800 \begin_layout Section
2801 Changelog:
2802 \end_layout
2804 \begin_layout Subsection
2805 rr0-β1
2806 \end_layout
2808 \begin_layout Itemize
2809 Fix -Wall warnings
2810 \end_layout
2812 \begin_layout Itemize
2813 Fix dumper video corruption with levels 10-18.
2814 \end_layout
2816 \end_body
2817 \end_document