diff options
Diffstat (limited to 'src/osd/modules/lib/osdobj_common.c')
-rw-r--r-- | src/osd/modules/lib/osdobj_common.c | 279 |
1 files changed, 138 insertions, 141 deletions
diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index 73580dba2fd..57731edc591 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -17,79 +17,79 @@ extern bool g_print_verbose; 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" }, - { 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" }, - - // debugging options - { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, - { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used : " }, - { 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 -sound none -nothrottle" }, - // video options - { NULL, NULL, OPTION_HEADER, "OSD VIDEO OPTIONS" }, + { NULL, NULL, OPTION_HEADER, "OSD FONT OPTIONS" }, + { OSD_FONT_PROVIDER, "auto", OPTION_STRING, "provider for ui font: " }, + + { NULL, NULL, OPTION_HEADER, "OSD CLI OPTIONS" }, + { 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" }, + + // debugging options + { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, + { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used : " }, + { 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 -sound none -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 } + { 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() : cli_options() { - add_entries(osd_options::s_option_entries); + add_entries(osd_options::s_option_entries); }; @@ -99,9 +99,9 @@ osd_options::osd_options() osd_common_t::osd_common_t(osd_options &options) : m_machine(NULL), - m_options(options), - m_sound(NULL), - m_debugger(NULL) + m_options(options), + m_sound(NULL), + m_debugger(NULL) { } @@ -110,52 +110,51 @@ osd_common_t::osd_common_t(osd_options &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); - 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); - - REGISTER_MODULE(m_mod_man, SOUND_DSOUND); - REGISTER_MODULE(m_mod_man, SOUND_JS); - REGISTER_MODULE(m_mod_man, SOUND_SDL); - REGISTER_MODULE(m_mod_man, SOUND_NONE); + REGISTER_MODULE(m_mod_man, SOUND_DSOUND); + REGISTER_MODULE(m_mod_man, SOUND_JS); + REGISTER_MODULE(m_mod_man, SOUND_SDL); + REGISTER_MODULE(m_mod_man, SOUND_NONE); #ifdef SDLMAME_MACOSX - REGISTER_MODULE(m_mod_man, DEBUG_OSX); + REGISTER_MODULE(m_mod_man, DEBUG_OSX); #endif - REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS); - REGISTER_MODULE(m_mod_man, DEBUG_QT); - REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL); - REGISTER_MODULE(m_mod_man, DEBUG_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); - - m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names); - dnames.reset(); - for (int i = 0; i < num; i++) - dnames.append(names[i]); - update_option(OSD_SOUND_PROVIDER, dnames); - - // Register debugger options and update options - m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names); - dnames.reset(); - for (int i = 0; i < num; i++) - dnames.append(names[i]); - update_option(OSD_DEBUG_PROVIDER, dnames); - - // Register video options and update options - video_options_add("none", NULL); - video_register(); - update_option(OSDOPTION_VIDEO, m_video_names); + REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS); + REGISTER_MODULE(m_mod_man, DEBUG_QT); + REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL); + REGISTER_MODULE(m_mod_man, DEBUG_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); + + m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names); + dnames.reset(); + for (int i = 0; i < num; i++) + dnames.append(names[i]); + update_option(OSD_SOUND_PROVIDER, dnames); + + // Register debugger options and update options + m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names); + dnames.reset(); + for (int i = 0; i < num; i++) + dnames.append(names[i]); + update_option(OSD_DEBUG_PROVIDER, dnames); + + // Register video options and update options + video_options_add("none", NULL); + video_register(); + update_option(OSDOPTION_VIDEO, m_video_names); } void osd_common_t::update_option(const char * key, dynamic_array<const char *> &values) @@ -305,7 +304,7 @@ void osd_common_t::update_audio_stream(const INT16 *buffer, int samples_this_fra // 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(m_machine->video().throttled(), buffer,samples_this_frame); + m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame); } @@ -322,8 +321,8 @@ void osd_common_t::set_mastervolume(int attenuation) // while (attenuation++ < 0) // volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB // - if (m_sound != NULL) - m_sound->set_mastervolume(attenuation); + if (m_sound != NULL) + m_sound->set_mastervolume(attenuation); } @@ -398,20 +397,20 @@ void *osd_common_t::get_slider_list() bool osd_common_t::execute_command(const char *command) { - if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0) - { - network_init(); - osd_list_network_adapters(); - network_exit(); - return true; - } - else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0) - { - osd_list_midi_devices(); - return true; - } + if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0) + { + network_init(); + osd_list_network_adapters(); + network_exit(); + return true; + } + else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0) + { + osd_list_midi_devices(); + return true; + } - return false; + return false; } @@ -437,15 +436,15 @@ void osd_common_t::init_subsystems() #endif midi_init(); - m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER); + m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER); - m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER); - m_sound->m_sample_rate = options().sample_rate(); - m_sound->m_audio_latency = options().audio_latency(); + m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER); + m_sound->m_sample_rate = options().sample_rate(); + m_sound->m_audio_latency = options().audio_latency(); - m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER); + m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER); - m_mod_man.init(); + m_mod_man.init(); } @@ -524,9 +523,9 @@ void osd_common_t::network_exit() void osd_common_t::osd_exit() { - m_mod_man.exit(); + m_mod_man.exit(); - exit_subsystems(); + exit_subsystems(); } void osd_common_t::video_options_add(const char *name, void *type) @@ -537,13 +536,11 @@ void osd_common_t::video_options_add(const char *name, void *type) bool osd_common_t::midi_init() { - // this should be done on the OS_level - return osd_midi_init(); + // this should be done on the OS_level + return osd_midi_init(); } void osd_common_t::midi_exit() { - osd_midi_exit(); + osd_midi_exit(); } - - |