mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
Make OSD options an init parameter for modules
This commit is contained in:
parent
7bdafcf33c
commit
e3df530786
@ -35,7 +35,7 @@ public:
|
||||
|
||||
virtual ~debug_internal() { }
|
||||
|
||||
virtual int init() { return 0;}
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
virtual void exit();
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
[m_console release];
|
||||
}
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
@ -71,7 +71,7 @@ MODULE_DEFINITION(DEBUG_OSX, debugger_osx)
|
||||
// debugger_osx::init
|
||||
//============================================================
|
||||
|
||||
int debugger_osx::init()
|
||||
int debugger_osx::init(const osd_options &options)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
virtual ~debug_qt() { }
|
||||
|
||||
virtual int init() { return 0;}
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
virtual void exit() { }
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
virtual ~debugger_windows() { }
|
||||
|
||||
virtual int init() { return 0; }
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
virtual void exit();
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
virtual ~debug_none() { }
|
||||
|
||||
virtual int init() { return 0;}
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
virtual void exit() { }
|
||||
|
||||
virtual void init_debugger(running_machine &machine);
|
||||
|
@ -14,7 +14,7 @@
|
||||
class osd_font_none : public osd_font
|
||||
{
|
||||
public:
|
||||
virtual ~osd_font_none() {};
|
||||
virtual ~osd_font_none() { }
|
||||
|
||||
virtual bool open(const char *font_path, const char *name, int &height);
|
||||
virtual void close();
|
||||
@ -52,11 +52,12 @@ bool osd_font_none::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32
|
||||
class font_none : public osd_module, public font_module
|
||||
{
|
||||
public:
|
||||
font_none()
|
||||
: osd_module(OSD_FONT_PROVIDER, "none"), font_module()
|
||||
font_none() : osd_module(OSD_FONT_PROVIDER, "none"), font_module()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
|
||||
osd_font *font_alloc()
|
||||
{
|
||||
return global_alloc(osd_font_none);
|
||||
|
@ -26,7 +26,7 @@
|
||||
class osd_font_osx : public osd_font
|
||||
{
|
||||
public:
|
||||
virtual ~osd_font_osx() {};
|
||||
virtual ~osd_font_osx() { }
|
||||
|
||||
virtual bool open(const char *font_path, const char *name, int &height);
|
||||
virtual void close();
|
||||
@ -37,14 +37,9 @@ private:
|
||||
|
||||
bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
||||
{
|
||||
CFStringRef font_name = NULL;
|
||||
CTFontRef ct_font = NULL;
|
||||
CTFontDescriptorRef font_descriptor;
|
||||
CGAffineTransform affine_transform = CGAffineTransformIdentity;
|
||||
|
||||
m_font = NULL;
|
||||
astring name(_name);
|
||||
printf("FONT NAME %s\n", _name);
|
||||
osd_printf_verbose("FONT NAME %s\n", _name);
|
||||
#if 0
|
||||
if (name == "default")
|
||||
{
|
||||
@ -53,23 +48,23 @@ bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
||||
#endif
|
||||
/* handle bdf fonts in the core */
|
||||
if (name.len() > 4)
|
||||
if (name.makeupper().substr(name.len()-4,4) == ".BDF" )
|
||||
return false;
|
||||
|
||||
font_name = CFStringCreateWithCString( NULL, name.cstr(), kCFStringEncodingUTF8 );
|
||||
if( font_name != NULL )
|
||||
{
|
||||
font_descriptor = CTFontDescriptorCreateWithNameAndSize( font_name, 0.0); //POINT_SIZE );
|
||||
|
||||
if( font_descriptor != NULL )
|
||||
{
|
||||
ct_font = CTFontCreateWithFontDescriptor( font_descriptor, POINT_SIZE, &affine_transform );
|
||||
|
||||
CFRelease( font_descriptor );
|
||||
}
|
||||
if (name.makeupper().substr(name.len() - 4, 4) == ".BDF")
|
||||
return false;
|
||||
}
|
||||
|
||||
CFRelease( font_name );
|
||||
CTFontRef ct_font = NULL;
|
||||
CFStringRef const font_name = CFStringCreateWithCString(NULL, name.cstr(), kCFStringEncodingUTF8);
|
||||
if (font_name != NULL)
|
||||
{
|
||||
CTFontDescriptorRef const font_descriptor = CTFontDescriptorCreateWithNameAndSize(font_name, 0.0);
|
||||
if (font_descriptor != NULL)
|
||||
{
|
||||
ct_font = CTFontCreateWithFontDescriptor(font_descriptor, POINT_SIZE, &CGAffineTransformIdentity);
|
||||
CFRelease(font_descriptor);
|
||||
}
|
||||
}
|
||||
CFRelease(font_name);
|
||||
|
||||
if (!ct_font)
|
||||
{
|
||||
@ -77,11 +72,11 @@ bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
||||
return false;
|
||||
}
|
||||
|
||||
CFStringRef real_name = CTFontCopyPostScriptName( ct_font );
|
||||
CFStringRef const real_name = CTFontCopyPostScriptName(ct_font);
|
||||
char real_name_c_string[255];
|
||||
CFStringGetCString ( real_name, real_name_c_string, 255, kCFStringEncodingUTF8 );
|
||||
CFStringGetCString(real_name, real_name_c_string, 255, kCFStringEncodingUTF8);
|
||||
osd_printf_verbose("Matching font: %s\n", real_name_c_string);
|
||||
CFRelease( real_name );
|
||||
CFRelease(real_name);
|
||||
|
||||
CGFloat line_height = 0.0;
|
||||
line_height += CTFontGetAscent(ct_font);
|
||||
@ -100,9 +95,9 @@ bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
||||
|
||||
void osd_font_osx::close()
|
||||
{
|
||||
if( m_font != NULL )
|
||||
if (m_font != NULL)
|
||||
{
|
||||
CFRelease( m_font );
|
||||
CFRelease(m_font);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,6 +185,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
|
||||
osd_font *font_alloc()
|
||||
{
|
||||
return global_alloc(osd_font_osx);
|
||||
|
@ -32,7 +32,7 @@
|
||||
class osd_font_sdl : public osd_font
|
||||
{
|
||||
public:
|
||||
virtual ~osd_font_sdl() {};
|
||||
virtual ~osd_font_sdl() { }
|
||||
|
||||
virtual bool open(const char *font_path, const char *name, int &height);
|
||||
virtual void close();
|
||||
@ -328,8 +328,7 @@ TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic,
|
||||
class font_sdl : public osd_module, public font_module
|
||||
{
|
||||
public:
|
||||
font_sdl()
|
||||
: osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
|
||||
font_sdl() : osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
|
||||
{
|
||||
}
|
||||
|
||||
@ -338,7 +337,7 @@ public:
|
||||
return global_alloc(osd_font_sdl);
|
||||
}
|
||||
|
||||
int init()
|
||||
virtual int init(const osd_options &options)
|
||||
{
|
||||
if (TTF_Init() == -1)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@
|
||||
class osd_font_windows : public osd_font
|
||||
{
|
||||
public:
|
||||
virtual ~osd_font_windows() {};
|
||||
virtual ~osd_font_windows() { }
|
||||
|
||||
virtual bool open(const char *font_path, const char *name, int &height);
|
||||
virtual void close();
|
||||
@ -266,11 +266,12 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT
|
||||
class font_win : public osd_module, public font_module
|
||||
{
|
||||
public:
|
||||
font_win()
|
||||
: osd_module(OSD_FONT_PROVIDER, "win"), font_module()
|
||||
font_win() : osd_module(OSD_FONT_PROVIDER, "win"), font_module()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
|
||||
osd_font *font_alloc()
|
||||
{
|
||||
return global_alloc(osd_font_windows);
|
||||
|
@ -500,7 +500,7 @@ bool osd_common_t::execute_command(const char *command)
|
||||
|
||||
if (om->probe())
|
||||
{
|
||||
om->init();
|
||||
om->init(options());
|
||||
osd_list_network_adapters();
|
||||
om->exit();
|
||||
}
|
||||
@ -514,7 +514,7 @@ bool osd_common_t::execute_command(const char *command)
|
||||
|
||||
if (om->probe())
|
||||
{
|
||||
om->init();
|
||||
om->init(options());
|
||||
pm->list_midi_devices();
|
||||
om->exit();
|
||||
}
|
||||
@ -555,7 +555,7 @@ void osd_common_t::init_subsystems()
|
||||
|
||||
m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);
|
||||
|
||||
m_mod_man.init();
|
||||
m_mod_man.init(options());
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
}
|
||||
virtual ~none_module() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
osd_midi_device *create_midi_device();
|
||||
@ -50,7 +50,7 @@ osd_midi_device *none_module::create_midi_device()
|
||||
}
|
||||
|
||||
|
||||
int none_module::init()
|
||||
int none_module::init(const osd_options &options)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
}
|
||||
virtual ~pm_module() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
osd_midi_device *create_midi_device();
|
||||
@ -63,7 +63,7 @@ osd_midi_device *pm_module::create_midi_device()
|
||||
}
|
||||
|
||||
|
||||
int pm_module::init()
|
||||
int pm_module::init(const osd_options &options)
|
||||
{
|
||||
Pm_Initialize();
|
||||
return 0;
|
||||
|
@ -13,6 +13,7 @@ public:
|
||||
: osd_module(OSD_NETDEV_PROVIDER, "none"), netdev_module()
|
||||
{
|
||||
}
|
||||
int init(const osd_options &options) { return 0; }
|
||||
};
|
||||
|
||||
MODULE_DEFINITION(NETDEV_NONE, netdev_none)
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
virtual ~pcap_module() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
virtual bool probe();
|
||||
@ -251,7 +251,7 @@ bool pcap_module::probe()
|
||||
}
|
||||
|
||||
|
||||
int pcap_module::init()
|
||||
int pcap_module::init(const osd_options &options)
|
||||
{
|
||||
pcap_if_t *devs;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
}
|
||||
virtual ~taptun_module() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
virtual bool probe() { return true; }
|
||||
@ -118,7 +118,7 @@ static CREATE_NETDEV(create_tap)
|
||||
return dynamic_cast<osd_netdev *>(dev);
|
||||
}
|
||||
|
||||
int taptun_module::init()
|
||||
int taptun_module::init(const osd_options &options)
|
||||
{
|
||||
add_netdev("tap", "TAP/TUN Device", create_tap);
|
||||
return 0;
|
||||
|
@ -68,11 +68,11 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name
|
||||
return m;
|
||||
}
|
||||
|
||||
void osd_module_manager::init()
|
||||
void osd_module_manager::init(const osd_options &options)
|
||||
{
|
||||
for (int i = 0; m_selected[i] != NULL; i++)
|
||||
{
|
||||
m_selected[i]->init();
|
||||
m_selected[i]->init(options);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
class osd_options;
|
||||
class osd_module;
|
||||
|
||||
// ======================> osd_module
|
||||
@ -36,7 +37,7 @@ public:
|
||||
|
||||
virtual bool probe() { return true; }
|
||||
|
||||
virtual int init() { return 0; }
|
||||
virtual int init(const osd_options &options) = 0;
|
||||
virtual void exit() { }
|
||||
|
||||
private:
|
||||
@ -79,7 +80,7 @@ public:
|
||||
|
||||
void get_module_names(const char *type, const int max, int *num, const char *names[]);
|
||||
|
||||
void init();
|
||||
void init(const osd_options &options);
|
||||
|
||||
void exit();
|
||||
|
||||
@ -98,8 +99,8 @@ private:
|
||||
#define MODULE_NOT_SUPPORTED(_mod, _type, _name) \
|
||||
class _mod : public osd_module { \
|
||||
public: \
|
||||
_mod () \
|
||||
: osd_module(_type, _name) {} \
|
||||
_mod () : osd_module(_type, _name) { } \
|
||||
int init(const osd_options &options) { return -1; } \
|
||||
bool probe() { return false; } \
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "sound_module.h"
|
||||
#include "modules/osdmodule.h"
|
||||
#include "modules/lib/osdobj_common.h"
|
||||
|
||||
#ifdef SDLMAME_MACOSX
|
||||
|
||||
@ -42,7 +43,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
// sound_module
|
||||
@ -99,7 +100,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
int sound_coreaudio::init()
|
||||
int sound_coreaudio::init(const osd_options &options)
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
}
|
||||
virtual ~sound_direct_sound() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
// sound_module
|
||||
@ -108,7 +108,7 @@ static int buffer_overflows;
|
||||
// sound_direct_sound - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
int sound_direct_sound::init()
|
||||
int sound_direct_sound::init(const osd_options &options)
|
||||
{
|
||||
// attempt to initialize directsound
|
||||
// don't make it fatal if we can't -- we'll just run without sound
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
virtual ~sound_js() { }
|
||||
|
||||
virtual int init() { }
|
||||
virtual int init(const osd_options &options) { }
|
||||
virtual void exit() { }
|
||||
|
||||
// sound_module
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
}
|
||||
virtual ~sound_none() { }
|
||||
|
||||
virtual int init() { return 0; }
|
||||
virtual int init(const osd_options &options) { return 0; }
|
||||
virtual void exit() { }
|
||||
|
||||
// sound_module
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
virtual ~sound_sdl() { }
|
||||
|
||||
virtual int init();
|
||||
virtual int init(const osd_options &options);
|
||||
virtual void exit();
|
||||
|
||||
// sound_module
|
||||
@ -403,7 +403,7 @@ static void sdl_callback(void *userdata, Uint8 *stream, int len)
|
||||
// sound_sdl::init
|
||||
//============================================================
|
||||
|
||||
int sound_sdl::init()
|
||||
int sound_sdl::init(const osd_options &options)
|
||||
{
|
||||
int n_channels = 2;
|
||||
int audio_latency;
|
||||
|
Loading…
Reference in New Issue
Block a user