mirror of
https://github.com/holub/mame
synced 2025-05-15 02:18:16 +03:00
- Moved softlist implementation from MESS [Miodrag Milanovic]
- Moved image related UI from MESS to emu core - Reimplemented filename related image device calls
This commit is contained in:
parent
834b1badde
commit
cbe7260a59
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -814,6 +814,8 @@ src/emu/romload.c svneol=native#text/plain
|
||||
src/emu/romload.h svneol=native#text/plain
|
||||
src/emu/schedule.c svneol=native#text/plain
|
||||
src/emu/schedule.h svneol=native#text/plain
|
||||
src/emu/softlist.c svneol=native#text/plain
|
||||
src/emu/softlist.h svneol=native#text/plain
|
||||
src/emu/sound.c svneol=native#text/plain
|
||||
src/emu/sound.h svneol=native#text/plain
|
||||
src/emu/sound/2151intf.c svneol=native#text/plain
|
||||
@ -1050,6 +1052,8 @@ src/emu/ui.c svneol=native#text/plain
|
||||
src/emu/ui.h svneol=native#text/plain
|
||||
src/emu/uigfx.c svneol=native#text/plain
|
||||
src/emu/uigfx.h svneol=native#text/plain
|
||||
src/emu/uiimage.c svneol=native#text/plain
|
||||
src/emu/uiimage.h svneol=native#text/plain
|
||||
src/emu/uiinput.c svneol=native#text/plain
|
||||
src/emu/uiinput.h svneol=native#text/plain
|
||||
src/emu/uimenu.c svneol=native#text/plain
|
||||
|
@ -208,18 +208,6 @@ legacy_image_device_base::legacy_image_device_base(running_machine &machine, con
|
||||
IMAGE LOADING
|
||||
****************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
set_image_filename - specifies the filename of
|
||||
an image
|
||||
-------------------------------------------------*/
|
||||
|
||||
image_error_t legacy_image_device_base::set_image_filename(const char *filename)
|
||||
{
|
||||
m_name = filename;
|
||||
zippath_parent(&m_working_directory, filename);
|
||||
return IMAGE_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
is_loaded - quick check to determine whether an
|
||||
image is loaded
|
||||
@ -227,7 +215,7 @@ image_error_t legacy_image_device_base::set_image_filename(const char *filename)
|
||||
|
||||
bool legacy_image_device_base::is_loaded()
|
||||
{
|
||||
return (m_file != NULL); // (image->software_info_ptr != NULL);
|
||||
return (m_file != NULL) || (m_software_info_ptr != NULL);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -332,6 +320,8 @@ bool legacy_image_device_base::load_internal(const char *path, bool is_create, i
|
||||
goto done;
|
||||
|
||||
/* Check if there's a software list defined for this device and use that if we're not creating an image */
|
||||
if (is_create || !load_software_part( this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name ) )
|
||||
{
|
||||
/* determine open plan */
|
||||
determine_open_plan(is_create, open_plan);
|
||||
|
||||
@ -343,7 +333,17 @@ bool legacy_image_device_base::load_internal(const char *path, bool is_create, i
|
||||
if (err && (err != IMAGE_ERROR_FILENOTFOUND))
|
||||
goto done;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Copy some image information when we have been loaded through a software list */
|
||||
if ( m_software_info_ptr )
|
||||
{
|
||||
m_longname = m_software_info_ptr->longname;
|
||||
m_manufacturer = m_software_info_ptr->publisher;
|
||||
m_year = m_software_info_ptr->year;
|
||||
//m_playable = m_software_info_ptr->supported;
|
||||
}
|
||||
|
||||
/* did we fail to find the file? */
|
||||
if (!is_loaded())
|
||||
{
|
||||
@ -469,6 +469,18 @@ void legacy_image_device_base::clear()
|
||||
m_name.reset();
|
||||
m_writeable = FALSE;
|
||||
m_created = FALSE;
|
||||
|
||||
m_longname.reset();
|
||||
m_manufacturer.reset();
|
||||
m_year.reset();
|
||||
m_playable.reset();
|
||||
m_extrainfo.reset();
|
||||
m_basename_noext.reset();
|
||||
m_filetype.reset();
|
||||
|
||||
m_full_software_name = NULL;
|
||||
m_software_info_ptr = NULL;
|
||||
m_software_part_ptr = NULL;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
@ -480,82 +492,3 @@ void legacy_image_device_base::unload()
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
WORKING DIRECTORIES
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
try_change_working_directory - tries to change
|
||||
the working directory, but only if the directory
|
||||
actually exists
|
||||
-------------------------------------------------*/
|
||||
bool legacy_image_device_base::try_change_working_directory(const char *subdir)
|
||||
{
|
||||
osd_directory *directory;
|
||||
const osd_directory_entry *entry;
|
||||
bool success = FALSE;
|
||||
bool done = FALSE;
|
||||
|
||||
directory = osd_opendir(m_working_directory.cstr());
|
||||
if (directory != NULL)
|
||||
{
|
||||
while(!done && (entry = osd_readdir(directory)) != NULL)
|
||||
{
|
||||
if (!mame_stricmp(subdir, entry->name))
|
||||
{
|
||||
done = TRUE;
|
||||
success = entry->type == ENTTYPE_DIR;
|
||||
}
|
||||
}
|
||||
|
||||
osd_closedir(directory);
|
||||
}
|
||||
|
||||
/* did we successfully identify the directory? */
|
||||
if (success)
|
||||
zippath_combine(&m_working_directory, m_working_directory, subdir);
|
||||
|
||||
return success;
|
||||
}
|
||||
/*-------------------------------------------------
|
||||
setup_working_directory - sets up the working
|
||||
directory according to a few defaults
|
||||
-------------------------------------------------*/
|
||||
|
||||
void legacy_image_device_base::setup_working_directory()
|
||||
{
|
||||
const game_driver *gamedrv;
|
||||
char *dst = NULL;
|
||||
|
||||
osd_get_full_path(&dst,".");
|
||||
/* first set up the working directory to be the starting directory */
|
||||
m_working_directory = dst;
|
||||
|
||||
/* now try browsing down to "software" */
|
||||
if (try_change_working_directory("software"))
|
||||
{
|
||||
/* now down to a directory for this computer */
|
||||
gamedrv = device().machine->gamedrv;
|
||||
while(gamedrv && !try_change_working_directory(gamedrv->name))
|
||||
{
|
||||
gamedrv = driver_get_compatible(gamedrv);
|
||||
}
|
||||
}
|
||||
osd_free(dst);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// working_directory - returns the working
|
||||
// directory to use for this image; this is
|
||||
// valid even if not mounted
|
||||
//-------------------------------------------------
|
||||
|
||||
const char * legacy_image_device_base::working_directory()
|
||||
{
|
||||
/* check to see if we've never initialized the working directory */
|
||||
if (m_working_directory.len() == 0)
|
||||
setup_working_directory();
|
||||
|
||||
return m_working_directory;
|
||||
}
|
||||
|
@ -638,8 +638,6 @@ class legacy_image_device_base : public legacy_device_base,
|
||||
{
|
||||
friend class legacy_image_device_config_base;
|
||||
public:
|
||||
virtual void set_working_directory(const char *working_directory) { m_working_directory = working_directory; }
|
||||
virtual const char * working_directory();
|
||||
virtual bool load(const char *path);
|
||||
virtual bool finish_load();
|
||||
virtual void unload();
|
||||
@ -648,16 +646,8 @@ protected:
|
||||
// construction/destruction
|
||||
legacy_image_device_base(running_machine &machine, const device_config &config);
|
||||
// device_image_interface overrides
|
||||
|
||||
/* working directory; persists across mounts */
|
||||
astring m_working_directory;
|
||||
|
||||
void setup_working_directory();
|
||||
bool try_change_working_directory(const char *subdir);
|
||||
|
||||
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args);
|
||||
void determine_open_plan(int is_create, UINT32 *open_plan);
|
||||
image_error_t set_image_filename(const char *filename);
|
||||
image_error_t load_image_by_path(UINT32 open_flags, const char *path);
|
||||
void clear();
|
||||
bool is_loaded();
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui.h"
|
||||
#include "zippath.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -130,7 +131,10 @@ const char *device_config_image_interface::device_brieftypename(iodevice_t type)
|
||||
device_image_interface::device_image_interface(running_machine &machine, const device_config &config, device_t &device)
|
||||
: device_interface(machine, config, device),
|
||||
m_image_config(dynamic_cast<const device_config_image_interface &>(config)),
|
||||
m_file(NULL)
|
||||
m_file(NULL),
|
||||
m_full_software_name(NULL),
|
||||
m_software_info_ptr(NULL),
|
||||
m_software_part_ptr(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -143,6 +147,45 @@ device_image_interface::~device_image_interface()
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
display - call image display callback function
|
||||
-------------------------------------------------*/
|
||||
|
||||
void device_image_interface::display()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
set_image_filename - specifies the filename of
|
||||
an image
|
||||
-------------------------------------------------*/
|
||||
|
||||
image_error_t device_image_interface::set_image_filename(const char *filename)
|
||||
{
|
||||
m_name = filename;
|
||||
zippath_parent(&m_working_directory, filename);
|
||||
m_basename = m_name.cpy(m_name);
|
||||
|
||||
int loc1 = m_name.rchr(0,'\\');
|
||||
int loc2 = m_name.rchr(0,'/');
|
||||
int loc3 = m_name.rchr(0,':');
|
||||
int loc = MAX(loc1,MAX(loc2,loc3));
|
||||
if (loc!=-1) {
|
||||
m_basename = m_basename.substr(loc + 1,m_basename.len()-loc);
|
||||
}
|
||||
m_basename_noext = m_basename.cpy(m_basename);
|
||||
m_filetype = "";
|
||||
loc = m_basename_noext.rchr(0,'.');
|
||||
if (loc!=-1) {
|
||||
m_basename_noext = m_basename_noext.substr(0,loc);
|
||||
m_filetype = m_basename.cpy(m_basename);
|
||||
m_filetype = m_filetype.substr(loc + 1,m_filetype.len()-loc);
|
||||
}
|
||||
|
||||
return IMAGE_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
CREATION FORMATS
|
||||
****************************************************************************/
|
||||
@ -260,74 +303,132 @@ void device_image_interface::message(const char *format, ...)
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Accessor functions
|
||||
|
||||
These provide information about the device; and about the mounted image
|
||||
****************************************************************************/
|
||||
/***************************************************************************
|
||||
WORKING DIRECTORIES
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
filename
|
||||
try_change_working_directory - tries to change
|
||||
the working directory, but only if the directory
|
||||
actually exists
|
||||
-------------------------------------------------*/
|
||||
bool device_image_interface::try_change_working_directory(const char *subdir)
|
||||
{
|
||||
osd_directory *directory;
|
||||
const osd_directory_entry *entry;
|
||||
bool success = FALSE;
|
||||
bool done = FALSE;
|
||||
|
||||
directory = osd_opendir(m_working_directory.cstr());
|
||||
if (directory != NULL)
|
||||
{
|
||||
while(!done && (entry = osd_readdir(directory)) != NULL)
|
||||
{
|
||||
if (!mame_stricmp(subdir, entry->name))
|
||||
{
|
||||
done = TRUE;
|
||||
success = entry->type == ENTTYPE_DIR;
|
||||
}
|
||||
}
|
||||
|
||||
osd_closedir(directory);
|
||||
}
|
||||
|
||||
/* did we successfully identify the directory? */
|
||||
if (success)
|
||||
zippath_combine(&m_working_directory, m_working_directory, subdir);
|
||||
|
||||
return success;
|
||||
}
|
||||
/*-------------------------------------------------
|
||||
setup_working_directory - sets up the working
|
||||
directory according to a few defaults
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_image_interface::filename()
|
||||
void device_image_interface::setup_working_directory()
|
||||
{
|
||||
const char *name = m_name;
|
||||
return (name[0] != '\0') ? name : NULL;
|
||||
const game_driver *gamedrv;
|
||||
char *dst = NULL;
|
||||
|
||||
osd_get_full_path(&dst,".");
|
||||
/* first set up the working directory to be the starting directory */
|
||||
m_working_directory = dst;
|
||||
|
||||
/* now try browsing down to "software" */
|
||||
if (try_change_working_directory("software"))
|
||||
{
|
||||
/* now down to a directory for this computer */
|
||||
gamedrv = device().machine->gamedrv;
|
||||
while(gamedrv && !try_change_working_directory(gamedrv->name))
|
||||
{
|
||||
gamedrv = driver_get_compatible(gamedrv);
|
||||
}
|
||||
}
|
||||
osd_free(dst);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// working_directory - returns the working
|
||||
// directory to use for this image; this is
|
||||
// valid even if not mounted
|
||||
//-------------------------------------------------
|
||||
|
||||
const char * device_image_interface::working_directory()
|
||||
{
|
||||
/* check to see if we've never initialized the working directory */
|
||||
if (m_working_directory.len() == 0)
|
||||
setup_working_directory();
|
||||
|
||||
return m_working_directory;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
basename
|
||||
get_software_region
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_image_interface::basename()
|
||||
UINT8 *device_image_interface::get_software_region(const char *tag)
|
||||
{
|
||||
char *fname = (char*)astring(filename()).cstr();
|
||||
const char *c;
|
||||
char full_tag[256];
|
||||
|
||||
// NULL begets NULL
|
||||
if (!fname)
|
||||
if ( m_software_info_ptr == NULL || m_software_part_ptr == NULL )
|
||||
return NULL;
|
||||
|
||||
// start at the end and return when we hit a slash or colon
|
||||
for (c = fname + strlen(fname) - 1; c >= fname; c--)
|
||||
if (*c == '\\' || *c == '/' || *c == ':')
|
||||
return c + 1;
|
||||
|
||||
// otherwise, return the whole thing
|
||||
return fname;
|
||||
sprintf( full_tag, "%s:%s", device().tag(), tag );
|
||||
return memory_region( device().machine, full_tag );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
basename_noext
|
||||
image_get_software_region_length
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_image_interface::basename_noext()
|
||||
UINT32 device_image_interface::get_software_region_length(const char *tag)
|
||||
{
|
||||
const char *s;
|
||||
char *ext;
|
||||
char full_tag[256];
|
||||
|
||||
s = astring(basename());
|
||||
if (s)
|
||||
sprintf( full_tag, "%s:%s", device().tag(), tag );
|
||||
return memory_region_length( device().machine, full_tag );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
image_get_feature
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_image_interface::get_feature(const char *feature_name)
|
||||
{
|
||||
feature_list *feature;
|
||||
|
||||
if ( ! m_software_part_ptr->featurelist )
|
||||
return NULL;
|
||||
|
||||
for ( feature = m_software_part_ptr->featurelist; feature; feature = feature->next )
|
||||
{
|
||||
ext = (char *)strrchr(s, '.');
|
||||
if (ext)
|
||||
*ext = '\0';
|
||||
if ( ! strcmp( feature->name, feature_name ) )
|
||||
return feature->value;
|
||||
}
|
||||
return s;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
filetype
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *device_image_interface::filetype()
|
||||
{
|
||||
const char *s = filename();
|
||||
if (s != NULL)
|
||||
s = strrchr(s, '.');
|
||||
return s ? s+1 : NULL;
|
||||
}
|
||||
|
@ -103,6 +103,9 @@ struct image_device_format
|
||||
};
|
||||
|
||||
class device_image_interface;
|
||||
struct feature_list;
|
||||
struct software_part;
|
||||
struct software_info;
|
||||
|
||||
// device image interface function types
|
||||
typedef int (*device_image_load_func)(device_image_interface &image);
|
||||
@ -188,12 +191,12 @@ public:
|
||||
device_image_interface(running_machine &machine, const device_config &config, device_t &device);
|
||||
virtual ~device_image_interface();
|
||||
|
||||
virtual void set_working_directory(const char *working_directory) = 0;
|
||||
virtual const char * working_directory() = 0;
|
||||
virtual bool load(const char *path) = 0;
|
||||
virtual bool finish_load() = 0;
|
||||
virtual void unload() = 0;
|
||||
|
||||
virtual void display();
|
||||
|
||||
virtual const image_device_format *device_get_indexed_creatable_format(int index);
|
||||
virtual const image_device_format *device_get_named_creatable_format(const char *format_name);
|
||||
const option_guide *image_device_get_creation_option_guide() { return m_image_config.create_option_guide(); }
|
||||
@ -206,10 +209,10 @@ public:
|
||||
void message(const char *format, ...);
|
||||
|
||||
bool exists() { return m_name.len() != 0; }
|
||||
const char *filename();
|
||||
const char *basename();
|
||||
const char *basename_noext();
|
||||
const char *filetype();
|
||||
const char *filename() { if (m_name.len()==0) return NULL; else return m_name; }
|
||||
const char *basename() { if (m_basename.len()==0) return NULL; else return m_basename; }
|
||||
const char *basename_noext() { if (m_basename_noext.len()==0) return NULL; else return m_basename_noext; }
|
||||
const char *filetype() { if (m_filetype.len()==0) return NULL; else return m_filetype; }
|
||||
core_file *image_core_file() { return m_file; }
|
||||
UINT64 length() { check_for_file(); return core_fsize(m_file); }
|
||||
bool is_writable() { return m_writeable; }
|
||||
@ -227,10 +230,33 @@ public:
|
||||
const device_config_image_interface &image_config() const { return m_image_config; }
|
||||
|
||||
void set_init_phase() { m_init_phase = TRUE; }
|
||||
|
||||
const char* longname() { return m_longname; }
|
||||
const char* manufacturer() { return m_manufacturer; }
|
||||
const char* year() { return m_year; }
|
||||
const char* playable() { return m_playable; }
|
||||
const char* pcb() { return m_pcb; }
|
||||
const char* extrainfo() { return m_extrainfo; }
|
||||
|
||||
const software_info *software_entry() { return m_software_info_ptr; }
|
||||
|
||||
virtual void set_working_directory(const char *working_directory) { m_working_directory = working_directory; }
|
||||
virtual const char * working_directory();
|
||||
|
||||
UINT8 *get_software_region(const char *tag);
|
||||
UINT32 get_software_region_length(const char *tag);
|
||||
const char *get_feature(const char *feature_name);
|
||||
|
||||
protected:
|
||||
image_error_t set_image_filename(const char *filename);
|
||||
|
||||
void clear_error();
|
||||
|
||||
void check_for_file() { assert_always(m_file != NULL, "Illegal operation on unmounted image"); }
|
||||
|
||||
void setup_working_directory();
|
||||
bool try_change_working_directory(const char *subdir);
|
||||
|
||||
// derived class overrides
|
||||
|
||||
// configuration
|
||||
@ -243,6 +269,26 @@ protected:
|
||||
/* variables that are only non-zero when an image is mounted */
|
||||
core_file *m_file;
|
||||
astring m_name;
|
||||
astring m_basename;
|
||||
astring m_basename_noext;
|
||||
astring m_filetype;
|
||||
|
||||
/* working directory; persists across mounts */
|
||||
astring m_working_directory;
|
||||
|
||||
/* Software information */
|
||||
char *m_full_software_name;
|
||||
software_info *m_software_info_ptr;
|
||||
software_part *m_software_part_ptr;
|
||||
|
||||
/* info read from the hash file/software list */
|
||||
astring m_longname;
|
||||
astring m_manufacturer;
|
||||
astring m_year;
|
||||
astring m_playable;
|
||||
astring m_pcb;
|
||||
astring m_extrainfo;
|
||||
|
||||
/* flags */
|
||||
bool m_writeable;
|
||||
bool m_created;
|
||||
|
@ -99,6 +99,7 @@
|
||||
#include "state.h"
|
||||
|
||||
// image-related
|
||||
#include "softlist.h"
|
||||
#include "image.h"
|
||||
|
||||
// the running machine
|
||||
|
@ -80,6 +80,7 @@ EMUOBJS = \
|
||||
$(EMUOBJ)/rendutil.o \
|
||||
$(EMUOBJ)/romload.o \
|
||||
$(EMUOBJ)/schedule.o \
|
||||
$(EMUOBJ)/softlist.o \
|
||||
$(EMUOBJ)/sound.o \
|
||||
$(EMUOBJ)/state.o \
|
||||
$(EMUOBJ)/streams.o \
|
||||
@ -87,6 +88,7 @@ EMUOBJS = \
|
||||
$(EMUOBJ)/timer.o \
|
||||
$(EMUOBJ)/ui.o \
|
||||
$(EMUOBJ)/uigfx.o \
|
||||
$(EMUOBJ)/uiimage.o \
|
||||
$(EMUOBJ)/uiinput.o \
|
||||
$(EMUOBJ)/uimenu.o \
|
||||
$(EMUOBJ)/validity.o \
|
||||
|
@ -1264,7 +1264,6 @@ static UINT32 normalize_flags_for_device(running_machine *machine, UINT32 startf
|
||||
}
|
||||
|
||||
|
||||
#ifdef MESS
|
||||
/*-------------------------------------------------
|
||||
load_software_part_region - load a software part
|
||||
|
||||
@ -1343,7 +1342,6 @@ void load_software_part_region(running_device *device, char *swlist, char *swnam
|
||||
/* display the results and exit */
|
||||
display_rom_load_results(romdata);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -324,9 +324,6 @@ chd_file *get_disk_handle(running_machine *machine, const char *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);
|
||||
|
||||
|
||||
#ifdef MESS
|
||||
void load_software_part_region(running_device *device, char *swlist, char *swname, rom_entry *start_region);
|
||||
#endif
|
||||
|
||||
#endif /* __ROMLOAD_H__ */
|
||||
|
1445
src/emu/softlist.c
Normal file
1445
src/emu/softlist.c
Normal file
File diff suppressed because it is too large
Load Diff
113
src/emu/softlist.h
Normal file
113
src/emu/softlist.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*********************************************************************
|
||||
|
||||
softlist.h
|
||||
|
||||
Software and software list information.
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __SOFTLIST_H_
|
||||
#define __SOFTLIST_H_
|
||||
|
||||
#include "uimenu.h"
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
Internal structures and XML file handling
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
/* Replace this with list<string>? */
|
||||
struct feature_list
|
||||
{
|
||||
feature_list *next;
|
||||
char *name;
|
||||
char *value;
|
||||
};
|
||||
|
||||
struct software_part
|
||||
{
|
||||
const char *name;
|
||||
const char *interface_;
|
||||
feature_list *featurelist;
|
||||
struct rom_entry *romdata;
|
||||
};
|
||||
|
||||
|
||||
/* The software info struct holds basic software information. Additional,
|
||||
optional information like local software names, release dates, serial
|
||||
numbers, etc can be maintained and stored in external recources.
|
||||
*/
|
||||
struct software_info
|
||||
{
|
||||
const char *shortname;
|
||||
const char *longname;
|
||||
const char *parentname;
|
||||
const char *year; /* Copyright year on title screen, actual release dates can be tracked in external resources */
|
||||
const char *publisher;
|
||||
UINT32 supported;
|
||||
software_part *partdata;
|
||||
};
|
||||
|
||||
|
||||
typedef struct _software_list software_list;
|
||||
|
||||
/* Handling a software list */
|
||||
software_list *software_list_open(core_options *options, const char *listname, int is_preload, void (*error_proc)(const char *message));
|
||||
void software_list_close(software_list *swlist);
|
||||
software_info *software_list_first(software_list *swlist);
|
||||
software_info *software_list_find(software_list *swlist, const char *software);
|
||||
software_info *software_list_next(software_list *swlist);
|
||||
|
||||
software_part *software_find_part(software_info *sw, const char *partname, const char *interface_);
|
||||
software_part *software_part_next(software_part *part);
|
||||
|
||||
|
||||
bool load_software_part(device_image_interface *image, const char *path, software_info **sw_info, software_part **sw_part, char **full_sw_name);
|
||||
|
||||
void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *parameter, void *state);
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
Driver software list configuration
|
||||
|
||||
*********************************************************************/
|
||||
DECLARE_LEGACY_DEVICE(SOFTWARE_LIST, software_list);
|
||||
#define __SOFTWARE_LIST_TAG "software_list"
|
||||
|
||||
|
||||
#define SOFTWARE_SUPPORTED_YES 0
|
||||
#define SOFTWARE_SUPPORTED_PARTIAL 1
|
||||
#define SOFTWARE_SUPPORTED_NO 2
|
||||
|
||||
|
||||
#define SOFTWARE_LIST_CONFIG_SIZE 10
|
||||
|
||||
|
||||
typedef struct _software_list_config software_list_config;
|
||||
struct _software_list_config
|
||||
{
|
||||
char *list_name[SOFTWARE_LIST_CONFIG_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#define DEVINFO_STR_SWLIST_0 (DEVINFO_STR_DEVICE_SPECIFIC+0)
|
||||
#define DEVINFO_STR_SWLIST_MAX (DEVINFO_STR_SWLIST_0 + SOFTWARE_LIST_CONFIG_SIZE - 1)
|
||||
|
||||
|
||||
#define MDRV_SOFTWARE_LIST_CONFIG(_idx,_list) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(software_list_config, list_name, _idx, _list)
|
||||
|
||||
#define MDRV_SOFTWARE_LIST_ADD( _list ) \
|
||||
MDRV_DEVICE_ADD( __SOFTWARE_LIST_TAG, SOFTWARE_LIST, 0 ) \
|
||||
MDRV_SOFTWARE_LIST_CONFIG(0,_list)
|
||||
|
||||
|
||||
#define MDRV_SOFTWARE_LIST_MODIFY( _list ) \
|
||||
MDRV_DEVICE_MODIFY( __SOFTWARE_LIST_TAG ) \
|
||||
MDRV_SOFTWARE_LIST_CONFIG(0,_list)
|
||||
|
||||
|
||||
#endif
|
29
src/emu/ui.c
29
src/emu/ui.c
@ -21,11 +21,6 @@
|
||||
#include "uiinput.h"
|
||||
#include "uimenu.h"
|
||||
#include "uigfx.h"
|
||||
|
||||
#ifdef MESS
|
||||
#include "uimess.h"
|
||||
#endif /* MESS */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@ -1265,6 +1260,26 @@ void ui_paste(running_machine *machine)
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_image_handler_ingame - execute display
|
||||
callback function for each image device
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_image_handler_ingame(running_machine *machine)
|
||||
{
|
||||
device_image_interface *image = NULL;
|
||||
|
||||
/* run display routine for devices */
|
||||
if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
|
||||
{
|
||||
for (bool gotone = machine->devicelist.first(image); gotone; gotone = image->next(image))
|
||||
{
|
||||
image->display();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
handler_ingame - in-game handler takes care
|
||||
of the standard keypresses
|
||||
@ -1345,9 +1360,7 @@ static UINT32 handler_ingame(running_machine *machine, render_container *contain
|
||||
ui_paste(machine);
|
||||
}
|
||||
|
||||
#ifdef MESS
|
||||
ui_mess_handler_ingame(machine);
|
||||
#endif /* MESS */
|
||||
ui_image_handler_ingame(machine);
|
||||
|
||||
if (ui_disabled) return ui_disabled;
|
||||
|
||||
|
1130
src/emu/uiimage.c
Normal file
1130
src/emu/uiimage.c
Normal file
File diff suppressed because it is too large
Load Diff
27
src/emu/uiimage.h
Normal file
27
src/emu/uiimage.h
Normal file
@ -0,0 +1,27 @@
|
||||
/***************************************************************************
|
||||
|
||||
uiimage.h
|
||||
|
||||
Internal MAME user interface image.
|
||||
|
||||
Copyright Nicola Salmoria and the MAME Team.
|
||||
Visit http://mamedev.org for licensing and usage restrictions.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UIIMAGE_H__
|
||||
#define __UIIMAGE_H__
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *parameter, void *state);
|
||||
|
||||
void ui_image_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state);
|
||||
|
||||
#endif /* __UIIMAGE_H__ */
|
@ -14,6 +14,7 @@
|
||||
#include "ui.h"
|
||||
#include "rendutil.h"
|
||||
#include "cheat.h"
|
||||
#include "uiimage.h"
|
||||
#include "uiinput.h"
|
||||
#include "uimenu.h"
|
||||
#include "audit.h"
|
||||
@ -1530,11 +1531,23 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
|
||||
/* add game info menu */
|
||||
ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info);
|
||||
|
||||
#ifdef MESS
|
||||
/* add MESS-specific menus */
|
||||
ui_mess_main_menu_populate(machine, menu);
|
||||
#endif /* MESS */
|
||||
device_image_interface *image = NULL;
|
||||
if (machine->devicelist.first(image))
|
||||
{
|
||||
/* add image info menu */
|
||||
ui_menu_item_append(menu, "Image Information", NULL, 0, (void*)ui_image_menu_image_info);
|
||||
|
||||
/* add file manager menu */
|
||||
ui_menu_item_append(menu, "File Manager", NULL, 0, (void*)ui_image_menu_file_manager);
|
||||
|
||||
/* add software menu */
|
||||
ui_menu_item_append(menu, "Software", NULL, 0, (void*)ui_image_menu_software);
|
||||
|
||||
#ifdef MESS
|
||||
/* add MESS-specific menus */
|
||||
ui_mess_main_menu_populate(machine, menu);
|
||||
#endif /* MESS */
|
||||
}
|
||||
/* add keyboard mode menu */
|
||||
if (input_machine_has_keyboard(machine) && inputx_can_post(machine))
|
||||
ui_menu_item_append(menu, "Keyboard Mode", NULL, 0, (void *)ui_menu_keyboard_mode);
|
||||
|
Loading…
Reference in New Issue
Block a user