mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
winmain compile for UWP
This commit is contained in:
parent
a05af7500f
commit
eae8eb8b00
@ -47,7 +47,9 @@ public:
|
||||
|
||||
private:
|
||||
HMONITOR m_handle; // handle to the monitor
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
MONITORINFOEX m_info; // most recently retrieved info
|
||||
#endif
|
||||
};
|
||||
|
||||
struct osd_video_config
|
||||
|
@ -57,14 +57,22 @@ public:
|
||||
|
||||
virtual bool win_has_menu() override
|
||||
{
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
return GetMenu(m_hwnd) ? true : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual osd_dim get_size() override
|
||||
{
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
RECT client;
|
||||
GetClientRect(m_hwnd, &client);
|
||||
return osd_dim(client.right - client.left, client.bottom - client.top);
|
||||
#else
|
||||
throw ref new Platform::NotImplementedException();
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual osd_monitor_info *monitor() const override { return m_monitor; }
|
||||
|
@ -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,22 +234,24 @@ int _CRT_glob = 0;
|
||||
// LOCAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
static LPTOP_LEVEL_EXCEPTION_FILTER pass_thru_filter;
|
||||
|
||||
static sampling_profiler *profiler = nullptr;
|
||||
static symbol_manager *symbols = nullptr;
|
||||
|
||||
bool stack_walker::s_initialized = false;
|
||||
|
||||
static int timeresult = !TIMERR_NOERROR;
|
||||
static TIMECAPS timecaps;
|
||||
#endif
|
||||
|
||||
static HANDLE watchdog_reset_event;
|
||||
static HANDLE watchdog_exit_event;
|
||||
static HANDLE watchdog_thread;
|
||||
|
||||
static running_machine *g_current_machine;
|
||||
|
||||
static int timeresult = !TIMERR_NOERROR;
|
||||
static TIMECAPS timecaps;
|
||||
|
||||
static sampling_profiler *profiler = nullptr;
|
||||
static symbol_manager *symbols = nullptr;
|
||||
|
||||
bool stack_walker::s_initialized = false;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// FUNCTION PROTOTYPES
|
||||
@ -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,8 +474,19 @@ static BOOL WINAPI control_handler(DWORD type)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//============================================================
|
||||
// windows_options
|
||||
//============================================================
|
||||
|
||||
windows_options::windows_options()
|
||||
: osd_options()
|
||||
{
|
||||
add_entries(s_option_entries);
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// output_oslog
|
||||
@ -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
|
Loading…
Reference in New Issue
Block a user