summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/osd/uwp.lua4
-rw-r--r--src/osd/modules/input/input_windows.cpp3
-rw-r--r--src/osd/modules/osdwindow.h10
-rw-r--r--src/osd/modules/render/drawbgfx.cpp6
-rw-r--r--src/osd/modules/render/drawnone.cpp2
-rw-r--r--src/osd/uwp/uwpmain.cpp186
-rw-r--r--src/osd/uwp/uwpmain.h52
-rw-r--r--src/osd/uwp/video.cpp7
-rw-r--r--src/osd/uwp/window.cpp92
-rw-r--r--src/osd/uwp/window.h37
-rw-r--r--src/osd/windows/winmain.cpp18
-rw-r--r--src/osd/windows/winmain.h2
-rw-r--r--src/osd/windows/winutf8.cpp6
13 files changed, 99 insertions, 326 deletions
diff --git a/scripts/src/osd/uwp.lua b/scripts/src/osd/uwp.lua
index 2cf4eb8c573..540116fe018 100644
--- a/scripts/src/osd/uwp.lua
+++ b/scripts/src/osd/uwp.lua
@@ -68,6 +68,8 @@ project ("osd_" .. _OPTIONS["osd"])
MAME_DIR .. "src/osd/uwp/video.h",
MAME_DIR .. "src/osd/uwp/window.cpp",
MAME_DIR .. "src/osd/uwp/window.h",
+ MAME_DIR .. "src/osd/windows/winutf8.cpp",
+ MAME_DIR .. "src/osd/windows/winutf8.h",
MAME_DIR .. "src/osd/modules/osdwindow.cpp",
MAME_DIR .. "src/osd/modules/osdwindow.h",
MAME_DIR .. "src/osd/windows/winmain.cpp",
@@ -76,8 +78,6 @@ project ("osd_" .. _OPTIONS["osd"])
MAME_DIR .. "src/osd/modules/render/drawnone.h",
MAME_DIR .. "src/osd/uwp/uwpcompat.cpp",
MAME_DIR .. "src/osd/uwp/uwpcompat.h",
- MAME_DIR .. "src/osd/uwp/uwpmain.cpp",
- MAME_DIR .. "src/osd/uwp/uwpmain.h",
MAME_DIR .. "src/osd/osdepend.h",
}
diff --git a/src/osd/modules/input/input_windows.cpp b/src/osd/modules/input/input_windows.cpp
index 88a82b8b877..45450343500 100644
--- a/src/osd/modules/input/input_windows.cpp
+++ b/src/osd/modules/input/input_windows.cpp
@@ -8,8 +8,6 @@
#include "input_module.h"
-#if defined(OSD_WINDOWS)
-
// MAME headers
#include "emu.h"
#include "osdepend.h"
@@ -151,4 +149,3 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
}
}
-#endif
diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h
index 93b77e0f6a9..da4385cc084 100644
--- a/src/osd/modules/osdwindow.h
+++ b/src/osd/modules/osdwindow.h
@@ -25,8 +25,6 @@
#ifdef OSD_SDL
// forward declaration
struct SDL_Window;
-#elif defined(OSD_UWP)
-#include <Agile.h>
#endif
#undef min
#undef max
@@ -138,15 +136,13 @@ public:
virtual void update() = 0;
virtual void destroy() = 0;
-#ifdef OSD_WINDOWS
+#if defined(OSD_WINDOWS) || defined(OSD_UWP)
virtual bool win_has_menu() = 0;
+#endif
+#ifdef OSD_WINDOWS
HDC m_dc; // only used by GDI renderer!
-
int m_resize_state;
-#elif defined(OSD_UWP)
- virtual bool win_has_menu() = 0;
- Platform::Agile<Windows::UI::Core::CoreWindow^> m_window;
#endif
render_primitive_list *m_primlist;
osd_window_config m_win_config;
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 97d4202d41f..4a170434742 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -228,7 +228,7 @@ int renderer_bgfx::create()
#ifdef OSD_WINDOWS
winSetHwnd(win->platform_window<HWND>());
#elif defined(OSD_UWP)
- winrtSetWindow(AsInspectable(win->m_window.Get()));
+ winrtSetWindow(win->platform_window<IInspectable*>());
#else
sdlSetWindow(win->platform_window<SDL_Window*>());
#endif
@@ -279,7 +279,7 @@ int renderer_bgfx::create()
#ifdef OSD_WINDOWS
m_framebuffer = m_targets->create_backbuffer(win->platform_window<HWND>(), m_width[win->m_index], m_height[win->m_index]);
#elif defined(OSD_UWP)
- m_framebuffer = m_targets->create_backbuffer(&win->m_window, m_width[win->m_index], m_height[win->m_index]);
+ m_framebuffer = m_targets->create_backbuffer(win->platform_window<IInspectable*>(), m_width[win->m_index], m_height[win->m_index]);
#else
m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window<SDL_Window*>()), m_width[win->m_index], m_height[win->m_index]);
#endif
@@ -920,7 +920,7 @@ bool renderer_bgfx::update_dimensions()
#ifdef OSD_WINDOWS
m_framebuffer = m_targets->create_backbuffer(win->platform_window<HWND>(), width, height);
#elif defined(OSD_UWP)
- m_framebuffer = m_targets->create_backbuffer(&win->m_window, width, height);
+ m_framebuffer = m_targets->create_backbuffer(win->platform_window<IInspectable*>(), width, height);
#else
m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window<SDL_Window*>()), width, height);
#endif
diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp
index 7303dcfd8d3..e8f7e8c1948 100644
--- a/src/osd/modules/render/drawnone.cpp
+++ b/src/osd/modules/render/drawnone.cpp
@@ -29,7 +29,7 @@ render_primitive_list *renderer_none::get_primitives()
#if defined(OSD_WINDOWS)
GetClientRect(win->platform_window<HWND>(), &client);
#elif defined(OSD_UWP)
- auto bounds = win->m_window->Bounds;
+ auto bounds = std::static_pointer_cast<uwp_window_info>(win)->uwp_window()->Bounds;
client.left = bounds.Left;
client.right = bounds.Right;
client.top = bounds.Top;
diff --git a/src/osd/uwp/uwpmain.cpp b/src/osd/uwp/uwpmain.cpp
deleted file mode 100644
index 173cf7ab536..00000000000
--- a/src/osd/uwp/uwpmain.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// main.c - Win32 main program
-//
-//============================================================
-
-// standard windows headers
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <tchar.h>
-#include <stdlib.h>
-#include <vector>
-#include <string>
-
-#include "uwpmain.h"
-#include <wrl\client.h>
-#undef interface
-
-using namespace Windows::ApplicationModel;
-using namespace Windows::ApplicationModel::Core;
-using namespace Windows::ApplicationModel::Activation;
-using namespace Windows::UI::Core;
-using namespace Windows::UI::Input;
-using namespace Windows::System;
-using namespace Windows::Foundation;
-using namespace Windows::Graphics::Display;
-
-using namespace MameUWP;
-
-Platform::Array<Platform::String^>^ g_command_args;
-
-// The main function is only used to initialize our IFrameworkView class.
-[Platform::MTAThread]
-int main(Platform::Array<Platform::String^>^ args)
-{
- g_command_args = args;
- auto direct3DApplicationSource = ref new Direct3DApplicationSource();
- CoreApplication::Run(direct3DApplicationSource);
- return 0;
-}
-
-IFrameworkView^ Direct3DApplicationSource::CreateView()
-{
- return ref new App();
-}
-
-App::App() :
- m_windowClosed(false),
- m_windowVisible(true)
-{
-}
-
-// The first method called when the IFrameworkView is being created.
-void App::Initialize(CoreApplicationView^ applicationView)
-{
- // Register event handlers for app lifecycle. This example includes Activated, so that we
- // can make the CoreWindow active and start rendering on the window.
- applicationView->Activated +=
- ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
-
- CoreApplication::Suspending +=
- ref new EventHandler<SuspendingEventArgs^>(this, &App::OnSuspending);
-
- CoreApplication::Resuming +=
- ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
-}
-
-// Called when the CoreWindow object is created (or re-created).
-void App::SetWindow(CoreWindow^ window)
-{
- window->SizeChanged +=
- ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);
-
- window->VisibilityChanged +=
- ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
-
- window->Closed +=
- ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
-
- DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
-
- currentDisplayInformation->DpiChanged +=
- ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDpiChanged);
-
- currentDisplayInformation->OrientationChanged +=
- ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnOrientationChanged);
-
- DisplayInformation::DisplayContentsInvalidated +=
- ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDisplayContentsInvalidated);
-}
-
-// Initializes scene resources, or loads a previously saved app state.
-void App::Load(Platform::String^ entryPoint)
-{
-}
-
-// This method is called after the window becomes active.
-void App::Run()
-{
- // parse config and cmdline options
-// DWORD result;
- {
-/* winrt_options options;
- winrt_osd_interface osd(options);
-
- char exe_path[MAX_PATH];
- GetModuleFileNameA(NULL, exe_path, MAX_PATH);
- char* args[2] = { exe_path, (char*)"-verbose" };
-
- osd.register_options();
- cli_frontend frontend(options, osd);
- result = frontend.execute(ARRAY_LENGTH(args), args);*/
- }
-}
-
-// Required for IFrameworkView.
-// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
-// class is torn down while the app is in the foreground.
-void App::Uninitialize()
-{
-}
-
-// Application lifecycle event handlers.
-
-void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
-{
- // Run() won't start until the CoreWindow is activated.
-}
-
-void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
-{
- // Save app state asynchronously after requesting a deferral. Holding a deferral
- // indicates that the application is busy performing suspending operations. Be
- // aware that a deferral may not be held indefinitely. After about five seconds,
- // the app will be forced to exit.
- SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
-
- //create_task([this, deferral]()
- //{
- // //m_deviceResources->Trim();
-
- // // Insert your code here.
-
- // deferral->Complete();
- //});
-}
-
-void App::OnResuming(Platform::Object^ sender, Platform::Object^ args)
-{
- // Restore any data or state that was unloaded on suspend. By default, data
- // and state are persisted when resuming from suspend. Note that this event
- // does not occur if the app was previously terminated.
-
- // Insert your code here.
-}
-
-// Window event handlers.
-
-void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
-{
-}
-
-void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
-{
- m_windowVisible = args->Visible;
-}
-
-void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
-{
- m_windowClosed = true;
-}
-
-// DisplayInformation event handlers.
-void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
-{
-}
-
-void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
-{
-}
-
-void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
-{
-}
diff --git a/src/osd/uwp/uwpmain.h b/src/osd/uwp/uwpmain.h
deleted file mode 100644
index 20f82e2430e..00000000000
--- a/src/osd/uwp/uwpmain.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Brad Hughes
-//============================================================
-//
-// uwpmain.h - Universal Windows Paltform
-//
-//============================================================
-
-#pragma once
-
-namespace MameUWP
-{
- // Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
- ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
- {
- public:
- App();
-
- // IFrameworkView Methods.
- virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
- virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
- virtual void Load(Platform::String^ entryPoint);
- virtual void Run();
- virtual void Uninitialize();
-
- protected:
- // Application lifecycle event handlers.
- void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
- void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
- void OnResuming(Platform::Object^ sender, Platform::Object^ args);
-
- // Window event handlers.
- void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
- void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
- void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
-
- // DisplayInformation event handlers.
- void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
- void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
- void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
-
- private:
- bool m_windowClosed;
- bool m_windowVisible;
- };
-}
-
-ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
-{
-public:
- virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
-};
diff --git a/src/osd/uwp/video.cpp b/src/osd/uwp/video.cpp
index 989d074f3a5..1462ff5b81b 100644
--- a/src/osd/uwp/video.cpp
+++ b/src/osd/uwp/video.cpp
@@ -65,11 +65,14 @@ bool windows_osd_interface::video_init()
windows_options &options = downcast<windows_options &>(machine().options());
for (int index = 0; index < video_config.numscreens; index++)
{
- win_window_info::create(machine(), index, m_monitor_module->pick_monitor(options, index), &windows[index]);
+ uwp_window_info::create(machine(), index, m_monitor_module->pick_monitor(options, index), &windows[index]);
}
if (video_config.mode != VIDEO_MODE_NONE)
- osd_common_t::s_window_list.front()->platform_window<Platform::Agile<CoreWindow^>>()->Activate();
+ {
+ auto win = std::static_pointer_cast<uwp_window_info>(osd_common_t::s_window_list.front());
+ win->uwp_window()->Activate();
+ }
return true;
}
diff --git a/src/osd/uwp/window.cpp b/src/osd/uwp/window.cpp
index 282d29972f8..d6bc8294c05 100644
--- a/src/osd/uwp/window.cpp
+++ b/src/osd/uwp/window.cpp
@@ -243,7 +243,7 @@ void windows_osd_interface::window_exit()
CloseHandle(ui_pause_event);
}
-win_window_info::win_window_info(
+uwp_window_info::uwp_window_info(
running_machine &machine,
int index,
std::shared_ptr<osd_monitor_info> monitor,
@@ -273,11 +273,11 @@ win_window_info::win_window_info(
m_prescale = video_config.prescale;
}
-POINT win_window_info::s_saved_cursor_pos = { -1, -1 };
+POINT uwp_window_info::s_saved_cursor_pos = { -1, -1 };
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-void win_window_info::capture_pointer()
+void uwp_window_info::capture_pointer()
{
RECT bounds;
GetClientRect(platform_window<HWND>(), &bounds);
@@ -286,12 +286,12 @@ void win_window_info::capture_pointer()
ClipCursor(&bounds);
}
-void win_window_info::release_pointer()
+void uwp_window_info::release_pointer()
{
ClipCursor(nullptr);
}
-void win_window_info::hide_pointer()
+void uwp_window_info::hide_pointer()
{
GetCursorPos(&s_saved_cursor_pos);
@@ -299,7 +299,7 @@ void win_window_info::hide_pointer()
ShowCursor(TRUE);
}
-void win_window_info::show_pointer()
+void uwp_window_info::show_pointer()
{
if (s_saved_cursor_pos.x != -1 || s_saved_cursor_pos.y != -1)
{
@@ -313,29 +313,29 @@ void win_window_info::show_pointer()
#else
-CoreCursor^ win_window_info::s_cursor = nullptr;
+CoreCursor^ uwp_window_info::s_cursor = nullptr;
-void win_window_info::capture_pointer()
+void uwp_window_info::capture_pointer()
{
- platform_window<Platform::Agile<CoreWindow^>>()->SetPointerCapture();
+ uwp_window()->SetPointerCapture();
}
-void win_window_info::release_pointer()
+void uwp_window_info::release_pointer()
{
- platform_window<Platform::Agile<CoreWindow^>>()->ReleasePointerCapture();
+ uwp_window()->ReleasePointerCapture();
}
-void win_window_info::hide_pointer()
+void uwp_window_info::hide_pointer()
{
- auto window = platform_window<Platform::Agile<CoreWindow^>>();
- win_window_info::s_cursor = window->PointerCursor;
+ auto window = uwp_window();
+ uwp_window_info::s_cursor = window->PointerCursor;
window->PointerCursor = nullptr;
}
-void win_window_info::show_pointer()
+void uwp_window_info::show_pointer()
{
- auto window = platform_window<Platform::Agile<CoreWindow^>>();
- window->PointerCursor = win_window_info::s_cursor;
+ auto window = uwp_window();
+ window->PointerCursor = uwp_window_info::s_cursor;
}
#endif
@@ -357,19 +357,15 @@ void winwindow_process_events_periodic(running_machine &machine)
winwindow_process_events(machine, TRUE, false);
}
-
-
//============================================================
-// is_mame_window
+// winwindow_has_focus
+// (main or window thread)
//============================================================
-static bool is_mame_window(HWND hwnd)
+BOOL winwindow_has_focus(void)
{
- //for (auto window : osd_common_t::s_window_list)
- //if (window->platform_window<HWND>() == hwnd)
- //return true;
-
- return false;
+ // For now always act like we have focus
+ return TRUE;
}
inline static BOOL handle_mouse_button(windows_osd_interface *osd, int button, int down, int x, int y)
@@ -421,12 +417,12 @@ void winwindow_process_events(running_machine &machine, int ingame, bool nodispa
// (main thread)
//============================================================
-void win_window_info::create(running_machine &machine, int index, std::shared_ptr<osd_monitor_info> monitor, const osd_window_config *config)
+void uwp_window_info::create(running_machine &machine, int index, std::shared_ptr<osd_monitor_info> monitor, const osd_window_config *config)
{
assert(GetCurrentThreadId() == main_threadid);
// allocate a new window object
- auto window = std::make_shared<win_window_info>(machine, index, monitor, config);
+ auto window = std::make_shared<uwp_window_info>(machine, index, monitor, config);
// set main window
if (window->m_index > 0)
@@ -485,7 +481,7 @@ void win_window_info::create(running_machine &machine, int index, std::shared_pt
fatalerror("Unable to complete window creation\n");
}
-std::shared_ptr<osd_monitor_info> win_window_info::monitor_from_rect(const osd_rect* proposed) const
+std::shared_ptr<osd_monitor_info> uwp_window_info::monitor_from_rect(const osd_rect* proposed) const
{
std::shared_ptr<osd_monitor_info> monitor;
@@ -513,7 +509,7 @@ std::shared_ptr<osd_monitor_info> win_window_info::monitor_from_rect(const osd_r
// (main thread)
//============================================================
-void win_window_info::destroy()
+void uwp_window_info::destroy()
{
assert(GetCurrentThreadId() == main_threadid);
@@ -535,7 +531,7 @@ void win_window_info::destroy()
// (main thread)
//============================================================
-void win_window_info::update()
+void uwp_window_info::update()
{
int targetview, targetorient;
render_layer_config targetlayerconfig;
@@ -598,7 +594,7 @@ void win_window_info::update()
// (main thread)
//============================================================
-void win_window_info::set_starting_view(int index, const char *defview, const char *view)
+void uwp_window_info::set_starting_view(int index, const char *defview, const char *view)
{
int viewindex;
@@ -678,7 +674,7 @@ int winwindow_ui_is_paused(running_machine &machine)
// (window thread)
//============================================================
-int win_window_info::wnd_extra_width()
+int uwp_window_info::wnd_extra_width()
{
RECT temprect = { 100, 100, 200, 200 };
if (fullscreen())
@@ -694,7 +690,7 @@ int win_window_info::wnd_extra_width()
// (window thread)
//============================================================
-int win_window_info::wnd_extra_height()
+int uwp_window_info::wnd_extra_height()
{
RECT temprect = { 100, 100, 200, 200 };
if (fullscreen())
@@ -709,7 +705,7 @@ int win_window_info::wnd_extra_height()
// (window thread)
//============================================================
-int win_window_info::complete_create()
+int uwp_window_info::complete_create()
{
int tempwidth, tempheight;
@@ -718,7 +714,9 @@ int win_window_info::complete_create()
// get the monitor bounds
osd_rect monitorbounds = m_monitor->position_size();
- m_window = Windows::UI::Core::CoreWindow::GetForCurrentThread();
+ IInspectable* raw_window = reinterpret_cast<IInspectable*>(Windows::UI::Core::CoreWindow::GetForCurrentThread());
+ raw_window->AddRef(); // TODO: Should probably figure out a way to auto-release
+ set_platform_window(raw_window);
// skip the positioning stuff for -video none */
if (video_config.mode == VIDEO_MODE_NONE)
@@ -757,7 +755,7 @@ int win_window_info::complete_create()
// (window thread)
//============================================================
-osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int adjustment)
+osd_rect uwp_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int adjustment)
{
assert(GetCurrentThreadId() == window_threadid);
@@ -882,7 +880,7 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
// (window thread)
//============================================================
-osd_dim win_window_info::get_min_bounds(int constrain)
+osd_dim uwp_window_info::get_min_bounds(int constrain)
{
int32_t minwidth, minheight;
@@ -935,7 +933,7 @@ osd_dim win_window_info::get_min_bounds(int constrain)
// (window thread)
//============================================================
-osd_dim win_window_info::get_max_bounds(int constrain)
+osd_dim uwp_window_info::get_max_bounds(int constrain)
{
//assert(GetCurrentThreadId() == window_threadid);
@@ -975,7 +973,7 @@ osd_dim win_window_info::get_max_bounds(int constrain)
// (window thread)
//============================================================
-void win_window_info::update_minmax_state()
+void uwp_window_info::update_minmax_state()
{
assert(GetCurrentThreadId() == window_threadid);
@@ -1008,30 +1006,28 @@ void win_window_info::update_minmax_state()
// (window thread)
//============================================================
-void win_window_info::minimize_window()
+void uwp_window_info::minimize_window()
{
assert(GetCurrentThreadId() == window_threadid);
osd_dim newsize = get_min_bounds(video_config.keepaspect);
// get the window rect
- RECT bounds;
+ //RECT bounds;
//GetWindowRect(platform_window<HWND>(), &bounds);
- osd_rect newrect(bounds.left, bounds.top, newsize );
+ //osd_rect newrect(bounds.left, bounds.top, newsize );
//SetWindowPos(platform_window<HWND>(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER);
}
-
-
//============================================================
// maximize_window
// (window thread)
//============================================================
-void win_window_info::maximize_window()
+void uwp_window_info::maximize_window()
{
assert(GetCurrentThreadId() == window_threadid);
@@ -1053,7 +1049,7 @@ void win_window_info::maximize_window()
// (window thread)
//============================================================
-void win_window_info::adjust_window_position_after_major_change()
+void uwp_window_info::adjust_window_position_after_major_change()
{
RECT oldrect;
@@ -1100,7 +1096,7 @@ void win_window_info::adjust_window_position_after_major_change()
// (window thread)
//============================================================
-void win_window_info::set_fullscreen(int fullscreen)
+void uwp_window_info::set_fullscreen(int fullscreen)
{
assert(GetCurrentThreadId() == window_threadid);
diff --git a/src/osd/uwp/window.h b/src/osd/uwp/window.h
index a6c6960b226..fe8d2a47379 100644
--- a/src/osd/uwp/window.h
+++ b/src/osd/uwp/window.h
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:Aaron Giles, Brad Hughes
//============================================================
//
// window.h - Win32 window handling
@@ -14,6 +14,9 @@
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
+#include <inspectable.h>
+#undef min
+#undef max
#include <chrono>
#include <mutex>
@@ -43,10 +46,10 @@
// TYPE DEFINITIONS
//============================================================
-class win_window_info : public osd_window
+class uwp_window_info : public osd_window
{
public:
- win_window_info(running_machine &machine, int index, std::shared_ptr<osd_monitor_info> monitor, const osd_window_config *config);
+ uwp_window_info(running_machine &machine, int index, std::shared_ptr<osd_monitor_info> monitor, const osd_window_config *config);
running_machine &machine() const override { return m_machine; }
@@ -55,24 +58,14 @@ public:
void update() override;
- virtual bool win_has_menu() override
+ virtual osd_dim get_size() override
{
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- return GetMenu(platform_window<HWND>()) ? true : false;
-#else
- return false;
-#endif
+ throw ref new Platform::NotImplementedException();
}
- virtual osd_dim get_size() override
+ bool win_has_menu() override
{
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- RECT client;
- GetClientRect(platform_window<HWND>(), &client);
- return osd_dim(client.right - client.left, client.bottom - client.top);
-#else
- throw ref new Platform::NotImplementedException();
-#endif
+ return false;
}
void capture_pointer() override;
@@ -80,6 +73,12 @@ public:
void show_pointer() override;
void hide_pointer() override;
+ Windows::UI::Core::CoreWindow^ uwp_window()
+ {
+ auto inspectable = platform_window<IInspectable*>();
+ return reinterpret_cast<Windows::UI::Core::CoreWindow^>(inspectable);
+ }
+
virtual osd_monitor_info *monitor() const override { return m_monitor.get(); }
void destroy() override;
@@ -94,7 +93,7 @@ public:
// member variables
- win_window_info * m_next;
+ uwp_window_info * m_next;
volatile int m_init_state;
// window handle and info
@@ -157,7 +156,9 @@ struct osd_draw_callbacks
// PROTOTYPES
//============================================================
+BOOL winwindow_has_focus(void);
void winwindow_process_events(running_machine &machine, int ingame, bool nodispatch);
+void winwindow_process_events_periodic(running_machine &machine);
//============================================================
// rect_width / rect_height
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 628eadff8c0..3116aa16730 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -24,6 +24,7 @@
// MAME headers
#include "emu.h"
#include "emuopts.h"
+#include "strconv.h"
// MAMEOS headers
#include "winmain.h"
@@ -99,10 +100,10 @@ public:
char buffer[1024];
vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args);
- osd_unique_wstr wcbuffer(osd::text::to_wstring(buffer));
- osd_unique_wstr wcappname(osd::text::to_wstring(emulator_info::get_appname()));
+ std::wstring wcbuffer(osd::text::to_wstring(buffer));
+ std::wstring wcappname(osd::text::to_wstring(emulator_info::get_appname()));
- auto dlg = ref new MessageDialog(ref new Platform::String(wcbuffer.get()), ref new Platform::String(wcappname.get()));
+ auto dlg = ref new MessageDialog(ref new Platform::String(wcbuffer.data()), ref new Platform::String(wcbuffer.data()));
dlg->ShowAsync();
}
else
@@ -343,6 +344,15 @@ static BOOL WINAPI control_handler(DWORD type)
#else
+// The main function is only used to initialize our IFrameworkView class.
+[Platform::MTAThread]
+int main(Platform::Array<Platform::String^>^ args)
+{
+ auto direct3DApplicationSource = ref new MameViewSource();
+ CoreApplication::Run(direct3DApplicationSource);
+ return 0;
+}
+
MameMainApp::MameMainApp()
{
}
@@ -373,7 +383,7 @@ void MameMainApp::Run()
// parse config and cmdline options
m_options = std::make_unique<windows_options>();
- m_osd = std::make_unique<windows_osd_interface>(m_options);
+ m_osd = std::make_unique<windows_osd_interface>(*m_options.get());
// Since we're a GUI app, out errors to message boxes
// Initialize this after the osd interface so that we are first in the
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index 7c5764dcc03..1c40a346d34 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -258,8 +258,10 @@ struct _EXCEPTION_POINTERS;
class windows_osd_interface : public osd_common_t
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Access to exception filter static method
friend int main(int argc, char *argv[]);
+#endif
public:
// construction/destruction
diff --git a/src/osd/windows/winutf8.cpp b/src/osd/windows/winutf8.cpp
index 371f6cc865c..be23d963f5b 100644
--- a/src/osd/windows/winutf8.cpp
+++ b/src/osd/windows/winutf8.cpp
@@ -28,6 +28,7 @@ void win_output_debug_string_utf8(const char *string)
}
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//============================================================
// win_message_box_utf8
@@ -55,6 +56,8 @@ int win_message_box_utf8(HWND window, const char *text, const char *caption, UIN
return MessageBox(window, t_text, t_caption, type);
}
+#endif
+
//============================================================
@@ -113,6 +116,7 @@ std::string win_get_window_text_utf8(HWND window)
}
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//============================================================
// win_create_window_ex_utf8
@@ -135,3 +139,5 @@ HWND win_create_window_ex_utf8(DWORD exstyle, const char* classname, const char*
return CreateWindowEx(exstyle, ts_classname.c_str(), t_windowname, style, x, y, width, height, parent,
menu, instance, param);
}
+
+#endif