1 #LyX 2.0 created this file. For more info see http://www.lyx.org/
6 \use_default_options true
7 \maintain_unincluded_children false
9 \language_package default
14 \font_typewriter default
15 \font_default_family default
16 \use_non_tex_fonts false
23 \default_output_format default
25 \bibtex_command default
26 \index_command default
27 \paperfontsize default
31 \pdf_bookmarksnumbered false
32 \pdf_bookmarksopen false
33 \pdf_bookmarksopenlevel 1
48 \paperorientation portrait
64 \paragraph_separation indent
65 \paragraph_indentation default
66 \quotes_language english
69 \paperpagestyle default
70 \tracking_changes false
80 lsnes Lua functions reference
87 \begin_layout Standard
88 \begin_inset CommandInset toc
89 LatexCommand tableofcontents
96 \begin_layout Standard
97 \begin_inset Newpage pagebreak
103 \begin_layout Section
107 \begin_layout Subsection
111 \begin_layout Itemize
112 Coordinates increase to right and down.
115 \begin_layout Itemize
116 The origin is at top left of game area or buffer.
119 \begin_layout Subsection
123 \begin_layout Itemize
124 Methods that draw something (unless stated otherwise) require a valid rendering
126 This context can come in three ways:
130 \begin_layout Enumerate
131 The default rendering context of paint callback (the screen).
134 \begin_layout Enumerate
135 The default rendering context of video callback (the video).
138 \begin_layout Enumerate
139 Explicitly set rendering context (RENDERCTX:set).
143 \begin_layout Itemize
144 The rendering context is always reset when callback ends.
147 \begin_layout Subsection
151 \begin_layout Standard
152 (Direct) colors can be specified either as numbers or strings.
155 \begin_layout Itemize
156 -1 is fully transparent.
159 \begin_layout Itemize
160 Non-negative numbers less than
161 \begin_inset Formula $2^{32}$
164 are partially opaque colors (
165 \begin_inset Formula $a*2^{24}+r*2^{16}+g*2^{8}+b$
172 \begin_layout Itemize
173 \begin_inset Formula $a$
177 \begin_inset Formula $0-255$
181 \begin_inset Formula $0$
185 \begin_inset Formula $256$
188 would be fully transparent.
192 \begin_layout Itemize
193 Thus, numbers in range
194 \begin_inset Formula $0-16777215$
197 stand for fully opaque colors.
201 \begin_layout Itemize
202 \begin_inset Formula $r$
206 \begin_inset Formula $g$
210 \begin_inset Formula $b$
213 are intensities of base colors on scale
214 \begin_inset Formula $0-255$
221 \begin_layout Itemize
222 Color can also be specified by name as string: The following color names
223 are known: aliceblue antiquewhite antiquewhite1 antiquewhite2 antiquewhite3
224 antiquewhite4 aqua aquamarine aquamarine1 aquamarine2 aquamarine3 aquamarine4
225 azure azure1 azure2 azure3 azure4 beige bisque bisque1 bisque2 bisque3
226 bisque4 black blanchedalmond blue blue1 blue2 blue3 blue4 blueviolet brown
227 brown1 brown2 brown3 brown4 burlywood burlywood1 burlywood2 burlywood3
228 burlywood4 cadet cadetblue cadetblue1 cadetblue2 cadetblue3 cadetblue4
229 chartreuse chartreuse1 chartreuse2 chartreuse3 chartreuse4 chocolate chocolate1
230 chocolate2 chocolate3 chocolate4 coral coral1 coral2 coral3 coral4 cornflowerbl
231 ue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4 crimson cyan cyan1 cyan2
232 cyan3 cyan4 darkblue darkcyan darkgoldenrod darkgoldenrod1 darkgoldenrod2
233 darkgoldenrod3 darkgoldenrod4 darkgray darkgreen darkgrey darkkhaki darkmagenta
234 darkolivegreen darkolivegreen1 darkolivegreen2 darkolivegreen3 darkolivegreen4
235 darkorange darkorange1 darkorange2 darkorange3 darkorange4 darkorchid darkorchi
236 d1 darkorchid2 darkorchid3 darkorchid4 darkred darksalmon darkseagreen darkseagr
237 een1 darkseagreen2 darkseagreen3 darkseagreen4 darkslateblue darkslategray
238 darkslategray1 darkslategray2 darkslategray3 darkslategray4 darkslategrey
239 darkturquoise darkviolet deeppink deeppink1 deeppink2 deeppink3 deeppink4
240 deepskyblue deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4 dimgray
241 dimgrey dodgerblue dodgerblue1 dodgerblue2 dodgerblue3 dodgerblue4 firebrick
242 firebrick1 firebrick2 firebrick3 firebrick4 floralwhite forestgreen fractal
243 fuchsia gainsboro ghostwhite gold gold1 gold2 gold3 gold4 goldenrod goldenrod1
244 goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100 gray11
245 gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2 gray20 gray21
246 gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3 gray30 gray31
247 gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4 gray40 gray41
248 gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5 gray50 gray51
249 gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6 gray60 gray61
250 gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7 gray70 gray71
251 gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8 gray80 gray81
252 gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9 gray90 gray91
253 gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green green1 green2
254 green3 green4 greenyellow grey grey0 grey1 grey10 grey100 grey11 grey12
255 grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2 grey20 grey21 grey22
256 grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3 grey30 grey31 grey32
257 grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4 grey40 grey41 grey42
258 grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5 grey50 grey51 grey52
259 grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6 grey60 grey61 grey62
260 grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7 grey70 grey71 grey72
261 grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8 grey80 grey81 grey82
262 grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9 grey90 grey91 grey92
263 grey93 grey94 grey95 grey96 grey97 grey98 grey99 honeydew honeydew1 honeydew2
264 honeydew3 honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4 indianred
265 indianred1 indianred2 indianred3 indianred4 indigo ivory ivory1 ivory2
266 ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4 lavender lavenderblush
267 lavenderblush1 lavenderblush2 lavenderblush3 lavenderblush4 lawngreen lemonchif
268 fon lemonchiffon1 lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue lightblue1
269 lightblue2 lightblue3 lightblue4 lightcoral lightcyan lightcyan1 lightcyan2
270 lightcyan3 lightcyan4 lightgoldenrod lightgoldenrod1 lightgoldenrod2 lightgolde
271 nrod3 lightgoldenrod4 lightgoldenrodyellow lightgray lightgreen lightgrey
272 lightpink lightpink1 lightpink2 lightpink3 lightpink4 lightsalmon lightsalmon1
273 lightsalmon2 lightsalmon3 lightsalmon4 lightseagreen lightskyblue lightskyblue1
274 lightskyblue2 lightskyblue3 lightskyblue4 lightslateblue lightslategray
275 lightslategrey lightsteelblue lightsteelblue1 lightsteelblue2 lightsteelblue3
276 lightsteelblue4 lightyellow lightyellow1 lightyellow2 lightyellow3 lightyellow4
277 lime limegreen linen magenta magenta1 magenta2 magenta3 magenta4 maroon
278 maroon1 maroon2 maroon3 maroon4 mediumaquamarine mediumblue mediumforestgreen
279 mediumgoldenrod mediumorchid mediumorchid1 mediumorchid2 mediumorchid3
280 mediumorchid4 mediumpurple mediumpurple1 mediumpurple2 mediumpurple3 mediumpurp
281 le4 mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumviole
282 tred midnightblue mintcream mistyrose mistyrose1 mistyrose2 mistyrose3 mistyrose
283 4 moccasin navajowhite navajowhite1 navajowhite2 navajowhite3 navajowhite4
284 navy navyblue oldlace olive olivedrab olivedrab1 olivedrab2 olivedrab3
285 olivedrab4 orange orange1 orange2 orange3 orange4 orangered orangered1
286 orangered2 orangered3 orangered4 orchid orchid1 orchid2 orchid3 orchid4
287 palegoldenrod palegreen palegreen1 palegreen2 palegreen3 palegreen4 paleturquoi
288 se paleturquoise1 paleturquoise2 paleturquoise3 paleturquoise4 palevioletred
289 palevioletred1 palevioletred2 palevioletred3 palevioletred4 papayawhip
290 peachpuff peachpuff1 peachpuff2 peachpuff3 peachpuff4 peru pink pink1 pink2
291 pink3 pink4 plum plum1 plum2 plum3 plum4 powderblue purple purple1 purple2
292 purple3 purple4 red red1 red2 red3 red4 rosybrown rosybrown1 rosybrown2
293 rosybrown3 rosybrown4 royalblue royalblue1 royalblue2 royalblue3 royalblue4
294 saddlebrown salmon salmon1 salmon2 salmon3 salmon4 sandybrown seagreen
295 seagreen1 seagreen2 seagreen3 seagreen4 seashell seashell1 seashell2 seashell3
296 seashell4 sienna sienna1 sienna2 sienna3 sienna4 silver skyblue skyblue1
297 skyblue2 skyblue3 skyblue4 slateblue slateblue1 slateblue2 slateblue3 slateblue
298 4 slategray slategray1 slategray2 slategray3 slategray4 slategrey snow snow1
299 snow2 snow3 snow4 springgreen springgreen1 springgreen2 springgreen3 springgree
300 n4 steelblue steelblue1 steelblue2 steelblue3 steelblue4 tan tan1 tan2 tan3
301 tan4 teal thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2
302 tomato3 tomato4 transparent turquoise turquoise1 turquoise2 turquoise3
303 turquoise4 violet violetred violetred1 violetred2 violetred3 violetred4
304 wheat wheat1 wheat2 wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
305 yellow3 yellow4 yellowgreen
308 \begin_layout Itemize
309 The HSL base color names: hsl-<hue><saturation><lightness>.
313 \begin_layout Itemize
314 Hue can be one of: r (red), ry (red-yellow), o (orange, same as red-yellow),
315 y (yellow), yg (yellow-green), g (green), gc (green-cyan), c (cyan), cb
316 (cyan-blue), b (blue), bm (blue-magenta), m (magenta), mr (magenta-red).
319 \begin_layout Itemize
320 Saturation is 0-8, where 0 is greyscale and 8 is fully saturated.
323 \begin_layout Itemize
324 Lightness is 0-8, where 0 is black and 8 is white.
328 \begin_layout Itemize
329 The color names can have a modifier after space (multiple modifiers are
330 allowed, separated by spaces): opaque10, opaque20, opaque25, opaque30,
331 opaque40, opaque50, opaque60, opaque70, opaque75, opaque80, opaque90, opaque,
332 hue{+,-}{1-23}, {saturation,lightness}{+,-}{1-16}.
336 \begin_layout Itemize
337 opaqueness is measured as percentage.
340 \begin_layout Itemize
341 Hue adjustments are on 24-step scale.
344 \begin_layout Itemize
345 Saturation and lightness adjustments are on 16-step scale.
349 \begin_layout Section
353 \begin_layout Standard
354 These tokens are special, and are expanded while the script is being loaded
357 \begin_layout Subsection
358 @@LUA_SCRIPT_FILENAME@@
361 \begin_layout Standard
362 Expanded to string token containing path and filename of this Lua script.
363 Handy for referencing other lua scripts or resources that are relative
367 \begin_layout Standard
368 In practicular, this is suitable to be passed as base argument of various
369 functions like loadfile, dofile, resolve_filename, gui.bitmap_load, gui.bitmap_lo
370 ad_png and gui.bitmap_load_pal.
373 \begin_layout Section
377 \begin_layout Subsection
378 MMAP_STRUCT: Quasi-table mapping emulated memory
381 \begin_layout Standard
382 Objects of this class act like tables, except that the values are reflected
383 to and from emulated memory.
386 \begin_layout Subsubsection
387 static function new: Create new instance
390 \begin_layout Itemize
391 Syntax: mmap memory.mmap.new()
394 \begin_layout Itemize
395 Syntax: mmap classes.MMAP_STRUCT.new()
398 \begin_layout Itemize
399 Deprecated: mmap memory.map_structure()
402 \begin_layout Standard
406 \begin_layout Itemize
407 mmap: MMAP_STRUCT: The created mmap structure.
410 \begin_layout Standard
411 Create a new MMAP_STRUCT (with no mappings) and return it.
414 \begin_layout Subsubsection
415 operator(): Bind key in mmap structure
418 \begin_layout Itemize
419 Syntax: obj(key, address, type)
422 \begin_layout Itemize
423 Syntax: obj(key, marea, address, type)
426 \begin_layout Standard
430 \begin_layout Itemize
431 obj: MMAP_STRUCT: The structure to manipulate.
434 \begin_layout Itemize
435 key: String: The name of the key in array to map.
438 \begin_layout Itemize
439 marea: String: The memory area the mapped address is in (default: global
443 \begin_layout Itemize
444 address: Number: The offset of memory addreess, relative to specified memory
445 area or global memory space.
448 \begin_layout Itemize
449 type: String: The type of data to map.
453 \begin_layout Itemize
454 One of: byte, sbyte, word, sword, hword, shword, dword, sdword, qword, sqword,
459 \begin_layout Standard
460 Bind key <key> in mmap structure <obj> to address <address> (relative to
462 The memory address is treated as type <type>.
465 \begin_layout Itemize
467 \begin_inset Quotes eld
471 \begin_inset Quotes erd
475 \begin_inset Quotes eld
479 \begin_inset Quotes erd
483 \begin_inset Quotes eld
487 \begin_inset Quotes erd
493 \begin_layout Standard
494 This binds signed word at address WRAM+0x2A into key
495 \begin_inset Quotes eld
499 \begin_inset Quotes erd
505 \begin_layout Standard
506 \begin_inset Newpage pagebreak
512 \begin_layout Subsection
513 ZIPWRITER: Write .zip files
516 \begin_layout Standard
517 This class does writing of .zip files.
520 \begin_layout Subsubsection
521 Static function new: Create a new zipfile
524 \begin_layout Itemize
525 Syntax: zip zip.writer.new(filename, [compression])
528 \begin_layout Itemize
529 Deprecated: zip zip.create(filename, [compression])
532 \begin_layout Standard
536 \begin_layout Itemize
537 filename: string: The name of the file to write.
540 \begin_layout Itemize
541 compression: number: Compression level (0-9).
545 \begin_layout Standard
549 \begin_layout Itemize
550 zip: ZIPWRITER: The newly created ZIP writer.
553 \begin_layout Standard
554 Create a new ZIPWRITER object and return it.
557 \begin_layout Subsubsection
558 Method commit: Finish creating ZIP file.
561 \begin_layout Itemize
562 Syntax: zipfile:commit()
565 \begin_layout Standard
569 \begin_layout Itemize
570 zipfile: ZIPFILE: The ZIP file object.
573 \begin_layout Standard
574 Finish writing the ZIP file and actually create it on disk.
577 \begin_layout Itemize
578 If a member is currently open, it is implicitly closed.
581 \begin_layout Itemize
582 Invoking this on already committed or rolled back zipfile causes an error.
585 \begin_layout Subsubsection
586 Method rollback: Cancel writing the ZIP file.
589 \begin_layout Itemize
590 Syntax: zipfile:rollback()
593 \begin_layout Standard
597 \begin_layout Itemize
598 zipfile: ZIPFILE: The ZIP file object.
601 \begin_layout Standard
602 Cancel writing the whole ZIP file.
603 The file on disk will not be modified.
606 \begin_layout Itemize
607 If a member is currently open, it is implicitly closed.
610 \begin_layout Itemize
611 Invoking this on already committed or rolled back zipfile causes an error.
614 \begin_layout Subsubsection
615 Method create_file: Start writing a new member
618 \begin_layout Itemize
619 Syntax: zipfile:create_file(filename)
622 \begin_layout Standard
626 \begin_layout Itemize
627 zipfile: ZIPFILE: The ZIP file object.
630 \begin_layout Itemize
631 string filename: Name of the new member to create
634 \begin_layout Standard
635 Start writing a new member <filename> in ZIP file.
638 \begin_layout Itemize
639 If a member is currently open, it is implicitly closed.
642 \begin_layout Itemize
643 Invoking this on already committed or rolled back zipfile causes an error.
646 \begin_layout Subsubsection
647 Method close_file: Close member
650 \begin_layout Itemize
651 Syntax: zipfile:close_file()
654 \begin_layout Standard
658 \begin_layout Itemize
659 zipfile: ZIPFILE: The ZIP file object.
662 \begin_layout Standard
663 Close the currently open member in zipfile.
666 \begin_layout Itemize
667 Invoking this on already committed or rolled back zipfile causes an error.
670 \begin_layout Itemize
671 Invoking this without an open member causes an error.
674 \begin_layout Subsubsection
675 Method write: Write data
678 \begin_layout Itemize
679 Syntax: zipfile:write(data)
682 \begin_layout Standard
686 \begin_layout Itemize
687 zipfile: ZIPFILE: The ZIP file object.
690 \begin_layout Itemize
691 data: string: The data to write.
694 \begin_layout Standard
695 Write <data> in binary mode (as-is) to currently open member.
698 \begin_layout Itemize
699 Invoking this without a member being open causes an error.
702 \begin_layout Standard
703 \begin_inset Newpage pagebreak
709 \begin_layout Subsection
710 TILEMAP: Tiled collection of bitmaps.
713 \begin_layout Standard
714 A tilemap is tiled table, each cell holding a bitmap (indexed or direct).
717 \begin_layout Subsubsection
718 Static function new: Create a tilemap
721 \begin_layout Itemize
722 Syntax: tilemap gui.tiled_bitmap.new(w, h, bw, bh);
725 \begin_layout Itemize
726 Syntax: tilemap classes.TILEMAP.new(w, h, bw, bh);
729 \begin_layout Itemize
730 Deprecated: tilemap gui.tilemap(w, h, bw, bh);
733 \begin_layout Standard
737 \begin_layout Itemize
738 w: number: Width of the tilemap in tiles
741 \begin_layout Itemize
742 h: number: Height of the tilemap in tiles
745 \begin_layout Itemize
746 bw: number: Width of each tile in pixels.
749 \begin_layout Itemize
750 bh: number: Height of each tile in pixels.
753 \begin_layout Standard
757 \begin_layout Itemize
758 tilemap: TILEMAP: the newly created tilemap
761 \begin_layout Standard
762 Create a new tilemap of <w>*<h> tiles, each of <bw>*<bh> pixels and return
766 \begin_layout Subsubsection
767 TILEMAP:getsize: Query tilemap size
770 \begin_layout Itemize
771 Syntax: width, height tmap:getsize()
774 \begin_layout Standard
778 \begin_layout Itemize
779 tmap: TILEMAP: The tilemap to query.
782 \begin_layout Standard
786 \begin_layout Itemize
787 width: number : The width of the tilemap in tiles.
790 \begin_layout Itemize
791 height: number: The height of the tilemap in tiles.
794 \begin_layout Standard
795 Get size of tilemap in tiles.
798 \begin_layout Subsubsection
799 TILEMAP:getcsize: Query tilemap cell size
802 \begin_layout Itemize
803 Syntax: width, height tmap:getcsize()
806 \begin_layout Standard
810 \begin_layout Itemize
811 tmap: TILEMAP: The tilemap to query.
814 \begin_layout Standard
818 \begin_layout Itemize
819 width: number: The width of tilemap tile in pixels.
822 \begin_layout Itemize
823 height: number: The height of tilemap tile in pixels.
826 \begin_layout Standard
827 Get size of each tilemap tile in pixels.
830 \begin_layout Subsubsection
831 TILEMAP:get: Query tilemap tile
834 \begin_layout Itemize
835 Syntax: bitmap, palette tmap:get(x, y)
838 \begin_layout Standard
842 \begin_layout Itemize
843 tmap: TILEMAP: The tilemap to query.
846 \begin_layout Itemize
847 x: number: The x-coordinate of tile to query.
850 \begin_layout Itemize
851 y: number: The y-coordinate of tile to query.
854 \begin_layout Standard
858 \begin_layout Itemize
859 bitmap: The associated bitmap (BITMAP or DBITMAP), or nil if none.
862 \begin_layout Itemize
863 palette: The palette (PALETTE) associated with indexed-color bitmap, if
868 \begin_layout Standard
869 Return the contents of tile at <x>,<y>.
872 \begin_layout Subsubsection
873 TILEMAP:set: Set tilemap cell
876 \begin_layout Itemize
877 Syntax: tmap:set(x, y)
880 \begin_layout Itemize
881 Syntax: tmap:set(x, y, bitmap)
884 \begin_layout Itemize
885 Syntax: tmap:set(x, y, bitmap, palette)
888 \begin_layout Standard
892 \begin_layout Itemize
893 tmap: TILEMAP: The tilemap to manipulate.
896 \begin_layout Itemize
897 number x: The x-coordinate of tile to set.
900 \begin_layout Itemize
901 number y: The y-coordinate of tile to set.
904 \begin_layout Itemize
905 bitmap: BITMAP/DBITMAP: The bitmap to set to tile.
908 \begin_layout Itemize
909 palette: PALETTE: The associated palette for bitmap.
912 \begin_layout Standard
913 Set the contents of tile <x>,<y>.
914 If no <bitmap> is given, clears the tile.
915 Otherwise sets the tile to contain bitmap <bitmap> with associated palette
919 \begin_layout Itemize
920 Specifying index bitmap <bitmap> without palette <palette> causes an error.
923 \begin_layout Subsubsection
924 TILEMAP:scroll: Scroll tilemap
927 \begin_layout Itemize
928 Syntax: tmap:scroll(ox, oy);
931 \begin_layout Itemize
932 Syntax: tmap:scroll(ox, oy, x, y, w, h);
935 \begin_layout Itemize
936 Syntax: tmap:scroll(ox, oy, x, y, w, h, circ_x, circ_y);
939 \begin_layout Standard
943 \begin_layout Itemize
944 tmap: TILEMAP: The tilemap to manipulate.
947 \begin_layout Itemize
948 ox: number: The number of tiles to scroll horizontally (positive is to right).
951 \begin_layout Itemize
952 oy: number: The number of tiles to scroll vertically (positive is to down).
955 \begin_layout Itemize
956 x: number: The left edge of scroll window.
959 \begin_layout Itemize
960 y: number: The top edge of scroll window.
963 \begin_layout Itemize
964 w: number: The width of scroll window.
967 \begin_layout Itemize
968 h: number: The height of scroll window.
971 \begin_layout Itemize
972 circ_x: boolean: If true, treat the window as circular in horizontal direction.
975 \begin_layout Itemize
976 circ_y: boolean: If true, treat the window as circular in vertical direction.
979 \begin_layout Standard
980 Scroll the specified tilemap <tmap> by <ox>,<oy>.
981 If a window <x>,<y>,<w>,<h> is specified, only that part is scrolled.
982 <circ_x> and <circ_y> control if scroll is circular or not.
985 \begin_layout Itemize
986 Specifying out-of-range window causes an error.
989 \begin_layout Subsubsection
990 TILEMAP:draw: Draw tilemap
993 \begin_layout Itemize
994 Name: tmap:draw(x, y)
997 \begin_layout Itemize
998 Name: tmap:draw(x, y, x0, y0, w, h)
1001 \begin_layout Standard
1005 \begin_layout Itemize
1006 tmap: TILEMAP: The tilemap to draw.
1009 \begin_layout Itemize
1010 x: The x coordinate on screen to draw to.
1013 \begin_layout Itemize
1014 y: The y coordinate on screen to draw to.
1017 \begin_layout Itemize
1018 x0: number: The x coordinate on tilemap (in pixels) to start drawing from.
1021 \begin_layout Itemize
1022 y0: number: The y coordinate on tilemap (in pixels) to start drawing from.
1025 \begin_layout Itemize
1026 w: number: The width to draw (in pixels).
1029 \begin_layout Itemize
1030 h: number: The height to draw (in pixels).
1033 \begin_layout Standard
1034 Draw tilemap <tmap> to screen at <x>,<y>.
1035 If a window <x0>,<y0>,<w>,<h> is specified, only that part is drawn.
1038 \begin_layout Itemize
1039 This method requires a rendering context to work.
1042 \begin_layout Standard
1043 \begin_inset Newpage pagebreak
1049 \begin_layout Subsection
1050 RENDERCTX: Off-screen rendering context
1053 \begin_layout Standard
1054 Object acting as off-screen rendering context.
1057 \begin_layout Subsubsection
1058 Static function new: Create a render queue
1061 \begin_layout Itemize
1062 Syntax: renderctx gui.renderctx.new(width, height);
1065 \begin_layout Itemize
1066 Syntax: renderctx classes.RENDERCTX.new(width, height);
1069 \begin_layout Itemize
1070 Deprecated: renderctx gui.renderq_new(width, height);
1073 \begin_layout Standard
1077 \begin_layout Itemize
1078 width: number: The notional width of the game area.
1081 \begin_layout Itemize
1082 height: number: The notional height of the game area.
1085 \begin_layout Standard
1089 \begin_layout Itemize
1090 rendectx: RENDERCTX: The newly created render context.
1093 \begin_layout Standard
1094 Create a render context with reported size <width>*<height> and return it.
1097 \begin_layout Subsubsection
1098 Static function setnull: Reset to default queue
1101 \begin_layout Itemize
1102 Syntax: gui.renderctx.setnull()
1105 \begin_layout Itemize
1106 Syntax: classes.RENDERCTX:setnull()
1109 \begin_layout Itemize
1110 Deprecated: gui.renderq_set()
1113 \begin_layout Standard
1114 Reset the used render context back to default for the executing callback:
1117 \begin_layout Itemize
1118 The default for paint callback is the screen
1121 \begin_layout Itemize
1122 The default for video callback is the video frame
1125 \begin_layout Itemize
1126 The default otherwise is nothing.
1129 \begin_layout Subsubsection
1130 Method clear: Clear a render queue
1133 \begin_layout Itemize
1134 Syntax: renderctx:clear()
1137 \begin_layout Itemize
1138 Deprecated: gui.renderq_clear(renderctx)
1141 \begin_layout Standard
1145 \begin_layout Itemize
1146 renderctx: RENDERCTX: The render queue to clear.
1149 \begin_layout Standard
1150 Clear all drawing from the context.
1153 \begin_layout Subsubsection
1154 Method set: Change active render context
1157 \begin_layout Itemize
1158 Syntax: renderctx:set()
1161 \begin_layout Itemize
1162 Deprecated: gui.renderq_set(renderctx)
1165 \begin_layout Standard
1169 \begin_layout Itemize
1170 renderctx: RENDERCTX: The render queue to use.
1173 \begin_layout Standard
1174 Switch the current rendering context <renderctx>.
1177 \begin_layout Subsubsection
1178 Method run: Draw all objects in context to another
1181 \begin_layout Itemize
1182 Syntax: renderctx:run()
1185 \begin_layout Itemize
1186 Deprecated: gui.renderq_run(renderctx)
1189 \begin_layout Standard
1193 \begin_layout Itemize
1194 renderctx: RENDERCTX: The render context to overlay.
1197 \begin_layout Standard
1198 Overlay the specified render context <context> upon the active rendering
1202 \begin_layout Itemize
1203 Trying to overlay rendering context upon itself is a bad idea.
1206 \begin_layout Subsubsection
1207 Method render: Render a contex to bitmap
1210 \begin_layout Itemize
1211 Syntax: bitmap renderctx:render()
1214 \begin_layout Standard
1218 \begin_layout Itemize
1219 renderctx: RENDERCTX: The context to render.
1222 \begin_layout Standard
1226 \begin_layout Itemize
1227 bitmap: DBITMAP: The rendered bitmap.
1230 \begin_layout Standard
1231 Render the specified context <renderctx> to a new bitmap.
1234 \begin_layout Itemize
1235 The size of bitmap will be nominal game area size, plus any set gaps.
1238 \begin_layout Itemize
1239 This method does not require active rendering context.
1242 \begin_layout Subsubsection
1243 Method synchronous_repaint: Paint screen now
1246 \begin_layout Itemize
1247 Syntax: renderctx:synchronous_repaint()
1250 \begin_layout Itemize
1251 Deprecated: gui.synchronous_repaint(renderctx)
1254 \begin_layout Standard
1258 \begin_layout Itemize
1259 renderctx: RENDERCTX: The context to paint.
1262 \begin_layout Standard
1263 Immediately redraw the screen with game overlayed by drawings from context
1267 \begin_layout Itemize
1268 This does not require active rendering context.
1271 \begin_layout Itemize
1272 Will not cause paint callback to be invoked.
1275 \begin_layout Standard
1276 \begin_inset Newpage pagebreak
1282 \begin_layout Subsection
1283 PALETTE: Color palette for indexed image
1286 \begin_layout Subsubsection
1287 Static function new: Create a new palette
1290 \begin_layout Itemize
1291 Syntax: palette gui.palette.new()
1294 \begin_layout Itemize
1295 Syntax: palette classes.PALETTE.new()
1298 \begin_layout Itemize
1299 Deprecated: palette gui.palette_new()
1302 \begin_layout Standard
1306 \begin_layout Itemize
1307 palette: PALETTE: The created palette.
1310 \begin_layout Standard
1311 Create a new palette (with all colors transparent) and return it.
1314 \begin_layout Subsubsection
1315 Static function load: Load a palette
1318 \begin_layout Itemize
1319 Syntax: palette gui.palette.load(file, [base])
1322 \begin_layout Itemize
1323 Syntax: palette classes.PALETTE.load(file, [base])
1326 \begin_layout Itemize
1327 Deprecated: palette gui.palette_load(file, [base])
1330 \begin_layout Standard
1334 \begin_layout Itemize
1335 string file: The file to load.
1338 \begin_layout Itemize
1339 string base (optional): The base file to resolve file relative to.
1342 \begin_layout Standard
1346 \begin_layout Itemize
1347 palette: PALETTE: The loaded palette.
1350 \begin_layout Standard
1351 Load a palette from file <file> (resolved relative to <base>).
1354 \begin_layout Itemize
1355 The file format is a series of lines, each with following format:
1359 \begin_layout Itemize
1360 Blank or just whitespace: Ignored
1363 \begin_layout Itemize
1364 First non-whitespace is '#': Ignored
1367 \begin_layout Itemize
1368 <r> <g> <b>: Fully opaque color with specified RGB values (0-255)
1371 \begin_layout Itemize
1372 <r> <g> <b> <a>: Color with specified RGB values (0-255) and specified alpha
1373 (0-256, 0 being fully transparent and 256 fully opaque).
1376 \begin_layout Itemize
1377 transparent: Fully transparent color
1381 \begin_layout Subsubsection
1382 Static function load_str: Load a palette from string
1385 \begin_layout Itemize
1386 Syntax: palette gui.palette.load(data)
1389 \begin_layout Itemize
1390 Syntax: palette classes.PALETTE.load(data)
1393 \begin_layout Itemize
1394 Deprecated: palette gui.palette_load(data)
1397 \begin_layout Standard
1401 \begin_layout Itemize
1402 string data: The palette data.
1405 \begin_layout Standard
1409 \begin_layout Itemize
1410 palette: PALETTE: The loaded palette.
1413 \begin_layout Standard
1414 Like PALETTE:load, but instead of reading palette from file, reads it from
1418 \begin_layout Subsubsection
1419 Method set: Set palette entry
1422 \begin_layout Itemize
1423 Syntax: palette:set(index, color)
1426 \begin_layout Itemize
1427 Deprecated: gui.palette_set(palette, ...)
1430 \begin_layout Standard
1434 \begin_layout Itemize
1435 palette: PALETTE: The palette to manipulate
1438 \begin_layout Itemize
1439 index: number: The index of color to set (0-65535).
1442 \begin_layout Itemize
1443 color: number/string: The color value to set.
1446 \begin_layout Standard
1447 Set palette <palette> index <index> to color <color>.
1450 \begin_layout Subsubsection
1451 Method hash: Hash a palette
1454 \begin_layout Itemize
1455 Syntax: hash palette:hash()
1458 \begin_layout Itemize
1459 Deprecated: hash gui.palette_hash(palette)
1462 \begin_layout Standard
1466 \begin_layout Itemize
1467 palette: The palette to hash.
1470 \begin_layout Standard
1474 \begin_layout Itemize
1475 hash: string: 64-hex digit hash.
1478 \begin_layout Standard
1479 Obtain crypto-grade hash of palette data of <palette>.
1482 \begin_layout Itemize
1483 All colors after the last non-transparent one are ignored.
1486 \begin_layout Subsubsection
1487 Method adjust_transparency: Adjust transparency
1490 \begin_layout Itemize
1491 Syntax: palette:adjust_transparency(newvalue)
1494 \begin_layout Itemize
1495 Deprecated: gui.adjust_transparency(palette, ...)
1498 \begin_layout Standard
1502 \begin_layout Itemize
1503 palette: PALETTE: The palette to adjust.
1506 \begin_layout Itemize
1507 Number adj: The factor to multiply opaqueness with times 256.
1510 \begin_layout Standard
1511 Multiply opaqueness of all colors in palette <palette> by factor of <adj>/256.
1514 \begin_layout Standard
1515 \begin_inset Newpage pagebreak
1521 \begin_layout Subsection
1522 BITMAP: Indexed-color bitmap
1525 \begin_layout Subsubsection
1526 Static function new: Create a new bitmap
1529 \begin_layout Itemize
1530 Syntax: bitmap gui.bitmap.new(w, h, [fillcolor])
1533 \begin_layout Itemize
1534 Syntax: bitmap classes.BITMAP.new(w, h, [fillcolor])
1537 \begin_layout Itemize
1538 Deprecated: bitmap gui.bitmap_new(w, h, false, [fillcolor])
1541 \begin_layout Standard
1545 \begin_layout Itemize
1546 w: number: The width of bitmap to create in pixels.
1549 \begin_layout Itemize
1550 h: number: The height of bitmap to create in pixels.
1553 \begin_layout Itemize
1554 false: boolean: Constant boolean false.
1557 \begin_layout Itemize
1558 fillcolor: number: The initial fill index.
1559 Default 0 if not specified.
1562 \begin_layout Standard
1563 Create a new bitmap of size <w>*<h>.
1564 Fill the bitmap with color index <fillcolor>.
1567 \begin_layout Subsubsection
1568 Method draw: Draw a bitmap
1571 \begin_layout Itemize
1572 Syntax: bitmap:draw(x, y, palette)
1575 \begin_layout Itemize
1576 Deprecated: gui.bitmap_draw(x, y, bitmap, palette)
1579 \begin_layout Standard
1583 \begin_layout Itemize
1584 bitmap: BITMAP: The bitmap to draw
1587 \begin_layout Itemize
1588 x: number: The x-coordinate on screen.
1591 \begin_layout Itemize
1592 y: number: The y-coordinate on screen.
1595 \begin_layout Itemize
1596 palette: The palette to use for drawing.
1599 \begin_layout Standard
1600 Draw bitmap <bitmap> on screen at <x>,<y> with palette <palette>.
1603 \begin_layout Subsubsection
1604 Method pset: Set pixel in bitmap
1607 \begin_layout Itemize
1608 Syntax: bitmap:pset(x, y, color)
1611 \begin_layout Itemize
1612 Deprecaed: gui.bitmap_pset(bitmap, ...)
1615 \begin_layout Standard
1619 \begin_layout Itemize
1620 bitmap: BITMAP: The bitmap to manipulate.
1623 \begin_layout Itemize
1624 x: number: x-coordinate of pixel to set.
1627 \begin_layout Itemize
1628 y: number: y-coordinate of pixel to set.
1631 \begin_layout Itemize
1632 color: number: The color index to set.
1635 \begin_layout Standard
1636 Sets specified pixel <x>,<y> in bitmap <bitmap> to color index <color>.
1639 \begin_layout Subsubsection
1640 Method pget: Get pixel in bitmap
1643 \begin_layout Itemize
1644 Syntax: color bitmap:pget(x,y)
1647 \begin_layout Itemize
1648 Deprecated: color gui.bitmap_pget(bitmap, ...)
1651 \begin_layout Standard
1655 \begin_layout Itemize
1656 bitmap: BITMAP: The bitmap to query.
1659 \begin_layout Itemize
1660 x: number: x-coordinate of pixel to get.
1663 \begin_layout Itemize
1664 y: number: y-coordinate of pixel to get.
1667 \begin_layout Standard
1671 \begin_layout Itemize
1672 color: number: The color index in specified pixel.
1675 \begin_layout Standard
1676 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
1679 \begin_layout Subsubsection
1680 Method size: Get size of bitmap
1683 \begin_layout Itemize
1684 Syntax: width, height bitmap:size()
1687 \begin_layout Itemize
1688 Syntax: width, height gui.bitmap_size(bitmap)
1691 \begin_layout Standard
1695 \begin_layout Itemize
1696 bitmap: BITMAP: The bitmap to query.
1699 \begin_layout Standard
1703 \begin_layout Itemize
1704 width: number: The width of the bitmap.
1707 \begin_layout Itemize
1708 height: number: The height of the bitmap.
1711 \begin_layout Standard
1712 Get size of bitmap <bitmap>.
1715 \begin_layout Subsubsection
1716 Method blit: Blit a bitmap into another
1719 \begin_layout Itemize
1720 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
1723 \begin_layout Itemize
1724 Deprecated: gui.bitmap_blit(dest, ...)
1727 \begin_layout Standard
1731 \begin_layout Itemize
1732 dest: BITMAP: The target bitmap to blit to.
1735 \begin_layout Itemize
1736 dx: number: The x-coordinate in target.
1739 \begin_layout Itemize
1740 dy: number: The y-coordinate in target.
1743 \begin_layout Itemize
1744 src: BITMAP: The source bitmap.
1747 \begin_layout Itemize
1748 sx: number: The x-coordinate in source.
1751 \begin_layout Itemize
1752 sy: number: The y-coordinate in source.
1755 \begin_layout Itemize
1756 w: number: The width of area to blit.
1759 \begin_layout Itemize
1760 h: number: The height of area to blit.
1763 \begin_layout Itemize
1764 ck: number: The color key.
1765 Pixels with this index are not copied.
1769 \begin_layout Itemize
1770 If none is specified, all pixels are copied.
1774 \begin_layout Standard
1775 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> into <dest> at
1777 If a color key <ck> is specified, pixels of that color are not copied.
1780 \begin_layout Subsubsection
1781 Method blit_scaled: Blit a bitmap into another with scaling
1784 \begin_layout Itemize
1785 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
1788 \begin_layout Itemize
1789 Deprecated: gui.bitmap_blit_scaled(dest, ...)
1792 \begin_layout Standard
1796 \begin_layout Itemize
1797 dest: BITMAP: The target bitmap to blit to.
1800 \begin_layout Itemize
1801 dx: number: The x-coordinate in target.
1804 \begin_layout Itemize
1805 dy: number: The y-coordinate in target.
1808 \begin_layout Itemize
1809 src: BITMAP: The source bitmap.
1812 \begin_layout Itemize
1813 sx: number: The x-coordinate in source.
1816 \begin_layout Itemize
1817 sy: number: The y-coordinate in source.
1820 \begin_layout Itemize
1821 w: number: The width of area to blit.
1824 \begin_layout Itemize
1825 h: number: The height of area to blit.
1828 \begin_layout Itemize
1829 hscl: number: Horizontal scale factor (integer).
1832 \begin_layout Itemize
1833 vscl: number: Vertical scale factor (integer).
1834 Defaults to the same as <hscl>.
1837 \begin_layout Itemize
1838 ck: number: The color key.
1839 Pixels with this index are not copied.
1843 \begin_layout Itemize
1844 If none is specified, all pixels are copied.
1848 \begin_layout Standard
1849 Like BITMAP:blit, but also scales the copied part of bitmap (using nearest
1850 neighbor) by factor of <hscl>*<vscl>.
1853 \begin_layout Subsubsection
1854 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
1857 \begin_layout Itemize
1858 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
1861 \begin_layout Itemize
1862 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
1865 \begin_layout Standard
1869 \begin_layout Itemize
1870 dest: BITMAP: The target bitmap to blit to.
1873 \begin_layout Itemize
1874 dx: number: The x-coordinate in target.
1877 \begin_layout Itemize
1878 dy: number: The y-coordinate in target.
1881 \begin_layout Itemize
1882 src: BITMAP: The source bitmap.
1885 \begin_layout Itemize
1886 sx: number: The x-coordinate in source.
1889 \begin_layout Itemize
1890 sy: number: The y-coordinate in source.
1893 \begin_layout Itemize
1894 w: number: The width of area to blit.
1897 \begin_layout Itemize
1898 h: number: The height of area to blit.
1901 \begin_layout Itemize
1902 operator: string: The operator to use.
1906 \begin_layout Itemize
1907 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
1908 DestOut, Clear or Xor.
1912 \begin_layout Standard
1913 Like BITMAP:blit, but instead of just overwriting, applies specified Porter-Duff
1918 \begin_layout Itemize
1919 Color index 0 in source and target is treated as background.
1922 \begin_layout Subsubsection
1923 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
1924 Porter-Duff composition
1927 \begin_layout Itemize
1928 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
1932 \begin_layout Itemize
1933 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
1936 \begin_layout Standard
1940 \begin_layout Itemize
1941 dest: BITMAP: The target bitmap to blit to.
1944 \begin_layout Itemize
1945 dx: number: The x-coordinate in target.
1948 \begin_layout Itemize
1949 dy: number: The y-coordinate in target.
1952 \begin_layout Itemize
1953 src: BITMAP: The source bitmap.
1956 \begin_layout Itemize
1957 sx: number: The x-coordinate in source.
1960 \begin_layout Itemize
1961 sy: number: The y-coordinate in source.
1964 \begin_layout Itemize
1965 w: number: The width of area to blit.
1968 \begin_layout Itemize
1969 h: number: The height of area to blit.
1972 \begin_layout Itemize
1973 hscl: number: Horizontal scale factor (integer).
1976 \begin_layout Itemize
1977 vscl: number: Vertical scale factor (integer).
1978 Defaults to the same as <hscl>.
1981 \begin_layout Itemize
1982 operator: string: The operator to use.
1986 \begin_layout Itemize
1987 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
1988 DestOut, Clear or Xor.
1992 \begin_layout Standard
1993 Like BITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
1994 like BITMAP:blit_scaled.
1997 \begin_layout Subsubsection
1998 Method blit_priority: Blit a bitmap into another with color priority
2001 \begin_layout Itemize
2002 Syntax: dest:blit_priority(dx, dy, src, sx, sy, w, h)
2005 \begin_layout Itemize
2006 Deprecated: gui.bitmap_blit_priority(dest, ...)
2009 \begin_layout Standard
2013 \begin_layout Itemize
2014 dest: BITMAP: The target bitmap to blit to.
2017 \begin_layout Itemize
2018 dx: number: The x-coordinate in target.
2021 \begin_layout Itemize
2022 dy: number: The y-coordinate in target.
2025 \begin_layout Itemize
2026 src: BITMAP: The source bitmap.
2029 \begin_layout Itemize
2030 sx: number: The x-coordinate in source.
2033 \begin_layout Itemize
2034 sy: number: The y-coordinate in source.
2037 \begin_layout Itemize
2038 w: number: The width of area to blit.
2041 \begin_layout Itemize
2042 h: number: The height of area to blit.
2045 \begin_layout Standard
2046 Like BITMAP:blit, but only copy pixels where source color index is greater
2047 than destination color index.
2050 \begin_layout Subsubsection
2051 Method blit_scaled_priority: Blit a bitmap into another with color priority
2055 \begin_layout Itemize
2056 Syntax: dest:blit_scaled_priority(dx, dy, src, sx, sy, w, h, hscl, [vscl])
2059 \begin_layout Itemize
2060 Deprecated: gui.bitmap_blit_scaled_priority(dest, ...)
2063 \begin_layout Standard
2067 \begin_layout Itemize
2068 dest: BITMAP: The target bitmap to blit to.
2071 \begin_layout Itemize
2072 dx: number: The x-coordinate in target.
2075 \begin_layout Itemize
2076 dy: number: The y-coordinate in target.
2079 \begin_layout Itemize
2080 src: BITMAP: The source bitmap.
2083 \begin_layout Itemize
2084 sx: number: The x-coordinate in source.
2087 \begin_layout Itemize
2088 sy: number: The y-coordinate in source.
2091 \begin_layout Itemize
2092 w: number: The width of area to blit.
2095 \begin_layout Itemize
2096 h: number: The height of area to blit.
2099 \begin_layout Itemize
2100 hscl: number: Horizontal scale factor (integer).
2103 \begin_layout Itemize
2104 vscl: number: Vertical scale factor (integer).
2105 Defaults to the same as <hscl>.
2108 \begin_layout Standard
2109 Like BITMAP:blit_priority, but apply scaling by <hscl>*<vscl> like BITMAP:blit_s
2113 \begin_layout Subsubsection
2114 Method save_png: Save a bitmap to PNG
2117 \begin_layout Itemize
2118 Syntax: bitmap:save_png(filename, [base], palette)
2121 \begin_layout Itemize
2122 Syntax: data bitmap:save_png(palette)
2125 \begin_layout Itemize
2127 gui.bitmap_save_png(bitmap, ...)
2130 \begin_layout Standard
2134 \begin_layout Itemize
2135 bitmap: BITMAP: The bitmap to save.
2138 \begin_layout Itemize
2139 filename: string: The filename to save to.
2142 \begin_layout Itemize
2143 base: string: The base filename is resolved relative to.
2146 \begin_layout Itemize
2147 palette: PALETTE: The palette to use.
2150 \begin_layout Standard
2154 \begin_layout Itemize
2155 data: string: BASE64 encoded PNG data.
2158 \begin_layout Standard
2159 Save bitmap <bitmap>, with palette <pal> into PNG file <filename> (relative
2160 to <base>) or return BASE64 encoding of it.
2163 \begin_layout Subsubsection
2164 Method hash: Hash a bitmap
2167 \begin_layout Itemize
2168 Syntax: hash bitmap:hash()
2171 \begin_layout Itemize
2172 Deprecated: hash bitmap:hash(bitmap)
2175 \begin_layout Standard
2179 \begin_layout Itemize
2180 bitmap: BITMAP: The bitmap to hash.
2183 \begin_layout Standard
2187 \begin_layout Itemize
2188 hash: string: 64-hex digit hash
2191 \begin_layout Standard
2192 Hashes bitmap <bitmap> and returns crypto-strong hash.
2196 \begin_layout Itemize
2197 Color order in bitmap is significant.
2200 \begin_layout Standard
2201 \begin_inset Newpage pagebreak
2207 \begin_layout Subsection
2208 DBITMAP: Direct-color bitmap
2211 \begin_layout Subsubsection
2212 Static function: new: Create a new bitmap
2215 \begin_layout Itemize
2216 Syntax: bitmap gui.dbitmap.new(w, h, [fillcolor])
2219 \begin_layout Itemize
2220 Syntax: bitmap classes.DBITMAP.new(w, h, [fillcolor])
2223 \begin_layout Itemize
2224 Deprecated: bitmap gui.bitmap_new (w, h, true, [fillcolor]).
2227 \begin_layout Standard
2231 \begin_layout Itemize
2232 w: number: The width of new bitmap.
2235 \begin_layout Itemize
2236 h: number: The height of new bitmap.
2239 \begin_layout Itemize
2240 true: boolean: Fixed boolean true
2243 \begin_layout Itemize
2244 fillcolor: The color to fill the bitmap with (default transparent).
2247 \begin_layout Standard
2251 \begin_layout Itemize
2252 bitmap: DBITMAP: The new bitmap.
2255 \begin_layout Standard
2256 Create a new direct-color bitmap of size <w>*<h>, initially filled with
2260 \begin_layout Subsubsection
2261 Method draw: Draw a bitmap
2264 \begin_layout Itemize
2265 Syntax: bitmap.draw(x, y)
2268 \begin_layout Itemize
2269 Deprecated: gui.bitmap_draw(x, y, bitmap)
2272 \begin_layout Standard
2276 \begin_layout Itemize
2277 bitmap: DBITMAP: The bitmap to draw.
2280 \begin_layout Itemize
2281 x: number: X-coordinate on screen.
2284 \begin_layout Itemize
2285 y: number: Y-coordinate on screen.
2288 \begin_layout Standard
2289 Draw bitmap <bitmap> on screen at <x>,<y>.
2292 \begin_layout Subsubsection
2293 Method pset: Set pixel in bitmap
2296 \begin_layout Itemize
2297 Syntax: bitmap:pset(x, y, color)
2300 \begin_layout Itemize
2301 Deprecaed: gui.bitmap_pset(bitmap, ...)
2304 \begin_layout Standard
2308 \begin_layout Itemize
2309 bitmap: DBITMAP: The bitmap to manipulate.
2312 \begin_layout Itemize
2313 x: number: x-coordinate of pixel to set.
2316 \begin_layout Itemize
2317 y: number: y-coordinate of pixel to set.
2320 \begin_layout Itemize
2321 color: number/string: The color to set.
2324 \begin_layout Standard
2325 Sets specified pixel <x>,<y> in bitmap <bitmap> to color <color>.
2328 \begin_layout Subsubsection
2329 Method pget: Get pixel in bitmap
2332 \begin_layout Itemize
2333 Syntax: color bitmap:pget(x,y)
2336 \begin_layout Itemize
2337 Deprecated: color gui.bitmap_pget(bitmap, ...)
2340 \begin_layout Standard
2344 \begin_layout Itemize
2345 bitmap: DBITMAP: The bitmap to query.
2348 \begin_layout Itemize
2349 x: number: x-coordinate of pixel to get.
2352 \begin_layout Itemize
2353 y: number: y-coordinate of pixel to get.
2356 \begin_layout Standard
2360 \begin_layout Itemize
2361 color: number: The color of specified pixel.
2364 \begin_layout Standard
2365 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
2368 \begin_layout Subsubsection
2369 Method size: Get size of bitmap
2372 \begin_layout Itemize
2373 Syntax: width, height bitmap:size()
2376 \begin_layout Itemize
2377 Syntax: width, height gui.bitmap_size(bitmap)
2380 \begin_layout Standard
2384 \begin_layout Itemize
2385 bitmap: DBITMAP: The bitmap to query.
2388 \begin_layout Standard
2392 \begin_layout Itemize
2393 width: number: The width of the bitmap.
2396 \begin_layout Itemize
2397 height: number: The height of the bitmap.
2400 \begin_layout Standard
2401 Get size of bitmap <bitmap>.
2404 \begin_layout Subsubsection
2405 Method blit: Blit a bitmap into another
2408 \begin_layout Itemize
2409 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
2412 \begin_layout Itemize
2413 Syntax: dest:blit(dx, dy, src, srcpal, sx, sy, w, h, [ck])
2416 \begin_layout Itemize
2417 Deprecated: gui.bitmap_blit(dest, ...)
2420 \begin_layout Standard
2424 \begin_layout Itemize
2425 dest: DBITMAP: The target bitmap to blit to.
2428 \begin_layout Itemize
2429 dx: number: The x-coordinate in target.
2432 \begin_layout Itemize
2433 dy: number: The y-coordinate in target.
2436 \begin_layout Itemize
2437 src: BITMAP/DBITMAP: The source bitmap.
2440 \begin_layout Itemize
2441 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2444 \begin_layout Itemize
2445 sx: number: The x-coordinate in source.
2448 \begin_layout Itemize
2449 sy: number: The y-coordinate in source.
2452 \begin_layout Itemize
2453 w: number: The width of area to blit.
2456 \begin_layout Itemize
2457 h: number: The height of area to blit.
2460 \begin_layout Itemize
2461 ck: number: The color key.
2462 Pixels with this index are not copied.
2466 \begin_layout Itemize
2467 If none is specified, all pixels are copied.
2470 \begin_layout Itemize
2471 If <src> is paletted, this is color index, otherwise it is a color.
2475 \begin_layout Standard
2476 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> (with palette <pal>
2477 if indexed) into <dest> at <dx>,<dy>.
2478 If a color key <ck> is specified, pixels of that color are not copied.
2481 \begin_layout Subsubsection
2482 Method blit_scaled: Blit a bitmap into another with scaling
2485 \begin_layout Itemize
2486 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
2489 \begin_layout Itemize
2490 Syntax: dest:blit_scaled(dx, dy, src, srcpal, sx, sy, w, h, hscl, [vscl],
2494 \begin_layout Itemize
2495 Deprecated: gui.bitmap_blit_scaled(dest, ...)
2498 \begin_layout Standard
2502 \begin_layout Itemize
2503 dest: DBITMAP: The target bitmap to blit to.
2506 \begin_layout Itemize
2507 dx: number: The x-coordinate in target.
2510 \begin_layout Itemize
2511 dy: number: The y-coordinate in target.
2514 \begin_layout Itemize
2515 src: BITMAP/DBITMAP: The source bitmap.
2518 \begin_layout Itemize
2519 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2522 \begin_layout Itemize
2523 sx: number: The x-coordinate in source.
2526 \begin_layout Itemize
2527 sy: number: The y-coordinate in source.
2530 \begin_layout Itemize
2531 w: number: The width of area to blit.
2534 \begin_layout Itemize
2535 h: number: The height of area to blit.
2538 \begin_layout Itemize
2539 hscl: number: Horizontal scale factor (integer).
2542 \begin_layout Itemize
2543 vscl: number: Vertical scale factor (integer).
2544 Defaults to the same as <hscl>.
2547 \begin_layout Itemize
2548 ck: number: The color key.
2549 Pixels with this index are not copied.
2553 \begin_layout Itemize
2554 If none is specified, all pixels are copied.
2557 \begin_layout Itemize
2558 If <src> is paletted, this is color index, otherwise it is a color.
2562 \begin_layout Standard
2563 Like DBITMAP:blit, but also scales the copied part of bitmap (using nearest
2564 neighbor) by factor of <hscl>*<vscl>.
2567 \begin_layout Subsubsection
2568 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2571 \begin_layout Itemize
2572 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2575 \begin_layout Itemize
2576 Syntax: dest:blit_porterduff(dx, dy, src, srcpal, sx, sy, w, h, operator)
2579 \begin_layout Itemize
2580 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2583 \begin_layout Standard
2587 \begin_layout Itemize
2588 dest: DBITMAP: The target bitmap to blit to.
2591 \begin_layout Itemize
2592 dx: number: The x-coordinate in target.
2595 \begin_layout Itemize
2596 dy: number: The y-coordinate in target.
2599 \begin_layout Itemize
2600 src: BITMAP/DBITMAP: The source bitmap.
2603 \begin_layout Itemize
2604 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2607 \begin_layout Itemize
2608 sx: number: The x-coordinate in source.
2611 \begin_layout Itemize
2612 sy: number: The y-coordinate in source.
2615 \begin_layout Itemize
2616 w: number: The width of area to blit.
2619 \begin_layout Itemize
2620 h: number: The height of area to blit.
2623 \begin_layout Itemize
2624 operator: string: The operator to use.
2628 \begin_layout Itemize
2629 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2630 DestOut, Clear or Xor.
2634 \begin_layout Standard
2635 Like DBITMAP:blit, but instead of just overwriting, applies specified Porter-Duf
2640 \begin_layout Itemize
2641 In target, fully transparent is background.
2642 In source, either fully transparent (if direct) or index 0 (if paletted)
2643 is treated as background.
2646 \begin_layout Subsubsection
2647 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2648 Porter-Duff composition
2651 \begin_layout Itemize
2652 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2656 \begin_layout Itemize
2657 Syntax: dest:blit_scaled_porterduff(dx, dy, src, srcpal, sx, sy, w, h, hscl,
2661 \begin_layout Itemize
2662 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2665 \begin_layout Standard
2669 \begin_layout Itemize
2670 dest: DBITMAP: The target bitmap to blit to.
2673 \begin_layout Itemize
2674 dx: number: The x-coordinate in target.
2677 \begin_layout Itemize
2678 dy: number: The y-coordinate in target.
2681 \begin_layout Itemize
2682 src: BITMAP/DBITMAP: The source bitmap.
2685 \begin_layout Itemize
2686 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2689 \begin_layout Itemize
2690 sx: number: The x-coordinate in source.
2693 \begin_layout Itemize
2694 sy: number: The y-coordinate in source.
2697 \begin_layout Itemize
2698 w: number: The width of area to blit.
2701 \begin_layout Itemize
2702 h: number: The height of area to blit.
2705 \begin_layout Itemize
2706 hscl: number: Horizontal scale factor (integer).
2709 \begin_layout Itemize
2710 vscl: number: Vertical scale factor (integer).
2711 Defaults to the same as <hscl>.
2714 \begin_layout Itemize
2715 operator: string: The operator to use.
2719 \begin_layout Itemize
2720 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2721 DestOut, Clear or Xor.
2725 \begin_layout Standard
2726 Like DBITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2727 like DBITMAP:blit_scaled.
2730 \begin_layout Subsubsection
2731 Method adjust_transparency: Adjust transparency of bitmap
2734 \begin_layout Itemize
2735 Syntax: bitmap:adjust_transparency(newvalue)
2738 \begin_layout Itemize
2739 Deprecated: gui.adjust_transparency(bitmap, ...)
2742 \begin_layout Standard
2746 \begin_layout Itemize
2747 bitmap: DBITMAP: The bitmap to adjust.
2750 \begin_layout Itemize
2751 Number adj: The factor to multiply opaqueness with times 256.
2754 \begin_layout Standard
2755 Multiply opaqueness of all colors in bitmap <bitmap> by factor of <adj>/256.
2758 \begin_layout Subsubsection
2759 Method save_png: Save a bitmap to PNG
2762 \begin_layout Itemize
2763 Syntax: bitmap:save_png(filename, [base])
2766 \begin_layout Itemize
2767 Syntax: data bitmap:save_png()
2770 \begin_layout Itemize
2772 gui.bitmap_save_png(bitmap, ...)
2775 \begin_layout Standard
2779 \begin_layout Itemize
2780 bitmap: DBITMAP: The bitmap to save.
2783 \begin_layout Itemize
2784 filename: string: The filename to save to.
2787 \begin_layout Itemize
2788 base: string: The base filename is resolved relative to.
2791 \begin_layout Standard
2795 \begin_layout Itemize
2796 data: string: BASE64 encoded PNG data.
2799 \begin_layout Standard
2800 Save bitmap <bitmap> into PNG file <filename> (relative to <base>) or return
2801 BASE64 encoding of it.
2804 \begin_layout Subsubsection
2805 Method hash: Hash a bitmap
2808 \begin_layout Itemize
2809 Syntax: hash bitmap:hash()
2812 \begin_layout Itemize
2813 Deprecated: hash bitmap:hash(bitmap)
2816 \begin_layout Standard
2820 \begin_layout Itemize
2821 bitmap: DBITMAP: The bitmap to hash.
2824 \begin_layout Standard
2828 \begin_layout Itemize
2829 hash: string: 64-hex digit hash
2832 \begin_layout Standard
2833 Hashes bitmap <bitmap> and returns crypto-strong hash.
2837 \begin_layout Subsection
2838 IMAGELOADER: Load an image
2841 \begin_layout Subsubsection
2842 Static function load: Load a bitmap from file
2845 \begin_layout Itemize
2846 Syntax: bitmap, palette gui.image.load(file, [base])
2849 \begin_layout Itemize
2850 Syntax: bitmap, palette classes.IMAGELOADER.load(file, [base])
2853 \begin_layout Itemize
2855 gui.bitmap_load(...)
2858 \begin_layout Standard
2862 \begin_layout Itemize
2863 file: string: The file to read.
2866 \begin_layout Itemize
2867 base: string: The base to resolve <file> relative to.
2870 \begin_layout Standard
2874 \begin_layout Itemize
2875 bitmap: BITMAP/DBITMAP: The new bitmap
2878 \begin_layout Itemize
2879 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
2883 \begin_layout Standard
2884 Load a new bitmap and return it (plus associated palette if any).
2887 \begin_layout Subsubsection
2888 Static function load_str: Load a bitmap from string
2891 \begin_layout Itemize
2892 Syntax: bitmap, palette gui.image.load_str(data)
2895 \begin_layout Itemize
2896 Syntax: bitmap, palette classes.IMAGELOADER.load_str(data)
2899 \begin_layout Itemize
2901 gui.bitmap_load_str(...)
2904 \begin_layout Standard
2908 \begin_layout Itemize
2909 data: string: The image data
2912 \begin_layout Standard
2916 \begin_layout Itemize
2917 bitmap: BITMAP/DBITMAP: The new bitmap
2920 \begin_layout Itemize
2921 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
2925 \begin_layout Standard
2926 Like IMAGELOADER:load, but read the bitmap from string <data> instead of
2930 \begin_layout Subsubsection
2931 Static function load_png: Load a bitmap from PNG file
2934 \begin_layout Itemize
2935 Syntax: bitmap, palette gui.image.load_png(file, [base])
2938 \begin_layout Itemize
2939 Syntax: bitmap, palette classes.IMAGELOADER.load_png(file, [base])
2942 \begin_layout Itemize
2944 gui.bitmap_load_png(...)
2947 \begin_layout Standard
2951 \begin_layout Itemize
2952 file: string: The file to read.
2955 \begin_layout Itemize
2956 base: string: The base to resolve <file> relative to.
2959 \begin_layout Standard
2963 \begin_layout Itemize
2964 bitmap: BITMAP/DBITMAP: The new bitmap
2967 \begin_layout Itemize
2968 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
2972 \begin_layout Standard
2973 Like IMAGELOADER:load, but load a PNG file instead.
2976 \begin_layout Subsubsection
2977 Static function load_png_str: Load a PNG bitmap from string
2980 \begin_layout Itemize
2981 Syntax: bitmap, palette gui.image.load_png_str(data)
2984 \begin_layout Itemize
2985 Syntax: bitmap, palette classes.IMAGELOADER.load_png_str(data)
2988 \begin_layout Itemize
2990 gui.bitmap_load_png_str(...)
2993 \begin_layout Standard
2997 \begin_layout Itemize
2998 data: string: The image data, base64 encoded.
3001 \begin_layout Standard
3005 \begin_layout Itemize
3006 bitmap: BITMAP/DBITMAP: The new bitmap
3009 \begin_layout Itemize
3010 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3014 \begin_layout Standard
3015 Like IMAGELOADER:load_png, but read the bitmap from BASE64 encoded string
3016 <data> instead of file.
3019 \begin_layout Standard
3020 \begin_inset Newpage pagebreak
3026 \begin_layout Subsection
3027 CUSTOMFONT: Arbitrary-sized bitmap font
3030 \begin_layout Subsubsection
3031 Static function new: Return a new empty font
3034 \begin_layout Itemize
3035 Syntax: font gui.font.new()
3038 \begin_layout Itemize
3039 Syntax: font classes.CUSTOMFONT.new()
3042 \begin_layout Itemize
3043 Deprecated: font gui.font_new()
3046 \begin_layout Standard
3050 \begin_layout Itemize
3051 font: CUSTOMFONT: New font.
3054 \begin_layout Standard
3055 Create a new font with no characters and return it.
3058 \begin_layout Subsubsection
3059 Static function: load: Load a font file
3062 \begin_layout Itemize
3063 Syntax: font gui.font.load(file, [base])
3066 \begin_layout Itemize
3067 Syntax: font gui.font.load()
3070 \begin_layout Itemize
3071 Syntax: font classes.CUSTOMFONT.load(file, [base])
3074 \begin_layout Itemize
3075 Syntax: font classes.CUSTOMFONT.load()
3078 \begin_layout Itemize
3079 Deprecated: font gui.loadfont(...)
3082 \begin_layout Standard
3086 \begin_layout Itemize
3087 file: string: The file to read the font from
3090 \begin_layout Itemize
3091 base: string: The file to resolve <file> relative to.
3094 \begin_layout Standard
3098 \begin_layout Itemize
3099 font: CUSTOMFONT: New font.
3102 \begin_layout Standard
3103 Load font from file <file> (relative to <base>).
3104 If no filename is given, system default font is loaded.
3107 \begin_layout Subsubsection
3108 operator(): Render text to screen
3111 \begin_layout Itemize
3112 Syntax: font(x, y, text, [fgc], [bgc], [hlc])
3115 \begin_layout Standard
3119 \begin_layout Itemize
3120 font: CUSTOMFONT: The font to use.
3123 \begin_layout Itemize
3124 x: number: The x-position on screen to draw to.
3127 \begin_layout Itemize
3128 y: number: The y-position on screen to draw to.
3131 \begin_layout Itemize
3132 text: string: The text to draw.
3135 \begin_layout Itemize
3136 fgc: number/string: Foreground color (default white).
3139 \begin_layout Itemize
3140 bgc: number/string: Background color (default transparent).
3143 \begin_layout Itemize
3144 hlc: number/string: Outline color (default transparent).
3147 \begin_layout Standard
3148 Draws a string <text> with specified font <font> and colors <fgc>,<bgc>,<hlc>
3152 \begin_layout Itemize
3153 If <hlc> is transparent, no outline is drawn.
3156 \begin_layout Subsubsection
3157 Method edit: Alter glyph in font
3160 \begin_layout Itemize
3161 Syntax: font:edit(character, glyph)
3164 \begin_layout Standard
3168 \begin_layout Itemize
3169 font: CUSTOMFONT: The font to edit.
3172 \begin_layout Itemize
3173 character: string: The character to edit (UTF-8 encoded).
3176 \begin_layout Itemize
3177 glyph: BITMAP: The bitmap to use.
3180 \begin_layout Standard
3181 Replace character <character> in font <font> by <glyph>.
3184 \begin_layout Itemize
3185 Color index 0 is background, everything else is foreground.
3188 \begin_layout Itemize
3189 <character> may be empty string, meaning the replacement character used
3193 \begin_layout Itemize
3194 <character> may be multi-codepoint string, meaning character used for that
3198 \begin_layout Standard
3199 \begin_inset Newpage pagebreak
3205 \begin_layout Subsection
3206 ICONV: Character set conversions
3209 \begin_layout Subsubsection
3210 Static function new: Create new character set converter
3213 \begin_layout Itemize
3214 Syntax: iconv iconv.new(from, to);
3217 \begin_layout Itemize
3218 Syntax: iconv classes.ICONV.new(from, to);
3221 \begin_layout Itemize
3222 Deprecated: iconv iconv_new(...);
3225 \begin_layout Standard
3229 \begin_layout Itemize
3230 from: string: The source character set.
3233 \begin_layout Itemize
3234 to: string: The target character set.
3237 \begin_layout Standard
3241 \begin_layout Itemize
3242 iconv: ICONV: The converter.
3245 \begin_layout Standard
3246 Create a character set converter, converting from <from> to <to> and return
3250 \begin_layout Subsubsection
3251 Operator(): Convert string fragment from character set to another
3254 \begin_layout Itemize
3255 Syntax: success, result, unconverted, error iconv(input)
3258 \begin_layout Standard
3262 \begin_layout Itemize
3263 iconv: ICONV: The context to use.
3266 \begin_layout Itemize
3267 input: string: The input to convert.
3270 \begin_layout Standard
3274 \begin_layout Itemize
3275 success: boolean: True if conversion was successful, false if not.
3278 \begin_layout Itemize
3279 result: string: The string (partially) converted.
3282 \begin_layout Itemize
3283 unconvered: number: Number of bytes that were not converted (only if <success>
3287 \begin_layout Itemize
3288 error: string: Error that caused conversion to stop (only if <success> is
3293 \begin_layout Itemize
3294 INVALID: The input string is invalid.
3297 \begin_layout Itemize
3298 INCOMPLETE: The input string cuts off in middle of character.
3301 \begin_layout Itemize
3302 INTERNALERR: Internal error.
3306 \begin_layout Standard
3307 Convert a string <input> using character set converter <iconv> and return
3311 \begin_layout Standard
3312 \begin_inset Newpage pagebreak
3318 \begin_layout Subsection
3319 FILEREADER: Read a file as a stream
3322 \begin_layout Subsubsection
3323 Static function open: Open a stream
3326 \begin_layout Itemize
3327 Syntax: handle filereader.open(file, [base])
3330 \begin_layout Itemize
3331 Syntax: handle classes.FILEREADER.open(file, [base])
3334 \begin_layout Itemize
3335 Deprecated: handle open_file(file, [base])
3338 \begin_layout Standard
3342 \begin_layout Itemize
3343 file: string: The filename to read.
3346 \begin_layout Itemize
3347 base: string: The base <file> is resolved against.
3350 \begin_layout Standard
3354 \begin_layout Itemize
3355 handle: FILEREADER: The new file reader.
3358 \begin_layout Standard
3359 Open file <file> (relative to <base>) and return a handle to it.
3362 \begin_layout Subsubsection
3363 operator(): Read line/bytes from stream
3366 \begin_layout Itemize
3367 Syntax: result handle()
3370 \begin_layout Itemize
3371 Syntax: result handle(bytes)
3374 \begin_layout Standard
3378 \begin_layout Itemize
3379 handle: FILEREADER: The handle to read from.
3382 \begin_layout Itemize
3383 bytes: Number of bytes to read (default is next line).
3386 \begin_layout Standard
3390 \begin_layout Itemize
3391 result: string: The read data, or nil on end-of-file.
3394 \begin_layout Standard
3395 Reads next line or <bytes> bytes from specified file handle <handle>.
3398 \begin_layout Itemize
3399 If reading specified number of bytes, the bytes are read in binary mode
3403 \begin_layout Itemize
3404 If reading next line, the line is read in text mode (any line ending is
3408 \begin_layout Subsubsection
3409 Method lines: Iterator to read all lines
3412 \begin_layout Itemize
3413 Syntax: for line in handle:lines() do ...
3417 \begin_layout Standard
3421 \begin_layout Itemize
3422 handle: FILEREADER: The handle to read.
3425 \begin_layout Standard
3429 \begin_layout Itemize
3430 A lua iterator with one variable.
3433 \begin_layout Standard
3434 Return a Lua iterator that iterates all the lines in <handle>.
3437 \begin_layout Standard
3438 \begin_inset Newpage pagebreak
3444 \begin_layout Section
3448 \begin_layout Subsection
3449 print: Print values to console
3452 \begin_layout Itemize
3453 Syntax: none print(value...
3457 \begin_layout Standard
3458 Prints specified values to console.
3459 Can print any Lua type at least enough to identify the type and instance.
3462 \begin_layout Subsection
3463 tostringx: Format a value to string
3466 \begin_layout Itemize
3467 Syntax: string tostringx(value val)
3470 \begin_layout Standard
3471 Formats value <val> like print would, and returns the result as a string.
3474 \begin_layout Subsection
3475 exec: Execute lsnes commands
3478 \begin_layout Itemize
3479 Syntax: none exec(string cmd)
3482 \begin_layout Standard
3483 Execute lsnes command <cmd>.
3486 \begin_layout Subsection
3487 utime: Get current time
3490 \begin_layout Itemize
3491 Syntax: (number,number) utime()
3494 \begin_layout Standard
3495 Returns two numbers.
3496 First is time since some epoch in seconds, the second is microseconds mod
3497 10^6 since that epoch.
3500 \begin_layout Subsection
3501 emulator_ready: Check if emulator has been fully initialized
3504 \begin_layout Itemize
3505 Syntax: boolean emulator_ready()
3508 \begin_layout Standard
3509 Returns true if emulator has finished booting, false if not (on_startup()
3510 will be issued later).
3513 \begin_layout Subsection
3514 set_idle_timeout: Run function after timeout when emulator is idle
3517 \begin_layout Itemize
3518 Syntax: none set_idle_timeout(number timeout)
3521 \begin_layout Standard
3522 Set number of microseconds to block idle for.
3523 After this timeout has expired, on_idle() will be called once.
3526 \begin_layout Subsection
3527 set_timer_timeout: Run function after timeout.
3530 \begin_layout Itemize
3531 Syntax: none set_timer_timeout(number timeout)
3534 \begin_layout Standard
3535 Set number of microseconds to block timer for.
3536 After this timeout has expired, on_timer() will be called once.
3539 \begin_layout Subsection
3540 bus_address: Look up address in system bus.
3543 \begin_layout Itemize
3544 Syntax: none bus_address(number bus_addr)
3547 \begin_layout Standard
3548 Returns virtual address corresponding to specified address on system bus.
3551 \begin_layout Subsection
3552 loopwrapper: Convert loop into callable function
3555 \begin_layout Itemize
3556 Syntax: function loopwrapper(function fun, ...)
3559 \begin_layout Standard
3560 Calls function <fun> with function and specified arguments.
3561 The function passed suspends execution until the function returned is called.
3562 Handy for linear flow control among multiple invocations of a hook.
3566 \begin_layout LyX-Code
3567 on_paint = loopwrapper(function(wait)
3571 \begin_layout LyX-Code
3576 \begin_layout LyX-Code
3578 \begin_inset Quotes eld
3582 \begin_inset Quotes erd
3588 \begin_layout LyX-Code
3593 \begin_layout LyX-Code
3598 \begin_layout LyX-Code
3602 \begin_layout Subsection
3603 list_bindings: List keybindings
3606 \begin_layout Itemize
3607 Syntax: table list_bindings([string cmd])
3610 \begin_layout Standard
3611 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
3612 If <cmd> is specified, the table is limited to that command.
3613 Also searches for controller keys.
3616 \begin_layout Subsection
3617 get_alias: Get expansion of alias
3620 \begin_layout Itemize
3621 Syntax: string get_alias(string aname)
3624 \begin_layout Standard
3625 Get expansion of given alias <aname>.
3628 \begin_layout Subsection
3629 set_alias: Set expansion of alias
3632 \begin_layout Itemize
3633 Syntax: none set_alias(string aname, string value)
3636 \begin_layout Standard
3637 Set expansion of given alias.
3640 \begin_layout Subsection
3641 create_ibind: Create invese binding
3644 \begin_layout Itemize
3645 Syntax: INVERSEBIND create_ibind(string name, string cmd)
3648 \begin_layout Standard
3649 Return object representing inverse binding with specified name <name> and
3650 specified command <cmd>.
3653 \begin_layout Itemize
3654 Note: To create press/release commands, use aliases +foo and -foo .
3657 \begin_layout Itemize
3658 Note: Keep the returned object around.
3661 \begin_layout Subsection
3662 create_command: Create a command
3665 \begin_layout Itemize
3666 Syntax: COMMANDBIND create_commmand(string name, function a)
3669 \begin_layout Itemize
3670 Syntax: COMMANDBIND create_commmand(string name, function a, function b)
3673 \begin_layout Standard
3674 Return object representing a command (pair).
3677 \begin_layout Itemize
3678 If only one function is specied, the command is level-sensitive, <a> is
3682 \begin_layout Itemize
3683 If <b> is function, the function is edge-sensitive, <a> is positive edge
3684 callback and <b> is negative edge callback.
3687 \begin_layout Itemize
3688 All callbacks get single argument: The parameters passed.
3691 \begin_layout Itemize
3692 Keep the returned object around.
3695 \begin_layout Subsection
3696 loadfile: Load Lua script
3699 \begin_layout Itemize
3700 Syntax: function loadfile(string filename[, string base])
3703 \begin_layout Standard
3704 Load lua script from <filename>, resolved relative to <base> (if empty,
3708 \begin_layout Subsection
3709 dofile: Execute Lua script
3712 \begin_layout Itemize
3713 Syntax: function dofile(string filename[, string base])
3716 \begin_layout Standard
3717 Execute lua script from <filename>, resolved relative to <base> (if empty,
3718 current directory) and return all return values.
3721 \begin_layout Subsection
3722 resolve_filename: Resolve name of file relative to another
3725 \begin_layout Itemize
3726 Syntax: string resolve_file(string filename, string base)
3729 \begin_layout Standard
3730 Resolve name of file <filename> relative to <base> and return the result.
3733 \begin_layout Subsection
3734 render_queue_function: Return paint function for render queue
3737 \begin_layout Itemize
3738 Syntax: function render_queue_function(RENDERQUEUE rq)
3741 \begin_layout Standard
3742 Return function that renders render queue <rq>.
3745 \begin_layout Itemize
3746 Handy for paint callback if one is using render queues updated in other
3751 \begin_layout LyX-Code
3752 handle = callback.paint:register(render_queue_function(my_rq));
3755 \begin_layout Subsection
3756 identify_class: Identify class of object
3759 \begin_layout Itemize
3760 Syntax: string identify_class(userdata object)
3763 \begin_layout Standard
3764 Identifies the class of userdata <object>, if possible.
3765 If no identification is possible, returns
3766 \begin_inset Quotes eld
3770 \begin_inset Quotes erd
3776 \begin_layout Subsection
3777 lookup_class: Lookup class by name
3780 \begin_layout Itemize
3781 Syntax: classobj lookup_class(string name)
3784 \begin_layout Standard
3785 Looks up class corresponding to <name>, if possible.
3786 If not found, returns nil.
3787 The classobj has following fields:
3790 \begin_layout Itemize
3791 _static_methods: Return static method names
3794 \begin_layout Itemize
3795 _class_methods: Return class method names
3798 \begin_layout Itemize
3799 <static-function-name>: The specified static function.
3802 \begin_layout Subsection
3803 all_classes: Get list of all classes
3806 \begin_layout Itemize
3811 \begin_layout Standard
3812 Get names of all classes available.
3815 \begin_layout Subsection
3819 \begin_layout Standard
3823 \begin_layout Subsection
3824 filereader: Class FILEREADER
3827 \begin_layout Standard
3828 See class FILEREADER.
3831 \begin_layout Standard
3832 \begin_inset Newpage pagebreak
3838 \begin_layout Section
3842 \begin_layout Standard
3843 Bitwise logical functions and related.
3846 \begin_layout Subsection
3847 bit.none/bit.bnot: Bitwise none or NOT function
3850 \begin_layout Itemize
3851 Syntax: number bit.none(number...)
3854 \begin_layout Itemize
3855 Syntax: number bit.bnot(number...)
3858 \begin_layout Standard
3859 48-bit bitwise NOT / NONE function (set bits that are set in none of the
3863 \begin_layout Subsection
3864 bit.any/bit.bor: Bitwise any or OR function
3867 \begin_layout Itemize
3868 Syntax: number bit.any(number...)
3871 \begin_layout Itemize
3872 Syntax: number bit.bor(number...)
3875 \begin_layout Standard
3876 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
3879 \begin_layout Subsection
3880 bit.all/bit.band: Bitwise all or AND function
3883 \begin_layout Itemize
3884 Syntax: number bit.all(number...)
3887 \begin_layout Itemize
3888 Syntax: number bit.band(number...)
3891 \begin_layout Standard
3892 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
3896 \begin_layout Subsection
3897 bit.parity/bit.bxor: Bitwise parity or XOR function
3900 \begin_layout Itemize
3901 Syntax: number bit.parity(number...)
3904 \begin_layout Itemize
3905 Syntax: number bit.bxor(number...)
3908 \begin_layout Standard
3909 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
3913 \begin_layout Subsection
3914 bit.lrotate: Rotate a number left
3917 \begin_layout Itemize
3918 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
3921 \begin_layout Standard
3922 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
3926 \begin_layout Subsection
3927 bit.rrotate: Rotate a number right
3930 \begin_layout Itemize
3931 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
3934 \begin_layout Standard
3935 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
3939 \begin_layout Subsection
3940 bit.lshift: Shift a number left
3943 \begin_layout Itemize
3944 Syntax: number bit.lshift(number base[, number amount[, number bits]])
3947 \begin_layout Standard
3948 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
3950 The new bits are filled with zeroes.
3953 \begin_layout Subsection
3954 bit.lrshift: Shift a number right (logical)
3957 \begin_layout Itemize
3958 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
3961 \begin_layout Standard
3962 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
3964 The new bits are filled with zeroes.
3967 \begin_layout Subsection
3968 bit.arshift: Shift a number right (arithmetic)
3971 \begin_layout Itemize
3972 Syntax: number bit.arshift(number base[, number amount[, number bits]])
3975 \begin_layout Standard
3976 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
3978 The new bits are shifted in with copy of the high bit.
3981 \begin_layout Subsection
3982 bit.extract: Extract/shuffle bits from number
3985 \begin_layout Itemize
3986 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
3989 \begin_layout Standard
3990 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
3993 \begin_layout Itemize
3994 Note: Bit numbers up to 51 should work reliably (then things start falling
3995 apart due to double precision issues).
3998 \begin_layout Itemize
3999 Note: There are two special bit positions, true and false, standing for
4000 always set bit and always clear bit.
4003 \begin_layout Subsection
4004 bit.value: Construct number with specified bits set
4007 \begin_layout Itemize
4008 Syntax: number bit.value([number bit1[, number bit2,...]])
4011 \begin_layout Standard
4012 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
4013 <bit2> places and so on.
4014 As special value, nil argument is no-op.
4017 \begin_layout Subsection
4018 bit.test_any: Test if any bit is set
4021 \begin_layout Itemize
4022 Syntax: boolean bit.test_any(number a, number b)
4025 \begin_layout Standard
4026 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
4029 \begin_layout Subsection
4030 bit.test_all: Test if all bits are set
4033 \begin_layout Itemize
4034 Syntax: boolean bit.test_all(number a, number b)
4037 \begin_layout Standard
4038 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
4041 \begin_layout Subsection
4042 bit.popcount: Population count
4045 \begin_layout Itemize
4046 Syntax: number bit.popcount(number a)
4049 \begin_layout Standard
4050 Returns number of set bits in <a>.
4053 \begin_layout Subsection
4054 bit.clshift: Chained left shift
4057 \begin_layout Itemize
4058 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
4062 \begin_layout Standard
4063 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
4064 numbers to be of specified number of bits <bits> (default 48).
4067 \begin_layout Subsection
4068 bit.crshift: Chained right shift
4071 \begin_layout Itemize
4072 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
4076 \begin_layout Standard
4077 Does chained right shift on <a>, <b> by <amount> positions (default 1),
4078 assuming numbers to be of specified number of bits <bits> (default 48).
4081 \begin_layout Subsection
4082 bit.flagdecode: Decode bitfield into flags
4085 \begin_layout Itemize
4086 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
4090 \begin_layout Standard
4091 Return string of length bits where ith character is ith character of on
4092 if bit i is on, otherwise ith character of off.
4093 Out of range reads give last character.
4096 \begin_layout Itemize
4097 Note: <on> defaults to '*' if empty.
4100 \begin_layout Itemize
4101 Note: <off> defaults to '-' if empty.
4104 \begin_layout Subsection
4105 bit.rflagdecode: Decode bitfield into flags
4108 \begin_layout Itemize
4109 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
4113 \begin_layout Standard
4114 Like bit.flagdecode, but outputs the string in the opposite order (most significa
4118 \begin_layout Subsection
4119 bit.swap{,s}{,h,d,q}word: Swap word endian
4122 \begin_layout Itemize
4123 Syntax: number bit.swapword(number n)
4126 \begin_layout Itemize
4127 Syntax: number bit.swaphword(number n)
4130 \begin_layout Itemize
4131 Syntax: number bit.swapdword(number n)
4134 \begin_layout Itemize
4135 Syntax: number bit.swapqword(number n)
4138 \begin_layout Itemize
4139 Syntax: number bit.swapsword(number n)
4142 \begin_layout Itemize
4143 Syntax: number bit.swapshword(number n)
4146 \begin_layout Itemize
4147 Syntax: number bit.swapsdword(number n)
4150 \begin_layout Itemize
4151 Syntax: number bit.swapsqword(number n)
4154 \begin_layout Standard
4155 Swap endianess of (un)signed integer <n>.
4158 \begin_layout Subsection
4159 bit.compose: Compose multi-byte number
4162 \begin_layout Itemize
4163 Syntax: number bit.compose(number n...)
4166 \begin_layout Standard
4168 \begin_inset Formula $n_{1}+256n_{2}+256^{2}n_{3}+\ldots$
4174 \begin_layout Subsection
4175 bit.binary_ld_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Load binary integer
4178 \begin_layout Itemize
4179 Syntax: number bit.binary_ld_<type>le(string str, number pos);
4182 \begin_layout Itemize
4183 Syntax: number bit.binary_ld_<type>be(string str, number pos);
4186 \begin_layout Standard
4187 Load little (*le) or big (*be) endian binary number from position <pos>
4189 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4193 \begin_layout Subsection
4194 bit.binary_st_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Store binary integer
4197 \begin_layout Itemize
4198 Syntax: string bit.binary_st_<type>le(number x);
4201 \begin_layout Itemize
4202 Syntax: string bit.binary_st_<type>be(number x);
4205 \begin_layout Standard
4206 Store specified number <x> as binary in string and return the result.
4207 Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4211 \begin_layout Subsection
4212 bit.quotent: Integer quotent
4215 \begin_layout Itemize
4216 Syntax: number bit.quotent(number a, number b)
4219 \begin_layout Standard
4220 Calculate quotent a/b.
4223 \begin_layout Standard
4224 \begin_inset Newpage pagebreak
4230 \begin_layout Section
4234 \begin_layout Subsection
4235 classes.<foo>: The classobj for class <foo>
4238 \begin_layout Itemize
4239 Syntax: classes.<foo>
4242 \begin_layout Standard
4243 The classobj for class <foo>.
4246 \begin_layout Subsection
4247 classes.<foo>._static_methods: Enumerate static methods
4250 \begin_layout Itemize
4252 classes.<foo>._static_methods()
4255 \begin_layout Standard
4256 Returns all static methods of <foo> as strings.
4259 \begin_layout Subsection
4260 classes.<foo>._class_methods: Enumerate static methods
4263 \begin_layout Itemize
4265 classes.<foo>._class_methods()
4268 \begin_layout Standard
4269 Returns all class methods of <foo> as strings.
4272 \begin_layout Subsection
4273 classes.<foo>.<bar>: Static method
4276 \begin_layout Itemize
4277 Syntax: variable classes.<foo>.<bar>(variable...)
4280 \begin_layout Standard
4281 Invokes static method <bar> of class <foo>.
4284 \begin_layout Section
4288 \begin_layout Subsection
4289 gui.resolution: Get current resolution
4292 \begin_layout Itemize
4293 Syntax: (number, number) gui.resolution()
4296 \begin_layout Standard
4297 Returns 2-tuple (hresolution, vresolution).
4300 \begin_layout Subsection
4301 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
4304 \begin_layout Itemize
4305 Syntax: number gui.left_gap(number gap)
4308 \begin_layout Itemize
4309 Syntax: number gui.right_gap(number gap)
4312 \begin_layout Itemize
4313 Syntax: number gui.top_gap(number gap)
4316 \begin_layout Itemize
4317 Syntax: number gui.bottom_gap(number gap)
4320 \begin_layout Standard
4321 Set the specified edge gap to specified value <gap> (max gap is 8191).
4322 If successful, old gap is returned.
4325 \begin_layout Subsection
4326 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
4330 \begin_layout Itemize
4331 Syntax: number gui.delta_left_gap(number dgap)
4334 \begin_layout Itemize
4335 Syntax: number gui.delta_right_gap(number dgap)
4338 \begin_layout Itemize
4339 Syntax: number gui.delta_top_gap(number dgap)
4342 \begin_layout Itemize
4343 Syntax: number gui.delta_bottom_gap(number dgap)
4346 \begin_layout Standard
4347 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
4348 and return the old gap (returns nothing on error).
4351 \begin_layout Subsection
4352 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
4355 \begin_layout Itemize
4356 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
4360 \begin_layout Itemize
4361 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
4365 \begin_layout Itemize
4366 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
4370 \begin_layout Itemize
4371 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
4375 \begin_layout Standard
4376 Draw specified text on the GUI (each character cell is 8 or 16 wide and
4381 \begin_layout Itemize
4382 x: X-coordinate to start the drawing from (and x-coordinate at begining
4386 \begin_layout Itemize
4387 y: Y-coordinate to start the drawing from.
4390 \begin_layout Itemize
4391 text: The text to draw.
4394 \begin_layout Itemize
4395 fgc: Text color (default is 0xFFFFFF (white))
4398 \begin_layout Itemize
4399 bgc: Background color (default is -1 (transparent))
4402 \begin_layout Standard
4403 Note: The H variants draw at double width and V variants draw at double
4407 \begin_layout Subsection
4408 gui.rectangle: Draw a rectangle
4411 \begin_layout Itemize
4412 Syntax: none gui.rectangle(number x, number y, number width, number height[,
4413 number thickness[, number outline[, number fill]]])
4416 \begin_layout Standard
4417 Draw rectangle on the GUI.
4421 \begin_layout Itemize
4422 x: X-coordinate of left edge.
4425 \begin_layout Itemize
4426 y: Y-coordinate of upper edge.
4429 \begin_layout Itemize
4430 width: Width of rectangle.
4433 \begin_layout Itemize
4434 height: Height of rectangle.
4437 \begin_layout Itemize
4438 thickness: Thickness of outline (default is 1).
4441 \begin_layout Itemize
4442 outline: Color of outline (default is 0xFFFFFF (white))
4445 \begin_layout Itemize
4446 fill: Color of fill (default is -1 (transparent))
4449 \begin_layout Subsection
4450 gui.box: Draw a 3D-effect box
4453 \begin_layout Itemize
4454 Syntax: none gui.box(number x, number y, number width, number height[, number
4455 thickness[, number outline1[,number outline2[, number fill]]]])
4458 \begin_layout Standard
4459 Draw rectangle with 3D effect on the GUI.
4463 \begin_layout Itemize
4464 x: X-coordinate of left edge.
4467 \begin_layout Itemize
4468 y: Y-coordinate of upper edge.
4471 \begin_layout Itemize
4472 width: Width of rectangle.
4475 \begin_layout Itemize
4476 height: Height of rectangle.
4479 \begin_layout Itemize
4480 thickness: Thickness of outline (default is 1).
4483 \begin_layout Itemize
4484 outline1: First color of outline (default is 0xFFFFFF (white))
4487 \begin_layout Itemize
4488 outline2: First color of outline (default is 0x808080 (dark gray))
4491 \begin_layout Itemize
4492 fill: Color of fill (default is 0xC0C0C0 (light grayy))
4495 \begin_layout Subsection
4496 gui.pixel: Draw a single pixel
4499 \begin_layout Itemize
4500 Syntax: none gui.pixel(number x, number y[, number color])
4503 \begin_layout Standard
4504 Draw one pixel on the GUI.
4508 \begin_layout Itemize
4509 x: X-coordinate of the pixel
4512 \begin_layout Itemize
4513 y: Y-coordinate of the pixel
4516 \begin_layout Itemize
4517 color: Color of the pixel (default is 0xFFFFFF (white))
4520 \begin_layout Subsection
4521 gui.crosshair: Draw a crosshair
4524 \begin_layout Itemize
4525 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
4528 \begin_layout Standard
4533 \begin_layout Itemize
4534 x: X-coordinate of the crosshair
4537 \begin_layout Itemize
4538 y: Y-coordinate of the crosshair
4541 \begin_layout Itemize
4542 length: Length of the crosshair lines (default 10).
4545 \begin_layout Itemize
4546 color: Color of the crosshair (default is 0xFFFFFF (white))
4549 \begin_layout Subsection
4550 gui.line: Draw a line
4553 \begin_layout Itemize
4554 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
4558 \begin_layout Standard
4563 \begin_layout Itemize
4564 x1: X-coordinate of one end.
4567 \begin_layout Itemize
4568 y1: Y-coordinate of one end.
4571 \begin_layout Itemize
4572 x2: X-coordinate of the other end.
4575 \begin_layout Itemize
4576 y2: Y-coordinate of the other end.
4579 \begin_layout Itemize
4580 color: Color of the line (default is 0xFFFFFF (white)).
4583 \begin_layout Subsection
4584 gui.circle: Draw a (filled) circle
4587 \begin_layout Itemize
4588 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
4589 border[, number fil]]])
4592 \begin_layout Standard
4597 \begin_layout Itemize
4598 x: X-coordinate of the center
4601 \begin_layout Itemize
4602 y: Y-coordinate of the center
4605 \begin_layout Itemize
4606 r: The radius of the circle
4609 \begin_layout Itemize
4610 thick: Border thickness
4613 \begin_layout Itemize
4614 border: Border color (default is 0xFFFFFF (white))
4617 \begin_layout Itemize
4618 fill: Fill color (default is -1 (transparent)).
4621 \begin_layout Subsection
4622 gui.repaint: Arrange a repaint
4625 \begin_layout Itemize
4626 Syntax: none gui.repaint()
4629 \begin_layout Standard
4630 Request on_repaint() to happen as soon as possible.
4633 \begin_layout Subsection
4634 gui.subframe_update: Enable/Disable subframe updates
4637 \begin_layout Itemize
4638 Syntax: none gui.subframe_update(boolean on)
4641 \begin_layout Standard
4642 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
4643 or not happen (<on>=false).
4646 \begin_layout Subsection
4647 gui.screenshot: Write a screenshot
4650 \begin_layout Itemize
4651 Syntax: none gui.screenshot(string filename)
4654 \begin_layout Standard
4655 Write PNG screenshot of the current frame (no drawings) to specified file
4659 \begin_layout Subsection
4660 gui.screenshot_bitmap: Write a screenshot to bitmap
4663 \begin_layout Itemize
4664 Syntax: DBITMAP gui.screenshot_bitmap()
4667 \begin_layout Standard
4668 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
4672 \begin_layout Subsection
4673 gui.color: Compose a color.
4676 \begin_layout Itemize
4677 Syntax: number gui.color(number r, number g, number b[, number a])
4680 \begin_layout Itemize
4681 Syntax: number gui.color(string c)
4684 \begin_layout Standard
4685 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
4686 , each component in scale 0-255.
4687 If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
4689 The default alpha is 256.
4692 \begin_layout Standard
4693 The form taking a string returns color corresponding color name.
4696 \begin_layout Subsection
4697 gui.status: Set status variable
4700 \begin_layout Itemize
4701 Syntax: none gui.status(string name, string value)
4704 \begin_layout Standard
4706 \begin_inset Quotes eld
4710 \begin_inset Quotes erd
4713 to <value> in status area.
4716 \begin_layout Subsection
4717 gui.rainbow: Rainbow color calculation
4720 \begin_layout Itemize
4721 Syntax: number gui.rainbow(number step, number steps[, number color])
4724 \begin_layout Standard
4725 Perform hue rotation of color <color> (default bright red), by <step> steps.
4726 The number of steps per full rotation is given by absolute value of <steps>.
4729 \begin_layout Standard
4730 If <step> is negative, the rotation will be counterclockwise.
4733 \begin_layout Subsection
4734 gui.kill_frame: Kill video frame and associated sound
4737 \begin_layout Itemize
4738 Syntax: none gui.kill_frame()
4741 \begin_layout Standard
4742 Kills the currently dumped video frame + the associated sound.
4743 Only valid in on_video callback.
4746 \begin_layout Subsection
4747 gui.set_video_scale: Set video frame scale
4750 \begin_layout Itemize
4751 Syntax: none gui.set_video_scale(number h, number v)
4754 \begin_layout Standard
4755 Sets the scale factors of current frame to <h>x<v>.
4756 Only valid in on_video callback.
4759 \begin_layout Subsection
4760 gui.arrow: Draw an arrow
4763 \begin_layout Itemize
4764 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
4765 number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
4769 \begin_layout Standard
4770 Draws an arrow using color <color>.
4771 The tip of arrow is at (<x>, <y>).
4775 \begin_layout Enumerate
4776 <length>: The length of arrow tail.
4779 \begin_layout Enumerate
4780 <hwidth>: The width of arrow head.
4784 \begin_layout Enumerate
4785 <direction>: Direction of arrow.
4786 0 is to right, +1 rotates 45 degrees counterclockwise.
4789 \begin_layout Enumerate
4790 <fill>: If true, fill the arrow head.
4794 \begin_layout Enumerate
4795 <twidth>: Tail width.
4800 \begin_layout Enumerate
4801 <hthick>: Head thickness (only used if <fill> is false).
4802 Default is <twidth>.
4805 \begin_layout Subsection
4806 gui.tiled_bitmap: Class TILEMAP
4809 \begin_layout Standard
4813 \begin_layout Subsection
4814 gui.palette: Class PALETTE
4817 \begin_layout Standard
4821 \begin_layout Subsection
4822 gui.bitmap: Class BITMAP
4825 \begin_layout Standard
4829 \begin_layout Subsection
4830 gui.dbitmap: Class DBITMAP
4833 \begin_layout Standard
4837 \begin_layout Subsection
4838 gui.font: Class CUSTOMFONT
4841 \begin_layout Standard
4842 See class CUSTOMFONT.
4845 \begin_layout Subsection
4846 gui.renderctx: Class RENDERCTX
4849 \begin_layout Standard
4850 See class RENDERCTX.
4853 \begin_layout Subsection
4854 gui.image: Class IMAGELOADER
4857 \begin_layout Standard
4858 See class IMAGELOADER.
4861 \begin_layout Standard
4862 \begin_inset Newpage pagebreak
4868 \begin_layout Section
4872 \begin_layout Standard
4874 Functions manipulating input are only available in on_input callback.
4877 \begin_layout Subsection
4878 input.get: Read controller button/axis (deprecated)
4881 \begin_layout Itemize
4882 Syntax: number input.get(number controller, number index)
4885 \begin_layout Standard
4886 Read the specified index <index> (zero-based) from specified controller
4887 <controller> (zero-based).
4891 \begin_layout Subsection
4892 input.set: Write controller button/axis (deprecated)
4895 \begin_layout Itemize
4896 Syntax: none input.set(number controller, number index, number value)
4899 \begin_layout Standard
4900 Write the specified index <index> (zero-based) from specified controller
4901 <controller> (zero-based), storing value <value>.
4904 \begin_layout Subsection
4905 input.get2: Read controller button/axis
4908 \begin_layout Itemize
4909 Syntax: number input.get2(number port, number controller, number index)
4912 \begin_layout Standard
4913 Read the specified input tuple.
4914 Port 0 is system port.
4917 \begin_layout Subsection
4918 input.set2: Write controller button/axis
4921 \begin_layout Itemize
4922 Syntax: input.set2(number port, number controller, number index, number value)
4925 \begin_layout Standard
4926 Write the specified input tuple.
4927 Port 0 is system port.
4930 \begin_layout Subsection
4931 input.lcid_to_pcid2: Look up logical controller
4934 \begin_layout Itemize
4935 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
4938 \begin_layout Standard
4939 Look up physical pcid pair (port, controller) corresponding to specified
4940 logical controller (1-based).
4941 Returns nothing if controller does not exist.
4944 \begin_layout Subsection
4945 input.port_type: Look up port type
4948 \begin_layout Itemize
4949 Syntax: string input.port_type(number port)
4952 \begin_layout Standard
4953 Return type of specified port.
4956 \begin_layout Subsection
4957 input.controller_info: Get information about controller
4960 \begin_layout Itemize
4961 Syntax: table input.controller_info(number port, number controller)
4964 \begin_layout Standard
4965 Get controller info for specified controller.
4966 If controller does not exist, returns nil.
4967 Otherwise returns a table with following fields:
4970 \begin_layout Itemize
4971 type (string): Type of the controller.
4974 \begin_layout Itemize
4975 class (string): Class of the controller.
4978 \begin_layout Itemize
4979 classnum (number): Number of the controller within its class (1-based)
4982 \begin_layout Itemize
4983 lcid (number): Logical controller number of the controller.
4986 \begin_layout Itemize
4987 button_count (number): Number of buttons on controller
4990 \begin_layout Itemize
4991 buttons (array): Array of following info about each button:
4995 \begin_layout Itemize
4996 type (string): Type of button.
4998 \begin_inset Quotes eld
5002 \begin_inset Quotes erd
5006 \begin_inset Quotes eld
5010 \begin_inset Quotes erd
5014 \begin_inset Quotes eld
5018 \begin_inset Quotes erd
5022 \begin_inset Quotes eld
5026 \begin_inset Quotes erd
5032 \begin_layout Itemize
5033 name (string): Name of button.
5036 \begin_layout Itemize
5037 symbol (string): Symbol of button.
5038 Only present for type
5039 \begin_inset Quotes eld
5043 \begin_inset Quotes erd
5049 \begin_layout Itemize
5050 hidden (boolean): True if hidden button.
5055 \begin_layout Subsection
5056 input.veto_button: Veto a button press
5059 \begin_layout Itemize
5060 Syntax: none input.veto_button()
5063 \begin_layout Standard
5064 Signals that the button event should be vetoed.
5065 Only valid in on_button callback.
5068 \begin_layout Subsection
5069 input.geta: Get all buttons for controller (deprecated)
5072 \begin_layout Itemize
5073 Syntax: (number, number...) input.geta(number controller)
5076 \begin_layout Standard
5077 Get input state for entiere controller.
5078 Returns n return values.
5081 \begin_layout Itemize
5082 1st return value: Bitmask: bit i is set if i:th index is nonzero
5085 \begin_layout Itemize
5086 2nd- return value: value of i:th index.
5089 \begin_layout Subsection
5090 input.seta: Set all buttons for controller (deprecated)
5093 \begin_layout Itemize
5094 Syntax: none input.seta(number controller, number bitmask, number args...)
5097 \begin_layout Standard
5098 Set state for entiere controller.
5099 args is up to N values for indices (overriding values in bitmask if specified).
5102 \begin_layout Subsection
5103 input.controllertype: Get controller type (deprecated)
5106 \begin_layout Itemize
5107 syntax: string input.controllertype(number controller)
5110 \begin_layout Standard
5111 Get the type of controller as string.
5114 \begin_layout Subsection
5115 input.reset: Execute (delayed) reset
5118 \begin_layout Itemize
5119 Syntax: none input.reset([number cycles])
5122 \begin_layout Standard
5124 If <cycles> is greater than zero, do delayed reset.
5125 0 (or no value) causes immediate reset.
5128 \begin_layout Itemize
5129 Note: Only available with subframe flag false.
5132 \begin_layout Subsection
5133 input.raw: Return raw input data
5136 \begin_layout Itemize
5137 Syntax: table input.raw()
5140 \begin_layout Standard
5141 Returns table of tables of all available keys and axes.
5142 The first table is indexed by key name (platform-dependent!), and the inner
5143 table has the following fields:
5146 \begin_layout Itemize
5147 value: Last reported value for control
5151 \begin_layout Itemize
5152 For keys: 1 for pressed, 0 for released.
5155 \begin_layout Itemize
5156 For axes: -32767...32767.
5159 \begin_layout Itemize
5160 For presure-sensitive buttons: 0...32767.
5163 \begin_layout Itemize
5164 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
5167 \begin_layout Itemize
5168 For mouse: Coordinates relative to game area.
5172 \begin_layout Itemize
5173 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
5176 \begin_layout Subsection
5177 input.keyhook: Hook a key
5180 \begin_layout Itemize
5181 Syntax: none input.keyhook(string key, boolean state)
5184 \begin_layout Standard
5185 Requests that keyhook events to be sent for key <key> (<state>=true) or
5186 not sent (<state>=false).
5189 \begin_layout Subsection
5190 input.joyget: Get controls for controller
5193 \begin_layout Itemize
5194 Syntax: table input.joyget(number logical)
5197 \begin_layout Standard
5198 Returns table for current controls for specified logical controller <logical>.
5199 The names of fields vary by controller type.
5202 \begin_layout Itemize
5203 The buttons have the same name as those are referred to in other contexts
5207 \begin_layout Itemize
5208 The analog axes are usually
5209 \begin_inset Quotes eld
5213 \begin_inset Quotes erd
5217 \begin_inset Quotes eld
5221 \begin_inset Quotes erd
5227 \begin_layout Itemize
5228 Each field is numeric or boolean depending on axis/button.
5231 \begin_layout Subsection
5232 input.joyset: Set controls for controller
5235 \begin_layout Itemize
5236 Syntax: none input.joyset(number controller, table controls)
5239 \begin_layout Standard
5240 Set the the state of specified controller to values specified in specified
5244 \begin_layout Itemize
5245 Each field can be boolean or number.
5248 \begin_layout Itemize
5249 Also, buttons allow strings, which cause value to be inverted.
5252 \begin_layout Subsection
5253 input.lcid_to_pcid: Look up logical controller (deprecated)
5256 \begin_layout Itemize
5257 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
5260 \begin_layout Standard
5261 Returns the legacy pcid for controller (or false if there isn't one), followed
5263 Returns nothing if controller does not exist.
5266 \begin_layout Standard
5267 \begin_inset Newpage pagebreak
5273 \begin_layout Section
5277 \begin_layout Standard
5278 Various keybinding-related functions
5281 \begin_layout Subsection
5282 keyboard.bind: Bind a key
5285 \begin_layout Itemize
5286 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
5289 \begin_layout Standard
5290 Bind specified key with specified modifers to specified command.
5293 \begin_layout Subsection
5294 keyboard.unbind: Unbind a key
5297 \begin_layout Itemize
5298 Syntax: none keyboard.unbind(string mod, string mask, string key)
5301 \begin_layout Standard
5302 Unbind specified key with specified modifers.
5305 \begin_layout Subsection
5306 keyboard.alias: Set alias expansion
5309 \begin_layout Itemize
5310 Syntax: none keyboard.alias(string alias, string expansion)
5313 \begin_layout Standard
5314 Set expansion of given command.
5317 \begin_layout Standard
5318 \begin_inset Newpage pagebreak
5324 \begin_layout Section
5328 \begin_layout Standard
5332 \begin_layout Subsection
5333 subtitle.byindex: Look up start and length of subtitle by index
5336 \begin_layout Itemize
5337 Syntax: (number, number) subtitle.byindex(number i)
5340 \begin_layout Standard
5341 Read the frame and length of ith subtitle.
5342 Returns nothing if not present.
5345 \begin_layout Subsection
5346 subtitle.set: Write a subtitle
5349 \begin_layout Itemize
5350 Syntax: none subtitle.set(number f, number l, string txt)
5353 \begin_layout Standard
5354 Set the text of subtitle.
5357 \begin_layout Subsection
5358 subtitle.get: Read a subtitle
5361 \begin_layout Itemize
5362 Syntax: string subtitle.get(number f, number l)
5365 \begin_layout Standard
5366 Get the text of subtitle.
5369 \begin_layout Subsection
5370 subtitle.delete: Delete a subtitle
5373 \begin_layout Itemize
5374 Syntax: none subtitle.delete(number f, number l)
5377 \begin_layout Standard
5378 Delete specified subtitle.
5381 \begin_layout Standard
5382 \begin_inset Newpage pagebreak
5388 \begin_layout Section
5392 \begin_layout Standard
5393 Host memory handling (extra memory saved to savestates).
5394 Host memory starts empty.
5397 \begin_layout Itemize
5398 Reads out of range return false.
5401 \begin_layout Itemize
5402 Writes out of range extend the memory.
5405 \begin_layout Subsection
5406 hostmemory.read: Read byte from host memory
5409 \begin_layout Itemize
5410 Syntax: number hostmemory.read(number address)
5413 \begin_layout Standard
5414 Reads byte from hostmemory slot address <address>.
5417 \begin_layout Subsection
5418 hostmemory.write: Write byte to host memory
5421 \begin_layout Itemize
5422 Syntax: none hostmemory.write(number address, number value)
5425 \begin_layout Standard
5426 Writes hostmemory slot with value <value> 0-255.
5429 \begin_layout Subsection
5430 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
5433 \begin_layout Itemize
5434 Syntax: number hostmemory.readbyte(number address)
5437 \begin_layout Itemize
5438 Syntax: number hostmemory.readsbyte(number address)
5441 \begin_layout Itemize
5442 Syntax: number hostmemory.readword(number address)
5445 \begin_layout Itemize
5446 Syntax: number hostmemory.readsword(number address)
5449 \begin_layout Itemize
5450 Syntax: number hostmemory.readhword(number address)
5453 \begin_layout Itemize
5454 Syntax: number hostmemory.readshword(number address)
5457 \begin_layout Itemize
5458 Syntax: number hostmemory.readdword(number address)
5461 \begin_layout Itemize
5462 Syntax: number hostmemory.readsdword(number address)
5465 \begin_layout Itemize
5466 Syntax: number hostmemory.readqword(number address)
5469 \begin_layout Itemize
5470 Syntax: number hostmemory.readsqword(number address)
5473 \begin_layout Standard
5474 Read elements (big-endian) from given address <address>.
5477 \begin_layout Itemize
5481 \begin_layout Itemize
5485 \begin_layout Itemize
5489 \begin_layout Itemize
5493 \begin_layout Itemize
5494 qword is 8 elements.
5497 \begin_layout Itemize
5498 The 's' variants do signed read.
5501 \begin_layout Subsection
5502 hostmemory.read{float,double}: Read from host memory
5505 \begin_layout Itemize
5506 syntax: number hostmemory.readfloat(number address)
5509 \begin_layout Itemize
5510 Syntax: number hostmemory.readdouble(number address)
5513 \begin_layout Standard
5514 Read elements (big-endian) floating-pont from given address <address>.
5517 \begin_layout Subsection
5518 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
5521 \begin_layout Itemize
5522 Syntax: number hostmemory.writebyte(number address, number value)
5525 \begin_layout Itemize
5526 Syntax: number hostmemory.writesbyte(number address, number value)
5529 \begin_layout Itemize
5530 Syntax: number hostmemory.writeword(number address, number value)
5533 \begin_layout Itemize
5534 Syntax: number hostmemory.writesword(number address, number value)
5537 \begin_layout Itemize
5538 Syntax: number hostmemory.writehword(number address, number value)
5541 \begin_layout Itemize
5542 Syntax: number hostmemory.writeshword(number address, number value)
5545 \begin_layout Itemize
5546 Syntax: number hostmemory.writedword(number address, number value)
5549 \begin_layout Itemize
5550 Syntax: number hostmemory.writesdword(number address, number value)
5553 \begin_layout Itemize
5554 Syntax: number hostmemory.writeqword(number address, number value)
5557 \begin_layout Itemize
5558 Syntax: number hostmemory.writesqword(number address, number value)
5561 \begin_layout Standard
5562 Write value <value> to elements (little-endian) starting from given address
5566 \begin_layout Itemize
5570 \begin_layout Itemize
5574 \begin_layout Itemize
5578 \begin_layout Itemize
5582 \begin_layout Itemize
5583 qword is 8 elements.
5586 \begin_layout Itemize
5587 The 's' variants do signed write.
5590 \begin_layout Subsection
5591 hostmemory.write{float,double}: Write to host memory
5594 \begin_layout Itemize
5595 syntax: none hostmemory.readfloat(number address, number value)
5598 \begin_layout Itemize
5599 Syntax: none hostmemory.readdouble(number address, number value)
5602 \begin_layout Standard
5603 Write elements (big-endian) floating-pont to given address <address>, storing
5607 \begin_layout Standard
5608 \begin_inset Newpage pagebreak
5614 \begin_layout Section
5618 \begin_layout Standard
5622 \begin_layout Subsection
5623 movie.currentframe: Get current frame number
5626 \begin_layout Itemize
5627 Syntax: number movie.currentframe()
5630 \begin_layout Standard
5631 Return number of current frame.
5634 \begin_layout Subsection
5635 movie.framecount: Get move frame count
5638 \begin_layout Itemize
5639 Syntax: number movie.framecount()
5642 \begin_layout Standard
5643 Return number of frames in movie.
5646 \begin_layout Subsection
5647 movie.readonly: Is in readonly mode?
5650 \begin_layout Itemize
5651 Syntax: boolean movie.readonly()
5654 \begin_layout Standard
5655 Return true if in readonly mode, false if in readwrite.
5658 \begin_layout Subsection
5659 movie.rerecords: Movie rerecord count
5662 \begin_layout Itemize
5663 Syntax: number movie.rerecords()
5666 \begin_layout Standard
5667 Returns the current value of rerecord count.
5670 \begin_layout Subsection
5671 movie.set_readwrite: Set read-write mode.
5674 \begin_layout Itemize
5675 Syntax: none movie.set_readwrite()
5678 \begin_layout Standard
5679 Set readwrite mode (does not cause on_readwrite callback).
5682 \begin_layout Subsection
5683 movie.frame_subframes: Count subframes in frame
5686 \begin_layout Itemize
5687 Syntax: number movie.frame_subframes(number frame)
5690 \begin_layout Standard
5691 Count number of subframes in specified frame <frame> (frame numbers are
5692 1-based) and return that.
5695 \begin_layout Subsection
5696 movie.read_subframes: Read subframe data (deprecated)
5699 \begin_layout Itemize
5700 Syntax: table movie.read_subframes(number frame, number subframe)
5703 \begin_layout Standard
5704 Read specifed subframe in specified frame and return data as array.
5707 \begin_layout Subsection
5708 movie.read_rtc: Read current RTC time
5711 \begin_layout Itemize
5712 Syntax: (number, number) movie.read_rtc()
5715 \begin_layout Standard
5716 Returns the current value of the RTC as a pair (second, subsecond).
5719 \begin_layout Subsection
5720 movie.unsafe_rewind: Fast movie rewind to saved state
5723 \begin_layout Itemize
5724 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
5727 \begin_layout Standard
5728 Start setting point for unsafe rewind or jump to point of unsafe rewind.
5731 \begin_layout Itemize
5732 If called without argument, causes emulator to start process of setting
5733 unsafe rewind point.
5734 When this has finished, callback on_set_rewind occurs, passing the rewind
5735 state to lua script.
5738 \begin_layout Itemize
5739 If called with argument, causes emulator rewind to passed rewind point as
5741 Readwrite mode is implicitly activated.
5744 \begin_layout Standard
5745 The following warnings apply to unsafe rewinding:
5748 \begin_layout Itemize
5749 There are no safety checks against misuse (that's what
5750 \begin_inset Quotes eld
5754 \begin_inset Quotes erd
5760 \begin_layout Itemize
5761 Only call rewind from timeline rewind point was set from.
5764 \begin_layout Itemize
5765 Only call rewind from after the rewind point was set.
5768 \begin_layout Subsection
5769 movie.to_rewind: Load savestate as rewind point
5772 \begin_layout Itemize
5773 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
5776 \begin_layout Standard
5777 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
5778 corresponding to it.
5781 \begin_layout Itemize
5782 Note: This operation does not take emulated time.
5785 \begin_layout Subsection
5786 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
5789 \begin_layout Itemize
5790 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE/string movie])
5793 \begin_layout Itemize
5794 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
5797 \begin_layout Standard
5798 Copies specified movie or branch <movie>/current object (if none or nil,
5799 the active movie) as new movie object.
5802 \begin_layout Subsection
5803 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
5806 \begin_layout Itemize
5807 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE/string movie,] number frame)
5810 \begin_layout Itemize
5811 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
5814 \begin_layout Standard
5815 Get INPUTFRAME object corresponding to specified frame in specified movie
5819 \begin_layout Subsection
5820 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
5823 \begin_layout Itemize
5824 Syntax: none movie.set_frame([INPUTMOVIE/string movie,] number frame, INPUTFRAME
5828 \begin_layout Itemize
5829 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
5832 \begin_layout Standard
5833 Set data in specified frame.
5836 \begin_layout Itemize
5837 Note: Past can't be edited in active movie.
5840 \begin_layout Subsection
5841 movie.get_size/INPUTMOVIE::get_size: Get size of movie
5844 \begin_layout Itemize
5845 Syntax: integer movie.get_size([INPUTMOVIE/string movie])
5848 \begin_layout Itemize
5849 Syntax: integer INPUTMOVIE::get_size()
5852 \begin_layout Standard
5853 Return number of subframes in specified movie or branch.
5856 \begin_layout Subsection
5857 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
5860 \begin_layout Itemize
5861 Syntax: number movie.count_frames([INPUTMOVIE/string movie])
5864 \begin_layout Itemize
5865 Syntax: number INPUTMOVIE::count_frames()
5868 \begin_layout Standard
5869 Return number of frames in movie.
5872 \begin_layout Subsection
5873 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
5876 \begin_layout Itemize
5877 Syntax: number movie.find_frame([INPUTMOVIE/string movie], number frame)
5880 \begin_layout Itemize
5881 Syntax: number INPUTMOVIE::find_frame(number frame)
5884 \begin_layout Standard
5885 Returns starting subframe of given frame (frame numbers are 1-based).
5886 Returns -1 if frame number is bad.
5889 \begin_layout Subsection
5890 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
5893 \begin_layout Itemize
5894 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE/string movie])
5897 \begin_layout Itemize
5898 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
5901 \begin_layout Standard
5902 Return blank INPUTFRAME with frame type from specified movie.
5905 \begin_layout Subsection
5906 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
5909 \begin_layout Itemize
5910 Syntax: none movie.append_frames([INPUTMOVIE/string movie,] number frames)
5913 \begin_layout Itemize
5914 Syntax: none INPUTMOVIE::append_frames(number frames)
5917 \begin_layout Standard
5918 Append specified number <frames> of frames.
5921 \begin_layout Subsection
5922 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
5925 \begin_layout Itemize
5926 Syntax: none movie.append_frame([INPUTMOVIE/string movie,] INPUTFRAME frame)
5929 \begin_layout Itemize
5930 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
5933 \begin_layout Standard
5934 Append specified frame <frame>.
5935 Past of current movie can't be edited.
5938 \begin_layout Subsection
5939 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
5942 \begin_layout Itemize
5943 Syntax: none movie.truncate([INPUTMOVIE/string movie,] number frames)
5946 \begin_layout Itemize
5947 Syntax: none INPUTMOVIE::truncate(number frames)
5950 \begin_layout Standard
5951 Truncate the specified movie to specified number of frames.
5954 \begin_layout Subsection
5955 movie.edit/INPUTMOVIE::edit: Edit a movie
5958 \begin_layout Itemize
5959 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
5960 controller, number control, number/bool value)
5963 \begin_layout Itemize
5964 Syntax: none movie.edit(string branch, number frame, number port, number
5965 controller, number control, number/bool value)
5968 \begin_layout Itemize
5969 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
5970 number control, number/bool value)
5973 \begin_layout Standard
5974 Change specified control in specified frame in specified movie.
5975 Past can't be edited in active movie.
5978 \begin_layout Subsection
5979 movie.copy_frames2: Copy frames between movies
5982 \begin_layout Itemize
5983 Syntax: none movie.copy_frames2([INPUTMOVIE/string dstmov,] number dst, [INPUTMOV
5984 IE/string srcmov,] number src, number count)
5987 \begin_layout Standard
5988 Copy specified number of frames between two movies.
5989 The copy proceeeds in forward direction.
5992 \begin_layout Subsection
5993 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
5996 \begin_layout Itemize
5997 Syntax: none movie.copy_frames([INPUTMOVIE/string mov,] number dst, number
5998 src, number count, bool backwards)
6001 \begin_layout Itemize
6002 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
6006 \begin_layout Standard
6007 Copy specified number of frames from one point in movie to another.
6008 If backwards is true, the copy will be done backwards.
6011 \begin_layout Subsection
6012 movie.serialize/INPUTMOVIE::serialize: Serialize movie
6015 \begin_layout Itemize
6016 Syntax: none movie.serialize([INPUTMOVIE movie/string,] string filename,
6020 \begin_layout Itemize
6021 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
6024 \begin_layout Standard
6025 Serialize given movie into file.
6026 If binary is true, binary format (more compact and much faster) is used.
6029 \begin_layout Subsection
6030 movie.unserialize: Unserialize movie
6033 \begin_layout Itemize
6034 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
6038 \begin_layout Standard
6039 Unserialize movie from file.
6040 The given frame is used as template to decide the frame type.
6041 If binary is true, binary format is decoded (much faster).
6044 \begin_layout Subsection
6045 movie.current_first_subframe: Return first subframe in current frame
6048 \begin_layout Itemize
6049 Syntax: number movie.current_first_subframe()
6052 \begin_layout Standard
6053 Returns first subframe in current frame.
6056 \begin_layout Subsection
6057 movie.pollcounter: Return poll counter for speified control
6060 \begin_layout Itemize
6061 Syntax: number movie.pollcounter(number port, number controller, number control)
6064 \begin_layout Standard
6065 Returns number of times the specified control has been polled this frame.
6068 \begin_layout Subsection
6069 movie.current_branch: Return current branch
6072 \begin_layout Itemize
6073 Syntax: string movie.current_branch()
6076 \begin_layout Standard
6077 Returns the name of the current branch.
6080 \begin_layout Subsection
6081 movie.get_branches: Return names of all branches
6084 \begin_layout Itemize
6086 movie.get_branches()
6089 \begin_layout Standard
6090 Returns the name of all branches.
6093 \begin_layout Subsection
6094 INPUTFRAME::get_button: Get button
6097 \begin_layout Itemize
6098 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
6102 \begin_layout Standard
6103 Returns state of given button as boolean.
6106 \begin_layout Subsection
6107 INPUTFRAME::get_axis: Get axis
6110 \begin_layout Itemize
6111 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
6115 \begin_layout Standard
6116 Returns state of given axis as number.
6119 \begin_layout Subsection
6120 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
6123 \begin_layout Itemize
6124 Syntax: none INPUTFRAME::set_button(number port, number controller, number
6125 control, number/bool value)
6128 \begin_layout Itemize
6129 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
6133 \begin_layout Standard
6134 Set the given button/axis to given value.
6137 \begin_layout Subsection
6138 INPUTFRAME::serialize: Serialize a frame
6141 \begin_layout Itemize
6142 Syntax: string INPUTFRAME::serialize()
6145 \begin_layout Standard
6146 Return string representation of frame.
6149 \begin_layout Subsection
6150 INPUTFRAME::unserialize: Unserialize a frame
6153 \begin_layout Itemize
6154 Syntax: none INPUTFRAME::unserialize(string data)
6157 \begin_layout Standard
6158 Set current frame from given data.
6161 \begin_layout Subsection
6162 INPUTFRAME::get_stride: Get movie stride
6165 \begin_layout Itemize
6166 Syntax: number INPUTFRAME::get_stride()
6169 \begin_layout Standard
6170 Return number of bytes needed to store the input frame.
6171 Mainly useful for some debugging.
6174 \begin_layout Standard
6175 \begin_inset Newpage pagebreak
6181 \begin_layout Section
6185 \begin_layout Standard
6186 Routines for settings manipulation
6189 \begin_layout Subsection
6190 settings.get: Get value of setting
6193 \begin_layout Itemize
6194 Syntax: string settings.get(string name)
6197 \begin_layout Standard
6198 Get value of setting <name>.
6199 If setting value can't be obtained, returns (nil, error message).
6202 \begin_layout Subsection
6203 settings.set: Set value of setting
6206 \begin_layout Itemize
6207 Syntax: none settings.set(string name, string value)
6210 \begin_layout Standard
6211 Set value <value> of setting <name>.
6212 If setting can't be set, returns (nil, error message).
6215 \begin_layout Standard
6216 \begin_inset Newpage pagebreak
6222 \begin_layout Section
6226 \begin_layout Standard
6227 Contains various functions for managing memory
6230 \begin_layout Subsection
6231 memory.vma_count: Count number of memory areas.
6234 \begin_layout Itemize
6235 Syntax: number memory.vma_count()
6238 \begin_layout Standard
6239 Returns the number of memory areas
6242 \begin_layout Subsection
6243 memory.read_vma: Lookup memory area info by index
6246 \begin_layout Itemize
6247 Syntax: table memory.read_vma(number index)
6250 \begin_layout Standard
6251 Reads the specified memory area (indices start from zero).
6252 Trying to read invalid memory area gives nil.
6253 The return value is table with the following fields:
6256 \begin_layout Itemize
6257 region_name (string): The readable name of the memory area
6260 \begin_layout Itemize
6261 baseaddr (number): Base address of the memory area
6264 \begin_layout Itemize
6265 lastaddr (number): Last address in the memory area.
6268 \begin_layout Itemize
6269 size (number): The size of memory area in bytes.
6272 \begin_layout Itemize
6273 readonly (boolean): True of the memory area corresponds to ROM.
6276 \begin_layout Itemize
6277 iospace (boolean): True if the memory area is I/O space.
6280 \begin_layout Itemize
6281 native_endian (boolean): True if the memory area has native endian as opposed
6285 \begin_layout Subsection
6286 memory.find_vma: Find memory area info by address
6289 \begin_layout Itemize
6290 Syntax: table memory.find_vma(number address)
6293 \begin_layout Standard
6294 Finds the memory area containing specified address.
6295 Returns table in the same format as read_vma or nil if not found.
6298 \begin_layout Subsection
6299 memory.read{,s}{byte,{,h,d,q}word}: Read memory
6302 \begin_layout Itemize
6303 Syntax: none memory.readbyte([string marea, ]number address)
6306 \begin_layout Itemize
6307 Syntax: none memory.readword([string marea, ]number address)
6310 \begin_layout Itemize
6311 Syntax: none memory.readhword([string marea, ]number address)
6314 \begin_layout Itemize
6315 Syntax: none memory.readdword([string marea, ]number address)
6318 \begin_layout Itemize
6319 Syntax: none memory.readqword([string marea, ]number address)
6322 \begin_layout Itemize
6323 Syntax: none memory.readsbyte([string marea, ]number address)
6326 \begin_layout Itemize
6327 Syntax: none memory.readsword([string marea, ]number address)
6330 \begin_layout Itemize
6331 Syntax: none memory.readshword([string marea, ]number address)
6334 \begin_layout Itemize
6335 Syntax: none memory.readsdword([string marea, ]number address)
6338 \begin_layout Itemize
6339 Syntax: none memory.readsqword([string marea, ]number address)
6342 \begin_layout Standard
6343 Reads the specified address <address> (if 's' variant is used, do undergo
6347 \begin_layout Subsection
6348 memory.{,s}read_sg: Scatter/Gather read memory
6351 \begin_layout Itemize
6352 Syntax: none memory.read_sg(string/boolean/number...)
6355 \begin_layout Itemize
6356 Syntax: none memory.sread_sg(string/boolean/number...)
6359 \begin_layout Standard
6360 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
6362 Each argument can be string, boolean or number:
6365 \begin_layout Itemize
6366 String: Set memory area addresses are relative to (e.g.
6370 \begin_layout Itemize
6371 boolean: If true, increment relative address by 1, if false, decrement by
6373 The new address is read as next higher byte.
6376 \begin_layout Itemize
6377 integer: Set the relative address to specified value and read the address
6378 as next higher byte.
6381 \begin_layout Subsection
6382 memory.write_sg: Scatter/Gather write memory
6385 \begin_layout Itemize
6386 Syntax: none memory.write_sg(number value, string/boolean/number...)
6389 \begin_layout Standard
6390 Perform scatter/gather write of value <value> on memory.
6391 Each argument can be string, boolean or number:
6394 \begin_layout Itemize
6395 String: Set memory area addresses are relative to (e.g.
6399 \begin_layout Itemize
6400 boolean: If true, increment relative address by 1, if false, decrement by
6402 The new address is read as next higher byte.
6405 \begin_layout Itemize
6406 integer: Set the relative address to specified value and read the address
6407 as next higher byte.
6410 \begin_layout Subsection
6411 memory.read{float,double}: Read memory
6414 \begin_layout Itemize
6415 Syntax: none memory.readfloat([string marea, ]number address)
6418 \begin_layout Itemize
6419 Syntax: none memory.readdouble([string marea, ]number address)
6422 \begin_layout Standard
6423 Reads the specified address <address>
6426 \begin_layout Subsection
6427 memory.write{byte,{,h,d,q}word,float,double}: Write memory
6430 \begin_layout Itemize
6431 Syntax: none memory.writebyte([string marea, ]number address, number value)
6434 \begin_layout Itemize
6435 Syntax: none memory.writeword([string marea, ]number address, number value)
6438 \begin_layout Itemize
6439 Syntax: none memory.writehword([string marea, ]number address, number value)
6442 \begin_layout Itemize
6443 Syntax: none memory.writedword([string marea, ]number address, number value)
6446 \begin_layout Itemize
6447 Syntax: none memory.writeqword([string marea, ]number address, number value)
6450 \begin_layout Itemize
6451 Syntax: none memory.writefloat([string marea, ]number address, number value)
6454 \begin_layout Itemize
6455 Syntax: none memory.writedouble([string marea, ]number address, number value)
6458 \begin_layout Standard
6459 Writes the specified value <value> (negative integer values undergo 2's
6460 complement) to specified address <address>.
6463 \begin_layout Subsection
6464 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
6467 \begin_layout Itemize
6468 Syntax: userdata memory.map<type>([[string marea, ]number base, number size])
6471 \begin_layout Standard
6472 Returns a table mapping specified memory aperture for read/write.
6473 If parameters are omitted, entiere map space is the aperture.
6476 \begin_layout Itemize
6477 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
6478 qword, sqword, float or double.
6481 \begin_layout Subsection
6482 memory.hash_region: Hash region of memory
6485 \begin_layout Itemize
6486 Syntax: string memory.hash_region([string marea, ]number base, number size)
6489 \begin_layout Standard
6490 Hash <size> bytes starting from address <base> (relative to <marea>) and
6494 \begin_layout Subsection
6495 memory.hash_region2: Hash region of memory
6498 \begin_layout Itemize
6499 Syntax: string memory.hash_region2([string marea, ]number base, number size[,
6500 number rows, number stride])
6503 \begin_layout Standard
6504 Hash <rows> blocks of <size> bytes starting from address <base> (relative
6506 The blocks are offset by <stride> from one another and return the SHA-256.
6509 \begin_layout Subsection
6510 memory.hash_region_skein: Hash region of memory
6513 \begin_layout Itemize
6514 Syntax: string memory.hash_region_skein([string marea, ]number base, number
6515 size[, number rows, number stride])
6518 \begin_layout Standard
6519 Same as memory.hash_region2, but uses Skein-512-256 (v1.3; one of the SHA-3
6520 finalists) as hash function.
6523 \begin_layout Subsection
6524 memory.store: Store region of memory
6527 \begin_layout Itemize
6528 Syntax: none memory.store([string marea, ]number addr, number daddr[, number
6529 rows, number stride]
6532 \begin_layout Standard
6533 Copy memory starting from <addr> in memory area <marea> (each row being
6534 of size <size>, there being <rows> rows, and rows being separated by <stride>
6535 in memory) into savestate-saved memory area, starting from <daadr> (all
6536 rows are written back to back).
6539 \begin_layout Subsection
6540 memory.storecmp: Compare and store region of memory
6543 \begin_layout Itemize
6544 Syntax: bool memory.storecmp([string marea, ]number addr, number daddr[,
6545 number rows, number stride]
6548 \begin_layout Standard
6549 Like memory.store, but returns true if target of copy already held the value
6550 that would be copied before the copy happened.
6551 Otherwise returns false (if target and source differ before copy).
6554 \begin_layout Subsection
6555 memory.hash_state: Hash system state
6558 \begin_layout Itemize
6559 Syntax: string memory.hash_state()
6562 \begin_layout Standard
6563 Hash the current system state.
6564 Mainly useful for debugging savestates.
6567 \begin_layout Subsection
6568 memory.readregion: Read region of memory
6571 \begin_layout Itemize
6572 Syntax: table memory.readregion([string marea, ]number base, number size)
6575 \begin_layout Standard
6576 Read a region of memory.
6579 \begin_layout Itemize
6580 Warning: If the region crosses memory area boundary, the results are undefined.
6583 \begin_layout Subsection
6584 memory.writeregion: Write region of memory
6587 \begin_layout Itemize
6588 Syntax: none memory.writeregion([string marea, ]number base, number size,
6592 \begin_layout Standard
6593 Write a region of memory.
6596 \begin_layout Itemize
6597 Warning: If the region crosses memory area boundary, the results are undefined.
6600 \begin_layout Subsection
6601 memory.read_expr: Evaluate memory watch expression
6604 \begin_layout Itemize
6605 Syntax: string memory.read_expr(string expr)
6608 \begin_layout Standard
6609 Evaluate specified watch expression and return result
6612 \begin_layout Subsection
6613 memory.action: Run core action
6616 \begin_layout Itemize
6617 memory.action(string action, [<params>])
6620 \begin_layout Standard
6622 The different models expect parameters as:
6625 \begin_layout Itemize
6629 \begin_layout Itemize
6633 \begin_layout Itemize
6637 \begin_layout Itemize
6641 \begin_layout Itemize
6645 \begin_layout Subsection
6646 memory.get_lag_flag: Get lag flag
6649 \begin_layout Itemize
6650 Syntax: boolean memory.get_lag_flag()
6653 \begin_layout Standard
6654 Get the value of core lag flag.
6655 True if this frame has been lag so far, false if poll has been detected.
6658 \begin_layout Subsection
6659 memory.set_lag_flag: Set lag flag
6662 \begin_layout Itemize
6663 Syntax: none memory.set_lag_flag(boolean flag)
6666 \begin_layout Standard
6667 Set the value of core lag flag.
6668 This flag automatically gets cleared if poll is detected, but can be forcibly
6669 set or cleared if game so requires.
6672 \begin_layout Itemize
6673 Should only be used in on_frame_emulated callback.
6676 \begin_layout Itemize
6677 Setting or clearing this affects the emulator lag counter.
6680 \begin_layout Subsection
6681 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
6685 \begin_layout Itemize
6686 Syntax: function memory.registerread([string marea, ] number addr, function
6690 \begin_layout Itemize
6691 Syntax: function memory.registerwrite([string marea, ] number addr, function
6695 \begin_layout Itemize
6696 Syntax: function memory.registerexec([string marea, ] number addr, function
6700 \begin_layout Itemize
6701 Syntax: none memory.unregisterread([string marea, ] number addr, function
6705 \begin_layout Itemize
6706 Syntax: none memory.unregisterwrite([string marea, ] number addr, function
6710 \begin_layout Itemize
6711 Syntax: none memory.unregisterexec([string marea, ] number addr, function
6715 \begin_layout Standard
6716 Add or remove callback on memory read, write or execute (depending on the
6718 If <marea> is specified, <addr> is relative to it, otherwise <addr> is
6720 <fn> is the callback.
6721 The register* functions return <fn> (which can then be passed to unregister*
6725 \begin_layout Itemize
6726 Not all cores support this, and it may be unsupported for some memory areas.
6729 \begin_layout Itemize
6730 The functions are passed two parameters: Address and value.
6733 \begin_layout Subsection
6734 memory.{,un}registertrace: Set/Clear trace hook
6737 \begin_layout Itemize
6738 Syntax: function memory.registertrace(number processor, function fn);
6741 \begin_layout Itemize
6742 Syntax: none memory.unregistertrace(number processor, function fn);
6745 \begin_layout Standard
6746 Add or remove trace callback.
6747 <processor> is system-dependent processor number (0 is usually main CPU).
6748 The function arguments work like in other (un)register* functions.
6751 \begin_layout Itemize
6752 The functions are passed two parameters: Trace CPU and Trace event string.
6755 \begin_layout Subsection
6756 memory.cheat: Set cheat
6759 \begin_layout Itemize
6760 Syntax: none memory.cheat([string marea, ] number addr, number value);
6763 \begin_layout Itemize
6764 Syntax: none memory.cheat([string marea, ] number addr);
6767 \begin_layout Standard
6768 Set or clear cheat (value <value>) on address <addr>.
6769 If <marea> is specified, <addr> is relative to that.
6770 If <value> is not speicified, clear a cheat.
6773 \begin_layout Itemize
6774 Not all cores support this, and it may be unsupported for some memory areas.
6777 \begin_layout Subsection
6778 memory.setxmask: Set global execute hook mask
6781 \begin_layout Itemize
6782 Syntax: none memory.setxmask(number mask)
6785 \begin_layout Standard
6786 Set the global execute hook mask to <mask>.
6787 The meaning of each bit is system-dependent, but bit 0 should be the main
6791 \begin_layout Subsection
6792 memory.mmap: Class MMAP_STRUCT
6795 \begin_layout Standard
6796 See class MMAP_STRUCT
6799 \begin_layout Standard
6800 \begin_inset Newpage pagebreak
6806 \begin_layout Section
6810 \begin_layout Standard
6811 Contains newer memory functions.
6814 \begin_layout Subsection
6815 memory2(): Get all memory area names.
6818 \begin_layout Itemize
6819 Syntax: table memory2()
6822 \begin_layout Standard
6823 Returns array of all valid memory area names.
6826 \begin_layout Subsection
6827 memory2.<marea>:info: Get memory area info
6830 \begin_layout Itemize
6831 Syntax: table memory2.<marea>:info()
6834 \begin_layout Standard
6835 Return table describing given memory area.
6836 Includes fields address, size, last, readonly, special and endian.
6839 \begin_layout Subsection
6840 memory2.<marea>:<op>: Read/Write memory
6843 \begin_layout Itemize
6844 Syntax: none memory2.<marea>:<op>(number offset, number value)
6847 \begin_layout Itemize
6848 Syntax: number memory2.<marea>:<op>(number offset)
6851 \begin_layout Standard
6852 Read/Write value from/to given memory area <marea> at given offset <offset>
6854 The value written is <value>.
6855 <Op> is of form: [i][s]<type>, where:
6858 \begin_layout Itemize
6859 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
6862 \begin_layout Itemize
6863 'i' signifies that the value is treated as opposite-to-normal endianess,
6866 \begin_layout Itemize
6867 's' signifies that value is treated as signed (not available for floating-point).
6870 \begin_layout Subsection
6871 memory2.<marea>:read: Scatter-gather value read
6874 \begin_layout Itemize
6875 Syntax: number memory2.<marea>:read(number addr...)
6878 \begin_layout Standard
6879 Read value from given memory area <marea> at byte offsets <addr>..., given
6880 in order of increasing significance.
6881 Value of true and false are special.
6882 True increments address by 1, and false decrements address by 1.
6885 \begin_layout Subsection
6886 memory2.<marea>:sread: Signed scatter-gather value read
6889 \begin_layout Itemize
6890 Syntax: number memory2.<marea>:sread(number addr...)
6893 \begin_layout Standard
6894 Like memory2.<marea>:read, but reads signed values.
6897 \begin_layout Subsection
6898 memory2.<marea>:write: Scatter-gather value write
6901 \begin_layout Itemize
6902 Syntax: number memory2.<marea>:write(number val, number addr...)
6905 \begin_layout Standard
6906 Write value <val> to given memory area <marea> at byte offsets <addr>..., given
6907 in order of increasing significance.
6908 Value of true and false are special.
6909 True increments address by 1, and false decrements address by 1.
6912 \begin_layout Subsection
6913 memory2.<marea>:cheat: Set/Clear cheat
6916 \begin_layout Itemize
6917 Syntax: none memory2.<marea>:cheat(number addr, [number value])
6920 \begin_layout Standard
6921 Set/Clear cheat at offset <addr> of memory area <marea>.
6922 If <value> is given, cheat with specified value is set.
6923 Otherwise cheat on address is removed.
6926 \begin_layout Subsection
6927 memory2.<marea>:sha256: SHA-256
6930 \begin_layout Itemize
6931 Syntax: string memory2.<marea>:sha256(number addr, number size[, number rows,
6935 \begin_layout Standard
6936 Compute SHA-256 of <rows> (default 1) chunks of <size> bytes each, starting
6937 from offset <addr> of area <marea>.
6938 The chunks are separated by <stride>.
6941 \begin_layout Subsection
6942 memory2.<marea>:skein: Skein-512-256
6945 \begin_layout Itemize
6946 Syntax: string memory2.<marea>:skein(number addr, number size[, number rows,
6950 \begin_layout Standard
6951 Same as memory2.<marea>:sha256, except with Skein-512-256 as hash function.
6954 \begin_layout Subsection
6955 memory2.<marea>:store{,cmp}: Copy region to Lua memory with compare
6958 \begin_layout Itemize
6959 Syntax: none memory2.<marea>:store(number addr, number daddr, number size[,
6960 number rows, number stride])
6963 \begin_layout Itemize
6964 Syntax: boolean memory2.<marea>:storecmp(number addr, number daddr, number
6965 size[, number rows, number stride])
6968 \begin_layout Standard
6969 Copy <rows> (default 1) chunks of <size> bytes each, starting from offset
6970 <addr> of area <marea>.
6971 The chunks are separated by <stride>.
6972 The target is Lua host memory, starting from offset <daddr>.
6975 \begin_layout Standard
6976 Additionally, the storecmp method returns false if target was modified (otherwis
6980 \begin_layout Subsection
6981 memory2.<marea>:readregion: Read region
6984 \begin_layout Itemize
6985 Syntax table memory2.<marea>:readregion(number addr, number size)
6988 \begin_layout Standard
6989 Read <size> bytes starting from <addr> in <marea> and return as array.
6992 \begin_layout Subsection
6993 memory2.<marea>:writeregion: Write region
6996 \begin_layout Itemize
6997 Syntax none memory2.<marea>:writeregion(number addr, table data)
7000 \begin_layout Standard
7001 Write array <data> to bytes starting from <addr> in <marea>.
7004 \begin_layout Subsection
7005 memory2.<marea>:register{read,write,exec}: Register hook
7008 \begin_layout Itemize
7009 Syntax: function memory2.<marea>:registerread(number addr, function fn);
7012 \begin_layout Itemize
7013 Syntax: function memory2.<marea>:registerwrite(number addr, function fn);
7016 \begin_layout Itemize
7017 Syntax: function memory2.<marea>:registerexec(number addr, function fn);
7020 \begin_layout Standard
7021 Register debug callback <fn> of specified type at offset <addr> of memory
7026 \begin_layout Subsection
7027 memory2.<marea>:unregister{read,write,exec}: Unregister hook
7030 \begin_layout Itemize
7031 Syntax: none memory2.<marea>:unregisterread(number addr, function fn);
7034 \begin_layout Itemize
7035 Syntax: none memory2.<marea>:unregisterwrite(number addr, function fn);
7038 \begin_layout Itemize
7039 Syntax: none memory2.<marea>:unregisterexec(number addr, function fn);
7042 \begin_layout Standard
7043 Unregister debug callback <fn> of specified type at offset <addr> of memory
7047 \begin_layout Standard
7048 \begin_inset Newpage pagebreak
7054 \begin_layout Section
7058 \begin_layout Standard
7059 Contains random number generation methods.
7060 These functions do not return reproducable results.
7063 \begin_layout Subsection
7064 random.boolean: Random boolean
7067 \begin_layout Itemize
7068 Syntax: boolean random.boolean()
7071 \begin_layout Standard
7072 Returns true or false at random (50-50 chance).
7075 \begin_layout Subsection
7076 random.integer: Random integer
7079 \begin_layout Itemize
7080 Syntax: number random.integer(number highplusone)
7083 \begin_layout Itemize
7084 Syntax: number random.integer(number low, number high)
7087 \begin_layout Standard
7088 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
7089 With two arguments, return random integer [<low>,<high>] (both ends inclusive).
7092 \begin_layout Standard
7093 The returned numbers are from uniform distribution.
7096 \begin_layout Subsection
7097 random.float: Random float
7100 \begin_layout Itemize
7101 Syntax: number random.float()
7104 \begin_layout Standard
7105 Returns random decimal number [0,1).
7108 \begin_layout Subsection
7109 random.among: Random parameter
7112 \begin_layout Itemize
7113 Syntax: value random.among(value values...)
7116 \begin_layout Standard
7117 Returns random parameter value, picked at uniform.
7118 Multiple equivalent values are returned with higher chance.
7121 \begin_layout Subsection
7122 random.amongtable: Random from table
7125 \begin_layout Itemize
7126 Syntax: value random.amongtable(table tab)
7129 \begin_layout Standard
7130 Returns random value from table <tab>.
7131 As in random.among, no equality testing is done.
7134 \begin_layout Standard
7135 \begin_inset Newpage pagebreak
7141 \begin_layout Section
7145 \begin_layout Subsection
7146 zip.enumerate: Enumerate members in zipfile
7149 \begin_layout Itemize
7150 Syntax: Table zip.enumerate(string filename[, boolean invert])
7153 \begin_layout Standard
7154 Returns table of files in zip archive <filename>.
7155 If <invert> is true, instead of returning array of names, returns table
7156 with keys being member names and values being true.
7159 \begin_layout Subsection
7160 zip.writer: Class ZIPWRITER
7163 \begin_layout Standard
7164 See class ZIPWRITER.
7167 \begin_layout Standard
7168 \begin_inset Newpage pagebreak
7174 \begin_layout Section
7178 \begin_layout Standard
7179 Various callback-related functions.
7182 \begin_layout Subsection
7183 \begin_inset CommandInset label
7185 name "sub:callback.register:-Register-a"
7189 callback.register: Register a callback
7192 \begin_layout Itemize
7193 Syntax: function callback.register(string cbname, function cbfun);
7196 \begin_layout Standard
7197 Instruct function <cbfun> to be added to list of callbacks to call on event
7198 <cbname> (See section
7199 \begin_inset CommandInset ref
7201 reference "sec:Callbacks"
7206 The callback name does not have the 'on_' prefix (e.g.
7208 \begin_inset Quotes eld
7212 \begin_inset Quotes erd
7219 \begin_layout Subsection
7220 \begin_inset CommandInset label
7222 name "sub:callback.unregister:-Unregister-"
7226 callback.unregister: Unregister a callback
7229 \begin_layout Itemize
7230 Syntax: function callback.unregister(string cbname, function cbfun);
7233 \begin_layout Standard
7234 Instruct function <cbfun> to be removed from list of callbacks to call on
7238 \begin_layout Subsection
7239 callback.<cbname>:register: Register callback
7242 \begin_layout Itemize
7243 Syntax: function callback.<cbname>:register(function cbfun)
7246 \begin_layout Standard
7247 Synonym for callback.register (section
7248 \begin_inset CommandInset ref
7250 reference "sub:callback.register:-Register-a"
7254 ), albeit with callback name specified differently.
7257 \begin_layout Subsection
7258 callback.<cbname>:unregister: Register callback
7261 \begin_layout Itemize
7262 Syntax: function callback.<cbname>:unregister(function cbfun)
7265 \begin_layout Standard
7266 Synonym for callback.unregister (section
7267 \begin_inset CommandInset ref
7269 reference "sub:callback.unregister:-Unregister-"
7273 ), albeit with callback name specified differently.
7276 \begin_layout Section
7280 \begin_layout Standard
7281 Various bsnes-specific functions.
7284 \begin_layout Subsection
7285 bsnes.dump_sprite: Dump a sprite
7288 \begin_layout Itemize
7289 Syntax: BITMAP bsnes.dump_sprite([string marea, ] number addr, number width,
7290 number height[, number stride])
7293 \begin_layout Standard
7294 Dumps given sprite (in native format) from memory.
7295 memory area is usually
7296 \begin_inset Quotes eld
7300 \begin_inset Quotes erd
7304 <Width> and <height> are given in 8x8 blocks.
7305 <Stride> overrides row stride (default 512).
7308 \begin_layout Subsection
7309 bsnes.dump_palette: Dump a palette
7312 \begin_layout Itemize
7313 Syntax: PALETTE bsnes.dump_palette([string marea, ] number addr, bool full256,
7317 \begin_layout Standard
7318 Dumps a palette from memory.
7319 memory area is usually
7320 \begin_inset Quotes eld
7324 \begin_inset Quotes erd
7328 If <full256> is true, 256 colors are dumped (otherwise 16).
7329 If <first_trans> is true, first color is forced transparent.
7332 \begin_layout Subsection
7333 bsnes.enablelayer: Set layer visibility
7336 \begin_layout Itemize
7337 Syntax: none bsnes.enablelayer(number layer, number priority, boolean enabled)
7340 \begin_layout Standard
7341 Enable or disable specified layer at specified priority.
7344 \begin_layout Section
7345 extensions to table string
7348 \begin_layout Subsection
7349 string.charU: string.char, UTF-8 version.
7352 \begin_layout Itemize
7353 Syntax: string string.charU(number n...)
7356 \begin_layout Standard
7357 Like Lua string.char(), but works in terms of Unicode codepoints.
7358 The returned string is UTF-8.
7361 \begin_layout Subsection
7362 string.byteU: string.byte, UTF-8 version.
7365 \begin_layout Itemize
7367 string.byteU(string str[, number i[, number j]])
7370 \begin_layout Standard
7371 Like string.byte(), but works in terms of Unicode codepoints.
7372 The input string <str> is assumed UTF-8.
7375 \begin_layout Section
7379 \begin_layout Standard
7380 Contains copy of global variables from time of Lua initialization.
7384 \begin_layout Standard
7385 \begin_inset Newpage pagebreak
7391 \begin_layout Section
7392 \begin_inset CommandInset label
7394 name "sec:Callbacks"
7401 \begin_layout Standard
7402 Various callbacks to Lua that can occur.
7405 \begin_layout Subsection
7406 on_paint: Screen is being painted
7409 \begin_layout Itemize
7410 Callback: on_paint(bool not_synth)
7413 \begin_layout Standard
7414 Called when screen is being painted.
7415 Any gui.* calls requiring graphic context draw on the screen.
7418 \begin_layout Itemize
7419 not_synth is true if this hook is being called in response to received frame,
7423 \begin_layout Subsection
7424 on_video: Dumped video frame is being painted
7427 \begin_layout Itemize
7428 Callback: on_video()
7431 \begin_layout Standard
7432 Called when video dump frame is being painted.
7433 Any gui.* calls requiring graphic context draw on the video.
7436 \begin_layout Subsection
7437 on_frame_emulated: Frame emulation complete
7440 \begin_layout Itemize
7441 Callback: on_frame_emulated()
7444 \begin_layout Standard
7445 Called when emulating frame has completed and on_paint()/on_video() calls
7446 are about to be issued.
7449 \begin_layout Subsection
7450 on_frame: Frame emulation starting.
7453 \begin_layout Itemize
7454 Callback: on_frame()
7457 \begin_layout Standard
7458 Called on each starting whole frame.
7461 \begin_layout Subsection
7462 on_startup: Emulator startup complete
7465 \begin_layout Itemize
7466 Callback: on_startup()
7469 \begin_layout Standard
7470 Called when the emulator is starting (lsnes.rc and --run files has been run).
7473 \begin_layout Subsection
7474 on_rewind: Movie rewound to beginning
7477 \begin_layout Itemize
7478 Callback: on_rewind()
7481 \begin_layout Standard
7482 Called when rewind movie to beginning has completed.
7485 \begin_layout Subsection
7486 on_pre_load: Load operation is about to start
7489 \begin_layout Itemize
7490 Callback: on_pre_load(string name)
7493 \begin_layout Standard
7494 Called just before savestate/movie load occurs (note: loads are always delayed,
7495 so this occurs even when load was initiated by lua).
7498 \begin_layout Subsection
7499 on_err_Load: Load failed
7502 \begin_layout Itemize
7503 Callback: on_err_load(string name)
7506 \begin_layout Standard
7507 Called if loadstate goes wrong.
7510 \begin_layout Subsection
7511 on_post_load: Load completed
7514 \begin_layout Itemize
7515 Callback: on_post_load(string name, boolean was_savestate)
7518 \begin_layout Standard
7519 Called on successful loadstate.
7520 was_savestate gives if this was a savestate or a movie.
7523 \begin_layout Subsection
7524 on_pre_save: Save operation is about to start
7527 \begin_layout Itemize
7528 Callback: on_pre_save(string name, boolean is_savestate)
7531 \begin_layout Standard
7532 Called just before savestate save occurs (note: movie saves are synchronous
7533 and won't trigger these callbacks if called from Lua).
7536 \begin_layout Subsection
7537 on_err_save: Save failed
7540 \begin_layout Itemize
7541 Callback: on_err_save(string name)
7544 \begin_layout Standard
7545 Called if savestate goes wrong.
7548 \begin_layout Subsection
7549 on_post_save: Save completed
7552 \begin_layout Itemize
7553 Callback: on_post_save(string name, boolean is_savestate)
7556 \begin_layout Standard
7557 Called on successful savaestate.
7558 is_savestate gives if this was a savestate or a movie.
7561 \begin_layout Subsection
7562 on_quit: Emulator is shutting down
7565 \begin_layout Itemize
7569 \begin_layout Standard
7570 Called when emulator is shutting down.
7573 \begin_layout Subsection
7574 on_input: Polling for input
7577 \begin_layout Standard
7578 Called when emulator is just sending input to bsnes core.
7579 Warning: This is called even in readonly mode, but the results are ignored.
7582 \begin_layout Subsection
7583 on_reset: System has been reset
7586 \begin_layout Itemize
7587 Callback: on_reset()
7590 \begin_layout Standard
7591 Called when system is reset.
7594 \begin_layout Subsection
7595 on_readwrite: Entered readwrite mode
7598 \begin_layout Itemize
7599 Callback: on_readwrite()
7602 \begin_layout Standard
7603 Called when moving into readwrite mode as result of
7604 \begin_inset Quotes eld
7608 \begin_inset Quotes erd
7611 command (note: moving to rwmode by Lua won't trigger this, as per recursive
7615 \begin_layout Subsection
7616 on_snoop/on_snoop2: Snoop core controller reads
7619 \begin_layout Itemize
7620 Callback: on_snoop(number port, number controller, number index, number
7624 \begin_layout Itemize
7625 Callback: on_snoop2(number port, number controller, number index, number
7629 \begin_layout Standard
7630 Called each time bsnes asks for input.
7631 The value is the final value to be sent to bsnes core (readonly mode, autohold
7632 and autofire have been taken into account).
7633 Might be useful when translating movies to format suitable for console
7635 Note: There is no way to modify the value to be sent.
7638 \begin_layout Itemize
7639 On_snoop2 is called instead of on_snoop if defined.
7640 Reserves port 0 for system, having first user port be port 1.
7643 \begin_layout Subsection
7644 on_keyhook: Hooked key/axis has been moved
7647 \begin_layout Itemize
7648 Callback: on_keyhook(string keyname, table state)
7651 \begin_layout Standard
7652 Sent when key that has keyhook events requested changes state.
7653 Keyname is name of the key (group) and state is the state (same kind as
7654 table values in input.raw).
7657 \begin_layout Subsection
7661 \begin_layout Itemize
7665 \begin_layout Standard
7666 Called when requested by set_idle_timeout(), the timeout has expired and
7667 emulator is waiting.
7670 \begin_layout Subsection
7671 on_timer: Timer event
7674 \begin_layout Itemize
7675 Callback: on_timer()
7678 \begin_layout Standard
7679 Called when requested by set_idle_timeout() and the timeout has expired
7680 (regardless if emulator is waiting).
7683 \begin_layout Subsection
7684 on_set_rewind: Rewind point has been set
7687 \begin_layout Itemize
7688 Callback: on_set_rewind(UNSAFEREWIND r)
7691 \begin_layout Standard
7692 Called when unsafe rewind object has been constructed.
7695 \begin_layout Subsection
7696 on_pre_rewind: Rewind is about to occur
7699 \begin_layout Itemize
7700 Callback: on_pre_rewind()
7703 \begin_layout Standard
7704 Called just before unsafe rewind is about to occur.
7707 \begin_layout Subsection
7708 on_post_rewind: Rewind has occured
7711 \begin_layout Itemize
7712 Callback: on_post_rewind()
7715 \begin_layout Standard
7716 Called just after unsafe rewind has occured.
7719 \begin_layout Subsection
7720 on_button: Button has been pressed
7723 \begin_layout Itemize
7724 Callback: on_button(number port, number controller, number index, string
7728 \begin_layout Standard
7729 Called on controller button press, with following parameters:
7732 \begin_layout Itemize
7733 port: Port number (0 is system)
7736 \begin_layout Itemize
7737 controller: Controller within port
7740 \begin_layout Itemize
7741 index: Index of button.
7744 \begin_layout Itemize
7745 type: Type of event, one of:
7749 \begin_layout Itemize
7750 \begin_inset Quotes eld
7754 \begin_inset Quotes erd
7757 : Button was pressed.
7760 \begin_layout Itemize
7761 \begin_inset Quotes eld
7765 \begin_inset Quotes erd
7768 : Button was released.
7771 \begin_layout Itemize
7772 \begin_inset Quotes eld
7776 \begin_inset Quotes erd
7782 \begin_layout Itemize
7783 \begin_inset Quotes eld
7787 \begin_inset Quotes erd
7790 : Released from hold.
7793 \begin_layout Itemize
7794 \begin_inset Quotes eld
7798 \begin_inset Quotes erd
7801 : Typing input on button.
7804 \begin_layout Itemize
7805 \begin_inset Quotes eld
7809 \begin_inset Quotes erd
7812 : Typing input undone.
7815 \begin_layout Itemize
7816 \begin_inset Quotes eld
7819 autofire <duty> <cycle>
7820 \begin_inset Quotes erd
7823 : Autofire with specifie duty and cycle.
7826 \begin_layout Itemize
7827 \begin_inset Quotes eld
7831 \begin_inset Quotes erd
7837 \begin_layout Itemize
7838 \begin_inset Quotes eld
7842 \begin_inset Quotes erd
7845 : Analog action on axis.
7849 \begin_layout Subsection
7850 on_movie_lost: Movie data is about to be lost
7853 \begin_layout Itemize
7854 Callback: on_movie_lost(STRING kind)
7857 \begin_layout Standard
7858 Called just before something would happen that could lose movie data.
7862 \begin_layout Itemize
7863 readwrite: Switching to readwrite mode.
7866 \begin_layout Itemize
7867 reload: ROM is being reloaded in readwrite mode.
7870 \begin_layout Itemize
7871 load: New movie is being loaded.
7874 \begin_layout Itemize
7875 unsaferewind: Unsafe rewind is happening.
7878 \begin_layout Subsection
7879 on_latch: Latch line is rising
7882 \begin_layout Itemize
7883 Callback: on_latch(<core-dependent-parameters>)
7886 \begin_layout Standard
7887 Called when latch line for controller is rising.
7888 Some cores may not support this.
7891 \begin_layout Section
7892 System-dependent behaviour
7895 \begin_layout Subsection
7899 \begin_layout Itemize
7900 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
7901 p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
7902 p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
7903 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
7904 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
7905 ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
7906 ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
7907 ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
7908 ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
7909 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
7910 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
7911 ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
7912 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
7913 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
7914 ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
7915 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
7916 ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
7917 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
7918 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
7919 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
7920 ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
7921 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
7922 ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
7923 ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
7924 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
7925 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
7926 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
7927 ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
7928 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
7929 ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
7930 ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
7931 ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
7932 ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
7933 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
7934 ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
7935 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
7936 ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
7937 ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
7938 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
7939 ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount,
7942 \begin_layout Itemize
7943 on_latch has no parameters
7946 \begin_layout Itemize
7947 CPU 0 is S-CPU, 1 is S-SMP.
7950 \begin_layout Itemize
7951 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
7954 \begin_layout Itemize
7955 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
7959 \begin_layout Subsection
7963 \begin_layout Itemize
7964 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
7968 \begin_layout Itemize
7969 on_latch is not supported
7972 \begin_layout Itemize
7976 \begin_layout Itemize
7977 Cheats are supported for ROM, SRAM and WRAM.
7980 \begin_layout Itemize
7981 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM