-Reorganized OSD, handling more sound output systems and debuggers, defaults left same as before [Miodrag Milanovic]

-Created osd_options as base option class for non-system specific options
This commit is contained in:
Miodrag Milanovic 2014-05-08 07:39:04 +00:00
parent 198162b8f5
commit 69faaf3aeb
51 changed files with 2613 additions and 547 deletions

51
.gitattributes vendored
View File

@ -8968,6 +8968,36 @@ src/mess/video/zx8301.h svneol=native#text/plain
src/osd/eigccppc.h svneol=native#text/plain
src/osd/eigccx86.h svneol=native#text/plain
src/osd/eminline.h svneol=native#text/plain
src/osd/modules/debugger/debugint.c svneol=native#text/plain
src/osd/modules/debugger/debugint.h svneol=native#text/plain
src/osd/modules/debugger/debugosx.h svneol=native#text/plain
src/osd/modules/debugger/debugosx.m svneol=native#text/plain
src/osd/modules/debugger/debugqt.c svneol=native#text/plain
src/osd/modules/debugger/debugqt.h svneol=native#text/plain
src/osd/modules/debugger/debugwin.c svneol=native#text/plain
src/osd/modules/debugger/debugwin.h svneol=native#text/plain
src/osd/modules/debugger/none.c svneol=native#text/plain
src/osd/modules/debugger/none.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtbreakpointswindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtbreakpointswindow.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtdasmwindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtdasmwindow.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtlogwindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtlogwindow.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtmainwindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtmainwindow.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtmemorywindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtmemorywindow.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtview.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtview.h svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtwindow.c svneol=native#text/plain
src/osd/modules/debugger/qt/debugqtwindow.h svneol=native#text/plain
src/osd/modules/sound/direct_sound.c svneol=native#text/plain
src/osd/modules/sound/direct_sound.h svneol=native#text/plain
src/osd/modules/sound/none.c svneol=native#text/plain
src/osd/modules/sound/none.h svneol=native#text/plain
src/osd/modules/sound/sdl_sound.c svneol=native#text/plain
src/osd/modules/sound/sdl_sound.h svneol=native#text/plain
src/osd/osdcomm.h svneol=native#text/plain
src/osd/osdcore.c svneol=native#text/plain
src/osd/osdcore.h svneol=native#text/plain
@ -8990,24 +9020,6 @@ src/osd/sdl/SDLMain_tmpl.h svneol=native#text/plain
src/osd/sdl/SDLMain_tmpl.m svneol=native#text/plain
src/osd/sdl/blit13.h svneol=native#text/plain
src/osd/sdl/build.mak svneol=native#text/plain
src/osd/sdl/debugosx.h svneol=native#text/plain
src/osd/sdl/debugosx.m svneol=native#text/plain
src/osd/sdl/debugqt.c svneol=native#text/plain
src/osd/sdl/debugqtbreakpointswindow.c svneol=native#text/plain
src/osd/sdl/debugqtbreakpointswindow.h svneol=native#text/plain
src/osd/sdl/debugqtdasmwindow.c svneol=native#text/plain
src/osd/sdl/debugqtdasmwindow.h svneol=native#text/plain
src/osd/sdl/debugqtlogwindow.c svneol=native#text/plain
src/osd/sdl/debugqtlogwindow.h svneol=native#text/plain
src/osd/sdl/debugqtmainwindow.c svneol=native#text/plain
src/osd/sdl/debugqtmainwindow.h svneol=native#text/plain
src/osd/sdl/debugqtmemorywindow.c svneol=native#text/plain
src/osd/sdl/debugqtmemorywindow.h svneol=native#text/plain
src/osd/sdl/debugqtview.c svneol=native#text/plain
src/osd/sdl/debugqtview.h svneol=native#text/plain
src/osd/sdl/debugqtwindow.c svneol=native#text/plain
src/osd/sdl/debugqtwindow.h svneol=native#text/plain
src/osd/sdl/debugwin.c svneol=native#text/plain
src/osd/sdl/draw13.c svneol=native#text/plain
src/osd/sdl/drawogl.c svneol=native#text/plain
src/osd/sdl/drawsdl.c svneol=native#text/plain
@ -9092,7 +9104,6 @@ src/osd/sdl/shader/glsl_plain_rgb32_dir.fsh svneol=native#text/plain
src/osd/sdl/shader/glsl_plain_rgb32_dir.fsh.c svneol=native#text/plain
src/osd/sdl/shader/glsl_plain_rgb32_lut.fsh svneol=native#text/plain
src/osd/sdl/shader/glsl_plain_rgb32_lut.fsh.c svneol=native#text/plain
src/osd/sdl/sound.c svneol=native#text/plain
src/osd/sdl/strconv.c svneol=native#text/plain
src/osd/sdl/strconv.h svneol=native#text/plain
src/osd/sdl/taputil.sh svneol=LF#text/plain eol=lf
@ -9108,7 +9119,6 @@ src/osd/windows/d3dcomm.h svneol=native#text/plain
src/osd/windows/d3dhlsl.c svneol=native#text/plain
src/osd/windows/d3dhlsl.h svneol=native#text/plain
src/osd/windows/d3dintf.h svneol=native#text/plain
src/osd/windows/debugwin.c svneol=native#text/plain
src/osd/windows/drawd3d.c svneol=native#text/plain
src/osd/windows/drawd3d.h svneol=native#text/plain
src/osd/windows/drawdd.c svneol=native#text/plain
@ -9129,7 +9139,6 @@ src/osd/windows/netdev_pcap.h svneol=native#text/plain
src/osd/windows/osinline.h svneol=native#text/plain
src/osd/windows/output.c svneol=native#text/plain
src/osd/windows/output.h svneol=native#text/plain
src/osd/windows/sound.c svneol=native#text/plain
src/osd/windows/strconv.c svneol=native#text/plain
src/osd/windows/strconv.h svneol=native#text/plain
src/osd/windows/vconv.c svneol=native#text/plain

View File

@ -17,7 +17,6 @@
#include "express.h"
#include "debugvw.h"
#include "debugger.h"
#include "debugint/debugint.h"
#include "uiinput.h"
#include "xmlfile.h"
#include <ctype.h>
@ -1936,8 +1935,6 @@ void device_debug::instruction_hook(offs_t curpc)
global->memory_modified = false;
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

View File

@ -17,7 +17,6 @@
#include "debug/debugcon.h"
#include "debug/express.h"
#include "debug/debugvw.h"
#include "debugint/debugint.h"
#include <ctype.h>
@ -72,9 +71,6 @@ void debugger_init(running_machine &machine)
debug_command_init(machine);
debug_console_init(machine);
/* always initialize the internal render debugger */
debugint_init(machine);
/* allocate a new entry for our global list */
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_exit), &machine));
entry = global_alloc(machine_entry);

View File

@ -25,7 +25,6 @@ OBJDIRS += \
$(EMUOBJ)/cpu \
$(EMUOBJ)/sound \
$(EMUOBJ)/debug \
$(EMUOBJ)/debugint \
$(EMUOBJ)/audio \
$(EMUOBJ)/bus \
$(EMUOBJ)/drivers \
@ -39,7 +38,10 @@ OSDSRC = $(SRC)/osd
OSDOBJ = $(OBJ)/osd
OBJDIRS += \
$(OSDOBJ)
$(OSDOBJ) \
$(OSDOBJ)/modules \
$(OSDOBJ)/modules/sound \
$(OSDOBJ)/modules/debugger \
#-------------------------------------------------
@ -141,12 +143,14 @@ EMUOBJS = \
$(EMUOBJ)/debug/dvtext.o \
$(EMUOBJ)/debug/express.o \
$(EMUOBJ)/debug/textbuf.o \
$(EMUOBJ)/debugint/debugint.o \
$(EMUOBJ)/profiler.o \
$(EMUOBJ)/webengine.o \
$(OSDOBJ)/osdcore.o \
$(OSDOBJ)/osdepend.o \
$(OSDOBJ)/osdnet.o
$(OSDOBJ)/osdnet.o \
$(OSDOBJ)/modules/sound/none.o \
$(OSDOBJ)/modules/debugger/none.o \
$(OSDOBJ)/modules/debugger/debugint.o \
EMUSOUNDOBJS = \
$(EMUOBJ)/sound/filter.o \

View File

@ -113,7 +113,6 @@ const options_entry emu_options::s_option_entries[] =
// sound options
{ NULL, NULL, OPTION_HEADER, "CORE SOUND OPTIONS" },
{ OPTION_SOUND, "1", OPTION_BOOLEAN, "enable sound output" },
{ OPTION_SAMPLERATE ";sr(1000-1000000)", "48000", OPTION_INTEGER, "set sound output sample rate" },
{ OPTION_SAMPLES, "1", OPTION_BOOLEAN, "enable the use of external samples if available" },
{ OPTION_VOLUME ";vol", "0", OPTION_INTEGER, "sound volume in decibels (-32 min, 0 max)" },
@ -150,12 +149,8 @@ const options_entry emu_options::s_option_entries[] =
// debugging options
{ NULL, NULL, OPTION_HEADER, "CORE DEBUGGING OPTIONS" },
{ OPTION_LOG, "0", OPTION_BOOLEAN, "generate an error.log file" },
{ OPTION_VERBOSE ";v", "0", OPTION_BOOLEAN, "display additional diagnostic information" },
{ OPTION_UPDATEINPAUSE, "0", OPTION_BOOLEAN, "keep calling video updates while in pause" },
{ OPTION_DEBUG ";d", "0", OPTION_BOOLEAN, "enable/disable debugger" },
{ OPTION_DEBUGSCRIPT, NULL, OPTION_STRING, "script for debugger" },
{ OPTION_DEBUG_INTERNAL ";di", "0", OPTION_BOOLEAN, "use the internal debugger for debugging" },
// misc options
{ NULL, NULL, OPTION_HEADER, "CORE MISC OPTIONS" },
@ -190,6 +185,7 @@ const options_entry emu_options::s_option_entries[] =
emu_options::emu_options()
{
add_entries(s_option_entries);
add_osd_options();
}

View File

@ -154,11 +154,7 @@ enum
#define OPTION_MOUSE_DEVICE "mouse_device"
// core debugging options
#define OPTION_LOG "log"
#define OPTION_VERBOSE "verbose"
#define OPTION_UPDATEINPAUSE "update_in_pause"
#define OPTION_DEBUG "debug"
#define OPTION_DEBUG_INTERNAL "debug_internal"
#define OPTION_DEBUGSCRIPT "debugscript"
// core misc options
@ -189,7 +185,7 @@ enum
struct game_driver;
class emu_options : public core_options
class emu_options : public osd_options
{
static const UINT32 OPTION_FLAG_DEVICE = 0x80000000;
@ -285,7 +281,7 @@ public:
float flicker() const { return float_value(OPTION_FLICKER); }
// core sound options
bool sound() const { return bool_value(OPTION_SOUND); }
const char *sound() const { return value(OPTION_SOUND); }
int sample_rate() const { return int_value(OPTION_SAMPLERATE); }
bool samples() const { return bool_value(OPTION_SAMPLES); }
int volume() const { return int_value(OPTION_VOLUME); }
@ -317,10 +313,6 @@ public:
int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); }
// core debugging options
bool verbose() const { return bool_value(OPTION_VERBOSE); }
bool log() const { return bool_value(OPTION_LOG); }
bool debug() const { return bool_value(OPTION_DEBUG); }
bool debug_internal() const { return bool_value(OPTION_DEBUG_INTERNAL); }
const char *debug_script() const { return value(OPTION_DEBUGSCRIPT); }
bool update_in_pause() const { return bool_value(OPTION_UPDATEINPAUSE); }

