static void print_game_sample(FILE* out, const game_driver* game) { #if (HAS_SAMPLES) machine_config drv; int i; expand_machine_driver(game->drv, &drv); for( i = 0; drv.sound[i].sound_type && i < MAX_SOUND; i++ ) { const char **samplenames = NULL; if( drv.sound[i].sound_type == SOUND_SAMPLES ) samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames; if (samplenames != 0 && samplenames[0] != 0) { int k = 0; if (samplenames[k][0]=='*') { ++k; } while (samplenames[k] != 0) { /* check if is not empty */ if (*samplenames[k]) { /* check if sample is duplicate */ int l = 0; while (l<k && strcmp(samplenames[k],samplenames[l])!=0) ++l; if (l==k) fprintf(out, "\t\t<sample name=\"%s\"/>\n", normalize_string(samplenames[k])); } ++k; } } } #endif }
BOOL DriverUsesSamples(int driver_index) { #if (HAS_SAMPLES == 1) || (HAS_VLM5030 == 1) int i; struct InternalMachineDriver drv; expand_machine_driver(drivers[driver_index]->drv,&drv); for (i = 0; drv.sound[i].sound_type && i < MAX_SOUND; i++) { const char **samplenames = NULL; #if (HAS_SAMPLES == 1) if (drv.sound[i].sound_type == SOUND_SAMPLES) samplenames = ((struct Samplesinterface *)drv.sound[i].sound_interface)->samplenames; #endif /* #if (HAS_VLM5030 == 1) if (drv.sound[i].sound_type == SOUND_VLM5030) samplenames = ((struct VLM5030interface *)drv.sound[i].sound_interface)->samplenames; #endif */ if (samplenames != 0 && samplenames[0] != 0) return TRUE; } #endif return FALSE; }
static void print_game_sampleof(FILE* out, const game_driver* game) { #if (HAS_SAMPLES) machine_config drv; int i; expand_machine_driver(game->drv, &drv); for( i = 0; drv.sound[i].sound_type && i < MAX_SOUND; i++ ) { const char **samplenames = NULL; if( drv.sound[i].sound_type == SOUND_SAMPLES ) samplenames = ((struct Samplesinterface *)drv.sound[i].config)->samplenames; if (samplenames != 0 && samplenames[0] != 0) { int k = 0; if (samplenames[k][0]=='*') { /* output sampleof only if different from game name */ if (strcmp(samplenames[k] + 1, game->name)!=0) fprintf(out, " sampleof=\"%s\"", normalize_string(samplenames[k] + 1)); ++k; } } } #endif }
void CreateSoundFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int nFolder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; LPTREEFOLDER map[SOUND_COUNT]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (i=1;i<SOUND_COUNT;i++) { // Defined in sndintrf.c struct snd_interface { unsigned sound_num; /* ID */ const char *name; /* description */ int (*chips_num)(const struct MachineSound *msound); /* returns number of chips if applicable */ int (*chips_clock)(const struct MachineSound *msound); /* returns chips clock if applicable */ int (*start)(const struct MachineSound *msound); /* starts sound emulation */ void (*stop)(void); /* stops sound emulation */ void (*update)(void); /* updates emulation once per frame if necessary */ void (*reset)(void); /* resets sound emulation */ }; extern struct snd_interface sndintf[]; LPTREEFOLDER lpTemp; for (jj = 1; jj < i; jj++) if (!strcmp(soundtype_name(i), soundtype_name(jj))) break; if (i != jj) { map[i] = map[jj]; continue; } lpTemp = NewFolder(sndintf[i].name, next_folder_id++, parent_index, IDI_CPU, GetFolderFlags(numFolders)); AddFolder(lpTemp); map[i] = treeFolders[nFolder++]; } for (jj = 0; jj < nGames; jj++) { int n; struct InternalMachineDriver drv; expand_machine_driver(drivers[jj]->drv,&drv); for (n = 0; n < MAX_SOUND; n++) if (drv.sound[n].sound_type != SOUND_DUMMY) { // sound type #'s are one-based AddGame(map[drv.sound[n].sound_type],jj); } } }
static running_machine *create_machine(int game) { running_machine *machine; int scrnum; /* allocate memory for the machine */ machine = malloc(sizeof(*machine)); if (machine == NULL) goto error; memset(machine, 0, sizeof(*machine)); /* allocate memory for the internal mame_data */ machine->mame_data = malloc(sizeof(*machine->mame_data)); if (machine->mame_data == NULL) goto error; memset(machine->mame_data, 0, sizeof(*machine->mame_data)); /* initialize the driver-related variables in the machine */ machine->gamedrv = drivers[game]; machine->drv = malloc(sizeof(*machine->drv)); if (machine->drv == NULL) goto error; machine->basename = mame_strdup(machine->gamedrv->name); expand_machine_driver(machine->gamedrv->drv, (machine_config *)machine->drv); /* allocate the driver data */ if (machine->drv->driver_data_size != 0) { machine->driver_data = malloc(machine->drv->driver_data_size); if (machine->driver_data == NULL) goto error; memset(machine->driver_data, 0, machine->drv->driver_data_size); } /* configure all screens to be the default */ for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) machine->screen[scrnum] = machine->drv->screen[scrnum].defstate; /* convert some options into live state */ machine->sample_rate = options.samplerate; machine->record_file = options.record; machine->playback_file = options.playback; machine->debug_mode = options.mame_debug; return machine; error: if (machine->driver_data != NULL) free(machine->driver_data); if (machine->drv != NULL) free((machine_config *)machine->drv); if (machine->mame_data != NULL) free(machine->mame_data); if (machine != NULL) free(machine); return NULL; }
void CreateCPUFolders(int parent_index) { int i,jj; int nGames = GetNumGames(); int nFolder = numFolders; LPTREEFOLDER lpFolder = treeFolders[parent_index]; LPTREEFOLDER map[CPU_COUNT]; // no games in top level folder SetAllBits(lpFolder->m_lpGameBits,FALSE); for (i=1;i<CPU_COUNT;i++) { LPTREEFOLDER lpTemp; for (jj = 1; jj < i; jj++) if (!strcmp(cputype_name(i), cputype_name(jj))) break; if (i != jj) { map[i] = map[jj]; continue; } lpTemp = NewFolder(cputype_name(i), next_folder_id++, parent_index, IDI_CPU, GetFolderFlags(numFolders)); AddFolder(lpTemp); map[i] = treeFolders[nFolder++]; } for (jj = 0; jj < nGames; jj++) { int n; struct InternalMachineDriver drv; expand_machine_driver(drivers[jj]->drv,&drv); for (n = 0; n < MAX_CPU; n++) if (drv.cpu[n].cpu_type != CPU_DUMMY) { // cpu type #'s are one-based AddGame(map[drv.cpu[n].cpu_type],jj); } } }
static void print_game_sound(FILE* out, const game_driver* game) { machine_config driver; const cpu_config* cpu; const sound_config* sound; /* check if the game have sound emulation */ int has_sound = 0; int i; expand_machine_driver(game->drv, &driver); cpu = driver.cpu; sound = driver.sound; i = 0; while (i < MAX_SOUND && !has_sound) { if (sound[i].sound_type) has_sound = 1; ++i; } fprintf(out, "\t\t<sound"); /* sound channel */ if (has_sound) { int speakers; for (speakers = 0; speakers < MAX_SPEAKER; speakers++) if (driver.speaker[speakers].tag == NULL) break; fprintf(out, " channels=\"%d\"", speakers); } else fprintf(out, " channels=\"0\""); fprintf(out, "/>\n"); }
static void print_game_micro(FILE* out, const game_driver* game) { machine_config driver; const cpu_config* cpu; const sound_config* sound; int j; expand_machine_driver(game->drv, &driver); cpu = driver.cpu; sound = driver.sound; for(j=0;j<MAX_CPU;++j) { if (cpu[j].cpu_type!=0) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"cpu\""); fprintf(out, " name=\"%s\"", normalize_string(cputype_name(cpu[j].cpu_type))); fprintf(out, " clock=\"%d\"", cpu[j].cpu_clock); fprintf(out, "/>\n"); } } for(j=0;j<MAX_SOUND;++j) if (sound[j].sound_type) { if (sound[j].sound_type) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"audio\""); fprintf(out, " name=\"%s\"", normalize_string(sndtype_name(sound[j].sound_type))); if (sound[j].clock) fprintf(out, " clock=\"%d\"", sound[j].clock); fprintf(out, "/>\n"); } } }
static void create_machine(int game) { /* first give the machine a good cleaning */ Machine = &active_machine; memset(Machine, 0, sizeof(*Machine)); /* initialize the driver-related variables in the Machine */ Machine->gamedrv = drivers[game]; Machine->drv = &internal_drv; expand_machine_driver(Machine->gamedrv->drv, &internal_drv); Machine->refresh_rate = Machine->drv->frames_per_second; /* copy some settings into easier-to-handle variables */ Machine->record_file = options.record; Machine->playback_file = options.playback; Machine->debug_mode = options.mame_debug; /* determine the color depth */ Machine->color_depth = 16; if (Machine->drv->video_attributes & VIDEO_RGB_DIRECT) Machine->color_depth = (Machine->drv->video_attributes & VIDEO_NEEDS_6BITS_PER_GUN) ? 32 : 15; /* update the vector width/height with defaults */ if (options.vector_width == 0) options.vector_width = 640; if (options.vector_height == 0) options.vector_height = 480; /* initialize the samplerate */ Machine->sample_rate = options.samplerate; /* get orientation right */ Machine->ui_orientation = options.ui_orientation; /* add an exit callback to clear out the Machine on the way out */ add_exit_callback(destroy_machine); }
int audit_samples(int game, audit_record **audit) { const game_driver *gamedrv = drivers[game]; machine_config config; audit_record *record; int sndnum, sampnum; int records = 0; /* count the number of sample records attached to this driver */ expand_machine_driver(gamedrv->drv, &config); #if HAS_SAMPLES for (sndnum = 0; sndnum < ARRAY_LENGTH(config.sound); sndnum++) if (config.sound[sndnum].sound_type == SOUND_SAMPLES) { struct Samplesinterface *intf = (struct Samplesinterface *)config.sound[sndnum].config; if (intf->samplenames == NULL) continue; /* iterate over samples in this entry */ for (sampnum = 0; intf->samplenames[sampnum] != NULL; sampnum++) if (intf->samplenames[sampnum][0] != '*') records++; } #endif /* if no records, just quit now */ if (records == 0) return records; /* allocate memory for the records */ *audit = malloc_or_die(sizeof(**audit) * records); memset(*audit, 0, sizeof(**audit) * records); record = *audit; /* now iterate over sample entries */ for (sndnum = 0; sndnum < ARRAY_LENGTH(config.sound); sndnum++) if (config.sound[sndnum].sound_type == SOUND_SAMPLES) { struct Samplesinterface *intf = (struct Samplesinterface *)config.sound[sndnum].config; const char *sharedname = NULL; /* iterate over samples in this entry */ for (sampnum = 0; intf->samplenames[sampnum] != NULL; sampnum++) if (intf->samplenames[sampnum][0] == '*') sharedname = &intf->samplenames[sampnum][1]; else { mame_file_error filerr; mame_file *file; char *fname; /* attempt to access the file from the game driver name */ fname = assemble_3_strings(gamedrv->name, PATH_SEPARATOR, intf->samplenames[sampnum]); filerr = mame_fopen(SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ, &file); free(fname); /* attempt to access the file from the shared driver name */ if (filerr != FILERR_NONE && sharedname != NULL) { fname = assemble_3_strings(sharedname, PATH_SEPARATOR, intf->samplenames[sampnum]); filerr = mame_fopen(SEARCHPATH_SAMPLE, fname, OPEN_FLAG_READ, &file); free(fname); } /* fill in the record */ record->type = AUDIT_FILE_SAMPLE; record->name = intf->samplenames[sampnum]; if (filerr == FILERR_NONE) { set_status(record, AUDIT_STATUS_GOOD, SUBSTATUS_GOOD); mame_fclose(file); } else set_status(record, AUDIT_STATUS_NOT_FOUND, SUBSTATUS_NOT_FOUND); } } return records; }
/* Builds a list of every missing sample. Returns total number of missing samples, or -1 if no samples were found. Sets audit to point to the list of missing samples. */ int audit_samples (int game, missing_sample **audit) { machine_config drv; int skipfirst; mame_file *f; const char **samplenames, *sharedname; int exist; static const game_driver *gamedrv; int j; int count = 0; missing_sample *aud; gamedrv = drivers[game]; expand_machine_driver(gamedrv->drv, &drv); samplenames = NULL; #if (HAS_SAMPLES || HAS_VLM5030) for( j = 0; drv.sound[j].sound_type && j < MAX_SOUND; j++ ) { #if (HAS_SAMPLES) if( drv.sound[j].sound_type == SOUND_SAMPLES ) samplenames = ((struct Samplesinterface *)drv.sound[j].config)->samplenames; #endif } #endif /* does the game use samples at all? */ if (samplenames == 0 || samplenames[0] == 0) return 0; /* take care of shared samples */ if (samplenames[0][0] == '*') { sharedname=samplenames[0]+1; skipfirst = 1; } else { sharedname = NULL; skipfirst = 0; } /* do we have samples for this game? */ exist = mame_faccess (gamedrv->name, FILETYPE_SAMPLE); /* try shared samples */ if (!exist && skipfirst) exist = mame_faccess (sharedname, FILETYPE_SAMPLE); /* if still not found, we're done */ if (!exist) return -1; /* allocate missing samples list (if necessary) */ if (!missing_samples) missing_samples = (missing_sample *)malloc (AUD_MAX_SAMPLES * sizeof (missing_sample)); if (missing_samples) *audit = aud = missing_samples; else return 0; for (j = skipfirst; samplenames[j] != 0; j++) { /* skip empty definitions */ if (strlen (samplenames[j]) == 0) continue; f = mame_fopen (gamedrv->name, samplenames[j], FILETYPE_SAMPLE, 0); if (f == NULL && skipfirst) f = mame_fopen (sharedname, samplenames[j], FILETYPE_SAMPLE, 0); if (f) mame_fclose(f); else { strcpy (aud->name, samplenames[j]); count++; aud++; } } return count; }
BOOL DriverIsVector(int driver_index) { struct InternalMachineDriver drv; expand_machine_driver(drivers[driver_index]->drv, &drv); return (drv.video_attributes & VIDEO_TYPE_VECTOR) != 0; }
static void print_game_video(FILE* out, const game_driver* game) { machine_config driver; int dx; int dy; int ax; int ay; int showxy; int orientation; expand_machine_driver(game->drv, &driver); fprintf(out, "\t\t<video"); if (driver.video_attributes & VIDEO_TYPE_VECTOR) { fprintf(out, " screen=\"vector\""); showxy = 0; } else { fprintf(out, " screen=\"raster\""); showxy = 1; } if (game->flags & ORIENTATION_SWAP_XY) { ax = driver.aspect_y; ay = driver.aspect_x; if (ax == 0 && ay == 0) { ax = 3; ay = 4; } dx = driver.default_visible_area.max_y - driver.default_visible_area.min_y + 1; dy = driver.default_visible_area.max_x - driver.default_visible_area.min_x + 1; orientation = 1; } else { ax = driver.aspect_x; ay = driver.aspect_y; if (ax == 0 && ay == 0) { ax = 4; ay = 3; } dx = driver.default_visible_area.max_x - driver.default_visible_area.min_x + 1; dy = driver.default_visible_area.max_y - driver.default_visible_area.min_y + 1; orientation = 0; } fprintf(out, " orientation=\"%s\"", orientation ? "vertical" : "horizontal" ); if (showxy) { fprintf(out, " width=\"%d\"", dx); fprintf(out, " height=\"%d\"", dy); } fprintf(out, " aspectx=\"%d\"", ax); fprintf(out, " aspecty=\"%d\"", ay); fprintf(out, " refresh=\"%f\"", driver.frames_per_second); fprintf(out, "/>\n"); }
BOOL DriverIsMultiMon(int driver_index) { struct InternalMachineDriver drv; expand_machine_driver(drivers[driver_index]->drv, &drv); return (drv.video_attributes & VIDEO_DUAL_MONITOR) != 0; }
BOOL DriverIsStereo(int driver_index) { struct InternalMachineDriver drv; expand_machine_driver(drivers[driver_index]->drv, &drv); return (drv.sound_attributes & SOUND_SUPPORTS_STEREO) != 0; }
int cli_frontend_init (int argc, char **argv) { machine_config drv; char buffer[128]; char *cmd_name; int game_index; int i; gamename = NULL; game_index = -1; /* clear all core options */ memset(&options,0,sizeof(options)); /* create the rc object */ rc = cli_rc_create(); if (!rc) { osd_die ("error on rc creation\n"); } /* parse the commandline */ got_gamename = 0; if (rc_parse_commandline(rc, argc, argv, 2, config_handle_arg)) { osd_die ("error while parsing cmdline\n"); } /* determine global configfile name */ cmd_name = win_strip_extension(win_basename(argv[0])); if (!cmd_name) { osd_die ("who am I? cannot determine the name I was called with\n"); } sprintf (buffer, "%s.ini", cmd_name); /* parse mame.ini/mess.ini even if called with another name */ if (mame_stricmp(cmd_name, APPNAME) != 0) { if (parse_config (APPNAME".ini", NULL)) exit(1); } /* parse cmd_name.ini */ if (parse_config (buffer, NULL)) exit(1); #ifdef MAME_DEBUG if (parse_config( "debug.ini", NULL)) exit(1); #endif /* if requested, write out cmd_name.ini (normally "mame.ini") */ if (createconfig) { rc_save(rc, buffer, 0); exit(0); } if (showconfig) { sprintf (buffer, " %s running parameters", cmd_name); rc_write(rc, stdout, buffer); exit(0); } if (showusage) { fprintf(stdout, "Usage: %s [" GAMENOUN "] [options]\n" "Options:\n", cmd_name); /* actual help message */ rc_print_help(rc, stdout); exit(0); } /* no longer needed */ free(cmd_name); /* handle playback */ if (playbackname != NULL) { options.playback = mame_fopen(playbackname,0,FILETYPE_INPUTLOG,0); if (!options.playback) { osd_die("failed to open %s for playback\n", playbackname); } } /* check for game name embedded in .inp header */ if (options.playback) { inp_header inp_header; /* read playback header */ mame_fread(options.playback, &inp_header, sizeof(inp_header)); if (!isalnum(inp_header.name[0])) /* If first byte is not alpha-numeric */ mame_fseek(options.playback, 0, SEEK_SET); /* old .inp file - no header */ else { for (i = 0; (drivers[i] != 0); i++) /* find game and play it */ { if (strcmp(drivers[i]->name, inp_header.name) == 0) { game_index = i; gamename = (char *)drivers[i]->name; printf("Playing back previously recorded " GAMENOUN " %s (%s) [press return]\n", drivers[game_index]->name,drivers[game_index]->description); getchar(); break; } } } } /* check for frontend options, horrible 1234 hack */ if (frontend_help(gamename) != 1234) exit(0); gamename = win_basename(gamename); gamename = win_strip_extension(gamename); /* if not given by .inp file yet */ if (game_index == -1) { /* do we have a driver for this? */ for (i = 0; drivers[i]; i++) if (mame_stricmp(gamename,drivers[i]->name) == 0) { game_index = i; break; } } #ifdef MAME_DEBUG if (game_index == -1) { /* pick a random game */ if (strcmp(gamename,"random") == 0) { i = 0; while (drivers[i]) i++; /* count available drivers */ srand(time(0)); /* call rand() once to get away from the seed */ rand(); game_index = rand() % i; fprintf(stderr, "running %s (%s) [press return]",drivers[game_index]->name,drivers[game_index]->description); getchar(); } } #endif /* we give up. print a few approximate matches */ if (game_index == -1) { fprintf(stderr, "\n\"%s\" approximately matches the following\n" "supported " GAMESNOUN " (best match first):\n\n", gamename); show_approx_matches(); exit(1); } /* ok, got a gamename */ /* if this is a vector game, parse vector.ini first */ expand_machine_driver(drivers[game_index]->drv, &drv); if (drv.video_attributes & VIDEO_TYPE_VECTOR) if (parse_config ("vector.ini", NULL)) exit(1); /* nice hack: load source_file.ini (omit if referenced later any) */ { const game_driver *tmp_gd; const char *start; /* remove the path and the .c suffix from the source file name */ start = strrchr(drivers[game_index]->source_file, '/'); if (!start) start = strrchr(drivers[game_index]->source_file, '\\'); if (!start) start = drivers[game_index]->source_file - 1; sprintf(buffer, "%s", start + 1); buffer[strlen(buffer) - 2] = 0; tmp_gd = drivers[game_index]; while (tmp_gd != NULL) { if (strcmp(tmp_gd->name, buffer) == 0) break; tmp_gd = tmp_gd->clone_of; } if (tmp_gd == NULL) /* not referenced later, so load it here */ { strcat(buffer, ".ini"); if (parse_config (buffer, NULL)) exit(1); } } /* now load gamename.ini */ /* this possibly checks for clonename.ini recursively! */ if (parse_config (NULL, drivers[game_index])) exit(1); /* handle record option */ if (recordname) { options.record = mame_fopen(recordname,0,FILETYPE_INPUTLOG,1); if (!options.record) { osd_die("failed to open %s for recording\n", recordname); } } if (options.record) { inp_header inp_header; memset(&inp_header, '\0', sizeof(inp_header)); strcpy(inp_header.name, drivers[game_index]->name); /* MAME32 stores the MAME version numbers at bytes 9 - 11 * MAME DOS keeps this information in a string, the * Windows code defines them in the Makefile. */ /* inp_header.version[0] = 0; inp_header.version[1] = VERSION; inp_header.version[2] = BETA_VERSION; */ mame_fwrite(options.record, &inp_header, sizeof(inp_header)); } if (statename) options.savegame = statename; #if defined(MAME_DEBUG) && defined(NEW_DEBUGGER) if (debugscript) debug_source_script(debugscript); #endif /* need a decent default for debug width/height */ if (options.debug_width == 0) options.debug_width = 640; if (options.debug_height == 0) options.debug_height = 480; options.debug_depth = 8; /* no sound is indicated by a 0 samplerate */ if (!enable_sound) options.samplerate = 0; /* set the artwork options */ options.use_artwork = ARTWORK_USE_ALL; if (use_backdrops == 0) options.use_artwork &= ~ARTWORK_USE_BACKDROPS; if (use_overlays == 0) options.use_artwork &= ~ARTWORK_USE_OVERLAYS; if (use_bezels == 0) options.use_artwork &= ~ARTWORK_USE_BEZELS; if (!use_artwork) options.use_artwork = ARTWORK_USE_NONE; { /* first start with the game's built in orientation */ int orientation = drivers[game_index]->flags & ORIENTATION_MASK; options.ui_orientation = orientation; if (options.ui_orientation & ORIENTATION_SWAP_XY) { /* if only one of the components is inverted, switch them */ if ((options.ui_orientation & ROT180) == ORIENTATION_FLIP_X || (options.ui_orientation & ROT180) == ORIENTATION_FLIP_Y) options.ui_orientation ^= ROT180; } /* override if no rotation requested */ if (video_norotate) orientation = options.ui_orientation = ROT0; /* rotate right */ if (video_ror) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT90; } /* rotate left */ if (video_rol) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT270; } /* auto-rotate right (e.g. for rotating lcds), based on original orientation */ if (video_autoror && (drivers[game_index]->flags & ORIENTATION_SWAP_XY) ) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT90; } /* auto-rotate left (e.g. for rotating lcds), based on original orientation */ if (video_autorol && (drivers[game_index]->flags & ORIENTATION_SWAP_XY) ) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT270; } /* flip X/Y */ if (video_flipx) orientation ^= ORIENTATION_FLIP_X; if (video_flipy) orientation ^= ORIENTATION_FLIP_Y; blit_flipx = ((orientation & ORIENTATION_FLIP_X) != 0); blit_flipy = ((orientation & ORIENTATION_FLIP_Y) != 0); blit_swapxy = ((orientation & ORIENTATION_SWAP_XY) != 0); if( options.vector_width == 0 && options.vector_height == 0 ) { options.vector_width = 640; options.vector_height = 480; } if( blit_swapxy ) { int temp; temp = options.vector_width; options.vector_width = options.vector_height; options.vector_height = temp; } } return game_index; }
static void print_game_driver(FILE* out, const game_driver* game) { machine_config driver; expand_machine_driver(game->drv, &driver); fprintf(out, "\t\t<driver"); /* The status entry is an hint for frontend authors */ /* to select working and not working games without */ /* the need to know all the other status entries. */ /* Games marked as status=good are perfectly emulated, games */ /* marked as status=imperfect are emulated with only */ /* some minor issues, games marked as status=preliminary */ /* don't work or have major emulation problems. */ if (game->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_WRONG_COLORS)) fprintf(out, " status=\"preliminary\""); else if (game->flags & (GAME_IMPERFECT_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS)) fprintf(out, " status=\"imperfect\""); else fprintf(out, " status=\"good\""); if (game->flags & GAME_NOT_WORKING) fprintf(out, " emulation=\"preliminary\""); else fprintf(out, " emulation=\"good\""); if (game->flags & GAME_WRONG_COLORS) fprintf(out, " color=\"preliminary\""); else if (game->flags & GAME_IMPERFECT_COLORS) fprintf(out, " color=\"imperfect\""); else fprintf(out, " color=\"good\""); if (game->flags & GAME_NO_SOUND) fprintf(out, " sound=\"preliminary\""); else if (game->flags & GAME_IMPERFECT_SOUND) fprintf(out, " sound=\"imperfect\""); else fprintf(out, " sound=\"good\""); if (game->flags & GAME_IMPERFECT_GRAPHICS) fprintf(out, " graphic=\"imperfect\""); else fprintf(out, " graphic=\"good\""); if (game->flags & GAME_NO_COCKTAIL) fprintf(out, " cocktail=\"preliminary\""); if (game->flags & GAME_UNEMULATED_PROTECTION) fprintf(out, " protection=\"preliminary\""); if (game->flags & GAME_SUPPORTS_SAVE) fprintf(out, " savestate=\"supported\""); else fprintf(out, " savestate=\"unsupported\""); fprintf(out, " palettesize=\"%d\"", driver.total_colors); fprintf(out, "/>\n"); }
int mess_validitychecks(void) { int i, j; int error = 0; iodevice_t devtype; struct IODevice *devices; const char *name; input_port_entry *inputports = NULL; extern int device_valididtychecks(void); extern const char *mess_default_text[]; struct SystemConfigurationParamBlock cfg; device_getinfo_handler handlers[64]; int count_overrides[sizeof(handlers) / sizeof(handlers[0])]; device_class devclass; /* make sure that all of the UI_* strings are set for all devices */ for (devtype = 0; devtype < IO_COUNT; devtype++) { name = mess_default_text[UI_cartridge - IO_CARTSLOT - UI_last_mame_entry + devtype]; if (!name || !name[0]) { printf("Device type %d does not have an associated UI string\n", devtype); error = 1; } } /* MESS specific driver validity checks */ for (i = 0; drivers[i]; i++) { devices = devices_allocate(drivers[i]); /* make sure that there are no clones that reference nonexistant drivers */ if (driver_get_clone(drivers[i])) { if (drivers[i]->compatible_with && !(drivers[i]->compatible_with->flags & NOT_A_DRIVER)) { printf("%s: both compatbile_with and clone_of are specified\n", drivers[i]->name); error = 1; } for (j = 0; drivers[j]; j++) { if (driver_get_clone(drivers[i]) == drivers[j]) break; } if (!drivers[j]) { printf("%s: is a clone of %s, which is not in drivers[]\n", drivers[i]->name, driver_get_clone(drivers[i])->name); error = 1; } } /* make sure that there are no clones that reference nonexistant drivers */ if (drivers[i]->compatible_with && !(drivers[i]->compatible_with->flags & NOT_A_DRIVER)) { for (j = 0; drivers[j]; j++) { if (drivers[i]->compatible_with == drivers[j]) break; } if (!drivers[j]) { printf("%s: is compatible with %s, which is not in drivers[]\n", drivers[i]->name, drivers[i]->compatible_with->name); error = 1; } } /* check devices */ if (drivers[i]->sysconfig_ctor) { memset(&cfg, 0, sizeof(cfg)); memset(handlers, 0, sizeof(handlers)); cfg.device_slotcount = sizeof(handlers) / sizeof(handlers[0]); cfg.device_handlers = handlers; cfg.device_countoverrides = count_overrides; drivers[i]->sysconfig_ctor(&cfg); for (j = 0; handlers[j]; j++) { devclass.gamedrv = drivers[i]; devclass.get_info = handlers[j]; if (validate_device(&devclass)) error = 1; } } /* check system config */ ram_option_count(drivers[i]); /* make sure that our input system likes this driver */ if (inputx_validitycheck(drivers[i], &inputports)) error = 1; devices = NULL; } /* call other validity checks */ if (inputx_validitycheck(NULL, &inputports)) error = 1; if (device_valididtychecks()) error = 1; /* now that we are completed, re-expand the actual driver to compensate * for the tms9928a hack */ if (Machine && Machine->gamedrv) { machine_config drv; expand_machine_driver(Machine->gamedrv->drv, &drv); } return error; }