Create new class osd_interface to house OSD callbacks. Added new

module osdepend.c with default empty implementations. Changed
mame_execute() and cli_execute() to accept a reference to an
osd_interface which is provided by the caller.

Updated SDL and Windows OSD to create an osd_interface-derived
class and moved their OSD callbacks to be members.
This commit is contained in:
Aaron Giles 2010-10-21 15:59:44 +00:00
parent f3be589604
commit e4beed95a6
30 changed files with 529 additions and 318 deletions

1
.gitattributes vendored
View File

@ -4187,6 +4187,7 @@ src/mame/video/zerozone.c svneol=native#text/plain
src/mame/video/zodiack.c svneol=native#text/plain
src/osd/osdcomm.h svneol=native#text/plain
src/osd/osdcore.h svneol=native#text/plain
src/osd/osdepend.c svneol=native#text/plain
src/osd/osdepend.h svneol=native#text/plain
src/osd/osdmini/minidir.c svneol=native#text/plain
src/osd/osdmini/minifile.c svneol=native#text/plain

View File

@ -112,7 +112,7 @@ static const options_entry cli_options[] =
command line interface
-------------------------------------------------*/
int cli_execute(int argc, char **argv, const options_entry *osd_options)
int cli_execute(int argc, char **argv, osd_interface &osd, const options_entry *osd_options)
{
core_options *options = NULL;
const char *gamename_option;
@ -172,7 +172,7 @@ int cli_execute(int argc, char **argv, const options_entry *osd_options)
}
/* run the game */
result = mame_execute(options);
result = mame_execute(osd, options);
}
catch (emu_fatalerror &fatal)
{

View File

@ -47,7 +47,7 @@
FUNCTION PROTOTYPES
***************************************************************************/
int cli_execute(int argc, char **argv, const options_entry *osd_options);
int cli_execute(int argc, char **argv, osd_interface &osd, const options_entry *osd_options);
/* informational functions */
int cli_info_listxml(core_options *options, const char *gamename);

View File

@ -1916,7 +1916,8 @@ void device_debug::exception_hook(int exception)
void device_debug::instruction_hook(offs_t curpc)
{
debugcpu_private *global = m_device.machine->debugcpu_data;
running_machine &machine = *m_device.machine;
debugcpu_private *global = machine.debugcpu_data;
// note that we are in the debugger code
global->within_instruction_hook = true;
@ -1949,9 +1950,9 @@ void device_debug::instruction_hook(offs_t curpc)
// update every 100 steps until we are within 200 of the end
else if ((m_flags & DEBUG_FLAG_STEPPING_OUT) == 0 && (m_stepsleft < 200 || m_stepsleft % 100 == 0))
{
m_device.machine->debug_view().update_all();
m_device.machine->debug_view().flush_osd_updates();
debugger_refresh_display(m_device.machine);
machine.debug_view().update_all();
machine.debug_view().flush_osd_updates();
debugger_refresh_display(&machine);
}
}
}
@ -1960,16 +1961,16 @@ void device_debug::instruction_hook(offs_t curpc)
if (global->execution_state != EXECUTION_STATE_STOPPED && (m_flags & (DEBUG_FLAG_STOP_TIME | DEBUG_FLAG_STOP_PC | DEBUG_FLAG_LIVE_BP)) != 0)
{
// see if we hit a target time
if ((m_flags & DEBUG_FLAG_STOP_TIME) != 0 && attotime_compare(timer_get_time(m_device.machine), m_stoptime) >= 0)
if ((m_flags & DEBUG_FLAG_STOP_TIME) != 0 && attotime_compare(timer_get_time(&machine), m_stoptime) >= 0)
{
debug_console_printf(m_device.machine, "Stopped at time interval %.1g\n", attotime_to_double(timer_get_time(m_device.machine)));
debug_console_printf(&machine, "Stopped at time interval %.1g\n", attotime_to_double(timer_get_time(&machine)));
global->execution_state = EXECUTION_STATE_STOPPED;
}
// check the temp running breakpoint and break if we hit it
else if ((m_flags & DEBUG_FLAG_STOP_PC) != 0 && m_stopaddr == curpc)
{
debug_console_printf(m_device.machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag());
debug_console_printf(&machine, "Stopped at temporary breakpoint %X on CPU '%s'\n", m_stopaddr, m_device.tag());
global->execution_state = EXECUTION_STATE_STOPPED;
}
@ -1981,7 +1982,7 @@ void device_debug::instruction_hook(offs_t curpc)
// if we are supposed to halt, do it now
if (global->execution_state == EXECUTION_STATE_STOPPED)
{
int firststop = true;
bool firststop = true;
// load comments if we haven't yet
if (!global->comments_loaded)
@ -1998,7 +1999,7 @@ void device_debug::instruction_hook(offs_t curpc)
global->visiblecpu = &m_device;
// update all views
m_device.machine->debug_view().update_all();
machine.debug_view().update_all();
debugger_refresh_display(m_device.machine);
// wait for the debugger; during this time, disable sound output
@ -2006,20 +2007,20 @@ void device_debug::instruction_hook(offs_t curpc)
while (global->execution_state == EXECUTION_STATE_STOPPED)
{
// flush any pending updates before waiting again
m_device.machine->debug_view().flush_osd_updates();
machine.debug_view().flush_osd_updates();
// clear the memory modified flag and wait
global->memory_modified = false;
if (m_device.machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
osd_wait_for_debugger(&m_device, firststop);
else if (m_device.machine->debug_flags & DEBUG_FLAG_ENABLED)
debugint_wait_for_debugger(&m_device, firststop);
if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
machine.osd().wait_for_debugger(m_device, firststop);
else if (machine.debug_flags & DEBUG_FLAG_ENABLED)
debugint_wait_for_debugger(m_device, firststop);
firststop = false;
// if something modified memory, update the screen
if (global->memory_modified)
{
m_device.machine->debug_view().update_all(DVT_DISASSEMBLY);
machine.debug_view().update_all(DVT_DISASSEMBLY);
debugger_refresh_display(m_device.machine);
}
@ -2027,7 +2028,7 @@ void device_debug::instruction_hook(offs_t curpc)
process_source_file(m_device.machine);
// if an event got scheduled, resume
if (m_device.machine->scheduled_event_pending())
if (machine.scheduled_event_pending())
global->execution_state = EXECUTION_STATE_RUNNING;
}
sound_mute(m_device.machine, false);

View File

@ -92,7 +92,7 @@ void debugger_init(running_machine *machine)
machine->add_logerror_callback(debug_errorlog_write_line);
/* initialize osd debugger features */
osd_init_debugger(machine);
machine->osd().init_debugger();
}
}

View File

@ -1439,7 +1439,7 @@ static void update_views(void)
}
void debugint_wait_for_debugger(running_device *device, int firststop)
void debugint_wait_for_debugger(running_device &device, bool firststop)
{
if (firststop && list == NULL)
@ -1447,28 +1447,28 @@ void debugint_wait_for_debugger(running_device *device, int firststop)
DView *dv;
render_target *target;
target = &device->machine->render().ui_target();
target = &device.machine->render().ui_target();
//set_view_by_name(target, "Debug");
dv = dview_alloc(target, device->machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
dv = dview_alloc(target, device.machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
dv->editor.active = TRUE;
dv->editor.container = &device->machine->render().ui_container();
dv = dview_alloc(target, device->machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU);
dv = dview_alloc(target, device->machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
dv->editor.container = &device.machine->render().ui_container();
dv = dview_alloc(target, device.machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU);
dv = dview_alloc(target, device.machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
dview_set_title(dv, "Console");
dv->editor.active = TRUE;
dv->editor.container = &device->machine->render().ui_container();
dv->editor.container = &device.machine->render().ui_container();
set_focus_view(dv);
}
followers_set_cpu(device);
followers_set_cpu(&device);
//ui_update_and_render(device->machine, &device->machine->render().ui_container()());
//ui_update_and_render(device.machine, &device.machine->render().ui_container()());
update_views();
osd_update(device->machine, FALSE);
handle_menus(device->machine);
handle_mouse(device->machine);
device.machine->osd().update(false);
handle_menus(device.machine);
handle_mouse(device.machine);
//osd_sleep(osd_ticks_per_second()/60);
}

View File

@ -39,7 +39,7 @@
void debugint_init(running_machine *machine);
/* process events for internal debugger */
void debugint_wait_for_debugger(running_device *device, int firststop);
void debugint_wait_for_debugger(running_device &device, bool firststop);
/* update the internal debugger during a game */
void debugint_update_during_game(running_machine *machine);

View File

@ -30,6 +30,11 @@ OBJDIRS += \
$(EMUOBJ)/layout \
$(EMUOBJ)/video \
OSDSRC = $(SRC)/osd
OSDOBJ = $(OBJ)/osd
OBJDIRS += \
$(OSDOBJ)
#-------------------------------------------------
@ -110,7 +115,8 @@ EMUOBJS = \
$(EMUOBJ)/debug/express.o \
$(EMUOBJ)/debug/textbuf.o \
$(EMUOBJ)/debugint/debugint.o \
$(EMUOBJ)/profiler.o
$(EMUOBJ)/profiler.o \
$(OSDOBJ)/osdepend.o
EMUSOUNDOBJS = \
$(EMUOBJ)/sound/filter.o \

View File

@ -1881,7 +1881,7 @@ static void init_port_types(running_machine *machine)
}
/* ask the OSD to customize the list */
osd_customize_input_type_list(&portdata->typestatelist->typedesc);
machine->osd().customize_input_type_list(&portdata->typestatelist->typedesc);
/* now iterate over the OSD-modified types */
for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next)

View File

@ -138,7 +138,7 @@ static char giant_string_buffer[65536] = { 0 };
// running_machine - constructor
//-------------------------------------------------
running_machine::running_machine(const machine_config &_config, core_options &options, bool exit_to_game_select)
running_machine::running_machine(const machine_config &_config, osd_interface &osd, core_options &options, bool exit_to_game_select)
: m_regionlist(m_respool),
m_devicelist(m_respool),
config(&_config),
@ -176,6 +176,7 @@ running_machine::running_machine(const machine_config &_config, core_options &op
m_logerror_list(NULL),
m_scheduler(*this),
m_options(options),
m_osd(osd),
m_basename(_config.gamedrv().name),
m_current_phase(MACHINE_PHASE_PREINIT),
m_paused(false),
@ -284,7 +285,7 @@ void running_machine::start()
m_soft_reset_timer = timer_alloc(this, static_soft_reset, NULL);
// init the osd layer
osd_init(this);
m_osd.init(*this);
// initialize the base time (needed for doing record/playback)
time(&m_base_time);

View File

@ -182,6 +182,7 @@ class gfx_element;
class colortable_t;
class debug_view_manager;
class render_manager;
class osd_interface;
typedef struct _mame_private mame_private;
typedef struct _cpuexec_private cpuexec_private;
@ -337,7 +338,7 @@ class running_machine : public bindable_object
public:
// construction/destruction
running_machine(const machine_config &config, core_options &options, bool exit_to_game_select = false);
running_machine(const machine_config &config, osd_interface &osd, core_options &options, bool exit_to_game_select = false);
~running_machine();
// fetch items by name
@ -360,6 +361,7 @@ public:
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
const char *new_driver_name() const { return m_new_driver_pending->name; }
device_scheduler &scheduler() { return m_scheduler; }
osd_interface &osd() const { return m_osd; }
// immediate operations
int run(bool firstrun);
@ -493,6 +495,7 @@ private:
device_scheduler m_scheduler; // scheduler object
core_options & m_options;
osd_interface & m_osd;
astring m_context; // context string
astring m_basename; // basename used for game-related paths

View File

@ -149,7 +149,7 @@ int mame_is_valid_machine(running_machine *machine)
mame_execute - run the core emulation
-------------------------------------------------*/
int mame_execute(core_options *options)
int mame_execute(osd_interface &osd, core_options *options)
{
bool firstgame = true;
bool firstrun = true;
@ -192,7 +192,7 @@ int mame_execute(core_options *options)
const machine_config *config = global_alloc(machine_config(*driver));
// create the machine structure and driver
running_machine *machine = global_alloc(running_machine(*config, *options, started_empty));
running_machine *machine = global_alloc(running_machine(*config, osd, *options, started_empty));
// looooong term: remove this
global_machine = machine;

View File

@ -96,7 +96,7 @@ extern const char build_version[];
/* ----- core system management ----- */
/* execute as configured by the OPTION_GAMENAME option on the specified options */
int mame_execute(core_options *options);
int mame_execute(osd_interface &osd, core_options *options);
/* accesses the core_options for the currently running emulation */
core_options *mame_options(void);

View File

@ -212,14 +212,14 @@ static void sound_pause(running_machine &machine)
{
sound_private *global = machine.sound_data;
global->muted |= 0x02;
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
machine.osd().set_mastervolume(global->muted ? -32 : global->attenuation);
}
static void sound_resume(running_machine &machine)
{
sound_private *global = machine.sound_data;
global->muted &= ~0x02;
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
machine.osd().set_mastervolume(global->muted ? -32 : global->attenuation);
}
@ -235,7 +235,7 @@ void sound_mute(running_machine *machine, int mute)
global->muted |= 0x01;
else
global->muted &= ~0x01;
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
machine->osd().set_mastervolume(global->muted ? -32 : global->attenuation);
}
@ -247,7 +247,7 @@ void sound_set_attenuation(running_machine *machine, int attenuation)
{
sound_private *global = machine->sound_data;
global->attenuation = attenuation;
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
machine->osd().set_mastervolume(global->muted ? -32 : global->attenuation);
}
@ -408,7 +408,7 @@ static TIMER_CALLBACK( sound_update )
if (finalmix_offset > 0)
{
if (!global->nosound_mode)
osd_update_audio_stream(machine, finalmix, finalmix_offset / 2);
machine->osd().update_audio_stream(finalmix, finalmix_offset / 2);
video_avi_add_sound(machine, finalmix, finalmix_offset / 2);
if (global->wavfile != NULL)
wav_add_data_16(global->wavfile, finalmix, finalmix_offset);

View File

@ -467,7 +467,7 @@ void video_frame_update(running_machine *machine, int debug)
/* ask the OSD to update */
g_profiler.start(PROFILER_BLIT);
osd_update(machine, !debug && skipped_it);
machine->osd().update(!debug && skipped_it);
g_profiler.stop();
/* perform tasks for this frame */

198
src/osd/osdepend.c Normal file
View File

@ -0,0 +1,198 @@
/***************************************************************************
osdepend.c
OS-dependent code interface.
****************************************************************************
Copyright Aaron Giles
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*******************************************************************c********/
#include "osdepend.h"
//-------------------------------------------------
// osd_interface - constructor
//-------------------------------------------------
osd_interface::osd_interface()
: m_machine(NULL)
{
}
//-------------------------------------------------
// osd_interface - destructor
//-------------------------------------------------
osd_interface::~osd_interface()
{
}
//-------------------------------------------------
// init - initialize the OSD system.
//-------------------------------------------------
void osd_interface::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.
//
// In terms of video, this function is expected to create one or more
// render_targets that will be used by the MAME core to provide graphics
// data to the system. Although it is possible to do this later, the
// assumption in the MAME core is that the user interface will be
// visible starting at init() time, so you will have some work to
// do to avoid these assumptions.
//
// In terms of input, this function is expected to enumerate all input
// devices available and describe them to the MAME core by adding
// input devices and their attached items (buttons/axes) via the input
// system.
//
// Beyond these core responsibilities, init() should also initialize
// any other OSD systems that require information about the current
// running_machine.
//
// This callback is also the last opportunity to adjust the options
// before they are consumed by the rest of the core.
//
// Future work/changes:
//
// Audio initialization may eventually move into here as well,
// instead of relying on independent callbacks from each system.
//
m_machine = &machine;
}
//-------------------------------------------------
// update - periodic system update
//-------------------------------------------------
void osd_interface::update(bool skip_redraw)
{
//
// This method is called periodically to flush video updates to the
// screen, and also to allow the OSD a chance to update other systems
// on a regular basis. In general this will be called at the frame
// rate of the system being run; however, it may be called at more
// irregular intervals in some circumstances (e.g., multi-screen games
// or games with asynchronous updates).
//
}
//-------------------------------------------------
// init_debugger - perform debugger-specific
// initialization
//-------------------------------------------------
void osd_interface::init_debugger()
{
//
// Unlike init() above, this method is only called if the debugger
// is active. This gives any OSD debugger interface a chance to
// create all of its structures.
//
}
//-------------------------------------------------
// wait_for_debugger - wait for a debugger
// command to be processed
//-------------------------------------------------
void osd_interface::wait_for_debugger(device_t &device, bool firststop)
{
//
// When implementing an OSD-driver debugger, this method should be
// overridden to wait for input, process it, and return. It will be
// called repeatedly until a command is issued that resumes
// execution.
//
}
//-------------------------------------------------
// update_audio_stream - update the stereo audio
// stream
//-------------------------------------------------
void osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
{
//
// This method is called whenever the system has new audio data to stream.
// It provides an array of stereo samples in L-R order which should be
// output at the configured sample_rate.
//
}
//-------------------------------------------------
// set_mastervolume - set the system volume
//-------------------------------------------------
void osd_interface::set_mastervolume(int attenuation)
{
//
// Attenuation is the attenuation in dB (a negative number).
// To convert from dB to a linear volume scale do the following:
// volume = MAX_VOLUME;
// while (attenuation++ < 0)
// volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB
//
}
//-------------------------------------------------
// customize_input_type_list - provide OSD
// additions/modifications to the input list
//-------------------------------------------------
void osd_interface::customize_input_type_list(input_type_desc *typelist)
{
//
// inptport.c defines some general purpose defaults for key and joystick bindings.
// They may be further adjusted by the OS dependent code to better match the
// available keyboard, e.g. one could map pause to the Pause key instead of P, or
// snapshot to PrtScr instead of F12. Of course the user can further change the
// settings to anything he/she likes.
//
// This function is called on startup, before reading the configuration from disk.
// Scan the list, and change the keys/joysticks you want.
//
}

View File

@ -35,30 +35,6 @@
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
****************************************************************************
The prototypes in this file describe the interfaces that the MAME core
relies upon to interact with the outside world. They are broken out into
several categories.
The general flow for an OSD port of MAME is as follows:
- parse the command line or display the frontend
- call run_game (mame.c) with the index in the driver list of
the game selected
- osd_init() is called shortly afterwards; at this time, you are
expected to set up the display system and create render_targets
- the input system will call osd_get_code_list()
- the input port system will call osd_customize_inputport_list()
- the sound system will call osd_start_audio_stream()
- while the game runs, osd_update() will be called periodically
- when the game exits, we return from run_game()
- the OSD layer is now in control again
This process is expected to be in flux over the next several versions
(this was written during 0.109u2 development) as some of the OSD
responsibilities are pushed into the core.
*******************************************************************c********/
#pragma once
@ -70,114 +46,47 @@
#include "osdcore.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// forward references
class input_type_desc;
class device_t;
/*-----------------------------------------------------------------------------
osd_init: initialize the OSD system.
// ======================> osd_interface
Parameters:
// description of the currently-running machine
class osd_interface
{
public:
// construction/destruction
osd_interface();
virtual ~osd_interface();
// getters
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
machine - pointer to a structure that contains parameters for the
current "machine"
// general overridables
virtual void init(running_machine &machine);
virtual void update(bool skip_redraw);
Return value:
// debugger overridables
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
// audio overridables
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
None
Notes:
This function is responsible for initializing the OSD-specific
video and input functionality, and registering that functionality
with the MAME core.
In terms of video, this function is expected to create one or more
render_targets that will be used by the MAME core to provide graphics
data to the system. Although it is possible to do this later, the
assumption in the MAME core is that the user interface will be
visible starting at osd_init() time, so you will have some work to
do to avoid these assumptions.
In terms of input, this function is expected to enumerate all input
devices available and describe them to the MAME core by adding
input devices and their attached items (buttons/axes) via the input
system.
Beyond these core responsibilities, osd_init() should also initialize
any other OSD systems that require information about the current
running_machine.
This callback is also the last opportunity to adjust the options
before they are consumed by the rest of the core.
Note that there is no corresponding osd_exit(). Rather, like most
systems in MAME, you can register an exit callback via the
add_notifier() function in mame.c.
Also note that there is no return value. If you need to report a
fatal error, use the fatalerror() function with a friendly message
to the user.
Future work/changes:
Audio initialization may eventually move into here as well,
instead of relying on independent callbacks from each system.
-----------------------------------------------------------------------------*/
void osd_init(running_machine *machine);
void osd_init_debugger(running_machine *machine);
void osd_wait_for_debugger(device_t *device, int firststop);
/******************************************************************************
Display
******************************************************************************/
void osd_update(running_machine *machine, int skip_redraw);
/******************************************************************************
Sound
******************************************************************************/
void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int samples_this_frame);
/*
control master volume. attenuation is the attenuation in dB (a negative
number). To convert from dB to a linear volume scale do the following:
volume = MAX_VOLUME;
while (attenuation++ < 0)
volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB
*/
void osd_set_mastervolume(int attenuation);
/******************************************************************************
Controls
******************************************************************************/
/*
inptport.c defines some general purpose defaults for key and joystick bindings.
They may be further adjusted by the OS dependent code to better match the
available keyboard, e.g. one could map pause to the Pause key instead of P, or
snapshot to PrtScr instead of F12. Of course the user can further change the
settings to anything he/she likes.
This function is called on startup, before reading the configuration from disk.
Scan the list, and change the keys/joysticks you want.
*/
void osd_customize_input_type_list(input_type_desc *typelist);
// input overridables
virtual void customize_input_type_list(input_type_desc *typelist);
private:
// internal state
running_machine * m_machine;
};
#endif /* __OSDEPEND_H__ */