View File

@ -159,7 +159,7 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o
// fetch core options
if (options().debug())
debug_flags = (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) | (options().debug_internal() ? 0 : DEBUG_FLAG_OSD_ENABLED);
debug_flags = (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) | (DEBUG_FLAG_OSD_ENABLED);
}

View File

@ -796,7 +796,7 @@ sound_manager::sound_manager(running_machine &machine)
m_rightmix(machine.sample_rate()),
m_muted(0),
m_attenuation(0),
m_nosound_mode(!machine.options().sound()),
m_nosound_mode(machine.osd().no_sound()),
m_wavfile(NULL),
m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds),
m_last_update(attotime::zero)

View File

@ -12,7 +12,6 @@
#include "emuopts.h"
#include "png.h"
#include "debugger.h"
#include "debugint/debugint.h"
#include "ui/ui.h"
#include "aviio.h"
#include "crsshair.h"
@ -214,9 +213,6 @@ void video_manager::frame_update(bool debug)
// draw the user interface
machine().ui().update_and_render(&machine().render().ui_container());
// update the internal render debugger
debugint_update_during_game(machine());
// if we're throttling, synchronize before rendering
attotime current_time = machine().time();
if (!debug && !skipped_it && effective_throttle())

View File

@ -124,6 +124,17 @@ void core_options::entry::set_default_value(const char *defvalue)
}
//-------------------------------------------------
// set_description - set the description of
// an option
//-------------------------------------------------
void core_options::entry::set_description(const char *description)
{
m_description = description;
}
void core_options::entry::set_flag(UINT32 mask, UINT32 flag)
{
m_flags = ( m_flags & mask ) | flag;
@ -298,6 +309,23 @@ void core_options::set_default_value(const char *name, const char *defvalue)
}
//-------------------------------------------------
// set_description - change the description
// of an option
//-------------------------------------------------
void core_options::set_description(const char *name, const char *description)
{
// find the entry and bail if we can't
entry *curentry = m_entrymap.find(name);
if (curentry == NULL)
return;
// update the data and default data
curentry->set_description(description);
}
//-------------------------------------------------
// parse_command_line - parse a series of
// command line arguments
@ -542,6 +570,17 @@ const char *core_options::value(const char *name) const
}
//-------------------------------------------------
// description - return description of option
//-------------------------------------------------
const char *core_options::description(const char *name) const
{
entry *curentry = m_entrymap.find(name);
return (curentry != NULL) ? curentry->description() : "";
}
//-------------------------------------------------
// priority - return the priority of option
//-------------------------------------------------

View File

@ -94,6 +94,7 @@ public:
// setters
void set_value(const char *newvalue, int priority);
void set_default_value(const char *defvalue);
void set_description(const char *description);
void set_flag(UINT32 mask, UINT32 flag);
void revert(int priority);
@ -134,6 +135,7 @@ public:
void add_entry(const options_entry &data, bool override_existing = false) { add_entry(data.name, data.description, data.flags, data.defvalue, override_existing); }
void add_entries(const options_entry *entrylist, bool override_existing = false);
void set_default_value(const char *name, const char *defvalue);
void set_description(const char *name, const char *description);
void remove_entry(entry &delentry);
// parsing/input
@ -149,6 +151,7 @@ public:
// reading
const char *value(const char *option) const;
const char *description(const char *option) const;
int priority(const char *option) const;
bool bool_value(const char *name) const { return (atoi(value(name)) != 0); }
int int_value(const char *name) const { return atoi(value(name)); }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
/*********************************************************************
debugint.c
Internal debugger frontend using render interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
*********************************************************************/
#pragma once
#ifndef __DEBUGGER_INTERNAL_H__
#define __DEBUGGER_INTERNAL_H__
#include "osdepend.h"
class debugger_internal : public osd_debugger_interface
{
public:
// construction/destruction
debugger_internal(const osd_interface &osd);
virtual ~debugger_internal() { }
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
};
extern const osd_debugger_type OSD_DEBUGGER_INTERNAL;
#endif /* __DEBUGGER_INTERNAL_H__ */

View File

@ -364,6 +364,21 @@ typedef float CGFloat;
@end
class debugger_osx : public osd_debugger_interface
{
public:
// construction/destruction
debugger_osx(const osd_interface &osd);
virtual ~debugger_osx() { }
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
};
extern const osd_debugger_type OSD_DEBUGGER_OSX;
#endif // __OBJC__
#endif // __SDL_DEBUGOSX__

View File

@ -64,20 +64,29 @@ static void debugwin_view_update(debug_view &view, void *osdprivate);
static void console_create_window(running_machine &machine);
const osd_debugger_type OSD_DEBUGGER_OSX = &osd_debugger_creator<debugger_osx>;
//============================================================
// sdl_osd_interface::init_debugger
//============================================================
void sdl_osd_interface::init_debugger()
//-------------------------------------------------
// debugger_osx - constructor
//-------------------------------------------------
debugger_osx::debugger_osx(const osd_interface &osd)
: osd_debugger_interface(osd)
{
}
//============================================================
// sdl_osd_interface::wait_for_debugger
// debugger_osx::init_debugger
//============================================================
void sdl_osd_interface::wait_for_debugger(device_t &device, bool firststop)
void debugger_osx::init_debugger()
{
}
//============================================================
// debugger_osx::wait_for_debugger
//============================================================
void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
{
// create a console window
if (main_console == nil)
@ -113,7 +122,7 @@ void sdl_osd_interface::wait_for_debugger(device_t &device, bool firststop)
// debugger_update
//============================================================
void sdl_osd_interface::debugger_update()
void debugger_osx::debugger_update()
{
}
@ -121,7 +130,7 @@ void sdl_osd_interface::debugger_update()
// debugger_exit
//============================================================
void sdl_osd_interface::debugger_exit()
void debugger_osx::debugger_exit()
{
}

View File

@ -9,8 +9,6 @@
//
//============================================================
#if !defined(NO_DEBUGGER)
#define NO_MEM_TRACKING
#include <vector>
@ -19,21 +17,22 @@
#include <QtGui/QApplication>
#include "emu.h"
#if defined(WIN32) && !defined(SDLMAME_WIN32)
#include "winmain.h"
#define xxx_osd_interface windows_osd_interface
#else
#include "osdsdl.h"
#define xxx_osd_interface sdl_osd_interface
#endif
#include "config.h"
#include "debugger.h"
#include "debugqtlogwindow.h"
#include "debugqtmainwindow.h"
#include "debugqtdasmwindow.h"
#include "debugqtmemorywindow.h"
#include "debugqtbreakpointswindow.h"
#include "qt/debugqtlogwindow.h"
#include "qt/debugqtmainwindow.h"
#include "qt/debugqtdasmwindow.h"
#include "qt/debugqtmemorywindow.h"
#include "qt/debugqtbreakpointswindow.h"
#include "debugqt.h"
osd_debugger_interface *qt_osd_debugger_creator(const osd_interface &osd)
{
return new debugger_qt(osd);
}
const osd_debugger_type OSD_DEBUGGER_QT = &qt_osd_debugger_creator;
//============================================================
// "Global" variables to make QT happy
@ -43,8 +42,19 @@ int qtArgc = 0;
char** qtArgv = NULL;
bool oneShot = true;
MainWindow* mainQtWindow = NULL;
static MainWindow* mainQtWindow = NULL;
//-------------------------------------------------
// debugger_qt - constructor
//-------------------------------------------------
debugger_qt::debugger_qt(const osd_interface &osd)
: osd_debugger_interface(osd)
{
}
debugger_qt::~debugger_qt()
{
}
//============================================================
// XML configuration save/load
@ -205,7 +215,7 @@ static void bring_main_window_to_front()
bool winwindow_qt_filter(void *message);
#endif
void xxx_osd_interface::init_debugger()
void debugger_qt::init_debugger()
{
if (qApp == NULL)
{
@ -228,10 +238,10 @@ void xxx_osd_interface::init_debugger()
}
// Setup the configuration XML saving and loading
config_register(machine(),
config_register(m_osd.machine(),
"debugger",
config_saveload_delegate(FUNC(xml_configuration_load), &machine()),
config_saveload_delegate(FUNC(xml_configuration_save), &machine()));
config_saveload_delegate(FUNC(xml_configuration_load), &m_osd.machine()),
config_saveload_delegate(FUNC(xml_configuration_save), &m_osd.machine()));
}
@ -245,7 +255,7 @@ extern int sdl_entered_debugger;
void winwindow_update_cursor_state(running_machine &machine);
#endif
void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
void debugger_qt::wait_for_debugger(device_t &device, bool firststop)
{
#if defined(SDLMAME_UNIX) || defined(SDLMAME_WIN32)
sdl_entered_debugger = 1;
@ -254,9 +264,9 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
// Dialog initialization
if (oneShot)
{
mainQtWindow = new MainWindow(&machine());
mainQtWindow = new MainWindow(&m_osd.machine());
load_and_clear_main_window_config(xmlConfigurations);
setup_additional_startup_windows(machine(), xmlConfigurations);
setup_additional_startup_windows(m_osd.machine(), xmlConfigurations);
mainQtWindow->show();
oneShot = false;
}
@ -274,7 +284,7 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
mainQtWindow->setProcessor(&device);
// Run our own QT event loop
while (debug_cpu_is_stopped(machine()))
while (debug_cpu_is_stopped(m_osd.machine()))
{
osd_sleep(50000);
qApp->processEvents(QEventLoop::AllEvents, 1);
@ -301,7 +311,7 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
}
// Exit if the machine has been instructed to do so (scheduled event == exit || hard_reset)
if (machine().scheduled_event_pending())
if (m_osd.machine().scheduled_event_pending())
{
// Keep a list of windows we want to save.
// We need to do this here because by the time xml_configuration_save gets called
@ -310,7 +320,7 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
break;
}
#if defined(WIN32) && !defined(SDLMAME_WIN32)
winwindow_update_cursor_state(machine()); // make sure the cursor isn't hidden while in debugger
winwindow_update_cursor_state(m_osd.machine()); // make sure the cursor isn't hidden while in debugger
#endif
}
}
@ -320,40 +330,12 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
// Available for video.*
//============================================================
void xxx_osd_interface::debugger_update()
void debugger_qt::debugger_update()
{
qApp->processEvents(QEventLoop::AllEvents, 1);
}
void xxx_osd_interface::debugger_exit()
void debugger_qt::debugger_exit()
{
}
#else
#include "sdlinc.h"
#include "emu.h"
#include "osdepend.h"
#include "osdsdl.h"
void sdl_osd_interface::init_debugger()
{
}
void sdl_osd_interface::wait_for_debugger(device_t &device, bool firststop)
{
}
void sdl_osd_interface::debugger_update()
{
}
void sdl_osd_interface::debugger_exit()
{
}
#endif

View File

@ -0,0 +1,34 @@
//============================================================
//
// debugqt.h - SDL/QT debug window handling
//
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
// Visit http://mamedev.org for licensing and usage restrictions.
//
// SDLMAME by Olivier Galibert and R. Belmont
//
//============================================================
#pragma once
#ifndef __DEBUGGER_QT_H__
#define __DEBUGGER_QT_H__
#include "osdepend.h"
class debugger_qt : public osd_debugger_interface
{
public:
// construction/destruction
debugger_qt(const osd_interface &osd);
virtual ~debugger_qt();
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
};
extern const osd_debugger_type OSD_DEBUGGER_QT;
#endif /* __DEBUGGER_QT_H__ */

