void pia_config(int which, int addressing, const pia6821_interface *intf) { assert_always(mame_get_phase() == MAME_PHASE_INIT, "Can only call pia_config at init time!"); assert_always((which >= 0) && (which < MAX_PIA), "pia_config called on an invalid PIA!"); assert_always(intf, "pia_config called with an invalid interface!"); memset(&pia[which], 0, sizeof(pia[0])); pia[which].intf = intf; pia[which].addr = addressing; state_save_register_item("6821pia", which, pia[which].in_a); state_save_register_item("6821pia", which, pia[which].in_ca1); state_save_register_item("6821pia", which, pia[which].in_ca2); state_save_register_item("6821pia", which, pia[which].out_a); state_save_register_item("6821pia", which, pia[which].out_ca2); state_save_register_item("6821pia", which, pia[which].ddr_a); state_save_register_item("6821pia", which, pia[which].ctl_a); state_save_register_item("6821pia", which, pia[which].irq_a1); state_save_register_item("6821pia", which, pia[which].irq_a2); state_save_register_item("6821pia", which, pia[which].irq_a_state); state_save_register_item("6821pia", which, pia[which].in_b); state_save_register_item("6821pia", which, pia[which].in_cb1); state_save_register_item("6821pia", which, pia[which].in_cb2); state_save_register_item("6821pia", which, pia[which].out_b); state_save_register_item("6821pia", which, pia[which].out_cb2); state_save_register_item("6821pia", which, pia[which].ddr_b); state_save_register_item("6821pia", which, pia[which].ctl_b); state_save_register_item("6821pia", which, pia[which].irq_b1); state_save_register_item("6821pia", which, pia[which].irq_b2); state_save_register_item("6821pia", which, pia[which].irq_b_state); state_save_register_item("6821pia", which, pia[which].in_set); }
void add_logerror_callback(void (*callback)(const char *)) { callback_item *cb, **cur; assert_always(mame_get_phase() == MAME_PHASE_INIT, "Can only call add_logerror_callback at init time!"); cb = auto_malloc(sizeof(*cb)); cb->func.log = callback; cb->next = NULL; for (cur = &logerror_callback_list; *cur; cur = &(*cur)->next) ; *cur = cb; }
void add_logerror_callback(running_machine *machine, void (*callback)(running_machine *, const char *)) { mame_private *mame = machine->mame_data; callback_item *cb, **cur; assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_logerror_callback at init time!"); cb = auto_malloc(sizeof(*cb)); cb->func.log = callback; cb->next = NULL; for (cur = &mame->logerror_callback_list; *cur; cur = &(*cur)->next) ; *cur = cb; }
void add_exit_callback(void (*callback)(void)) { callback_item *cb; assert_always(mame_get_phase() == MAME_PHASE_INIT, "Can only call add_exit_callback at init time!"); /* allocate memory */ cb = malloc_or_die(sizeof(*cb)); /* add us to the head of the list */ cb->func.exit = callback; cb->next = exit_callback_list; exit_callback_list = cb; }
void add_exit_callback(running_machine *machine, void (*callback)(running_machine *)) { mame_private *mame = machine->mame_data; callback_item *cb; assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_exit_callback at init time!"); /* allocate memory */ cb = malloc_or_die(sizeof(*cb)); /* add us to the head of the list */ cb->func.exit = callback; cb->next = mame->exit_callback_list; mame->exit_callback_list = cb; }
void add_pause_callback(void (*callback)(int)) { callback_item *cb, **cur; assert_always(mame_get_phase() == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!"); /* allocate memory */ cb = malloc_or_die(sizeof(*cb)); /* add us to the end of the list */ cb->func.pause = callback; cb->next = NULL; for (cur = &pause_callback_list; *cur; cur = &(*cur)->next) ; *cur = cb; }
void add_pause_callback(running_machine *machine, void (*callback)(running_machine *, int)) { mame_private *mame = machine->mame_data; callback_item *cb, **cur; assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!"); /* allocate memory */ cb = malloc_or_die(sizeof(*cb)); /* add us to the end of the list */ cb->func.pause = callback; cb->next = NULL; for (cur = &mame->pause_callback_list; *cur; cur = &(*cur)->next) ; *cur = cb; }
void debug_console_register_command(running_machine *machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine *machine, int ref, int params, const char **param)) { debug_command *cmd; assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); assert_always((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running"); cmd = auto_alloc_clear(machine, debug_command); /* fill in the command */ strcpy(cmd->command, command); cmd->flags = flags; cmd->ref = ref; cmd->minparams = minparams; cmd->maxparams = maxparams; cmd->handler = handler; /* link it */ cmd->next = commandlist; commandlist = cmd; }
void debug_console_register_command(const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(int ref, int params, const char **param)) { debug_command *cmd; assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call debug_console_register_command() at init time!"); assert_always(Machine->debug_mode, "Cannot call debug_console_register_command() when debugger is not running"); cmd = auto_malloc(sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); /* fill in the command */ strcpy(cmd->command, command); cmd->flags = flags; cmd->ref = ref; cmd->minparams = minparams; cmd->maxparams = maxparams; cmd->handler = handler; /* link it */ cmd->next = commandlist; commandlist = cmd; }
void video_frame_update(void) { int skipped_it = video_skip_this_frame(); int paused = mame_is_paused(Machine); int phase = mame_get_phase(Machine); int livemask; int scrnum; /* only render sound and video if we're in the running phase */ if (phase == MAME_PHASE_RUNNING) { /* update sound */ sound_frame_update(); /* finish updating the screens */ for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) if (Machine->drv->screen[scrnum].tag != NULL) video_screen_update_partial(scrnum, Machine->screen[scrnum].visarea.max_y); /* now add the quads for all the screens */ livemask = render_get_live_screens_mask(); for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) { if (livemask & (1 << scrnum)) { internal_screen_info *screen = &scrinfo[scrnum]; /* only update if empty and not a vector game; otherwise assume the driver did it directly */ if (render_container_is_empty(render_container_get_screen(scrnum)) && !(Machine->drv->video_attributes & VIDEO_TYPE_VECTOR)) { mame_bitmap *bitmap = screen->bitmap[screen->curbitmap]; if (!skipping_this_frame && screen->changed) { rectangle fixedvis = Machine->screen[scrnum].visarea; fixedvis.max_x++; fixedvis.max_y++; render_texture_set_bitmap(screen->texture, bitmap, &fixedvis, Machine->drv->screen[scrnum].palette_base, screen->format); screen->curbitmap = 1 - screen->curbitmap; } render_screen_add_quad(scrnum, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), screen->texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); } } } /* update our movie recording state */ if (!paused) movie_record_frame(0); /* reset the screen changed flags */ for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) scrinfo[scrnum].changed = 0; } /* draw any crosshairs */ crosshair_render(); /* draw the user interface */ ui_update_and_render(); /* call the OSD to update */ skipping_this_frame = osd_update(mame_timer_get_time()); /* empty the containers */ for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) if (Machine->drv->screen[scrnum].tag != NULL) render_container_empty(render_container_get_screen(scrnum)); /* update FPS */ recompute_fps(skipped_it); /* call the end-of-frame callback */ if (phase == MAME_PHASE_RUNNING) { /* reset partial updates if we're paused or if the debugger is active */ if (paused || mame_debug_is_active()) video_reset_partial_updates(); /* otherwise, call the video EOF callback */ else if (Machine->drv->video_eof != NULL) { profiler_mark(PROFILER_VIDEO); (*Machine->drv->video_eof)(Machine); profiler_mark(PROFILER_END); } } }