1 #LyX 2.2 created this file. For more info see http://www.lyx.org/
5 \save_transient_properties true
8 \use_default_options true
9 \maintain_unincluded_children false
11 \language_package default
14 \font_roman "default" "default"
15 \font_sans "default" "default"
16 \font_typewriter "default" "default"
17 \font_math "auto" "auto"
18 \font_default_family default
19 \use_non_tex_fonts false
22 \font_sf_scale 100 100
23 \font_tt_scale 100 100
25 \default_output_format default
27 \bibtex_command default
28 \index_command default
29 \paperfontsize default
33 \pdf_bookmarksnumbered false
34 \pdf_bookmarksopen false
35 \pdf_bookmarksopenlevel 1
43 \use_package amsmath 1
44 \use_package amssymb 1
47 \use_package mathdots 1
48 \use_package mathtools 1
50 \use_package stackrel 1
51 \use_package stmaryrd 1
52 \use_package undertilde 1
54 \cite_engine_type default
58 \paperorientation portrait
75 \paragraph_separation indent
76 \paragraph_indentation default
77 \quotes_language english
80 \paperpagestyle default
81 \tracking_changes false
91 lsnes Lua functions reference
98 \begin_layout Standard
99 \begin_inset CommandInset toc
100 LatexCommand tableofcontents
107 \begin_layout Standard
108 \begin_inset Newpage pagebreak
114 \begin_layout Section
118 \begin_layout Subsection
122 \begin_layout Itemize
123 Coordinates increase to right and down.
126 \begin_layout Itemize
127 The origin is at top left of game area or buffer.
130 \begin_layout Subsection
134 \begin_layout Itemize
135 Methods that draw something (unless stated otherwise) require a valid rendering
137 This context can come in three ways:
138 \begin_inset Separator latexpar
145 \begin_layout Enumerate
146 The default rendering context of paint callback (the screen).
149 \begin_layout Enumerate
150 The default rendering context of video callback (the video).
153 \begin_layout Enumerate
154 Explicitly set rendering context (RENDERCTX:set).
158 \begin_layout Itemize
159 The rendering context is always reset when callback ends.
162 \begin_layout Subsection
166 \begin_layout Standard
167 (Direct) colors can be specified either as numbers or strings.
170 \begin_layout Itemize
171 -1 is fully transparent.
174 \begin_layout Itemize
175 Non-negative numbers less than
176 \begin_inset Formula $2^{32}$
179 are partially opaque colors (
180 \begin_inset Formula $a*2^{24}+r*2^{16}+g*2^{8}+b$
184 \begin_inset Separator latexpar
191 \begin_layout Itemize
192 \begin_inset Formula $a$
196 \begin_inset Formula $0-255$
200 \begin_inset Formula $0$
204 \begin_inset Formula $256$
207 would be fully transparent.
208 \begin_inset Separator latexpar
215 \begin_layout Itemize
216 Thus, numbers in range
217 \begin_inset Formula $0-16777215$
220 stand for fully opaque colors.
224 \begin_layout Itemize
225 \begin_inset Formula $r$
229 \begin_inset Formula $g$
233 \begin_inset Formula $b$
236 are intensities of base colors on scale
237 \begin_inset Formula $0-255$
244 \begin_layout Itemize
245 Color can also be specified by name as string: The following color names
246 are known: aliceblue antiquewhite antiquewhite1 antiquewhite2 antiquewhite3
247 antiquewhite4 aqua aquamarine aquamarine1 aquamarine2 aquamarine3 aquamarine4
248 azure azure1 azure2 azure3 azure4 beige bisque bisque1 bisque2 bisque3
249 bisque4 black blanchedalmond blue blue1 blue2 blue3 blue4 blueviolet brown
250 brown1 brown2 brown3 brown4 burlywood burlywood1 burlywood2 burlywood3
251 burlywood4 cadet cadetblue cadetblue1 cadetblue2 cadetblue3 cadetblue4
252 chartreuse chartreuse1 chartreuse2 chartreuse3 chartreuse4 chocolate chocolate1
253 chocolate2 chocolate3 chocolate4 coral coral1 coral2 coral3 coral4 cornflowerbl
254 ue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4 crimson cyan cyan1 cyan2
255 cyan3 cyan4 darkblue darkcyan darkgoldenrod darkgoldenrod1 darkgoldenrod2
256 darkgoldenrod3 darkgoldenrod4 darkgray darkgreen darkgrey darkkhaki darkmagenta
257 darkolivegreen darkolivegreen1 darkolivegreen2 darkolivegreen3 darkolivegreen4
258 darkorange darkorange1 darkorange2 darkorange3 darkorange4 darkorchid darkorchi
259 d1 darkorchid2 darkorchid3 darkorchid4 darkred darksalmon darkseagreen darkseagr
260 een1 darkseagreen2 darkseagreen3 darkseagreen4 darkslateblue darkslategray
261 darkslategray1 darkslategray2 darkslategray3 darkslategray4 darkslategrey
262 darkturquoise darkviolet deeppink deeppink1 deeppink2 deeppink3 deeppink4
263 deepskyblue deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4 dimgray
264 dimgrey dodgerblue dodgerblue1 dodgerblue2 dodgerblue3 dodgerblue4 firebrick
265 firebrick1 firebrick2 firebrick3 firebrick4 floralwhite forestgreen fractal
266 fuchsia gainsboro ghostwhite gold gold1 gold2 gold3 gold4 goldenrod goldenrod1
267 goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100 gray11
268 gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2 gray20 gray21
269 gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3 gray30 gray31
270 gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4 gray40 gray41
271 gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5 gray50 gray51
272 gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6 gray60 gray61
273 gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7 gray70 gray71
274 gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8 gray80 gray81
275 gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9 gray90 gray91
276 gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green green1 green2
277 green3 green4 greenyellow grey grey0 grey1 grey10 grey100 grey11 grey12
278 grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2 grey20 grey21 grey22
279 grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3 grey30 grey31 grey32
280 grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4 grey40 grey41 grey42
281 grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5 grey50 grey51 grey52
282 grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6 grey60 grey61 grey62
283 grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7 grey70 grey71 grey72
284 grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8 grey80 grey81 grey82
285 grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9 grey90 grey91 grey92
286 grey93 grey94 grey95 grey96 grey97 grey98 grey99 honeydew honeydew1 honeydew2
287 honeydew3 honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4 indianred
288 indianred1 indianred2 indianred3 indianred4 indigo ivory ivory1 ivory2
289 ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4 lavender lavenderblush
290 lavenderblush1 lavenderblush2 lavenderblush3 lavenderblush4 lawngreen lemonchif
291 fon lemonchiffon1 lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue lightblue1
292 lightblue2 lightblue3 lightblue4 lightcoral lightcyan lightcyan1 lightcyan2
293 lightcyan3 lightcyan4 lightgoldenrod lightgoldenrod1 lightgoldenrod2 lightgolde
294 nrod3 lightgoldenrod4 lightgoldenrodyellow lightgray lightgreen lightgrey
295 lightpink lightpink1 lightpink2 lightpink3 lightpink4 lightsalmon lightsalmon1
296 lightsalmon2 lightsalmon3 lightsalmon4 lightseagreen lightskyblue lightskyblue1
297 lightskyblue2 lightskyblue3 lightskyblue4 lightslateblue lightslategray
298 lightslategrey lightsteelblue lightsteelblue1 lightsteelblue2 lightsteelblue3
299 lightsteelblue4 lightyellow lightyellow1 lightyellow2 lightyellow3 lightyellow4
300 lime limegreen linen magenta magenta1 magenta2 magenta3 magenta4 maroon
301 maroon1 maroon2 maroon3 maroon4 mediumaquamarine mediumblue mediumforestgreen
302 mediumgoldenrod mediumorchid mediumorchid1 mediumorchid2 mediumorchid3
303 mediumorchid4 mediumpurple mediumpurple1 mediumpurple2 mediumpurple3 mediumpurp
304 le4 mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumviole
305 tred midnightblue mintcream mistyrose mistyrose1 mistyrose2 mistyrose3 mistyrose
306 4 moccasin navajowhite navajowhite1 navajowhite2 navajowhite3 navajowhite4
307 navy navyblue oldlace olive olivedrab olivedrab1 olivedrab2 olivedrab3
308 olivedrab4 orange orange1 orange2 orange3 orange4 orangered orangered1
309 orangered2 orangered3 orangered4 orchid orchid1 orchid2 orchid3 orchid4
310 palegoldenrod palegreen palegreen1 palegreen2 palegreen3 palegreen4 paleturquoi
311 se paleturquoise1 paleturquoise2 paleturquoise3 paleturquoise4 palevioletred
312 palevioletred1 palevioletred2 palevioletred3 palevioletred4 papayawhip
313 peachpuff peachpuff1 peachpuff2 peachpuff3 peachpuff4 peru pink pink1 pink2
314 pink3 pink4 plum plum1 plum2 plum3 plum4 powderblue purple purple1 purple2
315 purple3 purple4 red red1 red2 red3 red4 rosybrown rosybrown1 rosybrown2
316 rosybrown3 rosybrown4 royalblue royalblue1 royalblue2 royalblue3 royalblue4
317 saddlebrown salmon salmon1 salmon2 salmon3 salmon4 sandybrown seagreen
318 seagreen1 seagreen2 seagreen3 seagreen4 seashell seashell1 seashell2 seashell3
319 seashell4 sienna sienna1 sienna2 sienna3 sienna4 silver skyblue skyblue1
320 skyblue2 skyblue3 skyblue4 slateblue slateblue1 slateblue2 slateblue3 slateblue
321 4 slategray slategray1 slategray2 slategray3 slategray4 slategrey snow snow1
322 snow2 snow3 snow4 springgreen springgreen1 springgreen2 springgreen3 springgree
323 n4 steelblue steelblue1 steelblue2 steelblue3 steelblue4 tan tan1 tan2 tan3
324 tan4 teal thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2
325 tomato3 tomato4 transparent turquoise turquoise1 turquoise2 turquoise3
326 turquoise4 violet violetred violetred1 violetred2 violetred3 violetred4
327 wheat wheat1 wheat2 wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
328 yellow3 yellow4 yellowgreen
331 \begin_layout Itemize
332 The HSL base color names: hsl-<hue><saturation><lightness>.
333 \begin_inset Separator latexpar
340 \begin_layout Itemize
341 Hue can be one of: r (red), ry (red-yellow), o (orange, same as red-yellow),
342 y (yellow), yg (yellow-green), g (green), gc (green-cyan), c (cyan), cb
343 (cyan-blue), b (blue), bm (blue-magenta), m (magenta), mr (magenta-red).
346 \begin_layout Itemize
347 Saturation is 0-8, where 0 is greyscale and 8 is fully saturated.
350 \begin_layout Itemize
351 Lightness is 0-8, where 0 is black and 8 is white.
355 \begin_layout Itemize
356 The color names can have a modifier after space (multiple modifiers are
357 allowed, separated by spaces): opaque10, opaque20, opaque25, opaque30,
358 opaque40, opaque50, opaque60, opaque70, opaque75, opaque80, opaque90, opaque,
359 hue{+,-}{1-23}, {saturation,lightness}{+,-}{1-16}.
360 \begin_inset Separator latexpar
367 \begin_layout Itemize
368 opaqueness is measured as percentage.
371 \begin_layout Itemize
372 Hue adjustments are on 24-step scale.
375 \begin_layout Itemize
376 Saturation and lightness adjustments are on 16-step scale.
380 \begin_layout Section
384 \begin_layout Standard
385 These tokens are special, and are expanded while the script is being loaded
388 \begin_layout Subsection
389 @@LUA_SCRIPT_FILENAME@@
392 \begin_layout Standard
393 Expanded to string token containing path and filename of this Lua script.
394 Handy for referencing other lua scripts or resources that are relative
398 \begin_layout Standard
399 In practicular, this is suitable to be passed as base argument of various
400 functions like loadfile, dofile, resolve_filename, gui.bitmap_load, gui.bitmap_lo
401 ad_png and gui.bitmap_load_pal.
404 \begin_layout Section
408 \begin_layout Subsection
409 MMAP_STRUCT: Quasi-table mapping emulated memory
412 \begin_layout Standard
413 Objects act like tables, but the values reflect emulated memory.
416 \begin_layout Subsubsection
417 static function new: Create a new instance
420 \begin_layout Itemize
421 Syntax: mmap memory.mmap.new()
424 \begin_layout Itemize
425 Syntax: mmap classes.MMAP_STRUCT.new()
428 \begin_layout Standard
432 \begin_layout Itemize
433 mmap: MMAP_STRUCT: The created mmap structure.
436 \begin_layout Standard
437 Create a new object (with no mappings) and return it.
440 \begin_layout Subsubsection
441 operator(): Bind key in mmap structure
444 \begin_layout Itemize
445 Syntax: obj(key, {marea, address|addrobj}, type)
448 \begin_layout Standard
452 \begin_layout Itemize
453 obj: MMAP_STRUCT: The structure to manipulate.
456 \begin_layout Itemize
457 key: String: The name of the key in array to map.
460 \begin_layout Itemize
461 marea: String: The memory area the mapped address is in (default: global
465 \begin_layout Itemize
466 address: Number: The offset of memory addreess, relative to specified memory
467 area or global memory space.
470 \begin_layout Itemize
471 addrobj: ADDRESS: The memory address.
474 \begin_layout Itemize
475 type: String: The type of data to map.
476 \begin_inset Separator latexpar
483 \begin_layout Itemize
484 One of: byte, sbyte, word, sword, hword, shword, dword, sdword, qword, sqword,
489 \begin_layout Standard
490 Bind key <key> in mmap structure <obj> to address <address> (relative to
492 The memory address is treated as type <type>.
495 \begin_layout Itemize
497 \begin_inset Quotes eld
501 \begin_inset Quotes erd
505 \begin_inset Quotes eld
509 \begin_inset Quotes erd
513 \begin_inset Quotes eld
517 \begin_inset Quotes erd
523 \begin_layout Standard
524 This binds signed word at address WRAM+0x2A into key
525 \begin_inset Quotes eld
529 \begin_inset Quotes erd
535 \begin_layout Standard
536 \begin_inset Newpage pagebreak
542 \begin_layout Subsection
543 ZIPWRITER: Write .zip files
546 \begin_layout Standard
547 This class does writing of .zip files.
550 \begin_layout Subsubsection
551 Static function new: Create a new zipfile
554 \begin_layout Itemize
555 Syntax: zip zip.writer.new(filename, [compression])
558 \begin_layout Itemize
559 Deprecated: zip zip.create(filename, [compression])
562 \begin_layout Standard
566 \begin_layout Itemize
567 filename: string: The name of the file to write.
570 \begin_layout Itemize
571 compression: number: Compression level (0-9).
575 \begin_layout Standard
579 \begin_layout Itemize
580 zip: ZIPWRITER: The newly created ZIP writer.
583 \begin_layout Standard
584 Create a new ZIPWRITER object and return it.
587 \begin_layout Subsubsection
588 Method commit: Finish creating ZIP file.
591 \begin_layout Itemize
592 Syntax: zipfile:commit()
595 \begin_layout Standard
599 \begin_layout Itemize
600 zipfile: ZIPFILE: The ZIP file object.
603 \begin_layout Standard
604 Finish writing the ZIP file and actually create it on disk.
607 \begin_layout Itemize
608 If a member is currently open, it is implicitly closed.
611 \begin_layout Itemize
612 Invoking this on already committed or rolled back zipfile causes an error.
615 \begin_layout Subsubsection
616 Method rollback: Cancel writing the ZIP file.
619 \begin_layout Itemize
620 Syntax: zipfile:rollback()
623 \begin_layout Standard
627 \begin_layout Itemize
628 zipfile: ZIPFILE: The ZIP file object.
631 \begin_layout Standard
632 Cancel writing the whole ZIP file.
633 The file on disk will not be modified.
636 \begin_layout Itemize
637 If a member is currently open, it is implicitly closed.
640 \begin_layout Itemize
641 Invoking this on already committed or rolled back zipfile causes an error.
644 \begin_layout Subsubsection
645 Method create_file: Start writing a new member
648 \begin_layout Itemize
649 Syntax: zipfile:create_file(filename)
652 \begin_layout Standard
656 \begin_layout Itemize
657 zipfile: ZIPFILE: The ZIP file object.
660 \begin_layout Itemize
661 string filename: Name of the new member to create
664 \begin_layout Standard
665 Start writing a new member <filename> in ZIP file.
668 \begin_layout Itemize
669 If a member is currently open, it is implicitly closed.
672 \begin_layout Itemize
673 Invoking this on already committed or rolled back zipfile causes an error.
676 \begin_layout Subsubsection
677 Method close_file: Close member
680 \begin_layout Itemize
681 Syntax: zipfile:close_file()
684 \begin_layout Standard
688 \begin_layout Itemize
689 zipfile: ZIPFILE: The ZIP file object.
692 \begin_layout Standard
693 Close the currently open member in zipfile.
696 \begin_layout Itemize
697 Invoking this on already committed or rolled back zipfile causes an error.
700 \begin_layout Itemize
701 Invoking this without an open member causes an error.
704 \begin_layout Subsubsection
705 Method write: Write data
708 \begin_layout Itemize
709 Syntax: zipfile:write(data)
712 \begin_layout Standard
716 \begin_layout Itemize
717 zipfile: ZIPFILE: The ZIP file object.
720 \begin_layout Itemize
721 data: string: The data to write.
724 \begin_layout Standard
725 Write <data> in binary mode (as-is) to currently open member.
728 \begin_layout Itemize
729 Invoking this without a member being open causes an error.
732 \begin_layout Standard
733 \begin_inset Newpage pagebreak
739 \begin_layout Subsection
740 TILEMAP: Tiled collection of bitmaps.
743 \begin_layout Standard
744 A tilemap is tiled table, each cell holding a bitmap (indexed or direct).
747 \begin_layout Subsubsection
748 Static function new: Create a tilemap
751 \begin_layout Itemize
752 Syntax: tilemap gui.tiled_bitmap.new(w, h, bw, bh);
755 \begin_layout Itemize
756 Syntax: tilemap classes.TILEMAP.new(w, h, bw, bh);
759 \begin_layout Itemize
760 Deprecated: tilemap gui.tilemap(w, h, bw, bh);
763 \begin_layout Standard
767 \begin_layout Itemize
768 w: number: Width of the tilemap in tiles
771 \begin_layout Itemize
772 h: number: Height of the tilemap in tiles
775 \begin_layout Itemize
776 bw: number: Width of each tile in pixels.
779 \begin_layout Itemize
780 bh: number: Height of each tile in pixels.
783 \begin_layout Standard
787 \begin_layout Itemize
788 tilemap: TILEMAP: the newly created tilemap
791 \begin_layout Standard
792 Create a new tilemap of <w>*<h> tiles, each of <bw>*<bh> pixels and return
796 \begin_layout Subsubsection
797 TILEMAP:getsize: Query tilemap size
800 \begin_layout Itemize
801 Syntax: width, height tmap:getsize()
804 \begin_layout Standard
808 \begin_layout Itemize
809 tmap: TILEMAP: The tilemap to query.
812 \begin_layout Standard
816 \begin_layout Itemize
817 width: number : The width of the tilemap in tiles.
820 \begin_layout Itemize
821 height: number: The height of the tilemap in tiles.
824 \begin_layout Standard
825 Get size of tilemap in tiles.
828 \begin_layout Subsubsection
829 TILEMAP:getcsize: Query tilemap cell size
832 \begin_layout Itemize
833 Syntax: width, height tmap:getcsize()
836 \begin_layout Standard
840 \begin_layout Itemize
841 tmap: TILEMAP: The tilemap to query.
844 \begin_layout Standard
848 \begin_layout Itemize
849 width: number: The width of tilemap tile in pixels.
852 \begin_layout Itemize
853 height: number: The height of tilemap tile in pixels.
856 \begin_layout Standard
857 Get size of each tilemap tile in pixels.
860 \begin_layout Subsubsection
861 TILEMAP:get: Query tilemap tile
864 \begin_layout Itemize
865 Syntax: bitmap, palette tmap:get(x, y)
868 \begin_layout Standard
872 \begin_layout Itemize
873 tmap: TILEMAP: The tilemap to query.
876 \begin_layout Itemize
877 x: number: The x-coordinate of tile to query.
880 \begin_layout Itemize
881 y: number: The y-coordinate of tile to query.
884 \begin_layout Standard
888 \begin_layout Itemize
889 bitmap: The associated bitmap (BITMAP or DBITMAP), or nil if none.
892 \begin_layout Itemize
893 palette: The palette (PALETTE) associated with indexed-color bitmap, if
898 \begin_layout Standard
899 Return the contents of tile at <x>,<y>.
902 \begin_layout Subsubsection
903 TILEMAP:set: Set tilemap cell
906 \begin_layout Itemize
907 Syntax: tmap:set(x, y)
910 \begin_layout Itemize
911 Syntax: tmap:set(x, y, bitmap)
914 \begin_layout Itemize
915 Syntax: tmap:set(x, y, bitmap, palette)
918 \begin_layout Standard
922 \begin_layout Itemize
923 tmap: TILEMAP: The tilemap to manipulate.
926 \begin_layout Itemize
927 number x: The x-coordinate of tile to set.
930 \begin_layout Itemize
931 number y: The y-coordinate of tile to set.
934 \begin_layout Itemize
935 bitmap: BITMAP/DBITMAP: The bitmap to set to tile.
938 \begin_layout Itemize
939 palette: PALETTE: The associated palette for bitmap.
942 \begin_layout Standard
943 Set the contents of tile <x>,<y>.
944 If no <bitmap> is given, clears the tile.
945 Otherwise sets the tile to contain bitmap <bitmap> with associated palette
949 \begin_layout Itemize
950 Specifying index bitmap <bitmap> without palette <palette> causes an error.
953 \begin_layout Subsubsection
954 TILEMAP:scroll: Scroll tilemap
957 \begin_layout Itemize
958 Syntax: tmap:scroll(ox, oy);
961 \begin_layout Itemize
962 Syntax: tmap:scroll(ox, oy, x, y, w, h);
965 \begin_layout Itemize
966 Syntax: tmap:scroll(ox, oy, x, y, w, h, circ_x, circ_y);
969 \begin_layout Standard
973 \begin_layout Itemize
974 tmap: TILEMAP: The tilemap to manipulate.
977 \begin_layout Itemize
978 ox: number: The number of tiles to scroll horizontally (positive is to right).
981 \begin_layout Itemize
982 oy: number: The number of tiles to scroll vertically (positive is to down).
985 \begin_layout Itemize
986 x: number: The left edge of scroll window.
989 \begin_layout Itemize
990 y: number: The top edge of scroll window.
993 \begin_layout Itemize
994 w: number: The width of scroll window.
997 \begin_layout Itemize
998 h: number: The height of scroll window.
1001 \begin_layout Itemize
1002 circ_x: boolean: If true, treat the window as circular in horizontal direction.
1005 \begin_layout Itemize
1006 circ_y: boolean: If true, treat the window as circular in vertical direction.
1009 \begin_layout Standard
1010 Scroll the specified tilemap <tmap> by <ox>,<oy>.
1011 If a window <x>,<y>,<w>,<h> is specified, only that part is scrolled.
1012 <circ_x> and <circ_y> control if scroll is circular or not.
1015 \begin_layout Itemize
1016 Specifying out-of-range window causes an error.
1019 \begin_layout Subsubsection
1020 TILEMAP:draw: Draw tilemap
1023 \begin_layout Itemize
1024 Name: tmap:draw(x, y)
1027 \begin_layout Itemize
1028 Name: tmap:draw(x, y, x0, y0, w, h)
1031 \begin_layout Standard
1035 \begin_layout Itemize
1036 tmap: TILEMAP: The tilemap to draw.
1039 \begin_layout Itemize
1040 x: The x coordinate on screen to draw to.
1043 \begin_layout Itemize
1044 y: The y coordinate on screen to draw to.
1047 \begin_layout Itemize
1048 x0: number: The x coordinate on tilemap (in pixels) to start drawing from.
1051 \begin_layout Itemize
1052 y0: number: The y coordinate on tilemap (in pixels) to start drawing from.
1055 \begin_layout Itemize
1056 w: number: The width to draw (in pixels).
1059 \begin_layout Itemize
1060 h: number: The height to draw (in pixels).
1063 \begin_layout Standard
1064 Draw tilemap <tmap> to screen at <x>,<y>.
1065 If a window <x0>,<y0>,<w>,<h> is specified, only that part is drawn.
1068 \begin_layout Itemize
1069 This method requires a rendering context to work.
1072 \begin_layout Subsubsection
1073 TILEMAP:draw_outside: Draw tilemap outside game area
1076 \begin_layout Itemize
1077 Name: tmap:draw_outside(x, y)
1080 \begin_layout Itemize
1081 Name: tmap:draw_outside(x, y, x0, y0, w, h)
1084 \begin_layout Standard
1085 Like TILEMAP:draw, but draws only outside game area.
1088 \begin_layout Standard
1089 \begin_inset Newpage pagebreak
1095 \begin_layout Subsection
1096 RENDERCTX: Off-screen rendering context
1099 \begin_layout Standard
1100 Object acting as off-screen rendering context.
1103 \begin_layout Subsubsection
1104 Static function new: Create a render queue
1107 \begin_layout Itemize
1108 Syntax: renderctx gui.renderctx.new(width, height);
1111 \begin_layout Itemize
1112 Syntax: renderctx classes.RENDERCTX.new(width, height);
1115 \begin_layout Itemize
1116 Deprecated: renderctx gui.renderq_new(width, height);
1119 \begin_layout Standard
1123 \begin_layout Itemize
1124 width: number: The notional width of the game area.
1127 \begin_layout Itemize
1128 height: number: The notional height of the game area.
1131 \begin_layout Standard
1135 \begin_layout Itemize
1136 rendectx: RENDERCTX: The newly created render context.
1139 \begin_layout Standard
1140 Create a render context with reported size <width>*<height> and return it.
1143 \begin_layout Subsubsection
1144 Static function setnull: Reset to default queue
1147 \begin_layout Itemize
1148 Syntax: gui.renderctx.setnull()
1151 \begin_layout Itemize
1152 Syntax: classes.RENDERCTX:setnull()
1155 \begin_layout Itemize
1156 Deprecated: gui.renderq_set()
1159 \begin_layout Standard
1160 Reset the used render context back to default for the executing callback:
1163 \begin_layout Itemize
1164 The default for paint callback is the screen
1167 \begin_layout Itemize
1168 The default for video callback is the video frame
1171 \begin_layout Itemize
1172 The default otherwise is nothing.
1175 \begin_layout Subsubsection
1176 Method clear: Clear a render queue
1179 \begin_layout Itemize
1180 Syntax: renderctx:clear()
1183 \begin_layout Itemize
1184 Deprecated: gui.renderq_clear(renderctx)
1187 \begin_layout Standard
1191 \begin_layout Itemize
1192 renderctx: RENDERCTX: The render queue to clear.
1195 \begin_layout Standard
1196 Clear all drawing from the context.
1199 \begin_layout Subsubsection
1200 Method set: Change active render context
1203 \begin_layout Itemize
1204 Syntax: renderctx:set()
1207 \begin_layout Itemize
1208 Deprecated: gui.renderq_set(renderctx)
1211 \begin_layout Standard
1215 \begin_layout Itemize
1216 renderctx: RENDERCTX: The render queue to use.
1219 \begin_layout Standard
1220 Switch the current rendering context <renderctx>.
1223 \begin_layout Subsubsection
1224 Method run: Draw all objects in context to another
1227 \begin_layout Itemize
1228 Syntax: renderctx:run()
1231 \begin_layout Itemize
1232 Deprecated: gui.renderq_run(renderctx)
1235 \begin_layout Standard
1239 \begin_layout Itemize
1240 renderctx: RENDERCTX: The render context to overlay.
1243 \begin_layout Standard
1244 Overlay the specified render context <context> upon the active rendering
1248 \begin_layout Itemize
1249 Trying to overlay rendering context upon itself is a bad idea.
1252 \begin_layout Subsubsection
1253 Method render: Render a contex to bitmap
1256 \begin_layout Itemize
1257 Syntax: bitmap renderctx:render()
1260 \begin_layout Standard
1264 \begin_layout Itemize
1265 renderctx: RENDERCTX: The context to render.
1268 \begin_layout Standard
1272 \begin_layout Itemize
1273 bitmap: DBITMAP: The rendered bitmap.
1276 \begin_layout Standard
1277 Render the specified context <renderctx> to a new bitmap.
1280 \begin_layout Itemize
1281 The size of bitmap will be nominal game area size, plus any set gaps.
1284 \begin_layout Itemize
1285 This method does not require active rendering context.
1288 \begin_layout Subsubsection
1289 Method synchronous_repaint: Paint screen now
1292 \begin_layout Itemize
1293 Syntax: renderctx:synchronous_repaint()
1296 \begin_layout Itemize
1297 Deprecated: gui.synchronous_repaint(renderctx)
1300 \begin_layout Standard
1304 \begin_layout Itemize
1305 renderctx: RENDERCTX: The context to paint.
1308 \begin_layout Standard
1309 Immediately redraw the screen with game overlayed by drawings from context
1313 \begin_layout Itemize
1314 This does not require active rendering context.
1317 \begin_layout Itemize
1318 Will not cause paint callback to be invoked.
1321 \begin_layout Standard
1322 \begin_inset Newpage pagebreak
1328 \begin_layout Subsection
1329 PALETTE: Color palette for indexed image
1332 \begin_layout Subsubsection
1333 Static function new: Create a new palette
1336 \begin_layout Itemize
1337 Syntax: palette gui.palette.new()
1340 \begin_layout Itemize
1341 Syntax: palette classes.PALETTE.new()
1344 \begin_layout Itemize
1345 Deprecated: palette gui.palette_new()
1348 \begin_layout Standard
1352 \begin_layout Itemize
1353 palette: PALETTE: The created palette.
1356 \begin_layout Standard
1357 Create a new palette (with all colors transparent) and return it.
1360 \begin_layout Subsubsection
1361 Static function load: Load a palette
1364 \begin_layout Itemize
1365 Syntax: palette gui.palette.load(file, [base])
1368 \begin_layout Itemize
1369 Syntax: palette classes.PALETTE.load(file, [base])
1372 \begin_layout Itemize
1373 Deprecated: palette gui.palette_load(file, [base])
1376 \begin_layout Standard
1380 \begin_layout Itemize
1381 string file: The file to load.
1384 \begin_layout Itemize
1385 string base (optional): The base file to resolve file relative to.
1388 \begin_layout Standard
1392 \begin_layout Itemize
1393 palette: PALETTE: The loaded palette.
1396 \begin_layout Standard
1397 Load a palette from file <file> (resolved relative to <base>).
1400 \begin_layout Itemize
1401 The file format is a series of lines, each with following format:
1402 \begin_inset Separator latexpar
1409 \begin_layout Itemize
1410 Blank or just whitespace: Ignored
1413 \begin_layout Itemize
1414 First non-whitespace is '#': Ignored
1417 \begin_layout Itemize
1418 <r> <g> <b>: Fully opaque color with specified RGB values (0-255)
1421 \begin_layout Itemize
1422 <r> <g> <b> <a>: Color with specified RGB values (0-255) and specified alpha
1423 (0-256, 0 being fully transparent and 256 fully opaque).
1426 \begin_layout Itemize
1427 transparent: Fully transparent color
1431 \begin_layout Subsubsection
1432 Static function load_str: Load a palette from string
1435 \begin_layout Itemize
1436 Syntax: palette gui.palette.load(data)
1439 \begin_layout Itemize
1440 Syntax: palette classes.PALETTE.load(data)
1443 \begin_layout Itemize
1444 Deprecated: palette gui.palette_load(data)
1447 \begin_layout Standard
1451 \begin_layout Itemize
1452 string data: The palette data.
1455 \begin_layout Standard
1459 \begin_layout Itemize
1460 palette: PALETTE: The loaded palette.
1463 \begin_layout Standard
1464 Like PALETTE:load, but instead of reading palette from file, reads it from
1468 \begin_layout Subsubsection
1469 Method set: Set palette entry
1472 \begin_layout Itemize
1473 Syntax: palette:set(index, color)
1476 \begin_layout Itemize
1477 Deprecated: gui.palette_set(palette, ...)
1480 \begin_layout Standard
1484 \begin_layout Itemize
1485 palette: PALETTE: The palette to manipulate
1488 \begin_layout Itemize
1489 index: number: The index of color to set (0-65535).
1492 \begin_layout Itemize
1493 color: number/string: The color value to set.
1496 \begin_layout Standard
1497 Set palette <palette> index <index> to color <color>.
1500 \begin_layout Subsubsection
1501 Method get: Get palette entry
1504 \begin_layout Itemize
1505 Syntax: number palette:get(index)
1508 \begin_layout Standard
1512 \begin_layout Itemize
1513 palette: PALETTE: The palette to query
1516 \begin_layout Itemize
1517 index: number: The index of color to get (0-65535).
1520 \begin_layout Standard
1524 \begin_layout Itemize
1525 The palette entry as integer.
1528 \begin_layout Standard
1529 Get palette entry <index> of palette <palette> and return it.
1532 \begin_layout Subsubsection
1533 Method hash: Hash a palette
1536 \begin_layout Itemize
1537 Syntax: hash palette:hash()
1540 \begin_layout Itemize
1541 Deprecated: hash gui.palette_hash(palette)
1544 \begin_layout Standard
1548 \begin_layout Itemize
1549 palette: The palette to hash.
1552 \begin_layout Standard
1556 \begin_layout Itemize
1557 hash: string: 64-hex digit hash.
1560 \begin_layout Standard
1561 Obtain crypto-grade hash of palette data of <palette>.
1564 \begin_layout Itemize
1565 All colors after the last non-transparent one are ignored.
1568 \begin_layout Subsubsection
1569 Method adjust_transparency: Adjust transparency
1572 \begin_layout Itemize
1573 Syntax: palette:adjust_transparency(newvalue)
1576 \begin_layout Itemize
1577 Deprecated: gui.adjust_transparency(palette, ...)
1580 \begin_layout Standard
1584 \begin_layout Itemize
1585 palette: PALETTE: The palette to adjust.
1588 \begin_layout Itemize
1589 Number adj: The factor to multiply opaqueness with times 256.
1592 \begin_layout Standard
1593 Multiply opaqueness of all colors in palette <palette> by factor of <adj>/256.
1596 \begin_layout Standard
1597 \begin_inset Newpage pagebreak
1603 \begin_layout Subsection
1604 BITMAP: Indexed-color bitmap
1607 \begin_layout Subsubsection
1608 Static function new: Create a new bitmap
1611 \begin_layout Itemize
1612 Syntax: bitmap gui.bitmap.new(w, h, [fillcolor])
1615 \begin_layout Itemize
1616 Syntax: bitmap classes.BITMAP.new(w, h, [fillcolor])
1619 \begin_layout Itemize
1620 Deprecated: bitmap gui.bitmap_new(w, h, false, [fillcolor])
1623 \begin_layout Standard
1627 \begin_layout Itemize
1628 w: number: The width of bitmap to create in pixels.
1631 \begin_layout Itemize
1632 h: number: The height of bitmap to create in pixels.
1635 \begin_layout Itemize
1636 false: boolean: Constant boolean false.
1639 \begin_layout Itemize
1640 fillcolor: number: The initial fill index.
1641 Default 0 if not specified.
1644 \begin_layout Standard
1645 Create a new bitmap of size <w>*<h>.
1646 Fill the bitmap with color index <fillcolor>.
1649 \begin_layout Subsubsection
1650 Method draw: Draw a bitmap
1653 \begin_layout Itemize
1654 Syntax: bitmap:draw(x, y, palette)
1657 \begin_layout Itemize
1658 Deprecated: gui.bitmap_draw(x, y, bitmap, palette)
1661 \begin_layout Standard
1665 \begin_layout Itemize
1666 bitmap: BITMAP: The bitmap to draw
1669 \begin_layout Itemize
1670 x: number: The x-coordinate on screen.
1673 \begin_layout Itemize
1674 y: number: The y-coordinate on screen.
1677 \begin_layout Itemize
1678 palette: The palette to use for drawing.
1681 \begin_layout Standard
1682 Draw bitmap <bitmap> on screen at <x>,<y> with palette <palette>.
1685 \begin_layout Subsubsection
1686 Method draw_outside: Draw a bitmap outside game area
1689 \begin_layout Itemize
1690 Syntax: bitmap:draw_outside(x, y, palette)
1693 \begin_layout Standard
1694 Like bitmap:draw, but does not draw on game area.
1697 \begin_layout Subsubsection
1698 Method draw_clip: Draw a bitmap, with clipping
1701 \begin_layout Itemize
1702 Syntax: bitmap:draw_clip(x, y, palette, x0, y0, width, height)
1705 \begin_layout Standard
1709 \begin_layout Itemize
1710 bitmap: BITMAP: The bitmap to draw
1713 \begin_layout Itemize
1714 x: number: The x-coordinate on screen.
1717 \begin_layout Itemize
1718 y: number: The y-coordinate on screen.
1721 \begin_layout Itemize
1722 palette: The palette to use for drawing.
1725 \begin_layout Itemize
1726 x0: The smallest bitmap x coordinate to draw.
1729 \begin_layout Itemize
1730 y0: The smallest bitmap y coordinate to draw.
1733 \begin_layout Itemize
1734 width: Width of region to draw
1737 \begin_layout Itemize
1738 height: Height of region to draw.
1741 \begin_layout Standard
1742 Like bitmap:draw, but clip the bitmap area drawn.
1745 \begin_layout Subsubsection
1746 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
1749 \begin_layout Itemize
1750 Syntax: bitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
1753 \begin_layout Standard
1754 Like bitmap:draw_clip, but only draw outside game area.
1757 \begin_layout Subsubsection
1758 Method pset: Set pixel in bitmap
1761 \begin_layout Itemize
1762 Syntax: bitmap:pset(x, y, color)
1765 \begin_layout Itemize
1766 Deprecaed: gui.bitmap_pset(bitmap, ...)
1769 \begin_layout Standard
1773 \begin_layout Itemize
1774 bitmap: BITMAP: The bitmap to manipulate.
1777 \begin_layout Itemize
1778 x: number: x-coordinate of pixel to set.
1781 \begin_layout Itemize
1782 y: number: y-coordinate of pixel to set.
1785 \begin_layout Itemize
1786 color: number: The color index to set.
1789 \begin_layout Standard
1790 Sets specified pixel <x>,<y> in bitmap <bitmap> to color index <color>.
1793 \begin_layout Subsubsection
1794 Method pget: Get pixel in bitmap
1797 \begin_layout Itemize
1798 Syntax: color bitmap:pget(x,y)
1801 \begin_layout Itemize
1802 Deprecated: color gui.bitmap_pget(bitmap, ...)
1805 \begin_layout Standard
1809 \begin_layout Itemize
1810 bitmap: BITMAP: The bitmap to query.
1813 \begin_layout Itemize
1814 x: number: x-coordinate of pixel to get.
1817 \begin_layout Itemize
1818 y: number: y-coordinate of pixel to get.
1821 \begin_layout Standard
1825 \begin_layout Itemize
1826 color: number: The color index in specified pixel.
1829 \begin_layout Standard
1830 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
1833 \begin_layout Subsubsection
1834 Method size: Get size of bitmap
1837 \begin_layout Itemize
1838 Syntax: width, height bitmap:size()
1841 \begin_layout Itemize
1842 Syntax: width, height gui.bitmap_size(bitmap)
1845 \begin_layout Standard
1849 \begin_layout Itemize
1850 bitmap: BITMAP: The bitmap to query.
1853 \begin_layout Standard
1857 \begin_layout Itemize
1858 width: number: The width of the bitmap.
1861 \begin_layout Itemize
1862 height: number: The height of the bitmap.
1865 \begin_layout Standard
1866 Get size of bitmap <bitmap>.
1869 \begin_layout Subsubsection
1870 Method blit: Blit a bitmap into another
1873 \begin_layout Itemize
1874 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
1877 \begin_layout Itemize
1878 Deprecated: gui.bitmap_blit(dest, ...)
1881 \begin_layout Standard
1885 \begin_layout Itemize
1886 dest: BITMAP: The target bitmap to blit to.
1889 \begin_layout Itemize
1890 dx: number: The x-coordinate in target.
1893 \begin_layout Itemize
1894 dy: number: The y-coordinate in target.
1897 \begin_layout Itemize
1898 src: BITMAP: The source bitmap.
1901 \begin_layout Itemize
1902 sx: number: The x-coordinate in source.
1905 \begin_layout Itemize
1906 sy: number: The y-coordinate in source.
1909 \begin_layout Itemize
1910 w: number: The width of area to blit.
1913 \begin_layout Itemize
1914 h: number: The height of area to blit.
1917 \begin_layout Itemize
1918 ck: number: The color key.
1919 Pixels with this index are not copied.
1920 \begin_inset Separator latexpar
1927 \begin_layout Itemize
1928 If none is specified, all pixels are copied.
1932 \begin_layout Standard
1933 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> into <dest> at
1935 If a color key <ck> is specified, pixels of that color are not copied.
1938 \begin_layout Subsubsection
1939 Method blit_scaled: Blit a bitmap into another with scaling
1942 \begin_layout Itemize
1943 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
1946 \begin_layout Itemize
1947 Deprecated: gui.bitmap_blit_scaled(dest, ...)
1950 \begin_layout Standard
1954 \begin_layout Itemize
1955 dest: BITMAP: The target bitmap to blit to.
1958 \begin_layout Itemize
1959 dx: number: The x-coordinate in target.
1962 \begin_layout Itemize
1963 dy: number: The y-coordinate in target.
1966 \begin_layout Itemize
1967 src: BITMAP: The source bitmap.
1970 \begin_layout Itemize
1971 sx: number: The x-coordinate in source.
1974 \begin_layout Itemize
1975 sy: number: The y-coordinate in source.
1978 \begin_layout Itemize
1979 w: number: The width of area to blit.
1982 \begin_layout Itemize
1983 h: number: The height of area to blit.
1986 \begin_layout Itemize
1987 hscl: number: Horizontal scale factor (integer).
1990 \begin_layout Itemize
1991 vscl: number: Vertical scale factor (integer).
1992 Defaults to the same as <hscl>.
1995 \begin_layout Itemize
1996 ck: number: The color key.
1997 Pixels with this index are not copied.
1998 \begin_inset Separator latexpar
2005 \begin_layout Itemize
2006 If none is specified, all pixels are copied.
2010 \begin_layout Standard
2011 Like BITMAP:blit, but also scales the copied part of bitmap (using nearest
2012 neighbor) by factor of <hscl>*<vscl>.
2015 \begin_layout Subsubsection
2016 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2019 \begin_layout Itemize
2020 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2023 \begin_layout Itemize
2024 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2027 \begin_layout Standard
2031 \begin_layout Itemize
2032 dest: BITMAP: The target bitmap to blit to.
2035 \begin_layout Itemize
2036 dx: number: The x-coordinate in target.
2039 \begin_layout Itemize
2040 dy: number: The y-coordinate in target.
2043 \begin_layout Itemize
2044 src: BITMAP: The source bitmap.
2047 \begin_layout Itemize
2048 sx: number: The x-coordinate in source.
2051 \begin_layout Itemize
2052 sy: number: The y-coordinate in source.
2055 \begin_layout Itemize
2056 w: number: The width of area to blit.
2059 \begin_layout Itemize
2060 h: number: The height of area to blit.
2063 \begin_layout Itemize
2064 operator: string: The operator to use.
2065 \begin_inset Separator latexpar
2072 \begin_layout Itemize
2073 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2074 DestOut, Clear or Xor.
2078 \begin_layout Standard
2079 Like BITMAP:blit, but instead of just overwriting, applies specified Porter-Duff
2084 \begin_layout Itemize
2085 Color index 0 in source and target is treated as background.
2088 \begin_layout Subsubsection
2089 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2090 Porter-Duff composition
2093 \begin_layout Itemize
2094 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2098 \begin_layout Itemize
2099 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2102 \begin_layout Standard
2106 \begin_layout Itemize
2107 dest: BITMAP: The target bitmap to blit to.
2110 \begin_layout Itemize
2111 dx: number: The x-coordinate in target.
2114 \begin_layout Itemize
2115 dy: number: The y-coordinate in target.
2118 \begin_layout Itemize
2119 src: BITMAP: The source bitmap.
2122 \begin_layout Itemize
2123 sx: number: The x-coordinate in source.
2126 \begin_layout Itemize
2127 sy: number: The y-coordinate in source.
2130 \begin_layout Itemize
2131 w: number: The width of area to blit.
2134 \begin_layout Itemize
2135 h: number: The height of area to blit.
2138 \begin_layout Itemize
2139 hscl: number: Horizontal scale factor (integer).
2142 \begin_layout Itemize
2143 vscl: number: Vertical scale factor (integer).
2144 Defaults to the same as <hscl>.
2147 \begin_layout Itemize
2148 operator: string: The operator to use.
2149 \begin_inset Separator latexpar
2156 \begin_layout Itemize
2157 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2158 DestOut, Clear or Xor.
2162 \begin_layout Standard
2163 Like BITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2164 like BITMAP:blit_scaled.
2167 \begin_layout Subsubsection
2168 Method blit_priority: Blit a bitmap into another with color priority
2171 \begin_layout Itemize
2172 Syntax: dest:blit_priority(dx, dy, src, sx, sy, w, h)
2175 \begin_layout Itemize
2176 Deprecated: gui.bitmap_blit_priority(dest, ...)
2179 \begin_layout Standard
2183 \begin_layout Itemize
2184 dest: BITMAP: The target bitmap to blit to.
2187 \begin_layout Itemize
2188 dx: number: The x-coordinate in target.
2191 \begin_layout Itemize
2192 dy: number: The y-coordinate in target.
2195 \begin_layout Itemize
2196 src: BITMAP: The source bitmap.
2199 \begin_layout Itemize
2200 sx: number: The x-coordinate in source.
2203 \begin_layout Itemize
2204 sy: number: The y-coordinate in source.
2207 \begin_layout Itemize
2208 w: number: The width of area to blit.
2211 \begin_layout Itemize
2212 h: number: The height of area to blit.
2215 \begin_layout Standard
2216 Like BITMAP:blit, but only copy pixels where source color index is greater
2217 than destination color index.
2220 \begin_layout Subsubsection
2221 Method blit_scaled_priority: Blit a bitmap into another with color priority
2225 \begin_layout Itemize
2226 Syntax: dest:blit_scaled_priority(dx, dy, src, sx, sy, w, h, hscl, [vscl])
2229 \begin_layout Itemize
2230 Deprecated: gui.bitmap_blit_scaled_priority(dest, ...)
2233 \begin_layout Standard
2237 \begin_layout Itemize
2238 dest: BITMAP: The target bitmap to blit to.
2241 \begin_layout Itemize
2242 dx: number: The x-coordinate in target.
2245 \begin_layout Itemize
2246 dy: number: The y-coordinate in target.
2249 \begin_layout Itemize
2250 src: BITMAP: The source bitmap.
2253 \begin_layout Itemize
2254 sx: number: The x-coordinate in source.
2257 \begin_layout Itemize
2258 sy: number: The y-coordinate in source.
2261 \begin_layout Itemize
2262 w: number: The width of area to blit.
2265 \begin_layout Itemize
2266 h: number: The height of area to blit.
2269 \begin_layout Itemize
2270 hscl: number: Horizontal scale factor (integer).
2273 \begin_layout Itemize
2274 vscl: number: Vertical scale factor (integer).
2275 Defaults to the same as <hscl>.
2278 \begin_layout Standard
2279 Like BITMAP:blit_priority, but apply scaling by <hscl>*<vscl> like BITMAP:blit_s
2283 \begin_layout Subsubsection
2284 Method save_png: Save a bitmap to PNG
2287 \begin_layout Itemize
2288 Syntax: bitmap:save_png(filename, [base], palette)
2291 \begin_layout Itemize
2292 Syntax: data bitmap:save_png(palette)
2295 \begin_layout Itemize
2297 gui.bitmap_save_png(bitmap, ...)
2300 \begin_layout Standard
2304 \begin_layout Itemize
2305 bitmap: BITMAP: The bitmap to save.
2308 \begin_layout Itemize
2309 filename: string: The filename to save to.
2312 \begin_layout Itemize
2313 base: string: The base filename is resolved relative to.
2316 \begin_layout Itemize
2317 palette: PALETTE: The palette to use.
2320 \begin_layout Standard
2324 \begin_layout Itemize
2325 data: string: BASE64 encoded PNG data.
2328 \begin_layout Standard
2329 Save bitmap <bitmap>, with palette <pal> into PNG file <filename> (relative
2330 to <base>) or return BASE64 encoding of it.
2333 \begin_layout Subsubsection
2334 Method hash: Hash a bitmap
2337 \begin_layout Itemize
2338 Syntax: hash bitmap:hash()
2341 \begin_layout Itemize
2342 Deprecated: hash bitmap:hash(bitmap)
2345 \begin_layout Standard
2349 \begin_layout Itemize
2350 bitmap: BITMAP: The bitmap to hash.
2353 \begin_layout Standard
2357 \begin_layout Itemize
2358 hash: string: 64-hex digit hash
2361 \begin_layout Standard
2362 Hashes bitmap <bitmap> and returns crypto-strong hash.
2366 \begin_layout Itemize
2367 Color order in bitmap is significant.
2370 \begin_layout Subsubsection
2371 Method sample_texture: Sample a texture
2374 \begin_layout Itemize
2375 Syntax: none bitmap:sample_texture(BITMAP source, number xx, number xy,
2376 number x0, number yx, number yy, number y0, number scale, boolean wrap)
2379 \begin_layout Standard
2383 \begin_layout Itemize
2384 source: BITMAP: The bitmap to sample
2387 \begin_layout Itemize
2388 xx: number: s times the source x coefficient of target x axis.
2391 \begin_layout Itemize
2392 xy: number: s times the source y coefficient of target x axis.
2395 \begin_layout Itemize
2396 x0: number: s times the target x axis offset.
2399 \begin_layout Itemize
2400 yx: number: s times the source x coefficient of target y axis.
2403 \begin_layout Itemize
2404 yy: number: s times the source y coefficient of target y axis.
2407 \begin_layout Itemize
2408 y0: number: s times the target y axis offset.
2411 \begin_layout Itemize
2412 s: number: Scale of coordinates
2415 \begin_layout Itemize
2416 wrap: boolean: If true, wrap the texture.
2417 If false, read outside the texture as color 0.
2420 \begin_layout Standard
2421 Samples the source as texture, performing linear transform (with nearest-neighbo
2422 r sampling) and writes the result to this bitmap.
2425 \begin_layout Subsubsection
2426 Method hflip: Horizontally flip a bitmap
2429 \begin_layout Itemize
2430 Syntax: none bitmap:hflip()
2433 \begin_layout Standard
2434 Horizontally flips a bitmap.
2437 \begin_layout Subsubsection
2438 Method vflip: Vertically flip a bitmap
2441 \begin_layout Itemize
2442 Syntax: none bitmap:vflip()
2445 \begin_layout Standard
2446 Vertically flips a bitmap.
2449 \begin_layout Standard
2450 \begin_inset Newpage pagebreak
2456 \begin_layout Subsection
2457 DBITMAP: Direct-color bitmap
2460 \begin_layout Subsubsection
2461 Static function: new: Create a new bitmap
2464 \begin_layout Itemize
2465 Syntax: bitmap gui.dbitmap.new(w, h, [fillcolor])
2468 \begin_layout Itemize
2469 Syntax: bitmap classes.DBITMAP.new(w, h, [fillcolor])
2472 \begin_layout Itemize
2473 Deprecated: bitmap gui.bitmap_new (w, h, true, [fillcolor]).
2476 \begin_layout Standard
2480 \begin_layout Itemize
2481 w: number: The width of new bitmap.
2484 \begin_layout Itemize
2485 h: number: The height of new bitmap.
2488 \begin_layout Itemize
2489 true: boolean: Fixed boolean true
2492 \begin_layout Itemize
2493 fillcolor: The color to fill the bitmap with (default transparent).
2496 \begin_layout Standard
2500 \begin_layout Itemize
2501 bitmap: DBITMAP: The new bitmap.
2504 \begin_layout Standard
2505 Create a new direct-color bitmap of size <w>*<h>, initially filled with
2509 \begin_layout Subsubsection
2510 Method draw: Draw a bitmap
2513 \begin_layout Itemize
2514 Syntax: bitmap.draw(x, y)
2517 \begin_layout Itemize
2518 Deprecated: gui.bitmap_draw(x, y, bitmap)
2521 \begin_layout Standard
2525 \begin_layout Itemize
2526 bitmap: DBITMAP: The bitmap to draw.
2529 \begin_layout Itemize
2530 x: number: X-coordinate on screen.
2533 \begin_layout Itemize
2534 y: number: Y-coordinate on screen.
2537 \begin_layout Standard
2538 Draw bitmap <bitmap> on screen at <x>,<y>.
2541 \begin_layout Subsubsection
2542 Method draw_outside: Draw a bitmap outside game area
2545 \begin_layout Itemize
2546 Syntax: dbitmap:draw_outside(x, y, palette)
2549 \begin_layout Standard
2550 Like dbitmap:draw, but does not draw on game area.
2553 \begin_layout Subsubsection
2554 Method draw_clip: Draw a bitmap, with clipping
2557 \begin_layout Itemize
2558 Syntax: dbitmap:draw(x, y, palette, x0, y0, width, height)
2561 \begin_layout Standard
2565 \begin_layout Itemize
2566 bitmap: DBITMAP: The bitmap to draw
2569 \begin_layout Itemize
2570 x: number: The x-coordinate on screen.
2573 \begin_layout Itemize
2574 y: number: The y-coordinate on screen.
2577 \begin_layout Itemize
2578 x0: The smallest bitmap x coordinate to draw.
2581 \begin_layout Itemize
2582 y0: The smallest bitmap y coordinate to draw.
2585 \begin_layout Itemize
2586 width: Width of region to draw
2589 \begin_layout Itemize
2590 height: Height of region to draw.
2593 \begin_layout Standard
2594 Like dbitmap:draw, but clip the bitmap area drawn.
2597 \begin_layout Subsubsection
2598 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
2601 \begin_layout Itemize
2602 Syntax: dbitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
2605 \begin_layout Standard
2606 Like dbitmap:draw_clip, but only draw outside game area.
2609 \begin_layout Subsubsection
2610 Method pset: Set pixel in bitmap
2613 \begin_layout Itemize
2614 Syntax: bitmap:pset(x, y, color)
2617 \begin_layout Itemize
2618 Deprecaed: gui.bitmap_pset(bitmap, ...)
2621 \begin_layout Standard
2625 \begin_layout Itemize
2626 bitmap: DBITMAP: The bitmap to manipulate.
2629 \begin_layout Itemize
2630 x: number: x-coordinate of pixel to set.
2633 \begin_layout Itemize
2634 y: number: y-coordinate of pixel to set.
2637 \begin_layout Itemize
2638 color: number/string: The color to set.
2641 \begin_layout Standard
2642 Sets specified pixel <x>,<y> in bitmap <bitmap> to color <color>.
2645 \begin_layout Subsubsection
2646 Method pget: Get pixel in bitmap
2649 \begin_layout Itemize
2650 Syntax: color bitmap:pget(x,y)
2653 \begin_layout Itemize
2654 Deprecated: color gui.bitmap_pget(bitmap, ...)
2657 \begin_layout Standard
2661 \begin_layout Itemize
2662 bitmap: DBITMAP: The bitmap to query.
2665 \begin_layout Itemize
2666 x: number: x-coordinate of pixel to get.
2669 \begin_layout Itemize
2670 y: number: y-coordinate of pixel to get.
2673 \begin_layout Standard
2677 \begin_layout Itemize
2678 color: number: The color of specified pixel.
2681 \begin_layout Standard
2682 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
2685 \begin_layout Subsubsection
2686 Method size: Get size of bitmap
2689 \begin_layout Itemize
2690 Syntax: width, height bitmap:size()
2693 \begin_layout Itemize
2694 Syntax: width, height gui.bitmap_size(bitmap)
2697 \begin_layout Standard
2701 \begin_layout Itemize
2702 bitmap: DBITMAP: The bitmap to query.
2705 \begin_layout Standard
2709 \begin_layout Itemize
2710 width: number: The width of the bitmap.
2713 \begin_layout Itemize
2714 height: number: The height of the bitmap.
2717 \begin_layout Standard
2718 Get size of bitmap <bitmap>.
2721 \begin_layout Subsubsection
2722 Method blit: Blit a bitmap into another
2725 \begin_layout Itemize
2726 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
2729 \begin_layout Itemize
2730 Syntax: dest:blit(dx, dy, src, srcpal, sx, sy, w, h, [ck])
2733 \begin_layout Itemize
2734 Deprecated: gui.bitmap_blit(dest, ...)
2737 \begin_layout Standard
2741 \begin_layout Itemize
2742 dest: DBITMAP: The target bitmap to blit to.
2745 \begin_layout Itemize
2746 dx: number: The x-coordinate in target.
2749 \begin_layout Itemize
2750 dy: number: The y-coordinate in target.
2753 \begin_layout Itemize
2754 src: BITMAP/DBITMAP: The source bitmap.
2757 \begin_layout Itemize
2758 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2761 \begin_layout Itemize
2762 sx: number: The x-coordinate in source.
2765 \begin_layout Itemize
2766 sy: number: The y-coordinate in source.
2769 \begin_layout Itemize
2770 w: number: The width of area to blit.
2773 \begin_layout Itemize
2774 h: number: The height of area to blit.
2777 \begin_layout Itemize
2778 ck: number: The color key.
2779 Pixels with this index are not copied.
2780 \begin_inset Separator latexpar
2787 \begin_layout Itemize
2788 If none is specified, all pixels are copied.
2791 \begin_layout Itemize
2792 If <src> is paletted, this is color index, otherwise it is a color.
2796 \begin_layout Standard
2797 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> (with palette <pal>
2798 if indexed) into <dest> at <dx>,<dy>.
2799 If a color key <ck> is specified, pixels of that color are not copied.
2802 \begin_layout Subsubsection
2803 Method blit_scaled: Blit a bitmap into another with scaling
2806 \begin_layout Itemize
2807 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
2810 \begin_layout Itemize
2811 Syntax: dest:blit_scaled(dx, dy, src, srcpal, sx, sy, w, h, hscl, [vscl],
2815 \begin_layout Itemize
2816 Deprecated: gui.bitmap_blit_scaled(dest, ...)
2819 \begin_layout Standard
2823 \begin_layout Itemize
2824 dest: DBITMAP: The target bitmap to blit to.
2827 \begin_layout Itemize
2828 dx: number: The x-coordinate in target.
2831 \begin_layout Itemize
2832 dy: number: The y-coordinate in target.
2835 \begin_layout Itemize
2836 src: BITMAP/DBITMAP: The source bitmap.
2839 \begin_layout Itemize
2840 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2843 \begin_layout Itemize
2844 sx: number: The x-coordinate in source.
2847 \begin_layout Itemize
2848 sy: number: The y-coordinate in source.
2851 \begin_layout Itemize
2852 w: number: The width of area to blit.
2855 \begin_layout Itemize
2856 h: number: The height of area to blit.
2859 \begin_layout Itemize
2860 hscl: number: Horizontal scale factor (integer).
2863 \begin_layout Itemize
2864 vscl: number: Vertical scale factor (integer).
2865 Defaults to the same as <hscl>.
2868 \begin_layout Itemize
2869 ck: number: The color key.
2870 Pixels with this index are not copied.
2871 \begin_inset Separator latexpar
2878 \begin_layout Itemize
2879 If none is specified, all pixels are copied.
2882 \begin_layout Itemize
2883 If <src> is paletted, this is color index, otherwise it is a color.
2887 \begin_layout Standard
2888 Like DBITMAP:blit, but also scales the copied part of bitmap (using nearest
2889 neighbor) by factor of <hscl>*<vscl>.
2892 \begin_layout Subsubsection
2893 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2896 \begin_layout Itemize
2897 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2900 \begin_layout Itemize
2901 Syntax: dest:blit_porterduff(dx, dy, src, srcpal, sx, sy, w, h, operator)
2904 \begin_layout Itemize
2905 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2908 \begin_layout Standard
2912 \begin_layout Itemize
2913 dest: DBITMAP: The target bitmap to blit to.
2916 \begin_layout Itemize
2917 dx: number: The x-coordinate in target.
2920 \begin_layout Itemize
2921 dy: number: The y-coordinate in target.
2924 \begin_layout Itemize
2925 src: BITMAP/DBITMAP: The source bitmap.
2928 \begin_layout Itemize
2929 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2932 \begin_layout Itemize
2933 sx: number: The x-coordinate in source.
2936 \begin_layout Itemize
2937 sy: number: The y-coordinate in source.
2940 \begin_layout Itemize
2941 w: number: The width of area to blit.
2944 \begin_layout Itemize
2945 h: number: The height of area to blit.
2948 \begin_layout Itemize
2949 operator: string: The operator to use.
2950 \begin_inset Separator latexpar
2957 \begin_layout Itemize
2958 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2959 DestOut, Clear or Xor.
2963 \begin_layout Standard
2964 Like DBITMAP:blit, but instead of just overwriting, applies specified Porter-Duf
2969 \begin_layout Itemize
2970 In target, fully transparent is background.
2971 In source, either fully transparent (if direct) or index 0 (if paletted)
2972 is treated as background.
2975 \begin_layout Subsubsection
2976 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2977 Porter-Duff composition
2980 \begin_layout Itemize
2981 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2985 \begin_layout Itemize
2986 Syntax: dest:blit_scaled_porterduff(dx, dy, src, srcpal, sx, sy, w, h, hscl,
2990 \begin_layout Itemize
2991 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2994 \begin_layout Standard
2998 \begin_layout Itemize
2999 dest: DBITMAP: The target bitmap to blit to.
3002 \begin_layout Itemize
3003 dx: number: The x-coordinate in target.
3006 \begin_layout Itemize
3007 dy: number: The y-coordinate in target.
3010 \begin_layout Itemize
3011 src: BITMAP/DBITMAP: The source bitmap.
3014 \begin_layout Itemize
3015 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
3018 \begin_layout Itemize
3019 sx: number: The x-coordinate in source.
3022 \begin_layout Itemize
3023 sy: number: The y-coordinate in source.
3026 \begin_layout Itemize
3027 w: number: The width of area to blit.
3030 \begin_layout Itemize
3031 h: number: The height of area to blit.
3034 \begin_layout Itemize
3035 hscl: number: Horizontal scale factor (integer).
3038 \begin_layout Itemize
3039 vscl: number: Vertical scale factor (integer).
3040 Defaults to the same as <hscl>.
3043 \begin_layout Itemize
3044 operator: string: The operator to use.
3045 \begin_inset Separator latexpar
3052 \begin_layout Itemize
3053 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
3054 DestOut, Clear or Xor.
3058 \begin_layout Standard
3059 Like DBITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
3060 like DBITMAP:blit_scaled.
3063 \begin_layout Subsubsection
3064 Method adjust_transparency: Adjust transparency of bitmap
3067 \begin_layout Itemize
3068 Syntax: bitmap:adjust_transparency(newvalue)
3071 \begin_layout Itemize
3072 Deprecated: gui.adjust_transparency(bitmap, ...)
3075 \begin_layout Standard
3079 \begin_layout Itemize
3080 bitmap: DBITMAP: The bitmap to adjust.
3083 \begin_layout Itemize
3084 Number adj: The factor to multiply opaqueness with times 256.
3087 \begin_layout Standard
3088 Multiply opaqueness of all colors in bitmap <bitmap> by factor of <adj>/256.
3091 \begin_layout Subsubsection
3092 Method save_png: Save a bitmap to PNG
3095 \begin_layout Itemize
3096 Syntax: bitmap:save_png(filename, [base])
3099 \begin_layout Itemize
3100 Syntax: data bitmap:save_png()
3103 \begin_layout Itemize
3105 gui.bitmap_save_png(bitmap, ...)
3108 \begin_layout Standard
3112 \begin_layout Itemize
3113 bitmap: DBITMAP: The bitmap to save.
3116 \begin_layout Itemize
3117 filename: string: The filename to save to.
3120 \begin_layout Itemize
3121 base: string: The base filename is resolved relative to.
3124 \begin_layout Standard
3128 \begin_layout Itemize
3129 data: string: BASE64 encoded PNG data.
3132 \begin_layout Standard
3133 Save bitmap <bitmap> into PNG file <filename> (relative to <base>) or return
3134 BASE64 encoding of it.
3137 \begin_layout Subsubsection
3138 Method hash: Hash a bitmap
3141 \begin_layout Itemize
3142 Syntax: hash bitmap:hash()
3145 \begin_layout Itemize
3146 Deprecated: hash bitmap:hash(bitmap)
3149 \begin_layout Standard
3153 \begin_layout Itemize
3154 bitmap: DBITMAP: The bitmap to hash.
3157 \begin_layout Standard
3161 \begin_layout Itemize
3162 hash: string: 64-hex digit hash
3165 \begin_layout Standard
3166 Hashes bitmap <bitmap> and returns crypto-strong hash.
3170 \begin_layout Subsubsection
3171 Method sample_texture: Sample a texture
3174 \begin_layout Itemize
3175 Syntax: none bitmap:sample_texture(BITMAP source, number xx, number xy,
3176 number x0, number yx, number yy, number y0, number scale, boolean wrap)
3179 \begin_layout Standard
3183 \begin_layout Itemize
3184 source: BITMAP: The bitmap to sample
3187 \begin_layout Itemize
3188 xx: number: s times the source x coefficient of target x axis.
3191 \begin_layout Itemize
3192 xy: number: s times the source y coefficient of target x axis.
3195 \begin_layout Itemize
3196 x0: number: s times the target x axis offset.
3199 \begin_layout Itemize
3200 yx: number: s times the source x coefficient of target y axis.
3203 \begin_layout Itemize
3204 yy: number: s times the source y coefficient of target y axis.
3207 \begin_layout Itemize
3208 y0: number: s times the target y axis offset.
3211 \begin_layout Itemize
3212 s: number: Scale of coordinates
3215 \begin_layout Itemize
3216 wrap: boolean: If true, wrap the texture.
3217 If false, read outside the texture as color 0.
3220 \begin_layout Standard
3221 Samples the source as texture, performing linear transform (with nearest-neighbo
3222 r sampling) and writes the result to this bitmap.
3225 \begin_layout Subsubsection
3226 Method hflip: Horizontally flip a bitmap
3229 \begin_layout Itemize
3230 Syntax: none dbitmap:hflip()
3233 \begin_layout Standard
3234 Horizontally flips a bitmap.
3237 \begin_layout Subsubsection
3238 Method vflip: Vertically flip a bitmap
3241 \begin_layout Itemize
3242 Syntax: none dbitmap:vflip()
3245 \begin_layout Standard
3246 Vertically flips a bitmap.
3249 \begin_layout Standard
3250 \begin_inset Newpage pagebreak
3256 \begin_layout Subsection
3257 IMAGELOADER: Load an image
3260 \begin_layout Subsubsection
3261 Static function load: Load a bitmap from file
3264 \begin_layout Itemize
3265 Syntax: bitmap, palette gui.image.load(file, [base])
3268 \begin_layout Itemize
3269 Syntax: bitmap, palette classes.IMAGELOADER.load(file, [base])
3272 \begin_layout Itemize
3274 gui.bitmap_load(...)
3277 \begin_layout Standard
3281 \begin_layout Itemize
3282 file: string: The file to read.
3285 \begin_layout Itemize
3286 base: string: The base to resolve <file> relative to.
3289 \begin_layout Standard
3293 \begin_layout Itemize
3294 bitmap: BITMAP/DBITMAP: The new bitmap
3297 \begin_layout Itemize
3298 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3302 \begin_layout Standard
3303 Load a new bitmap and return it (plus associated palette if any).
3306 \begin_layout Subsubsection
3307 Static function load_str: Load a bitmap from string
3310 \begin_layout Itemize
3311 Syntax: bitmap, palette gui.image.load_str(data)
3314 \begin_layout Itemize
3315 Syntax: bitmap, palette classes.IMAGELOADER.load_str(data)
3318 \begin_layout Itemize
3320 gui.bitmap_load_str(...)
3323 \begin_layout Standard
3327 \begin_layout Itemize
3328 data: string: The image data
3331 \begin_layout Standard
3335 \begin_layout Itemize
3336 bitmap: BITMAP/DBITMAP: The new bitmap
3339 \begin_layout Itemize
3340 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3344 \begin_layout Standard
3345 Like IMAGELOADER:load, but read the bitmap from string <data> instead of
3349 \begin_layout Subsubsection
3350 Static function load_png: Load a bitmap from PNG file
3353 \begin_layout Itemize
3354 Syntax: bitmap, palette gui.image.load_png(file, [base])
3357 \begin_layout Itemize
3358 Syntax: bitmap, palette classes.IMAGELOADER.load_png(file, [base])
3361 \begin_layout Itemize
3363 gui.bitmap_load_png(...)
3366 \begin_layout Standard
3370 \begin_layout Itemize
3371 file: string: The file to read.
3374 \begin_layout Itemize
3375 base: string: The base to resolve <file> relative to.
3378 \begin_layout Standard
3382 \begin_layout Itemize
3383 bitmap: BITMAP/DBITMAP: The new bitmap
3386 \begin_layout Itemize
3387 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3391 \begin_layout Standard
3392 Like IMAGELOADER:load, but load a PNG file instead.
3395 \begin_layout Subsubsection
3396 Static function load_png_str: Load a PNG bitmap from string
3399 \begin_layout Itemize
3400 Syntax: bitmap, palette gui.image.load_png_str(data)
3403 \begin_layout Itemize
3404 Syntax: bitmap, palette classes.IMAGELOADER.load_png_str(data)
3407 \begin_layout Itemize
3409 gui.bitmap_load_png_str(...)
3412 \begin_layout Standard
3416 \begin_layout Itemize
3417 data: string: The image data, base64 encoded.
3420 \begin_layout Standard
3424 \begin_layout Itemize
3425 bitmap: BITMAP/DBITMAP: The new bitmap
3428 \begin_layout Itemize
3429 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3433 \begin_layout Standard
3434 Like IMAGELOADER:load_png, but read the bitmap from BASE64 encoded string
3435 <data> instead of file.
3438 \begin_layout Standard
3439 \begin_inset Newpage pagebreak
3445 \begin_layout Subsection
3446 CUSTOMFONT: Arbitrary-sized bitmap font
3449 \begin_layout Subsubsection
3450 Static function new: Return a new empty font
3453 \begin_layout Itemize
3454 Syntax: font gui.font.new()
3457 \begin_layout Itemize
3458 Syntax: font classes.CUSTOMFONT.new()
3461 \begin_layout Itemize
3462 Deprecated: font gui.font_new()
3465 \begin_layout Standard
3469 \begin_layout Itemize
3470 font: CUSTOMFONT: New font.
3473 \begin_layout Standard
3474 Create a new font with no characters and return it.
3477 \begin_layout Subsubsection
3478 Static function: load: Load a font file
3481 \begin_layout Itemize
3482 Syntax: font gui.font.load(file, [base])
3485 \begin_layout Itemize
3486 Syntax: font gui.font.load()
3489 \begin_layout Itemize
3490 Syntax: font classes.CUSTOMFONT.load(file, [base])
3493 \begin_layout Itemize
3494 Syntax: font classes.CUSTOMFONT.load()
3497 \begin_layout Itemize
3498 Deprecated: font gui.loadfont(...)
3501 \begin_layout Standard
3505 \begin_layout Itemize
3506 file: string: The file to read the font from
3509 \begin_layout Itemize
3510 base: string: The file to resolve <file> relative to.
3513 \begin_layout Standard
3517 \begin_layout Itemize
3518 font: CUSTOMFONT: New font.
3521 \begin_layout Standard
3522 Load font from file <file> (relative to <base>).
3523 If no filename is given, system default font is loaded.
3526 \begin_layout Subsubsection
3527 operator(): Render text to screen
3530 \begin_layout Itemize
3531 Syntax: font(x, y, text, [fgc], [bgc], [hlc])
3534 \begin_layout Standard
3538 \begin_layout Itemize
3539 font: CUSTOMFONT: The font to use.
3542 \begin_layout Itemize
3543 x: number: The x-position on screen to draw to.
3546 \begin_layout Itemize
3547 y: number: The y-position on screen to draw to.
3550 \begin_layout Itemize
3551 text: string: The text to draw.
3554 \begin_layout Itemize
3555 fgc: number/string: Foreground color (default white).
3558 \begin_layout Itemize
3559 bgc: number/string: Background color (default transparent).
3562 \begin_layout Itemize
3563 hlc: number/string: Outline color (default transparent).
3566 \begin_layout Standard
3567 Draws a string <text> with specified font <font> and colors <fgc>,<bgc>,<hlc>
3571 \begin_layout Itemize
3572 If <hlc> is transparent, no outline is drawn.
3575 \begin_layout Subsubsection
3576 Method edit: Alter glyph in font
3579 \begin_layout Itemize
3580 Syntax: font:edit(string character, bitmap glyph)
3583 \begin_layout Standard
3587 \begin_layout Itemize
3588 font: CUSTOMFONT: The font to edit.
3591 \begin_layout Itemize
3592 character: string: The character to edit (UTF-8 encoded).
3595 \begin_layout Itemize
3596 glyph: BITMAP: The bitmap to use.
3599 \begin_layout Standard
3600 Replace character <character> in font <font> by <glyph>.
3603 \begin_layout Itemize
3604 Color index 0 is background, everything else is foreground.
3607 \begin_layout Itemize
3608 <character> may be empty string, meaning the replacement character used
3612 \begin_layout Itemize
3613 <character> may be multi-codepoint string, meaning character used for that
3617 \begin_layout Subsubsection
3618 Method dump: Dump font into file
3621 \begin_layout Itemize
3622 Syntax: font:dump(string filename[, string base])
3625 \begin_layout Standard
3629 \begin_layout Itemize
3630 filename: string: The file to dump to
3633 \begin_layout Itemize
3634 base: string: The base filename
3637 \begin_layout Standard
3638 Dump contents of <font> in file <filename> (resolved relative to <base>).
3639 The dump is in format CUSTOMFONT:load() can load.
3642 \begin_layout Standard
3643 \begin_inset Newpage pagebreak
3649 \begin_layout Subsection
3650 ICONV: Character set conversions
3653 \begin_layout Subsubsection
3654 Static function new: Create new character set converter
3657 \begin_layout Itemize
3658 Syntax: iconv iconv.new(from, to);
3661 \begin_layout Itemize
3662 Syntax: iconv classes.ICONV.new(from, to);
3665 \begin_layout Itemize
3666 Deprecated: iconv iconv_new(...);
3669 \begin_layout Standard
3673 \begin_layout Itemize
3674 from: string: The source character set.
3677 \begin_layout Itemize
3678 to: string: The target character set.
3681 \begin_layout Standard
3685 \begin_layout Itemize
3686 iconv: ICONV: The converter.
3689 \begin_layout Standard
3690 Create a character set converter, converting from <from> to <to> and return
3694 \begin_layout Subsubsection
3695 Operator(): Convert string fragment from character set to another
3698 \begin_layout Itemize
3699 Syntax: success, result, unconverted, error iconv(input)
3702 \begin_layout Standard
3706 \begin_layout Itemize
3707 iconv: ICONV: The context to use.
3710 \begin_layout Itemize
3711 input: string: The input to convert.
3714 \begin_layout Standard
3718 \begin_layout Itemize
3719 success: boolean: True if conversion was successful, false if not.
3722 \begin_layout Itemize
3723 result: string: The string (partially) converted.
3726 \begin_layout Itemize
3727 unconvered: number: Number of bytes that were not converted (only if <success>
3731 \begin_layout Itemize
3732 error: string: Error that caused conversion to stop (only if <success> is
3734 \begin_inset Separator latexpar
3741 \begin_layout Itemize
3742 INVALID: The input string is invalid.
3745 \begin_layout Itemize
3746 INCOMPLETE: The input string cuts off in middle of character.
3749 \begin_layout Itemize
3750 INTERNALERR: Internal error.
3754 \begin_layout Standard
3755 Convert a string <input> using character set converter <iconv> and return
3759 \begin_layout Standard
3760 \begin_inset Newpage pagebreak
3766 \begin_layout Subsection
3767 FILEREADER: Read a file as a stream
3770 \begin_layout Subsubsection
3771 Static function open: Open a stream
3774 \begin_layout Itemize
3775 Syntax: handle filereader.open(file, [base])
3778 \begin_layout Itemize
3779 Syntax: handle classes.FILEREADER.open(file, [base])
3782 \begin_layout Itemize
3783 Deprecated: handle open_file(file, [base])
3786 \begin_layout Standard
3790 \begin_layout Itemize
3791 file: string: The filename to read.
3794 \begin_layout Itemize
3795 base: string: The base <file> is resolved against.
3798 \begin_layout Standard
3802 \begin_layout Itemize
3803 handle: FILEREADER: The new file reader.
3806 \begin_layout Standard
3807 Open file <file> (relative to <base>) and return a handle to it.
3810 \begin_layout Subsubsection
3811 operator(): Read line/bytes from stream
3814 \begin_layout Itemize
3815 Syntax: result handle()
3818 \begin_layout Itemize
3819 Syntax: result handle(bytes)
3822 \begin_layout Standard
3826 \begin_layout Itemize
3827 handle: FILEREADER: The handle to read from.
3830 \begin_layout Itemize
3831 bytes: Number of bytes to read (default is next line).
3834 \begin_layout Standard
3838 \begin_layout Itemize
3839 result: string: The read data, or nil on end-of-file.
3842 \begin_layout Standard
3843 Reads next line or <bytes> bytes from specified file handle <handle>.
3846 \begin_layout Itemize
3847 If reading specified number of bytes, the bytes are read in binary mode
3851 \begin_layout Itemize
3852 If reading next line, the line is read in text mode (any line ending is
3856 \begin_layout Subsubsection
3857 Method lines: Iterator to read all lines
3860 \begin_layout Itemize
3861 Syntax: for line in handle:lines() do ...
3865 \begin_layout Standard
3869 \begin_layout Itemize
3870 handle: FILEREADER: The handle to read.
3873 \begin_layout Standard
3877 \begin_layout Itemize
3878 A lua iterator with one variable.
3881 \begin_layout Standard
3882 Return a Lua iterator that iterates all the lines in <handle>.
3885 \begin_layout Standard
3886 \begin_inset Newpage pagebreak
3892 \begin_layout Subsection
3893 COMPARE_OBJ: Watch memory area for changes
3896 \begin_layout Standard
3897 Objects of this class allow fast checking for modifications to given memory
3901 \begin_layout Subsubsection
3902 Static function new: Create a checker
3905 \begin_layout Itemize
3906 Syntax: handle classes.COMPARE_OBJ.new({marea, offset|addrobj}, size, [rows,
3910 \begin_layout Itemize
3911 Syntax: handle memory.compare_new({marea, offset|addrobj}, size, rows, stride)
3914 \begin_layout Standard
3918 \begin_layout Itemize
3919 marea: string: The memory area to interpret <offset> against.
3922 \begin_layout Itemize
3923 offset: number: The initial offset in memory area.
3926 \begin_layout Itemize
3927 addrobj: ADDRESS: The memory address.
3930 \begin_layout Itemize
3931 size: number: The number of bytes in each row.
3934 \begin_layout Itemize
3935 rows: number: The number of rows.
3939 \begin_layout Itemize
3940 stride: number: The number of bytes offset increments from one row to next.
3943 \begin_layout Standard
3947 \begin_layout Itemize
3951 \begin_layout Standard
3952 Return an object watching specified memory area.
3955 \begin_layout Itemize
3956 Note: For fastest operation, limit checks to inside one memory area (that
3957 has to be mappable, individual RAM areas often are).
3960 \begin_layout Subsubsection
3961 operator(): Check area for modifications
3964 \begin_layout Itemize
3965 Syntax: boolean handle()
3968 \begin_layout Standard
3972 \begin_layout Itemize
3973 True if memory block has been modified since last call (or object creation
3974 if first call), false if not.
3977 \begin_layout Standard
3978 Check if the block has been modified.
3981 \begin_layout Subsection
3982 ADDRESS: Memory address
3985 \begin_layout Standard
3986 Objects of this class contain a memory address.
3989 \begin_layout Subsubsection
3990 Static function new: Create new memory address
3993 \begin_layout Itemize
3994 Syntax: ADDRESS classes.ADDRESS.new(string marea, number offset)
3997 \begin_layout Itemize
3998 Syntax: ADDRESS memory.address.new(string marea, number offset)
4001 \begin_layout Itemize
4002 Syntax: ADDRESS memory.mkaddr(string marea, number offset)
4005 \begin_layout Standard
4009 \begin_layout Itemize
4010 marea: The memory area
4013 \begin_layout Itemize
4014 offset: The offset in memory area.
4017 \begin_layout Standard
4021 \begin_layout Itemize
4025 \begin_layout Standard
4026 Construct a new memory address object.
4029 \begin_layout Subsubsection
4030 Method: addr: Get global address
4033 \begin_layout Itemize
4034 Syntax: number addr:addr()
4037 \begin_layout Standard
4041 \begin_layout Itemize
4042 addr: ADRESS: The original address.
4045 \begin_layout Standard
4049 \begin_layout Itemize
4050 The global address corresponding to this address.
4053 \begin_layout Subsubsection
4054 Method: vma: Get memory area
4057 \begin_layout Itemize
4058 Syntax: string addr:vma()
4061 \begin_layout Standard
4065 \begin_layout Itemize
4066 addr: ADRESS: The original address.
4069 \begin_layout Standard
4073 \begin_layout Itemize
4074 The memory area corresponding to this address.
4077 \begin_layout Subsubsection
4078 Method: offset: Get memory area offset
4081 \begin_layout Itemize
4082 Syntax: string addr:offset()
4085 \begin_layout Standard
4089 \begin_layout Itemize
4090 addr: ADRESS: The original address.
4093 \begin_layout Standard
4097 \begin_layout Itemize
4098 The offset in memory area corresponding to this address.
4101 \begin_layout Subsubsection
4102 Method: replace: Replace address part
4105 \begin_layout Itemize
4106 Syntax: ADDRESS addr:replace(offset[, bits])
4109 \begin_layout Standard
4113 \begin_layout Itemize
4114 addr: ADRESS: The original address.
4117 \begin_layout Itemize
4118 offset: number: The new offset
4121 \begin_layout Itemize
4122 bits: number: The number of LSB to replace.
4125 \begin_layout Standard
4129 \begin_layout Itemize
4130 The modified address
4133 \begin_layout Standard
4134 Returns a new address, with <bits> (all if missing) least significant bits
4135 of <addr> replaced by LSB of <offset>.
4138 \begin_layout Subsubsection
4139 Method: add: Add to address
4142 \begin_layout Itemize
4143 Syntax: ADDRESS addr:add(offset)
4146 \begin_layout Itemize
4147 Syntax: ADDRESS addr:add(number, stride)
4150 \begin_layout Itemize
4151 Syntax: ADDRESS addr:add(number, stride, offset)
4154 \begin_layout Standard
4158 \begin_layout Itemize
4159 addr: ADRESS: The original address.
4162 \begin_layout Itemize
4163 offset: number: Offset to add.
4166 \begin_layout Itemize
4167 number: number: Number of table strides to add.
4170 \begin_layout Itemize
4171 stride: number: The table stride.
4174 \begin_layout Standard
4178 \begin_layout Itemize
4179 The modified address
4182 \begin_layout Standard
4183 Adds <offset>, <number>*<stride> or <number>*<stride>+<offset> into specified
4187 \begin_layout Subsection
4188 ADDRESS:<op>: Read/Write memory
4191 \begin_layout Itemize
4192 Syntax: none addr:<op>(value)
4195 \begin_layout Itemize
4196 Syntax: number addr:<op>()
4199 \begin_layout Standard
4203 \begin_layout Itemize
4204 addr: ADDRESS: The address to read/write.
4207 \begin_layout Itemize
4208 value: number: The number to write.
4211 \begin_layout Standard
4215 \begin_layout Itemize
4219 \begin_layout Standard
4220 Read/Write value from/to given address <addr>.
4221 The value written is <value>.
4222 <Op> is of form: [i][s]<type>, where:
4225 \begin_layout Itemize
4226 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
4229 \begin_layout Itemize
4230 'i' signifies that the value is treated as opposite-to-normal endianess,
4233 \begin_layout Itemize
4234 's' signifies that value is treated as signed (not available for floating-point).
4237 \begin_layout Standard
4238 \begin_inset Newpage pagebreak
4244 \begin_layout Section
4248 \begin_layout Subsection
4249 print: Print values to console
4252 \begin_layout Itemize
4253 Syntax: none print(value...
4257 \begin_layout Standard
4258 Prints specified values to console.
4259 Can print any Lua type at least enough to identify the type and instance.
4262 \begin_layout Subsection
4263 tostringx: Format a value to string
4266 \begin_layout Itemize
4267 Syntax: string tostringx(value val)
4270 \begin_layout Standard
4271 Formats value <val> like print would, and returns the result as a string.
4274 \begin_layout Subsection
4275 exec: Execute lsnes commands
4278 \begin_layout Itemize
4279 Syntax: none exec(string cmd)
4282 \begin_layout Standard
4283 Execute lsnes command <cmd>.
4286 \begin_layout Subsection
4287 utime: Get current time
4290 \begin_layout Itemize
4291 Syntax: (number,number) utime()
4294 \begin_layout Standard
4295 Returns two numbers.
4296 First is time since some epoch in seconds, the second is microseconds mod
4297 10^6 since that epoch.
4300 \begin_layout Subsection
4301 set_idle_timeout: Run function after timeout when emulator is idle
4304 \begin_layout Itemize
4305 Syntax: none set_idle_timeout(number timeout)
4308 \begin_layout Standard
4309 Set number of microseconds to block idle for.
4310 After this timeout has expired, on_idle() will be called once.
4313 \begin_layout Subsection
4314 set_timer_timeout: Run function after timeout.
4317 \begin_layout Itemize
4318 Syntax: none set_timer_timeout(number timeout)
4321 \begin_layout Standard
4322 Set number of microseconds to block timer for.
4323 After this timeout has expired, on_timer() will be called once.
4326 \begin_layout Subsection
4327 bus_address: Look up address in system bus.
4330 \begin_layout Itemize
4331 Syntax: none bus_address(number bus_addr)
4334 \begin_layout Standard
4335 Returns virtual address corresponding to specified address on system bus.
4338 \begin_layout Subsection
4339 loopwrapper: Convert loop into callable function
4342 \begin_layout Itemize
4343 Syntax: function loopwrapper(function fun, ...)
4346 \begin_layout Standard
4347 Calls function <fun> with function and specified arguments.
4348 The function passed suspends execution until the function returned is called.
4349 Handy for linear flow control among multiple invocations of a hook.
4353 \begin_layout LyX-Code
4354 on_paint = loopwrapper(function(wait)
4355 \begin_inset Separator latexpar
4362 \begin_layout LyX-Code
4364 \begin_inset Separator latexpar
4371 \begin_layout LyX-Code
4373 \begin_inset Quotes eld
4377 \begin_inset Quotes erd
4383 \begin_layout LyX-Code
4388 \begin_layout LyX-Code
4393 \begin_layout LyX-Code
4397 \begin_layout Subsection
4398 list_bindings: List keybindings
4401 \begin_layout Itemize
4402 Syntax: table list_bindings([string cmd])
4405 \begin_layout Standard
4406 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
4407 If <cmd> is specified, the table is limited to that command.
4408 Also searches for controller keys.
4411 \begin_layout Subsection
4412 get_alias: Get expansion of alias
4415 \begin_layout Itemize
4416 Syntax: string get_alias(string aname)
4419 \begin_layout Standard
4420 Get expansion of given alias <aname>.
4423 \begin_layout Subsection
4424 set_alias: Set expansion of alias
4427 \begin_layout Itemize
4428 Syntax: none set_alias(string aname, string value)
4431 \begin_layout Standard
4432 Set expansion of given alias.
4435 \begin_layout Subsection
4436 create_ibind: Create invese binding
4439 \begin_layout Itemize
4440 Syntax: INVERSEBIND create_ibind(string name, string cmd)
4443 \begin_layout Standard
4444 Return object representing inverse binding with specified name <name> and
4445 specified command <cmd>.
4448 \begin_layout Itemize
4449 Note: To create press/release commands, use aliases +foo and -foo .
4452 \begin_layout Itemize
4453 Note: Keep the returned object around.
4456 \begin_layout Subsection
4457 create_command: Create a command
4460 \begin_layout Itemize
4461 Syntax: COMMANDBIND create_command(string name, function a)
4464 \begin_layout Itemize
4465 Syntax: COMMANDBIND create_command(string name, function a, function b)
4468 \begin_layout Standard
4469 Return object representing a command (pair).
4472 \begin_layout Itemize
4473 If only one function is specied, the command is level-sensitive, <a> is
4477 \begin_layout Itemize
4478 If <b> is function, the function is edge-sensitive, <a> is positive edge
4479 callback and <b> is negative edge callback.
4482 \begin_layout Itemize
4483 All callbacks get single argument: The parameters passed.
4486 \begin_layout Itemize
4487 Keep the returned object around.
4490 \begin_layout Subsection
4491 loadfile: Load Lua script
4494 \begin_layout Itemize
4495 Syntax: function loadfile(string filename[, string base])
4498 \begin_layout Standard
4499 Load lua script from <filename>, resolved relative to <base> (if empty,
4503 \begin_layout Subsection
4504 dofile: Execute Lua script
4507 \begin_layout Itemize
4508 Syntax: function dofile(string filename[, string base])
4511 \begin_layout Standard
4512 Execute lua script from <filename>, resolved relative to <base> (if empty,
4513 current directory) and return all return values.
4516 \begin_layout Subsection
4517 resolve_filename: Resolve name of file relative to another
4520 \begin_layout Itemize
4521 Syntax: string resolve_filename(string filename[, string base])
4524 \begin_layout Standard
4525 Resolve name of file <filename> relative to <base> and return the result.
4528 \begin_layout Subsection
4529 render_queue_function: Return paint function for render queue
4532 \begin_layout Itemize
4533 Syntax: function render_queue_function(RENDERQUEUE rq)
4536 \begin_layout Standard
4537 Return function that renders render queue <rq>.
4540 \begin_layout Itemize
4541 Handy for paint callback if one is using render queues updated in other
4546 \begin_layout LyX-Code
4547 handle = callback.paint:register(render_queue_function(my_rq));
4550 \begin_layout Subsection
4551 get_directory_contents: Get files in directory
4554 \begin_layout Itemize
4555 Syntax: table get_directory_contents(string name[, string base[, string
4559 \begin_layout Standard
4560 Return array containg all files in specified directory <name> (relative
4562 If <pattern> is specified, the filenames are matched to specified regex.
4563 The returned filenames inherit path.
4566 \begin_layout Subsection
4567 get_file_type: Get type of file
4570 \begin_layout Itemize
4571 Syntax: string/nil get_file_type(string path)
4574 \begin_layout Standard
4575 Return type of file <path>.
4576 Currently possible return values are:
4579 \begin_layout Itemize
4580 regular: regular file
4583 \begin_layout Itemize
4584 directory: subdirectory
4587 \begin_layout Itemize
4588 unknown: Exists, but type not known (not anything above).
4591 \begin_layout Itemize
4592 <nil>: File does not exist.
4595 \begin_layout Subsection
4596 identify_class: Identify class of object
4599 \begin_layout Itemize
4600 Syntax: string identify_class(userdata object)
4603 \begin_layout Standard
4604 Identifies the class of userdata <object>, if possible.
4605 If no identification is possible, returns
4606 \begin_inset Quotes eld
4610 \begin_inset Quotes erd
4616 \begin_layout Subsection
4617 lookup_class: Lookup class by name
4620 \begin_layout Itemize
4621 Syntax: classobj lookup_class(string name)
4624 \begin_layout Standard
4625 Looks up class corresponding to <name>, if possible.
4626 If not found, returns nil.
4627 The classobj has following fields:
4630 \begin_layout Itemize
4631 _static_methods: Return static method names
4634 \begin_layout Itemize
4635 _class_methods: Return class method names
4638 \begin_layout Itemize
4639 <static-function-name>: The specified static function.
4642 \begin_layout Subsection
4643 all_classes: Get list of all classes
4646 \begin_layout Itemize
4651 \begin_layout Standard
4652 Get names of all classes available.
4655 \begin_layout Subsection
4656 lsnes_features: Read feature flags
4659 \begin_layout Itemize
4660 Syntax: boolean lsnes_features(string feature)
4663 \begin_layout Standard
4664 Checks if feature <feature> is available, if it is, returns true, otherwise
4666 The following features are known:
4669 \begin_layout Itemize
4670 text-halos: gui.text supports halos (takes halo color argument).
4673 \begin_layout Subsection
4677 \begin_layout Standard
4681 \begin_layout Subsection
4682 filereader: Class FILEREADER
4685 \begin_layout Standard
4686 See class FILEREADER.
4689 \begin_layout Standard
4690 \begin_inset Newpage pagebreak
4696 \begin_layout Section
4700 \begin_layout Standard
4701 Bitwise logical functions and related.
4704 \begin_layout Subsection
4705 bit.none/bit.bnot: Bitwise none or NOT function
4708 \begin_layout Itemize
4709 Syntax: number bit.none(number...)
4712 \begin_layout Itemize
4713 Syntax: number bit.bnot(number...)
4716 \begin_layout Standard
4717 48-bit bitwise NOT / NONE function (set bits that are set in none of the
4721 \begin_layout Subsection
4722 bit.any/bit.bor: Bitwise any or OR function
4725 \begin_layout Itemize
4726 Syntax: number bit.any(number...)
4729 \begin_layout Itemize
4730 Syntax: number bit.bor(number...)
4733 \begin_layout Standard
4734 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
4737 \begin_layout Subsection
4738 bit.all/bit.band: Bitwise all or AND function
4741 \begin_layout Itemize
4742 Syntax: number bit.all(number...)
4745 \begin_layout Itemize
4746 Syntax: number bit.band(number...)
4749 \begin_layout Standard
4750 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
4754 \begin_layout Subsection
4755 bit.parity/bit.bxor: Bitwise parity or XOR function
4758 \begin_layout Itemize
4759 Syntax: number bit.parity(number...)
4762 \begin_layout Itemize
4763 Syntax: number bit.bxor(number...)
4766 \begin_layout Standard
4767 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
4771 \begin_layout Subsection
4772 bit.lrotate: Rotate a number left
4775 \begin_layout Itemize
4776 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
4779 \begin_layout Standard
4780 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4784 \begin_layout Subsection
4785 bit.rrotate: Rotate a number right
4788 \begin_layout Itemize
4789 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
4792 \begin_layout Standard
4793 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
4797 \begin_layout Subsection
4798 bit.lshift: Shift a number left
4801 \begin_layout Itemize
4802 Syntax: number bit.lshift(number base[, number amount[, number bits]])
4805 \begin_layout Standard
4806 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4808 The new bits are filled with zeroes.
4811 \begin_layout Subsection
4812 bit.lrshift: Shift a number right (logical)
4815 \begin_layout Itemize
4816 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
4819 \begin_layout Standard
4820 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4822 The new bits are filled with zeroes.
4825 \begin_layout Subsection
4826 bit.arshift: Shift a number right (arithmetic)
4829 \begin_layout Itemize
4830 Syntax: number bit.arshift(number base[, number amount[, number bits]])
4833 \begin_layout Standard
4834 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4836 The new bits are shifted in with copy of the high bit.
4839 \begin_layout Subsection
4840 bit.extract: Extract/shuffle bits from number
4843 \begin_layout Itemize
4844 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
4847 \begin_layout Standard
4848 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
4851 \begin_layout Itemize
4852 Note: Bit numbers up to 51 should work reliably (then things start falling
4853 apart due to double precision issues).
4856 \begin_layout Itemize
4857 Note: There are two special bit positions, true and false, standing for
4858 always set bit and always clear bit.
4861 \begin_layout Subsection
4862 bit.value: Construct number with specified bits set
4865 \begin_layout Itemize
4866 Syntax: number bit.value([number bit1[, number bit2,...]])
4869 \begin_layout Standard
4870 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
4871 <bit2> places and so on.
4872 As special value, nil argument is no-op.
4875 \begin_layout Subsection
4876 bit.test: Test if bit is set
4879 \begin_layout Itemize
4880 Syntax: boolean bit.test(number a, number bit)
4883 \begin_layout Standard
4884 Tests if bit <bit> is set in <a>.
4885 If it is set, returns true, otherwise false.
4888 \begin_layout Subsection
4889 bit.testn: Test if bit is clear
4892 \begin_layout Itemize
4893 Syntax: boolean bit.testn(number a, number bit)
4896 \begin_layout Standard
4897 Tests if bit <bit> is set in <a>.
4898 If it is clear, returns true, otherwise false.
4901 \begin_layout Subsection
4902 bit.test_any: Test if any bit is set
4905 \begin_layout Itemize
4906 Syntax: boolean bit.test_any(number a, number b)
4909 \begin_layout Standard
4910 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
4913 \begin_layout Subsection
4914 bit.test_all: Test if all bits are set
4917 \begin_layout Itemize
4918 Syntax: boolean bit.test_all(number a, number b)
4921 \begin_layout Standard
4922 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
4925 \begin_layout Subsection
4926 bit.popcount: Population count
4929 \begin_layout Itemize
4930 Syntax: number bit.popcount(number a)
4933 \begin_layout Standard
4934 Returns number of set bits in <a>.
4937 \begin_layout Subsection
4938 bit.clshift: Chained left shift
4941 \begin_layout Itemize
4942 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
4946 \begin_layout Standard
4947 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
4948 numbers to be of specified number of bits <bits> (default 48).
4951 \begin_layout Subsection
4952 bit.crshift: Chained right shift
4955 \begin_layout Itemize
4956 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
4960 \begin_layout Standard
4961 Does chained right shift on <a>, <b> by <amount> positions (default 1),
4962 assuming numbers to be of specified number of bits <bits> (default 48).
4965 \begin_layout Subsection
4966 bit.flagdecode: Decode bitfield into flags
4969 \begin_layout Itemize
4970 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
4974 \begin_layout Standard
4975 Return string of length bits where ith character is ith character of on
4976 if bit i is on, otherwise ith character of off.
4977 Out of range reads give last character.
4980 \begin_layout Itemize
4981 Note: <on> defaults to '*' if empty.
4984 \begin_layout Itemize
4985 Note: <off> defaults to '-' if empty.
4988 \begin_layout Subsection
4989 bit.rflagdecode: Decode bitfield into flags
4992 \begin_layout Itemize
4993 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
4997 \begin_layout Standard
4998 Like bit.flagdecode, but outputs the string in the opposite order (most significa
5002 \begin_layout Subsection
5003 bit.swap{,s}{,h,d,q}word: Swap word endian
5006 \begin_layout Itemize
5007 Syntax: number bit.swapword(number n)
5010 \begin_layout Itemize
5011 Syntax: number bit.swaphword(number n)
5014 \begin_layout Itemize
5015 Syntax: number bit.swapdword(number n)
5018 \begin_layout Itemize
5019 Syntax: number bit.swapqword(number n)
5022 \begin_layout Itemize
5023 Syntax: number bit.swapsword(number n)
5026 \begin_layout Itemize
5027 Syntax: number bit.swapshword(number n)
5030 \begin_layout Itemize
5031 Syntax: number bit.swapsdword(number n)
5034 \begin_layout Itemize
5035 Syntax: number bit.swapsqword(number n)
5038 \begin_layout Standard
5039 Swap endianess of (un)signed integer <n>.
5042 \begin_layout Subsection
5043 bit.compose: Compose multi-byte number
5046 \begin_layout Itemize
5047 Syntax: number bit.compose(number n...)
5050 \begin_layout Standard
5052 \begin_inset Formula $n_{1}+256n_{2}+256^{2}n_{3}+\ldots$
5058 \begin_layout Subsection
5059 bit.binary_ld_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Load binary integer
5062 \begin_layout Itemize
5063 Syntax: number bit.binary_ld_<type>le(string str, number pos);
5066 \begin_layout Itemize
5067 Syntax: number bit.binary_ld_<type>be(string str, number pos);
5070 \begin_layout Standard
5071 Load little (*le) or big (*be) endian binary number from position <pos>
5073 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
5077 \begin_layout Subsection
5078 bit.binary_st_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Store binary integer
5081 \begin_layout Itemize
5082 Syntax: string bit.binary_st_<type>le(number x);
5085 \begin_layout Itemize
5086 Syntax: string bit.binary_st_<type>be(number x);
5089 \begin_layout Standard
5090 Store specified number <x> as binary in string and return the result.
5091 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
5095 \begin_layout Subsection
5096 bit.quotent: Integer quotent
5099 \begin_layout Itemize
5100 Syntax: number bit.quotent(number a, number b)
5103 \begin_layout Standard
5104 Calculate quotent a/b.
5107 \begin_layout Subsection
5108 bit.multidiv: Divide and split among multiple divisiors
5111 \begin_layout Itemize
5113 bit.multidiv(number v, number q...)
5116 \begin_layout Standard
5117 Does the following steps:
5120 \begin_layout Enumerate
5124 \begin_layout Enumerate
5126 \begin_inset Separator latexpar
5133 \begin_layout Enumerate
5134 Calculate quotent(v'/q) and add that to numbers returned.
5137 \begin_layout Enumerate
5138 v' <- remainder(v'/q)
5142 \begin_layout Enumerate
5143 Add v' to numbers returned.
5146 \begin_layout Standard
5147 That is, it successively divides <v> by <q>s, and reduces <v> modulo <q>
5149 <v> may be floating point, <q>s are integers.
5152 \begin_layout Itemize
5154 bit.multidiv(time, 3600, 60) splits time into hours, minutes and seconds.
5157 \begin_layout Itemize
5159 bit.multidiv(a, b) calculates quotent and remainder of a/b.
5162 \begin_layout Subsection
5163 bit.mul32: 32-bit multiply
5166 \begin_layout Itemize
5167 Syntax: number, number bit.mul32(number a, number b)
5170 \begin_layout Standard
5171 Multiply 32-bit numbers <a> and <b>.
5172 The first return value is low 32 bits of result, the second is high 32
5176 \begin_layout Subsection
5177 bit.fextract: Extract bit field
5180 \begin_layout Itemize
5181 Syntax: number bit.fextract(number value, number shift, number width)
5184 \begin_layout Standard
5185 Extract <width> bits starting from bit <shift> from number <value>.
5186 This is more compact way to write
5187 \begin_inset Formula $\left(value\gg shift\right)\&\left(2^{width}-1\right)$
5193 \begin_layout Subsection
5194 bit.bfields: Split number into bit fields
5197 \begin_layout Itemize
5199 bit.bfields(number v, number q...)
5202 \begin_layout Standard
5203 Split a number <v> into bitfields of <q> bits (in order, from least significant
5204 towards more significant bits), with no padding in between.
5207 \begin_layout Itemize
5209 number of form 0 bbbbb ggggg rrrrr can be decoded to its component fields
5210 using r,g,b = bit.bfields(v, 5, 5, 5).
5214 \begin_layout Itemize
5216 number of form x yyyyyyy w zzzzzzz can be decode to its component fields
5217 using z, w, y, x = bit.bfields(v, 7, 1, 7, 1).
5220 \begin_layout Standard
5221 \begin_inset Newpage pagebreak
5227 \begin_layout Section
5231 \begin_layout Subsection
5232 classes.<foo>: The classobj for class <foo>
5235 \begin_layout Itemize
5236 Syntax: classes.<foo>
5239 \begin_layout Standard
5240 The classobj for class <foo>.
5243 \begin_layout Subsection
5244 classes.<foo>._static_methods: Enumerate static methods
5247 \begin_layout Itemize
5249 classes.<foo>._static_methods()
5252 \begin_layout Standard
5253 Returns all static methods of <foo> as strings.
5256 \begin_layout Subsection
5257 classes.<foo>._class_methods: Enumerate static methods
5260 \begin_layout Itemize
5262 classes.<foo>._class_methods()
5265 \begin_layout Standard
5266 Returns all class methods of <foo> as strings.
5269 \begin_layout Subsection
5270 classes.<foo>.<bar>: Static method
5273 \begin_layout Itemize
5274 Syntax: variable classes.<foo>.<bar>(variable...)
5277 \begin_layout Standard
5278 Invokes static method <bar> of class <foo>.
5281 \begin_layout Section
5285 \begin_layout Subsection
5286 gui.resolution: Get current resolution
5289 \begin_layout Itemize
5290 Syntax: (number, number) gui.resolution()
5293 \begin_layout Standard
5294 Returns 2-tuple (hresolution, vresolution).
5297 \begin_layout Subsection
5298 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
5301 \begin_layout Itemize
5302 Syntax: number gui.left_gap(number gap)
5305 \begin_layout Itemize
5306 Syntax: number gui.right_gap(number gap)
5309 \begin_layout Itemize
5310 Syntax: number gui.top_gap(number gap)
5313 \begin_layout Itemize
5314 Syntax: number gui.bottom_gap(number gap)
5317 \begin_layout Standard
5318 Set the specified edge gap to specified value <gap> (max gap is 8191).
5319 If successful, old gap is returned.
5322 \begin_layout Subsection
5323 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
5327 \begin_layout Itemize
5328 Syntax: number gui.delta_left_gap(number dgap)
5331 \begin_layout Itemize
5332 Syntax: number gui.delta_right_gap(number dgap)
5335 \begin_layout Itemize
5336 Syntax: number gui.delta_top_gap(number dgap)
5339 \begin_layout Itemize
5340 Syntax: number gui.delta_bottom_gap(number dgap)
5343 \begin_layout Standard
5344 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
5345 and return the old gap (returns nothing on error).
5348 \begin_layout Subsection
5349 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
5352 \begin_layout Itemize
5353 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
5354 bgc[, number hlc]]])
5357 \begin_layout Itemize
5358 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
5359 bgc[, number hlc]]])
5362 \begin_layout Itemize
5363 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
5364 bgc[, number hlc]]])
5367 \begin_layout Itemize
5368 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
5369 bgc[, number hlc]]])
5372 \begin_layout Standard
5373 Draw specified text on the GUI (each character cell is 8 or 16 wide and
5378 \begin_layout Itemize
5379 x: X-coordinate to start the drawing from (and x-coordinate at begining
5383 \begin_layout Itemize
5384 y: Y-coordinate to start the drawing from.
5387 \begin_layout Itemize
5388 text: The text to draw.
5391 \begin_layout Itemize
5392 fgc: Text color (default is 0xFFFFFF (white))
5395 \begin_layout Itemize
5396 bgc: Background color (default is -1 (transparent))
5399 \begin_layout Itemize
5400 hlc: Halo color (default is -1 (transparent))
5403 \begin_layout Standard
5404 Note: The H variants draw at double width and V variants draw at double
5406 Halo thickness is always 1 and is not doubled.
5409 \begin_layout Subsection
5410 gui.rectangle: Draw a rectangle
5413 \begin_layout Itemize
5414 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5415 number thickness[, number outline[, number fill]]])
5418 \begin_layout Standard
5419 Draw rectangle on the GUI.
5423 \begin_layout Itemize
5424 x: X-coordinate of left edge.
5427 \begin_layout Itemize
5428 y: Y-coordinate of upper edge.
5431 \begin_layout Itemize
5432 width: Width of rectangle.
5435 \begin_layout Itemize
5436 height: Height of rectangle.
5439 \begin_layout Itemize
5440 thickness: Thickness of outline (default is 1).
5443 \begin_layout Itemize
5444 outline: Color of outline (default is 0xFFFFFF (white))
5447 \begin_layout Itemize
5448 fill: Color of fill (default is -1 (transparent))
5451 \begin_layout Subsection
5452 gui.solidrectangle: Draw a solid rectangle
5455 \begin_layout Itemize
5456 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5460 \begin_layout Standard
5461 Draw solid rectangle on the GUI.
5465 \begin_layout Itemize
5466 x: X-coordinate of left edge.
5469 \begin_layout Itemize
5470 y: Y-coordinate of upper edge.
5473 \begin_layout Itemize
5474 width: Width of rectangle.
5477 \begin_layout Itemize
5478 height: Height of rectangle.
5481 \begin_layout Itemize
5482 color: Color of rectangle (default is 0xFFFFFF (white))
5485 \begin_layout Subsection
5486 gui.box: Draw a 3D-effect box
5489 \begin_layout Itemize
5490 Syntax: none gui.box(number x, number y, number width, number height[, number
5491 thickness[, number outline1[,number outline2[, number fill]]]])
5494 \begin_layout Standard
5495 Draw rectangle with 3D effect on the GUI.
5499 \begin_layout Itemize
5500 x: X-coordinate of left edge.
5503 \begin_layout Itemize
5504 y: Y-coordinate of upper edge.
5507 \begin_layout Itemize
5508 width: Width of rectangle.
5511 \begin_layout Itemize
5512 height: Height of rectangle.
5515 \begin_layout Itemize
5516 thickness: Thickness of outline (default is 1).
5519 \begin_layout Itemize
5520 outline1: First color of outline (default is 0xFFFFFF (white))
5523 \begin_layout Itemize
5524 outline2: First color of outline (default is 0x808080 (dark gray))
5527 \begin_layout Itemize
5528 fill: Color of fill (default is 0xC0C0C0 (light grayy))
5531 \begin_layout Subsection
5532 gui.pixel: Draw a single pixel
5535 \begin_layout Itemize
5536 Syntax: none gui.pixel(number x, number y[, number color])
5539 \begin_layout Standard
5540 Draw one pixel on the GUI.
5544 \begin_layout Itemize
5545 x: X-coordinate of the pixel
5548 \begin_layout Itemize
5549 y: Y-coordinate of the pixel
5552 \begin_layout Itemize
5553 color: Color of the pixel (default is 0xFFFFFF (white))
5556 \begin_layout Subsection
5557 gui.crosshair: Draw a crosshair
5560 \begin_layout Itemize
5561 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
5564 \begin_layout Standard
5569 \begin_layout Itemize
5570 x: X-coordinate of the crosshair
5573 \begin_layout Itemize
5574 y: Y-coordinate of the crosshair
5577 \begin_layout Itemize
5578 length: Length of the crosshair lines (default 10).
5581 \begin_layout Itemize
5582 color: Color of the crosshair (default is 0xFFFFFF (white))
5585 \begin_layout Subsection
5586 gui.line: Draw a line
5589 \begin_layout Itemize
5590 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
5594 \begin_layout Standard
5599 \begin_layout Itemize
5600 x1: X-coordinate of one end.
5603 \begin_layout Itemize
5604 y1: Y-coordinate of one end.
5607 \begin_layout Itemize
5608 x2: X-coordinate of the other end.
5611 \begin_layout Itemize
5612 y2: Y-coordinate of the other end.
5615 \begin_layout Itemize
5616 color: Color of the line (default is 0xFFFFFF (white)).
5619 \begin_layout Subsection
5620 gui.circle: Draw a (filled) circle
5623 \begin_layout Itemize
5624 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
5625 border[, number fil]]])
5628 \begin_layout Standard
5633 \begin_layout Itemize
5634 x: X-coordinate of the center
5637 \begin_layout Itemize
5638 y: Y-coordinate of the center
5641 \begin_layout Itemize
5642 r: The radius of the circle
5645 \begin_layout Itemize
5646 thick: Border thickness
5649 \begin_layout Itemize
5650 border: Border color (default is 0xFFFFFF (white))
5653 \begin_layout Itemize
5654 fill: Fill color (default is -1 (transparent)).
5657 \begin_layout Subsection
5658 gui.repaint: Arrange a repaint
5661 \begin_layout Itemize
5662 Syntax: none gui.repaint()
5665 \begin_layout Standard
5666 Request on_repaint() to happen as soon as possible.
5669 \begin_layout Subsection
5670 gui.subframe_update: Enable/Disable subframe updates
5673 \begin_layout Itemize
5674 Syntax: none gui.subframe_update(boolean on)
5677 \begin_layout Standard
5678 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
5679 or not happen (<on>=false).
5682 \begin_layout Subsection
5683 gui.screenshot: Write a screenshot
5686 \begin_layout Itemize
5687 Syntax: none gui.screenshot(string filename)
5690 \begin_layout Standard
5691 Write PNG screenshot of the current frame (no drawings) to specified file
5695 \begin_layout Subsection
5696 gui.screenshot_bitmap: Write a screenshot to bitmap
5699 \begin_layout Itemize
5700 Syntax: DBITMAP gui.screenshot_bitmap()
5703 \begin_layout Standard
5704 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
5708 \begin_layout Subsection
5709 gui.color: Compose a color.
5712 \begin_layout Itemize
5713 Syntax: number gui.color(number r, number g, number b[, number a])
5716 \begin_layout Itemize
5717 Syntax: number gui.color(string c)
5720 \begin_layout Standard
5721 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
5722 , each component in scale 0-255.
5723 If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
5725 The default alpha is 256.
5728 \begin_layout Standard
5729 The form taking a string returns color corresponding color name.
5732 \begin_layout Subsection
5733 gui.status: Set status variable
5736 \begin_layout Itemize
5737 Syntax: none gui.status(string name, string value)
5740 \begin_layout Standard
5742 \begin_inset Quotes eld
5746 \begin_inset Quotes erd
5749 to <value> in status area.
5752 \begin_layout Subsection
5753 gui.rainbow: Rainbow color calculation
5756 \begin_layout Itemize
5757 Syntax: number gui.rainbow(number step, number steps[, number color])
5760 \begin_layout Standard
5761 Perform hue rotation of color <color> (default bright red), by <step> steps.
5762 The number of steps per full rotation is given by absolute value of <steps>.
5765 \begin_layout Standard
5766 If <step> is negative, the rotation will be counterclockwise.
5769 \begin_layout Subsection
5770 gui.kill_frame: Kill video frame and associated sound
5773 \begin_layout Itemize
5774 Syntax: none gui.kill_frame()
5777 \begin_layout Standard
5778 Kills the currently dumped video frame + the associated sound.
5779 Only valid in on_video callback.
5782 \begin_layout Subsection
5783 gui.set_video_scale: Set video frame scale
5786 \begin_layout Itemize
5787 Syntax: none gui.set_video_scale(number h, number v)
5790 \begin_layout Standard
5791 Sets the scale factors of current frame to <h>x<v>.
5792 Only valid in on_video callback.
5795 \begin_layout Subsection
5796 gui.arrow: Draw an arrow
5799 \begin_layout Itemize
5800 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
5801 number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
5805 \begin_layout Standard
5806 Draws an arrow using color <color>.
5807 The tip of arrow is at (<x>, <y>).
5811 \begin_layout Enumerate
5812 <length>: The length of arrow tail.
5815 \begin_layout Enumerate
5816 <hwidth>: The width of arrow head.
5820 \begin_layout Enumerate
5821 <direction>: Direction of arrow.
5822 0 is to right, +1 rotates 45 degrees counterclockwise.
5825 \begin_layout Enumerate
5826 <fill>: If true, fill the arrow head.
5830 \begin_layout Enumerate
5831 <twidth>: Tail width.
5836 \begin_layout Enumerate
5837 <hthick>: Head thickness (only used if <fill> is false).
5838 Default is <twidth>.
5841 \begin_layout Subsection
5842 gui.tiled_bitmap: Class TILEMAP
5845 \begin_layout Standard
5849 \begin_layout Subsection
5850 gui.palette: Class PALETTE
5853 \begin_layout Standard
5857 \begin_layout Subsection
5858 gui.bitmap: Class BITMAP
5861 \begin_layout Standard
5865 \begin_layout Subsection
5866 gui.dbitmap: Class DBITMAP
5869 \begin_layout Standard
5873 \begin_layout Subsection
5874 gui.font: Class CUSTOMFONT
5877 \begin_layout Standard
5878 See class CUSTOMFONT.
5881 \begin_layout Subsection
5882 gui.renderctx: Class RENDERCTX
5885 \begin_layout Standard
5886 See class RENDERCTX.
5889 \begin_layout Subsection
5890 gui.image: Class IMAGELOADER
5893 \begin_layout Standard
5894 See class IMAGELOADER.
5897 \begin_layout Subsection
5898 gui.get_runmode: Get current emulator mode
5901 \begin_layout Itemize
5902 Syntax: string gui.get_runmode()
5905 \begin_layout Standard
5906 Gets the current emulator runmode.
5907 The possible ones are:
5910 \begin_layout Itemize
5911 quit: Emulator is quitting.
5914 \begin_layout Itemize
5915 normal: Emulator is running emulation
5918 \begin_layout Itemize
5919 load: Emulator is loading a movie/savestate
5922 \begin_layout Itemize
5923 advance_frame: Emulator is doing frame advance
5926 \begin_layout Itemize
5927 advance_subframe: Emulator is doing subframe advance
5930 \begin_layout Itemize
5931 skiplag: Emulator is skipping lag frames
5934 \begin_layout Itemize
5935 skiplag_pending: Emulator will start skipping lag frames next frame
5938 \begin_layout Itemize
5939 pause: Emulator is paused
5942 \begin_layout Itemize
5943 pause_break: Emulator is paused at breakpoint
5946 \begin_layout Itemize
5947 corrupt: Emulator can't run because corrupt emulation state
5950 \begin_layout Itemize
5951 unknown: Unknown state (should not happen).
5954 \begin_layout Standard
5955 \begin_inset Newpage pagebreak
5961 \begin_layout Section
5965 \begin_layout Standard
5967 Functions manipulating input are only available in on_input callback.
5970 \begin_layout Subsection
5971 input.get: Read controller button/axis (deprecated)
5974 \begin_layout Itemize
5975 Syntax: number input.get(number controller, number index)
5978 \begin_layout Standard
5979 Read the specified index <index> (zero-based) from specified controller
5980 <controller> (zero-based).
5984 \begin_layout Subsection
5985 input.set: Write controller button/axis (deprecated)
5988 \begin_layout Itemize
5989 Syntax: none input.set(number controller, number index, number value)
5992 \begin_layout Standard
5993 Write the specified index <index> (zero-based) from specified controller
5994 <controller> (zero-based), storing value <value>.
5997 \begin_layout Subsection
5998 input.get2: Read controller button/axis
6001 \begin_layout Itemize
6002 Syntax: number input.get2(number port, number controller, number index)
6005 \begin_layout Standard
6006 Read the specified input tuple.
6007 Port 0 is system port.
6010 \begin_layout Subsection
6011 input.set2: Write controller button/axis
6014 \begin_layout Itemize
6015 Syntax: input.set2(number port, number controller, number index, number value)
6018 \begin_layout Standard
6019 Write the specified input tuple.
6020 Port 0 is system port.
6023 \begin_layout Subsection
6024 input.lcid_to_pcid2: Look up logical controller
6027 \begin_layout Itemize
6028 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
6031 \begin_layout Standard
6032 Look up physical pcid pair (port, controller) corresponding to specified
6033 logical controller (1-based).
6034 Returns nothing if controller does not exist.
6037 \begin_layout Subsection
6038 input.port_type: Look up port type
6041 \begin_layout Itemize
6042 Syntax: string input.port_type(number port)
6045 \begin_layout Standard
6046 Return type of specified port.
6049 \begin_layout Subsection
6050 input.controller_info: Get information about controller
6053 \begin_layout Itemize
6054 Syntax: table input.controller_info(number port, number controller)
6057 \begin_layout Standard
6058 Get controller info for specified controller.
6059 If controller does not exist, returns nil.
6060 Otherwise returns a table with following fields:
6063 \begin_layout Itemize
6064 type (string): Type of the controller.
6067 \begin_layout Itemize
6068 class (string): Class of the controller.
6071 \begin_layout Itemize
6072 classnum (number): Number of the controller within its class (1-based)
6075 \begin_layout Itemize
6076 lcid (number): Logical controller number of the controller.
6079 \begin_layout Itemize
6080 button_count (number): Number of buttons on controller
6083 \begin_layout Itemize
6084 buttons (array): Array of following info about each button:
6085 \begin_inset Separator latexpar
6092 \begin_layout Itemize
6093 type (string): Type of button.
6095 \begin_inset Quotes eld
6099 \begin_inset Quotes erd
6103 \begin_inset Quotes eld
6107 \begin_inset Quotes erd
6111 \begin_inset Quotes eld
6115 \begin_inset Quotes erd
6119 \begin_inset Quotes eld
6123 \begin_inset Quotes erd
6129 \begin_layout Itemize
6130 name (string): Name of button.
6133 \begin_layout Itemize
6134 symbol (string): Symbol of button.
6135 Only present for type
6136 \begin_inset Quotes eld
6140 \begin_inset Quotes erd
6146 \begin_layout Itemize
6147 hidden (boolean): True if hidden button.
6152 \begin_layout Subsection
6153 input.veto_button: Veto a button press
6156 \begin_layout Itemize
6157 Syntax: none input.veto_button()
6160 \begin_layout Standard
6161 Signals that the button event should be vetoed.
6162 Only valid in on_button callback.
6165 \begin_layout Subsection
6166 input.geta: Get all buttons for controller (deprecated)
6169 \begin_layout Itemize
6170 Syntax: (number, number...) input.geta(number controller)
6173 \begin_layout Standard
6174 Get input state for entiere controller.
6175 Returns n return values.
6178 \begin_layout Itemize
6179 1st return value: Bitmask: bit i is set if i:th index is nonzero
6182 \begin_layout Itemize
6183 2nd- return value: value of i:th index.
6186 \begin_layout Subsection
6187 input.seta: Set all buttons for controller (deprecated)
6190 \begin_layout Itemize
6191 Syntax: none input.seta(number controller, number bitmask, number args...)
6194 \begin_layout Standard
6195 Set state for entiere controller.
6196 args is up to N values for indices (overriding values in bitmask if specified).
6199 \begin_layout Subsection
6200 input.controllertype: Get controller type (deprecated)
6203 \begin_layout Itemize
6204 syntax: string input.controllertype(number controller)
6207 \begin_layout Standard
6208 Get the type of controller as string.
6211 \begin_layout Subsection
6212 input.reset: Execute (delayed) reset
6215 \begin_layout Itemize
6216 Syntax: none input.reset([number cycles])
6219 \begin_layout Standard
6221 If <cycles> is greater than zero, do delayed reset.
6222 0 (or no value) causes immediate reset.
6225 \begin_layout Itemize
6226 Note: Only available with subframe flag false.
6229 \begin_layout Subsection
6230 input.raw: Return raw input data
6233 \begin_layout Itemize
6234 Syntax: table input.raw()
6237 \begin_layout Standard
6238 Returns table of tables of all available keys and axes.
6239 The first table is indexed by key name (platform-dependent!), and the inner
6240 table has the following fields:
6243 \begin_layout Itemize
6244 value: Last reported value for control
6245 \begin_inset Separator latexpar
6252 \begin_layout Itemize
6253 For keys: 1 for pressed, 0 for released.
6256 \begin_layout Itemize
6257 For axes: -32767...32767.
6260 \begin_layout Itemize
6261 For presure-sensitive buttons: 0...32767.
6264 \begin_layout Itemize
6265 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
6268 \begin_layout Itemize
6269 For mouse: Coordinates relative to game area.
6273 \begin_layout Itemize
6274 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
6277 \begin_layout Subsection
6278 input.keyhook: Hook a key
6281 \begin_layout Itemize
6282 Syntax: none input.keyhook(string key, boolean state)
6285 \begin_layout Standard
6286 Requests that keyhook events to be sent for key <key> (<state>=true) or
6287 not sent (<state>=false).
6290 \begin_layout Subsection
6291 input.joyget: Get controls for controller
6294 \begin_layout Itemize
6295 Syntax: table input.joyget(number logical)
6298 \begin_layout Standard
6299 Returns table for current controls for specified logical controller <logical>.
6300 The names of fields vary by controller type.
6303 \begin_layout Itemize
6304 The buttons have the same name as those are referred to in other contexts
6308 \begin_layout Itemize
6309 The analog axes are usually
6310 \begin_inset Quotes eld
6314 \begin_inset Quotes erd
6318 \begin_inset Quotes eld
6322 \begin_inset Quotes erd
6328 \begin_layout Itemize
6329 Each field is numeric or boolean depending on axis/button.
6332 \begin_layout Subsection
6333 input.joyset: Set controls for controller
6336 \begin_layout Itemize
6337 Syntax: none input.joyset(number controller, table controls)
6340 \begin_layout Standard
6341 Set the the state of specified controller to values specified in specified
6345 \begin_layout Itemize
6346 Each field can be boolean or number.
6349 \begin_layout Itemize
6350 Also, buttons allow strings, which cause value to be inverted.
6353 \begin_layout Subsection
6354 input.lcid_to_pcid: Look up logical controller (deprecated)
6357 \begin_layout Itemize
6358 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
6361 \begin_layout Standard
6362 Returns the legacy pcid for controller (or false if there isn't one), followed
6364 Returns nothing if controller does not exist.
6367 \begin_layout Standard
6368 \begin_inset Newpage pagebreak
6374 \begin_layout Section
6378 \begin_layout Standard
6379 Various keybinding-related functions
6382 \begin_layout Subsection
6383 keyboard.bind: Bind a key
6386 \begin_layout Itemize
6387 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
6390 \begin_layout Standard
6391 Bind specified key with specified modifers to specified command.
6394 \begin_layout Subsection
6395 keyboard.unbind: Unbind a key
6398 \begin_layout Itemize
6399 Syntax: none keyboard.unbind(string mod, string mask, string key)
6402 \begin_layout Standard
6403 Unbind specified key with specified modifers.
6406 \begin_layout Subsection
6407 keyboard.alias: Set alias expansion
6410 \begin_layout Itemize
6411 Syntax: none keyboard.alias(string alias, string expansion)
6414 \begin_layout Standard
6415 Set expansion of given command.
6418 \begin_layout Standard
6419 \begin_inset Newpage pagebreak
6425 \begin_layout Section
6429 \begin_layout Standard
6433 \begin_layout Subsection
6434 subtitle.byindex: Look up start and length of subtitle by index
6437 \begin_layout Itemize
6438 Syntax: (number, number) subtitle.byindex(number i)
6441 \begin_layout Standard
6442 Read the frame and length of ith subtitle.
6443 Returns nothing if not present.
6446 \begin_layout Subsection
6447 subtitle.set: Write a subtitle
6450 \begin_layout Itemize
6451 Syntax: none subtitle.set(number f, number l, string txt)
6454 \begin_layout Standard
6455 Set the text of subtitle.
6458 \begin_layout Subsection
6459 subtitle.get: Read a subtitle
6462 \begin_layout Itemize
6463 Syntax: string subtitle.get(number f, number l)
6466 \begin_layout Standard
6467 Get the text of subtitle.
6470 \begin_layout Subsection
6471 subtitle.delete: Delete a subtitle
6474 \begin_layout Itemize
6475 Syntax: none subtitle.delete(number f, number l)
6478 \begin_layout Standard
6479 Delete specified subtitle.
6482 \begin_layout Standard
6483 \begin_inset Newpage pagebreak
6489 \begin_layout Section
6493 \begin_layout Standard
6494 Host memory handling (extra memory saved to savestates).
6495 Host memory starts empty.
6498 \begin_layout Itemize
6499 Reads out of range return false.
6502 \begin_layout Itemize
6503 Writes out of range extend the memory.
6506 \begin_layout Subsection
6507 hostmemory.read: Read byte from host memory
6510 \begin_layout Itemize
6511 Syntax: number hostmemory.read(number address)
6514 \begin_layout Standard
6515 Reads byte from hostmemory slot address <address>.
6518 \begin_layout Subsection
6519 hostmemory.write: Write byte to host memory
6522 \begin_layout Itemize
6523 Syntax: none hostmemory.write(number address, number value)
6526 \begin_layout Standard
6527 Writes hostmemory slot with value <value> 0-255.
6530 \begin_layout Subsection
6531 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
6534 \begin_layout Itemize
6535 Syntax: number hostmemory.readbyte(number address)
6538 \begin_layout Itemize
6539 Syntax: number hostmemory.readsbyte(number address)
6542 \begin_layout Itemize
6543 Syntax: number hostmemory.readword(number address)
6546 \begin_layout Itemize
6547 Syntax: number hostmemory.readsword(number address)
6550 \begin_layout Itemize
6551 Syntax: number hostmemory.readhword(number address)
6554 \begin_layout Itemize
6555 Syntax: number hostmemory.readshword(number address)
6558 \begin_layout Itemize
6559 Syntax: number hostmemory.readdword(number address)
6562 \begin_layout Itemize
6563 Syntax: number hostmemory.readsdword(number address)
6566 \begin_layout Itemize
6567 Syntax: number hostmemory.readqword(number address)
6570 \begin_layout Itemize
6571 Syntax: number hostmemory.readsqword(number address)
6574 \begin_layout Standard
6575 Read elements (big-endian) from given address <address>.
6578 \begin_layout Itemize
6582 \begin_layout Itemize
6586 \begin_layout Itemize
6590 \begin_layout Itemize
6594 \begin_layout Itemize
6595 qword is 8 elements.
6598 \begin_layout Itemize
6599 The 's' variants do signed read.
6602 \begin_layout Subsection
6603 hostmemory.read{float,double}: Read from host memory
6606 \begin_layout Itemize
6607 syntax: number hostmemory.readfloat(number address)
6610 \begin_layout Itemize
6611 Syntax: number hostmemory.readdouble(number address)
6614 \begin_layout Standard
6615 Read elements (big-endian) floating-pont from given address <address>.
6618 \begin_layout Subsection
6619 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
6622 \begin_layout Itemize
6623 Syntax: number hostmemory.writebyte(number address, number value)
6626 \begin_layout Itemize
6627 Syntax: number hostmemory.writesbyte(number address, number value)
6630 \begin_layout Itemize
6631 Syntax: number hostmemory.writeword(number address, number value)
6634 \begin_layout Itemize
6635 Syntax: number hostmemory.writesword(number address, number value)
6638 \begin_layout Itemize
6639 Syntax: number hostmemory.writehword(number address, number value)
6642 \begin_layout Itemize
6643 Syntax: number hostmemory.writeshword(number address, number value)
6646 \begin_layout Itemize
6647 Syntax: number hostmemory.writedword(number address, number value)
6650 \begin_layout Itemize
6651 Syntax: number hostmemory.writesdword(number address, number value)
6654 \begin_layout Itemize
6655 Syntax: number hostmemory.writeqword(number address, number value)
6658 \begin_layout Itemize
6659 Syntax: number hostmemory.writesqword(number address, number value)
6662 \begin_layout Standard
6663 Write value <value> to elements (little-endian) starting from given address
6667 \begin_layout Itemize
6671 \begin_layout Itemize
6675 \begin_layout Itemize
6679 \begin_layout Itemize
6683 \begin_layout Itemize
6684 qword is 8 elements.
6687 \begin_layout Itemize
6688 The 's' variants do signed write.
6691 \begin_layout Subsection
6692 hostmemory.write{float,double}: Write to host memory
6695 \begin_layout Itemize
6696 syntax: none hostmemory.readfloat(number address, number value)
6699 \begin_layout Itemize
6700 Syntax: none hostmemory.readdouble(number address, number value)
6703 \begin_layout Standard
6704 Write elements (big-endian) floating-pont to given address <address>, storing
6708 \begin_layout Standard
6709 \begin_inset Newpage pagebreak
6715 \begin_layout Section
6719 \begin_layout Standard
6723 \begin_layout Subsection
6724 movie.currentframe: Get current frame number
6727 \begin_layout Itemize
6728 Syntax: number movie.currentframe()
6731 \begin_layout Standard
6732 Return number of current frame.
6735 \begin_layout Subsection
6736 movie.framecount: Get move frame count
6739 \begin_layout Itemize
6740 Syntax: number movie.framecount()
6743 \begin_layout Standard
6744 Return number of frames in movie.
6747 \begin_layout Subsection
6748 movie.lagcount: Get current lag count
6751 \begin_layout Itemize
6752 Syntax: number movie.lagcount()
6755 \begin_layout Standard
6756 Return number of lag frames recorded so far.
6759 \begin_layout Subsection
6760 movie.readonly: Is in playback mode?
6763 \begin_layout Itemize
6764 Syntax: boolean movie.readonly()
6767 \begin_layout Standard
6768 Return true if in playback mode, false if in recording.
6771 \begin_layout Subsection
6772 movie.rerecords: Movie rerecord count
6775 \begin_layout Itemize
6776 Syntax: number movie.rerecords()
6779 \begin_layout Standard
6780 Returns the current value of rerecord count.
6783 \begin_layout Subsection
6784 movie.set_readwrite: Set recording mode.
6787 \begin_layout Itemize
6788 Syntax: none movie.set_readwrite()
6791 \begin_layout Standard
6792 Set recording mode (does not cause on_readwrite callback).
6795 \begin_layout Subsection
6796 movie.frame_subframes: Count subframes in frame
6799 \begin_layout Itemize
6800 Syntax: number movie.frame_subframes(number frame)
6803 \begin_layout Standard
6804 Count number of subframes in specified frame <frame> (frame numbers are
6805 1-based) and return that.
6808 \begin_layout Subsection
6809 movie.read_subframes: Read subframe data (deprecated)
6812 \begin_layout Itemize
6813 Syntax: table movie.read_subframes(number frame, number subframe)
6816 \begin_layout Standard
6817 Read specifed subframe in specified frame and return data as array.
6820 \begin_layout Subsection
6821 movie.read_rtc: Read current RTC time
6824 \begin_layout Itemize
6825 Syntax: (number, number) movie.read_rtc()
6828 \begin_layout Standard
6829 Returns the current value of the RTC as a pair (second, subsecond).
6832 \begin_layout Subsection
6833 movie.unsafe_rewind: Fast movie rewind to saved state
6836 \begin_layout Itemize
6837 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
6840 \begin_layout Standard
6841 Start setting point for unsafe rewind or jump to point of unsafe rewind.
6844 \begin_layout Itemize
6845 If called without argument, causes emulator to start process of setting
6846 unsafe rewind point.
6847 When this has finished, callback on_set_rewind occurs, passing the rewind
6848 state to lua script.
6851 \begin_layout Itemize
6852 If called with argument, causes emulator rewind to passed rewind point as
6854 recording mode is implicitly activated.
6857 \begin_layout Standard
6858 The following warnings apply to unsafe rewinding:
6861 \begin_layout Itemize
6862 There are no safety checks against misuse (that's what
6863 \begin_inset Quotes eld
6867 \begin_inset Quotes erd
6873 \begin_layout Itemize
6874 Only call rewind from timeline rewind point was set from.
6877 \begin_layout Itemize
6878 Only call rewind from after the rewind point was set.
6881 \begin_layout Subsection
6882 movie.to_rewind: Load savestate as rewind point
6885 \begin_layout Itemize
6886 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
6889 \begin_layout Standard
6890 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
6891 corresponding to it.
6894 \begin_layout Itemize
6895 Note: This operation does not take emulated time.
6898 \begin_layout Subsection
6899 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
6902 \begin_layout Itemize
6903 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE/string movie])
6906 \begin_layout Itemize
6907 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
6910 \begin_layout Standard
6911 Copies specified movie or branch <movie>/current object (if none or nil,
6912 the active movie) as new movie object.
6915 \begin_layout Subsection
6916 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
6919 \begin_layout Itemize
6920 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE/string movie,] number frame)
6923 \begin_layout Itemize
6924 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
6927 \begin_layout Standard
6928 Get INPUTFRAME object corresponding to specified frame in specified movie
6932 \begin_layout Subsection
6933 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
6936 \begin_layout Itemize
6937 Syntax: none movie.set_frame([INPUTMOVIE/string movie,] number frame, INPUTFRAME
6941 \begin_layout Itemize
6942 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
6945 \begin_layout Standard
6946 Set data in specified frame.
6949 \begin_layout Itemize
6950 Note: Past can't be edited in active movie.
6953 \begin_layout Subsection
6954 movie.get_size/INPUTMOVIE::get_size: Get size of movie
6957 \begin_layout Itemize
6958 Syntax: integer movie.get_size([INPUTMOVIE/string movie])
6961 \begin_layout Itemize
6962 Syntax: integer INPUTMOVIE::get_size()
6965 \begin_layout Standard
6966 Return number of subframes in specified movie or branch.
6969 \begin_layout Subsection
6970 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
6973 \begin_layout Itemize
6974 Syntax: number movie.count_frames([INPUTMOVIE/string movie])
6977 \begin_layout Itemize
6978 Syntax: number INPUTMOVIE::count_frames()
6981 \begin_layout Standard
6982 Return number of frames in movie.
6985 \begin_layout Subsection
6986 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
6989 \begin_layout Itemize
6990 Syntax: number movie.find_frame([INPUTMOVIE/string movie], number frame)
6993 \begin_layout Itemize
6994 Syntax: number INPUTMOVIE::find_frame(number frame)
6997 \begin_layout Standard
6998 Returns starting subframe of given frame (frame numbers are 1-based).
6999 Returns -1 if frame number is bad.
7002 \begin_layout Subsection
7003 movie.subframe_to_frame/INPUTMOVIE::subframe_to_frame: Find frame corresponding
7007 \begin_layout Itemize
7008 Syntax: number movie.subframe_to_frame([INPUTMOVIE/string movie], number
7012 \begin_layout Itemize
7013 Syntax: number INPUTMOVIE::subframe_to_frame(number subframe)
7016 \begin_layout Standard
7017 Returns frame containing given subframe (subframe numbers are 0-based).
7018 Returns -1 if subframe number is bad.
7021 \begin_layout Subsection
7022 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
7025 \begin_layout Itemize
7026 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE/string movie])
7029 \begin_layout Itemize
7030 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
7033 \begin_layout Standard
7034 Return blank INPUTFRAME with frame type from specified movie.
7037 \begin_layout Subsection
7038 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
7041 \begin_layout Itemize
7042 Syntax: none movie.append_frames([INPUTMOVIE/string movie,] number frames)
7045 \begin_layout Itemize
7046 Syntax: none INPUTMOVIE::append_frames(number frames)
7049 \begin_layout Standard
7050 Append specified number <frames> of frames.
7053 \begin_layout Subsection
7054 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
7057 \begin_layout Itemize
7058 Syntax: none movie.append_frame([INPUTMOVIE/string movie,] INPUTFRAME frame)
7061 \begin_layout Itemize
7062 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
7065 \begin_layout Standard
7066 Append specified frame <frame>.
7067 Past of current movie can't be edited.
7070 \begin_layout Subsection
7071 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
7074 \begin_layout Itemize
7075 Syntax: none movie.truncate([INPUTMOVIE/string movie,] number frames)
7078 \begin_layout Itemize
7079 Syntax: none INPUTMOVIE::truncate(number frames)
7082 \begin_layout Standard
7083 Truncate the specified movie to specified number of frames.
7086 \begin_layout Subsection
7087 movie.edit/INPUTMOVIE::edit: Edit a movie
7090 \begin_layout Itemize
7091 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
7092 controller, number control, number/bool value)
7095 \begin_layout Itemize
7096 Syntax: none movie.edit(string branch, number frame, number port, number
7097 controller, number control, number/bool value)
7100 \begin_layout Itemize
7101 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
7102 number control, number/bool value)
7105 \begin_layout Standard
7106 Change specified control in specified frame in specified movie.
7107 Past can't be edited in active movie.
7110 \begin_layout Subsection
7111 movie.copy_frames2: Copy frames between movies
7114 \begin_layout Itemize
7115 Syntax: none movie.copy_frames2([INPUTMOVIE/string dstmov,] number dst, [INPUTMOV
7116 IE/string srcmov,] number src, number count)
7119 \begin_layout Standard
7120 Copy specified number of frames between two movies.
7121 The copy proceeeds in forward direction.
7124 \begin_layout Subsection
7125 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
7128 \begin_layout Itemize
7129 Syntax: none movie.copy_frames([INPUTMOVIE/string mov,] number dst, number
7130 src, number count, bool backwards)
7133 \begin_layout Itemize
7134 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
7138 \begin_layout Standard
7139 Copy specified number of frames from one point in movie to another.
7140 If backwards is true, the copy will be done backwards.
7143 \begin_layout Subsection
7144 movie.serialize/INPUTMOVIE::serialize: Serialize movie
7147 \begin_layout Itemize
7148 Syntax: none movie.serialize([INPUTMOVIE movie/string,] string filename,
7152 \begin_layout Itemize
7153 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
7156 \begin_layout Standard
7157 Serialize given movie into file.
7158 If binary is true, binary format (more compact and much faster) is used.
7161 \begin_layout Subsection
7162 movie.unserialize: Unserialize movie
7165 \begin_layout Itemize
7166 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
7170 \begin_layout Standard
7171 Unserialize movie from file.
7172 The given frame is used as template to decide the frame type.
7173 If binary is true, binary format is decoded (much faster).
7176 \begin_layout Subsection
7177 movie.current_first_subframe: Return first subframe in current frame
7180 \begin_layout Itemize
7181 Syntax: number movie.current_first_subframe()
7184 \begin_layout Standard
7185 Returns first subframe in current frame.
7188 \begin_layout Subsection
7189 movie.pollcounter: Return poll counter for speified control
7192 \begin_layout Itemize
7193 Syntax: number movie.pollcounter(number port, number controller, number control)
7196 \begin_layout Standard
7197 Returns number of times the specified control has been polled this frame.
7200 \begin_layout Subsection
7201 movie.current_branch: Return current branch
7204 \begin_layout Itemize
7205 Syntax: string movie.current_branch()
7208 \begin_layout Standard
7209 Returns the name of the current branch.
7212 \begin_layout Subsection
7213 movie.get_branches: Return names of all branches
7216 \begin_layout Itemize
7218 movie.get_branches()
7221 \begin_layout Standard
7222 Returns the name of all branches.
7225 \begin_layout Subsection
7226 movie.rom_loaded: Is ROM loaded?
7229 \begin_layout Itemize
7230 Syntax: boolean movie.rom_loaded()
7233 \begin_layout Standard
7234 Returns true if ROM is loaded, false otherwise.
7237 \begin_layout Subsection
7238 movie.get_rom_info: Get info about loaded ROM
7241 \begin_layout Itemize
7242 Syntax: Table movie.get_rom_info()
7245 \begin_layout Standard
7246 Returns a table of tables.
7247 The outer table is indexed by ROM slot index.
7248 The inner table has the following fields:
7251 \begin_layout Itemize
7252 filename: The name of file
7255 \begin_layout Itemize
7256 hint: File name hint
7259 \begin_layout Itemize
7260 sha256: SHA-256 hash of ROM.
7263 \begin_layout Itemize
7264 xml_filename: The name of file for markup
7267 \begin_layout Itemize
7268 xml_hint: File name hint for markup
7271 \begin_layout Itemize
7272 xml_sha256: SHA-256 hash of ROM markup.
7275 \begin_layout Standard
7276 If there is no markup, the xml_* fields are absent.
7279 \begin_layout Subsection
7280 movie.get_game_info: Get info about loaded game
7283 \begin_layout Itemize
7284 Syntax: Table movie.get_game_info()
7287 \begin_layout Standard
7288 Returns a table with following fields:
7291 \begin_layout Itemize
7292 core: The name of the core
7295 \begin_layout Itemize
7296 core_short: Short name of the core
7299 \begin_layout Itemize
7300 type: The name of the system type
7303 \begin_layout Itemize
7304 type_long: The long name of the system type
7307 \begin_layout Itemize
7308 region: The name of region
7311 \begin_layout Itemize
7312 region_long: The long name of region
7315 \begin_layout Itemize
7316 gametype: The gametype of movie.
7319 \begin_layout Itemize
7320 fps: Nominal fps as floating-point value
7323 \begin_layout Itemize
7324 fps_n: Exact nominal fps numerator
7327 \begin_layout Itemize
7328 fps_d: Exact nominal fps denominator.
7331 \begin_layout Subsection
7332 INPUTFRAME::get_button: Get button
7335 \begin_layout Itemize
7336 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
7340 \begin_layout Standard
7341 Returns state of given button as boolean.
7344 \begin_layout Subsection
7345 INPUTFRAME::get_axis: Get axis
7348 \begin_layout Itemize
7349 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
7353 \begin_layout Standard
7354 Returns state of given axis as number.
7357 \begin_layout Subsection
7358 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
7361 \begin_layout Itemize
7362 Syntax: none INPUTFRAME::set_button(number port, number controller, number
7363 control, number/bool value)
7366 \begin_layout Itemize
7367 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
7371 \begin_layout Standard
7372 Set the given button/axis to given value.
7375 \begin_layout Subsection
7376 INPUTFRAME::serialize: Serialize a frame
7379 \begin_layout Itemize
7380 Syntax: string INPUTFRAME::serialize()
7383 \begin_layout Standard
7384 Return string representation of frame.
7387 \begin_layout Subsection
7388 INPUTFRAME::unserialize: Unserialize a frame
7391 \begin_layout Itemize
7392 Syntax: none INPUTFRAME::unserialize(string data)
7395 \begin_layout Standard
7396 Set current frame from given data.
7399 \begin_layout Subsection
7400 INPUTFRAME::get_stride: Get movie stride
7403 \begin_layout Itemize
7404 Syntax: number INPUTFRAME::get_stride()
7407 \begin_layout Standard
7408 Return number of bytes needed to store the input frame.
7409 Mainly useful for some debugging.
7412 \begin_layout Standard
7413 \begin_inset Newpage pagebreak
7419 \begin_layout Section
7423 \begin_layout Standard
7424 Routines for settings manipulation
7427 \begin_layout Subsection
7428 settings.get: Get value of setting
7431 \begin_layout Itemize
7432 Syntax: string settings.get(string name)
7435 \begin_layout Standard
7436 Get value of setting <name>.
7437 If setting value can't be obtained, returns (nil, error message).
7440 \begin_layout Subsection
7441 settings.set: Set value of setting
7444 \begin_layout Itemize
7445 Syntax: none settings.set(string name, string value)
7448 \begin_layout Standard
7449 Set value <value> of setting <name>.
7450 If setting can't be set, returns (nil, error message).
7453 \begin_layout Subsection
7454 settings.get_all: Get values of all settings
7457 \begin_layout Itemize
7458 Syntax: table settings.get_all()
7461 \begin_layout Standard
7462 Return a table with all setting names as keys and all current values as
7466 \begin_layout Subsection
7467 settings.get_speed: Get current speed
7470 \begin_layout Itemize
7471 Syntax: number/string settings.get_speed()
7474 \begin_layout Standard
7475 Return the current speed multiplier (1 is normal), or
7476 \begin_inset Quotes eld
7480 \begin_inset Quotes erd
7483 if speed is set to turbo (this does not react to turbo toggle).
7486 \begin_layout Subsection
7487 settings.set_speed: Set current speed
7490 \begin_layout Itemize
7491 Syntax: settings.get_speed(number spd)
7494 \begin_layout Itemize
7495 Syntax: settings.get_speed(string special)
7498 \begin_layout Standard
7499 Set the current speed multiplier (1 is normal).
7500 The speed may be positive multiplier or
7501 \begin_inset Quotes eld
7505 \begin_inset Quotes erd
7511 \begin_layout Standard
7512 \begin_inset Newpage pagebreak
7518 \begin_layout Section
7522 \begin_layout Standard
7523 Contains various functions for managing memory
7526 \begin_layout Subsection
7527 memory.vma_count: Count number of memory areas.
7530 \begin_layout Itemize
7531 Syntax: number memory.vma_count()
7534 \begin_layout Standard
7535 Returns the number of memory areas
7538 \begin_layout Subsection
7539 memory.read_vma: Lookup memory area info by index
7542 \begin_layout Itemize
7543 Syntax: table memory.read_vma(number index)
7546 \begin_layout Standard
7547 Reads the specified memory area (indices start from zero).
7548 Trying to read invalid memory area gives nil.
7549 The return value is table with the following fields:
7552 \begin_layout Itemize
7553 region_name (string): The readable name of the memory area
7556 \begin_layout Itemize
7557 baseaddr (number): Base address of the memory area
7560 \begin_layout Itemize
7561 lastaddr (number): Last address in the memory area.
7564 \begin_layout Itemize
7565 size (number): The size of memory area in bytes.
7568 \begin_layout Itemize
7569 readonly (boolean): True of the memory area corresponds to ROM.
7572 \begin_layout Itemize
7573 iospace (boolean): True if the memory area is I/O space.
7576 \begin_layout Itemize
7577 native_endian (boolean): True if the memory area has native endian as opposed
7581 \begin_layout Subsection
7582 memory.find_vma: Find memory area info by address
7585 \begin_layout Itemize
7586 Syntax: table memory.find_vma(number address)
7589 \begin_layout Standard
7590 Finds the memory area containing specified address.
7591 Returns table in the same format as read_vma or nil if not found.
7594 \begin_layout Subsection
7595 memory.read{,s}{byte,{,h,d,q}word}: Read memory
7598 \begin_layout Itemize
7599 Syntax: none memory.readbyte({string marea, number address|ADDRESS addrobj})
7602 \begin_layout Itemize
7603 Syntax: none memory.readword({string marea, number address|ADDRESS addrobj})
7606 \begin_layout Itemize
7607 Syntax: none memory.readhword({string marea, number address|ADDRESS addrobj})
7610 \begin_layout Itemize
7611 Syntax: none memory.readdword({string marea, number address|ADDRESS addrobj})
7614 \begin_layout Itemize
7615 Syntax: none memory.readqword({string marea, number address|ADDRESS addrobj})
7618 \begin_layout Itemize
7619 Syntax: none memory.readsbyte({string marea, number address|ADDRESS addrobj})
7622 \begin_layout Itemize
7623 Syntax: none memory.readsword({string marea, number address|ADDRESS addrobj})
7626 \begin_layout Itemize
7627 Syntax: none memory.readshword({string marea, number address|ADDRESS addrobj})
7630 \begin_layout Itemize
7631 Syntax: none memory.readsdword({string marea, number address|ADDRESS addrobj})
7634 \begin_layout Itemize
7635 Syntax: none memory.readsqword({string marea, number address|ADDRESS addrobj})
7638 \begin_layout Standard
7639 Reads the specified address <address> (if 's' variant is used, do undergo
7643 \begin_layout Subsection
7644 memory.{,s}read_sg: Scatter/Gather read memory
7647 \begin_layout Itemize
7648 Syntax: none memory.read_sg(string/boolean/number...)
7651 \begin_layout Itemize
7652 Syntax: none memory.sread_sg(string/boolean/number...)
7655 \begin_layout Standard
7656 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
7658 Each argument can be string, boolean or number:
7661 \begin_layout Itemize
7662 String: Set memory area addresses are relative to (e.g.
7666 \begin_layout Itemize
7667 boolean: If true, increment relative address by 1, if false, decrement by
7669 The new address is read as next higher byte.
7672 \begin_layout Itemize
7673 integer: Set the relative address to specified value and read the address
7674 as next higher byte.
7677 \begin_layout Subsection
7678 memory.write_sg: Scatter/Gather write memory
7681 \begin_layout Itemize
7682 Syntax: none memory.write_sg(number value, string/boolean/number...)
7685 \begin_layout Standard
7686 Perform scatter/gather write of value <value> on memory.
7687 Each argument can be string, boolean or number:
7690 \begin_layout Itemize
7691 String: Set memory area addresses are relative to (e.g.
7695 \begin_layout Itemize
7696 boolean: If true, increment relative address by 1, if false, decrement by
7698 The new address is read as next higher byte.
7701 \begin_layout Itemize
7702 integer: Set the relative address to specified value and read the address
7703 as next higher byte.
7706 \begin_layout Subsection
7707 memory.read{float,double}: Read memory
7710 \begin_layout Itemize
7711 Syntax: none memory.readfloat({string marea, number address|ADDRESS addrobj})
7714 \begin_layout Itemize
7715 Syntax: none memory.readdouble({string marea, number address|ADDRESS addrobj})
7718 \begin_layout Standard
7719 Reads the specified address <address>
7722 \begin_layout Subsection
7723 memory.write{byte,{,h,d,q}word,float,double}: Write memory
7726 \begin_layout Itemize
7727 Syntax: none memory.writebyte({string marea, number address|ADDRESS addrobj},
7731 \begin_layout Itemize
7732 Syntax: none memory.writeword({string marea, number address|ADDRESS addrobj},
7736 \begin_layout Itemize
7737 Syntax: none memory.writehword({string marea, number address|ADDRESS addrobj},
7741 \begin_layout Itemize
7742 Syntax: none memory.writedword({string marea, number address|ADDRESS addrobj},
7746 \begin_layout Itemize
7747 Syntax: none memory.writeqword({string marea, number address|ADDRESS addrobj},
7751 \begin_layout Itemize
7752 Syntax: none memory.writefloat({string marea, number address|ADDRESS addrobj},
7756 \begin_layout Itemize
7757 Syntax: none memory.writedouble({string marea, number address|ADDRESS addrobj},
7761 \begin_layout Standard
7762 Writes the specified value <value> (negative integer values undergo 2's
7763 complement) to specified address <address>.
7766 \begin_layout Subsection
7767 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
7770 \begin_layout Itemize
7771 Syntax: userdata memory.map<type>({string marea, number base|ADDRESS addrobj},
7775 \begin_layout Standard
7776 Returns a table mapping specified memory aperture for read/write.
7779 \begin_layout Itemize
7780 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
7781 qword, sqword, float or double.
7784 \begin_layout Subsection
7785 memory.hash_region: Hash region of memory
7788 \begin_layout Itemize
7789 Syntax: string memory.hash_region({string marea, number base|ADDRESS addrobj},
7793 \begin_layout Standard
7794 Hash <size> bytes starting from address <base> (relative to <marea>) and
7798 \begin_layout Subsection
7799 memory.hash_region2: Hash region of memory
7802 \begin_layout Itemize
7803 Syntax: string memory.hash_region2({string marea, number base|ADDRESS addrobj},
7804 number size[, number rows, number stride])
7807 \begin_layout Standard
7808 Hash <rows> blocks of <size> bytes starting from address <base> (relative
7810 The blocks are offset by <stride> from one another and return the SHA-256.
7813 \begin_layout Subsection
7814 memory.hash_region_skein: Hash region of memory
7817 \begin_layout Itemize
7818 Syntax: string memory.hash_region_skein({string marea, number base|ADDRESS
7819 addrobj}, number size[, number rows, number stride])
7822 \begin_layout Standard
7823 Same as memory.hash_region2, but uses Skein-512-256 (v1.3; one of the SHA-3
7824 finalists) as hash function.
7827 \begin_layout Subsection
7828 memory.store: Store region of memory
7831 \begin_layout Itemize
7832 Syntax: none memory.store({string marea, number addr|ADDRESS addrobj}, number
7833 daddr[, number rows, number stride]
7836 \begin_layout Standard
7837 Copy memory starting from <addr> in memory area <marea> (each row being
7838 of size <size>, there being <rows> rows, and rows being separated by <stride>
7839 in memory) into savestate-saved memory area, starting from <daadr> (all
7840 rows are written back to back).
7843 \begin_layout Subsection
7844 memory.storecmp: Compare and store region of memory
7847 \begin_layout Itemize
7848 Syntax: bool memory.storecmp({string marea, number addr|ADDRESS addrobj},
7849 number daddr[, number rows, number stride]
7852 \begin_layout Standard
7853 Like memory.store, but returns true if target of copy already held the value
7854 that would be copied before the copy happened.
7855 Otherwise returns false (if target and source differ before copy).
7858 \begin_layout Subsection
7859 memory.hash_state: Hash system state
7862 \begin_layout Itemize
7863 Syntax: string memory.hash_state()
7866 \begin_layout Standard
7867 Hash the current system state.
7868 Mainly useful for debugging savestates.
7871 \begin_layout Subsection
7872 memory.readregion: Read region of memory
7875 \begin_layout Itemize
7876 Syntax: table memory.readregion({string marea, number base|ADDRESS addrobj},
7880 \begin_layout Standard
7881 Read a region of memory.
7884 \begin_layout Itemize
7885 Warning: If the region crosses memory area boundary, the results are undefined.
7888 \begin_layout Subsection
7889 memory.writeregion: Write region of memory
7892 \begin_layout Itemize
7893 Syntax: none memory.writeregion({string marea, number base|ADDRESS addrobj},
7894 number size, table data)
7897 \begin_layout Standard
7898 Write a region of memory.
7901 \begin_layout Itemize
7902 Warning: If the region crosses memory area boundary, the results are undefined.
7905 \begin_layout Subsection
7906 memory.action: Run core action
7909 \begin_layout Itemize
7910 memory.action(string action, [<params>])
7913 \begin_layout Standard
7915 The different models expect parameters as:
7918 \begin_layout Itemize
7922 \begin_layout Itemize
7926 \begin_layout Itemize
7930 \begin_layout Itemize
7934 \begin_layout Itemize
7938 \begin_layout Subsection
7939 memory.action_flags: Get core action flags
7942 \begin_layout Itemize
7943 memory.action_flags(string action)
7946 \begin_layout Standard
7947 Get value of action flags for core action <action>.
7950 \begin_layout Itemize
7954 \begin_layout Itemize
7955 Bit 1: Selected (not all actions can be selected)?
7958 \begin_layout Subsection
7959 memory.get_lag_flag: Get lag flag
7962 \begin_layout Itemize
7963 Syntax: boolean memory.get_lag_flag()
7966 \begin_layout Standard
7967 Get the value of core lag flag.
7968 True if this frame has been lag so far, false if poll has been detected.
7971 \begin_layout Subsection
7972 memory.set_lag_flag: Set lag flag
7975 \begin_layout Itemize
7976 Syntax: none memory.set_lag_flag(boolean flag)
7979 \begin_layout Standard
7980 Set the value of core lag flag.
7981 This flag automatically gets cleared if poll is detected, but can be forcibly
7982 set or cleared if game so requires.
7985 \begin_layout Itemize
7986 Should only be used in on_frame_emulated callback.
7989 \begin_layout Itemize
7990 Setting or clearing this affects the emulator lag counter.
7993 \begin_layout Subsection
7994 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
7998 \begin_layout Itemize
7999 Syntax: function memory.registerread({string marea, number addr|ADDRESS addrobj},
8003 \begin_layout Itemize
8004 Syntax: function memory.registerwrite({string marea, number addr|ADDRESS
8005 addrobj}, function fn);
8008 \begin_layout Itemize
8009 Syntax: function memory.registerexec({string marea, number addr|ADDRESS addrobj},
8013 \begin_layout Itemize
8014 Syntax: none memory.unregisterread({string marea, number addr|ADDRESS addrobj},
8018 \begin_layout Itemize
8019 Syntax: none memory.unregisterwrite({string marea, number addr|ADDRESS addrobj},
8023 \begin_layout Itemize
8024 Syntax: none memory.unregisterexec({string marea, number addr|ADDRESS addrobj},
8028 \begin_layout Standard
8029 Add or remove callback on memory read, write or execute (depending on the
8031 <addr> is relative to <marea>.
8032 <fn> is the callback.
8033 The register* functions return <fn> (which can then be passed to unregister*
8037 \begin_layout Itemize
8038 Not all cores support this, and it may be unsupported for some memory areas.
8041 \begin_layout Itemize
8042 The functions are passed two parameters: Address and value.
8045 \begin_layout Subsection
8046 memory.{,un}registertrace: Set/Clear trace hook
8049 \begin_layout Itemize
8050 Syntax: function memory.registertrace(number processor, function fn);
8053 \begin_layout Itemize
8054 Syntax: none memory.unregistertrace(number processor, function fn);
8057 \begin_layout Standard
8058 Add or remove trace callback.
8059 <processor> is system-dependent processor number (0 is usually main CPU).
8060 The function arguments work like in other (un)register* functions.
8063 \begin_layout Itemize
8064 The functions are passed two parameters: Trace CPU and Trace event string.
8067 \begin_layout Subsection
8068 memory.cheat: Set cheat
8071 \begin_layout Itemize
8072 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj}, number
8076 \begin_layout Itemize
8077 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj});
8080 \begin_layout Standard
8081 Set or clear cheat (value <value>) on address <addr> (relative to <marea>).
8082 If <value> is not speicified, clear a cheat.
8085 \begin_layout Itemize
8086 Not all cores support this, and it may be unsupported for some memory areas.
8089 \begin_layout Subsection
8090 memory.setxmask: Set global execute hook mask
8093 \begin_layout Itemize
8094 Syntax: none memory.setxmask(number mask)
8097 \begin_layout Standard
8098 Set the global execute hook mask to <mask>.
8099 The meaning of each bit is system-dependent, but bit 0 should be the main
8103 \begin_layout Subsection
8104 memory.getregister: Get register value
8107 \begin_layout Itemize
8108 Syntax: number/boolean memory.getregister(string register)
8111 \begin_layout Standard
8112 Get the value of named register.
8115 \begin_layout Subsection
8116 memory.getregisters: Get register values
8119 \begin_layout Itemize
8120 Syntax: table memory.getregisters()
8123 \begin_layout Standard
8124 Get the value of all known registers as table.
8127 \begin_layout Subsection
8128 memory.setregister: Set register value
8131 \begin_layout Itemize
8132 Syntax: none memory.setregister(string register, number/boolean value)
8135 \begin_layout Standard
8136 Set the value of named register.
8139 \begin_layout Subsection
8140 memory.mmap: Class MMAP_STRUCT
8143 \begin_layout Standard
8144 See class MMAP_STRUCT
8147 \begin_layout Standard
8148 \begin_inset Newpage pagebreak
8154 \begin_layout Section
8158 \begin_layout Standard
8159 Contains newer memory functions.
8162 \begin_layout Subsection
8163 memory2(): Get all memory area names.
8166 \begin_layout Itemize
8167 Syntax: table memory2()
8170 \begin_layout Standard
8171 Returns array of all valid memory area names.
8174 \begin_layout Subsection
8175 memory2.<marea>:info: Get memory area info
8178 \begin_layout Itemize
8179 Syntax: table memory2.<marea>:info()
8182 \begin_layout Standard
8183 Return table describing given memory area.
8184 Includes fields address, size, last, readonly, special and endian.
8187 \begin_layout Subsection
8188 memory2.<marea>:<op>: Read/Write memory
8191 \begin_layout Itemize
8192 Syntax: none memory2.<marea>:<op>(number offset, number value)
8195 \begin_layout Itemize
8196 Syntax: number memory2.<marea>:<op>(number offset)
8199 \begin_layout Standard
8200 Read/Write value from/to given memory area <marea> at given offset <offset>
8202 The value written is <value>.
8203 <Op> is of form: [i][s]<type>, where:
8206 \begin_layout Itemize
8207 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
8210 \begin_layout Itemize
8211 'i' signifies that the value is treated as opposite-to-normal endianess,
8214 \begin_layout Itemize
8215 's' signifies that value is treated as signed (not available for floating-point).
8218 \begin_layout Subsection
8219 memory2.<marea>:read: Scatter-gather value read
8222 \begin_layout Itemize
8223 Syntax: number memory2.<marea>:read(number addr...)
8226 \begin_layout Standard
8227 Read value from given memory area <marea> at byte offsets <addr>..., given
8228 in order of increasing significance.
8229 Value of true and false are special.
8230 True increments address by 1, and false decrements address by 1.
8233 \begin_layout Subsection
8234 memory2.<marea>:sread: Signed scatter-gather value read
8237 \begin_layout Itemize
8238 Syntax: number memory2.<marea>:sread(number addr...)
8241 \begin_layout Standard
8242 Like memory2.<marea>:read, but reads signed values.
8245 \begin_layout Subsection
8246 memory2.<marea>:write: Scatter-gather value write
8249 \begin_layout Itemize
8250 Syntax: number memory2.<marea>:write(number val, number addr...)
8253 \begin_layout Standard
8254 Write value <val> to given memory area <marea> at byte offsets <addr>..., given
8255 in order of increasing significance.
8256 Value of true and false are special.
8257 True increments address by 1, and false decrements address by 1.
8260 \begin_layout Subsection
8261 memory2.<marea>:cheat: Set/Clear cheat
8264 \begin_layout Itemize
8265 Syntax: none memory2.<marea>:cheat(number addr, [number value])
8268 \begin_layout Standard
8269 Set/Clear cheat at offset <addr> of memory area <marea>.
8270 If <value> is given, cheat with specified value is set.
8271 Otherwise cheat on address is removed.
8274 \begin_layout Subsection
8275 memory2.<marea>:sha256: SHA-256
8278 \begin_layout Itemize
8279 Syntax: string memory2.<marea>:sha256(number addr, number size[, number rows,
8283 \begin_layout Standard
8284 Compute SHA-256 of <rows> (default 1) chunks of <size> bytes each, starting
8285 from offset <addr> of area <marea>.
8286 The chunks are separated by <stride>.
8289 \begin_layout Subsection
8290 memory2.<marea>:skein: Skein-512-256
8293 \begin_layout Itemize
8294 Syntax: string memory2.<marea>:skein(number addr, number size[, number rows,
8298 \begin_layout Standard
8299 Same as memory2.<marea>:sha256, except with Skein-512-256 as hash function.
8302 \begin_layout Subsection
8303 memory2.<marea>:store{,cmp}: Copy region to Lua memory with compare
8306 \begin_layout Itemize
8307 Syntax: none memory2.<marea>:store(number addr, number daddr, number size[,
8308 number rows, number stride])
8311 \begin_layout Itemize
8312 Syntax: boolean memory2.<marea>:storecmp(number addr, number daddr, number
8313 size[, number rows, number stride])
8316 \begin_layout Standard
8317 Copy <rows> (default 1) chunks of <size> bytes each, starting from offset
8318 <addr> of area <marea>.
8319 The chunks are separated by <stride>.
8320 The target is Lua host memory, starting from offset <daddr>.
8323 \begin_layout Standard
8324 Additionally, the storecmp method returns false if target was modified (otherwis
8328 \begin_layout Subsection
8329 memory2.<marea>:readregion: Read region
8332 \begin_layout Itemize
8333 Syntax table memory2.<marea>:readregion(number addr, number size)
8336 \begin_layout Standard
8337 Read <size> bytes starting from <addr> in <marea> and return as array.
8340 \begin_layout Subsection
8341 memory2.<marea>:writeregion: Write region
8344 \begin_layout Itemize
8345 Syntax none memory2.<marea>:writeregion(number addr, table data)
8348 \begin_layout Standard
8349 Write array <data> to bytes starting from <addr> in <marea>.
8352 \begin_layout Subsection
8353 memory2.<marea>:register{read,write,exec}: Register hook
8356 \begin_layout Itemize
8357 Syntax: function memory2.<marea>:registerread(number addr, function fn);
8360 \begin_layout Itemize
8361 Syntax: function memory2.<marea>:registerwrite(number addr, function fn);
8364 \begin_layout Itemize
8365 Syntax: function memory2.<marea>:registerexec(number addr, function fn);
8368 \begin_layout Standard
8369 Register debug callback <fn> of specified type at offset <addr> of memory
8374 \begin_layout Subsection
8375 memory2.<marea>:unregister{read,write,exec}: Unregister hook
8378 \begin_layout Itemize
8379 Syntax: none memory2.<marea>:unregisterread(number addr, function fn);
8382 \begin_layout Itemize
8383 Syntax: none memory2.<marea>:unregisterwrite(number addr, function fn);
8386 \begin_layout Itemize
8387 Syntax: none memory2.<marea>:unregisterexec(number addr, function fn);
8390 \begin_layout Standard
8391 Unregister debug callback <fn> of specified type at offset <addr> of memory
8395 \begin_layout Standard
8396 \begin_inset Newpage pagebreak
8402 \begin_layout Section
8406 \begin_layout Standard
8407 Contains random number generation methods.
8408 These functions do not return reproducable results.
8411 \begin_layout Subsection
8412 random.boolean: Random boolean
8415 \begin_layout Itemize
8416 Syntax: boolean random.boolean()
8419 \begin_layout Standard
8420 Returns true or false at random (50-50 chance).
8423 \begin_layout Subsection
8424 random.integer: Random integer
8427 \begin_layout Itemize
8428 Syntax: number random.integer(number highplusone)
8431 \begin_layout Itemize
8432 Syntax: number random.integer(number low, number high)
8435 \begin_layout Standard
8436 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
8437 With two arguments, return random integer [<low>,<high>] (both ends inclusive).
8440 \begin_layout Standard
8441 The returned numbers are from uniform distribution.
8444 \begin_layout Subsection
8445 random.float: Random float
8448 \begin_layout Itemize
8449 Syntax: number random.float()
8452 \begin_layout Standard
8453 Returns random decimal number [0,1).
8456 \begin_layout Subsection
8457 random.among: Random parameter
8460 \begin_layout Itemize
8461 Syntax: value random.among(value values...)
8464 \begin_layout Standard
8465 Returns random parameter value, picked at uniform.
8466 Multiple equivalent values are returned with higher chance.
8469 \begin_layout Subsection
8470 random.amongtable: Random from table
8473 \begin_layout Itemize
8474 Syntax: value random.amongtable(table tab)
8477 \begin_layout Standard
8478 Returns random value from table <tab>.
8479 As in random.among, no equality testing is done.
8482 \begin_layout Standard
8483 \begin_inset Newpage pagebreak
8489 \begin_layout Section
8493 \begin_layout Subsection
8494 zip.enumerate: Enumerate members in zipfile
8497 \begin_layout Itemize
8498 Syntax: Table zip.enumerate(string filename[, boolean invert])
8501 \begin_layout Standard
8502 Returns table of files in zip archive <filename>.
8503 If <invert> is true, instead of returning array of names, returns table
8504 with keys being member names and values being true.
8507 \begin_layout Subsection
8508 zip.writer: Class ZIPWRITER
8511 \begin_layout Standard
8512 See class ZIPWRITER.
8515 \begin_layout Section
8519 \begin_layout Subsection
8520 paths.get_executable_file: Get the name of lsnes executable file
8523 \begin_layout Itemize
8524 Syntax: String paths.get_executable_file()
8527 \begin_layout Standard
8528 Returns the filename of the lsnes executable (together with path), if known.
8529 If unknown, returns nil.
8532 \begin_layout Subsection
8533 paths.get_executable_path: Get the path of lsnes executable file
8536 \begin_layout Itemize
8537 Syntax: String paths.get_executable_path()
8540 \begin_layout Standard
8541 Returns the directory of the lsnes executable path, if known.
8542 If unknown, returns nil.
8545 \begin_layout Subsection
8546 paths.get_config_path: Get the path of lsnes config file
8549 \begin_layout Itemize
8550 Syntax: String paths.get_config_path()
8553 \begin_layout Standard
8554 Returns the directory of the lsnes configuration.
8557 \begin_layout Subsection
8558 paths.get_rompath: Get the path of ROM files
8561 \begin_layout Itemize
8562 Syntax: String paths.get_rompath()
8565 \begin_layout Standard
8566 Returns the default directory for various ROMs.
8569 \begin_layout Subsection
8570 paths.get_firmwarepath: Get the path of firmware files
8573 \begin_layout Itemize
8574 Syntax: String paths.get_firmwarepath()
8577 \begin_layout Standard
8578 Returns the default directory for various firmwares.
8581 \begin_layout Subsection
8582 paths.get_slotpath: Get the path of save slot files
8585 \begin_layout Itemize
8586 Syntax: String paths.get_slotpath()
8589 \begin_layout Standard
8590 Returns the default directory for various save slots.
8591 If in project context, returns the project directory.
8594 \begin_layout Subsection
8595 paths.get_save_slot_file: Get save slot filename
8598 \begin_layout Itemize
8599 Syntax: String paths.get_slotpath(string name)
8602 \begin_layout Itemize
8603 Syntax: String paths.get_slotpath(integer slotnum, bool for_save)
8606 \begin_layout Standard
8607 Resolve the filename of specified save slot <name> or <slotnum>.
8608 Projects and save branches are taken into account.
8609 If <for_save> is true, the filename is always for current branch.
8610 If <for_save> is false, branch tree is walked upwards until root is reached
8611 or desired file is located.
8614 \begin_layout Standard
8615 \begin_inset Newpage pagebreak
8621 \begin_layout Section
8625 \begin_layout Standard
8626 Various callback-related functions.
8629 \begin_layout Subsection
8630 \begin_inset CommandInset label
8632 name "subsec:callback.register:-Register-a"
8636 callback.register: Register a callback
8639 \begin_layout Itemize
8640 Syntax: function callback.register(string cbname, function cbfun);
8643 \begin_layout Standard
8644 Instruct function <cbfun> to be added to list of callbacks to call on event
8645 <cbname> (See section
8646 \begin_inset CommandInset ref
8648 reference "sec:Callbacks"
8653 The callback name does not have the 'on_' prefix (e.g.
8655 \begin_inset Quotes eld
8659 \begin_inset Quotes erd
8666 \begin_layout Subsection
8667 \begin_inset CommandInset label
8669 name "subsec:callback.unregister:-Unregister-"
8673 callback.unregister: Unregister a callback
8676 \begin_layout Itemize
8677 Syntax: function callback.unregister(string cbname, function cbfun);
8680 \begin_layout Standard
8681 Instruct function <cbfun> to be removed from list of callbacks to call on
8685 \begin_layout Subsection
8686 callback.<cbname>:register: Register callback
8689 \begin_layout Itemize
8690 Syntax: function callback.<cbname>:register(function cbfun)
8693 \begin_layout Standard
8694 Synonym for callback.register (section
8695 \begin_inset CommandInset ref
8697 reference "subsec:callback.register:-Register-a"
8701 ), albeit with callback name specified differently.
8704 \begin_layout Subsection
8705 callback.<cbname>:unregister: Register callback
8708 \begin_layout Itemize
8709 Syntax: function callback.<cbname>:unregister(function cbfun)
8712 \begin_layout Standard
8713 Synonym for callback.unregister (section
8714 \begin_inset CommandInset ref
8716 reference "subsec:callback.unregister:-Unregister-"
8720 ), albeit with callback name specified differently.
8723 \begin_layout Section
8727 \begin_layout Standard
8728 Various bsnes-specific functions.
8731 \begin_layout Subsection
8732 bsnes.dump_sprite: Dump a sprite
8735 \begin_layout Itemize
8736 Syntax: BITMAP bsnes.dump_sprite(string marea, number addr, number width,
8737 number height[, number stride])
8740 \begin_layout Standard
8741 Dumps given sprite (in native format) from memory.
8742 memory area is usually
8743 \begin_inset Quotes eld
8747 \begin_inset Quotes erd
8751 <Width> and <height> are given in 8x8 blocks.
8752 <Stride> overrides row stride (default 512).
8755 \begin_layout Subsection
8756 bsnes.dump_sprite2: Dump a 2bpp sprite
8759 \begin_layout Itemize
8760 Syntax: BITMAP bsnes.dump_sprite2(string marea, number addr, number width,
8761 number height[, number stride])
8764 \begin_layout Standard
8765 Dumps given sprite (in 2bpp format) from memory.
8766 memory area is usually
8767 \begin_inset Quotes eld
8771 \begin_inset Quotes erd
8775 <Width> and <height> are given in 8x8 blocks.
8776 <Stride> overrides row stride (default 256).
8779 \begin_layout Subsection
8780 bsnes.dump_palette: Dump a palette
8783 \begin_layout Itemize
8784 Syntax: PALETTE bsnes.dump_palette(string marea, number addr, bool/integer
8785 full256, bool first_trans)
8788 \begin_layout Standard
8789 Dumps a palette from memory.
8790 memory area is usually
8791 \begin_inset Quotes eld
8795 \begin_inset Quotes erd
8799 If <full256> is true, 256 colors are dumped (otherwise 16).
8800 <full256> can also be number of colors (4, 16 or 256).
8801 If <first_trans> is true, first color is forced transparent.
8804 \begin_layout Subsection
8805 bsnes.enablelayer: Set layer visibility
8808 \begin_layout Itemize
8809 Syntax: none bsnes.enablelayer(number layer, number priority, boolean enabled)
8812 \begin_layout Standard
8813 Enable or disable specified layer at specified priority.
8816 \begin_layout Subsection
8817 bsnes.redump_sprite: Redump a sprite
8820 \begin_layout Itemize
8821 Syntax: none bsnes.redump_sprite(BITMAP bitmap, string marea, number addr[,
8825 \begin_layout Standard
8826 Like bsnes.dump_sprite, but instead dumps to specified bitmap <bitmap>.
8827 The specified bitmap must have size multiple of 8x8.
8830 \begin_layout Subsection
8831 bsnes.redump_sprite2: Redump a 2bpp sprite
8834 \begin_layout Itemize
8835 Syntax: none bsnes.redump_sprite2(BITMAP bitmap, string marea, number addr[,
8839 \begin_layout Standard
8840 Like bsnes.dump_sprite2, but instead dumps to specified bitmap <bitmap>.
8841 The specified bitmap must have size multiple of 8x8.
8844 \begin_layout Subsection
8845 bsnes.redump_palette: Redump a palette
8848 \begin_layout Itemize
8849 Syntax: none bsnes.dump_palette(PALETTE pal, string marea, number addr, bool
8853 \begin_layout Standard
8854 Like bsnes.dump_palette, but instead dumps to specified palette <pal>.
8855 The specified palette must have either 16 or 256 colors.
8858 \begin_layout Section
8859 extensions to table string
8862 \begin_layout Subsection
8863 string.charU: string.char, UTF-8 version.
8866 \begin_layout Itemize
8867 Syntax: string string.charU(number n...)
8870 \begin_layout Standard
8871 Like Lua string.char(), but works in terms of Unicode codepoints.
8872 The returned string is UTF-8.
8875 \begin_layout Subsection
8876 string.byteU: string.byte, UTF-8 version.
8879 \begin_layout Itemize
8881 string.byteU(string str[, number i[, number j]])
8884 \begin_layout Standard
8885 Like string.byte(), but works in terms of Unicode codepoints.
8886 The input string <str> is assumed UTF-8.
8889 \begin_layout Subsection
8890 string.regex: Match string against regular expression
8893 \begin_layout Itemize
8894 Syntax: boolean/string...
8895 string.regex(string regexp, string against)
8898 \begin_layout Standard
8899 Match POSIX-extended regular expression <regexp> against string <against>.
8900 If no match, false is returned.
8901 Otherwise if string has no subcaptures, true is returned.
8902 Otherwise each subcapture is returned as a string (in order of starting
8906 \begin_layout Subsection
8907 string.hex: Transform integer into hex string
8910 \begin_layout Itemize
8911 Syntax: string string.hex(number n, [number digits])
8914 \begin_layout Standard
8915 Returns hexadecimal string representation of <n>, optionally padded with
8916 zeroes to <digits> digits (default is not to pad).
8919 \begin_layout Subsection
8920 string.lpad: Pad string with spaces from left
8923 \begin_layout Itemize
8924 Syntax: string string.lpad(string x, number n)
8927 \begin_layout Standard
8928 Pad string <x> to <n> bytes by inserting spaces at start and return the
8932 \begin_layout Subsection
8933 string.rpad: Pad string with spaces from right
8936 \begin_layout Itemize
8937 Syntax: string string.rpad(string x, number n)
8940 \begin_layout Standard
8941 Pad string <x> to <n> bytes by inserting spaces at end and return the result.
8944 \begin_layout Section
8948 \begin_layout Standard
8949 Contains copy of global variables from time of Lua initialization.
8953 \begin_layout Standard
8954 \begin_inset Newpage pagebreak
8960 \begin_layout Section
8961 \begin_inset CommandInset label
8963 name "sec:Callbacks"
8970 \begin_layout Standard
8971 Various callbacks to Lua that can occur.
8974 \begin_layout Subsection
8975 on_paint: Screen is being painted
8978 \begin_layout Itemize
8979 Callback: on_paint(bool not_synth)
8982 \begin_layout Standard
8983 Called when screen is being painted.
8984 Any gui.* calls requiring graphic context draw on the screen.
8987 \begin_layout Itemize
8988 not_synth is true if this hook is being called in response to received frame,
8992 \begin_layout Subsection
8993 on_video: Dumped video frame is being painted
8996 \begin_layout Itemize
8997 Callback: on_video()
9000 \begin_layout Standard
9001 Called when video dump frame is being painted.
9002 Any gui.* calls requiring graphic context draw on the video.
9005 \begin_layout Subsection
9006 on_frame_emulated: Frame emulation complete
9009 \begin_layout Itemize
9010 Callback: on_frame_emulated()
9013 \begin_layout Standard
9014 Called when emulating frame has completed and on_paint()/on_video() calls
9015 are about to be issued.
9018 \begin_layout Subsection
9019 on_frame: Frame emulation starting.
9022 \begin_layout Itemize
9023 Callback: on_frame()
9026 \begin_layout Standard
9027 Called on each starting whole frame.
9030 \begin_layout Subsection
9031 on_rewind: Movie rewound to beginning
9034 \begin_layout Itemize
9035 Callback: on_rewind()
9038 \begin_layout Standard
9039 Called when rewind movie to beginning has completed.
9042 \begin_layout Subsection
9043 on_pre_load: Load operation is about to start
9046 \begin_layout Itemize
9047 Callback: on_pre_load(string name)
9050 \begin_layout Standard
9051 Called just before savestate/movie load occurs (note: loads are always delayed,
9052 so this occurs even when load was initiated by lua).
9055 \begin_layout Subsection
9056 on_err_Load: Load failed
9059 \begin_layout Itemize
9060 Callback: on_err_load(string name)
9063 \begin_layout Standard
9064 Called if loadstate goes wrong.
9067 \begin_layout Subsection
9068 on_post_load: Load completed
9071 \begin_layout Itemize
9072 Callback: on_post_load(string name, boolean was_savestate)
9075 \begin_layout Standard
9076 Called on successful loadstate.
9077 was_savestate gives if this was a savestate or a movie.
9080 \begin_layout Subsection
9081 on_pre_save: Save operation is about to start
9084 \begin_layout Itemize
9085 Callback: on_pre_save(string name, boolean is_savestate)
9088 \begin_layout Standard
9089 Called just before savestate save occurs (note: movie saves are synchronous
9090 and won't trigger these callbacks if called from Lua).
9093 \begin_layout Subsection
9094 on_err_save: Save failed
9097 \begin_layout Itemize
9098 Callback: on_err_save(string name)
9101 \begin_layout Standard
9102 Called if savestate goes wrong.
9105 \begin_layout Subsection
9106 on_post_save: Save completed
9109 \begin_layout Itemize
9110 Callback: on_post_save(string name, boolean is_savestate)
9113 \begin_layout Standard
9114 Called on successful savaestate.
9115 is_savestate gives if this was a savestate or a movie.
9118 \begin_layout Subsection
9119 on_quit: Emulator is shutting down
9122 \begin_layout Itemize
9126 \begin_layout Standard
9127 Called when emulator is shutting down.
9130 \begin_layout Subsection
9131 on_input: Polling for input
9134 \begin_layout Standard
9135 Called when emulator is just sending input to bsnes core.
9136 Warning: This is called even in readonly mode, but the results are ignored.
9139 \begin_layout Subsection
9140 on_reset: System has been reset
9143 \begin_layout Itemize
9144 Callback: on_reset()
9147 \begin_layout Standard
9148 Called when system is reset.
9151 \begin_layout Subsection
9152 on_readwrite: Entered recording mode
9155 \begin_layout Itemize
9156 Callback: on_readwrite()
9159 \begin_layout Standard
9160 Called when moving into recording mode as result of
9161 \begin_inset Quotes eld
9165 \begin_inset Quotes erd
9168 command (note: moving to rwmode by Lua won't trigger this, as per recursive
9172 \begin_layout Subsection
9173 on_snoop/on_snoop2: Snoop core controller reads
9176 \begin_layout Itemize
9177 Callback: on_snoop(number port, number controller, number index, number
9181 \begin_layout Itemize
9182 Callback: on_snoop2(number port, number controller, number index, number
9186 \begin_layout Standard
9187 Called each time bsnes asks for input.
9188 The value is the final value to be sent to bsnes core (readonly mode, autohold
9189 and autofire have been taken into account).
9190 Might be useful when translating movies to format suitable for console
9192 Note: There is no way to modify the value to be sent.
9195 \begin_layout Itemize
9196 On_snoop2 is called instead of on_snoop if defined.
9197 Reserves port 0 for system, having first user port be port 1.
9200 \begin_layout Subsection
9201 on_keyhook: Hooked key/axis has been moved
9204 \begin_layout Itemize
9205 Callback: on_keyhook(string keyname, table state)
9208 \begin_layout Standard
9209 Sent when key that has keyhook events requested changes state.
9210 Keyname is name of the key (group) and state is the state (same kind as
9211 table values in input.raw).
9214 \begin_layout Subsection
9218 \begin_layout Itemize
9222 \begin_layout Standard
9223 Called when requested by set_idle_timeout(), the timeout has expired and
9224 emulator is waiting.
9227 \begin_layout Subsection
9228 on_timer: Timer event
9231 \begin_layout Itemize
9232 Callback: on_timer()
9235 \begin_layout Standard
9236 Called when requested by set_idle_timeout() and the timeout has expired
9237 (regardless if emulator is waiting).
9240 \begin_layout Subsection
9241 on_set_rewind: Rewind point has been set
9244 \begin_layout Itemize
9245 Callback: on_set_rewind(UNSAFEREWIND r)
9248 \begin_layout Standard
9249 Called when unsafe rewind object has been constructed.
9252 \begin_layout Subsection
9253 on_pre_rewind: Rewind is about to occur
9256 \begin_layout Itemize
9257 Callback: on_pre_rewind()
9260 \begin_layout Standard
9261 Called just before unsafe rewind is about to occur.
9264 \begin_layout Subsection
9265 on_post_rewind: Rewind has occured
9268 \begin_layout Itemize
9269 Callback: on_post_rewind()
9272 \begin_layout Standard
9273 Called just after unsafe rewind has occured.
9276 \begin_layout Subsection
9277 on_button: Button has been pressed
9280 \begin_layout Itemize
9281 Callback: on_button(number port, number controller, number index, string
9285 \begin_layout Standard
9286 Called on controller button press, with following parameters:
9289 \begin_layout Itemize
9290 port: Port number (0 is system)
9293 \begin_layout Itemize
9294 controller: Controller within port
9297 \begin_layout Itemize
9298 index: Index of button.
9301 \begin_layout Itemize
9302 type: Type of event, one of:
9303 \begin_inset Separator latexpar
9310 \begin_layout Itemize
9311 \begin_inset Quotes eld
9315 \begin_inset Quotes erd
9318 : Button was pressed.
9321 \begin_layout Itemize
9322 \begin_inset Quotes eld
9326 \begin_inset Quotes erd
9329 : Button was released.
9332 \begin_layout Itemize
9333 \begin_inset Quotes eld
9337 \begin_inset Quotes erd
9343 \begin_layout Itemize
9344 \begin_inset Quotes eld
9348 \begin_inset Quotes erd
9351 : Released from hold.
9354 \begin_layout Itemize
9355 \begin_inset Quotes eld
9359 \begin_inset Quotes erd
9362 : Typing input on button.
9365 \begin_layout Itemize
9366 \begin_inset Quotes eld
9370 \begin_inset Quotes erd
9373 : Typing input undone.
9376 \begin_layout Itemize
9377 \begin_inset Quotes eld
9380 autofire <duty> <cycle>
9381 \begin_inset Quotes erd
9384 : Autofire with specifie duty and cycle.
9387 \begin_layout Itemize
9388 \begin_inset Quotes eld
9392 \begin_inset Quotes erd
9398 \begin_layout Itemize
9399 \begin_inset Quotes eld
9403 \begin_inset Quotes erd
9406 : Analog action on axis.
9410 \begin_layout Subsection
9411 on_movie_lost: Movie data is about to be lost
9414 \begin_layout Itemize
9415 Callback: on_movie_lost(STRING kind)
9418 \begin_layout Standard
9419 Called just before something would happen that could lose movie data.
9423 \begin_layout Itemize
9424 readwrite: Switching to recording mode.
9427 \begin_layout Itemize
9428 reload: ROM is being reloaded in recording mode.
9431 \begin_layout Itemize
9432 load: New movie is being loaded.
9435 \begin_layout Itemize
9436 unsaferewind: Unsafe rewind is happening.
9439 \begin_layout Subsection
9440 on_latch: Latch line is rising
9443 \begin_layout Itemize
9444 Callback: on_latch(<core-dependent-parameters>)
9447 \begin_layout Standard
9448 Called when latch line for controller is rising.
9449 Some cores may not support this.
9452 \begin_layout Section
9453 System-dependent behaviour
9456 \begin_layout Subsection
9460 \begin_layout Itemize
9461 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
9462 p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
9463 p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
9464 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
9465 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
9466 ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
9467 ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
9468 ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
9469 ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
9470 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
9471 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
9472 ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
9473 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
9474 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
9475 ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
9476 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
9477 ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
9478 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
9479 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
9480 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
9481 ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
9482 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
9483 ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
9484 ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
9485 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
9486 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
9487 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
9488 ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
9489 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
9490 ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
9491 ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
9492 ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
9493 ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
9494 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
9495 ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
9496 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
9497 ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
9498 ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
9499 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
9500 ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount,
9503 \begin_layout Itemize
9504 on_latch has no parameters
9507 \begin_layout Itemize
9508 CPU 0 is S-CPU, 1 is S-SMP.
9511 \begin_layout Itemize
9512 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
9515 \begin_layout Itemize
9516 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
9520 \begin_layout Itemize
9521 Memory areas are: WRAM, APURAM, VRAM, OAM, CGRAM, RTC, DSPRAM, DSPPROM,
9522 DSPDROM, SRAM, ROM, BUS, PTRTABLE, CPU_STATE, PPU_STATE, SMP_STATE, DSP_STATE,
9523 BSXFLASH, BSX_RAM, BSX_PRAM, SLOTA_ROM, SLOTB_ROM, SLOTA_RAM, SLOTB_RAM,
9524 GBCPU_STATE, GBROM, GBRAM, GBWRAM, GBHRAM.
9527 \begin_layout Subsection
9531 \begin_layout Itemize
9532 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
9536 \begin_layout Itemize
9537 on_latch is not supported
9540 \begin_layout Itemize
9544 \begin_layout Itemize
9545 Cheats are supported for ROM, SRAM and WRAM.
9548 \begin_layout Itemize
9549 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM
9553 \begin_layout Itemize
9554 Memory areas are: SRAM, WRAM, VRAM, IOAMHRAM, ROM, BUS.