Lua: HSL colors and color modifiers
[lsnes.git] / lua.lyx
blob080f0ab47c45160273d71e0b024a124b54f5e3bc
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 english
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 \spacing single
29 \use_hyperref true
30 \pdf_bookmarks true
31 \pdf_bookmarksnumbered false
32 \pdf_bookmarksopen false
33 \pdf_bookmarksopenlevel 1
34 \pdf_breaklinks false
35 \pdf_pdfborder false
36 \pdf_colorlinks false
37 \pdf_backref false
38 \pdf_pdfusetitle true
39 \papersize a4paper
40 \use_geometry true
41 \use_amsmath 1
42 \use_esint 1
43 \use_mhchem 1
44 \use_mathdots 1
45 \cite_engine basic
46 \use_bibtopic false
47 \use_indices false
48 \paperorientation portrait
49 \suppress_date false
50 \use_refstyle 1
51 \index Hakusana
52 \shortcut idx
53 \color #008000
54 \end_index
55 \leftmargin 2cm
56 \topmargin 2cm
57 \rightmargin 1cm
58 \bottommargin 2cm
59 \headheight 1cm
60 \headsep 1cm
61 \footskip 1cm
62 \secnumdepth 3
63 \tocdepth 3
64 \paragraph_separation indent
65 \paragraph_indentation default
66 \quotes_language english
67 \papercolumns 1
68 \papersides 1
69 \paperpagestyle default
70 \tracking_changes false
71 \output_changes false
72 \html_math_output 0
73 \html_css_as_file 0
74 \html_be_strict false
75 \end_header
77 \begin_body
79 \begin_layout Title
80 lsnes Lua functions reference
81 \end_layout
83 \begin_layout Section
84 Table of contents
85 \end_layout
87 \begin_layout Standard
88 \begin_inset CommandInset toc
89 LatexCommand tableofcontents
91 \end_inset
94 \end_layout
96 \begin_layout Standard
97 \begin_inset Newpage pagebreak
98 \end_inset
101 \end_layout
103 \begin_layout Section
104 Special tokens
105 \end_layout
107 \begin_layout Standard
108 These tokens are special, and are expanded while the script is being loaded
109 \end_layout
111 \begin_layout Subsection
112 @@LUA_SCRIPT_FILENAME@@
113 \end_layout
115 \begin_layout Standard
116 Expanded to string token containing path and filename of this Lua script.
117  Handy for referencing other lua scripts or resources that are relative
118  to this Lua script.
119 \end_layout
121 \begin_layout Standard
122 In practicular, this is suitable to be passed as base argument of various
123  functions like loadfile, dofile, resolve_filename, gui.bitmap_load, gui.bitmap_lo
124 ad_png and gui.bitmap_load_pal.
125 \end_layout
127 \begin_layout Section
128 Global
129 \end_layout
131 \begin_layout Subsection
132 print: Print values to console
133 \end_layout
135 \begin_layout Itemize
136 Syntax: none print(value...
137  values)
138 \end_layout
140 \begin_layout Standard
141 Prints specified values to console.
142  Can print any Lua type at least enough to identify the type and instance.
143 \end_layout
145 \begin_layout Subsection
146 tostringx: Format a value to string
147 \end_layout
149 \begin_layout Itemize
150 Syntax: string tostringx(value val)
151 \end_layout
153 \begin_layout Standard
154 Formats value <val> like print would, and returns the result as a string.
155 \end_layout
157 \begin_layout Subsection
158 exec: Execute lsnes commands
159 \end_layout
161 \begin_layout Itemize
162 Syntax: none exec(string cmd)
163 \end_layout
165 \begin_layout Standard
166 Execute lsnes command <cmd>.
167 \end_layout
169 \begin_layout Subsection
170 utime: Get current time
171 \end_layout
173 \begin_layout Itemize
174 Syntax: (number,number) utime()
175 \end_layout
177 \begin_layout Standard
178 Returns two numbers.
179  First is time since some epoch in seconds, the second is microseconds mod
180  10^6 since that epoch.
181 \end_layout
183 \begin_layout Subsection
184 emulator_ready: Check if emulator has been fully initialized
185 \end_layout
187 \begin_layout Itemize
188 Syntax: boolean emulator_ready()
189 \end_layout
191 \begin_layout Standard
192 Returns true if emulator has finished booting, false if not (on_startup()
193  will be issued later).
194 \end_layout
196 \begin_layout Subsection
197 set_idle_timeout: Run function after timeout when emulator is idle
198 \end_layout
200 \begin_layout Itemize
201 Syntax: none set_idle_timeout(number timeout)
202 \end_layout
204 \begin_layout Standard
205 Set number of microseconds to block idle for.
206  After this timeout has expired, on_idle() will be called once.
207 \end_layout
209 \begin_layout Subsection
210 set_timer_timeout: Run function after timeout.
211 \end_layout
213 \begin_layout Itemize
214 Syntax: none set_timer_timeout(number timeout)
215 \end_layout
217 \begin_layout Standard
218 Set number of microseconds to block timer for.
219  After this timeout has expired, on_timer() will be called once.
220 \end_layout
222 \begin_layout Subsection
223 bus_address: Look up address in system bus.
224 \end_layout
226 \begin_layout Itemize
227 Syntax: none bus_address(number bus_addr)
228 \end_layout
230 \begin_layout Standard
231 Returns virtual address corresponding to specified address on system bus.
232 \end_layout
234 \begin_layout Subsection
235 loopwrapper: Convert loop into callable function
236 \end_layout
238 \begin_layout Itemize
239 Syntax: function loopwrapper(function fun, ...)
240 \end_layout
242 \begin_layout Standard
243 Calls function <fun> with function and specified arguments.
244  The function passed suspends execution until the function returned is called.
245  Handy for linear flow control among multiple invocations of a hook.
246  Example code:
247 \end_layout
249 \begin_layout LyX-Code
250 on_paint = loopwrapper(function(wait)
251 \end_layout
253 \begin_deeper
254 \begin_layout LyX-Code
255 while true do
256 \end_layout
258 \begin_deeper
259 \begin_layout LyX-Code
260 gui.text(0, 0, 
261 \begin_inset Quotes eld
262 \end_inset
264 Test!
265 \begin_inset Quotes erd
266 \end_inset
269 \end_layout
271 \begin_layout LyX-Code
272 wait();
273 \end_layout
275 \end_deeper
276 \begin_layout LyX-Code
278 \end_layout
280 \end_deeper
281 \begin_layout LyX-Code
282 end);
283 \end_layout
285 \begin_layout Subsection
286 list_bindings: List keybindings
287 \end_layout
289 \begin_layout Itemize
290 Syntax: table list_bindings([string cmd])
291 \end_layout
293 \begin_layout Standard
294 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
295  If <cmd> is specified, the table is limited to that command.
296  Also searches for controller keys.
297 \end_layout
299 \begin_layout Subsection
300 get_alias: Get expansion of alias
301 \end_layout
303 \begin_layout Itemize
304 Syntax: string get_alias(string aname)
305 \end_layout
307 \begin_layout Standard
308 Get expansion of given alias <aname>.
309 \end_layout
311 \begin_layout Subsection
312 set_alias: Set expansion of alias
313 \end_layout
315 \begin_layout Itemize
316 Syntax: none set_alias(string aname, string value)
317 \end_layout
319 \begin_layout Standard
320 Set expansion of given alias.
321 \end_layout
323 \begin_layout Subsection
324 create_ibind: Create invese binding
325 \end_layout
327 \begin_layout Itemize
328 Syntax: INVERSEBIND create_ibind(string name, string cmd)
329 \end_layout
331 \begin_layout Standard
332 Return object representing inverse binding with specified name <name> and
333  specified command <cmd>.
334 \end_layout
336 \begin_layout Itemize
337 Note: To create press/release commands, use aliases +foo and -foo .
338 \end_layout
340 \begin_layout Itemize
341 Note: Keep the returned object around.
342 \end_layout
344 \begin_layout Subsection
345 create_command: Create a command
346 \end_layout
348 \begin_layout Itemize
349 Syntax: COMMANDBIND create_commmand(string name, function a)
350 \end_layout
352 \begin_layout Itemize
353 Syntax: COMMANDBIND create_commmand(string name, function a, function b)
354 \end_layout
356 \begin_layout Standard
357 Return object representing a command (pair).
358 \end_layout
360 \begin_layout Itemize
361 If only one function is specied, the command is level-sensitive, <a> is
362  callback.
363 \end_layout
365 \begin_layout Itemize
366 If <b> is function, the function is edge-sensitive, <a> is positive edge
367  callback and <b> is negative edge callback.
368 \end_layout
370 \begin_layout Itemize
371 All callbacks get single argument: The parameters passed.
372 \end_layout
374 \begin_layout Itemize
375 Keep the returned object around.
376 \end_layout
378 \begin_layout Subsection
379 loadfile: Load Lua script
380 \end_layout
382 \begin_layout Itemize
383 Syntax: function loadfile(string filename[, string base])
384 \end_layout
386 \begin_layout Standard
387 Load lua script from <filename>, resolved relative to <base> (if empty,
388  current directory).
389 \end_layout
391 \begin_layout Subsection
392 dofile: Execute Lua script
393 \end_layout
395 \begin_layout Itemize
396 Syntax: function dofile(string filename[, string base])
397 \end_layout
399 \begin_layout Standard
400 Execute lua script from <filename>, resolved relative to <base> (if empty,
401  current directory) and return all return values.
402 \end_layout
404 \begin_layout Subsection
405 open_file: Open a stream
406 \end_layout
408 \begin_layout Itemize
409 Syntax: FILEREADER open_file(string filename[, string base])
410 \end_layout
412 \begin_layout Standard
413 Open file <filename>, resolved relative to <base> (if empty, current directory)
414  and return a handle.
415 \end_layout
417 \begin_layout Subsection
418 FILEREADER(): Read line/bytes from stream
419 \end_layout
421 \begin_layout Itemize
422 Syntax: string/nil FILEREADER()
423 \end_layout
425 \begin_layout Itemize
426 Syntax: string/nil FILEREADER(number bytes)
427 \end_layout
429 \begin_layout Standard
430 Reads next line or <bytes> bytes from specified file handle.
431  On EOF, nil is returned.
432 \end_layout
434 \begin_layout Itemize
435 Note: The line-oriented variant reads in text mode, so CR at end of line
436  is stripped.
437 \end_layout
439 \begin_layout Subsection
440 FILEREADER:lines: Iterator to read all lines
441 \end_layout
443 \begin_layout Itemize
444 Syntax: for line in <foo>:lines() do ...
445  end
446 \end_layout
448 \begin_layout Standard
449 Iterator for reading all lines of <foo> in a loop.
450 \end_layout
452 \begin_layout Subsection
453 resolve_filename: Resolve name of file relative to another
454 \end_layout
456 \begin_layout Itemize
457 Syntax: string resolve_file(string filename, string base)
458 \end_layout
460 \begin_layout Standard
461 Resolve name of file <filename> relative to <base> and return the result.
462 \end_layout
464 \begin_layout Standard
465 \begin_inset Newpage pagebreak
466 \end_inset
469 \end_layout
471 \begin_layout Section
472 Table bit:
473 \end_layout
475 \begin_layout Standard
476 Bitwise logical functions and related.
477 \end_layout
479 \begin_layout Subsection
480 bit.none/bit.bnot: Bitwise none or NOT function
481 \end_layout
483 \begin_layout Itemize
484 Syntax: number bit.none(number...)
485 \end_layout
487 \begin_layout Itemize
488 Syntax: number bit.bnot(number...)
489 \end_layout
491 \begin_layout Standard
492 48-bit bitwise NOT / NONE function (set bits that are set in none of the
493  arguments).
494 \end_layout
496 \begin_layout Subsection
497 bit.any/bit.bor: Bitwise any or OR function
498 \end_layout
500 \begin_layout Itemize
501 Syntax: number bit.any(number...)
502 \end_layout
504 \begin_layout Itemize
505 Syntax: number bit.bor(number...)
506 \end_layout
508 \begin_layout Standard
509 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
510 \end_layout
512 \begin_layout Subsection
513 bit.all/bit.band: Bitwise all or AND function
514 \end_layout
516 \begin_layout Itemize
517 Syntax: number bit.all(number...)
518 \end_layout
520 \begin_layout Itemize
521 Syntax: number bit.band(number...)
522 \end_layout
524 \begin_layout Standard
525 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
527 \end_layout
529 \begin_layout Subsection
530 bit.parity/bit.bxor: Bitwise parity or XOR function
531 \end_layout
533 \begin_layout Itemize
534 Syntax: number bit.parity(number...)
535 \end_layout
537 \begin_layout Itemize
538 Syntax: number bit.bxor(number...)
539 \end_layout
541 \begin_layout Standard
542 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
543  of the arguments).
544 \end_layout
546 \begin_layout Subsection
547 bit.lrotate: Rotate a number left
548 \end_layout
550 \begin_layout Itemize
551 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
552 \end_layout
554 \begin_layout Standard
555 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
556  1) places.
557 \end_layout
559 \begin_layout Subsection
560 bit.rrotate: Rotate a number right
561 \end_layout
563 \begin_layout Itemize
564 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
565 \end_layout
567 \begin_layout Standard
568 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
569  1) places.
570 \end_layout
572 \begin_layout Subsection
573 bit.lshift: Shift a number left
574 \end_layout
576 \begin_layout Itemize
577 Syntax: number bit.lshift(number base[, number amount[, number bits]])
578 \end_layout
580 \begin_layout Standard
581 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
582  1) places.
583  The new bits are filled with zeroes.
584 \end_layout
586 \begin_layout Subsection
587 bit.lrshift: Shift a number right (logical)
588 \end_layout
590 \begin_layout Itemize
591 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
592 \end_layout
594 \begin_layout Standard
595 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
596  (default 1) places.
597  The new bits are filled with zeroes.
598 \end_layout
600 \begin_layout Subsection
601 bit.arshift: Shift a number right (arithmetic)
602 \end_layout
604 \begin_layout Itemize
605 Syntax: number bit.arshift(number base[, number amount[, number bits]])
606 \end_layout
608 \begin_layout Standard
609 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
610  (default 1) places.
611  The new bits are shifted in with copy of the high bit.
612 \end_layout
614 \begin_layout Subsection
615 bit.extract: Extract/shuffle bits from number
616 \end_layout
618 \begin_layout Itemize
619 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
620 \end_layout
622 \begin_layout Standard
623 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
624 \end_layout
626 \begin_layout Itemize
627 Note: Bit numbers up to 51 should work reliably (then things start falling
628  apart due to double precision issues).
629 \end_layout
631 \begin_layout Itemize
632 Note: There are two special bit positions, true and false, standing for
633  always set bit and always clear bit.
634 \end_layout
636 \begin_layout Subsection
637 bit.value: Construct number with specified bits set
638 \end_layout
640 \begin_layout Itemize
641 Syntax: number bit.value([number bit1[, number bit2,...]])
642 \end_layout
644 \begin_layout Standard
645 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
646  <bit2> places and so on.
647  As special value, nil argument is no-op.
648 \end_layout
650 \begin_layout Subsection
651 bit.test_any: Test if any bit is set
652 \end_layout
654 \begin_layout Itemize
655 Syntax: boolean bit.test_any(number a, number b)
656 \end_layout
658 \begin_layout Standard
659 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
660 \end_layout
662 \begin_layout Subsection
663 bit.test_all: Test if all bits are set
664 \end_layout
666 \begin_layout Itemize
667 Syntax: boolean bit.test_all(number a, number b)
668 \end_layout
670 \begin_layout Standard
671 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
672 \end_layout
674 \begin_layout Subsection
675 bit.popcount: Population count
676 \end_layout
678 \begin_layout Itemize
679 Syntax: number bit.popcount(number a)
680 \end_layout
682 \begin_layout Standard
683 Returns number of set bits in <a>.
684 \end_layout
686 \begin_layout Subsection
687 bit.clshift: Chained left shift
688 \end_layout
690 \begin_layout Itemize
691 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
692  bits]])
693 \end_layout
695 \begin_layout Standard
696 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
697  numbers to be of specified number of bits <bits> (default 48).
698 \end_layout
700 \begin_layout Subsection
701 bit.crshift: Chained right shift
702 \end_layout
704 \begin_layout Itemize
705 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
706  bits]])
707 \end_layout
709 \begin_layout Standard
710 Does chained right shift on <a>, <b> by <amount> positions (default 1),
711  assuming numbers to be of specified number of bits <bits> (default 48).
712 \end_layout
714 \begin_layout Subsection
715 bit.flagdecode: Decode bitfield into flags
716 \end_layout
718 \begin_layout Itemize
719 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
720  off]])
721 \end_layout
723 \begin_layout Standard
724 Return string of length bits where ith character is ith character of on
725  if bit i is on, otherwise ith character of off.
726  Out of range reads give last character.
727 \end_layout
729 \begin_layout Itemize
730 Note: <on> defaults to '*' if empty.
731 \end_layout
733 \begin_layout Itemize
734 Note: <off> defaults to '-' if empty.
735 \end_layout
737 \begin_layout Subsection
738 bit.rflagdecode: Decode bitfield into flags
739 \end_layout
741 \begin_layout Itemize
742 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
743  off]])
744 \end_layout
746 \begin_layout Standard
747 Like bit.flagdecode, but outputs the string in the opposite order (most significa
748 nt bit first).
749 \end_layout
751 \begin_layout Standard
752 \begin_inset Newpage pagebreak
753 \end_inset
756 \end_layout
758 \begin_layout Section
759 Table gui:
760 \end_layout
762 \begin_layout Itemize
763 Functions that draw to screen can only only be called in on_paint and on_video
764  callbacks or if non-default render queue has been set.
765 \end_layout
767 \begin_layout Itemize
768 Colors are 32-bit.
769  Bits 0-7 are the blue component, bits 8-15 are the green component, bits
770  16-23 are the red component, bits 24-31 are alpha component (0 is fully
771  opaque, 255 is almost transparent).
772  -1 is the fully transparent color.
773  Alternatively, colors can be given as strings naming the color.
774 \end_layout
776 \begin_layout Itemize
777 Alpha values greater than 127 do work properly.
778 \end_layout
780 \begin_layout Itemize
781 Origin of coordinates is at top left corner of game display area.
782  Left and top gaps correspond to negative coordinates.
783 \end_layout
785 \begin_layout Itemize
786 The following color names are known: aliceblue antiquewhite antiquewhite1
787  antiquewhite2 antiquewhite3 antiquewhite4 aqua aquamarine aquamarine1 aquamarin
788 e2 aquamarine3 aquamarine4 azure azure1 azure2 azure3 azure4 beige bisque
789  bisque1 bisque2 bisque3 bisque4 black blanchedalmond blue blue1 blue2 blue3
790  blue4 blueviolet brown brown1 brown2 brown3 brown4 burlywood burlywood1
791  burlywood2 burlywood3 burlywood4 cadet cadetblue cadetblue1 cadetblue2
792  cadetblue3 cadetblue4 chartreuse chartreuse1 chartreuse2 chartreuse3 chartreuse
793 4 chocolate chocolate1 chocolate2 chocolate3 chocolate4 coral coral1 coral2
794  coral3 coral4 cornflowerblue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4
795  crimson cyan cyan1 cyan2 cyan3 cyan4 darkblue darkcyan darkgoldenrod darkgolden
796 rod1 darkgoldenrod2 darkgoldenrod3 darkgoldenrod4 darkgray darkgreen darkgrey
797  darkkhaki darkmagenta darkolivegreen darkolivegreen1 darkolivegreen2 darkoliveg
798 reen3 darkolivegreen4 darkorange darkorange1 darkorange2 darkorange3 darkorange4
799  darkorchid darkorchid1 darkorchid2 darkorchid3 darkorchid4 darkred darksalmon
800  darkseagreen darkseagreen1 darkseagreen2 darkseagreen3 darkseagreen4 darkslateb
801 lue darkslategray darkslategray1 darkslategray2 darkslategray3 darkslategray4
802  darkslategrey darkturquoise darkviolet deeppink deeppink1 deeppink2 deeppink3
803  deeppink4 deepskyblue deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4
804  dimgray dimgrey dodgerblue dodgerblue1 dodgerblue2 dodgerblue3 dodgerblue4
805  firebrick firebrick1 firebrick2 firebrick3 firebrick4 floralwhite forestgreen
806  fractal fuchsia gainsboro ghostwhite gold gold1 gold2 gold3 gold4 goldenrod
807  goldenrod1 goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100
808  gray11 gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2 gray20
809  gray21 gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3 gray30
810  gray31 gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4 gray40
811  gray41 gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5 gray50
812  gray51 gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6 gray60
813  gray61 gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7 gray70
814  gray71 gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8 gray80
815  gray81 gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9 gray90
816  gray91 gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green green1
817  green2 green3 green4 greenyellow grey grey0 grey1 grey10 grey100 grey11
818  grey12 grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2 grey20 grey21
819  grey22 grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3 grey30 grey31
820  grey32 grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4 grey40 grey41
821  grey42 grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5 grey50 grey51
822  grey52 grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6 grey60 grey61
823  grey62 grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7 grey70 grey71
824  grey72 grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8 grey80 grey81
825  grey82 grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9 grey90 grey91
826  grey92 grey93 grey94 grey95 grey96 grey97 grey98 grey99 honeydew honeydew1
827  honeydew2 honeydew3 honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4
828  indianred indianred1 indianred2 indianred3 indianred4 indigo ivory ivory1
829  ivory2 ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4 lavender lavenderblush
830  lavenderblush1 lavenderblush2 lavenderblush3 lavenderblush4 lawngreen lemonchif
831 fon lemonchiffon1 lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue lightblue1
832  lightblue2 lightblue3 lightblue4 lightcoral lightcyan lightcyan1 lightcyan2
833  lightcyan3 lightcyan4 lightgoldenrod lightgoldenrod1 lightgoldenrod2 lightgolde
834 nrod3 lightgoldenrod4 lightgoldenrodyellow lightgray lightgreen lightgrey
835  lightpink lightpink1 lightpink2 lightpink3 lightpink4 lightsalmon lightsalmon1
836  lightsalmon2 lightsalmon3 lightsalmon4 lightseagreen lightskyblue lightskyblue1
837  lightskyblue2 lightskyblue3 lightskyblue4 lightslateblue lightslategray
838  lightslategrey lightsteelblue lightsteelblue1 lightsteelblue2 lightsteelblue3
839  lightsteelblue4 lightyellow lightyellow1 lightyellow2 lightyellow3 lightyellow4
840  lime limegreen linen magenta magenta1 magenta2 magenta3 magenta4 maroon
841  maroon1 maroon2 maroon3 maroon4 mediumaquamarine mediumblue mediumforestgreen
842  mediumgoldenrod mediumorchid mediumorchid1 mediumorchid2 mediumorchid3
843  mediumorchid4 mediumpurple mediumpurple1 mediumpurple2 mediumpurple3 mediumpurp
844 le4 mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumviole
845 tred midnightblue mintcream mistyrose mistyrose1 mistyrose2 mistyrose3 mistyrose
846 4 moccasin navajowhite navajowhite1 navajowhite2 navajowhite3 navajowhite4
847  navy navyblue oldlace olive olivedrab olivedrab1 olivedrab2 olivedrab3
848  olivedrab4 orange orange1 orange2 orange3 orange4 orangered orangered1
849  orangered2 orangered3 orangered4 orchid orchid1 orchid2 orchid3 orchid4
850  palegoldenrod palegreen palegreen1 palegreen2 palegreen3 palegreen4 paleturquoi
851 se paleturquoise1 paleturquoise2 paleturquoise3 paleturquoise4 palevioletred
852  palevioletred1 palevioletred2 palevioletred3 palevioletred4 papayawhip
853  peachpuff peachpuff1 peachpuff2 peachpuff3 peachpuff4 peru pink pink1 pink2
854  pink3 pink4 plum plum1 plum2 plum3 plum4 powderblue purple purple1 purple2
855  purple3 purple4 red red1 red2 red3 red4 rosybrown rosybrown1 rosybrown2
856  rosybrown3 rosybrown4 royalblue royalblue1 royalblue2 royalblue3 royalblue4
857  saddlebrown salmon salmon1 salmon2 salmon3 salmon4 sandybrown seagreen
858  seagreen1 seagreen2 seagreen3 seagreen4 seashell seashell1 seashell2 seashell3
859  seashell4 sienna sienna1 sienna2 sienna3 sienna4 silver skyblue skyblue1
860  skyblue2 skyblue3 skyblue4 slateblue slateblue1 slateblue2 slateblue3 slateblue
861 4 slategray slategray1 slategray2 slategray3 slategray4 slategrey snow snow1
862  snow2 snow3 snow4 springgreen springgreen1 springgreen2 springgreen3 springgree
863 n4 steelblue steelblue1 steelblue2 steelblue3 steelblue4 tan tan1 tan2 tan3
864  tan4 teal thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2
865  tomato3 tomato4 transparent turquoise turquoise1 turquoise2 turquoise3
866  turquoise4 violet violetred violetred1 violetred2 violetred3 violetred4
867  wheat wheat1 wheat2 wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
868  yellow3 yellow4 yellowgreen hsl-{r,ry,o,y,yg,g,gc,c,cb,b,bm,m,mr}{0,1,2,3,4,5,6
869 ,7,8}{0,1,2,3,4,5,6,7,8}.
870 \end_layout
872 \begin_layout Itemize
873 The following modifiers can be applied: opaque10, opaque20, opaque25, opaque30,
874  opaque40, opaque50, opaque60, opaque70, opaque75, opaque80, opaque90, opaque,
875  hue{+,-}{1-23}, {saturation,lightness}{+,-}{1-16}.
876 \end_layout
878 \begin_layout Itemize
879 HSL base color names: r => Red, ry => Red-Yellow (also o).
880  y => Yellow, yg => Yellow-Green, g => Green, gc => Green-Cyan, c => Cyan,
881  cb => Cyan-Blue, b => Blue, bm => Blue-Magenta, m => Magenta, mr => Magenta
882  red.
883 \end_layout
885 \begin_layout Itemize
886 HSL colors use 8-step scales for saturation and lightness.
887 \end_layout
889 \begin_layout Itemize
890 Modifiers have opaqueness on percent scale (0 is transparent, 100 is fully
891  opaque).
892 \end_layout
894 \begin_layout Itemize
895 Modifiers have Hue on 24-step scale (4 steps between R->Y->G->C->B->M->R).
896 \end_layout
898 \begin_layout Itemize
899 Modifiers have Saturation/Lightness on 16 step scale.
900 \end_layout
902 \begin_layout Subsection
903 gui.resolution: Get current resolution
904 \end_layout
906 \begin_layout Itemize
907 Syntax: (number, number) gui.resolution()
908 \end_layout
910 \begin_layout Standard
911 Returns 2-tuple (hresolution, vresolution).
912 \end_layout
914 \begin_layout Subsection
915 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
916 \end_layout
918 \begin_layout Itemize
919 Syntax: number gui.left_gap(number gap)
920 \end_layout
922 \begin_layout Itemize
923 Syntax: number gui.right_gap(number gap)
924 \end_layout
926 \begin_layout Itemize
927 Syntax: number gui.top_gap(number gap)
928 \end_layout
930 \begin_layout Itemize
931 Syntax: number gui.bottom_gap(number gap)
932 \end_layout
934 \begin_layout Standard
935 Set the specified edge gap to specified value <gap> (max gap is 8191).
936  If successful, old gap is returned.
937 \end_layout
939 \begin_layout Subsection
940 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
941  Adjust edge gaps
942 \end_layout
944 \begin_layout Itemize
945 Syntax: number gui.delta_left_gap(number dgap)
946 \end_layout
948 \begin_layout Itemize
949 Syntax: number gui.delta_right_gap(number dgap)
950 \end_layout
952 \begin_layout Itemize
953 Syntax: number gui.delta_top_gap(number dgap)
954 \end_layout
956 \begin_layout Itemize
957 Syntax: number gui.delta_bottom_gap(number dgap)
958 \end_layout
960 \begin_layout Standard
961 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
962  and return the old gap (returns nothing on error).
963 \end_layout
965 \begin_layout Subsection
966 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
967 \end_layout
969 \begin_layout Itemize
970 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
971  bgc]])
972 \end_layout
974 \begin_layout Itemize
975 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
976  bgc]])
977 \end_layout
979 \begin_layout Itemize
980 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
981  bgc]])
982 \end_layout
984 \begin_layout Itemize
985 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
986  bgc]])
987 \end_layout
989 \begin_layout Standard
990 Draw specified text on the GUI (each character cell is 8 or 16 wide and
991  16 high).
992  Parameters:
993 \end_layout
995 \begin_layout Itemize
996 x: X-coordinate to start the drawing from (and x-coordinate at begining
997  of the lines).
998 \end_layout
1000 \begin_layout Itemize
1001 y: Y-coordinate to start the drawing from.
1002 \end_layout
1004 \begin_layout Itemize
1005 text: The text to draw.
1006 \end_layout
1008 \begin_layout Itemize
1009 fgc: Text color (default is 0xFFFFFF (white))
1010 \end_layout
1012 \begin_layout Itemize
1013 bgc: Background color (default is -1 (transparent))
1014 \end_layout
1016 \begin_layout Standard
1017 Note: The H variants draw at double width and V variants draw at double
1018  height.
1019 \end_layout
1021 \begin_layout Subsection
1022 gui.rectangle: Draw a rectangle
1023 \end_layout
1025 \begin_layout Itemize
1026 Syntax: none gui.rectangle(number x, number y, number width, number height[,
1027  number thickness[, number outline[, number fill]]])
1028 \end_layout
1030 \begin_layout Standard
1031 Draw rectangle on the GUI.
1032  Parameters:
1033 \end_layout
1035 \begin_layout Itemize
1036 x: X-coordinate of left edge.
1037 \end_layout
1039 \begin_layout Itemize
1040 y: Y-coordinate of upper edge.
1041 \end_layout
1043 \begin_layout Itemize
1044 width: Width of rectangle.
1045 \end_layout
1047 \begin_layout Itemize
1048 height: Height of rectangle.
1049 \end_layout
1051 \begin_layout Itemize
1052 thickness: Thickness of outline (default is 1).
1053 \end_layout
1055 \begin_layout Itemize
1056 outline: Color of outline (default is 0xFFFFFF (white))
1057 \end_layout
1059 \begin_layout Itemize
1060 fill: Color of fill (default is -1 (transparent))
1061 \end_layout
1063 \begin_layout Subsection
1064 gui.box: Draw a 3D-effect box
1065 \end_layout
1067 \begin_layout Itemize
1068 Syntax: none gui.box(number x, number y, number width, number height[, number
1069  thickness[, number outline1[,number outline2[, number fill]]]])
1070 \end_layout
1072 \begin_layout Standard
1073 Draw rectangle with 3D effect on the GUI.
1074  Parameters:
1075 \end_layout
1077 \begin_layout Itemize
1078 x: X-coordinate of left edge.
1079 \end_layout
1081 \begin_layout Itemize
1082 y: Y-coordinate of upper edge.
1083 \end_layout
1085 \begin_layout Itemize
1086 width: Width of rectangle.
1087 \end_layout
1089 \begin_layout Itemize
1090 height: Height of rectangle.
1091 \end_layout
1093 \begin_layout Itemize
1094 thickness: Thickness of outline (default is 1).
1095 \end_layout
1097 \begin_layout Itemize
1098 outline1: First color of outline (default is 0xFFFFFF (white))
1099 \end_layout
1101 \begin_layout Itemize
1102 outline2: First color of outline (default is 0x808080 (dark gray))
1103 \end_layout
1105 \begin_layout Itemize
1106 fill: Color of fill (default is 0xC0C0C0 (light grayy))
1107 \end_layout
1109 \begin_layout Subsection
1110 gui.pixel: Draw a single pixel
1111 \end_layout
1113 \begin_layout Itemize
1114 Syntax: none gui.pixel(number x, number y[, number color])
1115 \end_layout
1117 \begin_layout Standard
1118 Draw one pixel on the GUI.
1119  Parameters:
1120 \end_layout
1122 \begin_layout Itemize
1123 x: X-coordinate of the pixel
1124 \end_layout
1126 \begin_layout Itemize
1127 y: Y-coordinate of the pixel
1128 \end_layout
1130 \begin_layout Itemize
1131 color: Color of the pixel (default is 0xFFFFFF (white))
1132 \end_layout
1134 \begin_layout Subsection
1135 gui.crosshair: Draw a crosshair
1136 \end_layout
1138 \begin_layout Itemize
1139 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
1140 \end_layout
1142 \begin_layout Standard
1143 Draw a crosshair.
1144  Parameters:
1145 \end_layout
1147 \begin_layout Itemize
1148 x: X-coordinate of the crosshair
1149 \end_layout
1151 \begin_layout Itemize
1152 y: Y-coordinate of the crosshair
1153 \end_layout
1155 \begin_layout Itemize
1156 length: Length of the crosshair lines (default 10).
1157 \end_layout
1159 \begin_layout Itemize
1160 color: Color of the crosshair (default is 0xFFFFFF (white))
1161 \end_layout
1163 \begin_layout Subsection
1164 gui.line: Draw a line
1165 \end_layout
1167 \begin_layout Itemize
1168 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
1169  color])
1170 \end_layout
1172 \begin_layout Standard
1173 Draw a thin line.
1174  Parameters:
1175 \end_layout
1177 \begin_layout Itemize
1178 x1: X-coordinate of one end.
1179 \end_layout
1181 \begin_layout Itemize
1182 y1: Y-coordinate of one end.
1183 \end_layout
1185 \begin_layout Itemize
1186 x2: X-coordinate of the other end.
1187 \end_layout
1189 \begin_layout Itemize
1190 y2: Y-coordinate of the other end.
1191 \end_layout
1193 \begin_layout Itemize
1194 color: Color of the line (default is 0xFFFFFF (white)).
1195 \end_layout
1197 \begin_layout Subsection
1198 gui.circle: Draw a (filled) circle
1199 \end_layout
1201 \begin_layout Itemize
1202 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
1203  border[, number fil]]])
1204 \end_layout
1206 \begin_layout Standard
1207 Draw a circle.
1208  Parameters.
1209 \end_layout
1211 \begin_layout Itemize
1212 x: X-coordinate of the center
1213 \end_layout
1215 \begin_layout Itemize
1216 y: Y-coordinate of the center
1217 \end_layout
1219 \begin_layout Itemize
1220 r: The radius of the circle
1221 \end_layout
1223 \begin_layout Itemize
1224 thick: Border thickness
1225 \end_layout
1227 \begin_layout Itemize
1228 border: Border color (default is 0xFFFFFF (white))
1229 \end_layout
1231 \begin_layout Itemize
1232 fill: Fill color (default is -1 (transparent)).
1233 \end_layout
1235 \begin_layout Subsection
1236 gui.bitmap_draw/(D)BITMAP:draw: Draw a bitmap
1237 \end_layout
1239 \begin_layout Itemize
1240 Syntax: none gui.bitmap_draw(number x, number y, BITMAP bitmap, PALETTE palette)
1241 \end_layout
1243 \begin_layout Itemize
1244 Syntax: none gui.bitmap_draw(number x, number y, DBITMAP bitmap)
1245 \end_layout
1247 \begin_layout Itemize
1248 Syntax: none BITMAP:draw(number x, number y, PALETTE palette)
1249 \end_layout
1251 \begin_layout Itemize
1252 Syntax: none DBITMAP:draw(number x, number y)
1253 \end_layout
1255 \begin_layout Standard
1256 Draw a bitmap <bitmap> (or object) on screen with specified palette <palette>
1257  (if bitmap is paletted) .
1258  Parameters:
1259 \end_layout
1261 \begin_layout Itemize
1262 x: X-coordinate of left edge.
1263 \end_layout
1265 \begin_layout Itemize
1266 y: Y-coordinate of top edge.
1267 \end_layout
1269 \begin_layout Itemize
1270 bitmap: The bitmap to draw
1271 \end_layout
1273 \begin_layout Itemize
1274 palette: The palette to draw the bitmap using.
1275 \end_layout
1277 \begin_layout Subsection
1278 gui.palette_new: Create a new palette
1279 \end_layout
1281 \begin_layout Itemize
1282 Syntax: PALETTE gui.palette_new()
1283 \end_layout
1285 \begin_layout Standard
1286 Returns a new palette (initially all transparent).
1288 \end_layout
1290 \begin_layout Subsection
1291 gui.bitmap_new: Create a new bitmap
1292 \end_layout
1294 \begin_layout Itemize
1295 Syntax: BITMAP/DBITMAP gui.bitmap_new(number w, number h, boolean direct[,
1296  bool icolor])
1297 \end_layout
1299 \begin_layout Standard
1300 Returns a new bitmap/dbitmap.
1301 \end_layout
1303 \begin_layout Standard
1304 Parameters:
1305 \end_layout
1307 \begin_layout Itemize
1308 w: The width of new bitmap
1309 \end_layout
1311 \begin_layout Itemize
1312 h: The height of new bitmap
1313 \end_layout
1315 \begin_layout Itemize
1316 direct: If true, the returned bitmap is dbitmap, otherwise bitmap.
1317 \end_layout
1319 \begin_layout Itemize
1320 icolor: Initital fill color (defaults to 0 on BITMAP, -1 on DBITMAP)
1321 \end_layout
1323 \begin_layout Subsection
1324 gui.bitmap_load/gui.bitmap_load_str: Load a bitmap from file or string
1325 \end_layout
1327 \begin_layout Itemize
1328 Syntax: DBITMAP/(BITMAP, PALETTE) gui.bitmap_load(string file[, string base])
1329 \end_layout
1331 \begin_layout Itemize
1332 Syntax: DBITMAP/(BITMAP, PALETTE) gui.bitmap_load_str(string content)
1333 \end_layout
1335 \begin_layout Standard
1336 Reads file <file> (resolved relative to <base>) or string <content> and
1337  returns loaded bitmap/dbitmap (if bitmap, the second return value is palette
1338  for bitmap).
1339 \end_layout
1341 \begin_layout Subsection
1342 gui.bitmap_load_png/gui.bitmap_load_png_str: Load a bitmap from PNG
1343 \end_layout
1345 \begin_layout Itemize
1346 Syntax: DBITMAP/(BITMAP, PALETTE) gui.bitmap_load_png(string file[, string
1347  base])
1348 \end_layout
1350 \begin_layout Itemize
1351 Syntax: DBITMAP/(BITMAP, PALETTE) gui.bitmap_load_png_str(string content)
1352 \end_layout
1354 \begin_layout Standard
1355 Load a bitmap from PNG file <file> (resolved relative to <base>) or BASE64
1356  encoded content <content>.
1357 \end_layout
1359 \begin_layout Itemize
1360 If the PNG is of color type 3 (PALETTE), returns two values.
1361  First is BITMAP containing the image data from the PNG and second is PALETTE
1362  containg the palette data from the PNG.
1363 \end_layout
1365 \begin_layout Itemize
1366 For color types 0 (GRAY), 2 (RGB), 4 (GRAY_ALPHA) and 6 (RGBA), returns
1367  one DBITMAP containg the image data loaded from the PNG.
1368 \end_layout
1370 \begin_layout Subsection
1371 gui.bitmap_load_pal/gui.bitmap_load_pal_str: Load a palette
1372 \end_layout
1374 \begin_layout Itemize
1375 Syntax: PALETTE gui.bitmap_load_pal(string file[, string base])
1376 \end_layout
1378 \begin_layout Itemize
1379 Syntax: PALETTE gui.bitmap_load_pal_str(string content)
1380 \end_layout
1382 \begin_layout Standard
1383 Load a palette from file <file>(resolved relative to <base>) or string <content>.
1384 \end_layout
1386 \begin_layout Itemize
1387 The kinds of lines supported:
1388 \end_layout
1390 \begin_deeper
1391 \begin_layout Itemize
1392 Blank or just whitespace: Ignored
1393 \end_layout
1395 \begin_layout Itemize
1396 First non-whitespace is '#': Ignored
1397 \end_layout
1399 \begin_layout Itemize
1400 <r> <g> <b>: Fully opaque color with specified RGB values (0-255)
1401 \end_layout
1403 \begin_layout Itemize
1404 <r> <g> <b> <a>: Color with specified RGB values (0-255) and specified alpha
1405  (0-256, 0 being fully transparent and 256 fully opaque).
1406 \end_layout
1408 \begin_layout Itemize
1409 transparent: Fully transparent color
1410 \end_layout
1412 \end_deeper
1413 \begin_layout Subsection
1414 gui.palette_set/PALETTE:set: Set palette entry
1415 \end_layout
1417 \begin_layout Itemize
1418 Syntax: none gui.palette_set(PALETTE palette, number index, number color)
1419 \end_layout
1421 \begin_layout Itemize
1422 Syntax: none PALETTE:set(number index, number color)
1423 \end_layout
1425 \begin_layout Standard
1426 Sets color in palette.
1427  Parameters:
1428 \end_layout
1430 \begin_layout Itemize
1431 palette: The palette to manipulate
1432 \end_layout
1434 \begin_layout Itemize
1435 index: Index of color (0-65535).
1436 \end_layout
1438 \begin_layout Itemize
1439 color: The color value.
1440 \end_layout
1442 \begin_layout Subsection
1443 gui.bitmap_pset/(D)BITMAP:pset: Set pixel in bitmap
1444 \end_layout
1446 \begin_layout Itemize
1447 Syntax: none gui.bitmap_pset(BITMAP/DBITMAP bitmap, number x, number y, number
1448  color)
1449 \end_layout
1451 \begin_layout Itemize
1452 Syntax: none BITMAP:pset(number x, number y, number color)
1453 \end_layout
1455 \begin_layout Itemize
1456 Syntax: none DBITMAP:pset(number x, number y, number color)
1457 \end_layout
1459 \begin_layout Standard
1460 Sets specified pixel in bitmap.
1461  Parameters:
1462 \end_layout
1464 \begin_layout Itemize
1465 bitmap: The bitmap to manipulate
1466 \end_layout
1468 \begin_layout Itemize
1469 x: The x-coordinate of the pixel.
1470 \end_layout
1472 \begin_layout Itemize
1473 y: The y-coordinate of the pixel.
1474 \end_layout
1476 \begin_layout Itemize
1477 color: If bitmap is a bitmap, color index (0-65535).
1478  Otherwise color value.
1479 \end_layout
1481 \begin_layout Subsection
1482 gui.bitmap_pget/(D)BITMAP:pget: Get pixel in bitmap
1483 \end_layout
1485 \begin_layout Itemize
1486 Syntax: number gui.bitmap_pget(BITMAP/DBITMAP bitmap, number x, number y)
1487 \end_layout
1489 \begin_layout Itemize
1490 Syntax: number BITMAP:pget(number x, number y)
1491 \end_layout
1493 \begin_layout Itemize
1494 Syntax: number DBITMAP:pget(number x, number y)
1495 \end_layout
1497 \begin_layout Standard
1498 Gets specified pixel in bitmap.
1499  Parameters:
1500 \end_layout
1502 \begin_layout Itemize
1503 bitmap: The bitmap to query
1504 \end_layout
1506 \begin_layout Itemize
1507 x: The x-coordinate of the pixel.
1508 \end_layout
1510 \begin_layout Itemize
1511 y: The y-coordinate of the pixel.
1512 \end_layout
1514 \begin_layout Standard
1515 The bitmap color (color index if paletted, otherwise color value).
1516 \end_layout
1518 \begin_layout Subsection
1519 gui.bitmap_size/(D)BITMAP:size: Get size of bitmap
1520 \end_layout
1522 \begin_layout Itemize
1523 Syntax: (number, number) gui.bitmap_size(BITMAP/DBITMAP bitmap)
1524 \end_layout
1526 \begin_layout Itemize
1527 Syntax: (number, number) BITMAP:size()
1528 \end_layout
1530 \begin_layout Itemize
1531 Syntax: (number, number) DBITMAP:size()
1532 \end_layout
1534 \begin_layout Standard
1535 Get size of bitmap <bitmap>.
1536  The first return is the width, the second is the height.
1537 \end_layout
1539 \begin_layout Itemize
1540 Note: Can be used anywhere.
1541 \end_layout
1543 \begin_layout Subsection
1544 gui.bitmap_blit/(D)BITMAP:blit: Blit a bitmap into another
1545 \end_layout
1547 \begin_layout Itemize
1548 Syntax: none gui.bitmap_blit(BITMAP dest, number dx, number dy, BITMAP src,
1549  number sx, number sy, number w, number h[, number ck])
1550 \end_layout
1552 \begin_layout Itemize
1553 Syntax: none gui.bitmap_blit(DBITMAP dest, number dx, number dy, DBITMAP
1554  src, number sx, number sy, number w, number h[, number ck])
1555 \end_layout
1557 \begin_layout Itemize
1558 Syntax: none gui.bitmap_blit(DBITMAP dest, number dx, number dy, BITMAP src,
1559  PALETTE pal, number sx, number sy, number w, number h[, number ck])
1560 \end_layout
1562 \begin_layout Itemize
1563 Syntax: none BITMAP::blit(number dx, number dy, BITMAP src, number sx, number
1564  sy, number w, number h[, number ck])
1565 \end_layout
1567 \begin_layout Itemize
1568 Syntax: none DBITMAP::blit(number dx, number dy, DBITMAP src, number sx,
1569  number sy, number w, number h[, number ck])
1570 \end_layout
1572 \begin_layout Itemize
1573 Syntax: none DBITMAP:blit(number dx, number dy, BITMAP src, PALETTE pal,
1574  number sx, number sy, number w, number h[, number ck])
1575 \end_layout
1577 \begin_layout Standard
1578 Blit a part of bitmap to another (current object if any is destination).
1579  Parameters:
1580 \end_layout
1582 \begin_layout Itemize
1583 dest: Destination to blit to.
1584 \end_layout
1586 \begin_layout Itemize
1587 dx: left edge of target
1588 \end_layout
1590 \begin_layout Itemize
1591 dy: Top edge of target
1592 \end_layout
1594 \begin_layout Itemize
1595 src: The source to blit from.
1596 \end_layout
1598 \begin_layout Itemize
1599 pal: The palette to use in blit.
1600 \end_layout
1602 \begin_layout Itemize
1603 sx: left edge of source
1604 \end_layout
1606 \begin_layout Itemize
1607 sy: Top edge of source
1608 \end_layout
1610 \begin_layout Itemize
1611 w: Width of region
1612 \end_layout
1614 \begin_layout Itemize
1615 h: Height of region.
1616 \end_layout
1618 \begin_layout Itemize
1619 ck: Color key.
1620  Pixels of this color are not blitted.
1621 \end_layout
1623 \begin_deeper
1624 \begin_layout Itemize
1625 If soruce bitmap is bitmap, this is color index of colorkey.
1626  Values outside range 0-65535 cause no key to be used as colorkey.
1627 \end_layout
1629 \begin_layout Itemize
1630 If source bitmap is dbitmap, this is the color value of colorkey.
1631 \end_layout
1633 \begin_layout Itemize
1634 May be absent or nil for no colorkey blit.
1635 \end_layout
1637 \end_deeper
1638 \begin_layout Subsection
1639 gui.repaint: Arrange a repaint
1640 \end_layout
1642 \begin_layout Itemize
1643 Syntax: none gui.repaint()
1644 \end_layout
1646 \begin_layout Standard
1647 Request on_repaint() to happen as soon as possible.
1648 \end_layout
1650 \begin_layout Subsection
1651 gui.synchronous_repaint/RENDERQUEUE:synchronous_repaint: Paint screen now
1652 \end_layout
1654 \begin_layout Itemize
1655 Syntax: none gui.synchronous_repaint(RENDERQUEUE queue)
1656 \end_layout
1658 \begin_layout Itemize
1659 Syntax: none RENDERQUEUE::synchronous_repaint()
1660 \end_layout
1662 \begin_layout Standard
1663 Paints specified render queue on screen right there and then.
1664 \end_layout
1666 \begin_layout Subsection
1667 gui.subframe_update: Enable/Disable subframe updates
1668 \end_layout
1670 \begin_layout Itemize
1671 Syntax: none gui.subframe_update(boolean on)
1672 \end_layout
1674 \begin_layout Standard
1675 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
1676  or not happen (<on>=false).
1677 \end_layout
1679 \begin_layout Subsection
1680 gui.screenshot: Write a screenshot
1681 \end_layout
1683 \begin_layout Itemize
1684 Syntax: none gui.screenshot(string filename)
1685 \end_layout
1687 \begin_layout Standard
1688 Write PNG screenshot of the current frame (no drawings) to specified file
1689  <filename>.
1690 \end_layout
1692 \begin_layout Subsection
1693 gui.screenshot_bitmap: Write a screenshot to bitmap
1694 \end_layout
1696 \begin_layout Itemize
1697 Syntax: DBITMAP gui.screenshot_bitmap()
1698 \end_layout
1700 \begin_layout Standard
1701 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
1702  the result.
1703 \end_layout
1705 \begin_layout Subsection
1706 gui.color: Compose a color.
1707 \end_layout
1709 \begin_layout Itemize
1710 Syntax: number gui.color(number r, number g, number b[, number a])
1711 \end_layout
1713 \begin_layout Itemize
1714 Syntax: number gui.color(string c)
1715 \end_layout
1717 \begin_layout Standard
1718 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
1719 , each component in scale 0-255.
1720  If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
1721  fully opaque).
1722  The default alpha is 256.
1723 \end_layout
1725 \begin_layout Standard
1726 The form taking a string returns color corresponding color name.
1727 \end_layout
1729 \begin_layout Subsection
1730 gui.status: Set status variable
1731 \end_layout
1733 \begin_layout Itemize
1734 Syntax: none gui.status(string name, string value)
1735 \end_layout
1737 \begin_layout Standard
1738 Set status field 
1739 \begin_inset Quotes eld
1740 \end_inset
1742 L[<name>]
1743 \begin_inset Quotes erd
1744 \end_inset
1746  to <value> in status area.
1747 \end_layout
1749 \begin_layout Subsection
1750 gui.rainbow: Rainbow color calculation
1751 \end_layout
1753 \begin_layout Itemize
1754 Syntax: number gui.rainbow(number step, number steps[, number color])
1755 \end_layout
1757 \begin_layout Standard
1758 Perform hue rotation of color <color> (default bright red), by <step> steps.
1759  The number of steps per full rotation is given by absolute value of <steps>.
1760 \end_layout
1762 \begin_layout Standard
1763 If <step> is negative, the rotation will be counterclockwise.
1764 \end_layout
1766 \begin_layout Subsection
1767 gui.renderq_new: Create a render queue
1768 \end_layout
1770 \begin_layout Itemize
1771 Syntax: RENDERQUEUE gui.renderq_new(number width, number height)
1772 \end_layout
1774 \begin_layout Standard
1775 Create render queue with specified reported size and return it.
1776 \end_layout
1778 \begin_layout Subsection
1779 gui.renderq_clear/RENDERQUEUE:clear: Clear a render queue
1780 \end_layout
1782 \begin_layout Itemize
1783 Syntax: none gui.renderq_clear(RENDERQUEUE queue)
1784 \end_layout
1786 \begin_layout Itemize
1787 Syntax: none RENDERQUEUE:clear()
1788 \end_layout
1790 \begin_layout Standard
1791 Clear specified render queue.
1792 \end_layout
1794 \begin_layout Subsection
1795 gui.renderq_set/RENDERQUEUE:set: Change active render queue
1796 \end_layout
1798 \begin_layout Itemize
1799 Syntax: none gui.renderq_set(RENDERQUEUE queue)
1800 \end_layout
1802 \begin_layout Itemize
1803 Syntax: none RENDERQUEUE:set()
1804 \end_layout
1806 \begin_layout Standard
1807 Switch to specified render queue.
1808  Use nil as queue to switch to default queue.
1809 \end_layout
1811 \begin_layout Itemize
1812 Note: When switched to another queue, all drawing functions work and draw
1813  there, even outside on_video/on_paint.
1814 \end_layout
1816 \begin_layout Subsection
1817 gui.renderq_run/RENDERQUEUE:run: Run render queue
1818 \end_layout
1820 \begin_layout Itemize
1821 Syntax: none gui.renderq_run(RENDERQUEUE queue)
1822 \end_layout
1824 \begin_layout Itemize
1825 Syntax: none RENDERQUEUE:run()
1826 \end_layout
1828 \begin_layout Standard
1829 Run specified render queue, copying the objects to current render queue.
1831 \end_layout
1833 \begin_layout Itemize
1834 Warning: Don't try to run the current render queue.
1835 \end_layout
1837 \begin_layout Subsection
1838 RENDERQUEUE:render: Render a queue to DBITMAP
1839 \end_layout
1841 \begin_layout Itemize
1842 Syntax: DBITMAP RENDERQUEUE:render()
1843 \end_layout
1845 \begin_layout Standard
1846 Renders the specified render queue to a bitmap, the base bitmap size (modified
1847  by gaps) being the nominal screen size for render queue.
1848 \end_layout
1850 \begin_layout Subsection
1851 gui.loadfont: Load a font file
1852 \end_layout
1854 \begin_layout Itemize
1855 Syntax: CUSTOMFONT gui.loadfont([string filename])
1856 \end_layout
1858 \begin_layout Standard
1859 Loads font from specified file (CUSTOMFONT object).
1860  If filename is not given, loads the system default font.
1861 \end_layout
1863 \begin_layout Subsection
1864 CUSTOMFONT(): Render text to screen
1865 \end_layout
1867 \begin_layout Itemize
1868 Syntax: none CUSTOMFONT(number x, number y, string text[, number fgc[, number
1869  bgc[, number hlc]]])
1870 \end_layout
1872 \begin_layout Standard
1873 Draw string with custom font to screen.
1874  The parameters are the same as in gui.text, except <hlc> is the halo color
1875  (default is no halo).
1877 \end_layout
1879 \begin_layout Subsection
1880 gui.adjust_transparency/DBITMAP:adjust_transparency/PALETTE:adjust_transparency:
1881  Adjust transparency of DBITMAP or PALETTE
1882 \end_layout
1884 \begin_layout Itemize
1885 Syntax: none gui.adjust_transparency(DBITMAP obj, number adj)
1886 \end_layout
1888 \begin_layout Itemize
1889 Syntax: none gui.adjust_transparency(PALETTE obj, number adj)
1890 \end_layout
1892 \begin_layout Itemize
1893 Syntax: none DBITMAP:adjust_transparency(number adj)
1894 \end_layout
1896 \begin_layout Itemize
1897 Syntax: none PALETTE:adjust_transparency(number adj)
1898 \end_layout
1900 \begin_layout Standard
1901 Multiply alpha channel of <obj> by <adj>/256.
1902  Useful for making 
1903 \begin_inset Quotes eld
1904 \end_inset
1906 ghosts
1907 \begin_inset Quotes erd
1908 \end_inset
1910  out of solid bitmaps.
1911 \end_layout
1913 \begin_layout Subsection
1914 gui.kill_frame: Kill video frame and associated sound
1915 \end_layout
1917 \begin_layout Itemize
1918 Syntax: none gui.kill_frame()
1919 \end_layout
1921 \begin_layout Standard
1922 Kills the currently dumped video frame + the associated sound.
1923  Only valid in on_video callback.
1924 \end_layout
1926 \begin_layout Subsection
1927 gui.arrow: Draw an arrow
1928 \end_layout
1930 \begin_layout Itemize
1931 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
1932  number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
1934 \end_layout
1936 \begin_layout Standard
1937 Draws an arrow using color <color>.
1938  The tip of arrow is at (<x>, <y>).
1939  Other parameters:
1940 \end_layout
1942 \begin_layout Enumerate
1943 <length>: The length of arrow tail.
1944 \end_layout
1946 \begin_layout Enumerate
1947 <hwidth>: The width of arrow head.
1948  Should be odd.
1949 \end_layout
1951 \begin_layout Enumerate
1952 <direction>: Direction of arrow.
1953  0 is to right, +1 rotates 45 degrees counterclockwise.
1954 \end_layout
1956 \begin_layout Enumerate
1957 <fill>: If true, fill the arrow head.
1958  Default false.
1959 \end_layout
1961 \begin_layout Enumerate
1962 <twidth>: Tail width.
1963  Should be odd.
1964  Default 1.
1965 \end_layout
1967 \begin_layout Enumerate
1968 <hthick>: Head thickness (only used if <fill> is false).
1969  Default is <twidth>.
1970 \end_layout
1972 \begin_layout Subsection
1973 gui.tilemap: Create a tilemap
1974 \end_layout
1976 \begin_layout Itemize
1977 Syntax: TILEMAP gui.tilemap(number w, number h, number bw, number bh)
1978 \end_layout
1980 \begin_layout Standard
1981 Create a new tilemap of size <w>*<h>, with each cell being <bw>*<bh>.
1982 \end_layout
1984 \begin_layout Subsection
1985 TILEMAP:getsize: Query tilemap size
1986 \end_layout
1988 \begin_layout Itemize
1989 Syntax: number, number TILEMAP:getsize()
1990 \end_layout
1992 \begin_layout Standard
1993 Return size of tilemap (width first).
1994 \end_layout
1996 \begin_layout Subsection
1997 TILEMAP:getcsize: Query tilemap cell size
1998 \end_layout
2000 \begin_layout Itemize
2001 Syntax: number, number TILEMAP:getcsize()
2002 \end_layout
2004 \begin_layout Standard
2005 Return size of tilemap cell (width first).
2006 \end_layout
2008 \begin_layout Subsection
2009 TILEMAP:get: Query tilemap cell
2010 \end_layout
2012 \begin_layout Itemize
2013 Syntax: none TILEMAP:get(number x, number y)
2014 \end_layout
2016 \begin_layout Itemize
2017 Syntax: dbitmap TILEMAP:get(number x, number y)
2018 \end_layout
2020 \begin_layout Itemize
2021 Syntax: bitmap,palette TILEMAP:get(number x, number y)
2022 \end_layout
2024 \begin_layout Standard
2025 Return contents of cell at <x>,<y>.
2026 \end_layout
2028 \begin_layout Subsection
2029 TILEMAP:set: Set tilemap cell
2030 \end_layout
2032 \begin_layout Itemize
2033 Syntax: none TILEMAP:set(number x, number y)
2034 \end_layout
2036 \begin_layout Itemize
2037 Syntax: none TILEMAP:set(number x, number y, dbitmap b)
2038 \end_layout
2040 \begin_layout Itemize
2041 Syntax: none TILEMAP:set(number x, number y, bitmap b, palette p)
2042 \end_layout
2044 \begin_layout Standard
2045 Set contents of cell at <x>,<y>.
2046  If no bitmap/dbitmap is given, cell is cleared.
2047  Otherwise specified (d)bitmap is used (with specified palette if bitmap).
2048 \end_layout
2050 \begin_layout Subsection
2051 TILEMAP:scroll: Scroll tilemap
2052 \end_layout
2054 \begin_layout Itemize
2055 Syntax: none TILEMAP:scroll(number ox, number oy)
2056 \end_layout
2058 \begin_layout Itemize
2059 Syntax: none TILEMAP:scroll(number ox, number oy, number x, number y, number
2060  w, number h)
2061 \end_layout
2063 \begin_layout Itemize
2064 Syntax: none TILEMAP:scroll(number ox, number oy, number x, number y, number
2065  w, number h, boolean circx, boolean circy)
2066 \end_layout
2068 \begin_layout Standard
2069 Scrolls the tilemap tiles by <ox>,<oy>.
2070  If <x>,<y>,<w>,<h> is specified, the scrolling is limited to <w>*<h> window
2071  starting at <x>,<y> (in tiles).
2072 \end_layout
2074 \begin_layout Standard
2075 If <circx> is true, the window is circular in horizontal direction.
2076  Similarly with <circy> and vertical direciton.
2077 \end_layout
2079 \begin_layout Subsection
2080 TILEMAP:draw: Draw tilemap
2081 \end_layout
2083 \begin_layout Itemize
2084 Syntax: none TILEMAP:draw(number x, number y)
2085 \end_layout
2087 \begin_layout Itemize
2088 Syntax: none TILEMAP:draw(number x, number y, number x0, number y0)
2089 \end_layout
2091 \begin_layout Itemize
2092 Syntax: none TILEMAP:draw(number x, number y, number x0, number y0, number
2093  w, number h)
2094 \end_layout
2096 \begin_layout Standard
2097 Draw tilemap at <x>,<y>.
2098  If <x0>,<y0> is given, that is tilemap coordinate (in pixels) of upper
2099  left edge.
2100  If <w>,<h> is given, that is the size of window to draw (in pixels)
2101 \end_layout
2103 \begin_layout Subsection
2104 gui.bitmap_save_png/(D)BITMAP:save_png: Save a bitmap to PNG
2105 \end_layout
2107 \begin_layout Itemize
2108 Syntax: none gui.bitmap_save_png(string filename[, string base], BITMAP bmp,
2109  PALETTE pal)
2110 \end_layout
2112 \begin_layout Itemize
2113 Syntax: none gui.bitmap_save_png(string filename[, string base], DBITMAP
2114  bmp)
2115 \end_layout
2117 \begin_layout Itemize
2118 Syntax: string gui.bitmap_save_png(BITMAP bmp, PALETTE pal)
2119 \end_layout
2121 \begin_layout Itemize
2122 Syntax: string gui.bitmap_save_png(DBITMAP bmp)
2123 \end_layout
2125 \begin_layout Itemize
2126 Syntax: none BITMAP:save_png(string filename[, string base], PALETTE pal)
2127 \end_layout
2129 \begin_layout Itemize
2130 Syntax: none DBITMAP:save_png(string filename[, string base])
2131 \end_layout
2133 \begin_layout Itemize
2134 Syntax: string BITMAP:save_png(PALETTE pal)
2135 \end_layout
2137 \begin_layout Itemize
2138 Syntax: string DBITMAP:save_png()
2139 \end_layout
2141 \begin_layout Standard
2142 Save specified bitmap <bmp> (or current object), with palette <pal> (only
2143  if paletted) into PNG file <filename> (relative to <base>) or return BASE64
2144  encoding as return value.
2145 \end_layout
2147 \begin_layout Subsection
2148 gui.bitmap_hash/(D)BITMAP:hash: Hash a bitmap
2149 \end_layout
2151 \begin_layout Itemize
2152 Syntax: string gui.bitmap_hash(BITMAP bmp)
2153 \end_layout
2155 \begin_layout Itemize
2156 Syntax: string gui.bitmap_hash(DBITMAP bmp)
2157 \end_layout
2159 \begin_layout Itemize
2160 Syntax: string BITMAP:hash()
2161 \end_layout
2163 \begin_layout Itemize
2164 Syntax: string DBITMAP:hash()
2165 \end_layout
2167 \begin_layout Standard
2168 Hashes bitmap <bmp> (or current object) and returns 64-hex digit crypto-strong
2169  hash.
2170  Identical bitmaps result in indentical hashes (but color order in indexed
2171  bitmaps is significant).
2172 \end_layout
2174 \begin_layout Subsection
2175 gui.palette_hash/PALETTE:hash: Hash a palette
2176 \end_layout
2178 \begin_layout Itemize
2179 Syntax: string gui.palette_hash(PALETTE pal)
2180 \end_layout
2182 \begin_layout Itemize
2183 Syntax: string PALETTE:hash(PALETTE pal)
2184 \end_layout
2186 \begin_layout Standard
2187 Hashes palette <pal> (or current object) and retruns 64-hex digit crypto-strong
2188  hash.
2189  Identical palettes result in identical hashes (fully transparent colors
2190  at end of palette don't affect the hash).
2191 \end_layout
2193 \begin_layout Standard
2194 \begin_inset Newpage pagebreak
2195 \end_inset
2198 \end_layout
2200 \begin_layout Section
2201 table input
2202 \end_layout
2204 \begin_layout Standard
2205 Input handling.
2206  Functions manipulating input are only available in on_input callback.
2207 \end_layout
2209 \begin_layout Subsection
2210 input.get: Read controller button/axis (deprecated)
2211 \end_layout
2213 \begin_layout Itemize
2214 Syntax: number input.get(number controller, number index)
2215 \end_layout
2217 \begin_layout Standard
2218 Read the specified index <index> (zero-based) from specified controller
2219  <controller> (zero-based).
2221 \end_layout
2223 \begin_layout Subsection
2224 input.set: Write controller button/axis (deprecated)
2225 \end_layout
2227 \begin_layout Itemize
2228 Syntax: none input.set(number controller, number index, number value)
2229 \end_layout
2231 \begin_layout Standard
2232 Write the specified index <index> (zero-based) from specified controller
2233  <controller> (zero-based), storing value <value>.
2234 \end_layout
2236 \begin_layout Subsection
2237 input.get2: Read controller button/axis
2238 \end_layout
2240 \begin_layout Itemize
2241 Syntax: number input.get2(number port, number controller, number index)
2242 \end_layout
2244 \begin_layout Standard
2245 Read the specified input tuple.
2246  Port 0 is system port.
2247 \end_layout
2249 \begin_layout Subsection
2250 input.set2: Write controller button/axis
2251 \end_layout
2253 \begin_layout Itemize
2254 Syntax: input.set2(number port, number controller, number index, number value)
2255 \end_layout
2257 \begin_layout Standard
2258 Write the specified input tuple.
2259  Port 0 is system port.
2260 \end_layout
2262 \begin_layout Subsection
2263 input.lcid_to_pcid2: Look up logical controller
2264 \end_layout
2266 \begin_layout Itemize
2267 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
2268 \end_layout
2270 \begin_layout Standard
2271 Look up physical pcid pair (port, controller) corresponding to specified
2272  logical controller (1-based).
2273  Returns nothing if controller does not exist.
2274 \end_layout
2276 \begin_layout Subsection
2277 input.port_type: Look up port type
2278 \end_layout
2280 \begin_layout Itemize
2281 Syntax: string input.port_type(number port)
2282 \end_layout
2284 \begin_layout Standard
2285 Return type of specified port.
2286 \end_layout
2288 \begin_layout Subsection
2289 input.controller_info: Get information about controller
2290 \end_layout
2292 \begin_layout Itemize
2293 Syntax: table input.controller_info(number port, number controller)
2294 \end_layout
2296 \begin_layout Standard
2297 Get controller info for specified controller.
2298  If controller does not exist, returns nil.
2299  Otherwise returns a table with following fields:
2300 \end_layout
2302 \begin_layout Itemize
2303 type (string): Type of the controller.
2304 \end_layout
2306 \begin_layout Itemize
2307 class (string): Class of the controller.
2308 \end_layout
2310 \begin_layout Itemize
2311 classnum (number): Number of the controller within its class (1-based)
2312 \end_layout
2314 \begin_layout Itemize
2315 lcid (number): Logical controller number of the controller.
2316 \end_layout
2318 \begin_layout Itemize
2319 button_count (number): Number of buttons on controller
2320 \end_layout
2322 \begin_layout Itemize
2323 buttons (array): Array of following info about each button:
2324 \end_layout
2326 \begin_deeper
2327 \begin_layout Itemize
2328 type (string): Type of button.
2329  Currently one of 
2330 \begin_inset Quotes eld
2331 \end_inset
2333 null
2334 \begin_inset Quotes erd
2335 \end_inset
2338 \begin_inset Quotes eld
2339 \end_inset
2341 button
2342 \begin_inset Quotes erd
2343 \end_inset
2346 \begin_inset Quotes eld
2347 \end_inset
2349 axis
2350 \begin_inset Quotes erd
2351 \end_inset
2354 \begin_inset Quotes eld
2355 \end_inset
2357 raxis
2358 \begin_inset Quotes erd
2359 \end_inset
2362 \end_layout
2364 \begin_layout Itemize
2365 name (string): Name of button.
2366 \end_layout
2368 \begin_layout Itemize
2369 symbol (string): Symbol of button.
2370  Only present for type 
2371 \begin_inset Quotes eld
2372 \end_inset
2374 button
2375 \begin_inset Quotes erd
2376 \end_inset
2379 \end_layout
2381 \begin_layout Itemize
2382 hidden (boolean): True if hidden button.
2384 \end_layout
2386 \end_deeper
2387 \begin_layout Subsection
2388 input.veto_button: Veto a button press
2389 \end_layout
2391 \begin_layout Itemize
2392 Syntax: none input.veto_button()
2393 \end_layout
2395 \begin_layout Standard
2396 Signals that the button event should be vetoed.
2397  Only valid in on_button callback.
2398 \end_layout
2400 \begin_layout Subsection
2401 input.geta: Get all buttons for controller (deprecated)
2402 \end_layout
2404 \begin_layout Itemize
2405 Syntax: (number, number...) input.geta(number controller)
2406 \end_layout
2408 \begin_layout Standard
2409 Get input state for entiere controller.
2410  Returns n return values.
2411 \end_layout
2413 \begin_layout Itemize
2414 1st return value: Bitmask: bit i is set if i:th index is nonzero
2415 \end_layout
2417 \begin_layout Itemize
2418 2nd- return value: value of i:th index.
2419 \end_layout
2421 \begin_layout Subsection
2422 input.seta: Set all buttons for controller (deprecated)
2423 \end_layout
2425 \begin_layout Itemize
2426 Syntax: none input.seta(number controller, number bitmask, number args...)
2427 \end_layout
2429 \begin_layout Standard
2430 Set state for entiere controller.
2431  args is up to N values for indices (overriding values in bitmask if specified).
2432 \end_layout
2434 \begin_layout Subsection
2435 input.controllertype: Get controller type (deprecated)
2436 \end_layout
2438 \begin_layout Itemize
2439 syntax: string input.controllertype(number controller)
2440 \end_layout
2442 \begin_layout Standard
2443 Get the type of controller as string.
2444 \end_layout
2446 \begin_layout Subsection
2447 input.reset: Execute (delayed) reset
2448 \end_layout
2450 \begin_layout Itemize
2451 Syntax: none input.reset([number cycles])
2452 \end_layout
2454 \begin_layout Standard
2455 Execute reset.
2456  If <cycles> is greater than zero, do delayed reset.
2457  0 (or no value) causes immediate reset.
2458 \end_layout
2460 \begin_layout Itemize
2461 Note: Only available with subframe flag false.
2462 \end_layout
2464 \begin_layout Subsection
2465 input.raw: Return raw input data
2466 \end_layout
2468 \begin_layout Itemize
2469 Syntax: table input.raw()
2470 \end_layout
2472 \begin_layout Standard
2473 Returns table of tables of all available keys and axes.
2474  The first table is indexed by key name (platform-dependent!), and the inner
2475  table has the following fields:
2476 \end_layout
2478 \begin_layout Itemize
2479 value: Last reported value for control
2480 \end_layout
2482 \begin_deeper
2483 \begin_layout Itemize
2484 For keys: 1 for pressed, 0 for released.
2485 \end_layout
2487 \begin_layout Itemize
2488 For axes: -32767...32767.
2489 \end_layout
2491 \begin_layout Itemize
2492 For presure-sensitive buttons: 0...32767.
2493 \end_layout
2495 \begin_layout Itemize
2496 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
2497 \end_layout
2499 \begin_layout Itemize
2500 For mouse: Coordinates relative to game area.
2501 \end_layout
2503 \end_deeper
2504 \begin_layout Itemize
2505 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
2506 \end_layout
2508 \begin_layout Subsection
2509 input.keyhook: Hook a key
2510 \end_layout
2512 \begin_layout Itemize
2513 Syntax: none input.keyhook(string key, boolean state)
2514 \end_layout
2516 \begin_layout Standard
2517 Requests that keyhook events to be sent for key <key> (<state>=true) or
2518  not sent (<state>=false).
2519 \end_layout
2521 \begin_layout Subsection
2522 input.joyget: Get controls for controller
2523 \end_layout
2525 \begin_layout Itemize
2526 Syntax: table input.joyget(number logical)
2527 \end_layout
2529 \begin_layout Standard
2530 Returns table for current controls for specified logical controller <logical>.
2531  The names of fields vary by controller type.
2532 \end_layout
2534 \begin_layout Itemize
2535 The buttons have the same name as those are referred to in other contexts
2536  in the emulator
2537 \end_layout
2539 \begin_layout Itemize
2540 The analog axes are usually 
2541 \begin_inset Quotes eld
2542 \end_inset
2544 xaxis
2545 \begin_inset Quotes erd
2546 \end_inset
2548  and 
2549 \begin_inset Quotes eld
2550 \end_inset
2552 yaxis
2553 \begin_inset Quotes erd
2554 \end_inset
2557 \end_layout
2559 \begin_layout Itemize
2560 Each field is numeric or boolean depending on axis/button.
2561 \end_layout
2563 \begin_layout Subsection
2564 input.joyset: Set controls for controller
2565 \end_layout
2567 \begin_layout Itemize
2568 Syntax: none input.joyset(number controller, table controls)
2569 \end_layout
2571 \begin_layout Standard
2572 Set the the state of specified controller to values specified in specified
2573  table.
2574 \end_layout
2576 \begin_layout Itemize
2577 Each field can be boolean or number.
2578 \end_layout
2580 \begin_layout Itemize
2581 Also, buttons allow strings, which cause value to be inverted.
2582 \end_layout
2584 \begin_layout Subsection
2585 input.lcid_to_pcid: Look up logical controller (deprecated)
2586 \end_layout
2588 \begin_layout Itemize
2589 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
2590 \end_layout
2592 \begin_layout Standard
2593 Returns the legacy pcid for controller (or false if there isn't one), followed
2594  by pcid pair.
2595  Returns nothing if controller does not exist.
2596 \end_layout
2598 \begin_layout Standard
2599 \begin_inset Newpage pagebreak
2600 \end_inset
2603 \end_layout
2605 \begin_layout Section
2606 Table keyboard
2607 \end_layout
2609 \begin_layout Standard
2610 Various keybinding-related functions
2611 \end_layout
2613 \begin_layout Subsection
2614 keyboard.bind: Bind a key
2615 \end_layout
2617 \begin_layout Itemize
2618 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
2619 \end_layout
2621 \begin_layout Standard
2622 Bind specified key with specified modifers to specified command.
2623 \end_layout
2625 \begin_layout Subsection
2626 keyboard.unbind: Unbind a key
2627 \end_layout
2629 \begin_layout Itemize
2630 Syntax: none keyboard.unbind(string mod, string mask, string key)
2631 \end_layout
2633 \begin_layout Standard
2634 Unbind specified key with specified modifers.
2635 \end_layout
2637 \begin_layout Subsection
2638 keyboard.alias: Set alias expansion
2639 \end_layout
2641 \begin_layout Itemize
2642 Syntax: none keyboard.alias(string alias, string expansion)
2643 \end_layout
2645 \begin_layout Standard
2646 Set expansion of given command.
2647 \end_layout
2649 \begin_layout Standard
2650 \begin_inset Newpage pagebreak
2651 \end_inset
2654 \end_layout
2656 \begin_layout Section
2657 Table subtitle
2658 \end_layout
2660 \begin_layout Standard
2661 Subtitle handling
2662 \end_layout
2664 \begin_layout Subsection
2665 subtitle.byindex: Look up start and length of subtitle by index
2666 \end_layout
2668 \begin_layout Itemize
2669 Syntax: (number, number) subtitle.byindex(number i)
2670 \end_layout
2672 \begin_layout Standard
2673 Read the frame and length of ith subtitle.
2674  Returns nothing if not present.
2675 \end_layout
2677 \begin_layout Subsection
2678 subtitle.set: Write a subtitle
2679 \end_layout
2681 \begin_layout Itemize
2682 Syntax: none subtitle.set(number f, number l, string txt)
2683 \end_layout
2685 \begin_layout Standard
2686 Set the text of subtitle.
2687 \end_layout
2689 \begin_layout Subsection
2690 subtitle.get: Read a subtitle
2691 \end_layout
2693 \begin_layout Itemize
2694 Syntax: string subtitle.get(number f, number l)
2695 \end_layout
2697 \begin_layout Standard
2698 Get the text of subtitle.
2699 \end_layout
2701 \begin_layout Subsection
2702 subtitle.delete: Delete a subtitle
2703 \end_layout
2705 \begin_layout Itemize
2706 Syntax: nonesubtitle.delete(number f, number l)
2707 \end_layout
2709 \begin_layout Standard
2710 Delete specified subtitle.
2711 \end_layout
2713 \begin_layout Standard
2714 \begin_inset Newpage pagebreak
2715 \end_inset
2718 \end_layout
2720 \begin_layout Section
2721 Table hostmemory
2722 \end_layout
2724 \begin_layout Standard
2725 Host memory handling (extra memory saved to savestates).
2726  Host memory starts empty.
2727 \end_layout
2729 \begin_layout Itemize
2730 Reads out of range return false.
2731 \end_layout
2733 \begin_layout Itemize
2734 Writes out of range extend the memory.
2735 \end_layout
2737 \begin_layout Subsection
2738 hostmemory.read: Read byte from host memory
2739 \end_layout
2741 \begin_layout Itemize
2742 Syntax: number hostmemory.read(number address)
2743 \end_layout
2745 \begin_layout Standard
2746 Reads byte from hostmemory slot address <address>.
2747 \end_layout
2749 \begin_layout Subsection
2750 hostmemory.write: Write byte to host memory
2751 \end_layout
2753 \begin_layout Itemize
2754 Syntax: none hostmemory.write(number address, number value)
2755 \end_layout
2757 \begin_layout Standard
2758 Writes hostmemory slot with value <value> 0-255.
2759 \end_layout
2761 \begin_layout Subsection
2762 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
2763 \end_layout
2765 \begin_layout Itemize
2766 Syntax: number hostmemory.readbyte(number address)
2767 \end_layout
2769 \begin_layout Itemize
2770 Syntax: number hostmemory.readsbyte(number address)
2771 \end_layout
2773 \begin_layout Itemize
2774 Syntax: number hostmemory.readword(number address)
2775 \end_layout
2777 \begin_layout Itemize
2778 Syntax: number hostmemory.readsword(number address)
2779 \end_layout
2781 \begin_layout Itemize
2782 Syntax: number hostmemory.readhword(number address)
2783 \end_layout
2785 \begin_layout Itemize
2786 Syntax: number hostmemory.readshword(number address)
2787 \end_layout
2789 \begin_layout Itemize
2790 Syntax: number hostmemory.readdword(number address)
2791 \end_layout
2793 \begin_layout Itemize
2794 Syntax: number hostmemory.readsdword(number address)
2795 \end_layout
2797 \begin_layout Itemize
2798 Syntax: number hostmemory.readqword(number address)
2799 \end_layout
2801 \begin_layout Itemize
2802 Syntax: number hostmemory.readsqword(number address)
2803 \end_layout
2805 \begin_layout Standard
2806 Read elements (big-endian) from given address <address>.
2807 \end_layout
2809 \begin_layout Itemize
2810 byte is 1 element
2811 \end_layout
2813 \begin_layout Itemize
2814 word is 2 elements
2815 \end_layout
2817 \begin_layout Itemize
2818 hword is 3 elements
2819 \end_layout
2821 \begin_layout Itemize
2822 dword is 4 elements
2823 \end_layout
2825 \begin_layout Itemize
2826 qword is 8 elements.
2827 \end_layout
2829 \begin_layout Itemize
2830 The 's' variants do signed read.
2831 \end_layout
2833 \begin_layout Subsection
2834 hostmemory.read{float,double}: Read from host memory
2835 \end_layout
2837 \begin_layout Itemize
2838 syntax: number hostmemory.readfloat(number address)
2839 \end_layout
2841 \begin_layout Itemize
2842 Syntax: number hostmemory.readdouble(number address)
2843 \end_layout
2845 \begin_layout Standard
2846 Read elements (big-endian) floating-pont from given address <address>.
2847 \end_layout
2849 \begin_layout Subsection
2850 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
2851 \end_layout
2853 \begin_layout Itemize
2854 Syntax: number hostmemory.writebyte(number address, number value)
2855 \end_layout
2857 \begin_layout Itemize
2858 Syntax: number hostmemory.writesbyte(number address, number value)
2859 \end_layout
2861 \begin_layout Itemize
2862 Syntax: number hostmemory.writeword(number address, number value)
2863 \end_layout
2865 \begin_layout Itemize
2866 Syntax: number hostmemory.writesword(number address, number value)
2867 \end_layout
2869 \begin_layout Itemize
2870 Syntax: number hostmemory.writehword(number address, number value)
2871 \end_layout
2873 \begin_layout Itemize
2874 Syntax: number hostmemory.writeshword(number address, number value)
2875 \end_layout
2877 \begin_layout Itemize
2878 Syntax: number hostmemory.writedword(number address, number value)
2879 \end_layout
2881 \begin_layout Itemize
2882 Syntax: number hostmemory.writesdword(number address, number value)
2883 \end_layout
2885 \begin_layout Itemize
2886 Syntax: number hostmemory.writeqword(number address, number value)
2887 \end_layout
2889 \begin_layout Itemize
2890 Syntax: number hostmemory.writesqword(number address, number value)
2891 \end_layout
2893 \begin_layout Standard
2894 Write value <value> to elements (little-endian) starting from given address
2895  <address>.
2896 \end_layout
2898 \begin_layout Itemize
2899 byte is 1 element
2900 \end_layout
2902 \begin_layout Itemize
2903 word is 2 elements
2904 \end_layout
2906 \begin_layout Itemize
2907 hword is 3 elements
2908 \end_layout
2910 \begin_layout Itemize
2911 dword is 4 elements
2912 \end_layout
2914 \begin_layout Itemize
2915 qword is 8 elements.
2916 \end_layout
2918 \begin_layout Itemize
2919 The 's' variants do signed write.
2920 \end_layout
2922 \begin_layout Subsection
2923 hostmemory.write{float,double}: Write to host memory
2924 \end_layout
2926 \begin_layout Itemize
2927 syntax: none hostmemory.readfloat(number address, number value)
2928 \end_layout
2930 \begin_layout Itemize
2931 Syntax: none hostmemory.readdouble(number address, number value)
2932 \end_layout
2934 \begin_layout Standard
2935 Write elements (big-endian) floating-pont to given address <address>, storing
2936  <value>.
2937 \end_layout
2939 \begin_layout Standard
2940 \begin_inset Newpage pagebreak
2941 \end_inset
2944 \end_layout
2946 \begin_layout Section
2947 Table movie
2948 \end_layout
2950 \begin_layout Standard
2951 Movie handling
2952 \end_layout
2954 \begin_layout Subsection
2955 movie.currentframe: Get current frame number
2956 \end_layout
2958 \begin_layout Itemize
2959 Syntax: number movie.currentframe()
2960 \end_layout
2962 \begin_layout Standard
2963 Return number of current frame.
2964 \end_layout
2966 \begin_layout Subsection
2967 movie.framecount: Get move frame count
2968 \end_layout
2970 \begin_layout Itemize
2971 Syntax: number movie.framecount()
2972 \end_layout
2974 \begin_layout Standard
2975 Return number of frames in movie.
2976 \end_layout
2978 \begin_layout Subsection
2979 movie.readonly: Is in readonly mode?
2980 \end_layout
2982 \begin_layout Itemize
2983 Syntax: boolean movie.readonly()
2984 \end_layout
2986 \begin_layout Standard
2987 Return true if in readonly mode, false if in readwrite.
2988 \end_layout
2990 \begin_layout Subsection
2991 movie.rerecords: Movie rerecord count
2992 \end_layout
2994 \begin_layout Itemize
2995 Syntax: number movie.rerecords()
2996 \end_layout
2998 \begin_layout Standard
2999 Returns the current value of rerecord count.
3000 \end_layout
3002 \begin_layout Subsection
3003 movie.set_readwrite: Set read-write mode.
3004 \end_layout
3006 \begin_layout Itemize
3007 Syntax: none movie.set_readwrite()
3008 \end_layout
3010 \begin_layout Standard
3011 Set readwrite mode (does not cause on_readwrite callback).
3012 \end_layout
3014 \begin_layout Subsection
3015 movie.frame_subframes: Count subframes in frame
3016 \end_layout
3018 \begin_layout Itemize
3019 Syntax: number movie.frame_subframes(number frame)
3020 \end_layout
3022 \begin_layout Standard
3023 Count number of subframes in specified frame <frame> (frame numbers are
3024  1-based) and return that.
3025 \end_layout
3027 \begin_layout Subsection
3028 movie.read_subframes: Read subframe data (deprecated)
3029 \end_layout
3031 \begin_layout Itemize
3032 Syntax: table movie.read_subframes(number frame, number subframe)
3033 \end_layout
3035 \begin_layout Standard
3036 Read specifed subframe in specified frame and return data as array.
3037 \end_layout
3039 \begin_layout Subsection
3040 movie.read_rtc: Read current RTC time
3041 \end_layout
3043 \begin_layout Itemize
3044 Syntax: (number, number) movie.read_rtc()
3045 \end_layout
3047 \begin_layout Standard
3048 Returns the current value of the RTC as a pair (second, subsecond).
3049 \end_layout
3051 \begin_layout Subsection
3052 movie.unsafe_rewind: Fast movie rewind to saved state
3053 \end_layout
3055 \begin_layout Itemize
3056 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
3057 \end_layout
3059 \begin_layout Standard
3060 Start setting point for unsafe rewind or jump to point of unsafe rewind.
3061 \end_layout
3063 \begin_layout Itemize
3064 If called without argument, causes emulator to start process of setting
3065  unsafe rewind point.
3066  When this has finished, callback on_set_rewind occurs, passing the rewind
3067  state to lua script.
3068 \end_layout
3070 \begin_layout Itemize
3071 If called with argument, causes emulator rewind to passed rewind point as
3072  soon as possible.
3073  Readwrite mode is implicitly activated.
3074 \end_layout
3076 \begin_layout Standard
3077 The following warnings apply to unsafe rewinding:
3078 \end_layout
3080 \begin_layout Itemize
3081 There are no safety checks against misuse (that's what 
3082 \begin_inset Quotes eld
3083 \end_inset
3085 unsafe
3086 \begin_inset Quotes erd
3087 \end_inset
3089  comes from)!
3090 \end_layout
3092 \begin_layout Itemize
3093 Only call rewind from timeline rewind point was set from.
3094 \end_layout
3096 \begin_layout Itemize
3097 Only call rewind from after the rewind point was set.
3098 \end_layout
3100 \begin_layout Subsection
3101 movie.to_rewind: Load savestate as rewind point
3102 \end_layout
3104 \begin_layout Itemize
3105 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
3106 \end_layout
3108 \begin_layout Standard
3109 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
3110  corresponding to it.
3111 \end_layout
3113 \begin_layout Itemize
3114 Note: This operation does not take emulated time.
3115 \end_layout
3117 \begin_layout Subsection
3118 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
3119 \end_layout
3121 \begin_layout Itemize
3122 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE movie])
3123 \end_layout
3125 \begin_layout Itemize
3126 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
3127 \end_layout
3129 \begin_layout Standard
3130 Copies specified movie <movie>/current object (if none or nil, the active
3131  movie) as new movie object.
3132 \end_layout
3134 \begin_layout Subsection
3135 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
3136 \end_layout
3138 \begin_layout Itemize
3139 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE movie,] number frame)
3140 \end_layout
3142 \begin_layout Itemize
3143 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
3144 \end_layout
3146 \begin_layout Standard
3147 Get INPUTFRAME object corresponding to specified frame in specified movie.
3148 \end_layout
3150 \begin_layout Subsection
3151 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
3152 \end_layout
3154 \begin_layout Itemize
3155 Syntax: none movie.set_frame([INPUTMOVIE movie,] number frame, INPUTFRAME
3156  data)
3157 \end_layout
3159 \begin_layout Itemize
3160 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
3161 \end_layout
3163 \begin_layout Standard
3164 Set data in specified frame.
3165 \end_layout
3167 \begin_layout Itemize
3168 Note: Past can't be edited in active movie.
3169 \end_layout
3171 \begin_layout Subsection
3172 movie.get_size/INPUTMOVIE::get_size: Get size of movie
3173 \end_layout
3175 \begin_layout Itemize
3176 Syntax: integer movie.get_size([INPUTMOVIE movie])
3177 \end_layout
3179 \begin_layout Itemize
3180 Syntax: integer INPUTMOVIE::get_size()
3181 \end_layout
3183 \begin_layout Standard
3184 Return number of subframes in specified movie.
3185 \end_layout
3187 \begin_layout Subsection
3188 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
3189 \end_layout
3191 \begin_layout Itemize
3192 Syntax: number movie.count_frames([INPUTMOVIE movie])
3193 \end_layout
3195 \begin_layout Itemize
3196 Syntax: number INPUTMOVIE::count_frames()
3197 \end_layout
3199 \begin_layout Standard
3200 Return number of frames in movie.
3201 \end_layout
3203 \begin_layout Subsection
3204 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
3205 \end_layout
3207 \begin_layout Itemize
3208 Syntax: number movie.find_frame([INPUTMOVIE movie], number frame)
3209 \end_layout
3211 \begin_layout Itemize
3212 Syntax: number INPUTMOVIE::find_frame(number frame)
3213 \end_layout
3215 \begin_layout Standard
3216 Returns starting subframe of given frame (frame numbers are 1-based).
3217  Returns -1 if frame number is bad.
3218 \end_layout
3220 \begin_layout Subsection
3221 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
3222 \end_layout
3224 \begin_layout Itemize
3225 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE movie])
3226 \end_layout
3228 \begin_layout Itemize
3229 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
3230 \end_layout
3232 \begin_layout Standard
3233 Return blank INPUTFRAME with frame type from specified movie.
3234 \end_layout
3236 \begin_layout Subsection
3237 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
3238 \end_layout
3240 \begin_layout Itemize
3241 Syntax: none movie.append_frames([INPUTMOVIE movie,] number frames)
3242 \end_layout
3244 \begin_layout Itemize
3245 Syntax: none INPUTMOVIE::append_frames(number frames)
3246 \end_layout
3248 \begin_layout Standard
3249 Append specified number <frames> of frames.
3250 \end_layout
3252 \begin_layout Subsection
3253 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
3254 \end_layout
3256 \begin_layout Itemize
3257 Syntax: none movie.append_frame([INPUTMOVIE movie,] INPUTFRAME frame)
3258 \end_layout
3260 \begin_layout Itemize
3261 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
3262 \end_layout
3264 \begin_layout Standard
3265 Append specified frame <frame>.
3266  Past of current movie can't be edited.
3267 \end_layout
3269 \begin_layout Subsection
3270 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
3271 \end_layout
3273 \begin_layout Itemize
3274 Syntax: none movie.truncate([INPUTMOVIE movie,] number frames)
3275 \end_layout
3277 \begin_layout Itemize
3278 Syntax: none INPUTMOVIE::truncate(number frames)
3279 \end_layout
3281 \begin_layout Standard
3282 Truncate the specified movie to specified number of frames.
3283 \end_layout
3285 \begin_layout Subsection
3286 movie.edit/INPUTMOVIE::edit: Edit a movie
3287 \end_layout
3289 \begin_layout Itemize
3290 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
3291  controller, number control, number/bool value)
3292 \end_layout
3294 \begin_layout Itemize
3295 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
3296  number control, number/bool value)
3297 \end_layout
3299 \begin_layout Standard
3300 Change specified control in specified frame in specified movie.
3301  Past can't be edited in active movie.
3302 \end_layout
3304 \begin_layout Subsection
3305 movie.copy_frames2: Copy frames between movies
3306 \end_layout
3308 \begin_layout Itemize
3309 Syntax: none movie.copy_frames2([INPUTMOVIE dstmov,] number dst, [INPUTMOVIE
3310  srcmov,] number src, number count)
3311 \end_layout
3313 \begin_layout Standard
3314 Copy specified number of frames between two movies.
3315  The copy proceeeds in forward direction.
3316 \end_layout
3318 \begin_layout Subsection
3319 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
3320 \end_layout
3322 \begin_layout Itemize
3323 Syntax: none movie.copy_frames([INPUTMOVIE mov,] number dst, number src,
3324  number count, bool backwards)
3325 \end_layout
3327 \begin_layout Itemize
3328 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
3329  bool backwards)
3330 \end_layout
3332 \begin_layout Standard
3333 Copy specified number of frames from one point in movie to another.
3334  If backwards is true, the copy will be done backwards.
3335 \end_layout
3337 \begin_layout Subsection
3338 movie.serialize/INPUTMOVIE::serialize: Serialize movie
3339 \end_layout
3341 \begin_layout Itemize
3342 Syntax: none movie.serialize([INPUTMOVIE movie,] string filename, bool binary)
3343 \end_layout
3345 \begin_layout Itemize
3346 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
3347 \end_layout
3349 \begin_layout Standard
3350 Serialize given movie into file.
3351  If binary is true, binary format (more compact and much faster) is used.
3352 \end_layout
3354 \begin_layout Subsection
3355 movie.unserialize: Unserialize movie
3356 \end_layout
3358 \begin_layout Itemize
3359 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
3360  bool binary)
3361 \end_layout
3363 \begin_layout Standard
3364 Unserialize movie from file.
3365  The given frame is used as template to decide the frame type.
3366  If binary is true, binary format is decoded (much faster).
3367 \end_layout
3369 \begin_layout Subsection
3370 movie.current_first_subframe: Return first subframe in current frame
3371 \end_layout
3373 \begin_layout Itemize
3374 Syntax: number movie.current_first_subframe()
3375 \end_layout
3377 \begin_layout Standard
3378 Returns first subframe in current frame.
3379 \end_layout
3381 \begin_layout Subsection
3382 movie.pollcounter: Return poll counter for speified control
3383 \end_layout
3385 \begin_layout Itemize
3386 Syntax: number movie.pollcounter(number port, number controller, number control)
3387 \end_layout
3389 \begin_layout Standard
3390 Returns number of times the specified control has been polled this frame.
3391 \end_layout
3393 \begin_layout Subsection
3394 INPUTFRAME::get_button: Get button
3395 \end_layout
3397 \begin_layout Itemize
3398 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
3399  control)
3400 \end_layout
3402 \begin_layout Standard
3403 Returns state of given button as boolean.
3404 \end_layout
3406 \begin_layout Subsection
3407 INPUTFRAME::get_axis: Get axis
3408 \end_layout
3410 \begin_layout Itemize
3411 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
3412  control)
3413 \end_layout
3415 \begin_layout Standard
3416 Returns state of given axis as number.
3417 \end_layout
3419 \begin_layout Subsection
3420 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
3421 \end_layout
3423 \begin_layout Itemize
3424 Syntax: none INPUTFRAME::set_button(number port, number controller, number
3425  control, number/bool value)
3426 \end_layout
3428 \begin_layout Itemize
3429 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
3430  control)
3431 \end_layout
3433 \begin_layout Standard
3434 Set the given button/axis to given value.
3435 \end_layout
3437 \begin_layout Subsection
3438 INPUTFRAME::serialize: Serialize a frame
3439 \end_layout
3441 \begin_layout Itemize
3442 Syntax: string INPUTFRAME::serialize()
3443 \end_layout
3445 \begin_layout Standard
3446 Return string representation of frame.
3447 \end_layout
3449 \begin_layout Subsection
3450 INPUTFRAME::unserialize: Unserialize a frame
3451 \end_layout
3453 \begin_layout Itemize
3454 Syntax: none INPUTFRAME::unserialize(string data)
3455 \end_layout
3457 \begin_layout Standard
3458 Set current frame from given data.
3459 \end_layout
3461 \begin_layout Subsection
3462 INPUTFRAME::get_stride: Get movie stride
3463 \end_layout
3465 \begin_layout Itemize
3466 Syntax: number INPUTFRAME::get_stride()
3467 \end_layout
3469 \begin_layout Standard
3470 Return number of bytes needed to store the input frame.
3471  Mainly useful for some debugging.
3472 \end_layout
3474 \begin_layout Standard
3475 \begin_inset Newpage pagebreak
3476 \end_inset
3479 \end_layout
3481 \begin_layout Section
3482 Table settings
3483 \end_layout
3485 \begin_layout Standard
3486 Routines for settings manipulation
3487 \end_layout
3489 \begin_layout Subsection
3490 settings.get: Get value of setting
3491 \end_layout
3493 \begin_layout Itemize
3494 Syntax: string settings.get(string name)
3495 \end_layout
3497 \begin_layout Standard
3498 Get value of setting <name>.
3499  If setting value can't be obtained, returns (nil, error message).
3500 \end_layout
3502 \begin_layout Subsection
3503 settings.set: Set value of setting
3504 \end_layout
3506 \begin_layout Itemize
3507 Syntax: none settings.set(string name, string value)
3508 \end_layout
3510 \begin_layout Standard
3511 Set value <value> of setting <name>.
3512  If setting can't be set, returns (nil, error message).
3513 \end_layout
3515 \begin_layout Standard
3516 \begin_inset Newpage pagebreak
3517 \end_inset
3520 \end_layout
3522 \begin_layout Section
3523 Table memory
3524 \end_layout
3526 \begin_layout Standard
3527 Contains various functions for managing memory
3528 \end_layout
3530 \begin_layout Subsection
3531 memory.vma_count: Count number of VMAs.
3532 \end_layout
3534 \begin_layout Itemize
3535 Syntax: number memory.vma_count()
3536 \end_layout
3538 \begin_layout Standard
3539 Returns the number of VMAs
3540 \end_layout
3542 \begin_layout Subsection
3543 memory.read_vma: Lookup VMA info by index
3544 \end_layout
3546 \begin_layout Itemize
3547 Syntax: string memory.read_vma(number index)
3548 \end_layout
3550 \begin_layout Standard
3551 Reads the specified VMA (indices start from zero).
3552  Trying to read invalid VMA gives nil.
3553  The read VMA is table with the following fields:
3554 \end_layout
3556 \begin_layout Itemize
3557 region_name (string): The readable name of the VMA
3558 \end_layout
3560 \begin_layout Itemize
3561 baseaddr (number): Base address of the VMA
3562 \end_layout
3564 \begin_layout Itemize
3565 lastaddr (number): Last address in the VMA.
3566 \end_layout
3568 \begin_layout Itemize
3569 size (number): The size of VMA in bytes.
3570 \end_layout
3572 \begin_layout Itemize
3573 readonly (boolean): True of the VMA corresponds to ROM.
3574 \end_layout
3576 \begin_layout Itemize
3577 iospace (boolean): True if the VMA is I/O space.
3578 \end_layout
3580 \begin_layout Itemize
3581 native_endian (boolean): True if the VMA has native endian as opposed to
3582  little endian.
3583 \end_layout
3585 \begin_layout Subsection
3586 memory.find_vma: Find VMA info by address
3587 \end_layout
3589 \begin_layout Itemize
3590 Syntax: table memory.find_vma(number address)
3591 \end_layout
3593 \begin_layout Standard
3594 Finds the VMA containing specified address.
3595  Returns table in the same format as read_vma or nil if not found.
3596 \end_layout
3598 \begin_layout Subsection
3599 memory.read{,s}{byte,{,h,d,q}word}: Read memory
3600 \end_layout
3602 \begin_layout Itemize
3603 Syntax: none memory.readbyte([string vma, ]number address)
3604 \end_layout
3606 \begin_layout Itemize
3607 Syntax: none memory.readword([string vma, ]number address)
3608 \end_layout
3610 \begin_layout Itemize
3611 Syntax: none memory.readhword([string vma, ]number address)
3612 \end_layout
3614 \begin_layout Itemize
3615 Syntax: none memory.readdword([string vma, ]number address)
3616 \end_layout
3618 \begin_layout Itemize
3619 Syntax: none memory.readqword([string vma, ]number address)
3620 \end_layout
3622 \begin_layout Itemize
3623 Syntax: none memory.readsbyte([string vma, ]number address)
3624 \end_layout
3626 \begin_layout Itemize
3627 Syntax: none memory.readsword([string vma, ]number address)
3628 \end_layout
3630 \begin_layout Itemize
3631 Syntax: none memory.readshword([string vma, ]number address)
3632 \end_layout
3634 \begin_layout Itemize
3635 Syntax: none memory.readsdword([string vma, ]number address)
3636 \end_layout
3638 \begin_layout Itemize
3639 Syntax: none memory.readsqword([string vma, ]number address)
3640 \end_layout
3642 \begin_layout Standard
3643 Reads the specified address <address> (if 's' variant is used, do undergo
3644  2's complement).
3645 \end_layout
3647 \begin_layout Subsection
3648 memory.{,s}read_sg: Scatter/Gather read memory
3649 \end_layout
3651 \begin_layout Itemize
3652 Syntax: none memory.read_sg(string/boolean/number...)
3653 \end_layout
3655 \begin_layout Itemize
3656 Syntax: none memory.sread_sg(string/boolean/number...)
3657 \end_layout
3659 \begin_layout Standard
3660 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
3661  of memory.
3662  Each argument can be string, boolean or number:
3663 \end_layout
3665 \begin_layout Itemize
3666 String: Set VMA addresses are relative to (e.g.
3667  'WRAM').
3668 \end_layout
3670 \begin_layout Itemize
3671 boolean: If true, increment relative address by 1, if false, decrement by
3672  1.
3673  The new address is read as next higher byte.
3674 \end_layout
3676 \begin_layout Itemize
3677 integer: Set the relative address to specified value and read the address
3678  as next higher byte.
3679 \end_layout
3681 \begin_layout Subsection
3682 memory.write_sg: Scatter/Gather write memory
3683 \end_layout
3685 \begin_layout Itemize
3686 Syntax: none memory.write_sg(number value, string/boolean/number...)
3687 \end_layout
3689 \begin_layout Standard
3690 Perform scatter/gather write of value <value> on memory.
3691  Each argument can be string, boolean or number:
3692 \end_layout
3694 \begin_layout Itemize
3695 String: Set VMA addresses are relative to (e.g.
3696  'WRAM').
3697 \end_layout
3699 \begin_layout Itemize
3700 boolean: If true, increment relative address by 1, if false, decrement by
3701  1.
3702  The new address is read as next higher byte.
3703 \end_layout
3705 \begin_layout Itemize
3706 integer: Set the relative address to specified value and read the address
3707  as next higher byte.
3708 \end_layout
3710 \begin_layout Subsection
3711 memory.read{float,double}: Read memory
3712 \end_layout
3714 \begin_layout Itemize
3715 Syntax: none memory.readfloat([string vma, ]number address)
3716 \end_layout
3718 \begin_layout Itemize
3719 Syntax: none memory.readdouble([string vma, ]number address)
3720 \end_layout
3722 \begin_layout Standard
3723 Reads the specified address <address>
3724 \end_layout
3726 \begin_layout Subsection
3727 memory.write{byte,{,h,d,q}word,float,double}: Write memory
3728 \end_layout
3730 \begin_layout Itemize
3731 Syntax: none memory.writebyte([string vma, ]number address, number value)
3732 \end_layout
3734 \begin_layout Itemize
3735 Syntax: none memory.writeword([string vma, ]number address, number value)
3736 \end_layout
3738 \begin_layout Itemize
3739 Syntax: none memory.writehword([string vma, ]number address, number value)
3740 \end_layout
3742 \begin_layout Itemize
3743 Syntax: none memory.writedword([string vma, ]number address, number value)
3744 \end_layout
3746 \begin_layout Itemize
3747 Syntax: none memory.writeqword([string vma, ]number address, number value)
3748 \end_layout
3750 \begin_layout Itemize
3751 Syntax: none memory.writefloat([string vma, ]number address, number value)
3752 \end_layout
3754 \begin_layout Itemize
3755 Syntax: none memory.writedouble([string vma, ]number address, number value)
3756 \end_layout
3758 \begin_layout Standard
3759 Writes the specified value <value> (negative integer values undergo 2's
3760  complement) to specified address <address>.
3761 \end_layout
3763 \begin_layout Subsection
3764 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
3765 \end_layout
3767 \begin_layout Itemize
3768 Syntax: userdata memory.map<type>([[string vma, ]number base, number size])
3769 \end_layout
3771 \begin_layout Standard
3772 Returns a table mapping specified memory aperture for read/write.
3773  If parameters are omitted, entiere map space is the aperture.
3774 \end_layout
3776 \begin_layout Itemize
3777 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
3778  qword, sqword, float or double.
3779 \end_layout
3781 \begin_layout Subsection
3782 memory.hash_region: Hash region of memory
3783 \end_layout
3785 \begin_layout Itemize
3786 Syntax: string memory.hash_region([string vma, ]number base, number size)
3787 \end_layout
3789 \begin_layout Standard
3790 Hash specified number of bytes starting from specified address and return
3791  the SHA-256.
3792 \end_layout
3794 \begin_layout Subsection
3795 memory.hash_state: Hash system state
3796 \end_layout
3798 \begin_layout Itemize
3799 Syntax: string memory.hash_state()
3800 \end_layout
3802 \begin_layout Standard
3803 Hash the current system state.
3804  Mainly useful for debugging savestates.
3805 \end_layout
3807 \begin_layout Subsection
3808 memory.readregion: Read region of memory
3809 \end_layout
3811 \begin_layout Itemize
3812 Syntax: table memory.readregion([string vma, ]number base, number size)
3813 \end_layout
3815 \begin_layout Standard
3816 Read a region of memory.
3817 \end_layout
3819 \begin_layout Itemize
3820 Warning: If the region crosses VMA boundary, the results are undefined.
3821 \end_layout
3823 \begin_layout Subsection
3824 memory.writeregion: Write region of memory
3825 \end_layout
3827 \begin_layout Itemize
3828 Syntax: none memory.writeregion([string vma, ]number base, number size, table
3829  data)
3830 \end_layout
3832 \begin_layout Standard
3833 Write a region of memory.
3834 \end_layout
3836 \begin_layout Itemize
3837 Warning: If the region crosses VMA boundary, the results are undefined.
3838 \end_layout
3840 \begin_layout Subsection
3841 memory.map_structure: Create mmap structure
3842 \end_layout
3844 \begin_layout Itemize
3845 syntax: MMAP_STRUCT memory.map_structure()
3846 \end_layout
3848 \begin_layout Standard
3849 Returns a new mapping structure (MMAP_STRUCT)
3850 \end_layout
3852 \begin_layout Subsection
3853 MMAP_STRUCT(): Bind key in mmap structure
3854 \end_layout
3856 \begin_layout Itemize
3857 Syntax: none MMAP_STRUCT(string key, [string vma, ]number address, string
3858  type)
3859 \end_layout
3861 \begin_layout Standard
3862 Bind key <key> in mmap structure to specified address <address> with specified
3863  type <type>.
3864 \end_layout
3866 \begin_layout Itemize
3867 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
3868  qword, sqword, float or double.
3869 \end_layout
3871 \begin_layout Subsection
3872 memory.read_expr: Evaluate memory watch expression
3873 \end_layout
3875 \begin_layout Itemize
3876 Syntax: string memory.read_expr(string expr)
3877 \end_layout
3879 \begin_layout Standard
3880 Evaluate specified watch expression and return result
3881 \end_layout
3883 \begin_layout Subsection
3884 memory.action: Run core action
3885 \end_layout
3887 \begin_layout Itemize
3888 memory.action(string action, [<params>])
3889 \end_layout
3891 \begin_layout Standard
3892 Run core action.
3893  The different models expect parameters as:
3894 \end_layout
3896 \begin_layout Itemize
3897 string: String
3898 \end_layout
3900 \begin_layout Itemize
3901 numeric: numeric
3902 \end_layout
3904 \begin_layout Itemize
3905 enumeration: String
3906 \end_layout
3908 \begin_layout Itemize
3909 boolean: String
3910 \end_layout
3912 \begin_layout Itemize
3913 toggle: None.
3914 \end_layout
3916 \begin_layout Subsection
3917 memory.get_lag_flag: Get lag flag
3918 \end_layout
3920 \begin_layout Itemize
3921 Syntax: boolean memory.get_lag_flag()
3922 \end_layout
3924 \begin_layout Standard
3925 Get the value of core lag flag.
3926  True if this frame has been lag so far, false if poll has been detected.
3927 \end_layout
3929 \begin_layout Subsection
3930 memory.set_lag_flag: Set lag flag
3931 \end_layout
3933 \begin_layout Itemize
3934 Syntax: none memory.set_lag_flag(boolean flag)
3935 \end_layout
3937 \begin_layout Standard
3938 Set the value of core lag flag.
3939  This flag automatically gets cleared if poll is detected, but can be forcibly
3940  set or cleared if game so requires.
3941 \end_layout
3943 \begin_layout Itemize
3944 Should only be used in on_frame_emulated callback.
3945 \end_layout
3947 \begin_layout Itemize
3948 Setting or clearing this affects the emulator lag counter.
3949 \end_layout
3951 \begin_layout Subsection
3952 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
3953  callback
3954 \end_layout
3956 \begin_layout Itemize
3957 Syntax: function memory.registerread([string vma, ] number addr, function
3958  fn);
3959 \end_layout
3961 \begin_layout Itemize
3962 Syntax: function memory.registerwrite([string vma, ] number addr, function
3963  fn);
3964 \end_layout
3966 \begin_layout Itemize
3967 Syntax: function memory.registerexec([string vma, ] number addr, function
3968  fn);
3969 \end_layout
3971 \begin_layout Itemize
3972 Syntax: none memory.unregisterread([string vma, ] number addr, function fn);
3973 \end_layout
3975 \begin_layout Itemize
3976 Syntax: none memory.unregisterwrite([string vma, ] number addr, function
3977  fn);
3978 \end_layout
3980 \begin_layout Itemize
3981 Syntax: none memory.unregisterexec([string vma, ] number addr, function fn);
3982 \end_layout
3984 \begin_layout Standard
3985 Add or remove callback on memory read, write or execute (depending on the
3986  function).
3987  If <vma> is specified, <addr> is relative to it, otherwise <addr> is global.
3988  <fn> is the callback.
3989  The register* functions return <fn> (which can then be passed to unregister*
3990  functions.
3991 \end_layout
3993 \begin_layout Itemize
3994 Not all cores support this, and it may be unsupported for some VMAs.
3995 \end_layout
3997 \begin_layout Itemize
3998 The functions are passed two parameters: Address and value.
3999 \end_layout
4001 \begin_layout Subsection
4002 memory.{,un}registertrace: Set/Clear trace hook
4003 \end_layout
4005 \begin_layout Itemize
4006 Syntax: function memory.registertrace(number processor, function fn);
4007 \end_layout
4009 \begin_layout Itemize
4010 Syntax: none memory.unregistertrace(number processor, function fn);
4011 \end_layout
4013 \begin_layout Standard
4014 Add or remove trace callback.
4015  <processor> is system-dependent processor number (0 is usually main CPU).
4016  The function arguments work like in other (un)register* functions.
4017 \end_layout
4019 \begin_layout Itemize
4020 The functions are passed two parameters: Trace CPU and Trace event string.
4021 \end_layout
4023 \begin_layout Subsection
4024 memory.cheat: Set cheat
4025 \end_layout
4027 \begin_layout Itemize
4028 Syntax: none memory.cheat([string vma, ] number addr, number value);
4029 \end_layout
4031 \begin_layout Itemize
4032 Syntax: none memory.cheat([string vma, ] number addr);
4033 \end_layout
4035 \begin_layout Standard
4036 Set or clear cheat (value <value>) on address <addr>.
4037  If <vma> is specified, <addr> is relative to that.
4038  If <value> is not speicified, clear a cheat.
4039 \end_layout
4041 \begin_layout Itemize
4042 Not all cores support this, and it may be unsupported for some VMAs.
4043 \end_layout
4045 \begin_layout Subsection
4046 memory.setxmask: Set global execute hook mask
4047 \end_layout
4049 \begin_layout Itemize
4050 Syntax: none memory.setxmask(number mask)
4051 \end_layout
4053 \begin_layout Standard
4054 Set the global execute hook mask to <mask>.
4055  The meaning of each bit is system-dependent, but bit 0 should be the main
4056  CPU.
4057 \end_layout
4059 \begin_layout Standard
4060 \begin_inset Newpage pagebreak
4061 \end_inset
4064 \end_layout
4066 \begin_layout Section
4067 Table memory2
4068 \end_layout
4070 \begin_layout Standard
4071 Contains newer memory functions.
4072 \end_layout
4074 \begin_layout Subsection
4075 memory2(): Get all VMA names.
4076 \end_layout
4078 \begin_layout Itemize
4079 Syntax: table memory2()
4080 \end_layout
4082 \begin_layout Standard
4083 Returns array of all valid VMA names.
4084 \end_layout
4086 \begin_layout Subsection
4087 memory2.<vma>:info: Get VMA info
4088 \end_layout
4090 \begin_layout Itemize
4091 Syntax: table memory2.<vma>:info()
4092 \end_layout
4094 \begin_layout Standard
4095 Return table describing given VMA.
4096  Includes fields address, size, last, readonly, special and endian.
4097 \end_layout
4099 \begin_layout Subsection
4100 memory2.<vma>:<op>: Read/Write memory
4101 \end_layout
4103 \begin_layout Itemize
4104 Syntax: none memory2.<vma>:<op>(number offset, number value)
4105 \end_layout
4107 \begin_layout Itemize
4108 Syntax: number memory2.<vma>:<op>(number offset)
4109 \end_layout
4111 \begin_layout Standard
4112 Read/Write value from/to given VMA <vma> at given offset <offset> (must
4113  be in-range).
4114  The value written is <value>.
4115  <Op> is of form: [i][s]<type>, where:
4116 \end_layout
4118 \begin_layout Itemize
4119 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
4120 \end_layout
4122 \begin_layout Itemize
4123 'i' signifies that the value is treated as opposite-to-normal endianess,
4124 \end_layout
4126 \begin_layout Itemize
4127 's' signifies that value is treated as signed (not available for floating-point).
4128 \end_layout
4130 \begin_layout Subsection
4131 memory2.<vma>:read: Scatter-gather value read
4132 \end_layout
4134 \begin_layout Itemize
4135 Syntax: number memory2.<vma>:read(number addr...)
4136 \end_layout
4138 \begin_layout Standard
4139 Read value from given VMA <vma> at byte offsets <addr>..., given in order of
4140  increasing significance.
4141  Value of true and false are special.
4142  True increments address by 1, and false decrements address by 1.
4143 \end_layout
4145 \begin_layout Subsection
4146 memory2.<vma>:sread: Signed scatter-gather value read
4147 \end_layout
4149 \begin_layout Itemize
4150 Syntax: number memory2.<vma>:sread(number addr...)
4151 \end_layout
4153 \begin_layout Standard
4154 Like memory2.<vma>:read, but reads signed values.
4155 \end_layout
4157 \begin_layout Subsection
4158 memory2.<vma>:write: Scatter-gather value write
4159 \end_layout
4161 \begin_layout Itemize
4162 Syntax: number memory2.<vma>:write(number val, number addr...)
4163 \end_layout
4165 \begin_layout Standard
4166 Write value <val> to given VMA <vma> at byte offsets <addr>..., given in order
4167  of increasing significance.
4168  Value of true and false are special.
4169  True increments address by 1, and false decrements address by 1.
4170 \end_layout
4172 \begin_layout Standard
4173 \begin_inset Newpage pagebreak
4174 \end_inset
4177 \end_layout
4179 \begin_layout Section
4180 Table random
4181 \end_layout
4183 \begin_layout Standard
4184 Contains random number generation methods.
4185  These functions do not return reproducable results.
4186 \end_layout
4188 \begin_layout Subsection
4189 random.boolean: Random boolean
4190 \end_layout
4192 \begin_layout Itemize
4193 Syntax: boolean random.boolean()
4194 \end_layout
4196 \begin_layout Standard
4197 Returns true or false at random (50-50 chance).
4198 \end_layout
4200 \begin_layout Subsection
4201 random.integer: Random integer
4202 \end_layout
4204 \begin_layout Itemize
4205 Syntax: number random.integer(number highplusone)
4206 \end_layout
4208 \begin_layout Itemize
4209 Syntax: number random.integer(number low, number high)
4210 \end_layout
4212 \begin_layout Standard
4213 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
4214  With two arguments, return random integer [<low>,<high>] (both ends inclusive).
4215 \end_layout
4217 \begin_layout Standard
4218 The returned numbers are from uniform distribution.
4219 \end_layout
4221 \begin_layout Subsection
4222 random.float: Random float
4223 \end_layout
4225 \begin_layout Itemize
4226 Syntax: number random.float()
4227 \end_layout
4229 \begin_layout Standard
4230 Returns random decimal number [0,1).
4231 \end_layout
4233 \begin_layout Subsection
4234 random.among: Random parameter
4235 \end_layout
4237 \begin_layout Itemize
4238 Syntax: value random.among(value values...)
4239 \end_layout
4241 \begin_layout Standard
4242 Returns random parameter value, picked at uniform.
4243  Multiple equivalent values are returned with higher chance.
4244 \end_layout
4246 \begin_layout Subsection
4247 random.amongtable: Random from table
4248 \end_layout
4250 \begin_layout Itemize
4251 Syntax: value random.amongtable(table tab)
4252 \end_layout
4254 \begin_layout Standard
4255 Returns random value from table <tab>.
4256  As in random.among, no equality testing is done.
4257 \end_layout
4259 \begin_layout Standard
4260 \begin_inset Newpage pagebreak
4261 \end_inset
4264 \end_layout
4266 \begin_layout Section
4267 Table zip
4268 \end_layout
4270 \begin_layout Subsection
4271 zip.create: Create a new zipfile
4272 \end_layout
4274 \begin_layout Itemize
4275 Syntax: ZIPWRITER zip.create(string filename[, number compression])
4276 \end_layout
4278 \begin_layout Standard
4279 Creates a new zipfile <filename>, with specified compression level <compression>
4280  (default 9).
4281 \end_layout
4283 \begin_layout Subsection
4284 zip.enumerate: Enumerate members in zipfile
4285 \end_layout
4287 \begin_layout Itemize
4288 Syntax: Table zip.enumerate(string filename[, boolean invert])
4289 \end_layout
4291 \begin_layout Standard
4292 Returns table of files in zip archive <filename>.
4293  If <invert> is true, instead of returning array of names, returns table
4294  with keys being member names and values being true.
4295 \end_layout
4297 \begin_layout Subsection
4298 ZIPWRITER:commit: Finish creating ZIP file.
4299 \end_layout
4301 \begin_layout Itemize
4302 Syntax: none ZIPWRITER:commit()
4303 \end_layout
4305 \begin_layout Standard
4306 Closes the ZIP archive.
4307  Nothing more can be written.
4308 \end_layout
4310 \begin_layout Subsection
4311 ZIPWRITER:rollback: Delete the ZIP file being creted
4312 \end_layout
4314 \begin_layout Itemize
4315 Syntax: none ZIPWRITER:rollback()
4316 \end_layout
4318 \begin_layout Standard
4319 Deletes the newly written ZIP archive.
4320  Nothing more can be written.
4321 \end_layout
4323 \begin_layout Subsection
4324 ZIPWRITER:create_file: Start writing a new member
4325 \end_layout
4327 \begin_layout Itemize
4328 Syntax: none ZIPWRITER:create_file(string filename)
4329 \end_layout
4331 \begin_layout Standard
4332 Starts writing a new member <filename> in ZIP file.
4333  If member is open, it is closed.
4334 \end_layout
4336 \begin_layout Subsection
4337 ZIPWRITER:close_file: Close member
4338 \end_layout
4340 \begin_layout Itemize
4341 Syntax: none ZIPWRITER:close_file()
4342 \end_layout
4344 \begin_layout Standard
4345 Closes member in ZIP file.
4346 \end_layout
4348 \begin_layout Subsection
4349 ZIPWRITER:write: Write data
4350 \end_layout
4352 \begin_layout Itemize
4353 Syntax none ZIPWRITER:write(string data)
4354 \end_layout
4356 \begin_layout Standard
4357 Writes data <data> into ZIP file (binary mode).
4358 \end_layout
4360 \begin_layout Standard
4361 \begin_inset Newpage pagebreak
4362 \end_inset
4365 \end_layout
4367 \begin_layout Section
4368 Table callback
4369 \end_layout
4371 \begin_layout Standard
4372 Various callback-related functions.
4373 \end_layout
4375 \begin_layout Subsection
4376 \begin_inset CommandInset label
4377 LatexCommand label
4378 name "sub:callback.register:-Register-a"
4380 \end_inset
4382 callback.register: Register a callback
4383 \end_layout
4385 \begin_layout Itemize
4386 Syntax: function callback.register(string cbname, function cbfun);
4387 \end_layout
4389 \begin_layout Standard
4390 Instruct function <cbfun> to be added to list of callbacks to call on event
4391  <cbname> (See section 
4392 \begin_inset CommandInset ref
4393 LatexCommand ref
4394 reference "sec:Callbacks"
4396 \end_inset
4399  The callback name does not have the 'on_' prefix (e.g.
4401 \begin_inset Quotes eld
4402 \end_inset
4404 paint
4405 \begin_inset Quotes erd
4406 \end_inset
4409  Returns <cbfun>.
4410 \end_layout
4412 \begin_layout Subsection
4413 \begin_inset CommandInset label
4414 LatexCommand label
4415 name "sub:callback.unregister:-Unregister-"
4417 \end_inset
4419 callback.unregister: Unregister a callback
4420 \end_layout
4422 \begin_layout Itemize
4423 Syntax: function callback.unregister(string cbname, function cbfun);
4424 \end_layout
4426 \begin_layout Standard
4427 Instruct function <cbfun> to be removed from list of callbacks to call on
4428  event <cbname>.
4429 \end_layout
4431 \begin_layout Subsection
4432 callback.<cbname>:register: Register callback
4433 \end_layout
4435 \begin_layout Itemize
4436 Syntax: function callback.<cbname>:register(function cbfun)
4437 \end_layout
4439 \begin_layout Standard
4440 Synonym for callback.register (section 
4441 \begin_inset CommandInset ref
4442 LatexCommand ref
4443 reference "sub:callback.register:-Register-a"
4445 \end_inset
4447 ), albeit with callback name specified differently.
4448 \end_layout
4450 \begin_layout Subsection
4451 callback.<cbname>:unregister: Register callback
4452 \end_layout
4454 \begin_layout Itemize
4455 Syntax: function callback.<cbname>:unregister(function cbfun)
4456 \end_layout
4458 \begin_layout Standard
4459 Synonym for callback.unregister (section 
4460 \begin_inset CommandInset ref
4461 LatexCommand ref
4462 reference "sub:callback.unregister:-Unregister-"
4464 \end_inset
4466 ), albeit with callback name specified differently.
4467 \end_layout
4469 \begin_layout Section
4470 table bsnes
4471 \end_layout
4473 \begin_layout Standard
4474 Various bsnes-specific functions.
4475 \end_layout
4477 \begin_layout Subsection
4478 bsnes.dump_sprite: Dump a sprite
4479 \end_layout
4481 \begin_layout Itemize
4482 Syntax: BITMAP bsnes.dump_sprite([string vma, ] number addr, number width,
4483  number height[, number stride])
4484 \end_layout
4486 \begin_layout Standard
4487 Dumps given sprite (in native format) from memory.
4488  VMA is usually 
4489 \begin_inset Quotes eld
4490 \end_inset
4492 VRAM
4493 \begin_inset Quotes erd
4494 \end_inset
4497  <Width> and <height> are given in 8x8 blocks.
4498  <Stride> overrides row stride (default 512).
4499 \end_layout
4501 \begin_layout Subsection
4502 bsnes.dump_palette: Dump a palette
4503 \end_layout
4505 \begin_layout Itemize
4506 Syntax: PALETTE bsnes.dump_palette([string vma, ] number addr, bool full256,
4507  bool first_trans)
4508 \end_layout
4510 \begin_layout Standard
4511 Dumps a palette from memory.
4512  VMA is usually 
4513 \begin_inset Quotes eld
4514 \end_inset
4516 CGRAM
4517 \begin_inset Quotes erd
4518 \end_inset
4521  If <full256> is true, 256 colors are dumped (otherwise 16).
4522  If <first_trans> is true, first color is forced transparent.
4523 \end_layout
4525 \begin_layout Section
4526 Table _SYSTEM
4527 \end_layout
4529 \begin_layout Standard
4530 Contains copy of global variables from time of Lua initialization.
4531  Non-writeable.
4532 \end_layout
4534 \begin_layout Standard
4535 \begin_inset Newpage pagebreak
4536 \end_inset
4539 \end_layout
4541 \begin_layout Section
4542 \begin_inset CommandInset label
4543 LatexCommand label
4544 name "sec:Callbacks"
4546 \end_inset
4548 Callbacks
4549 \end_layout
4551 \begin_layout Standard
4552 Various callbacks to Lua that can occur.
4553 \end_layout
4555 \begin_layout Subsection
4556 on_paint: Screen is being painted
4557 \end_layout
4559 \begin_layout Itemize
4560 Callback: on_paint(bool not_synth)
4561 \end_layout
4563 \begin_layout Standard
4564 Called when screen is being painted.
4565  Any gui.* calls requiring graphic context draw on the screen.
4566 \end_layout
4568 \begin_layout Itemize
4569 not_synth is true if this hook is being called in response to received frame,
4570  false otherwise.
4571 \end_layout
4573 \begin_layout Subsection
4574 on_video: Dumped video frame is being painted
4575 \end_layout
4577 \begin_layout Itemize
4578 Callback: on_video()
4579 \end_layout
4581 \begin_layout Standard
4582 Called when video dump frame is being painted.
4583  Any gui.* calls requiring graphic context draw on the video.
4584 \end_layout
4586 \begin_layout Subsection
4587 on_frame_emulated: Frame emulation complete
4588 \end_layout
4590 \begin_layout Itemize
4591 Callback: on_frame_emulated()
4592 \end_layout
4594 \begin_layout Standard
4595 Called when emulating frame has completed and on_paint()/on_video() calls
4596  are about to be issued.
4597 \end_layout
4599 \begin_layout Subsection
4600 on_frame: Frame emulation starting.
4601 \end_layout
4603 \begin_layout Itemize
4604 Callback: on_frame()
4605 \end_layout
4607 \begin_layout Standard
4608 Called on each starting whole frame.
4609 \end_layout
4611 \begin_layout Subsection
4612 on_startup: Emulator startup complete
4613 \end_layout
4615 \begin_layout Itemize
4616 Callback: on_startup()
4617 \end_layout
4619 \begin_layout Standard
4620 Called when the emulator is starting (lsnes.rc and --run files has been run).
4621 \end_layout
4623 \begin_layout Subsection
4624 on_rewind: Movie rewound to beginning
4625 \end_layout
4627 \begin_layout Itemize
4628 Callback: on_rewind()
4629 \end_layout
4631 \begin_layout Standard
4632 Called when rewind movie to beginning has completed.
4633 \end_layout
4635 \begin_layout Subsection
4636 on_pre_load: Load operation is about to start
4637 \end_layout
4639 \begin_layout Itemize
4640 Callback: on_pre_load(string name)
4641 \end_layout
4643 \begin_layout Standard
4644 Called just before savestate/movie load occurs (note: loads are always delayed,
4645  so this occurs even when load was initiated by lua).
4646 \end_layout
4648 \begin_layout Subsection
4649 on_err_Load: Load failed
4650 \end_layout
4652 \begin_layout Itemize
4653 Callback: on_err_load(string name)
4654 \end_layout
4656 \begin_layout Standard
4657 Called if loadstate goes wrong.
4658 \end_layout
4660 \begin_layout Subsection
4661 on_post_load: Load completed
4662 \end_layout
4664 \begin_layout Itemize
4665 Callback: on_post_load(string name, boolean was_savestate)
4666 \end_layout
4668 \begin_layout Standard
4669 Called on successful loadstate.
4670  was_savestate gives if this was a savestate or a movie.
4671 \end_layout
4673 \begin_layout Subsection
4674 on_pre_save: Save operation is about to start
4675 \end_layout
4677 \begin_layout Itemize
4678 Callback: on_pre_save(string name, boolean is_savestate)
4679 \end_layout
4681 \begin_layout Standard
4682 Called just before savestate save occurs (note: movie saves are synchronous
4683  and won't trigger these callbacks if called from Lua).
4684 \end_layout
4686 \begin_layout Subsection
4687 on_err_save: Save failed
4688 \end_layout
4690 \begin_layout Itemize
4691 Callback: on_err_save(string name)
4692 \end_layout
4694 \begin_layout Standard
4695 Called if savestate goes wrong.
4696 \end_layout
4698 \begin_layout Subsection
4699 on_post_save: Save completed
4700 \end_layout
4702 \begin_layout Itemize
4703 Callback: on_post_save(string name, boolean is_savestate)
4704 \end_layout
4706 \begin_layout Standard
4707 Called on successful savaestate.
4708  is_savestate gives if this was a savestate or a movie.
4709 \end_layout
4711 \begin_layout Subsection
4712 on_quit: Emulator is shutting down
4713 \end_layout
4715 \begin_layout Itemize
4716 Callback: on_quit()
4717 \end_layout
4719 \begin_layout Standard
4720 Called when emulator is shutting down.
4721 \end_layout
4723 \begin_layout Subsection
4724 on_input: Polling for input
4725 \end_layout
4727 \begin_layout Standard
4728 Called when emulator is just sending input to bsnes core.
4729  Warning: This is called even in readonly mode, but the results are ignored.
4730 \end_layout
4732 \begin_layout Subsection
4733 on_reset: System has been reset
4734 \end_layout
4736 \begin_layout Itemize
4737 Callback: on_reset()
4738 \end_layout
4740 \begin_layout Standard
4741 Called when system is reset.
4742 \end_layout
4744 \begin_layout Subsection
4745 on_readwrite: Entered readwrite mode
4746 \end_layout
4748 \begin_layout Itemize
4749 Callback: on_readwrite()
4750 \end_layout
4752 \begin_layout Standard
4753 Called when moving into readwrite mode as result of 
4754 \begin_inset Quotes eld
4755 \end_inset
4757 set-rwmode
4758 \begin_inset Quotes erd
4759 \end_inset
4761  command (note: moving to rwmode by Lua won't trigger this, as per recursive
4762  entry protection).
4763 \end_layout
4765 \begin_layout Subsection
4766 on_snoop/on_snoop2: Snoop core controller reads
4767 \end_layout
4769 \begin_layout Itemize
4770 Callback: on_snoop(number port, number controller, number index, number
4771  value)
4772 \end_layout
4774 \begin_layout Itemize
4775 Callback: on_snoop2(number port, number controller, number index, number
4776  value)
4777 \end_layout
4779 \begin_layout Standard
4780 Called each time bsnes asks for input.
4781  The value is the final value to be sent to bsnes core (readonly mode, autohold
4782  and autofire have been taken into account).
4783  Might be useful when translating movies to format suitable for console
4784  verification.
4785  Note: There is no way to modify the value to be sent.
4786 \end_layout
4788 \begin_layout Itemize
4789 On_snoop2 is called instead of on_snoop if defined.
4790  Reserves port 0 for system, having first user port be port 1.
4791 \end_layout
4793 \begin_layout Subsection
4794 on_keyhook: Hooked key/axis has been moved
4795 \end_layout
4797 \begin_layout Itemize
4798 Callback: on_keyhook(string keyname, table state)
4799 \end_layout
4801 \begin_layout Standard
4802 Sent when key that has keyhook events requested changes state.
4803  Keyname is name of the key (group) and state is the state (same kind as
4804  table values in input.raw).
4805 \end_layout
4807 \begin_layout Subsection
4808 on_idle: Idle event
4809 \end_layout
4811 \begin_layout Itemize
4812 Callback: on_idle()
4813 \end_layout
4815 \begin_layout Standard
4816 Called when requested by set_idle_timeout(), the timeout has expired and
4817  emulator is waiting.
4818 \end_layout
4820 \begin_layout Subsection
4821 on_timer: Timer event
4822 \end_layout
4824 \begin_layout Itemize
4825 Callback: on_timer()
4826 \end_layout
4828 \begin_layout Standard
4829 Called when requested by set_idle_timeout() and the timeout has expired
4830  (regardless if emulator is waiting).
4831 \end_layout
4833 \begin_layout Subsection
4834 on_set_rewind: Rewind point has been set
4835 \end_layout
4837 \begin_layout Itemize
4838 Callback: on_set_rewind(UNSAFEREWIND r)
4839 \end_layout
4841 \begin_layout Standard
4842 Called when unsafe rewind object has been constructed.
4843 \end_layout
4845 \begin_layout Subsection
4846 on_pre_rewind: Rewind is about to occur
4847 \end_layout
4849 \begin_layout Itemize
4850 Callback: on_pre_rewind() 
4851 \end_layout
4853 \begin_layout Standard
4854 Called just before unsafe rewind is about to occur.
4855 \end_layout
4857 \begin_layout Subsection
4858 on_post_rewind: Rewind has occured
4859 \end_layout
4861 \begin_layout Itemize
4862 Callback: on_post_rewind() 
4863 \end_layout
4865 \begin_layout Standard
4866 Called just after unsafe rewind has occured.
4867 \end_layout
4869 \begin_layout Subsection
4870 on_button: Button has been pressed
4871 \end_layout
4873 \begin_layout Itemize
4874 Callback: on_button(number port, number controller, number index, string
4875  type)
4876 \end_layout
4878 \begin_layout Standard
4879 Called on controller button press, with following parameters:
4880 \end_layout
4882 \begin_layout Itemize
4883 port: Port number (0 is system)
4884 \end_layout
4886 \begin_layout Itemize
4887 controller: Controller within port
4888 \end_layout
4890 \begin_layout Itemize
4891 index: Index of button.
4892 \end_layout
4894 \begin_layout Itemize
4895 type: Type of event, one of:
4896 \end_layout
4898 \begin_deeper
4899 \begin_layout Itemize
4900 \begin_inset Quotes eld
4901 \end_inset
4903 pressed
4904 \begin_inset Quotes erd
4905 \end_inset
4907 : Button was pressed.
4908 \end_layout
4910 \begin_layout Itemize
4911 \begin_inset Quotes eld
4912 \end_inset
4914 released
4915 \begin_inset Quotes erd
4916 \end_inset
4918 : Button was released.
4919 \end_layout
4921 \begin_layout Itemize
4922 \begin_inset Quotes eld
4923 \end_inset
4925 hold
4926 \begin_inset Quotes erd
4927 \end_inset
4929 : Held.
4930 \end_layout
4932 \begin_layout Itemize
4933 \begin_inset Quotes eld
4934 \end_inset
4936 unhold
4937 \begin_inset Quotes erd
4938 \end_inset
4940 : Released from hold.
4941 \end_layout
4943 \begin_layout Itemize
4944 \begin_inset Quotes eld
4945 \end_inset
4947 type
4948 \begin_inset Quotes erd
4949 \end_inset
4951 : Typing input on button.
4952 \end_layout
4954 \begin_layout Itemize
4955 \begin_inset Quotes eld
4956 \end_inset
4958 untype
4959 \begin_inset Quotes erd
4960 \end_inset
4962 : Typing input undone.
4963 \end_layout
4965 \begin_layout Itemize
4966 \begin_inset Quotes eld
4967 \end_inset
4969 autofire <duty> <cycle>
4970 \begin_inset Quotes erd
4971 \end_inset
4973 : Autofire with specifie duty and cycle.
4974 \end_layout
4976 \begin_layout Itemize
4977 \begin_inset Quotes eld
4978 \end_inset
4980 autofire
4981 \begin_inset Quotes erd
4982 \end_inset
4984 : Stop autofire.
4985 \end_layout
4987 \begin_layout Itemize
4988 \begin_inset Quotes eld
4989 \end_inset
4991 analog
4992 \begin_inset Quotes erd
4993 \end_inset
4995 : Analog action on axis.
4996 \end_layout
4998 \end_deeper
4999 \begin_layout Subsection
5000 on_movie_lost: Movie data is about to be lost
5001 \end_layout
5003 \begin_layout Itemize
5004 Callback: on_movie_lost(STRING kind)
5005 \end_layout
5007 \begin_layout Standard
5008 Called just before something would happen that could lose movie data.
5009  Kind can be:
5010 \end_layout
5012 \begin_layout Itemize
5013 readwrite: Switching to readwrite mode.
5014 \end_layout
5016 \begin_layout Itemize
5017 reload: ROM is being reloaded in readwrite mode.
5018 \end_layout
5020 \begin_layout Itemize
5021 load: New movie is being loaded.
5022 \end_layout
5024 \begin_layout Itemize
5025 unsaferewind: Unsafe rewind is happening.
5026 \end_layout
5028 \begin_layout Subsection
5029 on_latch: Latch line is rising
5030 \end_layout
5032 \begin_layout Itemize
5033 Callback: on_latch(<core-dependent-parameters>)
5034 \end_layout
5036 \begin_layout Standard
5037 Called when latch line for controller is rising.
5038  Some cores may not support this.
5039 \end_layout
5041 \begin_layout Section
5042 System-dependent behaviour
5043 \end_layout
5045 \begin_layout Subsection
5046 bsnes core
5047 \end_layout
5049 \begin_layout Itemize
5050 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
5051  p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
5052  p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
5053 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
5054 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
5055  ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
5056  ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
5057  ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
5058  ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
5059 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
5060 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
5061  ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
5062 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
5063 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
5064  ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
5065 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
5066  ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
5067 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
5068 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
5069 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
5070  ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
5071 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
5072  ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
5073  ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
5074 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
5075 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
5076 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
5077  ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
5078 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
5079  ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
5080  ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
5081  ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
5082  ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
5083 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
5084  ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
5085 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
5086  ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
5087  ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
5088 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
5089  ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount, 
5090 \end_layout
5092 \begin_layout Itemize
5093 on_latch has no parameters
5094 \end_layout
5096 \begin_layout Itemize
5097 CPU 0 is S-CPU, 1 is S-SMP.
5098 \end_layout
5100 \begin_layout Itemize
5101 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
5102 \end_layout
5104 \begin_layout Itemize
5105 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
5106 {RAM,ROM}.
5107 \end_layout
5109 \begin_layout Subsection
5110 gambatte core
5111 \end_layout
5113 \begin_layout Itemize
5114 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
5115  d, e, f, h, l
5116 \end_layout
5118 \begin_layout Itemize
5119 on_latch is not supported
5120 \end_layout
5122 \begin_layout Itemize
5123 CPU 0 is main CPU.
5124 \end_layout
5126 \begin_layout Itemize
5127 Cheats are supported for ROM, SRAM and WRAM.
5128 \end_layout
5130 \begin_layout Itemize
5131 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM
5132  and WRAM.
5133 \end_layout
5135 \end_body
5136 \end_document