OSD Updates:

- OSD can now use OPTION_COMMAND; added execute_command handler to
osd_interface.
- moved list_network_devices and list_midi_devices to OSD
This commit is contained in:
couriersud 2015-01-14 01:05:38 +01:00
parent 410c8e8a1b
commit 11af4265a0
9 changed files with 62 additions and 125 deletions

View File

@ -18,6 +18,7 @@
#include "un7z.h"
#include "validity.h"
#include "sound/samples.h"
#include "cliopts.h"
#include "clifront.h"
#include "xmlfile.h"
@ -27,47 +28,6 @@
#include <ctype.h>
//**************************************************************************
// COMMAND-LINE OPTIONS
//**************************************************************************
const options_entry cli_options::s_option_entries[] =
{
/* core commands */
{ NULL, NULL, OPTION_HEADER, "CORE COMMANDS" },
{ CLICOMMAND_HELP ";h;?", "0", OPTION_COMMAND, "show help message" },
{ CLICOMMAND_VALIDATE ";valid", "0", OPTION_COMMAND, "perform driver validation on all game drivers" },
/* configuration commands */
{ NULL, NULL, OPTION_HEADER, "CONFIGURATION COMMANDS" },
{ CLICOMMAND_CREATECONFIG ";cc", "0", OPTION_COMMAND, "create the default configuration file" },
{ CLICOMMAND_SHOWCONFIG ";sc", "0", OPTION_COMMAND, "display running parameters" },
{ CLICOMMAND_SHOWUSAGE ";su", "0", OPTION_COMMAND, "show this help" },
/* frontend commands */
{ NULL, NULL, OPTION_HEADER, "FRONTEND COMMANDS" },
{ CLICOMMAND_LISTXML ";lx", "0", OPTION_COMMAND, "all available info on driver in XML format" },
{ CLICOMMAND_LISTFULL ";ll", "0", OPTION_COMMAND, "short name, full name" },
{ CLICOMMAND_LISTSOURCE ";ls", "0", OPTION_COMMAND, "driver sourcefile" },
{ CLICOMMAND_LISTCLONES ";lc", "0", OPTION_COMMAND, "show clones" },
{ CLICOMMAND_LISTBROTHERS ";lb", "0", OPTION_COMMAND, "show \"brothers\", or other drivers from same sourcefile" },
{ CLICOMMAND_LISTCRC, "0", OPTION_COMMAND, "CRC-32s" },
{ CLICOMMAND_LISTROMS ";lr", "0", OPTION_COMMAND, "list required roms for a driver" },
{ CLICOMMAND_LISTSAMPLES, "0", OPTION_COMMAND, "list optional samples for a driver" },
{ CLICOMMAND_VERIFYROMS, "0", OPTION_COMMAND, "report romsets that have problems" },
{ CLICOMMAND_VERIFYSAMPLES, "0", OPTION_COMMAND, "report samplesets that have problems" },
{ CLICOMMAND_ROMIDENT, "0", OPTION_COMMAND, "compare files with known MAME roms" },
{ CLICOMMAND_LISTDEVICES ";ld", "0", OPTION_COMMAND, "list available devices" },
{ CLICOMMAND_LISTSLOTS ";lslot", "0", OPTION_COMMAND, "list available slots and slot devices" },
{ CLICOMMAND_LISTMEDIA ";lm", "0", OPTION_COMMAND, "list available media for the system" },
{ CLICOMMAND_LISTSOFTWARE ";lsoft", "0", OPTION_COMMAND, "list known software for the system" },
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ CLICOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
{ CLICOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" },
{ NULL }
};
// media_identifier class identifies media by hash via a search in
// the driver database
@ -98,23 +58,6 @@ private:
};
//**************************************************************************
// CLI OPTIONS
//**************************************************************************
//-------------------------------------------------
// cli_options - constructor
//-------------------------------------------------
cli_options::cli_options()
: emu_options()
{
add_entries(cli_options::s_option_entries);
}
//**************************************************************************
// CLI FRONTEND
//**************************************************************************
@ -804,28 +747,6 @@ void cli_frontend::listmedia(const char *gamename)
}
}
//-------------------------------------------------
// listmididevices - output the list of MIDI devices
// available in the current system to be used
//-------------------------------------------------
void cli_frontend::listmididevices(const char *gamename)
{
m_osd.list_midi_devices();
}
//-------------------------------------------------
// listnetworkadapters - output the list of network
// adapters available in the current system to be used
//-------------------------------------------------
void cli_frontend::listnetworkadapters(const char *gamename)
{
m_osd.list_network_adapters();
}
//-------------------------------------------------
// verifyroms - verify the ROM sets of one or
// more games
@ -1679,12 +1600,10 @@ void cli_frontend::execute_commands(const char *exename)
{ CLICOMMAND_VERIFYSAMPLES, &cli_frontend::verifysamples },
{ CLICOMMAND_LISTMEDIA, &cli_frontend::listmedia },
{ CLICOMMAND_LISTSOFTWARE, &cli_frontend::listsoftware },
{ CLICOMMAND_VERIFYSOFTWARE, &cli_frontend::verifysoftware },
{ CLICOMMAND_VERIFYSOFTWARE,&cli_frontend::verifysoftware },
{ CLICOMMAND_ROMIDENT, &cli_frontend::romident },
{ CLICOMMAND_GETSOFTLIST, &cli_frontend::getsoftlist },
{ CLICOMMAND_VERIFYSOFTLIST, &cli_frontend::verifysoftlist },
{ CLICOMMAND_LIST_MIDI_DEVICES, &cli_frontend::listmididevices },
{ CLICOMMAND_LIST_NETWORK_ADAPTERS, &cli_frontend::listnetworkadapters },
{ CLICOMMAND_VERIFYSOFTLIST,&cli_frontend::verifysoftlist },
};
// find the command
@ -1697,6 +1616,7 @@ void cli_frontend::execute_commands(const char *exename)
return;
}
if (!m_osd.execute_command(m_options.command()))
// if we get here, we don't know what has been requested
throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command());
}

