lsnes rr0-β0
[lsnes.git] / manual.lyx
blobcc3f18022be12d3d0c83b05ea99a938b088368c3
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-video <level> <prefix>
434 \end_layout
436 \begin_layout Standard
437 Dump video to prefix <prefix> at level <level> (0-18).
438 \end_layout
440 \begin_layout Itemize
441 The codec is Camstudio Codec.
442 \end_layout
444 \begin_layout Itemize
445 Audio enable/disable and framerate has no effect.
446 \end_layout
448 \begin_layout Itemize
449 Warning: Levels 10-18 are not compatible with AVISource (and don't seem
450  to be compatible with some ffmpeg versions either).
451 \end_layout
453 \begin_layout Itemize
454 Recomended level is 7.
455 \end_layout
457 \begin_layout Subsubsection
458 end-video
459 \end_layout
461 \begin_layout Standard
462 End current video dump.
463 \end_layout
465 \begin_layout Subsection
466 Memory manipulation
467 \end_layout
469 \begin_layout Standard
470 <address> may be decimal or hexadecimal (prefixed with '0x').
471  <value> can be hexadecimal (prefixed with '0x'), unsigned or signed (prefixed
472  with '-') decimal.
473 \end_layout
475 \begin_layout Standard
476 The available element <sizes> are:
477 \end_layout
479 \begin_layout Itemize
480 byte: 1 byte
481 \end_layout
483 \begin_layout Itemize
484 word: 2 bytes
485 \end_layout
487 \begin_layout Itemize
488 dword: 4 bytes
489 \end_layout
491 \begin_layout Itemize
492 qword: 8 bytes
493 \end_layout
495 \begin_layout Standard
496 When reading RAM and ROM, multi-byte reads/writes are big-endian.
497  When dealing with DSP memory, multi-byte reads/writes are native-endian
498  (do not use operand sizes exceeding DSP bitness, except dword is OK for
499  24-bit memory).
500 \end_layout
502 \begin_layout Subsubsection
503 read-<size> <address>
504 \end_layout
506 \begin_layout Standard
507 Read the value of byte in <address>.
508 \end_layout
510 \begin_layout Subsubsection
511 read-s<size> <address>
512 \end_layout
514 \begin_layout Standard
515 Read the value of signed byte in <address>.
516 \end_layout
518 \begin_layout Subsubsection
519 write-<size> <address> <value>
520 \end_layout
522 \begin_layout Standard
523 Write <value> to byte in address <address>.
524 \end_layout
526 \begin_layout Subsubsection
527 search-memory reset
528 \end_layout
530 \begin_layout Standard
531 Reset the memory search
532 \end_layout
534 \begin_layout Subsubsection
535 search-memory count
536 \end_layout
538 \begin_layout Standard
539 Print number of candidates remaining
540 \end_layout
542 \begin_layout Subsubsection
543 search-memory print
544 \end_layout
546 \begin_layout Standard
547 Print all candidates remaining
548 \end_layout
550 \begin_layout Subsubsection
551 search-memory <usflag><sizeflag><op>
552 \end_layout
554 \begin_layout Standard
555 Searches memory for addresses satisfying criteria.
556 \end_layout
558 \begin_layout Standard
559 <usflag> can be:
560 \end_layout
562 \begin_layout Itemize
563 u: unsigned
564 \end_layout
566 \begin_layout Itemize
567 s: signed
568 \end_layout
570 \begin_layout Standard
571 <sizeflag> can be:
572 \end_layout
574 \begin_layout Itemize
575 b: byte
576 \end_layout
578 \begin_layout Itemize
579 w: word
580 \end_layout
582 \begin_layout Itemize
583 d: dword
584 \end_layout
586 \begin_layout Itemize
587 q: qword
588 \end_layout
590 \begin_layout Standard
591 <op> can be:
592 \end_layout
594 \begin_layout Itemize
595 lt: < previous value.
596 \end_layout
598 \begin_layout Itemize
599 le: <= previous value.
600 \end_layout
602 \begin_layout Itemize
603 eq: = previous value.
604 \end_layout
606 \begin_layout Itemize
607 ne: != previous value.
608 \end_layout
610 \begin_layout Itemize
611 ge: >= previous value.
612 \end_layout
614 \begin_layout Itemize
615 gt: > previous value.
616 \end_layout
618 \begin_layout Subsubsection
619 search-memory <sizeflag> <value>
620 \end_layout
622 \begin_layout Standard
623 Searches for addresses that currently have value <value>.
624  <sizeflag> is as in previous command.
625 \end_layout
627 \begin_layout Subsection
628 Main commands
629 \end_layout
631 \begin_layout Standard
632 These commands are not available in lsnesrc, but are available after ROM
633  has been loaded.
634 \end_layout
636 \begin_layout Subsubsection
637 quit-emulator [/y]
638 \end_layout
640 \begin_layout Standard
641 Quits the emulator (asking for confirmation).
642  If /y is given, no confirmation is asked.
643 \end_layout
645 \begin_layout Subsubsection
646 pause-emulator
647 \end_layout
649 \begin_layout Standard
650 Toggle paused/unpaused
651 \end_layout
653 \begin_layout Subsubsection
654 +advance-frame
655 \end_layout
657 \begin_layout Standard
658 Advance frame.
659  If the button is still held after configurable timeout expires, game unpauses
660  for the duration frame advance is held.
661 \end_layout
663 \begin_layout Subsubsection
664 +advance-poll
665 \end_layout
667 \begin_layout Standard
668 Advance subframe.
669  If the button is still held after configurable timeout expires, game unpauses
670  for the duration frame advance is held.
671 \end_layout
673 \begin_layout Subsubsection
674 advance-skiplag
675 \end_layout
677 \begin_layout Standard
678 Skip to first poll in frame after current.
679 \end_layout
681 \begin_layout Subsubsection
682 reset
683 \end_layout
685 \begin_layout Standard
686 Reset the SNES after this frame.
687 \end_layout
689 \begin_layout Subsubsection
690 load-state <filename>
691 \end_layout
693 \begin_layout Standard
694 Load savestate <filename> in readwrite mode.
695 \end_layout
697 \begin_layout Subsubsection
698 load-readonly <filename>
699 \end_layout
701 \begin_layout Standard
702 Load savestate <filename> in readonly mode.
703 \end_layout
705 \begin_layout Subsubsection
706 load-preserve <filename>
707 \end_layout
709 \begin_layout Standard
710 Load savestate <filename> in readonly mode, preserving current events.
711 \end_layout
713 \begin_layout Subsubsection
714 load-movie <filename>
715 \end_layout
717 \begin_layout Standard
718 Load savestate <filename>, ignoring save part in readonly mode.
719 \end_layout
721 \begin_layout Subsubsection
722 save-state <filename>
723 \end_layout
725 \begin_layout Standard
726 Save system state to <filename> as soon as possible.
727 \end_layout
729 \begin_layout Subsubsection
730 save-movie <filename>
731 \end_layout
733 \begin_layout Standard
734 Save movie to <filename>.
735 \end_layout
737 \begin_layout Subsubsection
738 set-rwmode
739 \end_layout
741 \begin_layout Standard
742 Set read-write mode.
743 \end_layout
745 \begin_layout Subsubsection
746 set-gamename <name>
747 \end_layout
749 \begin_layout Standard
750 Set name of the game to <name>
751 \end_layout
753 \begin_layout Subsubsection
754 get-gamename
755 \end_layout
757 \begin_layout Standard
758 Print the name of the game.
759 \end_layout
761 \begin_layout Subsubsection
762 add-author <author>
763 \end_layout
765 \begin_layout Standard
766 Adds new author <author>.
767  If <author> does not contain '|' it is full name.
768  If it contains '|', '|' splits the full name and nickname.
769 \end_layout
771 \begin_layout Subsubsection
772 edit-author <num> <author>
773 \end_layout
775 \begin_layout Standard
776 Edit the author in slot <num> (0-based) to be <author> (see add-author for
777  format)
778 \end_layout
780 \begin_layout Subsubsection
781 remove-author <num>
782 \end_layout
784 \begin_layout Standard
785 Remove author in slot <num>
786 \end_layout
788 \begin_layout Subsubsection
789 print-authors
790 \end_layout
792 \begin_layout Standard
793 Print authors.
794 \end_layout
796 \begin_layout Subsubsection
797 test-1, test-2, test-3
798 \end_layout
800 \begin_layout Standard
801 Internal test commands
802 \end_layout
804 \begin_layout Subsubsection
805 take-screenshot <filename>
806 \end_layout
808 \begin_layout Standard
809 Save screenshot to <filename>.
810 \end_layout
812 \begin_layout Subsubsection
813 +controller<num><button>
814 \end_layout
816 \begin_layout Standard
817 Press button <button> on controller <num> (1-8).
818  The following button names are known:
819 \end_layout
821 \begin_layout Itemize
822 left
823 \end_layout
825 \begin_layout Itemize
826 right
827 \end_layout
829 \begin_layout Itemize
831 \end_layout
833 \begin_layout Itemize
834 down
835 \end_layout
837 \begin_layout Itemize
839 \end_layout
841 \begin_layout Itemize
843 \end_layout
845 \begin_layout Itemize
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
862 select
863 \end_layout
865 \begin_layout Itemize
866 start
867 \end_layout
869 \begin_layout Itemize
870 trigger
871 \end_layout
873 \begin_layout Itemize
874 cursor
875 \end_layout
877 \begin_layout Itemize
878 pause
879 \end_layout
881 \begin_layout Itemize
882 turbo
883 \end_layout
885 \begin_layout Subsubsection
886 controllerh<num><button>
887 \end_layout
889 \begin_layout Standard
890 Hold/unhold button <button> on controller <num> (1-8).
891  See +controller for button names.
892 \end_layout
894 \begin_layout Subsubsection
895 repaint
896 \end_layout
898 \begin_layout Standard
899 Force a repaint.
900 \end_layout
902 \begin_layout Subsection
904 \end_layout
906 \begin_layout Standard
907 Only available if lua support is compiled in.
908 \end_layout
910 \begin_layout Subsubsection
911 eval-lua <luacode>
912 \end_layout
914 \begin_layout Standard
915 Run Lua code <luacode> using built-in Lua interpretter.
916 \end_layout
918 \begin_layout Subsubsection
919 run-lua <script>
920 \end_layout
922 \begin_layout Standard
923 Run specified lua file using built-in Lua interpretter.
924 \end_layout
926 \begin_layout Subsection
927 Memory watch
928 \end_layout
930 \begin_layout Subsubsection
931 add-watch <name> <expression>
932 \end_layout
934 \begin_layout Standard
935 Adds new watch (or modifies old one).
936 \end_layout
938 \begin_layout Subsubsection
939 remove-watch <name>
940 \end_layout
942 \begin_layout Standard
943 Remove a watch.
944 \end_layout
946 \begin_layout Section
947 Settings
948 \end_layout
950 \begin_layout Subsection
951 firmwarepath
952 \end_layout
954 \begin_layout Standard
955 Set where bsnes looks for firmware files.
956  Default is 
957 \begin_inset Quotes eld
958 \end_inset
961 \begin_inset Quotes erd
962 \end_inset
965 \end_layout
967 \begin_layout Subsection
968 targetfps
969 \end_layout
971 \begin_layout Standard
972 Set the target fps.
973  Numeric, range is 0.001 to 
974 \begin_inset Quotes eld
975 \end_inset
977 infinite
978 \begin_inset Quotes erd
979 \end_inset
982  Default is native framerate.
983 \end_layout
985 \begin_layout Subsection
986 savecompression
987 \end_layout
989 \begin_layout Standard
990 Set save compression level (integer 0-9).
991  Default is 7 (0 is no compression).
992 \end_layout
994 \begin_layout Subsection
995 advance-timeout
996 \end_layout
998 \begin_layout Standard
999 Set the frame advance timeout in milliseconds.
1000  Numeric integer, range is 0-999999999.
1001  Default is 500.
1002 \end_layout
1004 \begin_layout Section
1005 Lua functions
1006 \end_layout
1008 \begin_layout Subsection
1009 print
1010 \end_layout
1012 \begin_layout Standard
1013 Print line to message console.
1014 \end_layout
1016 \begin_layout Subsection
1017 bit.none(number...) / bit.bnot(number...)
1018 \end_layout
1020 \begin_layout Standard
1021 48-bit bitwise NOT / NONE function (set bits that are set in none of the
1022  arguments).
1023 \end_layout
1025 \begin_layout Subsection
1026 bit.any(number...) / bit.bor(number...)
1027 \end_layout
1029 \begin_layout Standard
1030 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
1031 \end_layout
1033 \begin_layout Subsection
1034 bit.all(number...) / bit.band(number...)
1035 \end_layout
1037 \begin_layout Standard
1038 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
1040 \end_layout
1042 \begin_layout Subsection
1043 bit.parity(number...) / bit.bxor(number...)
1044 \end_layout
1046 \begin_layout Standard
1047 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
1048  of the arguments).
1049 \end_layout
1051 \begin_layout Subsection
1052 bit.lrotate(number base[, number amount[, number bits]])
1053 \end_layout
1055 \begin_layout Standard
1056 Rotate bits-bit (max 48, default 48) number left by amount (default 1) places.
1057 \end_layout
1059 \begin_layout Subsection
1060 bit.rrotate(number base[, number amount[, number bits]])
1061 \end_layout
1063 \begin_layout Standard
1064 Rotate bits-bit (max 48, default 48) number right by amount (default 1)
1065  places.
1066 \end_layout
1068 \begin_layout Subsection
1069 bit.lshift(number base[, number amount[, number bits]])
1070 \end_layout
1072 \begin_layout Standard
1073 Shift bits-bit (max 48, default 48) number left by amount (default 1) places.
1074  The new bits are filled with zeroes.
1075 \end_layout
1077 \begin_layout Subsection
1078 bit.lrshift(number base[, number amount[, number bits]])
1079 \end_layout
1081 \begin_layout Standard
1082 Shift bits-bit (max 48, default 48) number logically right by amount (default
1083  1) places.
1084  The new bits are filled with zeroes.
1085 \end_layout
1087 \begin_layout Subsection
1088 bit.arshift(number base[, number amount[, number bits]])
1089 \end_layout
1091 \begin_layout Standard
1092 Shift bits-bit (max 48, default 48) number arithmetically right by amount
1093  (default 1) places.
1094  The new bits are shifted in with copy of the high bit.
1095 \end_layout
1097 \begin_layout Subsection
1098 gui.resolution()
1099 \end_layout
1101 \begin_layout Standard
1102 Returns 5-tuple (hresolution, vresolution, rshift, gshift, bshift).
1103  Only available in on_paint() and on_video() callbacks.
1104 \end_layout
1106 \begin_layout Subsection
1107 gui.<class>_gap(number gap)
1108 \end_layout
1110 \begin_layout Standard
1111 Set the <class> (left, right, top, bottom) gap to specified value (max gap
1112  is 8191).
1113  Only available in on_paint() and on_video() callbacks.
1114 \end_layout
1116 \begin_layout Subsection
1117 gui.text(number x, number y, string text[, number fgc[, number fga[, number
1118  bgc[, number bga]]]])
1119 \end_layout
1121 \begin_layout Standard
1122 Draw text on the GUI.
1123  Font size is 8(or 16) by 16.
1124  Notes:
1125 \end_layout
1127 \begin_layout Itemize
1128 Coordinate origin is at top-left of the game area.
1129  Left and top gaps have negative coordinates.
1130 \end_layout
1132 \begin_layout Itemize
1133 Use gui.resolution() to discover how to layout colors.
1134 \end_layout
1136 \begin_layout Itemize
1137 Alpha range is 0(transparent)-256(opaque).
1138 \end_layout
1140 \begin_layout Itemize
1141 Only available in on_paint() and on_video() callbacks.
1142 \end_layout
1144 \begin_layout Subsection
1145 gui.repaint()
1146 \end_layout
1148 \begin_layout Standard
1149 Request on_repaint() to happen as soon as possible.
1150 \end_layout
1152 \begin_layout Subsection
1153 gui.subframe_update(boolean on)
1154 \end_layout
1156 \begin_layout Standard
1157 Request subframe updates (calling on_paint() on subframes) to happen (on=true)
1158  or not happen (on=false).
1159 \end_layout
1161 \begin_layout Subsection
1162 input.get(number controller, number index)
1163 \end_layout
1165 \begin_layout Standard
1166 Read the specified index (0-11) from specified controller (0-7).
1167  Notes:
1168 \end_layout
1170 \begin_layout Itemize
1171 Uses physical controller numbering.
1172  Gamepad in port 2 is controller 4, not 1!
1173 \end_layout
1175 \begin_layout Itemize
1176 Only available in on_input callback.
1177 \end_layout
1179 \begin_layout Subsection
1180 input.set(number controller, number index, number value)
1181 \end_layout
1183 \begin_layout Standard
1184 Write the specified index (0-11) from specified controller (0-7), storing
1185  value.
1186  Notes:
1187 \end_layout
1189 \begin_layout Itemize
1190 Uses physical controller numbering.
1191  Gamepad in port 2 is controller 4, not 1!
1192 \end_layout
1194 \begin_layout Itemize
1195 Only available in on_input callback.
1196 \end_layout
1198 \begin_layout Subsection
1199 input.reset([number cycles])
1200 \end_layout
1202 \begin_layout Standard
1203 Execute reset.
1204  If cycles is greater than zero, do delayed reset.
1205 \end_layout
1207 \begin_layout Itemize
1208 Only available in on_input callback with subframe flag false.
1209 \end_layout
1211 \begin_layout Subsection
1212 hostmemory.read(number address)
1213 \end_layout
1215 \begin_layout Standard
1216 Reads hostmemory slot address.
1217  Slot numbers out of range return false instead of numeric.
1218 \end_layout
1220 \begin_layout Subsection
1221 hostmemory.write(number address, number value)
1222 \end_layout
1224 \begin_layout Standard
1225 Writes hostmemory slot with 0-255.
1226  Slot numbers out of range cause extension of host memory slot space.
1227 \end_layout
1229 \begin_layout Subsection
1230 movie.currentframe()
1231 \end_layout
1233 \begin_layout Standard
1234 Return number of current frame.
1235 \end_layout
1237 \begin_layout Subsection
1238 movie.framecount()
1239 \end_layout
1241 \begin_layout Standard
1242 Return number of frames in movie.
1243 \end_layout
1245 \begin_layout Subsection
1246 movie.readonly()
1247 \end_layout
1249 \begin_layout Standard
1250 Return true if in readonly mode, false if in readwrite.
1251 \end_layout
1253 \begin_layout Subsection
1254 movie.set_readwrite()
1255 \end_layout
1257 \begin_layout Standard
1258 Set readwrite mode (does not cause on_readwrite callback).
1259 \end_layout
1261 \begin_layout Subsection
1262 movie.frame_subframes(number frame)
1263 \end_layout
1265 \begin_layout Standard
1266 Count number of subframes in specified frame (frame numbers are 1-based)
1267  and return that.
1268 \end_layout
1270 \begin_layout Subsection
1271 movie.read_subframe(number frame, number subframe)
1272 \end_layout
1274 \begin_layout Standard
1275 Read specifed subframe in specified frame and return data as array (100
1276  elements, numbered 0-99 currently).
1277 \end_layout
1279 \begin_layout Subsection
1280 Callback: on_paint()
1281 \end_layout
1283 \begin_layout Standard
1284 Called when screen is being painted.
1285  Any gui.* calls requiring graphic context draw on the screen.
1286 \end_layout
1288 \begin_layout Subsection
1289 Callback: on_video()
1290 \end_layout
1292 \begin_layout Standard
1293 Called when video dump frame is being painted.
1294  Any gui.* calls requiring graphic context draw on the video.
1295 \end_layout
1297 \begin_layout Subsection
1298 Callback: on_startup()
1299 \end_layout
1301 \begin_layout Standard
1302 Called when the emulator is starting (lsnes.rc has been run).
1303 \end_layout
1305 \begin_layout Subsection
1306 Callback: on_pre_load(string name)
1307 \end_layout
1309 \begin_layout Standard
1310 Called just before savestate/movie load occurs (note: loads are always delayed,
1311  so this occurs even when load was initiated by lua).
1312 \end_layout
1314 \begin_layout Subsection
1315 Callback: on_err_load(string name)
1316 \end_layout
1318 \begin_layout Standard
1319 Called if loadstate goes wrong.
1320 \end_layout
1322 \begin_layout Subsection
1323 Callback: on_post_load(string name, boolean was_savestate)
1324 \end_layout
1326 \begin_layout Standard
1327 Called on successful loadstate.
1328  was_savestate gives if this was a savestate or a movie.
1329 \end_layout
1331 \begin_layout Subsection
1332 Callback: on_pre_save(string name, boolean is_savestate)
1333 \end_layout
1335 \begin_layout Standard
1336 Called just before savestate save occurs (note: movie saves are synchronous
1337  and won't trigger these callbacks if called from Lua).
1338 \end_layout
1340 \begin_layout Subsection
1341 Callback: on_err_save(string name)
1342 \end_layout
1344 \begin_layout Standard
1345 Called if savestate goes wrong.
1346 \end_layout
1348 \begin_layout Subsection
1349 Callback: on_post_save(string name, boolean is_savestate)
1350 \end_layout
1352 \begin_layout Standard
1353 Called on successful savaestate.
1354  is_savestate gives if this was a savestate or a movie.
1355 \end_layout
1357 \begin_layout Subsection
1358 Callback: on_quit()
1359 \end_layout
1361 \begin_layout Standard
1362 Called when emulator is shutting down.
1363 \end_layout
1365 \begin_layout Subsection
1366 Callback: on_input(boolean subframe)
1367 \end_layout
1369 \begin_layout Standard
1370 Called when emulator is just sending input to bsnes core.
1371  Warning: This is called even in readonly mode, but the results are ignored.
1372 \end_layout
1374 \begin_layout Subsection
1375 Callback: on_reset()
1376 \end_layout
1378 \begin_layout Standard
1379 Called when SNES is reset.
1380 \end_layout
1382 \begin_layout Subsection
1383 Callback: on_readwrite()
1384 \end_layout
1386 \begin_layout Standard
1387 Called when moving into readwrite mode as result of 
1388 \begin_inset Quotes eld
1389 \end_inset
1391 set-rwmode
1392 \begin_inset Quotes erd
1393 \end_inset
1395  command (note: moving to rwmode by Lua won't trigger this, as per recursive
1396  entry protection).
1397 \end_layout
1399 \begin_layout Section
1400 SDL platform:
1401 \end_layout
1403 \begin_layout Subsection
1404 Platform-specific commands:
1405 \end_layout
1407 \begin_layout Subsubsection
1408 enable-sound on
1409 \end_layout
1411 \begin_layout Standard
1412 Enable sounds in GUI (has no effect on video dumping).
1413 \end_layout
1415 \begin_layout Subsubsection
1416 enable-sound off
1417 \end_layout
1419 \begin_layout Standard
1420 Disable sounds in GUI (has no effect on video dumping).
1421 \end_layout
1423 \begin_layout Subsubsection
1424 identify-key
1425 \end_layout
1427 \begin_layout Standard
1428 Asks to press a key and then identifies that key.
1429 \end_layout
1431 \begin_layout Subsubsection
1432 set-autorepeat <delay> <repeat>
1433 \end_layout
1435 \begin_layout Standard
1436 Set keyboard autorepeat.
1437  <delay> is before first autorepeat, <repeat> is between autorepeats.
1439 \end_layout
1441 \begin_layout Subsubsection
1442 toggle-console
1443 \end_layout
1445 \begin_layout Standard
1446 Toggle between windowed/fullscreen console.
1447 \end_layout
1449 \begin_layout Subsubsection
1450 scroll-fullup
1451 \end_layout
1453 \begin_layout Standard
1454 Scroll messages window as far back as it goes.
1455 \end_layout
1457 \begin_layout Subsubsection
1458 scroll-fulldown
1459 \end_layout
1461 \begin_layout Standard
1462 Scroll messages window as far forward as it goes.
1463 \end_layout
1465 \begin_layout Subsubsection
1466 scroll-up
1467 \end_layout
1469 \begin_layout Standard
1470 Scroll messages window back one screenful.
1471 \end_layout
1473 \begin_layout Subsubsection
1474 scroll-down
1475 \end_layout
1477 \begin_layout Standard
1478 Scroll messages window forward one screenful.
1479 \end_layout
1481 \begin_layout Subsection
1482 Modifier names
1483 \end_layout
1485 \begin_layout Standard
1486 Following modifier names are known:
1487 \end_layout
1489 \begin_layout Itemize
1490 ctrl, lctrl, rctrl: Control keys
1491 \end_layout
1493 \begin_layout Itemize
1494 alt, lalt, ralt: ALT keys.
1495 \end_layout
1497 \begin_layout Itemize
1498 shift, lshift, rshift: Shift keys.
1499 \end_layout
1501 \begin_layout Itemize
1502 meta, lmeta, rmeta: Meta keys.
1503 \end_layout
1505 \begin_layout Itemize
1506 num, caps: Numlock/Capslock (these are sticky!)
1507 \end_layout
1509 \begin_layout Itemize
1510 mode: Mode select.
1511 \end_layout
1513 \begin_layout Subsection
1514 Key names
1515 \end_layout
1517 \begin_layout Standard
1518 Following key names are known:
1519 \end_layout
1521 \begin_layout Itemize
1522 backspace, tab, clear, return, pause, escape, space, exclaim, quotedbl,
1523  hash, dollar, ampersand, quote, leftparen, rightparen, asterisk, plus,
1524  comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon,
1525  less, equals, greater, question, at, leftbracket, backslash, rightbracket,
1526  caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, n,
1527  o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, world_1, world_2,
1528  world_3, world_4, world_5, world_6, world_7, world_8, world_9, world_10,
1529  world_11, world_12, world_13, world_14, world_15, world_16, world_17, world_18,
1530  world_19, world_20, world_21, world_22, world_23, world_24, world_25, world_26,
1531  world_27, world_28, world_29, world_30, world_31, world_32, world_33, world_34,
1532  world_35, world_36, world_37, world_38, world_39, world_40, world_41, world_42,
1533  world_43, world_44, world_45, world_46, world_47, world_48, world_49, world_50,
1534  world_51, world_52, world_53, world_54, world_55, world_56, world_57, world_58,
1535  world_59, world_60, world_61, world_62, world_63, world_64, world_65, world_66,
1536  world_67, world_68, world_69, world_70, world_71, world_72, world_73, world_74,
1537  world_75, world_76, world_77, world_78, world_79, world_80, world_81, world_82,
1538  world_83, world_84, world_85, world_86, world_87, world_88, world_89, world_90,
1539  world_91, world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, kp4,
1540  kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, kp_multiply, kp_minus, kp_plus,
1541  kp_enter, kp_equals, up, down, right, left, insert, home, end, pageup,
1542  pagedown, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
1543  f15, numlock, capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt,
1544  lalt, rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, sysreq,
1545  break, menu, power, euro, undo
1546 \end_layout
1548 \begin_layout Itemize
1549 Names of form 'key<n>' where <n> is 0-255 are interpretted as key having
1550  hardware-dependent scan code of <n> (useful to bind those keys that don't
1551  have symbolic names).
1552 \end_layout
1554 \begin_layout Standard
1555 In addition, following pseudo-keys are known (note: these do not work yet,
1556  and especially do not work in conjunction with modifers):
1557 \end_layout
1559 \begin_layout Itemize
1560 joystick<num>button<button>: Joystick <num> (0-based) button <button> (0-based).
1561 \end_layout
1563 \begin_layout Itemize
1564 joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> (0-based) up.
1565 \end_layout
1567 \begin_layout Itemize
1568 joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> (0-based) left.
1569 \end_layout
1571 \begin_layout Itemize
1572 joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> (0-based) down.
1573 \end_layout
1575 \begin_layout Itemize
1576 joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> (0-based) right.
1577 \end_layout
1579 \begin_layout Itemize
1580 joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> negative
1581  position.
1582 \end_layout
1584 \begin_layout Itemize
1585 joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> positive
1586  position.
1587 \end_layout
1589 \begin_layout Subsection
1590 Special buttons:
1591 \end_layout
1593 \begin_layout Itemize
1594 Escape: Enter/Exit Command mode, cancel modal dialogs.
1595 \end_layout
1597 \begin_layout Itemize
1598 Return (also KPEnter): Execute command, ok modal dialog.
1599 \end_layout
1601 \begin_layout Itemize
1602 Pgup/Up (also KP8/9 if no num lock; command mode): Previous command in command
1603  history
1604 \end_layout
1606 \begin_layout Itemize
1607 Pgdn/Down(also KP2/3 if no num lock; command mode): Next command in command
1608  history
1609 \end_layout
1611 \begin_layout Itemize
1612 Home (also KP7 if no num lock; command mode): Beginning of command.
1613 \end_layout
1615 \begin_layout Itemize
1616 End (also KP1 if no num lock; command mode): End of command.
1617 \end_layout
1619 \begin_layout Itemize
1620 Left (also KP4 if no num lock; command mode): Move cursor left.
1621 \end_layout
1623 \begin_layout Itemize
1624 Right (also KP6 if no num lock; command mode): Move cursor right.
1625 \end_layout
1627 \begin_layout Itemize
1628 Delete (also KP.
1629  if no num lock; command mode): Delete character to right of cursor.
1630 \end_layout
1632 \begin_layout Itemize
1633 Insert (also KP0 if no num lock; command mode): Toggle between insert /
1634  overwrite modes.
1635 \end_layout
1637 \begin_layout Itemize
1638 Backspace (command mode): Delete character to left of cursor.
1639 \end_layout
1641 \begin_layout Itemize
1642 LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump corrupted!).
1643 \end_layout
1645 \begin_layout Subsection
1646 Watchdog timer:
1647 \end_layout
1649 \begin_layout Standard
1650 If emulator does not reach internal polling loop in 15 seconds after leaving
1651  it or 15 seconds after starting, the emulator instantly bombs out.
1652 \end_layout
1654 \begin_layout Section
1655 Movie file format
1656 \end_layout
1658 \begin_layout Standard
1659 Movie file is .zip archive in itself, normal ZIP archive tools work on it
1660  (note: If you recompress it, do not use compression methods other than
1661  store and deflate and especially do not use encryption of any kind).
1662 \end_layout
1664 \begin_layout Subsection
1665 Detecting clean start/SRAM/Savestate
1666 \end_layout
1668 \begin_layout Itemize
1669 If file has member 
1670 \begin_inset Quotes eld
1671 \end_inset
1673 savestate
1674 \begin_inset Quotes erd
1675 \end_inset
1677  it is savestate, otherwise:
1678 \end_layout
1680 \begin_layout Itemize
1681 If file has members with names starting 
1682 \begin_inset Quotes eld
1683 \end_inset
1685 moviesram.
1686 \begin_inset Quotes erd
1687 \end_inset
1689  it is movie starting from SRAM, otherwise:
1690 \end_layout
1692 \begin_layout Itemize
1693 It is movie starting from clear state.
1694 \end_layout
1696 \begin_layout Subsection
1697 Member: gametype
1698 \end_layout
1700 \begin_layout Standard
1701 Type of game ROM and region.
1702  Valid values are:
1703 \end_layout
1705 \begin_layout Standard
1706 \begin_inset Tabular
1707 <lyxtabular version="3" rows="8" columns="3">
1708 <features tabularvalignment="middle">
1709 <column alignment="center" valignment="top" width="0">
1710 <column alignment="center" valignment="top" width="0">
1711 <column alignment="center" valignment="top" width="0">
1712 <row>
1713 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1714 \begin_inset Text
1716 \begin_layout Plain Layout
1717 Value
1718 \end_layout
1720 \end_inset
1721 </cell>
1722 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1723 \begin_inset Text
1725 \begin_layout Plain Layout
1726 System
1727 \end_layout
1729 \end_inset
1730 </cell>
1731 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1732 \begin_inset Text
1734 \begin_layout Plain Layout
1735 Region
1736 \end_layout
1738 \end_inset
1739 </cell>
1740 </row>
1741 <row>
1742 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1743 \begin_inset Text
1745 \begin_layout Plain Layout
1746 snes_pal
1747 \end_layout
1749 \end_inset
1750 </cell>
1751 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1752 \begin_inset Text
1754 \begin_layout Plain Layout
1755 Super NES
1756 \end_layout
1758 \end_inset
1759 </cell>
1760 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1761 \begin_inset Text
1763 \begin_layout Plain Layout
1765 \end_layout
1767 \end_inset
1768 </cell>
1769 </row>
1770 <row>
1771 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1772 \begin_inset Text
1774 \begin_layout Plain Layout
1775 sgb_pal
1776 \end_layout
1778 \end_inset
1779 </cell>
1780 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1781 \begin_inset Text
1783 \begin_layout Plain Layout
1784 Super Game Boy
1785 \end_layout
1787 \end_inset
1788 </cell>
1789 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1790 \begin_inset Text
1792 \begin_layout Plain Layout
1794 \end_layout
1796 \end_inset
1797 </cell>
1798 </row>
1799 <row>
1800 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1801 \begin_inset Text
1803 \begin_layout Plain Layout
1804 snes_ntsc
1805 \end_layout
1807 \end_inset
1808 </cell>
1809 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1810 \begin_inset Text
1812 \begin_layout Plain Layout
1813 Super NES
1814 \end_layout
1816 \end_inset
1817 </cell>
1818 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1819 \begin_inset Text
1821 \begin_layout Plain Layout
1822 NTSC
1823 \end_layout
1825 \end_inset
1826 </cell>
1827 </row>
1828 <row>
1829 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1830 \begin_inset Text
1832 \begin_layout Plain Layout
1833 sgb_ntsc
1834 \end_layout
1836 \end_inset
1837 </cell>
1838 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1839 \begin_inset Text
1841 \begin_layout Plain Layout
1842 Super Game Boy
1843 \end_layout
1845 \end_inset
1846 </cell>
1847 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1848 \begin_inset Text
1850 \begin_layout Plain Layout
1851 NTSC
1852 \end_layout
1854 \end_inset
1855 </cell>
1856 </row>
1857 <row>
1858 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1859 \begin_inset Text
1861 \begin_layout Plain Layout
1863 \end_layout
1865 \end_inset
1866 </cell>
1867 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1868 \begin_inset Text
1870 \begin_layout Plain Layout
1871 BS-X (non-slotted)
1872 \end_layout
1874 \end_inset
1875 </cell>
1876 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1877 \begin_inset Text
1879 \begin_layout Plain Layout
1880 NTSC
1881 \end_layout
1883 \end_inset
1884 </cell>
1885 </row>
1886 <row>
1887 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1888 \begin_inset Text
1890 \begin_layout Plain Layout
1891 bsxslotted
1892 \end_layout
1894 \end_inset
1895 </cell>
1896 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1897 \begin_inset Text
1899 \begin_layout Plain Layout
1900 BS-X (slotted)
1901 \end_layout
1903 \end_inset
1904 </cell>
1905 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1906 \begin_inset Text
1908 \begin_layout Plain Layout
1909 NTSC
1910 \end_layout
1912 \end_inset
1913 </cell>
1914 </row>
1915 <row>
1916 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1917 \begin_inset Text
1919 \begin_layout Plain Layout
1920 sufamiturbo
1921 \end_layout
1923 \end_inset
1924 </cell>
1925 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1926 \begin_inset Text
1928 \begin_layout Plain Layout
1929 Sufami Turbo
1930 \end_layout
1932 \end_inset
1933 </cell>
1934 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1935 \begin_inset Text
1937 \begin_layout Plain Layout
1938 NTSC
1939 \end_layout
1941 \end_inset
1942 </cell>
1943 </row>
1944 </lyxtabular>
1946 \end_inset
1949 \end_layout
1951 \begin_layout Standard
1952 Frame rates are:
1953 \end_layout
1955 \begin_layout Standard
1956 \begin_inset Tabular
1957 <lyxtabular version="3" rows="3" columns="2">
1958 <features tabularvalignment="middle">
1959 <column alignment="center" valignment="top" width="0">
1960 <column alignment="center" valignment="top" width="0">
1961 <row>
1962 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1963 \begin_inset Text
1965 \begin_layout Plain Layout
1966 Region
1967 \end_layout
1969 \end_inset
1970 </cell>
1971 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1972 \begin_inset Text
1974 \begin_layout Plain Layout
1975 Framerate
1976 \end_layout
1978 \end_inset
1979 </cell>
1980 </row>
1981 <row>
1982 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1983 \begin_inset Text
1985 \begin_layout Plain Layout
1987 \end_layout
1989 \end_inset
1990 </cell>
1991 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1992 \begin_inset Text
1994 \begin_layout Plain Layout
1995 322445/6448
1996 \end_layout
1998 \end_inset
1999 </cell>
2000 </row>
2001 <row>
2002 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2003 \begin_inset Text
2005 \begin_layout Plain Layout
2006 NTSC
2007 \end_layout
2009 \end_inset
2010 </cell>
2011 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2012 \begin_inset Text
2014 \begin_layout Plain Layout
2015 10738636/178683
2016 \end_layout
2018 \end_inset
2019 </cell>
2020 </row>
2021 </lyxtabular>
2023 \end_inset
2026 \end_layout
2028 \begin_layout Subsection
2029 Member: port1
2030 \end_layout
2032 \begin_layout Standard
2033 Contains type of port #1.
2034  Valid values are 'none', 'gamepad', 'multitap' and 'mouse'.
2035  If not present, defaults to 'gamepad'.
2036 \end_layout
2038 \begin_layout Subsection
2039 Member: port2
2040 \end_layout
2042 \begin_layout Standard
2043 Contains type of port #2.
2044  Valid values are 'none', 'gamepad', 'multitap', 'mouse', 'superscope',
2045  'justifier' and 'justifiers'.
2046  If not present, defaults to 'none'.
2047 \end_layout
2049 \begin_layout Subsection
2050 Member: gamename
2051 \end_layout
2053 \begin_layout Standard
2054 Contains name of the game.
2055 \end_layout
2057 \begin_layout Subsection
2058 Member: authors
2059 \end_layout
2061 \begin_layout Standard
2062 Contains authors, one per line.
2063  Part before '|' is the full name, part after is the nickname.
2064 \end_layout
2066 \begin_layout Subsection
2067 Member: systemid
2068 \end_layout
2070 \begin_layout Standard
2071 Always 
2072 \begin_inset Quotes eld
2073 \end_inset
2075 lsnes-rr1
2076 \begin_inset Quotes erd
2077 \end_inset
2080  Used to reject other saves.
2081 \end_layout
2083 \begin_layout Subsection
2084 Member: controlsversion
2085 \end_layout
2087 \begin_layout Standard
2088 Always 
2089 \begin_inset Quotes eld
2090 \end_inset
2093 \begin_inset Quotes erd
2094 \end_inset
2097  Used to identify what controls are there.
2098 \end_layout
2100 \begin_layout Subsection
2101 Member: 
2102 \begin_inset Quotes eld
2103 \end_inset
2105 coreversion
2106 \begin_inset Quotes erd
2107 \end_inset
2110 \end_layout
2112 \begin_layout Standard
2113 Contains bsnes core version number.
2114 \end_layout
2116 \begin_layout Subsection
2117 Member: projectid
2118 \end_layout
2120 \begin_layout Standard
2121 Contains project ID.
2122  Used to identify if two movies are part of the same project.
2123 \end_layout
2125 \begin_layout Subsection
2126 Member: {rom,slota,slotb}{,xml}.sha256
2127 \end_layout
2129 \begin_layout Standard
2130 Contains SHA-256 of said ROM or ROM mapping file.
2131  Absent if corresponding file is absent.
2132 \end_layout
2134 \begin_layout Subsection
2135 Member: moviesram.<name>
2136 \end_layout
2138 \begin_layout Standard
2139 Raw binary startup SRAM of kind <name>.
2140  Only present in savestates and movies starting from SRAM.
2141 \end_layout
2143 \begin_layout Subsection
2144 Member: moviestate
2145 \end_layout
2147 \begin_layout Standard
2148 Raw binary movie state data.
2149  Only present in savestates.
2150 \end_layout
2152 \begin_layout Standard
2153 for version 0:
2154 \end_layout
2156 \begin_layout Itemize
2157 32 bytes: SHA-256 of project ID.
2158 \end_layout
2160 \begin_layout Itemize
2161 8 bytes: Big-endian current frame.
2162 \end_layout
2164 \begin_layout Itemize
2165 100x4 bytes: Poll counters for each control (bit31 of each is 
2166 \begin_inset Quotes eld
2167 \end_inset
2169 data ready
2170 \begin_inset Quotes erd
2171 \end_inset
2173  bit), big-endian.
2174 \end_layout
2176 \begin_layout Itemize
2177 8 bytes: Big-endian lag frame count.
2178 \end_layout
2180 \begin_layout Itemize
2181 32 bytes: SHA-256 of past input
2182 \end_layout
2184 \begin_layout Itemize
2185 32 bytes: SHA-256 of previous.
2186 \end_layout
2188 \begin_layout Subsection
2189 Member: hostmemory
2190 \end_layout
2192 \begin_layout Standard
2193 Raw binary dump of host memory.
2194  Only present in savestates.
2195 \end_layout
2197 \begin_layout Subsection
2198 Member: savestate
2199 \end_layout
2201 \begin_layout Standard
2202 The savestate itself.
2203  Savestate detection uses this file, only present in savestates.
2204 \end_layout
2206 \begin_layout Subsection
2207 Member: screenshot
2208 \end_layout
2210 \begin_layout Standard
2211 Screenshot of current frame.
2212  Only present in savestates.
2213 \end_layout
2215 \begin_layout Subsection
2216 Member: sram.<name>
2217 \end_layout
2219 \begin_layout Standard
2220 Raw binary SRAM of kind <name> at time of savestate.
2221  Only present in savestates.
2222 \end_layout
2224 \begin_layout Subsection
2225 Member: input
2226 \end_layout
2228 \begin_layout Standard
2229 The actual input track, one line per subframe (blank lines are skipped).
2230 \end_layout
2232 \begin_layout Itemize
2233 If the first byte of each line is '.', ' ', <tab> or '|', then the line is
2234  part of same frame as previous, otherwise it starts a new frame.
2235 \end_layout
2237 \begin_layout Itemize
2238 First subframe must start a new frame.
2239 \end_layout
2241 \begin_layout Standard
2242 Length of movie in frames is number of lines in input file that start a
2243  new frame.
2244 \end_layout
2246 \begin_layout Subsection
2247 Member: rerecords
2248 \end_layout
2250 \begin_layout Standard
2251 Contains textual base-10 rerecord count (emulator just writes this, it doesn't
2252  read it) + 1.
2253 \end_layout
2255 \begin_layout Subsection
2256 Member: rrdata
2257 \end_layout
2259 \begin_layout Standard
2260 This member stores set of load IDs.
2261  There is one load ID per rerecord (plus one corresponding to start of project).
2262 \end_layout
2264 \begin_layout Itemize
2265 This member constists of concatenation of records
2266 \end_layout
2268 \begin_layout Itemize
2269 Each record is 2-36 bytes long and can represent 1-16,843,009 consequtive
2270  IDs.
2271 \end_layout
2273 \begin_layout Itemize
2274 IDs are interpretted as 256-bit big-endian integers with warparound.
2275 \end_layout
2277 \begin_layout Itemize
2278 Initial predicted ID is all zeroes.
2279 \end_layout
2281 \begin_layout Standard
2282 Format of each record is:
2283 \end_layout
2285 \begin_layout Itemize
2286 1 byte: Opcode byte.
2287  Bits 0-4 are prefix length (prefixlen), bits 5-6 are count length (countlen).
2288  Bit 7 is unused.
2289 \end_layout
2291 \begin_layout Itemize
2292 32-prefixlen bytes of ID.
2293 \end_layout
2295 \begin_layout Itemize
2296 countlen bytes of big-endian count (count).
2297 \end_layout
2299 \begin_layout Standard
2300 Records are processed as follows:
2301 \end_layout
2303 \begin_layout Itemize
2304 To form the first ID encoded by record, take the first prefixlen bytes predicted
2305  ID and append the read ID value to it.
2306  The result is the first ID encoded.
2307 \end_layout
2309 \begin_layout Itemize
2310 If countlen is 0, record encodes 1 ID.
2311 \end_layout
2313 \begin_layout Itemize
2314 If countlen is 1, record encodes 2+count IDs.
2315 \end_layout
2317 \begin_layout Itemize
2318 If countlen is 2, record encodes 258+count IDs.
2319 \end_layout
2321 \begin_layout Itemize
2322 If countlen is 3, record encodes 65794+count IDs.
2323 \end_layout
2325 \begin_layout Itemize
2326 The new predicted ID is the next ID after last one encoded by the record.
2327 \end_layout
2329 \begin_layout Standard
2330 The number of rerecords + 1 is equal to the sum of number of IDs encoded
2331  by all records.
2332 \end_layout
2334 \begin_layout Section
2335 Compiling:
2336 \end_layout
2338 \begin_layout Subsection
2339 Building BSNES
2340 \end_layout
2342 \begin_layout Standard
2343 make ui=ui-libsnes options=debugger profile=accuracy
2344 \end_layout
2346 \begin_layout Itemize
2347 Yes, debugger is needed.
2348 \end_layout
2350 \begin_layout Subsection
2351 Prerequisite libraries:
2352 \end_layout
2354 \begin_layout Itemize
2355 zlib
2356 \end_layout
2358 \begin_layout Itemize
2359 SDL (SDL platform)
2360 \end_layout
2362 \begin_layout Itemize
2363 boost_iostreams
2364 \end_layout
2366 \begin_layout Itemize
2367 boost_filesystem
2368 \end_layout
2370 \begin_layout Itemize
2371 boost (conversion)
2372 \end_layout
2374 \begin_layout Subsection
2375 Compile options to make:
2376 \end_layout
2378 \begin_layout Subsubsection
2379 BSNES_PATH=<path>
2380 \end_layout
2382 \begin_layout Standard
2383 Set path to BSNES bsnes directory to <path>.
2384 \end_layout
2386 \begin_layout Subsubsection
2387 NO_THREADS=1
2388 \end_layout
2390 \begin_layout Standard
2391 Don't use threads (makes dumping slower, but threads probably only work
2392  on Linux).
2393 \end_layout
2395 \begin_layout Subsubsection
2396 CC=<compiler>
2397 \end_layout
2399 \begin_layout Standard
2400 (cross) C++ compiler to use.
2401  Defaults to g++-4.5
2402 \end_layout
2404 \begin_layout Subsubsection
2405 HOSTCC=<compiler>
2406 \end_layout
2408 \begin_layout Standard
2409 (host) C++ compiler to use.
2410  Defaults to the same as CC.
2411 \end_layout
2413 \begin_layout Subsubsection
2414 BSNES_IS_COMPAT=1
2415 \end_layout
2417 \begin_layout Standard
2418 Assume BSNES uses compatiblity core instead of accuracy core.
2419 \end_layout
2421 \begin_layout Subsubsection
2422 NO_LUA=1
2423 \end_layout
2425 \begin_layout Standard
2426 Don't compile in Lua support.
2427 \end_layout
2429 \begin_layout Section
2430 Errata:
2431 \end_layout
2433 \begin_layout Subsection
2434 Problems from BSNES core:
2435 \end_layout
2437 \begin_layout Itemize
2438 The whole pending save stuff.
2439 \end_layout
2441 \begin_layout Itemize
2442 Delay resets are slow.
2443 \end_layout
2445 \begin_layout Itemize
2446 RTC is not emulated in sync-stable manner.
2447 \end_layout
2449 \begin_layout Itemize
2450 Lack of layer hiding.
2451 \end_layout
2453 \begin_layout Itemize
2454 It is slow.
2455 \end_layout
2457 \begin_layout Itemize
2458 Firmwares can't be loaded from ZIP archives.
2459 \end_layout
2461 \begin_layout Itemize
2462 Manual polls can be corrupted if savestate occurs during those.
2463 \end_layout
2465 \begin_layout Subsection
2466 TODO For rr0:
2467 \end_layout
2469 \begin_layout Itemize
2470 Make it build on Windows (and build binaries).
2471  Not todo for rr0-β0.
2472 \end_layout
2474 \begin_layout Subsection
2475 Other problems:
2476 \end_layout
2478 \begin_layout Itemize
2479 Audio for last dumped frame is not itself dumped.
2480 \end_layout
2482 \begin_layout Itemize
2483 Audio in UI is pretty bad in quality.
2484 \end_layout
2486 \begin_layout Itemize
2487 UI itself is 30fps max.
2488 \end_layout
2490 \begin_layout Itemize
2491 AVI compression levels 10-18 are not compatible with AVISynth AVISource.
2492 \end_layout
2494 \begin_layout Itemize
2495 No menus, command based interface (SDL).
2496 \end_layout
2498 \begin_layout Itemize
2499 Long commands don't scroll.
2500 \end_layout
2502 \begin_layout Itemize
2503 No autofire
2504 \end_layout
2506 \begin_layout Itemize
2507 Joysticks don't work.
2508 \end_layout
2510 \end_body
2511 \end_document