View File

@ -32,13 +32,13 @@
// MAMEOS headers
#include "winmain.h"
#include "window.h"
#include "video.h"
#include "input.h"
#include "config.h"
#include "../../windows/input.h"
#include "strconv.h"
#include "winutf8.h"
#include "debugwin.h"
const osd_debugger_type OSD_DEBUGGER_WINDOWS = &osd_debugger_creator<debugger_windows>;
//============================================================
// PARAMETERS
@ -238,17 +238,26 @@ static void smart_show_all(BOOL show);
static void image_update_menu(debugwin_info *info);
//-------------------------------------------------
// debugger_windows - constructor
//-------------------------------------------------
debugger_windows::debugger_windows(const osd_interface &osd)
: osd_debugger_interface(osd)
{
}
//============================================================
// wait_for_debugger
//============================================================
void windows_osd_interface::wait_for_debugger(device_t &device, bool firststop)
void debugger_windows::wait_for_debugger(device_t &device, bool firststop)
{
MSG message;
// create a console window
if (main_console == NULL)
console_create_window(machine());
console_create_window(m_osd.machine());
// update the views in the console to reflect the current CPU
if (main_console != NULL)
@ -267,7 +276,7 @@ void windows_osd_interface::wait_for_debugger(device_t &device, bool firststop)
smart_show_all(TRUE);
// run input polling to ensure that our status is in sync
wininput_poll(machine());
wininput_poll(m_osd.machine());
// get and process messages
GetMessage(&message, NULL, 0, 0);
@ -285,7 +294,7 @@ void windows_osd_interface::wait_for_debugger(device_t &device, bool firststop)
// process everything else
default:
winwindow_dispatch_message(machine(), &message);
winwindow_dispatch_message(m_osd.machine(), &message);
break;
}
@ -359,7 +368,7 @@ static int debugwin_seq_pressed(running_machine &machine)
// debugwin_init_windows
//============================================================
void windows_osd_interface::init_debugger()
void debugger_windows::init_debugger()
{
static int class_registered;
@ -405,7 +414,7 @@ void windows_osd_interface::init_debugger()
if (temp_dc != NULL)
{
windows_options &options = downcast<windows_options &>(machine().options());
windows_options &options = downcast<windows_options &>(m_osd.machine().options());
int size = options.debugger_font_size();
TCHAR *t_face;
@ -443,7 +452,7 @@ void windows_osd_interface::init_debugger()
// debugwin_destroy_windows
//============================================================
void windows_osd_interface::debugger_exit()
void debugger_windows::debugger_exit()
{
// loop over windows and free them
while (window_list != NULL)
@ -462,18 +471,18 @@ void windows_osd_interface::debugger_exit()
// debugger_update
//============================================================
void windows_osd_interface::debugger_update()
void debugger_windows::debugger_update()
{
// if we're running live, do some checks
if (!winwindow_has_focus() && !debug_cpu_is_stopped(machine()) && machine().phase() == MACHINE_PHASE_RUNNING)
if (!winwindow_has_focus() && !debug_cpu_is_stopped(m_osd.machine()) && m_osd.machine().phase() == MACHINE_PHASE_RUNNING)
{
// see if the interrupt key is pressed and break if it is
if (debugwin_seq_pressed(machine()))
if (debugwin_seq_pressed(m_osd.machine()))
{
HWND focuswnd = GetFocus();
debugwin_info *info;
debug_cpu_get_visible_cpu(machine())->debug()->halt_on_next_instruction("User-initiated break\n");
debug_cpu_get_visible_cpu(m_osd.machine())->debug()->halt_on_next_instruction("User-initiated break\n");
// if we were focused on some window's edit box, reset it to default
for (info = window_list; info != NULL; info = info->next)

View File

@ -0,0 +1,32 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
//============================================================
//
// debugwin.h - Win32 debug window handling
//
//============================================================
#pragma once
#ifndef __DEBUGGER_WINDOWS_H__
#define __DEBUGGER_WINDOWS_H__
#include "osdepend.h"
class debugger_windows : public osd_debugger_interface
{
public:
// construction/destruction
debugger_windows(const osd_interface &osd);
virtual ~debugger_windows() { }
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
};
extern const osd_debugger_type OSD_DEBUGGER_WINDOWS;
#endif /* __DEBUGGER_WINDOWS_H__ */

View File

@ -0,0 +1,36 @@
//============================================================
//
// none.c - stubs for linking when NO_DEBUGGER is defined
//
//============================================================
#include "none.h"
#include "debug/debugcpu.h"
const osd_debugger_type OSD_DEBUGGER_NONE = &osd_debugger_creator<debugger_none>;
//-------------------------------------------------
// debugger_none - constructor
//-------------------------------------------------
debugger_none::debugger_none(const osd_interface &osd)
: osd_debugger_interface(osd)
{
}
void debugger_none::init_debugger()
{
}
void debugger_none::wait_for_debugger(device_t &device, bool firststop)
{
debug_cpu_get_visible_cpu(m_osd.machine())->debug()->go();
}
void debugger_none::debugger_update()
{
}
void debugger_none::debugger_exit()
{
}

View File

@ -0,0 +1,33 @@
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************
none.h
Dummy debugger interface.
*******************************************************************c********/
#pragma once
#ifndef __DEBUGGER_NONE_H__
#define __DEBUGGER_NONE_H__
#include "osdepend.h"
class debugger_none : public osd_debugger_interface
{
public:
// construction/destruction
debugger_none(const osd_interface &osd);
virtual ~debugger_none() { }
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
};
extern const osd_debugger_type OSD_DEBUGGER_NONE;
#endif /* __DEBUGGER_NONE_H__ */

View File

@ -489,3 +489,11 @@ void MainWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
m_windowState = QByteArray::fromPercentEncoding(state);
m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
}
DasmDockWidget::~DasmDockWidget()
{
}
ProcessorDockWidget::~ProcessorDockWidget()
{
}

View File

@ -90,7 +90,7 @@ public:
}
virtual ~DasmDockWidget() {}
virtual ~DasmDockWidget();
DebuggerView* view() { return m_dasmView; }
@ -140,7 +140,7 @@ public:
}
virtual ~ProcessorDockWidget() {}
virtual ~ProcessorDockWidget();
DebuggerView* view() { return m_processorView; }

View File

@ -22,11 +22,9 @@
#include "emuopts.h"
// MAMEOS headers
#include "direct_sound.h"
#include "winmain.h"
#include "window.h"
#include "video.h"
#include "config.h"
//============================================================
// DEBUGGING
@ -41,60 +39,26 @@
// LOCAL VARIABLES
//============================================================
// DirectSound objects
static LPDIRECTSOUND dsound;
static DSCAPS dsound_caps;
// sound buffers
static LPDIRECTSOUNDBUFFER primary_buffer;
static LPDIRECTSOUNDBUFFER stream_buffer;
static UINT32 stream_buffer_size;
static UINT32 stream_buffer_in;
// descriptors and formats
static DSBUFFERDESC primary_desc;
static DSBUFFERDESC stream_desc;
static WAVEFORMATEX primary_format;
static WAVEFORMATEX stream_format;
// buffer over/underflow counts
static int buffer_underflows;
static int buffer_overflows;
//============================================================
// PROTOTYPES
//============================================================
static HRESULT dsound_init(running_machine &machine);
static void dsound_kill(void);
static HRESULT dsound_create_buffers(void);
static void dsound_destroy_buffers(void);
const osd_sound_type OSD_SOUND_DIRECT_SOUND = &osd_sound_creator<sound_direct_sound>;
//============================================================
// sound_init
//============================================================
bool windows_osd_interface::sound_init()
//-------------------------------------------------
// sound_direct_sound - constructor
//-------------------------------------------------
sound_direct_sound::sound_direct_sound(const osd_interface &osd)
: osd_sound_interface(osd)
{
// if no sound, don't create anything
if (!machine().options().sound())
return true;
// attempt to initialize directsound
// don't make it fatal if we can't -- we'll just run without sound
dsound_init(machine());
return true;
dsound_init();
}
//============================================================
// sound_exit
//============================================================
void windows_osd_interface::sound_exit()
sound_direct_sound::~sound_direct_sound()
{
// kill the buffers and dsound
dsound_destroy_buffers();
@ -112,7 +76,7 @@ void windows_osd_interface::sound_exit()
// copy_sample_data
//============================================================
static void copy_sample_data(const INT16 *data, int bytes_to_copy)
void sound_direct_sound::copy_sample_data(const INT16 *data, int bytes_to_copy)
{
void *buffer1, *buffer2;
DWORD length1, length2;
@ -156,7 +120,7 @@ static void copy_sample_data(const INT16 *data, int bytes_to_copy)
// update_audio_stream
//============================================================
void windows_osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
void sound_direct_sound::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;
@ -212,7 +176,7 @@ void windows_osd_interface::update_audio_stream(const INT16 *buffer, int samples
// set_mastervolume
//============================================================
void windows_osd_interface::set_mastervolume(int attenuation)
void sound_direct_sound::set_mastervolume(int attenuation)
{
// clamp the attenuation to 0-32 range
if (attenuation > 0)
@ -230,7 +194,7 @@ void windows_osd_interface::set_mastervolume(int attenuation)
// dsound_init
//============================================================
static HRESULT dsound_init(running_machine &machine)
HRESULT sound_direct_sound::dsound_init()
{
HRESULT result;
@ -263,12 +227,12 @@ static HRESULT dsound_init(running_machine &machine)
stream_format.wBitsPerSample = 16;
stream_format.wFormatTag = WAVE_FORMAT_PCM;
stream_format.nChannels = 2;
stream_format.nSamplesPerSec = machine.sample_rate();
stream_format.nSamplesPerSec = m_osd.machine().sample_rate();
stream_format.nBlockAlign = stream_format.wBitsPerSample * stream_format.nChannels / 8;
stream_format.nAvgBytesPerSec = stream_format.nSamplesPerSec * stream_format.nBlockAlign;
// compute the buffer size based on the output sample rate
stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * downcast<windows_options &>(machine.options()).audio_latency() / 10;
stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * downcast<windows_options &>(m_osd.machine().options()).audio_latency() / 10;
stream_buffer_size = (stream_buffer_size / 1024) * 1024;
if (stream_buffer_size < 1024)
stream_buffer_size = 1024;
@ -301,7 +265,7 @@ error:
// dsound_kill
//============================================================
static void dsound_kill(void)
void sound_direct_sound::dsound_kill()
{
// release the object
if (dsound != NULL)
@ -314,7 +278,7 @@ static void dsound_kill(void)
// dsound_create_buffers
//============================================================
static HRESULT dsound_create_buffers(void)
HRESULT sound_direct_sound::dsound_create_buffers()
{
HRESULT result;
void *buffer;
@ -391,7 +355,7 @@ error:
// dsound_destroy_buffers
//============================================================
static void dsound_destroy_buffers(void)
void sound_direct_sound::dsound_destroy_buffers(void)
{
// stop any playback
if (stream_buffer != NULL)
@ -407,3 +371,4 @@ static void dsound_destroy_buffers(void)
IDirectSoundBuffer_Release(primary_buffer);
primary_buffer = NULL;
}

View File

@ -0,0 +1,64 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
//============================================================
//
// sound.c - Win32 implementation of MAME sound routines
//
//============================================================
#pragma once
#ifndef __SOUND_DSOUND_H__
#define __SOUND_DSOUND_H__
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
// undef WINNT for dsound.h to prevent duplicate definition
#undef WINNT
#include <dsound.h>
#undef interface
#include "osdepend.h"
class sound_direct_sound : public osd_sound_interface
{
public:
// construction/destruction
sound_direct_sound(const osd_interface &osd);
virtual ~sound_direct_sound();
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
HRESULT dsound_init();
void dsound_kill();
HRESULT dsound_create_buffers();
void dsound_destroy_buffers();
void copy_sample_data(const INT16 *data, int bytes_to_copy);
private:
// DirectSound objects
LPDIRECTSOUND dsound;
DSCAPS dsound_caps;
// sound buffers
LPDIRECTSOUNDBUFFER primary_buffer;
LPDIRECTSOUNDBUFFER stream_buffer;
UINT32 stream_buffer_size;
UINT32 stream_buffer_in;
// descriptors and formats
DSBUFFERDESC primary_desc;
DSBUFFERDESC stream_desc;
WAVEFORMATEX primary_format;
WAVEFORMATEX stream_format;
// buffer over/underflow counts
int buffer_underflows;
int buffer_overflows;
};
extern const osd_sound_type OSD_SOUND_DIRECT_SOUND;
#endif /* __SOUND_DSOUND_H__ */

View File

@ -0,0 +1,23 @@
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************
none.c
Dummy sound interface.
*******************************************************************c********/
#include "none.h"
//-------------------------------------------------
// sound_none - constructor
//-------------------------------------------------
sound_none::sound_none(const osd_interface &osd)
: osd_sound_interface(osd)
{
}
const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;

View File

@ -0,0 +1,31 @@
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************
none.h
Dummy sound interface.
*******************************************************************c********/
#pragma once
#ifndef __SOUND_NONE_H__
#define __SOUND_NONE_H__
#include "osdepend.h"
class sound_none : public osd_sound_interface
{
public:
// construction/destruction
sound_none(const osd_interface &osd);
virtual ~sound_none() { }
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) { }
virtual void set_mastervolume(int attenuation) { }
};
extern const osd_sound_type OSD_SOUND_NONE;
#endif /* __SOUND_NONE_H__ */

View File

@ -10,14 +10,14 @@
//============================================================
// standard sdl header
#include "sdlinc.h"
#include "../../sdl/sdlinc.h"
// MAME headers
#include "emu.h"
#include "emuopts.h"
#include "osdepend.h"
#include "osdsdl.h"
#include "sdl_sound.h"
#include "../../sdl/osdsdl.h"
//============================================================
// DEBUGGING
@ -75,48 +75,48 @@ static int sdl_create_buffers(void);
static void sdl_destroy_buffers(void);
static void SDLCALL sdl_callback(void *userdata, Uint8 *stream, int len);
const osd_sound_type OSD_SOUND_SDL = &osd_sound_creator<sound_sdl>;
//============================================================
// osd_start_audio_stream
//============================================================
bool sdl_osd_interface::sound_init()
//-------------------------------------------------
// sound_sdl - constructor
//-------------------------------------------------
sound_sdl::sound_sdl(const osd_interface &osd)
: osd_sound_interface(osd)
{
if (LOG_SOUND)
sound_log = fopen(SDLMAME_SOUND_LOG, "w");
// skip if sound disabled
if (machine().sample_rate() != 0)
if (osd.machine().sample_rate() != 0)
{
if (initialized_audio)
{
sound_exit();
//sound_exit();
}
// attempt to initialize SDL
if (sdl_init(machine()))
return false;
if (sdl_init(osd.machine()))
return;
// set the startup volume
machine().osd().set_mastervolume(attenuation);
set_mastervolume(attenuation);
}
return true;
}
//============================================================
// osd_stop_audio_stream
// sound_sdl - destructor
//============================================================
void sdl_osd_interface::sound_exit()
sound_sdl::~sound_sdl()
{
// if nothing to do, don't do it
if (machine().sample_rate() == 0)
if (m_osd.machine().sample_rate() == 0)
return;
// kill the buffers and dsound
sdl_kill(machine());
sdl_kill(m_osd.machine());
sdl_destroy_buffers();
// print out over/underflow stats
@ -264,10 +264,10 @@ static void copy_sample_data(running_machine &machine, const INT16 *data, int by
// update_audio_stream
//============================================================
void sdl_osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_frame)
void sound_sdl::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 (m_osd.machine().sample_rate() != 0 && stream_buffer)
{
int bytes_this_frame = samples_this_frame * sizeof(INT16) * 2;
int play_position, write_position, stream_in;
@ -275,7 +275,7 @@ void sdl_osd_interface::update_audio_stream(const INT16 *buffer, int samples_thi
play_position = stream_playpos;
write_position = stream_playpos + ((machine().sample_rate() / 50) * sizeof(INT16) * 2);
write_position = stream_playpos + ((m_osd.machine().sample_rate() / 50) * sizeof(INT16) * 2);
orig_write = write_position;
if (!stream_in_initialized)
@ -336,7 +336,7 @@ void sdl_osd_interface::update_audio_stream(const INT16 *buffer, int samples_thi
// now we know where to copy; let's do it
stream_buffer_in = stream_in;
copy_sample_data(machine(), buffer, bytes_this_frame);
copy_sample_data(m_osd.machine(), buffer, bytes_this_frame);
}
}
@ -346,7 +346,7 @@ void sdl_osd_interface::update_audio_stream(const INT16 *buffer, int samples_thi
// set_mastervolume
//============================================================
void sdl_osd_interface::set_mastervolume(int _attenuation)
void sound_sdl::set_mastervolume(int _attenuation)
{
// clamp the attenuation to 0-32 range
if (_attenuation > 0)
@ -429,6 +429,11 @@ static int sdl_init(running_machine &machine)
SDL_AudioSpec aspec, obtained;
char audio_driver[16] = "";
if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);
}
osd_printf_verbose("Audio: Start initialization\n");
#if (SDLMAME_SDL2)
strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
@ -509,6 +514,7 @@ static void sdl_kill(running_machine &machine)
SDL_CloseAudio();
}
SDL_QuitSubSystem(SDL_INIT_AUDIO);
}

View File

@ -0,0 +1,31 @@
//============================================================
//
// sound.c - SDL implementation of MAME sound routines
//
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
// Visit http://mamedev.org for licensing and usage restrictions.
//
// SDLMAME by Olivier Galibert and R. Belmont
//
//============================================================
#pragma once
#ifndef __SOUND_SDL_H__
#define __SOUND_SDL_H__
#include "osdepend.h"
class sound_sdl : public osd_sound_interface
{
public:
// construction/destruction
sound_sdl(const osd_interface &osd);
virtual ~sound_sdl();
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
};
extern const osd_sound_type OSD_SOUND_SDL;
#endif /* __SOUND_SDL_H__ */

View File

@ -10,21 +10,146 @@
#include "emu.h"
#include "emuopts.h"
#include "osdepend.h"
#include "portmidi/portmidi.h"
#include "modules/sound/none.h"
#include "modules/debugger/none.h"
#include "modules/debugger/debugint.h"
extern bool g_print_verbose;
const options_entry osd_options::s_option_entries[] =
{
// debugging options
{ NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" },
{ OSDOPTION_LOG, "0", OPTION_BOOLEAN, "generate an error.log file" },
{ OSDOPTION_VERBOSE ";v", "0", OPTION_BOOLEAN, "display additional diagnostic information" },
{ OSDOPTION_DEBUG ";d", "0", OPTION_BOOLEAN, "enable/disable debugger" },
{ OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used : " },
{ OSDOPTION_OSLOG, "0", OPTION_BOOLEAN, "output error.log data to the system debugger" },
{ OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" },
// performance options
{ NULL, NULL, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" },
{ OSDOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" },
{ OSDOPTION_NUMPROCESSORS ";np", OSDOPTVAL_AUTO, OPTION_STRING, "number of processors; this overrides the number the system reports" },
{ OSDOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -nosound -nothrottle" },
// video options
{ NULL, NULL, OPTION_HEADER, "OSD VIDEO OPTIONS" },
// OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience
{ OSDOPTION_VIDEO, OSDOPTVAL_AUTO, OPTION_STRING, "video output method: " },
{ OSDOPTION_NUMSCREENS "(1-4)", "1", OPTION_INTEGER, "number of screens to create; usually, you want just one" },
{ OSDOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
{ OSDOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
{ OSDOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
{ OSDOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ OSDOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
{ OSDOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
// per-window options
{ NULL, NULL, OPTION_HEADER, "OSD PER-WINDOW VIDEO OPTIONS" },
{ OSDOPTION_SCREEN, OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_ASPECT ";screen_aspect", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio for all screens; 'auto' here will try to make a best guess" },
{ OSDOPTION_RESOLUTION ";r", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ OSDOPTION_VIEW, OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for all screens" },
{ OSDOPTION_SCREEN "0", OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_ASPECT "0", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_RESOLUTION "0;r0", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ OSDOPTION_VIEW "0", OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for the first screen" },
{ OSDOPTION_SCREEN "1", OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the second screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_ASPECT "1", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_RESOLUTION "1;r1", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ OSDOPTION_VIEW "1", OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for the second screen" },
{ OSDOPTION_SCREEN "2", OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the third screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_ASPECT "2", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_RESOLUTION "2;r2", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ OSDOPTION_VIEW "2", OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for the third screen" },
{ OSDOPTION_SCREEN "3", OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_ASPECT "3", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
{ OSDOPTION_RESOLUTION "3;r3", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ OSDOPTION_VIEW "3", OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for the fourth screen" },
// full screen options
{ NULL, NULL, OPTION_HEADER, "OSD FULL SCREEN OPTIONS" },
{ OSDOPTION_SWITCHRES, "0", OPTION_BOOLEAN, "enable resolution switching" },
// sound options
{ NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" },
{ OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " },
{ OSDOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
// End of list
{ NULL }
};
//============================================================
// osd_options
//============================================================
osd_options::osd_options()
{
}
void osd_options::add_osd_options()
{
add_entries(s_option_entries);
}
//-------------------------------------------------
// osd_interface - constructor
//-------------------------------------------------
osd_interface::osd_interface()
: m_machine(NULL)
: m_machine(NULL),
m_sound(NULL),
m_debugger(NULL)
{
}
void osd_interface::update_option(osd_options &options, const char * key, dynamic_array<const char *> &values)
{
astring current_value(options.description(key));
astring new_option_value("");
for (int index = 0; index < values.count(); index++)
{
astring t(values[index]);
if (new_option_value.len() > 0)
{
if( index != (values.count()-1))
new_option_value.cat(", ");
else
new_option_value.cat(" or ");
}
new_option_value.cat(t);
}
options.set_description(key, core_strdup(current_value.cat(new_option_value).cstr()));
}
void osd_interface::register_options(osd_options &options)
{
// Register video options and update options
video_options_add("none", NULL);
video_register();
update_option(options, OSDOPTION_VIDEO, m_video_names);
// Register sound options and update options
sound_options_add("none", OSD_SOUND_NONE);
sound_register();
update_option(options, OSDOPTION_SOUND, m_sound_names);
// Register debugger options and update options
debugger_options_add("none", OSD_DEBUGGER_NONE);
debugger_options_add("internal", OSD_DEBUGGER_INTERNAL);
debugger_register();
update_option(options, OSDOPTION_DEBUGGER, m_debugger_names);
}
//-------------------------------------------------
// osd_interface - destructor
@ -32,6 +157,8 @@ osd_interface::osd_interface()
osd_interface::~osd_interface()
{
m_debugger_options.reset();
m_sound_options.reset();
}
@ -73,11 +200,11 @@ void osd_interface::init(running_machine &machine)
m_machine = &machine;
emu_options &options = downcast<emu_options &>(machine.options());
osd_options &options = downcast<osd_options &>(machine.options());
// extract the verbose printing option
if (options.verbose())
g_print_verbose = true;
// ensure we get called on the way out
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_interface::osd_exit), this));
}
@ -112,6 +239,15 @@ void osd_interface::init_debugger()
// is active. This gives any OSD debugger interface a chance to
// create all of its structures.
//
osd_debugger_type debugger = m_debugger_options.find(machine().options().debugger());
if (debugger==NULL)
{
osd_printf_warning("debugger_init: option %s not found switching to auto\n",machine().options().debugger());
debugger = m_debugger_options.find("auto");
}
m_debugger = (*debugger)(*this);
m_debugger->init_debugger();
}
@ -128,10 +264,22 @@ void osd_interface::wait_for_debugger(device_t &device, bool firststop)
// called repeatedly until a command is issued that resumes
// execution.
//
m_debugger->wait_for_debugger(device, firststop);
}
void osd_interface::debugger_update()
{
if (m_debugger) m_debugger->debugger_update();
}
void osd_interface::debugger_exit()
{
if (m_debugger)
{
m_debugger->debugger_exit();
global_free(m_debugger);
m_debugger = NULL;
}
}
//-------------------------------------------------
@ -146,6 +294,7 @@ void osd_interface::update_audio_stream(const INT16 *buffer, int samples_this_fr
// It provides an array of stereo samples in L-R order which should be
// output at the configured sample_rate.
//
m_sound->update_audio_stream(buffer,samples_this_frame);
}
@ -162,6 +311,7 @@ void osd_interface::set_mastervolume(int attenuation)
// while (attenuation++ < 0)
// volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB
//
m_sound->set_mastervolume(attenuation);
}
@ -237,7 +387,8 @@ void osd_interface::init_subsystems()
fflush(stderr);
fflush(stdout);
exit(-1);
}
}
sound_init();
input_init();
// we need pause callbacks
@ -258,9 +409,33 @@ bool osd_interface::video_init()
bool osd_interface::sound_init()
{
osd_sound_type sound = m_sound_options.find(machine().options().sound());
if (sound==NULL)
{
osd_printf_warning("sound_init: option %s not found switching to auto\n",machine().options().sound());
sound = m_sound_options.find("auto");
}
m_sound = (*sound)(*this);
return true;
}
bool osd_interface::no_sound()
{
return (strcmp(machine().options().sound(),"none")==0) ? true : false;
}
void osd_interface::video_register()
{
}
void osd_interface::sound_register()
{
}
void osd_interface::debugger_register()
{
}
bool osd_interface::input_init()
{
return true;
@ -312,6 +487,7 @@ void osd_interface::video_exit()
void osd_interface::sound_exit()
{
global_free(m_sound);
}
void osd_interface::input_exit()
@ -333,12 +509,59 @@ void osd_interface::midi_exit()
#endif
}
void osd_interface::debugger_exit()
{
}
void osd_interface::osd_exit()
{
exit_subsystems();
}
void osd_interface::video_options_add(const char *name, void *type)
{
//m_video_options.add(name, type, false);
m_video_names.append(core_strdup(name));
}
void osd_interface::sound_options_add(const char *name, osd_sound_type type)
{
m_sound_options.add(name, type, false);
m_sound_names.append(core_strdup(name));
}
void osd_interface::debugger_options_add(const char *name, osd_debugger_type type)
{
m_debugger_options.add(name, type, false);
m_debugger_names.append(core_strdup(name));
}
//-------------------------------------------------
// osd_sound_interface - constructor
//-------------------------------------------------
osd_sound_interface::osd_sound_interface(const osd_interface &osd)
: m_osd(osd)
{
}
//-------------------------------------------------
// osd_sound_interface - destructor
//-------------------------------------------------
osd_sound_interface::~osd_sound_interface()
{
}
//-------------------------------------------------
// osd_debugger_interface - constructor
//-------------------------------------------------
osd_debugger_interface::osd_debugger_interface(const osd_interface &osd)
: m_osd(osd)
{
}
//-------------------------------------------------
// osd_debugger_interface - destructor
//-------------------------------------------------
osd_debugger_interface::~osd_debugger_interface()
{
}

View File

@ -16,17 +16,115 @@
#include "emucore.h"
#include "osdcore.h"
#include "unicode.h"
#include "options.h"
//============================================================
// Defines
//============================================================
//**************************************************************************
#define OSDOPTION_LOG "log"
#define OSDOPTION_VERBOSE "verbose"
#define OSDOPTION_DEBUG "debug"
#define OSDOPTION_DEBUGGER "debugger"
#define OSDOPTION_OSLOG "oslog"
#define OSDOPTION_WATCHDOG "watchdog"
#define OSDOPTION_MULTITHREADING "multithreading"
#define OSDOPTION_NUMPROCESSORS "numprocessors"
#define OSDOPTION_BENCH "bench"
#define OSDOPTION_VIDEO "video"
#define OSDOPTION_NUMSCREENS "numscreens"
#define OSDOPTION_WINDOW "window"
#define OSDOPTION_MAXIMIZE "maximize"
#define OSDOPTION_KEEPASPECT "keepaspect"
#define OSDOPTION_UNEVENSTRETCH "unevenstretch"
#define OSDOPTION_WAITVSYNC "waitvsync"
#define OSDOPTION_SYNCREFRESH "syncrefresh"
#define OSDOPTION_SCREEN "screen"
#define OSDOPTION_ASPECT "aspect"
#define OSDOPTION_RESOLUTION "resolution"
#define OSDOPTION_VIEW "view"
#define OSDOPTION_SWITCHRES "switchres"
#define OSDOPTION_SOUND "sound"
#define OSDOPTION_AUDIO_LATENCY "audio_latency"
#define OSDOPTVAL_AUTO "auto"
//============================================================
// TYPE DEFINITIONS
//**************************************************************************
//============================================================
class osd_options : public core_options
{
public:
// construction/destruction
osd_options();
// debugging options
bool verbose() const { return bool_value(OSDOPTION_VERBOSE); }
bool log() const { return bool_value(OSDOPTION_LOG); }
bool debug() const { return bool_value(OSDOPTION_DEBUG); }
const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
bool oslog() const { return bool_value(OSDOPTION_OSLOG); }
int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
// performance options
bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
int bench() const { return int_value(OSDOPTION_BENCH); }
// video options
const char *video() const { return value(OSDOPTION_VIDEO); }
int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
bool window() const { return bool_value(OSDOPTION_WINDOW); }
bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
// per-window options
const char *screen() const { return value(OSDOPTION_SCREEN); }
const char *aspect() const { return value(OSDOPTION_ASPECT); }
const char *resolution() const { return value(OSDOPTION_RESOLUTION); }
const char *view() const { return value(OSDOPTION_VIEW); }
const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); }
const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); }
const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); }
const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); }
// full screen options
bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
// sound options
const char *sound() const { return value(OSDOPTION_SOUND); }
int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
void add_osd_options();
private:
static const options_entry s_option_entries[];
};
// forward references
class input_type_entry;
class device_t;
class osd_interface;
class osd_sound_interface;
class osd_debugger_interface;
typedef void *osd_font;
// a osd_sound_type is simply a pointer to its alloc function
typedef osd_sound_interface *(*osd_sound_type)(const osd_interface &osd);
// a osd_sound_type is simply a pointer to its alloc function
typedef osd_debugger_interface *(*osd_debugger_type)(const osd_interface &osd);
// ======================> osd_interface
@ -38,6 +136,8 @@ public:
osd_interface();
virtual ~osd_interface();
void register_options(osd_options &options);
// getters
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
@ -46,14 +146,15 @@ public:
virtual void update(bool skip_redraw);
// debugger overridables
virtual void init_debugger();
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
virtual void debugger_exit();
void init_debugger();
void wait_for_debugger(device_t &device, bool firststop);
void debugger_update();
void debugger_exit();
virtual void debugger_register();
// audio overridables
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
void update_audio_stream(const INT16 *buffer, int samples_this_frame);
void set_mastervolume(int attenuation);
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
@ -67,8 +168,14 @@ public:
virtual void *get_slider_list();
void init_subsystems();
virtual bool video_init();
virtual bool sound_init();
virtual void video_register();
bool sound_init();
virtual void sound_register();
bool no_sound();
virtual bool input_init();
virtual void input_pause();
virtual void input_resume();
@ -78,17 +185,77 @@ public:
void exit_subsystems();
virtual void video_exit();
virtual void sound_exit();
void sound_exit();
virtual void input_exit();
virtual void output_exit();
virtual void network_exit();
virtual void midi_exit();
virtual void osd_exit();
void video_options_add(const char *name, void *type);
void sound_options_add(const char *name, osd_sound_type type);
void debugger_options_add(const char *name, osd_debugger_type type);
private:
// internal state
running_machine * m_machine;
running_machine * m_machine;
void update_option(osd_options &options, const char * key, dynamic_array<const char *> &values);
protected:
osd_sound_interface* m_sound;
osd_debugger_interface* m_debugger;
private:
//tagmap_t<osd_video_type> m_video_options;
dynamic_array<const char *> m_video_names;
tagmap_t<osd_sound_type> m_sound_options;
dynamic_array<const char *> m_sound_names;
tagmap_t<osd_debugger_type> m_debugger_options;
dynamic_array<const char *> m_debugger_names;
};
class osd_sound_interface
{
public:
// construction/destruction
osd_sound_interface(const osd_interface &osd);
virtual ~osd_sound_interface();
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) = 0;
virtual void set_mastervolume(int attenuation) = 0;
protected:
const osd_interface& m_osd;
};
// this template function creates a stub which constructs a sound subsystem
template<class _DeviceClass>
osd_sound_interface *osd_sound_creator(const osd_interface &osd)
{
return global_alloc(_DeviceClass(osd));
}
class osd_debugger_interface
{
public:
// construction/destruction
osd_debugger_interface(const osd_interface &osd);
virtual ~osd_debugger_interface();
virtual void init_debugger() = 0;
virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
virtual void debugger_update() = 0;
virtual void debugger_exit() = 0;
protected:
const osd_interface& m_osd;
};
// this template function creates a stub which constructs a debugger
template<class _DeviceClass>
osd_debugger_interface *osd_debugger_creator(const osd_interface &osd)
{
return global_alloc(_DeviceClass(osd));
}
#endif /* __OSDEPEND_H__ */

View File

@ -64,6 +64,7 @@ int main(int argc, char *argv[])
// create a derivative of cli_options and add our own
cli_options options;
mini_osd_interface osd;
osd.register_options(options);
cli_frontend frontend(options, osd);
return frontend.execute(argc, argv);
}

View File

@ -1,38 +0,0 @@
//============================================================
//
// debugwin.c - stubs for linking when NO_DEBUGGER is defined
//
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
// Visit http://mamedev.org for licensing and usage restrictions.
//
// SDLMAME by Olivier Galibert and R. Belmont
//
//============================================================
#if defined(NO_DEBUGGER)
#include "sdlinc.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(device_t &device, bool firststop)
{
}
// win32 stubs for linking
void sdl_osd_interface::debugger_update()
{
}
void sdl_osd_interface::debugger_exit()
{
}
#endif

View File

@ -41,20 +41,8 @@
//============================================================
#define SDLOPTION_INIPATH "inipath"
#define SDLOPTION_AUDIO_LATENCY "audio_latency"
#define SDLOPTION_SCREEN "screen"
#define SDLOPTION_ASPECT "aspect"
#define SDLOPTION_RESOLUTION "resolution"
#define SDLOPTION_VIEW "view"
#define SDLOPTION_SDLVIDEOFPS "sdlvideofps"
#define SDLOPTION_KEEPASPECT "keepaspect"
#define SDLOPTION_WINDOW "window"
#define SDLOPTION_NUMSCREENS "numscreens"
#define SDLOPTION_UNEVENSTRETCH "unevenstretch"
#define SDLOPTION_USEALLHEADS "useallheads"
#define SDLOPTION_MAXIMIZE "maximize"
#define SDLOPTION_VIDEO "video"
#define SDLOPTION_SWITCHRES "switchres"
#define SDLOPTION_FILTER "filter"
#define SDLOPTION_CENTERH "centerh"
#define SDLOPTION_CENTERV "centerv"
@ -62,17 +50,11 @@
#define SDLOPTION_SCALEMODE "scalemode"
#define SDLOPTION_MULTITHREADING "multithreading"
#define SDLOPTION_BENCH "bench"
#define SDLOPTION_NUMPROCESSORS "numprocessors"
#define SDLOPTION_WAITVSYNC "waitvsync"
#define SDLOPTION_SYNCREFRESH "syncrefresh"
#define SDLOPTION_KEYMAP "keymap"
#define SDLOPTION_KEYMAP_FILE "keymap_file"
#define SDLOPTION_UIMODEKEY "uimodekey"
#define SDLOPTION_OSLOG "oslog"
#define SDLOPTION_WATCHDOG "watchdog"
#define SDLOPTION_SIXAXIS "sixaxis"
#define SDLOPTION_JOYINDEX "joy_idx"
@ -144,27 +126,12 @@ public:
// construction/destruction
sdl_options();
// debugging options
bool oslog() const { return bool_value(SDLOPTION_OSLOG); }
int watchdog() const { return int_value(SDLOPTION_WATCHDOG); }
// performance options
bool multithreading() const { return bool_value(SDLOPTION_MULTITHREADING); }
const char *numprocessors() const { return value(SDLOPTION_NUMPROCESSORS); }
bool video_fps() const { return bool_value(SDLOPTION_SDLVIDEOFPS); }
int bench() const { return int_value(SDLOPTION_BENCH); }
// video options
const char *video() const { return value(SDLOPTION_VIDEO); }
int numscreens() const { return int_value(SDLOPTION_NUMSCREENS); }
bool window() const { return bool_value(SDLOPTION_WINDOW); }
bool maximize() const { return bool_value(SDLOPTION_MAXIMIZE); }
bool keep_aspect() const { return bool_value(SDLOPTION_KEEPASPECT); }
bool uneven_stretch() const { return bool_value(SDLOPTION_UNEVENSTRETCH); }
bool centerh() const { return bool_value(SDLOPTION_CENTERH); }
bool centerv() const { return bool_value(SDLOPTION_CENTERV); }
bool wait_vsync() const { return bool_value(SDLOPTION_WAITVSYNC); }
bool sync_refresh() const { return bool_value(SDLOPTION_SYNCREFRESH); }
const char *scale_mode() const { return value(SDLOPTION_SCALEMODE); }
// OpenGL specific options
@ -179,25 +146,11 @@ public:
const char *shader_mame(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_SHADER_MAME, index)); }
const char *shader_screen(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_SHADER_SCREEN, index)); }
// per-window options
const char *screen() const { return value(SDLOPTION_SCREEN); }
const char *aspect() const { return value(SDLOPTION_ASPECT); }
const char *resolution() const { return value(SDLOPTION_RESOLUTION); }
const char *view() const { return value(SDLOPTION_VIEW); }
const char *screen(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_SCREEN, index)); }
const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_ASPECT, index)); }
const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_RESOLUTION, index)); }
const char *view(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_VIEW, index)); }
// full screen options
bool switch_res() const { return bool_value(SDLOPTION_SWITCHRES); }
#ifdef SDLMAME_X11
bool use_all_heads() const { return bool_value(SDLOPTION_USEALLHEADS); }
#endif
// sound options
int audio_latency() const { return int_value(SDLOPTION_AUDIO_LATENCY); }
// keyboard mapping
bool keymap() const { return bool_value(SDLOPTION_KEYMAP); }
const char *keymap_file() const { return value(SDLOPTION_KEYMAP_FILE); }
@ -235,16 +188,6 @@ public:
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);
virtual void debugger_update();
virtual void debugger_exit();
// 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(simple_list<input_type_entry> &typelist);
@ -253,8 +196,11 @@ public:
virtual void font_close(osd_font font);
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
virtual void video_register();
virtual void sound_register();
virtual void debugger_register();
virtual bool video_init();
virtual bool sound_init();
virtual bool input_init();
virtual void input_pause();
virtual void input_resume();
@ -264,7 +210,6 @@ public:
#endif
virtual void video_exit();
virtual void sound_exit();
virtual void input_exit();
virtual void output_exit();
#ifdef USE_NETWORK

