void debugger_flush_all_traces_on_abnormal_exit(void) { /* clear out the machine list and flush traces on each one */ while (machine_list != NULL) { machine_entry *deleteme = machine_list; debug_cpu_flush_traces(*deleteme->machine); machine_list = deleteme->next; global_free(deleteme); } }
static void video_exit(running_machine &machine) { // free all of our monitor information while (sdl_monitor_list != NULL) { sdl_monitor_info *temp = sdl_monitor_list; sdl_monitor_list = temp->next; global_free(temp); } }
void debug_view_manager::free_view(debug_view &view) { // free us but only if we're in the list for (debug_view **viewptr = &m_viewlist; *viewptr != nullptr; viewptr = &(*viewptr)->m_next) if (*viewptr == &view) { *viewptr = view.m_next; global_free(&view); break; } }
static void create_bitmap(running_machine *machine, int player) { int x, y; char filename[20]; rgb_t color = crosshair_colors[player]; /* if we have a bitmap and texture for this player, kill it */ global_free(global.bitmap[player]); machine->render().texture_free(global.texture[player]); emu_file crossfile(machine->options(), OPTION_CROSSHAIRPATH, OPEN_FLAG_READ); if (global.name[player][0] != 0) { /* look for user specified file */ sprintf(filename, "%s.png", global.name[player]); global.bitmap[player] = render_load_png(crossfile, NULL, filename, NULL, NULL); } else { /* look for default cross?.png in crsshair\game dir */ sprintf(filename, "cross%d.png", player + 1); global.bitmap[player] = render_load_png(crossfile, machine->gamedrv->name, filename, NULL, NULL); /* look for default cross?.png in crsshair dir */ if (global.bitmap[player] == NULL) global.bitmap[player] = render_load_png(crossfile, NULL, filename, NULL, NULL); } /* if that didn't work, use the built-in one */ if (global.bitmap[player] == NULL) { /* allocate a blank bitmap to start with */ global.bitmap[player] = global_alloc(bitmap_t(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE, BITMAP_FORMAT_ARGB32)); bitmap_fill(global.bitmap[player], NULL, MAKE_ARGB(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ UINT32 *dest0 = BITMAP_ADDR32(global.bitmap[player], y, 0); UINT32 *dest1 = BITMAP_ADDR32(global.bitmap[player], CROSSHAIR_RAW_SIZE - 1 - y, 0); /* extract to two rows simultaneously */ for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color; } } /* create a texture to reference the bitmap */ global.texture[player] = machine->render().texture_alloc(render_texture::hq_scale); global.texture[player]->set_bitmap(global.bitmap[player], NULL, TEXFORMAT_ARGB32); }
device_image_interface::~device_image_interface() { image_device_format **formatptr = &m_formatlist; /* free all entries */ while (*formatptr != NULL) { image_device_format *entry = *formatptr; *formatptr = entry->m_next; global_free(entry); } }
legacy_image_device_config_base::~legacy_image_device_config_base() { image_device_format **formatptr = &m_formatlist; /* free all entries */ while (*formatptr != NULL) { image_device_format *entry = *formatptr; *formatptr = entry->m_next; global_free(entry); } }
void windows_osd_interface::video_exit() { window_exit(); // free all of our monitor information while (osd_monitor_info::list != NULL) { osd_monitor_info *temp = osd_monitor_info::list; osd_monitor_info::list = temp->m_next; global_free(temp); } }
void staleness_free_snapshot(stale_snap_allocs_t *snaps) { if (snaps == NULL) return; if (snaps->num_entries > 0) { if (snaps->uses_large) { global_free(snaps->data.lg, snaps->num_entries*sizeof(*snaps->data.lg), HEAPSTAT_STALENESS); } else { global_free(snaps->data.sm.main, snaps->num_entries*sizeof(*snaps->data.sm.main), HEAPSTAT_STALENESS); if (snaps->data.sm.ext != NULL) { global_free(snaps->data.sm.ext, snaps->data.sm.ext_capacity* sizeof(*snaps->data.sm.ext), HEAPSTAT_STALENESS); } } } global_free(snaps, sizeof(*snaps), HEAPSTAT_STALENESS); }
/* Free a boxed reference. Free the unboxed reference if necessary. */ void boxed_free(Boxed reference) { if (!reference) return; global_free(); if (--reference->count > 0) return; assert(reference->count == 0); if (boxed_type(reference) == QUOTATION) quotation_clear(reference); unboxed_free(reference->value); free(reference); }
static void crosshair_exit(running_machine &machine) { /* free bitmaps and textures for each player */ for (int player = 0; player < MAX_PLAYERS; player++) { machine.render().texture_free(global.texture[player]); global.texture[player] = NULL; global_free(global.bitmap[player]); global.bitmap[player] = NULL; } }
void floppy_image_device::call_unload() { dskchg = 0; if (image) { if(image_dirty) commit_image(); global_free(image); image = 0; } if (!cur_unload_cb.isnull()) cur_unload_cb(this); }
static int nvram_system_save( running_machine &machine, const char *name, nvram_save_func _nvram_save) { emu_file *file; file = nvram_system_fopen( machine, OPEN_FLAG_CREATE | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE_PATHS, name); if (!file) { mame_printf_error( "nvram save failed (%s)\n", name); return FALSE; } (*_nvram_save)(machine, file); global_free(file); return TRUE; }
static void winoutput_exit(running_machine &machine) { // free all the clients while (clientlist != NULL) { registered_client *temp = clientlist; clientlist = temp->next; global_free(temp); } // broadcast a shutdown message PostMessage(HWND_BROADCAST, om_mame_stop, (WPARAM)output_hwnd, 0); }
bool midiout_device::call_load(void) { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_output(filename())) { global_free(m_midi); m_midi = NULL; return IMAGE_INIT_FAIL; } return IMAGE_INIT_PASS; }
void windows_osd_interface::output_exit() { // free all the clients while (clientlist != nullptr) { registered_client *temp = clientlist; clientlist = temp->next; global_free(temp); } // broadcast a shutdown message PostMessage(HWND_BROADCAST, om_mame_stop, (WPARAM)output_hwnd, 0); }
static int nvram_system_load( running_machine &machine, const char *name, nvram_load_func _nvram_load, int required) { emu_file *file; file = nvram_system_fopen( machine, OPEN_FLAG_READ, name); if (!file) { if (required) mame_printf_error( "nvram load failed (%s)\n", name); return FALSE; } (*_nvram_load)(machine, file); global_free(file); return TRUE; }
void software_config_free(software_config *config) { if (config->mconfig != NULL) { global_free(config->mconfig); config->mconfig = NULL; } /*if (config->hashfile != NULL) { hashfile_close(config->hashfile); config->hashfile = NULL; }*/ free(config); }
static void debugger_exit(running_machine *machine) { machine_entry **entryptr; /* remove this machine from the list; it came down cleanly */ for (entryptr = &machine_list; *entryptr != NULL; entryptr = &(*entryptr)->next) if ((*entryptr)->machine == machine) { machine_entry *deleteme = *entryptr; *entryptr = deleteme->next; global_free(deleteme); break; } }
/*------------------------------------------------- softlist_match_roms - scan for a matching software ROM by hash -------------------------------------------------*/ static void softlist_match_roms(core_options *options, const char *hash, int length, int *found) { int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) { machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); for (const device_config *dev = config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { if ( swlist->list_name[i] ) { software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) ) { for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) ) { for ( const rom_entry *region = part->romdata; region != NULL; region = rom_next_region(region) ) { for ( const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom) ) { if ( hash_data_is_equal(hash, ROM_GETHASHDATA(rom), 0) ) { int baddump = hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP); /* output information about the match */ if (*found != 0) mame_printf_info(" "); mame_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlist->list_name[i], swinfo->shortname, swinfo->longname); (*found)++; } } } } } software_list_close( list ); } } } global_free(config); } }
void staleness_sweep(uint64 stamp) { /* if we changed iter param to always be 64 bits we wouldn't need this */ uint64 *iter_data = (uint64 *) global_alloc(sizeof(*iter_data), HEAPSTAT_STALENESS); /* note that depending on the time units in use, and the period between * snapshots, this sweep could use the same stamp as the last sweep: * that's fine, but should we up the sweep timer? */ *iter_data = stamp; ASSERT(options.staleness, "should not get here"); LOG(2, "\nSTALENESS SWEEP @%"INT64_FORMAT"u\n", stamp); malloc_iterate(alloc_itercb_sweep, (void *) iter_data); global_free(iter_data, sizeof(*iter_data), HEAPSTAT_STALENESS); }
// Verifies the ROM set while calling SetRomAuditResults int MameUIVerifyRomSet(int game) { audit_record *audit; int audit_records; int res; // perform the audit audit_records = audit_images(MameUIGlobal(), drivers[game], AUDIT_VALIDATE_FAST, &audit); res = ProcessAuditResults(game, audit, audit_records); if (audit_records > 0) global_free(audit); SetRomAuditResults(game, res); return res; }
bool midiin_device::call_load(void) { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_input(filename())) { global_free(m_midi); m_midi = NULL; return IMAGE_INIT_FAIL; } m_timer->adjust(attotime::from_hz(1500), 0, attotime::from_hz(1500)); m_timer->enable(true); return IMAGE_INIT_PASS; }
// Verifies the Sample set while calling SetSampleAuditResults int MameUIVerifySampleSet(int game) { audit_record *audit; int audit_records; int res; // perform the audit audit_records = audit_samples(MameUIGlobal(), drivers[game], &audit); res = ProcessAuditResults(game, audit, audit_records); if (audit_records > 0) global_free(audit); SetSampleAuditResults(game, res); return res; }
static void drawdd_window_destroy(win_window_info *window) { dd_info *dd = (dd_info *)window->drawdata; // skip if nothing if (dd == NULL) return; // delete the ddraw object ddraw_delete(window); // free the memory in the window global_free(dd); window->drawdata = NULL; }
netlist_base_t::~netlist_base_t() { for (int i=0; i < m_nets.count(); i++) { if (!m_nets[i]->isRailNet()) { global_free(m_nets[i]); } } m_nets.clear(); m_devices.clear_and_free(); pstring::resetmem(); }
void mini_osd_interface::osd_exit(running_machine &machine) { write_log("osd_exit called \n"); global_free(Pad_device[0]); global_free(Pad_device[1]); global_free(joy_device[0]); global_free(joy_device[1]); global_free(retrokbd_device); global_free(mouse_device); }
file_error common_process_file(emu_options &options, const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, emu_file **image_file) { *image_file = global_alloc(emu_file(options.media_path(), OPEN_FLAG_READ)); file_error filerr; if (has_crc) filerr = (*image_file)->open(location, PATH_SEPARATOR, ROM_GETNAME(romp), crc); else filerr = (*image_file)->open(location, PATH_SEPARATOR, ROM_GETNAME(romp)); if (filerr != FILERR_NONE) { global_free(*image_file); *image_file = NULL; } return filerr; }
DR_EXPORT drmf_status_t drfuzz_exit(void) { int count = dr_atomic_add32_return_sum(&drfuzz_init_count, -1); if (count > 0) return DRMF_SUCCESS; if (count < 0) return DRMF_ERROR; global_free(callbacks, sizeof(drfuzz_callbacks_t), HEAPSTAT_MISC); drmgr_exit(); drwrap_exit(); hashtable_delete(&fuzz_target_htable); return DRMF_SUCCESS; }
void info_xml_creator::output_devices() { m_drivlist.reset(); slot_map shortnames; while (m_drivlist.next()) { // first, run through devices with roms which belongs to the default configuration device_iterator deviter(m_drivlist.config().root_device()); for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) { if (device->owner() != NULL && device->rom_region() != NULL && device->shortname()!= NULL) { if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE) output_one_device(*device, device->tag()); } } // then, run through slot devices slot_interface_iterator iter(m_drivlist.config().root_device()); for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) { const slot_interface* intf = slot->get_slot_interfaces(); for (int i = 0; intf && intf[i].name != NULL; i++) { astring temptag("_"); temptag.cat(intf[i].name); device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.cstr(), intf[i].devtype, 0); // notify this device and all its subdevices that they are now configured device_iterator subiter(*dev); for (device_t *device = subiter.first(); device != NULL; device = subiter.next()) if (!device->configured()) device->config_complete(); if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE) output_one_device(*dev, temptag.cstr()); const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.cstr()); global_free(dev); } } } }
static LRESULT unregister_client(HWND hwnd, LPARAM id) { registered_client **client; int found = FALSE; // find any matching IDs in the list and remove them for (client = &clientlist; *client != NULL; client = &(*client)->next) if ((*client)->id == id) { registered_client *temp = *client; *client = (*client)->next; global_free(temp); found = TRUE; break; } // return an error if not found return found ? 0 : 1; }