Skip to main content

callback

 * emu.app_name() - return application name
 * emu.app_version() - return application version
 * emu.gamename() - returns game full name
 * emu.softname() - returns softlist name
 * emu.keypost(keys) - post keys to natural keyboard
 * emu.time() - return emulation time
 * emu.start(driver) - start given driver
 * emu.pause() - pause emulation
 * emu.unpause() - unpause emulation
 * emu.register_prestart(callback) - callback before reset
 * emu.register_start(callback) - callback after reset
 * emu.register_stop(callback) - callback after stopping
 * emu.register_pause(callback) - callback at pause
 * emu.register_resume(callback) - callback at resume
 * emu.register_frame(callback) - callback at end of frame
 * emu.register_frame_done(callback) - callback after frame is drawn to screen (for overlays)
 * emu.register_periodic(callback) - periodic callback while program is running
 * emu.register_menu(event_callback, populate_callback, name) - callbacks for plugin menu
 * emu.print_verbose(str) -- output to stderr at verbose level
 * emu.print_error(str) -- output to stderr at error level
 * emu.print_info(str) -- output to stderr at info level
 * emu.print_debug(str) -- output to stderr at debug level
 * emu.driver_find(driver) -- find and return game_driver for driver
 * emu.wait(len) -- wait for len within coroutine
 * emu.lang_translate(str) -- get translation for str if available


 * emu.file([opt] searchpath, flags) - flags can be as in osdcore "OPEN_FLAG_*" or lua style with 'rwc' with addtional c for create *and truncate* (be careful)
 *                                     support zipped files on the searchpath
 * file:open(name) - open first file matching name in searchpath, supports read and write sockets as "socket.127.0.0.1:1234"
 * file:open_next() - open next file matching name in searchpath
 * file:read(len) - only reads len bytes, doen't do lua style formats
 * file:write(data) - write data to file
 * file:seek(offset, whence) - whence is as C "SEEK_*" int
 * file:seek([opt] whence, [opt] offset) - lua style "set"|"cur"|"end", returns cur offset
 * file:size() -
 * file:filename() - name of current file, container name if file is in zip
 * file:fullpath() -


 * emu.thread()
 * thread.start(scr) - run scr (string not function) in a seperate thread in a new empty (other then modules) lua context
 * thread.continue(val) - resume thread and pass val to it
 * thread.result() - get thread result as string
 * thread.busy - check if thread is running
 * thread.yield - check if thread is yielded

 manager:options()
 * machine:options()
 * machine:ui():options()
 * options:help() - get help for options
 * options:command(command) - return output for command
 * options.entries[] - get table of option entries

 options.entries[entry_name]
 * entry.value() - get value of entry
 * entry.value(val) - set entry to val
 * entry.description() - get info about entry
 * entry.default_value() - get default for entry
 * entry.minimum() - get min value for entry
 * entry.maximum() - get max value for entry
 * entry.has_range() - are min and max valid for entry

 manager:machine()
 * machine:exit() - close program
 * machine:hard_reset() - hard reset emulation
 * machine:soft_reset() - soft reset emulation
 * machine:save(filename) - save state to filename
 * machine:load(filename) - load state from filename
 * machine:system() - get game_driver for running driver
 * machine:video() - get video_manager
 * machine:render() - get render_manager
 * machine:ioport() - get ioport_manager
 * machine:parameters() - get parameter_manager
 * machine:options() - get machine core_options
 * machine:output() - get output_manager
 * machine:input() - get input_manager
 * machine:uiinput() - get ui_input_manager
 * machine.paused - get paused state
 * machine.devices[] - get device table
 * machine.screens[] - get screens table
 * machine.images[] - get available image devices
 * machine:popmessage(str) - print str as popup
 * machine:logerror(str) - print str to log

 game_driver - this should be self explanatory

 machine:debugger()
 * debug:command(cmd) - run cmd in debugger console
 * debug.consolelog[] - get consolelog
 * debug.errorlog[] - get errorlog
 * debug.visible_cpu - accessor for debugger active cpu for commands, affects debug views
 * debug.execution_state - accessor for active cpu run state

 device:debug()
 * debug:step([opt] steps) - run cpu steps, default 1
 * debug:go() - run cpu
 * debug:bpset(addr, cond, act) - set break, cond and act are debugger expressions
 * debug:bpclr(idx) - clear break
 * debug:bplist()[] - table of breakpoints
 * debug:wpset(space, type, addr, len, cond, act) - set watch, cond and act are debugger expressions
 * debug:wpclr(idx) - clear watch
 * debug:wplist(space)[] - table of watchpoints

 machine.devices[device_tag]
 * device:name() - device long name
 * device:shortname() - device short name
 * device:tag() - device tree tag
 * device:owner() - device parent tag
 * device:debug() - debug interface, cpus only
 * device.spaces[] - device address spaces table
 * device.state[] - device state entries table
 * device.items[] - device save state items table

 machine:ioport()
 * ioport:count_players() - get count of player controllers
 * ioport.ports[] - ioports table

 ioport.ports[port_tag]
 * port:tag() - get port tag
 * port:active() - get port status
 * port:live() - get port ioport_port_live (TODO: not usable from lua as of now)
 * port:read() - get port value
 * port:write(val, mask) - set port to value & mask (output fields only, for other fields use field:set_value(val))
 * port:field(mask) - get ioport_field for port and mask
 * port.field[] - get ioport_field table

 port.field[field_tag] - this should be self explanatory

 field.live

 machine:parameters()
 * parameter:add(tag, val) - add tag = val parameter
 * parameter:lookup(tag) - get val for tag

 machine:video()
 * video:begin_recording([opt] filename) - start recording to filename if given or default
 * video:end_recording() - stop recording
 * video:snapshot() - save shot of all screens
 * video:is_recording() - get recording status
 * video:skip_this_frame() - is current frame going to be skipped
 * video:speed_factor() - get speed factor
 * video:speed_percent() - get percent from realtime
 * video.frameskip - current frameskip
 * video.throttled - throttle state
 * video.throttle_rate - throttle rate

 machine:input()
 * input:code_from_token(token) - get input_code for KEYCODE_* string token
 * input:code_pressed(code) - get pressed state for input_code
 * input:code_to_token(code) - get KEYCODE_* string token for code
 * input:code_name(code) - get code friendly name
 * input:seq_from_tokens(tokens) - get input_seq for multiple space separated KEYCODE_* string tokens
 * input:seq_pressed(seq) - get pressed state for input_seq
 * input:seq_to_tokens(seq) - get KEYCODE_* string tokens for seq
 * input:seq_name(seq) - get seq friendly name

 machine:uiinput()
 * uiinput:find_mouse() - returns x, y, button state, ui render target
 * uiinput:pressed(key) - get pressed state for ui key

 render.targets[target_index]
 * render:ui_target()
 * target:view_bounds() - get x0, x1, y0, y1 bounds for target
 * target:width() - get target width
 * target:height() - get target height
 * target:pixel_aspect() - get target aspect
 * target:hidden() - is target hidden
 * target:is_ui_target() - is ui render target
 * target:index() - target index
 * target:view_name(index) - current target layout view name
 * target.max_update_rate -
 * target.view - current target layout view
 * target.orientation - current target orientation
 * target.backdrops - enable backdrops
 * target.bezels - enable bezels
 * target.marquees - enable marquees
 * target.screen_overlay - enable overlays
 * target.zoom - enable zoom

 render:ui_container() - this should be self explanatory

 machine:render()
 * render:max_update_rate() -
 * render:ui_target() - target for ui drawing
 * render:ui_container() - container for ui drawing
 * render.target[] - render_target table

 machine.screens[screen_tag]
 * screen:draw_box(x1, y1, x2, y2, fillcol, linecol) - draw box from (x1, y1)-(x2, y2) colored linecol filled with fillcol
 * screen:draw_line(x1, y1, x2, y2, linecol) - draw line from (x1, y1)-(x2, y2) colored linecol
 * screen:draw_text(x || justify, y, message, [opt] color) - draw message at (x, y) or at line y with left, right, center justification
 * screen:height() - screen height
 * screen:width() - screen width
 * screen:orientation() - screen angle, flipx, flipy
 * screen:refresh() - screen refresh rate
 * screen:snapshot() - save snap shot
 * screen:type() - screen drawing type
 * screen:frame_number() - screen frame count
 * screen:name() - screen device full name
 * screen:shortname() - screen device short name
 * screen:tag() - screen device tag
 * screen:xscale() - screen x scale factor
 * screen:yscale() - screen y scale factor

 mame_manager:ui()
 * ui:is_menu_active() - ui menu state
 * ui:options() - ui core_options
 * ui.show_fps - fps display enabled
 * ui.show_profiler - profiler display enabled
 * ui:get_line_height() - current ui font height
 * ui:get_string_width(str, scale) - get str width with ui font at scale factor of current font size
 * ui:get_char_width(char) - get width of utf8 glyph char with ui font

 device.state[]
 * state:name() - get device state name
 * state:value() - get device state value
 * state:is_visible() - is state visible in debugger
 * state:is_divider() - is state a divider

 machine:memory()
 * memory.banks[] - table of memory banks
 * memory.regions[] - table of memory regions
 * memory.shares[] - table of memory shares

 machine:output()
 * output:set_value(name, val) - set output name to val
 * output:set_indexed_value(index, val) - set output index to val
 * output:get_value(name) - get output name value
 * output:get_indexed_value(index) - get output index value
 * output:name_to_id(name) - get index for name
 * output:id_to_name(index) - get name for index

 machine.images[] - images are floppy/cart/cdrom/tape/hdd etc, otherwise this should be self explanatory