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 Standard
2426 \begin_inset Newpage pagebreak
2432 \begin_layout Subsection
2433 DBITMAP: Direct-color bitmap
2436 \begin_layout Subsubsection
2437 Static function: new: Create a new bitmap
2440 \begin_layout Itemize
2441 Syntax: bitmap gui.dbitmap.new(w, h, [fillcolor])
2444 \begin_layout Itemize
2445 Syntax: bitmap classes.DBITMAP.new(w, h, [fillcolor])
2448 \begin_layout Itemize
2449 Deprecated: bitmap gui.bitmap_new (w, h, true, [fillcolor]).
2452 \begin_layout Standard
2456 \begin_layout Itemize
2457 w: number: The width of new bitmap.
2460 \begin_layout Itemize
2461 h: number: The height of new bitmap.
2464 \begin_layout Itemize
2465 true: boolean: Fixed boolean true
2468 \begin_layout Itemize
2469 fillcolor: The color to fill the bitmap with (default transparent).
2472 \begin_layout Standard
2476 \begin_layout Itemize
2477 bitmap: DBITMAP: The new bitmap.
2480 \begin_layout Standard
2481 Create a new direct-color bitmap of size <w>*<h>, initially filled with
2485 \begin_layout Subsubsection
2486 Method draw: Draw a bitmap
2489 \begin_layout Itemize
2490 Syntax: bitmap.draw(x, y)
2493 \begin_layout Itemize
2494 Deprecated: gui.bitmap_draw(x, y, bitmap)
2497 \begin_layout Standard
2501 \begin_layout Itemize
2502 bitmap: DBITMAP: The bitmap to draw.
2505 \begin_layout Itemize
2506 x: number: X-coordinate on screen.
2509 \begin_layout Itemize
2510 y: number: Y-coordinate on screen.
2513 \begin_layout Standard
2514 Draw bitmap <bitmap> on screen at <x>,<y>.
2517 \begin_layout Subsubsection
2518 Method draw_outside: Draw a bitmap outside game area
2521 \begin_layout Itemize
2522 Syntax: dbitmap:draw_outside(x, y, palette)
2525 \begin_layout Standard
2526 Like dbitmap:draw, but does not draw on game area.
2529 \begin_layout Subsubsection
2530 Method draw_clip: Draw a bitmap, with clipping
2533 \begin_layout Itemize
2534 Syntax: dbitmap:draw(x, y, palette, x0, y0, width, height)
2537 \begin_layout Standard
2541 \begin_layout Itemize
2542 bitmap: DBITMAP: The bitmap to draw
2545 \begin_layout Itemize
2546 x: number: The x-coordinate on screen.
2549 \begin_layout Itemize
2550 y: number: The y-coordinate on screen.
2553 \begin_layout Itemize
2554 x0: The smallest bitmap x coordinate to draw.
2557 \begin_layout Itemize
2558 y0: The smallest bitmap y coordinate to draw.
2561 \begin_layout Itemize
2562 width: Width of region to draw
2565 \begin_layout Itemize
2566 height: Height of region to draw.
2569 \begin_layout Standard
2570 Like dbitmap:draw, but clip the bitmap area drawn.
2573 \begin_layout Subsubsection
2574 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
2577 \begin_layout Itemize
2578 Syntax: dbitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
2581 \begin_layout Standard
2582 Like dbitmap:draw_clip, but only draw outside game area.
2585 \begin_layout Subsubsection
2586 Method pset: Set pixel in bitmap
2589 \begin_layout Itemize
2590 Syntax: bitmap:pset(x, y, color)
2593 \begin_layout Itemize
2594 Deprecaed: gui.bitmap_pset(bitmap, ...)
2597 \begin_layout Standard
2601 \begin_layout Itemize
2602 bitmap: DBITMAP: The bitmap to manipulate.
2605 \begin_layout Itemize
2606 x: number: x-coordinate of pixel to set.
2609 \begin_layout Itemize
2610 y: number: y-coordinate of pixel to set.
2613 \begin_layout Itemize
2614 color: number/string: The color to set.
2617 \begin_layout Standard
2618 Sets specified pixel <x>,<y> in bitmap <bitmap> to color <color>.
2621 \begin_layout Subsubsection
2622 Method pget: Get pixel in bitmap
2625 \begin_layout Itemize
2626 Syntax: color bitmap:pget(x,y)
2629 \begin_layout Itemize
2630 Deprecated: color gui.bitmap_pget(bitmap, ...)
2633 \begin_layout Standard
2637 \begin_layout Itemize
2638 bitmap: DBITMAP: The bitmap to query.
2641 \begin_layout Itemize
2642 x: number: x-coordinate of pixel to get.
2645 \begin_layout Itemize
2646 y: number: y-coordinate of pixel to get.
2649 \begin_layout Standard
2653 \begin_layout Itemize
2654 color: number: The color of specified pixel.
2657 \begin_layout Standard
2658 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
2661 \begin_layout Subsubsection
2662 Method size: Get size of bitmap
2665 \begin_layout Itemize
2666 Syntax: width, height bitmap:size()
2669 \begin_layout Itemize
2670 Syntax: width, height gui.bitmap_size(bitmap)
2673 \begin_layout Standard
2677 \begin_layout Itemize
2678 bitmap: DBITMAP: The bitmap to query.
2681 \begin_layout Standard
2685 \begin_layout Itemize
2686 width: number: The width of the bitmap.
2689 \begin_layout Itemize
2690 height: number: The height of the bitmap.
2693 \begin_layout Standard
2694 Get size of bitmap <bitmap>.
2697 \begin_layout Subsubsection
2698 Method blit: Blit a bitmap into another
2701 \begin_layout Itemize
2702 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
2705 \begin_layout Itemize
2706 Syntax: dest:blit(dx, dy, src, srcpal, sx, sy, w, h, [ck])
2709 \begin_layout Itemize
2710 Deprecated: gui.bitmap_blit(dest, ...)
2713 \begin_layout Standard
2717 \begin_layout Itemize
2718 dest: DBITMAP: The target bitmap to blit to.
2721 \begin_layout Itemize
2722 dx: number: The x-coordinate in target.
2725 \begin_layout Itemize
2726 dy: number: The y-coordinate in target.
2729 \begin_layout Itemize
2730 src: BITMAP/DBITMAP: The source bitmap.
2733 \begin_layout Itemize
2734 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2737 \begin_layout Itemize
2738 sx: number: The x-coordinate in source.
2741 \begin_layout Itemize
2742 sy: number: The y-coordinate in source.
2745 \begin_layout Itemize
2746 w: number: The width of area to blit.
2749 \begin_layout Itemize
2750 h: number: The height of area to blit.
2753 \begin_layout Itemize
2754 ck: number: The color key.
2755 Pixels with this index are not copied.
2756 \begin_inset Separator latexpar
2763 \begin_layout Itemize
2764 If none is specified, all pixels are copied.
2767 \begin_layout Itemize
2768 If <src> is paletted, this is color index, otherwise it is a color.
2772 \begin_layout Standard
2773 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> (with palette <pal>
2774 if indexed) into <dest> at <dx>,<dy>.
2775 If a color key <ck> is specified, pixels of that color are not copied.
2778 \begin_layout Subsubsection
2779 Method blit_scaled: Blit a bitmap into another with scaling
2782 \begin_layout Itemize
2783 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
2786 \begin_layout Itemize
2787 Syntax: dest:blit_scaled(dx, dy, src, srcpal, sx, sy, w, h, hscl, [vscl],
2791 \begin_layout Itemize
2792 Deprecated: gui.bitmap_blit_scaled(dest, ...)
2795 \begin_layout Standard
2799 \begin_layout Itemize
2800 dest: DBITMAP: The target bitmap to blit to.
2803 \begin_layout Itemize
2804 dx: number: The x-coordinate in target.
2807 \begin_layout Itemize
2808 dy: number: The y-coordinate in target.
2811 \begin_layout Itemize
2812 src: BITMAP/DBITMAP: The source bitmap.
2815 \begin_layout Itemize
2816 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2819 \begin_layout Itemize
2820 sx: number: The x-coordinate in source.
2823 \begin_layout Itemize
2824 sy: number: The y-coordinate in source.
2827 \begin_layout Itemize
2828 w: number: The width of area to blit.
2831 \begin_layout Itemize
2832 h: number: The height of area to blit.
2835 \begin_layout Itemize
2836 hscl: number: Horizontal scale factor (integer).
2839 \begin_layout Itemize
2840 vscl: number: Vertical scale factor (integer).
2841 Defaults to the same as <hscl>.
2844 \begin_layout Itemize
2845 ck: number: The color key.
2846 Pixels with this index are not copied.
2847 \begin_inset Separator latexpar
2854 \begin_layout Itemize
2855 If none is specified, all pixels are copied.
2858 \begin_layout Itemize
2859 If <src> is paletted, this is color index, otherwise it is a color.
2863 \begin_layout Standard
2864 Like DBITMAP:blit, but also scales the copied part of bitmap (using nearest
2865 neighbor) by factor of <hscl>*<vscl>.
2868 \begin_layout Subsubsection
2869 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2872 \begin_layout Itemize
2873 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2876 \begin_layout Itemize
2877 Syntax: dest:blit_porterduff(dx, dy, src, srcpal, sx, sy, w, h, operator)
2880 \begin_layout Itemize
2881 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2884 \begin_layout Standard
2888 \begin_layout Itemize
2889 dest: DBITMAP: The target bitmap to blit to.
2892 \begin_layout Itemize
2893 dx: number: The x-coordinate in target.
2896 \begin_layout Itemize
2897 dy: number: The y-coordinate in target.
2900 \begin_layout Itemize
2901 src: BITMAP/DBITMAP: The source bitmap.
2904 \begin_layout Itemize
2905 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2908 \begin_layout Itemize
2909 sx: number: The x-coordinate in source.
2912 \begin_layout Itemize
2913 sy: number: The y-coordinate in source.
2916 \begin_layout Itemize
2917 w: number: The width of area to blit.
2920 \begin_layout Itemize
2921 h: number: The height of area to blit.
2924 \begin_layout Itemize
2925 operator: string: The operator to use.
2926 \begin_inset Separator latexpar
2933 \begin_layout Itemize
2934 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2935 DestOut, Clear or Xor.
2939 \begin_layout Standard
2940 Like DBITMAP:blit, but instead of just overwriting, applies specified Porter-Duf
2945 \begin_layout Itemize
2946 In target, fully transparent is background.
2947 In source, either fully transparent (if direct) or index 0 (if paletted)
2948 is treated as background.
2951 \begin_layout Subsubsection
2952 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2953 Porter-Duff composition
2956 \begin_layout Itemize
2957 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2961 \begin_layout Itemize
2962 Syntax: dest:blit_scaled_porterduff(dx, dy, src, srcpal, sx, sy, w, h, hscl,
2966 \begin_layout Itemize
2967 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2970 \begin_layout Standard
2974 \begin_layout Itemize
2975 dest: DBITMAP: The target bitmap to blit to.
2978 \begin_layout Itemize
2979 dx: number: The x-coordinate in target.
2982 \begin_layout Itemize
2983 dy: number: The y-coordinate in target.
2986 \begin_layout Itemize
2987 src: BITMAP/DBITMAP: The source bitmap.
2990 \begin_layout Itemize
2991 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2994 \begin_layout Itemize
2995 sx: number: The x-coordinate in source.
2998 \begin_layout Itemize
2999 sy: number: The y-coordinate in source.
3002 \begin_layout Itemize
3003 w: number: The width of area to blit.
3006 \begin_layout Itemize
3007 h: number: The height of area to blit.
3010 \begin_layout Itemize
3011 hscl: number: Horizontal scale factor (integer).
3014 \begin_layout Itemize
3015 vscl: number: Vertical scale factor (integer).
3016 Defaults to the same as <hscl>.
3019 \begin_layout Itemize
3020 operator: string: The operator to use.
3021 \begin_inset Separator latexpar
3028 \begin_layout Itemize
3029 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
3030 DestOut, Clear or Xor.
3034 \begin_layout Standard
3035 Like DBITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
3036 like DBITMAP:blit_scaled.
3039 \begin_layout Subsubsection
3040 Method adjust_transparency: Adjust transparency of bitmap
3043 \begin_layout Itemize
3044 Syntax: bitmap:adjust_transparency(newvalue)
3047 \begin_layout Itemize
3048 Deprecated: gui.adjust_transparency(bitmap, ...)
3051 \begin_layout Standard
3055 \begin_layout Itemize
3056 bitmap: DBITMAP: The bitmap to adjust.
3059 \begin_layout Itemize
3060 Number adj: The factor to multiply opaqueness with times 256.
3063 \begin_layout Standard
3064 Multiply opaqueness of all colors in bitmap <bitmap> by factor of <adj>/256.
3067 \begin_layout Subsubsection
3068 Method save_png: Save a bitmap to PNG
3071 \begin_layout Itemize
3072 Syntax: bitmap:save_png(filename, [base])
3075 \begin_layout Itemize
3076 Syntax: data bitmap:save_png()
3079 \begin_layout Itemize
3081 gui.bitmap_save_png(bitmap, ...)
3084 \begin_layout Standard
3088 \begin_layout Itemize
3089 bitmap: DBITMAP: The bitmap to save.
3092 \begin_layout Itemize
3093 filename: string: The filename to save to.
3096 \begin_layout Itemize
3097 base: string: The base filename is resolved relative to.
3100 \begin_layout Standard
3104 \begin_layout Itemize
3105 data: string: BASE64 encoded PNG data.
3108 \begin_layout Standard
3109 Save bitmap <bitmap> into PNG file <filename> (relative to <base>) or return
3110 BASE64 encoding of it.
3113 \begin_layout Subsubsection
3114 Method hash: Hash a bitmap
3117 \begin_layout Itemize
3118 Syntax: hash bitmap:hash()
3121 \begin_layout Itemize
3122 Deprecated: hash bitmap:hash(bitmap)
3125 \begin_layout Standard
3129 \begin_layout Itemize
3130 bitmap: DBITMAP: The bitmap to hash.
3133 \begin_layout Standard
3137 \begin_layout Itemize
3138 hash: string: 64-hex digit hash
3141 \begin_layout Standard
3142 Hashes bitmap <bitmap> and returns crypto-strong hash.
3146 \begin_layout Subsubsection
3147 Method sample_texture: Sample a texture
3150 \begin_layout Itemize
3151 Syntax: none bitmap:sample_texture(BITMAP source, number xx, number xy,
3152 number x0, number yx, number yy, number y0, number scale, boolean wrap)
3155 \begin_layout Standard
3159 \begin_layout Itemize
3160 source: BITMAP: The bitmap to sample
3163 \begin_layout Itemize
3164 xx: number: s times the source x coefficient of target x axis.
3167 \begin_layout Itemize
3168 xy: number: s times the source y coefficient of target x axis.
3171 \begin_layout Itemize
3172 x0: number: s times the target x axis offset.
3175 \begin_layout Itemize
3176 yx: number: s times the source x coefficient of target y axis.
3179 \begin_layout Itemize
3180 yy: number: s times the source y coefficient of target y axis.
3183 \begin_layout Itemize
3184 y0: number: s times the target y axis offset.
3187 \begin_layout Itemize
3188 s: number: Scale of coordinates
3191 \begin_layout Itemize
3192 wrap: boolean: If true, wrap the texture.
3193 If false, read outside the texture as color 0.
3196 \begin_layout Standard
3197 Samples the source as texture, performing linear transform (with nearest-neighbo
3198 r sampling) and writes the result to this bitmap.
3199 \begin_inset Newpage pagebreak
3205 \begin_layout Subsection
3206 IMAGELOADER: Load an image
3209 \begin_layout Subsubsection
3210 Static function load: Load a bitmap from file
3213 \begin_layout Itemize
3214 Syntax: bitmap, palette gui.image.load(file, [base])
3217 \begin_layout Itemize
3218 Syntax: bitmap, palette classes.IMAGELOADER.load(file, [base])
3221 \begin_layout Itemize
3223 gui.bitmap_load(...)
3226 \begin_layout Standard
3230 \begin_layout Itemize
3231 file: string: The file to read.
3234 \begin_layout Itemize
3235 base: string: The base to resolve <file> relative to.
3238 \begin_layout Standard
3242 \begin_layout Itemize
3243 bitmap: BITMAP/DBITMAP: The new bitmap
3246 \begin_layout Itemize
3247 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3251 \begin_layout Standard
3252 Load a new bitmap and return it (plus associated palette if any).
3255 \begin_layout Subsubsection
3256 Static function load_str: Load a bitmap from string
3259 \begin_layout Itemize
3260 Syntax: bitmap, palette gui.image.load_str(data)
3263 \begin_layout Itemize
3264 Syntax: bitmap, palette classes.IMAGELOADER.load_str(data)
3267 \begin_layout Itemize
3269 gui.bitmap_load_str(...)
3272 \begin_layout Standard
3276 \begin_layout Itemize
3277 data: string: The image data
3280 \begin_layout Standard
3284 \begin_layout Itemize
3285 bitmap: BITMAP/DBITMAP: The new bitmap
3288 \begin_layout Itemize
3289 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3293 \begin_layout Standard
3294 Like IMAGELOADER:load, but read the bitmap from string <data> instead of
3298 \begin_layout Subsubsection
3299 Static function load_png: Load a bitmap from PNG file
3302 \begin_layout Itemize
3303 Syntax: bitmap, palette gui.image.load_png(file, [base])
3306 \begin_layout Itemize
3307 Syntax: bitmap, palette classes.IMAGELOADER.load_png(file, [base])
3310 \begin_layout Itemize
3312 gui.bitmap_load_png(...)
3315 \begin_layout Standard
3319 \begin_layout Itemize
3320 file: string: The file to read.
3323 \begin_layout Itemize
3324 base: string: The base to resolve <file> relative to.
3327 \begin_layout Standard
3331 \begin_layout Itemize
3332 bitmap: BITMAP/DBITMAP: The new bitmap
3335 \begin_layout Itemize
3336 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3340 \begin_layout Standard
3341 Like IMAGELOADER:load, but load a PNG file instead.
3344 \begin_layout Subsubsection
3345 Static function load_png_str: Load a PNG bitmap from string
3348 \begin_layout Itemize
3349 Syntax: bitmap, palette gui.image.load_png_str(data)
3352 \begin_layout Itemize
3353 Syntax: bitmap, palette classes.IMAGELOADER.load_png_str(data)
3356 \begin_layout Itemize
3358 gui.bitmap_load_png_str(...)
3361 \begin_layout Standard
3365 \begin_layout Itemize
3366 data: string: The image data, base64 encoded.
3369 \begin_layout Standard
3373 \begin_layout Itemize
3374 bitmap: BITMAP/DBITMAP: The new bitmap
3377 \begin_layout Itemize
3378 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3382 \begin_layout Standard
3383 Like IMAGELOADER:load_png, but read the bitmap from BASE64 encoded string
3384 <data> instead of file.
3387 \begin_layout Standard
3388 \begin_inset Newpage pagebreak
3394 \begin_layout Subsection
3395 CUSTOMFONT: Arbitrary-sized bitmap font
3398 \begin_layout Subsubsection
3399 Static function new: Return a new empty font
3402 \begin_layout Itemize
3403 Syntax: font gui.font.new()
3406 \begin_layout Itemize
3407 Syntax: font classes.CUSTOMFONT.new()
3410 \begin_layout Itemize
3411 Deprecated: font gui.font_new()
3414 \begin_layout Standard
3418 \begin_layout Itemize
3419 font: CUSTOMFONT: New font.
3422 \begin_layout Standard
3423 Create a new font with no characters and return it.
3426 \begin_layout Subsubsection
3427 Static function: load: Load a font file
3430 \begin_layout Itemize
3431 Syntax: font gui.font.load(file, [base])
3434 \begin_layout Itemize
3435 Syntax: font gui.font.load()
3438 \begin_layout Itemize
3439 Syntax: font classes.CUSTOMFONT.load(file, [base])
3442 \begin_layout Itemize
3443 Syntax: font classes.CUSTOMFONT.load()
3446 \begin_layout Itemize
3447 Deprecated: font gui.loadfont(...)
3450 \begin_layout Standard
3454 \begin_layout Itemize
3455 file: string: The file to read the font from
3458 \begin_layout Itemize
3459 base: string: The file to resolve <file> relative to.
3462 \begin_layout Standard
3466 \begin_layout Itemize
3467 font: CUSTOMFONT: New font.
3470 \begin_layout Standard
3471 Load font from file <file> (relative to <base>).
3472 If no filename is given, system default font is loaded.
3475 \begin_layout Subsubsection
3476 operator(): Render text to screen
3479 \begin_layout Itemize
3480 Syntax: font(x, y, text, [fgc], [bgc], [hlc])
3483 \begin_layout Standard
3487 \begin_layout Itemize
3488 font: CUSTOMFONT: The font to use.
3491 \begin_layout Itemize
3492 x: number: The x-position on screen to draw to.
3495 \begin_layout Itemize
3496 y: number: The y-position on screen to draw to.
3499 \begin_layout Itemize
3500 text: string: The text to draw.
3503 \begin_layout Itemize
3504 fgc: number/string: Foreground color (default white).
3507 \begin_layout Itemize
3508 bgc: number/string: Background color (default transparent).
3511 \begin_layout Itemize
3512 hlc: number/string: Outline color (default transparent).
3515 \begin_layout Standard
3516 Draws a string <text> with specified font <font> and colors <fgc>,<bgc>,<hlc>
3520 \begin_layout Itemize
3521 If <hlc> is transparent, no outline is drawn.
3524 \begin_layout Subsubsection
3525 Method edit: Alter glyph in font
3528 \begin_layout Itemize
3529 Syntax: font:edit(string character, bitmap glyph)
3532 \begin_layout Standard
3536 \begin_layout Itemize
3537 font: CUSTOMFONT: The font to edit.
3540 \begin_layout Itemize
3541 character: string: The character to edit (UTF-8 encoded).
3544 \begin_layout Itemize
3545 glyph: BITMAP: The bitmap to use.
3548 \begin_layout Standard
3549 Replace character <character> in font <font> by <glyph>.
3552 \begin_layout Itemize
3553 Color index 0 is background, everything else is foreground.
3556 \begin_layout Itemize
3557 <character> may be empty string, meaning the replacement character used
3561 \begin_layout Itemize
3562 <character> may be multi-codepoint string, meaning character used for that
3566 \begin_layout Subsubsection
3567 Method dump: Dump font into file
3570 \begin_layout Itemize
3571 Syntax: font:dump(string filename[, string base])
3574 \begin_layout Standard
3578 \begin_layout Itemize
3579 filename: string: The file to dump to
3582 \begin_layout Itemize
3583 base: string: The base filename
3586 \begin_layout Standard
3587 Dump contents of <font> in file <filename> (resolved relative to <base>).
3588 The dump is in format CUSTOMFONT:load() can load.
3591 \begin_layout Standard
3592 \begin_inset Newpage pagebreak
3598 \begin_layout Subsection
3599 ICONV: Character set conversions
3602 \begin_layout Subsubsection
3603 Static function new: Create new character set converter
3606 \begin_layout Itemize
3607 Syntax: iconv iconv.new(from, to);
3610 \begin_layout Itemize
3611 Syntax: iconv classes.ICONV.new(from, to);
3614 \begin_layout Itemize
3615 Deprecated: iconv iconv_new(...);
3618 \begin_layout Standard
3622 \begin_layout Itemize
3623 from: string: The source character set.
3626 \begin_layout Itemize
3627 to: string: The target character set.
3630 \begin_layout Standard
3634 \begin_layout Itemize
3635 iconv: ICONV: The converter.
3638 \begin_layout Standard
3639 Create a character set converter, converting from <from> to <to> and return
3643 \begin_layout Subsubsection
3644 Operator(): Convert string fragment from character set to another
3647 \begin_layout Itemize
3648 Syntax: success, result, unconverted, error iconv(input)
3651 \begin_layout Standard
3655 \begin_layout Itemize
3656 iconv: ICONV: The context to use.
3659 \begin_layout Itemize
3660 input: string: The input to convert.
3663 \begin_layout Standard
3667 \begin_layout Itemize
3668 success: boolean: True if conversion was successful, false if not.
3671 \begin_layout Itemize
3672 result: string: The string (partially) converted.
3675 \begin_layout Itemize
3676 unconvered: number: Number of bytes that were not converted (only if <success>
3680 \begin_layout Itemize
3681 error: string: Error that caused conversion to stop (only if <success> is
3683 \begin_inset Separator latexpar
3690 \begin_layout Itemize
3691 INVALID: The input string is invalid.
3694 \begin_layout Itemize
3695 INCOMPLETE: The input string cuts off in middle of character.
3698 \begin_layout Itemize
3699 INTERNALERR: Internal error.
3703 \begin_layout Standard
3704 Convert a string <input> using character set converter <iconv> and return
3708 \begin_layout Standard
3709 \begin_inset Newpage pagebreak
3715 \begin_layout Subsection
3716 FILEREADER: Read a file as a stream
3719 \begin_layout Subsubsection
3720 Static function open: Open a stream
3723 \begin_layout Itemize
3724 Syntax: handle filereader.open(file, [base])
3727 \begin_layout Itemize
3728 Syntax: handle classes.FILEREADER.open(file, [base])
3731 \begin_layout Itemize
3732 Deprecated: handle open_file(file, [base])
3735 \begin_layout Standard
3739 \begin_layout Itemize
3740 file: string: The filename to read.
3743 \begin_layout Itemize
3744 base: string: The base <file> is resolved against.
3747 \begin_layout Standard
3751 \begin_layout Itemize
3752 handle: FILEREADER: The new file reader.
3755 \begin_layout Standard
3756 Open file <file> (relative to <base>) and return a handle to it.
3759 \begin_layout Subsubsection
3760 operator(): Read line/bytes from stream
3763 \begin_layout Itemize
3764 Syntax: result handle()
3767 \begin_layout Itemize
3768 Syntax: result handle(bytes)
3771 \begin_layout Standard
3775 \begin_layout Itemize
3776 handle: FILEREADER: The handle to read from.
3779 \begin_layout Itemize
3780 bytes: Number of bytes to read (default is next line).
3783 \begin_layout Standard
3787 \begin_layout Itemize
3788 result: string: The read data, or nil on end-of-file.
3791 \begin_layout Standard
3792 Reads next line or <bytes> bytes from specified file handle <handle>.
3795 \begin_layout Itemize
3796 If reading specified number of bytes, the bytes are read in binary mode
3800 \begin_layout Itemize
3801 If reading next line, the line is read in text mode (any line ending is
3805 \begin_layout Subsubsection
3806 Method lines: Iterator to read all lines
3809 \begin_layout Itemize
3810 Syntax: for line in handle:lines() do ...
3814 \begin_layout Standard
3818 \begin_layout Itemize
3819 handle: FILEREADER: The handle to read.
3822 \begin_layout Standard
3826 \begin_layout Itemize
3827 A lua iterator with one variable.
3830 \begin_layout Standard
3831 Return a Lua iterator that iterates all the lines in <handle>.
3834 \begin_layout Standard
3835 \begin_inset Newpage pagebreak
3841 \begin_layout Subsection
3842 COMPARE_OBJ: Watch memory area for changes
3845 \begin_layout Standard
3846 Objects of this class allow fast checking for modifications to given memory
3850 \begin_layout Subsubsection
3851 Static function new: Create a checker
3854 \begin_layout Itemize
3855 Syntax: handle classes.COMPARE_OBJ.new({marea, offset|addrobj}, size, [rows,
3859 \begin_layout Itemize
3860 Syntax: handle memory.compare_new({marea, offset|addrobj}, size, rows, stride)
3863 \begin_layout Standard
3867 \begin_layout Itemize
3868 marea: string: The memory area to interpret <offset> against.
3871 \begin_layout Itemize
3872 offset: number: The initial offset in memory area.
3875 \begin_layout Itemize
3876 addrobj: ADDRESS: The memory address.
3879 \begin_layout Itemize
3880 size: number: The number of bytes in each row.
3883 \begin_layout Itemize
3884 rows: number: The number of rows.
3888 \begin_layout Itemize
3889 stride: number: The number of bytes offset increments from one row to next.
3892 \begin_layout Standard
3896 \begin_layout Itemize
3900 \begin_layout Standard
3901 Return an object watching specified memory area.
3904 \begin_layout Itemize
3905 Note: For fastest operation, limit checks to inside one memory area (that
3906 has to be mappable, individual RAM areas often are).
3909 \begin_layout Subsubsection
3910 operator(): Check area for modifications
3913 \begin_layout Itemize
3914 Syntax: boolean handle()
3917 \begin_layout Standard
3921 \begin_layout Itemize
3922 True if memory block has been modified since last call (or object creation
3923 if first call), false if not.
3926 \begin_layout Standard
3927 Check if the block has been modified.
3930 \begin_layout Subsection
3931 ADDRESS: Memory address
3934 \begin_layout Standard
3935 Objects of this class contain a memory address.
3938 \begin_layout Subsubsection
3939 Static function new: Create new memory address
3942 \begin_layout Itemize
3943 Syntax: ADDRESS classes.ADDRESS.new(string marea, number offset)
3946 \begin_layout Itemize
3947 Syntax: ADDRESS memory.address.new(string marea, number offset)
3950 \begin_layout Itemize
3951 Syntax: ADDRESS memory.mkaddr(string marea, number offset)
3954 \begin_layout Standard
3958 \begin_layout Itemize
3959 marea: The memory area
3962 \begin_layout Itemize
3963 offset: The offset in memory area.
3966 \begin_layout Standard
3970 \begin_layout Itemize
3974 \begin_layout Standard
3975 Construct a new memory address object.
3978 \begin_layout Subsubsection
3979 Method: addr: Get global address
3982 \begin_layout Itemize
3983 Syntax: number addr:addr()
3986 \begin_layout Standard
3990 \begin_layout Itemize
3991 addr: ADRESS: The original address.
3994 \begin_layout Standard
3998 \begin_layout Itemize
3999 The global address corresponding to this address.
4002 \begin_layout Subsubsection
4003 Method: vma: Get memory area
4006 \begin_layout Itemize
4007 Syntax: string addr:vma()
4010 \begin_layout Standard
4014 \begin_layout Itemize
4015 addr: ADRESS: The original address.
4018 \begin_layout Standard
4022 \begin_layout Itemize
4023 The memory area corresponding to this address.
4026 \begin_layout Subsubsection
4027 Method: offset: Get memory area offset
4030 \begin_layout Itemize
4031 Syntax: string addr:offset()
4034 \begin_layout Standard
4038 \begin_layout Itemize
4039 addr: ADRESS: The original address.
4042 \begin_layout Standard
4046 \begin_layout Itemize
4047 The offset in memory area corresponding to this address.
4050 \begin_layout Subsubsection
4051 Method: replace: Replace address part
4054 \begin_layout Itemize
4055 Syntax: ADDRESS addr:replace(offset[, bits])
4058 \begin_layout Standard
4062 \begin_layout Itemize
4063 addr: ADRESS: The original address.
4066 \begin_layout Itemize
4067 offset: number: The new offset
4070 \begin_layout Itemize
4071 bits: number: The number of LSB to replace.
4074 \begin_layout Standard
4078 \begin_layout Itemize
4079 The modified address
4082 \begin_layout Standard
4083 Returns a new address, with <bits> (all if missing) least significant bits
4084 of <addr> replaced by LSB of <offset>.
4087 \begin_layout Subsubsection
4088 Method: add: Add to address
4091 \begin_layout Itemize
4092 Syntax: ADDRESS addr:add(offset)
4095 \begin_layout Itemize
4096 Syntax: ADDRESS addr:add(number, stride)
4099 \begin_layout Itemize
4100 Syntax: ADDRESS addr:add(number, stride, offset)
4103 \begin_layout Standard
4107 \begin_layout Itemize
4108 addr: ADRESS: The original address.
4111 \begin_layout Itemize
4112 offset: number: Offset to add.
4115 \begin_layout Itemize
4116 number: number: Number of table strides to add.
4119 \begin_layout Itemize
4120 stride: number: The table stride.
4123 \begin_layout Standard
4127 \begin_layout Itemize
4128 The modified address
4131 \begin_layout Standard
4132 Adds <offset>, <number>*<stride> or <number>*<stride>+<offset> into specified
4136 \begin_layout Subsection
4137 ADDRESS:<op>: Read/Write memory
4140 \begin_layout Itemize
4141 Syntax: none addr:<op>(value)
4144 \begin_layout Itemize
4145 Syntax: number addr:<op>()
4148 \begin_layout Standard
4152 \begin_layout Itemize
4153 addr: ADDRESS: The address to read/write.
4156 \begin_layout Itemize
4157 value: number: The number to write.
4160 \begin_layout Standard
4164 \begin_layout Itemize
4168 \begin_layout Standard
4169 Read/Write value from/to given address <addr>.
4170 The value written is <value>.
4171 <Op> is of form: [i][s]<type>, where:
4174 \begin_layout Itemize
4175 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
4178 \begin_layout Itemize
4179 'i' signifies that the value is treated as opposite-to-normal endianess,
4182 \begin_layout Itemize
4183 's' signifies that value is treated as signed (not available for floating-point).
4186 \begin_layout Standard
4187 \begin_inset Newpage pagebreak
4193 \begin_layout Section
4197 \begin_layout Subsection
4198 print: Print values to console
4201 \begin_layout Itemize
4202 Syntax: none print(value...
4206 \begin_layout Standard
4207 Prints specified values to console.
4208 Can print any Lua type at least enough to identify the type and instance.
4211 \begin_layout Subsection
4212 tostringx: Format a value to string
4215 \begin_layout Itemize
4216 Syntax: string tostringx(value val)
4219 \begin_layout Standard
4220 Formats value <val> like print would, and returns the result as a string.
4223 \begin_layout Subsection
4224 exec: Execute lsnes commands
4227 \begin_layout Itemize
4228 Syntax: none exec(string cmd)
4231 \begin_layout Standard
4232 Execute lsnes command <cmd>.
4235 \begin_layout Subsection
4236 utime: Get current time
4239 \begin_layout Itemize
4240 Syntax: (number,number) utime()
4243 \begin_layout Standard
4244 Returns two numbers.
4245 First is time since some epoch in seconds, the second is microseconds mod
4246 10^6 since that epoch.
4249 \begin_layout Subsection
4250 set_idle_timeout: Run function after timeout when emulator is idle
4253 \begin_layout Itemize
4254 Syntax: none set_idle_timeout(number timeout)
4257 \begin_layout Standard
4258 Set number of microseconds to block idle for.
4259 After this timeout has expired, on_idle() will be called once.
4262 \begin_layout Subsection
4263 set_timer_timeout: Run function after timeout.
4266 \begin_layout Itemize
4267 Syntax: none set_timer_timeout(number timeout)
4270 \begin_layout Standard
4271 Set number of microseconds to block timer for.
4272 After this timeout has expired, on_timer() will be called once.
4275 \begin_layout Subsection
4276 bus_address: Look up address in system bus.
4279 \begin_layout Itemize
4280 Syntax: none bus_address(number bus_addr)
4283 \begin_layout Standard
4284 Returns virtual address corresponding to specified address on system bus.
4287 \begin_layout Subsection
4288 loopwrapper: Convert loop into callable function
4291 \begin_layout Itemize
4292 Syntax: function loopwrapper(function fun, ...)
4295 \begin_layout Standard
4296 Calls function <fun> with function and specified arguments.
4297 The function passed suspends execution until the function returned is called.
4298 Handy for linear flow control among multiple invocations of a hook.
4302 \begin_layout LyX-Code
4303 on_paint = loopwrapper(function(wait)
4304 \begin_inset Separator latexpar
4311 \begin_layout LyX-Code
4313 \begin_inset Separator latexpar
4320 \begin_layout LyX-Code
4322 \begin_inset Quotes eld
4326 \begin_inset Quotes erd
4332 \begin_layout LyX-Code
4337 \begin_layout LyX-Code
4342 \begin_layout LyX-Code
4346 \begin_layout Subsection
4347 list_bindings: List keybindings
4350 \begin_layout Itemize
4351 Syntax: table list_bindings([string cmd])
4354 \begin_layout Standard
4355 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
4356 If <cmd> is specified, the table is limited to that command.
4357 Also searches for controller keys.
4360 \begin_layout Subsection
4361 get_alias: Get expansion of alias
4364 \begin_layout Itemize
4365 Syntax: string get_alias(string aname)
4368 \begin_layout Standard
4369 Get expansion of given alias <aname>.
4372 \begin_layout Subsection
4373 set_alias: Set expansion of alias
4376 \begin_layout Itemize
4377 Syntax: none set_alias(string aname, string value)
4380 \begin_layout Standard
4381 Set expansion of given alias.
4384 \begin_layout Subsection
4385 create_ibind: Create invese binding
4388 \begin_layout Itemize
4389 Syntax: INVERSEBIND create_ibind(string name, string cmd)
4392 \begin_layout Standard
4393 Return object representing inverse binding with specified name <name> and
4394 specified command <cmd>.
4397 \begin_layout Itemize
4398 Note: To create press/release commands, use aliases +foo and -foo .
4401 \begin_layout Itemize
4402 Note: Keep the returned object around.
4405 \begin_layout Subsection
4406 create_command: Create a command
4409 \begin_layout Itemize
4410 Syntax: COMMANDBIND create_command(string name, function a)
4413 \begin_layout Itemize
4414 Syntax: COMMANDBIND create_command(string name, function a, function b)
4417 \begin_layout Standard
4418 Return object representing a command (pair).
4421 \begin_layout Itemize
4422 If only one function is specied, the command is level-sensitive, <a> is
4426 \begin_layout Itemize
4427 If <b> is function, the function is edge-sensitive, <a> is positive edge
4428 callback and <b> is negative edge callback.
4431 \begin_layout Itemize
4432 All callbacks get single argument: The parameters passed.
4435 \begin_layout Itemize
4436 Keep the returned object around.
4439 \begin_layout Subsection
4440 loadfile: Load Lua script
4443 \begin_layout Itemize
4444 Syntax: function loadfile(string filename[, string base])
4447 \begin_layout Standard
4448 Load lua script from <filename>, resolved relative to <base> (if empty,
4452 \begin_layout Subsection
4453 dofile: Execute Lua script
4456 \begin_layout Itemize
4457 Syntax: function dofile(string filename[, string base])
4460 \begin_layout Standard
4461 Execute lua script from <filename>, resolved relative to <base> (if empty,
4462 current directory) and return all return values.
4465 \begin_layout Subsection
4466 resolve_filename: Resolve name of file relative to another
4469 \begin_layout Itemize
4470 Syntax: string resolve_filename(string filename[, string base])
4473 \begin_layout Standard
4474 Resolve name of file <filename> relative to <base> and return the result.
4477 \begin_layout Subsection
4478 render_queue_function: Return paint function for render queue
4481 \begin_layout Itemize
4482 Syntax: function render_queue_function(RENDERQUEUE rq)
4485 \begin_layout Standard
4486 Return function that renders render queue <rq>.
4489 \begin_layout Itemize
4490 Handy for paint callback if one is using render queues updated in other
4495 \begin_layout LyX-Code
4496 handle = callback.paint:register(render_queue_function(my_rq));
4499 \begin_layout Subsection
4500 get_directory_contents: Get files in directory
4503 \begin_layout Itemize
4504 Syntax: table get_directory_contents(string name[, string base[, string
4508 \begin_layout Standard
4509 Return array containg all files in specified directory <name> (relative
4511 If <pattern> is specified, the filenames are matched to specified regex.
4512 The returned filenames inherit path.
4515 \begin_layout Subsection
4516 get_file_type: Get type of file
4519 \begin_layout Itemize
4520 Syntax: string/nil get_file_type(string path)
4523 \begin_layout Standard
4524 Return type of file <path>.
4525 Currently possible return values are:
4528 \begin_layout Itemize
4529 regular: regular file
4532 \begin_layout Itemize
4533 directory: subdirectory
4536 \begin_layout Itemize
4537 unknown: Exists, but type not known (not anything above).
4540 \begin_layout Itemize
4541 <nil>: File does not exist.
4544 \begin_layout Subsection
4545 identify_class: Identify class of object
4548 \begin_layout Itemize
4549 Syntax: string identify_class(userdata object)
4552 \begin_layout Standard
4553 Identifies the class of userdata <object>, if possible.
4554 If no identification is possible, returns
4555 \begin_inset Quotes eld
4559 \begin_inset Quotes erd
4565 \begin_layout Subsection
4566 lookup_class: Lookup class by name
4569 \begin_layout Itemize
4570 Syntax: classobj lookup_class(string name)
4573 \begin_layout Standard
4574 Looks up class corresponding to <name>, if possible.
4575 If not found, returns nil.
4576 The classobj has following fields:
4579 \begin_layout Itemize
4580 _static_methods: Return static method names
4583 \begin_layout Itemize
4584 _class_methods: Return class method names
4587 \begin_layout Itemize
4588 <static-function-name>: The specified static function.
4591 \begin_layout Subsection
4592 all_classes: Get list of all classes
4595 \begin_layout Itemize
4600 \begin_layout Standard
4601 Get names of all classes available.
4604 \begin_layout Subsection
4605 lsnes_features: Read feature flags
4608 \begin_layout Itemize
4609 Syntax: boolean lsnes_features(string feature)
4612 \begin_layout Standard
4613 Checks if feature <feature> is available, if it is, returns true, otherwise
4615 The following features are known:
4618 \begin_layout Itemize
4619 text-halos: gui.text supports halos (takes halo color argument).
4622 \begin_layout Subsection
4626 \begin_layout Standard
4630 \begin_layout Subsection
4631 filereader: Class FILEREADER
4634 \begin_layout Standard
4635 See class FILEREADER.
4638 \begin_layout Standard
4639 \begin_inset Newpage pagebreak
4645 \begin_layout Section
4649 \begin_layout Standard
4650 Bitwise logical functions and related.
4653 \begin_layout Subsection
4654 bit.none/bit.bnot: Bitwise none or NOT function
4657 \begin_layout Itemize
4658 Syntax: number bit.none(number...)
4661 \begin_layout Itemize
4662 Syntax: number bit.bnot(number...)
4665 \begin_layout Standard
4666 48-bit bitwise NOT / NONE function (set bits that are set in none of the
4670 \begin_layout Subsection
4671 bit.any/bit.bor: Bitwise any or OR function
4674 \begin_layout Itemize
4675 Syntax: number bit.any(number...)
4678 \begin_layout Itemize
4679 Syntax: number bit.bor(number...)
4682 \begin_layout Standard
4683 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
4686 \begin_layout Subsection
4687 bit.all/bit.band: Bitwise all or AND function
4690 \begin_layout Itemize
4691 Syntax: number bit.all(number...)
4694 \begin_layout Itemize
4695 Syntax: number bit.band(number...)
4698 \begin_layout Standard
4699 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
4703 \begin_layout Subsection
4704 bit.parity/bit.bxor: Bitwise parity or XOR function
4707 \begin_layout Itemize
4708 Syntax: number bit.parity(number...)
4711 \begin_layout Itemize
4712 Syntax: number bit.bxor(number...)
4715 \begin_layout Standard
4716 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
4720 \begin_layout Subsection
4721 bit.lrotate: Rotate a number left
4724 \begin_layout Itemize
4725 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
4728 \begin_layout Standard
4729 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4733 \begin_layout Subsection
4734 bit.rrotate: Rotate a number right
4737 \begin_layout Itemize
4738 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
4741 \begin_layout Standard
4742 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
4746 \begin_layout Subsection
4747 bit.lshift: Shift a number left
4750 \begin_layout Itemize
4751 Syntax: number bit.lshift(number base[, number amount[, number bits]])
4754 \begin_layout Standard
4755 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4757 The new bits are filled with zeroes.
4760 \begin_layout Subsection
4761 bit.lrshift: Shift a number right (logical)
4764 \begin_layout Itemize
4765 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
4768 \begin_layout Standard
4769 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4771 The new bits are filled with zeroes.
4774 \begin_layout Subsection
4775 bit.arshift: Shift a number right (arithmetic)
4778 \begin_layout Itemize
4779 Syntax: number bit.arshift(number base[, number amount[, number bits]])
4782 \begin_layout Standard
4783 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4785 The new bits are shifted in with copy of the high bit.
4788 \begin_layout Subsection
4789 bit.extract: Extract/shuffle bits from number
4792 \begin_layout Itemize
4793 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
4796 \begin_layout Standard
4797 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
4800 \begin_layout Itemize
4801 Note: Bit numbers up to 51 should work reliably (then things start falling
4802 apart due to double precision issues).
4805 \begin_layout Itemize
4806 Note: There are two special bit positions, true and false, standing for
4807 always set bit and always clear bit.
4810 \begin_layout Subsection
4811 bit.value: Construct number with specified bits set
4814 \begin_layout Itemize
4815 Syntax: number bit.value([number bit1[, number bit2,...]])
4818 \begin_layout Standard
4819 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
4820 <bit2> places and so on.
4821 As special value, nil argument is no-op.
4824 \begin_layout Subsection
4825 bit.test: Test if bit is set
4828 \begin_layout Itemize
4829 Syntax: boolean bit.test(number a, number bit)
4832 \begin_layout Standard
4833 Tests if bit <bit> is set in <a>.
4834 If it is set, returns true, otherwise false.
4837 \begin_layout Subsection
4838 bit.testn: Test if bit is clear
4841 \begin_layout Itemize
4842 Syntax: boolean bit.testn(number a, number bit)
4845 \begin_layout Standard
4846 Tests if bit <bit> is set in <a>.
4847 If it is clear, returns true, otherwise false.
4850 \begin_layout Subsection
4851 bit.test_any: Test if any bit is set
4854 \begin_layout Itemize
4855 Syntax: boolean bit.test_any(number a, number b)
4858 \begin_layout Standard
4859 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
4862 \begin_layout Subsection
4863 bit.test_all: Test if all bits are set
4866 \begin_layout Itemize
4867 Syntax: boolean bit.test_all(number a, number b)
4870 \begin_layout Standard
4871 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
4874 \begin_layout Subsection
4875 bit.popcount: Population count
4878 \begin_layout Itemize
4879 Syntax: number bit.popcount(number a)
4882 \begin_layout Standard
4883 Returns number of set bits in <a>.
4886 \begin_layout Subsection
4887 bit.clshift: Chained left shift
4890 \begin_layout Itemize
4891 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
4895 \begin_layout Standard
4896 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
4897 numbers to be of specified number of bits <bits> (default 48).
4900 \begin_layout Subsection
4901 bit.crshift: Chained right shift
4904 \begin_layout Itemize
4905 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
4909 \begin_layout Standard
4910 Does chained right shift on <a>, <b> by <amount> positions (default 1),
4911 assuming numbers to be of specified number of bits <bits> (default 48).
4914 \begin_layout Subsection
4915 bit.flagdecode: Decode bitfield into flags
4918 \begin_layout Itemize
4919 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
4923 \begin_layout Standard
4924 Return string of length bits where ith character is ith character of on
4925 if bit i is on, otherwise ith character of off.
4926 Out of range reads give last character.
4929 \begin_layout Itemize
4930 Note: <on> defaults to '*' if empty.
4933 \begin_layout Itemize
4934 Note: <off> defaults to '-' if empty.
4937 \begin_layout Subsection
4938 bit.rflagdecode: Decode bitfield into flags
4941 \begin_layout Itemize
4942 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
4946 \begin_layout Standard
4947 Like bit.flagdecode, but outputs the string in the opposite order (most significa
4951 \begin_layout Subsection
4952 bit.swap{,s}{,h,d,q}word: Swap word endian
4955 \begin_layout Itemize
4956 Syntax: number bit.swapword(number n)
4959 \begin_layout Itemize
4960 Syntax: number bit.swaphword(number n)
4963 \begin_layout Itemize
4964 Syntax: number bit.swapdword(number n)
4967 \begin_layout Itemize
4968 Syntax: number bit.swapqword(number n)
4971 \begin_layout Itemize
4972 Syntax: number bit.swapsword(number n)
4975 \begin_layout Itemize
4976 Syntax: number bit.swapshword(number n)
4979 \begin_layout Itemize
4980 Syntax: number bit.swapsdword(number n)
4983 \begin_layout Itemize
4984 Syntax: number bit.swapsqword(number n)
4987 \begin_layout Standard
4988 Swap endianess of (un)signed integer <n>.
4991 \begin_layout Subsection
4992 bit.compose: Compose multi-byte number
4995 \begin_layout Itemize
4996 Syntax: number bit.compose(number n...)
4999 \begin_layout Standard
5001 \begin_inset Formula $n_{1}+256n_{2}+256^{2}n_{3}+\ldots$
5007 \begin_layout Subsection
5008 bit.binary_ld_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Load binary integer
5011 \begin_layout Itemize
5012 Syntax: number bit.binary_ld_<type>le(string str, number pos);
5015 \begin_layout Itemize
5016 Syntax: number bit.binary_ld_<type>be(string str, number pos);
5019 \begin_layout Standard
5020 Load little (*le) or big (*be) endian binary number from position <pos>
5022 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
5026 \begin_layout Subsection
5027 bit.binary_st_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Store binary integer
5030 \begin_layout Itemize
5031 Syntax: string bit.binary_st_<type>le(number x);
5034 \begin_layout Itemize
5035 Syntax: string bit.binary_st_<type>be(number x);
5038 \begin_layout Standard
5039 Store specified number <x> as binary in string and return the result.
5040 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
5044 \begin_layout Subsection
5045 bit.quotent: Integer quotent
5048 \begin_layout Itemize
5049 Syntax: number bit.quotent(number a, number b)
5052 \begin_layout Standard
5053 Calculate quotent a/b.
5056 \begin_layout Subsection
5057 bit.multidiv: Divide and split among multiple divisiors
5060 \begin_layout Itemize
5062 bit.multidiv(number v, number q...)
5065 \begin_layout Standard
5066 Does the following steps:
5069 \begin_layout Enumerate
5073 \begin_layout Enumerate
5075 \begin_inset Separator latexpar
5082 \begin_layout Enumerate
5083 Calculate quotent(v'/q) and add that to numbers returned.
5086 \begin_layout Enumerate
5087 v' <- remainder(v'/q)
5091 \begin_layout Enumerate
5092 Add v' to numbers returned.
5095 \begin_layout Standard
5096 That is, it successively divides <v> by <q>s, and reduces <v> modulo <q>
5098 <v> may be floating point, <q>s are integers.
5101 \begin_layout Itemize
5103 bit.multidiv(time, 3600, 60) splits time into hours, minutes and seconds.
5106 \begin_layout Itemize
5108 bit.multidiv(a, b) calculates quotent and remainder of a/b.
5111 \begin_layout Subsection
5112 bit.mul32: 32-bit multiply
5115 \begin_layout Itemize
5116 Syntax: number, number bit.mul32(number a, number b)
5119 \begin_layout Standard
5120 Multiply 32-bit numbers <a> and <b>.
5121 The first return value is low 32 bits of result, the second is high 32
5125 \begin_layout Subsection
5126 bit.fextract: Extract bit field
5129 \begin_layout Itemize
5130 Syntax: number bit.fextract(number value, number shift, number width)
5133 \begin_layout Standard
5134 Extract <width> bits starting from bit <shift> from number <value>.
5135 This is more compact way to write
5136 \begin_inset Formula $\left(value\gg shift\right)\&\left(2^{width}-1\right)$
5142 \begin_layout Subsection
5143 bit.bfields: Split number into bit fields
5146 \begin_layout Itemize
5148 bit.bfields(number v, number q...)
5151 \begin_layout Standard
5152 Split a number <v> into bitfields of <q> bits (in order, from least significant
5153 towards more significant bits), with no padding in between.
5156 \begin_layout Itemize
5158 number of form 0 bbbbb ggggg rrrrr can be decoded to its component fields
5159 using r,g,b = bit.bfields(v, 5, 5, 5).
5163 \begin_layout Itemize
5165 number of form x yyyyyyy w zzzzzzz can be decode to its component fields
5166 using z, w, y, x = bit.bfields(v, 7, 1, 7, 1).
5169 \begin_layout Standard
5170 \begin_inset Newpage pagebreak
5176 \begin_layout Section
5180 \begin_layout Subsection
5181 classes.<foo>: The classobj for class <foo>
5184 \begin_layout Itemize
5185 Syntax: classes.<foo>
5188 \begin_layout Standard
5189 The classobj for class <foo>.
5192 \begin_layout Subsection
5193 classes.<foo>._static_methods: Enumerate static methods
5196 \begin_layout Itemize
5198 classes.<foo>._static_methods()
5201 \begin_layout Standard
5202 Returns all static methods of <foo> as strings.
5205 \begin_layout Subsection
5206 classes.<foo>._class_methods: Enumerate static methods
5209 \begin_layout Itemize
5211 classes.<foo>._class_methods()
5214 \begin_layout Standard
5215 Returns all class methods of <foo> as strings.
5218 \begin_layout Subsection
5219 classes.<foo>.<bar>: Static method
5222 \begin_layout Itemize
5223 Syntax: variable classes.<foo>.<bar>(variable...)
5226 \begin_layout Standard
5227 Invokes static method <bar> of class <foo>.
5230 \begin_layout Section
5234 \begin_layout Subsection
5235 gui.resolution: Get current resolution
5238 \begin_layout Itemize
5239 Syntax: (number, number) gui.resolution()
5242 \begin_layout Standard
5243 Returns 2-tuple (hresolution, vresolution).
5246 \begin_layout Subsection
5247 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
5250 \begin_layout Itemize
5251 Syntax: number gui.left_gap(number gap)
5254 \begin_layout Itemize
5255 Syntax: number gui.right_gap(number gap)
5258 \begin_layout Itemize
5259 Syntax: number gui.top_gap(number gap)
5262 \begin_layout Itemize
5263 Syntax: number gui.bottom_gap(number gap)
5266 \begin_layout Standard
5267 Set the specified edge gap to specified value <gap> (max gap is 8191).
5268 If successful, old gap is returned.
5271 \begin_layout Subsection
5272 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
5276 \begin_layout Itemize
5277 Syntax: number gui.delta_left_gap(number dgap)
5280 \begin_layout Itemize
5281 Syntax: number gui.delta_right_gap(number dgap)
5284 \begin_layout Itemize
5285 Syntax: number gui.delta_top_gap(number dgap)
5288 \begin_layout Itemize
5289 Syntax: number gui.delta_bottom_gap(number dgap)
5292 \begin_layout Standard
5293 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
5294 and return the old gap (returns nothing on error).
5297 \begin_layout Subsection
5298 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
5301 \begin_layout Itemize
5302 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
5303 bgc[, number hlc]]])
5306 \begin_layout Itemize
5307 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
5308 bgc[, number hlc]]])
5311 \begin_layout Itemize
5312 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
5313 bgc[, number hlc]]])
5316 \begin_layout Itemize
5317 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
5318 bgc[, number hlc]]])
5321 \begin_layout Standard
5322 Draw specified text on the GUI (each character cell is 8 or 16 wide and
5327 \begin_layout Itemize
5328 x: X-coordinate to start the drawing from (and x-coordinate at begining
5332 \begin_layout Itemize
5333 y: Y-coordinate to start the drawing from.
5336 \begin_layout Itemize
5337 text: The text to draw.
5340 \begin_layout Itemize
5341 fgc: Text color (default is 0xFFFFFF (white))
5344 \begin_layout Itemize
5345 bgc: Background color (default is -1 (transparent))
5348 \begin_layout Itemize
5349 hlc: Halo color (default is -1 (transparent))
5352 \begin_layout Standard
5353 Note: The H variants draw at double width and V variants draw at double
5355 Halo thickness is always 1 and is not doubled.
5358 \begin_layout Subsection
5359 gui.rectangle: Draw a rectangle
5362 \begin_layout Itemize
5363 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5364 number thickness[, number outline[, number fill]]])
5367 \begin_layout Standard
5368 Draw rectangle on the GUI.
5372 \begin_layout Itemize
5373 x: X-coordinate of left edge.
5376 \begin_layout Itemize
5377 y: Y-coordinate of upper edge.
5380 \begin_layout Itemize
5381 width: Width of rectangle.
5384 \begin_layout Itemize
5385 height: Height of rectangle.
5388 \begin_layout Itemize
5389 thickness: Thickness of outline (default is 1).
5392 \begin_layout Itemize
5393 outline: Color of outline (default is 0xFFFFFF (white))
5396 \begin_layout Itemize
5397 fill: Color of fill (default is -1 (transparent))
5400 \begin_layout Subsection
5401 gui.solidrectangle: Draw a solid rectangle
5404 \begin_layout Itemize
5405 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5409 \begin_layout Standard
5410 Draw solid rectangle on the GUI.
5414 \begin_layout Itemize
5415 x: X-coordinate of left edge.
5418 \begin_layout Itemize
5419 y: Y-coordinate of upper edge.
5422 \begin_layout Itemize
5423 width: Width of rectangle.
5426 \begin_layout Itemize
5427 height: Height of rectangle.
5430 \begin_layout Itemize
5431 color: Color of rectangle (default is 0xFFFFFF (white))
5434 \begin_layout Subsection
5435 gui.box: Draw a 3D-effect box
5438 \begin_layout Itemize
5439 Syntax: none gui.box(number x, number y, number width, number height[, number
5440 thickness[, number outline1[,number outline2[, number fill]]]])
5443 \begin_layout Standard
5444 Draw rectangle with 3D effect on the GUI.
5448 \begin_layout Itemize
5449 x: X-coordinate of left edge.
5452 \begin_layout Itemize
5453 y: Y-coordinate of upper edge.
5456 \begin_layout Itemize
5457 width: Width of rectangle.
5460 \begin_layout Itemize
5461 height: Height of rectangle.
5464 \begin_layout Itemize
5465 thickness: Thickness of outline (default is 1).
5468 \begin_layout Itemize
5469 outline1: First color of outline (default is 0xFFFFFF (white))
5472 \begin_layout Itemize
5473 outline2: First color of outline (default is 0x808080 (dark gray))
5476 \begin_layout Itemize
5477 fill: Color of fill (default is 0xC0C0C0 (light grayy))
5480 \begin_layout Subsection
5481 gui.pixel: Draw a single pixel
5484 \begin_layout Itemize
5485 Syntax: none gui.pixel(number x, number y[, number color])
5488 \begin_layout Standard
5489 Draw one pixel on the GUI.
5493 \begin_layout Itemize
5494 x: X-coordinate of the pixel
5497 \begin_layout Itemize
5498 y: Y-coordinate of the pixel
5501 \begin_layout Itemize
5502 color: Color of the pixel (default is 0xFFFFFF (white))
5505 \begin_layout Subsection
5506 gui.crosshair: Draw a crosshair
5509 \begin_layout Itemize
5510 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
5513 \begin_layout Standard
5518 \begin_layout Itemize
5519 x: X-coordinate of the crosshair
5522 \begin_layout Itemize
5523 y: Y-coordinate of the crosshair
5526 \begin_layout Itemize
5527 length: Length of the crosshair lines (default 10).
5530 \begin_layout Itemize
5531 color: Color of the crosshair (default is 0xFFFFFF (white))
5534 \begin_layout Subsection
5535 gui.line: Draw a line
5538 \begin_layout Itemize
5539 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
5543 \begin_layout Standard
5548 \begin_layout Itemize
5549 x1: X-coordinate of one end.
5552 \begin_layout Itemize
5553 y1: Y-coordinate of one end.
5556 \begin_layout Itemize
5557 x2: X-coordinate of the other end.
5560 \begin_layout Itemize
5561 y2: Y-coordinate of the other end.
5564 \begin_layout Itemize
5565 color: Color of the line (default is 0xFFFFFF (white)).
5568 \begin_layout Subsection
5569 gui.circle: Draw a (filled) circle
5572 \begin_layout Itemize
5573 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
5574 border[, number fil]]])
5577 \begin_layout Standard
5582 \begin_layout Itemize
5583 x: X-coordinate of the center
5586 \begin_layout Itemize
5587 y: Y-coordinate of the center
5590 \begin_layout Itemize
5591 r: The radius of the circle
5594 \begin_layout Itemize
5595 thick: Border thickness
5598 \begin_layout Itemize
5599 border: Border color (default is 0xFFFFFF (white))
5602 \begin_layout Itemize
5603 fill: Fill color (default is -1 (transparent)).
5606 \begin_layout Subsection
5607 gui.repaint: Arrange a repaint
5610 \begin_layout Itemize
5611 Syntax: none gui.repaint()
5614 \begin_layout Standard
5615 Request on_repaint() to happen as soon as possible.
5618 \begin_layout Subsection
5619 gui.subframe_update: Enable/Disable subframe updates
5622 \begin_layout Itemize
5623 Syntax: none gui.subframe_update(boolean on)
5626 \begin_layout Standard
5627 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
5628 or not happen (<on>=false).
5631 \begin_layout Subsection
5632 gui.screenshot: Write a screenshot
5635 \begin_layout Itemize
5636 Syntax: none gui.screenshot(string filename)
5639 \begin_layout Standard
5640 Write PNG screenshot of the current frame (no drawings) to specified file
5644 \begin_layout Subsection
5645 gui.screenshot_bitmap: Write a screenshot to bitmap
5648 \begin_layout Itemize
5649 Syntax: DBITMAP gui.screenshot_bitmap()
5652 \begin_layout Standard
5653 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
5657 \begin_layout Subsection
5658 gui.color: Compose a color.
5661 \begin_layout Itemize
5662 Syntax: number gui.color(number r, number g, number b[, number a])
5665 \begin_layout Itemize
5666 Syntax: number gui.color(string c)
5669 \begin_layout Standard
5670 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
5671 , each component in scale 0-255.
5672 If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
5674 The default alpha is 256.
5677 \begin_layout Standard
5678 The form taking a string returns color corresponding color name.
5681 \begin_layout Subsection
5682 gui.status: Set status variable
5685 \begin_layout Itemize
5686 Syntax: none gui.status(string name, string value)
5689 \begin_layout Standard
5691 \begin_inset Quotes eld
5695 \begin_inset Quotes erd
5698 to <value> in status area.
5701 \begin_layout Subsection
5702 gui.rainbow: Rainbow color calculation
5705 \begin_layout Itemize
5706 Syntax: number gui.rainbow(number step, number steps[, number color])
5709 \begin_layout Standard
5710 Perform hue rotation of color <color> (default bright red), by <step> steps.
5711 The number of steps per full rotation is given by absolute value of <steps>.
5714 \begin_layout Standard
5715 If <step> is negative, the rotation will be counterclockwise.
5718 \begin_layout Subsection
5719 gui.kill_frame: Kill video frame and associated sound
5722 \begin_layout Itemize
5723 Syntax: none gui.kill_frame()
5726 \begin_layout Standard
5727 Kills the currently dumped video frame + the associated sound.
5728 Only valid in on_video callback.
5731 \begin_layout Subsection
5732 gui.set_video_scale: Set video frame scale
5735 \begin_layout Itemize
5736 Syntax: none gui.set_video_scale(number h, number v)
5739 \begin_layout Standard
5740 Sets the scale factors of current frame to <h>x<v>.
5741 Only valid in on_video callback.
5744 \begin_layout Subsection
5745 gui.arrow: Draw an arrow
5748 \begin_layout Itemize
5749 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
5750 number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
5754 \begin_layout Standard
5755 Draws an arrow using color <color>.
5756 The tip of arrow is at (<x>, <y>).
5760 \begin_layout Enumerate
5761 <length>: The length of arrow tail.
5764 \begin_layout Enumerate
5765 <hwidth>: The width of arrow head.
5769 \begin_layout Enumerate
5770 <direction>: Direction of arrow.
5771 0 is to right, +1 rotates 45 degrees counterclockwise.
5774 \begin_layout Enumerate
5775 <fill>: If true, fill the arrow head.
5779 \begin_layout Enumerate
5780 <twidth>: Tail width.
5785 \begin_layout Enumerate
5786 <hthick>: Head thickness (only used if <fill> is false).
5787 Default is <twidth>.
5790 \begin_layout Subsection
5791 gui.tiled_bitmap: Class TILEMAP
5794 \begin_layout Standard
5798 \begin_layout Subsection
5799 gui.palette: Class PALETTE
5802 \begin_layout Standard
5806 \begin_layout Subsection
5807 gui.bitmap: Class BITMAP
5810 \begin_layout Standard
5814 \begin_layout Subsection
5815 gui.dbitmap: Class DBITMAP
5818 \begin_layout Standard
5822 \begin_layout Subsection
5823 gui.font: Class CUSTOMFONT
5826 \begin_layout Standard
5827 See class CUSTOMFONT.
5830 \begin_layout Subsection
5831 gui.renderctx: Class RENDERCTX
5834 \begin_layout Standard
5835 See class RENDERCTX.
5838 \begin_layout Subsection
5839 gui.image: Class IMAGELOADER
5842 \begin_layout Standard
5843 See class IMAGELOADER.
5846 \begin_layout Subsection
5847 gui.get_runmode: Get current emulator mode
5850 \begin_layout Itemize
5851 Syntax: string gui.get_runmode()
5854 \begin_layout Standard
5855 Gets the current emulator runmode.
5856 The possible ones are:
5859 \begin_layout Itemize
5860 quit: Emulator is quitting.
5863 \begin_layout Itemize
5864 normal: Emulator is running emulation
5867 \begin_layout Itemize
5868 load: Emulator is loading a movie/savestate
5871 \begin_layout Itemize
5872 advance_frame: Emulator is doing frame advance
5875 \begin_layout Itemize
5876 advance_subframe: Emulator is doing subframe advance
5879 \begin_layout Itemize
5880 skiplag: Emulator is skipping lag frames
5883 \begin_layout Itemize
5884 skiplag_pending: Emulator will start skipping lag frames next frame
5887 \begin_layout Itemize
5888 pause: Emulator is paused
5891 \begin_layout Itemize
5892 pause_break: Emulator is paused at breakpoint
5895 \begin_layout Itemize
5896 corrupt: Emulator can't run because corrupt emulation state
5899 \begin_layout Itemize
5900 unknown: Unknown state (should not happen).
5903 \begin_layout Standard
5904 \begin_inset Newpage pagebreak
5910 \begin_layout Section
5914 \begin_layout Standard
5916 Functions manipulating input are only available in on_input callback.
5919 \begin_layout Subsection
5920 input.get: Read controller button/axis (deprecated)
5923 \begin_layout Itemize
5924 Syntax: number input.get(number controller, number index)
5927 \begin_layout Standard
5928 Read the specified index <index> (zero-based) from specified controller
5929 <controller> (zero-based).
5933 \begin_layout Subsection
5934 input.set: Write controller button/axis (deprecated)
5937 \begin_layout Itemize
5938 Syntax: none input.set(number controller, number index, number value)
5941 \begin_layout Standard
5942 Write the specified index <index> (zero-based) from specified controller
5943 <controller> (zero-based), storing value <value>.
5946 \begin_layout Subsection
5947 input.get2: Read controller button/axis
5950 \begin_layout Itemize
5951 Syntax: number input.get2(number port, number controller, number index)
5954 \begin_layout Standard
5955 Read the specified input tuple.
5956 Port 0 is system port.
5959 \begin_layout Subsection
5960 input.set2: Write controller button/axis
5963 \begin_layout Itemize
5964 Syntax: input.set2(number port, number controller, number index, number value)
5967 \begin_layout Standard
5968 Write the specified input tuple.
5969 Port 0 is system port.
5972 \begin_layout Subsection
5973 input.lcid_to_pcid2: Look up logical controller
5976 \begin_layout Itemize
5977 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
5980 \begin_layout Standard
5981 Look up physical pcid pair (port, controller) corresponding to specified
5982 logical controller (1-based).
5983 Returns nothing if controller does not exist.
5986 \begin_layout Subsection
5987 input.port_type: Look up port type
5990 \begin_layout Itemize
5991 Syntax: string input.port_type(number port)
5994 \begin_layout Standard
5995 Return type of specified port.
5998 \begin_layout Subsection
5999 input.controller_info: Get information about controller
6002 \begin_layout Itemize
6003 Syntax: table input.controller_info(number port, number controller)
6006 \begin_layout Standard
6007 Get controller info for specified controller.
6008 If controller does not exist, returns nil.
6009 Otherwise returns a table with following fields:
6012 \begin_layout Itemize
6013 type (string): Type of the controller.
6016 \begin_layout Itemize
6017 class (string): Class of the controller.
6020 \begin_layout Itemize
6021 classnum (number): Number of the controller within its class (1-based)
6024 \begin_layout Itemize
6025 lcid (number): Logical controller number of the controller.
6028 \begin_layout Itemize
6029 button_count (number): Number of buttons on controller
6032 \begin_layout Itemize
6033 buttons (array): Array of following info about each button:
6034 \begin_inset Separator latexpar
6041 \begin_layout Itemize
6042 type (string): Type of button.
6044 \begin_inset Quotes eld
6048 \begin_inset Quotes erd
6052 \begin_inset Quotes eld
6056 \begin_inset Quotes erd
6060 \begin_inset Quotes eld
6064 \begin_inset Quotes erd
6068 \begin_inset Quotes eld
6072 \begin_inset Quotes erd
6078 \begin_layout Itemize
6079 name (string): Name of button.
6082 \begin_layout Itemize
6083 symbol (string): Symbol of button.
6084 Only present for type
6085 \begin_inset Quotes eld
6089 \begin_inset Quotes erd
6095 \begin_layout Itemize
6096 hidden (boolean): True if hidden button.
6101 \begin_layout Subsection
6102 input.veto_button: Veto a button press
6105 \begin_layout Itemize
6106 Syntax: none input.veto_button()
6109 \begin_layout Standard
6110 Signals that the button event should be vetoed.
6111 Only valid in on_button callback.
6114 \begin_layout Subsection
6115 input.geta: Get all buttons for controller (deprecated)
6118 \begin_layout Itemize
6119 Syntax: (number, number...) input.geta(number controller)
6122 \begin_layout Standard
6123 Get input state for entiere controller.
6124 Returns n return values.
6127 \begin_layout Itemize
6128 1st return value: Bitmask: bit i is set if i:th index is nonzero
6131 \begin_layout Itemize
6132 2nd- return value: value of i:th index.
6135 \begin_layout Subsection
6136 input.seta: Set all buttons for controller (deprecated)
6139 \begin_layout Itemize
6140 Syntax: none input.seta(number controller, number bitmask, number args...)
6143 \begin_layout Standard
6144 Set state for entiere controller.
6145 args is up to N values for indices (overriding values in bitmask if specified).
6148 \begin_layout Subsection
6149 input.controllertype: Get controller type (deprecated)
6152 \begin_layout Itemize
6153 syntax: string input.controllertype(number controller)
6156 \begin_layout Standard
6157 Get the type of controller as string.
6160 \begin_layout Subsection
6161 input.reset: Execute (delayed) reset
6164 \begin_layout Itemize
6165 Syntax: none input.reset([number cycles])
6168 \begin_layout Standard
6170 If <cycles> is greater than zero, do delayed reset.
6171 0 (or no value) causes immediate reset.
6174 \begin_layout Itemize
6175 Note: Only available with subframe flag false.
6178 \begin_layout Subsection
6179 input.raw: Return raw input data
6182 \begin_layout Itemize
6183 Syntax: table input.raw()
6186 \begin_layout Standard
6187 Returns table of tables of all available keys and axes.
6188 The first table is indexed by key name (platform-dependent!), and the inner
6189 table has the following fields:
6192 \begin_layout Itemize
6193 value: Last reported value for control
6194 \begin_inset Separator latexpar
6201 \begin_layout Itemize
6202 For keys: 1 for pressed, 0 for released.
6205 \begin_layout Itemize
6206 For axes: -32767...32767.
6209 \begin_layout Itemize
6210 For presure-sensitive buttons: 0...32767.
6213 \begin_layout Itemize
6214 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
6217 \begin_layout Itemize
6218 For mouse: Coordinates relative to game area.
6222 \begin_layout Itemize
6223 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
6226 \begin_layout Subsection
6227 input.keyhook: Hook a key
6230 \begin_layout Itemize
6231 Syntax: none input.keyhook(string key, boolean state)
6234 \begin_layout Standard
6235 Requests that keyhook events to be sent for key <key> (<state>=true) or
6236 not sent (<state>=false).
6239 \begin_layout Subsection
6240 input.joyget: Get controls for controller
6243 \begin_layout Itemize
6244 Syntax: table input.joyget(number logical)
6247 \begin_layout Standard
6248 Returns table for current controls for specified logical controller <logical>.
6249 The names of fields vary by controller type.
6252 \begin_layout Itemize
6253 The buttons have the same name as those are referred to in other contexts
6257 \begin_layout Itemize
6258 The analog axes are usually
6259 \begin_inset Quotes eld
6263 \begin_inset Quotes erd
6267 \begin_inset Quotes eld
6271 \begin_inset Quotes erd
6277 \begin_layout Itemize
6278 Each field is numeric or boolean depending on axis/button.
6281 \begin_layout Subsection
6282 input.joyset: Set controls for controller
6285 \begin_layout Itemize
6286 Syntax: none input.joyset(number controller, table controls)
6289 \begin_layout Standard
6290 Set the the state of specified controller to values specified in specified
6294 \begin_layout Itemize
6295 Each field can be boolean or number.
6298 \begin_layout Itemize
6299 Also, buttons allow strings, which cause value to be inverted.
6302 \begin_layout Subsection
6303 input.lcid_to_pcid: Look up logical controller (deprecated)
6306 \begin_layout Itemize
6307 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
6310 \begin_layout Standard
6311 Returns the legacy pcid for controller (or false if there isn't one), followed
6313 Returns nothing if controller does not exist.
6316 \begin_layout Standard
6317 \begin_inset Newpage pagebreak
6323 \begin_layout Section
6327 \begin_layout Standard
6328 Various keybinding-related functions
6331 \begin_layout Subsection
6332 keyboard.bind: Bind a key
6335 \begin_layout Itemize
6336 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
6339 \begin_layout Standard
6340 Bind specified key with specified modifers to specified command.
6343 \begin_layout Subsection
6344 keyboard.unbind: Unbind a key
6347 \begin_layout Itemize
6348 Syntax: none keyboard.unbind(string mod, string mask, string key)
6351 \begin_layout Standard
6352 Unbind specified key with specified modifers.
6355 \begin_layout Subsection
6356 keyboard.alias: Set alias expansion
6359 \begin_layout Itemize
6360 Syntax: none keyboard.alias(string alias, string expansion)
6363 \begin_layout Standard
6364 Set expansion of given command.
6367 \begin_layout Standard
6368 \begin_inset Newpage pagebreak
6374 \begin_layout Section
6378 \begin_layout Standard
6382 \begin_layout Subsection
6383 subtitle.byindex: Look up start and length of subtitle by index
6386 \begin_layout Itemize
6387 Syntax: (number, number) subtitle.byindex(number i)
6390 \begin_layout Standard
6391 Read the frame and length of ith subtitle.
6392 Returns nothing if not present.
6395 \begin_layout Subsection
6396 subtitle.set: Write a subtitle
6399 \begin_layout Itemize
6400 Syntax: none subtitle.set(number f, number l, string txt)
6403 \begin_layout Standard
6404 Set the text of subtitle.
6407 \begin_layout Subsection
6408 subtitle.get: Read a subtitle
6411 \begin_layout Itemize
6412 Syntax: string subtitle.get(number f, number l)
6415 \begin_layout Standard
6416 Get the text of subtitle.
6419 \begin_layout Subsection
6420 subtitle.delete: Delete a subtitle
6423 \begin_layout Itemize
6424 Syntax: none subtitle.delete(number f, number l)
6427 \begin_layout Standard
6428 Delete specified subtitle.
6431 \begin_layout Standard
6432 \begin_inset Newpage pagebreak
6438 \begin_layout Section
6442 \begin_layout Standard
6443 Host memory handling (extra memory saved to savestates).
6444 Host memory starts empty.
6447 \begin_layout Itemize
6448 Reads out of range return false.
6451 \begin_layout Itemize
6452 Writes out of range extend the memory.
6455 \begin_layout Subsection
6456 hostmemory.read: Read byte from host memory
6459 \begin_layout Itemize
6460 Syntax: number hostmemory.read(number address)
6463 \begin_layout Standard
6464 Reads byte from hostmemory slot address <address>.
6467 \begin_layout Subsection
6468 hostmemory.write: Write byte to host memory
6471 \begin_layout Itemize
6472 Syntax: none hostmemory.write(number address, number value)
6475 \begin_layout Standard
6476 Writes hostmemory slot with value <value> 0-255.
6479 \begin_layout Subsection
6480 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
6483 \begin_layout Itemize
6484 Syntax: number hostmemory.readbyte(number address)
6487 \begin_layout Itemize
6488 Syntax: number hostmemory.readsbyte(number address)
6491 \begin_layout Itemize
6492 Syntax: number hostmemory.readword(number address)
6495 \begin_layout Itemize
6496 Syntax: number hostmemory.readsword(number address)
6499 \begin_layout Itemize
6500 Syntax: number hostmemory.readhword(number address)
6503 \begin_layout Itemize
6504 Syntax: number hostmemory.readshword(number address)
6507 \begin_layout Itemize
6508 Syntax: number hostmemory.readdword(number address)
6511 \begin_layout Itemize
6512 Syntax: number hostmemory.readsdword(number address)
6515 \begin_layout Itemize
6516 Syntax: number hostmemory.readqword(number address)
6519 \begin_layout Itemize
6520 Syntax: number hostmemory.readsqword(number address)
6523 \begin_layout Standard
6524 Read elements (big-endian) from given address <address>.
6527 \begin_layout Itemize
6531 \begin_layout Itemize
6535 \begin_layout Itemize
6539 \begin_layout Itemize
6543 \begin_layout Itemize
6544 qword is 8 elements.
6547 \begin_layout Itemize
6548 The 's' variants do signed read.
6551 \begin_layout Subsection
6552 hostmemory.read{float,double}: Read from host memory
6555 \begin_layout Itemize
6556 syntax: number hostmemory.readfloat(number address)
6559 \begin_layout Itemize
6560 Syntax: number hostmemory.readdouble(number address)
6563 \begin_layout Standard
6564 Read elements (big-endian) floating-pont from given address <address>.
6567 \begin_layout Subsection
6568 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
6571 \begin_layout Itemize
6572 Syntax: number hostmemory.writebyte(number address, number value)
6575 \begin_layout Itemize
6576 Syntax: number hostmemory.writesbyte(number address, number value)
6579 \begin_layout Itemize
6580 Syntax: number hostmemory.writeword(number address, number value)
6583 \begin_layout Itemize
6584 Syntax: number hostmemory.writesword(number address, number value)
6587 \begin_layout Itemize
6588 Syntax: number hostmemory.writehword(number address, number value)
6591 \begin_layout Itemize
6592 Syntax: number hostmemory.writeshword(number address, number value)
6595 \begin_layout Itemize
6596 Syntax: number hostmemory.writedword(number address, number value)
6599 \begin_layout Itemize
6600 Syntax: number hostmemory.writesdword(number address, number value)
6603 \begin_layout Itemize
6604 Syntax: number hostmemory.writeqword(number address, number value)
6607 \begin_layout Itemize
6608 Syntax: number hostmemory.writesqword(number address, number value)
6611 \begin_layout Standard
6612 Write value <value> to elements (little-endian) starting from given address
6616 \begin_layout Itemize
6620 \begin_layout Itemize
6624 \begin_layout Itemize
6628 \begin_layout Itemize
6632 \begin_layout Itemize
6633 qword is 8 elements.
6636 \begin_layout Itemize
6637 The 's' variants do signed write.
6640 \begin_layout Subsection
6641 hostmemory.write{float,double}: Write to host memory
6644 \begin_layout Itemize
6645 syntax: none hostmemory.readfloat(number address, number value)
6648 \begin_layout Itemize
6649 Syntax: none hostmemory.readdouble(number address, number value)
6652 \begin_layout Standard
6653 Write elements (big-endian) floating-pont to given address <address>, storing
6657 \begin_layout Standard
6658 \begin_inset Newpage pagebreak
6664 \begin_layout Section
6668 \begin_layout Standard
6672 \begin_layout Subsection
6673 movie.currentframe: Get current frame number
6676 \begin_layout Itemize
6677 Syntax: number movie.currentframe()
6680 \begin_layout Standard
6681 Return number of current frame.
6684 \begin_layout Subsection
6685 movie.framecount: Get move frame count
6688 \begin_layout Itemize
6689 Syntax: number movie.framecount()
6692 \begin_layout Standard
6693 Return number of frames in movie.
6696 \begin_layout Subsection
6697 movie.lagcount: Get current lag count
6700 \begin_layout Itemize
6701 Syntax: number movie.lagcount()
6704 \begin_layout Standard
6705 Return number of lag frames recorded so far.
6708 \begin_layout Subsection
6709 movie.readonly: Is in playback mode?
6712 \begin_layout Itemize
6713 Syntax: boolean movie.readonly()
6716 \begin_layout Standard
6717 Return true if in playback mode, false if in recording.
6720 \begin_layout Subsection
6721 movie.rerecords: Movie rerecord count
6724 \begin_layout Itemize
6725 Syntax: number movie.rerecords()
6728 \begin_layout Standard
6729 Returns the current value of rerecord count.
6732 \begin_layout Subsection
6733 movie.set_readwrite: Set recording mode.
6736 \begin_layout Itemize
6737 Syntax: none movie.set_readwrite()
6740 \begin_layout Standard
6741 Set recording mode (does not cause on_readwrite callback).
6744 \begin_layout Subsection
6745 movie.frame_subframes: Count subframes in frame
6748 \begin_layout Itemize
6749 Syntax: number movie.frame_subframes(number frame)
6752 \begin_layout Standard
6753 Count number of subframes in specified frame <frame> (frame numbers are
6754 1-based) and return that.
6757 \begin_layout Subsection
6758 movie.read_subframes: Read subframe data (deprecated)
6761 \begin_layout Itemize
6762 Syntax: table movie.read_subframes(number frame, number subframe)
6765 \begin_layout Standard
6766 Read specifed subframe in specified frame and return data as array.
6769 \begin_layout Subsection
6770 movie.read_rtc: Read current RTC time
6773 \begin_layout Itemize
6774 Syntax: (number, number) movie.read_rtc()
6777 \begin_layout Standard
6778 Returns the current value of the RTC as a pair (second, subsecond).
6781 \begin_layout Subsection
6782 movie.unsafe_rewind: Fast movie rewind to saved state
6785 \begin_layout Itemize
6786 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
6789 \begin_layout Standard
6790 Start setting point for unsafe rewind or jump to point of unsafe rewind.
6793 \begin_layout Itemize
6794 If called without argument, causes emulator to start process of setting
6795 unsafe rewind point.
6796 When this has finished, callback on_set_rewind occurs, passing the rewind
6797 state to lua script.
6800 \begin_layout Itemize
6801 If called with argument, causes emulator rewind to passed rewind point as
6803 recording mode is implicitly activated.
6806 \begin_layout Standard
6807 The following warnings apply to unsafe rewinding:
6810 \begin_layout Itemize
6811 There are no safety checks against misuse (that's what
6812 \begin_inset Quotes eld
6816 \begin_inset Quotes erd
6822 \begin_layout Itemize
6823 Only call rewind from timeline rewind point was set from.
6826 \begin_layout Itemize
6827 Only call rewind from after the rewind point was set.
6830 \begin_layout Subsection
6831 movie.to_rewind: Load savestate as rewind point
6834 \begin_layout Itemize
6835 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
6838 \begin_layout Standard
6839 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
6840 corresponding to it.
6843 \begin_layout Itemize
6844 Note: This operation does not take emulated time.
6847 \begin_layout Subsection
6848 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
6851 \begin_layout Itemize
6852 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE/string movie])
6855 \begin_layout Itemize
6856 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
6859 \begin_layout Standard
6860 Copies specified movie or branch <movie>/current object (if none or nil,
6861 the active movie) as new movie object.
6864 \begin_layout Subsection
6865 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
6868 \begin_layout Itemize
6869 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE/string movie,] number frame)
6872 \begin_layout Itemize
6873 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
6876 \begin_layout Standard
6877 Get INPUTFRAME object corresponding to specified frame in specified movie
6881 \begin_layout Subsection
6882 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
6885 \begin_layout Itemize
6886 Syntax: none movie.set_frame([INPUTMOVIE/string movie,] number frame, INPUTFRAME
6890 \begin_layout Itemize
6891 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
6894 \begin_layout Standard
6895 Set data in specified frame.
6898 \begin_layout Itemize
6899 Note: Past can't be edited in active movie.
6902 \begin_layout Subsection
6903 movie.get_size/INPUTMOVIE::get_size: Get size of movie
6906 \begin_layout Itemize
6907 Syntax: integer movie.get_size([INPUTMOVIE/string movie])
6910 \begin_layout Itemize
6911 Syntax: integer INPUTMOVIE::get_size()
6914 \begin_layout Standard
6915 Return number of subframes in specified movie or branch.
6918 \begin_layout Subsection
6919 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
6922 \begin_layout Itemize
6923 Syntax: number movie.count_frames([INPUTMOVIE/string movie])
6926 \begin_layout Itemize
6927 Syntax: number INPUTMOVIE::count_frames()
6930 \begin_layout Standard
6931 Return number of frames in movie.
6934 \begin_layout Subsection
6935 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
6938 \begin_layout Itemize
6939 Syntax: number movie.find_frame([INPUTMOVIE/string movie], number frame)
6942 \begin_layout Itemize
6943 Syntax: number INPUTMOVIE::find_frame(number frame)
6946 \begin_layout Standard
6947 Returns starting subframe of given frame (frame numbers are 1-based).
6948 Returns -1 if frame number is bad.
6951 \begin_layout Subsection
6952 movie.subframe_to_frame/INPUTMOVIE::subframe_to_frame: Find frame corresponding
6956 \begin_layout Itemize
6957 Syntax: number movie.subframe_to_frame([INPUTMOVIE/string movie], number
6961 \begin_layout Itemize
6962 Syntax: number INPUTMOVIE::subframe_to_frame(number subframe)
6965 \begin_layout Standard
6966 Returns frame containing given subframe (subframe numbers are 0-based).
6967 Returns -1 if subframe number is bad.
6970 \begin_layout Subsection
6971 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
6974 \begin_layout Itemize
6975 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE/string movie])
6978 \begin_layout Itemize
6979 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
6982 \begin_layout Standard
6983 Return blank INPUTFRAME with frame type from specified movie.
6986 \begin_layout Subsection
6987 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
6990 \begin_layout Itemize
6991 Syntax: none movie.append_frames([INPUTMOVIE/string movie,] number frames)
6994 \begin_layout Itemize
6995 Syntax: none INPUTMOVIE::append_frames(number frames)
6998 \begin_layout Standard
6999 Append specified number <frames> of frames.
7002 \begin_layout Subsection
7003 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
7006 \begin_layout Itemize
7007 Syntax: none movie.append_frame([INPUTMOVIE/string movie,] INPUTFRAME frame)
7010 \begin_layout Itemize
7011 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
7014 \begin_layout Standard
7015 Append specified frame <frame>.
7016 Past of current movie can't be edited.
7019 \begin_layout Subsection
7020 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
7023 \begin_layout Itemize
7024 Syntax: none movie.truncate([INPUTMOVIE/string movie,] number frames)
7027 \begin_layout Itemize
7028 Syntax: none INPUTMOVIE::truncate(number frames)
7031 \begin_layout Standard
7032 Truncate the specified movie to specified number of frames.
7035 \begin_layout Subsection
7036 movie.edit/INPUTMOVIE::edit: Edit a movie
7039 \begin_layout Itemize
7040 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
7041 controller, number control, number/bool value)
7044 \begin_layout Itemize
7045 Syntax: none movie.edit(string branch, number frame, number port, number
7046 controller, number control, number/bool value)
7049 \begin_layout Itemize
7050 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
7051 number control, number/bool value)
7054 \begin_layout Standard
7055 Change specified control in specified frame in specified movie.
7056 Past can't be edited in active movie.
7059 \begin_layout Subsection
7060 movie.copy_frames2: Copy frames between movies
7063 \begin_layout Itemize
7064 Syntax: none movie.copy_frames2([INPUTMOVIE/string dstmov,] number dst, [INPUTMOV
7065 IE/string srcmov,] number src, number count)
7068 \begin_layout Standard
7069 Copy specified number of frames between two movies.
7070 The copy proceeeds in forward direction.
7073 \begin_layout Subsection
7074 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
7077 \begin_layout Itemize
7078 Syntax: none movie.copy_frames([INPUTMOVIE/string mov,] number dst, number
7079 src, number count, bool backwards)
7082 \begin_layout Itemize
7083 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
7087 \begin_layout Standard
7088 Copy specified number of frames from one point in movie to another.
7089 If backwards is true, the copy will be done backwards.
7092 \begin_layout Subsection
7093 movie.serialize/INPUTMOVIE::serialize: Serialize movie
7096 \begin_layout Itemize
7097 Syntax: none movie.serialize([INPUTMOVIE movie/string,] string filename,
7101 \begin_layout Itemize
7102 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
7105 \begin_layout Standard
7106 Serialize given movie into file.
7107 If binary is true, binary format (more compact and much faster) is used.
7110 \begin_layout Subsection
7111 movie.unserialize: Unserialize movie
7114 \begin_layout Itemize
7115 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
7119 \begin_layout Standard
7120 Unserialize movie from file.
7121 The given frame is used as template to decide the frame type.
7122 If binary is true, binary format is decoded (much faster).
7125 \begin_layout Subsection
7126 movie.current_first_subframe: Return first subframe in current frame
7129 \begin_layout Itemize
7130 Syntax: number movie.current_first_subframe()
7133 \begin_layout Standard
7134 Returns first subframe in current frame.
7137 \begin_layout Subsection
7138 movie.pollcounter: Return poll counter for speified control
7141 \begin_layout Itemize
7142 Syntax: number movie.pollcounter(number port, number controller, number control)
7145 \begin_layout Standard
7146 Returns number of times the specified control has been polled this frame.
7149 \begin_layout Subsection
7150 movie.current_branch: Return current branch
7153 \begin_layout Itemize
7154 Syntax: string movie.current_branch()
7157 \begin_layout Standard
7158 Returns the name of the current branch.
7161 \begin_layout Subsection
7162 movie.get_branches: Return names of all branches
7165 \begin_layout Itemize
7167 movie.get_branches()
7170 \begin_layout Standard
7171 Returns the name of all branches.
7174 \begin_layout Subsection
7175 movie.rom_loaded: Is ROM loaded?
7178 \begin_layout Itemize
7179 Syntax: boolean movie.rom_loaded()
7182 \begin_layout Standard
7183 Returns true if ROM is loaded, false otherwise.
7186 \begin_layout Subsection
7187 movie.get_rom_info: Get info about loaded ROM
7190 \begin_layout Itemize
7191 Syntax: Table movie.get_rom_info()
7194 \begin_layout Standard
7195 Returns a table of tables.
7196 The outer table is indexed by ROM slot index.
7197 The inner table has the following fields:
7200 \begin_layout Itemize
7201 filename: The name of file
7204 \begin_layout Itemize
7205 hint: File name hint
7208 \begin_layout Itemize
7209 sha256: SHA-256 hash of ROM.
7212 \begin_layout Itemize
7213 xml_filename: The name of file for markup
7216 \begin_layout Itemize
7217 xml_hint: File name hint for markup
7220 \begin_layout Itemize
7221 xml_sha256: SHA-256 hash of ROM markup.
7224 \begin_layout Standard
7225 If there is no markup, the xml_* fields are absent.
7228 \begin_layout Subsection
7229 movie.get_game_info: Get info about loaded game
7232 \begin_layout Itemize
7233 Syntax: Table movie.get_game_info()
7236 \begin_layout Standard
7237 Returns a table with following fields:
7240 \begin_layout Itemize
7241 core: The name of the core
7244 \begin_layout Itemize
7245 core_short: Short name of the core
7248 \begin_layout Itemize
7249 type: The name of the system type
7252 \begin_layout Itemize
7253 type_long: The long name of the system type
7256 \begin_layout Itemize
7257 region: The name of region
7260 \begin_layout Itemize
7261 region_long: The long name of region
7264 \begin_layout Itemize
7265 gametype: The gametype of movie.
7268 \begin_layout Itemize
7269 fps: Nominal fps as floating-point value
7272 \begin_layout Itemize
7273 fps_n: Exact nominal fps numerator
7276 \begin_layout Itemize
7277 fps_d: Exact nominal fps denominator.
7280 \begin_layout Subsection
7281 INPUTFRAME::get_button: Get button
7284 \begin_layout Itemize
7285 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
7289 \begin_layout Standard
7290 Returns state of given button as boolean.
7293 \begin_layout Subsection
7294 INPUTFRAME::get_axis: Get axis
7297 \begin_layout Itemize
7298 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
7302 \begin_layout Standard
7303 Returns state of given axis as number.
7306 \begin_layout Subsection
7307 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
7310 \begin_layout Itemize
7311 Syntax: none INPUTFRAME::set_button(number port, number controller, number
7312 control, number/bool value)
7315 \begin_layout Itemize
7316 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
7320 \begin_layout Standard
7321 Set the given button/axis to given value.
7324 \begin_layout Subsection
7325 INPUTFRAME::serialize: Serialize a frame
7328 \begin_layout Itemize
7329 Syntax: string INPUTFRAME::serialize()
7332 \begin_layout Standard
7333 Return string representation of frame.
7336 \begin_layout Subsection
7337 INPUTFRAME::unserialize: Unserialize a frame
7340 \begin_layout Itemize
7341 Syntax: none INPUTFRAME::unserialize(string data)
7344 \begin_layout Standard
7345 Set current frame from given data.
7348 \begin_layout Subsection
7349 INPUTFRAME::get_stride: Get movie stride
7352 \begin_layout Itemize
7353 Syntax: number INPUTFRAME::get_stride()
7356 \begin_layout Standard
7357 Return number of bytes needed to store the input frame.
7358 Mainly useful for some debugging.
7361 \begin_layout Standard
7362 \begin_inset Newpage pagebreak
7368 \begin_layout Section
7372 \begin_layout Standard
7373 Routines for settings manipulation
7376 \begin_layout Subsection
7377 settings.get: Get value of setting
7380 \begin_layout Itemize
7381 Syntax: string settings.get(string name)
7384 \begin_layout Standard
7385 Get value of setting <name>.
7386 If setting value can't be obtained, returns (nil, error message).
7389 \begin_layout Subsection
7390 settings.set: Set value of setting
7393 \begin_layout Itemize
7394 Syntax: none settings.set(string name, string value)
7397 \begin_layout Standard
7398 Set value <value> of setting <name>.
7399 If setting can't be set, returns (nil, error message).
7402 \begin_layout Subsection
7403 settings.get_all: Get values of all settings
7406 \begin_layout Itemize
7407 Syntax: table settings.get_all()
7410 \begin_layout Standard
7411 Return a table with all setting names as keys and all current values as
7415 \begin_layout Subsection
7416 settings.get_speed: Get current speed
7419 \begin_layout Itemize
7420 Syntax: number/string settings.get_speed()
7423 \begin_layout Standard
7424 Return the current speed multiplier (1 is normal), or
7425 \begin_inset Quotes eld
7429 \begin_inset Quotes erd
7432 if speed is set to turbo (this does not react to turbo toggle).
7435 \begin_layout Subsection
7436 settings.set_speed: Set current speed
7439 \begin_layout Itemize
7440 Syntax: settings.get_speed(number spd)
7443 \begin_layout Itemize
7444 Syntax: settings.get_speed(string special)
7447 \begin_layout Standard
7448 Set the current speed multiplier (1 is normal).
7449 The speed may be positive multiplier or
7450 \begin_inset Quotes eld
7454 \begin_inset Quotes erd
7460 \begin_layout Standard
7461 \begin_inset Newpage pagebreak
7467 \begin_layout Section
7471 \begin_layout Standard
7472 Contains various functions for managing memory
7475 \begin_layout Subsection
7476 memory.vma_count: Count number of memory areas.
7479 \begin_layout Itemize
7480 Syntax: number memory.vma_count()
7483 \begin_layout Standard
7484 Returns the number of memory areas
7487 \begin_layout Subsection
7488 memory.read_vma: Lookup memory area info by index
7491 \begin_layout Itemize
7492 Syntax: table memory.read_vma(number index)
7495 \begin_layout Standard
7496 Reads the specified memory area (indices start from zero).
7497 Trying to read invalid memory area gives nil.
7498 The return value is table with the following fields:
7501 \begin_layout Itemize
7502 region_name (string): The readable name of the memory area
7505 \begin_layout Itemize
7506 baseaddr (number): Base address of the memory area
7509 \begin_layout Itemize
7510 lastaddr (number): Last address in the memory area.
7513 \begin_layout Itemize
7514 size (number): The size of memory area in bytes.
7517 \begin_layout Itemize
7518 readonly (boolean): True of the memory area corresponds to ROM.
7521 \begin_layout Itemize
7522 iospace (boolean): True if the memory area is I/O space.
7525 \begin_layout Itemize
7526 native_endian (boolean): True if the memory area has native endian as opposed
7530 \begin_layout Subsection
7531 memory.find_vma: Find memory area info by address
7534 \begin_layout Itemize
7535 Syntax: table memory.find_vma(number address)
7538 \begin_layout Standard
7539 Finds the memory area containing specified address.
7540 Returns table in the same format as read_vma or nil if not found.
7543 \begin_layout Subsection
7544 memory.read{,s}{byte,{,h,d,q}word}: Read memory
7547 \begin_layout Itemize
7548 Syntax: none memory.readbyte({string marea, number address|ADDRESS addrobj})
7551 \begin_layout Itemize
7552 Syntax: none memory.readword({string marea, number address|ADDRESS addrobj})
7555 \begin_layout Itemize
7556 Syntax: none memory.readhword({string marea, number address|ADDRESS addrobj})
7559 \begin_layout Itemize
7560 Syntax: none memory.readdword({string marea, number address|ADDRESS addrobj})
7563 \begin_layout Itemize
7564 Syntax: none memory.readqword({string marea, number address|ADDRESS addrobj})
7567 \begin_layout Itemize
7568 Syntax: none memory.readsbyte({string marea, number address|ADDRESS addrobj})
7571 \begin_layout Itemize
7572 Syntax: none memory.readsword({string marea, number address|ADDRESS addrobj})
7575 \begin_layout Itemize
7576 Syntax: none memory.readshword({string marea, number address|ADDRESS addrobj})
7579 \begin_layout Itemize
7580 Syntax: none memory.readsdword({string marea, number address|ADDRESS addrobj})
7583 \begin_layout Itemize
7584 Syntax: none memory.readsqword({string marea, number address|ADDRESS addrobj})
7587 \begin_layout Standard
7588 Reads the specified address <address> (if 's' variant is used, do undergo
7592 \begin_layout Subsection
7593 memory.{,s}read_sg: Scatter/Gather read memory
7596 \begin_layout Itemize
7597 Syntax: none memory.read_sg(string/boolean/number...)
7600 \begin_layout Itemize
7601 Syntax: none memory.sread_sg(string/boolean/number...)
7604 \begin_layout Standard
7605 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
7607 Each argument can be string, boolean or number:
7610 \begin_layout Itemize
7611 String: Set memory area addresses are relative to (e.g.
7615 \begin_layout Itemize
7616 boolean: If true, increment relative address by 1, if false, decrement by
7618 The new address is read as next higher byte.
7621 \begin_layout Itemize
7622 integer: Set the relative address to specified value and read the address
7623 as next higher byte.
7626 \begin_layout Subsection
7627 memory.write_sg: Scatter/Gather write memory
7630 \begin_layout Itemize
7631 Syntax: none memory.write_sg(number value, string/boolean/number...)
7634 \begin_layout Standard
7635 Perform scatter/gather write of value <value> on memory.
7636 Each argument can be string, boolean or number:
7639 \begin_layout Itemize
7640 String: Set memory area addresses are relative to (e.g.
7644 \begin_layout Itemize
7645 boolean: If true, increment relative address by 1, if false, decrement by
7647 The new address is read as next higher byte.
7650 \begin_layout Itemize
7651 integer: Set the relative address to specified value and read the address
7652 as next higher byte.
7655 \begin_layout Subsection
7656 memory.read{float,double}: Read memory
7659 \begin_layout Itemize
7660 Syntax: none memory.readfloat({string marea, number address|ADDRESS addrobj})
7663 \begin_layout Itemize
7664 Syntax: none memory.readdouble({string marea, number address|ADDRESS addrobj})
7667 \begin_layout Standard
7668 Reads the specified address <address>
7671 \begin_layout Subsection
7672 memory.write{byte,{,h,d,q}word,float,double}: Write memory
7675 \begin_layout Itemize
7676 Syntax: none memory.writebyte({string marea, number address|ADDRESS addrobj},
7680 \begin_layout Itemize
7681 Syntax: none memory.writeword({string marea, number address|ADDRESS addrobj},
7685 \begin_layout Itemize
7686 Syntax: none memory.writehword({string marea, number address|ADDRESS addrobj},
7690 \begin_layout Itemize
7691 Syntax: none memory.writedword({string marea, number address|ADDRESS addrobj},
7695 \begin_layout Itemize
7696 Syntax: none memory.writeqword({string marea, number address|ADDRESS addrobj},
7700 \begin_layout Itemize
7701 Syntax: none memory.writefloat({string marea, number address|ADDRESS addrobj},
7705 \begin_layout Itemize
7706 Syntax: none memory.writedouble({string marea, number address|ADDRESS addrobj},
7710 \begin_layout Standard
7711 Writes the specified value <value> (negative integer values undergo 2's
7712 complement) to specified address <address>.
7715 \begin_layout Subsection
7716 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
7719 \begin_layout Itemize
7720 Syntax: userdata memory.map<type>({string marea, number base|ADDRESS addrobj},
7724 \begin_layout Standard
7725 Returns a table mapping specified memory aperture for read/write.
7728 \begin_layout Itemize
7729 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
7730 qword, sqword, float or double.
7733 \begin_layout Subsection
7734 memory.hash_region: Hash region of memory
7737 \begin_layout Itemize
7738 Syntax: string memory.hash_region({string marea, number base|ADDRESS addrobj},
7742 \begin_layout Standard
7743 Hash <size> bytes starting from address <base> (relative to <marea>) and
7747 \begin_layout Subsection
7748 memory.hash_region2: Hash region of memory
7751 \begin_layout Itemize
7752 Syntax: string memory.hash_region2({string marea, number base|ADDRESS addrobj},
7753 number size[, number rows, number stride])
7756 \begin_layout Standard
7757 Hash <rows> blocks of <size> bytes starting from address <base> (relative
7759 The blocks are offset by <stride> from one another and return the SHA-256.
7762 \begin_layout Subsection
7763 memory.hash_region_skein: Hash region of memory
7766 \begin_layout Itemize
7767 Syntax: string memory.hash_region_skein({string marea, number base|ADDRESS
7768 addrobj}, number size[, number rows, number stride])
7771 \begin_layout Standard
7772 Same as memory.hash_region2, but uses Skein-512-256 (v1.3; one of the SHA-3
7773 finalists) as hash function.
7776 \begin_layout Subsection
7777 memory.store: Store region of memory
7780 \begin_layout Itemize
7781 Syntax: none memory.store({string marea, number addr|ADDRESS addrobj}, number
7782 daddr[, number rows, number stride]
7785 \begin_layout Standard
7786 Copy memory starting from <addr> in memory area <marea> (each row being
7787 of size <size>, there being <rows> rows, and rows being separated by <stride>
7788 in memory) into savestate-saved memory area, starting from <daadr> (all
7789 rows are written back to back).
7792 \begin_layout Subsection
7793 memory.storecmp: Compare and store region of memory
7796 \begin_layout Itemize
7797 Syntax: bool memory.storecmp({string marea, number addr|ADDRESS addrobj},
7798 number daddr[, number rows, number stride]
7801 \begin_layout Standard
7802 Like memory.store, but returns true if target of copy already held the value
7803 that would be copied before the copy happened.
7804 Otherwise returns false (if target and source differ before copy).
7807 \begin_layout Subsection
7808 memory.hash_state: Hash system state
7811 \begin_layout Itemize
7812 Syntax: string memory.hash_state()
7815 \begin_layout Standard
7816 Hash the current system state.
7817 Mainly useful for debugging savestates.
7820 \begin_layout Subsection
7821 memory.readregion: Read region of memory
7824 \begin_layout Itemize
7825 Syntax: table memory.readregion({string marea, number base|ADDRESS addrobj},
7829 \begin_layout Standard
7830 Read a region of memory.
7833 \begin_layout Itemize
7834 Warning: If the region crosses memory area boundary, the results are undefined.
7837 \begin_layout Subsection
7838 memory.writeregion: Write region of memory
7841 \begin_layout Itemize
7842 Syntax: none memory.writeregion({string marea, number base|ADDRESS addrobj},
7843 number size, table data)
7846 \begin_layout Standard
7847 Write a region of memory.
7850 \begin_layout Itemize
7851 Warning: If the region crosses memory area boundary, the results are undefined.
7854 \begin_layout Subsection
7855 memory.action: Run core action
7858 \begin_layout Itemize
7859 memory.action(string action, [<params>])
7862 \begin_layout Standard
7864 The different models expect parameters as:
7867 \begin_layout Itemize
7871 \begin_layout Itemize
7875 \begin_layout Itemize
7879 \begin_layout Itemize
7883 \begin_layout Itemize
7887 \begin_layout Subsection
7888 memory.action_flags: Get core action flags
7891 \begin_layout Itemize
7892 memory.action_flags(string action)
7895 \begin_layout Standard
7896 Get value of action flags for core action <action>.
7899 \begin_layout Itemize
7903 \begin_layout Itemize
7904 Bit 1: Selected (not all actions can be selected)?
7907 \begin_layout Subsection
7908 memory.get_lag_flag: Get lag flag
7911 \begin_layout Itemize
7912 Syntax: boolean memory.get_lag_flag()
7915 \begin_layout Standard
7916 Get the value of core lag flag.
7917 True if this frame has been lag so far, false if poll has been detected.
7920 \begin_layout Subsection
7921 memory.set_lag_flag: Set lag flag
7924 \begin_layout Itemize
7925 Syntax: none memory.set_lag_flag(boolean flag)
7928 \begin_layout Standard
7929 Set the value of core lag flag.
7930 This flag automatically gets cleared if poll is detected, but can be forcibly
7931 set or cleared if game so requires.
7934 \begin_layout Itemize
7935 Should only be used in on_frame_emulated callback.
7938 \begin_layout Itemize
7939 Setting or clearing this affects the emulator lag counter.
7942 \begin_layout Subsection
7943 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
7947 \begin_layout Itemize
7948 Syntax: function memory.registerread({string marea, number addr|ADDRESS addrobj},
7952 \begin_layout Itemize
7953 Syntax: function memory.registerwrite({string marea, number addr|ADDRESS
7954 addrobj}, function fn);
7957 \begin_layout Itemize
7958 Syntax: function memory.registerexec({string marea, number addr|ADDRESS addrobj},
7962 \begin_layout Itemize
7963 Syntax: none memory.unregisterread({string marea, number addr|ADDRESS addrobj},
7967 \begin_layout Itemize
7968 Syntax: none memory.unregisterwrite({string marea, number addr|ADDRESS addrobj},
7972 \begin_layout Itemize
7973 Syntax: none memory.unregisterexec({string marea, number addr|ADDRESS addrobj},
7977 \begin_layout Standard
7978 Add or remove callback on memory read, write or execute (depending on the
7980 <addr> is relative to <marea>.
7981 <fn> is the callback.
7982 The register* functions return <fn> (which can then be passed to unregister*
7986 \begin_layout Itemize
7987 Not all cores support this, and it may be unsupported for some memory areas.
7990 \begin_layout Itemize
7991 The functions are passed two parameters: Address and value.
7994 \begin_layout Subsection
7995 memory.{,un}registertrace: Set/Clear trace hook
7998 \begin_layout Itemize
7999 Syntax: function memory.registertrace(number processor, function fn);
8002 \begin_layout Itemize
8003 Syntax: none memory.unregistertrace(number processor, function fn);
8006 \begin_layout Standard
8007 Add or remove trace callback.
8008 <processor> is system-dependent processor number (0 is usually main CPU).
8009 The function arguments work like in other (un)register* functions.
8012 \begin_layout Itemize
8013 The functions are passed two parameters: Trace CPU and Trace event string.
8016 \begin_layout Subsection
8017 memory.cheat: Set cheat
8020 \begin_layout Itemize
8021 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj}, number
8025 \begin_layout Itemize
8026 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj});
8029 \begin_layout Standard
8030 Set or clear cheat (value <value>) on address <addr> (relative to <marea>).
8031 If <value> is not speicified, clear a cheat.
8034 \begin_layout Itemize
8035 Not all cores support this, and it may be unsupported for some memory areas.
8038 \begin_layout Subsection
8039 memory.setxmask: Set global execute hook mask
8042 \begin_layout Itemize
8043 Syntax: none memory.setxmask(number mask)
8046 \begin_layout Standard
8047 Set the global execute hook mask to <mask>.
8048 The meaning of each bit is system-dependent, but bit 0 should be the main
8052 \begin_layout Subsection
8053 memory.getregister: Get register value
8056 \begin_layout Itemize
8057 Syntax: number/boolean memory.getregister(string register)
8060 \begin_layout Standard
8061 Get the value of named register.
8064 \begin_layout Subsection
8065 memory.getregisters: Get register values
8068 \begin_layout Itemize
8069 Syntax: table memory.getregisters()
8072 \begin_layout Standard
8073 Get the value of all known registers as table.
8076 \begin_layout Subsection
8077 memory.setregister: Set register value
8080 \begin_layout Itemize
8081 Syntax: none memory.setregister(string register, number/boolean value)
8084 \begin_layout Standard
8085 Set the value of named register.
8088 \begin_layout Subsection
8089 memory.mmap: Class MMAP_STRUCT
8092 \begin_layout Standard
8093 See class MMAP_STRUCT
8096 \begin_layout Standard
8097 \begin_inset Newpage pagebreak
8103 \begin_layout Section
8107 \begin_layout Standard
8108 Contains newer memory functions.
8111 \begin_layout Subsection
8112 memory2(): Get all memory area names.
8115 \begin_layout Itemize
8116 Syntax: table memory2()
8119 \begin_layout Standard
8120 Returns array of all valid memory area names.
8123 \begin_layout Subsection
8124 memory2.<marea>:info: Get memory area info
8127 \begin_layout Itemize
8128 Syntax: table memory2.<marea>:info()
8131 \begin_layout Standard
8132 Return table describing given memory area.
8133 Includes fields address, size, last, readonly, special and endian.
8136 \begin_layout Subsection
8137 memory2.<marea>:<op>: Read/Write memory
8140 \begin_layout Itemize
8141 Syntax: none memory2.<marea>:<op>(number offset, number value)
8144 \begin_layout Itemize
8145 Syntax: number memory2.<marea>:<op>(number offset)
8148 \begin_layout Standard
8149 Read/Write value from/to given memory area <marea> at given offset <offset>
8151 The value written is <value>.
8152 <Op> is of form: [i][s]<type>, where:
8155 \begin_layout Itemize
8156 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
8159 \begin_layout Itemize
8160 'i' signifies that the value is treated as opposite-to-normal endianess,
8163 \begin_layout Itemize
8164 's' signifies that value is treated as signed (not available for floating-point).
8167 \begin_layout Subsection
8168 memory2.<marea>:read: Scatter-gather value read
8171 \begin_layout Itemize
8172 Syntax: number memory2.<marea>:read(number addr...)
8175 \begin_layout Standard
8176 Read value from given memory area <marea> at byte offsets <addr>..., given
8177 in order of increasing significance.
8178 Value of true and false are special.
8179 True increments address by 1, and false decrements address by 1.
8182 \begin_layout Subsection
8183 memory2.<marea>:sread: Signed scatter-gather value read
8186 \begin_layout Itemize
8187 Syntax: number memory2.<marea>:sread(number addr...)
8190 \begin_layout Standard
8191 Like memory2.<marea>:read, but reads signed values.
8194 \begin_layout Subsection
8195 memory2.<marea>:write: Scatter-gather value write
8198 \begin_layout Itemize
8199 Syntax: number memory2.<marea>:write(number val, number addr...)
8202 \begin_layout Standard
8203 Write value <val> to given memory area <marea> at byte offsets <addr>..., given
8204 in order of increasing significance.
8205 Value of true and false are special.
8206 True increments address by 1, and false decrements address by 1.
8209 \begin_layout Subsection
8210 memory2.<marea>:cheat: Set/Clear cheat
8213 \begin_layout Itemize
8214 Syntax: none memory2.<marea>:cheat(number addr, [number value])
8217 \begin_layout Standard
8218 Set/Clear cheat at offset <addr> of memory area <marea>.
8219 If <value> is given, cheat with specified value is set.
8220 Otherwise cheat on address is removed.
8223 \begin_layout Subsection
8224 memory2.<marea>:sha256: SHA-256
8227 \begin_layout Itemize
8228 Syntax: string memory2.<marea>:sha256(number addr, number size[, number rows,
8232 \begin_layout Standard
8233 Compute SHA-256 of <rows> (default 1) chunks of <size> bytes each, starting
8234 from offset <addr> of area <marea>.
8235 The chunks are separated by <stride>.
8238 \begin_layout Subsection
8239 memory2.<marea>:skein: Skein-512-256
8242 \begin_layout Itemize
8243 Syntax: string memory2.<marea>:skein(number addr, number size[, number rows,
8247 \begin_layout Standard
8248 Same as memory2.<marea>:sha256, except with Skein-512-256 as hash function.
8251 \begin_layout Subsection
8252 memory2.<marea>:store{,cmp}: Copy region to Lua memory with compare
8255 \begin_layout Itemize
8256 Syntax: none memory2.<marea>:store(number addr, number daddr, number size[,
8257 number rows, number stride])
8260 \begin_layout Itemize
8261 Syntax: boolean memory2.<marea>:storecmp(number addr, number daddr, number
8262 size[, number rows, number stride])
8265 \begin_layout Standard
8266 Copy <rows> (default 1) chunks of <size> bytes each, starting from offset
8267 <addr> of area <marea>.
8268 The chunks are separated by <stride>.
8269 The target is Lua host memory, starting from offset <daddr>.
8272 \begin_layout Standard
8273 Additionally, the storecmp method returns false if target was modified (otherwis
8277 \begin_layout Subsection
8278 memory2.<marea>:readregion: Read region
8281 \begin_layout Itemize
8282 Syntax table memory2.<marea>:readregion(number addr, number size)
8285 \begin_layout Standard
8286 Read <size> bytes starting from <addr> in <marea> and return as array.
8289 \begin_layout Subsection
8290 memory2.<marea>:writeregion: Write region
8293 \begin_layout Itemize
8294 Syntax none memory2.<marea>:writeregion(number addr, table data)
8297 \begin_layout Standard
8298 Write array <data> to bytes starting from <addr> in <marea>.
8301 \begin_layout Subsection
8302 memory2.<marea>:register{read,write,exec}: Register hook
8305 \begin_layout Itemize
8306 Syntax: function memory2.<marea>:registerread(number addr, function fn);
8309 \begin_layout Itemize
8310 Syntax: function memory2.<marea>:registerwrite(number addr, function fn);
8313 \begin_layout Itemize
8314 Syntax: function memory2.<marea>:registerexec(number addr, function fn);
8317 \begin_layout Standard
8318 Register debug callback <fn> of specified type at offset <addr> of memory
8323 \begin_layout Subsection
8324 memory2.<marea>:unregister{read,write,exec}: Unregister hook
8327 \begin_layout Itemize
8328 Syntax: none memory2.<marea>:unregisterread(number addr, function fn);
8331 \begin_layout Itemize
8332 Syntax: none memory2.<marea>:unregisterwrite(number addr, function fn);
8335 \begin_layout Itemize
8336 Syntax: none memory2.<marea>:unregisterexec(number addr, function fn);
8339 \begin_layout Standard
8340 Unregister debug callback <fn> of specified type at offset <addr> of memory
8344 \begin_layout Standard
8345 \begin_inset Newpage pagebreak
8351 \begin_layout Section
8355 \begin_layout Standard
8356 Contains random number generation methods.
8357 These functions do not return reproducable results.
8360 \begin_layout Subsection
8361 random.boolean: Random boolean
8364 \begin_layout Itemize
8365 Syntax: boolean random.boolean()
8368 \begin_layout Standard
8369 Returns true or false at random (50-50 chance).
8372 \begin_layout Subsection
8373 random.integer: Random integer
8376 \begin_layout Itemize
8377 Syntax: number random.integer(number highplusone)
8380 \begin_layout Itemize
8381 Syntax: number random.integer(number low, number high)
8384 \begin_layout Standard
8385 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
8386 With two arguments, return random integer [<low>,<high>] (both ends inclusive).
8389 \begin_layout Standard
8390 The returned numbers are from uniform distribution.
8393 \begin_layout Subsection
8394 random.float: Random float
8397 \begin_layout Itemize
8398 Syntax: number random.float()
8401 \begin_layout Standard
8402 Returns random decimal number [0,1).
8405 \begin_layout Subsection
8406 random.among: Random parameter
8409 \begin_layout Itemize
8410 Syntax: value random.among(value values...)
8413 \begin_layout Standard
8414 Returns random parameter value, picked at uniform.
8415 Multiple equivalent values are returned with higher chance.
8418 \begin_layout Subsection
8419 random.amongtable: Random from table
8422 \begin_layout Itemize
8423 Syntax: value random.amongtable(table tab)
8426 \begin_layout Standard
8427 Returns random value from table <tab>.
8428 As in random.among, no equality testing is done.
8431 \begin_layout Standard
8432 \begin_inset Newpage pagebreak
8438 \begin_layout Section
8442 \begin_layout Subsection
8443 zip.enumerate: Enumerate members in zipfile
8446 \begin_layout Itemize
8447 Syntax: Table zip.enumerate(string filename[, boolean invert])
8450 \begin_layout Standard
8451 Returns table of files in zip archive <filename>.
8452 If <invert> is true, instead of returning array of names, returns table
8453 with keys being member names and values being true.
8456 \begin_layout Subsection
8457 zip.writer: Class ZIPWRITER
8460 \begin_layout Standard
8461 See class ZIPWRITER.
8464 \begin_layout Section
8468 \begin_layout Subsection
8469 paths.get_executable_file: Get the name of lsnes executable file
8472 \begin_layout Itemize
8473 Syntax: String paths.get_executable_file()
8476 \begin_layout Standard
8477 Returns the filename of the lsnes executable (together with path), if known.
8478 If unknown, returns nil.
8481 \begin_layout Subsection
8482 paths.get_executable_path: Get the path of lsnes executable file
8485 \begin_layout Itemize
8486 Syntax: String paths.get_executable_path()
8489 \begin_layout Standard
8490 Returns the directory of the lsnes executable path, if known.
8491 If unknown, returns nil.
8494 \begin_layout Subsection
8495 paths.get_config_path: Get the path of lsnes config file
8498 \begin_layout Itemize
8499 Syntax: String paths.get_config_path()
8502 \begin_layout Standard
8503 Returns the directory of the lsnes configuration.
8506 \begin_layout Subsection
8507 paths.get_rompath: Get the path of ROM files
8510 \begin_layout Itemize
8511 Syntax: String paths.get_rompath()
8514 \begin_layout Standard
8515 Returns the default directory for various ROMs.
8518 \begin_layout Subsection
8519 paths.get_firmwarepath: Get the path of firmware files
8522 \begin_layout Itemize
8523 Syntax: String paths.get_firmwarepath()
8526 \begin_layout Standard
8527 Returns the default directory for various firmwares.
8530 \begin_layout Subsection
8531 paths.get_slotpath: Get the path of save slot files
8534 \begin_layout Itemize
8535 Syntax: String paths.get_slotpath()
8538 \begin_layout Standard
8539 Returns the default directory for various save slots.
8540 If in project context, returns the project directory.
8543 \begin_layout Subsection
8544 paths.get_save_slot_file: Get save slot filename
8547 \begin_layout Itemize
8548 Syntax: String paths.get_slotpath(string name)
8551 \begin_layout Itemize
8552 Syntax: String paths.get_slotpath(integer slotnum, bool for_save)
8555 \begin_layout Standard
8556 Resolve the filename of specified save slot <name> or <slotnum>.
8557 Projects and save branches are taken into account.
8558 If <for_save> is true, the filename is always for current branch.
8559 If <for_save> is false, branch tree is walked upwards until root is reached
8560 or desired file is located.
8563 \begin_layout Standard
8564 \begin_inset Newpage pagebreak
8570 \begin_layout Section
8574 \begin_layout Standard
8575 Various callback-related functions.
8578 \begin_layout Subsection
8579 \begin_inset CommandInset label
8581 name "subsec:callback.register:-Register-a"
8585 callback.register: Register a callback
8588 \begin_layout Itemize
8589 Syntax: function callback.register(string cbname, function cbfun);
8592 \begin_layout Standard
8593 Instruct function <cbfun> to be added to list of callbacks to call on event
8594 <cbname> (See section
8595 \begin_inset CommandInset ref
8597 reference "sec:Callbacks"
8602 The callback name does not have the 'on_' prefix (e.g.
8604 \begin_inset Quotes eld
8608 \begin_inset Quotes erd
8615 \begin_layout Subsection
8616 \begin_inset CommandInset label
8618 name "subsec:callback.unregister:-Unregister-"
8622 callback.unregister: Unregister a callback
8625 \begin_layout Itemize
8626 Syntax: function callback.unregister(string cbname, function cbfun);
8629 \begin_layout Standard
8630 Instruct function <cbfun> to be removed from list of callbacks to call on
8634 \begin_layout Subsection
8635 callback.<cbname>:register: Register callback
8638 \begin_layout Itemize
8639 Syntax: function callback.<cbname>:register(function cbfun)
8642 \begin_layout Standard
8643 Synonym for callback.register (section
8644 \begin_inset CommandInset ref
8646 reference "subsec:callback.register:-Register-a"
8650 ), albeit with callback name specified differently.
8653 \begin_layout Subsection
8654 callback.<cbname>:unregister: Register callback
8657 \begin_layout Itemize
8658 Syntax: function callback.<cbname>:unregister(function cbfun)
8661 \begin_layout Standard
8662 Synonym for callback.unregister (section
8663 \begin_inset CommandInset ref
8665 reference "subsec:callback.unregister:-Unregister-"
8669 ), albeit with callback name specified differently.
8672 \begin_layout Section
8676 \begin_layout Standard
8677 Various bsnes-specific functions.
8680 \begin_layout Subsection
8681 bsnes.dump_sprite: Dump a sprite
8684 \begin_layout Itemize
8685 Syntax: BITMAP bsnes.dump_sprite(string marea, number addr, number width,
8686 number height[, number stride])
8689 \begin_layout Standard
8690 Dumps given sprite (in native format) from memory.
8691 memory area is usually
8692 \begin_inset Quotes eld
8696 \begin_inset Quotes erd
8700 <Width> and <height> are given in 8x8 blocks.
8701 <Stride> overrides row stride (default 512).
8704 \begin_layout Subsection
8705 bsnes.dump_sprite2: Dump a 2bpp sprite
8708 \begin_layout Itemize
8709 Syntax: BITMAP bsnes.dump_sprite2(string marea, number addr, number width,
8710 number height[, number stride])
8713 \begin_layout Standard
8714 Dumps given sprite (in 2bpp format) from memory.
8715 memory area is usually
8716 \begin_inset Quotes eld
8720 \begin_inset Quotes erd
8724 <Width> and <height> are given in 8x8 blocks.
8725 <Stride> overrides row stride (default 256).
8728 \begin_layout Subsection
8729 bsnes.dump_palette: Dump a palette
8732 \begin_layout Itemize
8733 Syntax: PALETTE bsnes.dump_palette(string marea, number addr, bool/integer
8734 full256, bool first_trans)
8737 \begin_layout Standard
8738 Dumps a palette from memory.
8739 memory area is usually
8740 \begin_inset Quotes eld
8744 \begin_inset Quotes erd
8748 If <full256> is true, 256 colors are dumped (otherwise 16).
8749 <full256> can also be number of colors (4, 16 or 256).
8750 If <first_trans> is true, first color is forced transparent.
8753 \begin_layout Subsection
8754 bsnes.enablelayer: Set layer visibility
8757 \begin_layout Itemize
8758 Syntax: none bsnes.enablelayer(number layer, number priority, boolean enabled)
8761 \begin_layout Standard
8762 Enable or disable specified layer at specified priority.
8765 \begin_layout Subsection
8766 bsnes.redump_sprite: Redump a sprite
8769 \begin_layout Itemize
8770 Syntax: none bsnes.redump_sprite(BITMAP bitmap, string marea, number addr[,
8774 \begin_layout Standard
8775 Like bsnes.dump_sprite, but instead dumps to specified bitmap <bitmap>.
8776 The specified bitmap must have size multiple of 8x8.
8779 \begin_layout Subsection
8780 bsnes.redump_sprite2: Redump a 2bpp sprite
8783 \begin_layout Itemize
8784 Syntax: none bsnes.redump_sprite2(BITMAP bitmap, string marea, number addr[,
8788 \begin_layout Standard
8789 Like bsnes.dump_sprite2, but instead dumps to specified bitmap <bitmap>.
8790 The specified bitmap must have size multiple of 8x8.
8793 \begin_layout Subsection
8794 bsnes.redump_palette: Redump a palette
8797 \begin_layout Itemize
8798 Syntax: none bsnes.dump_palette(PALETTE pal, string marea, number addr, bool
8802 \begin_layout Standard
8803 Like bsnes.dump_palette, but instead dumps to specified palette <pal>.
8804 The specified palette must have either 16 or 256 colors.
8807 \begin_layout Section
8808 extensions to table string
8811 \begin_layout Subsection
8812 string.charU: string.char, UTF-8 version.
8815 \begin_layout Itemize
8816 Syntax: string string.charU(number n...)
8819 \begin_layout Standard
8820 Like Lua string.char(), but works in terms of Unicode codepoints.
8821 The returned string is UTF-8.
8824 \begin_layout Subsection
8825 string.byteU: string.byte, UTF-8 version.
8828 \begin_layout Itemize
8830 string.byteU(string str[, number i[, number j]])
8833 \begin_layout Standard
8834 Like string.byte(), but works in terms of Unicode codepoints.
8835 The input string <str> is assumed UTF-8.
8838 \begin_layout Subsection
8839 string.regex: Match string against regular expression
8842 \begin_layout Itemize
8843 Syntax: boolean/string...
8844 string.regex(string regexp, string against)
8847 \begin_layout Standard
8848 Match POSIX-extended regular expression <regexp> against string <against>.
8849 If no match, false is returned.
8850 Otherwise if string has no subcaptures, true is returned.
8851 Otherwise each subcapture is returned as a string (in order of starting
8855 \begin_layout Subsection
8856 string.hex: Transform integer into hex string
8859 \begin_layout Itemize
8860 Syntax: string string.hex(number n, [number digits])
8863 \begin_layout Standard
8864 Returns hexadecimal string representation of <n>, optionally padded with
8865 zeroes to <digits> digits (default is not to pad).
8868 \begin_layout Subsection
8869 string.lpad: Pad string with spaces from left
8872 \begin_layout Itemize
8873 Syntax: string string.lpad(string x, number n)
8876 \begin_layout Standard
8877 Pad string <x> to <n> bytes by inserting spaces at start and return the
8881 \begin_layout Subsection
8882 string.rpad: Pad string with spaces from right
8885 \begin_layout Itemize
8886 Syntax: string string.rpad(string x, number n)
8889 \begin_layout Standard
8890 Pad string <x> to <n> bytes by inserting spaces at end and return the result.
8893 \begin_layout Section
8897 \begin_layout Standard
8898 Contains copy of global variables from time of Lua initialization.
8902 \begin_layout Standard
8903 \begin_inset Newpage pagebreak
8909 \begin_layout Section
8910 \begin_inset CommandInset label
8912 name "sec:Callbacks"
8919 \begin_layout Standard
8920 Various callbacks to Lua that can occur.
8923 \begin_layout Subsection
8924 on_paint: Screen is being painted
8927 \begin_layout Itemize
8928 Callback: on_paint(bool not_synth)
8931 \begin_layout Standard
8932 Called when screen is being painted.
8933 Any gui.* calls requiring graphic context draw on the screen.
8936 \begin_layout Itemize
8937 not_synth is true if this hook is being called in response to received frame,
8941 \begin_layout Subsection
8942 on_video: Dumped video frame is being painted
8945 \begin_layout Itemize
8946 Callback: on_video()
8949 \begin_layout Standard
8950 Called when video dump frame is being painted.
8951 Any gui.* calls requiring graphic context draw on the video.
8954 \begin_layout Subsection
8955 on_frame_emulated: Frame emulation complete
8958 \begin_layout Itemize
8959 Callback: on_frame_emulated()
8962 \begin_layout Standard
8963 Called when emulating frame has completed and on_paint()/on_video() calls
8964 are about to be issued.
8967 \begin_layout Subsection
8968 on_frame: Frame emulation starting.
8971 \begin_layout Itemize
8972 Callback: on_frame()
8975 \begin_layout Standard
8976 Called on each starting whole frame.
8979 \begin_layout Subsection
8980 on_rewind: Movie rewound to beginning
8983 \begin_layout Itemize
8984 Callback: on_rewind()
8987 \begin_layout Standard
8988 Called when rewind movie to beginning has completed.
8991 \begin_layout Subsection
8992 on_pre_load: Load operation is about to start
8995 \begin_layout Itemize
8996 Callback: on_pre_load(string name)
8999 \begin_layout Standard
9000 Called just before savestate/movie load occurs (note: loads are always delayed,
9001 so this occurs even when load was initiated by lua).
9004 \begin_layout Subsection
9005 on_err_Load: Load failed
9008 \begin_layout Itemize
9009 Callback: on_err_load(string name)
9012 \begin_layout Standard
9013 Called if loadstate goes wrong.
9016 \begin_layout Subsection
9017 on_post_load: Load completed
9020 \begin_layout Itemize
9021 Callback: on_post_load(string name, boolean was_savestate)
9024 \begin_layout Standard
9025 Called on successful loadstate.
9026 was_savestate gives if this was a savestate or a movie.
9029 \begin_layout Subsection
9030 on_pre_save: Save operation is about to start
9033 \begin_layout Itemize
9034 Callback: on_pre_save(string name, boolean is_savestate)
9037 \begin_layout Standard
9038 Called just before savestate save occurs (note: movie saves are synchronous
9039 and won't trigger these callbacks if called from Lua).
9042 \begin_layout Subsection
9043 on_err_save: Save failed
9046 \begin_layout Itemize
9047 Callback: on_err_save(string name)
9050 \begin_layout Standard
9051 Called if savestate goes wrong.
9054 \begin_layout Subsection
9055 on_post_save: Save completed
9058 \begin_layout Itemize
9059 Callback: on_post_save(string name, boolean is_savestate)
9062 \begin_layout Standard
9063 Called on successful savaestate.
9064 is_savestate gives if this was a savestate or a movie.
9067 \begin_layout Subsection
9068 on_quit: Emulator is shutting down
9071 \begin_layout Itemize
9075 \begin_layout Standard
9076 Called when emulator is shutting down.
9079 \begin_layout Subsection
9080 on_input: Polling for input
9083 \begin_layout Standard
9084 Called when emulator is just sending input to bsnes core.
9085 Warning: This is called even in readonly mode, but the results are ignored.
9088 \begin_layout Subsection
9089 on_reset: System has been reset
9092 \begin_layout Itemize
9093 Callback: on_reset()
9096 \begin_layout Standard
9097 Called when system is reset.
9100 \begin_layout Subsection
9101 on_readwrite: Entered recording mode
9104 \begin_layout Itemize
9105 Callback: on_readwrite()
9108 \begin_layout Standard
9109 Called when moving into recording mode as result of
9110 \begin_inset Quotes eld
9114 \begin_inset Quotes erd
9117 command (note: moving to rwmode by Lua won't trigger this, as per recursive
9121 \begin_layout Subsection
9122 on_snoop/on_snoop2: Snoop core controller reads
9125 \begin_layout Itemize
9126 Callback: on_snoop(number port, number controller, number index, number
9130 \begin_layout Itemize
9131 Callback: on_snoop2(number port, number controller, number index, number
9135 \begin_layout Standard
9136 Called each time bsnes asks for input.
9137 The value is the final value to be sent to bsnes core (readonly mode, autohold
9138 and autofire have been taken into account).
9139 Might be useful when translating movies to format suitable for console
9141 Note: There is no way to modify the value to be sent.
9144 \begin_layout Itemize
9145 On_snoop2 is called instead of on_snoop if defined.
9146 Reserves port 0 for system, having first user port be port 1.
9149 \begin_layout Subsection
9150 on_keyhook: Hooked key/axis has been moved
9153 \begin_layout Itemize
9154 Callback: on_keyhook(string keyname, table state)
9157 \begin_layout Standard
9158 Sent when key that has keyhook events requested changes state.
9159 Keyname is name of the key (group) and state is the state (same kind as
9160 table values in input.raw).
9163 \begin_layout Subsection
9167 \begin_layout Itemize
9171 \begin_layout Standard
9172 Called when requested by set_idle_timeout(), the timeout has expired and
9173 emulator is waiting.
9176 \begin_layout Subsection
9177 on_timer: Timer event
9180 \begin_layout Itemize
9181 Callback: on_timer()
9184 \begin_layout Standard
9185 Called when requested by set_idle_timeout() and the timeout has expired
9186 (regardless if emulator is waiting).
9189 \begin_layout Subsection
9190 on_set_rewind: Rewind point has been set
9193 \begin_layout Itemize
9194 Callback: on_set_rewind(UNSAFEREWIND r)
9197 \begin_layout Standard
9198 Called when unsafe rewind object has been constructed.
9201 \begin_layout Subsection
9202 on_pre_rewind: Rewind is about to occur
9205 \begin_layout Itemize
9206 Callback: on_pre_rewind()
9209 \begin_layout Standard
9210 Called just before unsafe rewind is about to occur.
9213 \begin_layout Subsection
9214 on_post_rewind: Rewind has occured
9217 \begin_layout Itemize
9218 Callback: on_post_rewind()
9221 \begin_layout Standard
9222 Called just after unsafe rewind has occured.
9225 \begin_layout Subsection
9226 on_button: Button has been pressed
9229 \begin_layout Itemize
9230 Callback: on_button(number port, number controller, number index, string
9234 \begin_layout Standard
9235 Called on controller button press, with following parameters:
9238 \begin_layout Itemize
9239 port: Port number (0 is system)
9242 \begin_layout Itemize
9243 controller: Controller within port
9246 \begin_layout Itemize
9247 index: Index of button.
9250 \begin_layout Itemize
9251 type: Type of event, one of:
9252 \begin_inset Separator latexpar
9259 \begin_layout Itemize
9260 \begin_inset Quotes eld
9264 \begin_inset Quotes erd
9267 : Button was pressed.
9270 \begin_layout Itemize
9271 \begin_inset Quotes eld
9275 \begin_inset Quotes erd
9278 : Button was released.
9281 \begin_layout Itemize
9282 \begin_inset Quotes eld
9286 \begin_inset Quotes erd
9292 \begin_layout Itemize
9293 \begin_inset Quotes eld
9297 \begin_inset Quotes erd
9300 : Released from hold.
9303 \begin_layout Itemize
9304 \begin_inset Quotes eld
9308 \begin_inset Quotes erd
9311 : Typing input on button.
9314 \begin_layout Itemize
9315 \begin_inset Quotes eld
9319 \begin_inset Quotes erd
9322 : Typing input undone.
9325 \begin_layout Itemize
9326 \begin_inset Quotes eld
9329 autofire <duty> <cycle>
9330 \begin_inset Quotes erd
9333 : Autofire with specifie duty and cycle.
9336 \begin_layout Itemize
9337 \begin_inset Quotes eld
9341 \begin_inset Quotes erd
9347 \begin_layout Itemize
9348 \begin_inset Quotes eld
9352 \begin_inset Quotes erd
9355 : Analog action on axis.
9359 \begin_layout Subsection
9360 on_movie_lost: Movie data is about to be lost
9363 \begin_layout Itemize
9364 Callback: on_movie_lost(STRING kind)
9367 \begin_layout Standard
9368 Called just before something would happen that could lose movie data.
9372 \begin_layout Itemize
9373 readwrite: Switching to recording mode.
9376 \begin_layout Itemize
9377 reload: ROM is being reloaded in recording mode.
9380 \begin_layout Itemize
9381 load: New movie is being loaded.
9384 \begin_layout Itemize
9385 unsaferewind: Unsafe rewind is happening.
9388 \begin_layout Subsection
9389 on_latch: Latch line is rising
9392 \begin_layout Itemize
9393 Callback: on_latch(<core-dependent-parameters>)
9396 \begin_layout Standard
9397 Called when latch line for controller is rising.
9398 Some cores may not support this.
9401 \begin_layout Section
9402 System-dependent behaviour
9405 \begin_layout Subsection
9409 \begin_layout Itemize
9410 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
9411 p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
9412 p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
9413 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
9414 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
9415 ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
9416 ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
9417 ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
9418 ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
9419 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
9420 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
9421 ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
9422 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
9423 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
9424 ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
9425 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
9426 ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
9427 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
9428 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
9429 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
9430 ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
9431 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
9432 ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
9433 ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
9434 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
9435 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
9436 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
9437 ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
9438 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
9439 ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
9440 ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
9441 ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
9442 ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
9443 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
9444 ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
9445 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
9446 ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
9447 ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
9448 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
9449 ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount,
9452 \begin_layout Itemize
9453 on_latch has no parameters
9456 \begin_layout Itemize
9457 CPU 0 is S-CPU, 1 is S-SMP.
9460 \begin_layout Itemize
9461 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
9464 \begin_layout Itemize
9465 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
9469 \begin_layout Itemize
9470 Memory areas are: WRAM, APURAM, VRAM, OAM, CGRAM, RTC, DSPRAM, DSPPROM,
9471 DSPDROM, SRAM, ROM, BUS, PTRTABLE, CPU_STATE, PPU_STATE, SMP_STATE, DSP_STATE,
9472 BSXFLASH, BSX_RAM, BSX_PRAM, SLOTA_ROM, SLOTB_ROM, SLOTA_RAM, SLOTB_RAM,
9473 GBCPU_STATE, GBROM, GBRAM, GBWRAM, GBHRAM.
9476 \begin_layout Subsection
9480 \begin_layout Itemize
9481 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
9485 \begin_layout Itemize
9486 on_latch is not supported
9489 \begin_layout Itemize
9493 \begin_layout Itemize
9494 Cheats are supported for ROM, SRAM and WRAM.
9497 \begin_layout Itemize
9498 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM
9502 \begin_layout Itemize
9503 Memory areas are: SRAM, WRAM, VRAM, IOAMHRAM, ROM, BUS.