diff options
author | Aaron Giles <aaron@aarongiles.com> | 2011-04-13 20:31:00 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2011-04-13 20:31:00 +0000 |
commit | 00d745ca7752d2f96e842a7f23e157c0d2c40bdf (patch) | |
tree | 9b6a3dcda7d0ff05b098fe0823fe4d09f6d0e6b4 /src/emu/clifront.h | |
parent | f99e1a5da63f996cd07fae98d42c2e5ff389adef (diff) |
(Big tangle of changes that all happened as I was looking into the ROM
loader rewrite, which is still in progress....)
Replaced mamedriv.c with a new driver list mechanism that is generated
by the build tools. The emulator core now expects the presence of a
file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of
driver names, one per line. C and C++ comments are still permitted.
This file is parsed by a new build tool makelist which extracts the
driver names, sorts them, and generates a file called drivlist.c, which
is consumed by the core. [Aaron Giles]
Added new osdcore function osd_malloc_array() which is identical to
osd_malloc() but obviously hints that the underlying allocation is for
an array. Updated all callers to use the appropriate form. Modified the
Windows allocator to only use guard pages for array-style allocations,
allowing us to enable them once again in debug builds. [Aaron Giles]
Created new static class driver_list to wrap accesses to the list of
available drivers. Improved speed of driver lookups by relying on the
presorting done by makelist. [Aaron Giles]
Created helper class driver_enumerator as a helper for iterating through
the list of drivers. This class supports basic filtering and iteration,
and also serves as a temporary cache of machine_configs. [Aaron Giles]
Created cli_frontend object to wrap all the CLI handling code in
clifront.c. Updated/simplified all the code to take advantage of the
driver_enumerator. [Aaron Giles]
Created media_auditor object to wrap all the auditing functions in
audit.c. Updated all users to the new interface. Note that the new
auditing mechanism is slightly out of sync with the romload code in
terms of finding ROMs owned by devices, so it may mis-report some
issues until the new ROM loading code is in. [Aaron Giles]
Added concept of a per-device searchpath. For most devices, their
searchpath is just the short name of the device. For driver_devices, the
searchpath is driver[;parent[;bios]]. This searchpath will eventually be
used by the rom loader to find ROMs. For now it is used by the media
auditor only. [Aaron Giles]
Created info_xml_creator object to wrap all the info generation functions
in info.c. Converted the file to C++ and cleaned up the input processing
code. [Aaron Giles]
(not for whatsnew ... Known issues: auditing of CHDs appears busted, and
debug builds report unfreed memory if you use the built-in game picker)
Diffstat (limited to 'src/emu/clifront.h')
-rw-r--r-- | src/emu/clifront.h | 84 |
1 files changed, 69 insertions, 15 deletions
diff --git a/src/emu/clifront.h b/src/emu/clifront.h index d240fdf160f..2870309c7a4 100644 --- a/src/emu/clifront.h +++ b/src/emu/clifront.h @@ -80,6 +80,7 @@ // TYPE DEFINITIONS //************************************************************************** +// cli_options wraps the general emu options with CLI-specific additions class cli_options : public emu_options { public: @@ -91,22 +92,75 @@ private: }; +// cli_frontend handles command-line processing and emulator execution +class cli_frontend +{ +public: + // construction/destruction + cli_frontend(cli_options &options, osd_interface &osd); + ~cli_frontend(); + + // execute based on the incoming argc/argv + int execute(int argc, char **argv); + + // direct access to the command operations + void listxml(const char *gamename = "*"); + void listfull(const char *gamename = "*"); + void listsource(const char *gamename = "*"); + void listclones(const char *gamename = "*"); + void listbrothers(const char *gamename = "*"); + void listcrc(const char *gamename = "*"); + void listroms(const char *gamename = "*"); + void listsamples(const char *gamename = "*"); + void listdevices(const char *gamename = "*"); + void listmedia(const char *gamename = "*"); + void verifyroms(const char *gamename = "*"); + void verifysamples(const char *gamename = "*"); + void romident(const char *filename); + +private: + // internal helpers + void execute_commands(const char *exename); + void display_help(); + void display_suggestions(const char *gamename); + + // internal state + cli_options & m_options; + osd_interface & m_osd; + int m_result; +}; + + +// media_identifier class identifies media by hash via a search in +// the driver database +class media_identifier +{ +public: + // construction/destruction + media_identifier(cli_options &options); + + // getters + const char *result() const { return m_result; } + int total() const { return m_total; } + int matches() const { return m_matches; } + int nonroms() const { return m_nonroms; } + + // operations + void reset() { m_total = m_matches = m_nonroms = 0; m_result.reset(); } + void identify(const char *name); + void identify_file(const char *name); + void identify_data(const char *name, const UINT8 *data, int length); + int find_by_hash(const hash_collection &hashes, int length); + +private: + // internal state + driver_enumerator m_drivlist; + astring m_result; + int m_total; + int m_matches; + int m_nonroms; +}; -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ -int cli_execute(cli_options &options, osd_interface &osd, int argc, char **argv); - -/* informational functions */ -void cli_info_listxml(emu_options &options, const char *gamename); -void cli_info_listfull(emu_options &options, const char *gamename); -void cli_info_listsource(emu_options &options, const char *gamename); -void cli_info_listclones(emu_options &options, const char *gamename); -void cli_info_listbrothers(emu_options &options, const char *gamename); -void cli_info_listcrc(emu_options &options, const char *gamename); -void cli_info_listroms(emu_options &options, const char *gamename); -void cli_info_listsamples(emu_options &options, const char *gamename); -void cli_info_listdevices(emu_options &options, const char *gamename); #endif /* __CLIFRONT_H__ */ |