diff options
Diffstat (limited to 'src/osd/osdepend.h')
-rw-r--r-- | src/osd/osdepend.h | 257 |
1 files changed, 80 insertions, 177 deletions
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index 104039edf3d..26d8506da49 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -16,12 +16,19 @@ #include "emucore.h" #include "osdcore.h" #include "unicode.h" -#include "options.h" + +// forward references +class input_type_entry; // FIXME: including emu.h does not work because emu.h includes osdepend.h //============================================================ // Defines //============================================================ +/* FIXME: void cli_frontend::listnetworkadapters should be + * moved here. + */ +#include "options.h" + #define OSDOPTION_LOG "log" #define OSDOPTION_VERBOSE "verbose" #define OSDOPTION_DEBUG "debug" @@ -58,213 +65,109 @@ // 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 ... + */ + 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(); + // construction/destruction + osd_options() : core_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() + { + this->add_entries(s_option_entries); + } private: - static const options_entry s_option_entries[]; + 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; - +// FIXME: We can do better than this 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 // description of the currently-running machine class osd_interface { public: - // construction/destruction - osd_interface(); - virtual ~osd_interface(); - - void register_options(osd_options &options); - - // getters - running_machine &machine() const { assert(m_machine != NULL); return *m_machine; } // general overridables - virtual void init(running_machine &machine); - virtual void update(bool skip_redraw); + virtual void init(running_machine &machine) = 0; + virtual void update(bool skip_redraw) = 0; // debugger overridables - void init_debugger(); - void wait_for_debugger(device_t &device, bool firststop); - void debugger_update(); - void debugger_exit(); - virtual void debugger_register(); + virtual void init_debugger() = 0; + virtual void wait_for_debugger(device_t &device, bool firststop) = 0; // audio overridables - void update_audio_stream(const INT16 *buffer, int samples_this_frame); - void set_mastervolume(int attenuation); + virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame) = 0; + virtual void set_mastervolume(int attenuation) = 0; + virtual bool no_sound() = 0; + // input overridables - virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); + virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0; // font overridables - virtual osd_font font_open(const char *name, int &height); - 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 osd_font font_open(const char *name, int &height) = 0; + virtual void font_close(osd_font font) = 0; + virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0; // video overridables - virtual void *get_slider_list(); + virtual void *get_slider_list() = 0; // FIXME: returns slider_state * // midi overridables - // FIXME: this should return a list of devices, not list them on stdout - virtual void list_midi_devices(void); - - // FIXME: everything below seems to be osd specific and not part of - // this INTERFACE but part of the osd IMPLEMENTATION - - void init_subsystems(); - - virtual bool video_init(); - virtual void video_register(); - virtual bool window_init(); - - bool sound_init(); - virtual void sound_register(); - bool no_sound(); - - virtual bool input_init(); - virtual void input_pause(); - virtual void input_resume(); - virtual bool output_init(); - virtual bool network_init(); - virtual bool midi_init(); - - void exit_subsystems(); - virtual void video_exit(); - virtual void window_exit(); - void sound_exit(); - virtual void input_exit(); - virtual void output_exit(); - virtual void network_exit(); - virtual void midi_exit(); + // FIXME: this should return a list of devices, not list them on stdout, even better + // move this to OSD_OPTIONS + virtual void list_midi_devices(void) = 0; - virtual void osd_exit(); + virtual void list_network_adapters() = 0; - 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; - - 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__ */ |