diff options
author | Brad Hughes <bradhugh@outlook.com> | 2016-04-03 21:49:38 -0400 |
---|---|---|
committer | Brad Hughes <bradhugh@outlook.com> | 2016-04-03 21:49:38 -0400 |
commit | eae8eb8b00e8480afdc4e167b178cecb7c37a129 (patch) | |
tree | 684194ddb5ff8393a9a161d9c392c132807fc4a6 /src/osd/windows/winmain.cpp | |
parent | a05af7500f1f6ddcad7b4bd0159bee26b544358b (diff) |
winmain compile for UWP
Diffstat (limited to 'src/osd/windows/winmain.cpp')
-rw-r--r-- | src/osd/windows/winmain.cpp | 129 |
1 files changed, 72 insertions, 57 deletions
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 55cbde387e6..c7b1cb619e8 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -52,6 +52,8 @@ // TYPE DEFINITIONS //************************************************************************** +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + template<typename _FunctionPtr> class dynamic_bind { @@ -217,6 +219,7 @@ public: } }; +#endif @@ -231,21 +234,23 @@ int _CRT_glob = 0; // LOCAL VARIABLES //************************************************************************** +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) static LPTOP_LEVEL_EXCEPTION_FILTER pass_thru_filter; -static HANDLE watchdog_reset_event; -static HANDLE watchdog_exit_event; -static HANDLE watchdog_thread; +static sampling_profiler *profiler = nullptr; +static symbol_manager *symbols = nullptr; -static running_machine *g_current_machine; +bool stack_walker::s_initialized = false; static int timeresult = !TIMERR_NOERROR; static TIMECAPS timecaps; +#endif -static sampling_profiler *profiler = nullptr; -static symbol_manager *symbols = nullptr; +static HANDLE watchdog_reset_event; +static HANDLE watchdog_exit_event; +static HANDLE watchdog_thread; -bool stack_walker::s_initialized = false; +static running_machine *g_current_machine; //************************************************************************** @@ -374,6 +379,7 @@ const options_entry windows_options::s_option_entries[] = // MAIN ENTRY POINT //************************************************************************** +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) //============================================================ // utf8_main @@ -432,18 +438,6 @@ int main(int argc, char *argv[]) return result; } - -//============================================================ -// windows_options -//============================================================ - -windows_options::windows_options() -: osd_options() -{ - add_entries(s_option_entries); -} - - //============================================================ // control_handler //============================================================ @@ -453,12 +447,12 @@ static BOOL WINAPI control_handler(DWORD type) // indicate to the user that we detected something switch (type) { - case CTRL_C_EVENT: fprintf(stderr, "Caught Ctrl+C"); break; - case CTRL_BREAK_EVENT: fprintf(stderr, "Caught Ctrl+break"); break; - case CTRL_CLOSE_EVENT: fprintf(stderr, "Caught console close"); break; - case CTRL_LOGOFF_EVENT: fprintf(stderr, "Caught logoff"); break; - case CTRL_SHUTDOWN_EVENT: fprintf(stderr, "Caught shutdown"); break; - default: fprintf(stderr, "Caught unexpected console event"); break; + case CTRL_C_EVENT: fprintf(stderr, "Caught Ctrl+C"); break; + case CTRL_BREAK_EVENT: fprintf(stderr, "Caught Ctrl+break"); break; + case CTRL_CLOSE_EVENT: fprintf(stderr, "Caught console close"); break; + case CTRL_LOGOFF_EVENT: fprintf(stderr, "Caught logoff"); break; + case CTRL_SHUTDOWN_EVENT: fprintf(stderr, "Caught shutdown"); break; + default: fprintf(stderr, "Caught unexpected console event"); break; } // if we don't have a machine yet, or if we are handling ctrl+c/ctrl+break, @@ -480,7 +474,18 @@ static BOOL WINAPI control_handler(DWORD type) return TRUE; } +#endif + + +//============================================================ +// windows_options +//============================================================ +windows_options::windows_options() +: osd_options() +{ + add_entries(s_option_entries); +} //============================================================ @@ -592,11 +597,13 @@ void windows_osd_interface::init(running_machine &machine) if (options.oslog()) machine.add_logerror_callback(output_oslog); +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) // crank up the multimedia timer resolution to its max // this gives the system much finer timeslices timeresult = timeGetDevCaps(&timecaps, sizeof(timecaps)); if (timeresult == TIMERR_NOERROR) timeBeginPeriod(timecaps.wPeriodMin); +#endif // if a watchdog thread is requested, create one int watchdog = options.watchdog(); @@ -611,11 +618,13 @@ void windows_osd_interface::init(running_machine &machine) } // create and start the profiler +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) if (profile > 0) { profiler = global_alloc(sampling_profiler(1000, profile - 1)); profiler->start(); } +#endif // initialize sockets win_init_sockets(); @@ -652,6 +661,7 @@ void windows_osd_interface::osd_exit() watchdog_thread = nullptr; } +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) // stop the profiler if (profiler != nullptr) { @@ -663,43 +673,12 @@ void windows_osd_interface::osd_exit() // restore the timer resolution if (timeresult == TIMERR_NOERROR) timeEndPeriod(timecaps.wPeriodMin); +#endif // one last pass at events winwindow_process_events(machine(), 0, 0); } -//============================================================ -// winmain_dump_stack -//============================================================ - -void winmain_dump_stack() -{ - // set up the stack walker - stack_walker walker; - if (!walker.reset()) - return; - - // walk the stack - while (walker.unwind()) - fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip())); -} - - -//============================================================ -// check_for_double_click_start -//============================================================ - -static int is_double_click_start(int argc) -{ - STARTUPINFO startup_info = { sizeof(STARTUPINFO) }; - - // determine our startup information - GetStartupInfo(&startup_info); - - // try to determine if MAME was simply double-clicked - return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES)); -} - //============================================================ // watchdog_thread_entry @@ -751,6 +730,40 @@ void winmain_watchdog_ping(void) } +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + +//============================================================ +// winmain_dump_stack +//============================================================ + +void winmain_dump_stack() +{ + // set up the stack walker + stack_walker walker; + if (!walker.reset()) + return; + + // walk the stack + while (walker.unwind()) + fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip())); +} + + +//============================================================ +// check_for_double_click_start +//============================================================ + +static int is_double_click_start(int argc) +{ + STARTUPINFO startup_info = { sizeof(STARTUPINFO) }; + + // determine our startup information + GetStartupInfo(&startup_info); + + // try to determine if MAME was simply double-clicked + return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES)); +} + //============================================================ // exception_filter //============================================================ @@ -1559,3 +1572,5 @@ void sampling_profiler::thread_run() Sleep(1); } } + +#endif
\ No newline at end of file |