Remove OSD_UWP from rest of code

This commit is contained in:
Miodrag Milanovic 2021-10-26 11:45:04 +02:00
parent 67389f4cbd
commit 8aa5c5a29c
24 changed files with 19 additions and 438 deletions

View File

@ -381,12 +381,6 @@ project ("osd_" .. _OPTIONS["osd"])
MAME_DIR .. "src/osd/sdl",
}
if _OPTIONS["targetos"]=="windows" then
files {
MAME_DIR .. "src/osd/windows/main.cpp",
}
end
if _OPTIONS["targetos"]=="macosx" then
files {
MAME_DIR .. "src/osd/modules/debugger/debugosx.mm",

View File

@ -217,7 +217,6 @@ project ("ocore_" .. _OPTIONS["osd"])
MAME_DIR .. "src/osd/strconv.h",
MAME_DIR .. "src/osd/osdsync.cpp",
MAME_DIR .. "src/osd/osdsync.h",
MAME_DIR .. "src/osd/windows/main.cpp",
MAME_DIR .. "src/osd/windows/winutf8.cpp",
MAME_DIR .. "src/osd/windows/winutf8.h",
MAME_DIR .. "src/osd/windows/winutil.cpp",

View File

@ -16,7 +16,6 @@
// standard windows headers
#include <windows.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#include <debugger.h>
#include <psapi.h>
@ -1098,6 +1097,4 @@ diagnostics_module * diagnostics_module::get_instance()
return &s_instance;
}
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#endif

View File

@ -35,13 +35,8 @@ public:
// Determine if diagnostics_none should be used based on OSD
#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define USE_DIAG_NONE 0 // Desktop Windows
#else
#define USE_DIAG_NONE 1 // Universal Windows
#endif
#else
#define USE_DIAG_NONE 1 // SDL and others
#endif

View File

@ -9,7 +9,7 @@
#include "modules/osdmodule.h"
#include "modules/lib/osdlib.h"
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
#include <windows.h>
@ -353,11 +353,7 @@ public:
// accept qualifiers from the name
std::string name(_name);
if (name.compare("default") == 0)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
name = "Tahoma";
#else
name = "Segoe UI";
#endif
bool bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0);
bool italic = (strreplace(name, "[I]", "") + strreplace(name, "[i]", "") > 0);

View File