View File

@ -99,20 +99,23 @@ int main(int argc, char *argv[])
//============================================================
// osd_init
// init
//============================================================
void osd_init(running_machine *machine)
void mini_osd_interface::init(running_machine &machine)
{
// call our parent
osd_interface::init(machine);
// initialize the video system by allocating a rendering target
our_target = machine->render().target_alloc();
our_target = machine.render().target_alloc();
// nothing yet to do to initialize sound, since we don't have any
// sound updates are handled by osd_update_audio_stream() below
// sound updates are handled by update_audio_stream() below
// initialize the input system by adding devices
// let's pretend like we have a keyboard device
keyboard_device = input_device_add(machine, DEVICE_CLASS_KEYBOARD, "Keyboard", NULL);
keyboard_device = input_device_add(&machine, DEVICE_CLASS_KEYBOARD, "Keyboard", NULL);
if (keyboard_device == NULL)
fatalerror("Error creating keyboard device");
@ -133,47 +136,27 @@ void osd_init(running_machine *machine)
}
//============================================================
// osd_init_debugger
//============================================================
void osd_init_debugger(running_machine *machine)
{
}
//============================================================
// osd_wait_for_debugger
//============================================================
void osd_wait_for_debugger(running_device *device, int firststop)
{
// we don't have a debugger, so we just return here
}
//============================================================
// osd_update
//============================================================
void osd_update(running_machine *machine, int skip_redraw)
void mini_osd_interface::update(bool skip_redraw)
{
const render_primitive_list *primlist;
int minwidth, minheight;
// get the minimum width/height for the current layout
int minwidth, minheight;
our_target->compute_minimum_size(minwidth, minheight);
// make that the size of our target
our_target->render_target_set_bounds(minwidth, minheight);
// get the list of primitives for the target at the current size
primlist = our_target->get_primitives();
const render_primitive_list *primlist = our_target->get_primitives();
// lock them, and then render them
osd_lock_acquire(primlist->lock);
primlist->acquire_locK();
// do the drawing here
osd_lock_release(primlist->lock);
primlist->release_lock();
// after 5 seconds, exit
if (attotime_compare(timer_get_time(machine), attotime_make(5, 0)) > 0)
@ -182,10 +165,10 @@ void osd_update(running_machine *machine, int skip_redraw)
//============================================================
// osd_update_audio_stream
// update_audio_stream
//============================================================
void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int samples_this_frame)
void mini_osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
{
// if we had actual sound output, we would copy the
// interleaved stereo samples to our sound stream
@ -193,10 +176,10 @@ void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int sample
//============================================================
// osd_set_mastervolume
// set_mastervolume
//============================================================
void osd_set_mastervolume(int attenuation)
void mini_osd_interface::set_mastervolume(int attenuation)
{
// if we had actual sound output, we would adjust the global
// volume in response to this function
@ -204,10 +187,10 @@ void osd_set_mastervolume(int attenuation)
//============================================================
// osd_customize_input_type_list
// customize_input_type_list
//============================================================
void osd_customize_input_type_list(input_type_desc *typelist)
void mini_osd_interface::customize_input_type_list(input_type_desc *typelist)
{
// This function is called on startup, before reading the
// configuration from disk. Scan the list, and change the

View File

@ -537,21 +537,21 @@ static void configuration_save(running_machine *machine, int config_type, xml_da
//============================================================
// osd_init_debugger
// sdl_osd_interface::init_debugger
//============================================================
void osd_init_debugger(running_machine *machine)
void sdl_osd_interface::init_debugger()
{
/* register callbacks */
config_register(machine, "debugger", configuration_load, configuration_save);
config_register(&machine(), "debugger", configuration_load, configuration_save);
}
//============================================================
// osd_wait_for_debugger
// wait_for_debugger
//============================================================
void osd_wait_for_debugger(running_device *device, int firststop)
void sdl_osd_interface::wait_for_debugger(running_device &device, bool firststop)
{
win_i *dmain = get_first_win_i(WIN_TYPE_MAIN);
@ -560,7 +560,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
{
// GTK init should probably be done earlier
gtk_init(0, 0);
debugmain_init(device->machine);
debugmain_init(&machine());
// Resize the main window
for (int i = 0; i < windowStateCount; i++)
@ -580,9 +580,9 @@ void osd_wait_for_debugger(running_device *device, int firststop)
switch (windowStateArray[i].type)
{
case WIN_TYPE_MEMORY: memorywin_new(device->machine); break;
case WIN_TYPE_DISASM: disasmwin_new(device->machine); break;
case WIN_TYPE_LOG: logwin_new(device->machine); break;
case WIN_TYPE_MEMORY: memorywin_new(&machine()); break;
case WIN_TYPE_DISASM: disasmwin_new(&machine()); break;
case WIN_TYPE_LOG: logwin_new(&machine()); break;
default: break;
}
@ -592,7 +592,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
}
// update the views in the console to reflect the current CPU
debugmain_set_cpu(device);
debugmain_set_cpu(&device);
debugwin_show(1);
gtk_main_iteration();
@ -1269,17 +1269,23 @@ on_memoryview_key_press_event (GtkWidget *widget,
#else
#include <SDL/SDL.h>
#include <SDL/SDL_version.h>
#include "emu.h"
#include "osdepend.h"
#include "osdsdl.h"
// win32 stubs for linking
void sdl_osd_interface::init_debugger()
{
}
void sdl_osd_interface::wait_for_debugger(running_device &device, bool firststop)
{
}
// win32 stubs for linking
void osd_init_debugger(running_machine *machine)
{
}
void osd_wait_for_debugger(running_device *device, int firststop)
{
}
void debugwin_update_during_game(running_machine *machine)
{
}

View File

@ -1586,10 +1586,10 @@ int sdlinput_should_hide_mouse(running_machine *machine)
//============================================================
// osd_customize_inputport_list
// customize_input_type_list
//============================================================
void osd_customize_input_type_list(input_type_desc *typelist)
void sdl_osd_interface::customize_input_type_list(input_type_desc *typelist)
{
int mameid_code ,ui_code;
input_type_desc *typedesc;

View File

@ -116,6 +116,38 @@
#endif
//============================================================
// TYPE DEFINITIONS
//============================================================
class sdl_osd_interface : public osd_interface
{
public:
// construction/destruction
sdl_osd_interface();
virtual ~sdl_osd_interface();
// general overridables
virtual void init(running_machine &machine);
virtual void update(bool skip_redraw);
// debugger overridables
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
// audio overridables
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
// input overridables
virtual void customize_input_type_list(input_type_desc *typelist);
private:
static void osd_exit(running_machine &machine);
};
//============================================================
// sound.c
//============================================================

View File

@ -303,7 +303,10 @@ int main(int argc, char *argv[])
}
#endif
res = cli_execute(argc, argv, mame_sdl_options);
{
sdl_osd_interface osd;
res = cli_execute(argc, argv, osd, mame_sdl_options);
}
#ifdef MALLOC_DEBUG
{
@ -333,11 +336,29 @@ static void output_oslog(running_machine &machine, const char *buffer)
//============================================================
// constructor
//============================================================
sdl_osd_interface::sdl_osd_interface()
{
}
//============================================================
// destructor
//============================================================
sdl_osd_interface::~sdl_osd_interface()
{
}
//============================================================
// osd_exit
//============================================================
static void osd_exit(running_machine &machine)
void sdl_osd_interface::osd_exit(running_machine &machine)
{
if (!SDLMAME_INIT_IN_WORKER_THREAD)
@ -462,22 +483,25 @@ static void osd_sdl_info(void)
//============================================================
// osd_init
// init
//============================================================
void osd_init(running_machine *machine)
void sdl_osd_interface::init(running_machine &machine)
{
// call our parent
osd_interface::init(machine);
const char *stemp;
// Some driver options - must be before audio init!
stemp = options_get_string(machine->options(), SDLOPTION_AUDIODRIVER);
stemp = options_get_string(machine.options(), SDLOPTION_AUDIODRIVER);
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
{
mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp);
osd_setenv(SDLENV_AUDIODRIVER, stemp, 1);
}
stemp = options_get_string(machine->options(), SDLOPTION_VIDEODRIVER);
stemp = options_get_string(machine.options(), SDLOPTION_VIDEODRIVER);
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
{
mame_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp);
@ -486,7 +510,7 @@ void osd_init(running_machine *machine)
if (SDL_VERSION_ATLEAST(1,3,0))
{
stemp = options_get_string(machine->options(), SDLOPTION_RENDERDRIVER);
stemp = options_get_string(machine.options(), SDLOPTION_RENDERDRIVER);
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
{
mame_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp);
@ -499,7 +523,7 @@ void osd_init(running_machine *machine)
*/
/* FIXME: move lib loading code from drawogl.c here */
stemp = options_get_string(machine->options(), SDLOPTION_GL_LIB);
stemp = options_get_string(machine.options(), SDLOPTION_GL_LIB);
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
{
osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1);
@ -507,7 +531,7 @@ void osd_init(running_machine *machine)
}
/* get number of processors */
stemp = options_get_string(machine->options(), SDLOPTION_NUMPROCESSORS);
stemp = options_get_string(machine.options(), SDLOPTION_NUMPROCESSORS);
sdl_num_processors = 0;
@ -536,35 +560,35 @@ void osd_init(running_machine *machine)
osd_sdl_info();
}
// must be before sdlvideo_init!
machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
defines_verbose();
if (!SDLMAME_HAS_DEBUGGER)
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
{
mame_printf_error("sdlmame: -debug not supported on X11-less builds\n\n");
osd_exit(*machine);
osd_exit(machine);
exit(-1);
}
if (sdlvideo_init(machine))
if (sdlvideo_init(&machine))
{
osd_exit(*machine);
osd_exit(machine);
mame_printf_error("sdlvideo_init: Initialization failed!\n\n\n");
fflush(stderr);
fflush(stdout);
exit(-1);
}
sdlinput_init(machine);
sdlinput_init(&machine);
sdlaudio_init(machine);
sdlaudio_init(&machine);
sdloutput_init(machine);
sdloutput_init(&machine);
if (options_get_bool(machine->options(), SDLOPTION_OSLOG))
machine->add_logerror_callback(output_oslog);
if (options_get_bool(machine.options(), SDLOPTION_OSLOG))
machine.add_logerror_callback(output_oslog);
#if (SDL_VERSION_ATLEAST(1,3,0))
SDL_EventState(SDL_TEXTINPUT, SDL_TRUE);

View File

@ -95,7 +95,7 @@ void sdlaudio_init(running_machine *machine)
machine->add_notifier(MACHINE_NOTIFY_EXIT, sdl_cleanup_audio);
// set the startup volume
osd_set_mastervolume(attenuation);
machine->osd().set_mastervolume(attenuation);
}
return;
}
@ -197,7 +197,7 @@ static void unlock_buffer(void)
// Apply attenuation
//============================================================
static void att_memcpy(void *dest, INT16 *data, int bytes_to_copy)
static void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy)
{
int level= (int) (pow(10.0, (float) attenuation / 20.0) * 128.0);
INT16 *d = (INT16 *) dest;
@ -213,7 +213,7 @@ static void att_memcpy(void *dest, INT16 *data, int bytes_to_copy)
// copy_sample_data
//============================================================
static void copy_sample_data(INT16 *data, int bytes_to_copy)
static void copy_sample_data(const INT16 *data, int bytes_to_copy)
{
void *buffer1, *buffer2 = (void *)NULL;
long length1, length2;
@ -258,13 +258,13 @@ static void copy_sample_data(INT16 *data, int bytes_to_copy)
//============================================================
// osd_update_audio_stream
// update_audio_stream
//============================================================
void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int samples_this_frame)
void sdl_osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
{
// if nothing to do, don't do it
if (machine->sample_rate != 0 && stream_buffer)
if (machine().sample_rate != 0 && stream_buffer)
{
int bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
int play_position, write_position, stream_in;
@ -272,7 +272,7 @@ void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int sample
play_position = stream_playpos;
write_position = stream_playpos + ((machine->sample_rate / 50) * sizeof(INT16) * 2);
write_position = stream_playpos + ((machine().sample_rate / 50) * sizeof(INT16) * 2);
orig_write = write_position;
if (!stream_in_initialized)
@ -340,10 +340,10 @@ void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int sample
//============================================================
// osd_set_mastervolume
// set_mastervolume
//============================================================
void osd_set_mastervolume(int _attenuation)
void sdl_osd_interface::set_mastervolume(int _attenuation)
{
// clamp the attenuation to 0-32 range
if (_attenuation > 0)

View File

@ -326,10 +326,10 @@ sdl_monitor_info *sdlvideo_monitor_from_handle(UINT32 hmonitor)
//============================================================
// osd_update
// update
//============================================================
void osd_update(running_machine *machine, int skip_redraw)
void sdl_osd_interface::update(bool skip_redraw)
{
sdl_window_info *window;
@ -338,16 +338,16 @@ void osd_update(running_machine *machine, int skip_redraw)
{
// profiler_mark(PROFILER_BLIT);
for (window = sdl_window_list; window != NULL; window = window->next)
sdlwindow_video_window_update(machine, window);
sdlwindow_video_window_update(&machine(), window);
// profiler_mark(PROFILER_END);
}
// poll the joystick values here
sdlinput_poll(machine);
check_osd_inputs(machine);
sdlinput_poll(&machine());
check_osd_inputs(&machine());
if ((machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
debugwin_update_during_game(machine);
if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
debugwin_update_during_game(&machine());
}

View File

@ -262,29 +262,20 @@ static void smart_show_all(BOOL show);
//============================================================
// osd_init_debugger
// wait_for_debugger
//============================================================
void osd_init_debugger(running_machine *machine)
{
}
//============================================================
// osd_wait_for_debugger
//============================================================
void osd_wait_for_debugger(running_device *device, int firststop)
void windows_osd_interface::wait_for_debugger(running_device &device, bool firststop)
{
MSG message;
// create a console window
if (main_console == NULL)
console_create_window(device->machine);
console_create_window(&machine());
// update the views in the console to reflect the current CPU
if (main_console != NULL)
console_set_cpu(device);
console_set_cpu(&device);
// when we are first stopped, adjust focus to us
if (firststop && main_console != NULL)
@ -299,7 +290,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
smart_show_all(TRUE);
// run input polling to ensure that our status is in sync
wininput_poll(device->machine);
wininput_poll(&machine());
// get and process messages
GetMessage(&message, NULL, 0, 0);
@ -317,7 +308,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
// process everything else
default:
winwindow_dispatch_message(device->machine, &message);
winwindow_dispatch_message(&machine(), &message);
break;
}

View File

@ -756,10 +756,10 @@ int wininput_vkey_for_mame_code(input_code code)
//============================================================
// osd_customize_mapping_list
// customize_input_type_list
//============================================================
void osd_customize_input_type_list(input_type_desc *typelist)
void windows_osd_interface::customize_input_type_list(input_type_desc *typelist)
{
input_type_desc *typedesc;

View File

@ -149,7 +149,7 @@ static void sound_exit(running_machine &machine)
// copy_sample_data
//============================================================
static void copy_sample_data(INT16 *data, int bytes_to_copy)
static void copy_sample_data(const INT16 *data, int bytes_to_copy)
{
void *buffer1, *buffer2;
DWORD length1, length2;
@ -190,10 +190,10 @@ static void copy_sample_data(INT16 *data, int bytes_to_copy)
//============================================================
// osd_update_audio_stream
// update_audio_stream
//============================================================
void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int samples_this_frame)
void windows_osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
{
int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign;
DWORD play_position, write_position;
@ -246,10 +246,10 @@ void osd_update_audio_stream(running_machine *machine, INT16 *buffer, int sample
//============================================================
// osd_set_mastervolume
// set_mastervolume
//============================================================
void osd_set_mastervolume(int attenuation)
void windows_osd_interface::set_mastervolume(int attenuation)
{
// clamp the attenuation to 0-32 range
if (attenuation > 0)

View File

@ -210,25 +210,23 @@ win_monitor_info *winvideo_monitor_from_handle(HMONITOR hmonitor)
//============================================================
// osd_update
// update
//============================================================
void osd_update(running_machine *machine, int skip_redraw)
void windows_osd_interface::update(bool skip_redraw)
{
win_window_info *window;
// ping the watchdog on each update
winmain_watchdog_ping();
// if we're not skipping this redraw, update all windows
if (!skip_redraw)
for (window = win_window_list; window != NULL; window = window->next)
for (win_window_info *window = win_window_list; window != NULL; window = window->next)
winwindow_video_window_update(window);
// poll the joystick values here
winwindow_process_events(machine, TRUE);
wininput_poll(machine);
check_osd_inputs(machine);
winwindow_process_events(&machine(), TRUE);
wininput_poll(&machine());
check_osd_inputs(&machine());
}

View File

@ -279,7 +279,6 @@ bool stack_walker::s_initialized = false;
// FUNCTION PROTOTYPES
//**************************************************************************
static void osd_exit(running_machine &machine);
static BOOL WINAPI control_handler(DWORD type);
static int is_double_click_start(int argc);
static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter);
@ -418,7 +417,11 @@ int main(int argc, char *argv[])
}
// parse config and cmdline options
DWORD result = cli_execute(argc, argv, mame_win_options);
DWORD result = 0;
{
windows_osd_interface osd;
result = cli_execute(argc, argv, osd, mame_win_options);
}
// free symbols
symbols = NULL;
@ -492,41 +495,62 @@ static void output_oslog(running_machine &machine, const char *buffer)
//============================================================
// osd_init
// constructor
//============================================================
void osd_init(running_machine *machine)
windows_osd_interface::windows_osd_interface()
{
}
//============================================================
// destructor
//============================================================
windows_osd_interface::~windows_osd_interface()
{
}
//============================================================
// init
//============================================================
void windows_osd_interface::init(running_machine &machine)
{
// call our parent
osd_interface::init(machine);
const char *stemp;
// determine if we are benchmarking, and adjust options appropriately
int bench = options_get_int(machine->options(), WINOPTION_BENCH);
int bench = options_get_int(machine.options(), WINOPTION_BENCH);
if (bench > 0)
{
options_set_bool(machine->options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine->options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM);
options_set_string(machine->options(), WINOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM);
options_set_int(machine->options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM);
options_set_string(machine.options(), WINOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM);
options_set_int(machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM);
}
// determine if we are profiling, and adjust options appropriately
int profile = options_get_int(machine->options(), WINOPTION_PROFILE);
int profile = options_get_int(machine.options(), WINOPTION_PROFILE);
if (profile > 0)
{
options_set_bool(machine->options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine->options(), WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM);
options_set_int(machine->options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine.options(), OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM);
options_set_bool(machine.options(), WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM);
options_set_int(machine.options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM);
}
// thread priority
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
SetThreadPriority(GetCurrentThread(), options_get_int(machine->options(), WINOPTION_PRIORITY));
if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
SetThreadPriority(GetCurrentThread(), options_get_int(machine.options(), WINOPTION_PRIORITY));
// ensure we get called on the way out
machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
// get number of processors
stemp = options_get_string(machine->options(), WINOPTION_NUMPROCESSORS);
stemp = options_get_string(machine.options(), WINOPTION_NUMPROCESSORS);
osd_num_processors = 0;
@ -541,10 +565,10 @@ void osd_init(running_machine *machine)
}
// initialize the subsystems
winvideo_init(machine);
winsound_init(machine);
wininput_init(machine);
winoutput_init(machine);
winvideo_init(&machine);
winsound_init(&machine);
wininput_init(&machine);
winoutput_init(&machine);
// notify listeners of screen configuration
astring tempstring;
@ -555,8 +579,8 @@ void osd_init(running_machine *machine)
}
// hook up the debugger log
if (options_get_bool(machine->options(), WINOPTION_OSLOG))
machine->add_logerror_callback(output_oslog);
if (options_get_bool(machine.options(), WINOPTION_OSLOG))
machine.add_logerror_callback(output_oslog);
// crank up the multimedia timer resolution to its max
// this gives the system much finer timeslices
@ -569,7 +593,7 @@ void osd_init(running_machine *machine)
// mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index);
// if a watchdog thread is requested, create one
int watchdog = options_get_int(machine->options(), WINOPTION_WATCHDOG);
int watchdog = options_get_int(machine.options(), WINOPTION_WATCHDOG);
if (watchdog != 0)
{
watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
@ -588,7 +612,7 @@ void osd_init(running_machine *machine)
}
// note the existence of a machine
g_current_machine = machine;
g_current_machine = &machine;
}
@ -596,7 +620,7 @@ void osd_init(running_machine *machine)
// osd_exit
//============================================================
static void osd_exit(running_machine &machine)
void windows_osd_interface::osd_exit(running_machine &machine)
{
// no longer have a machine
g_current_machine = NULL;

View File

@ -40,6 +40,7 @@
//============================================================
#include "options.h"
#include "osdepend.h"
//============================================================
@ -129,6 +130,38 @@
//============================================================
// TYPE DEFINITIONS
//============================================================
class windows_osd_interface : public osd_interface
{
public:
// construction/destruction
windows_osd_interface();
virtual ~windows_osd_interface();
// general overridables
virtual void init(running_machine &machine);
virtual void update(bool skip_redraw);
// debugger overridables
// virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
// audio overridables
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
// input overridables
virtual void customize_input_type_list(input_type_desc *typelist);
private:
static void osd_exit(running_machine &machine);
};
//============================================================
// GLOBAL VARIABLES
//============================================================
@ -139,6 +172,7 @@ extern const options_entry mame_win_options[];
extern int osd_num_processors;
//============================================================
// FUNCTION PROTOTYPES
//============================================================