View File

@ -83,6 +83,12 @@ SDL_FRAMEWORK_PATH = /Library/Frameworks/
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
###########################################################################
OSDSRC = $(SRC)/osd
OSDOBJ = $(OBJ)/osd
ifndef NO_USE_QTDEBUG
OBJDIRS += $(OSDOBJ)/modules/debugger/qt
endif
ifndef SDL_LIBVER
SDL_LIBVER = sdl
@ -262,7 +268,7 @@ LIBS += -framework CoreAudio -framework CoreMIDI
endif
ifdef NO_USE_QTDEBUG
DEBUGOBJS = $(SDLOBJ)/debugosx.o
DEBUGOBJS = $(OSDOBJ)/modules/debugger/debugosx.o
endif
SYNC_IMPLEMENTATION = ntc
@ -391,7 +397,7 @@ OSDOBJS = \
$(SDLMAIN) \
$(SDLOBJ)/sdlmain.o \
$(SDLOBJ)/input.o \
$(SDLOBJ)/sound.o \
$(OSDOBJ)/modules/sound/sdl_sound.o \
$(SDLOBJ)/video.o \
$(SDLOBJ)/drawsdl.o \
$(SDLOBJ)/window.o \
@ -631,31 +637,29 @@ endif # OS2
#-------------------------------------------------
ifndef NO_USE_QTDEBUG
$(SDLOBJ)/%.moc.c: $(SDLSRC)/%.h
$(OSDOBJ)/%.moc.c: $(OSDSRC)/%.h
$(MOC) $(MOCINCPATH) $(DEFS) $< -o $@
DEBUGOBJS = \
$(SDLOBJ)/debugqt.o \
$(SDLOBJ)/debugqtview.o \
$(SDLOBJ)/debugqtwindow.o \
$(SDLOBJ)/debugqtlogwindow.o \
$(SDLOBJ)/debugqtdasmwindow.o \
$(SDLOBJ)/debugqtmainwindow.o \
$(SDLOBJ)/debugqtmemorywindow.o \
$(SDLOBJ)/debugqtbreakpointswindow.o \
$(SDLOBJ)/debugqtview.moc.o \
$(SDLOBJ)/debugqtwindow.moc.o \
$(SDLOBJ)/debugqtlogwindow.moc.o \
$(SDLOBJ)/debugqtdasmwindow.moc.o \
$(SDLOBJ)/debugqtmainwindow.moc.o \
$(SDLOBJ)/debugqtmemorywindow.moc.o \
$(SDLOBJ)/debugqtbreakpointswindow.moc.o
$(OSDOBJ)/modules/debugger/debugqt.o \
$(OSDOBJ)/modules/debugger/qt/debugqtview.o \
$(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtview.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o
endif
ifeq ($(NO_DEBUGGER),1)
DEFS += -DNO_DEBUGGER
# debugwin compiles into a stub ...
OSDOBJS += $(SDLOBJ)/debugwin.o
else
OSDOBJS += $(DEBUGOBJS)
endif # NO_DEBUGGER

View File

@ -49,7 +49,14 @@
#include "input.h"
#include "osdsdl.h"
#include "sdlos.h"
#include "modules/sound/sdl_sound.h"
#if !defined(NO_DEBUGGER)
#include "modules/debugger/debugqt.h"
#endif
#include "modules/debugger/none.h"
#if defined(SDLMAME_MACOSX)
#include "modules/debugger/debugosx.h"
#endif
// we override SDL's normal startup on Win32
// please see sdlprefix.h as well
@ -91,36 +98,14 @@ const options_entry sdl_options::s_option_entries[] =
{
{ SDLOPTION_INIPATH, INI_PATH, OPTION_STRING, "path to ini files" },
// debugging options
{ NULL, NULL, OPTION_HEADER, "DEBUGGING OPTIONS" },
{ SDLOPTION_OSLOG, "0", OPTION_BOOLEAN, "output error.log data to the system debugger" },
{ SDLOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" },
// performance options
{ NULL, NULL, OPTION_HEADER, "PERFORMANCE OPTIONS" },
{ SDLOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" },
{ SDLOPTION_NUMPROCESSORS ";np", "auto", OPTION_STRING, "number of processors; this overrides the number the system reports" },
{ NULL, NULL, OPTION_HEADER, "SDL PERFORMANCE OPTIONS" },
{ SDLOPTION_SDLVIDEOFPS, "0", OPTION_BOOLEAN, "show sdl video performance" },
{ SDLOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -nosound -nothrottle" },
// video options
{ NULL, NULL, OPTION_HEADER, "VIDEO OPTIONS" },
{ NULL, NULL, OPTION_HEADER, "SDL VIDEO OPTIONS" },
// OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience
#ifdef SDLMAME_MACOSX
{ SDLOPTION_VIDEO, SDLOPTVAL_OPENGL, OPTION_STRING, "video output method: soft or opengl" },
#else
{ SDLOPTION_VIDEO, SDLOPTVAL_SOFT, OPTION_STRING, "video output method: soft or opengl" },
#endif
{ SDLOPTION_NUMSCREENS, "1", OPTION_INTEGER, "number of screens to create; SDLMAME only supports 1 at this time" },
{ SDLOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
{ SDLOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
{ SDLOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
{ SDLOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ SDLOPTION_CENTERH, "1", OPTION_BOOLEAN, "center horizontally within the view area" },
{ SDLOPTION_CENTERV, "1", OPTION_BOOLEAN, "center vertically within the view area" },
#if (SDL_VERSION_ATLEAST(1,2,10))
{ SDLOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
{ SDLOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
#endif
#if (SDLMAME_SDL2)
{ SDLOPTION_SCALEMODE ";sm", SDLOPTVAL_NONE, OPTION_STRING, "Scale mode: none, hwblit, hwbest, yv12, yuy2, yv12x2, yuy2x2 (-video soft only)" },
#else
@ -159,44 +144,12 @@ const options_entry sdl_options::s_option_entries[] =
{ SDLOPTION_SHADER_SCREEN "9", SDLOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" },
#endif
// per-window options
{ NULL, NULL, OPTION_HEADER, "PER-WINDOW VIDEO OPTIONS" },
{ SDLOPTION_SCREEN, SDLOPTVAL_AUTO, OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_ASPECT ";screen_aspect", SDLOPTVAL_AUTO, OPTION_STRING, "aspect ratio for all screens; 'auto' here will try to make a best guess" },
{ SDLOPTION_RESOLUTION ";r", SDLOPTVAL_AUTO, OPTION_STRING, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ SDLOPTION_VIEW, SDLOPTVAL_AUTO, OPTION_STRING, "preferred view for all screens" },
{ SDLOPTION_SCREEN "0", SDLOPTVAL_AUTO, OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_ASPECT "0", SDLOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_RESOLUTION "0;r0", SDLOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ SDLOPTION_VIEW "0", SDLOPTVAL_AUTO, OPTION_STRING, "preferred view for the first screen" },
{ SDLOPTION_SCREEN "1", SDLOPTVAL_AUTO, OPTION_STRING, "explicit name of the second screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_ASPECT "1", SDLOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_RESOLUTION "1;r1", SDLOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ SDLOPTION_VIEW "1", SDLOPTVAL_AUTO, OPTION_STRING, "preferred view for the second screen" },
{ SDLOPTION_SCREEN "2", SDLOPTVAL_AUTO, OPTION_STRING, "explicit name of the third screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_ASPECT "2", SDLOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_RESOLUTION "2;r2", SDLOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ SDLOPTION_VIEW "2", SDLOPTVAL_AUTO, OPTION_STRING, "preferred view for the third screen" },
{ SDLOPTION_SCREEN "3", SDLOPTVAL_AUTO, OPTION_STRING, "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_ASPECT "3", SDLOPTVAL_AUTO, OPTION_STRING, "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
{ SDLOPTION_RESOLUTION "3;r3", SDLOPTVAL_AUTO, OPTION_STRING, "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ SDLOPTION_VIEW "3", SDLOPTVAL_AUTO, OPTION_STRING, "preferred view for the fourth screen" },
// full screen options
{ NULL, NULL, OPTION_HEADER, "FULL SCREEN OPTIONS" },
{ SDLOPTION_SWITCHRES, "0", OPTION_BOOLEAN, "enable resolution switching" },
#ifdef SDLMAME_X11
{ NULL, NULL, OPTION_HEADER, "SDL FULL SCREEN OPTIONS" },
{ SDLOPTION_USEALLHEADS, "0", OPTION_BOOLEAN, "split full screen image across monitors" },
#endif
// sound options
{ NULL, NULL, OPTION_HEADER, "SOUND OPTIONS" },
{ SDLOPTION_AUDIO_LATENCY, "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
// keyboard mapping
{ NULL, NULL, OPTION_HEADER, "SDL KEYBOARD MAPPING" },
{ SDLOPTION_KEYMAP, "0", OPTION_BOOLEAN, "enable keymap" },
@ -371,6 +324,7 @@ int main(int argc, char *argv[])
{
sdl_osd_interface osd;
sdl_options options;
osd.register_options(options);
cli_frontend frontend(options, osd);
res = frontend.execute(argc, argv);
}
@ -441,13 +395,13 @@ sdl_osd_interface::~sdl_osd_interface()
void sdl_osd_interface::osd_exit()
{
osd_interface::exit_subsystems();
osd_interface::osd_exit();
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
/* FixMe: Bug in SDL2.0, Quitting joystick will cause SIGSEGV */
#if SDLMAME_SDL2
SDL_QuitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO /*| SDL_INIT_JOYSTICK */);
SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO /*| SDL_INIT_JOYSTICK */);
#else
SDL_Quit();
#endif
@ -568,6 +522,46 @@ static void osd_sdl_info(void)
}
//============================================================
// video_register
//============================================================
void sdl_osd_interface::video_register()
{
video_options_add("soft", NULL);
video_options_add("opengl", NULL);
//video_options_add("auto", NULL); // making d3d video default one
}
//============================================================
// sound_register
//============================================================
void sdl_osd_interface::sound_register()
{
sound_options_add("sdl", OSD_SOUND_SDL);
sound_options_add("auto", OSD_SOUND_SDL); // making SDL audio default one
}
//============================================================
// debugger_register
//============================================================
void sdl_osd_interface::debugger_register()
{
#if defined(NO_DEBUGGER)
debugger_options_add("auto", OSD_DEBUGGER_NONE);
#else
#if defined(SDLMAME_MACOSX)
debugger_options_add("osx", OSD_DEBUGGER_OSX);
debugger_options_add("auto", OSD_DEBUGGER_OSX); // making OSX debugger default one
#else
debugger_options_add("qt", OSD_DEBUGGER_QT);
debugger_options_add("auto", OSD_DEBUGGER_QT); // making QT debugger default one
#endif // SDLMAME_MACOSX
#endif // NO_DEBUGGER
}
//============================================================
// init
//============================================================
@ -587,7 +581,7 @@ void sdl_osd_interface::init(running_machine &machine)
{
options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(SDLOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM, error_string);
assert(!error_string);
}
@ -651,9 +645,9 @@ void sdl_osd_interface::init(running_machine &machine)
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
#if (SDLMAME_SDL2)
if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
#else
if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
#endif
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);

View File

@ -63,6 +63,11 @@
# set this to the minimum DirectInput version to support (7 or 8)
# DIRECTINPUT = 8
# uncomment next line to use SDL library for sound and video output
# USE_SDL = 1
# uncomment next line to use QT debugger
# USE_QTDEBUG = 1
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
@ -76,12 +81,26 @@
WINSRC = $(SRC)/osd/$(OSD)
WINOBJ = $(OBJ)/osd/$(OSD)
OSDSRC = $(SRC)/osd
OSDOBJ = $(OBJ)/osd
OBJDIRS += $(WINOBJ)
ifdef USE_QTDEBUG
OBJDIRS += $(WINOBJ)/../sdl
OBJDIRS += $(OSDOBJ)/modules/debugger/qt
DEFS += -DUSE_QTDEBUG=1
else
DEFS += -DUSE_QTDEBUG=0
endif
ifdef USE_SDL
DEFS += -DSDLMAME_SDL2=0
DEFS += -DUSE_XINPUT=0
DEFS += -DUSE_OPENGL=0
DEFS += -DUSE_SDL=1
else
DEFS += -DUSE_SDL=0
endif
#-------------------------------------------------
# configure the resource compiler
@ -289,6 +308,10 @@ endif
# add the windows libraries
LIBS += -luser32 -lgdi32 -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi -lwsock32
ifdef USE_SDL
LIBS += -lSDL.dll
endif
ifeq ($(DIRECTINPUT),8)
LIBS += -ldinput8
CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0800
@ -332,12 +355,16 @@ OSDOBJS = \
$(WINOBJ)/drawnone.o \
$(WINOBJ)/input.o \
$(WINOBJ)/output.o \
$(WINOBJ)/sound.o \
$(OSDOBJ)/modules/sound/direct_sound.o \
$(WINOBJ)/video.o \
$(WINOBJ)/window.o \
$(WINOBJ)/winmenu.o \
$(WINOBJ)/winmain.o
ifdef USE_SDL
OSDOBJS += \
$(OSDOBJ)/modules/sound/sdl_sound.o
endif
ifdef USE_NETWORK
OSDOBJS += \
@ -351,11 +378,9 @@ CCOMFLAGS += -DDIRECT3D_VERSION=0x0900
$(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.inc
$(WINOBJ)/drawgdi.o : $(SRC)/emu/rendersw.inc
ifndef USE_QTDEBUG
# add debug-specific files
OSDOBJS += \
$(WINOBJ)/debugwin.o
endif
$(OSDOBJ)/modules/debugger/debugwin.o
# add a stub resource file
RESFILE = $(WINOBJ)/mame.res
@ -368,30 +393,28 @@ QT_INSTALL_HEADERS := $(shell qmake -query QT_INSTALL_HEADERS)
QT_LIBS := -L$(shell qmake -query QT_INSTALL_LIBS)
LIBS += $(QT_LIBS) -lqtmain -lQtGui4 -lQtCore4
INCPATH += -I$(QT_INSTALL_HEADERS)/QtCore -I$(QT_INSTALL_HEADERS)/QtGui -I$(QT_INSTALL_HEADERS)
SDLOBJ := $(WINOBJ)/../sdl
SDLSRC := $(WINSRC)/../sdl
CFLAGS += -DUSE_QTDEBUG
MOC = @moc
$(SDLOBJ)/%.moc.c: $(SDLSRC)/%.h
$(OSDOBJ)/%.moc.c: $(OSDSRC)/%.h
$(MOC) $(INCPATH) $(DEFS) $< -o $@
OSDOBJS += \
$(SDLOBJ)/debugqt.o \
$(SDLOBJ)/debugqtview.o \
$(SDLOBJ)/debugqtwindow.o \
$(SDLOBJ)/debugqtlogwindow.o \
$(SDLOBJ)/debugqtdasmwindow.o \
$(SDLOBJ)/debugqtmainwindow.o \
$(SDLOBJ)/debugqtmemorywindow.o \
$(SDLOBJ)/debugqtbreakpointswindow.o \
$(SDLOBJ)/debugqtview.moc.o \
$(SDLOBJ)/debugqtwindow.moc.o \
$(SDLOBJ)/debugqtlogwindow.moc.o \
$(SDLOBJ)/debugqtdasmwindow.moc.o \
$(SDLOBJ)/debugqtmainwindow.moc.o \
$(SDLOBJ)/debugqtmemorywindow.moc.o \
$(SDLOBJ)/debugqtbreakpointswindow.moc.o
$(OSDOBJ)/modules/debugger/debugqt.o \
$(OSDOBJ)/modules/debugger/qt/debugqtview.o \
$(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.o \
$(OSDOBJ)/modules/debugger/qt/debugqtview.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.moc.o \
$(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o
endif
#-------------------------------------------------

View File

@ -39,6 +39,16 @@
#include "debugger.h"
#include "winfile.h"
#include "modules/sound/direct_sound.h"
#if (USE_SDL)
#include "modules/sound/sdl_sound.h"
#endif
#include "modules/debugger/debugwin.h"
#if (USE_QTDEBUG)
#include "modules/debugger/debugqt.h"
#endif
#define DEBUG_SLOW_LOCKS 0
@ -261,30 +271,17 @@ const options_entry windows_options::s_option_entries[] =
{
// debugging options
{ NULL, NULL, OPTION_HEADER, "WINDOWS DEBUGGING OPTIONS" },
{ WINOPTION_OSLOG, "0", OPTION_BOOLEAN, "output error.log data to the system debugger" },
{ WINOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" },
{ WINOPTION_DEBUGGER_FONT ";dfont", "Lucida Console", OPTION_STRING,"specifies the font to use for debugging; defaults to Lucida Console" },
{ WINOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "9", OPTION_FLOAT, "specifies the font size to use for debugging; defaults to 9 pt" },
// performance options
{ NULL, NULL, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" },
{ WINOPTION_PRIORITY "(-15-1)", "0", OPTION_INTEGER, "thread priority for the main game thread; range from -15 to 1" },
{ WINOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" },
{ WINOPTION_NUMPROCESSORS ";np", "auto", OPTION_STRING, "number of processors; this overrides the number the system reports" },
{ WINOPTION_PROFILE, "0", OPTION_INTEGER, "enable profiling, specifying the stack depth to track" },
{ WINOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -nosound -nothrottle" },
// video options
{ NULL, NULL, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" },
{ WINOPTION_VIDEO, "d3d", OPTION_STRING, "video output method: none, gdi, ddraw, or d3d" },
{ WINOPTION_NUMSCREENS "(1-4)", "1", OPTION_INTEGER, "number of screens to create; usually, you want just one" },
{ WINOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
{ WINOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
{ WINOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
{ WINOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ WINOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" },
{ WINOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
{ WINOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
{ WINOPTION_MENU, "0", OPTION_BOOLEAN, "enable menu bar if available by UI implementation" },
// DirectDraw-specific options
@ -371,45 +368,13 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_BLOOM_LEVEL9_WEIGHT, "0.10", OPTION_FLOAT, "Bloom level 9 (.) weight" },
{ WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.09", OPTION_FLOAT, "Bloom level 10 (1x1 target) weight" },
// per-window options
{ NULL, NULL, OPTION_HEADER, "PER-WINDOW VIDEO OPTIONS" },
{ WINOPTION_SCREEN, "auto", OPTION_STRING, "explicit name of all screens; 'auto' here will try to make a best guess" },
{ WINOPTION_ASPECT ";screen_aspect", "auto", OPTION_STRING, "aspect ratio for all screens; 'auto' here will try to make a best guess" },
{ WINOPTION_RESOLUTION ";r", "auto", OPTION_STRING, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ WINOPTION_VIEW, "auto", OPTION_STRING, "preferred view for all screens" },
{ WINOPTION_SCREEN "0", "auto", OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" },
{ WINOPTION_ASPECT "0", "auto", OPTION_STRING, "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
{ WINOPTION_RESOLUTION "0;r0", "auto", OPTION_STRING, "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ WINOPTION_VIEW "0", "auto", OPTION_STRING, "preferred view for the first screen" },
{ WINOPTION_SCREEN "1", "auto", OPTION_STRING, "explicit name of the second screen; 'auto' here will try to make a best guess" },
{ WINOPTION_ASPECT "1", "auto", OPTION_STRING, "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
{ WINOPTION_RESOLUTION "1;r1", "auto", OPTION_STRING, "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ WINOPTION_VIEW "1", "auto", OPTION_STRING, "preferred view for the second screen" },
{ WINOPTION_SCREEN "2", "auto", OPTION_STRING, "explicit name of the third screen; 'auto' here will try to make a best guess" },
{ WINOPTION_ASPECT "2", "auto", OPTION_STRING, "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
{ WINOPTION_RESOLUTION "2;r2", "auto", OPTION_STRING, "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ WINOPTION_VIEW "2", "auto", OPTION_STRING, "preferred view for the third screen" },
{ WINOPTION_SCREEN "3", "auto", OPTION_STRING, "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
{ WINOPTION_ASPECT "3", "auto", OPTION_STRING, "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
{ WINOPTION_RESOLUTION "3;r3", "auto", OPTION_STRING, "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
{ WINOPTION_VIEW "3", "auto", OPTION_STRING, "preferred view for the fourth screen" },
// full screen options
{ NULL, NULL, OPTION_HEADER, "FULL SCREEN OPTIONS" },
{ WINOPTION_TRIPLEBUFFER ";tb", "0", OPTION_BOOLEAN, "enable triple buffering" },
{ WINOPTION_SWITCHRES, "0", OPTION_BOOLEAN, "enable resolution switching" },
{ WINOPTION_FULLSCREENBRIGHTNESS ";fsb(0.1-2.0)", "1.0", OPTION_FLOAT, "brightness value in full screen mode" },
{ WINOPTION_FULLSCREENCONTRAST ";fsc(0.1-2.0)", "1.0", OPTION_FLOAT, "contrast value in full screen mode" },
{ WINOPTION_FULLSCREENGAMMA ";fsg(0.1-3.0)", "1.0", OPTION_FLOAT, "gamma value in full screen mode" },
// sound options
{ NULL, NULL, OPTION_HEADER, "WINDOWS SOUND OPTIONS" },
{ WINOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches)" },
// input options
{ NULL, NULL, OPTION_HEADER, "INPUT DEVICE OPTIONS" },
{ WINOPTION_DUAL_LIGHTGUN ";dual", "0", OPTION_BOOLEAN, "enable dual lightgun input" },
@ -467,6 +432,7 @@ int main(int argc, char *argv[])
{
windows_options options;
windows_osd_interface osd;
osd.register_options(options);
cli_frontend frontend(options, osd);
result = frontend.execute(argc, argv);
}
@ -570,6 +536,45 @@ windows_osd_interface::~windows_osd_interface()
}
//============================================================
// video_register
//============================================================
void windows_osd_interface::video_register()
{
video_options_add("gdi", NULL);
video_options_add("ddraw", NULL);
video_options_add("d3d", NULL);
//video_options_add("auto", NULL); // making d3d video default one
}
//============================================================
// sound_register
//============================================================
void windows_osd_interface::sound_register()
{
sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
#if (USE_SDL)
sound_options_add("sdl", OSD_SOUND_SDL);
#endif
sound_options_add("auto", OSD_SOUND_DIRECT_SOUND); // making Direct Sound audio default one
}
//============================================================
// debugger_register
//============================================================
void windows_osd_interface::debugger_register()
{
debugger_options_add("windows", OSD_DEBUGGER_WINDOWS);
#if (USE_QTDEBUG)
debugger_options_add("qt", OSD_DEBUGGER_QT);
#endif
debugger_options_add("auto", OSD_DEBUGGER_WINDOWS); // making windows debugger default one
}
//============================================================
// init
//============================================================
@ -588,8 +593,8 @@ void windows_osd_interface::init(running_machine &machine)
if (bench > 0)
{
options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OPTION_SOUND, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(WINOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM, error_string);
assert(!error_string);
}
@ -599,8 +604,8 @@ void windows_osd_interface::init(running_machine &machine)
if (profile > 0)
{
options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(WINOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(WINOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_MULTITHREADING, false, OPTION_PRIORITY_MAXIMUM, error_string);
options.set_value(OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM, error_string);
assert(!error_string);
}
@ -689,7 +694,7 @@ void windows_osd_interface::osd_exit()
// cleanup sockets
win_cleanup_sockets();
osd_interface::exit_subsystems();
osd_interface::osd_exit();
// take down the watchdog thread if it exists
if (watchdog_thread != NULL)

View File

@ -15,28 +15,15 @@
//============================================================
// debugging options
#define WINOPTION_OSLOG "oslog"
#define WINOPTION_WATCHDOG "watchdog"
#define WINOPTION_DEBUGGER_FONT "debugger_font"
#define WINOPTION_DEBUGGER_FONT_SIZE "debugger_font_size"
// performance options
#define WINOPTION_PRIORITY "priority"
#define WINOPTION_MULTITHREADING "multithreading"
#define WINOPTION_NUMPROCESSORS "numprocessors"
#define WINOPTION_PROFILE "profile"
#define WINOPTION_BENCH "bench"
// video options
#define WINOPTION_VIDEO "video"
#define WINOPTION_NUMSCREENS "numscreens"
#define WINOPTION_WINDOW "window"
#define WINOPTION_MAXIMIZE "maximize"
#define WINOPTION_KEEPASPECT "keepaspect"
#define WINOPTION_UNEVENSTRETCH "unevenstretch"
#define WINOPTION_PRESCALE "prescale"
#define WINOPTION_WAITVSYNC "waitvsync"
#define WINOPTION_SYNCREFRESH "syncrefresh"
#define WINOPTION_MENU "menu"
// DirectDraw-specific options
@ -111,22 +98,12 @@
#define WINOPTION_BLOOM_LEVEL9_WEIGHT "bloom_lvl9_weight"
#define WINOPTION_BLOOM_LEVEL10_WEIGHT "bloom_lvl10_weight"
// per-window options
#define WINOPTION_SCREEN "screen"
#define WINOPTION_ASPECT "aspect"
#define WINOPTION_RESOLUTION "resolution"
#define WINOPTION_VIEW "view"
// full screen options
#define WINOPTION_TRIPLEBUFFER "triplebuffer"
#define WINOPTION_SWITCHRES "switchres"
#define WINOPTION_FULLSCREENBRIGHTNESS "full_screen_brightness"
#define WINOPTION_FULLSCREENCONTRAST "full_screen_contrast"
#define WINOPTION_FULLSCREENGAMMA "full_screen_gamma"
// sound options
#define WINOPTION_AUDIO_LATENCY "audio_latency"
// input options
#define WINOPTION_DUAL_LIGHTGUN "dual_lightgun"
@ -143,28 +120,15 @@ public:
windows_options();
// debugging options
bool oslog() const { return bool_value(WINOPTION_OSLOG); }
int watchdog() const { return int_value(WINOPTION_WATCHDOG); }
const char *debugger_font() const { return value(WINOPTION_DEBUGGER_FONT); }
float debugger_font_size() const { return float_value(WINOPTION_DEBUGGER_FONT_SIZE); }
// performance options
int priority() const { return int_value(WINOPTION_PRIORITY); }
bool multithreading() const { return bool_value(WINOPTION_MULTITHREADING); }
const char *numprocessors() const { return value(WINOPTION_NUMPROCESSORS); }
int profile() const { return int_value(WINOPTION_PROFILE); }
int bench() const { return int_value(WINOPTION_BENCH); }
// video options
const char *video() const { return value(WINOPTION_VIDEO); }
int numscreens() const { return int_value(WINOPTION_NUMSCREENS); }
bool window() const { return bool_value(WINOPTION_WINDOW); }
bool maximize() const { return bool_value(WINOPTION_MAXIMIZE); }
bool keep_aspect() const { return bool_value(WINOPTION_KEEPASPECT); }
bool uneven_stretch() const { return bool_value(WINOPTION_UNEVENSTRETCH); }
int prescale() const { return int_value(WINOPTION_PRESCALE); }
bool wait_vsync() const { return bool_value(WINOPTION_WAITVSYNC); }
bool sync_refresh() const { return bool_value(WINOPTION_SYNCREFRESH); }
bool menu() const { return bool_value(WINOPTION_MENU); }
// DirectDraw-specific options
@ -239,26 +203,12 @@ public:
const char *screen_phosphor() const { return value(WINOPTION_PHOSPHOR); }
float screen_saturation() const { return float_value(WINOPTION_SATURATION); }
// per-window options
const char *screen() const { return value(WINOPTION_SCREEN); }
const char *aspect() const { return value(WINOPTION_ASPECT); }
const char *resolution() const { return value(WINOPTION_RESOLUTION); }
const char *view() const { return value(WINOPTION_VIEW); }
const char *screen(int index) const { astring temp; return value(temp.format("%s%d", WINOPTION_SCREEN, index)); }
const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", WINOPTION_ASPECT, index)); }
const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", WINOPTION_RESOLUTION, index)); }
const char *view(int index) const { astring temp; return value(temp.format("%s%d", WINOPTION_VIEW, index)); }
// full screen options
bool triple_buffer() const { return bool_value(WINOPTION_TRIPLEBUFFER); }
bool switch_res() const { return bool_value(WINOPTION_SWITCHRES); }
float full_screen_brightness() const { return float_value(WINOPTION_FULLSCREENBRIGHTNESS); }
float full_screen_contrast() const { return float_value(WINOPTION_FULLSCREENCONTRAST); }
float full_screen_gamma() const { return float_value(WINOPTION_FULLSCREENGAMMA); }
// sound options
int audio_latency() const { return int_value(WINOPTION_AUDIO_LATENCY); }
// input options
bool dual_lightgun() const { return bool_value(WINOPTION_DUAL_LIGHTGUN); }
@ -295,16 +245,6 @@ public:
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);
virtual void debugger_update();
virtual void debugger_exit();
// audio overridables
virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame);
virtual void set_mastervolume(int attenuation);
// video overridables
virtual void *get_slider_list();
@ -316,8 +256,11 @@ public:
virtual void font_close(osd_font font);
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
virtual bool video_init();
virtual bool sound_init();
virtual void video_register();
virtual void sound_register();
virtual void debugger_register();
virtual bool video_init();
virtual bool input_init();
virtual void input_pause();
virtual void input_resume();
@ -327,7 +270,6 @@ public:
#endif
virtual void video_exit();
virtual void sound_exit();
virtual void input_exit();
virtual void output_exit();
#ifdef USE_NETWORK