mirror of
https://github.com/holub/mame
synced 2025-04-28 19:14:55 +03:00
And woohoo, mame_options() is no more.
This commit is contained in:
parent
1b54456be5
commit
d2fac452a3
@ -251,10 +251,7 @@ static int execute_simple_commands(core_options *options, const char *exename)
|
|||||||
|
|
||||||
/* validate? */
|
/* validate? */
|
||||||
if (options_get_bool(options, CLIOPTION_VALIDATE))
|
if (options_get_bool(options, CLIOPTION_VALIDATE))
|
||||||
{
|
|
||||||
set_mame_options(options);
|
|
||||||
return mame_validitychecks(*options, NULL);
|
return mame_validitychecks(*options, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ static DEVICE_IMAGE_LOAD( cartslot )
|
|||||||
return (*config->device_load)(image);
|
return (*config->device_load)(image);
|
||||||
|
|
||||||
/* try opening this as if it were a multicart */
|
/* try opening this as if it were a multicart */
|
||||||
multicart_open(image.filename(), device->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
|
multicart_open(device->machine->options(), image.filename(), device->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
|
||||||
if (cart->mc == NULL)
|
if (cart->mc == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ static DEVICE_IMAGE_UNLOAD( cartslot )
|
|||||||
|
|
||||||
if (cart->mc != NULL)
|
if (cart->mc != NULL)
|
||||||
{
|
{
|
||||||
multicart_close(cart->mc);
|
multicart_close(device->machine->options(), cart->mc);
|
||||||
cart->mc = NULL;
|
cart->mc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,12 +360,12 @@ static const cartslot_pcb_type *identify_pcb(device_image_interface &image)
|
|||||||
if (image.software_entry() == NULL && image.exists())
|
if (image.software_entry() == NULL && image.exists())
|
||||||
{
|
{
|
||||||
/* try opening this as if it were a multicart */
|
/* try opening this as if it were a multicart */
|
||||||
multicart_open_error me = multicart_open(image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc);
|
multicart_open_error me = multicart_open(image.device().machine->options(), image.filename(), image.device().machine->gamedrv->name, MULTICART_FLAGS_DONT_LOAD_RESOURCES, &mc);
|
||||||
if (me == MCERR_NONE)
|
if (me == MCERR_NONE)
|
||||||
{
|
{
|
||||||
/* this was a multicart - read from it */
|
/* this was a multicart - read from it */
|
||||||
astring_cpyc(&pcb_name, mc->pcb_type);
|
astring_cpyc(&pcb_name, mc->pcb_type);
|
||||||
multicart_close(mc);
|
multicart_close(image.device().machine->options(), mc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
#include "multcart.h"
|
#include "multcart.h"
|
||||||
#include "pool.h"
|
#include "pool.h"
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "corestr.h"
|
#include "corestr.h"
|
||||||
#include "xmlfile.h"
|
#include "xmlfile.h"
|
||||||
#include "emu.h"
|
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ static multicart_open_error load_rom_resource(multicart_load_state *state, xml_d
|
|||||||
load_ram_resource
|
load_ram_resource
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static multicart_open_error load_ram_resource(multicart_load_state *state, xml_data_node *resource_node,
|
static multicart_open_error load_ram_resource(core_options &options, multicart_load_state *state, xml_data_node *resource_node,
|
||||||
multicart_resource *resource)
|
multicart_resource *resource)
|
||||||
{
|
{
|
||||||
const char *length_string;
|
const char *length_string;
|
||||||
@ -258,7 +258,7 @@ static multicart_open_error load_ram_resource(multicart_load_state *state, xml_d
|
|||||||
if (resource->filename == NULL)
|
if (resource->filename == NULL)
|
||||||
return MCERR_OUT_OF_MEMORY;
|
return MCERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
image_battery_load_by_name(*mame_options(), resource->filename, resource->ptr, resource->length, 0x00);
|
image_battery_load_by_name(options, resource->filename, resource->ptr, resource->length, 0x00);
|
||||||
}
|
}
|
||||||
/* else this type is volatile, in which case we just have
|
/* else this type is volatile, in which case we just have
|
||||||
a memory expansion */
|
a memory expansion */
|
||||||
@ -271,7 +271,7 @@ static multicart_open_error load_ram_resource(multicart_load_state *state, xml_d
|
|||||||
load_resource
|
load_resource
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static multicart_open_error load_resource(multicart_load_state *state, xml_data_node *resource_node,
|
static multicart_open_error load_resource(core_options &options, multicart_load_state *state, xml_data_node *resource_node,
|
||||||
multicart_resource_type resource_type)
|
multicart_resource_type resource_type)
|
||||||
{
|
{
|
||||||
const char *id;
|
const char *id;
|
||||||
@ -305,7 +305,7 @@ static multicart_open_error load_resource(multicart_load_state *state, xml_data_
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MULTICART_RESOURCE_TYPE_RAM:
|
case MULTICART_RESOURCE_TYPE_RAM:
|
||||||
err = load_ram_resource(state, resource_node, resource);
|
err = load_ram_resource(options, state, resource_node, resource);
|
||||||
if (err != MCERR_NONE)
|
if (err != MCERR_NONE)
|
||||||
return err;
|
return err;
|
||||||
break;
|
break;
|
||||||
@ -327,7 +327,7 @@ static multicart_open_error load_resource(multicart_load_state *state, xml_data_
|
|||||||
load_all_resources
|
load_all_resources
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static multicart_open_error load_all_resources(multicart_load_state *state)
|
static multicart_open_error load_all_resources(core_options &options, multicart_load_state *state)
|
||||||
{
|
{
|
||||||
multicart_open_error err;
|
multicart_open_error err;
|
||||||
xml_data_node *resource_node;
|
xml_data_node *resource_node;
|
||||||
@ -338,7 +338,7 @@ static multicart_open_error load_all_resources(multicart_load_state *state)
|
|||||||
resource_type = get_resource_type(resource_node->name);
|
resource_type = get_resource_type(resource_node->name);
|
||||||
if (resource_type != MULTICART_RESOURCE_TYPE_INVALID)
|
if (resource_type != MULTICART_RESOURCE_TYPE_INVALID)
|
||||||
{
|
{
|
||||||
err = load_resource(state, resource_node, resource_type);
|
err = load_resource(options, state, resource_node, resource_type);
|
||||||
if (err != MCERR_NONE)
|
if (err != MCERR_NONE)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ static multicart_open_error load_all_resources(multicart_load_state *state)
|
|||||||
be freed on multicart_close.
|
be freed on multicart_close.
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
static multicart_open_error save_ram_resources(multicart_t *cart)
|
static multicart_open_error save_ram_resources(core_options &options, multicart_t *cart)
|
||||||
{
|
{
|
||||||
const multicart_resource *resource;
|
const multicart_resource *resource;
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ static multicart_open_error save_ram_resources(multicart_t *cart)
|
|||||||
{
|
{
|
||||||
if ((resource->type == MULTICART_RESOURCE_TYPE_RAM) && (resource->filename != NULL))
|
if ((resource->type == MULTICART_RESOURCE_TYPE_RAM) && (resource->filename != NULL))
|
||||||
{
|
{
|
||||||
image_battery_save_by_name(*mame_options(), resource->filename, resource->ptr, resource->length);
|
image_battery_save_by_name(options, resource->filename, resource->ptr, resource->length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MCERR_NONE;
|
return MCERR_NONE;
|
||||||
@ -460,7 +460,7 @@ static multicart_open_error load_all_sockets(multicart_load_state *state)
|
|||||||
multicart_open - opens a multicart
|
multicart_open - opens a multicart
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
multicart_open_error multicart_open(const char *filename, const char *gamedrv, multicart_load_flags load_flags, multicart_t **cart)
|
multicart_open_error multicart_open(core_options &options, const char *filename, const char *gamedrv, multicart_load_flags load_flags, multicart_t **cart)
|
||||||
{
|
{
|
||||||
multicart_open_error err;
|
multicart_open_error err;
|
||||||
zip_error ziperr;
|
zip_error ziperr;
|
||||||
@ -565,7 +565,7 @@ multicart_open_error multicart_open(const char *filename, const char *gamedrv, m
|
|||||||
/* do we have to load resources? */
|
/* do we have to load resources? */
|
||||||
if (load_flags & MULTICART_FLAGS_LOAD_RESOURCES)
|
if (load_flags & MULTICART_FLAGS_LOAD_RESOURCES)
|
||||||
{
|
{
|
||||||
err = load_all_resources(&state);
|
err = load_all_resources(options, &state);
|
||||||
if (err != MCERR_NONE)
|
if (err != MCERR_NONE)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@ -588,7 +588,7 @@ done:
|
|||||||
|
|
||||||
if ((err != MCERR_NONE) && (state.multicart != NULL))
|
if ((err != MCERR_NONE) && (state.multicart != NULL))
|
||||||
{
|
{
|
||||||
multicart_close(state.multicart);
|
multicart_close(options, state.multicart);
|
||||||
state.multicart = NULL;
|
state.multicart = NULL;
|
||||||
}
|
}
|
||||||
*cart = state.multicart;
|
*cart = state.multicart;
|
||||||
@ -600,8 +600,8 @@ done:
|
|||||||
multicart_close - closes a multicart
|
multicart_close - closes a multicart
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
void multicart_close(multicart_t *cart)
|
void multicart_close(core_options &options, multicart_t *cart)
|
||||||
{
|
{
|
||||||
save_ram_resources(cart);
|
save_ram_resources(options, cart);
|
||||||
pool_free_lib(cart->data->pool);
|
pool_free_lib(cart->data->pool);
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,9 @@ const char *multicart_error_text(multicart_open_error error);
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* opens a multicart */
|
/* opens a multicart */
|
||||||
multicart_open_error multicart_open(const char *filename, const char *drvname, multicart_load_flags load_flags, multicart_t **cart);
|
multicart_open_error multicart_open(core_options &options, const char *filename, const char *drvname, multicart_load_flags load_flags, multicart_t **cart);
|
||||||
|
|
||||||
/* closes a multicart */
|
/* closes a multicart */
|
||||||
void multicart_close(multicart_t *cart);
|
void multicart_close(core_options &options, multicart_t *cart);
|
||||||
|
|
||||||
#endif /* __MULTCART_H__ */
|
#endif /* __MULTCART_H__ */
|
||||||
|
@ -96,12 +96,11 @@
|
|||||||
GLOBAL VARIABLES
|
GLOBAL VARIABLES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* the current options */
|
|
||||||
static core_options *mame_opts;
|
|
||||||
|
|
||||||
/* started empty? */
|
/* started empty? */
|
||||||
static bool started_empty;
|
static bool started_empty;
|
||||||
|
|
||||||
|
static bool print_verbose = false;
|
||||||
|
|
||||||
static running_machine *global_machine;
|
static running_machine *global_machine;
|
||||||
|
|
||||||
/* output channels */
|
/* output channels */
|
||||||
@ -153,14 +152,15 @@ int mame_execute(osd_interface &osd, core_options *options)
|
|||||||
bool firstgame = true;
|
bool firstgame = true;
|
||||||
bool firstrun = true;
|
bool firstrun = true;
|
||||||
|
|
||||||
|
// extract the verbose printing option
|
||||||
|
if (options_get_bool(options, OPTION_VERBOSE))
|
||||||
|
print_verbose = true;
|
||||||
|
|
||||||
// loop across multiple hard resets
|
// loop across multiple hard resets
|
||||||
bool exit_pending = false;
|
bool exit_pending = false;
|
||||||
int error = MAMERR_NONE;
|
int error = MAMERR_NONE;
|
||||||
while (error == MAMERR_NONE && !exit_pending)
|
while (error == MAMERR_NONE && !exit_pending)
|
||||||
{
|
{
|
||||||
// specify the global mame_options
|
|
||||||
mame_opts = options;
|
|
||||||
|
|
||||||
// convert the specified gamename to a driver
|
// convert the specified gamename to a driver
|
||||||
astring gamename;
|
astring gamename;
|
||||||
core_filename_extract_base(&gamename, options_get_string(options, OPTION_GAMENAME), true);
|
core_filename_extract_base(&gamename, options_get_string(options, OPTION_GAMENAME), true);
|
||||||
@ -217,9 +217,6 @@ int mame_execute(osd_interface &osd, core_options *options)
|
|||||||
// clear flag for added devices
|
// clear flag for added devices
|
||||||
options_set_bool(options, OPTION_ADDED_DEVICE_OPTIONS, FALSE, OPTION_PRIORITY_CMDLINE);
|
options_set_bool(options, OPTION_ADDED_DEVICE_OPTIONS, FALSE, OPTION_PRIORITY_CMDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the options
|
|
||||||
mame_opts = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return an error
|
// return an error
|
||||||
@ -227,30 +224,6 @@ int mame_execute(osd_interface &osd, core_options *options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
mame_options - accesses the options for the
|
|
||||||
currently running emulation
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
core_options *mame_options(void)
|
|
||||||
{
|
|
||||||
assert(mame_opts != NULL);
|
|
||||||
return mame_opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
set_mame_options - set mame options, used by
|
|
||||||
validate option
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void set_mame_options(core_options *options)
|
|
||||||
{
|
|
||||||
mame_opts = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
OUTPUT MANAGEMENT
|
OUTPUT MANAGEMENT
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -377,7 +350,7 @@ void mame_printf_verbose(const char *format, ...)
|
|||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
/* if we're not verbose, skip it */
|
/* if we're not verbose, skip it */
|
||||||
if (mame_opts == NULL || !options_get_bool(mame_options(), OPTION_VERBOSE))
|
if (!print_verbose)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* by default, we go to stdout */
|
/* by default, we go to stdout */
|
||||||
|
@ -98,12 +98,6 @@ extern const char build_version[];
|
|||||||
/* execute as configured by the OPTION_GAMENAME option on the specified options */
|
/* execute as configured by the OPTION_GAMENAME option on the specified options */
|
||||||
int mame_execute(osd_interface &osd, core_options *options);
|
int mame_execute(osd_interface &osd, core_options *options);
|
||||||
|
|
||||||
/* accesses the core_options for the currently running emulation */
|
|
||||||
core_options *mame_options(void);
|
|
||||||
|
|
||||||
/* set mame options, used by validate option */
|
|
||||||
void set_mame_options(core_options *options);
|
|
||||||
|
|
||||||
/* return true if the given machine is valid */
|
/* return true if the given machine is valid */
|
||||||
int mame_is_valid_machine(running_machine *machine);
|
int mame_is_valid_machine(running_machine *machine);
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ void main()
|
|||||||
void Load(char *name,byte *buffer,int from, int length)
|
void Load(char *name,byte *buffer,int from, int length)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
emu_file file(*mame_options(), NULL, OPEN_FLAG_READ);
|
emu_file file(options, NULL, OPEN_FLAG_READ);
|
||||||
file_error filerr = file.open(name);
|
file_error filerr = file.open(name);
|
||||||
if (filerr != FILERR_NONE)
|
if (filerr != FILERR_NONE)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user