mirror of
https://github.com/holub/mame
synced 2025-06-05 04:16:28 +03:00
Added helpers for loading file for slot determination (no whatsnew)
This commit is contained in:
parent
d9303a9a03
commit
dab559f2aa
@ -38,6 +38,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
#include "emuopts.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "zippath.h"
|
#include "zippath.h"
|
||||||
#include "uiimage.h"
|
#include "uiimage.h"
|
||||||
@ -845,7 +846,7 @@ bool device_image_interface::load_software(char *swlist, char *swname, rom_entry
|
|||||||
load_internal - core image loading
|
load_internal - core image loading
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args)
|
bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load)
|
||||||
{
|
{
|
||||||
UINT32 open_plan[4];
|
UINT32 open_plan[4];
|
||||||
int i;
|
int i;
|
||||||
@ -926,6 +927,10 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int
|
|||||||
/* success! */
|
/* success! */
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (just_load) {
|
||||||
|
if(m_err) clear();
|
||||||
|
return m_err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS;
|
||||||
|
}
|
||||||
if (m_err!=0) {
|
if (m_err!=0) {
|
||||||
if (!m_init_phase)
|
if (!m_init_phase)
|
||||||
{
|
{
|
||||||
@ -962,9 +967,26 @@ done:
|
|||||||
|
|
||||||
bool device_image_interface::load(const char *path)
|
bool device_image_interface::load(const char *path)
|
||||||
{
|
{
|
||||||
return load_internal(path, FALSE, 0, NULL);
|
return load_internal(path, FALSE, 0, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
load_for_slot - load an image for slot device
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
bool device_image_interface::load_for_slot(emu_options &options)
|
||||||
|
{
|
||||||
|
const char* path = options.value(instance_name());
|
||||||
|
if (strlen(path)>0)
|
||||||
|
{
|
||||||
|
set_init_phase();
|
||||||
|
if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
|
||||||
|
{
|
||||||
|
if (software_entry()==NULL) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
image_finish_load - special call - only use
|
image_finish_load - special call - only use
|
||||||
@ -1016,7 +1038,7 @@ bool device_image_interface::finish_load()
|
|||||||
bool device_image_interface::create(const char *path, const image_device_format *create_format, option_resolution *create_args)
|
bool device_image_interface::create(const char *path, const image_device_format *create_format, option_resolution *create_args)
|
||||||
{
|
{
|
||||||
int format_index = (create_format != NULL) ? create_format->m_index : 0;
|
int format_index = (create_format != NULL) ? create_format->m_index : 0;
|
||||||
return load_internal(path, TRUE, format_index, create_args);
|
return load_internal(path, TRUE, format_index, create_args, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ public:
|
|||||||
image_device_format *formatlist() const { return m_formatlist; }
|
image_device_format *formatlist() const { return m_formatlist; }
|
||||||
|
|
||||||
bool load(const char *path);
|
bool load(const char *path);
|
||||||
|
bool load_for_slot(emu_options &options);
|
||||||
bool finish_load();
|
bool finish_load();
|
||||||
void unload();
|
void unload();
|
||||||
bool create(const char *path, const image_device_format *create_format, option_resolution *create_args);
|
bool create(const char *path, const image_device_format *create_format, option_resolution *create_args);
|
||||||
@ -253,7 +254,7 @@ public:
|
|||||||
int reopen_for_write(const char *path);
|
int reopen_for_write(const char *path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args);
|
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load);
|
||||||
void determine_open_plan(int is_create, UINT32 *open_plan);
|
void determine_open_plan(int is_create, UINT32 *open_plan);
|
||||||
image_error_t load_image_by_path(UINT32 open_flags, const char *path);
|
image_error_t load_image_by_path(UINT32 open_flags, const char *path);
|
||||||
void clear();
|
void clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user