trunk/src/emu/validity.c
| r244743 | r244744 | |
| 199 | 199 | if (m_errors > 0 || m_warnings > 0) |
| 200 | 200 | { |
| 201 | 201 | astring tempstr; |
| 202 | | output_via_delegate(m_saved_error_output, "Core: %d errors, %d warnings\n", m_errors, m_warnings); |
| 202 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Core: %d errors, %d warnings\n", m_errors, m_warnings); |
| 203 | 203 | if (m_errors > 0) |
| 204 | 204 | { |
| 205 | 205 | m_error_text.replace("\n", "\n "); |
| 206 | | output_via_delegate(m_saved_error_output, "Errors:\n %s", m_error_text.cstr()); |
| 206 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.cstr()); |
| 207 | 207 | } |
| 208 | 208 | if (m_warnings > 0) |
| 209 | 209 | { |
| 210 | 210 | m_warning_text.replace("\n", "\n "); |
| 211 | | output_via_delegate(m_saved_error_output, "Warnings:\n %s", m_warning_text.cstr()); |
| 211 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.cstr()); |
| 212 | 212 | } |
| 213 | | output_via_delegate(m_saved_error_output, "\n"); |
| 213 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // then iterate over all drivers and check them |
| r244743 | r244744 | |
| 232 | 232 | void validity_checker::validate_begin() |
| 233 | 233 | { |
| 234 | 234 | // take over error and warning outputs |
| 235 | | m_saved_error_output = osd_set_output_channel(OSD_OUTPUT_CHANNEL_ERROR, output_delegate(FUNC(validity_checker::error_output), this)); |
| 236 | | m_saved_warning_output = osd_set_output_channel(OSD_OUTPUT_CHANNEL_WARNING, output_delegate(FUNC(validity_checker::warning_output), this)); |
| 235 | osd_output::push(this); |
| 237 | 236 | |
| 238 | 237 | // reset all our maps |
| 239 | 238 | m_names_map.reset(); |
| r244743 | r244744 | |
| 257 | 256 | void validity_checker::validate_end() |
| 258 | 257 | { |
| 259 | 258 | // restore the original output callbacks |
| 260 | | osd_set_output_channel(OSD_OUTPUT_CHANNEL_ERROR, m_saved_error_output); |
| 261 | | osd_set_output_channel(OSD_OUTPUT_CHANNEL_WARNING, m_saved_warning_output); |
| 259 | osd_output::pop(this); |
| 262 | 260 | } |
| 263 | 261 | |
| 264 | 262 | |
| r244743 | r244744 | |
| 301 | 299 | if (m_errors > start_errors || m_warnings > start_warnings) |
| 302 | 300 | { |
| 303 | 301 | astring tempstr; |
| 304 | | output_via_delegate(m_saved_error_output, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).cstr(), m_errors - start_errors, m_warnings - start_warnings); |
| 302 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).cstr(), m_errors - start_errors, m_warnings - start_warnings); |
| 305 | 303 | if (m_errors > start_errors) |
| 306 | 304 | { |
| 307 | 305 | m_error_text.replace("\n", "\n "); |
| 308 | | output_via_delegate(m_saved_error_output, "Errors:\n %s", m_error_text.cstr()); |
| 306 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.cstr()); |
| 309 | 307 | } |
| 310 | 308 | if (m_warnings > start_warnings) |
| 311 | 309 | { |
| 312 | 310 | m_warning_text.replace("\n", "\n "); |
| 313 | | output_via_delegate(m_saved_error_output, "Warnings:\n %s", m_warning_text.cstr()); |
| 311 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.cstr()); |
| 314 | 312 | } |
| 315 | | output_via_delegate(m_saved_error_output, "\n"); |
| 313 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); |
| 316 | 314 | } |
| 317 | 315 | |
| 318 | 316 | // reset the driver/device |
| r244743 | r244744 | |
| 834 | 832 | // if we have a coin error, demonstrate the correct way |
| 835 | 833 | if (coin_error) |
| 836 | 834 | { |
| 837 | | output_via_delegate(m_saved_error_output, " Note proper coin sort order should be:\n"); |
| 835 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, " Note proper coin sort order should be:\n"); |
| 838 | 836 | for (int entry = 0; entry < ARRAY_LENGTH(coin_list); entry++) |
| 839 | 837 | if (coin_list[entry]) |
| 840 | | output_via_delegate(m_saved_error_output, " %s\n", ioport_string_from_index(__input_string_coinage_start + entry)); |
| 838 | output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, " %s\n", ioport_string_from_index(__input_string_coinage_start + entry)); |
| 841 | 839 | } |
| 842 | 840 | } |
| 843 | 841 | |
| r244743 | r244744 | |
| 1057 | 1055 | // error_output - error message output override |
| 1058 | 1056 | //------------------------------------------------- |
| 1059 | 1057 | |
| 1060 | | void validity_checker::error_output(const char *format, va_list argptr) |
| 1058 | void validity_checker::output_callback(osd_output_channel channel, const char *msg, va_list args) |
| 1061 | 1059 | { |
| 1062 | | // count the error |
| 1063 | | m_errors++; |
| 1064 | | |
| 1065 | | // output the source(driver) device 'tag' |
| 1066 | 1060 | astring output; |
| 1067 | | build_output_prefix(output); |
| 1061 | switch (channel) |
| 1062 | { |
| 1063 | case OSD_OUTPUT_CHANNEL_ERROR: |
| 1064 | // count the error |
| 1065 | m_errors++; |
| 1068 | 1066 | |
| 1069 | | // generate the string |
| 1070 | | output.catvprintf(format, argptr); |
| 1071 | | m_error_text.cat(output); |
| 1072 | | } |
| 1067 | // output the source(driver) device 'tag' |
| 1068 | build_output_prefix(output); |
| 1073 | 1069 | |
| 1070 | // generate the string |
| 1071 | output.catvprintf(msg, args); |
| 1072 | m_error_text.cat(output); |
| 1073 | break; |
| 1074 | case OSD_OUTPUT_CHANNEL_WARNING: |
| 1075 | // count the error |
| 1076 | m_warnings++; |
| 1074 | 1077 | |
| 1075 | | //------------------------------------------------- |
| 1076 | | // warning_output - warning message output |
| 1077 | | // override |
| 1078 | | //------------------------------------------------- |
| 1078 | // output the source(driver) device 'tag' |
| 1079 | build_output_prefix(output); |
| 1079 | 1080 | |
| 1080 | | void validity_checker::warning_output(const char *format, va_list argptr) |
| 1081 | | { |
| 1082 | | // count the error |
| 1083 | | m_warnings++; |
| 1084 | | |
| 1085 | | // output the source(driver) device 'tag' |
| 1086 | | astring output; |
| 1087 | | build_output_prefix(output); |
| 1088 | | |
| 1089 | | // generate the string and output to the original target |
| 1090 | | output.catvprintf(format, argptr); |
| 1091 | | m_warning_text.cat(output); |
| 1081 | // generate the string and output to the original target |
| 1082 | output.catvprintf(msg, args); |
| 1083 | m_warning_text.cat(output); |
| 1084 | break; |
| 1085 | default: |
| 1086 | chain_output(channel, msg, args); |
| 1087 | break; |
| 1088 | } |
| 1092 | 1089 | } |
| 1093 | 1090 | |
| 1094 | | |
| 1095 | 1091 | //------------------------------------------------- |
| 1096 | 1092 | // output_via_delegate - helper to output a |
| 1097 | 1093 | // message via a varargs string, so the argptr |
| 1098 | 1094 | // can be forwarded onto the given delegate |
| 1099 | 1095 | //------------------------------------------------- |
| 1100 | 1096 | |
| 1101 | | void validity_checker::output_via_delegate(output_delegate &delegate, const char *format, ...) |
| 1097 | void validity_checker::output_via_delegate(osd_output_channel channel, const char *format, ...) |
| 1102 | 1098 | { |
| 1103 | 1099 | va_list argptr; |
| 1104 | 1100 | |
| 1105 | 1101 | // call through to the delegate with the proper parameters |
| 1106 | 1102 | va_start(argptr, format); |
| 1107 | | delegate(format, argptr); |
| 1103 | this->chain_output(channel, format, argptr); |
| 1108 | 1104 | va_end(argptr); |
| 1109 | 1105 | } |
trunk/src/osd/modules/lib/osdobj_common.c
| r244743 | r244744 | |
| 133 | 133 | //------------------------------------------------- |
| 134 | 134 | |
| 135 | 135 | osd_common_t::osd_common_t(osd_options &options) |
| 136 | | : m_machine(NULL), |
| 136 | : osd_output(), m_machine(NULL), |
| 137 | 137 | m_options(options), |
| 138 | 138 | m_sound(NULL), |
| 139 | 139 | m_debugger(NULL) |
| 140 | { |
| 141 | osd_output::push(this); |
| 142 | } |
| 140 | 143 | |
| 144 | //------------------------------------------------- |
| 145 | // osd_interface - destructor |
| 146 | //------------------------------------------------- |
| 147 | |
| 148 | osd_common_t::~osd_common_t() |
| 141 | 149 | { |
| 150 | for(int i= 0; i < m_video_names.count(); ++i) |
| 151 | osd_free(const_cast<char*>(m_video_names[i])); |
| 152 | //m_video_options,reset(); |
| 153 | osd_output::pop(this); |
| 142 | 154 | } |
| 143 | 155 | |
| 144 | 156 | #define REGISTER_MODULE(_O, _X ) { extern const module_type _X; _O . register_module( _X ); } |
| r244743 | r244744 | |
| 228 | 240 | m_options.set_description(key, core_strdup(current_value.cat(new_option_value).cstr())); |
| 229 | 241 | } |
| 230 | 242 | |
| 243 | |
| 231 | 244 | //------------------------------------------------- |
| 232 | | // osd_interface - destructor |
| 245 | // output_callback - callback for osd_printf_... |
| 233 | 246 | //------------------------------------------------- |
| 234 | | |
| 235 | | osd_common_t::~osd_common_t() |
| 247 | void osd_common_t::output_callback(osd_output_channel channel, const char *msg, va_list args) |
| 236 | 248 | { |
| 237 | | for(int i= 0; i < m_video_names.count(); ++i) |
| 238 | | osd_free(const_cast<char*>(m_video_names[i])); |
| 239 | | //m_video_options,reset(); |
| 249 | switch (channel) |
| 250 | { |
| 251 | case OSD_OUTPUT_CHANNEL_ERROR: |
| 252 | case OSD_OUTPUT_CHANNEL_WARNING: |
| 253 | vfprintf(stderr, msg, args); |
| 254 | break; |
| 255 | case OSD_OUTPUT_CHANNEL_INFO: |
| 256 | case OSD_OUTPUT_CHANNEL_VERBOSE: |
| 257 | case OSD_OUTPUT_CHANNEL_LOG: |
| 258 | vfprintf(stdout, msg, args); |
| 259 | break; |
| 260 | case OSD_OUTPUT_CHANNEL_DEBUG: |
| 261 | #ifdef MAME_DEBUG |
| 262 | vfprintf(stdout, msg, args); |
| 263 | #endif |
| 264 | break; |
| 265 | default: |
| 266 | break; |
| 267 | } |
| 240 | 268 | } |
| 241 | 269 | |
| 242 | | |
| 243 | 270 | //------------------------------------------------- |
| 244 | 271 | // init - initialize the OSD system. |
| 245 | 272 | //------------------------------------------------- |
trunk/src/osd/osdcore.c
| r244743 | r244744 | |
| 3 | 3 | |
| 4 | 4 | bool g_print_verbose = false; |
| 5 | 5 | |
| 6 | static const int MAXSTACK = 10; |
| 7 | static osd_output *m_stack[MAXSTACK]; |
| 8 | static int m_ptr = -1; |
| 6 | 9 | |
| 7 | 10 | /*------------------------------------------------- |
| 8 | | osd_file_output_callback - default callback |
| 9 | | for file output |
| 11 | osd_output |
| 10 | 12 | -------------------------------------------------*/ |
| 11 | 13 | |
| 12 | | void osd_file_output_callback(FILE *param, const char *format, va_list argptr) |
| 14 | void osd_output::push(osd_output *delegate) |
| 13 | 15 | { |
| 14 | | vfprintf(param, format, argptr); |
| 16 | assert(m_ptr < MAXSTACK); |
| 17 | delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : NULL); |
| 18 | m_ptr++; |
| 19 | m_stack[m_ptr] = delegate; |
| 20 | //printf("push m_ptr == %d\n", m_ptr); |
| 15 | 21 | } |
| 16 | 22 | |
| 17 | | |
| 18 | | /*------------------------------------------------- |
| 19 | | osd_null_output_callback - default callback |
| 20 | | for no output |
| 21 | | -------------------------------------------------*/ |
| 22 | | |
| 23 | | void osd_null_output_callback(FILE *param, const char *format, va_list argptr) |
| 23 | void osd_output::pop(osd_output *delegate) |
| 24 | 24 | { |
| 25 | int f = -1; |
| 26 | for (int i=0; i<=m_ptr; i++) |
| 27 | if (m_stack[i] == delegate) |
| 28 | { |
| 29 | f = i; |
| 30 | break; |
| 31 | } |
| 32 | if (f >= 0) |
| 33 | { |
| 34 | if (f < m_ptr) |
| 35 | m_stack[f+1]->m_chain = m_stack[f]->m_chain; |
| 36 | m_ptr--; |
| 37 | for (int i = f; i <= m_ptr; i++) |
| 38 | m_stack[i] = m_stack[i+1]; |
| 39 | } |
| 40 | //printf("pop m_ptr == %d\n", m_ptr); |
| 25 | 41 | } |
| 26 | 42 | |
| 27 | 43 | |
| 28 | | |
| 29 | | /* output channels */ |
| 30 | | static output_delegate output_cb[OSD_OUTPUT_CHANNEL_COUNT] = |
| 31 | | { |
| 32 | | output_delegate(FUNC(osd_file_output_callback), stderr), // OSD_OUTPUT_CHANNEL_ERROR |
| 33 | | output_delegate(FUNC(osd_file_output_callback), stderr), // OSD_OUTPUT_CHANNEL_WARNING |
| 34 | | output_delegate(FUNC(osd_file_output_callback), stdout), // OSD_OUTPUT_CHANNEL_INFO |
| 35 | | #ifdef MAME_DEBUG |
| 36 | | output_delegate(FUNC(osd_file_output_callback), stdout), // OSD_OUTPUT_CHANNEL_DEBUG |
| 37 | | #else |
| 38 | | output_delegate(FUNC(osd_null_output_callback), stdout), // OSD_OUTPUT_CHANNEL_DEBUG |
| 39 | | #endif |
| 40 | | output_delegate(FUNC(osd_file_output_callback), stdout), // OSD_OUTPUT_CHANNEL_VERBOSE |
| 41 | | output_delegate(FUNC(osd_file_output_callback), stdout) // OSD_OUTPUT_CHANNEL_LOG |
| 42 | | }; |
| 43 | | |
| 44 | | |
| 45 | 44 | /*************************************************************************** |
| 46 | 45 | OUTPUT MANAGEMENT |
| 47 | 46 | ***************************************************************************/ |
| 48 | 47 | |
| 49 | 48 | /*------------------------------------------------- |
| 50 | | osd_set_output_channel - configure an output |
| 51 | | channel |
| 52 | | -------------------------------------------------*/ |
| 53 | | |
| 54 | | output_delegate osd_set_output_channel(output_channel channel, output_delegate callback) |
| 55 | | { |
| 56 | | if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull()) |
| 57 | | { |
| 58 | | throw std::exception(); |
| 59 | | } |
| 60 | | |
| 61 | | /* return the originals if requested */ |
| 62 | | output_delegate prevcb = output_cb[channel]; |
| 63 | | |
| 64 | | /* set the new ones */ |
| 65 | | output_cb[channel] = callback; |
| 66 | | return prevcb; |
| 67 | | } |
| 68 | | |
| 69 | | /*------------------------------------------------- |
| 70 | 49 | osd_printf_error - output an error to the |
| 71 | 50 | appropriate callback |
| 72 | 51 | -------------------------------------------------*/ |
| r244743 | r244744 | |
| 77 | 56 | |
| 78 | 57 | /* do the output */ |
| 79 | 58 | va_start(argptr, format); |
| 80 | | output_cb[OSD_OUTPUT_CHANNEL_ERROR](format, argptr); |
| 59 | if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_ERROR, format, argptr); |
| 81 | 60 | va_end(argptr); |
| 82 | 61 | } |
| 83 | 62 | |
| r244743 | r244744 | |
| 93 | 72 | |
| 94 | 73 | /* do the output */ |
| 95 | 74 | va_start(argptr, format); |
| 96 | | output_cb[OSD_OUTPUT_CHANNEL_WARNING](format, argptr); |
| 75 | if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_WARNING, format, argptr); |
| 97 | 76 | va_end(argptr); |
| 98 | 77 | } |
| 99 | 78 | |
| r244743 | r244744 | |
| 109 | 88 | |
| 110 | 89 | /* do the output */ |
| 111 | 90 | va_start(argptr, format); |
| 112 | | output_cb[OSD_OUTPUT_CHANNEL_INFO](format, argptr); |
| 91 | if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_INFO, format, argptr); |
| 113 | 92 | va_end(argptr); |
| 114 | 93 | } |
| 115 | 94 | |
| r244743 | r244744 | |
| 129 | 108 | |
| 130 | 109 | /* do the output */ |
| 131 | 110 | va_start(argptr, format); |
| 132 | | output_cb[OSD_OUTPUT_CHANNEL_VERBOSE](format, argptr); |
| 111 | if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_VERBOSE, format, argptr); |
| 133 | 112 | va_end(argptr); |
| 134 | 113 | } |
| 135 | 114 | |
| r244743 | r244744 | |
| 145 | 124 | |
| 146 | 125 | /* do the output */ |
| 147 | 126 | va_start(argptr, format); |
| 148 | | output_cb[OSD_OUTPUT_CHANNEL_DEBUG](format, argptr); |
| 127 | if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_DEBUG, format, argptr); |
| 149 | 128 | va_end(argptr); |
| 150 | 129 | } |
| 151 | 130 | |
trunk/src/osd/osdcore.h
| r244743 | r244744 | |
| 20 | 20 | #define __OSDCORE_H__ |
| 21 | 21 | |
| 22 | 22 | #include "osdcomm.h" |
| 23 | | #include "delegate.h" |
| 24 | 23 | #include <stdarg.h> |
| 25 | 24 | |
| 26 | 25 | /*************************************************************************** |
| r244743 | r244744 | |
| 926 | 925 | /* ----- output management ----- */ |
| 927 | 926 | |
| 928 | 927 | // output channels |
| 929 | | enum output_channel |
| 928 | enum osd_output_channel |
| 930 | 929 | { |
| 931 | 930 | OSD_OUTPUT_CHANNEL_ERROR, |
| 932 | 931 | OSD_OUTPUT_CHANNEL_WARNING, |
| r244743 | r244744 | |
| 937 | 936 | OSD_OUTPUT_CHANNEL_COUNT |
| 938 | 937 | }; |
| 939 | 938 | |
| 940 | | // output channel callback |
| 941 | | typedef delegate<void (const char *, va_list)> output_delegate; |
| 939 | class osd_output |
| 940 | { |
| 941 | public: |
| 942 | osd_output() : m_chain(NULL) { } |
| 943 | virtual ~osd_output() { } |
| 942 | 944 | |
| 943 | | /* set the output handler for a channel, returns the current one */ |
| 944 | | output_delegate osd_set_output_channel(output_channel channel, output_delegate callback); |
| 945 | virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) = 0; |
| 945 | 946 | |
| 947 | static void push(osd_output *delegate); |
| 948 | static void pop(osd_output *delegate); |
| 949 | protected: |
| 950 | |
| 951 | void chain_output(osd_output_channel channel, const char *msg, va_list args) |
| 952 | { |
| 953 | if (m_chain != NULL) |
| 954 | m_chain->output_callback(channel, msg, args); |
| 955 | } |
| 956 | private: |
| 957 | osd_output *m_chain; |
| 958 | }; |
| 959 | |
| 946 | 960 | /* calls to be used by the code */ |
| 947 | 961 | void CLIB_DECL osd_printf_error(const char *format, ...) ATTR_PRINTF(1,2); |
| 948 | 962 | void CLIB_DECL osd_printf_warning(const char *format, ...) ATTR_PRINTF(1,2); |
trunk/src/osd/windows/winmain.c
| r244743 | r244744 | |
| 198 | 198 | FPTR * m_buffer_end; |
| 199 | 199 | }; |
| 200 | 200 | |
| 201 | //============================================================ |
| 202 | // winui_output_error |
| 203 | //============================================================ |
| 201 | 204 | |
| 205 | class winui_output_error : public osd_output |
| 206 | { |
| 207 | public: |
| 208 | virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) |
| 209 | { |
| 210 | if (channel == OSD_OUTPUT_CHANNEL_ERROR) |
| 211 | { |
| 212 | char buffer[1024]; |
| 202 | 213 | |
| 214 | // if we are in fullscreen mode, go to windowed mode |
| 215 | if ((video_config.windowed == 0) && (win_window_list != NULL)) |
| 216 | winwindow_toggle_full_screen(); |
| 203 | 217 | |
| 218 | vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args); |
| 219 | win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK); |
| 220 | } |
| 221 | else |
| 222 | chain_output(channel, msg, args); |
| 223 | } |
| 224 | }; |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 204 | 229 | //************************************************************************** |
| 205 | 230 | // GLOBAL VARIABLES |
| 206 | 231 | //************************************************************************** |
| r244743 | r244744 | |
| 237 | 262 | static int is_double_click_start(int argc); |
| 238 | 263 | static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter); |
| 239 | 264 | static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info); |
| 240 | | static void winui_output_error(delegate_late_bind *__dummy, const char *format, va_list argptr); |
| 241 | 265 | |
| 242 | 266 | |
| 243 | 267 | |
| r244743 | r244744 | |
| 391 | 415 | extern void (*s_debugger_stack_crawler)(); |
| 392 | 416 | s_debugger_stack_crawler = winmain_dump_stack; |
| 393 | 417 | |
| 394 | | // if we're a GUI app, out errors to message boxes |
| 395 | | if (win_is_gui_application() || is_double_click_start(argc)) |
| 396 | | { |
| 397 | | // if we are a GUI app, output errors to message boxes |
| 398 | | osd_set_output_channel(OSD_OUTPUT_CHANNEL_ERROR, output_delegate(FUNC(winui_output_error), (delegate_late_bind *)0)); |
| 399 | 418 | |
| 400 | | // make sure any console window that opened on our behalf is nuked |
| 401 | | FreeConsole(); |
| 402 | | } |
| 403 | | |
| 404 | 419 | // parse config and cmdline options |
| 405 | 420 | DWORD result = 0; |
| 406 | 421 | { |
| 407 | 422 | windows_options options; |
| 408 | 423 | windows_osd_interface osd(options); |
| 424 | // if we're a GUI app, out errors to message boxes |
| 425 | // Initialize this after the osd interface so that we are first in the |
| 426 | // output order |
| 427 | winui_output_error winerror; |
| 428 | if (win_is_gui_application() || is_double_click_start(argc)) |
| 429 | { |
| 430 | // if we are a GUI app, output errors to message boxes |
| 431 | osd_output::push(&winerror); |
| 432 | // make sure any console window that opened on our behalf is nuked |
| 433 | FreeConsole(); |
| 434 | } |
| 409 | 435 | osd.register_options(); |
| 410 | 436 | cli_frontend frontend(options, osd); |
| 411 | 437 | result = frontend.execute(argc, argv); |
| 438 | osd_output::pop(&winerror); |
| 412 | 439 | } |
| 413 | 440 | // free symbols |
| 414 | 441 | symbols = NULL; |
| r244743 | r244744 | |
| 464 | 491 | } |
| 465 | 492 | |
| 466 | 493 | |
| 467 | | //============================================================ |
| 468 | | // winui_output_error |
| 469 | | //============================================================ |
| 470 | 494 | |
| 471 | | static void winui_output_error(delegate_late_bind *param, const char *format, va_list argptr) |
| 472 | | { |
| 473 | | char buffer[1024]; |
| 474 | 495 | |
| 475 | | // if we are in fullscreen mode, go to windowed mode |
| 476 | | if ((video_config.windowed == 0) && (win_window_list != NULL)) |
| 477 | | winwindow_toggle_full_screen(); |
| 478 | | |
| 479 | | vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr); |
| 480 | | win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK); |
| 481 | | } |
| 482 | | |
| 483 | | |
| 484 | | |
| 485 | 496 | //============================================================ |
| 486 | 497 | // output_oslog |
| 487 | 498 | //============================================================ |