summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2021-10-26 11:45:04 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2021-10-26 11:45:04 +0200
commit8aa5c5a29c5af282c8c89a489f91617f59a97706 (patch)
treeffc0989f406f5aa7083c74d3938c81a060ace12a /src/osd/windows
parent67389f4cbdd00e1b139590325d5fbae47d0e62d0 (diff)
Remove OSD_UWP from rest of code
Diffstat (limited to 'src/osd/windows')
-rw-r--r--src/osd/windows/main.cpp34
-rw-r--r--src/osd/windows/window.cpp36
-rw-r--r--src/osd/windows/window.h12
-rw-r--r--src/osd/windows/winmain.cpp154
-rw-r--r--src/osd/windows/winmain.h30
-rw-r--r--src/osd/windows/winutf8.cpp42
6 files changed, 8 insertions, 300 deletions
diff --git a/src/osd/windows/main.cpp b/src/osd/windows/main.cpp
deleted file mode 100644
index cfadf9ffe0b..00000000000
--- a/src/osd/windows/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-//============================================================
-//
-// main.cpp - Win32 main program
-//
-//============================================================
-
-// standard windows headers
-#ifdef OSD_SDL
-#define _WIN32_WINNT 0x0501
-#endif
-#include <windows.h>
-#include <tchar.h>
-#include <cstdlib>
-#include <vector>
-#include <string>
-
-#include "strconv.h"
-
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
-#include "winmain.h"
-
-// The main function is only used to initialize our IFrameworkView class.
-[Platform::MTAThread]
-int main(Platform::Array<Platform::String^>^)
-{
- auto app_source = ref new MameViewSource();
- Windows::ApplicationModel::Core::CoreApplication::Run(app_source);
- return 0;
-}
-
-#endif
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index 0f03f34ff90..e6a15729350 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -34,11 +34,6 @@
#include "modules/monitor/monitor_common.h"
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#include <agile.h>
-using namespace Windows::UI::Core;
-#endif
-
#include "modules/render/drawbgfx.h"
#include "modules/render/drawnone.h"
#include "modules/render/drawd3d.h"
@@ -325,8 +320,6 @@ win_window_info::win_window_info(
POINT win_window_info::s_saved_cursor_pos = { -1, -1 };
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
void win_window_info::capture_pointer()
{
RECT bounds;
@@ -361,35 +354,6 @@ void win_window_info::show_pointer()
ShowCursor(FALSE);
}
-#else
-
-CoreCursor^ win_window_info::s_cursor = nullptr;
-
-void win_window_info::capture_pointer()
-{
- platform_window<Platform::Agile<CoreWindow^>>()->SetPointerCapture();
-}
-
-void win_window_info::release_pointer()
-{
- platform_window<Platform::Agile<CoreWindow^>>()->ReleasePointerCapture();
-}
-
-void win_window_info::hide_pointer()
-{
- auto window = platform_window<Platform::Agile<CoreWindow^>>();
- win_window_info::s_cursor = window->PointerCursor;
- window->PointerCursor = nullptr;
-}
-
-void win_window_info::show_pointer()
-{
- auto window = platform_window<Platform::Agile<CoreWindow^>>();
- window->PointerCursor = win_window_info::s_cursor;
-}
-
-#endif
-
//============================================================
// winwindow_process_events_periodic
// (main thread)
diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h
index 71bd519ab3a..8db6fc394b2 100644
--- a/src/osd/windows/window.h
+++ b/src/osd/windows/window.h
@@ -62,22 +62,14 @@ public:
virtual bool win_has_menu() override
{
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
return GetMenu(platform_window()) ? true : false;
-#else
- return false;
-#endif
}
virtual osd_dim get_size() override
{
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
RECT client;
GetClientRect(platform_window(), &client);
return osd_dim(client.right - client.left, client.bottom - client.top);
-#else
- throw ref new Platform::NotImplementedException();
-#endif
}
void capture_pointer() override;
@@ -137,10 +129,6 @@ private:
static POINT s_saved_cursor_pos;
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- static Windows::UI::Core::CoreCursor^ s_cursor;
-#endif
-
bool m_attached_mode;
};
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index f9d5f4964c2..09315e5ca84 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -33,15 +33,6 @@
#include <tchar.h>
#include <io.h>
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-#include <wrl/client.h>
-using namespace Windows::Storage;
-using namespace Platform;
-using namespace Windows::ApplicationModel;
-using namespace Windows::ApplicationModel::Core;
-using namespace Windows::UI::Popups;
-#endif
-
#define DEBUG_SLOW_LOCKS 0
//**************************************************************************
@@ -58,8 +49,6 @@ using namespace Windows::UI::Popups;
// TYPE DEFINITIONS
//**************************************************************************
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
//============================================================
// winui_output_error
//============================================================
@@ -84,45 +73,6 @@ public:
}
};
-#else
-
-//============================================================
-// winuniversal_output_error
-//============================================================
-
-class winuniversal_output_error : public osd_output
-{
-public:
- virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override
- {
- char buffer[2048];
- if (channel == OSD_OUTPUT_CHANNEL_ERROR)
- {
- vsnprintf(buffer, std::size(buffer), msg, args);
-
- 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.data()), ref new Platform::String(wcbuffer.data()));
- dlg->ShowAsync();
- }
- else if (channel == OSD_OUTPUT_CHANNEL_VERBOSE)
- {
- vsnprintf(buffer, std::size(buffer), msg, args);
- std::wstring wcbuffer = osd::text::to_wstring(buffer);
- OutputDebugString(wcbuffer.c_str());
-
- // Chain to next anyway
- chain_output(channel, msg, args);
- }
- else
- chain_output(channel, msg, args);
- }
-};
-
-#endif
-
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -134,10 +84,8 @@ int _CRT_glob = 0;
// LOCAL VARIABLES
//**************************************************************************
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
static int timeresult = !TIMERR_NOERROR;
static TIMECAPS timecaps;
-#endif
static running_machine *g_current_machine;
@@ -279,8 +227,6 @@ const options_entry windows_options::s_option_entries[] =
// MAIN ENTRY POINT
//**************************************************************************
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
//============================================================
// main
//============================================================
@@ -365,83 +311,6 @@ static BOOL WINAPI control_handler(DWORD type)
return TRUE;
}
-#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()
-{
- // Turn off application view scaling so XBOX gets full screen
- Windows::UI::ViewManagement::ApplicationViewScaling::TrySetDisableLayoutScaling(true);
-}
-
-void MameMainApp::Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView)
-{
- // Register event handlers for app lifecycle.
-}
-
-// Called when the CoreWindow object is created (or re-created).
-void MameMainApp::SetWindow(Windows::UI::Core::CoreWindow^ window)
-{
- // Attach event handlers on the window for input, etc.
-}
-
-// Initializes scene resources, or loads a previously saved app state.
-void MameMainApp::Load(Platform::String^ entryPoint)
-{
-}
-
-void MameMainApp::Run()
-{
- // use small output buffers on non-TTYs (i.e. pipes)
- if (!isatty(fileno(stdout)))
- setvbuf(stdout, (char *) nullptr, _IOFBF, 64);
- if (!isatty(fileno(stderr)))
- setvbuf(stderr, (char *) nullptr, _IOFBF, 64);
-
- // parse config and cmdline options
- m_options = std::make_unique<windows_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
- // output order
- winuniversal_output_error winerror;
- osd_output::push(&winerror);
-
- m_osd->register_options();
-
- // To satisfy the latter things, pass in the module path name
- char exe_path[MAX_PATH];
- GetModuleFileNameA(nullptr, exe_path, MAX_PATH);
- char* args[3] = { exe_path, (char*)"-verbose", (char*)"-mouse" };
-
- DWORD result = emulator_info::start_frontend(*m_options.get(), *m_osd.get(), std::size(args), args);
- osd_output::pop(&winerror);
-}
-
-// Required for IFrameworkView.
-void MameMainApp::Uninitialize()
-{
- // 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.
-}
-
-IFrameworkView^ MameViewSource::CreateView()
-{
- return ref new MameMainApp();
-}
-
-#endif
-
-
//============================================================
// windows_options
//============================================================
@@ -450,21 +319,6 @@ windows_options::windows_options()
: osd_options()
{
add_entries(s_option_entries);
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- String^ path = ApplicationData::Current->LocalFolder->Path + L"\\";
- set_default_value(OPTION_INIPATH, osd::text::from_wstring((LPCWSTR)path->Data()) + ";" + ini_path());
- set_default_value(OPTION_CFG_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + cfg_directory());
- set_default_value(OPTION_NVRAM_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + nvram_directory());
- set_default_value(OPTION_INPUT_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + input_directory());
- set_default_value(OPTION_STATE_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + state_directory());
- set_default_value(OPTION_SNAPSHOT_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + snapshot_directory());
- set_default_value(OPTION_DIFF_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + diff_directory());
- set_default_value(OPTION_COMMENT_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + comment_directory());
- set_default_value(OPTION_SHARE_DIRECTORY, osd::text::from_wstring((LPCWSTR)path->Data()) + share_directory());
-
- set_default_value(OPTION_HOMEPATH, osd::text::from_wstring((LPCWSTR)path->Data()));
- set_default_value(OPTION_MEDIAPATH, osd::text::from_wstring((LPCWSTR)path->Data()) + media_path());
-#endif
}
@@ -579,13 +433,11 @@ void windows_osd_interface::init(running_machine &machine)
if (options.oslog())
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
// this gives the system much finer timeslices
timeresult = timeGetDevCaps(&timecaps, sizeof(timecaps));
if (timeresult == TIMERR_NOERROR)
timeBeginPeriod(timecaps.wPeriodMin);
-#endif
// create and start the profiler
if (profile > 0)
@@ -619,11 +471,9 @@ void windows_osd_interface::osd_exit()
diagnostics_module::get_instance()->stop_profiler();
diagnostics_module::get_instance()->print_profiler_results();
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// restore the timer resolution
if (timeresult == TIMERR_NOERROR)
timeEndPeriod(timecaps.wPeriodMin);
-#endif
// one last pass at events
winwindow_process_events(machine(), false, false);
@@ -641,8 +491,6 @@ void osd_setup_osd_specific_emu_options(emu_options &opts)
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
//============================================================
// check_for_double_click_start
//============================================================
@@ -657,5 +505,3 @@ static int is_double_click_start(int argc)
// try to determine if MAME was simply double-clicked
return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES));
}
-
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index faca28e5bca..ef1cd1aff4f 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -9,7 +9,6 @@
#ifndef __WINDOWS_WINMAIN_H__
#define __WINDOWS_WINMAIN_H__
-#include <winapifamily.h>
#include "osdepend.h"
#include "modules/lib/osdobj_common.h"
@@ -267,10 +266,8 @@ 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
@@ -322,33 +319,6 @@ private:
static const int DEFAULT_FONT_HEIGHT = 200;
};
-#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
-ref class MameMainApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
-{
-private:
- std::unique_ptr<windows_options> m_options;
- std::unique_ptr<windows_osd_interface> m_osd;
-
-public:
- MameMainApp();
-
- // 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();
-};
-
-ref class MameViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
-{
-public:
- virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
-};
-
-#endif
-
//============================================================
// GLOBAL VARIABLES
//============================================================
diff --git a/src/osd/windows/winutf8.cpp b/src/osd/windows/winutf8.cpp
index cb6ab1a3dbc..cdb0e87a86b 100644
--- a/src/osd/windows/winutf8.cpp
+++ b/src/osd/windows/winutf8.cpp
@@ -27,8 +27,6 @@ void win_output_debug_string_utf8(const char *string)
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
//============================================================
// win_message_box_utf8
//============================================================
@@ -55,9 +53,6 @@ int win_message_box_utf8(HWND window, const char *text, const char *caption, UIN
return MessageBox(window, t_text, t_caption, type);
}
-#endif
-
-
//============================================================
// win_set_window_text_utf8
@@ -75,13 +70,7 @@ BOOL win_set_window_text_utf8(HWND window, const char *text)
t_text = ts_text.c_str();
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
result = SetWindowText(window, t_text);
-#else
- Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->Title = ref new Platform::String(t_text);
- result = TRUE;
-#endif
-
return result;
}
@@ -93,30 +82,17 @@ BOOL win_set_window_text_utf8(HWND window, const char *text)
std::string win_get_window_text_utf8(HWND window)
{
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- {
- // invoke the core Win32 API
- int length = GetWindowTextLength(window);
- if (length <= 0)
- return std::string();
-
- auto *buffer = (TCHAR *) alloca((length + 1) * sizeof(TCHAR));
- GetWindowText(window, buffer, length + 1);
- return osd::text::from_tstring(buffer);
- }
-#else
- {
- TCHAR t_buffer[256];
- auto title = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->Title;
- wcsncpy(t_buffer, title->Data(), std::size(t_buffer));
- return osd::text::from_tstring(t_buffer);
- }
-#endif
+ // invoke the core Win32 API
+ int length = GetWindowTextLength(window);
+ if (length <= 0)
+ return std::string();
+
+ auto *buffer = (TCHAR *) alloca((length + 1) * sizeof(TCHAR));
+ GetWindowText(window, buffer, length + 1);
+ return osd::text::from_tstring(buffer);
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
//============================================================
// win_create_window_ex_utf8
//============================================================
@@ -138,5 +114,3 @@ 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