1 #LyX 2.0 created this file. For more info see http://www.lyx.org/
6 \use_default_options true
7 \maintain_unincluded_children false
9 \language_package default
14 \font_typewriter default
15 \font_default_family default
16 \use_non_tex_fonts false
23 \default_output_format default
25 \bibtex_command default
26 \index_command default
27 \paperfontsize default
38 \paperorientation portrait
47 \paragraph_separation indent
48 \paragraph_indentation default
49 \quotes_language english
52 \paperpagestyle default
53 \tracking_changes false
66 \begin_layout Subsection
70 \begin_layout Standard
71 These options control loading the ROM.
72 <kind> can be one of following:
80 bsx: BS-X flash ROM in non-slotted mode.
84 bsxslotted: BS-X flash ROM in slotted mode.
92 slot-a: Sufami Turbo Slot A.
96 slot-b: Sufami Turbo Slot B.
99 \begin_layout Subsubsection
103 \begin_layout Standard
104 Set the <file> to use as ROM of <kind>.
107 \begin_layout Subsubsection
111 \begin_layout Standard
112 Apply IPS patch <file> to ROM of <kind>
115 \begin_layout Subsubsection
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.
124 \begin_layout Subsubsection
125 --ips-<kind>-xml=<file>
128 \begin_layout Standard
129 Apply IPS patch <file> to ROM mapping for <kind>.
132 \begin_layout Subsubsection
133 --ips-offset=<offset>
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
142 \begin_layout Subsubsection
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).
151 \begin_layout Subsubsection
155 \begin_layout Standard
156 Force ROM to be considered NTSC-only (default for everything except SNES
160 \begin_layout Subsection
164 \begin_layout Standard
165 If filename is not specified, new session is started.
166 These options control properties of that:
169 \begin_layout Subsubsection
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'.
179 \begin_layout Subsubsection
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'.
189 \begin_layout Subsubsection
193 \begin_layout Standard
194 Set the name of game to <name>
197 \begin_layout Subsubsection
201 \begin_layout Standard
202 Add author with full name of <name> (no nickname).
205 \begin_layout Subsubsection
209 \begin_layout Standard
210 Add author with nickname of <name> (no full name).
213 \begin_layout Subsubsection
214 --author=<fullname>|<nickname>
217 \begin_layout Standard
218 Add author with full name of <fullname> and nickname of <nickname>.
221 \begin_layout Subsection
225 \begin_layout Standard
226 If filename is specified on command line, it is loaded as initial state
227 (instead of constructing one).
230 \begin_layout Section
231 Startup file lsnes.rc
234 \begin_layout Standard
235 Upon startup, lsnes executes file lsnes.rc as commands.
236 This file is located in:
239 \begin_layout Itemize
244 lsnes.rc (if %APPDATA% exists)
247 \begin_layout Itemize
248 Unix: $XDG_CONFIG_HOME/lsnes/lsnes.rc (if $XDG_CONFIG_HOME exists)
251 \begin_layout Itemize
252 Unix: $HOME/.config/lsnes/lsnes.rc (if $HOME exists)
255 \begin_layout Itemize
256 All: ./lsnes.rc (fallback default).
259 \begin_layout Standard
260 If leading directories do not exist, attempt to create them is made.
263 \begin_layout Section
264 Game internal commands
267 \begin_layout Itemize
268 Commands beginning with '*' invoke the corresponding command without alias
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
278 \begin_layout Subsection
282 \begin_layout Standard
283 Settings control various aspects of emulator behaviour.
286 \begin_layout Subsubsection
287 set-setting <setting> <value>
290 \begin_layout Standard
291 Sets setting <setting> to value <value> (may be empty).
294 \begin_layout Subsubsection
295 unset-setting <setting>
298 \begin_layout Standard
299 Try to unset setting <setting> (not all settings can be unset).
302 \begin_layout Subsubsection
303 get-setting <setting>
306 \begin_layout Standard
307 Read value of setting <setting>
310 \begin_layout Subsubsection
314 \begin_layout Standard
315 Print names and values of all settings.
318 \begin_layout Subsection
322 \begin_layout Standard
323 Keybindings bind commands or aliases to keys (or pseudo-keys).
327 \begin_layout Standard
331 \begin_layout Itemize
332 Do not bind edge active (+/-) commands to keys with modifiers, that won't
336 \begin_layout Itemize
337 Names of keys and modifiers are platform-dependent.
340 \begin_layout Subsubsection
341 bind-key [<mod>/<modmask>] <key> <command>
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).
350 \begin_layout Subsubsection
351 unbind-key [<mod>/<modmask>] <key>
354 \begin_layout Standard
355 Unbind command from <key> (with specified <mod> and <modmask>).
358 \begin_layout Subsubsection
362 \begin_layout Standard
363 Print all key bindings in effect.
366 \begin_layout Subsection
370 \begin_layout Standard
371 Aliases bind command to sequence of commands.
372 After alias has been defined, it replaces the command it shadows.
375 \begin_layout Standard
379 \begin_layout Itemize
380 You can't alias command to itself.
383 \begin_layout Itemize
384 Aliases starting with +/- are edge active just like ordinary commands starting
388 \begin_layout Itemize
389 One command can be aliased to multiple commands.
392 \begin_layout Subsubsection
393 alias-command <command> <expansion>
396 \begin_layout Standard
397 Append <expansion> to alias <command>.
400 \begin_layout Subsubsection
401 unalias-command <command>
404 \begin_layout Standard
405 Clear alias expansion for <command>.
408 \begin_layout Subsubsection
412 \begin_layout Standard
413 Print all aliases and their expansions in effect.
416 \begin_layout Subsection
420 \begin_layout Standard
421 Run <script> as if commands were entered on command line.
424 \begin_layout Subsection
428 \begin_layout Standard
429 Following commands control video dumping:
432 \begin_layout Subsubsection
433 dump-avi <level> <prefix>
436 \begin_layout Standard
437 Dump AVI video to prefix <prefix> at level <level> (0-18).
440 \begin_layout Itemize
441 The codec is Camstudio Codec in gzip mode.
444 \begin_layout Itemize
445 Encoder and muxer are internal, available on all platforms.
448 \begin_layout Itemize
449 Audio enable/disable and framerate has no effect.
452 \begin_layout Itemize
453 Warning: Levels 10-18 are not compatible with AVISource.
456 \begin_layout Itemize
457 Recomended level is 7 if decoded by AVISource.
460 \begin_layout Itemize
461 Recomended level is 16 if decoded by ffmpeg, mencoder or FFMpegSource.
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.
469 \begin_layout Subsubsection
473 \begin_layout Standard
474 End current AVI video dump.
477 \begin_layout Subsection
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
487 \begin_layout Standard
488 The available element <sizes> are:
491 \begin_layout Itemize
495 \begin_layout Itemize
499 \begin_layout Itemize
503 \begin_layout Itemize
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
514 \begin_layout Subsubsection
515 read-<size> <address>
518 \begin_layout Standard
519 Read the value of byte in <address>.
522 \begin_layout Subsubsection
523 read-s<size> <address>
526 \begin_layout Standard
527 Read the value of signed byte in <address>.
530 \begin_layout Subsubsection
531 write-<size> <address> <value>
534 \begin_layout Standard
535 Write <value> to byte in address <address>.
538 \begin_layout Subsubsection
542 \begin_layout Standard
543 Reset the memory search
546 \begin_layout Subsubsection
550 \begin_layout Standard
551 Print number of candidates remaining
554 \begin_layout Subsubsection
558 \begin_layout Standard
559 Print all candidates remaining
562 \begin_layout Subsubsection
563 search-memory <usflag><sizeflag><op>
566 \begin_layout Standard
567 Searches memory for addresses satisfying criteria.
570 \begin_layout Standard
574 \begin_layout Itemize
578 \begin_layout Itemize
582 \begin_layout Standard
586 \begin_layout Itemize
590 \begin_layout Itemize
594 \begin_layout Itemize
598 \begin_layout Itemize
602 \begin_layout Standard
606 \begin_layout Itemize
607 lt: < previous value.
610 \begin_layout Itemize
611 le: <= previous value.
614 \begin_layout Itemize
615 eq: = previous value.
618 \begin_layout Itemize
619 ne: != previous value.
622 \begin_layout Itemize
623 ge: >= previous value.
626 \begin_layout Itemize
627 gt: > previous value.
630 \begin_layout Subsubsection
631 search-memory <sizeflag> <value>
634 \begin_layout Standard
635 Searches for addresses that currently have value <value>.
636 <sizeflag> is as in previous command.
639 \begin_layout Subsection
643 \begin_layout Standard
644 These commands are not available in lsnesrc, but are available after ROM
648 \begin_layout Subsubsection
652 \begin_layout Standard
653 Quits the emulator (asking for confirmation).
654 If /y is given, no confirmation is asked.
657 \begin_layout Subsubsection
661 \begin_layout Standard
662 Toggle paused/unpaused
665 \begin_layout Subsubsection
669 \begin_layout Standard
671 If the button is still held after configurable timeout expires, game unpauses
672 for the duration frame advance is held.
675 \begin_layout Subsubsection
679 \begin_layout Standard
681 If the button is still held after configurable timeout expires, game unpauses
682 for the duration frame advance is held.
685 \begin_layout Subsubsection
689 \begin_layout Standard
690 Skip to first poll in frame after current.
693 \begin_layout Subsubsection
697 \begin_layout Standard
698 Reset the SNES after this frame.
701 \begin_layout Subsubsection
702 load-state <filename>
705 \begin_layout Standard
706 Load savestate <filename> in readwrite mode.
709 \begin_layout Subsubsection
710 load-readonly <filename>
713 \begin_layout Standard
714 Load savestate <filename> in readonly mode.
717 \begin_layout Subsubsection
718 load-preserve <filename>
721 \begin_layout Standard
722 Load savestate <filename> in readonly mode, preserving current events.
725 \begin_layout Subsubsection
726 load-movie <filename>
729 \begin_layout Standard
730 Load savestate <filename>, ignoring save part in readonly mode.
733 \begin_layout Subsubsection
734 save-state <filename>
737 \begin_layout Standard
738 Save system state to <filename> as soon as possible.
741 \begin_layout Subsubsection
742 save-movie <filename>
745 \begin_layout Standard
746 Save movie to <filename>.
749 \begin_layout Subsubsection
753 \begin_layout Standard
757 \begin_layout Subsubsection
761 \begin_layout Standard
762 Set name of the game to <name>
765 \begin_layout Subsubsection
769 \begin_layout Standard
770 Print the name of the game.
773 \begin_layout Subsubsection
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.
783 \begin_layout Subsubsection
784 edit-author <num> <author>
787 \begin_layout Standard
788 Edit the author in slot <num> (0-based) to be <author> (see add-author for
792 \begin_layout Subsubsection
796 \begin_layout Standard
797 Remove author in slot <num>
800 \begin_layout Subsubsection
804 \begin_layout Standard
808 \begin_layout Subsubsection
809 test-1, test-2, test-3
812 \begin_layout Standard
813 Internal test commands
816 \begin_layout Subsubsection
817 take-screenshot <filename>
820 \begin_layout Standard
821 Save screenshot to <filename>.
824 \begin_layout Subsubsection
825 +controller<num><button>
828 \begin_layout Standard
829 Press button <button> on controller <num> (1-8).
830 The following button names are known:
833 \begin_layout Itemize
837 \begin_layout Itemize
841 \begin_layout Itemize
845 \begin_layout Itemize
849 \begin_layout Itemize
853 \begin_layout Itemize
857 \begin_layout Itemize
861 \begin_layout Itemize
865 \begin_layout Itemize
869 \begin_layout Itemize
873 \begin_layout Itemize
877 \begin_layout Itemize
881 \begin_layout Itemize
885 \begin_layout Itemize
889 \begin_layout Itemize
893 \begin_layout Itemize
897 \begin_layout Subsubsection
898 controllerh<num><button>
901 \begin_layout Standard
902 Hold/unhold button <button> on controller <num> (1-8).
903 See +controller for button names.
906 \begin_layout Subsubsection
907 autofire (<pattern>|-)...
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.
917 \begin_layout Subsubsection
921 \begin_layout Standard
925 \begin_layout Subsection
929 \begin_layout Standard
930 Only available if lua support is compiled in.
933 \begin_layout Subsubsection
937 \begin_layout Standard
938 Run Lua code <luacode> using built-in Lua interpretter.
941 \begin_layout Subsubsection
945 \begin_layout Standard
946 Run specified lua file using built-in Lua interpretter.
949 \begin_layout Subsection
953 \begin_layout Subsubsection
954 add-watch <name> <expression>
957 \begin_layout Standard
958 Adds new watch (or modifies old one).
961 \begin_layout Subsubsection
965 \begin_layout Standard
969 \begin_layout Section
973 \begin_layout Subsection
977 \begin_layout Standard
978 Set where bsnes looks for firmware files.
980 \begin_inset Quotes eld
984 \begin_inset Quotes erd
990 \begin_layout Subsection
994 \begin_layout Standard
996 Numeric, range is 0.001 to
997 \begin_inset Quotes eld
1001 \begin_inset Quotes erd
1005 Default is native framerate.
1008 \begin_layout Subsection
1012 \begin_layout Standard
1013 Set save compression level (integer 0-9).
1014 Default is 7 (0 is no compression).
1017 \begin_layout Subsection
1021 \begin_layout Standard
1022 Set the frame advance timeout in milliseconds.
1023 Numeric integer, range is 0-999999999.
1027 \begin_layout Subsection
1031 \begin_layout Standard
1032 AVI dumper: Always dump at 512x448 or 512x478 regardless of what the console
1036 \begin_layout Subsection
1040 \begin_layout Standard
1041 AVI dumper: Set the default left border thickness (unless lua overrides)
1047 \begin_layout Subsection
1051 \begin_layout Standard
1052 AVI dumper: Set the default right border thickness (unless lua overrides)
1058 \begin_layout Subsection
1062 \begin_layout Standard
1063 AVI dumper: Set the default top border thickness (unless lua overrides)
1069 \begin_layout Subsection
1073 \begin_layout Standard
1074 AVI dumper: Set the default bottom border thickness (unless lua overrides)
1080 \begin_layout Subsection
1084 \begin_layout Standard
1085 AVI dumper: Maximum number of frames per dump segment (0 => unlimited).
1090 \begin_layout Section
1094 \begin_layout Subsection
1095 Core (in main table)
1098 \begin_layout Subsubsection
1102 \begin_layout Standard
1103 Print line to message console.
1106 \begin_layout Subsubsection
1107 exec(string command)
1110 \begin_layout Standard
1111 Run command as it was entered on the command line
1114 \begin_layout Subsection
1118 \begin_layout Standard
1119 Bitwise logical functions and related.
1122 \begin_layout Subsubsection
1123 none(number...) / bnot(number...)
1126 \begin_layout Standard
1127 48-bit bitwise NOT / NONE function (set bits that are set in none of the
1131 \begin_layout Subsubsection
1132 any(number...) / bor(number...)
1135 \begin_layout Standard
1136 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
1139 \begin_layout Subsubsection
1140 all(number...) / band(number...)
1143 \begin_layout Standard
1144 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
1148 \begin_layout Subsubsection
1149 parity(number...) / bxor(number...)
1152 \begin_layout Standard
1153 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
1157 \begin_layout Subsubsection
1158 lrotate(number base[, number amount[, number bits]])
1161 \begin_layout Standard
1162 Rotate bits-bit (max 48, default 48) number left by amount (default 1) places.
1165 \begin_layout Subsubsection
1166 rrotate(number base[, number amount[, number bits]])
1169 \begin_layout Standard
1170 Rotate bits-bit (max 48, default 48) number right by amount (default 1)
1174 \begin_layout Subsubsection
1175 lshift(number base[, number amount[, number bits]])
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.
1183 \begin_layout Subsubsection
1184 lrshift(number base[, number amount[, number bits]])
1187 \begin_layout Standard
1188 Shift bits-bit (max 48, default 48) number logically right by amount (default
1190 The new bits are filled with zeroes.
1193 \begin_layout Subsubsection
1194 arshift(number base[, number amount[, number bits]])
1197 \begin_layout Standard
1198 Shift bits-bit (max 48, default 48) number arithmetically right by amount
1200 The new bits are shifted in with copy of the high bit.
1203 \begin_layout Subsection
1207 \begin_layout Standard
1208 Most of these functions can only be called in on_paint and on_video callbacks.
1209 Exceptions are noted.
1212 \begin_layout Subsubsection
1216 \begin_layout Standard
1217 Returns 5-tuple (hresolution, vresolution, rshift, gshift, bshift).
1220 \begin_layout Subsubsection
1221 gui.<class>_gap(number gap)
1224 \begin_layout Standard
1225 Set the <class> (left, right, top, bottom) gap to specified value (max gap
1229 \begin_layout Subsubsection
1230 gui.text(number x, number y, string text[, number fgc[, number fga[, number
1231 bgc[, number bga]]]])
1234 \begin_layout Standard
1235 Draw text on the GUI.
1236 Font size is 8(or 16) by 16.
1240 \begin_layout Itemize
1241 Coordinate origin is at top-left of the game area.
1242 Left and top gaps have negative coordinates.
1245 \begin_layout Itemize
1246 Use gui.resolution() to discover how to layout colors.
1249 \begin_layout Itemize
1250 Alpha range is 0(transparent)-256(opaque).
1253 \begin_layout Itemize
1254 Only available in on_paint() and on_video() callbacks.
1257 \begin_layout Subsubsection
1261 \begin_layout Standard
1262 Request on_repaint() to happen as soon as possible.
1263 Can be used anywhere.
1266 \begin_layout Subsubsection
1267 gui.subframe_update(boolean on)
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.
1276 \begin_layout Subsection
1280 \begin_layout Standard
1282 Only available in on_input callback.
1285 \begin_layout Subsection
1286 get(number controller, number index)
1289 \begin_layout Standard
1290 Read the specified index (0-11) from specified controller (0-7).
1294 \begin_layout Itemize
1295 Uses physical controller numbering.
1296 Gamepad in port 2 is controller 4, not 1!
1299 \begin_layout Subsection
1300 set(number controller, number index, number value)
1303 \begin_layout Standard
1304 Write the specified index (0-11) from specified controller (0-7), storing
1309 \begin_layout Itemize
1310 Uses physical controller numbering.
1311 Gamepad in port 2 is controller 4, not 1!
1314 \begin_layout Subsection
1315 reset([number cycles])
1318 \begin_layout Standard
1320 If cycles is greater than zero, do delayed reset.
1323 \begin_layout Itemize
1324 Only available with subframe flag false.
1327 \begin_layout Subsection
1331 \begin_layout Standard
1332 Host memory handling (extra memory saved to savestates).
1333 Host memory starts empty.
1336 \begin_layout Subsubsection
1337 read(number address)
1340 \begin_layout Standard
1341 Reads hostmemory slot address.
1342 Slot numbers out of range return false instead of numeric.
1345 \begin_layout Subsubsection
1346 write(number address, number value)
1349 \begin_layout Standard
1350 Writes hostmemory slot with 0-255.
1351 Slot numbers out of range cause extension of host memory slot space.
1354 \begin_layout Subsection
1358 \begin_layout Standard
1362 \begin_layout Subsubsection
1363 movie.currentframe()
1366 \begin_layout Standard
1367 Return number of current frame.
1370 \begin_layout Subsubsection
1374 \begin_layout Standard
1375 Return number of frames in movie.
1378 \begin_layout Subsubsection
1382 \begin_layout Standard
1383 Return true if in readonly mode, false if in readwrite.
1386 \begin_layout Subsubsection
1387 movie.set_readwrite()
1390 \begin_layout Standard
1391 Set readwrite mode (does not cause on_readwrite callback).
1394 \begin_layout Subsubsection
1395 movie.frame_subframes(number frame)
1398 \begin_layout Standard
1399 Count number of subframes in specified frame (frame numbers are 1-based)
1403 \begin_layout Subsubsection
1404 movie.read_subframe(number frame, number subframe)
1407 \begin_layout Standard
1408 Read specifed subframe in specified frame and return data as array (100
1409 elements, numbered 0-99 currently).
1412 \begin_layout Subsection
1416 \begin_layout Standard
1417 Routines for settings manipulation
1420 \begin_layout Subsubsection
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).
1430 \begin_layout Subsubsection
1431 set(string name, string value)
1434 \begin_layout Standard
1435 Set value of setting.
1436 If setting can't be set, returns (nil, error message).
1439 \begin_layout Subsubsection
1443 \begin_layout Standard
1444 Returns if setting is set.
1445 If setting does not exist, returns (nil, error message).
1448 \begin_layout Subsubsection
1452 \begin_layout Standard
1453 Blanks a setting and returns true.
1454 If setting can't be blanked, returns (nil, error message).
1457 \begin_layout Subsection
1461 \begin_layout Standard
1462 Various callbacks to Lua that can occur.
1465 \begin_layout Subsubsection
1466 Callback: on_paint()
1469 \begin_layout Standard
1470 Called when screen is being painted.
1471 Any gui.* calls requiring graphic context draw on the screen.
1474 \begin_layout Subsubsection
1475 Callback: on_video()
1478 \begin_layout Standard
1479 Called when video dump frame is being painted.
1480 Any gui.* calls requiring graphic context draw on the video.
1483 \begin_layout Subsubsection
1484 Callback: on_startup()
1487 \begin_layout Standard
1488 Called when the emulator is starting (lsnes.rc has been run).
1491 \begin_layout Subsubsection
1492 Callback: on_pre_load(string name)
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).
1500 \begin_layout Subsubsection
1501 Callback: on_err_load(string name)
1504 \begin_layout Standard
1505 Called if loadstate goes wrong.
1508 \begin_layout Subsubsection
1509 Callback: on_post_load(string name, boolean was_savestate)
1512 \begin_layout Standard
1513 Called on successful loadstate.
1514 was_savestate gives if this was a savestate or a movie.
1517 \begin_layout Subsubsection
1518 Callback: on_pre_save(string name, boolean is_savestate)
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).
1526 \begin_layout Subsubsection
1527 Callback: on_err_save(string name)
1530 \begin_layout Standard
1531 Called if savestate goes wrong.
1534 \begin_layout Subsubsection
1535 Callback: on_post_save(string name, boolean is_savestate)
1538 \begin_layout Standard
1539 Called on successful savaestate.
1540 is_savestate gives if this was a savestate or a movie.
1543 \begin_layout Subsubsection
1547 \begin_layout Standard
1548 Called when emulator is shutting down.
1551 \begin_layout Subsubsection
1552 Callback: on_input(boolean subframe)
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.
1560 \begin_layout Subsubsection
1561 Callback: on_reset()
1564 \begin_layout Standard
1565 Called when SNES is reset.
1568 \begin_layout Subsubsection
1569 Callback: on_readwrite()
1572 \begin_layout Standard
1573 Called when moving into readwrite mode as result of
1574 \begin_inset Quotes eld
1578 \begin_inset Quotes erd
1581 command (note: moving to rwmode by Lua won't trigger this, as per recursive
1585 \begin_layout Subsubsection
1586 Callback: on_snoop(number port, number controller, number index, number
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
1597 \begin_layout Section
1601 \begin_layout Subsection
1602 Platform-specific commands:
1605 \begin_layout Subsubsection
1609 \begin_layout Standard
1610 Enable sounds in GUI (has no effect on video dumping).
1613 \begin_layout Subsubsection
1617 \begin_layout Standard
1618 Disable sounds in GUI (has no effect on video dumping).
1621 \begin_layout Subsubsection
1625 \begin_layout Standard
1626 Asks to press a key and then identifies that key.
1629 \begin_layout Subsubsection
1633 \begin_layout Standard
1634 Toggle between windowed/fullscreen console.
1637 \begin_layout Subsubsection
1641 \begin_layout Standard
1642 Scroll messages window as far back as it goes.
1645 \begin_layout Subsubsection
1649 \begin_layout Standard
1650 Scroll messages window as far forward as it goes.
1653 \begin_layout Subsubsection
1657 \begin_layout Standard
1658 Scroll messages window back one screenful.
1661 \begin_layout Subsubsection
1665 \begin_layout Standard
1666 Scroll messages window forward one screenful.
1669 \begin_layout Subsection
1673 \begin_layout Subsubsection
1674 autorepeat-first-delay
1677 \begin_layout Standard
1678 Sets the delay for first character in typematic autorepeat.
1681 \begin_layout Subsubsection
1682 autorepeat-subsequent-delay
1685 \begin_layout Standard
1686 Sets the delay for subsequent characters in typematic autorepeat.
1689 \begin_layout Subsection
1693 \begin_layout Standard
1694 Following modifier names are known:
1697 \begin_layout Itemize
1698 ctrl, lctrl, rctrl: Control keys
1701 \begin_layout Itemize
1702 alt, lalt, ralt: ALT keys.
1705 \begin_layout Itemize
1706 shift, lshift, rshift: Shift keys.
1709 \begin_layout Itemize
1710 meta, lmeta, rmeta: Meta keys.
1713 \begin_layout Itemize
1714 num, caps: Numlock/Capslock (these are sticky!)
1717 \begin_layout Itemize
1721 \begin_layout Subsection
1725 \begin_layout Standard
1726 Following key names are known:
1729 \begin_layout Itemize
1730 backspace, tab, clear, return, pause, escape, space, exclaim, quotedbl,
1731 hash, dollar, ampersand, quote, leftparen, rightparen, asterisk, plus,
1732 comma, minus, period, slash, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, colon, semicolon,
1733 less, equals, greater, question, at, leftbracket, backslash, rightbracket,
1734 caret, underscore, backquote, a, b, c, d, e, f, g, h, i, j, k, l, m, n,
1735 o, p, q, r, s, t, u, v, w, x, y, z, delete, world_0, world_1, world_2,
1736 world_3, world_4, world_5, world_6, world_7, world_8, world_9, world_10,
1737 world_11, world_12, world_13, world_14, world_15, world_16, world_17, world_18,
1738 world_19, world_20, world_21, world_22, world_23, world_24, world_25, world_26,
1739 world_27, world_28, world_29, world_30, world_31, world_32, world_33, world_34,
1740 world_35, world_36, world_37, world_38, world_39, world_40, world_41, world_42,
1741 world_43, world_44, world_45, world_46, world_47, world_48, world_49, world_50,
1742 world_51, world_52, world_53, world_54, world_55, world_56, world_57, world_58,
1743 world_59, world_60, world_61, world_62, world_63, world_64, world_65, world_66,
1744 world_67, world_68, world_69, world_70, world_71, world_72, world_73, world_74,
1745 world_75, world_76, world_77, world_78, world_79, world_80, world_81, world_82,
1746 world_83, world_84, world_85, world_86, world_87, world_88, world_89, world_90,
1747 world_91, world_92, world_93, world_94, world_95, kp0, kp1, kp2, kp3, kp4,
1748 kp5, kp6, kp7, kp8, kp9, kp_period, kp_divide, kp_multiply, kp_minus, kp_plus,
1749 kp_enter, kp_equals, up, down, right, left, insert, home, end, pageup,
1750 pagedown, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
1751 f15, numlock, capslock, scrollock, rshift, lshift, rctrl, lctrl, ralt,
1752 lalt, rmeta, lmeta, lsuper, rsuper, mode, compose, help, print, sysreq,
1753 break, menu, power, euro, undo
1756 \begin_layout Itemize
1757 Names of form 'key<n>' where <n> is 0-255 are interpretted as key having
1758 hardware-dependent scan code of <n> (useful to bind those keys that don't
1759 have symbolic names).
1762 \begin_layout Standard
1763 In addition, following pseudo-keys are known (note: these do not work yet,
1764 and especially do not work in conjunction with modifers):
1767 \begin_layout Itemize
1768 joystick<num>button<button>: Joystick <num> (0-based) button <button> (0-based).
1771 \begin_layout Itemize
1772 joystick<num>hat<hat>n: Joystick <num> (0-based) hat <hat> (0-based) up.
1775 \begin_layout Itemize
1776 joystick<num>hat<hat>w: Joystick <num> (0-based) hat <hat> (0-based) left.
1779 \begin_layout Itemize
1780 joystick<num>hat<hat>s: Joystick <num> (0-based) hat <hat> (0-based) down.
1783 \begin_layout Itemize
1784 joystick<num>hat<hat>e: Joystick <num> (0-based) hat <hat> (0-based) right.
1787 \begin_layout Itemize
1788 joystick<num>axis<axis>-: Joystick <num> (0-based) axis <axis> negative
1792 \begin_layout Itemize
1793 joystick<num>axis<axis>+: Joystick <num> (0-based) axis <axis> positive
1797 \begin_layout Subsection
1801 \begin_layout Itemize
1802 Escape: Enter/Exit Command mode, cancel modal dialogs.
1805 \begin_layout Itemize
1806 Return (also KPEnter): Execute command, ok modal dialog.
1809 \begin_layout Itemize
1810 Pgup/Up (also KP8/9 if no num lock; command mode): Previous command in command
1814 \begin_layout Itemize
1815 Pgdn/Down(also KP2/3 if no num lock; command mode): Next command in command
1819 \begin_layout Itemize
1820 Home (also KP7 if no num lock; command mode): Beginning of command.
1823 \begin_layout Itemize
1824 End (also KP1 if no num lock; command mode): End of command.
1827 \begin_layout Itemize
1828 Left (also KP4 if no num lock; command mode): Move cursor left.
1831 \begin_layout Itemize
1832 Right (also KP6 if no num lock; command mode): Move cursor right.
1835 \begin_layout Itemize
1837 if no num lock; command mode): Delete character to right of cursor.
1840 \begin_layout Itemize
1841 Insert (also KP0 if no num lock; command mode): Toggle between insert /
1845 \begin_layout Itemize
1846 Backspace (command mode): Delete character to left of cursor.
1849 \begin_layout Itemize
1850 LCTRL+LALT+ESCAPE: Ungraceful shutdown (leaves dump corrupted!).
1853 \begin_layout Subsection
1857 \begin_layout Standard
1858 If emulator does not reach internal polling loop in 15 seconds after leaving
1859 it or 15 seconds after starting, the emulator instantly bombs out.
1862 \begin_layout Section
1866 \begin_layout Standard
1867 Movie file is .zip archive in itself, normal ZIP archive tools work on it
1868 (note: If you recompress it, do not use compression methods other than
1869 store and deflate and especially do not use encryption of any kind).
1872 \begin_layout Subsection
1873 Detecting clean start/SRAM/Savestate
1876 \begin_layout Itemize
1878 \begin_inset Quotes eld
1882 \begin_inset Quotes erd
1885 it is savestate, otherwise:
1888 \begin_layout Itemize
1889 If file has members with names starting
1890 \begin_inset Quotes eld
1894 \begin_inset Quotes erd
1897 it is movie starting from SRAM, otherwise:
1900 \begin_layout Itemize
1901 It is movie starting from clear state.
1904 \begin_layout Subsection
1908 \begin_layout Standard
1909 Type of game ROM and region.
1913 \begin_layout Standard
1914 \begin_inset Tabular
1915 <lyxtabular version="3" rows="8" columns="3">
1916 <features tabularvalignment="middle">
1917 <column alignment="center" valignment="top" width="0">
1918 <column alignment="center" valignment="top" width="0">
1919 <column alignment="center" valignment="top" width="0">
1921 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1924 \begin_layout Plain Layout
1930 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1933 \begin_layout Plain Layout
1939 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1942 \begin_layout Plain Layout
1950 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1953 \begin_layout Plain Layout
1959 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1962 \begin_layout Plain Layout
1968 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1971 \begin_layout Plain Layout
1979 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1982 \begin_layout Plain Layout
1988 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1991 \begin_layout Plain Layout
1997 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2000 \begin_layout Plain Layout
2008 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2011 \begin_layout Plain Layout
2017 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2020 \begin_layout Plain Layout
2026 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2029 \begin_layout Plain Layout
2037 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2040 \begin_layout Plain Layout
2046 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2049 \begin_layout Plain Layout
2055 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2058 \begin_layout Plain Layout
2066 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2069 \begin_layout Plain Layout
2075 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2078 \begin_layout Plain Layout
2084 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2087 \begin_layout Plain Layout
2095 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2098 \begin_layout Plain Layout
2104 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2107 \begin_layout Plain Layout
2113 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2116 \begin_layout Plain Layout
2124 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2127 \begin_layout Plain Layout
2133 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2136 \begin_layout Plain Layout
2142 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2145 \begin_layout Plain Layout
2159 \begin_layout Standard
2163 \begin_layout Standard
2164 \begin_inset Tabular
2165 <lyxtabular version="3" rows="3" columns="2">
2166 <features tabularvalignment="middle">
2167 <column alignment="center" valignment="top" width="0">
2168 <column alignment="center" valignment="top" width="0">
2170 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2173 \begin_layout Plain Layout
2179 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2182 \begin_layout Plain Layout
2190 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2193 \begin_layout Plain Layout
2199 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2202 \begin_layout Plain Layout
2210 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
2213 \begin_layout Plain Layout
2219 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
2222 \begin_layout Plain Layout
2236 \begin_layout Subsection
2240 \begin_layout Standard
2241 Contains type of port #1.
2242 Valid values are 'none', 'gamepad', 'multitap' and 'mouse'.
2243 If not present, defaults to 'gamepad'.
2246 \begin_layout Subsection
2250 \begin_layout Standard
2251 Contains type of port #2.
2252 Valid values are 'none', 'gamepad', 'multitap', 'mouse', 'superscope',
2253 'justifier' and 'justifiers'.
2254 If not present, defaults to 'none'.
2257 \begin_layout Subsection
2261 \begin_layout Standard
2262 Contains name of the game.
2265 \begin_layout Subsection
2269 \begin_layout Standard
2270 Contains authors, one per line.
2271 Part before '|' is the full name, part after is the nickname.
2274 \begin_layout Subsection
2278 \begin_layout Standard
2280 \begin_inset Quotes eld
2284 \begin_inset Quotes erd
2288 Used to reject other saves.
2291 \begin_layout Subsection
2292 Member: controlsversion
2295 \begin_layout Standard
2297 \begin_inset Quotes eld
2301 \begin_inset Quotes erd
2305 Used to identify what controls are there.
2308 \begin_layout Subsection
2310 \begin_inset Quotes eld
2314 \begin_inset Quotes erd
2320 \begin_layout Standard
2321 Contains bsnes core version number.
2324 \begin_layout Subsection
2328 \begin_layout Standard
2329 Contains project ID.
2330 Used to identify if two movies are part of the same project.
2333 \begin_layout Subsection
2334 Member: {rom,slota,slotb}{,xml}.sha256
2337 \begin_layout Standard
2338 Contains SHA-256 of said ROM or ROM mapping file.
2339 Absent if corresponding file is absent.
2342 \begin_layout Subsection
2343 Member: moviesram.<name>
2346 \begin_layout Standard
2347 Raw binary startup SRAM of kind <name>.
2348 Only present in savestates and movies starting from SRAM.
2351 \begin_layout Subsection
2355 \begin_layout Standard
2356 Raw binary movie state data.
2357 Only present in savestates.
2360 \begin_layout Standard
2364 \begin_layout Itemize
2365 32 bytes: SHA-256 of project ID.
2368 \begin_layout Itemize
2369 8 bytes: Big-endian current frame.
2372 \begin_layout Itemize
2373 100x4 bytes: Poll counters for each control (bit31 of each is
2374 \begin_inset Quotes eld
2378 \begin_inset Quotes erd
2384 \begin_layout Itemize
2385 8 bytes: Big-endian lag frame count.
2388 \begin_layout Itemize
2389 32 bytes: SHA-256 of past input
2392 \begin_layout Itemize
2393 32 bytes: SHA-256 of previous.
2396 \begin_layout Subsection
2400 \begin_layout Standard
2401 Raw binary dump of host memory.
2402 Only present in savestates.
2405 \begin_layout Subsection
2409 \begin_layout Standard
2410 The savestate itself.
2411 Savestate detection uses this file, only present in savestates.
2414 \begin_layout Subsection
2418 \begin_layout Standard
2419 Screenshot of current frame.
2420 Only present in savestates.
2423 \begin_layout Subsection
2427 \begin_layout Standard
2428 Raw binary SRAM of kind <name> at time of savestate.
2429 Only present in savestates.
2432 \begin_layout Subsection
2436 \begin_layout Standard
2437 The actual input track, one line per subframe (blank lines are skipped).
2440 \begin_layout Itemize
2441 If the first byte of each line is '.', ' ', <tab> or '|', then the line is
2442 part of same frame as previous, otherwise it starts a new frame.
2445 \begin_layout Itemize
2446 First subframe must start a new frame.
2449 \begin_layout Standard
2450 Length of movie in frames is number of lines in input file that start a
2454 \begin_layout Subsection
2458 \begin_layout Standard
2459 Contains textual base-10 rerecord count (emulator just writes this, it doesn't
2463 \begin_layout Subsection
2467 \begin_layout Standard
2468 This member stores set of load IDs.
2469 There is one load ID per rerecord (plus one corresponding to start of project).
2472 \begin_layout Itemize
2473 This member constists of concatenation of records
2476 \begin_layout Itemize
2477 Each record is 2-36 bytes long and can represent 1-16,843,009 consequtive
2481 \begin_layout Itemize
2482 IDs are interpretted as 256-bit big-endian integers with warparound.
2485 \begin_layout Itemize
2486 Initial predicted ID is all zeroes.
2489 \begin_layout Standard
2490 Format of each record is:
2493 \begin_layout Itemize
2494 1 byte: Opcode byte.
2495 Bits 0-4 are prefix length (prefixlen), bits 5-6 are count length (countlen).
2499 \begin_layout Itemize
2500 32-prefixlen bytes of ID.
2503 \begin_layout Itemize
2504 countlen bytes of big-endian count (count).
2507 \begin_layout Standard
2508 Records are processed as follows:
2511 \begin_layout Itemize
2512 To form the first ID encoded by record, take the first prefixlen bytes predicted
2513 ID and append the read ID value to it.
2514 The result is the first ID encoded.
2517 \begin_layout Itemize
2518 If countlen is 0, record encodes 1 ID.
2521 \begin_layout Itemize
2522 If countlen is 1, record encodes 2+count IDs.
2525 \begin_layout Itemize
2526 If countlen is 2, record encodes 258+count IDs.
2529 \begin_layout Itemize
2530 If countlen is 3, record encodes 65794+count IDs.
2533 \begin_layout Itemize
2534 The new predicted ID is the next ID after last one encoded by the record.
2537 \begin_layout Standard
2538 The number of rerecords + 1 is equal to the sum of number of IDs encoded
2542 \begin_layout Section
2546 \begin_layout Subsection
2550 \begin_layout Standard
2551 make ui=ui-libsnes options=debugger profile=accuracy
2554 \begin_layout Itemize
2555 Yes, debugger is needed.
2558 \begin_layout Subsection
2559 Prerequisite libraries:
2562 \begin_layout Itemize
2566 \begin_layout Itemize
2570 \begin_layout Itemize
2574 \begin_layout Itemize
2578 \begin_layout Itemize
2582 \begin_layout Subsection
2583 Compile options to make:
2586 \begin_layout Subsubsection
2590 \begin_layout Standard
2591 Set path to BSNES bsnes directory to <path>.
2594 \begin_layout Subsubsection
2598 \begin_layout Standard
2599 Don't use threads (makes dumping slower, but threads probably only work
2603 \begin_layout Subsubsection
2607 \begin_layout Standard
2608 (cross) C++ compiler to use.
2612 \begin_layout Subsubsection
2616 \begin_layout Standard
2617 (host) C++ compiler to use.
2618 Defaults to the same as CC.
2621 \begin_layout Subsubsection
2625 \begin_layout Standard
2626 Assume BSNES uses compatiblity core instead of accuracy core.
2629 \begin_layout Subsubsection
2633 \begin_layout Standard
2634 Don't compile in Lua support.
2637 \begin_layout Section
2641 \begin_layout Subsection
2642 Problems from BSNES core:
2645 \begin_layout Itemize
2646 The whole pending save stuff.
2649 \begin_layout Itemize
2650 Delay resets are slow.
2653 \begin_layout Itemize
2654 RTC is not emulated in sync-stable manner.
2657 \begin_layout Itemize
2658 Lack of layer hiding.
2661 \begin_layout Itemize
2665 \begin_layout Itemize
2666 Firmwares can't be loaded from ZIP archives.
2669 \begin_layout Itemize
2670 Manual polls can be corrupted if savestate occurs during those.
2673 \begin_layout Subsection
2677 \begin_layout Itemize
2678 Make it build on Windows (and build binaries).
2679 Not todo for rr0-β0.
2682 \begin_layout Subsection
2686 \begin_layout Itemize
2687 Audio for last dumped frame is not itself dumped.
2690 \begin_layout Itemize
2691 Audio in UI is pretty bad in quality.
2694 \begin_layout Itemize
2695 UI itself is 30fps max.
2698 \begin_layout Itemize
2699 AVI compression levels 10-18 are not compatible with AVISynth AVISource.
2702 \begin_layout Itemize
2703 No menus, command based interface (SDL).
2706 \begin_layout Itemize
2707 Long commands don't scroll.
2710 \begin_layout Itemize
2714 \begin_layout Itemize
2715 Joysticks don't work.
2718 \begin_layout Section
2722 \begin_layout Subsection
2726 \begin_layout Itemize
2730 \begin_layout Itemize
2731 Fix dumper video corruption with levels 10-18.