void generic_machine_init(running_machine &machine) { generic_machine_private *state; int counternum; /* allocate our state */ machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private); state = machine.generic_machine_data; /* reset coin counters */ for (counternum = 0; counternum < COIN_COUNTERS; counternum++) { state->lastcoin[counternum] = 0; state->coinlockedout[counternum] = 0; } /* register coin save state */ machine.save().save_item(NAME(state->coin_count)); machine.save().save_item(NAME(state->coinlockedout)); machine.save().save_item(NAME(state->lastcoin)); /* reset memory card info */ state->memcard_inserted = -1; /* register for configuration */ config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine)); /* for memory cards, request save state and an exit callback */ if (machine.config().m_memcard_handler != NULL) { machine.save().save_item(NAME(state->memcard_inserted)); machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine)); } }
void generic_machine_init(running_machine *machine) { int counternum; /* reset coin counters */ for (counternum = 0; counternum < COIN_COUNTERS; counternum++) { lastcoin[counternum] = 0; coinlockedout[counternum] = 0; servicecoinlockedout[counternum] = 0; } /* reset NVRAM size and pointers */ generic_nvram_size = 0; generic_nvram = NULL; generic_nvram16 = NULL; generic_nvram32 = NULL; /* reset memory card info */ memcard_inserted = -1; /* register a reset callback and save state for interrupt enable */ add_reset_callback(machine, interrupt_reset); state_save_register_item_array("cpu", 0, interrupt_enable); /* register for configuration */ config_register("counters", counters_load, counters_save); /* for memory cards, request save state and an exit callback */ if (machine->drv->memcard_handler != NULL) { state_save_register_global(memcard_inserted); add_exit_callback(machine, memcard_eject); } }
int sound_init(running_machine *machine) { /* handle -nosound */ nosound_mode = (Machine->sample_rate == 0); if (nosound_mode) Machine->sample_rate = 11025; /* count the speakers */ for (totalspeakers = 0; Machine->drv->speaker[totalspeakers].tag; totalspeakers++) ; VPRINTF(("total speakers = %d\n", totalspeakers)); /* initialize the OSD layer */ VPRINTF(("osd_start_audio_stream\n")); samples_this_frame = osd_start_audio_stream(1); if (!samples_this_frame) return 1; /* allocate memory for mix buffers */ leftmix = auto_malloc(Machine->sample_rate * sizeof(*leftmix)); rightmix = auto_malloc(Machine->sample_rate * sizeof(*rightmix)); finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix)); /* allocate a global timer for sound timing */ sound_update_timer = mame_timer_alloc(NULL); /* initialize the streams engine */ VPRINTF(("streams_init\n")); streams_init(); /* now start up the sound chips and tag their streams */ VPRINTF(("start_sound_chips\n")); if (start_sound_chips()) return 1; /* then create all the speakers */ VPRINTF(("start_speakers\n")); if (start_speakers()) return 1; /* finally, do all the routing */ VPRINTF(("route_sound\n")); if (route_sound()) return 1; if (MAKE_WAVS) wavfile = wav_open("finalmix.wav", Machine->sample_rate, 2); /* enable sound by default */ global_sound_enabled = TRUE; /* register callbacks */ config_register("mixer", sound_load, sound_save); add_pause_callback(machine, sound_pause); add_reset_callback(machine, sound_reset); add_exit_callback(machine, sound_exit); return 0; }
void registry_init(void) { /* Request settings json object in main configuration */ config_register(&config_registry, "registry"); config_registry->readorder = 5; config_registry->writeorder = 5; config_registry->parse=®istry_parse; config_registry->sync=®istry_sync; config_registry->gc=®istry_gc; }
void laserdisc_device::device_start() { // initialize the various pieces init_disc(); init_video(); init_audio(); // register callbacks config_register(machine(), "laserdisc", config_saveload_delegate(FUNC(laserdisc_device::config_load), this), config_saveload_delegate(FUNC(laserdisc_device::config_save), this)); }
void sound_init(running_machine *machine) { attotime update_frequency = SOUND_UPDATE_FREQUENCY; const char *filename; /* handle -nosound */ nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND); if (nosound_mode) Machine->sample_rate = 11025; /* count the speakers */ for (totalspeakers = 0; Machine->drv->speaker[totalspeakers].tag; totalspeakers++) ; VPRINTF(("total speakers = %d\n", totalspeakers)); /* allocate memory for mix buffers */ leftmix = auto_malloc(Machine->sample_rate * sizeof(*leftmix)); rightmix = auto_malloc(Machine->sample_rate * sizeof(*rightmix)); finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix)); /* allocate a global timer for sound timing */ sound_update_timer = timer_alloc(sound_update, NULL); timer_adjust(sound_update_timer, update_frequency, 0, update_frequency); /* initialize the streams engine */ VPRINTF(("streams_init\n")); streams_init(machine, update_frequency.attoseconds); /* now start up the sound chips and tag their streams */ VPRINTF(("start_sound_chips\n")); start_sound_chips(); /* then create all the speakers */ VPRINTF(("start_speakers\n")); start_speakers(); /* finally, do all the routing */ VPRINTF(("route_sound\n")); route_sound(); /* open the output WAV file if specified */ filename = options_get_string(mame_options(), OPTION_WAVWRITE); if (filename[0] != 0) wavfile = wav_open(filename, machine->sample_rate, 2); /* enable sound by default */ global_sound_enabled = TRUE; sound_muted = FALSE; sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME)); /* register callbacks */ config_register("mixer", sound_load, sound_save); add_pause_callback(machine, sound_pause); add_reset_callback(machine, sound_reset); add_exit_callback(machine, sound_exit); }
void rules_init(void) { event_operator_init(); event_action_init(); /* Request rules json object in main configuration */ config_register(&config_rules, "rules"); config_rules->readorder = 2; config_rules->writeorder = 1; config_rules->parse=&rules_parse; config_rules->sync=&rules_sync; config_rules->gc=&rules_gc; }
/// register the logging configuration /// note that for this to work, logger_handle_create("handle-name",logger_handle_for_handle_name_ptr_ptr) /// must be called before the config_read is done ya_result config_register_logger(const char *null_or_channels_name, const char *null_or_loggers_name, s32 priority) { //null_or_channels_name = "channels"; //null_or_loggers_name = "loggers"; (void)null_or_channels_name; (void)null_or_loggers_name; if(priority < 0) { priority = 0; } ya_result return_code; if(ISOK(return_code = config_register(&config_section_handles_descriptor, priority + 0))) { return_code = config_register(&config_section_loggers_descriptor, priority + 1); } return return_code; }
void laserdisc_device::device_start() { // if we have a palette and it's not started, wait for it if (m_overlay_palette != NULL && !m_overlay_palette->started()) throw device_missing_dependencies(); // initialize the various pieces init_disc(); init_video(); init_audio(); // register callbacks config_register(machine(), "laserdisc", config_saveload_delegate(FUNC(laserdisc_device::config_load), this), config_saveload_delegate(FUNC(laserdisc_device::config_save), this)); }
void laserdisc_device::device_start() { // ensure that our screen is started first m_screen = machine().device<screen_device>(m_screen_name); assert(m_screen != NULL); if (!m_screen->started()) throw device_missing_dependencies(); // initialize the various pieces init_disc(); init_video(); init_audio(); // register callbacks config_register(machine(), "laserdisc", config_saveload_delegate(FUNC(laserdisc_device::config_load), this), config_saveload_delegate(FUNC(laserdisc_device::config_save), this)); }
void cutoff_init(void) { CUTOFF_INIT(); config_register(&cutoff); config_load(&cutoff); uplink_registerCmd("cutoff", cutoff_procedure); uplink_registerCmd("cutoff_reset", cmd_cutoff_reset); uplink_registerCmd("cutoff_pause", cmd_cutoff_pause); uplink_registerCmd("cutoff_resume", cmd_cutoff_resume); #if !(ARCH & ARCH_UNITTEST) //start process LOG_INFO("Starting cutoff process\n"); Process *p = proc_new(cutoff_process, NULL, KERN_MINSTACKSIZE * 6, NULL); ASSERT(p); #endif }
void sound_init(running_machine *machine) { sound_private *global; const char *filename; machine->sound_data = global = auto_alloc_clear(machine, sound_private); /* handle -nosound */ global->nosound_mode = !options_get_bool(machine->options(), OPTION_SOUND); if (global->nosound_mode) machine->sample_rate = 11025; /* count the speakers */ VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config))); /* allocate memory for mix buffers */ global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate); /* allocate a global timer for sound timing */ global->update_timer = timer_alloc(machine, sound_update, NULL); timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); /* finally, do all the routing */ VPRINTF(("route_sound\n")); route_sound(machine); /* open the output WAV file if specified */ filename = options_get_string(machine->options(), OPTION_WAVWRITE); if (filename[0] != 0) global->wavfile = wav_open(filename, machine->sample_rate, 2); /* enable sound by default */ global->enabled = TRUE; global->muted = FALSE; sound_set_attenuation(machine, options_get_int(machine->options(), OPTION_VOLUME)); /* register callbacks */ config_register(machine, "mixer", sound_load, sound_save); machine->add_notifier(MACHINE_NOTIFY_PAUSE, sound_pause); machine->add_notifier(MACHINE_NOTIFY_RESUME, sound_resume); machine->add_notifier(MACHINE_NOTIFY_RESET, sound_reset); machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit); }
void generic_machine_init(running_machine &machine) { generic_machine_private *state; int counternum; /* allocate our state */ machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private); state = machine.generic_machine_data; /* reset coin counters */ for (counternum = 0; counternum < COIN_COUNTERS; counternum++) { state->lastcoin[counternum] = 0; state->coinlockedout[counternum] = 0; } // map devices to the interrupt state memset(state->interrupt_device, 0, sizeof(state->interrupt_device)); device_execute_interface *exec = NULL; int index = 0; for (bool gotone = machine.devicelist().first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec)) state->interrupt_device[index++] = &exec->device(); /* register coin save state */ machine.save().save_item(NAME(state->coin_count)); machine.save().save_item(NAME(state->coinlockedout)); machine.save().save_item(NAME(state->lastcoin)); /* reset memory card info */ state->memcard_inserted = -1; /* register a reset callback and save state for interrupt enable */ machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(interrupt_reset), &machine)); machine.save().save_item(NAME(state->interrupt_enable)); /* register for configuration */ config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine)); /* for memory cards, request save state and an exit callback */ if (machine.config().m_memcard_handler != NULL) { state_save_register_global(machine, state->memcard_inserted); machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine)); } }
void crosshair_init(running_machine *machine) { const input_port_config *port; const input_field_config *field; /* request a callback upon exiting */ machine->add_notifier(MACHINE_NOTIFY_EXIT, crosshair_exit); /* clear all the globals */ memset(&global, 0, sizeof(global)); /* setup the default auto visibility time */ global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT; /* determine who needs crosshairs */ for (port = machine->m_portlist.first(); port != NULL; port = port->next()) for (field = port->fieldlist; field != NULL; field = field->next) if (field->crossaxis != CROSSHAIR_AXIS_NONE) { int player = field->player; assert(player < MAX_PLAYERS); /* mark as used and set the default visibility and mode */ global.usage = TRUE; global.used[player] = TRUE; global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT; global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE; /* for now, use the main screen */ global.screen[player] = machine->primary_screen; create_bitmap(machine, player); } /* register callbacks for when we load/save configurations */ if (global.usage) config_register(machine, "crosshairs", crosshair_load, crosshair_save); /* register the animation callback */ if (machine->primary_screen != NULL) machine->primary_screen->register_vblank_callback(animate, NULL); }
ya_result config_register_zone(const char *null_or_key_name, s32 priority) { //null_or_key_name = "zone"; (void)null_or_key_name; config_section_descriptor_s *desc; MALLOC_OR_DIE(config_section_descriptor_s*, desc, sizeof(config_section_descriptor_s), CFGSDESC_TAG); desc->base = NULL; desc->vtbl = &config_section_zone_descriptor_vtbl; ya_result return_code = config_register(desc, priority); if(FAIL(return_code)) { free(desc); } return return_code; // scan-build false positive: either it is freed, either it is stored in a global collection }
void crosshair_init(running_machine &machine) { /* request a callback upon exiting */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_exit), &machine)); /* clear all the globals */ memset(&global, 0, sizeof(global)); /* setup the default auto visibility time */ global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT; /* determine who needs crosshairs */ for (ioport_port *port = machine.ioport().first_port(); port != NULL; port = port->next()) for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE) { int player = field->player(); assert(player < MAX_PLAYERS); /* mark as used and set the default visibility and mode */ global.usage = TRUE; global.used[player] = TRUE; global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT; global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE; /* for now, use the main screen */ global.screen[player] = machine.first_screen(); create_bitmap(machine, player); } /* register callbacks for when we load/save configurations */ if (global.usage) config_register(machine, "crosshairs", config_saveload_delegate(FUNC(crosshair_load), &machine), config_saveload_delegate(FUNC(crosshair_save), &machine)); /* register the animation callback */ if (machine.first_screen() != NULL) machine.first_screen()->register_vblank_callback(vblank_state_delegate(FUNC(animate), &machine)); }
int pi_rrd_init () { pi_rrd = plugin_register ("rrd"); /* *INDENT-OFF* */ command_register ("rrdcreate", &pi_rrd_handler_rrdcreate, CAP_CONFIG, _("Create an RRD file for statistics gathering")); command_register ("rrdlist", &pi_rrd_handler_rrdlist, CAP_CONFIG, _("Show the RRD file generated.")); command_register ("rrddelete", &pi_rrd_handler_rrddelete, CAP_CONFIG, _("Remove a RRD file.")); /* *INDENT-ON* */ plugin_request (NULL, PLUGIN_EVENT_LOAD, (plugin_event_handler_t *) pi_rrd_handle_load); plugin_request (NULL, PLUGIN_EVENT_SAVE, (plugin_event_handler_t *) pi_rrd_handle_save); config_register ("rrd.silent", CFG_ELEM_ULONG, &rrd_silent, _("If set, errors are not reported.")); rrdlist.next = &rrdlist; rrdlist.prev = &rrdlist; return 0; }
void measures_init(void) { sem_init(&i2c_sem); i2c_init(&i2c_bus, I2C_BITBANG0, CONFIG_I2C_FREQ); bool ret = mma845x_init(&i2c_bus, 0, MMADYN_4G); ASSERT(ret); Process *p = proc_new(acc_process, NULL, KERN_MINSTACKSIZE * 4, NULL); ASSERT(p); aux_init(); config_register(&measures); config_load(&measures); /* Start current check process */ p = proc_new(curr_process, NULL, KERN_MINSTACKSIZE * 4, NULL); ASSERT(p); uplink_registerCmd("curr_override", cmd_curr_override); uplink_registerCmd("curr_reset", cmd_curr_reset); }
void generic_machine_init(running_machine &machine) { generic_machine_private *state; int counternum; /* allocate our state */ machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private); state = machine.generic_machine_data; /* reset coin counters */ for (counternum = 0; counternum < COIN_COUNTERS; counternum++) { state->lastcoin[counternum] = 0; state->coinlockedout[counternum] = 0; } /* register coin save state */ machine.save().save_item(NAME(state->coin_count)); machine.save().save_item(NAME(state->coinlockedout)); machine.save().save_item(NAME(state->lastcoin)); /* register for configuration */ config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine)); }
void image_init(running_machine *machine) { image_device_init(machine); config_register(machine, "image_directories", image_dirs_load, image_dirs_save); }
void image_init(running_machine &machine) { image_device_init(machine); config_register(machine, "image_directories", config_saveload_delegate(FUNC(image_dirs_load), &machine), config_saveload_delegate(FUNC(image_dirs_save), &machine)); }
void sdl_osd_interface::init_debugger() { /* register callbacks */ config_register(machine(), "debugger", config_saveload_delegate(FUNC(configuration_load), &machine()), config_saveload_delegate(FUNC(configuration_save), &machine())); }