View File

@ -13,6 +13,7 @@
#ifndef __CLIFRONT_H__
#define __CLIFRONT_H__
#include "emu.h"
#include "cliopts.h"
#include "osdepend.h"

View File

@ -7,6 +7,7 @@
***************************************************************************/
#include "cliopts.h"
#include "clifront.h"
//**************************************************************************
// COMMAND-LINE OPTIONS
@ -45,8 +46,20 @@ const options_entry cli_options::s_option_entries[] =
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ CLICOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
{ CLICOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" },
{ NULL }
};
//**************************************************************************
// CLI OPTIONS
//**************************************************************************
//-------------------------------------------------
// cli_options - constructor
//-------------------------------------------------
cli_options::cli_options()
: emu_options()
{
add_entries(cli_options::s_option_entries);
}

View File

@ -47,8 +47,6 @@
#define CLICOMMAND_VERIFYSOFTWARE "verifysoftware"
#define CLICOMMAND_GETSOFTLIST "getsoftlist"
#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist"
#define CLICOMMAND_LIST_MIDI_DEVICES "listmidi"
#define CLICOMMAND_LIST_NETWORK_ADAPTERS "listnetwork"
//**************************************************************************

View File

@ -55,6 +55,7 @@ EMUOBJS = \
$(EMUOBJ)/audit.o \
$(EMUOBJ)/cheat.o \
$(EMUOBJ)/clifront.o \
$(EMUOBJ)/cliopts.o \
$(EMUOBJ)/config.o \
$(EMUOBJ)/crsshair.o \
$(EMUOBJ)/debugger.o \
@ -145,7 +146,6 @@ EMUOBJS = \
$(EMUOBJ)/profiler.o \
$(EMUOBJ)/webengine.o \
$(OSDOBJ)/osdcore.o \
$(OSDOBJ)/osdepend.o \
$(OSDOBJ)/osdnet.o \
$(OSDOBJ)/modules/sound/none.o \
$(OSDOBJ)/modules/debugger/none.o \

View File

@ -20,6 +20,10 @@ extern bool g_print_verbose;
const options_entry osd_options::s_option_entries[] =
{
{ NULL, NULL, OPTION_HEADER, "OSD CLI OPTIONS" },
{ OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
{ OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" },
// debugging options
{ NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" },
{ OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used : " },
@ -375,11 +379,36 @@ bool osd_common_t::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_arg
// get_slider_list - allocate and populate a
// list of OS-dependent slider values.
//-------------------------------------------------
void *osd_common_t::get_slider_list()
{
return NULL;
}
//-------------------------------------------------
// execute_command - execute a command not yet
// handled by the core
//-------------------------------------------------
bool osd_common_t::execute_command(const char *command)
{
if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
{
network_init();
osd_list_network_adapters();
network_exit();
return true;
}
else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
{
osd_list_midi_devices();
return true;
}
return false;
}
void osd_common_t::init_subsystems()
{
if (!video_init())
@ -537,15 +566,6 @@ bool osd_common_t::midi_init()
return osd_midi_init();
}
//-------------------------------------------------
// list_midi_devices - list available midi devices
//-------------------------------------------------
void osd_common_t::list_midi_devices(void)
{
osd_list_midi_devices();
}
void osd_common_t::midi_exit()
{
osd_midi_exit();

View File

@ -20,9 +20,8 @@
// Defines
//============================================================
/* FIXME: void cli_frontend::listnetworkadapters should be
* moved here.
*/
#define OSDCOMMAND_LIST_MIDI_DEVICES "listmidi"
#define OSDCOMMAND_LIST_NETWORK_ADAPTERS "listnetwork"
#define OSDOPTION_DEBUGGER "debugger"
#define OSDOPTION_WATCHDOG "watchdog"
@ -161,17 +160,8 @@ public:
// video overridables
virtual void *get_slider_list();
// midi overridables
// FIXME: this should return a list of devices, not list them on stdout
virtual void list_midi_devices(void);
virtual void list_network_adapters()
{
network_init();
osd_list_network_adapters();
network_exit();
}
// command option overrides
virtual bool execute_command(const char *command);
// FIXME: everything below seems to be osd specific and not part of
// this INTERFACE but part of the osd IMPLEMENTATION
@ -193,8 +183,6 @@ public:
virtual bool sound_init();
virtual void sound_register();
virtual bool input_init();
virtual void input_pause();
virtual void input_resume();
virtual bool output_init();
virtual bool network_init();
@ -217,6 +205,10 @@ public:
osd_options &options() { return m_options; }
protected:
virtual bool input_init();
virtual void input_pause();
private:
// internal state
running_machine * m_machine;

View File

@ -1,2 +0,0 @@
#include "osdepend.h"

View File

@ -49,7 +49,6 @@ public:
virtual void set_mastervolume(int attenuation) = 0;
virtual bool no_sound() = 0;
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
@ -61,12 +60,8 @@ public:
// video overridables
virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
// midi overridables
// FIXME: this should return a list of devices, not list them on stdout, even better
// move this to OSD_OPTIONS
virtual void list_midi_devices(void) = 0;
virtual void list_network_adapters() = 0;
// command option overrides
virtual bool execute_command(const char *command) = 0;
};