@ -32,16 +32,13 @@
#include <SDL2/SDL.h>
#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii, UI) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, ascii, "ITEM_ID_"#mame, (char *) UI }
#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, ascii, "ITEM_ID_"#mame, (char*) #mame }
#elif defined(OSD_UWP)
#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii, UI) { ITEM_ID_##mame, KEY_ ## disc, Windows::System::VirtualKey:: ## uwp, ascii, "ITEM_ID_"#mame, (char *) UI }
#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii) { ITEM_ID_##mame, KEY_ ## disc, Windows::System::VirtualKey:: ## uwp, ascii, "ITEM_ID_"#mame, (char*) #mame }
#else
// osd mini
#endif
// FIXME: sdl_key can be removed from the table below. It is no longer used.
#if defined(OSD_WINDOWS) || defined(OSD_SDL) || defined(OSD_UWP)
#if defined(OSD_WINDOWS) || defined(OSD_SDL)
key_trans_entry keyboard_trans_table::s_default_table[] =
{
// MAME key sdl scancode sdl key di scancode virtual key uwp vkey ascii ui
@ -227,7 +224,7 @@ input_item_id keyboard_trans_table::lookup_mame_code(const char *scode) const
}
// Windows specific lookup methods
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
input_item_id keyboard_trans_table::map_di_scancode_to_itemid(int scancode) const
{
@ -242,10 +239,6 @@ input_item_id keyboard_trans_table::map_di_scancode_to_itemid(int scancode) cons
return ITEM_ID_OTHER_SWITCH;
}
#endif
#if defined(OSD_WINDOWS)
//============================================================
// wininput_vkey_for_mame_code
//============================================================
@ -268,22 +261,6 @@ int keyboard_trans_table::vkey_for_mame_code(input_code code) const
#endif
#if defined(OSD_UWP)
const char* keyboard_trans_table::ui_label_for_mame_key(input_item_id itemid) const
{
// scan the table for a match
for (int tablenum = 0; tablenum < m_table_size; tablenum++)
if (m_table[tablenum].mame_key == itemid)
return m_table[tablenum].ui_name;
// We didn't find one
return nullptr;
}
#endif
int input_module_base::init(const osd_options &options)
{
m_options = &options;

View File

@ -360,9 +360,6 @@ struct key_trans_entry {
#elif defined(OSD_WINDOWS)
int scan_code;
unsigned char virtual_key;
#elif defined(OSD_UWP)
int scan_code;
Windows::System::VirtualKey virtual_key;
#endif
char ascii_key;
@ -396,9 +393,6 @@ public:
#if defined(OSD_WINDOWS)
input_item_id map_di_scancode_to_itemid(int di_scancode) const;
int vkey_for_mame_code(input_code code) const;
#elif defined(OSD_UWP)
input_item_id map_di_scancode_to_itemid(int di_scancode) const;
const char* ui_label_for_mame_key(input_item_id code) const;
#endif
static keyboard_trans_table& instance()

View File

@ -8,7 +8,7 @@
#include "input_module.h"
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
// MAME headers
#include "emu.h"
@ -81,23 +81,11 @@ void windows_osd_interface::customize_input_type_list(std::vector<input_type_ent
for (input_type_entry &entry : typelist)
switch (entry.type())
{
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// disable the config menu if the ALT key is down
// (allows ALT-TAB to switch between windows apps)
case IPT_UI_CONFIGURE:
entry.defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
break;
#else
// UWP: Hotkey Select + X => UI_CONFIGURE (Menu)
case IPT_UI_CONFIGURE:
entry.defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::or_code, JOYCODE_SELECT, JOYCODE_BUTTON3);
break;
// UWP: Hotkey Select + Start => CANCEL
case IPT_UI_CANCEL:
entry.defseq(SEQ_TYPE_STANDARD).set(KEYCODE_ESC, input_seq::or_code, JOYCODE_SELECT, JOYCODE_START);
break;
#endif
// configurable UI mode switch
case IPT_UI_TOGGLE_UI:
uimode = options().ui_mode_key();
@ -163,4 +151,4 @@ void windows_osd_interface::customize_input_type_list(std::vector<input_type_ent
}
}
#endif // defined(OSD_WINDOWS) || defined(OSD_UWP)
#endif // defined(OSD_WINDOWS)

View File

@ -30,11 +30,7 @@
#include "input_windows.h"
#include "input_xinput.h"
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define XINPUT_LIBRARIES { "xinput1_4.dll", "xinput9_1_0.dll" }
#else
#define XINPUT_LIBRARIES { "xinput1_4.dll" }
#endif
#define XINPUT_AXIS_MINVALUE -32767
#define XINPUT_AXIS_MAXVALUE 32767

View File

@ -188,20 +188,9 @@ protected:
// Calling then looks like: DYNAMIC_CALL(CreateDXGIFactory1, p1, p2, etc)
//=========================================================================================================
#if !defined(OSD_UWP)
#define OSD_DYNAMIC_API(apiname, ...) osd::dynamic_module::ptr m_##apiname##module = osd::dynamic_module::open( { __VA_ARGS__ } )
#define OSD_DYNAMIC_API_FN(apiname, ret, conv, fname, ...) ret(conv *m_##fname##_pfn)( __VA_ARGS__ ) = m_##apiname##module->bind<ret(conv *)( __VA_ARGS__ )>(#fname)
#define OSD_DYNAMIC_CALL(fname, ...) (*m_##fname##_pfn) ( __VA_ARGS__ )
#define OSD_DYNAMIC_API_TEST(fname) (m_##fname##_pfn != nullptr)
#else
#define OSD_DYNAMIC_API(apiname, ...)
#define OSD_DYNAMIC_API_FN(apiname, ret, conv, fname, ...)
#define OSD_DYNAMIC_CALL(fname, ...) fname( __VA_ARGS__ )
#define OSD_DYNAMIC_API_TEST(fname) (true)
#endif
#endif /* __OSDLIB__ */

View File

@ -195,13 +195,8 @@ int osd_getpid()
// osd_dynamic_bind
//============================================================
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// for classic desktop applications
#define load_library(filename) LoadLibrary(filename)
#else
// for Windows Store universal applications
#define load_library(filename) LoadPackagedLibrary(filename, 0)
#endif
namespace osd {

View File

@ -9,7 +9,7 @@
#include "modules/osdmodule.h"
#include "monitor_module.h"
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
// standard windows headers
#include <windows.h>
@ -79,7 +79,6 @@ public:
if (!m_initialized)
return nullptr;
#if defined(OSD_WINDOWS)
RECT p;
p.top = rect.top();
p.left = rect.left();
@ -89,13 +88,6 @@ public:
auto nearest = monitor_from_handle(reinterpret_cast<std::uintptr_t>(MonitorFromRect(&p, MONITOR_DEFAULTTONEAREST)));
assert(nearest != nullptr);
return nearest;
#elif defined(OSD_UWP)
if (list().size() == 0)
return nullptr;
// For now just return first monitor
return list()[0];
#endif
}
// Currently this method implementation is duplicated from the win32 module
@ -105,17 +97,9 @@ public:
if (!m_initialized)
return nullptr;
#if defined(OSD_WINDOWS)
auto nearest = monitor_from_handle(reinterpret_cast<std::uintptr_t>(MonitorFromWindow(static_cast<const win_window_info &>(window).platform_window(), MONITOR_DEFAULTTONEAREST)));
assert(nearest != nullptr);
return nearest;
#elif defined(OSD_UWP)
if (list().size() == 0)
return nullptr;
// For now just return first monitor
return list()[0];
#endif
}
protected:

View File

@ -61,7 +61,7 @@ std::unique_ptr<osd_renderer> osd_renderer::make_for_type(int mode, std::shared_
{
switch(mode)
{
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
case VIDEO_MODE_NONE:
return std::make_unique<renderer_none>(window);
#endif

View File

@ -127,7 +127,7 @@ public:
virtual void update() = 0;
virtual void complete_destroy() = 0;
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
virtual bool win_has_menu() = 0;
#endif

View File

@ -8,7 +8,7 @@
#include <bx/math.h>
#include <bx/readerwriter.h>
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
// standard windows headers
#include <windows.h>
#if defined(SDLMAME_WIN32)
@ -208,22 +208,6 @@ inline bool sdlSetWindow(SDL_Window* _window)
return true;
}
#elif defined(OSD_UWP)
inline void winrtSetWindow(::IUnknown* _window)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
IInspectable* AsInspectable(Platform::Agile<Windows::UI::Core::CoreWindow> win)
{
return reinterpret_cast<IInspectable*>(win.Get());
}
#endif
int renderer_bgfx::create()
@ -249,9 +233,6 @@ int renderer_bgfx::create()
}
#ifdef OSD_WINDOWS
winSetHwnd(std::static_pointer_cast<win_window_info>(win)->platform_window());
#elif defined(OSD_UWP)
winrtSetWindow(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()));
#elif defined(OSD_MAC)
macSetWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window());
#else
@ -316,8 +297,6 @@ int renderer_bgfx::create()
{
#ifdef OSD_WINDOWS
m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast<win_window_info>(win)->platform_window(), m_width[win->index()], m_height[win->index()]);
#elif defined(OSD_UWP)
m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()), m_width[win->index()], m_height[win->index()]);
#elif defined(OSD_MAC)
m_framebuffer = m_targets->create_backbuffer(GetOSWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window()), m_width[win->index()], m_height[win->index()]);
#else
@ -1001,8 +980,6 @@ bool renderer_bgfx::update_dimensions()
delete m_framebuffer;
#ifdef OSD_WINDOWS
m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast<win_window_info>(win)->platform_window(), width, height);
#elif defined(OSD_UWP)
m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast<uwp_window_info>(win)->platform_window()), width, height);
#elif defined(OSD_MAC)
m_framebuffer = m_targets->create_backbuffer(GetOSWindow(std::static_pointer_cast<mac_window_info>(win)->platform_window()), width, height);
#else

