diff options
author | Vas Crabb <vas@vastheman.com> | 2019-01-13 02:47:35 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2019-01-13 02:47:35 +1100 |
commit | 87822251d8fcbaa83b029340453afdb0670e868e (patch) | |
tree | 1555c7dd21945f112de00667b801321076c6f527 /src/osd | |
parent | 8b9c0940cf138fdb1405d0761fd36100352f65f2 (diff) |
osd/windows: Send logerror to stderr if no debugger is attached and -oslog is on.
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/windows/winmain.cpp | 33 | ||||
-rw-r--r-- | src/osd/windows/winmain.h | 2 | ||||
-rw-r--r-- | src/osd/windows/winutf8.cpp | 10 | ||||
-rw-r--r-- | src/osd/windows/winutf8.h | 23 |
4 files changed, 38 insertions, 30 deletions
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 9225acc0443..45d790aea78 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -6,20 +6,6 @@ // //============================================================ -// only for oslog callback -#include <functional> - -// standard windows headers -#include <windows.h> -#include <commctrl.h> -#include <mmsystem.h> -#include <tchar.h> -#include <io.h> - -// standard C headers -#include <ctype.h> -#include <stdarg.h> - // MAME headers #include "emu.h" #include "emuopts.h" @@ -34,6 +20,18 @@ #include "modules/diagnostics/diagnostics_module.h" #include "modules/monitor/monitor_common.h" +// standard C headers +#include <ctype.h> +#include <stdarg.h> +#include <stdio.h> + +// standard windows headers +#include <windows.h> +#include <commctrl.h> +#include <mmsystem.h> +#include <tchar.h> +#include <io.h> + #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #include <wrl/client.h> using namespace Windows::Storage; @@ -475,6 +473,8 @@ void windows_osd_interface::output_oslog(const char *buffer) { if (IsDebuggerPresent()) win_output_debug_string_utf8(buffer); + else + fputs(buffer, stderr); } @@ -573,10 +573,7 @@ void windows_osd_interface::init(running_machine &machine) // hook up the debugger log if (options.oslog()) - { - using namespace std::placeholders; - machine.add_logerror_callback(std::bind(&windows_osd_interface::output_oslog, this, _1)); - } + machine.add_logerror_callback(&windows_osd_interface::output_oslog); #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) // crank up the multimedia timer resolution to its max diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index 79e3b023b64..5fb71fa9286 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -312,7 +312,7 @@ protected: private: virtual void osd_exit() override; - void output_oslog(const char *buffer); + static void output_oslog(const char *buffer); windows_options & m_options; diff --git a/src/osd/windows/winutf8.cpp b/src/osd/windows/winutf8.cpp index 1c076158ebe..a056d694b89 100644 --- a/src/osd/windows/winutf8.cpp +++ b/src/osd/windows/winutf8.cpp @@ -6,15 +6,15 @@ // //============================================================ -// standard windows headers -#include <windows.h> -#include <shellapi.h> -#include <stdlib.h> - // MAMEOS headers #include "winutf8.h" #include "strconv.h" +#include <stdlib.h> + +// standard windows headers +#include <shellapi.h> + //============================================================ // win_output_debug_string_utf8 diff --git a/src/osd/windows/winutf8.h b/src/osd/windows/winutf8.h index a8d072ed2cc..1ec5429cfab 100644 --- a/src/osd/windows/winutf8.h +++ b/src/osd/windows/winutf8.h @@ -6,11 +6,15 @@ // //============================================================ -#ifndef __WINUTF8__ -#define __WINUTF8__ +#ifndef MAME_OSD_WINDOWS_WINUTF8_H +#define MAME_OSD_WINDOWS_WINUTF8_H + +#pragma once #include "osdcore.h" +#include <windows.h> + // wrappers for kernel32.dll void win_output_debug_string_utf8(const char *string); @@ -18,8 +22,15 @@ void win_output_debug_string_utf8(const char *string); int win_message_box_utf8(HWND window, const char *text, const char *caption, UINT type); BOOL win_set_window_text_utf8(HWND window, const char *text); std::string win_get_window_text_utf8(HWND window); -HWND win_create_window_ex_utf8(DWORD exstyle, const char* classname, const char* windowname, DWORD style, - int x, int y, int width, int height, HWND wndparent, HMENU menu, - HINSTANCE instance, void* param); +HWND win_create_window_ex_utf8( + DWORD exstyle, + const char *classname, + const char *windowname, + DWORD style, + int x, int y, int width, int height, + HWND wndparent, + HMENU menu, + HINSTANCE instance, + void *param); -#endif // __WINUTF8__ +#endif // MAME_OSD_WINDOWS_WINUTF8_H |