From a18497e7a24d931e7ab1dda9d79fee484e5aa170 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 10 Nov 2016 13:13:51 +0100 Subject: [PATCH] Some more work on UWP (nw) --- 3rdparty/lua-linenoise/linenoise_none.c | 6 + scripts/src/3rdparty.lua | 6 +- scripts/src/main.lua | 30 ++ scripts/src/osd/uwp.lua | 18 +- scripts/toolchain.lua | 3 + src/osd/modules/file/winrtdir.cpp | 142 ++++++ src/osd/modules/file/winrtfile.cpp | 465 ++++++++++++++++++ src/osd/modules/file/winrtfile.h | 34 ++ src/osd/modules/file/winrtptty.cpp | 87 ++++ src/osd/modules/file/winrtsocket.cpp | 274 +++++++++++ src/osd/modules/lib/osdlib_uwp.cpp | 383 +++++++++++++++ src/osd/strconv.cpp | 4 +- src/osd/uwp/Package.appxmanifest | 36 ++ .../uwp/assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes src/osd/uwp/assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../uwp/assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes src/osd/uwp/assets/StoreLogo.png | Bin 0 -> 1451 bytes .../uwp/assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes src/osd/uwp/uwpcompat.cpp | 14 +- src/osd/uwp/uwpmain.cpp | 186 +++++++ src/osd/uwp/uwpmain.h | 52 ++ 23 files changed, 1723 insertions(+), 17 deletions(-) create mode 100644 3rdparty/lua-linenoise/linenoise_none.c create mode 100644 src/osd/modules/file/winrtdir.cpp create mode 100644 src/osd/modules/file/winrtfile.cpp create mode 100644 src/osd/modules/file/winrtfile.h create mode 100644 src/osd/modules/file/winrtptty.cpp create mode 100644 src/osd/modules/file/winrtsocket.cpp create mode 100644 src/osd/modules/lib/osdlib_uwp.cpp create mode 100644 src/osd/uwp/Package.appxmanifest create mode 100644 src/osd/uwp/assets/LockScreenLogo.scale-200.png create mode 100644 src/osd/uwp/assets/SplashScreen.scale-200.png create mode 100644 src/osd/uwp/assets/Square150x150Logo.scale-200.png create mode 100644 src/osd/uwp/assets/Square44x44Logo.scale-200.png create mode 100644 src/osd/uwp/assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 src/osd/uwp/assets/StoreLogo.png create mode 100644 src/osd/uwp/assets/Wide310x150Logo.scale-200.png create mode 100644 src/osd/uwp/uwpmain.cpp create mode 100644 src/osd/uwp/uwpmain.h diff --git a/3rdparty/lua-linenoise/linenoise_none.c b/3rdparty/lua-linenoise/linenoise_none.c new file mode 100644 index 00000000000..1cb1564f595 --- /dev/null +++ b/3rdparty/lua-linenoise/linenoise_none.c @@ -0,0 +1,6 @@ +#include + +int luaopen_linenoise(lua_State *L) +{ + return 1; +} diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index c1bb26e8e6d..79d131a63dc 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -594,7 +594,11 @@ end MAME_DIR .. "3rdparty/lua-zlib/lua_zlib.c", MAME_DIR .. "3rdparty/luafilesystem/src/lfs.c", } -if (_OPTIONS["osd"] ~= "uwp") then +if (_OPTIONS["osd"] == "uwp") then + files { + MAME_DIR .. "3rdparty/lua-linenoise/linenoise_none.c", + } +else files { MAME_DIR .. "3rdparty/lua-linenoise/linenoise.c", } diff --git a/scripts/src/main.lua b/scripts/src/main.lua index f1c33edd84b..84458f9fe89 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -48,6 +48,10 @@ end "ppapi_gles2", "pthread", } + + configuration { "winstore*" } + kind "WindowedApp" + configuration { } addprojectflags() @@ -69,6 +73,32 @@ end "Unicode", } + configuration { "winstore*" } + -- Windows Required Files + files { + -- Manifest file + MAME_DIR .. "src/osd/uwp/Package.appxmanifest", + } + + configuration { "winstore*" } + files { + MAME_DIR .. "src/osd/uwp/assets/*.png" + } + configuration "**/src/osd/uwp/assets/*.png" + flags { "DeploymentContent" } + + -- Effects and Shaders + configuration { "winstore*" } + files { + MAME_DIR .. "artwork/**/*", + MAME_DIR .. "bgfx/**/*", + MAME_DIR .. "hash/*", + MAME_DIR .. "language/**/*", + MAME_DIR .. "plugins/**/*", + } + configuration "**/*" + flags { "DeploymentContent" } + configuration { "x64", "Release" } targetsuffix "64" if _OPTIONS["PROFILE"] then diff --git a/scripts/src/osd/uwp.lua b/scripts/src/osd/uwp.lua index 20540fbe477..fdaec08a3c7 100644 --- a/scripts/src/osd/uwp.lua +++ b/scripts/src/osd/uwp.lua @@ -70,6 +70,8 @@ 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", } @@ -93,17 +95,21 @@ project ("ocore_" .. _OPTIONS["osd"]) } files { - MAME_DIR .. "src/osd/osdnet.cpp", - MAME_DIR .. "src/osd/osdnet.h", + MAME_DIR .. "src/osd/osdcomm.h", MAME_DIR .. "src/osd/osdcore.cpp", MAME_DIR .. "src/osd/osdcore.h", - MAME_DIR .. "src/osd/modules/osdmodule.cpp", - MAME_DIR .. "src/osd/modules/osdmodule.h", MAME_DIR .. "src/osd/strconv.cpp", MAME_DIR .. "src/osd/strconv.h", MAME_DIR .. "src/osd/osdsync.cpp", - MAME_DIR .. "src/osd/osdsync.h", + MAME_DIR .. "src/osd/osdsync.h", MAME_DIR .. "src/osd/windows/winutil.cpp", MAME_DIR .. "src/osd/windows/winutil.h", - --MAME_DIR .. "src/osd/modules/lib/osdlib_uwp.cpp", + MAME_DIR .. "src/osd/modules/osdmodule.cpp", + MAME_DIR .. "src/osd/modules/osdmodule.h", + MAME_DIR .. "src/osd/modules/file/winrtdir.cpp", + MAME_DIR .. "src/osd/modules/file/winrtfile.cpp", + MAME_DIR .. "src/osd/modules/file/winrtfile.h", + MAME_DIR .. "src/osd/modules/file/winrtptty.cpp", + MAME_DIR .. "src/osd/modules/file/winrtsocket.cpp", + MAME_DIR .. "src/osd/modules/lib/osdlib_uwp.cpp", } diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 6f5476bdd0a..99a3647b6ec 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -468,6 +468,9 @@ function toolchain(_buildDir, _subDir) "StaticRuntime", "NoExceptions", } + flags { + "WinMain" + } configuration { "mingw*" } defines { "WIN32" } diff --git a/src/osd/modules/file/winrtdir.cpp b/src/osd/modules/file/winrtdir.cpp new file mode 100644 index 00000000000..ac5c9ecaabb --- /dev/null +++ b/src/osd/modules/file/winrtdir.cpp @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +//============================================================ +// +// windir.c - Win32 OSD core directory access functions +// +//============================================================ + +// standard windows headers +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +// MAME headers +#include "osdcore.h" +#include "strformat.h" + +// MAMEOS headers +#include "strconv.h" +#include "../../windows/winutil.h" + +// standard C headers +#include +#include +#include +#include + + +namespace osd { +namespace { +//============================================================ +// TYPE DEFINITIONS +//============================================================ + +class win_directory : public directory +{ +public: + win_directory(); + virtual ~win_directory() override; + + virtual const entry *read() override; + + bool open_impl(std::string const &dirname); + +private: + HANDLE m_find; // handle to the finder + bool m_is_first; // true if this is the first entry + entry m_entry; // current entry's data + WIN32_FIND_DATA m_data; // current raw data + std::string m_name; // converted name of directory +}; + +//============================================================ +// win_directory::win_directory +//============================================================ + +win_directory::win_directory() + : m_find(INVALID_HANDLE_VALUE) + , m_is_first(true) +{ + m_entry.name = nullptr; + std::memset(&m_data, 0, sizeof(m_data)); +} + + +//============================================================ +// win_directory::~win_directory +//============================================================ + +win_directory::~win_directory() +{ + // free any data associated + if (m_find != INVALID_HANDLE_VALUE) + FindClose(m_find); +} + + +//============================================================ +// win_directory::read +//============================================================ + +const directory::entry *win_directory::read() +{ + // if this isn't the first file, do a find next + if (!m_is_first) + { + if (!FindNextFile(m_find, &m_data)) + return nullptr; + } + m_is_first = false; + + // extract the data + osd::text::from_tstring(m_name, m_data.cFileName); + m_entry.name = m_name.c_str(); + m_entry.type = win_attributes_to_entry_type(m_data.dwFileAttributes); + m_entry.size = m_data.nFileSizeLow | (std::uint64_t(m_data.nFileSizeHigh) << 32); + m_entry.last_modified = win_time_point_from_filetime(&m_data.ftLastWriteTime); + return (m_entry.name != nullptr) ? &m_entry : nullptr; +} + + +//============================================================ +// win_directory::open_impl +//============================================================ + +bool win_directory::open_impl(std::string const &dirname) +{ + assert(m_find == INVALID_HANDLE_VALUE); + + // append \*.* to the directory name + std::string dirfilter = string_format("%s\\*.*", dirname); + + // convert the path to TCHARs + osd::text::tstring t_dirfilter = osd::text::to_tstring(dirfilter); + + // attempt to find the first file + m_find = FindFirstFileEx(t_dirfilter.c_str(), FindExInfoStandard, &m_data, FindExSearchNameMatch, nullptr, 0); + return m_find != INVALID_HANDLE_VALUE; +} + +} // anonymous namespace + + +//============================================================ +// osd::directory::open +//============================================================ + +directory::ptr directory::open(std::string const &dirname) +{ + // allocate memory to hold the osd_tool_directory structure + std::unique_ptr dir; + try { dir.reset(new win_directory()); } + catch (...) { return nullptr; } + + if (!dir->open_impl(dirname)) + return nullptr; + + return ptr(std::move(dir)); +} + +} // namesapce osd diff --git a/src/osd/modules/file/winrtfile.cpp b/src/osd/modules/file/winrtfile.cpp new file mode 100644 index 00000000000..14cb08aa7c4 --- /dev/null +++ b/src/osd/modules/file/winrtfile.cpp @@ -0,0 +1,465 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles, Vas Crabb +//============================================================ +// +// winfile.c - Win32 OSD core file access functions +// +//============================================================ + +#define WIN32_LEAN_AND_MEAN + +#include "winfile.h" + +#include "../../windows/winutil.h" + +// MAMEOS headers +#include "strconv.h" +#include "unicode.h" + +// MAME headers +#include "osdcore.h" + +#include +#include + +// standard windows headers +#include +#include +#include +#include +#include +#include + + +namespace { +//============================================================ +// TYPE DEFINITIONS +//============================================================ + +class win_osd_file : public osd_file +{ +public: + win_osd_file(win_osd_file const &) = delete; + win_osd_file(win_osd_file &&) = delete; + win_osd_file& operator=(win_osd_file const &) = delete; + win_osd_file& operator=(win_osd_file &&) = delete; + + win_osd_file(HANDLE handle) : m_handle(handle) + { + assert(m_handle); + assert(INVALID_HANDLE_VALUE != m_handle); + } + + virtual ~win_osd_file() override + { + FlushFileBuffers(m_handle); + CloseHandle(m_handle); + } + + virtual error read(void *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override + { + // attempt to set the file pointer + LARGE_INTEGER largeOffset; + largeOffset.QuadPart = offset; + if (!SetFilePointerEx(m_handle, largeOffset, nullptr, FILE_BEGIN)) + return win_error_to_file_error(GetLastError()); + + // then perform the read + DWORD result = 0; + if (!ReadFile(m_handle, buffer, length, &result, nullptr)) + return win_error_to_file_error(GetLastError()); + + actual = result; + return error::NONE; + } + + virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override + { + // attempt to set the file pointer + LARGE_INTEGER largeOffset; + largeOffset.QuadPart = offset; + if (!SetFilePointerEx(m_handle, largeOffset, nullptr, FILE_BEGIN)) + return win_error_to_file_error(GetLastError()); + + // then perform the write + DWORD result = 0; + if (!WriteFile(m_handle, buffer, length, &result, nullptr)) + return win_error_to_file_error(GetLastError()); + + actual = result; + return error::NONE; + } + + virtual error truncate(std::uint64_t offset) override + { + // attempt to set the file pointer + LARGE_INTEGER largeOffset; + largeOffset.QuadPart = offset; + if (!SetFilePointerEx(m_handle, largeOffset, nullptr, FILE_BEGIN)) + return win_error_to_file_error(GetLastError()); + + // then perform the truncation + if (!SetEndOfFile(m_handle)) + return win_error_to_file_error(GetLastError()); + else + return error::NONE; + } + + virtual error flush() override + { + // shouldn't be any userspace buffers on the file handle + return error::NONE; + } + +private: + HANDLE m_handle; +}; + + + +//============================================================ +// INLINE FUNCTIONS +//============================================================ + +inline bool is_path_to_physical_drive(char const *path) +{ + return (_strnicmp(path, "\\\\.\\physicaldrive", 17) == 0); +} + + + +//============================================================ +// create_path_recursive +//============================================================ + +DWORD create_path_recursive(TCHAR *path) +{ + // if there's still a separator, and it's not the root, nuke it and recurse + TCHAR *sep = _tcsrchr(path, '\\'); + if (sep && (sep > path) && (sep[0] != ':') && (sep[-1] != '\\')) + { + *sep = 0; + create_path_recursive(path); + *sep = '\\'; + } + + // if the path already exists, we're done + WIN32_FILE_ATTRIBUTE_DATA fileinfo; + if (GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo)) + return NO_ERROR; + else if (!CreateDirectory(path, nullptr)) + return GetLastError(); + else + return NO_ERROR; +} + +} // anonymous namespace + + + +//============================================================ +// osd_open +//============================================================ + +osd_file::error osd_file::open(std::string const &orig_path, uint32_t openflags, ptr &file, std::uint64_t &filesize) +{ + std::string path; + try { osd_subst_env(path, orig_path); } + catch (...) { return error::OUT_OF_MEMORY; } + + if (win_check_socket_path(path)) + return win_open_socket(path, openflags, file, filesize); + else if (win_check_ptty_path(path)) + return win_open_ptty(path, openflags, file, filesize); + + // convert path to TCHAR + osd::text::tstring t_path = osd::text::to_tstring(path); + + // convert the path into something Windows compatible (the actual interesting part appears + // to have been commented out???) + for (auto iter = t_path.begin(); iter != t_path.end(); iter++) + *iter = /* ('/' == *iter) ? '\\' : */ *iter; + + // select the file open modes + DWORD disposition, access, sharemode; + if (openflags & OPEN_FLAG_WRITE) + { + disposition = (!is_path_to_physical_drive(path.c_str()) && (openflags & OPEN_FLAG_CREATE)) ? CREATE_ALWAYS : OPEN_EXISTING; + access = (openflags & OPEN_FLAG_READ) ? (GENERIC_READ | GENERIC_WRITE) : GENERIC_WRITE; + sharemode = FILE_SHARE_READ; + } + else if (openflags & OPEN_FLAG_READ) + { + disposition = OPEN_EXISTING; + access = GENERIC_READ; + sharemode = FILE_SHARE_READ; + } + else + { + return error::INVALID_ACCESS; + } + + // attempt to open the file + HANDLE h = CreateFile2(t_path.c_str(), access, sharemode, disposition, nullptr); + if (INVALID_HANDLE_VALUE == h) + { + DWORD err = GetLastError(); + // create the path if necessary + if ((ERROR_PATH_NOT_FOUND == err) && (openflags & OPEN_FLAG_CREATE) && (openflags & OPEN_FLAG_CREATE_PATHS)) + { + auto pathsep = t_path.rfind('\\'); + if (pathsep != decltype(t_path)::npos) + { + // create the path up to the file + t_path[pathsep] = 0; + err = create_path_recursive(&t_path[0]); + t_path[pathsep] = '\\'; + + // attempt to reopen the file + if (err == NO_ERROR) + { + h = CreateFile2(t_path.c_str(), access, sharemode, disposition, nullptr); + err = GetLastError(); + } + } + } + + // if we still failed, clean up and free + if (INVALID_HANDLE_VALUE == h) + return win_error_to_file_error(err); + } + + // get the file size + FILE_STANDARD_INFO file_info; + GetFileInformationByHandleEx(h, FileStandardInfo, &file_info, sizeof(file_info)); + auto lower = file_info.EndOfFile.QuadPart; + + if (INVALID_FILE_SIZE == lower) + { + DWORD const err = GetLastError(); + if (NO_ERROR != err) + { + CloseHandle(h); + return win_error_to_file_error(err); + } + } + + try + { + file = std::make_unique(h); + filesize = lower; + return error::NONE; + } + catch (...) + { + CloseHandle(h); + return error::OUT_OF_MEMORY; + } +} + + + +//============================================================ +// osd_openpty +//============================================================ + +osd_file::error osd_file::openpty(ptr &file, std::string &name) +{ + return error::FAILURE; +} + + + +//============================================================ +// osd_rmfile +//============================================================ + +osd_file::error osd_file::remove(std::string const &filename) +{ + osd::text::tstring tempstr = osd::text::to_tstring(filename); + + error filerr = error::NONE; + if (!DeleteFile(tempstr.c_str())) + filerr = win_error_to_file_error(GetLastError()); + + return filerr; +} + + + +//============================================================ +// osd_get_physical_drive_geometry +//============================================================ + +bool osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors, uint32_t *bps) +{ + return false; +} + + + +//============================================================ +// osd_stat +//============================================================ + +std::unique_ptr osd_stat(const std::string &path) +{ + // convert the path to TCHARs + osd::text::tstring t_path = osd::text::to_tstring(path); + + // is this path a root directory (e.g. - C:)? + WIN32_FIND_DATA find_data; + std::memset(&find_data, 0, sizeof(find_data)); + if (isalpha(path[0]) && (path[1] == ':') && (path[2] == '\0')) + { + // need to do special logic for root directories + if (!GetFileAttributesEx(t_path.c_str(), GetFileExInfoStandard, &find_data.dwFileAttributes)) + find_data.dwFileAttributes = INVALID_FILE_ATTRIBUTES; + } + else + { + // attempt to find the first file + HANDLE find = FindFirstFileEx(t_path.c_str(), FindExInfoStandard, &find_data, FindExSearchNameMatch, nullptr, 0); + if (find == INVALID_HANDLE_VALUE) + return nullptr; + FindClose(find); + } + + // create an osd::directory::entry; be sure to make sure that the caller can + // free all resources by just freeing the resulting osd::directory::entry + osd::directory::entry *result; + try { result = reinterpret_cast(::operator new(sizeof(*result) + path.length() + 1)); } + catch (...) { return nullptr; } + new (result) osd::directory::entry; + + strcpy(((char *) result) + sizeof(*result), path.c_str()); + result->name = ((char *) result) + sizeof(*result); + result->type = win_attributes_to_entry_type(find_data.dwFileAttributes); + result->size = find_data.nFileSizeLow | ((uint64_t) find_data.nFileSizeHigh << 32); + result->last_modified = win_time_point_from_filetime(&find_data.ftLastWriteTime); + + return std::unique_ptr(result); +} + + +//============================================================ +// osd_get_full_path +//============================================================ + +osd_file::error osd_get_full_path(std::string &dst, std::string const &path) +{ + // convert the path to TCHARs + osd::text::tstring t_path = osd::text::to_tstring(path); + + // cannonicalize the path + TCHAR buffer[MAX_PATH]; + if (!GetFullPathName(t_path.c_str(), ARRAY_LENGTH(buffer), buffer, nullptr)) + return win_error_to_file_error(GetLastError()); + + // convert the result back to UTF-8 + osd::text::from_tstring(dst, buffer); + return osd_file::error::NONE; +} + + + +//============================================================ +// osd_is_absolute_path +//============================================================ + +bool osd_is_absolute_path(std::string const &path) +{ + // very dumb hack here that will be imprecise + if (strlen(path.c_str()) >= 2 && path[1] == ':') + return true; + + return false; + +} + + + +//============================================================ +// osd_get_volume_name +//============================================================ + +const char *osd_get_volume_name(int idx) +{ + return nullptr; +} + + + +//============================================================ +// osd_is_valid_filename_char +//============================================================ + +bool osd_is_valid_filename_char(char32_t uchar) +{ + return osd_is_valid_filepath_char(uchar) + && uchar != '/' + && uchar != '\\' + && uchar != ':'; +} + + + +//============================================================ +// osd_is_valid_filepath_char +//============================================================ + +bool osd_is_valid_filepath_char(char32_t uchar) +{ + return uchar >= 0x20 + && uchar != '<' + && uchar != '>' + && uchar != '\"' + && uchar != '|' + && uchar != '?' + && uchar != '*' + && !(uchar >= '\x7F' && uchar <= '\x9F') + && uchar_isvalid(uchar); +} + + + +//============================================================ +// win_error_to_file_error +//============================================================ + +osd_file::error win_error_to_file_error(DWORD error) +{ + osd_file::error filerr; + + // convert a Windows error to a osd_file::error + switch (error) + { + case ERROR_SUCCESS: + filerr = osd_file::error::NONE; + break; + + case ERROR_OUTOFMEMORY: + filerr = osd_file::error::OUT_OF_MEMORY; + break; + + case ERROR_FILE_NOT_FOUND: + case ERROR_FILENAME_EXCED_RANGE: + case ERROR_PATH_NOT_FOUND: + case ERROR_INVALID_NAME: + filerr = osd_file::error::NOT_FOUND; + break; + + case ERROR_ACCESS_DENIED: + filerr = osd_file::error::ACCESS_DENIED; + break; + + case ERROR_SHARING_VIOLATION: + filerr = osd_file::error::ALREADY_OPEN; + break; + + default: + filerr = osd_file::error::FAILURE; + break; + } + return filerr; +} diff --git a/src/osd/modules/file/winrtfile.h b/src/osd/modules/file/winrtfile.h new file mode 100644 index 00000000000..9a6f1b8fc34 --- /dev/null +++ b/src/osd/modules/file/winrtfile.h @@ -0,0 +1,34 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles, Vas Crabb +//============================================================ +// +// winfile.h - File access functions +// +//============================================================ +#ifndef MAME_OSD_WINDOWS_WINFILE_H +#define MAME_OSD_WINDOWS_WINFILE_H + +#include "osdcore.h" + +#include +#include + +#include + + +//============================================================ +// PROTOTYPES +//============================================================ + +bool win_init_sockets(); +void win_cleanup_sockets(); + +bool win_check_socket_path(std::string const &path); +osd_file::error win_open_socket(std::string const &path, std::uint32_t openflags, osd_file::ptr &file, std::uint64_t &filesize); + +bool win_check_ptty_path(std::string const &path); +osd_file::error win_open_ptty(std::string const &path, std::uint32_t openflags, osd_file::ptr &file, std::uint64_t &filesize); + +osd_file::error win_error_to_file_error(DWORD error); + +#endif // MAME_OSD_WINDOWS_WINFILE_H diff --git a/src/osd/modules/file/winrtptty.cpp b/src/osd/modules/file/winrtptty.cpp new file mode 100644 index 00000000000..e32f035582d --- /dev/null +++ b/src/osd/modules/file/winrtptty.cpp @@ -0,0 +1,87 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles, Vas Crabb + +#define WIN32_LEAN_AND_MEAN + +#include "winrtfile.h" + +#include "strconv.h" + +#include + +#include +#include + + +namespace { +char const *const winfile_ptty_identifier = "\\\\.\\pipe\\"; + + +class win_osd_ptty : public osd_file +{ +public: + win_osd_ptty(win_osd_ptty const &) = delete; + win_osd_ptty(win_osd_ptty &&) = delete; + win_osd_ptty& operator=(win_osd_ptty const &) = delete; + win_osd_ptty& operator=(win_osd_ptty &&) = delete; + + win_osd_ptty(HANDLE handle) : m_handle(handle) + { + assert(m_handle); + assert(INVALID_HANDLE_VALUE != m_handle); + } + + ~win_osd_ptty() + { + } + + virtual error read(void *buffer, std::uint64_t offset, std::uint32_t count, std::uint32_t &actual) override + { + DWORD bytes_read; + if (!ReadFile(m_handle, buffer, count, &bytes_read, nullptr)) + return win_error_to_file_error(GetLastError()); + + actual = bytes_read; + return error::NONE; + } + + virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t count, std::uint32_t &actual) override + { + DWORD bytes_written; + if (!WriteFile(m_handle, buffer, count, &bytes_written, nullptr)) + return win_error_to_file_error(GetLastError()); + + actual = bytes_written; + return error::NONE; + } + + virtual error truncate(std::uint64_t offset) override + { + // doesn't make sense for a PTTY + return error::INVALID_ACCESS; + } + + virtual error flush() override + { + // don't want to wait for client to read all data as implied by FlushFileBuffers + return error::NONE; + } + +private: + HANDLE m_handle; +}; + +} // anonymous namespace + + +bool win_check_ptty_path(std::string const &path) +{ + if (strncmp(path.c_str(), winfile_ptty_identifier, strlen(winfile_ptty_identifier)) == 0) return true; + return false; +} + + +osd_file::error win_open_ptty(std::string const &path, std::uint32_t openflags, osd_file::ptr &file, std::uint64_t &filesize) +{ + return osd_file::error::ACCESS_DENIED; +} diff --git a/src/osd/modules/file/winrtsocket.cpp b/src/osd/modules/file/winrtsocket.cpp new file mode 100644 index 00000000000..94a8c3c3dc0 --- /dev/null +++ b/src/osd/modules/file/winrtsocket.cpp @@ -0,0 +1,274 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles, Vas Crabb +//============================================================ +// +// winsocket.c - Windows socket (inet) access functions +// +//============================================================ + +#define WIN32_LEAN_AND_MEAN + +#include "winfile.h" + +// MAME headers +#include "osdcore.h" + +#include +#include + +// standard windows headers +#include +#include +#include +#include +#include + + +namespace { +char const *const winfile_socket_identifier = "socket."; + + +class win_osd_socket : public osd_file +{ +public: + win_osd_socket(win_osd_socket const &) = delete; + win_osd_socket(win_osd_socket &&) = delete; + win_osd_socket& operator=(win_osd_socket const &) = delete; + win_osd_socket& operator=(win_osd_socket &&) = delete; + + win_osd_socket(SOCKET s, bool l) + : m_socket(s) + , m_listening(l) + { + assert(INVALID_SOCKET != m_socket); + } + + virtual ~win_osd_socket() override + { + closesocket(m_socket); + } + + virtual error read(void *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override + { + fd_set readfds; + FD_ZERO(&readfds); + FD_SET(m_socket, &readfds); + + struct timeval timeout; + timeout.tv_sec = timeout.tv_usec = 0; + + if (select(m_socket + 1, &readfds, nullptr, nullptr, &timeout) < 0) + { + char line[80]; + std::sprintf(line, "win_read_socket : %s : %d ", __FILE__, __LINE__); + std::perror(line); + return error::FAILURE; + } + else if (FD_ISSET(m_socket, &readfds)) + { + if (!m_listening) + { + // connected socket + int const result = recv(m_socket, (char*)buffer, length, 0); + if (result < 0) + { + return wsa_error_to_file_error(WSAGetLastError()); + } + else + { + actual = result; + return error::NONE; + } + } + else + { + // listening socket + SOCKET const accepted = accept(m_socket, nullptr, nullptr); + if (INVALID_SOCKET == accepted) + { + return wsa_error_to_file_error(WSAGetLastError()); + } + else + { + closesocket(m_socket); + m_socket = accepted; + m_listening = false; + actual = 0; + + return error::NONE; + } + } + } + else + { + return error::FAILURE; + } + } + + virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override + { + auto const result = send(m_socket, reinterpret_cast(buffer), length, 0); + if (result < 0) + return wsa_error_to_file_error(WSAGetLastError()); + + actual = result; + return error::NONE; + } + + virtual error truncate(std::uint64_t offset) override + { + // doesn't make sense for a socket + return error::INVALID_ACCESS; + } + + virtual error flush() override + { + // no buffers to flush + return error::NONE; + } + + static error wsa_error_to_file_error(int err) + { + switch (err) + { + case 0: return error::NONE; + case WSAEACCES: return error::ACCESS_DENIED; + case WSAEADDRINUSE: return error::ALREADY_OPEN; + case WSAEADDRNOTAVAIL: return error::NOT_FOUND; + case WSAECONNREFUSED: return error::NOT_FOUND; + case WSAEHOSTUNREACH: return error::NOT_FOUND; + case WSAENETUNREACH: return error::NOT_FOUND; + default: return error::FAILURE; + } + } + +private: + SOCKET m_socket; + bool m_listening; +}; + +} // anonymous namespace + + +bool win_init_sockets() +{ + WSADATA wsaData; + WORD const version = MAKEWORD(2, 0); + int const error = WSAStartup(version, &wsaData); + + // check for error + if (error) + { + // error occurred + return false; + } + + // check for correct version + if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion ) != 0) + { + // incorrect WinSock version + WSACleanup(); + return false; + } + + // WinSock has been initialized + return true; +} + + +void win_cleanup_sockets() +{ + WSACleanup(); +} + + +bool win_check_socket_path(std::string const &path) +{ + if (strncmp(path.c_str(), winfile_socket_identifier, strlen(winfile_socket_identifier)) == 0 && + strchr(path.c_str(), ':') != nullptr) return true; + return false; +} + + +osd_file::error win_open_socket(std::string const &path, std::uint32_t openflags, osd_file::ptr &file, std::uint64_t &filesize) +{ + char hostname[256]; + int port; + std::sscanf(&path[strlen(winfile_socket_identifier)], "%255[^:]:%d", hostname, &port); + + struct hostent const *const localhost = gethostbyname(hostname); + if (!localhost) + return osd_file::error::NOT_FOUND; + + struct sockaddr_in sai; + memset(&sai, 0, sizeof(sai)); + sai.sin_family = AF_INET; + sai.sin_port = htons(port); + sai.sin_addr = *reinterpret_cast(localhost->h_addr); + + SOCKET sock = socket(AF_INET, SOCK_STREAM, 0); + if (INVALID_SOCKET == sock) + return win_osd_socket::wsa_error_to_file_error(WSAGetLastError()); + + int const flag = 1; + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&flag), sizeof(flag)) == SOCKET_ERROR) + { + int const err = WSAGetLastError(); + closesocket(sock); + return win_osd_socket::wsa_error_to_file_error(err); + } + + // listening socket support + if (openflags & OPEN_FLAG_CREATE) + { + //printf("Listening for client at '%s' on port '%d'\n", hostname, port); + // bind socket... + if (bind(sock, reinterpret_cast(&sai), sizeof(struct sockaddr)) == SOCKET_ERROR) + { + int const err = WSAGetLastError(); + closesocket(sock); + return win_osd_socket::wsa_error_to_file_error(err); + } + + // start to listen... + if (listen(sock, 1) == SOCKET_ERROR) + { + int const err = WSAGetLastError(); + closesocket(sock); + return win_osd_socket::wsa_error_to_file_error(err); + } + + // mark socket as "listening" + try + { + file = std::make_unique(sock, true); + filesize = 0; + return osd_file::error::NONE; + } + catch (...) + { + closesocket(sock); + return osd_file::error::OUT_OF_MEMORY; + } + } + else + { + //printf("Connecting to server '%s' on port '%d'\n", hostname, port); + if (connect(sock, reinterpret_cast(&sai), sizeof(struct sockaddr)) == SOCKET_ERROR) + { + closesocket(sock); + return osd_file::error::ACCESS_DENIED; // have to return this value or bitb won't try to bind on connect failure + } + try + { + file = std::make_unique(sock, false); + filesize = 0; + return osd_file::error::NONE; + } + catch (...) + { + closesocket(sock); + return osd_file::error::OUT_OF_MEMORY; + } + } +} diff --git a/src/osd/modules/lib/osdlib_uwp.cpp b/src/osd/modules/lib/osdlib_uwp.cpp new file mode 100644 index 00000000000..66f753444b6 --- /dev/null +++ b/src/osd/modules/lib/osdlib_uwp.cpp @@ -0,0 +1,383 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont +//============================================================ +// +// sdlos_*.c - OS specific low level code +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include +#ifndef _MSC_VER +#include +#endif + +#include +#include + +// MAME headers +#include "osdlib.h" +#include "osdcomm.h" +#include "osdcore.h" +#include "strconv.h" + +#include +#include + +#include "strconv.h" + +using namespace Platform; +using namespace Windows::ApplicationModel::DataTransfer; +using namespace Windows::Foundation; + +#include +//============================================================ +// MACROS +//============================================================ + +// presumed size of a page of memory +#define PAGE_SIZE 4096 + +// align allocations to start or end of the page? +#define GUARD_ALIGN_START 0 + +#if defined(__BIGGEST_ALIGNMENT__) +#define MAX_ALIGNMENT __BIGGEST_ALIGNMENT__ +#elif defined(__AVX__) +#define MAX_ALIGNMENT 32 +#elif defined(__SSE__) || defined(__x86_64__) || defined(_M_X64) +#define MAX_ALIGNMENT 16 +#else +#define MAX_ALIGNMENT sizeof(int64_t) +#endif + + +//============================================================ +// GLOBAL VARIABLES +//============================================================ + +std::map> g_runtime_environment; + +//============================================================ +// osd_getenv +//============================================================ + +const char *osd_getenv(const char *name) +{ + for (auto iter = g_runtime_environment.begin(); iter != g_runtime_environment.end(); iter++) + { + if (stricmp(iter->first, name) == 0) + { + osd_printf_debug("ENVIRONMENT: Get %s = value: '%s'", name, iter->second.get()); + return iter->second.get(); + } + } + + return nullptr; +} + + +//============================================================ +// osd_setenv +//============================================================ + +int osd_setenv(const char *name, const char *value, int overwrite) +{ + if (!overwrite) + { + if (osd_getenv(name) != nullptr) + return 0; + } + + auto buf = std::make_unique(strlen(name) + strlen(value) + 2); + sprintf(buf.get(), "%s=%s", name, value); + + g_runtime_environment[name] = std::move(buf); + osd_printf_debug("ENVIRONMENT: Set %s to value: '%s'", name, buf.get()); + + return 0; +} + +//============================================================ +// osd_process_kill +//============================================================ + +void osd_process_kill() +{ + std::fflush(stdout); + std::fflush(stderr); + TerminateProcess(GetCurrentProcess(), -1); +} + +//============================================================ +// osd_malloc +//============================================================ + +void *osd_malloc(size_t size) +{ +#ifndef MALLOC_DEBUG + return malloc(size); +#else + // add in space for the size and offset + size += MAX_ALIGNMENT + sizeof(size_t) + 2; + size &= ~size_t(1); + + // basic objects just come from the heap + uint8_t *const block = reinterpret_cast(HeapAlloc(GetProcessHeap(), 0, size)); + if (block == nullptr) + return nullptr; + uint8_t *const result = reinterpret_cast(reinterpret_cast(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1)); + + // store the size and return and pointer to the data afterward + *reinterpret_cast(block) = size; + *(result - 1) = result - block; + return result; +#endif +} + + +//============================================================ +// osd_malloc_array +//============================================================ + +void *osd_malloc_array(size_t size) +{ +#ifndef MALLOC_DEBUG + return malloc(size); +#else + // add in space for the size and offset + size += MAX_ALIGNMENT + sizeof(size_t) + 2; + size &= ~size_t(1); + + // round the size up to a page boundary + size_t const rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; + + // reserve that much memory, plus two guard pages + void *page_base = VirtualAlloc(nullptr, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS); + if (page_base == nullptr) + return nullptr; + + // now allow access to everything but the first and last pages + page_base = VirtualAlloc(reinterpret_cast(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE); + if (page_base == nullptr) + return nullptr; + + // work backwards from the page base to get to the block base + uint8_t *const block = GUARD_ALIGN_START ? reinterpret_cast(page_base) : (reinterpret_cast(page_base) + rounded_size - size); + uint8_t *const result = reinterpret_cast(reinterpret_cast(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1)); + + // store the size at the start with a flag indicating it has a guard page + *reinterpret_cast(block) = size | 1; + *(result - 1) = result - block; + return result; +#endif +} + + +//============================================================ +// osd_free +//============================================================ + +void osd_free(void *ptr) +{ +#ifndef MALLOC_DEBUG + free(ptr); +#else + uint8_t const offset = *(reinterpret_cast(ptr) - 1); + uint8_t *const block = reinterpret_cast(ptr) - offset; + size_t const size = *reinterpret_cast(block); + + if ((size & 0x1) == 0) + { + // if no guard page, just free the pointer + HeapFree(GetProcessHeap(), 0, block); + } + else + { + // large items need more care + ULONG_PTR const page_base = reinterpret_cast(block) & ~(PAGE_SIZE - 1); + VirtualFree(reinterpret_cast(page_base - PAGE_SIZE), 0, MEM_RELEASE); + } +#endif +} + + +//============================================================ +// osd_alloc_executable +// +// allocates "size" bytes of executable memory. this must take +// things like NX support into account. +//============================================================ + +void *osd_alloc_executable(size_t size) +{ + return nullptr; +} + + +//============================================================ +// osd_free_executable +// +// frees memory allocated with osd_alloc_executable +//============================================================ + +void osd_free_executable(void *ptr, size_t size) +{ +} + + +//============================================================ +// osd_break_into_debugger +//============================================================ + +void osd_break_into_debugger(const char *message) +{ +#ifdef OSD_WINDOWS + if (IsDebuggerPresent()) + { + win_output_debug_string_utf8(message); + DebugBreak(); + } + else if (s_debugger_stack_crawler != nullptr) + (*s_debugger_stack_crawler)(); +#else + if (IsDebuggerPresent()) + { + OutputDebugStringA(message); + __debugbreak(); + } +#endif +} + +//============================================================ +// get_clipboard_text_by_format +//============================================================ + +static char *get_clipboard_text_by_format(UINT format, std::string (*convert)(LPCVOID data)) +{ + /*DataPackageView^ dataPackageView; + IAsyncOperation^ getTextOp; + String^ clipboardText; + + dataPackageView = Clipboard::GetContent(); + getTextOp = dataPackageView->GetTextAsync(); + clipboardText = getTextOp->GetResults(); + + return osd::text::from_wstring(clipboardText->Data()).c_str();*/ + return nullptr; +} + +//============================================================ +// convert_wide +//============================================================ + +static std::string convert_wide(LPCVOID data) +{ + return osd::text::from_wstring((LPCWSTR) data); +} + +//============================================================ +// convert_ansi +//============================================================ + +static std::string convert_ansi(LPCVOID data) +{ + return osd::text::from_astring((LPCSTR) data); +} + +//============================================================ +// osd_get_clipboard_text +//============================================================ + +char *osd_get_clipboard_text(void) +{ + // try to access unicode text + char *result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide); + + // try to access ANSI text + if (result == nullptr) + result = get_clipboard_text_by_format(CF_TEXT, convert_ansi); + + return result; +} + +//============================================================ +// 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 { +class dynamic_module_win32_impl : public dynamic_module +{ +public: + dynamic_module_win32_impl(std::vector &libraries) + : m_module(nullptr) + { + m_libraries = libraries; + } + + virtual ~dynamic_module_win32_impl() override + { + if (m_module != nullptr) + FreeLibrary(m_module); + }; + +protected: + virtual generic_fptr_t get_symbol_address(char const *symbol) override + { + /* + * given a list of libraries, if a first symbol is successfully loaded from + * one of them, all additional symbols will be loaded from the same library + */ + if (m_module) + { + return reinterpret_cast(GetProcAddress(m_module, symbol)); + } + + for (auto const &library : m_libraries) + { + osd::text::tstring tempstr = osd::text::to_tstring(library); + HMODULE module = load_library(tempstr.c_str()); + + if (module != nullptr) + { + generic_fptr_t function = reinterpret_cast(GetProcAddress(module, symbol)); + + if (function != nullptr) + { + m_module = module; + return function; + } + else + { + FreeLibrary(module); + } + } + } + + return nullptr; + } + +private: + std::vector m_libraries; + HMODULE m_module; +}; + +dynamic_module::ptr dynamic_module::open(std::vector &&names) +{ + return std::make_unique(names); +} + +} // namespace osd diff --git a/src/osd/strconv.cpp b/src/osd/strconv.cpp index b8c6b999c19..d8fed98d687 100644 --- a/src/osd/strconv.cpp +++ b/src/osd/strconv.cpp @@ -5,7 +5,7 @@ // strconv.cpp - Win32 string conversion // //============================================================ -#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) +#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) || defined(OSD_UWP) #define WIN32_LEAN_AND_MEAN #include #endif @@ -16,7 +16,7 @@ // MAMEOS headers #include "strconv.h" -#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) +#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS) || defined(OSD_UWP) namespace { diff --git a/src/osd/uwp/Package.appxmanifest b/src/osd/uwp/Package.appxmanifest new file mode 100644 index 00000000000..466e8c2a084 --- /dev/null +++ b/src/osd/uwp/Package.appxmanifest @@ -0,0 +1,36 @@ + + + + + + MAME + MAME Team + src\osd\uwp\assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/osd/uwp/assets/LockScreenLogo.scale-200.png b/src/osd/uwp/assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/src/osd/uwp/assets/SplashScreen.scale-200.png b/src/osd/uwp/assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^L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#`MNV z6UUcf9ZwEnKCCp+OoBnF@OdbvH)ANXO0o~Pi9l8=x3))}L<#vO0-~O4!~--Ket?d} zJaqsj<@CD1%S2cTW%rOP{Vto%0sGW~1RMa_j^)5nil0Yw- z0EE#bP+l4#P^%PQ+N*oxu1Zq05xZ!bXfYTg>9c{(Iw*lnjR^>kz%lAN^zFce7rppy zY8zA~3GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/src/osd/uwp/assets/Square150x150Logo.scale-200.png b/src/osd/uwp/assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8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lN5e*06-f1Uot67wY#{o-S1!KZ7E=!~7ynnk9_iJR#kFoNbAOT#^2Gd17F zMmvU6>lndZQGd|ax9kUoXXO+$N?|j@6qpsF&_j7YXvwo_C{JpmLw5&#e6k>atv%es z5)7r*Wvv_JkUpT}M!_o!nVlEk1Zbl=a*2hQ*<|%*K1Glj^FcF`6kTzGQ3lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/src/osd/uwp/assets/Square44x44Logo.scale-200.png b/src/osd/uwp/assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/src/osd/uwp/assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/osd/uwp/assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/src/osd/uwp/assets/StoreLogo.png b/src/osd/uwp/assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzW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310x150Logo.scale-200.png b/src/osd/uwp/assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV8$e3?-F=L^&FrtWn~(U_Q~~^uYiyeY6-KoTnfh9AWz@ zIKje0)u!_Lw)E}G!#kEfwKVdNt(UAf9*f>tEL_(=xco-T%jTi@7YlC3hs2ik%Le0H ztj}RTeCF(5mwvi3_56>-yB?l;J>-1%!9~=fs|QcNG3J~a@JCu`4SB460s0ZO+##4fFUSGLcj_ja^fL4&BKALfb#$6$O?>P@qx2Agl^x0i&ugt zsy5Pyu=()`7HRMG3IB7F1@`_ z+-!J%#i6e^U$e#+C%Q>_qVRzWRsG^W_n+@OcX@vzI&z;mzHNb!GQ?LWA(wtpqHqTM z1OFw_{Zn?fD)p)`c`kOgv{de=v@suGRqY{N^U7gI1VF3*F=obwaXI6ob5__Yn zVTguS!%(NI09J8x#AO_aW!9W7k*UvB;IWDFC3srwftr{kHj%g)fvnAm;&h_dnl~

