mirror of
https://github.com/holub/mame
synced 2025-05-23 14:19:01 +03:00
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:
parent
f3be589604
commit
e4beed95a6
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4187,6 +4187,7 @@ src/mame/video/zerozone.c svneol=native#text/plain
|
|||||||
src/mame/video/zodiack.c svneol=native#text/plain
|
src/mame/video/zodiack.c svneol=native#text/plain
|
||||||
src/osd/osdcomm.h svneol=native#text/plain
|
src/osd/osdcomm.h svneol=native#text/plain
|
||||||
src/osd/osdcore.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/osdepend.h svneol=native#text/plain
|
||||||
src/osd/osdmini/minidir.c svneol=native#text/plain
|
src/osd/osdmini/minidir.c svneol=native#text/plain
|
||||||
src/osd/osdmini/minifile.c svneol=native#text/plain
|
src/osd/osdmini/minifile.c svneol=native#text/plain
|
||||||
|
@ -112,7 +112,7 @@ static const options_entry cli_options[] =
|
|||||||
command line interface
|
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;
|
core_options *options = NULL;
|
||||||
const char *gamename_option;
|
const char *gamename_option;
|
||||||
@ -172,7 +172,7 @@ int cli_execute(int argc, char **argv, const options_entry *osd_options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* run the game */
|
/* run the game */
|
||||||
result = mame_execute(options);
|
result = mame_execute(osd, options);
|
||||||
}
|
}
|
||||||
catch (emu_fatalerror &fatal)
|
catch (emu_fatalerror &fatal)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
FUNCTION PROTOTYPES
|
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 */
|
/* informational functions */
|
||||||
int cli_info_listxml(core_options *options, const char *gamename);
|
int cli_info_listxml(core_options *options, const char *gamename);
|
||||||
|
@ -1916,7 +1916,8 @@ void device_debug::exception_hook(int exception)
|
|||||||
|
|
||||||
void device_debug::instruction_hook(offs_t curpc)
|
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
|
// note that we are in the debugger code
|
||||||
global->within_instruction_hook = true;
|
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
|
// 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))
|
else if ((m_flags & DEBUG_FLAG_STEPPING_OUT) == 0 && (m_stepsleft < 200 || m_stepsleft % 100 == 0))
|
||||||
{
|
{
|
||||||
m_device.machine->debug_view().update_all();
|
machine.debug_view().update_all();
|
||||||
m_device.machine->debug_view().flush_osd_updates();
|
machine.debug_view().flush_osd_updates();
|
||||||
debugger_refresh_display(m_device.machine);
|
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)
|
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
|
// 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;
|
global->execution_state = EXECUTION_STATE_STOPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the temp running breakpoint and break if we hit it
|
// check the temp running breakpoint and break if we hit it
|
||||||
else if ((m_flags & DEBUG_FLAG_STOP_PC) != 0 && m_stopaddr == curpc)
|
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;
|
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 we are supposed to halt, do it now
|
||||||
if (global->execution_state == EXECUTION_STATE_STOPPED)
|
if (global->execution_state == EXECUTION_STATE_STOPPED)
|
||||||
{
|
{
|
||||||
int firststop = true;
|
bool firststop = true;
|
||||||
|
|
||||||
// load comments if we haven't yet
|
// load comments if we haven't yet
|
||||||
if (!global->comments_loaded)
|
if (!global->comments_loaded)
|
||||||
@ -1998,7 +1999,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
|||||||
global->visiblecpu = &m_device;
|
global->visiblecpu = &m_device;
|
||||||
|
|
||||||
// update all views
|
// update all views
|
||||||
m_device.machine->debug_view().update_all();
|
machine.debug_view().update_all();
|
||||||
debugger_refresh_display(m_device.machine);
|
debugger_refresh_display(m_device.machine);
|
||||||
|
|
||||||
// wait for the debugger; during this time, disable sound output
|
// 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)
|
while (global->execution_state == EXECUTION_STATE_STOPPED)
|
||||||
{
|
{
|
||||||
// flush any pending updates before waiting again
|
// 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
|
// clear the memory modified flag and wait
|
||||||
global->memory_modified = false;
|
global->memory_modified = false;
|
||||||
if (m_device.machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
|
if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
|
||||||
osd_wait_for_debugger(&m_device, firststop);
|
machine.osd().wait_for_debugger(m_device, firststop);
|
||||||
else if (m_device.machine->debug_flags & DEBUG_FLAG_ENABLED)
|
else if (machine.debug_flags & DEBUG_FLAG_ENABLED)
|
||||||
debugint_wait_for_debugger(&m_device, firststop);
|
debugint_wait_for_debugger(m_device, firststop);
|
||||||
firststop = false;
|
firststop = false;
|
||||||
|
|
||||||
// if something modified memory, update the screen
|
// if something modified memory, update the screen
|
||||||
if (global->memory_modified)
|
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);
|
debugger_refresh_display(m_device.machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2027,7 +2028,7 @@ void device_debug::instruction_hook(offs_t curpc)
|
|||||||
process_source_file(m_device.machine);
|
process_source_file(m_device.machine);
|
||||||
|
|
||||||
// if an event got scheduled, resume
|
// if an event got scheduled, resume
|
||||||
if (m_device.machine->scheduled_event_pending())
|
if (machine.scheduled_event_pending())
|
||||||
global->execution_state = EXECUTION_STATE_RUNNING;
|
global->execution_state = EXECUTION_STATE_RUNNING;
|
||||||
}
|
}
|
||||||
sound_mute(m_device.machine, false);
|
sound_mute(m_device.machine, false);
|
||||||
|
@ -92,7 +92,7 @@ void debugger_init(running_machine *machine)
|
|||||||
machine->add_logerror_callback(debug_errorlog_write_line);
|
machine->add_logerror_callback(debug_errorlog_write_line);
|
||||||
|
|
||||||
/* initialize osd debugger features */
|
/* initialize osd debugger features */
|
||||||
osd_init_debugger(machine);
|
machine->osd().init_debugger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
if (firststop && list == NULL)
|
||||||
@ -1447,28 +1447,28 @@ void debugint_wait_for_debugger(running_device *device, int firststop)
|
|||||||
DView *dv;
|
DView *dv;
|
||||||
render_target *target;
|
render_target *target;
|
||||||
|
|
||||||
target = &device->machine->render().ui_target();
|
target = &device.machine->render().ui_target();
|
||||||
|
|
||||||
//set_view_by_name(target, "Debug");
|
//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.active = TRUE;
|
||||||
dv->editor.container = &device->machine->render().ui_container();
|
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_STATE, VIEW_STATE_FOLLOW_CPU);
|
||||||
dv = dview_alloc(target, device->machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
|
dv = dview_alloc(target, device.machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
|
||||||
dview_set_title(dv, "Console");
|
dview_set_title(dv, "Console");
|
||||||
dv->editor.active = TRUE;
|
dv->editor.active = TRUE;
|
||||||
dv->editor.container = &device->machine->render().ui_container();
|
dv->editor.container = &device.machine->render().ui_container();
|
||||||
set_focus_view(dv);
|
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();
|
update_views();
|
||||||
osd_update(device->machine, FALSE);
|
device.machine->osd().update(false);
|
||||||
handle_menus(device->machine);
|
handle_menus(device.machine);
|
||||||
handle_mouse(device->machine);
|
handle_mouse(device.machine);
|
||||||
//osd_sleep(osd_ticks_per_second()/60);
|
//osd_sleep(osd_ticks_per_second()/60);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
void debugint_init(running_machine *machine);
|
void debugint_init(running_machine *machine);
|
||||||
|
|
||||||
/* process events for internal debugger */
|
/* 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 */
|
/* update the internal debugger during a game */
|
||||||
void debugint_update_during_game(running_machine *machine);
|
void debugint_update_during_game(running_machine *machine);
|
||||||
|
@ -30,6 +30,11 @@ OBJDIRS += \
|
|||||||
$(EMUOBJ)/layout \
|
$(EMUOBJ)/layout \
|
||||||
$(EMUOBJ)/video \
|
$(EMUOBJ)/video \
|
||||||
|
|
||||||
|
OSDSRC = $(SRC)/osd
|
||||||
|
OSDOBJ = $(OBJ)/osd
|
||||||
|
|
||||||
|
OBJDIRS += \
|
||||||
|
$(OSDOBJ)
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
@ -110,7 +115,8 @@ EMUOBJS = \
|
|||||||
$(EMUOBJ)/debug/express.o \
|
$(EMUOBJ)/debug/express.o \
|
||||||
$(EMUOBJ)/debug/textbuf.o \
|
$(EMUOBJ)/debug/textbuf.o \
|
||||||
$(EMUOBJ)/debugint/debugint.o \
|
$(EMUOBJ)/debugint/debugint.o \
|
||||||
$(EMUOBJ)/profiler.o
|
$(EMUOBJ)/profiler.o \
|
||||||
|
$(OSDOBJ)/osdepend.o
|
||||||
|
|
||||||
EMUSOUNDOBJS = \
|
EMUSOUNDOBJS = \
|
||||||
$(EMUOBJ)/sound/filter.o \
|
$(EMUOBJ)/sound/filter.o \
|
||||||
|
@ -1881,7 +1881,7 @@ static void init_port_types(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ask the OSD to customize the list */
|
/* 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 */
|
/* now iterate over the OSD-modified types */
|
||||||
for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next)
|
for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next)
|
||||||
|
@ -138,7 +138,7 @@ static char giant_string_buffer[65536] = { 0 };
|
|||||||
// running_machine - constructor
|
// 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_regionlist(m_respool),
|
||||||
m_devicelist(m_respool),
|
m_devicelist(m_respool),
|
||||||
config(&_config),
|
config(&_config),
|
||||||
@ -176,6 +176,7 @@ running_machine::running_machine(const machine_config &_config, core_options &op
|
|||||||
m_logerror_list(NULL),
|
m_logerror_list(NULL),
|
||||||
m_scheduler(*this),
|
m_scheduler(*this),
|
||||||
m_options(options),
|
m_options(options),
|
||||||
|
m_osd(osd),
|
||||||
m_basename(_config.gamedrv().name),
|
m_basename(_config.gamedrv().name),
|
||||||
m_current_phase(MACHINE_PHASE_PREINIT),
|
m_current_phase(MACHINE_PHASE_PREINIT),
|
||||||
m_paused(false),
|
m_paused(false),
|
||||||
@ -284,7 +285,7 @@ void running_machine::start()
|
|||||||
m_soft_reset_timer = timer_alloc(this, static_soft_reset, NULL);
|
m_soft_reset_timer = timer_alloc(this, static_soft_reset, NULL);
|
||||||
|
|
||||||
// init the osd layer
|
// init the osd layer
|
||||||
osd_init(this);
|
m_osd.init(*this);
|
||||||
|
|
||||||
// initialize the base time (needed for doing record/playback)
|
// initialize the base time (needed for doing record/playback)
|
||||||
time(&m_base_time);
|
time(&m_base_time);
|
||||||
|
@ -182,6 +182,7 @@ class gfx_element;
|
|||||||
class colortable_t;
|
class colortable_t;
|
||||||
class debug_view_manager;
|
class debug_view_manager;
|
||||||
class render_manager;
|
class render_manager;
|
||||||
|
class osd_interface;
|
||||||
|
|
||||||
typedef struct _mame_private mame_private;
|
typedef struct _mame_private mame_private;
|
||||||
typedef struct _cpuexec_private cpuexec_private;
|
typedef struct _cpuexec_private cpuexec_private;
|
||||||
@ -337,7 +338,7 @@ class running_machine : public bindable_object
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// 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();
|
~running_machine();
|
||||||
|
|
||||||
// fetch items by name
|
// fetch items by name
|
||||||
@ -360,6 +361,7 @@ public:
|
|||||||
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
|
bool new_driver_pending() const { return (m_new_driver_pending != NULL); }
|
||||||
const char *new_driver_name() const { return m_new_driver_pending->name; }
|
const char *new_driver_name() const { return m_new_driver_pending->name; }
|
||||||
device_scheduler &scheduler() { return m_scheduler; }
|
device_scheduler &scheduler() { return m_scheduler; }
|
||||||
|
osd_interface &osd() const { return m_osd; }
|
||||||
|
|
||||||
// immediate operations
|
// immediate operations
|
||||||
int run(bool firstrun);
|
int run(bool firstrun);
|
||||||
@ -493,6 +495,7 @@ private:
|
|||||||
|
|
||||||
device_scheduler m_scheduler; // scheduler object
|
device_scheduler m_scheduler; // scheduler object
|
||||||
core_options & m_options;
|
core_options & m_options;
|
||||||
|
osd_interface & m_osd;
|
||||||
|
|
||||||
astring m_context; // context string
|
astring m_context; // context string
|
||||||
astring m_basename; // basename used for game-related paths
|
astring m_basename; // basename used for game-related paths
|
||||||
|
@ -149,7 +149,7 @@ int mame_is_valid_machine(running_machine *machine)
|
|||||||
mame_execute - run the core emulation
|
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 firstgame = true;
|
||||||
bool firstrun = true;
|
bool firstrun = true;
|
||||||
@ -192,7 +192,7 @@ int mame_execute(core_options *options)
|
|||||||
const machine_config *config = global_alloc(machine_config(*driver));
|
const machine_config *config = global_alloc(machine_config(*driver));
|
||||||
|
|
||||||
// create the machine structure and 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
|
// looooong term: remove this
|
||||||
global_machine = machine;
|
global_machine = machine;
|
||||||
|
@ -96,7 +96,7 @@ extern const char build_version[];
|
|||||||
/* ----- core system management ----- */
|
/* ----- core system management ----- */
|
||||||
|
|
||||||
/* execute as configured by the OPTION_GAMENAME option on the specified options */
|
/* 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 */
|
/* accesses the core_options for the currently running emulation */
|
||||||
core_options *mame_options(void);
|
core_options *mame_options(void);
|
||||||
|
@ -212,14 +212,14 @@ static void sound_pause(running_machine &machine)
|
|||||||
{
|
{
|
||||||
sound_private *global = machine.sound_data;
|
sound_private *global = machine.sound_data;
|
||||||
global->muted |= 0x02;
|
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)
|
static void sound_resume(running_machine &machine)
|
||||||
{
|
{
|
||||||
sound_private *global = machine.sound_data;
|
sound_private *global = machine.sound_data;
|
||||||
global->muted &= ~0x02;
|
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;
|
global->muted |= 0x01;
|
||||||
else
|
else
|
||||||
global->muted &= ~0x01;
|
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;
|
sound_private *global = machine->sound_data;
|
||||||
global->attenuation = attenuation;
|
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 (finalmix_offset > 0)
|
||||||
{
|
{
|
||||||
if (!global->nosound_mode)
|
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);
|
video_avi_add_sound(machine, finalmix, finalmix_offset / 2);
|
||||||
if (global->wavfile != NULL)
|
if (global->wavfile != NULL)
|
||||||
wav_add_data_16(global->wavfile, finalmix, finalmix_offset);
|
wav_add_data_16(global->wavfile, finalmix, finalmix_offset);
|
||||||
|
@ -467,7 +467,7 @@ void video_frame_update(running_machine *machine, int debug)
|
|||||||
|
|
||||||
/* ask the OSD to update */
|
/* ask the OSD to update */
|
||||||
g_profiler.start(PROFILER_BLIT);
|
g_profiler.start(PROFILER_BLIT);
|
||||||
osd_update(machine, !debug && skipped_it);
|
machine->osd().update(!debug && skipped_it);
|
||||||
g_profiler.stop();
|
g_profiler.stop();
|
||||||
|
|
||||||
/* perform tasks for this frame */
|
/* perform tasks for this frame */
|
||||||
|
198
src/osd/osdepend.c
Normal file
198
src/osd/osdepend.c
Normal 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.
|
||||||
|
//
|
||||||
|
}
|
@ -35,30 +35,6 @@
|
|||||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
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********/
|
*******************************************************************c********/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -70,114 +46,47 @@
|
|||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// forward references
|
||||||
class input_type_desc;
|
class input_type_desc;
|
||||||
class device_t;
|
class device_t;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
// ======================> osd_interface
|
||||||
osd_init: initialize the OSD system.
|
|
||||||
|
|
||||||
Parameters:
|
// description of the currently-running machine
|
||||||
|
class osd_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
osd_interface();
|
||||||
|
virtual ~osd_interface();
|
||||||
|
|
||||||
machine - pointer to a structure that contains parameters for the
|
// getters
|
||||||
current "machine"
|
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
|
||||||
|
|
||||||
Return value:
|
// general overridables
|
||||||
|
virtual void init(running_machine &machine);
|
||||||
|
virtual void update(bool skip_redraw);
|
||||||
|
|
||||||
None
|
// debugger overridables
|
||||||
|
virtual void init_debugger();
|
||||||
|
virtual void wait_for_debugger(device_t &device, bool firststop);
|
||||||
|
|
||||||
Notes:
|
// audio overridables
|
||||||
|
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
|
||||||
|
virtual void set_mastervolume(int attenuation);
|
||||||
|
|
||||||
This function is responsible for initializing the OSD-specific
|
// input overridables
|
||||||
video and input functionality, and registering that functionality
|
virtual void customize_input_type_list(input_type_desc *typelist);
|
||||||
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);
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
// internal state
|
||||||
|
running_machine * m_machine;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* __OSDEPEND_H__ */
|
#endif /* __OSDEPEND_H__ */
|
||||||
|
@ -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
|
// 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
|
// 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
|
// initialize the input system by adding devices
|
||||||
// let's pretend like we have a keyboard device
|
// 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)
|
if (keyboard_device == NULL)
|
||||||
fatalerror("Error creating keyboard device");
|
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
|
// 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
|
// get the minimum width/height for the current layout
|
||||||
|
int minwidth, minheight;
|
||||||
our_target->compute_minimum_size(minwidth, minheight);
|
our_target->compute_minimum_size(minwidth, minheight);
|
||||||
|
|
||||||
// make that the size of our target
|
// make that the size of our target
|
||||||
our_target->render_target_set_bounds(minwidth, minheight);
|
our_target->render_target_set_bounds(minwidth, minheight);
|
||||||
|
|
||||||
// get the list of primitives for the target at the current size
|
// 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
|
// lock them, and then render them
|
||||||
osd_lock_acquire(primlist->lock);
|
primlist->acquire_locK();
|
||||||
|
|
||||||
// do the drawing here
|
// do the drawing here
|
||||||
osd_lock_release(primlist->lock);
|
primlist->release_lock();
|
||||||
|
|
||||||
// after 5 seconds, exit
|
// after 5 seconds, exit
|
||||||
if (attotime_compare(timer_get_time(machine), attotime_make(5, 0)) > 0)
|
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
|
// if we had actual sound output, we would copy the
|
||||||
// interleaved stereo samples to our sound stream
|
// 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
|
// if we had actual sound output, we would adjust the global
|
||||||
// volume in response to this function
|
// 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
|
// This function is called on startup, before reading the
|
||||||
// configuration from disk. Scan the list, and change the
|
// configuration from disk. Scan the list, and change the
|
||||||
|
@ -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 */
|
/* 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);
|
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 should probably be done earlier
|
||||||
gtk_init(0, 0);
|
gtk_init(0, 0);
|
||||||
debugmain_init(device->machine);
|
debugmain_init(&machine());
|
||||||
|
|
||||||
// Resize the main window
|
// Resize the main window
|
||||||
for (int i = 0; i < windowStateCount; i++)
|
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)
|
switch (windowStateArray[i].type)
|
||||||
{
|
{
|
||||||
case WIN_TYPE_MEMORY: memorywin_new(device->machine); break;
|
case WIN_TYPE_MEMORY: memorywin_new(&machine()); break;
|
||||||
case WIN_TYPE_DISASM: disasmwin_new(device->machine); break;
|
case WIN_TYPE_DISASM: disasmwin_new(&machine()); break;
|
||||||
case WIN_TYPE_LOG: logwin_new(device->machine); break;
|
case WIN_TYPE_LOG: logwin_new(&machine()); break;
|
||||||
default: 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
|
// update the views in the console to reflect the current CPU
|
||||||
debugmain_set_cpu(device);
|
debugmain_set_cpu(&device);
|
||||||
|
|
||||||
debugwin_show(1);
|
debugwin_show(1);
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
@ -1269,17 +1269,23 @@ on_memoryview_key_press_event (GtkWidget *widget,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_version.h>
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
#include "osdepend.h"
|
||||||
|
#include "osdsdl.h"
|
||||||
|
|
||||||
// win32 stubs for linking
|
// win32 stubs for linking
|
||||||
void osd_init_debugger(running_machine *machine)
|
void sdl_osd_interface::init_debugger()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void osd_wait_for_debugger(running_device *device, int firststop)
|
void sdl_osd_interface::wait_for_debugger(running_device &device, bool firststop)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// win32 stubs for linking
|
||||||
void debugwin_update_during_game(running_machine *machine)
|
void debugwin_update_during_game(running_machine *machine)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -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;
|
int mameid_code ,ui_code;
|
||||||
input_type_desc *typedesc;
|
input_type_desc *typedesc;
|
||||||
|
@ -116,6 +116,38 @@
|
|||||||
#endif
|
#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
|
// sound.c
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -303,7 +303,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
#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
|
// osd_exit
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static void osd_exit(running_machine &machine)
|
void sdl_osd_interface::osd_exit(running_machine &machine)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!SDLMAME_INIT_IN_WORKER_THREAD)
|
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;
|
const char *stemp;
|
||||||
|
|
||||||
// Some driver options - must be before audio init!
|
// 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)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp);
|
mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp);
|
||||||
osd_setenv(SDLENV_AUDIODRIVER, stemp, 1);
|
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)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp);
|
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))
|
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)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp);
|
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 */
|
/* 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)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1);
|
osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1);
|
||||||
@ -507,7 +531,7 @@ void osd_init(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get number of processors */
|
/* get number of processors */
|
||||||
stemp = options_get_string(machine->options(), SDLOPTION_NUMPROCESSORS);
|
stemp = options_get_string(machine.options(), SDLOPTION_NUMPROCESSORS);
|
||||||
|
|
||||||
sdl_num_processors = 0;
|
sdl_num_processors = 0;
|
||||||
|
|
||||||
@ -536,35 +560,35 @@ void osd_init(running_machine *machine)
|
|||||||
osd_sdl_info();
|
osd_sdl_info();
|
||||||
}
|
}
|
||||||
// must be before sdlvideo_init!
|
// must be before sdlvideo_init!
|
||||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
|
machine.add_notifier(MACHINE_NOTIFY_EXIT, osd_exit);
|
||||||
|
|
||||||
defines_verbose();
|
defines_verbose();
|
||||||
|
|
||||||
if (!SDLMAME_HAS_DEBUGGER)
|
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");
|
mame_printf_error("sdlmame: -debug not supported on X11-less builds\n\n");
|
||||||
osd_exit(*machine);
|
osd_exit(machine);
|
||||||
exit(-1);
|
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");
|
mame_printf_error("sdlvideo_init: Initialization failed!\n\n\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
exit(-1);
|
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))
|
if (options_get_bool(machine.options(), SDLOPTION_OSLOG))
|
||||||
machine->add_logerror_callback(output_oslog);
|
machine.add_logerror_callback(output_oslog);
|
||||||
|
|
||||||
#if (SDL_VERSION_ATLEAST(1,3,0))
|
#if (SDL_VERSION_ATLEAST(1,3,0))
|
||||||
SDL_EventState(SDL_TEXTINPUT, SDL_TRUE);
|
SDL_EventState(SDL_TEXTINPUT, SDL_TRUE);
|
||||||
|
@ -95,7 +95,7 @@ void sdlaudio_init(running_machine *machine)
|
|||||||
|
|
||||||
machine->add_notifier(MACHINE_NOTIFY_EXIT, sdl_cleanup_audio);
|
machine->add_notifier(MACHINE_NOTIFY_EXIT, sdl_cleanup_audio);
|
||||||
// set the startup volume
|
// set the startup volume
|
||||||
osd_set_mastervolume(attenuation);
|
machine->osd().set_mastervolume(attenuation);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ static void unlock_buffer(void)
|
|||||||
// Apply attenuation
|
// 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);
|
int level= (int) (pow(10.0, (float) attenuation / 20.0) * 128.0);
|
||||||
INT16 *d = (INT16 *) dest;
|
INT16 *d = (INT16 *) dest;
|
||||||
@ -213,7 +213,7 @@ static void att_memcpy(void *dest, INT16 *data, int bytes_to_copy)
|
|||||||
// copy_sample_data
|
// 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;
|
void *buffer1, *buffer2 = (void *)NULL;
|
||||||
long length1, length2;
|
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 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 bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
|
||||||
int play_position, write_position, stream_in;
|
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;
|
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;
|
orig_write = write_position;
|
||||||
|
|
||||||
if (!stream_in_initialized)
|
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
|
// clamp the attenuation to 0-32 range
|
||||||
if (_attenuation > 0)
|
if (_attenuation > 0)
|
||||||
|
@ -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;
|
sdl_window_info *window;
|
||||||
|
|
||||||
@ -338,16 +338,16 @@ void osd_update(running_machine *machine, int skip_redraw)
|
|||||||
{
|
{
|
||||||
// profiler_mark(PROFILER_BLIT);
|
// profiler_mark(PROFILER_BLIT);
|
||||||
for (window = sdl_window_list; window != NULL; window = window->next)
|
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);
|
// profiler_mark(PROFILER_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
// poll the joystick values here
|
// poll the joystick values here
|
||||||
sdlinput_poll(machine);
|
sdlinput_poll(&machine());
|
||||||
check_osd_inputs(machine);
|
check_osd_inputs(&machine());
|
||||||
|
|
||||||
if ((machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
|
if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
|
||||||
debugwin_update_during_game(machine);
|
debugwin_update_during_game(&machine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,29 +262,20 @@ static void smart_show_all(BOOL show);
|
|||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_init_debugger
|
// wait_for_debugger
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void osd_init_debugger(running_machine *machine)
|
void windows_osd_interface::wait_for_debugger(running_device &device, bool firststop)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// osd_wait_for_debugger
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void osd_wait_for_debugger(running_device *device, int firststop)
|
|
||||||
{
|
{
|
||||||
MSG message;
|
MSG message;
|
||||||
|
|
||||||
// create a console window
|
// create a console window
|
||||||
if (main_console == NULL)
|
if (main_console == NULL)
|
||||||
console_create_window(device->machine);
|
console_create_window(&machine());
|
||||||
|
|
||||||
// update the views in the console to reflect the current CPU
|
// update the views in the console to reflect the current CPU
|
||||||
if (main_console != NULL)
|
if (main_console != NULL)
|
||||||
console_set_cpu(device);
|
console_set_cpu(&device);
|
||||||
|
|
||||||
// when we are first stopped, adjust focus to us
|
// when we are first stopped, adjust focus to us
|
||||||
if (firststop && main_console != NULL)
|
if (firststop && main_console != NULL)
|
||||||
@ -299,7 +290,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
|
|||||||
smart_show_all(TRUE);
|
smart_show_all(TRUE);
|
||||||
|
|
||||||
// run input polling to ensure that our status is in sync
|
// run input polling to ensure that our status is in sync
|
||||||
wininput_poll(device->machine);
|
wininput_poll(&machine());
|
||||||
|
|
||||||
// get and process messages
|
// get and process messages
|
||||||
GetMessage(&message, NULL, 0, 0);
|
GetMessage(&message, NULL, 0, 0);
|
||||||
@ -317,7 +308,7 @@ void osd_wait_for_debugger(running_device *device, int firststop)
|
|||||||
|
|
||||||
// process everything else
|
// process everything else
|
||||||
default:
|
default:
|
||||||
winwindow_dispatch_message(device->machine, &message);
|
winwindow_dispatch_message(&machine(), &message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
input_type_desc *typedesc;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ static void sound_exit(running_machine &machine)
|
|||||||
// copy_sample_data
|
// 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 *buffer1, *buffer2;
|
||||||
DWORD length1, length2;
|
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;
|
int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign;
|
||||||
DWORD play_position, write_position;
|
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
|
// clamp the attenuation to 0-32 range
|
||||||
if (attenuation > 0)
|
if (attenuation > 0)
|
||||||
|
@ -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
|
// ping the watchdog on each update
|
||||||
winmain_watchdog_ping();
|
winmain_watchdog_ping();
|
||||||
|
|
||||||
// if we're not skipping this redraw, update all windows
|
// if we're not skipping this redraw, update all windows
|
||||||
if (!skip_redraw)
|
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);
|
winwindow_video_window_update(window);
|
||||||
|
|
||||||
// poll the joystick values here
|
// poll the joystick values here
|
||||||
winwindow_process_events(machine, TRUE);
|
winwindow_process_events(&machine(), TRUE);
|
||||||
wininput_poll(machine);
|
wininput_poll(&machine());
|
||||||
check_osd_inputs(machine);
|
check_osd_inputs(&machine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +279,6 @@ bool stack_walker::s_initialized = false;
|
|||||||
// FUNCTION PROTOTYPES
|
// FUNCTION PROTOTYPES
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
static void osd_exit(running_machine &machine);
|
|
||||||
static BOOL WINAPI control_handler(DWORD type);
|
static BOOL WINAPI control_handler(DWORD type);
|
||||||
static int is_double_click_start(int argc);
|
static int is_double_click_start(int argc);
|
||||||
static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter);
|
static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter);
|
||||||
@ -418,7 +417,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse config and cmdline options
|
// 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
|
// free symbols
|
||||||
symbols = NULL;
|
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;
|
const char *stemp;
|
||||||
|
|
||||||
// determine if we are benchmarking, and adjust options appropriately
|
// 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)
|
if (bench > 0)
|
||||||
{
|
{
|
||||||
options_set_bool(machine->options(), OPTION_THROTTLE, false, 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_bool(machine.options(), OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM);
|
||||||
options_set_string(machine->options(), WINOPTION_VIDEO, "none", 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_int(machine.options(), OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine if we are profiling, and adjust options appropriately
|
// 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)
|
if (profile > 0)
|
||||||
{
|
{
|
||||||
options_set_bool(machine->options(), OPTION_THROTTLE, false, 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_bool(machine.options(), WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM);
|
||||||
options_set_int(machine->options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM);
|
options_set_int(machine.options(), WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// thread priority
|
// thread priority
|
||||||
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
|
if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
|
||||||
SetThreadPriority(GetCurrentThread(), options_get_int(machine->options(), WINOPTION_PRIORITY));
|
SetThreadPriority(GetCurrentThread(), options_get_int(machine.options(), WINOPTION_PRIORITY));
|
||||||
|
|
||||||
// ensure we get called on the way out
|
// 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
|
// get number of processors
|
||||||
stemp = options_get_string(machine->options(), WINOPTION_NUMPROCESSORS);
|
stemp = options_get_string(machine.options(), WINOPTION_NUMPROCESSORS);
|
||||||
|
|
||||||
osd_num_processors = 0;
|
osd_num_processors = 0;
|
||||||
|
|
||||||
@ -541,10 +565,10 @@ void osd_init(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize the subsystems
|
// initialize the subsystems
|
||||||
winvideo_init(machine);
|
winvideo_init(&machine);
|
||||||
winsound_init(machine);
|
winsound_init(&machine);
|
||||||
wininput_init(machine);
|
wininput_init(&machine);
|
||||||
winoutput_init(machine);
|
winoutput_init(&machine);
|
||||||
|
|
||||||
// notify listeners of screen configuration
|
// notify listeners of screen configuration
|
||||||
astring tempstring;
|
astring tempstring;
|
||||||
@ -555,8 +579,8 @@ void osd_init(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hook up the debugger log
|
// hook up the debugger log
|
||||||
if (options_get_bool(machine->options(), WINOPTION_OSLOG))
|
if (options_get_bool(machine.options(), WINOPTION_OSLOG))
|
||||||
machine->add_logerror_callback(output_oslog);
|
machine.add_logerror_callback(output_oslog);
|
||||||
|
|
||||||
// crank up the multimedia timer resolution to its max
|
// crank up the multimedia timer resolution to its max
|
||||||
// this gives the system much finer timeslices
|
// 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);
|
// mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index);
|
||||||
|
|
||||||
// if a watchdog thread is requested, create one
|
// 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)
|
if (watchdog != 0)
|
||||||
{
|
{
|
||||||
watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
@ -588,7 +612,7 @@ void osd_init(running_machine *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// note the existence of a 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
|
// osd_exit
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static void osd_exit(running_machine &machine)
|
void windows_osd_interface::osd_exit(running_machine &machine)
|
||||||
{
|
{
|
||||||
// no longer have a machine
|
// no longer have a machine
|
||||||
g_current_machine = NULL;
|
g_current_machine = NULL;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#include "options.h"
|
#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
|
// GLOBAL VARIABLES
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -139,6 +172,7 @@ extern const options_entry mame_win_options[];
|
|||||||
extern int osd_num_processors;
|
extern int osd_num_processors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// FUNCTION PROTOTYPES
|
// FUNCTION PROTOTYPES
|
||||||
//============================================================
|
//============================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user