Circle coordinates can go negative and thus must be signed
[lsnes.git] / lua.lyx
blob90033f44a5994da02812c7bd1be09d9a58a3b308
1 #LyX 2.1 created this file. For more info see http://www.lyx.org/
2 \lyxformat 474
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_math auto
16 \font_default_family default
17 \use_non_tex_fonts false
18 \font_sc false
19 \font_osf false
20 \font_sf_scale 100
21 \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_package amsmath 1
42 \use_package amssymb 1
43 \use_package cancel 1
44 \use_package esint 1
45 \use_package mathdots 1
46 \use_package mathtools 1
47 \use_package mhchem 1
48 \use_package stackrel 1
49 \use_package stmaryrd 1
50 \use_package undertilde 1
51 \cite_engine basic
52 \cite_engine_type default
53 \biblio_style plain
54 \use_bibtopic false
55 \use_indices false
56 \paperorientation portrait
57 \suppress_date false
58 \justification true
59 \use_refstyle 1
60 \index Hakusana
61 \shortcut idx
62 \color #008000
63 \end_index
64 \leftmargin 2cm
65 \topmargin 2cm
66 \rightmargin 1cm
67 \bottommargin 2cm
68 \headheight 1cm
69 \headsep 1cm
70 \footskip 1cm
71 \secnumdepth 3
72 \tocdepth 3
73 \paragraph_separation indent
74 \paragraph_indentation default
75 \quotes_language english
76 \papercolumns 1
77 \papersides 1
78 \paperpagestyle default
79 \tracking_changes false
80 \output_changes false
81 \html_math_output 0
82 \html_css_as_file 0
83 \html_be_strict false
84 \end_header
86 \begin_body
88 \begin_layout Title
89 lsnes Lua functions reference
90 \end_layout
92 \begin_layout Section
93 Table of contents
94 \end_layout
96 \begin_layout Standard
97 \begin_inset CommandInset toc
98 LatexCommand tableofcontents
100 \end_inset
103 \end_layout
105 \begin_layout Standard
106 \begin_inset Newpage pagebreak
107 \end_inset
110 \end_layout
112 \begin_layout Section
113 Conventions
114 \end_layout
116 \begin_layout Subsection
117 Coordinates:
118 \end_layout
120 \begin_layout Itemize
121 Coordinates increase to right and down.
122 \end_layout
124 \begin_layout Itemize
125 The origin is at top left of game area or buffer.
126 \end_layout
128 \begin_layout Subsection
129 Drawing and contexts
130 \end_layout
132 \begin_layout Itemize
133 Methods that draw something (unless stated otherwise) require a valid rendering
134  context.
135  This context can come in three ways:
136 \end_layout
138 \begin_deeper
139 \begin_layout Enumerate
140 The default rendering context of paint callback (the screen).
141 \end_layout
143 \begin_layout Enumerate
144 The default rendering context of video callback (the video).
145 \end_layout
147 \begin_layout Enumerate
148 Explicitly set rendering context (RENDERCTX:set).
149 \end_layout
151 \end_deeper
152 \begin_layout Itemize
153 The rendering context is always reset when callback ends.
154 \end_layout
156 \begin_layout Subsection
157 Colors
158 \end_layout
160 \begin_layout Standard
161 (Direct) colors can be specified either as numbers or strings.
162 \end_layout
164 \begin_layout Itemize
165 -1 is fully transparent.
166 \end_layout
168 \begin_layout Itemize
169 Non-negative numbers less than 
170 \begin_inset Formula $2^{32}$
171 \end_inset
173  are partially opaque colors (
174 \begin_inset Formula $a*2^{24}+r*2^{16}+g*2^{8}+b$
175 \end_inset
178 \end_layout
180 \begin_deeper
181 \begin_layout Itemize
182 \begin_inset Formula $a$
183 \end_inset
185  is transparency 
186 \begin_inset Formula $0-255$
187 \end_inset
190 \begin_inset Formula $0$
191 \end_inset
193  is fully opaque, 
194 \begin_inset Formula $256$
195 \end_inset
197  would be fully transparent.
198 \end_layout
200 \begin_deeper
201 \begin_layout Itemize
202 Thus, numbers in range 
203 \begin_inset Formula $0-16777215$
204 \end_inset
206  stand for fully opaque colors.
207 \end_layout
209 \end_deeper
210 \begin_layout Itemize
211 \begin_inset Formula $r$
212 \end_inset
215 \begin_inset Formula $g$
216 \end_inset
218  and 
219 \begin_inset Formula $b$
220 \end_inset
222  are intensities of base colors on scale 
223 \begin_inset Formula $0-255$
224 \end_inset
227 \end_layout
229 \end_deeper
230 \begin_layout Itemize
231 Color can also be specified by name as string: The following color names
232  are known: aliceblue antiquewhite antiquewhite1 antiquewhite2 antiquewhite3
233  antiquewhite4 aqua aquamarine aquamarine1 aquamarine2 aquamarine3 aquamarine4
234  azure azure1 azure2 azure3 azure4 beige bisque bisque1 bisque2 bisque3
235  bisque4 black blanchedalmond blue blue1 blue2 blue3 blue4 blueviolet brown
236  brown1 brown2 brown3 brown4 burlywood burlywood1 burlywood2 burlywood3
237  burlywood4 cadet cadetblue cadetblue1 cadetblue2 cadetblue3 cadetblue4
238  chartreuse chartreuse1 chartreuse2 chartreuse3 chartreuse4 chocolate chocolate1
239  chocolate2 chocolate3 chocolate4 coral coral1 coral2 coral3 coral4 cornflowerbl
240 ue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4 crimson cyan cyan1 cyan2
241  cyan3 cyan4 darkblue darkcyan darkgoldenrod darkgoldenrod1 darkgoldenrod2
242  darkgoldenrod3 darkgoldenrod4 darkgray darkgreen darkgrey darkkhaki darkmagenta
243  darkolivegreen darkolivegreen1 darkolivegreen2 darkolivegreen3 darkolivegreen4
244  darkorange darkorange1 darkorange2 darkorange3 darkorange4 darkorchid darkorchi
245 d1 darkorchid2 darkorchid3 darkorchid4 darkred darksalmon darkseagreen darkseagr
246 een1 darkseagreen2 darkseagreen3 darkseagreen4 darkslateblue darkslategray
247  darkslategray1 darkslategray2 darkslategray3 darkslategray4 darkslategrey
248  darkturquoise darkviolet deeppink deeppink1 deeppink2 deeppink3 deeppink4
249  deepskyblue deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4 dimgray
250  dimgrey dodgerblue dodgerblue1 dodgerblue2 dodgerblue3 dodgerblue4 firebrick
251  firebrick1 firebrick2 firebrick3 firebrick4 floralwhite forestgreen fractal
252  fuchsia gainsboro ghostwhite gold gold1 gold2 gold3 gold4 goldenrod goldenrod1
253  goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100 gray11
254  gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2 gray20 gray21
255  gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3 gray30 gray31
256  gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4 gray40 gray41
257  gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5 gray50 gray51
258  gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6 gray60 gray61
259  gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7 gray70 gray71
260  gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8 gray80 gray81
261  gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9 gray90 gray91
262  gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green green1 green2
263  green3 green4 greenyellow grey grey0 grey1 grey10 grey100 grey11 grey12
264  grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2 grey20 grey21 grey22
265  grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3 grey30 grey31 grey32
266  grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4 grey40 grey41 grey42
267  grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5 grey50 grey51 grey52
268  grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6 grey60 grey61 grey62
269  grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7 grey70 grey71 grey72
270  grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8 grey80 grey81 grey82
271  grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9 grey90 grey91 grey92
272  grey93 grey94 grey95 grey96 grey97 grey98 grey99 honeydew honeydew1 honeydew2
273  honeydew3 honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4 indianred
274  indianred1 indianred2 indianred3 indianred4 indigo ivory ivory1 ivory2
275  ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4 lavender lavenderblush
276  lavenderblush1 lavenderblush2 lavenderblush3 lavenderblush4 lawngreen lemonchif
277 fon lemonchiffon1 lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue lightblue1
278  lightblue2 lightblue3 lightblue4 lightcoral lightcyan lightcyan1 lightcyan2
279  lightcyan3 lightcyan4 lightgoldenrod lightgoldenrod1 lightgoldenrod2 lightgolde
280 nrod3 lightgoldenrod4 lightgoldenrodyellow lightgray lightgreen lightgrey
281  lightpink lightpink1 lightpink2 lightpink3 lightpink4 lightsalmon lightsalmon1
282  lightsalmon2 lightsalmon3 lightsalmon4 lightseagreen lightskyblue lightskyblue1
283  lightskyblue2 lightskyblue3 lightskyblue4 lightslateblue lightslategray
284  lightslategrey lightsteelblue lightsteelblue1 lightsteelblue2 lightsteelblue3
285  lightsteelblue4 lightyellow lightyellow1 lightyellow2 lightyellow3 lightyellow4
286  lime limegreen linen magenta magenta1 magenta2 magenta3 magenta4 maroon
287  maroon1 maroon2 maroon3 maroon4 mediumaquamarine mediumblue mediumforestgreen
288  mediumgoldenrod mediumorchid mediumorchid1 mediumorchid2 mediumorchid3
289  mediumorchid4 mediumpurple mediumpurple1 mediumpurple2 mediumpurple3 mediumpurp
290 le4 mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumviole
291 tred midnightblue mintcream mistyrose mistyrose1 mistyrose2 mistyrose3 mistyrose
292 4 moccasin navajowhite navajowhite1 navajowhite2 navajowhite3 navajowhite4
293  navy navyblue oldlace olive olivedrab olivedrab1 olivedrab2 olivedrab3
294  olivedrab4 orange orange1 orange2 orange3 orange4 orangered orangered1
295  orangered2 orangered3 orangered4 orchid orchid1 orchid2 orchid3 orchid4
296  palegoldenrod palegreen palegreen1 palegreen2 palegreen3 palegreen4 paleturquoi
297 se paleturquoise1 paleturquoise2 paleturquoise3 paleturquoise4 palevioletred
298  palevioletred1 palevioletred2 palevioletred3 palevioletred4 papayawhip
299  peachpuff peachpuff1 peachpuff2 peachpuff3 peachpuff4 peru pink pink1 pink2
300  pink3 pink4 plum plum1 plum2 plum3 plum4 powderblue purple purple1 purple2
301  purple3 purple4 red red1 red2 red3 red4 rosybrown rosybrown1 rosybrown2
302  rosybrown3 rosybrown4 royalblue royalblue1 royalblue2 royalblue3 royalblue4
303  saddlebrown salmon salmon1 salmon2 salmon3 salmon4 sandybrown seagreen
304  seagreen1 seagreen2 seagreen3 seagreen4 seashell seashell1 seashell2 seashell3
305  seashell4 sienna sienna1 sienna2 sienna3 sienna4 silver skyblue skyblue1
306  skyblue2 skyblue3 skyblue4 slateblue slateblue1 slateblue2 slateblue3 slateblue
307 4 slategray slategray1 slategray2 slategray3 slategray4 slategrey snow snow1
308  snow2 snow3 snow4 springgreen springgreen1 springgreen2 springgreen3 springgree
309 n4 steelblue steelblue1 steelblue2 steelblue3 steelblue4 tan tan1 tan2 tan3
310  tan4 teal thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2
311  tomato3 tomato4 transparent turquoise turquoise1 turquoise2 turquoise3
312  turquoise4 violet violetred violetred1 violetred2 violetred3 violetred4
313  wheat wheat1 wheat2 wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
314  yellow3 yellow4 yellowgreen 
315 \end_layout
317 \begin_layout Itemize
318 The HSL base color names: hsl-<hue><saturation><lightness>.
319 \end_layout
321 \begin_deeper
322 \begin_layout Itemize
323 Hue can be one of: r (red), ry (red-yellow), o (orange, same as red-yellow),
324  y (yellow), yg (yellow-green), g (green), gc (green-cyan), c (cyan), cb
325  (cyan-blue), b (blue), bm (blue-magenta), m (magenta), mr (magenta-red).
326 \end_layout
328 \begin_layout Itemize
329 Saturation is 0-8, where 0 is greyscale and 8 is fully saturated.
330 \end_layout
332 \begin_layout Itemize
333 Lightness is 0-8, where 0 is black and 8 is white.
334 \end_layout
336 \end_deeper
337 \begin_layout Itemize
338 The color names can have a modifier after space (multiple modifiers are
339  allowed, separated by spaces): opaque10, opaque20, opaque25, opaque30,
340  opaque40, opaque50, opaque60, opaque70, opaque75, opaque80, opaque90, opaque,
341  hue{+,-}{1-23}, {saturation,lightness}{+,-}{1-16}.
342 \end_layout
344 \begin_deeper
345 \begin_layout Itemize
346 opaqueness is measured as percentage.
347 \end_layout
349 \begin_layout Itemize
350 Hue adjustments are on 24-step scale.
351 \end_layout
353 \begin_layout Itemize
354 Saturation and lightness adjustments are on 16-step scale.
355 \end_layout
357 \end_deeper
358 \begin_layout Section
359 Special tokens
360 \end_layout
362 \begin_layout Standard
363 These tokens are special, and are expanded while the script is being loaded
364 \end_layout
366 \begin_layout Subsection
367 @@LUA_SCRIPT_FILENAME@@
368 \end_layout
370 \begin_layout Standard
371 Expanded to string token containing path and filename of this Lua script.
372  Handy for referencing other lua scripts or resources that are relative
373  to this Lua script.
374 \end_layout
376 \begin_layout Standard
377 In practicular, this is suitable to be passed as base argument of various
378  functions like loadfile, dofile, resolve_filename, gui.bitmap_load, gui.bitmap_lo
379 ad_png and gui.bitmap_load_pal.
380 \end_layout
382 \begin_layout Section
383 Classes
384 \end_layout
386 \begin_layout Subsection
387 MMAP_STRUCT: Quasi-table mapping emulated memory
388 \end_layout
390 \begin_layout Standard
391 Objects act like tables, but the values reflect emulated memory.
392 \end_layout
394 \begin_layout Subsubsection
395 static function new: Create a new instance
396 \end_layout
398 \begin_layout Itemize
399 Syntax: mmap memory.mmap.new()
400 \end_layout
402 \begin_layout Itemize
403 Syntax: mmap classes.MMAP_STRUCT.new()
404 \end_layout
406 \begin_layout Standard
407 Return value:
408 \end_layout
410 \begin_layout Itemize
411 mmap: MMAP_STRUCT: The created mmap structure.
412 \end_layout
414 \begin_layout Standard
415 Create a new object (with no mappings) and return it.
416 \end_layout
418 \begin_layout Subsubsection
419 operator(): Bind key in mmap structure
420 \end_layout
422 \begin_layout Itemize
423 Syntax: obj(key, {marea, address|addrobj}, type)
424 \end_layout
426 \begin_layout Standard
427 Parameters:
428 \end_layout
430 \begin_layout Itemize
431 obj: MMAP_STRUCT: The structure to manipulate.
432 \end_layout
434 \begin_layout Itemize
435 key: String: The name of the key in array to map.
436 \end_layout
438 \begin_layout Itemize
439 marea: String: The memory area the mapped address is in (default: global
440  memory space).
441 \end_layout
443 \begin_layout Itemize
444 address: Number: The offset of memory addreess, relative to specified memory
445  area or global memory space.
446 \end_layout
448 \begin_layout Itemize
449 addrobj: ADDRESS: The memory address.
450 \end_layout
452 \begin_layout Itemize
453 type: String: The type of data to map.
454 \end_layout
456 \begin_deeper
457 \begin_layout Itemize
458 One of: byte, sbyte, word, sword, hword, shword, dword, sdword, qword, sqword,
459  float or double.
460 \end_layout
462 \end_deeper
463 \begin_layout Standard
464 Bind key <key> in mmap structure <obj> to address <address> (relative to
465  <marea>).
466  The memory address is treated as type <type>.
467 \end_layout
469 \begin_layout Itemize
470 Example: foomap(
471 \begin_inset Quotes eld
472 \end_inset
475 \begin_inset Quotes erd
476 \end_inset
479 \begin_inset Quotes eld
480 \end_inset
482 WRAM
483 \begin_inset Quotes erd
484 \end_inset
486 , 0x2A, 
487 \begin_inset Quotes eld
488 \end_inset
490 sword
491 \begin_inset Quotes erd
492 \end_inset
495 \end_layout
497 \begin_layout Standard
498 This binds signed word at address WRAM+0x2A into key 
499 \begin_inset Quotes eld
500 \end_inset
503 \begin_inset Quotes erd
504 \end_inset
507 \end_layout
509 \begin_layout Standard
510 \begin_inset Newpage pagebreak
511 \end_inset
514 \end_layout
516 \begin_layout Subsection
517 ZIPWRITER: Write .zip files
518 \end_layout
520 \begin_layout Standard
521 This class does writing of .zip files.
522 \end_layout
524 \begin_layout Subsubsection
525 Static function new: Create a new zipfile
526 \end_layout
528 \begin_layout Itemize
529 Syntax: zip zip.writer.new(filename, [compression])
530 \end_layout
532 \begin_layout Itemize
533 Deprecated: zip zip.create(filename, [compression])
534 \end_layout
536 \begin_layout Standard
537 Parameters:
538 \end_layout
540 \begin_layout Itemize
541 filename: string: The name of the file to write.
542 \end_layout
544 \begin_layout Itemize
545 compression: number: Compression level (0-9).
546  Default is 9.
547 \end_layout
549 \begin_layout Standard
550 Return value:
551 \end_layout
553 \begin_layout Itemize
554 zip: ZIPWRITER: The newly created ZIP writer.
555 \end_layout
557 \begin_layout Standard
558 Create a new ZIPWRITER object and return it.
559 \end_layout
561 \begin_layout Subsubsection
562 Method commit: Finish creating ZIP file.
563 \end_layout
565 \begin_layout Itemize
566 Syntax: zipfile:commit()
567 \end_layout
569 \begin_layout Standard
570 Parameters:
571 \end_layout
573 \begin_layout Itemize
574 zipfile: ZIPFILE: The ZIP file object.
575 \end_layout
577 \begin_layout Standard
578 Finish writing the ZIP file and actually create it on disk.
579 \end_layout
581 \begin_layout Itemize
582 If a member is currently open, it is implicitly closed.
583 \end_layout
585 \begin_layout Itemize
586 Invoking this on already committed or rolled back zipfile causes an error.
587 \end_layout
589 \begin_layout Subsubsection
590 Method rollback: Cancel writing the ZIP file.
591 \end_layout
593 \begin_layout Itemize
594 Syntax: zipfile:rollback()
595 \end_layout
597 \begin_layout Standard
598 Parameters:
599 \end_layout
601 \begin_layout Itemize
602 zipfile: ZIPFILE: The ZIP file object.
603 \end_layout
605 \begin_layout Standard
606 Cancel writing the whole ZIP file.
607  The file on disk will not be modified.
608 \end_layout
610 \begin_layout Itemize
611 If a member is currently open, it is implicitly closed.
612 \end_layout
614 \begin_layout Itemize
615 Invoking this on already committed or rolled back zipfile causes an error.
616 \end_layout
618 \begin_layout Subsubsection
619 Method create_file: Start writing a new member
620 \end_layout
622 \begin_layout Itemize
623 Syntax: zipfile:create_file(filename)
624 \end_layout
626 \begin_layout Standard
627 Parameters:
628 \end_layout
630 \begin_layout Itemize
631 zipfile: ZIPFILE: The ZIP file object.
632 \end_layout
634 \begin_layout Itemize
635 string filename: Name of the new member to create
636 \end_layout
638 \begin_layout Standard
639 Start writing a new member <filename> in ZIP file.
640 \end_layout
642 \begin_layout Itemize
643 If a member is currently open, it is implicitly closed.
644 \end_layout
646 \begin_layout Itemize
647 Invoking this on already committed or rolled back zipfile causes an error.
648 \end_layout
650 \begin_layout Subsubsection
651 Method close_file: Close member
652 \end_layout
654 \begin_layout Itemize
655 Syntax: zipfile:close_file()
656 \end_layout
658 \begin_layout Standard
659 Parameters:
660 \end_layout
662 \begin_layout Itemize
663 zipfile: ZIPFILE: The ZIP file object.
664 \end_layout
666 \begin_layout Standard
667 Close the currently open member in zipfile.
668 \end_layout
670 \begin_layout Itemize
671 Invoking this on already committed or rolled back zipfile causes an error.
672 \end_layout
674 \begin_layout Itemize
675 Invoking this without an open member causes an error.
676 \end_layout
678 \begin_layout Subsubsection
679 Method write: Write data
680 \end_layout
682 \begin_layout Itemize
683 Syntax: zipfile:write(data)
684 \end_layout
686 \begin_layout Standard
687 Parameters:
688 \end_layout
690 \begin_layout Itemize
691 zipfile: ZIPFILE: The ZIP file object.
692 \end_layout
694 \begin_layout Itemize
695 data: string: The data to write.
696 \end_layout
698 \begin_layout Standard
699 Write <data> in binary mode (as-is) to currently open member.
700 \end_layout
702 \begin_layout Itemize
703 Invoking this without a member being open causes an error.
704 \end_layout
706 \begin_layout Standard
707 \begin_inset Newpage pagebreak
708 \end_inset
711 \end_layout
713 \begin_layout Subsection
714 TILEMAP: Tiled collection of bitmaps.
715 \end_layout
717 \begin_layout Standard
718 A tilemap is tiled table, each cell holding a bitmap (indexed or direct).
719 \end_layout
721 \begin_layout Subsubsection
722 Static function new: Create a tilemap
723 \end_layout
725 \begin_layout Itemize
726 Syntax: tilemap gui.tiled_bitmap.new(w, h, bw, bh);
727 \end_layout
729 \begin_layout Itemize
730 Syntax: tilemap classes.TILEMAP.new(w, h, bw, bh);
731 \end_layout
733 \begin_layout Itemize
734 Deprecated: tilemap gui.tilemap(w, h, bw, bh);
735 \end_layout
737 \begin_layout Standard
738 Parameters:
739 \end_layout
741 \begin_layout Itemize
742 w: number: Width of the tilemap in tiles
743 \end_layout
745 \begin_layout Itemize
746 h: number: Height of the tilemap in tiles
747 \end_layout
749 \begin_layout Itemize
750 bw: number: Width of each tile in pixels.
751 \end_layout
753 \begin_layout Itemize
754 bh: number: Height of each tile in pixels.
755 \end_layout
757 \begin_layout Standard
758 Return value:
759 \end_layout
761 \begin_layout Itemize
762 tilemap: TILEMAP: the newly created tilemap
763 \end_layout
765 \begin_layout Standard
766 Create a new tilemap of <w>*<h> tiles, each of <bw>*<bh> pixels and return
767  it.
768 \end_layout
770 \begin_layout Subsubsection
771 TILEMAP:getsize: Query tilemap size
772 \end_layout
774 \begin_layout Itemize
775 Syntax: width, height tmap:getsize()
776 \end_layout
778 \begin_layout Standard
779 Parameters:
780 \end_layout
782 \begin_layout Itemize
783 tmap: TILEMAP: The tilemap to query.
784 \end_layout
786 \begin_layout Standard
787 Return value:
788 \end_layout
790 \begin_layout Itemize
791 width: number : The width of the tilemap in tiles.
792 \end_layout
794 \begin_layout Itemize
795 height: number: The height of the tilemap in tiles.
796 \end_layout
798 \begin_layout Standard
799 Get size of tilemap in tiles.
800 \end_layout
802 \begin_layout Subsubsection
803 TILEMAP:getcsize: Query tilemap cell size
804 \end_layout
806 \begin_layout Itemize
807 Syntax: width, height tmap:getcsize()
808 \end_layout
810 \begin_layout Standard
811 Parameters:
812 \end_layout
814 \begin_layout Itemize
815 tmap: TILEMAP: The tilemap to query.
816 \end_layout
818 \begin_layout Standard
819 Return value:
820 \end_layout
822 \begin_layout Itemize
823 width: number: The width of tilemap tile in pixels.
824 \end_layout
826 \begin_layout Itemize
827 height: number: The height of tilemap tile in pixels.
828 \end_layout
830 \begin_layout Standard
831 Get size of each tilemap tile in pixels.
832 \end_layout
834 \begin_layout Subsubsection
835 TILEMAP:get: Query tilemap tile
836 \end_layout
838 \begin_layout Itemize
839 Syntax: bitmap, palette tmap:get(x, y)
840 \end_layout
842 \begin_layout Standard
843 Parameters:
844 \end_layout
846 \begin_layout Itemize
847 tmap: TILEMAP: The tilemap to query.
848 \end_layout
850 \begin_layout Itemize
851 x: number: The x-coordinate of tile to query.
852 \end_layout
854 \begin_layout Itemize
855 y: number: The y-coordinate of tile to query.
856 \end_layout
858 \begin_layout Standard
859 Return value:
860 \end_layout
862 \begin_layout Itemize
863 bitmap: The associated bitmap (BITMAP or DBITMAP), or nil if none.
864 \end_layout
866 \begin_layout Itemize
867 palette: The palette (PALETTE) associated with indexed-color bitmap, if
868  any.
869  Otherwise nil.
870 \end_layout
872 \begin_layout Standard
873 Return the contents of tile at <x>,<y>.
874 \end_layout
876 \begin_layout Subsubsection
877 TILEMAP:set: Set tilemap cell
878 \end_layout
880 \begin_layout Itemize
881 Syntax: tmap:set(x, y)
882 \end_layout
884 \begin_layout Itemize
885 Syntax: tmap:set(x, y, bitmap)
886 \end_layout
888 \begin_layout Itemize
889 Syntax: tmap:set(x, y, bitmap, palette)
890 \end_layout
892 \begin_layout Standard
893 Parameters:
894 \end_layout
896 \begin_layout Itemize
897 tmap: TILEMAP: The tilemap to manipulate.
898 \end_layout
900 \begin_layout Itemize
901 number x: The x-coordinate of tile to set.
902 \end_layout
904 \begin_layout Itemize
905 number y: The y-coordinate of tile to set.
906 \end_layout
908 \begin_layout Itemize
909 bitmap: BITMAP/DBITMAP: The bitmap to set to tile.
910 \end_layout
912 \begin_layout Itemize
913 palette: PALETTE: The associated palette for bitmap.
914 \end_layout
916 \begin_layout Standard
917 Set the contents of tile <x>,<y>.
918  If no <bitmap> is given, clears the tile.
919  Otherwise sets the tile to contain bitmap <bitmap> with associated palette
920  <palette>.
921 \end_layout
923 \begin_layout Itemize
924 Specifying index bitmap <bitmap> without palette <palette> causes an error.
925 \end_layout
927 \begin_layout Subsubsection
928 TILEMAP:scroll: Scroll tilemap
929 \end_layout
931 \begin_layout Itemize
932 Syntax: tmap:scroll(ox, oy);
933 \end_layout
935 \begin_layout Itemize
936 Syntax: tmap:scroll(ox, oy, x, y, w, h);
937 \end_layout
939 \begin_layout Itemize
940 Syntax: tmap:scroll(ox, oy, x, y, w, h, circ_x, circ_y);
941 \end_layout
943 \begin_layout Standard
944 Parameters:
945 \end_layout
947 \begin_layout Itemize
948 tmap: TILEMAP: The tilemap to manipulate.
949 \end_layout
951 \begin_layout Itemize
952 ox: number: The number of tiles to scroll horizontally (positive is to right).
953 \end_layout
955 \begin_layout Itemize
956 oy: number: The number of tiles to scroll vertically (positive is to down).
957 \end_layout
959 \begin_layout Itemize
960 x: number: The left edge of scroll window.
961 \end_layout
963 \begin_layout Itemize
964 y: number: The top edge of scroll window.
965 \end_layout
967 \begin_layout Itemize
968 w: number: The width of scroll window.
969 \end_layout
971 \begin_layout Itemize
972 h: number: The height of scroll window.
973 \end_layout
975 \begin_layout Itemize
976 circ_x: boolean: If true, treat the window as circular in horizontal direction.
977 \end_layout
979 \begin_layout Itemize
980 circ_y: boolean: If true, treat the window as circular in vertical direction.
981 \end_layout
983 \begin_layout Standard
984 Scroll the specified tilemap <tmap> by <ox>,<oy>.
985  If a window <x>,<y>,<w>,<h> is specified, only that part is scrolled.
986  <circ_x> and <circ_y> control if scroll is circular or not.
987 \end_layout
989 \begin_layout Itemize
990 Specifying out-of-range window causes an error.
991 \end_layout
993 \begin_layout Subsubsection
994 TILEMAP:draw: Draw tilemap
995 \end_layout
997 \begin_layout Itemize
998 Name: tmap:draw(x, y)
999 \end_layout
1001 \begin_layout Itemize
1002 Name: tmap:draw(x, y, x0, y0, w, h)
1003 \end_layout
1005 \begin_layout Standard
1006 Parameters:
1007 \end_layout
1009 \begin_layout Itemize
1010 tmap: TILEMAP: The tilemap to draw.
1011 \end_layout
1013 \begin_layout Itemize
1014 x: The x coordinate on screen to draw to.
1015 \end_layout
1017 \begin_layout Itemize
1018 y: The y coordinate on screen to draw to.
1019 \end_layout
1021 \begin_layout Itemize
1022 x0: number: The x coordinate on tilemap (in pixels) to start drawing from.
1023 \end_layout
1025 \begin_layout Itemize
1026 y0: number: The y coordinate on tilemap (in pixels) to start drawing from.
1027 \end_layout
1029 \begin_layout Itemize
1030 w: number: The width to draw (in pixels).
1031 \end_layout
1033 \begin_layout Itemize
1034 h: number: The height to draw (in pixels).
1035 \end_layout
1037 \begin_layout Standard
1038 Draw tilemap <tmap> to screen at <x>,<y>.
1039  If a window <x0>,<y0>,<w>,<h> is specified, only that part is drawn.
1040 \end_layout
1042 \begin_layout Itemize
1043 This method requires a rendering context to work.
1044 \end_layout
1046 \begin_layout Subsubsection
1047 TILEMAP:draw_outside: Draw tilemap outside game area
1048 \end_layout
1050 \begin_layout Itemize
1051 Name: tmap:draw_outside(x, y)
1052 \end_layout
1054 \begin_layout Itemize
1055 Name: tmap:draw_outside(x, y, x0, y0, w, h)
1056 \end_layout
1058 \begin_layout Standard
1059 Like TILEMAP:draw, but draws only outside game area.
1060 \end_layout
1062 \begin_layout Standard
1063 \begin_inset Newpage pagebreak
1064 \end_inset
1067 \end_layout
1069 \begin_layout Subsection
1070 RENDERCTX: Off-screen rendering context
1071 \end_layout
1073 \begin_layout Standard
1074 Object acting as off-screen rendering context.
1075 \end_layout
1077 \begin_layout Subsubsection
1078 Static function new: Create a render queue
1079 \end_layout
1081 \begin_layout Itemize
1082 Syntax: renderctx gui.renderctx.new(width, height);
1083 \end_layout
1085 \begin_layout Itemize
1086 Syntax: renderctx classes.RENDERCTX.new(width, height);
1087 \end_layout
1089 \begin_layout Itemize
1090 Deprecated: renderctx gui.renderq_new(width, height);
1091 \end_layout
1093 \begin_layout Standard
1094 Parameters:
1095 \end_layout
1097 \begin_layout Itemize
1098 width: number: The notional width of the game area.
1099 \end_layout
1101 \begin_layout Itemize
1102 height: number: The notional height of the game area.
1103 \end_layout
1105 \begin_layout Standard
1106 Returns:
1107 \end_layout
1109 \begin_layout Itemize
1110 rendectx: RENDERCTX: The newly created render context.
1111 \end_layout
1113 \begin_layout Standard
1114 Create a render context with reported size <width>*<height> and return it.
1115 \end_layout
1117 \begin_layout Subsubsection
1118 Static function setnull: Reset to default queue
1119 \end_layout
1121 \begin_layout Itemize
1122 Syntax: gui.renderctx.setnull()
1123 \end_layout
1125 \begin_layout Itemize
1126 Syntax: classes.RENDERCTX:setnull()
1127 \end_layout
1129 \begin_layout Itemize
1130 Deprecated: gui.renderq_set()
1131 \end_layout
1133 \begin_layout Standard
1134 Reset the used render context back to default for the executing callback:
1135 \end_layout
1137 \begin_layout Itemize
1138 The default for paint callback is the screen
1139 \end_layout
1141 \begin_layout Itemize
1142 The default for video callback is the video frame
1143 \end_layout
1145 \begin_layout Itemize
1146 The default otherwise is nothing.
1147 \end_layout
1149 \begin_layout Subsubsection
1150 Method clear: Clear a render queue
1151 \end_layout
1153 \begin_layout Itemize
1154 Syntax: renderctx:clear()
1155 \end_layout
1157 \begin_layout Itemize
1158 Deprecated: gui.renderq_clear(renderctx)
1159 \end_layout
1161 \begin_layout Standard
1162 Parameters:
1163 \end_layout
1165 \begin_layout Itemize
1166 renderctx: RENDERCTX: The render queue to clear.
1167 \end_layout
1169 \begin_layout Standard
1170 Clear all drawing from the context.
1171 \end_layout
1173 \begin_layout Subsubsection
1174 Method set: Change active render context
1175 \end_layout
1177 \begin_layout Itemize
1178 Syntax: renderctx:set()
1179 \end_layout
1181 \begin_layout Itemize
1182 Deprecated: gui.renderq_set(renderctx)
1183 \end_layout
1185 \begin_layout Standard
1186 Parameters:
1187 \end_layout
1189 \begin_layout Itemize
1190 renderctx: RENDERCTX: The render queue to use.
1191 \end_layout
1193 \begin_layout Standard
1194 Switch the current rendering context <renderctx>.
1195 \end_layout
1197 \begin_layout Subsubsection
1198 Method run: Draw all objects in context to another
1199 \end_layout
1201 \begin_layout Itemize
1202 Syntax: renderctx:run()
1203 \end_layout
1205 \begin_layout Itemize
1206 Deprecated: gui.renderq_run(renderctx)
1207 \end_layout
1209 \begin_layout Standard
1210 Parameters:
1211 \end_layout
1213 \begin_layout Itemize
1214 renderctx: RENDERCTX: The render context to overlay.
1215 \end_layout
1217 \begin_layout Standard
1218 Overlay the specified render context <context> upon the active rendering
1219  context.
1220 \end_layout
1222 \begin_layout Itemize
1223 Trying to overlay rendering context upon itself is a bad idea.
1224 \end_layout
1226 \begin_layout Subsubsection
1227 Method render: Render a contex to bitmap
1228 \end_layout
1230 \begin_layout Itemize
1231 Syntax: bitmap renderctx:render()
1232 \end_layout
1234 \begin_layout Standard
1235 Parameters:
1236 \end_layout
1238 \begin_layout Itemize
1239 renderctx: RENDERCTX: The context to render.
1240 \end_layout
1242 \begin_layout Standard
1243 Returns:
1244 \end_layout
1246 \begin_layout Itemize
1247 bitmap: DBITMAP: The rendered bitmap.
1248 \end_layout
1250 \begin_layout Standard
1251 Render the specified context <renderctx> to a new bitmap.
1252 \end_layout
1254 \begin_layout Itemize
1255 The size of bitmap will be nominal game area size, plus any set gaps.
1256 \end_layout
1258 \begin_layout Itemize
1259 This method does not require active rendering context.
1260 \end_layout
1262 \begin_layout Subsubsection
1263 Method synchronous_repaint: Paint screen now
1264 \end_layout
1266 \begin_layout Itemize
1267 Syntax: renderctx:synchronous_repaint()
1268 \end_layout
1270 \begin_layout Itemize
1271 Deprecated: gui.synchronous_repaint(renderctx)
1272 \end_layout
1274 \begin_layout Standard
1275 Parameters:
1276 \end_layout
1278 \begin_layout Itemize
1279 renderctx: RENDERCTX: The context to paint.
1280 \end_layout
1282 \begin_layout Standard
1283 Immediately redraw the screen with game overlayed by drawings from context
1284  <renderctx>.
1285 \end_layout
1287 \begin_layout Itemize
1288 This does not require active rendering context.
1289 \end_layout
1291 \begin_layout Itemize
1292 Will not cause paint callback to be invoked.
1293 \end_layout
1295 \begin_layout Standard
1296 \begin_inset Newpage pagebreak
1297 \end_inset
1300 \end_layout
1302 \begin_layout Subsection
1303 PALETTE: Color palette for indexed image
1304 \end_layout
1306 \begin_layout Subsubsection
1307 Static function new: Create a new palette
1308 \end_layout
1310 \begin_layout Itemize
1311 Syntax: palette gui.palette.new()
1312 \end_layout
1314 \begin_layout Itemize
1315 Syntax: palette classes.PALETTE.new()
1316 \end_layout
1318 \begin_layout Itemize
1319 Deprecated: palette gui.palette_new()
1320 \end_layout
1322 \begin_layout Standard
1323 Returns:
1324 \end_layout
1326 \begin_layout Itemize
1327 palette: PALETTE: The created palette.
1328 \end_layout
1330 \begin_layout Standard
1331 Create a new palette (with all colors transparent) and return it.
1332 \end_layout
1334 \begin_layout Subsubsection
1335 Static function load: Load a palette
1336 \end_layout
1338 \begin_layout Itemize
1339 Syntax: palette gui.palette.load(file, [base])
1340 \end_layout
1342 \begin_layout Itemize
1343 Syntax: palette classes.PALETTE.load(file, [base])
1344 \end_layout
1346 \begin_layout Itemize
1347 Deprecated: palette gui.palette_load(file, [base])
1348 \end_layout
1350 \begin_layout Standard
1351 Parameters:
1352 \end_layout
1354 \begin_layout Itemize
1355 string file: The file to load.
1356 \end_layout
1358 \begin_layout Itemize
1359 string base (optional): The base file to resolve file relative to.
1360 \end_layout
1362 \begin_layout Standard
1363 Returns:
1364 \end_layout
1366 \begin_layout Itemize
1367 palette: PALETTE: The loaded palette.
1368 \end_layout
1370 \begin_layout Standard
1371 Load a palette from file <file> (resolved relative to <base>).
1372 \end_layout
1374 \begin_layout Itemize
1375 The file format is a series of lines, each with following format:
1376 \end_layout
1378 \begin_deeper
1379 \begin_layout Itemize
1380 Blank or just whitespace: Ignored
1381 \end_layout
1383 \begin_layout Itemize
1384 First non-whitespace is '#': Ignored
1385 \end_layout
1387 \begin_layout Itemize
1388 <r> <g> <b>: Fully opaque color with specified RGB values (0-255)
1389 \end_layout
1391 \begin_layout Itemize
1392 <r> <g> <b> <a>: Color with specified RGB values (0-255) and specified alpha
1393  (0-256, 0 being fully transparent and 256 fully opaque).
1394 \end_layout
1396 \begin_layout Itemize
1397 transparent: Fully transparent color
1398 \end_layout
1400 \end_deeper
1401 \begin_layout Subsubsection
1402 Static function load_str: Load a palette from string
1403 \end_layout
1405 \begin_layout Itemize
1406 Syntax: palette gui.palette.load(data)
1407 \end_layout
1409 \begin_layout Itemize
1410 Syntax: palette classes.PALETTE.load(data)
1411 \end_layout
1413 \begin_layout Itemize
1414 Deprecated: palette gui.palette_load(data)
1415 \end_layout
1417 \begin_layout Standard
1418 Parameters:
1419 \end_layout
1421 \begin_layout Itemize
1422 string data: The palette data.
1423 \end_layout
1425 \begin_layout Standard
1426 Returns:
1427 \end_layout
1429 \begin_layout Itemize
1430 palette: PALETTE: The loaded palette.
1431 \end_layout
1433 \begin_layout Standard
1434 Like PALETTE:load, but instead of reading palette from file, reads it from
1435  a string.
1436 \end_layout
1438 \begin_layout Subsubsection
1439 Method set: Set palette entry
1440 \end_layout
1442 \begin_layout Itemize
1443 Syntax: palette:set(index, color)
1444 \end_layout
1446 \begin_layout Itemize
1447 Deprecated: gui.palette_set(palette, ...)
1448 \end_layout
1450 \begin_layout Standard
1451 Parameters:
1452 \end_layout
1454 \begin_layout Itemize
1455 palette: PALETTE: The palette to manipulate
1456 \end_layout
1458 \begin_layout Itemize
1459 index: number: The index of color to set (0-65535).
1460 \end_layout
1462 \begin_layout Itemize
1463 color: number/string: The color value to set.
1464 \end_layout
1466 \begin_layout Standard
1467 Set palette <palette> index <index> to color <color>.
1468 \end_layout
1470 \begin_layout Subsubsection
1471 Method hash: Hash a palette
1472 \end_layout
1474 \begin_layout Itemize
1475 Syntax: hash palette:hash()
1476 \end_layout
1478 \begin_layout Itemize
1479 Deprecated: hash gui.palette_hash(palette)
1480 \end_layout
1482 \begin_layout Standard
1483 Parameters:
1484 \end_layout
1486 \begin_layout Itemize
1487 palette: The palette to hash.
1488 \end_layout
1490 \begin_layout Standard
1491 Return value:
1492 \end_layout
1494 \begin_layout Itemize
1495 hash: string: 64-hex digit hash.
1496 \end_layout
1498 \begin_layout Standard
1499 Obtain crypto-grade hash of palette data of <palette>.
1500 \end_layout
1502 \begin_layout Itemize
1503 All colors after the last non-transparent one are ignored.
1504 \end_layout
1506 \begin_layout Subsubsection
1507 Method adjust_transparency: Adjust transparency
1508 \end_layout
1510 \begin_layout Itemize
1511 Syntax: palette:adjust_transparency(newvalue)
1512 \end_layout
1514 \begin_layout Itemize
1515 Deprecated: gui.adjust_transparency(palette, ...)
1516 \end_layout
1518 \begin_layout Standard
1519 Parameters:
1520 \end_layout
1522 \begin_layout Itemize
1523 palette: PALETTE: The palette to adjust.
1524 \end_layout
1526 \begin_layout Itemize
1527 Number adj: The factor to multiply opaqueness with times 256.
1528 \end_layout
1530 \begin_layout Standard
1531 Multiply opaqueness of all colors in palette <palette> by factor of <adj>/256.
1532 \end_layout
1534 \begin_layout Standard
1535 \begin_inset Newpage pagebreak
1536 \end_inset
1539 \end_layout
1541 \begin_layout Subsection
1542 BITMAP: Indexed-color bitmap
1543 \end_layout
1545 \begin_layout Subsubsection
1546 Static function new: Create a new bitmap
1547 \end_layout
1549 \begin_layout Itemize
1550 Syntax: bitmap gui.bitmap.new(w, h, [fillcolor])
1551 \end_layout
1553 \begin_layout Itemize
1554 Syntax: bitmap classes.BITMAP.new(w, h, [fillcolor])
1555 \end_layout
1557 \begin_layout Itemize
1558 Deprecated: bitmap gui.bitmap_new(w, h, false, [fillcolor])
1559 \end_layout
1561 \begin_layout Standard
1562 Parameters:
1563 \end_layout
1565 \begin_layout Itemize
1566 w: number: The width of bitmap to create in pixels.
1567 \end_layout
1569 \begin_layout Itemize
1570 h: number: The height of bitmap to create in pixels.
1571 \end_layout
1573 \begin_layout Itemize
1574 false: boolean: Constant boolean false.
1575 \end_layout
1577 \begin_layout Itemize
1578 fillcolor: number: The initial fill index.
1579  Default 0 if not specified.
1580 \end_layout
1582 \begin_layout Standard
1583 Create a new bitmap of size <w>*<h>.
1584  Fill the bitmap with color index <fillcolor>.
1585 \end_layout
1587 \begin_layout Subsubsection
1588 Method draw: Draw a bitmap
1589 \end_layout
1591 \begin_layout Itemize
1592 Syntax: bitmap:draw(x, y, palette)
1593 \end_layout
1595 \begin_layout Itemize
1596 Deprecated: gui.bitmap_draw(x, y, bitmap, palette)
1597 \end_layout
1599 \begin_layout Standard
1600 Parameters:
1601 \end_layout
1603 \begin_layout Itemize
1604 bitmap: BITMAP: The bitmap to draw
1605 \end_layout
1607 \begin_layout Itemize
1608 x: number: The x-coordinate on screen.
1609 \end_layout
1611 \begin_layout Itemize
1612 y: number: The y-coordinate on screen.
1613 \end_layout
1615 \begin_layout Itemize
1616 palette: The palette to use for drawing.
1617 \end_layout
1619 \begin_layout Standard
1620 Draw bitmap <bitmap> on screen at <x>,<y> with palette <palette>.
1621 \end_layout
1623 \begin_layout Subsubsection
1624 Method draw_outside: Draw a bitmap outside game area
1625 \end_layout
1627 \begin_layout Itemize
1628 Syntax: bitmap:draw_outside(x, y, palette)
1629 \end_layout
1631 \begin_layout Standard
1632 Like bitmap:draw, but does not draw on game area.
1633 \end_layout
1635 \begin_layout Subsubsection
1636 Method draw_clip: Draw a bitmap, with clipping
1637 \end_layout
1639 \begin_layout Itemize
1640 Syntax: bitmap:draw_clip(x, y, palette, x0, y0, width, height)
1641 \end_layout
1643 \begin_layout Standard
1644 Parameters:
1645 \end_layout
1647 \begin_layout Itemize
1648 bitmap: BITMAP: The bitmap to draw
1649 \end_layout
1651 \begin_layout Itemize
1652 x: number: The x-coordinate on screen.
1653 \end_layout
1655 \begin_layout Itemize
1656 y: number: The y-coordinate on screen.
1657 \end_layout
1659 \begin_layout Itemize
1660 palette: The palette to use for drawing.
1661 \end_layout
1663 \begin_layout Itemize
1664 x0: The smallest bitmap x coordinate to draw.
1665 \end_layout
1667 \begin_layout Itemize
1668 y0: The smallest bitmap y coordinate to draw.
1669 \end_layout
1671 \begin_layout Itemize
1672 width: Width of region to draw
1673 \end_layout
1675 \begin_layout Itemize
1676 height: Height of region to draw.
1677 \end_layout
1679 \begin_layout Standard
1680 Like bitmap:draw, but clip the bitmap area drawn.
1681 \end_layout
1683 \begin_layout Subsubsection
1684 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
1685 \end_layout
1687 \begin_layout Itemize
1688 Syntax: bitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
1689 \end_layout
1691 \begin_layout Standard
1692 Like bitmap:draw_clip, but only draw outside game area.
1693 \end_layout
1695 \begin_layout Subsubsection
1696 Method pset: Set pixel in bitmap
1697 \end_layout
1699 \begin_layout Itemize
1700 Syntax: bitmap:pset(x, y, color)
1701 \end_layout
1703 \begin_layout Itemize
1704 Deprecaed: gui.bitmap_pset(bitmap, ...)
1705 \end_layout
1707 \begin_layout Standard
1708 Parameters:
1709 \end_layout
1711 \begin_layout Itemize
1712 bitmap: BITMAP: The bitmap to manipulate.
1713 \end_layout
1715 \begin_layout Itemize
1716 x: number: x-coordinate of pixel to set.
1717 \end_layout
1719 \begin_layout Itemize
1720 y: number: y-coordinate of pixel to set.
1721 \end_layout
1723 \begin_layout Itemize
1724 color: number: The color index to set.
1725 \end_layout
1727 \begin_layout Standard
1728 Sets specified pixel <x>,<y> in bitmap <bitmap> to color index <color>.
1729 \end_layout
1731 \begin_layout Subsubsection
1732 Method pget: Get pixel in bitmap
1733 \end_layout
1735 \begin_layout Itemize
1736 Syntax: color bitmap:pget(x,y)
1737 \end_layout
1739 \begin_layout Itemize
1740 Deprecated: color gui.bitmap_pget(bitmap, ...)
1741 \end_layout
1743 \begin_layout Standard
1744 Parameters:
1745 \end_layout
1747 \begin_layout Itemize
1748 bitmap: BITMAP: The bitmap to query.
1749 \end_layout
1751 \begin_layout Itemize
1752 x: number: x-coordinate of pixel to get.
1753 \end_layout
1755 \begin_layout Itemize
1756 y: number: y-coordinate of pixel to get.
1757 \end_layout
1759 \begin_layout Standard
1760 Returns:
1761 \end_layout
1763 \begin_layout Itemize
1764 color: number: The color index in specified pixel.
1765 \end_layout
1767 \begin_layout Standard
1768 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
1769 \end_layout
1771 \begin_layout Subsubsection
1772 Method size: Get size of bitmap
1773 \end_layout
1775 \begin_layout Itemize
1776 Syntax: width, height bitmap:size()
1777 \end_layout
1779 \begin_layout Itemize
1780 Syntax: width, height gui.bitmap_size(bitmap)
1781 \end_layout
1783 \begin_layout Standard
1784 Parameters:
1785 \end_layout
1787 \begin_layout Itemize
1788 bitmap: BITMAP: The bitmap to query.
1789 \end_layout
1791 \begin_layout Standard
1792 Returns:
1793 \end_layout
1795 \begin_layout Itemize
1796 width: number: The width of the bitmap.
1797 \end_layout
1799 \begin_layout Itemize
1800 height: number: The height of the bitmap.
1801 \end_layout
1803 \begin_layout Standard
1804 Get size of bitmap <bitmap>.
1805 \end_layout
1807 \begin_layout Subsubsection
1808 Method blit: Blit a bitmap into another
1809 \end_layout
1811 \begin_layout Itemize
1812 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
1813 \end_layout
1815 \begin_layout Itemize
1816 Deprecated: gui.bitmap_blit(dest, ...)
1817 \end_layout
1819 \begin_layout Standard
1820 Parameters:
1821 \end_layout
1823 \begin_layout Itemize
1824 dest: BITMAP: The target bitmap to blit to.
1825 \end_layout
1827 \begin_layout Itemize
1828 dx: number: The x-coordinate in target.
1829 \end_layout
1831 \begin_layout Itemize
1832 dy: number: The y-coordinate in target.
1833 \end_layout
1835 \begin_layout Itemize
1836 src: BITMAP: The source bitmap.
1837 \end_layout
1839 \begin_layout Itemize
1840 sx: number: The x-coordinate in source.
1841 \end_layout
1843 \begin_layout Itemize
1844 sy: number: The y-coordinate in source.
1845 \end_layout
1847 \begin_layout Itemize
1848 w: number: The width of area to blit.
1849 \end_layout
1851 \begin_layout Itemize
1852 h: number: The height of area to blit.
1853 \end_layout
1855 \begin_layout Itemize
1856 ck: number: The color key.
1857  Pixels with this index are not copied.
1858 \end_layout
1860 \begin_deeper
1861 \begin_layout Itemize
1862 If none is specified, all pixels are copied.
1863 \end_layout
1865 \end_deeper
1866 \begin_layout Standard
1867 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> into <dest> at
1868  <dx>,<dy>.
1869  If a color key <ck> is specified, pixels of that color are not copied.
1870 \end_layout
1872 \begin_layout Subsubsection
1873 Method blit_scaled: Blit a bitmap into another with scaling
1874 \end_layout
1876 \begin_layout Itemize
1877 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
1878 \end_layout
1880 \begin_layout Itemize
1881 Deprecated: gui.bitmap_blit_scaled(dest, ...)
1882 \end_layout
1884 \begin_layout Standard
1885 Parameters:
1886 \end_layout
1888 \begin_layout Itemize
1889 dest: BITMAP: The target bitmap to blit to.
1890 \end_layout
1892 \begin_layout Itemize
1893 dx: number: The x-coordinate in target.
1894 \end_layout
1896 \begin_layout Itemize
1897 dy: number: The y-coordinate in target.
1898 \end_layout
1900 \begin_layout Itemize
1901 src: BITMAP: The source bitmap.
1902 \end_layout
1904 \begin_layout Itemize
1905 sx: number: The x-coordinate in source.
1906 \end_layout
1908 \begin_layout Itemize
1909 sy: number: The y-coordinate in source.
1910 \end_layout
1912 \begin_layout Itemize
1913 w: number: The width of area to blit.
1914 \end_layout
1916 \begin_layout Itemize
1917 h: number: The height of area to blit.
1918 \end_layout
1920 \begin_layout Itemize
1921 hscl: number: Horizontal scale factor (integer).
1922 \end_layout
1924 \begin_layout Itemize
1925 vscl: number: Vertical scale factor (integer).
1926  Defaults to the same as <hscl>.
1927 \end_layout
1929 \begin_layout Itemize
1930 ck: number: The color key.
1931  Pixels with this index are not copied.
1932 \end_layout
1934 \begin_deeper
1935 \begin_layout Itemize
1936 If none is specified, all pixels are copied.
1937 \end_layout
1939 \end_deeper
1940 \begin_layout Standard
1941 Like BITMAP:blit, but also scales the copied part of bitmap (using nearest
1942  neighbor) by factor of <hscl>*<vscl>.
1943 \end_layout
1945 \begin_layout Subsubsection
1946 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
1947 \end_layout
1949 \begin_layout Itemize
1950 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
1951 \end_layout
1953 \begin_layout Itemize
1954 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
1955 \end_layout
1957 \begin_layout Standard
1958 Parameters:
1959 \end_layout
1961 \begin_layout Itemize
1962 dest: BITMAP: The target bitmap to blit to.
1963 \end_layout
1965 \begin_layout Itemize
1966 dx: number: The x-coordinate in target.
1967 \end_layout
1969 \begin_layout Itemize
1970 dy: number: The y-coordinate in target.
1971 \end_layout
1973 \begin_layout Itemize
1974 src: BITMAP: The source bitmap.
1975 \end_layout
1977 \begin_layout Itemize
1978 sx: number: The x-coordinate in source.
1979 \end_layout
1981 \begin_layout Itemize
1982 sy: number: The y-coordinate in source.
1983 \end_layout
1985 \begin_layout Itemize
1986 w: number: The width of area to blit.
1987 \end_layout
1989 \begin_layout Itemize
1990 h: number: The height of area to blit.
1991 \end_layout
1993 \begin_layout Itemize
1994 operator: string: The operator to use.
1995 \end_layout
1997 \begin_deeper
1998 \begin_layout Itemize
1999 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2000  DestOut, Clear or Xor.
2001 \end_layout
2003 \end_deeper
2004 \begin_layout Standard
2005 Like BITMAP:blit, but instead of just overwriting, applies specified Porter-Duff
2006  operator.
2008 \end_layout
2010 \begin_layout Itemize
2011 Color index 0 in source and target is treated as background.
2012 \end_layout
2014 \begin_layout Subsubsection
2015 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2016  Porter-Duff composition
2017 \end_layout
2019 \begin_layout Itemize
2020 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2021  operator)
2022 \end_layout
2024 \begin_layout Itemize
2025 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2026 \end_layout
2028 \begin_layout Standard
2029 Parameters:
2030 \end_layout
2032 \begin_layout Itemize
2033 dest: BITMAP: The target bitmap to blit to.
2034 \end_layout
2036 \begin_layout Itemize
2037 dx: number: The x-coordinate in target.
2038 \end_layout
2040 \begin_layout Itemize
2041 dy: number: The y-coordinate in target.
2042 \end_layout
2044 \begin_layout Itemize
2045 src: BITMAP: The source bitmap.
2046 \end_layout
2048 \begin_layout Itemize
2049 sx: number: The x-coordinate in source.
2050 \end_layout
2052 \begin_layout Itemize
2053 sy: number: The y-coordinate in source.
2054 \end_layout
2056 \begin_layout Itemize
2057 w: number: The width of area to blit.
2058 \end_layout
2060 \begin_layout Itemize
2061 h: number: The height of area to blit.
2062 \end_layout
2064 \begin_layout Itemize
2065 hscl: number: Horizontal scale factor (integer).
2066 \end_layout
2068 \begin_layout Itemize
2069 vscl: number: Vertical scale factor (integer).
2070  Defaults to the same as <hscl>.
2071 \end_layout
2073 \begin_layout Itemize
2074 operator: string: The operator to use.
2075 \end_layout
2077 \begin_deeper
2078 \begin_layout Itemize
2079 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2080  DestOut, Clear or Xor.
2081 \end_layout
2083 \end_deeper
2084 \begin_layout Standard
2085 Like BITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2086  like BITMAP:blit_scaled.
2087 \end_layout
2089 \begin_layout Subsubsection
2090 Method blit_priority: Blit a bitmap into another with color priority
2091 \end_layout
2093 \begin_layout Itemize
2094 Syntax: dest:blit_priority(dx, dy, src, sx, sy, w, h)
2095 \end_layout
2097 \begin_layout Itemize
2098 Deprecated: gui.bitmap_blit_priority(dest, ...)
2099 \end_layout
2101 \begin_layout Standard
2102 Parameters:
2103 \end_layout
2105 \begin_layout Itemize
2106 dest: BITMAP: The target bitmap to blit to.
2107 \end_layout
2109 \begin_layout Itemize
2110 dx: number: The x-coordinate in target.
2111 \end_layout
2113 \begin_layout Itemize
2114 dy: number: The y-coordinate in target.
2115 \end_layout
2117 \begin_layout Itemize
2118 src: BITMAP: The source bitmap.
2119 \end_layout
2121 \begin_layout Itemize
2122 sx: number: The x-coordinate in source.
2123 \end_layout
2125 \begin_layout Itemize
2126 sy: number: The y-coordinate in source.
2127 \end_layout
2129 \begin_layout Itemize
2130 w: number: The width of area to blit.
2131 \end_layout
2133 \begin_layout Itemize
2134 h: number: The height of area to blit.
2135 \end_layout
2137 \begin_layout Standard
2138 Like BITMAP:blit, but only copy pixels where source color index is greater
2139  than destination color index.
2140 \end_layout
2142 \begin_layout Subsubsection
2143 Method blit_scaled_priority: Blit a bitmap into another with color priority
2144  and scaling
2145 \end_layout
2147 \begin_layout Itemize
2148 Syntax: dest:blit_scaled_priority(dx, dy, src, sx, sy, w, h, hscl, [vscl])
2149 \end_layout
2151 \begin_layout Itemize
2152 Deprecated: gui.bitmap_blit_scaled_priority(dest, ...)
2153 \end_layout
2155 \begin_layout Standard
2156 Parameters:
2157 \end_layout
2159 \begin_layout Itemize
2160 dest: BITMAP: The target bitmap to blit to.
2161 \end_layout
2163 \begin_layout Itemize
2164 dx: number: The x-coordinate in target.
2165 \end_layout
2167 \begin_layout Itemize
2168 dy: number: The y-coordinate in target.
2169 \end_layout
2171 \begin_layout Itemize
2172 src: BITMAP: The source bitmap.
2173 \end_layout
2175 \begin_layout Itemize
2176 sx: number: The x-coordinate in source.
2177 \end_layout
2179 \begin_layout Itemize
2180 sy: number: The y-coordinate in source.
2181 \end_layout
2183 \begin_layout Itemize
2184 w: number: The width of area to blit.
2185 \end_layout
2187 \begin_layout Itemize
2188 h: number: The height of area to blit.
2189 \end_layout
2191 \begin_layout Itemize
2192 hscl: number: Horizontal scale factor (integer).
2193 \end_layout
2195 \begin_layout Itemize
2196 vscl: number: Vertical scale factor (integer).
2197  Defaults to the same as <hscl>.
2198 \end_layout
2200 \begin_layout Standard
2201 Like BITMAP:blit_priority, but apply scaling by <hscl>*<vscl> like BITMAP:blit_s
2202 caled.
2203 \end_layout
2205 \begin_layout Subsubsection
2206 Method save_png: Save a bitmap to PNG
2207 \end_layout
2209 \begin_layout Itemize
2210 Syntax: bitmap:save_png(filename, [base], palette)
2211 \end_layout
2213 \begin_layout Itemize
2214 Syntax: data bitmap:save_png(palette)
2215 \end_layout
2217 \begin_layout Itemize
2218 Deprecated: ...
2219  gui.bitmap_save_png(bitmap, ...)
2220 \end_layout
2222 \begin_layout Standard
2223 Parameters:
2224 \end_layout
2226 \begin_layout Itemize
2227 bitmap: BITMAP: The bitmap to save.
2228 \end_layout
2230 \begin_layout Itemize
2231 filename: string: The filename to save to.
2232 \end_layout
2234 \begin_layout Itemize
2235 base: string: The base filename is resolved relative to.
2236 \end_layout
2238 \begin_layout Itemize
2239 palette: PALETTE: The palette to use.
2240 \end_layout
2242 \begin_layout Standard
2243 Return value:
2244 \end_layout
2246 \begin_layout Itemize
2247 data: string: BASE64 encoded PNG data.
2248 \end_layout
2250 \begin_layout Standard
2251 Save bitmap <bitmap>, with palette <pal> into PNG file <filename> (relative
2252  to <base>) or return BASE64 encoding of it.
2253 \end_layout
2255 \begin_layout Subsubsection
2256 Method hash: Hash a bitmap
2257 \end_layout
2259 \begin_layout Itemize
2260 Syntax: hash bitmap:hash()
2261 \end_layout
2263 \begin_layout Itemize
2264 Deprecated: hash bitmap:hash(bitmap)
2265 \end_layout
2267 \begin_layout Standard
2268 Parameters:
2269 \end_layout
2271 \begin_layout Itemize
2272 bitmap: BITMAP: The bitmap to hash.
2273 \end_layout
2275 \begin_layout Standard
2276 Return value:
2277 \end_layout
2279 \begin_layout Itemize
2280 hash: string: 64-hex digit hash
2281 \end_layout
2283 \begin_layout Standard
2284 Hashes bitmap <bitmap> and returns crypto-strong hash.
2286 \end_layout
2288 \begin_layout Itemize
2289 Color order in bitmap is significant.
2290 \end_layout
2292 \begin_layout Standard
2293 \begin_inset Newpage pagebreak
2294 \end_inset
2297 \end_layout
2299 \begin_layout Subsection
2300 DBITMAP: Direct-color bitmap
2301 \end_layout
2303 \begin_layout Subsubsection
2304 Static function: new: Create a new bitmap
2305 \end_layout
2307 \begin_layout Itemize
2308 Syntax: bitmap gui.dbitmap.new(w, h, [fillcolor])
2309 \end_layout
2311 \begin_layout Itemize
2312 Syntax: bitmap classes.DBITMAP.new(w, h, [fillcolor])
2313 \end_layout
2315 \begin_layout Itemize
2316 Deprecated: bitmap gui.bitmap_new (w, h, true, [fillcolor]).
2317 \end_layout
2319 \begin_layout Standard
2320 Parameters:
2321 \end_layout
2323 \begin_layout Itemize
2324 w: number: The width of new bitmap.
2325 \end_layout
2327 \begin_layout Itemize
2328 h: number: The height of new bitmap.
2329 \end_layout
2331 \begin_layout Itemize
2332 true: boolean: Fixed boolean true
2333 \end_layout
2335 \begin_layout Itemize
2336 fillcolor: The color to fill the bitmap with (default transparent).
2337 \end_layout
2339 \begin_layout Standard
2340 Return value:
2341 \end_layout
2343 \begin_layout Itemize
2344 bitmap: DBITMAP: The new bitmap.
2345 \end_layout
2347 \begin_layout Standard
2348 Create a new direct-color bitmap of size <w>*<h>, initially filled with
2349  <fillcolor>.
2350 \end_layout
2352 \begin_layout Subsubsection
2353 Method draw: Draw a bitmap
2354 \end_layout
2356 \begin_layout Itemize
2357 Syntax: bitmap.draw(x, y)
2358 \end_layout
2360 \begin_layout Itemize
2361 Deprecated: gui.bitmap_draw(x, y, bitmap)
2362 \end_layout
2364 \begin_layout Standard
2365 Parameters:
2366 \end_layout
2368 \begin_layout Itemize
2369 bitmap: DBITMAP: The bitmap to draw.
2370 \end_layout
2372 \begin_layout Itemize
2373 x: number: X-coordinate on screen.
2374 \end_layout
2376 \begin_layout Itemize
2377 y: number: Y-coordinate on screen.
2378 \end_layout
2380 \begin_layout Standard
2381 Draw bitmap <bitmap> on screen at <x>,<y>.
2382 \end_layout
2384 \begin_layout Subsubsection
2385 Method draw_outside: Draw a bitmap outside game area
2386 \end_layout
2388 \begin_layout Itemize
2389 Syntax: dbitmap:draw_outside(x, y, palette)
2390 \end_layout
2392 \begin_layout Standard
2393 Like dbitmap:draw, but does not draw on game area.
2394 \end_layout
2396 \begin_layout Subsubsection
2397 Method draw_clip: Draw a bitmap, with clipping
2398 \end_layout
2400 \begin_layout Itemize
2401 Syntax: dbitmap:draw(x, y, palette, x0, y0, width, height)
2402 \end_layout
2404 \begin_layout Standard
2405 Parameters:
2406 \end_layout
2408 \begin_layout Itemize
2409 bitmap: DBITMAP: The bitmap to draw
2410 \end_layout
2412 \begin_layout Itemize
2413 x: number: The x-coordinate on screen.
2414 \end_layout
2416 \begin_layout Itemize
2417 y: number: The y-coordinate on screen.
2418 \end_layout
2420 \begin_layout Itemize
2421 x0: The smallest bitmap x coordinate to draw.
2422 \end_layout
2424 \begin_layout Itemize
2425 y0: The smallest bitmap y coordinate to draw.
2426 \end_layout
2428 \begin_layout Itemize
2429 width: Width of region to draw
2430 \end_layout
2432 \begin_layout Itemize
2433 height: Height of region to draw.
2434 \end_layout
2436 \begin_layout Standard
2437 Like dbitmap:draw, but clip the bitmap area drawn.
2438 \end_layout
2440 \begin_layout Subsubsection
2441 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
2442 \end_layout
2444 \begin_layout Itemize
2445 Syntax: dbitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
2446 \end_layout
2448 \begin_layout Standard
2449 Like dbitmap:draw_clip, but only draw outside game area.
2450 \end_layout
2452 \begin_layout Subsubsection
2453 Method pset: Set pixel in bitmap
2454 \end_layout
2456 \begin_layout Itemize
2457 Syntax: bitmap:pset(x, y, color)
2458 \end_layout
2460 \begin_layout Itemize
2461 Deprecaed: gui.bitmap_pset(bitmap, ...)
2462 \end_layout
2464 \begin_layout Standard
2465 Parameters:
2466 \end_layout
2468 \begin_layout Itemize
2469 bitmap: DBITMAP: The bitmap to manipulate.
2470 \end_layout
2472 \begin_layout Itemize
2473 x: number: x-coordinate of pixel to set.
2474 \end_layout
2476 \begin_layout Itemize
2477 y: number: y-coordinate of pixel to set.
2478 \end_layout
2480 \begin_layout Itemize
2481 color: number/string: The color to set.
2482 \end_layout
2484 \begin_layout Standard
2485 Sets specified pixel <x>,<y> in bitmap <bitmap> to color <color>.
2486 \end_layout
2488 \begin_layout Subsubsection
2489 Method pget: Get pixel in bitmap
2490 \end_layout
2492 \begin_layout Itemize
2493 Syntax: color bitmap:pget(x,y)
2494 \end_layout
2496 \begin_layout Itemize
2497 Deprecated: color gui.bitmap_pget(bitmap, ...)
2498 \end_layout
2500 \begin_layout Standard
2501 Parameters:
2502 \end_layout
2504 \begin_layout Itemize
2505 bitmap: DBITMAP: The bitmap to query.
2506 \end_layout
2508 \begin_layout Itemize
2509 x: number: x-coordinate of pixel to get.
2510 \end_layout
2512 \begin_layout Itemize
2513 y: number: y-coordinate of pixel to get.
2514 \end_layout
2516 \begin_layout Standard
2517 Returns:
2518 \end_layout
2520 \begin_layout Itemize
2521 color: number: The color of specified pixel.
2522 \end_layout
2524 \begin_layout Standard
2525 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
2526 \end_layout
2528 \begin_layout Subsubsection
2529 Method size: Get size of bitmap
2530 \end_layout
2532 \begin_layout Itemize
2533 Syntax: width, height bitmap:size()
2534 \end_layout
2536 \begin_layout Itemize
2537 Syntax: width, height gui.bitmap_size(bitmap)
2538 \end_layout
2540 \begin_layout Standard
2541 Parameters:
2542 \end_layout
2544 \begin_layout Itemize
2545 bitmap: DBITMAP: The bitmap to query.
2546 \end_layout
2548 \begin_layout Standard
2549 Returns:
2550 \end_layout
2552 \begin_layout Itemize
2553 width: number: The width of the bitmap.
2554 \end_layout
2556 \begin_layout Itemize
2557 height: number: The height of the bitmap.
2558 \end_layout
2560 \begin_layout Standard
2561 Get size of bitmap <bitmap>.
2562 \end_layout
2564 \begin_layout Subsubsection
2565 Method blit: Blit a bitmap into another
2566 \end_layout
2568 \begin_layout Itemize
2569 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
2570 \end_layout
2572 \begin_layout Itemize
2573 Syntax: dest:blit(dx, dy, src, srcpal, sx, sy, w, h, [ck])
2574 \end_layout
2576 \begin_layout Itemize
2577 Deprecated: gui.bitmap_blit(dest, ...)
2578 \end_layout
2580 \begin_layout Standard
2581 Parameters:
2582 \end_layout
2584 \begin_layout Itemize
2585 dest: DBITMAP: The target bitmap to blit to.
2586 \end_layout
2588 \begin_layout Itemize
2589 dx: number: The x-coordinate in target.
2590 \end_layout
2592 \begin_layout Itemize
2593 dy: number: The y-coordinate in target.
2594 \end_layout
2596 \begin_layout Itemize
2597 src: BITMAP/DBITMAP: The source bitmap.
2598 \end_layout
2600 \begin_layout Itemize
2601 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2602 \end_layout
2604 \begin_layout Itemize
2605 sx: number: The x-coordinate in source.
2606 \end_layout
2608 \begin_layout Itemize
2609 sy: number: The y-coordinate in source.
2610 \end_layout
2612 \begin_layout Itemize
2613 w: number: The width of area to blit.
2614 \end_layout
2616 \begin_layout Itemize
2617 h: number: The height of area to blit.
2618 \end_layout
2620 \begin_layout Itemize
2621 ck: number: The color key.
2622  Pixels with this index are not copied.
2623 \end_layout
2625 \begin_deeper
2626 \begin_layout Itemize
2627 If none is specified, all pixels are copied.
2628 \end_layout
2630 \begin_layout Itemize
2631 If <src> is paletted, this is color index, otherwise it is a color.
2632 \end_layout
2634 \end_deeper
2635 \begin_layout Standard
2636 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> (with palette <pal>
2637  if indexed) into <dest> at <dx>,<dy>.
2638  If a color key <ck> is specified, pixels of that color are not copied.
2639 \end_layout
2641 \begin_layout Subsubsection
2642 Method blit_scaled: Blit a bitmap into another with scaling
2643 \end_layout
2645 \begin_layout Itemize
2646 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
2647 \end_layout
2649 \begin_layout Itemize
2650 Syntax: dest:blit_scaled(dx, dy, src, srcpal, sx, sy, w, h, hscl, [vscl],
2651  [ck])
2652 \end_layout
2654 \begin_layout Itemize
2655 Deprecated: gui.bitmap_blit_scaled(dest, ...)
2656 \end_layout
2658 \begin_layout Standard
2659 Parameters:
2660 \end_layout
2662 \begin_layout Itemize
2663 dest: DBITMAP: The target bitmap to blit to.
2664 \end_layout
2666 \begin_layout Itemize
2667 dx: number: The x-coordinate in target.
2668 \end_layout
2670 \begin_layout Itemize
2671 dy: number: The y-coordinate in target.
2672 \end_layout
2674 \begin_layout Itemize
2675 src: BITMAP/DBITMAP: The source bitmap.
2676 \end_layout
2678 \begin_layout Itemize
2679 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2680 \end_layout
2682 \begin_layout Itemize
2683 sx: number: The x-coordinate in source.
2684 \end_layout
2686 \begin_layout Itemize
2687 sy: number: The y-coordinate in source.
2688 \end_layout
2690 \begin_layout Itemize
2691 w: number: The width of area to blit.
2692 \end_layout
2694 \begin_layout Itemize
2695 h: number: The height of area to blit.
2696 \end_layout
2698 \begin_layout Itemize
2699 hscl: number: Horizontal scale factor (integer).
2700 \end_layout
2702 \begin_layout Itemize
2703 vscl: number: Vertical scale factor (integer).
2704  Defaults to the same as <hscl>.
2705 \end_layout
2707 \begin_layout Itemize
2708 ck: number: The color key.
2709  Pixels with this index are not copied.
2710 \end_layout
2712 \begin_deeper
2713 \begin_layout Itemize
2714 If none is specified, all pixels are copied.
2715 \end_layout
2717 \begin_layout Itemize
2718 If <src> is paletted, this is color index, otherwise it is a color.
2719 \end_layout
2721 \end_deeper
2722 \begin_layout Standard
2723 Like DBITMAP:blit, but also scales the copied part of bitmap (using nearest
2724  neighbor) by factor of <hscl>*<vscl>.
2725 \end_layout
2727 \begin_layout Subsubsection
2728 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2729 \end_layout
2731 \begin_layout Itemize
2732 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2733 \end_layout
2735 \begin_layout Itemize
2736 Syntax: dest:blit_porterduff(dx, dy, src, srcpal, sx, sy, w, h, operator)
2737 \end_layout
2739 \begin_layout Itemize
2740 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2741 \end_layout
2743 \begin_layout Standard
2744 Parameters:
2745 \end_layout
2747 \begin_layout Itemize
2748 dest: DBITMAP: The target bitmap to blit to.
2749 \end_layout
2751 \begin_layout Itemize
2752 dx: number: The x-coordinate in target.
2753 \end_layout
2755 \begin_layout Itemize
2756 dy: number: The y-coordinate in target.
2757 \end_layout
2759 \begin_layout Itemize
2760 src: BITMAP/DBITMAP: The source bitmap.
2761 \end_layout
2763 \begin_layout Itemize
2764 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2765 \end_layout
2767 \begin_layout Itemize
2768 sx: number: The x-coordinate in source.
2769 \end_layout
2771 \begin_layout Itemize
2772 sy: number: The y-coordinate in source.
2773 \end_layout
2775 \begin_layout Itemize
2776 w: number: The width of area to blit.
2777 \end_layout
2779 \begin_layout Itemize
2780 h: number: The height of area to blit.
2781 \end_layout
2783 \begin_layout Itemize
2784 operator: string: The operator to use.
2785 \end_layout
2787 \begin_deeper
2788 \begin_layout Itemize
2789 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2790  DestOut, Clear or Xor.
2791 \end_layout
2793 \end_deeper
2794 \begin_layout Standard
2795 Like DBITMAP:blit, but instead of just overwriting, applies specified Porter-Duf
2796 f operator.
2798 \end_layout
2800 \begin_layout Itemize
2801 In target, fully transparent is background.
2802  In source, either fully transparent (if direct) or index 0 (if paletted)
2803  is treated as background.
2804 \end_layout
2806 \begin_layout Subsubsection
2807 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2808  Porter-Duff composition
2809 \end_layout
2811 \begin_layout Itemize
2812 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2813  operator)
2814 \end_layout
2816 \begin_layout Itemize
2817 Syntax: dest:blit_scaled_porterduff(dx, dy, src, srcpal, sx, sy, w, h, hscl,
2818  [vscl], operator)
2819 \end_layout
2821 \begin_layout Itemize
2822 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2823 \end_layout
2825 \begin_layout Standard
2826 Parameters:
2827 \end_layout
2829 \begin_layout Itemize
2830 dest: DBITMAP: The target bitmap to blit to.
2831 \end_layout
2833 \begin_layout Itemize
2834 dx: number: The x-coordinate in target.
2835 \end_layout
2837 \begin_layout Itemize
2838 dy: number: The y-coordinate in target.
2839 \end_layout
2841 \begin_layout Itemize
2842 src: BITMAP/DBITMAP: The source bitmap.
2843 \end_layout
2845 \begin_layout Itemize
2846 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2847 \end_layout
2849 \begin_layout Itemize
2850 sx: number: The x-coordinate in source.
2851 \end_layout
2853 \begin_layout Itemize
2854 sy: number: The y-coordinate in source.
2855 \end_layout
2857 \begin_layout Itemize
2858 w: number: The width of area to blit.
2859 \end_layout
2861 \begin_layout Itemize
2862 h: number: The height of area to blit.
2863 \end_layout
2865 \begin_layout Itemize
2866 hscl: number: Horizontal scale factor (integer).
2867 \end_layout
2869 \begin_layout Itemize
2870 vscl: number: Vertical scale factor (integer).
2871  Defaults to the same as <hscl>.
2872 \end_layout
2874 \begin_layout Itemize
2875 operator: string: The operator to use.
2876 \end_layout
2878 \begin_deeper
2879 \begin_layout Itemize
2880 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2881  DestOut, Clear or Xor.
2882 \end_layout
2884 \end_deeper
2885 \begin_layout Standard
2886 Like DBITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2887  like DBITMAP:blit_scaled.
2888 \end_layout
2890 \begin_layout Subsubsection
2891 Method adjust_transparency: Adjust transparency of bitmap
2892 \end_layout
2894 \begin_layout Itemize
2895 Syntax: bitmap:adjust_transparency(newvalue)
2896 \end_layout
2898 \begin_layout Itemize
2899 Deprecated: gui.adjust_transparency(bitmap, ...)
2900 \end_layout
2902 \begin_layout Standard
2903 Parameters:
2904 \end_layout
2906 \begin_layout Itemize
2907 bitmap: DBITMAP: The bitmap to adjust.
2908 \end_layout
2910 \begin_layout Itemize
2911 Number adj: The factor to multiply opaqueness with times 256.
2912 \end_layout
2914 \begin_layout Standard
2915 Multiply opaqueness of all colors in bitmap <bitmap> by factor of <adj>/256.
2916 \end_layout
2918 \begin_layout Subsubsection
2919 Method save_png: Save a bitmap to PNG
2920 \end_layout
2922 \begin_layout Itemize
2923 Syntax: bitmap:save_png(filename, [base])
2924 \end_layout
2926 \begin_layout Itemize
2927 Syntax: data bitmap:save_png()
2928 \end_layout
2930 \begin_layout Itemize
2931 Deprecated: ...
2932  gui.bitmap_save_png(bitmap, ...)
2933 \end_layout
2935 \begin_layout Standard
2936 Parameters:
2937 \end_layout
2939 \begin_layout Itemize
2940 bitmap: DBITMAP: The bitmap to save.
2941 \end_layout
2943 \begin_layout Itemize
2944 filename: string: The filename to save to.
2945 \end_layout
2947 \begin_layout Itemize
2948 base: string: The base filename is resolved relative to.
2949 \end_layout
2951 \begin_layout Standard
2952 Return value:
2953 \end_layout
2955 \begin_layout Itemize
2956 data: string: BASE64 encoded PNG data.
2957 \end_layout
2959 \begin_layout Standard
2960 Save bitmap <bitmap> into PNG file <filename> (relative to <base>) or return
2961  BASE64 encoding of it.
2962 \end_layout
2964 \begin_layout Subsubsection
2965 Method hash: Hash a bitmap
2966 \end_layout
2968 \begin_layout Itemize
2969 Syntax: hash bitmap:hash()
2970 \end_layout
2972 \begin_layout Itemize
2973 Deprecated: hash bitmap:hash(bitmap)
2974 \end_layout
2976 \begin_layout Standard
2977 Parameters:
2978 \end_layout
2980 \begin_layout Itemize
2981 bitmap: DBITMAP: The bitmap to hash.
2982 \end_layout
2984 \begin_layout Standard
2985 Return value:
2986 \end_layout
2988 \begin_layout Itemize
2989 hash: string: 64-hex digit hash
2990 \end_layout
2992 \begin_layout Standard
2993 Hashes bitmap <bitmap> and returns crypto-strong hash.
2995 \end_layout
2997 \begin_layout Subsection
2998 IMAGELOADER: Load an image
2999 \end_layout
3001 \begin_layout Subsubsection
3002 Static function load: Load a bitmap from file
3003 \end_layout
3005 \begin_layout Itemize
3006 Syntax: bitmap, palette gui.image.load(file, [base])
3007 \end_layout
3009 \begin_layout Itemize
3010 Syntax: bitmap, palette classes.IMAGELOADER.load(file, [base])
3011 \end_layout
3013 \begin_layout Itemize
3014 Deprecated: ...
3015  gui.bitmap_load(...)
3016 \end_layout
3018 \begin_layout Standard
3019 Parameters:
3020 \end_layout
3022 \begin_layout Itemize
3023 file: string: The file to read.
3024 \end_layout
3026 \begin_layout Itemize
3027 base: string: The base to resolve <file> relative to.
3028 \end_layout
3030 \begin_layout Standard
3031 Returns:
3032 \end_layout
3034 \begin_layout Itemize
3035 bitmap: BITMAP/DBITMAP: The new bitmap
3036 \end_layout
3038 \begin_layout Itemize
3039 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3040  nil.
3041 \end_layout
3043 \begin_layout Standard
3044 Load a new bitmap and return it (plus associated palette if any).
3045 \end_layout
3047 \begin_layout Subsubsection
3048 Static function load_str: Load a bitmap from string
3049 \end_layout
3051 \begin_layout Itemize
3052 Syntax: bitmap, palette gui.image.load_str(data)
3053 \end_layout
3055 \begin_layout Itemize
3056 Syntax: bitmap, palette classes.IMAGELOADER.load_str(data)
3057 \end_layout
3059 \begin_layout Itemize
3060 Deprecated: ...
3061  gui.bitmap_load_str(...)
3062 \end_layout
3064 \begin_layout Standard
3065 Parameters:
3066 \end_layout
3068 \begin_layout Itemize
3069 data: string: The image data
3070 \end_layout
3072 \begin_layout Standard
3073 Returns:
3074 \end_layout
3076 \begin_layout Itemize
3077 bitmap: BITMAP/DBITMAP: The new bitmap
3078 \end_layout
3080 \begin_layout Itemize
3081 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3082  nil.
3083 \end_layout
3085 \begin_layout Standard
3086 Like IMAGELOADER:load, but read the bitmap from string <data> instead of
3087  file.
3088 \end_layout
3090 \begin_layout Subsubsection
3091 Static function load_png: Load a bitmap from PNG file
3092 \end_layout
3094 \begin_layout Itemize
3095 Syntax: bitmap, palette gui.image.load_png(file, [base])
3096 \end_layout
3098 \begin_layout Itemize
3099 Syntax: bitmap, palette classes.IMAGELOADER.load_png(file, [base])
3100 \end_layout
3102 \begin_layout Itemize
3103 Deprecated: ...
3104  gui.bitmap_load_png(...)
3105 \end_layout
3107 \begin_layout Standard
3108 Parameters:
3109 \end_layout
3111 \begin_layout Itemize
3112 file: string: The file to read.
3113 \end_layout
3115 \begin_layout Itemize
3116 base: string: The base to resolve <file> relative to.
3117 \end_layout
3119 \begin_layout Standard
3120 Returns:
3121 \end_layout
3123 \begin_layout Itemize
3124 bitmap: BITMAP/DBITMAP: The new bitmap
3125 \end_layout
3127 \begin_layout Itemize
3128 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3129  nil.
3130 \end_layout
3132 \begin_layout Standard
3133 Like IMAGELOADER:load, but load a PNG file instead.
3134 \end_layout
3136 \begin_layout Subsubsection
3137 Static function load_png_str: Load a PNG bitmap from string
3138 \end_layout
3140 \begin_layout Itemize
3141 Syntax: bitmap, palette gui.image.load_png_str(data)
3142 \end_layout
3144 \begin_layout Itemize
3145 Syntax: bitmap, palette classes.IMAGELOADER.load_png_str(data)
3146 \end_layout
3148 \begin_layout Itemize
3149 Deprecated: ...
3150  gui.bitmap_load_png_str(...)
3151 \end_layout
3153 \begin_layout Standard
3154 Parameters:
3155 \end_layout
3157 \begin_layout Itemize
3158 data: string: The image data, base64 encoded.
3159 \end_layout
3161 \begin_layout Standard
3162 Returns:
3163 \end_layout
3165 \begin_layout Itemize
3166 bitmap: BITMAP/DBITMAP: The new bitmap
3167 \end_layout
3169 \begin_layout Itemize
3170 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3171  nil.
3172 \end_layout
3174 \begin_layout Standard
3175 Like IMAGELOADER:load_png, but read the bitmap from BASE64 encoded string
3176  <data> instead of file.
3177 \end_layout
3179 \begin_layout Standard
3180 \begin_inset Newpage pagebreak
3181 \end_inset
3184 \end_layout
3186 \begin_layout Subsection
3187 CUSTOMFONT: Arbitrary-sized bitmap font
3188 \end_layout
3190 \begin_layout Subsubsection
3191 Static function new: Return a new empty font
3192 \end_layout
3194 \begin_layout Itemize
3195 Syntax: font gui.font.new()
3196 \end_layout
3198 \begin_layout Itemize
3199 Syntax: font classes.CUSTOMFONT.new()
3200 \end_layout
3202 \begin_layout Itemize
3203 Deprecated: font gui.font_new()
3204 \end_layout
3206 \begin_layout Standard
3207 Return value:
3208 \end_layout
3210 \begin_layout Itemize
3211 font: CUSTOMFONT: New font.
3212 \end_layout
3214 \begin_layout Standard
3215 Create a new font with no characters and return it.
3216 \end_layout
3218 \begin_layout Subsubsection
3219 Static function: load: Load a font file
3220 \end_layout
3222 \begin_layout Itemize
3223 Syntax: font gui.font.load(file, [base])
3224 \end_layout
3226 \begin_layout Itemize
3227 Syntax: font gui.font.load()
3228 \end_layout
3230 \begin_layout Itemize
3231 Syntax: font classes.CUSTOMFONT.load(file, [base])
3232 \end_layout
3234 \begin_layout Itemize
3235 Syntax: font classes.CUSTOMFONT.load()
3236 \end_layout
3238 \begin_layout Itemize
3239 Deprecated: font gui.loadfont(...)
3240 \end_layout
3242 \begin_layout Standard
3243 Parameters:
3244 \end_layout
3246 \begin_layout Itemize
3247 file: string: The file to read the font from
3248 \end_layout
3250 \begin_layout Itemize
3251 base: string: The file to resolve <file> relative to.
3252 \end_layout
3254 \begin_layout Standard
3255 Return value:
3256 \end_layout
3258 \begin_layout Itemize
3259 font: CUSTOMFONT: New font.
3260 \end_layout
3262 \begin_layout Standard
3263 Load font from file <file> (relative to <base>).
3264  If no filename is given, system default font is loaded.
3265 \end_layout
3267 \begin_layout Subsubsection
3268 operator(): Render text to screen
3269 \end_layout
3271 \begin_layout Itemize
3272 Syntax: font(x, y, text, [fgc], [bgc], [hlc])
3273 \end_layout
3275 \begin_layout Standard
3276 Parmeters:
3277 \end_layout
3279 \begin_layout Itemize
3280 font: CUSTOMFONT: The font to use.
3281 \end_layout
3283 \begin_layout Itemize
3284 x: number: The x-position on screen to draw to.
3285 \end_layout
3287 \begin_layout Itemize
3288 y: number: The y-position on screen to draw to.
3289 \end_layout
3291 \begin_layout Itemize
3292 text: string: The text to draw.
3293 \end_layout
3295 \begin_layout Itemize
3296 fgc: number/string: Foreground color (default white).
3297 \end_layout
3299 \begin_layout Itemize
3300 bgc: number/string: Background color (default transparent).
3301 \end_layout
3303 \begin_layout Itemize
3304 hlc: number/string: Outline color (default transparent).
3305 \end_layout
3307 \begin_layout Standard
3308 Draws a string <text> with specified font <font> and colors <fgc>,<bgc>,<hlc>
3309  onto screen.
3310 \end_layout
3312 \begin_layout Itemize
3313 If <hlc> is transparent, no outline is drawn.
3314 \end_layout
3316 \begin_layout Subsubsection
3317 Method edit: Alter glyph in font
3318 \end_layout
3320 \begin_layout Itemize
3321 Syntax: font:edit(character, glyph)
3322 \end_layout
3324 \begin_layout Standard
3325 Parameters:
3326 \end_layout
3328 \begin_layout Itemize
3329 font: CUSTOMFONT: The font to edit.
3330 \end_layout
3332 \begin_layout Itemize
3333 character: string: The character to edit (UTF-8 encoded).
3334 \end_layout
3336 \begin_layout Itemize
3337 glyph: BITMAP: The bitmap to use.
3338 \end_layout
3340 \begin_layout Standard
3341 Replace character <character> in font <font> by <glyph>.
3342 \end_layout
3344 \begin_layout Itemize
3345 Color index 0 is background, everything else is foreground.
3346 \end_layout
3348 \begin_layout Itemize
3349 <character> may be empty string, meaning the replacement character used
3350  for bad characters.
3351 \end_layout
3353 \begin_layout Itemize
3354 <character> may be multi-codepoint string, meaning character used for that
3355  ligature.
3356 \end_layout
3358 \begin_layout Standard
3359 \begin_inset Newpage pagebreak
3360 \end_inset
3363 \end_layout
3365 \begin_layout Subsection
3366 ICONV: Character set conversions
3367 \end_layout
3369 \begin_layout Subsubsection
3370 Static function new: Create new character set converter
3371 \end_layout
3373 \begin_layout Itemize
3374 Syntax: iconv iconv.new(from, to);
3375 \end_layout
3377 \begin_layout Itemize
3378 Syntax: iconv classes.ICONV.new(from, to);
3379 \end_layout
3381 \begin_layout Itemize
3382 Deprecated: iconv iconv_new(...);
3383 \end_layout
3385 \begin_layout Standard
3386 Parameters:
3387 \end_layout
3389 \begin_layout Itemize
3390 from: string: The source character set.
3391 \end_layout
3393 \begin_layout Itemize
3394 to: string: The target character set.
3395 \end_layout
3397 \begin_layout Standard
3398 Returns:
3399 \end_layout
3401 \begin_layout Itemize
3402 iconv: ICONV: The converter.
3403 \end_layout
3405 \begin_layout Standard
3406 Create a character set converter, converting from <from> to <to> and return
3407  it.
3408 \end_layout
3410 \begin_layout Subsubsection
3411 Operator(): Convert string fragment from character set to another
3412 \end_layout
3414 \begin_layout Itemize
3415 Syntax: success, result, unconverted, error iconv(input)
3416 \end_layout
3418 \begin_layout Standard
3419 Parameters:
3420 \end_layout
3422 \begin_layout Itemize
3423 iconv: ICONV: The context to use.
3424 \end_layout
3426 \begin_layout Itemize
3427 input: string: The input to convert.
3428 \end_layout
3430 \begin_layout Standard
3431 Return value:
3432 \end_layout
3434 \begin_layout Itemize
3435 success: boolean: True if conversion was successful, false if not.
3436 \end_layout
3438 \begin_layout Itemize
3439 result: string: The string (partially) converted.
3440 \end_layout
3442 \begin_layout Itemize
3443 unconvered: number: Number of bytes that were not converted (only if <success>
3444  is false).
3445 \end_layout
3447 \begin_layout Itemize
3448 error: string: Error that caused conversion to stop (only if <success> is
3449  false).
3450 \end_layout
3452 \begin_deeper
3453 \begin_layout Itemize
3454 INVALID: The input string is invalid.
3455 \end_layout
3457 \begin_layout Itemize
3458 INCOMPLETE: The input string cuts off in middle of character.
3459 \end_layout
3461 \begin_layout Itemize
3462 INTERNALERR: Internal error.
3463 \end_layout
3465 \end_deeper
3466 \begin_layout Standard
3467 Convert a string <input> using character set converter <iconv> and return
3468  the result.
3469 \end_layout
3471 \begin_layout Standard
3472 \begin_inset Newpage pagebreak
3473 \end_inset
3476 \end_layout
3478 \begin_layout Subsection
3479 FILEREADER: Read a file as a stream
3480 \end_layout
3482 \begin_layout Subsubsection
3483 Static function open: Open a stream
3484 \end_layout
3486 \begin_layout Itemize
3487 Syntax: handle filereader.open(file, [base])
3488 \end_layout
3490 \begin_layout Itemize
3491 Syntax: handle classes.FILEREADER.open(file, [base])
3492 \end_layout
3494 \begin_layout Itemize
3495 Deprecated: handle open_file(file, [base])
3496 \end_layout
3498 \begin_layout Standard
3499 Parameters:
3500 \end_layout
3502 \begin_layout Itemize
3503 file: string: The filename to read.
3504 \end_layout
3506 \begin_layout Itemize
3507 base: string: The base <file> is resolved against.
3508 \end_layout
3510 \begin_layout Standard
3511 Returns:
3512 \end_layout
3514 \begin_layout Itemize
3515 handle: FILEREADER: The new file reader.
3516 \end_layout
3518 \begin_layout Standard
3519 Open file <file> (relative to <base>) and return a handle to it.
3520 \end_layout
3522 \begin_layout Subsubsection
3523 operator(): Read line/bytes from stream
3524 \end_layout
3526 \begin_layout Itemize
3527 Syntax: result handle()
3528 \end_layout
3530 \begin_layout Itemize
3531 Syntax: result handle(bytes)
3532 \end_layout
3534 \begin_layout Standard
3535 Parameters:
3536 \end_layout
3538 \begin_layout Itemize
3539 handle: FILEREADER: The handle to read from.
3540 \end_layout
3542 \begin_layout Itemize
3543 bytes: Number of bytes to read (default is next line).
3544 \end_layout
3546 \begin_layout Standard
3547 Returns:
3548 \end_layout
3550 \begin_layout Itemize
3551 result: string: The read data, or nil on end-of-file.
3552 \end_layout
3554 \begin_layout Standard
3555 Reads next line or <bytes> bytes from specified file handle <handle>.
3556 \end_layout
3558 \begin_layout Itemize
3559 If reading specified number of bytes, the bytes are read in binary mode
3560  (as-is).
3561 \end_layout
3563 \begin_layout Itemize
3564 If reading next line, the line is read in text mode (any line ending is
3565  skpped).
3566 \end_layout
3568 \begin_layout Subsubsection
3569 Method lines: Iterator to read all lines
3570 \end_layout
3572 \begin_layout Itemize
3573 Syntax: for line in handle:lines() do ...
3574  end
3575 \end_layout
3577 \begin_layout Standard
3578 Parameters:
3579 \end_layout
3581 \begin_layout Itemize
3582 handle: FILEREADER: The handle to read.
3583 \end_layout
3585 \begin_layout Standard
3586 Returns:
3587 \end_layout
3589 \begin_layout Itemize
3590 A lua iterator with one variable.
3591 \end_layout
3593 \begin_layout Standard
3594 Return a Lua iterator that iterates all the lines in <handle>.
3595 \end_layout
3597 \begin_layout Standard
3598 \begin_inset Newpage pagebreak
3599 \end_inset
3602 \end_layout
3604 \begin_layout Subsection
3605 COMPARE_OBJ: Watch memory area for changes
3606 \end_layout
3608 \begin_layout Standard
3609 Objects of this class allow fast checking for modifications to given memory
3610  block.
3611 \end_layout
3613 \begin_layout Subsubsection
3614 Static function new: Create a checker
3615 \end_layout
3617 \begin_layout Itemize
3618 Syntax: handle classes.COMPARE_OBJ.new({marea, offset|addrobj}, size, [rows,
3619  stride])
3620 \end_layout
3622 \begin_layout Itemize
3623 Syntax: handle memory.compare_new({marea, offset|addrobj}, size, rows, stride)
3624 \end_layout
3626 \begin_layout Standard
3627 Parameters:
3628 \end_layout
3630 \begin_layout Itemize
3631 marea: string: The memory area to interpret <offset> against.
3632 \end_layout
3634 \begin_layout Itemize
3635 offset: number: The initial offset in memory area.
3636 \end_layout
3638 \begin_layout Itemize
3639 addrobj: ADDRESS: The memory address.
3640 \end_layout
3642 \begin_layout Itemize
3643 size: number: The number of bytes in each row.
3644 \end_layout
3646 \begin_layout Itemize
3647 rows: number: The number of rows.
3648  Default is 1.
3649 \end_layout
3651 \begin_layout Itemize
3652 stride: number: The number of bytes offset increments from one row to next.
3653 \end_layout
3655 \begin_layout Standard
3656 Returns:
3657 \end_layout
3659 \begin_layout Itemize
3660 A handle to object.
3661 \end_layout
3663 \begin_layout Standard
3664 Return an object watching specified memory area.
3665 \end_layout
3667 \begin_layout Itemize
3668 Note: For fastest operation, limit checks to inside one memory area (that
3669  has to be mappable, individual RAM areas often are).
3670 \end_layout
3672 \begin_layout Subsubsection
3673 operator(): Check area for modifications
3674 \end_layout
3676 \begin_layout Itemize
3677 Syntax: boolean handle()
3678 \end_layout
3680 \begin_layout Standard
3681 Returns:
3682 \end_layout
3684 \begin_layout Itemize
3685 True if memory block has been modified since last call (or object creation
3686  if first call), false if not.
3687 \end_layout
3689 \begin_layout Standard
3690 Check if the block has been modified.
3691 \end_layout
3693 \begin_layout Subsection
3694 ADDRESS: Memory address
3695 \end_layout
3697 \begin_layout Standard
3698 Objects of this class contain a memory address.
3699 \end_layout
3701 \begin_layout Subsubsection
3702 Static function new: Create new memory address
3703 \end_layout
3705 \begin_layout Itemize
3706 Syntax: ADDRESS classes.ADDRESS.new(string marea, number offset)
3707 \end_layout
3709 \begin_layout Itemize
3710 Syntax: ADDRESS memory.address.new(string marea, number offset)
3711 \end_layout
3713 \begin_layout Itemize
3714 Syntax: ADDRESS memory.mkaddr(string marea, number offset)
3715 \end_layout
3717 \begin_layout Standard
3718 Parameters:
3719 \end_layout
3721 \begin_layout Itemize
3722 marea: The memory area
3723 \end_layout
3725 \begin_layout Itemize
3726 offset: The offset in memory area.
3727 \end_layout
3729 \begin_layout Standard
3730 Returns:
3731 \end_layout
3733 \begin_layout Itemize
3734 The memory area.
3735 \end_layout
3737 \begin_layout Standard
3738 Construct a new memory address object.
3739 \end_layout
3741 \begin_layout Subsubsection
3742 Method: addr: Get global address
3743 \end_layout
3745 \begin_layout Itemize
3746 Syntax: number addr:addr()
3747 \end_layout
3749 \begin_layout Standard
3750 Parameters:
3751 \end_layout
3753 \begin_layout Itemize
3754 addr: ADRESS: The original address.
3755 \end_layout
3757 \begin_layout Standard
3758 Returns:
3759 \end_layout
3761 \begin_layout Itemize
3762 The global address corresponding to this address.
3763 \end_layout
3765 \begin_layout Subsubsection
3766 Method: vma: Get memory area
3767 \end_layout
3769 \begin_layout Itemize
3770 Syntax: string addr:vma()
3771 \end_layout
3773 \begin_layout Standard
3774 Parameters:
3775 \end_layout
3777 \begin_layout Itemize
3778 addr: ADRESS: The original address.
3779 \end_layout
3781 \begin_layout Standard
3782 Returns:
3783 \end_layout
3785 \begin_layout Itemize
3786 The memory area corresponding to this address.
3787 \end_layout
3789 \begin_layout Subsubsection
3790 Method: offset: Get memory area offset
3791 \end_layout
3793 \begin_layout Itemize
3794 Syntax: string addr:offset()
3795 \end_layout
3797 \begin_layout Standard
3798 Parameters:
3799 \end_layout
3801 \begin_layout Itemize
3802 addr: ADRESS: The original address.
3803 \end_layout
3805 \begin_layout Standard
3806 Returns:
3807 \end_layout
3809 \begin_layout Itemize
3810 The offset in memory area corresponding to this address.
3811 \end_layout
3813 \begin_layout Subsubsection
3814 Method: replace: Replace address part
3815 \end_layout
3817 \begin_layout Itemize
3818 Syntax: ADDRESS addr:replace(offset[, bits])
3819 \end_layout
3821 \begin_layout Standard
3822 Parameters:
3823 \end_layout
3825 \begin_layout Itemize
3826 addr: ADRESS: The original address.
3827 \end_layout
3829 \begin_layout Itemize
3830 offset: number: The new offset
3831 \end_layout
3833 \begin_layout Itemize
3834 bits: number: The number of LSB to replace.
3835 \end_layout
3837 \begin_layout Standard
3838 Returns:
3839 \end_layout
3841 \begin_layout Itemize
3842 The modified address
3843 \end_layout
3845 \begin_layout Standard
3846 Returns a new address, with <bits> (all if missing) least significant bits
3847  of <addr> replaced by LSB of <offset>.
3848 \end_layout
3850 \begin_layout Subsubsection
3851 Method: add: Add to address
3852 \end_layout
3854 \begin_layout Itemize
3855 Syntax: ADDRESS addr:add(offset)
3856 \end_layout
3858 \begin_layout Itemize
3859 Syntax: ADDRESS addr:add(number, stride)
3860 \end_layout
3862 \begin_layout Itemize
3863 Syntax: ADDRESS addr:add(number, stride, offset)
3864 \end_layout
3866 \begin_layout Standard
3867 Parameters:
3868 \end_layout
3870 \begin_layout Itemize
3871 addr: ADRESS: The original address.
3872 \end_layout
3874 \begin_layout Itemize
3875 offset: number: Offset to add.
3876 \end_layout
3878 \begin_layout Itemize
3879 number: number: Number of table strides to add.
3880 \end_layout
3882 \begin_layout Itemize
3883 stride: number: The table stride.
3884 \end_layout
3886 \begin_layout Standard
3887 Returns:
3888 \end_layout
3890 \begin_layout Itemize
3891 The modified address
3892 \end_layout
3894 \begin_layout Standard
3895 Adds <offset>, <number>*<stride> or <number>*<stride>+<offset> into specified
3896  address <addr>.
3897 \end_layout
3899 \begin_layout Subsection
3900 ADDRESS:<op>: Read/Write memory
3901 \end_layout
3903 \begin_layout Itemize
3904 Syntax: none addr:<op>(value)
3905 \end_layout
3907 \begin_layout Itemize
3908 Syntax: number addr:<op>()
3909 \end_layout
3911 \begin_layout Standard
3912 Parameters:
3913 \end_layout
3915 \begin_layout Itemize
3916 addr: ADDRESS: The address to read/write.
3917 \end_layout
3919 \begin_layout Itemize
3920 value: number: The number to write.
3921 \end_layout
3923 \begin_layout Standard
3924 Returns:
3925 \end_layout
3927 \begin_layout Itemize
3928 The value read.
3929 \end_layout
3931 \begin_layout Standard
3932 Read/Write value from/to given address <addr>.
3933  The value written is <value>.
3934  <Op> is of form: [i][s]<type>, where:
3935 \end_layout
3937 \begin_layout Itemize
3938 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
3939 \end_layout
3941 \begin_layout Itemize
3942 'i' signifies that the value is treated as opposite-to-normal endianess,
3943 \end_layout
3945 \begin_layout Itemize
3946 's' signifies that value is treated as signed (not available for floating-point).
3947 \end_layout
3949 \begin_layout Standard
3950 \begin_inset Newpage pagebreak
3951 \end_inset
3954 \end_layout
3956 \begin_layout Section
3957 Global
3958 \end_layout
3960 \begin_layout Subsection
3961 print: Print values to console
3962 \end_layout
3964 \begin_layout Itemize
3965 Syntax: none print(value...
3966  values)
3967 \end_layout
3969 \begin_layout Standard
3970 Prints specified values to console.
3971  Can print any Lua type at least enough to identify the type and instance.
3972 \end_layout
3974 \begin_layout Subsection
3975 tostringx: Format a value to string
3976 \end_layout
3978 \begin_layout Itemize
3979 Syntax: string tostringx(value val)
3980 \end_layout
3982 \begin_layout Standard
3983 Formats value <val> like print would, and returns the result as a string.
3984 \end_layout
3986 \begin_layout Subsection
3987 exec: Execute lsnes commands
3988 \end_layout
3990 \begin_layout Itemize
3991 Syntax: none exec(string cmd)
3992 \end_layout
3994 \begin_layout Standard
3995 Execute lsnes command <cmd>.
3996 \end_layout
3998 \begin_layout Subsection
3999 utime: Get current time
4000 \end_layout
4002 \begin_layout Itemize
4003 Syntax: (number,number) utime()
4004 \end_layout
4006 \begin_layout Standard
4007 Returns two numbers.
4008  First is time since some epoch in seconds, the second is microseconds mod
4009  10^6 since that epoch.
4010 \end_layout
4012 \begin_layout Subsection
4013 set_idle_timeout: Run function after timeout when emulator is idle
4014 \end_layout
4016 \begin_layout Itemize
4017 Syntax: none set_idle_timeout(number timeout)
4018 \end_layout
4020 \begin_layout Standard
4021 Set number of microseconds to block idle for.
4022  After this timeout has expired, on_idle() will be called once.
4023 \end_layout
4025 \begin_layout Subsection
4026 set_timer_timeout: Run function after timeout.
4027 \end_layout
4029 \begin_layout Itemize
4030 Syntax: none set_timer_timeout(number timeout)
4031 \end_layout
4033 \begin_layout Standard
4034 Set number of microseconds to block timer for.
4035  After this timeout has expired, on_timer() will be called once.
4036 \end_layout
4038 \begin_layout Subsection
4039 bus_address: Look up address in system bus.
4040 \end_layout
4042 \begin_layout Itemize
4043 Syntax: none bus_address(number bus_addr)
4044 \end_layout
4046 \begin_layout Standard
4047 Returns virtual address corresponding to specified address on system bus.
4048 \end_layout
4050 \begin_layout Subsection
4051 loopwrapper: Convert loop into callable function
4052 \end_layout
4054 \begin_layout Itemize
4055 Syntax: function loopwrapper(function fun, ...)
4056 \end_layout
4058 \begin_layout Standard
4059 Calls function <fun> with function and specified arguments.
4060  The function passed suspends execution until the function returned is called.
4061  Handy for linear flow control among multiple invocations of a hook.
4062  Example code:
4063 \end_layout
4065 \begin_layout LyX-Code
4066 on_paint = loopwrapper(function(wait)
4067 \end_layout
4069 \begin_deeper
4070 \begin_layout LyX-Code
4071 while true do
4072 \end_layout
4074 \begin_deeper
4075 \begin_layout LyX-Code
4076 gui.text(0, 0, 
4077 \begin_inset Quotes eld
4078 \end_inset
4080 Test!
4081 \begin_inset Quotes erd
4082 \end_inset
4085 \end_layout
4087 \begin_layout LyX-Code
4088 wait();
4089 \end_layout
4091 \end_deeper
4092 \begin_layout LyX-Code
4094 \end_layout
4096 \end_deeper
4097 \begin_layout LyX-Code
4098 end);
4099 \end_layout
4101 \begin_layout Subsection
4102 list_bindings: List keybindings
4103 \end_layout
4105 \begin_layout Itemize
4106 Syntax: table list_bindings([string cmd])
4107 \end_layout
4109 \begin_layout Standard
4110 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
4111  If <cmd> is specified, the table is limited to that command.
4112  Also searches for controller keys.
4113 \end_layout
4115 \begin_layout Subsection
4116 get_alias: Get expansion of alias
4117 \end_layout
4119 \begin_layout Itemize
4120 Syntax: string get_alias(string aname)
4121 \end_layout
4123 \begin_layout Standard
4124 Get expansion of given alias <aname>.
4125 \end_layout
4127 \begin_layout Subsection
4128 set_alias: Set expansion of alias
4129 \end_layout
4131 \begin_layout Itemize
4132 Syntax: none set_alias(string aname, string value)
4133 \end_layout
4135 \begin_layout Standard
4136 Set expansion of given alias.
4137 \end_layout
4139 \begin_layout Subsection
4140 create_ibind: Create invese binding
4141 \end_layout
4143 \begin_layout Itemize
4144 Syntax: INVERSEBIND create_ibind(string name, string cmd)
4145 \end_layout
4147 \begin_layout Standard
4148 Return object representing inverse binding with specified name <name> and
4149  specified command <cmd>.
4150 \end_layout
4152 \begin_layout Itemize
4153 Note: To create press/release commands, use aliases +foo and -foo .
4154 \end_layout
4156 \begin_layout Itemize
4157 Note: Keep the returned object around.
4158 \end_layout
4160 \begin_layout Subsection
4161 create_command: Create a command
4162 \end_layout
4164 \begin_layout Itemize
4165 Syntax: COMMANDBIND create_commmand(string name, function a)
4166 \end_layout
4168 \begin_layout Itemize
4169 Syntax: COMMANDBIND create_commmand(string name, function a, function b)
4170 \end_layout
4172 \begin_layout Standard
4173 Return object representing a command (pair).
4174 \end_layout
4176 \begin_layout Itemize
4177 If only one function is specied, the command is level-sensitive, <a> is
4178  callback.
4179 \end_layout
4181 \begin_layout Itemize
4182 If <b> is function, the function is edge-sensitive, <a> is positive edge
4183  callback and <b> is negative edge callback.
4184 \end_layout
4186 \begin_layout Itemize
4187 All callbacks get single argument: The parameters passed.
4188 \end_layout
4190 \begin_layout Itemize
4191 Keep the returned object around.
4192 \end_layout
4194 \begin_layout Subsection
4195 loadfile: Load Lua script
4196 \end_layout
4198 \begin_layout Itemize
4199 Syntax: function loadfile(string filename[, string base])
4200 \end_layout
4202 \begin_layout Standard
4203 Load lua script from <filename>, resolved relative to <base> (if empty,
4204  current directory).
4205 \end_layout
4207 \begin_layout Subsection
4208 dofile: Execute Lua script
4209 \end_layout
4211 \begin_layout Itemize
4212 Syntax: function dofile(string filename[, string base])
4213 \end_layout
4215 \begin_layout Standard
4216 Execute lua script from <filename>, resolved relative to <base> (if empty,
4217  current directory) and return all return values.
4218 \end_layout
4220 \begin_layout Subsection
4221 resolve_filename: Resolve name of file relative to another
4222 \end_layout
4224 \begin_layout Itemize
4225 Syntax: string resolve_filename(string filename[, string base])
4226 \end_layout
4228 \begin_layout Standard
4229 Resolve name of file <filename> relative to <base> and return the result.
4230 \end_layout
4232 \begin_layout Subsection
4233 render_queue_function: Return paint function for render queue
4234 \end_layout
4236 \begin_layout Itemize
4237 Syntax: function render_queue_function(RENDERQUEUE rq)
4238 \end_layout
4240 \begin_layout Standard
4241 Return function that renders render queue <rq>.
4242 \end_layout
4244 \begin_layout Itemize
4245 Handy for paint callback if one is using render queues updated in other
4246  callbacks.
4247  As in:
4248 \end_layout
4250 \begin_layout LyX-Code
4251 handle = callback.paint:register(render_queue_function(my_rq));
4252 \end_layout
4254 \begin_layout Subsection
4255 identify_class: Identify class of object
4256 \end_layout
4258 \begin_layout Itemize
4259 Syntax: string identify_class(userdata object)
4260 \end_layout
4262 \begin_layout Standard
4263 Identifies the class of userdata <object>, if possible.
4264  If no identification is possible, returns 
4265 \begin_inset Quotes eld
4266 \end_inset
4268 unknown
4269 \begin_inset Quotes erd
4270 \end_inset
4273 \end_layout
4275 \begin_layout Subsection
4276 lookup_class: Lookup class by name
4277 \end_layout
4279 \begin_layout Itemize
4280 Syntax: classobj lookup_class(string name)
4281 \end_layout
4283 \begin_layout Standard
4284 Looks up class corresponding to <name>, if possible.
4285  If not found, returns nil.
4286  The classobj has following fields:
4287 \end_layout
4289 \begin_layout Itemize
4290 _static_methods: Return static method names
4291 \end_layout
4293 \begin_layout Itemize
4294 _class_methods: Return class method names
4295 \end_layout
4297 \begin_layout Itemize
4298 <static-function-name>: The specified static function.
4299 \end_layout
4301 \begin_layout Subsection
4302 all_classes: Get list of all classes
4303 \end_layout
4305 \begin_layout Itemize
4306 Syntax: string...
4307  all_classes()
4308 \end_layout
4310 \begin_layout Standard
4311 Get names of all classes available.
4312 \end_layout
4314 \begin_layout Subsection
4316 \end_layout
4318 \begin_layout Subsection
4319 icnov: Class ICONV
4320 \end_layout
4322 \begin_layout Standard
4323 See class ICONV.
4324 \end_layout
4326 \begin_layout Subsection
4327 filereader: Class FILEREADER
4328 \end_layout
4330 \begin_layout Standard
4331 See class FILEREADER.
4332 \end_layout
4334 \begin_layout Standard
4335 \begin_inset Newpage pagebreak
4336 \end_inset
4339 \end_layout
4341 \begin_layout Section
4342 Table bit:
4343 \end_layout
4345 \begin_layout Standard
4346 Bitwise logical functions and related.
4347 \end_layout
4349 \begin_layout Subsection
4350 bit.none/bit.bnot: Bitwise none or NOT function
4351 \end_layout
4353 \begin_layout Itemize
4354 Syntax: number bit.none(number...)
4355 \end_layout
4357 \begin_layout Itemize
4358 Syntax: number bit.bnot(number...)
4359 \end_layout
4361 \begin_layout Standard
4362 48-bit bitwise NOT / NONE function (set bits that are set in none of the
4363  arguments).
4364 \end_layout
4366 \begin_layout Subsection
4367 bit.any/bit.bor: Bitwise any or OR function
4368 \end_layout
4370 \begin_layout Itemize
4371 Syntax: number bit.any(number...)
4372 \end_layout
4374 \begin_layout Itemize
4375 Syntax: number bit.bor(number...)
4376 \end_layout
4378 \begin_layout Standard
4379 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
4380 \end_layout
4382 \begin_layout Subsection
4383 bit.all/bit.band: Bitwise all or AND function
4384 \end_layout
4386 \begin_layout Itemize
4387 Syntax: number bit.all(number...)
4388 \end_layout
4390 \begin_layout Itemize
4391 Syntax: number bit.band(number...)
4392 \end_layout
4394 \begin_layout Standard
4395 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
4397 \end_layout
4399 \begin_layout Subsection
4400 bit.parity/bit.bxor: Bitwise parity or XOR function
4401 \end_layout
4403 \begin_layout Itemize
4404 Syntax: number bit.parity(number...)
4405 \end_layout
4407 \begin_layout Itemize
4408 Syntax: number bit.bxor(number...)
4409 \end_layout
4411 \begin_layout Standard
4412 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
4413  of the arguments).
4414 \end_layout
4416 \begin_layout Subsection
4417 bit.lrotate: Rotate a number left
4418 \end_layout
4420 \begin_layout Itemize
4421 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
4422 \end_layout
4424 \begin_layout Standard
4425 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4426  1) places.
4427 \end_layout
4429 \begin_layout Subsection
4430 bit.rrotate: Rotate a number right
4431 \end_layout
4433 \begin_layout Itemize
4434 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
4435 \end_layout
4437 \begin_layout Standard
4438 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
4439  1) places.
4440 \end_layout
4442 \begin_layout Subsection
4443 bit.lshift: Shift a number left
4444 \end_layout
4446 \begin_layout Itemize
4447 Syntax: number bit.lshift(number base[, number amount[, number bits]])
4448 \end_layout
4450 \begin_layout Standard
4451 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4452  1) places.
4453  The new bits are filled with zeroes.
4454 \end_layout
4456 \begin_layout Subsection
4457 bit.lrshift: Shift a number right (logical)
4458 \end_layout
4460 \begin_layout Itemize
4461 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
4462 \end_layout
4464 \begin_layout Standard
4465 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4466  (default 1) places.
4467  The new bits are filled with zeroes.
4468 \end_layout
4470 \begin_layout Subsection
4471 bit.arshift: Shift a number right (arithmetic)
4472 \end_layout
4474 \begin_layout Itemize
4475 Syntax: number bit.arshift(number base[, number amount[, number bits]])
4476 \end_layout
4478 \begin_layout Standard
4479 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4480  (default 1) places.
4481  The new bits are shifted in with copy of the high bit.
4482 \end_layout
4484 \begin_layout Subsection
4485 bit.extract: Extract/shuffle bits from number
4486 \end_layout
4488 \begin_layout Itemize
4489 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
4490 \end_layout
4492 \begin_layout Standard
4493 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
4494 \end_layout
4496 \begin_layout Itemize
4497 Note: Bit numbers up to 51 should work reliably (then things start falling
4498  apart due to double precision issues).
4499 \end_layout
4501 \begin_layout Itemize
4502 Note: There are two special bit positions, true and false, standing for
4503  always set bit and always clear bit.
4504 \end_layout
4506 \begin_layout Subsection
4507 bit.value: Construct number with specified bits set
4508 \end_layout
4510 \begin_layout Itemize
4511 Syntax: number bit.value([number bit1[, number bit2,...]])
4512 \end_layout
4514 \begin_layout Standard
4515 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
4516  <bit2> places and so on.
4517  As special value, nil argument is no-op.
4518 \end_layout
4520 \begin_layout Subsection
4521 bit.test: Test if bit is set
4522 \end_layout
4524 \begin_layout Itemize
4525 Syntax: boolean bit.test(number a, number bit)
4526 \end_layout
4528 \begin_layout Standard
4529 Tests if bit <bit> is set in <a>.
4530  If it is set, returns true, otherwise false.
4531 \end_layout
4533 \begin_layout Subsection
4534 bit.testn: Test if bit is clear
4535 \end_layout
4537 \begin_layout Itemize
4538 Syntax: boolean bit.testn(number a, number bit)
4539 \end_layout
4541 \begin_layout Standard
4542 Tests if bit <bit> is set in <a>.
4543  If it is clear, returns true, otherwise false.
4544 \end_layout
4546 \begin_layout Subsection
4547 bit.test_any: Test if any bit is set
4548 \end_layout
4550 \begin_layout Itemize
4551 Syntax: boolean bit.test_any(number a, number b)
4552 \end_layout
4554 \begin_layout Standard
4555 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
4556 \end_layout
4558 \begin_layout Subsection
4559 bit.test_all: Test if all bits are set
4560 \end_layout
4562 \begin_layout Itemize
4563 Syntax: boolean bit.test_all(number a, number b)
4564 \end_layout
4566 \begin_layout Standard
4567 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
4568 \end_layout
4570 \begin_layout Subsection
4571 bit.popcount: Population count
4572 \end_layout
4574 \begin_layout Itemize
4575 Syntax: number bit.popcount(number a)
4576 \end_layout
4578 \begin_layout Standard
4579 Returns number of set bits in <a>.
4580 \end_layout
4582 \begin_layout Subsection
4583 bit.clshift: Chained left shift
4584 \end_layout
4586 \begin_layout Itemize
4587 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
4588  bits]])
4589 \end_layout
4591 \begin_layout Standard
4592 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
4593  numbers to be of specified number of bits <bits> (default 48).
4594 \end_layout
4596 \begin_layout Subsection
4597 bit.crshift: Chained right shift
4598 \end_layout
4600 \begin_layout Itemize
4601 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
4602  bits]])
4603 \end_layout
4605 \begin_layout Standard
4606 Does chained right shift on <a>, <b> by <amount> positions (default 1),
4607  assuming numbers to be of specified number of bits <bits> (default 48).
4608 \end_layout
4610 \begin_layout Subsection
4611 bit.flagdecode: Decode bitfield into flags
4612 \end_layout
4614 \begin_layout Itemize
4615 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
4616  off]])
4617 \end_layout
4619 \begin_layout Standard
4620 Return string of length bits where ith character is ith character of on
4621  if bit i is on, otherwise ith character of off.
4622  Out of range reads give last character.
4623 \end_layout
4625 \begin_layout Itemize
4626 Note: <on> defaults to '*' if empty.
4627 \end_layout
4629 \begin_layout Itemize
4630 Note: <off> defaults to '-' if empty.
4631 \end_layout
4633 \begin_layout Subsection
4634 bit.rflagdecode: Decode bitfield into flags
4635 \end_layout
4637 \begin_layout Itemize
4638 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
4639  off]])
4640 \end_layout
4642 \begin_layout Standard
4643 Like bit.flagdecode, but outputs the string in the opposite order (most significa
4644 nt bit first).
4645 \end_layout
4647 \begin_layout Subsection
4648 bit.swap{,s}{,h,d,q}word: Swap word endian
4649 \end_layout
4651 \begin_layout Itemize
4652 Syntax: number bit.swapword(number n)
4653 \end_layout
4655 \begin_layout Itemize
4656 Syntax: number bit.swaphword(number n)
4657 \end_layout
4659 \begin_layout Itemize
4660 Syntax: number bit.swapdword(number n)
4661 \end_layout
4663 \begin_layout Itemize
4664 Syntax: number bit.swapqword(number n)
4665 \end_layout
4667 \begin_layout Itemize
4668 Syntax: number bit.swapsword(number n)
4669 \end_layout
4671 \begin_layout Itemize
4672 Syntax: number bit.swapshword(number n)
4673 \end_layout
4675 \begin_layout Itemize
4676 Syntax: number bit.swapsdword(number n)
4677 \end_layout
4679 \begin_layout Itemize
4680 Syntax: number bit.swapsqword(number n)
4681 \end_layout
4683 \begin_layout Standard
4684 Swap endianess of (un)signed integer <n>.
4685 \end_layout
4687 \begin_layout Subsection
4688 bit.compose: Compose multi-byte number
4689 \end_layout
4691 \begin_layout Itemize
4692 Syntax: number bit.compose(number n...)
4693 \end_layout
4695 \begin_layout Standard
4696 Return 
4697 \begin_inset Formula $n_{1}+256n_{2}+256^{2}n_{3}+\ldots$
4698 \end_inset
4701 \end_layout
4703 \begin_layout Subsection
4704 bit.binary_ld_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Load binary integer
4705 \end_layout
4707 \begin_layout Itemize
4708 Syntax: number bit.binary_ld_<type>le(string str, number pos);
4709 \end_layout
4711 \begin_layout Itemize
4712 Syntax: number bit.binary_ld_<type>be(string str, number pos);
4713 \end_layout
4715 \begin_layout Standard
4716 Load little (*le) or big (*be) endian binary number from position <pos>
4717  of string <str>.
4718  Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4719  double.
4720 \end_layout
4722 \begin_layout Subsection
4723 bit.binary_st_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Store binary integer
4724 \end_layout
4726 \begin_layout Itemize
4727 Syntax: string bit.binary_st_<type>le(number x);
4728 \end_layout
4730 \begin_layout Itemize
4731 Syntax: string bit.binary_st_<type>be(number x);
4732 \end_layout
4734 \begin_layout Standard
4735 Store specified number <x> as binary in string and return the result.
4736  Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4737  double.
4738 \end_layout
4740 \begin_layout Subsection
4741 bit.quotent: Integer quotent
4742 \end_layout
4744 \begin_layout Itemize
4745 Syntax: number bit.quotent(number a, number b)
4746 \end_layout
4748 \begin_layout Standard
4749 Calculate quotent a/b.
4750 \end_layout
4752 \begin_layout Subsection
4753 bit.multidiv: Divide and split among multiple divisiors
4754 \end_layout
4756 \begin_layout Itemize
4757 Syntax: number...
4758  bit.multidiv(number v, number q...)
4759 \end_layout
4761 \begin_layout Standard
4762 Does the following steps:
4763 \end_layout
4765 \begin_layout Enumerate
4766 Set v' to <v>.
4767 \end_layout
4769 \begin_layout Enumerate
4770 For each <q> q:
4771 \end_layout
4773 \begin_deeper
4774 \begin_layout Enumerate
4775 Calculate quotent(v'/q) and add that to numbers returned.
4776 \end_layout
4778 \begin_layout Enumerate
4779 v' <- remainder(v'/q)
4780 \end_layout
4782 \end_deeper
4783 \begin_layout Enumerate
4784 Add v' to numbers returned.
4785 \end_layout
4787 \begin_layout Standard
4788 That is, it successively divides <v> by <q>s, and reduces <v> modulo <q>
4789  at each step.
4790  <v> may be floating point, <q>s are integers.
4791 \end_layout
4793 \begin_layout Itemize
4794 E.g.
4795  bit.multidiv(time, 3600, 60) splits time into hours, minutes and seconds.
4796 \end_layout
4798 \begin_layout Itemize
4799 E.g.
4800  bit.multidiv(a, b) calculates quotent and remainder of a/b.
4801 \end_layout
4803 \begin_layout Subsection
4804 bit.mul32: 32-bit multiply
4805 \end_layout
4807 \begin_layout Itemize
4808 Syntax: number, number bit.mul32(number a, number b)
4809 \end_layout
4811 \begin_layout Standard
4812 Multiply 32-bit numbers <a> and <b>.
4813  The first return value is low 32 bits of result, the second is high 32
4814  bits.
4815 \end_layout
4817 \begin_layout Standard
4818 \begin_inset Newpage pagebreak
4819 \end_inset
4822 \end_layout
4824 \begin_layout Section
4825 Table classes:
4826 \end_layout
4828 \begin_layout Subsection
4829 classes.<foo>: The classobj for class <foo>
4830 \end_layout
4832 \begin_layout Itemize
4833 Syntax: classes.<foo>
4834 \end_layout
4836 \begin_layout Standard
4837 The classobj for class <foo>.
4838 \end_layout
4840 \begin_layout Subsection
4841 classes.<foo>._static_methods: Enumerate static methods
4842 \end_layout
4844 \begin_layout Itemize
4845 Syntax: string...
4846  classes.<foo>._static_methods()
4847 \end_layout
4849 \begin_layout Standard
4850 Returns all static methods of <foo> as strings.
4851 \end_layout
4853 \begin_layout Subsection
4854 classes.<foo>._class_methods: Enumerate static methods
4855 \end_layout
4857 \begin_layout Itemize
4858 Syntax: string...
4859  classes.<foo>._class_methods()
4860 \end_layout
4862 \begin_layout Standard
4863 Returns all class methods of <foo> as strings.
4864 \end_layout
4866 \begin_layout Subsection
4867 classes.<foo>.<bar>: Static method
4868 \end_layout
4870 \begin_layout Itemize
4871 Syntax: variable classes.<foo>.<bar>(variable...)
4872 \end_layout
4874 \begin_layout Standard
4875 Invokes static method <bar> of class <foo>.
4876 \end_layout
4878 \begin_layout Section
4879 Table gui:
4880 \end_layout
4882 \begin_layout Subsection
4883 gui.resolution: Get current resolution
4884 \end_layout
4886 \begin_layout Itemize
4887 Syntax: (number, number) gui.resolution()
4888 \end_layout
4890 \begin_layout Standard
4891 Returns 2-tuple (hresolution, vresolution).
4892 \end_layout
4894 \begin_layout Subsection
4895 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
4896 \end_layout
4898 \begin_layout Itemize
4899 Syntax: number gui.left_gap(number gap)
4900 \end_layout
4902 \begin_layout Itemize
4903 Syntax: number gui.right_gap(number gap)
4904 \end_layout
4906 \begin_layout Itemize
4907 Syntax: number gui.top_gap(number gap)
4908 \end_layout
4910 \begin_layout Itemize
4911 Syntax: number gui.bottom_gap(number gap)
4912 \end_layout
4914 \begin_layout Standard
4915 Set the specified edge gap to specified value <gap> (max gap is 8191).
4916  If successful, old gap is returned.
4917 \end_layout
4919 \begin_layout Subsection
4920 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
4921  Adjust edge gaps
4922 \end_layout
4924 \begin_layout Itemize
4925 Syntax: number gui.delta_left_gap(number dgap)
4926 \end_layout
4928 \begin_layout Itemize
4929 Syntax: number gui.delta_right_gap(number dgap)
4930 \end_layout
4932 \begin_layout Itemize
4933 Syntax: number gui.delta_top_gap(number dgap)
4934 \end_layout
4936 \begin_layout Itemize
4937 Syntax: number gui.delta_bottom_gap(number dgap)
4938 \end_layout
4940 \begin_layout Standard
4941 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
4942  and return the old gap (returns nothing on error).
4943 \end_layout
4945 \begin_layout Subsection
4946 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
4947 \end_layout
4949 \begin_layout Itemize
4950 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
4951  bgc]])
4952 \end_layout
4954 \begin_layout Itemize
4955 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
4956  bgc]])
4957 \end_layout
4959 \begin_layout Itemize
4960 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
4961  bgc]])
4962 \end_layout
4964 \begin_layout Itemize
4965 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
4966  bgc]])
4967 \end_layout
4969 \begin_layout Standard
4970 Draw specified text on the GUI (each character cell is 8 or 16 wide and
4971  16 high).
4972  Parameters:
4973 \end_layout
4975 \begin_layout Itemize
4976 x: X-coordinate to start the drawing from (and x-coordinate at begining
4977  of the lines).
4978 \end_layout
4980 \begin_layout Itemize
4981 y: Y-coordinate to start the drawing from.
4982 \end_layout
4984 \begin_layout Itemize
4985 text: The text to draw.
4986 \end_layout
4988 \begin_layout Itemize
4989 fgc: Text color (default is 0xFFFFFF (white))
4990 \end_layout
4992 \begin_layout Itemize
4993 bgc: Background color (default is -1 (transparent))
4994 \end_layout
4996 \begin_layout Standard
4997 Note: The H variants draw at double width and V variants draw at double
4998  height.
4999 \end_layout
5001 \begin_layout Subsection
5002 gui.rectangle: Draw a rectangle
5003 \end_layout
5005 \begin_layout Itemize
5006 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5007  number thickness[, number outline[, number fill]]])
5008 \end_layout
5010 \begin_layout Standard
5011 Draw rectangle on the GUI.
5012  Parameters:
5013 \end_layout
5015 \begin_layout Itemize
5016 x: X-coordinate of left edge.
5017 \end_layout
5019 \begin_layout Itemize
5020 y: Y-coordinate of upper edge.
5021 \end_layout
5023 \begin_layout Itemize
5024 width: Width of rectangle.
5025 \end_layout
5027 \begin_layout Itemize
5028 height: Height of rectangle.
5029 \end_layout
5031 \begin_layout Itemize
5032 thickness: Thickness of outline (default is 1).
5033 \end_layout
5035 \begin_layout Itemize
5036 outline: Color of outline (default is 0xFFFFFF (white))
5037 \end_layout
5039 \begin_layout Itemize
5040 fill: Color of fill (default is -1 (transparent))
5041 \end_layout
5043 \begin_layout Subsection
5044 gui.solidrectangle: Draw a solid rectangle
5045 \end_layout
5047 \begin_layout Itemize
5048 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5049  number color])
5050 \end_layout
5052 \begin_layout Standard
5053 Draw solid rectangle on the GUI.
5054  Parameters:
5055 \end_layout
5057 \begin_layout Itemize
5058 x: X-coordinate of left edge.
5059 \end_layout
5061 \begin_layout Itemize
5062 y: Y-coordinate of upper edge.
5063 \end_layout
5065 \begin_layout Itemize
5066 width: Width of rectangle.
5067 \end_layout
5069 \begin_layout Itemize
5070 height: Height of rectangle.
5071 \end_layout
5073 \begin_layout Itemize
5074 color: Color of rectangle (default is 0xFFFFFF (white))
5075 \end_layout
5077 \begin_layout Subsection
5078 gui.box: Draw a 3D-effect box
5079 \end_layout
5081 \begin_layout Itemize
5082 Syntax: none gui.box(number x, number y, number width, number height[, number
5083  thickness[, number outline1[,number outline2[, number fill]]]])
5084 \end_layout
5086 \begin_layout Standard
5087 Draw rectangle with 3D effect on the GUI.
5088  Parameters:
5089 \end_layout
5091 \begin_layout Itemize
5092 x: X-coordinate of left edge.
5093 \end_layout
5095 \begin_layout Itemize
5096 y: Y-coordinate of upper edge.
5097 \end_layout
5099 \begin_layout Itemize
5100 width: Width of rectangle.
5101 \end_layout
5103 \begin_layout Itemize
5104 height: Height of rectangle.
5105 \end_layout
5107 \begin_layout Itemize
5108 thickness: Thickness of outline (default is 1).
5109 \end_layout
5111 \begin_layout Itemize
5112 outline1: First color of outline (default is 0xFFFFFF (white))
5113 \end_layout
5115 \begin_layout Itemize
5116 outline2: First color of outline (default is 0x808080 (dark gray))
5117 \end_layout
5119 \begin_layout Itemize
5120 fill: Color of fill (default is 0xC0C0C0 (light grayy))
5121 \end_layout
5123 \begin_layout Subsection
5124 gui.pixel: Draw a single pixel
5125 \end_layout
5127 \begin_layout Itemize
5128 Syntax: none gui.pixel(number x, number y[, number color])
5129 \end_layout
5131 \begin_layout Standard
5132 Draw one pixel on the GUI.
5133  Parameters:
5134 \end_layout
5136 \begin_layout Itemize
5137 x: X-coordinate of the pixel
5138 \end_layout
5140 \begin_layout Itemize
5141 y: Y-coordinate of the pixel
5142 \end_layout
5144 \begin_layout Itemize
5145 color: Color of the pixel (default is 0xFFFFFF (white))
5146 \end_layout
5148 \begin_layout Subsection
5149 gui.crosshair: Draw a crosshair
5150 \end_layout
5152 \begin_layout Itemize
5153 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
5154 \end_layout
5156 \begin_layout Standard
5157 Draw a crosshair.
5158  Parameters:
5159 \end_layout
5161 \begin_layout Itemize
5162 x: X-coordinate of the crosshair
5163 \end_layout
5165 \begin_layout Itemize
5166 y: Y-coordinate of the crosshair
5167 \end_layout
5169 \begin_layout Itemize
5170 length: Length of the crosshair lines (default 10).
5171 \end_layout
5173 \begin_layout Itemize
5174 color: Color of the crosshair (default is 0xFFFFFF (white))
5175 \end_layout
5177 \begin_layout Subsection
5178 gui.line: Draw a line
5179 \end_layout
5181 \begin_layout Itemize
5182 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
5183  color])
5184 \end_layout
5186 \begin_layout Standard
5187 Draw a thin line.
5188  Parameters:
5189 \end_layout
5191 \begin_layout Itemize
5192 x1: X-coordinate of one end.
5193 \end_layout
5195 \begin_layout Itemize
5196 y1: Y-coordinate of one end.
5197 \end_layout
5199 \begin_layout Itemize
5200 x2: X-coordinate of the other end.
5201 \end_layout
5203 \begin_layout Itemize
5204 y2: Y-coordinate of the other end.
5205 \end_layout
5207 \begin_layout Itemize
5208 color: Color of the line (default is 0xFFFFFF (white)).
5209 \end_layout
5211 \begin_layout Subsection
5212 gui.circle: Draw a (filled) circle
5213 \end_layout
5215 \begin_layout Itemize
5216 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
5217  border[, number fil]]])
5218 \end_layout
5220 \begin_layout Standard
5221 Draw a circle.
5222  Parameters.
5223 \end_layout
5225 \begin_layout Itemize
5226 x: X-coordinate of the center
5227 \end_layout
5229 \begin_layout Itemize
5230 y: Y-coordinate of the center
5231 \end_layout
5233 \begin_layout Itemize
5234 r: The radius of the circle
5235 \end_layout
5237 \begin_layout Itemize
5238 thick: Border thickness
5239 \end_layout
5241 \begin_layout Itemize
5242 border: Border color (default is 0xFFFFFF (white))
5243 \end_layout
5245 \begin_layout Itemize
5246 fill: Fill color (default is -1 (transparent)).
5247 \end_layout
5249 \begin_layout Subsection
5250 gui.repaint: Arrange a repaint
5251 \end_layout
5253 \begin_layout Itemize
5254 Syntax: none gui.repaint()
5255 \end_layout
5257 \begin_layout Standard
5258 Request on_repaint() to happen as soon as possible.
5259 \end_layout
5261 \begin_layout Subsection
5262 gui.subframe_update: Enable/Disable subframe updates
5263 \end_layout
5265 \begin_layout Itemize
5266 Syntax: none gui.subframe_update(boolean on)
5267 \end_layout
5269 \begin_layout Standard
5270 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
5271  or not happen (<on>=false).
5272 \end_layout
5274 \begin_layout Subsection
5275 gui.screenshot: Write a screenshot
5276 \end_layout
5278 \begin_layout Itemize
5279 Syntax: none gui.screenshot(string filename)
5280 \end_layout
5282 \begin_layout Standard
5283 Write PNG screenshot of the current frame (no drawings) to specified file
5284  <filename>.
5285 \end_layout
5287 \begin_layout Subsection
5288 gui.screenshot_bitmap: Write a screenshot to bitmap
5289 \end_layout
5291 \begin_layout Itemize
5292 Syntax: DBITMAP gui.screenshot_bitmap()
5293 \end_layout
5295 \begin_layout Standard
5296 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
5297  the result.
5298 \end_layout
5300 \begin_layout Subsection
5301 gui.color: Compose a color.
5302 \end_layout
5304 \begin_layout Itemize
5305 Syntax: number gui.color(number r, number g, number b[, number a])
5306 \end_layout
5308 \begin_layout Itemize
5309 Syntax: number gui.color(string c)
5310 \end_layout
5312 \begin_layout Standard
5313 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
5314 , each component in scale 0-255.
5315  If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
5316  fully opaque).
5317  The default alpha is 256.
5318 \end_layout
5320 \begin_layout Standard
5321 The form taking a string returns color corresponding color name.
5322 \end_layout
5324 \begin_layout Subsection
5325 gui.status: Set status variable
5326 \end_layout
5328 \begin_layout Itemize
5329 Syntax: none gui.status(string name, string value)
5330 \end_layout
5332 \begin_layout Standard
5333 Set status field 
5334 \begin_inset Quotes eld
5335 \end_inset
5337 L[<name>]
5338 \begin_inset Quotes erd
5339 \end_inset
5341  to <value> in status area.
5342 \end_layout
5344 \begin_layout Subsection
5345 gui.rainbow: Rainbow color calculation
5346 \end_layout
5348 \begin_layout Itemize
5349 Syntax: number gui.rainbow(number step, number steps[, number color])
5350 \end_layout
5352 \begin_layout Standard
5353 Perform hue rotation of color <color> (default bright red), by <step> steps.
5354  The number of steps per full rotation is given by absolute value of <steps>.
5355 \end_layout
5357 \begin_layout Standard
5358 If <step> is negative, the rotation will be counterclockwise.
5359 \end_layout
5361 \begin_layout Subsection
5362 gui.kill_frame: Kill video frame and associated sound
5363 \end_layout
5365 \begin_layout Itemize
5366 Syntax: none gui.kill_frame()
5367 \end_layout
5369 \begin_layout Standard
5370 Kills the currently dumped video frame + the associated sound.
5371  Only valid in on_video callback.
5372 \end_layout
5374 \begin_layout Subsection
5375 gui.set_video_scale: Set video frame scale
5376 \end_layout
5378 \begin_layout Itemize
5379 Syntax: none gui.set_video_scale(number h, number v)
5380 \end_layout
5382 \begin_layout Standard
5383 Sets the scale factors of current frame to <h>x<v>.
5384  Only valid in on_video callback.
5385 \end_layout
5387 \begin_layout Subsection
5388 gui.arrow: Draw an arrow
5389 \end_layout
5391 \begin_layout Itemize
5392 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
5393  number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
5395 \end_layout
5397 \begin_layout Standard
5398 Draws an arrow using color <color>.
5399  The tip of arrow is at (<x>, <y>).
5400  Other parameters:
5401 \end_layout
5403 \begin_layout Enumerate
5404 <length>: The length of arrow tail.
5405 \end_layout
5407 \begin_layout Enumerate
5408 <hwidth>: The width of arrow head.
5409  Should be odd.
5410 \end_layout
5412 \begin_layout Enumerate
5413 <direction>: Direction of arrow.
5414  0 is to right, +1 rotates 45 degrees counterclockwise.
5415 \end_layout
5417 \begin_layout Enumerate
5418 <fill>: If true, fill the arrow head.
5419  Default false.
5420 \end_layout
5422 \begin_layout Enumerate
5423 <twidth>: Tail width.
5424  Should be odd.
5425  Default 1.
5426 \end_layout
5428 \begin_layout Enumerate
5429 <hthick>: Head thickness (only used if <fill> is false).
5430  Default is <twidth>.
5431 \end_layout
5433 \begin_layout Subsection
5434 gui.tiled_bitmap: Class TILEMAP
5435 \end_layout
5437 \begin_layout Standard
5438 See class TILEMAP.
5439 \end_layout
5441 \begin_layout Subsection
5442 gui.palette: Class PALETTE
5443 \end_layout
5445 \begin_layout Standard
5446 See class PALETTE.
5447 \end_layout
5449 \begin_layout Subsection
5450 gui.bitmap: Class BITMAP
5451 \end_layout
5453 \begin_layout Standard
5454 See class BITMAP.
5455 \end_layout
5457 \begin_layout Subsection
5458 gui.dbitmap: Class DBITMAP
5459 \end_layout
5461 \begin_layout Standard
5462 See class DBITMAP.
5463 \end_layout
5465 \begin_layout Subsection
5466 gui.font: Class CUSTOMFONT
5467 \end_layout
5469 \begin_layout Standard
5470 See class CUSTOMFONT.
5471 \end_layout
5473 \begin_layout Subsection
5474 gui.renderctx: Class RENDERCTX
5475 \end_layout
5477 \begin_layout Standard
5478 See class RENDERCTX.
5479 \end_layout
5481 \begin_layout Subsection
5482 gui.image: Class IMAGELOADER
5483 \end_layout
5485 \begin_layout Standard
5486 See class IMAGELOADER.
5487 \end_layout
5489 \begin_layout Subsection
5490 gui.get_runmode: Get current emulator mode
5491 \end_layout
5493 \begin_layout Itemize
5494 Syntax: string gui.get_runmode()
5495 \end_layout
5497 \begin_layout Standard
5498 Gets the current emulator runmode.
5499  The possible ones are:
5500 \end_layout
5502 \begin_layout Itemize
5503 quit: Emulator is quitting.
5504 \end_layout
5506 \begin_layout Itemize
5507 normal: Emulator is running emulation
5508 \end_layout
5510 \begin_layout Itemize
5511 load: Emulator is loading a movie/savestate
5512 \end_layout
5514 \begin_layout Itemize
5515 advance_frame: Emulator is doing frame advance
5516 \end_layout
5518 \begin_layout Itemize
5519 advance_subframe: Emulator is doing subframe advance
5520 \end_layout
5522 \begin_layout Itemize
5523 skiplag: Emulator is skipping lag frames
5524 \end_layout
5526 \begin_layout Itemize
5527 skiplag_pending: Emulator will start skipping lag frames next frame
5528 \end_layout
5530 \begin_layout Itemize
5531 pause: Emulator is paused
5532 \end_layout
5534 \begin_layout Itemize
5535 pause_break: Emulator is paused at breakpoint
5536 \end_layout
5538 \begin_layout Itemize
5539 corrupt: Emulator can't run because corrupt emulation state
5540 \end_layout
5542 \begin_layout Itemize
5543 unknown: Unknown state (should not happen).
5544 \end_layout
5546 \begin_layout Standard
5547 \begin_inset Newpage pagebreak
5548 \end_inset
5551 \end_layout
5553 \begin_layout Section
5554 table input
5555 \end_layout
5557 \begin_layout Standard
5558 Input handling.
5559  Functions manipulating input are only available in on_input callback.
5560 \end_layout
5562 \begin_layout Subsection
5563 input.get: Read controller button/axis (deprecated)
5564 \end_layout
5566 \begin_layout Itemize
5567 Syntax: number input.get(number controller, number index)
5568 \end_layout
5570 \begin_layout Standard
5571 Read the specified index <index> (zero-based) from specified controller
5572  <controller> (zero-based).
5574 \end_layout
5576 \begin_layout Subsection
5577 input.set: Write controller button/axis (deprecated)
5578 \end_layout
5580 \begin_layout Itemize
5581 Syntax: none input.set(number controller, number index, number value)
5582 \end_layout
5584 \begin_layout Standard
5585 Write the specified index <index> (zero-based) from specified controller
5586  <controller> (zero-based), storing value <value>.
5587 \end_layout
5589 \begin_layout Subsection
5590 input.get2: Read controller button/axis
5591 \end_layout
5593 \begin_layout Itemize
5594 Syntax: number input.get2(number port, number controller, number index)
5595 \end_layout
5597 \begin_layout Standard
5598 Read the specified input tuple.
5599  Port 0 is system port.
5600 \end_layout
5602 \begin_layout Subsection
5603 input.set2: Write controller button/axis
5604 \end_layout
5606 \begin_layout Itemize
5607 Syntax: input.set2(number port, number controller, number index, number value)
5608 \end_layout
5610 \begin_layout Standard
5611 Write the specified input tuple.
5612  Port 0 is system port.
5613 \end_layout
5615 \begin_layout Subsection
5616 input.lcid_to_pcid2: Look up logical controller
5617 \end_layout
5619 \begin_layout Itemize
5620 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
5621 \end_layout
5623 \begin_layout Standard
5624 Look up physical pcid pair (port, controller) corresponding to specified
5625  logical controller (1-based).
5626  Returns nothing if controller does not exist.
5627 \end_layout
5629 \begin_layout Subsection
5630 input.port_type: Look up port type
5631 \end_layout
5633 \begin_layout Itemize
5634 Syntax: string input.port_type(number port)
5635 \end_layout
5637 \begin_layout Standard
5638 Return type of specified port.
5639 \end_layout
5641 \begin_layout Subsection
5642 input.controller_info: Get information about controller
5643 \end_layout
5645 \begin_layout Itemize
5646 Syntax: table input.controller_info(number port, number controller)
5647 \end_layout
5649 \begin_layout Standard
5650 Get controller info for specified controller.
5651  If controller does not exist, returns nil.
5652  Otherwise returns a table with following fields:
5653 \end_layout
5655 \begin_layout Itemize
5656 type (string): Type of the controller.
5657 \end_layout
5659 \begin_layout Itemize
5660 class (string): Class of the controller.
5661 \end_layout
5663 \begin_layout Itemize
5664 classnum (number): Number of the controller within its class (1-based)
5665 \end_layout
5667 \begin_layout Itemize
5668 lcid (number): Logical controller number of the controller.
5669 \end_layout
5671 \begin_layout Itemize
5672 button_count (number): Number of buttons on controller
5673 \end_layout
5675 \begin_layout Itemize
5676 buttons (array): Array of following info about each button:
5677 \end_layout
5679 \begin_deeper
5680 \begin_layout Itemize
5681 type (string): Type of button.
5682  Currently one of 
5683 \begin_inset Quotes eld
5684 \end_inset
5686 null
5687 \begin_inset Quotes erd
5688 \end_inset
5691 \begin_inset Quotes eld
5692 \end_inset
5694 button
5695 \begin_inset Quotes erd
5696 \end_inset
5699 \begin_inset Quotes eld
5700 \end_inset
5702 axis
5703 \begin_inset Quotes erd
5704 \end_inset
5707 \begin_inset Quotes eld
5708 \end_inset
5710 raxis
5711 \begin_inset Quotes erd
5712 \end_inset
5715 \end_layout
5717 \begin_layout Itemize
5718 name (string): Name of button.
5719 \end_layout
5721 \begin_layout Itemize
5722 symbol (string): Symbol of button.
5723  Only present for type 
5724 \begin_inset Quotes eld
5725 \end_inset
5727 button
5728 \begin_inset Quotes erd
5729 \end_inset
5732 \end_layout
5734 \begin_layout Itemize
5735 hidden (boolean): True if hidden button.
5737 \end_layout
5739 \end_deeper
5740 \begin_layout Subsection
5741 input.veto_button: Veto a button press
5742 \end_layout
5744 \begin_layout Itemize
5745 Syntax: none input.veto_button()
5746 \end_layout
5748 \begin_layout Standard
5749 Signals that the button event should be vetoed.
5750  Only valid in on_button callback.
5751 \end_layout
5753 \begin_layout Subsection
5754 input.geta: Get all buttons for controller (deprecated)
5755 \end_layout
5757 \begin_layout Itemize
5758 Syntax: (number, number...) input.geta(number controller)
5759 \end_layout
5761 \begin_layout Standard
5762 Get input state for entiere controller.
5763  Returns n return values.
5764 \end_layout
5766 \begin_layout Itemize
5767 1st return value: Bitmask: bit i is set if i:th index is nonzero
5768 \end_layout
5770 \begin_layout Itemize
5771 2nd- return value: value of i:th index.
5772 \end_layout
5774 \begin_layout Subsection
5775 input.seta: Set all buttons for controller (deprecated)
5776 \end_layout
5778 \begin_layout Itemize
5779 Syntax: none input.seta(number controller, number bitmask, number args...)
5780 \end_layout
5782 \begin_layout Standard
5783 Set state for entiere controller.
5784  args is up to N values for indices (overriding values in bitmask if specified).
5785 \end_layout
5787 \begin_layout Subsection
5788 input.controllertype: Get controller type (deprecated)
5789 \end_layout
5791 \begin_layout Itemize
5792 syntax: string input.controllertype(number controller)
5793 \end_layout
5795 \begin_layout Standard
5796 Get the type of controller as string.
5797 \end_layout
5799 \begin_layout Subsection
5800 input.reset: Execute (delayed) reset
5801 \end_layout
5803 \begin_layout Itemize
5804 Syntax: none input.reset([number cycles])
5805 \end_layout
5807 \begin_layout Standard
5808 Execute reset.
5809  If <cycles> is greater than zero, do delayed reset.
5810  0 (or no value) causes immediate reset.
5811 \end_layout
5813 \begin_layout Itemize
5814 Note: Only available with subframe flag false.
5815 \end_layout
5817 \begin_layout Subsection
5818 input.raw: Return raw input data
5819 \end_layout
5821 \begin_layout Itemize
5822 Syntax: table input.raw()
5823 \end_layout
5825 \begin_layout Standard
5826 Returns table of tables of all available keys and axes.
5827  The first table is indexed by key name (platform-dependent!), and the inner
5828  table has the following fields:
5829 \end_layout
5831 \begin_layout Itemize
5832 value: Last reported value for control
5833 \end_layout
5835 \begin_deeper
5836 \begin_layout Itemize
5837 For keys: 1 for pressed, 0 for released.
5838 \end_layout
5840 \begin_layout Itemize
5841 For axes: -32767...32767.
5842 \end_layout
5844 \begin_layout Itemize
5845 For presure-sensitive buttons: 0...32767.
5846 \end_layout
5848 \begin_layout Itemize
5849 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
5850 \end_layout
5852 \begin_layout Itemize
5853 For mouse: Coordinates relative to game area.
5854 \end_layout
5856 \end_deeper
5857 \begin_layout Itemize
5858 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
5859 \end_layout
5861 \begin_layout Subsection
5862 input.keyhook: Hook a key
5863 \end_layout
5865 \begin_layout Itemize
5866 Syntax: none input.keyhook(string key, boolean state)
5867 \end_layout
5869 \begin_layout Standard
5870 Requests that keyhook events to be sent for key <key> (<state>=true) or
5871  not sent (<state>=false).
5872 \end_layout
5874 \begin_layout Subsection
5875 input.joyget: Get controls for controller
5876 \end_layout
5878 \begin_layout Itemize
5879 Syntax: table input.joyget(number logical)
5880 \end_layout
5882 \begin_layout Standard
5883 Returns table for current controls for specified logical controller <logical>.
5884  The names of fields vary by controller type.
5885 \end_layout
5887 \begin_layout Itemize
5888 The buttons have the same name as those are referred to in other contexts
5889  in the emulator
5890 \end_layout
5892 \begin_layout Itemize
5893 The analog axes are usually 
5894 \begin_inset Quotes eld
5895 \end_inset
5897 xaxis
5898 \begin_inset Quotes erd
5899 \end_inset
5901  and 
5902 \begin_inset Quotes eld
5903 \end_inset
5905 yaxis
5906 \begin_inset Quotes erd
5907 \end_inset
5910 \end_layout
5912 \begin_layout Itemize
5913 Each field is numeric or boolean depending on axis/button.
5914 \end_layout
5916 \begin_layout Subsection
5917 input.joyset: Set controls for controller
5918 \end_layout
5920 \begin_layout Itemize
5921 Syntax: none input.joyset(number controller, table controls)
5922 \end_layout
5924 \begin_layout Standard
5925 Set the the state of specified controller to values specified in specified
5926  table.
5927 \end_layout
5929 \begin_layout Itemize
5930 Each field can be boolean or number.
5931 \end_layout
5933 \begin_layout Itemize
5934 Also, buttons allow strings, which cause value to be inverted.
5935 \end_layout
5937 \begin_layout Subsection
5938 input.lcid_to_pcid: Look up logical controller (deprecated)
5939 \end_layout
5941 \begin_layout Itemize
5942 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
5943 \end_layout
5945 \begin_layout Standard
5946 Returns the legacy pcid for controller (or false if there isn't one), followed
5947  by pcid pair.
5948  Returns nothing if controller does not exist.
5949 \end_layout
5951 \begin_layout Standard
5952 \begin_inset Newpage pagebreak
5953 \end_inset
5956 \end_layout
5958 \begin_layout Section
5959 Table keyboard
5960 \end_layout
5962 \begin_layout Standard
5963 Various keybinding-related functions
5964 \end_layout
5966 \begin_layout Subsection
5967 keyboard.bind: Bind a key
5968 \end_layout
5970 \begin_layout Itemize
5971 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
5972 \end_layout
5974 \begin_layout Standard
5975 Bind specified key with specified modifers to specified command.
5976 \end_layout
5978 \begin_layout Subsection
5979 keyboard.unbind: Unbind a key
5980 \end_layout
5982 \begin_layout Itemize
5983 Syntax: none keyboard.unbind(string mod, string mask, string key)
5984 \end_layout
5986 \begin_layout Standard
5987 Unbind specified key with specified modifers.
5988 \end_layout
5990 \begin_layout Subsection
5991 keyboard.alias: Set alias expansion
5992 \end_layout
5994 \begin_layout Itemize
5995 Syntax: none keyboard.alias(string alias, string expansion)
5996 \end_layout
5998 \begin_layout Standard
5999 Set expansion of given command.
6000 \end_layout
6002 \begin_layout Standard
6003 \begin_inset Newpage pagebreak
6004 \end_inset
6007 \end_layout
6009 \begin_layout Section
6010 Table subtitle
6011 \end_layout
6013 \begin_layout Standard
6014 Subtitle handling
6015 \end_layout
6017 \begin_layout Subsection
6018 subtitle.byindex: Look up start and length of subtitle by index
6019 \end_layout
6021 \begin_layout Itemize
6022 Syntax: (number, number) subtitle.byindex(number i)
6023 \end_layout
6025 \begin_layout Standard
6026 Read the frame and length of ith subtitle.
6027  Returns nothing if not present.
6028 \end_layout
6030 \begin_layout Subsection
6031 subtitle.set: Write a subtitle
6032 \end_layout
6034 \begin_layout Itemize
6035 Syntax: none subtitle.set(number f, number l, string txt)
6036 \end_layout
6038 \begin_layout Standard
6039 Set the text of subtitle.
6040 \end_layout
6042 \begin_layout Subsection
6043 subtitle.get: Read a subtitle
6044 \end_layout
6046 \begin_layout Itemize
6047 Syntax: string subtitle.get(number f, number l)
6048 \end_layout
6050 \begin_layout Standard
6051 Get the text of subtitle.
6052 \end_layout
6054 \begin_layout Subsection
6055 subtitle.delete: Delete a subtitle
6056 \end_layout
6058 \begin_layout Itemize
6059 Syntax: none subtitle.delete(number f, number l)
6060 \end_layout
6062 \begin_layout Standard
6063 Delete specified subtitle.
6064 \end_layout
6066 \begin_layout Standard
6067 \begin_inset Newpage pagebreak
6068 \end_inset
6071 \end_layout
6073 \begin_layout Section
6074 Table hostmemory
6075 \end_layout
6077 \begin_layout Standard
6078 Host memory handling (extra memory saved to savestates).
6079  Host memory starts empty.
6080 \end_layout
6082 \begin_layout Itemize
6083 Reads out of range return false.
6084 \end_layout
6086 \begin_layout Itemize
6087 Writes out of range extend the memory.
6088 \end_layout
6090 \begin_layout Subsection
6091 hostmemory.read: Read byte from host memory
6092 \end_layout
6094 \begin_layout Itemize
6095 Syntax: number hostmemory.read(number address)
6096 \end_layout
6098 \begin_layout Standard
6099 Reads byte from hostmemory slot address <address>.
6100 \end_layout
6102 \begin_layout Subsection
6103 hostmemory.write: Write byte to host memory
6104 \end_layout
6106 \begin_layout Itemize
6107 Syntax: none hostmemory.write(number address, number value)
6108 \end_layout
6110 \begin_layout Standard
6111 Writes hostmemory slot with value <value> 0-255.
6112 \end_layout
6114 \begin_layout Subsection
6115 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
6116 \end_layout
6118 \begin_layout Itemize
6119 Syntax: number hostmemory.readbyte(number address)
6120 \end_layout
6122 \begin_layout Itemize
6123 Syntax: number hostmemory.readsbyte(number address)
6124 \end_layout
6126 \begin_layout Itemize
6127 Syntax: number hostmemory.readword(number address)
6128 \end_layout
6130 \begin_layout Itemize
6131 Syntax: number hostmemory.readsword(number address)
6132 \end_layout
6134 \begin_layout Itemize
6135 Syntax: number hostmemory.readhword(number address)
6136 \end_layout
6138 \begin_layout Itemize
6139 Syntax: number hostmemory.readshword(number address)
6140 \end_layout
6142 \begin_layout Itemize
6143 Syntax: number hostmemory.readdword(number address)
6144 \end_layout
6146 \begin_layout Itemize
6147 Syntax: number hostmemory.readsdword(number address)
6148 \end_layout
6150 \begin_layout Itemize
6151 Syntax: number hostmemory.readqword(number address)
6152 \end_layout
6154 \begin_layout Itemize
6155 Syntax: number hostmemory.readsqword(number address)
6156 \end_layout
6158 \begin_layout Standard
6159 Read elements (big-endian) from given address <address>.
6160 \end_layout
6162 \begin_layout Itemize
6163 byte is 1 element
6164 \end_layout
6166 \begin_layout Itemize
6167 word is 2 elements
6168 \end_layout
6170 \begin_layout Itemize
6171 hword is 3 elements
6172 \end_layout
6174 \begin_layout Itemize
6175 dword is 4 elements
6176 \end_layout
6178 \begin_layout Itemize
6179 qword is 8 elements.
6180 \end_layout
6182 \begin_layout Itemize
6183 The 's' variants do signed read.
6184 \end_layout
6186 \begin_layout Subsection
6187 hostmemory.read{float,double}: Read from host memory
6188 \end_layout
6190 \begin_layout Itemize
6191 syntax: number hostmemory.readfloat(number address)
6192 \end_layout
6194 \begin_layout Itemize
6195 Syntax: number hostmemory.readdouble(number address)
6196 \end_layout
6198 \begin_layout Standard
6199 Read elements (big-endian) floating-pont from given address <address>.
6200 \end_layout
6202 \begin_layout Subsection
6203 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
6204 \end_layout
6206 \begin_layout Itemize
6207 Syntax: number hostmemory.writebyte(number address, number value)
6208 \end_layout
6210 \begin_layout Itemize
6211 Syntax: number hostmemory.writesbyte(number address, number value)
6212 \end_layout
6214 \begin_layout Itemize
6215 Syntax: number hostmemory.writeword(number address, number value)
6216 \end_layout
6218 \begin_layout Itemize
6219 Syntax: number hostmemory.writesword(number address, number value)
6220 \end_layout
6222 \begin_layout Itemize
6223 Syntax: number hostmemory.writehword(number address, number value)
6224 \end_layout
6226 \begin_layout Itemize
6227 Syntax: number hostmemory.writeshword(number address, number value)
6228 \end_layout
6230 \begin_layout Itemize
6231 Syntax: number hostmemory.writedword(number address, number value)
6232 \end_layout
6234 \begin_layout Itemize
6235 Syntax: number hostmemory.writesdword(number address, number value)
6236 \end_layout
6238 \begin_layout Itemize
6239 Syntax: number hostmemory.writeqword(number address, number value)
6240 \end_layout
6242 \begin_layout Itemize
6243 Syntax: number hostmemory.writesqword(number address, number value)
6244 \end_layout
6246 \begin_layout Standard
6247 Write value <value> to elements (little-endian) starting from given address
6248  <address>.
6249 \end_layout
6251 \begin_layout Itemize
6252 byte is 1 element
6253 \end_layout
6255 \begin_layout Itemize
6256 word is 2 elements
6257 \end_layout
6259 \begin_layout Itemize
6260 hword is 3 elements
6261 \end_layout
6263 \begin_layout Itemize
6264 dword is 4 elements
6265 \end_layout
6267 \begin_layout Itemize
6268 qword is 8 elements.
6269 \end_layout
6271 \begin_layout Itemize
6272 The 's' variants do signed write.
6273 \end_layout
6275 \begin_layout Subsection
6276 hostmemory.write{float,double}: Write to host memory
6277 \end_layout
6279 \begin_layout Itemize
6280 syntax: none hostmemory.readfloat(number address, number value)
6281 \end_layout
6283 \begin_layout Itemize
6284 Syntax: none hostmemory.readdouble(number address, number value)
6285 \end_layout
6287 \begin_layout Standard
6288 Write elements (big-endian) floating-pont to given address <address>, storing
6289  <value>.
6290 \end_layout
6292 \begin_layout Standard
6293 \begin_inset Newpage pagebreak
6294 \end_inset
6297 \end_layout
6299 \begin_layout Section
6300 Table movie
6301 \end_layout
6303 \begin_layout Standard
6304 Movie handling
6305 \end_layout
6307 \begin_layout Subsection
6308 movie.currentframe: Get current frame number
6309 \end_layout
6311 \begin_layout Itemize
6312 Syntax: number movie.currentframe()
6313 \end_layout
6315 \begin_layout Standard
6316 Return number of current frame.
6317 \end_layout
6319 \begin_layout Subsection
6320 movie.framecount: Get move frame count
6321 \end_layout
6323 \begin_layout Itemize
6324 Syntax: number movie.framecount()
6325 \end_layout
6327 \begin_layout Standard
6328 Return number of frames in movie.
6329 \end_layout
6331 \begin_layout Subsection
6332 movie.lagcount: Get current lag count
6333 \end_layout
6335 \begin_layout Itemize
6336 Syntax: number movie.lagcount()
6337 \end_layout
6339 \begin_layout Standard
6340 Return number of lag frames recorded so far.
6341 \end_layout
6343 \begin_layout Subsection
6344 movie.readonly: Is in playback mode?
6345 \end_layout
6347 \begin_layout Itemize
6348 Syntax: boolean movie.readonly()
6349 \end_layout
6351 \begin_layout Standard
6352 Return true if in playback mode, false if in recording.
6353 \end_layout
6355 \begin_layout Subsection
6356 movie.rerecords: Movie rerecord count
6357 \end_layout
6359 \begin_layout Itemize
6360 Syntax: number movie.rerecords()
6361 \end_layout
6363 \begin_layout Standard
6364 Returns the current value of rerecord count.
6365 \end_layout
6367 \begin_layout Subsection
6368 movie.set_readwrite: Set recording mode.
6369 \end_layout
6371 \begin_layout Itemize
6372 Syntax: none movie.set_readwrite()
6373 \end_layout
6375 \begin_layout Standard
6376 Set recording mode (does not cause on_readwrite callback).
6377 \end_layout
6379 \begin_layout Subsection
6380 movie.frame_subframes: Count subframes in frame
6381 \end_layout
6383 \begin_layout Itemize
6384 Syntax: number movie.frame_subframes(number frame)
6385 \end_layout
6387 \begin_layout Standard
6388 Count number of subframes in specified frame <frame> (frame numbers are
6389  1-based) and return that.
6390 \end_layout
6392 \begin_layout Subsection
6393 movie.read_subframes: Read subframe data (deprecated)
6394 \end_layout
6396 \begin_layout Itemize
6397 Syntax: table movie.read_subframes(number frame, number subframe)
6398 \end_layout
6400 \begin_layout Standard
6401 Read specifed subframe in specified frame and return data as array.
6402 \end_layout
6404 \begin_layout Subsection
6405 movie.read_rtc: Read current RTC time
6406 \end_layout
6408 \begin_layout Itemize
6409 Syntax: (number, number) movie.read_rtc()
6410 \end_layout
6412 \begin_layout Standard
6413 Returns the current value of the RTC as a pair (second, subsecond).
6414 \end_layout
6416 \begin_layout Subsection
6417 movie.unsafe_rewind: Fast movie rewind to saved state
6418 \end_layout
6420 \begin_layout Itemize
6421 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
6422 \end_layout
6424 \begin_layout Standard
6425 Start setting point for unsafe rewind or jump to point of unsafe rewind.
6426 \end_layout
6428 \begin_layout Itemize
6429 If called without argument, causes emulator to start process of setting
6430  unsafe rewind point.
6431  When this has finished, callback on_set_rewind occurs, passing the rewind
6432  state to lua script.
6433 \end_layout
6435 \begin_layout Itemize
6436 If called with argument, causes emulator rewind to passed rewind point as
6437  soon as possible.
6438  recording mode is implicitly activated.
6439 \end_layout
6441 \begin_layout Standard
6442 The following warnings apply to unsafe rewinding:
6443 \end_layout
6445 \begin_layout Itemize
6446 There are no safety checks against misuse (that's what 
6447 \begin_inset Quotes eld
6448 \end_inset
6450 unsafe
6451 \begin_inset Quotes erd
6452 \end_inset
6454  comes from)!
6455 \end_layout
6457 \begin_layout Itemize
6458 Only call rewind from timeline rewind point was set from.
6459 \end_layout
6461 \begin_layout Itemize
6462 Only call rewind from after the rewind point was set.
6463 \end_layout
6465 \begin_layout Subsection
6466 movie.to_rewind: Load savestate as rewind point
6467 \end_layout
6469 \begin_layout Itemize
6470 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
6471 \end_layout
6473 \begin_layout Standard
6474 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
6475  corresponding to it.
6476 \end_layout
6478 \begin_layout Itemize
6479 Note: This operation does not take emulated time.
6480 \end_layout
6482 \begin_layout Subsection
6483 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
6484 \end_layout
6486 \begin_layout Itemize
6487 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE/string movie])
6488 \end_layout
6490 \begin_layout Itemize
6491 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
6492 \end_layout
6494 \begin_layout Standard
6495 Copies specified movie or branch <movie>/current object (if none or nil,
6496  the active movie) as new movie object.
6497 \end_layout
6499 \begin_layout Subsection
6500 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
6501 \end_layout
6503 \begin_layout Itemize
6504 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE/string movie,] number frame)
6505 \end_layout
6507 \begin_layout Itemize
6508 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
6509 \end_layout
6511 \begin_layout Standard
6512 Get INPUTFRAME object corresponding to specified frame in specified movie
6513  or branch.
6514 \end_layout
6516 \begin_layout Subsection
6517 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
6518 \end_layout
6520 \begin_layout Itemize
6521 Syntax: none movie.set_frame([INPUTMOVIE/string movie,] number frame, INPUTFRAME
6522  data)
6523 \end_layout
6525 \begin_layout Itemize
6526 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
6527 \end_layout
6529 \begin_layout Standard
6530 Set data in specified frame.
6531 \end_layout
6533 \begin_layout Itemize
6534 Note: Past can't be edited in active movie.
6535 \end_layout
6537 \begin_layout Subsection
6538 movie.get_size/INPUTMOVIE::get_size: Get size of movie
6539 \end_layout
6541 \begin_layout Itemize
6542 Syntax: integer movie.get_size([INPUTMOVIE/string movie])
6543 \end_layout
6545 \begin_layout Itemize
6546 Syntax: integer INPUTMOVIE::get_size()
6547 \end_layout
6549 \begin_layout Standard
6550 Return number of subframes in specified movie or branch.
6551 \end_layout
6553 \begin_layout Subsection
6554 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
6555 \end_layout
6557 \begin_layout Itemize
6558 Syntax: number movie.count_frames([INPUTMOVIE/string movie])
6559 \end_layout
6561 \begin_layout Itemize
6562 Syntax: number INPUTMOVIE::count_frames()
6563 \end_layout
6565 \begin_layout Standard
6566 Return number of frames in movie.
6567 \end_layout
6569 \begin_layout Subsection
6570 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
6571 \end_layout
6573 \begin_layout Itemize
6574 Syntax: number movie.find_frame([INPUTMOVIE/string movie], number frame)
6575 \end_layout
6577 \begin_layout Itemize
6578 Syntax: number INPUTMOVIE::find_frame(number frame)
6579 \end_layout
6581 \begin_layout Standard
6582 Returns starting subframe of given frame (frame numbers are 1-based).
6583  Returns -1 if frame number is bad.
6584 \end_layout
6586 \begin_layout Subsection
6587 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
6588 \end_layout
6590 \begin_layout Itemize
6591 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE/string movie])
6592 \end_layout
6594 \begin_layout Itemize
6595 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
6596 \end_layout
6598 \begin_layout Standard
6599 Return blank INPUTFRAME with frame type from specified movie.
6600 \end_layout
6602 \begin_layout Subsection
6603 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
6604 \end_layout
6606 \begin_layout Itemize
6607 Syntax: none movie.append_frames([INPUTMOVIE/string movie,] number frames)
6608 \end_layout
6610 \begin_layout Itemize
6611 Syntax: none INPUTMOVIE::append_frames(number frames)
6612 \end_layout
6614 \begin_layout Standard
6615 Append specified number <frames> of frames.
6616 \end_layout
6618 \begin_layout Subsection
6619 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
6620 \end_layout
6622 \begin_layout Itemize
6623 Syntax: none movie.append_frame([INPUTMOVIE/string movie,] INPUTFRAME frame)
6624 \end_layout
6626 \begin_layout Itemize
6627 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
6628 \end_layout
6630 \begin_layout Standard
6631 Append specified frame <frame>.
6632  Past of current movie can't be edited.
6633 \end_layout
6635 \begin_layout Subsection
6636 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
6637 \end_layout
6639 \begin_layout Itemize
6640 Syntax: none movie.truncate([INPUTMOVIE/string movie,] number frames)
6641 \end_layout
6643 \begin_layout Itemize
6644 Syntax: none INPUTMOVIE::truncate(number frames)
6645 \end_layout
6647 \begin_layout Standard
6648 Truncate the specified movie to specified number of frames.
6649 \end_layout
6651 \begin_layout Subsection
6652 movie.edit/INPUTMOVIE::edit: Edit a movie
6653 \end_layout
6655 \begin_layout Itemize
6656 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
6657  controller, number control, number/bool value)
6658 \end_layout
6660 \begin_layout Itemize
6661 Syntax: none movie.edit(string branch, number frame, number port, number
6662  controller, number control, number/bool value)
6663 \end_layout
6665 \begin_layout Itemize
6666 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
6667  number control, number/bool value)
6668 \end_layout
6670 \begin_layout Standard
6671 Change specified control in specified frame in specified movie.
6672  Past can't be edited in active movie.
6673 \end_layout
6675 \begin_layout Subsection
6676 movie.copy_frames2: Copy frames between movies
6677 \end_layout
6679 \begin_layout Itemize
6680 Syntax: none movie.copy_frames2([INPUTMOVIE/string dstmov,] number dst, [INPUTMOV
6681 IE/string srcmov,] number src, number count)
6682 \end_layout
6684 \begin_layout Standard
6685 Copy specified number of frames between two movies.
6686  The copy proceeeds in forward direction.
6687 \end_layout
6689 \begin_layout Subsection
6690 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
6691 \end_layout
6693 \begin_layout Itemize
6694 Syntax: none movie.copy_frames([INPUTMOVIE/string mov,] number dst, number
6695  src, number count, bool backwards)
6696 \end_layout
6698 \begin_layout Itemize
6699 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
6700  bool backwards)
6701 \end_layout
6703 \begin_layout Standard
6704 Copy specified number of frames from one point in movie to another.
6705  If backwards is true, the copy will be done backwards.
6706 \end_layout
6708 \begin_layout Subsection
6709 movie.serialize/INPUTMOVIE::serialize: Serialize movie
6710 \end_layout
6712 \begin_layout Itemize
6713 Syntax: none movie.serialize([INPUTMOVIE movie/string,] string filename,
6714  bool binary)
6715 \end_layout
6717 \begin_layout Itemize
6718 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
6719 \end_layout
6721 \begin_layout Standard
6722 Serialize given movie into file.
6723  If binary is true, binary format (more compact and much faster) is used.
6724 \end_layout
6726 \begin_layout Subsection
6727 movie.unserialize: Unserialize movie
6728 \end_layout
6730 \begin_layout Itemize
6731 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
6732  bool binary)
6733 \end_layout
6735 \begin_layout Standard
6736 Unserialize movie from file.
6737  The given frame is used as template to decide the frame type.
6738  If binary is true, binary format is decoded (much faster).
6739 \end_layout
6741 \begin_layout Subsection
6742 movie.current_first_subframe: Return first subframe in current frame
6743 \end_layout
6745 \begin_layout Itemize
6746 Syntax: number movie.current_first_subframe()
6747 \end_layout
6749 \begin_layout Standard
6750 Returns first subframe in current frame.
6751 \end_layout
6753 \begin_layout Subsection
6754 movie.pollcounter: Return poll counter for speified control
6755 \end_layout
6757 \begin_layout Itemize
6758 Syntax: number movie.pollcounter(number port, number controller, number control)
6759 \end_layout
6761 \begin_layout Standard
6762 Returns number of times the specified control has been polled this frame.
6763 \end_layout
6765 \begin_layout Subsection
6766 movie.current_branch: Return current branch
6767 \end_layout
6769 \begin_layout Itemize
6770 Syntax: string movie.current_branch()
6771 \end_layout
6773 \begin_layout Standard
6774 Returns the name of the current branch.
6775 \end_layout
6777 \begin_layout Subsection
6778 movie.get_branches: Return names of all branches
6779 \end_layout
6781 \begin_layout Itemize
6782 Syntax: string...
6783  movie.get_branches()
6784 \end_layout
6786 \begin_layout Standard
6787 Returns the name of all branches.
6788 \end_layout
6790 \begin_layout Subsection
6791 movie.rom_loaded: Is ROM loaded?
6792 \end_layout
6794 \begin_layout Itemize
6795 Syntax: boolean movie.rom_loaded()
6796 \end_layout
6798 \begin_layout Standard
6799 Returns true if ROM is loaded, false otherwise.
6800 \end_layout
6802 \begin_layout Subsection
6803 movie.get_rom_info: Get info about loaded ROM
6804 \end_layout
6806 \begin_layout Itemize
6807 Syntax: Table movie.get_rom_info()
6808 \end_layout
6810 \begin_layout Standard
6811 Returns a table of tables.
6812  The outer table is indexed by ROM slot index.
6813  The inner table has the following fields:
6814 \end_layout
6816 \begin_layout Itemize
6817 filename: The name of file
6818 \end_layout
6820 \begin_layout Itemize
6821 hint: File name hint
6822 \end_layout
6824 \begin_layout Itemize
6825 sha256: SHA-256 hash of ROM.
6826 \end_layout
6828 \begin_layout Itemize
6829 xml_filename: The name of file for markup
6830 \end_layout
6832 \begin_layout Itemize
6833 xml_hint: File name hint for markup
6834 \end_layout
6836 \begin_layout Itemize
6837 xml_sha256: SHA-256 hash of ROM markup.
6838 \end_layout
6840 \begin_layout Standard
6841 If there is no markup, the xml_* fields are absent.
6842 \end_layout
6844 \begin_layout Subsection
6845 movie.get_game_info: Get info about loaded game
6846 \end_layout
6848 \begin_layout Itemize
6849 Syntax: Table movie.get_game_info()
6850 \end_layout
6852 \begin_layout Standard
6853 Returns a table with following fields:
6854 \end_layout
6856 \begin_layout Itemize
6857 core: The name of the core
6858 \end_layout
6860 \begin_layout Itemize
6861 core_short: Short name of the core
6862 \end_layout
6864 \begin_layout Itemize
6865 type: The name of the system type
6866 \end_layout
6868 \begin_layout Itemize
6869 type_long: The long name of the system type
6870 \end_layout
6872 \begin_layout Itemize
6873 region: The name of region
6874 \end_layout
6876 \begin_layout Itemize
6877 region_long: The long name of region
6878 \end_layout
6880 \begin_layout Itemize
6881 gametype: The gametype of movie.
6882 \end_layout
6884 \begin_layout Itemize
6885 fps: Nominal fps as floating-point value
6886 \end_layout
6888 \begin_layout Itemize
6889 fps_n: Exact nominal fps numerator
6890 \end_layout
6892 \begin_layout Itemize
6893 fps_d: Exact nominal fps denominator.
6894 \end_layout
6896 \begin_layout Subsection
6897 INPUTFRAME::get_button: Get button
6898 \end_layout
6900 \begin_layout Itemize
6901 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
6902  control)
6903 \end_layout
6905 \begin_layout Standard
6906 Returns state of given button as boolean.
6907 \end_layout
6909 \begin_layout Subsection
6910 INPUTFRAME::get_axis: Get axis
6911 \end_layout
6913 \begin_layout Itemize
6914 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
6915  control)
6916 \end_layout
6918 \begin_layout Standard
6919 Returns state of given axis as number.
6920 \end_layout
6922 \begin_layout Subsection
6923 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
6924 \end_layout
6926 \begin_layout Itemize
6927 Syntax: none INPUTFRAME::set_button(number port, number controller, number
6928  control, number/bool value)
6929 \end_layout
6931 \begin_layout Itemize
6932 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
6933  control)
6934 \end_layout
6936 \begin_layout Standard
6937 Set the given button/axis to given value.
6938 \end_layout
6940 \begin_layout Subsection
6941 INPUTFRAME::serialize: Serialize a frame
6942 \end_layout
6944 \begin_layout Itemize
6945 Syntax: string INPUTFRAME::serialize()
6946 \end_layout
6948 \begin_layout Standard
6949 Return string representation of frame.
6950 \end_layout
6952 \begin_layout Subsection
6953 INPUTFRAME::unserialize: Unserialize a frame
6954 \end_layout
6956 \begin_layout Itemize
6957 Syntax: none INPUTFRAME::unserialize(string data)
6958 \end_layout
6960 \begin_layout Standard
6961 Set current frame from given data.
6962 \end_layout
6964 \begin_layout Subsection
6965 INPUTFRAME::get_stride: Get movie stride
6966 \end_layout
6968 \begin_layout Itemize
6969 Syntax: number INPUTFRAME::get_stride()
6970 \end_layout
6972 \begin_layout Standard
6973 Return number of bytes needed to store the input frame.
6974  Mainly useful for some debugging.
6975 \end_layout
6977 \begin_layout Standard
6978 \begin_inset Newpage pagebreak
6979 \end_inset
6982 \end_layout
6984 \begin_layout Section
6985 Table settings
6986 \end_layout
6988 \begin_layout Standard
6989 Routines for settings manipulation
6990 \end_layout
6992 \begin_layout Subsection
6993 settings.get: Get value of setting
6994 \end_layout
6996 \begin_layout Itemize
6997 Syntax: string settings.get(string name)
6998 \end_layout
7000 \begin_layout Standard
7001 Get value of setting <name>.
7002  If setting value can't be obtained, returns (nil, error message).
7003 \end_layout
7005 \begin_layout Subsection
7006 settings.set: Set value of setting
7007 \end_layout
7009 \begin_layout Itemize
7010 Syntax: none settings.set(string name, string value)
7011 \end_layout
7013 \begin_layout Standard
7014 Set value <value> of setting <name>.
7015  If setting can't be set, returns (nil, error message).
7016 \end_layout
7018 \begin_layout Subsection
7019 settings.get_all: Get values of all settings
7020 \end_layout
7022 \begin_layout Itemize
7023 Syntax: table settings.get_all()
7024 \end_layout
7026 \begin_layout Standard
7027 Return a table with all setting names as keys and all current values as
7028  values.
7029 \end_layout
7031 \begin_layout Subsection
7032 settings.get_speed: Get current speed
7033 \end_layout
7035 \begin_layout Itemize
7036 Syntax: number/string settings.get_speed()
7037 \end_layout
7039 \begin_layout Standard
7040 Return the current speed multiplier (1 is normal), or 
7041 \begin_inset Quotes eld
7042 \end_inset
7044 turbo
7045 \begin_inset Quotes erd
7046 \end_inset
7048  if speed is set to turbo (this does not react to turbo toggle).
7049 \end_layout
7051 \begin_layout Subsection
7052 settings.set_speed: Set current speed
7053 \end_layout
7055 \begin_layout Itemize
7056 Syntax: settings.get_speed(number spd)
7057 \end_layout
7059 \begin_layout Itemize
7060 Syntax: settings.get_speed(string special)
7061 \end_layout
7063 \begin_layout Standard
7064 Set the current speed multiplier (1 is normal).
7065  The speed may be positive multiplier or 
7066 \begin_inset Quotes eld
7067 \end_inset
7069 turbo
7070 \begin_inset Quotes erd
7071 \end_inset
7073  for turbo speed.
7074 \end_layout
7076 \begin_layout Standard
7077 \begin_inset Newpage pagebreak
7078 \end_inset
7081 \end_layout
7083 \begin_layout Section
7084 Table memory
7085 \end_layout
7087 \begin_layout Standard
7088 Contains various functions for managing memory
7089 \end_layout
7091 \begin_layout Subsection
7092 memory.vma_count: Count number of memory areas.
7093 \end_layout
7095 \begin_layout Itemize
7096 Syntax: number memory.vma_count()
7097 \end_layout
7099 \begin_layout Standard
7100 Returns the number of memory areas
7101 \end_layout
7103 \begin_layout Subsection
7104 memory.read_vma: Lookup memory area info by index
7105 \end_layout
7107 \begin_layout Itemize
7108 Syntax: table memory.read_vma(number index)
7109 \end_layout
7111 \begin_layout Standard
7112 Reads the specified memory area (indices start from zero).
7113  Trying to read invalid memory area gives nil.
7114  The return value is table with the following fields:
7115 \end_layout
7117 \begin_layout Itemize
7118 region_name (string): The readable name of the memory area
7119 \end_layout
7121 \begin_layout Itemize
7122 baseaddr (number): Base address of the memory area
7123 \end_layout
7125 \begin_layout Itemize
7126 lastaddr (number): Last address in the memory area.
7127 \end_layout
7129 \begin_layout Itemize
7130 size (number): The size of memory area in bytes.
7131 \end_layout
7133 \begin_layout Itemize
7134 readonly (boolean): True of the memory area corresponds to ROM.
7135 \end_layout
7137 \begin_layout Itemize
7138 iospace (boolean): True if the memory area is I/O space.
7139 \end_layout
7141 \begin_layout Itemize
7142 native_endian (boolean): True if the memory area has native endian as opposed
7143  to little endian.
7144 \end_layout
7146 \begin_layout Subsection
7147 memory.find_vma: Find memory area info by address
7148 \end_layout
7150 \begin_layout Itemize
7151 Syntax: table memory.find_vma(number address)
7152 \end_layout
7154 \begin_layout Standard
7155 Finds the memory area containing specified address.
7156  Returns table in the same format as read_vma or nil if not found.
7157 \end_layout
7159 \begin_layout Subsection
7160 memory.read{,s}{byte,{,h,d,q}word}: Read memory
7161 \end_layout
7163 \begin_layout Itemize
7164 Syntax: none memory.readbyte({string marea, number address|ADDRESS addrobj})
7165 \end_layout
7167 \begin_layout Itemize
7168 Syntax: none memory.readword({string marea, number address|ADDRESS addrobj})
7169 \end_layout
7171 \begin_layout Itemize
7172 Syntax: none memory.readhword({string marea, number address|ADDRESS addrobj})
7173 \end_layout
7175 \begin_layout Itemize
7176 Syntax: none memory.readdword({string marea, number address|ADDRESS addrobj})
7177 \end_layout
7179 \begin_layout Itemize
7180 Syntax: none memory.readqword({string marea, number address|ADDRESS addrobj})
7181 \end_layout
7183 \begin_layout Itemize
7184 Syntax: none memory.readsbyte({string marea, number address|ADDRESS addrobj})
7185 \end_layout
7187 \begin_layout Itemize
7188 Syntax: none memory.readsword({string marea, number address|ADDRESS addrobj})
7189 \end_layout
7191 \begin_layout Itemize
7192 Syntax: none memory.readshword({string marea, number address|ADDRESS addrobj})
7193 \end_layout
7195 \begin_layout Itemize
7196 Syntax: none memory.readsdword({string marea, number address|ADDRESS addrobj})
7197 \end_layout
7199 \begin_layout Itemize
7200 Syntax: none memory.readsqword({string marea, number address|ADDRESS addrobj})
7201 \end_layout
7203 \begin_layout Standard
7204 Reads the specified address <address> (if 's' variant is used, do undergo
7205  2's complement).
7206 \end_layout
7208 \begin_layout Subsection
7209 memory.{,s}read_sg: Scatter/Gather read memory
7210 \end_layout
7212 \begin_layout Itemize
7213 Syntax: none memory.read_sg(string/boolean/number...)
7214 \end_layout
7216 \begin_layout Itemize
7217 Syntax: none memory.sread_sg(string/boolean/number...)
7218 \end_layout
7220 \begin_layout Standard
7221 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
7222  of memory.
7223  Each argument can be string, boolean or number:
7224 \end_layout
7226 \begin_layout Itemize
7227 String: Set memory area addresses are relative to (e.g.
7228  'WRAM').
7229 \end_layout
7231 \begin_layout Itemize
7232 boolean: If true, increment relative address by 1, if false, decrement by
7233  1.
7234  The new address is read as next higher byte.
7235 \end_layout
7237 \begin_layout Itemize
7238 integer: Set the relative address to specified value and read the address
7239  as next higher byte.
7240 \end_layout
7242 \begin_layout Subsection
7243 memory.write_sg: Scatter/Gather write memory
7244 \end_layout
7246 \begin_layout Itemize
7247 Syntax: none memory.write_sg(number value, string/boolean/number...)
7248 \end_layout
7250 \begin_layout Standard
7251 Perform scatter/gather write of value <value> on memory.
7252  Each argument can be string, boolean or number:
7253 \end_layout
7255 \begin_layout Itemize
7256 String: Set memory area addresses are relative to (e.g.
7257  'WRAM').
7258 \end_layout
7260 \begin_layout Itemize
7261 boolean: If true, increment relative address by 1, if false, decrement by
7262  1.
7263  The new address is read as next higher byte.
7264 \end_layout
7266 \begin_layout Itemize
7267 integer: Set the relative address to specified value and read the address
7268  as next higher byte.
7269 \end_layout
7271 \begin_layout Subsection
7272 memory.read{float,double}: Read memory
7273 \end_layout
7275 \begin_layout Itemize
7276 Syntax: none memory.readfloat({string marea, number address|ADDRESS addrobj})
7277 \end_layout
7279 \begin_layout Itemize
7280 Syntax: none memory.readdouble({string marea, number address|ADDRESS addrobj})
7281 \end_layout
7283 \begin_layout Standard
7284 Reads the specified address <address>
7285 \end_layout
7287 \begin_layout Subsection
7288 memory.write{byte,{,h,d,q}word,float,double}: Write memory
7289 \end_layout
7291 \begin_layout Itemize
7292 Syntax: none memory.writebyte({string marea, number address|ADDRESS addrobj},
7293  number value)
7294 \end_layout
7296 \begin_layout Itemize
7297 Syntax: none memory.writeword({string marea, number address|ADDRESS addrobj},
7298  number value)
7299 \end_layout
7301 \begin_layout Itemize
7302 Syntax: none memory.writehword({string marea, number address|ADDRESS addrobj},
7303  number value)
7304 \end_layout
7306 \begin_layout Itemize
7307 Syntax: none memory.writedword({string marea, number address|ADDRESS addrobj},
7308  number value)
7309 \end_layout
7311 \begin_layout Itemize
7312 Syntax: none memory.writeqword({string marea, number address|ADDRESS addrobj},
7313  number value)
7314 \end_layout
7316 \begin_layout Itemize
7317 Syntax: none memory.writefloat({string marea, number address|ADDRESS addrobj},
7318  number value)
7319 \end_layout
7321 \begin_layout Itemize
7322 Syntax: none memory.writedouble({string marea, number address|ADDRESS addrobj},
7323  number value)
7324 \end_layout
7326 \begin_layout Standard
7327 Writes the specified value <value> (negative integer values undergo 2's
7328  complement) to specified address <address>.
7329 \end_layout
7331 \begin_layout Subsection
7332 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
7333 \end_layout
7335 \begin_layout Itemize
7336 Syntax: userdata memory.map<type>({string marea, number base|ADDRESS addrobj},
7337  number size)
7338 \end_layout
7340 \begin_layout Standard
7341 Returns a table mapping specified memory aperture for read/write.
7342 \end_layout
7344 \begin_layout Itemize
7345 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
7346  qword, sqword, float or double.
7347 \end_layout
7349 \begin_layout Subsection
7350 memory.hash_region: Hash region of memory
7351 \end_layout
7353 \begin_layout Itemize
7354 Syntax: string memory.hash_region({string marea, number base|ADDRESS addrobj},
7355  number size)
7356 \end_layout
7358 \begin_layout Standard
7359 Hash <size> bytes starting from address <base> (relative to <marea>) and
7360  return the SHA-256.
7361 \end_layout
7363 \begin_layout Subsection
7364 memory.hash_region2: Hash region of memory
7365 \end_layout
7367 \begin_layout Itemize
7368 Syntax: string memory.hash_region2({string marea, number base|ADDRESS addrobj},
7369  number size[, number rows, number stride])
7370 \end_layout
7372 \begin_layout Standard
7373 Hash <rows> blocks of <size> bytes starting from address <base> (relative
7374  to <marea>).
7375  The blocks are offset by <stride> from one another and return the SHA-256.
7376 \end_layout
7378 \begin_layout Subsection
7379 memory.hash_region_skein: Hash region of memory
7380 \end_layout
7382 \begin_layout Itemize
7383 Syntax: string memory.hash_region_skein({string marea, number base|ADDRESS
7384  addrobj}, number size[, number rows, number stride])
7385 \end_layout
7387 \begin_layout Standard
7388 Same as memory.hash_region2, but uses Skein-512-256 (v1.3; one of the SHA-3
7389  finalists) as hash function.
7390 \end_layout
7392 \begin_layout Subsection
7393 memory.store: Store region of memory
7394 \end_layout
7396 \begin_layout Itemize
7397 Syntax: none memory.store({string marea, number addr|ADDRESS addrobj}, number
7398  daddr[, number rows, number stride]
7399 \end_layout
7401 \begin_layout Standard
7402 Copy memory starting from <addr> in memory area <marea> (each row being
7403  of size <size>, there being <rows> rows, and rows being separated by <stride>
7404  in memory) into savestate-saved memory area, starting from <daadr> (all
7405  rows are written back to back).
7406 \end_layout
7408 \begin_layout Subsection
7409 memory.storecmp: Compare and store region of memory
7410 \end_layout
7412 \begin_layout Itemize
7413 Syntax: bool memory.storecmp({string marea, number addr|ADDRESS addrobj},
7414  number daddr[, number rows, number stride]
7415 \end_layout
7417 \begin_layout Standard
7418 Like memory.store, but returns true if target of copy already held the value
7419  that would be copied before the copy happened.
7420  Otherwise returns false (if target and source differ before copy).
7421 \end_layout
7423 \begin_layout Subsection
7424 memory.hash_state: Hash system state
7425 \end_layout
7427 \begin_layout Itemize
7428 Syntax: string memory.hash_state()
7429 \end_layout
7431 \begin_layout Standard
7432 Hash the current system state.
7433  Mainly useful for debugging savestates.
7434 \end_layout
7436 \begin_layout Subsection
7437 memory.readregion: Read region of memory
7438 \end_layout
7440 \begin_layout Itemize
7441 Syntax: table memory.readregion({string marea, number base|ADDRESS addrobj},
7442  number size)
7443 \end_layout
7445 \begin_layout Standard
7446 Read a region of memory.
7447 \end_layout
7449 \begin_layout Itemize
7450 Warning: If the region crosses memory area boundary, the results are undefined.
7451 \end_layout
7453 \begin_layout Subsection
7454 memory.writeregion: Write region of memory
7455 \end_layout
7457 \begin_layout Itemize
7458 Syntax: none memory.writeregion({string marea, number base|ADDRESS addrobj},
7459  number size, table data)
7460 \end_layout
7462 \begin_layout Standard
7463 Write a region of memory.
7464 \end_layout
7466 \begin_layout Itemize
7467 Warning: If the region crosses memory area boundary, the results are undefined.
7468 \end_layout
7470 \begin_layout Subsection
7471 memory.action: Run core action
7472 \end_layout
7474 \begin_layout Itemize
7475 memory.action(string action, [<params>])
7476 \end_layout
7478 \begin_layout Standard
7479 Run core action.
7480  The different models expect parameters as:
7481 \end_layout
7483 \begin_layout Itemize
7484 string: String
7485 \end_layout
7487 \begin_layout Itemize
7488 numeric: numeric
7489 \end_layout
7491 \begin_layout Itemize
7492 enumeration: String
7493 \end_layout
7495 \begin_layout Itemize
7496 boolean: String
7497 \end_layout
7499 \begin_layout Itemize
7500 toggle: None.
7501 \end_layout
7503 \begin_layout Subsection
7504 memory.action_flags: Get core action flags
7505 \end_layout
7507 \begin_layout Itemize
7508 memory.action_flags(string action)
7509 \end_layout
7511 \begin_layout Standard
7512 Get value of action flags for core action <action>.
7513 \end_layout
7515 \begin_layout Itemize
7516 Bit 0: Enabled?
7517 \end_layout
7519 \begin_layout Itemize
7520 Bit 1: Selected (not all actions can be selected)?
7521 \end_layout
7523 \begin_layout Subsection
7524 memory.get_lag_flag: Get lag flag
7525 \end_layout
7527 \begin_layout Itemize
7528 Syntax: boolean memory.get_lag_flag()
7529 \end_layout
7531 \begin_layout Standard
7532 Get the value of core lag flag.
7533  True if this frame has been lag so far, false if poll has been detected.
7534 \end_layout
7536 \begin_layout Subsection
7537 memory.set_lag_flag: Set lag flag
7538 \end_layout
7540 \begin_layout Itemize
7541 Syntax: none memory.set_lag_flag(boolean flag)
7542 \end_layout
7544 \begin_layout Standard
7545 Set the value of core lag flag.
7546  This flag automatically gets cleared if poll is detected, but can be forcibly
7547  set or cleared if game so requires.
7548 \end_layout
7550 \begin_layout Itemize
7551 Should only be used in on_frame_emulated callback.
7552 \end_layout
7554 \begin_layout Itemize
7555 Setting or clearing this affects the emulator lag counter.
7556 \end_layout
7558 \begin_layout Subsection
7559 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
7560  callback
7561 \end_layout
7563 \begin_layout Itemize
7564 Syntax: function memory.registerread({string marea, number addr|ADDRESS addrobj},
7565  function fn);
7566 \end_layout
7568 \begin_layout Itemize
7569 Syntax: function memory.registerwrite({string marea, number addr|ADDRESS
7570  addrobj}, function fn);
7571 \end_layout
7573 \begin_layout Itemize
7574 Syntax: function memory.registerexec({string marea, number addr|ADDRESS addrobj},
7575  function fn);
7576 \end_layout
7578 \begin_layout Itemize
7579 Syntax: none memory.unregisterread({string marea, number addr|ADDRESS addrobj},
7580  function fn);
7581 \end_layout
7583 \begin_layout Itemize
7584 Syntax: none memory.unregisterwrite({string marea, number addr|ADDRESS addrobj},
7585  function fn);
7586 \end_layout
7588 \begin_layout Itemize
7589 Syntax: none memory.unregisterexec({string marea, number addr|ADDRESS addrobj},
7590  function fn);
7591 \end_layout
7593 \begin_layout Standard
7594 Add or remove callback on memory read, write or execute (depending on the
7595  function).
7596  <addr> is relative to <marea>.
7597  <fn> is the callback.
7598  The register* functions return <fn> (which can then be passed to unregister*
7599  functions.
7600 \end_layout
7602 \begin_layout Itemize
7603 Not all cores support this, and it may be unsupported for some memory areas.
7604 \end_layout
7606 \begin_layout Itemize
7607 The functions are passed two parameters: Address and value.
7608 \end_layout
7610 \begin_layout Subsection
7611 memory.{,un}registertrace: Set/Clear trace hook
7612 \end_layout
7614 \begin_layout Itemize
7615 Syntax: function memory.registertrace(number processor, function fn);
7616 \end_layout
7618 \begin_layout Itemize
7619 Syntax: none memory.unregistertrace(number processor, function fn);
7620 \end_layout
7622 \begin_layout Standard
7623 Add or remove trace callback.
7624  <processor> is system-dependent processor number (0 is usually main CPU).
7625  The function arguments work like in other (un)register* functions.
7626 \end_layout
7628 \begin_layout Itemize
7629 The functions are passed two parameters: Trace CPU and Trace event string.
7630 \end_layout
7632 \begin_layout Subsection
7633 memory.cheat: Set cheat
7634 \end_layout
7636 \begin_layout Itemize
7637 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj}, number
7638  value);
7639 \end_layout
7641 \begin_layout Itemize
7642 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj});
7643 \end_layout
7645 \begin_layout Standard
7646 Set or clear cheat (value <value>) on address <addr> (relative to <marea>).
7647  If <value> is not speicified, clear a cheat.
7648 \end_layout
7650 \begin_layout Itemize
7651 Not all cores support this, and it may be unsupported for some memory areas.
7652 \end_layout
7654 \begin_layout Subsection
7655 memory.setxmask: Set global execute hook mask
7656 \end_layout
7658 \begin_layout Itemize
7659 Syntax: none memory.setxmask(number mask)
7660 \end_layout
7662 \begin_layout Standard
7663 Set the global execute hook mask to <mask>.
7664  The meaning of each bit is system-dependent, but bit 0 should be the main
7665  CPU.
7666 \end_layout
7668 \begin_layout Subsection
7669 memory.getregister: Get register value
7670 \end_layout
7672 \begin_layout Itemize
7673 Syntax: number/boolean memory.getregister(string register)
7674 \end_layout
7676 \begin_layout Standard
7677 Get the value of named register.
7678 \end_layout
7680 \begin_layout Subsection
7681 memory.getregisters: Get register values
7682 \end_layout
7684 \begin_layout Itemize
7685 Syntax: table memory.getregisters()
7686 \end_layout
7688 \begin_layout Standard
7689 Get the value of all known registers as table.
7690 \end_layout
7692 \begin_layout Subsection
7693 memory.setregister: Set register value
7694 \end_layout
7696 \begin_layout Itemize
7697 Syntax: none memory.setregister(string register, number/boolean value)
7698 \end_layout
7700 \begin_layout Standard
7701 Set the value of named register.
7702 \end_layout
7704 \begin_layout Subsection
7705 memory.mmap: Class MMAP_STRUCT
7706 \end_layout
7708 \begin_layout Standard
7709 See class MMAP_STRUCT
7710 \end_layout
7712 \begin_layout Standard
7713 \begin_inset Newpage pagebreak
7714 \end_inset
7717 \end_layout
7719 \begin_layout Section
7720 Table memory2
7721 \end_layout
7723 \begin_layout Standard
7724 Contains newer memory functions.
7725 \end_layout
7727 \begin_layout Subsection
7728 memory2(): Get all memory area names.
7729 \end_layout
7731 \begin_layout Itemize
7732 Syntax: table memory2()
7733 \end_layout
7735 \begin_layout Standard
7736 Returns array of all valid memory area names.
7737 \end_layout
7739 \begin_layout Subsection
7740 memory2.<marea>:info: Get memory area info
7741 \end_layout
7743 \begin_layout Itemize
7744 Syntax: table memory2.<marea>:info()
7745 \end_layout
7747 \begin_layout Standard
7748 Return table describing given memory area.
7749  Includes fields address, size, last, readonly, special and endian.
7750 \end_layout
7752 \begin_layout Subsection
7753 memory2.<marea>:<op>: Read/Write memory
7754 \end_layout
7756 \begin_layout Itemize
7757 Syntax: none memory2.<marea>:<op>(number offset, number value)
7758 \end_layout
7760 \begin_layout Itemize
7761 Syntax: number memory2.<marea>:<op>(number offset)
7762 \end_layout
7764 \begin_layout Standard
7765 Read/Write value from/to given memory area <marea> at given offset <offset>
7766  (must be in-range).
7767  The value written is <value>.
7768  <Op> is of form: [i][s]<type>, where:
7769 \end_layout
7771 \begin_layout Itemize
7772 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
7773 \end_layout
7775 \begin_layout Itemize
7776 'i' signifies that the value is treated as opposite-to-normal endianess,
7777 \end_layout
7779 \begin_layout Itemize
7780 's' signifies that value is treated as signed (not available for floating-point).
7781 \end_layout
7783 \begin_layout Subsection
7784 memory2.<marea>:read: Scatter-gather value read
7785 \end_layout
7787 \begin_layout Itemize
7788 Syntax: number memory2.<marea>:read(number addr...)
7789 \end_layout
7791 \begin_layout Standard
7792 Read value from given memory area <marea> at byte offsets <addr>..., given
7793  in order of increasing significance.
7794  Value of true and false are special.
7795  True increments address by 1, and false decrements address by 1.
7796 \end_layout
7798 \begin_layout Subsection
7799 memory2.<marea>:sread: Signed scatter-gather value read
7800 \end_layout
7802 \begin_layout Itemize
7803 Syntax: number memory2.<marea>:sread(number addr...)
7804 \end_layout
7806 \begin_layout Standard
7807 Like memory2.<marea>:read, but reads signed values.
7808 \end_layout
7810 \begin_layout Subsection
7811 memory2.<marea>:write: Scatter-gather value write
7812 \end_layout
7814 \begin_layout Itemize
7815 Syntax: number memory2.<marea>:write(number val, number addr...)
7816 \end_layout
7818 \begin_layout Standard
7819 Write value <val> to given memory area <marea> at byte offsets <addr>..., given
7820  in order of increasing significance.
7821  Value of true and false are special.
7822  True increments address by 1, and false decrements address by 1.
7823 \end_layout
7825 \begin_layout Subsection
7826 memory2.<marea>:cheat: Set/Clear cheat
7827 \end_layout
7829 \begin_layout Itemize
7830 Syntax: none memory2.<marea>:cheat(number addr, [number value])
7831 \end_layout
7833 \begin_layout Standard
7834 Set/Clear cheat at offset <addr> of memory area <marea>.
7835  If <value> is given, cheat with specified value is set.
7836  Otherwise cheat on address is removed.
7837 \end_layout
7839 \begin_layout Subsection
7840 memory2.<marea>:sha256: SHA-256
7841 \end_layout
7843 \begin_layout Itemize
7844 Syntax: string memory2.<marea>:sha256(number addr, number size[, number rows,
7845  number stride])
7846 \end_layout
7848 \begin_layout Standard
7849 Compute SHA-256 of <rows> (default 1) chunks of <size> bytes each, starting
7850  from offset <addr> of area <marea>.
7851  The chunks are separated by <stride>.
7852 \end_layout
7854 \begin_layout Subsection
7855 memory2.<marea>:skein: Skein-512-256
7856 \end_layout
7858 \begin_layout Itemize
7859 Syntax: string memory2.<marea>:skein(number addr, number size[, number rows,
7860  number stride])
7861 \end_layout
7863 \begin_layout Standard
7864 Same as memory2.<marea>:sha256, except with Skein-512-256 as hash function.
7865 \end_layout
7867 \begin_layout Subsection
7868 memory2.<marea>:store{,cmp}: Copy region to Lua memory with compare
7869 \end_layout
7871 \begin_layout Itemize
7872 Syntax: none memory2.<marea>:store(number addr, number daddr, number size[,
7873  number rows, number stride])
7874 \end_layout
7876 \begin_layout Itemize
7877 Syntax: boolean memory2.<marea>:storecmp(number addr, number daddr, number
7878  size[, number rows, number stride])
7879 \end_layout
7881 \begin_layout Standard
7882 Copy <rows> (default 1) chunks of <size> bytes each, starting from offset
7883  <addr> of area <marea>.
7884  The chunks are separated by <stride>.
7885  The target is Lua host memory, starting from offset <daddr>.
7886 \end_layout
7888 \begin_layout Standard
7889 Additionally, the storecmp method returns false if target was modified (otherwis
7890 e true).
7891 \end_layout
7893 \begin_layout Subsection
7894 memory2.<marea>:readregion: Read region
7895 \end_layout
7897 \begin_layout Itemize
7898 Syntax table memory2.<marea>:readregion(number addr, number size)
7899 \end_layout
7901 \begin_layout Standard
7902 Read <size> bytes starting from <addr> in <marea> and return as array.
7903 \end_layout
7905 \begin_layout Subsection
7906 memory2.<marea>:writeregion: Write region
7907 \end_layout
7909 \begin_layout Itemize
7910 Syntax none memory2.<marea>:writeregion(number addr, table data)
7911 \end_layout
7913 \begin_layout Standard
7914 Write array <data> to bytes starting from <addr> in <marea>.
7915 \end_layout
7917 \begin_layout Subsection
7918 memory2.<marea>:register{read,write,exec}: Register hook
7919 \end_layout
7921 \begin_layout Itemize
7922 Syntax: function memory2.<marea>:registerread(number addr, function fn);
7923 \end_layout
7925 \begin_layout Itemize
7926 Syntax: function memory2.<marea>:registerwrite(number addr, function fn);
7927 \end_layout
7929 \begin_layout Itemize
7930 Syntax: function memory2.<marea>:registerexec(number addr, function fn);
7931 \end_layout
7933 \begin_layout Standard
7934 Register debug callback <fn> of specified type at offset <addr> of memory
7935  area <marea>.
7936  Returns <fn>.
7937 \end_layout
7939 \begin_layout Subsection
7940 memory2.<marea>:unregister{read,write,exec}: Unregister hook
7941 \end_layout
7943 \begin_layout Itemize
7944 Syntax: none memory2.<marea>:unregisterread(number addr, function fn);
7945 \end_layout
7947 \begin_layout Itemize
7948 Syntax: none memory2.<marea>:unregisterwrite(number addr, function fn);
7949 \end_layout
7951 \begin_layout Itemize
7952 Syntax: none memory2.<marea>:unregisterexec(number addr, function fn);
7953 \end_layout
7955 \begin_layout Standard
7956 Unregister debug callback <fn> of specified type at offset <addr> of memory
7957  area <marea>.
7958 \end_layout
7960 \begin_layout Standard
7961 \begin_inset Newpage pagebreak
7962 \end_inset
7965 \end_layout
7967 \begin_layout Section
7968 Table random
7969 \end_layout
7971 \begin_layout Standard
7972 Contains random number generation methods.
7973  These functions do not return reproducable results.
7974 \end_layout
7976 \begin_layout Subsection
7977 random.boolean: Random boolean
7978 \end_layout
7980 \begin_layout Itemize
7981 Syntax: boolean random.boolean()
7982 \end_layout
7984 \begin_layout Standard
7985 Returns true or false at random (50-50 chance).
7986 \end_layout
7988 \begin_layout Subsection
7989 random.integer: Random integer
7990 \end_layout
7992 \begin_layout Itemize
7993 Syntax: number random.integer(number highplusone)
7994 \end_layout
7996 \begin_layout Itemize
7997 Syntax: number random.integer(number low, number high)
7998 \end_layout
8000 \begin_layout Standard
8001 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
8002  With two arguments, return random integer [<low>,<high>] (both ends inclusive).
8003 \end_layout
8005 \begin_layout Standard
8006 The returned numbers are from uniform distribution.
8007 \end_layout
8009 \begin_layout Subsection
8010 random.float: Random float
8011 \end_layout
8013 \begin_layout Itemize
8014 Syntax: number random.float()
8015 \end_layout
8017 \begin_layout Standard
8018 Returns random decimal number [0,1).
8019 \end_layout
8021 \begin_layout Subsection
8022 random.among: Random parameter
8023 \end_layout
8025 \begin_layout Itemize
8026 Syntax: value random.among(value values...)
8027 \end_layout
8029 \begin_layout Standard
8030 Returns random parameter value, picked at uniform.
8031  Multiple equivalent values are returned with higher chance.
8032 \end_layout
8034 \begin_layout Subsection
8035 random.amongtable: Random from table
8036 \end_layout
8038 \begin_layout Itemize
8039 Syntax: value random.amongtable(table tab)
8040 \end_layout
8042 \begin_layout Standard
8043 Returns random value from table <tab>.
8044  As in random.among, no equality testing is done.
8045 \end_layout
8047 \begin_layout Standard
8048 \begin_inset Newpage pagebreak
8049 \end_inset
8052 \end_layout
8054 \begin_layout Section
8055 Table zip
8056 \end_layout
8058 \begin_layout Subsection
8059 zip.enumerate: Enumerate members in zipfile
8060 \end_layout
8062 \begin_layout Itemize
8063 Syntax: Table zip.enumerate(string filename[, boolean invert])
8064 \end_layout
8066 \begin_layout Standard
8067 Returns table of files in zip archive <filename>.
8068  If <invert> is true, instead of returning array of names, returns table
8069  with keys being member names and values being true.
8070 \end_layout
8072 \begin_layout Subsection
8073 zip.writer: Class ZIPWRITER
8074 \end_layout
8076 \begin_layout Standard
8077 See class ZIPWRITER.
8078 \end_layout
8080 \begin_layout Standard
8081 \begin_inset Newpage pagebreak
8082 \end_inset
8085 \end_layout
8087 \begin_layout Section
8088 Table callback
8089 \end_layout
8091 \begin_layout Standard
8092 Various callback-related functions.
8093 \end_layout
8095 \begin_layout Subsection
8096 \begin_inset CommandInset label
8097 LatexCommand label
8098 name "sub:callback.register:-Register-a"
8100 \end_inset
8102 callback.register: Register a callback
8103 \end_layout
8105 \begin_layout Itemize
8106 Syntax: function callback.register(string cbname, function cbfun);
8107 \end_layout
8109 \begin_layout Standard
8110 Instruct function <cbfun> to be added to list of callbacks to call on event
8111  <cbname> (See section 
8112 \begin_inset CommandInset ref
8113 LatexCommand ref
8114 reference "sec:Callbacks"
8116 \end_inset
8119  The callback name does not have the 'on_' prefix (e.g.
8121 \begin_inset Quotes eld
8122 \end_inset
8124 paint
8125 \begin_inset Quotes erd
8126 \end_inset
8129  Returns <cbfun>.
8130 \end_layout
8132 \begin_layout Subsection
8133 \begin_inset CommandInset label
8134 LatexCommand label
8135 name "sub:callback.unregister:-Unregister-"
8137 \end_inset
8139 callback.unregister: Unregister a callback
8140 \end_layout
8142 \begin_layout Itemize
8143 Syntax: function callback.unregister(string cbname, function cbfun);
8144 \end_layout
8146 \begin_layout Standard
8147 Instruct function <cbfun> to be removed from list of callbacks to call on
8148  event <cbname>.
8149 \end_layout
8151 \begin_layout Subsection
8152 callback.<cbname>:register: Register callback
8153 \end_layout
8155 \begin_layout Itemize
8156 Syntax: function callback.<cbname>:register(function cbfun)
8157 \end_layout
8159 \begin_layout Standard
8160 Synonym for callback.register (section 
8161 \begin_inset CommandInset ref
8162 LatexCommand ref
8163 reference "sub:callback.register:-Register-a"
8165 \end_inset
8167 ), albeit with callback name specified differently.
8168 \end_layout
8170 \begin_layout Subsection
8171 callback.<cbname>:unregister: Register callback
8172 \end_layout
8174 \begin_layout Itemize
8175 Syntax: function callback.<cbname>:unregister(function cbfun)
8176 \end_layout
8178 \begin_layout Standard
8179 Synonym for callback.unregister (section 
8180 \begin_inset CommandInset ref
8181 LatexCommand ref
8182 reference "sub:callback.unregister:-Unregister-"
8184 \end_inset
8186 ), albeit with callback name specified differently.
8187 \end_layout
8189 \begin_layout Section
8190 table bsnes
8191 \end_layout
8193 \begin_layout Standard
8194 Various bsnes-specific functions.
8195 \end_layout
8197 \begin_layout Subsection
8198 bsnes.dump_sprite: Dump a sprite
8199 \end_layout
8201 \begin_layout Itemize
8202 Syntax: BITMAP bsnes.dump_sprite(string marea, number addr, number width,
8203  number height[, number stride])
8204 \end_layout
8206 \begin_layout Standard
8207 Dumps given sprite (in native format) from memory.
8208  memory area is usually 
8209 \begin_inset Quotes eld
8210 \end_inset
8212 VRAM
8213 \begin_inset Quotes erd
8214 \end_inset
8217  <Width> and <height> are given in 8x8 blocks.
8218  <Stride> overrides row stride (default 512).
8219 \end_layout
8221 \begin_layout Subsection
8222 bsnes.dump_palette: Dump a palette
8223 \end_layout
8225 \begin_layout Itemize
8226 Syntax: PALETTE bsnes.dump_palette(string marea, number addr, bool full256,
8227  bool first_trans)
8228 \end_layout
8230 \begin_layout Standard
8231 Dumps a palette from memory.
8232  memory area is usually 
8233 \begin_inset Quotes eld
8234 \end_inset
8236 CGRAM
8237 \begin_inset Quotes erd
8238 \end_inset
8241  If <full256> is true, 256 colors are dumped (otherwise 16).
8242  If <first_trans> is true, first color is forced transparent.
8243 \end_layout
8245 \begin_layout Subsection
8246 bsnes.enablelayer: Set layer visibility
8247 \end_layout
8249 \begin_layout Itemize
8250 Syntax: none bsnes.enablelayer(number layer, number priority, boolean enabled)
8251 \end_layout
8253 \begin_layout Standard
8254 Enable or disable specified layer at specified priority.
8255 \end_layout
8257 \begin_layout Subsection
8258 bsnes.redump_sprite: Redump a sprite
8259 \end_layout
8261 \begin_layout Itemize
8262 Syntax: none bsnes.redump_sprite(BITMAP bitmap, string marea, number addr[,
8263  number stride])
8264 \end_layout
8266 \begin_layout Standard
8267 Like bsnes.dump_sprite, but instead dumps to specified bitmap <bitmap>.
8268  The specified bitmap must have size multiple of 8x8.
8269 \end_layout
8271 \begin_layout Subsection
8272 bsnes.redump_palette: Redump a palette
8273 \end_layout
8275 \begin_layout Itemize
8276 Syntax: none bsnes.dump_palette(PALETTE pal, string marea, number addr, bool
8277  first_trans)
8278 \end_layout
8280 \begin_layout Standard
8281 Like bsnes.dump_palette, but instead dumps to specified palette <pal>.
8282  The specified palette must have either 16 or 256 colors.
8283 \end_layout
8285 \begin_layout Section
8286 extensions to table string
8287 \end_layout
8289 \begin_layout Subsection
8290 string.charU: string.char, UTF-8 version.
8291 \end_layout
8293 \begin_layout Itemize
8294 Syntax: string string.charU(number n...)
8295 \end_layout
8297 \begin_layout Standard
8298 Like Lua string.char(), but works in terms of Unicode codepoints.
8299  The returned string is UTF-8.
8300 \end_layout
8302 \begin_layout Subsection
8303 string.byteU: string.byte, UTF-8 version.
8304 \end_layout
8306 \begin_layout Itemize
8307 Syntax: number...
8308  string.byteU(string str[, number i[, number j]])
8309 \end_layout
8311 \begin_layout Standard
8312 Like string.byte(), but works in terms of Unicode codepoints.
8313  The input string <str> is assumed UTF-8.
8314 \end_layout
8316 \begin_layout Subsection
8317 string.regex: Match string against regular expression
8318 \end_layout
8320 \begin_layout Itemize
8321 Syntax: boolean/string...
8322  string.regex(string regexp, string against)
8323 \end_layout
8325 \begin_layout Standard
8326 Match POSIX-extended regular expression <regexp> against string <against>.
8327  If no match, false is returned.
8328  Otherwise if string has no subcaptures, true is returned.
8329  Otherwise each subcapture is returned as a string (in order of starting
8330  position).
8331 \end_layout
8333 \begin_layout Subsection
8334 string.hex: Transform integer into hex string
8335 \end_layout
8337 \begin_layout Itemize
8338 Syntax: string string.hex(number n, [number digits])
8339 \end_layout
8341 \begin_layout Standard
8342 Returns hexadecimal string representation of <n>, optionally padded with
8343  zeroes to <digits> digits (default is not to pad).
8344 \end_layout
8346 \begin_layout Subsection
8347 string.lpad: Pad string with spaces from left
8348 \end_layout
8350 \begin_layout Itemize
8351 Syntax: string string.lpad(string x, number n)
8352 \end_layout
8354 \begin_layout Standard
8355 Pad string <x> to <n> bytes by inserting spaces at start and return the
8356  result.
8357 \end_layout
8359 \begin_layout Subsection
8360 string.rpad: Pad string with spaces from right
8361 \end_layout
8363 \begin_layout Itemize
8364 Syntax: string string.rpad(string x, number n)
8365 \end_layout
8367 \begin_layout Standard
8368 Pad string <x> to <n> bytes by inserting spaces at end and return the result.
8369 \end_layout
8371 \begin_layout Section
8372 Table _SYSTEM
8373 \end_layout
8375 \begin_layout Standard
8376 Contains copy of global variables from time of Lua initialization.
8377  Non-writeable.
8378 \end_layout
8380 \begin_layout Standard
8381 \begin_inset Newpage pagebreak
8382 \end_inset
8385 \end_layout
8387 \begin_layout Section
8388 \begin_inset CommandInset label
8389 LatexCommand label
8390 name "sec:Callbacks"
8392 \end_inset
8394 Callbacks
8395 \end_layout
8397 \begin_layout Standard
8398 Various callbacks to Lua that can occur.
8399 \end_layout
8401 \begin_layout Subsection
8402 on_paint: Screen is being painted
8403 \end_layout
8405 \begin_layout Itemize
8406 Callback: on_paint(bool not_synth)
8407 \end_layout
8409 \begin_layout Standard
8410 Called when screen is being painted.
8411  Any gui.* calls requiring graphic context draw on the screen.
8412 \end_layout
8414 \begin_layout Itemize
8415 not_synth is true if this hook is being called in response to received frame,
8416  false otherwise.
8417 \end_layout
8419 \begin_layout Subsection
8420 on_video: Dumped video frame is being painted
8421 \end_layout
8423 \begin_layout Itemize
8424 Callback: on_video()
8425 \end_layout
8427 \begin_layout Standard
8428 Called when video dump frame is being painted.
8429  Any gui.* calls requiring graphic context draw on the video.
8430 \end_layout
8432 \begin_layout Subsection
8433 on_frame_emulated: Frame emulation complete
8434 \end_layout
8436 \begin_layout Itemize
8437 Callback: on_frame_emulated()
8438 \end_layout
8440 \begin_layout Standard
8441 Called when emulating frame has completed and on_paint()/on_video() calls
8442  are about to be issued.
8443 \end_layout
8445 \begin_layout Subsection
8446 on_frame: Frame emulation starting.
8447 \end_layout
8449 \begin_layout Itemize
8450 Callback: on_frame()
8451 \end_layout
8453 \begin_layout Standard
8454 Called on each starting whole frame.
8455 \end_layout
8457 \begin_layout Subsection
8458 on_rewind: Movie rewound to beginning
8459 \end_layout
8461 \begin_layout Itemize
8462 Callback: on_rewind()
8463 \end_layout
8465 \begin_layout Standard
8466 Called when rewind movie to beginning has completed.
8467 \end_layout
8469 \begin_layout Subsection
8470 on_pre_load: Load operation is about to start
8471 \end_layout
8473 \begin_layout Itemize
8474 Callback: on_pre_load(string name)
8475 \end_layout
8477 \begin_layout Standard
8478 Called just before savestate/movie load occurs (note: loads are always delayed,
8479  so this occurs even when load was initiated by lua).
8480 \end_layout
8482 \begin_layout Subsection
8483 on_err_Load: Load failed
8484 \end_layout
8486 \begin_layout Itemize
8487 Callback: on_err_load(string name)
8488 \end_layout
8490 \begin_layout Standard
8491 Called if loadstate goes wrong.
8492 \end_layout
8494 \begin_layout Subsection
8495 on_post_load: Load completed
8496 \end_layout
8498 \begin_layout Itemize
8499 Callback: on_post_load(string name, boolean was_savestate)
8500 \end_layout
8502 \begin_layout Standard
8503 Called on successful loadstate.
8504  was_savestate gives if this was a savestate or a movie.
8505 \end_layout
8507 \begin_layout Subsection
8508 on_pre_save: Save operation is about to start
8509 \end_layout
8511 \begin_layout Itemize
8512 Callback: on_pre_save(string name, boolean is_savestate)
8513 \end_layout
8515 \begin_layout Standard
8516 Called just before savestate save occurs (note: movie saves are synchronous
8517  and won't trigger these callbacks if called from Lua).
8518 \end_layout
8520 \begin_layout Subsection
8521 on_err_save: Save failed
8522 \end_layout
8524 \begin_layout Itemize
8525 Callback: on_err_save(string name)
8526 \end_layout
8528 \begin_layout Standard
8529 Called if savestate goes wrong.
8530 \end_layout
8532 \begin_layout Subsection
8533 on_post_save: Save completed
8534 \end_layout
8536 \begin_layout Itemize
8537 Callback: on_post_save(string name, boolean is_savestate)
8538 \end_layout
8540 \begin_layout Standard
8541 Called on successful savaestate.
8542  is_savestate gives if this was a savestate or a movie.
8543 \end_layout
8545 \begin_layout Subsection
8546 on_quit: Emulator is shutting down
8547 \end_layout
8549 \begin_layout Itemize
8550 Callback: on_quit()
8551 \end_layout
8553 \begin_layout Standard
8554 Called when emulator is shutting down.
8555 \end_layout
8557 \begin_layout Subsection
8558 on_input: Polling for input
8559 \end_layout
8561 \begin_layout Standard
8562 Called when emulator is just sending input to bsnes core.
8563  Warning: This is called even in readonly mode, but the results are ignored.
8564 \end_layout
8566 \begin_layout Subsection
8567 on_reset: System has been reset
8568 \end_layout
8570 \begin_layout Itemize
8571 Callback: on_reset()
8572 \end_layout
8574 \begin_layout Standard
8575 Called when system is reset.
8576 \end_layout
8578 \begin_layout Subsection
8579 on_readwrite: Entered recording mode
8580 \end_layout
8582 \begin_layout Itemize
8583 Callback: on_readwrite()
8584 \end_layout
8586 \begin_layout Standard
8587 Called when moving into recording mode as result of 
8588 \begin_inset Quotes eld
8589 \end_inset
8591 set-rwmode
8592 \begin_inset Quotes erd
8593 \end_inset
8595  command (note: moving to rwmode by Lua won't trigger this, as per recursive
8596  entry protection).
8597 \end_layout
8599 \begin_layout Subsection
8600 on_snoop/on_snoop2: Snoop core controller reads
8601 \end_layout
8603 \begin_layout Itemize
8604 Callback: on_snoop(number port, number controller, number index, number
8605  value)
8606 \end_layout
8608 \begin_layout Itemize
8609 Callback: on_snoop2(number port, number controller, number index, number
8610  value)
8611 \end_layout
8613 \begin_layout Standard
8614 Called each time bsnes asks for input.
8615  The value is the final value to be sent to bsnes core (readonly mode, autohold
8616  and autofire have been taken into account).
8617  Might be useful when translating movies to format suitable for console
8618  verification.
8619  Note: There is no way to modify the value to be sent.
8620 \end_layout
8622 \begin_layout Itemize
8623 On_snoop2 is called instead of on_snoop if defined.
8624  Reserves port 0 for system, having first user port be port 1.
8625 \end_layout
8627 \begin_layout Subsection
8628 on_keyhook: Hooked key/axis has been moved
8629 \end_layout
8631 \begin_layout Itemize
8632 Callback: on_keyhook(string keyname, table state)
8633 \end_layout
8635 \begin_layout Standard
8636 Sent when key that has keyhook events requested changes state.
8637  Keyname is name of the key (group) and state is the state (same kind as
8638  table values in input.raw).
8639 \end_layout
8641 \begin_layout Subsection
8642 on_idle: Idle event
8643 \end_layout
8645 \begin_layout Itemize
8646 Callback: on_idle()
8647 \end_layout
8649 \begin_layout Standard
8650 Called when requested by set_idle_timeout(), the timeout has expired and
8651  emulator is waiting.
8652 \end_layout
8654 \begin_layout Subsection
8655 on_timer: Timer event
8656 \end_layout
8658 \begin_layout Itemize
8659 Callback: on_timer()
8660 \end_layout
8662 \begin_layout Standard
8663 Called when requested by set_idle_timeout() and the timeout has expired
8664  (regardless if emulator is waiting).
8665 \end_layout
8667 \begin_layout Subsection
8668 on_set_rewind: Rewind point has been set
8669 \end_layout
8671 \begin_layout Itemize
8672 Callback: on_set_rewind(UNSAFEREWIND r)
8673 \end_layout
8675 \begin_layout Standard
8676 Called when unsafe rewind object has been constructed.
8677 \end_layout
8679 \begin_layout Subsection
8680 on_pre_rewind: Rewind is about to occur
8681 \end_layout
8683 \begin_layout Itemize
8684 Callback: on_pre_rewind() 
8685 \end_layout
8687 \begin_layout Standard
8688 Called just before unsafe rewind is about to occur.
8689 \end_layout
8691 \begin_layout Subsection
8692 on_post_rewind: Rewind has occured
8693 \end_layout
8695 \begin_layout Itemize
8696 Callback: on_post_rewind() 
8697 \end_layout
8699 \begin_layout Standard
8700 Called just after unsafe rewind has occured.
8701 \end_layout
8703 \begin_layout Subsection
8704 on_button: Button has been pressed
8705 \end_layout
8707 \begin_layout Itemize
8708 Callback: on_button(number port, number controller, number index, string
8709  type)
8710 \end_layout
8712 \begin_layout Standard
8713 Called on controller button press, with following parameters:
8714 \end_layout
8716 \begin_layout Itemize
8717 port: Port number (0 is system)
8718 \end_layout
8720 \begin_layout Itemize
8721 controller: Controller within port
8722 \end_layout
8724 \begin_layout Itemize
8725 index: Index of button.
8726 \end_layout
8728 \begin_layout Itemize
8729 type: Type of event, one of:
8730 \end_layout
8732 \begin_deeper
8733 \begin_layout Itemize
8734 \begin_inset Quotes eld
8735 \end_inset
8737 pressed
8738 \begin_inset Quotes erd
8739 \end_inset
8741 : Button was pressed.
8742 \end_layout
8744 \begin_layout Itemize
8745 \begin_inset Quotes eld
8746 \end_inset
8748 released
8749 \begin_inset Quotes erd
8750 \end_inset
8752 : Button was released.
8753 \end_layout
8755 \begin_layout Itemize
8756 \begin_inset Quotes eld
8757 \end_inset
8759 hold
8760 \begin_inset Quotes erd
8761 \end_inset
8763 : Held.
8764 \end_layout
8766 \begin_layout Itemize
8767 \begin_inset Quotes eld
8768 \end_inset
8770 unhold
8771 \begin_inset Quotes erd
8772 \end_inset
8774 : Released from hold.
8775 \end_layout
8777 \begin_layout Itemize
8778 \begin_inset Quotes eld
8779 \end_inset
8781 type
8782 \begin_inset Quotes erd
8783 \end_inset
8785 : Typing input on button.
8786 \end_layout
8788 \begin_layout Itemize
8789 \begin_inset Quotes eld
8790 \end_inset
8792 untype
8793 \begin_inset Quotes erd
8794 \end_inset
8796 : Typing input undone.
8797 \end_layout
8799 \begin_layout Itemize
8800 \begin_inset Quotes eld
8801 \end_inset
8803 autofire <duty> <cycle>
8804 \begin_inset Quotes erd
8805 \end_inset
8807 : Autofire with specifie duty and cycle.
8808 \end_layout
8810 \begin_layout Itemize
8811 \begin_inset Quotes eld
8812 \end_inset
8814 autofire
8815 \begin_inset Quotes erd
8816 \end_inset
8818 : Stop autofire.
8819 \end_layout
8821 \begin_layout Itemize
8822 \begin_inset Quotes eld
8823 \end_inset
8825 analog
8826 \begin_inset Quotes erd
8827 \end_inset
8829 : Analog action on axis.
8830 \end_layout
8832 \end_deeper
8833 \begin_layout Subsection
8834 on_movie_lost: Movie data is about to be lost
8835 \end_layout
8837 \begin_layout Itemize
8838 Callback: on_movie_lost(STRING kind)
8839 \end_layout
8841 \begin_layout Standard
8842 Called just before something would happen that could lose movie data.
8843  Kind can be:
8844 \end_layout
8846 \begin_layout Itemize
8847 readwrite: Switching to recording mode.
8848 \end_layout
8850 \begin_layout Itemize
8851 reload: ROM is being reloaded in recording mode.
8852 \end_layout
8854 \begin_layout Itemize
8855 load: New movie is being loaded.
8856 \end_layout
8858 \begin_layout Itemize
8859 unsaferewind: Unsafe rewind is happening.
8860 \end_layout
8862 \begin_layout Subsection
8863 on_latch: Latch line is rising
8864 \end_layout
8866 \begin_layout Itemize
8867 Callback: on_latch(<core-dependent-parameters>)
8868 \end_layout
8870 \begin_layout Standard
8871 Called when latch line for controller is rising.
8872  Some cores may not support this.
8873 \end_layout
8875 \begin_layout Section
8876 System-dependent behaviour
8877 \end_layout
8879 \begin_layout Subsection
8880 bsnes core
8881 \end_layout
8883 \begin_layout Itemize
8884 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
8885  p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
8886  p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
8887 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
8888 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
8889  ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
8890  ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
8891  ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
8892  ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
8893 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
8894 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
8895  ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
8896 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
8897 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
8898  ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
8899 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
8900  ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
8901 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
8902 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
8903 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
8904  ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
8905 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
8906  ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
8907  ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
8908 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
8909 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
8910 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
8911  ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
8912 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
8913  ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
8914  ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
8915  ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
8916  ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
8917 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
8918  ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
8919 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
8920  ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
8921  ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
8922 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
8923  ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount, 
8924 \end_layout
8926 \begin_layout Itemize
8927 on_latch has no parameters
8928 \end_layout
8930 \begin_layout Itemize
8931 CPU 0 is S-CPU, 1 is S-SMP.
8932 \end_layout
8934 \begin_layout Itemize
8935 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
8936 \end_layout
8938 \begin_layout Itemize
8939 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
8940 {RAM,ROM}.
8941 \end_layout
8943 \begin_layout Itemize
8944 Memory areas are: WRAM, APURAM, VRAM, OAM, CGRAM, RTC, DSPRAM, DSPPROM,
8945  DSPDROM, SRAM, ROM, BUS, PTRTABLE, CPU_STATE, PPU_STATE, SMP_STATE, DSP_STATE,
8946  BSXFLASH, BSX_RAM, BSX_PRAM, SLOTA_ROM, SLOTB_ROM, SLOTA_RAM, SLOTB_RAM,
8947  GBCPU_STATE, GBROM, GBRAM, GBWRAM, GBHRAM.
8948 \end_layout
8950 \begin_layout Subsection
8951 gambatte core
8952 \end_layout
8954 \begin_layout Itemize
8955 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
8956  d, e, f, h, l
8957 \end_layout
8959 \begin_layout Itemize
8960 on_latch is not supported
8961 \end_layout
8963 \begin_layout Itemize
8964 CPU 0 is main CPU.
8965 \end_layout
8967 \begin_layout Itemize
8968 Cheats are supported for ROM, SRAM and WRAM.
8969 \end_layout
8971 \begin_layout Itemize
8972 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM
8973  and WRAM.
8974 \end_layout
8976 \begin_layout Itemize
8977 Memory areas are: SRAM, WRAM, VRAM, IOAMHRAM, ROM, BUS.
8978 \end_layout
8980 \end_body
8981 \end_document