MY- zf+K}sCe8qU6Ujs`3ua{U0Of$R_gVQBuUA za0v=mu#vIOqiiAZOr&h*$WyOw&k-xr$;G4Ixa!#TJNr>95(h>l%)PUy4p+^SgR(uR zta%k*?ny-+nAr8spEk1fo{J4i!b^Fia`N{_F6@zidA2ZTTrjl#^5Z-2KfB@Cu}l9s z(*|Z2jc?p~vn2f)3y9i*7zJV1L{$?|&q)4oaT;uXi6>1GkRXVTOzAz(RHEmr=eFIi z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fAdwMajorVersion = 10; + return TRUE; } HANDLE diff --git a/src/osd/uwp/uwpmain.cpp b/src/osd/uwp/uwpmain.cpp new file mode 100644 index 00000000000..173cf7ab536 --- /dev/null +++ b/src/osd/uwp/uwpmain.cpp @@ -0,0 +1,186 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +//============================================================ +// +// main.c - Win32 main program +// +//============================================================ + +// standard windows headers +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include + +#include "uwpmain.h" +#include +#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^ g_command_args; + +// The main function is only used to initialize our IFrameworkView class. +[Platform::MTAThread] +int main(Platform::Array^ 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(this, &App::OnActivated); + + CoreApplication::Suspending += + ref new EventHandler(this, &App::OnSuspending); + + CoreApplication::Resuming += + ref new EventHandler(this, &App::OnResuming); +} + +// Called when the CoreWindow object is created (or re-created). +void App::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += + ref new TypedEventHandler(this, &App::OnWindowSizeChanged); + + window->VisibilityChanged += + ref new TypedEventHandler(this, &App::OnVisibilityChanged); + + window->Closed += + ref new TypedEventHandler(this, &App::OnWindowClosed); + + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + + currentDisplayInformation->DpiChanged += + ref new TypedEventHandler(this, &App::OnDpiChanged); + + currentDisplayInformation->OrientationChanged += + ref new TypedEventHandler(this, &App::OnOrientationChanged); + + DisplayInformation::DisplayContentsInvalidated += + ref new TypedEventHandler(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 new file mode 100644 index 00000000000..20f82e2430e --- /dev/null +++ b/src/osd/uwp/uwpmain.h @@ -0,0 +1,52 @@ +// 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(); +};