mirror of
https://github.com/holub/mame
synced 2025-05-18 03:35:03 +03:00
> -----Original Message-----
> From: Atari Ace [mailto:atari_ace@verizon.net] > Sent: Monday, August 03, 2009 10:52 PM > To: submit@mamedev.org > Cc: atariace@hotmail.com > Subject: [patch] De-globalize romload.c/validity.c > > Hi mamedev, > > Static and global variables in the core of MAME have slowly been > replaced with opaque structures latched onto the running machine. This > patch extends this idiom to two more files, romload.c and validity.c. > validity.c in fact didn't need any global state (it was used only to > pass data between function calls), and romload.c already had a struct > that largely served that purpose. > > ~aa
This commit is contained in:
parent
259fb90602
commit
40cc74b98f
@ -1801,7 +1801,7 @@ static DEVICE_START( ide_controller )
|
|||||||
|
|
||||||
/* set MAME harddisk handle */
|
/* set MAME harddisk handle */
|
||||||
config = (const ide_config *)device->inline_config;
|
config = (const ide_config *)device->inline_config;
|
||||||
ide->handle = get_disk_handle((config->master != NULL) ? config->master : device->tag);
|
ide->handle = get_disk_handle(device->machine, (config->master != NULL) ? config->master : device->tag);
|
||||||
ide->disk = hard_disk_open(ide->handle);
|
ide->disk = hard_disk_open(ide->handle);
|
||||||
assert_always(config->slave == NULL, "IDE controller does not yet support slave drives\n");
|
assert_always(config->slave == NULL, "IDE controller does not yet support slave drives\n");
|
||||||
|
|
||||||
|
@ -1327,7 +1327,7 @@ static void init_disc(const device_config *device)
|
|||||||
if (config->getdisc != NULL)
|
if (config->getdisc != NULL)
|
||||||
ldcore->disc = (*config->getdisc)(device);
|
ldcore->disc = (*config->getdisc)(device);
|
||||||
else
|
else
|
||||||
ldcore->disc = get_disk_handle(device->tag);
|
ldcore->disc = get_disk_handle(device->machine, device->tag);
|
||||||
|
|
||||||
/* set default parameters */
|
/* set default parameters */
|
||||||
ldcore->width = 720;
|
ldcore->width = 720;
|
||||||
|
@ -695,7 +695,7 @@ static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr
|
|||||||
/* TODO: get rid of this ifdef MESS section */
|
/* TODO: get rid of this ifdef MESS section */
|
||||||
our_this->cdrom = mess_cd_get_cdrom_file( devtag_get_device( machine, diskregion ) );
|
our_this->cdrom = mess_cd_get_cdrom_file( devtag_get_device( machine, diskregion ) );
|
||||||
#else
|
#else
|
||||||
our_this->cdrom = cdrom_open(get_disk_handle( diskregion ));
|
our_this->cdrom = cdrom_open(get_disk_handle( machine, diskregion ));
|
||||||
|
|
||||||
if (!our_this->cdrom)
|
if (!our_this->cdrom)
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr
|
|||||||
/* TODO: get rid of this ifdef MESS section */
|
/* TODO: get rid of this ifdef MESS section */
|
||||||
our_this->disk = mess_hd_get_hard_disk_file( devtag_get_device( machine, diskregion ) );
|
our_this->disk = mess_hd_get_hard_disk_file( devtag_get_device( machine, diskregion ) );
|
||||||
#else
|
#else
|
||||||
our_this->disk = hard_disk_open(get_disk_handle( diskregion ));
|
our_this->disk = hard_disk_open(get_disk_handle( machine, diskregion ));
|
||||||
|
|
||||||
if (!our_this->disk)
|
if (!our_this->disk)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,7 @@ typedef struct _palette_private palette_private;
|
|||||||
typedef struct _tilemap_private tilemap_private;
|
typedef struct _tilemap_private tilemap_private;
|
||||||
typedef struct _streams_private streams_private;
|
typedef struct _streams_private streams_private;
|
||||||
typedef struct _devices_private devices_private;
|
typedef struct _devices_private devices_private;
|
||||||
|
typedef struct _romload_private romload_private;
|
||||||
typedef struct _input_port_private input_port_private;
|
typedef struct _input_port_private input_port_private;
|
||||||
typedef struct _ui_input_private ui_input_private;
|
typedef struct _ui_input_private ui_input_private;
|
||||||
typedef struct _cheat_private cheat_private;
|
typedef struct _cheat_private cheat_private;
|
||||||
@ -182,6 +183,7 @@ struct _running_machine
|
|||||||
tilemap_private * tilemap_data; /* internal data from tilemap.c */
|
tilemap_private * tilemap_data; /* internal data from tilemap.c */
|
||||||
streams_private * streams_data; /* internal data from streams.c */
|
streams_private * streams_data; /* internal data from streams.c */
|
||||||
devices_private * devices_data; /* internal data from devices.c */
|
devices_private * devices_data; /* internal data from devices.c */
|
||||||
|
romload_private * romload_data; /* internal data from romload.c */
|
||||||
input_port_private * input_port_data; /* internal data from inptport.c */
|
input_port_private * input_port_data; /* internal data from inptport.c */
|
||||||
ui_input_private * ui_input_data; /* internal data from uiinput.c */
|
ui_input_private * ui_input_data; /* internal data from uiinput.c */
|
||||||
cheat_private * cheat_data; /* internal data from cheat.c */
|
cheat_private * cheat_data; /* internal data from cheat.c */
|
||||||
@ -223,7 +225,7 @@ struct _mame_system_time
|
|||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
GLOBAL VARAIBLES
|
GLOBAL VARIABLES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
extern const char mame_disclaimer[];
|
extern const char mame_disclaimer[];
|
||||||
|
@ -34,8 +34,20 @@
|
|||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
typedef struct _rom_load_data rom_load_data;
|
typedef struct _open_chd open_chd;
|
||||||
struct _rom_load_data
|
struct _open_chd
|
||||||
|
{
|
||||||
|
open_chd * next; /* pointer to next in the list */
|
||||||
|
const char * region; /* disk region we came from */
|
||||||
|
chd_file * origchd; /* handle to the original CHD */
|
||||||
|
mame_file * origfile; /* file handle to the original CHD file */
|
||||||
|
chd_file * diffchd; /* handle to the diff CHD */
|
||||||
|
mame_file * difffile; /* file handle to the diff CHD file */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _romload_private rom_load_data;
|
||||||
|
struct _romload_private
|
||||||
{
|
{
|
||||||
running_machine *machine; /* machine object where needed */
|
running_machine *machine; /* machine object where needed */
|
||||||
int system_bios; /* the system BIOS we wish to load */
|
int system_bios; /* the system BIOS we wish to load */
|
||||||
@ -49,6 +61,8 @@ struct _rom_load_data
|
|||||||
UINT32 romstotalsize; /* total size of ROMs to read */
|
UINT32 romstotalsize; /* total size of ROMs to read */
|
||||||
|
|
||||||
mame_file * file; /* current file */
|
mame_file * file; /* current file */
|
||||||
|
open_chd * chd_list; /* disks */
|
||||||
|
open_chd ** chd_list_tailptr;
|
||||||
|
|
||||||
UINT8 * regionbase; /* base of current region */
|
UINT8 * regionbase; /* base of current region */
|
||||||
UINT32 regionlength; /* length of current region */
|
UINT32 regionlength; /* length of current region */
|
||||||
@ -57,31 +71,6 @@ struct _rom_load_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _open_chd open_chd;
|
|
||||||
struct _open_chd
|
|
||||||
{
|
|
||||||
open_chd * next; /* pointer to next in the list */
|
|
||||||
const char * region; /* disk region we came from */
|
|
||||||
chd_file * origchd; /* handle to the original CHD */
|
|
||||||
mame_file * origfile; /* file handle to the original CHD file */
|
|
||||||
chd_file * diffchd; /* handle to the diff CHD */
|
|
||||||
mame_file * difffile; /* file handle to the diff CHD file */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
GLOBAL VARIABLES
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/* disks */
|
|
||||||
static open_chd *chd_list;
|
|
||||||
static open_chd **chd_list_tailptr;
|
|
||||||
|
|
||||||
static int total_rom_load_warnings;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
FUNCTION PROTOTYPES
|
FUNCTION PROTOTYPES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -99,17 +88,32 @@ static void rom_exit(running_machine *machine);
|
|||||||
CHD file associated with the given region
|
CHD file associated with the given region
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
chd_file *get_disk_handle(const char *region)
|
chd_file *get_disk_handle(running_machine *machine, const char *region)
|
||||||
{
|
{
|
||||||
open_chd *curdisk;
|
open_chd *curdisk;
|
||||||
|
|
||||||
for (curdisk = chd_list; curdisk != NULL; curdisk = curdisk->next)
|
for (curdisk = machine->romload_data->chd_list; curdisk != NULL; curdisk = curdisk->next)
|
||||||
if (strcmp(curdisk->region, region) == 0)
|
if (strcmp(curdisk->region, region) == 0)
|
||||||
return (curdisk->diffchd != NULL) ? curdisk->diffchd : curdisk->origchd;
|
return (curdisk->diffchd != NULL) ? curdisk->diffchd : curdisk->origchd;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
add_disk_handle - add a disk to the to the
|
||||||
|
list of CHD files
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
static void add_disk_handle(running_machine *machine, open_chd *chd)
|
||||||
|
{
|
||||||
|
romload_private *romload_data = machine->romload_data;
|
||||||
|
|
||||||
|
*romload_data->chd_list_tailptr = auto_alloc(machine, open_chd);
|
||||||
|
**romload_data->chd_list_tailptr = *chd;
|
||||||
|
romload_data->chd_list_tailptr = &(*romload_data->chd_list_tailptr)->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
set_disk_handle - set a pointer to the CHD
|
set_disk_handle - set a pointer to the CHD
|
||||||
file associated with the given region
|
file associated with the given region
|
||||||
@ -125,9 +129,7 @@ void set_disk_handle(running_machine *machine, const char *region, mame_file *fi
|
|||||||
chd.origfile = file;
|
chd.origfile = file;
|
||||||
|
|
||||||
/* we're okay, add to the list of disks */
|
/* we're okay, add to the list of disks */
|
||||||
*chd_list_tailptr = auto_alloc(machine, open_chd);
|
add_disk_handle(machine, &chd);
|
||||||
**chd_list_tailptr = chd;
|
|
||||||
chd_list_tailptr = &(*chd_list_tailptr)->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1225,9 +1227,7 @@ static void process_disk_entries(rom_load_data *romdata, const char *regiontag,
|
|||||||
|
|
||||||
/* we're okay, add to the list of disks */
|
/* we're okay, add to the list of disks */
|
||||||
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
|
LOG(("Assigning to handle %d\n", DISK_GETINDEX(romp)));
|
||||||
*chd_list_tailptr = auto_alloc(romdata->machine, open_chd);
|
add_disk_handle(romdata->machine, &chd);
|
||||||
**chd_list_tailptr = chd;
|
|
||||||
chd_list_tailptr = &(*chd_list_tailptr)->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
astring_free(filename);
|
astring_free(filename);
|
||||||
@ -1338,33 +1338,34 @@ static void process_region_list(rom_load_data *romdata)
|
|||||||
|
|
||||||
void rom_init(running_machine *machine)
|
void rom_init(running_machine *machine)
|
||||||
{
|
{
|
||||||
rom_load_data romdata;
|
rom_load_data *romdata;
|
||||||
|
|
||||||
|
/* allocate private data */
|
||||||
|
machine->romload_data = romdata = auto_alloc_clear(machine, romload_private);
|
||||||
|
|
||||||
/* make sure we get called back on the way out */
|
/* make sure we get called back on the way out */
|
||||||
add_exit_callback(machine, rom_exit);
|
add_exit_callback(machine, rom_exit);
|
||||||
|
|
||||||
/* reset the romdata struct */
|
/* reset the romdata struct */
|
||||||
memset(&romdata, 0, sizeof(romdata));
|
romdata->machine = machine;
|
||||||
romdata.machine = machine;
|
romdata->errorstring = astring_alloc();
|
||||||
romdata.errorstring = astring_alloc();
|
|
||||||
|
|
||||||
/* figure out which BIOS we are using */
|
/* figure out which BIOS we are using */
|
||||||
determine_bios_rom(&romdata);
|
determine_bios_rom(romdata);
|
||||||
|
|
||||||
/* count the total number of ROMs */
|
/* count the total number of ROMs */
|
||||||
count_roms(&romdata);
|
count_roms(romdata);
|
||||||
|
|
||||||
/* reset the disk list */
|
/* reset the disk list */
|
||||||
chd_list = NULL;
|
romdata->chd_list = NULL;
|
||||||
chd_list_tailptr = &chd_list;
|
romdata->chd_list_tailptr = &machine->romload_data->chd_list;
|
||||||
|
|
||||||
/* process the ROM entries we were passed */
|
/* process the ROM entries we were passed */
|
||||||
process_region_list(&romdata);
|
process_region_list(romdata);
|
||||||
|
|
||||||
/* display the results and exit */
|
/* display the results and exit */
|
||||||
total_rom_load_warnings = romdata.warnings;
|
display_rom_load_results(romdata);
|
||||||
display_rom_load_results(&romdata);
|
astring_free(romdata->errorstring);
|
||||||
astring_free(romdata.errorstring);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1385,7 +1386,7 @@ static void rom_exit(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* close all hard drives */
|
/* close all hard drives */
|
||||||
for (curchd = chd_list; curchd != NULL; curchd = curchd->next)
|
for (curchd = machine->romload_data->chd_list; curchd != NULL; curchd = curchd->next)
|
||||||
{
|
{
|
||||||
if (curchd->diffchd != NULL)
|
if (curchd->diffchd != NULL)
|
||||||
chd_close(curchd->diffchd);
|
chd_close(curchd->diffchd);
|
||||||
@ -1404,7 +1405,7 @@ static void rom_exit(running_machine *machine)
|
|||||||
warnings we generated
|
warnings we generated
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
int rom_load_warnings(void)
|
int rom_load_warnings(running_machine *machine)
|
||||||
{
|
{
|
||||||
return total_rom_load_warnings;
|
return machine->romload_data->warnings;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ struct _rom_entry
|
|||||||
void rom_init(running_machine *machine);
|
void rom_init(running_machine *machine);
|
||||||
|
|
||||||
/* return the number of warnings we generated */
|
/* return the number of warnings we generated */
|
||||||
int rom_load_warnings(void);
|
int rom_load_warnings(running_machine *machine);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, mam
|
|||||||
chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd);
|
chd_error open_disk_image_options(core_options *options, const game_driver *gamedrv, const rom_entry *romp, mame_file **image_file, chd_file **image_chd);
|
||||||
|
|
||||||
/* return a pointer to the CHD file associated with the given region */
|
/* return a pointer to the CHD file associated with the given region */
|
||||||
chd_file *get_disk_handle(const char *region);
|
chd_file *get_disk_handle(running_machine *machine, const char *region);
|
||||||
|
|
||||||
/* set a pointer to the CHD file associated with the given region */
|
/* set a pointer to the CHD file associated with the given region */
|
||||||
void set_disk_handle(running_machine *machine, const char *region, mame_file *file, chd_file *chd);
|
void set_disk_handle(running_machine *machine, const char *region, mame_file *file, chd_file *chd);
|
||||||
|
@ -876,11 +876,11 @@ static astring *warnings_string(running_machine *machine, astring *string)
|
|||||||
astring_reset(string);
|
astring_reset(string);
|
||||||
|
|
||||||
/* if no warnings, nothing to return */
|
/* if no warnings, nothing to return */
|
||||||
if (rom_load_warnings() == 0 && !(machine->gamedrv->flags & WARNING_FLAGS))
|
if (rom_load_warnings(machine) == 0 && !(machine->gamedrv->flags & WARNING_FLAGS))
|
||||||
return string;
|
return string;
|
||||||
|
|
||||||
/* add a warning if any ROMs were loaded with warnings */
|
/* add a warning if any ROMs were loaded with warnings */
|
||||||
if (rom_load_warnings() > 0)
|
if (rom_load_warnings(machine) > 0)
|
||||||
{
|
{
|
||||||
astring_catc(string, "One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n");
|
astring_catc(string, "One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n");
|
||||||
if (machine->gamedrv->flags & WARNING_FLAGS)
|
if (machine->gamedrv->flags & WARNING_FLAGS)
|
||||||
|
@ -85,16 +85,15 @@ struct _quark_table
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _quark_tables quark_tables;
|
||||||
/***************************************************************************
|
struct _quark_tables
|
||||||
GLOBAL VARIABLES
|
{
|
||||||
***************************************************************************/
|
quark_table *source;
|
||||||
|
quark_table *name;
|
||||||
static quark_table *source_table;
|
quark_table *description;
|
||||||
static quark_table *name_table;
|
quark_table *roms;
|
||||||
static quark_table *description_table;
|
quark_table *defstr;
|
||||||
static quark_table *roms_table;
|
};
|
||||||
static quark_table *defstr_table;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -254,15 +253,15 @@ static quark_table *quark_table_alloc(UINT32 entries, UINT32 hashsize)
|
|||||||
string operations
|
string operations
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static void quark_tables_create(void)
|
static void quark_tables_create(quark_tables *tables)
|
||||||
{
|
{
|
||||||
int drivnum = driver_list_get_count(drivers), strnum;
|
int drivnum = driver_list_get_count(drivers), strnum;
|
||||||
|
|
||||||
/* allocate memory for the quark tables */
|
/* allocate memory for the quark tables */
|
||||||
source_table = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
tables->source = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
||||||
name_table = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
tables->name = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
||||||
description_table = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
tables->description = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
||||||
roms_table = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
tables->roms = quark_table_alloc(drivnum, QUARK_HASH_SIZE);
|
||||||
|
|
||||||
/* build the quarks and the hash tables */
|
/* build the quarks and the hash tables */
|
||||||
for (drivnum = 0; drivers[drivnum]; drivnum++)
|
for (drivnum = 0; drivers[drivnum]; drivnum++)
|
||||||
@ -270,24 +269,24 @@ static void quark_tables_create(void)
|
|||||||
const game_driver *driver = drivers[drivnum];
|
const game_driver *driver = drivers[drivnum];
|
||||||
|
|
||||||
/* fill in the quark with hashes of the strings */
|
/* fill in the quark with hashes of the strings */
|
||||||
quark_add(source_table, drivnum, quark_string_crc(driver->source_file));
|
quark_add(tables->source, drivnum, quark_string_crc(driver->source_file));
|
||||||
quark_add(name_table, drivnum, quark_string_crc(driver->name));
|
quark_add(tables->name, drivnum, quark_string_crc(driver->name));
|
||||||
quark_add(description_table, drivnum, quark_string_crc(driver->description));
|
quark_add(tables->description, drivnum, quark_string_crc(driver->description));
|
||||||
|
|
||||||
/* only track actual driver ROM entries */
|
/* only track actual driver ROM entries */
|
||||||
if (driver->rom && (driver->flags & GAME_NO_STANDALONE) == 0)
|
if (driver->rom && (driver->flags & GAME_NO_STANDALONE) == 0)
|
||||||
quark_add(roms_table, drivnum, (FPTR)driver->rom);
|
quark_add(tables->roms, drivnum, (FPTR)driver->rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for a quark table of strings */
|
/* allocate memory for a quark table of strings */
|
||||||
defstr_table = quark_table_alloc(INPUT_STRING_COUNT, 97);
|
tables->defstr = quark_table_alloc(INPUT_STRING_COUNT, 97);
|
||||||
|
|
||||||
/* add all the default strings */
|
/* add all the default strings */
|
||||||
for (strnum = 1; strnum < INPUT_STRING_COUNT; strnum++)
|
for (strnum = 1; strnum < INPUT_STRING_COUNT; strnum++)
|
||||||
{
|
{
|
||||||
const char *string = input_port_string_from_index(strnum);
|
const char *string = input_port_string_from_index(strnum);
|
||||||
if (string != NULL)
|
if (string != NULL)
|
||||||
quark_add(defstr_table, strnum, quark_string_crc(string));
|
quark_add(tables->defstr, strnum, quark_string_crc(string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,27 +295,27 @@ static void quark_tables_create(void)
|
|||||||
quark_tables_free - free allocated tables
|
quark_tables_free - free allocated tables
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static void quark_tables_free(void)
|
static void quark_tables_free(quark_tables *tables)
|
||||||
{
|
{
|
||||||
if (source_table != NULL)
|
if (tables->source != NULL)
|
||||||
free(source_table);
|
free(tables->source);
|
||||||
source_table = NULL;
|
tables->source = NULL;
|
||||||
|
|
||||||
if (name_table != NULL)
|
if (tables->name != NULL)
|
||||||
free(name_table);
|
free(tables->name);
|
||||||
name_table = NULL;
|
tables->name = NULL;
|
||||||
|
|
||||||
if (description_table != NULL)
|
if (tables->description != NULL)
|
||||||
free(description_table);
|
free(tables->description);
|
||||||
description_table = NULL;
|
tables->description = NULL;
|
||||||
|
|
||||||
if (roms_table != NULL)
|
if (tables->roms != NULL)
|
||||||
free(roms_table);
|
free(tables->roms);
|
||||||
roms_table = NULL;
|
tables->roms = NULL;
|
||||||
|
|
||||||
if (defstr_table != NULL)
|
if (tables->defstr != NULL)
|
||||||
free(defstr_table);
|
free(tables->defstr);
|
||||||
defstr_table = NULL;
|
tables->defstr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -483,9 +482,12 @@ static int validate_inlines(void)
|
|||||||
information
|
information
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static int validate_driver(int drivnum, const machine_config *config)
|
static int validate_driver(int drivnum, const machine_config *config, const quark_tables *tables)
|
||||||
{
|
{
|
||||||
const game_driver *driver = drivers[drivnum];
|
const game_driver *driver = drivers[drivnum];
|
||||||
|
quark_table *name_table = tables->name;
|
||||||
|
quark_table *description_table = tables->description;
|
||||||
|
quark_table *roms_table = tables->roms;
|
||||||
const game_driver *clone_of;
|
const game_driver *clone_of;
|
||||||
quark_entry *entry;
|
quark_entry *entry;
|
||||||
int error = FALSE, is_clone;
|
int error = FALSE, is_clone;
|
||||||
@ -1005,7 +1007,7 @@ static int validate_gfx(int drivnum, const machine_config *config, region_info *
|
|||||||
strings
|
strings
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static int get_defstr_index(const char *name, const game_driver *driver, int *error)
|
static int get_defstr_index(quark_table *defstr_table, const char *name, const game_driver *driver, int *error)
|
||||||
{
|
{
|
||||||
UINT32 crc = quark_string_crc(name);
|
UINT32 crc = quark_string_crc(name);
|
||||||
quark_entry *entry;
|
quark_entry *entry;
|
||||||
@ -1144,7 +1146,7 @@ static void validate_analog_input_field(const input_field_config *field, const g
|
|||||||
setting
|
setting
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static void validate_dip_settings(const input_field_config *field, const game_driver *driver, int *error)
|
static void validate_dip_settings(const input_field_config *field, const game_driver *driver, quark_table *defstr_table, int *error)
|
||||||
{
|
{
|
||||||
const char *demo_sounds = input_port_string_from_index(INPUT_STRING_Demo_Sounds);
|
const char *demo_sounds = input_port_string_from_index(INPUT_STRING_Demo_Sounds);
|
||||||
const char *flipscreen = input_port_string_from_index(INPUT_STRING_Flip_Screen);
|
const char *flipscreen = input_port_string_from_index(INPUT_STRING_Flip_Screen);
|
||||||
@ -1155,7 +1157,7 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
|||||||
/* iterate through the settings */
|
/* iterate through the settings */
|
||||||
for (setting = field->settinglist; setting != NULL; setting = setting->next)
|
for (setting = field->settinglist; setting != NULL; setting = setting->next)
|
||||||
{
|
{
|
||||||
int strindex = get_defstr_index(setting->name, driver, error);
|
int strindex = get_defstr_index(defstr_table, setting->name, driver, error);
|
||||||
|
|
||||||
/* note any coinage strings */
|
/* note any coinage strings */
|
||||||
if (strindex >= INPUT_STRING_9C_1C && strindex <= INPUT_STRING_1C_9C)
|
if (strindex >= INPUT_STRING_9C_1C && strindex <= INPUT_STRING_1C_9C)
|
||||||
@ -1185,7 +1187,7 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
|||||||
/* if we have a neighbor, compare ourselves to him */
|
/* if we have a neighbor, compare ourselves to him */
|
||||||
if (setting->next != NULL)
|
if (setting->next != NULL)
|
||||||
{
|
{
|
||||||
int next_strindex = get_defstr_index(setting->next->name, driver, error);
|
int next_strindex = get_defstr_index(defstr_table, setting->next->name, driver, error);
|
||||||
|
|
||||||
/* check for inverted off/on dispswitch order */
|
/* check for inverted off/on dispswitch order */
|
||||||
if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off)
|
if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off)
|
||||||
@ -1235,7 +1237,7 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
|||||||
validate_inputs - validate input configuration
|
validate_inputs - validate input configuration
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static int validate_inputs(int drivnum, const machine_config *config, const input_port_config **portlistptr)
|
static int validate_inputs(int drivnum, const machine_config *config, quark_table *defstr_table, const input_port_config **portlistptr)
|
||||||
{
|
{
|
||||||
const input_port_config *scanport;
|
const input_port_config *scanport;
|
||||||
const input_port_config *port;
|
const input_port_config *port;
|
||||||
@ -1289,7 +1291,7 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* verify the settings list */
|
/* verify the settings list */
|
||||||
validate_dip_settings(field, driver, &error);
|
validate_dip_settings(field, driver, defstr_table, &error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* look for invalid (0) types which should be mapped to IPT_OTHER */
|
/* look for invalid (0) types which should be mapped to IPT_OTHER */
|
||||||
@ -1324,7 +1326,7 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* look up the string and print an error if default strings are not used */
|
/* look up the string and print an error if default strings are not used */
|
||||||
/*strindex = */get_defstr_index(field->name, driver, &error);
|
/*strindex = */get_defstr_index(defstr_table, field->name, driver, &error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* verify conditions on the field */
|
/* verify conditions on the field */
|
||||||
@ -1593,6 +1595,7 @@ static int validate_devices(int drivnum, const machine_config *config, const inp
|
|||||||
|
|
||||||
int mame_validitychecks(const game_driver *curdriver)
|
int mame_validitychecks(const game_driver *curdriver)
|
||||||
{
|
{
|
||||||
|
quark_tables tables;
|
||||||
osd_ticks_t prep = 0;
|
osd_ticks_t prep = 0;
|
||||||
osd_ticks_t expansion = 0;
|
osd_ticks_t expansion = 0;
|
||||||
osd_ticks_t driver_checks = 0;
|
osd_ticks_t driver_checks = 0;
|
||||||
@ -1647,7 +1650,7 @@ int mame_validitychecks(const game_driver *curdriver)
|
|||||||
|
|
||||||
/* prepare by pre-scanning all the drivers and adding their info to hash tables */
|
/* prepare by pre-scanning all the drivers and adding their info to hash tables */
|
||||||
prep -= osd_profiling_ticks();
|
prep -= osd_profiling_ticks();
|
||||||
quark_tables_create();
|
quark_tables_create(&tables);
|
||||||
prep += osd_profiling_ticks();
|
prep += osd_profiling_ticks();
|
||||||
|
|
||||||
/* iterate over all drivers */
|
/* iterate over all drivers */
|
||||||
@ -1671,7 +1674,7 @@ int mame_validitychecks(const game_driver *curdriver)
|
|||||||
|
|
||||||
/* validate the driver entry */
|
/* validate the driver entry */
|
||||||
driver_checks -= osd_profiling_ticks();
|
driver_checks -= osd_profiling_ticks();
|
||||||
error = validate_driver(drivnum, config) || error;
|
error = validate_driver(drivnum, config, &tables) || error;
|
||||||
driver_checks += osd_profiling_ticks();
|
driver_checks += osd_profiling_ticks();
|
||||||
|
|
||||||
/* validate the ROM information */
|
/* validate the ROM information */
|
||||||
@ -1681,7 +1684,7 @@ int mame_validitychecks(const game_driver *curdriver)
|
|||||||
|
|
||||||
/* validate input ports */
|
/* validate input ports */
|
||||||
input_checks -= osd_profiling_ticks();
|
input_checks -= osd_profiling_ticks();
|
||||||
error = validate_inputs(drivnum, config, &portlist) || error;
|
error = validate_inputs(drivnum, config, tables.defstr, &portlist) || error;
|
||||||
input_checks += osd_profiling_ticks();
|
input_checks += osd_profiling_ticks();
|
||||||
|
|
||||||
/* validate the CPU information */
|
/* validate the CPU information */
|
||||||
@ -1741,7 +1744,7 @@ int mame_validitychecks(const game_driver *curdriver)
|
|||||||
|
|
||||||
end_resource_tracking();
|
end_resource_tracking();
|
||||||
exit_resource_tracking();
|
exit_resource_tracking();
|
||||||
quark_tables_free();
|
quark_tables_free(&tables);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ static chd_file *get_disc(const device_config *device)
|
|||||||
if (image_file == NULL)
|
if (image_file == NULL)
|
||||||
fatalerror("No valid image file found!\n");
|
fatalerror("No valid image file found!\n");
|
||||||
|
|
||||||
return get_disk_handle("laserdisc");
|
return get_disk_handle(device->machine, "laserdisc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -455,9 +455,9 @@ static cdrom_toc cde_toc;
|
|||||||
static CDE_DMA cde_dma[2];
|
static CDE_DMA cde_dma[2];
|
||||||
|
|
||||||
|
|
||||||
static void cde_init(void)
|
static void cde_init(running_machine *machine)
|
||||||
{
|
{
|
||||||
cdrom_file *cd = cdrom_open(get_disk_handle("cdrom"));
|
cdrom_file *cd = cdrom_open(get_disk_handle(machine, "cdrom"));
|
||||||
const cdrom_toc *toc = cdrom_get_toc(cd);
|
const cdrom_toc *toc = cdrom_get_toc(cd);
|
||||||
|
|
||||||
if (cd)
|
if (cd)
|
||||||
@ -1231,7 +1231,7 @@ static DRIVER_INIT( m2 )
|
|||||||
{
|
{
|
||||||
unk3 = U64(0xffffffffffffffff);
|
unk3 = U64(0xffffffffffffffff);
|
||||||
unk20004 = 0;
|
unk20004 = 0;
|
||||||
cde_init();
|
cde_init(machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
GAME( 1997, polystar, 0, m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
|
GAME( 1997, polystar, 0, m2, m2, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )
|
||||||
|
@ -1011,7 +1011,7 @@ static void atapi_exit(running_machine* machine)
|
|||||||
|
|
||||||
for( i = 0; i < 2; i++ )
|
for( i = 0; i < 2; i++ )
|
||||||
{
|
{
|
||||||
if( get_disk_handle( diskregions[i] ) != NULL )
|
if( get_disk_handle( machine, diskregions[i] ) != NULL )
|
||||||
{
|
{
|
||||||
SCSIDeleteInstance( available_cdroms[ i ] );
|
SCSIDeleteInstance( available_cdroms[ i ] );
|
||||||
}
|
}
|
||||||
@ -1039,7 +1039,7 @@ static void atapi_init(running_machine *machine)
|
|||||||
|
|
||||||
for( i = 0; i < 2; i++ )
|
for( i = 0; i < 2; i++ )
|
||||||
{
|
{
|
||||||
if( get_disk_handle( diskregions[i] ) != NULL )
|
if( get_disk_handle( machine, diskregions[i] ) != NULL )
|
||||||
{
|
{
|
||||||
SCSIAllocInstance( machine, &SCSIClassCr589, &available_cdroms[ i ], diskregions[i] );
|
SCSIAllocInstance( machine, &SCSIClassCr589, &available_cdroms[ i ], diskregions[i] );
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ static WRITE32_HANDLER(rf5c296_mem_w)
|
|||||||
pos++;
|
pos++;
|
||||||
} else
|
} else
|
||||||
v = data;
|
v = data;
|
||||||
chd_get_metadata(get_disk_handle("card"), HARD_DISK_KEY_METADATA_TAG, 0, key, 5, 0, 0, 0);
|
chd_get_metadata(get_disk_handle(space->machine, "card"), HARD_DISK_KEY_METADATA_TAG, 0, key, 5, 0, 0, 0);
|
||||||
k = pos < 5 ? key[pos] : 0;
|
k = pos < 5 ? key[pos] : 0;
|
||||||
if(v == k)
|
if(v == k)
|
||||||
locked &= ~(1 << pos);
|
locked &= ~(1 << pos);
|
||||||
@ -834,7 +834,7 @@ static DRIVER_INIT( coh3002t )
|
|||||||
dip_timer = timer_alloc(machine, dip_timer_fired, NULL );
|
dip_timer = timer_alloc(machine, dip_timer_fired, NULL );
|
||||||
|
|
||||||
memset(cis, 0xff, 512);
|
memset(cis, 0xff, 512);
|
||||||
chd_get_metadata(get_disk_handle("card"), PCMCIA_CIS_METADATA_TAG, 0, cis, 512, 0, 0, 0);
|
chd_get_metadata(get_disk_handle(machine, "card"), PCMCIA_CIS_METADATA_TAG, 0, cis, 512, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DRIVER_INIT( coh3002t_mp )
|
static DRIVER_INIT( coh3002t_mp )
|
||||||
|
@ -102,7 +102,7 @@ void amiga_akiko_init(running_machine* machine)
|
|||||||
akiko.cdrom_cmd_start = 0;
|
akiko.cdrom_cmd_start = 0;
|
||||||
akiko.cdrom_cmd_end = 0;
|
akiko.cdrom_cmd_end = 0;
|
||||||
akiko.cdrom_cmd_resp = 0;
|
akiko.cdrom_cmd_resp = 0;
|
||||||
akiko.cdrom = cdrom_open(get_disk_handle("cdrom"));
|
akiko.cdrom = cdrom_open(get_disk_handle(machine, "cdrom"));
|
||||||
akiko.cdrom_toc = NULL;
|
akiko.cdrom_toc = NULL;
|
||||||
akiko.dma_timer = timer_alloc(machine, akiko_dma_proc, NULL);
|
akiko.dma_timer = timer_alloc(machine, akiko_dma_proc, NULL);
|
||||||
akiko.frame_timer = timer_alloc(machine, akiko_frame_proc, NULL);
|
akiko.frame_timer = timer_alloc(machine, akiko_frame_proc, NULL);
|
||||||
|
@ -946,7 +946,7 @@ static DEVICE_START( naomibd )
|
|||||||
|
|
||||||
case DIMM_BOARD:
|
case DIMM_BOARD:
|
||||||
v->memory = (UINT8 *)memory_region(device->machine, config->regiontag);
|
v->memory = (UINT8 *)memory_region(device->machine, config->regiontag);
|
||||||
v->gdromchd = get_disk_handle(config->gdromregiontag);
|
v->gdromchd = get_disk_handle(device->machine, config->gdromregiontag);
|
||||||
v->picdata = (UINT8 *)memory_region(device->machine, config->picregiontag);
|
v->picdata = (UINT8 *)memory_region(device->machine, config->picregiontag);
|
||||||
load_rom_gdrom(device->machine, v);
|
load_rom_gdrom(device->machine, v);
|
||||||
break;
|
break;
|
||||||
|
@ -261,7 +261,7 @@ void stvcd_reset(running_machine *machine)
|
|||||||
#ifdef MESS
|
#ifdef MESS
|
||||||
cdrom = mess_cd_get_cdrom_file(devtag_get_device( machine, "cdrom" ));
|
cdrom = mess_cd_get_cdrom_file(devtag_get_device( machine, "cdrom" ));
|
||||||
#else
|
#else
|
||||||
cdrom = cdrom_open(get_disk_handle("cdrom"));
|
cdrom = cdrom_open(get_disk_handle(machine, "cdrom"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cdrom)
|
if (cdrom)
|
||||||
|
Loading…
Reference in New Issue
Block a user