mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
Added a generic module abstraction layer and migrated font modules to
use this layer. (nw)
This commit is contained in:
parent
af80347955
commit
4a4ae1d5ed
26
src/osd/modules/font/font_module.h
Normal file
26
src/osd/modules/font/font_module.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* font_module.h
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FONT_MODULE_H_
|
||||||
|
#define FONT_MODULE_H_
|
||||||
|
|
||||||
|
#include "osdepend.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// CONSTANTS
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
#define OSD_FONT_PROVIDER "uifontprovider"
|
||||||
|
|
||||||
|
class font_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~font_module() { }
|
||||||
|
virtual osd_font *font_alloc() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FONT_MODULE_H_ */
|
@ -3,7 +3,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osdepend.h"
|
#include "font_module.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
#include "astring.h"
|
#include "astring.h"
|
||||||
#include "corealloc.h"
|
#include "corealloc.h"
|
||||||
@ -25,11 +26,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
osd_font *osd_font_alloc()
|
|
||||||
{
|
|
||||||
return global_alloc(osd_font_none);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool osd_font_none::open(const char *font_path, const char *_name, int &height)
|
bool osd_font_none::open(const char *font_path, const char *_name, int &height)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -56,3 +52,20 @@ bool osd_font_none::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class font_none : public osd_module, public font_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
font_none()
|
||||||
|
: osd_module(OSD_FONT_PROVIDER, "none"), font_module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_font *font_alloc()
|
||||||
|
{
|
||||||
|
return global_alloc(osd_font_none);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_DEFINITION(FONT_NONE, font_none)
|
||||||
|
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
#include "font_module.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
#include "osdepend.h"
|
#ifdef SDLMAME_MACOSX
|
||||||
|
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
#include "astring.h"
|
#include "astring.h"
|
||||||
#include "corealloc.h"
|
#include "corealloc.h"
|
||||||
@ -32,11 +35,6 @@ private:
|
|||||||
CTFontRef m_font;
|
CTFontRef m_font;
|
||||||
};
|
};
|
||||||
|
|
||||||
osd_font *osd_font_alloc()
|
|
||||||
{
|
|
||||||
return global_alloc(osd_font_osx);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
|
||||||
{
|
{
|
||||||
CFStringRef font_name = NULL;
|
CFStringRef font_name = NULL;
|
||||||
@ -183,3 +181,23 @@ bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &
|
|||||||
return bitmap.valid();
|
return bitmap.valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class font_osx : public osd_module, public font_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
font_osx()
|
||||||
|
: osd_module(OSD_FONT_PROVIDER, "osx"), font_module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_font *font_alloc()
|
||||||
|
{
|
||||||
|
return global_alloc(osd_font_osx);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
#else /* SDLMAME_UNIX */
|
||||||
|
MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MODULE_DEFINITION(FONT_OSX, font_osx)
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "font_module.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
|
#if defined(SDLMAME_UNIX) && (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
|
||||||
|
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL2/SDL_ttf.h>
|
||||||
#else
|
#else
|
||||||
@ -12,7 +17,6 @@
|
|||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "osdepend.h"
|
|
||||||
|
|
||||||
#include "astring.h"
|
#include "astring.h"
|
||||||
#include "corealloc.h"
|
#include "corealloc.h"
|
||||||
@ -25,10 +29,10 @@
|
|||||||
// font with the given name
|
// font with the given name
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
class osd_font_unix : public osd_font
|
class osd_font_sdl : public osd_font
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~osd_font_unix() {};
|
virtual ~osd_font_sdl() {};
|
||||||
|
|
||||||
virtual bool open(const char *font_path, const char *name, int &height);
|
virtual bool open(const char *font_path, const char *name, int &height);
|
||||||
virtual void close();
|
virtual void close();
|
||||||
@ -42,12 +46,7 @@ private:
|
|||||||
TTF_Font *m_font;
|
TTF_Font *m_font;
|
||||||
};
|
};
|
||||||
|
|
||||||
osd_font *osd_font_alloc()
|
bool osd_font_sdl::open(const char *font_path, const char *_name, int &height)
|
||||||
{
|
|
||||||
return global_alloc(osd_font_unix);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool osd_font_unix::open(const char *font_path, const char *_name, int &height)
|
|
||||||
{
|
{
|
||||||
TTF_Font *font = (TTF_Font *)NULL;
|
TTF_Font *font = (TTF_Font *)NULL;
|
||||||
bool bakedstyles = false;
|
bool bakedstyles = false;
|
||||||
@ -129,7 +128,7 @@ bool osd_font_unix::open(const char *font_path, const char *_name, int &height)
|
|||||||
// a given OSD font
|
// a given OSD font
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void osd_font_unix::close()
|
void osd_font_sdl::close()
|
||||||
{
|
{
|
||||||
TTF_CloseFont(this->m_font);
|
TTF_CloseFont(this->m_font);
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ void osd_font_unix::close()
|
|||||||
// pixel of a black & white font
|
// pixel of a black & white font
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
bool osd_font_unix::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||||
{
|
{
|
||||||
TTF_Font *ttffont;
|
TTF_Font *ttffont;
|
||||||
SDL_Surface *drawsurf;
|
SDL_Surface *drawsurf;
|
||||||
@ -185,7 +184,7 @@ bool osd_font_unix::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32
|
|||||||
return bitmap.valid();
|
return bitmap.valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
TTF_Font * osd_font_unix::TTF_OpenFont_Magic(astring name, int fsize)
|
TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize)
|
||||||
{
|
{
|
||||||
emu_file file(OPEN_FLAG_READ);
|
emu_file file(OPEN_FLAG_READ);
|
||||||
if (file.open(name) == FILERR_NONE)
|
if (file.open(name) == FILERR_NONE)
|
||||||
@ -199,7 +198,7 @@ TTF_Font * osd_font_unix::TTF_OpenFont_Magic(astring name, int fsize)
|
|||||||
return TTF_OpenFont(name.cstr(), POINT_SIZE);
|
return TTF_OpenFont(name.cstr(), POINT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool osd_font_unix::BDF_Check_Magic(astring name)
|
bool osd_font_sdl::BDF_Check_Magic(astring name)
|
||||||
{
|
{
|
||||||
emu_file file(OPEN_FLAG_READ);
|
emu_file file(OPEN_FLAG_READ);
|
||||||
if (file.open(name) == FILERR_NONE)
|
if (file.open(name) == FILERR_NONE)
|
||||||
@ -216,7 +215,7 @@ bool osd_font_unix::BDF_Check_Magic(astring name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SDLMAME_HAIKU
|
#ifndef SDLMAME_HAIKU
|
||||||
TTF_Font *osd_font_unix::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles)
|
TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles)
|
||||||
{
|
{
|
||||||
TTF_Font *font = (TTF_Font *)NULL;
|
TTF_Font *font = (TTF_Font *)NULL;
|
||||||
FcConfig *config;
|
FcConfig *config;
|
||||||
@ -324,3 +323,38 @@ TTF_Font *osd_font_unix::search_font_config(astring name, bool bold, bool italic
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
class font_sdl : public osd_module, public font_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
font_sdl()
|
||||||
|
: osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_font *font_alloc()
|
||||||
|
{
|
||||||
|
return global_alloc(osd_font_sdl);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void init()
|
||||||
|
{
|
||||||
|
if (TTF_Init() == -1)
|
||||||
|
{
|
||||||
|
osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void exit()
|
||||||
|
{
|
||||||
|
TTF_Quit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#else /* SDLMAME_UNIX */
|
||||||
|
MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MODULE_DEFINITION(FONT_SDL, font_sdl)
|
||||||
|
|
||||||
|
|
@ -3,6 +3,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "font_module.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
|
#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
@ -10,7 +15,8 @@
|
|||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#include "osdepend.h"
|
#include "font_module.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
#include "strconv.h"
|
#include "strconv.h"
|
||||||
#include "astring.h"
|
#include "astring.h"
|
||||||
@ -78,11 +84,6 @@ private:
|
|||||||
HGDIOBJ m_font;
|
HGDIOBJ m_font;
|
||||||
};
|
};
|
||||||
|
|
||||||
osd_font *osd_font_alloc()
|
|
||||||
{
|
|
||||||
return global_alloc(osd_font_windows);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool osd_font_windows::open(const char *font_path, const char *_name, int &height)
|
bool osd_font_windows::open(const char *font_path, const char *_name, int &height)
|
||||||
{
|
{
|
||||||
// accept qualifiers from the name
|
// accept qualifiers from the name
|
||||||
@ -298,3 +299,22 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT
|
|||||||
return bitmap.valid();
|
return bitmap.valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class font_win : public osd_module, public font_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
font_win()
|
||||||
|
: osd_module(OSD_FONT_PROVIDER, "win"), font_module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_font *font_alloc()
|
||||||
|
{
|
||||||
|
return global_alloc(osd_font_windows);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
#else /* SDLMAME_UNIX */
|
||||||
|
MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MODULE_DEFINITION(FONT_WINDOWS, font_win)
|
||||||
|
@ -20,6 +20,9 @@ extern bool g_print_verbose;
|
|||||||
|
|
||||||
const options_entry osd_options::s_option_entries[] =
|
const options_entry osd_options::s_option_entries[] =
|
||||||
{
|
{
|
||||||
|
{ NULL, NULL, OPTION_HEADER, "OSD FONT OPTIONS" },
|
||||||
|
{ OSD_FONT_PROVIDER, "auto", OPTION_STRING, "provider for ui font: " },
|
||||||
|
|
||||||
{ NULL, NULL, OPTION_HEADER, "OSD CLI OPTIONS" },
|
{ NULL, NULL, OPTION_HEADER, "OSD CLI OPTIONS" },
|
||||||
{ OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
|
{ OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
|
||||||
{ OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" },
|
{ OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" },
|
||||||
@ -106,9 +109,30 @@ osd_common_t::osd_common_t(osd_options &options)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define REGISTER_MODULE(_O, _X ) { extern const module_type _X; _O . register_module( _X ); }
|
||||||
|
|
||||||
void osd_common_t::register_options()
|
void osd_common_t::register_options()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
REGISTER_MODULE(m_mod_man, FONT_OSX);
|
||||||
|
REGISTER_MODULE(m_mod_man, FONT_WINDOWS);
|
||||||
|
REGISTER_MODULE(m_mod_man, FONT_SDL);
|
||||||
|
REGISTER_MODULE(m_mod_man, FONT_NONE);
|
||||||
|
|
||||||
|
// after initialization we know which modules are supported
|
||||||
|
|
||||||
|
const char *names[20];
|
||||||
|
int num;
|
||||||
|
m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names);
|
||||||
|
dynamic_array<const char *> dnames;
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
dnames.append(names[i]);
|
||||||
|
update_option(OSD_FONT_PROVIDER, dnames);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Register video options and update options
|
// Register video options and update options
|
||||||
video_options_add("none", NULL);
|
video_options_add("none", NULL);
|
||||||
video_register();
|
video_register();
|
||||||
@ -209,6 +233,11 @@ void osd_common_t::init(running_machine &machine)
|
|||||||
if (options.verbose())
|
if (options.verbose())
|
||||||
g_print_verbose = true;
|
g_print_verbose = true;
|
||||||
|
|
||||||
|
m_font_module = select_module_options<font_module *>(options, OSD_FONT_PROVIDER);
|
||||||
|
|
||||||
|
m_mod_man.init();
|
||||||
|
|
||||||
|
|
||||||
// ensure we get called on the way out
|
// ensure we get called on the way out
|
||||||
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_common_t::osd_exit), this));
|
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_common_t::osd_exit), this));
|
||||||
}
|
}
|
||||||
@ -539,6 +568,8 @@ void osd_common_t::network_exit()
|
|||||||
|
|
||||||
void osd_common_t::osd_exit()
|
void osd_common_t::osd_exit()
|
||||||
{
|
{
|
||||||
|
m_mod_man.exit();
|
||||||
|
|
||||||
exit_subsystems();
|
exit_subsystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#define __OSDOBJ_COMMON__
|
#define __OSDOBJ_COMMON__
|
||||||
|
|
||||||
#include "osdepend.h"
|
#include "osdepend.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
#include "modules/font/font_module.h"
|
||||||
#include "cliopts.h"
|
#include "cliopts.h"
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -55,18 +57,6 @@
|
|||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
/* FIXME: core_options inherits from osd_options. This will force any
|
|
||||||
* future osd implementation to use the options below. Actually, these
|
|
||||||
* options are *private* to the osd_core. This object should actually be an
|
|
||||||
* accessor object. Later ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* FIXME: core_options inherits from osd_options. This will force any
|
|
||||||
* future osd implementation to use the options below. Actually, these
|
|
||||||
* options are *private* to the osd_core. This object should actually be an
|
|
||||||
* accessor object. Later ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
class osd_options : public cli_options
|
class osd_options : public cli_options
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -163,6 +153,8 @@ public:
|
|||||||
// command option overrides
|
// command option overrides
|
||||||
virtual bool execute_command(const char *command);
|
virtual bool execute_command(const char *command);
|
||||||
|
|
||||||
|
osd_font *font_alloc() { return m_font_module->font_alloc(); }
|
||||||
|
|
||||||
// FIXME: everything below seems to be osd specific and not part of
|
// FIXME: everything below seems to be osd specific and not part of
|
||||||
// this INTERFACE but part of the osd IMPLEMENTATION
|
// this INTERFACE but part of the osd IMPLEMENTATION
|
||||||
|
|
||||||
@ -214,7 +206,29 @@ private:
|
|||||||
running_machine * m_machine;
|
running_machine * m_machine;
|
||||||
osd_options& m_options;
|
osd_options& m_options;
|
||||||
|
|
||||||
|
osd_module_manager m_mod_man;
|
||||||
|
font_module *m_font_module;
|
||||||
|
|
||||||
void update_option(const char * key, dynamic_array<const char *> &values);
|
void update_option(const char * key, dynamic_array<const char *> &values);
|
||||||
|
// FIXME: should be elsewhere
|
||||||
|
osd_module *select_module_options(const core_options &opts, const astring &opt_name)
|
||||||
|
{
|
||||||
|
astring opt_val = opts.value(opt_name);
|
||||||
|
if (opt_val == "auto")
|
||||||
|
opt_val = "";
|
||||||
|
else if (!m_mod_man.type_has_name(opt_name, opt_val))
|
||||||
|
{
|
||||||
|
osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr());
|
||||||
|
opt_val = "";
|
||||||
|
}
|
||||||
|
return m_mod_man.select_module(opt_name, opt_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
C select_module_options(const core_options &opts, const astring &opt_name)
|
||||||
|
{
|
||||||
|
return dynamic_cast<C>(select_module_options(opts, opt_name));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
osd_sound_interface* m_sound;
|
osd_sound_interface* m_sound;
|
||||||
|
116
src/osd/modules/osdmodule.c
Normal file
116
src/osd/modules/osdmodule.c
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* osdmodule.c
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
|
||||||
|
osd_module_manager::osd_module_manager()
|
||||||
|
{
|
||||||
|
for (int i=0; i<MAX_MODULES; i++)
|
||||||
|
{
|
||||||
|
m_modules[i] = NULL;
|
||||||
|
m_selected[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
osd_module_manager::~osd_module_manager()
|
||||||
|
{
|
||||||
|
for (int i = 0; m_modules[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
m_modules[i]->~osd_module();
|
||||||
|
osd_free(m_modules[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void osd_module_manager::register_module(const module_type &mod_type)
|
||||||
|
{
|
||||||
|
osd_module *module = mod_type();
|
||||||
|
if (module->probe())
|
||||||
|
{
|
||||||
|
osd_printf_info("===> registered module %s %s\n", module->name(), module->type());
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; m_modules[i] != NULL; i++)
|
||||||
|
;
|
||||||
|
m_modules[i] = module;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
osd_printf_info("===> not supported %s %s\n", module->name(), module->type());
|
||||||
|
module->~osd_module();
|
||||||
|
osd_free(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool osd_module_manager::type_has_name(const char *type, const char *name)
|
||||||
|
{
|
||||||
|
return (get_module_index(type, name) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_module *osd_module_manager::get_module_generic(const char *type, const char *name)
|
||||||
|
{
|
||||||
|
int i = get_module_index(type, name);
|
||||||
|
if (i>=0)
|
||||||
|
return m_modules[i];
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_module *osd_module_manager::select_module(const char *type, const char *name)
|
||||||
|
{
|
||||||
|
osd_module *m = get_module_generic(type, name);
|
||||||
|
|
||||||
|
// FIXME: check if already exists!
|
||||||
|
int i;
|
||||||
|
for (i = 0; m_selected[i] != NULL; i++)
|
||||||
|
;
|
||||||
|
m_selected[i] = m;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void osd_module_manager::init()
|
||||||
|
{
|
||||||
|
for (int i = 0; m_selected[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
m_selected[i]->init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void osd_module_manager::exit()
|
||||||
|
{
|
||||||
|
// Find count
|
||||||
|
int cnt;
|
||||||
|
for (cnt = 0; m_selected[cnt] != NULL; cnt++)
|
||||||
|
;
|
||||||
|
for (int i = cnt - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
m_selected[i]->exit();
|
||||||
|
m_selected[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int osd_module_manager::get_module_index(const char *type, const char *name)
|
||||||
|
{
|
||||||
|
for (int i = 0; m_modules[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0)))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[])
|
||||||
|
{
|
||||||
|
*num = 0;
|
||||||
|
for (int i = 0; m_modules[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max))
|
||||||
|
{
|
||||||
|
names[*num] = m_modules[i]->name();
|
||||||
|
*num = *num + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
106
src/osd/modules/osdmodule.h
Normal file
106
src/osd/modules/osdmodule.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
osdmodule.h
|
||||||
|
|
||||||
|
OSD module manangement
|
||||||
|
|
||||||
|
*******************************************************************c********/
|
||||||
|
|
||||||
|
//#pragma once
|
||||||
|
|
||||||
|
#ifndef __OSDMODULE_H__
|
||||||
|
#define __OSDMODULE_H__
|
||||||
|
|
||||||
|
#include "osdcore.h"
|
||||||
|
#include "osdepend.h"
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
class osd_module;
|
||||||
|
|
||||||
|
// ======================> osd_module
|
||||||
|
|
||||||
|
class osd_module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
osd_module(const char *type, const char *name)
|
||||||
|
: m_name(name), m_type(type)
|
||||||
|
{}
|
||||||
|
virtual ~osd_module() { }
|
||||||
|
|
||||||
|
const char * name() const { return m_name; }
|
||||||
|
const char * type() const { return m_type; }
|
||||||
|
|
||||||
|
virtual bool probe() const { return true; }
|
||||||
|
|
||||||
|
virtual void init() { }
|
||||||
|
virtual void exit() { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
astring m_name;
|
||||||
|
astring m_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// a module_type is simply a pointer to its alloc function
|
||||||
|
typedef osd_module *(*module_type)();
|
||||||
|
|
||||||
|
// this template function creates a stub which constructs a module
|
||||||
|
template<class _ModuleClass>
|
||||||
|
osd_module *module_creator()
|
||||||
|
{
|
||||||
|
void *p = osd_malloc(sizeof(_ModuleClass));
|
||||||
|
return new(p) _ModuleClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
class osd_module_manager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static const int MAX_MODULES = 32;
|
||||||
|
|
||||||
|
osd_module_manager();
|
||||||
|
~osd_module_manager();
|
||||||
|
|
||||||
|
void register_module(const module_type &mod_type);
|
||||||
|
bool type_has_name(const char *type, const char *name);
|
||||||
|
|
||||||
|
osd_module *get_module_generic(const char *type, const char *name);
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
C select_module(const char *type, const char *name = "")
|
||||||
|
{
|
||||||
|
return dynamic_cast<C>(select_module(type, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_module *select_module(const char *type, const char *name = "");
|
||||||
|
|
||||||
|
void get_module_names(const char *type, const int max, int *num, const char *names[]);
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void exit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int get_module_index(const char *type, const char *name);
|
||||||
|
|
||||||
|
osd_module *m_modules[MAX_MODULES];
|
||||||
|
osd_module *m_selected[MAX_MODULES];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MODULE_DEFINITION(_id, _class) \
|
||||||
|
extern const module_type _id ; \
|
||||||
|
const module_type _id = &module_creator< _class >;
|
||||||
|
|
||||||
|
|
||||||
|
#define MODULE_NOT_SUPPORTED(_mod, _type, _name) \
|
||||||
|
class _mod : public osd_module { \
|
||||||
|
public: \
|
||||||
|
_mod () \
|
||||||
|
: osd_module(_type, _name) {} \
|
||||||
|
bool probe() const { return false; } \
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __OSDMODULE_H__ */
|
@ -18,6 +18,7 @@
|
|||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
#include "cliopts.h"
|
#include "cliopts.h"
|
||||||
|
|
||||||
|
|
||||||
// forward references
|
// forward references
|
||||||
class input_type_entry; // FIXME: including emu.h does not work because emu.h includes osdepend.h
|
class input_type_entry; // FIXME: including emu.h does not work because emu.h includes osdepend.h
|
||||||
|
|
||||||
@ -40,12 +41,6 @@ public:
|
|||||||
|
|
||||||
// ======================> osd_interface
|
// ======================> osd_interface
|
||||||
|
|
||||||
/* FIXME: this should be replaced by a proper module implementation
|
|
||||||
* For the time being only one font provider can be linked
|
|
||||||
*/
|
|
||||||
|
|
||||||
osd_font *osd_font_alloc();
|
|
||||||
|
|
||||||
// description of the currently-running machine
|
// description of the currently-running machine
|
||||||
class osd_interface
|
class osd_interface
|
||||||
{
|
{
|
||||||
@ -71,9 +66,7 @@ public:
|
|||||||
virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
|
virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
|
||||||
|
|
||||||
// font interface
|
// font interface
|
||||||
|
virtual osd_font *font_alloc() = 0;
|
||||||
// font is allocated with global_alloc; therefore use global_free!
|
|
||||||
osd_font *font_alloc() { return osd_font_alloc(); }
|
|
||||||
|
|
||||||
// command option overrides
|
// command option overrides
|
||||||
virtual bool execute_command(const char *command) = 0;
|
virtual bool execute_command(const char *command) = 0;
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:Aaron Giles
|
||||||
//============================================================
|
//============================================================
|
||||||
//
|
//
|
||||||
// main.c - Win32 main program
|
// main.c - Win32 main program
|
||||||
//
|
//
|
||||||
// Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
|
|
||||||
// Visit http://mamedev.org for licensing and usage restrictions.
|
|
||||||
//
|
|
||||||
// SDLMAME by Olivier Galibert and R. Belmont
|
|
||||||
//
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
// standard windows headers
|
// standard windows headers
|
||||||
|
#ifdef OSD_SDL
|
||||||
#define _WIN32_WINNT 0x0400
|
#define _WIN32_WINNT 0x0400
|
||||||
|
#endif
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
@ -38,10 +37,12 @@ extern "C" int _tmain(int argc, TCHAR **argv)
|
|||||||
int i, rc;
|
int i, rc;
|
||||||
char **utf8_argv;
|
char **utf8_argv;
|
||||||
|
|
||||||
|
#ifdef OSD_SDL
|
||||||
#ifdef MALLOC_DEBUG
|
#ifdef MALLOC_DEBUG
|
||||||
{
|
{
|
||||||
extern int winalloc_in_main_code;
|
extern int winalloc_in_main_code;
|
||||||
winalloc_in_main_code = TRUE;
|
winalloc_in_main_code = TRUE;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* convert arguments to UTF-8 */
|
/* convert arguments to UTF-8 */
|
||||||
@ -63,6 +64,7 @@ extern "C" int _tmain(int argc, TCHAR **argv)
|
|||||||
osd_free(utf8_argv[i]);
|
osd_free(utf8_argv[i]);
|
||||||
free(utf8_argv);
|
free(utf8_argv);
|
||||||
|
|
||||||
|
#ifdef OSD_SDL
|
||||||
#ifdef MALLOC_DEBUG
|
#ifdef MALLOC_DEBUG
|
||||||
{
|
{
|
||||||
void check_unfreed_mem(void);
|
void check_unfreed_mem(void);
|
||||||
@ -70,6 +72,7 @@ extern "C" int _tmain(int argc, TCHAR **argv)
|
|||||||
}
|
}
|
||||||
winalloc_in_main_code = FALSE;
|
winalloc_in_main_code = FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "clifront.h"
|
#include "clifront.h"
|
||||||
#include "modules/lib/osdobj_common.h"
|
#include "modules/lib/osdobj_common.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
#include "modules/osdmodule.h"
|
||||||
|
#include "modules/font/font_module.h"
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// System dependent defines
|
// System dependent defines
|
||||||
@ -220,7 +222,6 @@ private:
|
|||||||
// FIXME: remove machine usage
|
// FIXME: remove machine usage
|
||||||
void extract_video_config(running_machine &machine);
|
void extract_video_config(running_machine &machine);
|
||||||
|
|
||||||
|
|
||||||
sdl_options &m_options;
|
sdl_options &m_options;
|
||||||
|
|
||||||
watchdog *m_watchdog;
|
watchdog *m_watchdog;
|
||||||
|
@ -204,14 +204,14 @@ endif
|
|||||||
ifeq ($(TARGETOS),unix)
|
ifeq ($(TARGETOS),unix)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = tc
|
SYNC_IMPLEMENTATION = tc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGETOS),linux)
|
ifeq ($(TARGETOS),linux)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = tc
|
SYNC_IMPLEMENTATION = tc
|
||||||
SDL_NETWORK = taptun
|
SDL_NETWORK = taptun
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
|
|
||||||
ifndef NO_USE_MIDI
|
ifndef NO_USE_MIDI
|
||||||
INCPATH += `pkg-config --cflags alsa`
|
INCPATH += `pkg-config --cflags alsa`
|
||||||
@ -223,7 +223,7 @@ endif
|
|||||||
ifeq ($(TARGETOS),freebsd)
|
ifeq ($(TARGETOS),freebsd)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = tc
|
SYNC_IMPLEMENTATION = tc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
DEFS += -DNO_AFFINITY_NP
|
DEFS += -DNO_AFFINITY_NP
|
||||||
LIBS += -lutil
|
LIBS += -lutil
|
||||||
# /usr/local/include is not considered a system include directory
|
# /usr/local/include is not considered a system include directory
|
||||||
@ -235,7 +235,7 @@ endif
|
|||||||
ifeq ($(TARGETOS),openbsd)
|
ifeq ($(TARGETOS),openbsd)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = ntc
|
SYNC_IMPLEMENTATION = ntc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
LIBS += -lutil
|
LIBS += -lutil
|
||||||
NO_USE_MIDI = 1
|
NO_USE_MIDI = 1
|
||||||
endif
|
endif
|
||||||
@ -243,7 +243,7 @@ endif
|
|||||||
ifeq ($(TARGETOS),netbsd)
|
ifeq ($(TARGETOS),netbsd)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = ntc
|
SYNC_IMPLEMENTATION = ntc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
LIBS += -lutil
|
LIBS += -lutil
|
||||||
NO_USE_MIDI = 1
|
NO_USE_MIDI = 1
|
||||||
endif
|
endif
|
||||||
@ -252,14 +252,14 @@ ifeq ($(TARGETOS),solaris)
|
|||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
|
DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
|
||||||
SYNC_IMPLEMENTATION = tc
|
SYNC_IMPLEMENTATION = tc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
NO_USE_MIDI = 1
|
NO_USE_MIDI = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGETOS),haiku)
|
ifeq ($(TARGETOS),haiku)
|
||||||
BASE_TARGETOS = unix
|
BASE_TARGETOS = unix
|
||||||
SYNC_IMPLEMENTATION = ntc
|
SYNC_IMPLEMENTATION = ntc
|
||||||
FONT_IMPLEMENTATION = unix
|
FONT_IMPLEMENTATION = sdl
|
||||||
NO_X11 = 1
|
NO_X11 = 1
|
||||||
NO_USE_XINPUT = 1
|
NO_USE_XINPUT = 1
|
||||||
NO_USE_MIDI = 1
|
NO_USE_MIDI = 1
|
||||||
@ -430,7 +430,7 @@ OSDCOREOBJS = \
|
|||||||
$(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
|
$(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
|
||||||
$(OSDOBJ)/modules/lib/osdlib_$(SDLOS_TARGETOS).o \
|
$(OSDOBJ)/modules/lib/osdlib_$(SDLOS_TARGETOS).o \
|
||||||
$(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
|
$(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
|
||||||
$(OSDOBJ)/modules/font/font_$(FONT_IMPLEMENTATION).o \
|
$(OSDOBJ)/modules/osdmodule.o \
|
||||||
|
|
||||||
ifdef NOASM
|
ifdef NOASM
|
||||||
OSDCOREOBJS += $(OSDOBJ)/modules/sync/work_mini.o
|
OSDCOREOBJS += $(OSDOBJ)/modules/sync/work_mini.o
|
||||||
@ -451,6 +451,10 @@ OSDOBJS = \
|
|||||||
$(SDLOBJ)/output.o \
|
$(SDLOBJ)/output.o \
|
||||||
$(SDLOBJ)/watchdog.o \
|
$(SDLOBJ)/watchdog.o \
|
||||||
$(OSDOBJ)/modules/lib/osdobj_common.o \
|
$(OSDOBJ)/modules/lib/osdobj_common.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_sdl.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_windows.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_osx.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_none.o \
|
||||||
|
|
||||||
ifdef NO_USE_MIDI
|
ifdef NO_USE_MIDI
|
||||||
OSDOBJS += $(OSDOBJ)/modules/midi/none.o
|
OSDOBJS += $(OSDOBJ)/modules/midi/none.o
|
||||||
|
@ -12,11 +12,6 @@
|
|||||||
|
|
||||||
#ifdef SDLMAME_UNIX
|
#ifdef SDLMAME_UNIX
|
||||||
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
|
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
|
||||||
#if (SDLMAME_SDL2)
|
|
||||||
#include <SDL2/SDL_ttf.h>
|
|
||||||
#else
|
|
||||||
#include <SDL/SDL_ttf.h>
|
|
||||||
#endif
|
|
||||||
#ifndef SDLMAME_HAIKU
|
#ifndef SDLMAME_HAIKU
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#endif
|
#endif
|
||||||
@ -61,7 +56,9 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "osdsdl.h"
|
#include "osdsdl.h"
|
||||||
#include "modules/lib/osdlib.h"
|
#include "modules/lib/osdlib.h"
|
||||||
|
|
||||||
#include "modules/sound/sdl_sound.h"
|
#include "modules/sound/sdl_sound.h"
|
||||||
|
|
||||||
#if defined(SDLMAME_EMSCRIPTEN)
|
#if defined(SDLMAME_EMSCRIPTEN)
|
||||||
#include "modules/sound/js_sound.h"
|
#include "modules/sound/js_sound.h"
|
||||||
#endif
|
#endif
|
||||||
@ -269,7 +266,6 @@ sdl_options::sdl_options()
|
|||||||
set_default_value(SDLOPTION_INIPATH, ini_path.cstr());
|
set_default_value(SDLOPTION_INIPATH, ini_path.cstr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// main
|
// main
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -301,14 +297,11 @@ int main(int argc, char *argv[])
|
|||||||
setvbuf(stdout, (char *) NULL, _IONBF, 0);
|
setvbuf(stdout, (char *) NULL, _IONBF, 0);
|
||||||
setvbuf(stderr, (char *) NULL, _IONBF, 0);
|
setvbuf(stderr, (char *) NULL, _IONBF, 0);
|
||||||
|
|
||||||
//FIXME: move to font module
|
// FIXME: this should be done differently
|
||||||
|
|
||||||
#ifdef SDLMAME_UNIX
|
#ifdef SDLMAME_UNIX
|
||||||
sdl_entered_debugger = 0;
|
sdl_entered_debugger = 0;
|
||||||
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
|
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
|
||||||
if (TTF_Init() == -1)
|
|
||||||
{
|
|
||||||
printf("SDL_ttf failed: %s\n", TTF_GetError());
|
|
||||||
}
|
|
||||||
FcInit();
|
FcInit();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -355,12 +348,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// already called...
|
|
||||||
//SDL_Quit();
|
|
||||||
|
|
||||||
#ifdef SDLMAME_UNIX
|
#ifdef SDLMAME_UNIX
|
||||||
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
|
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
|
||||||
TTF_Quit();
|
|
||||||
if (!sdl_entered_debugger)
|
if (!sdl_entered_debugger)
|
||||||
{
|
{
|
||||||
FcFini();
|
FcFini();
|
||||||
@ -591,6 +580,7 @@ void sdl_osd_interface::debugger_register()
|
|||||||
// init
|
// init
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
|
||||||
void sdl_osd_interface::init(running_machine &machine)
|
void sdl_osd_interface::init(running_machine &machine)
|
||||||
{
|
{
|
||||||
// call our parent
|
// call our parent
|
||||||
|
@ -22,8 +22,10 @@
|
|||||||
|
|
||||||
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
|
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
|
||||||
|
|
||||||
|
#if defined(SDLMAME_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
// the result of these functions has to be released with osd_free()
|
// the result of these functions has to be released with osd_free()
|
||||||
|
|
||||||
CHAR *astring_from_utf8(const char *s);
|
CHAR *astring_from_utf8(const char *s);
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
// standard windows headers
|
// standard windows headers
|
||||||
|
#ifdef OSD_SDL
|
||||||
|
#define _WIN32_WINNT 0x0400
|
||||||
|
#endif
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
@ -34,6 +37,14 @@ extern "C" int _tmain(int argc, TCHAR **argv)
|
|||||||
int i, rc;
|
int i, rc;
|
||||||
char **utf8_argv;
|
char **utf8_argv;
|
||||||
|
|
||||||
|
#ifdef OSD_SDL
|
||||||
|
#ifdef MALLOC_DEBUG
|
||||||
|
{
|
||||||
|
extern int winalloc_in_main_code;
|
||||||
|
winalloc_in_main_code = TRUE;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* convert arguments to UTF-8 */
|
/* convert arguments to UTF-8 */
|
||||||
utf8_argv = (char **) malloc(argc * sizeof(*argv));
|
utf8_argv = (char **) malloc(argc * sizeof(*argv));
|
||||||
if (utf8_argv == NULL)
|
if (utf8_argv == NULL)
|
||||||
@ -53,5 +64,16 @@ extern "C" int _tmain(int argc, TCHAR **argv)
|
|||||||
osd_free(utf8_argv[i]);
|
osd_free(utf8_argv[i]);
|
||||||
free(utf8_argv);
|
free(utf8_argv);
|
||||||
|
|
||||||
|
#ifdef OSD_SDL
|
||||||
|
#ifdef MALLOC_DEBUG
|
||||||
|
{
|
||||||
|
void check_unfreed_mem(void);
|
||||||
|
check_unfreed_mem();
|
||||||
|
}
|
||||||
|
winalloc_in_main_code = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef __NETDEV_H
|
#ifndef __NETDEV_PCAP_H__
|
||||||
#define __NETDEV_H
|
#define __NETDEV_PCAP_H__
|
||||||
|
|
||||||
void init_pcap();
|
void init_pcap();
|
||||||
void deinit_pcap();
|
void deinit_pcap();
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
|
|
||||||
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
|
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
|
||||||
|
|
||||||
|
#if defined(SDLMAME_WIN32)
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
// the result of these functions has to be released with osd_free()
|
// the result of these functions has to be released with osd_free()
|
||||||
|
|
||||||
CHAR *astring_from_utf8(const char *s);
|
CHAR *astring_from_utf8(const char *s);
|
||||||
@ -38,6 +42,10 @@ char *utf8_from_wstring(const WCHAR *s);
|
|||||||
#define utf8_from_tstring utf8_from_astring
|
#define utf8_from_tstring utf8_from_astring
|
||||||
#endif // UNICODE
|
#endif // UNICODE
|
||||||
|
|
||||||
|
#if defined(SDLMAME_WIN32)
|
||||||
|
#define _tcsncpy wcsncpy
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //SDLMAME_WIN32
|
#endif //SDLMAME_WIN32
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,6 +358,7 @@ OSDCOREOBJS = \
|
|||||||
$(OSDOBJ)/modules/sync/work_osd.o \
|
$(OSDOBJ)/modules/sync/work_osd.o \
|
||||||
$(OSDOBJ)/modules/lib/osdlib_win32.o \
|
$(OSDOBJ)/modules/lib/osdlib_win32.o \
|
||||||
$(OSDOBJ)/modules/font/font_windows.o \
|
$(OSDOBJ)/modules/font/font_windows.o \
|
||||||
|
$(OSDOBJ)/modules/osdmodule.o \
|
||||||
$(WINOBJ)/winptty.o \
|
$(WINOBJ)/winptty.o \
|
||||||
|
|
||||||
|
|
||||||
@ -381,6 +382,10 @@ OSDOBJS = \
|
|||||||
$(WINOBJ)/winmain.o \
|
$(WINOBJ)/winmain.o \
|
||||||
$(OSDOBJ)/modules/midi/portmidi.o \
|
$(OSDOBJ)/modules/midi/portmidi.o \
|
||||||
$(OSDOBJ)/modules/lib/osdobj_common.o \
|
$(OSDOBJ)/modules/lib/osdobj_common.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_sdl.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_windows.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_osx.o \
|
||||||
|
$(OSDOBJ)/modules/font/font_none.o \
|
||||||
|
|
||||||
ifdef USE_SDL
|
ifdef USE_SDL
|
||||||
OSDOBJS += \
|
OSDOBJS += \
|
||||||
|
Loading…
Reference in New Issue
Block a user