mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
Added none and console output providers (nw)
This commit is contained in:
parent
39c9c8c5dc
commit
2f974586d6
@ -87,6 +87,9 @@ function osdmodulesbuild()
|
||||
MAME_DIR .. "src/osd/modules/input/input_xinput.cpp",
|
||||
MAME_DIR .. "src/osd/modules/input/input_xinput.h",
|
||||
MAME_DIR .. "src/osd/modules/input/input_winhybrid.cpp",
|
||||
MAME_DIR .. "src/osd/modules/output/output_module.h",
|
||||
MAME_DIR .. "src/osd/modules/output/none.cpp",
|
||||
MAME_DIR .. "src/osd/modules/output/console.cpp",
|
||||
}
|
||||
|
||||
if _OPTIONS["targetos"]=="windows" then
|
||||
|
@ -93,6 +93,9 @@ project ("osd_" .. _OPTIONS["osd"])
|
||||
MAME_DIR .. "src/osd/modules/input/input_windows.cpp",
|
||||
MAME_DIR .. "src/osd/modules/input/input_windows.h",
|
||||
MAME_DIR .. "src/osd/modules/input/input_xinput.cpp",
|
||||
MAME_DIR .. "src/osd/modules/output/output_module.h",
|
||||
MAME_DIR .. "src/osd/modules/output/none.cpp",
|
||||
MAME_DIR .. "src/osd/modules/output/console.cpp",
|
||||
}
|
||||
|
||||
project ("ocore_" .. _OPTIONS["osd"])
|
||||
|
@ -25,6 +25,9 @@ const options_entry osd_options::s_option_entries[] =
|
||||
{ nullptr, nullptr, OPTION_HEADER, "OSD FONT OPTIONS" },
|
||||
{ OSD_FONT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for ui font: " },
|
||||
|
||||
{ nullptr, nullptr, OPTION_HEADER, "OSD OUTPUT OPTIONS" },
|
||||
{ OSD_OUTPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for output: " },
|
||||
|
||||
{ nullptr, nullptr, OPTION_HEADER, "OSD INPUT OPTIONS" },
|
||||
{ OSD_KEYBOARDINPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for keyboard input: " },
|
||||
{ OSD_MOUSEINPUT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for mouse input: " },
|
||||
@ -171,7 +174,8 @@ osd_common_t::osd_common_t(osd_options &options)
|
||||
m_keyboard_input(nullptr),
|
||||
m_mouse_input(nullptr),
|
||||
m_lightgun_input(nullptr),
|
||||
m_joystick_input(nullptr)
|
||||
m_joystick_input(nullptr),
|
||||
m_output(nullptr)
|
||||
{
|
||||
osd_output::push(this);
|
||||
}
|
||||
@ -245,6 +249,10 @@ void osd_common_t::register_options()
|
||||
REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_DINPUT);
|
||||
REGISTER_MODULE(m_mod_man, JOYSTICKINPUT_XINPUT);
|
||||
REGISTER_MODULE(m_mod_man, JOYSTICK_NONE);
|
||||
|
||||
REGISTER_MODULE(m_mod_man, OUTPUT_NONE);
|
||||
REGISTER_MODULE(m_mod_man, OUTPUT_CONSOLE);
|
||||
|
||||
|
||||
// after initialization we know which modules are supported
|
||||
|
||||
@ -302,6 +310,12 @@ void osd_common_t::register_options()
|
||||
dnames.push_back(names[i]);
|
||||
update_option(OSD_DEBUG_PROVIDER, dnames);
|
||||
|
||||
m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, &num, names);
|
||||
dnames.clear();
|
||||
for (int i = 0; i < num; i++)
|
||||
dnames.push_back(names[i]);
|
||||
update_option(OSD_OUTPUT_PROVIDER, dnames);
|
||||
|
||||
// Register video options and update options
|
||||
video_options_add("none", nullptr);
|
||||
#if USE_OPENGL
|
||||
@ -565,6 +579,12 @@ bool osd_common_t::execute_command(const char *command)
|
||||
|
||||
}
|
||||
|
||||
static void output_notifier_callback(const char *outname, INT32 value, void *param)
|
||||
{
|
||||
osd_common_t *osd = (osd_common_t*)param;
|
||||
osd->notify(outname, value);
|
||||
}
|
||||
|
||||
void osd_common_t::init_subsystems()
|
||||
{
|
||||
if (!video_init())
|
||||
@ -576,8 +596,6 @@ void osd_common_t::init_subsystems()
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
output_init();
|
||||
|
||||
m_keyboard_input = select_module_options<input_module *>(options(), OSD_KEYBOARDINPUT_PROVIDER);
|
||||
m_mouse_input = select_module_options<input_module *>(options(), OSD_MOUSEINPUT_PROVIDER);
|
||||
m_lightgun_input = select_module_options<input_module *>(options(), OSD_LIGHTGUNINPUT_PROVIDER);
|
||||
@ -593,6 +611,9 @@ void osd_common_t::init_subsystems()
|
||||
select_module_options<netdev_module *>(options(), OSD_NETDEV_PROVIDER);
|
||||
|
||||
m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);
|
||||
|
||||
m_output = select_module_options<output_module *>(options(), OSD_OUTPUT_PROVIDER);
|
||||
machine().output().set_notifier(NULL, output_notifier_callback, this);
|
||||
|
||||
m_mod_man.init(options());
|
||||
|
||||
@ -646,16 +667,10 @@ void osd_common_t::input_resume()
|
||||
m_joystick_input->resume();
|
||||
}
|
||||
|
||||
bool osd_common_t::output_init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void osd_common_t::exit_subsystems()
|
||||
{
|
||||
video_exit();
|
||||
input_exit();
|
||||
output_exit();
|
||||
}
|
||||
|
||||
void osd_common_t::video_exit()
|
||||
@ -674,10 +689,6 @@ void osd_common_t::input_exit()
|
||||
m_joystick_input->exit();
|
||||
}
|
||||
|
||||
void osd_common_t::output_exit()
|
||||
{
|
||||
}
|
||||
|
||||
void osd_common_t::osd_exit()
|
||||
{
|
||||
m_mod_man.exit();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "modules/debugger/debug_module.h"
|
||||
#include "modules/netdev/netdev_module.h"
|
||||
#include "modules/midi/midi_module.h"
|
||||
#include "modules/output/output_module.h"
|
||||
#include "cliopts.h"
|
||||
|
||||
//============================================================
|
||||
@ -213,13 +214,11 @@ public:
|
||||
virtual bool window_init();
|
||||
|
||||
virtual void input_resume();
|
||||
virtual bool output_init();
|
||||
|
||||
virtual void exit_subsystems();
|
||||
virtual void video_exit();
|
||||
virtual void window_exit();
|
||||
virtual void input_exit();
|
||||
virtual void output_exit();
|
||||
|
||||
virtual void osd_exit();
|
||||
|
||||
@ -232,6 +231,7 @@ public:
|
||||
bool verbose() const { return m_print_verbose; }
|
||||
void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; }
|
||||
|
||||
void notify(const char *outname, INT32 value) { m_output->notify(outname, value); }
|
||||
protected:
|
||||
virtual bool input_init();
|
||||
virtual void input_pause();
|
||||
@ -278,6 +278,7 @@ protected:
|
||||
input_module* m_mouse_input;
|
||||
input_module* m_lightgun_input;
|
||||
input_module* m_joystick_input;
|
||||
output_module* m_output;
|
||||
private:
|
||||
std::vector<const char *> m_video_names;
|
||||
};
|
||||
|
32
src/osd/modules/output/console.cpp
Normal file
32
src/osd/modules/output/console.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
/***************************************************************************
|
||||
|
||||
console.cpp
|
||||
|
||||
Console output interface.
|
||||
|
||||
*******************************************************************c********/
|
||||
|
||||
#include "output_module.h"
|
||||
#include "modules/osdmodule.h"
|
||||
|
||||
class output_console : public osd_module, public output_module
|
||||
{
|
||||
public:
|
||||
output_console()
|
||||
: osd_module(OSD_OUTPUT_PROVIDER, "console"), output_module()
|
||||
{
|
||||
}
|
||||
virtual ~output_console() { }
|
||||
|
||||
virtual int init(const osd_options &options) override { return 0; }
|
||||
virtual void exit() override { }
|
||||
|
||||
// output_module
|
||||
|
||||
virtual void notify(const char *outname, INT32 value) override { osd_printf_info("%s = %d\n", ((outname==nullptr) ? "none" : outname), value); }
|
||||
|
||||
};
|
||||
|
||||
MODULE_DEFINITION(OUTPUT_CONSOLE, output_console)
|
32
src/osd/modules/output/none.cpp
Normal file
32
src/osd/modules/output/none.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
/***************************************************************************
|
||||
|
||||
none.cpp
|
||||
|
||||
Dummy output interface.
|
||||
|
||||
*******************************************************************c********/
|
||||
|
||||
#include "output_module.h"
|
||||
#include "modules/osdmodule.h"
|
||||
|
||||
class output_none : public osd_module, public output_module
|
||||
{
|
||||
public:
|
||||
output_none()
|
||||
: osd_module(OSD_OUTPUT_PROVIDER, "none"), output_module()
|
||||
{
|
||||
}
|
||||
virtual ~output_none() { }
|
||||
|
||||
virtual int init(const osd_options &options) override { return 0; }
|
||||
virtual void exit() override { }
|
||||
|
||||
// output_module
|
||||
|
||||
virtual void notify(const char *outname, INT32 value) override { }
|
||||
|
||||
};
|
||||
|
||||
MODULE_DEFINITION(OUTPUT_NONE, output_none)
|
30
src/osd/modules/output/output_module.h
Normal file
30
src/osd/modules/output/output_module.h
Normal file
@ -0,0 +1,30 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
/*
|
||||
* outpout_module.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OUTPUT_MODULE_H_
|
||||
#define OUTPUT_MODULE_H_
|
||||
|
||||
#include "osdepend.h"
|
||||
#include "modules/osdmodule.h"
|
||||
|
||||
//============================================================
|
||||
// CONSTANTS
|
||||
//============================================================
|
||||
|
||||
#define OSD_OUTPUT_PROVIDER "output"
|
||||
|
||||
class output_module
|
||||
{
|
||||
public:
|
||||
output_module() { }
|
||||
|
||||
virtual ~output_module() { }
|
||||
|
||||
virtual void notify(const char *outname, INT32 value) = 0;
|
||||
};
|
||||
|
||||
#endif /* OUTPUT_MODULE_H_ */
|
Loading…
Reference in New Issue
Block a user