apply -verbose after processing command-line options and after first pass over .ini files (nw)

This commit is contained in:
Vas Crabb 2019-01-12 18:17:13 +11:00
parent b053f0d483
commit 19612b1f10
7 changed files with 55 additions and 49 deletions

View File

@ -183,9 +183,9 @@ void print_summary(
//-------------------------------------------------
cli_frontend::cli_frontend(emu_options &options, osd_interface &osd)
: m_options(options),
m_osd(osd),
m_result(EMU_ERR_NONE)
: m_options(options)
, m_osd(osd)
, m_result(EMU_ERR_NONE)
{
m_options.add_entries(cli_option_entries);
}
@ -211,6 +211,7 @@ void cli_frontend::start_execution(mame_machine_manager *manager, const std::vec
try
{
m_options.parse_command_line(args, OPTION_PRIORITY_CMDLINE);
m_osd.set_verbose(m_options.verbose());
}
catch (options_exception &ex)
{
@ -234,7 +235,10 @@ void cli_frontend::start_execution(mame_machine_manager *manager, const std::vec
// read INI's, if appropriate
if (m_options.read_config())
{
mame_options::parse_standard_inis(m_options, option_errors);
m_osd.set_verbose(m_options.verbose());
}
// otherwise, check for a valid system
load_translation(m_options);

View File

@ -31,12 +31,11 @@
mame_machine_manager* mame_machine_manager::m_manager = nullptr;
mame_machine_manager* mame_machine_manager::instance(emu_options &options,osd_interface &osd)
mame_machine_manager* mame_machine_manager::instance(emu_options &options, osd_interface &osd)
{
if(!m_manager)
{
m_manager = global_alloc(mame_machine_manager(options,osd));
}
if (!m_manager)
m_manager = global_alloc(mame_machine_manager(options, osd));
return m_manager;
}
@ -49,13 +48,13 @@ mame_machine_manager* mame_machine_manager::instance()
// mame_machine_manager - constructor
//-------------------------------------------------
mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &osd)
: machine_manager(options, osd),
m_plugins(std::make_unique<plugin_options>()),
m_lua(global_alloc(lua_engine)),
m_new_driver_pending(nullptr),
m_firstrun(true),
m_autoboot_timer(nullptr)
mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &osd) :
machine_manager(options, osd),
m_plugins(std::make_unique<plugin_options>()),
m_lua(global_alloc(lua_engine)),
m_new_driver_pending(nullptr),
m_firstrun(true),
m_autoboot_timer(nullptr)
{
}
@ -100,7 +99,8 @@ std::vector<std::string> split(const std::string &text, char sep)
{
std::vector<std::string> tokens;
std::size_t start = 0, end = 0;
while ((end = text.find(sep, start)) != std::string::npos) {
while ((end = text.find(sep, start)) != std::string::npos)
{
std::string temp = text.substr(start, end - start);
if (temp != "") tokens.push_back(temp);
start = end + 1;
@ -120,8 +120,8 @@ void mame_machine_manager::start_luaengine()
{
m_plugins->parse_json(pluginpath);
}
std::vector<std::string> include = split(options().plugin(),',');
std::vector<std::string> exclude = split(options().no_plugin(),',');
std::vector<std::string> include = split(options().plugin(), ',');
std::vector<std::string> exclude = split(options().no_plugin(), ',');
{
// parse the file
// attempt to open the output file

View File

@ -15,26 +15,20 @@
class plugin_options;
class osd_interface;
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class lua_engine;
class cheat_manager;
class inifile_manager;
class favorite_manager;
class mame_ui_manager;
namespace ui {
} // namespace ui
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> machine_manager
class mame_machine_manager : public machine_manager
{
DISABLE_COPYING(mame_machine_manager);
private:
// construction/destruction
mame_machine_manager(emu_options &options, osd_interface &osd);
public:
static mame_machine_manager *instance(emu_options &options, osd_interface &osd);
static mame_machine_manager *instance();
@ -64,7 +58,15 @@ public:
cheat_manager &cheat() const { assert(m_cheat != nullptr); return *m_cheat; }
inifile_manager &inifile() const { assert(m_inifile != nullptr); return *m_inifile; }
favorite_manager &favorite() const { assert(m_favorite != nullptr); return *m_favorite; }
private:
// construction
mame_machine_manager(emu_options &options, osd_interface &osd);
mame_machine_manager(mame_machine_manager const &) = delete;
mame_machine_manager(mame_machine_manager &&) = delete;
mame_machine_manager &operator=(mame_machine_manager const &) = delete;
mame_machine_manager &operator=(mame_machine_manager &&) = delete;
std::unique_ptr<plugin_options> m_plugins; // pointer to plugin options
lua_engine * m_lua;

View File

@ -39,8 +39,8 @@ void mame_options::parse_standard_inis(emu_options &options, std::ostream &error
parse_one_ini(options, "debug", OPTION_PRIORITY_DEBUG_INI, &error_stream);
// if we have a valid system driver, parse system-specific INI files
const game_driver *cursystem = (driver == nullptr) ? system(options) : driver;
if (cursystem == nullptr)
game_driver const *const cursystem = !driver ? system(options) : driver;
if (!cursystem)
return;
// parse "vertical.ini" or "horizont.ini"

View File

@ -163,7 +163,7 @@ const options_entry osd_options::s_option_entries[] =
};
osd_options::osd_options()
: emu_options()
: emu_options()
{
add_entries(osd_options::s_option_entries);
}
@ -176,20 +176,20 @@ std::list<std::shared_ptr<osd_window>> osd_common_t::s_window_list;
//-------------------------------------------------
osd_common_t::osd_common_t(osd_options &options)
: osd_output(), m_machine(nullptr),
m_options(options),
m_print_verbose(false),
m_font_module(nullptr),
m_sound(nullptr),
m_debugger(nullptr),
m_midi(nullptr),
m_keyboard_input(nullptr),
m_mouse_input(nullptr),
m_lightgun_input(nullptr),
m_joystick_input(nullptr),
m_output(nullptr),
m_monitor_module(nullptr),
m_watchdog(nullptr)
: osd_output(), m_machine(nullptr)
, m_options(options)
, m_print_verbose(false)
, m_font_module(nullptr)
, m_sound(nullptr)
, m_debugger(nullptr)
, m_midi(nullptr)
, m_keyboard_input(nullptr)
, m_mouse_input(nullptr)
, m_lightgun_input(nullptr)
, m_joystick_input(nullptr)
, m_output(nullptr)
, m_monitor_module(nullptr)
, m_watchdog(nullptr)
{
osd_output::push(this);
}
@ -409,7 +409,6 @@ void osd_common_t::output_callback(osd_output_channel channel, const char *msg,
void osd_common_t::init(running_machine &machine)
{
//
// This function is responsible for initializing the OSD-specific
// video and input functionality, and registering that functionality
// with the MAME core.
@ -437,7 +436,6 @@ void osd_common_t::init(running_machine &machine)
//
// Audio initialization may eventually move into here as well,
// instead of relying on independent callbacks from each system.
//
m_machine = &machine;

View File

@ -245,11 +245,12 @@ public:
// osd_output interface ...
virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override;
bool verbose() const { return m_print_verbose; }
void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; }
virtual void set_verbose(bool print_verbose) override { m_print_verbose = print_verbose; }
void notify(const char *outname, int32_t value) const { m_output->notify(outname, value); }
static std::list<std::shared_ptr<osd_window>> s_window_list;
protected:
virtual bool input_init();
virtual void input_pause();

View File

@ -7,11 +7,11 @@
OS-dependent code interface.
*******************************************************************c********/
#ifndef MAME_OSD_OSDEPEND_H
#define MAME_OSD_OSDEPEND_H
#pragma once
#ifndef MAME_OSD_OSDEPEND_H
#define MAME_OSD_OSDEPEND_H
#include "emucore.h"
#include "osdcore.h"
@ -64,6 +64,7 @@ public:
// general overridables
virtual void init(running_machine &machine) = 0;
virtual void update(bool skip_redraw) = 0;
virtual void set_verbose(bool print_verbose) = 0;
// debugger overridables
virtual void init_debugger() = 0;