View File

@ -25,15 +25,7 @@ render_primitive_list *renderer_none::get_primitives()
return nullptr;
RECT client;
#if defined(OSD_WINDOWS)
GetClientRect(std::static_pointer_cast<win_window_info>(win)->platform_window(), &client);
#elif defined(OSD_UWP)
auto bounds = std::static_pointer_cast<uwp_window_info>(win)->platform_window()->Bounds;
client.left = bounds.Left;
client.right = bounds.Right;
client.top = bounds.Top;
client.bottom = bounds.Bottom;
#endif
if ((rect_width(&client) == 0) || (rect_height(&client) == 0))
return nullptr;
win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect());

View File

@ -9,7 +9,7 @@
#include "sound_module.h"
#include "modules/osdmodule.h"
#if defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(OSD_WINDOWS)
// standard windows headers
#include <windows.h>

View File

@ -5,7 +5,7 @@
// strconv.cpp - Win32 string conversion
//
//============================================================
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
#include <windows.h>
#endif
#include <algorithm>
@ -13,7 +13,7 @@
// MAMEOS headers
#include "strconv.h"
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) || defined(OSD_UWP)
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
namespace osd::text {

View File

@ -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

View File

@ -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)

View File

@ -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;
};

View File

@ -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)

View File

@ -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
//============================================================

View File

@ -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();
// 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
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