void harddisk_image_device::device_config_complete() { // inherit a copy of the static data const harddisk_interface *intf = reinterpret_cast<const harddisk_interface *>(static_config()); if (intf != NULL) *static_cast<harddisk_interface *>(this) = *intf; // or initialize to defaults if none provided else { memset(&m_device_image_load, 0, sizeof(m_device_image_load)); memset(&m_device_image_unload, 0, sizeof(m_device_image_unload)); memset(&m_interface, 0, sizeof(m_interface)); memset(&m_device_displayinfo, 0, sizeof(m_device_displayinfo)); } image_device_format *format = global_alloc_clear(image_device_format);; format->m_index = 0; format->m_name = "chd"; format->m_description = "CHD Hard drive"; format->m_extensions = "chd,hd"; format->m_optspec = hd_option_spec; format->m_next = NULL; m_formatlist = format; // set brief and instance name update_names(); }
legacy_floppy_image_device::legacy_floppy_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_image_interface(mconfig, *this), m_token(NULL) { m_token = global_alloc_clear(floppy_drive); }
void legacy_floppy_image_device::device_config_complete() { image_device_format **formatptr; image_device_format *format; formatptr = &m_formatlist; int cnt = 0; m_extension_list[0] = '\0'; const struct FloppyFormat *floppy_options = ((floppy_interface*)static_config())->formats; for (int i = 0; floppy_options[i].construct; i++) { // only add if creatable if (floppy_options[i].param_guidelines) { // allocate a new format format = global_alloc_clear(image_device_format); // populate it format->m_index = cnt; format->m_name = floppy_options[i].name; format->m_description = floppy_options[i].description; format->m_extensions = floppy_options[i].extensions; format->m_optspec = floppy_options[i].param_guidelines; // and append it to the list *formatptr = format; formatptr = &format->m_next; cnt++; } image_specify_extension( m_extension_list, 256, floppy_options[i].extensions ); } // set brief and instance name update_names(); }
static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data) { win_monitor_info ***tailptr = (win_monitor_info ***)data; win_monitor_info *monitor; MONITORINFOEX info; BOOL result; // get the monitor info info.cbSize = sizeof(info); result = GetMonitorInfo(handle, (LPMONITORINFO)&info); assert(result); (void)result; // to silence gcc 4.6 // allocate a new monitor info monitor = global_alloc_clear(win_monitor_info); // copy in the data monitor->handle = handle; monitor->info = info; // guess the aspect ratio assuming square pixels monitor->aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top); // save the primary monitor handle if (monitor->info.dwFlags & MONITORINFOF_PRIMARY) primary_monitor = monitor; // hook us into the list **tailptr = monitor; *tailptr = &monitor->next; // enumerate all the available monitors so to list their names in verbose mode return TRUE; }
legacy_floppy_image_device::legacy_floppy_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, LEGACY_FLOPPY, "Floppy Disk", tag, owner, clock, "legacy_floppy_image", __FILE__), device_image_interface(mconfig, *this), m_token(NULL) { m_token = global_alloc_clear(floppy_drive); }
static int drawgdi_window_init(win_window_info *window) { gdi_info *gdi; int i; // allocate memory for our structures gdi = global_alloc_clear(gdi_info); window->drawdata = gdi; // fill in the bitmap info header gdi->bminfo.bmiHeader.biSize = sizeof(gdi->bminfo.bmiHeader); gdi->bminfo.bmiHeader.biPlanes = 1; gdi->bminfo.bmiHeader.biCompression = BI_RGB; gdi->bminfo.bmiHeader.biSizeImage = 0; gdi->bminfo.bmiHeader.biXPelsPerMeter = 0; gdi->bminfo.bmiHeader.biYPelsPerMeter = 0; gdi->bminfo.bmiHeader.biClrUsed = 0; gdi->bminfo.bmiHeader.biClrImportant = 0; // initialize the palette to a gray ramp for (i = 0; i < 256; i++) { gdi->bminfo.bmiColors[i].rgbRed = i; gdi->bminfo.bmiColors[i].rgbGreen = i; gdi->bminfo.bmiColors[i].rgbBlue = i; gdi->bminfo.bmiColors[i].rgbReserved = i; } return 0; }
void cdrom_image_device::device_config_complete() { // inherit a copy of the static data const cdrom_interface *intf = reinterpret_cast<const cdrom_interface *>(static_config()); if (intf != NULL) *static_cast<cdrom_interface *>(this) = *intf; // or initialize to defaults if none provided else { memset(&m_interface, 0, sizeof(m_interface)); memset(&m_device_displayinfo, 0, sizeof(m_device_displayinfo)); } m_extension_list = "chd,cue,toc,nrg,gdi,iso,cdr"; image_device_format *format = global_alloc_clear(image_device_format);; format->m_index = 0; format->m_name = "chdcd"; format->m_description = "CD-ROM drive"; format->m_extensions = m_extension_list; format->m_optspec = cd_option_spec; format->m_next = NULL; m_formatlist = format; // set brief and instance name update_names(); }
void floppy_image_device::set_formats(const floppy_format_type *formats) { image_device_format **formatptr; image_device_format *format; formatptr = &m_formatlist; extension_list[0] = '\0'; fif_list = 0; for(int cnt=0; formats[cnt]; cnt++) { // allocate a new format floppy_image_format_t *fif = formats[cnt](); if(!fif_list) fif_list = fif; else fif_list->append(fif); format = global_alloc_clear(image_device_format); format->m_index = cnt; format->m_name = fif->name(); format->m_description = fif->description(); format->m_extensions = fif->extensions(); format->m_optspec = ""; image_specify_extension( extension_list, 256, fif->extensions() ); // and append it to the list *formatptr = format; formatptr = &format->m_next; } // set brief and instance name update_names(); }
mos6581_device::mos6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_sound_interface(mconfig, *this), m_read_potx(*this), m_read_poty(*this), m_stream(NULL), m_variant(variant) { m_token = global_alloc_clear(SID6581_t); }
mos6581_device::mos6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, MOS6581, "MOS6581", tag, owner, clock, "mos6581", __FILE__), device_sound_interface(mconfig, *this), m_read_potx(*this), m_read_poty(*this), m_stream(NULL), m_variant(TYPE_6581) { m_token = global_alloc_clear(SID6581_t); }
void add_netdev(const char *name, const char *description, create_netdev func) { osd_netdev::entry_t *entry = global_alloc_clear(osd_netdev::entry_t); entry->id = netdev_list.count(); strncpy(entry->name, name, 255); entry->name[255] = '\0'; strncpy(entry->description, (description != NULL) ? description : "(no name)", 255); entry->description[255] = '\0'; entry->func = func; netdev_list.append(*entry); }
void add_netdev(const char *name, const char *description, create_netdev func) { netdev_entry_t *entry = global_alloc_clear(netdev_entry_t); entry->id = netdev_list.count(); strncpy(entry->name, name, 255); entry->name[255] = '\0'; strncpy(entry->description, description, 255); entry->description[255] = '\0'; entry->func = func; netdev_list.append(*entry); }
x86log_context *x86log_create_context(const char *filename) { x86log_context *log; /* allocate the log */ log = global_alloc_clear(x86log_context); /* allocate the filename */ log->filename.cpy(filename); /* reset things */ reset_log(log); return log; }
static void init_monitors(void) { sdl_monitor_info **tailptr; // make a list of monitors sdl_monitor_list = NULL; tailptr = &sdl_monitor_list; #if (SDLMAME_SDL2) { int i; mame_printf_verbose("Enter init_monitors\n"); for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { sdl_monitor_info *monitor; SDL_DisplayMode dmode; // allocate a new monitor info monitor = global_alloc_clear(sdl_monitor_info); snprintf(monitor->monitor_device, sizeof(monitor->monitor_device)-1, "%s%d", SDLOPTION_SCREEN,i); SDL_GetDesktopDisplayMode(i, &dmode); monitor->monitor_width = dmode.w; monitor->monitor_height = dmode.h; monitor->center_width = dmode.w; monitor->center_height = dmode.h; monitor->handle = i; // guess the aspect ratio assuming square pixels monitor->aspect = (float)(dmode.w) / (float)(dmode.h); mame_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->monitor_device, dmode.w, dmode.h); // save the primary monitor handle if (i == 0) primary_monitor = monitor; // hook us into the list *tailptr = monitor; tailptr = &monitor->next; } } mame_printf_verbose("Leave init_monitors\n"); #elif defined(SDLMAME_WIN32) EnumDisplayMonitors(NULL, NULL, monitor_enum_callback, (LPARAM)&tailptr); #else add_primary_monitor((void *)&tailptr); #endif }
void datapack_device::device_config_complete() { image_device_format *format = global_alloc_clear(image_device_format); format->m_index = 0; format->m_name = "opk"; format->m_description = "Psion Datapack image"; format->m_extensions = "opk"; format->m_optspec = datapack_option_spec; format->m_next = NULL; m_formatlist = format; // set brief and instance name update_names(); }
void sdl_monitor_info::add_primary_monitor(void *data) { // make a list of monitors osd_monitor_info::list = NULL; osd_monitor_info **tailptr = &sdl_monitor_info::list; // allocate a new monitor info osd_monitor_info *monitor = global_alloc_clear(sdl_monitor_info(0, "", 1.0f)); //monitor->refresh(); // guess the aspect ratio assuming square pixels monitor->set_aspect((float)(monitor->position_size().width()) / (float)(monitor->position_size().height())); // hook us into the list *tailptr = monitor; //tailptr = &monitor->m_next; }
static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data) { sdl_monitor_info ***tailptr = (sdl_monitor_info ***)data; sdl_monitor_info *monitor; MONITORINFOEX info; BOOL result; // get the monitor info info.cbSize = sizeof(info); result = GetMonitorInfo(handle, (LPMONITORINFO)&info); assert(result); (void)result; // to silence gcc 4.6 // allocate a new monitor info monitor = global_alloc_clear(sdl_monitor_info); // copy in the data #ifdef PTR64 monitor->handle = (UINT64)handle; #else monitor->handle = (UINT32)handle; #endif monitor->monitor_width = info.rcMonitor.right - info.rcMonitor.left; monitor->monitor_height = info.rcMonitor.bottom - info.rcMonitor.top; monitor->center_width = monitor->monitor_width; monitor->center_height = monitor->monitor_height; char *temp = utf8_from_wstring(info.szDevice); strcpy(monitor->monitor_device, temp); osd_free(temp); // guess the aspect ratio assuming square pixels monitor->aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top); // save the primary monitor handle if (info.dwFlags & MONITORINFOF_PRIMARY) primary_monitor = monitor; // hook us into the list **tailptr = monitor; *tailptr = &monitor->next; // enumerate all the available monitors so to list their names in verbose mode return TRUE; }
void sdl_monitor_info::init() { osd_monitor_info **tailptr; // make a list of monitors osd_monitor_info::list = NULL; tailptr = &osd_monitor_info::list; #if (SDLMAME_SDL2) { int i; osd_printf_verbose("Enter init_monitors\n"); for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { sdl_monitor_info *monitor; char temp[64]; snprintf(temp, sizeof(temp)-1, "%s%d", OSDOPTION_SCREEN,i); // allocate a new monitor info monitor = global_alloc_clear(sdl_monitor_info(i, temp, 1.0f)); osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->devicename(), monitor->position_size().width(), monitor->position_size().height()); // guess the aspect ratio assuming square pixels monitor->set_aspect((float)(monitor->position_size().width()) / (float)(monitor->position_size().height())); // hook us into the list *tailptr = monitor; tailptr = &monitor->m_next; } } osd_printf_verbose("Leave init_monitors\n"); #elif defined(SDLMAME_WIN32) EnumDisplayMonitors(NULL, NULL, monitor_enum_callback, (LPARAM)&tailptr); #else add_primary_monitor((void *)&tailptr); #endif }
static int drawdd_window_init(win_window_info *window) { dd_info *dd; // allocate memory for our structures dd = global_alloc_clear(dd_info); window->drawdata = dd; // configure the adapter for the mode we want if (config_adapter_mode(window)) goto error; // create the ddraw object if (ddraw_create(window)) goto error; return 0; error: drawdd_window_destroy(window); mame_printf_error("Unable to initialize DirectDraw.\n"); return 1; }
static void add_primary_monitor(void *data) { sdl_monitor_info ***tailptr = (sdl_monitor_info ***)data; sdl_monitor_info *monitor; // allocate a new monitor info monitor = global_alloc_clear(sdl_monitor_info); // copy in the data monitor->handle = 1; sdlvideo_monitor_refresh(monitor); // guess the aspect ratio assuming square pixels monitor->aspect = (float)(monitor->monitor_width) / (float)(monitor->monitor_height); // save the primary monitor handle primary_monitor = monitor; // hook us into the list **tailptr = monitor; *tailptr = &monitor->next; }
namco_06xx_device::namco_06xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NAMCO_06XX, "Namco 06xx", tag, owner, clock, "namco06xx", __FILE__) { m_token = global_alloc_clear(namco_06xx_state); }
ymf262_device::ymf262_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, YMF262, "YMF262", tag, owner, clock), device_sound_interface(mconfig, *this) { m_token = global_alloc_clear(ymf262_state); }
beep_device::beep_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, BEEP, "Beep", tag, owner, clock), device_sound_interface(mconfig, *this) { m_token = global_alloc_clear(beep_state); }
nmk112_device::nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NMK112, "NMK 112", tag, owner, clock) { m_token = global_alloc_clear(nmk112_state); }
void legacy_image_device_config_base::device_config_complete() { const device_config_image_interface *image = NULL; int count = 0; int index = -1; image_device_format **formatptr; image_device_format *format; formatptr = &m_formatlist; int cnt = 0; m_type = static_cast<iodevice_t>(get_legacy_config_int(DEVINFO_INT_IMAGE_TYPE)); m_readable = get_legacy_config_int(DEVINFO_INT_IMAGE_READABLE)!=0; m_writeable = get_legacy_config_int(DEVINFO_INT_IMAGE_WRITEABLE)!=0; m_creatable = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATABLE)!=0; m_must_be_loaded = get_legacy_config_int(DEVINFO_INT_IMAGE_MUST_BE_LOADED)!=0; m_reset_on_load = get_legacy_config_int(DEVINFO_INT_IMAGE_RESET_ON_LOAD)!=0; m_has_partial_hash = get_legacy_config_int(DEVINFO_FCT_IMAGE_PARTIAL_HASH)!=0; m_interface_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INTERFACE); m_file_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_FILE_EXTENSIONS); m_create_option_guide = reinterpret_cast<const option_guide *>(get_legacy_config_ptr(DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE)); int format_count = get_legacy_config_int(DEVINFO_INT_IMAGE_CREATE_OPTCOUNT); for (int i = 0; i < format_count; i++) { // only add if creatable if (get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) { // allocate a new format format = global_alloc_clear(image_device_format); // populate it format->m_index = cnt; format->m_name = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTNAME + i); format->m_description = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTDESC + i); format->m_extensions = get_legacy_config_string(DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i); format->m_optspec = get_legacy_config_string(DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i); // and append it to the list *formatptr = format; formatptr = &format->m_next; cnt++; } } for (bool gotone = device_config::m_machine_config.m_devicelist.first(image); gotone; gotone = image->next(image)) { if (this == image) index = count; if (image->image_type_direct() == m_type) count++; } if (count > 1) { m_instance_name.printf("%s%d", device_typename(m_type), index + 1); m_brief_instance_name.printf("%s%d", device_brieftypename(m_type), index + 1); } else { m_instance_name = device_typename(m_type); m_brief_instance_name = device_brieftypename(m_type); } // Override in case of hardcoded values if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME))>0) { m_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_INSTANCE_NAME); } if (strlen(get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME))>0) { m_brief_instance_name = get_legacy_config_string(DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME); } }
int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config) { sdl_window_info *window; worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param)); int result; ASSERT_MAIN_THREAD(); clear_worker_param(wp); // allocate a new window object window = global_alloc_clear(sdl_window_info); window->maxwidth = config->width; window->maxheight = config->height; window->depth = config->depth; window->refresh = config->refresh; window->monitor = monitor; window->m_machine = &machine; window->index = index; //FIXME: these should be per_window in config-> or even better a bit set window->fullscreen = !video_config.windowed; window->prescale = video_config.prescale; // set the initial maximized state // FIXME: Does not belong here sdl_options &options = downcast<sdl_options &>(machine.options()); window->startmaximized = options.maximize(); if (!window->fullscreen) { window->windowed_width = config->width; window->windowed_height = config->height; } window->totalColors = config->totalColors; // add us to the list *last_window_ptr = window; last_window_ptr = &window->next; draw.attach(&draw, window); // create an event that we can use to skip blitting window->rendered_event = osd_event_alloc(FALSE, TRUE); // load the layout window->target = machine.render().target_alloc(); // set the specific view set_starting_view(machine, index, window, options.view(), options.view(index)); // make the window title if (video_config.numscreens == 1) sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name); else sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index); wp->window = window; if (multithreading_enabled) { osd_work_item *wi; wi = osd_work_item_queue(work_queue, &complete_create_wt, (void *) wp, 0); sdlwindow_sync(); result = *((int *) (osd_work_item_result)(wi)); osd_work_item_release(wi); } else result = *((int *) complete_create_wt((void *) wp, 0)); // handle error conditions if (result == 1) goto error; return 0; error: sdlwindow_video_window_destroy(machine, window); return 1; }
beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock) { m_token = global_alloc_clear(beta_disk_state); }
s3c2440_device::s3c2440_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, S3C2440, "Samsung S3C2440", tag, owner, clock, "s3c2440", __FILE__), m_palette(*this) { m_token = global_alloc_clear(s3c24xx_t); }
crt_device::crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, CRT, "CRT Video", tag, owner, clock) { m_token = global_alloc_clear(crt_t); }
timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, TIMEPLT_AUDIO, "Time Pilot Audio", tag, owner, clock), device_sound_interface(mconfig, *this) { m_token = global_alloc_clear(timeplt_audio_state); }