summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--3rdparty/luafilesystem/src/lfs.c2
-rw-r--r--makefile2
-rw-r--r--scripts/genie.lua6
-rw-r--r--scripts/src/3rdparty.lua38
-rw-r--r--scripts/src/osd/uwp.lua109
-rw-r--r--scripts/src/osd/uwp_cfg.lua18
-rw-r--r--src/osd/asio.h4
-rw-r--r--src/osd/uwp/uwpcompat.cpp100
-rw-r--r--src/osd/uwp/uwpcompat.h105
9 files changed, 381 insertions, 3 deletions
diff --git a/3rdparty/luafilesystem/src/lfs.c b/3rdparty/luafilesystem/src/lfs.c
index ca89223e8f2..4eed5d99a9c 100644
--- a/3rdparty/luafilesystem/src/lfs.c
+++ b/3rdparty/luafilesystem/src/lfs.c
@@ -288,7 +288,7 @@ static int lfs_lock_dir(lua_State *L) {
lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
}
strcpy(ln, path); strcat(ln, lockfile);
- if((fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW,
+ if((fd = CreateFileA(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL)) == INVALID_HANDLE_VALUE) {
int en = GetLastError();
free(ln); lua_pushnil(L);
diff --git a/makefile b/makefile
index dcfb3aa0ce8..650b864a953 100644
--- a/makefile
+++ b/makefile
@@ -1043,7 +1043,7 @@ endif
.PHONY: vs2015_uwp
vs2015_uwp: generate
- $(SILENT) $(GENIE) $(PARAMS) $(TARGET_PARAMS) --vs=winstore82 --osd=windows --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --MODERN_WIN_API=1 vs2015
+ $(SILENT) $(GENIE) $(PARAMS) $(TARGET_PARAMS) --vs=winstore82 --osd=uwp --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --MODERN_WIN_API=1 vs2015
ifdef MSBUILD
$(SILENT) msbuild.exe $(PROJECTDIR_WIN)/vs2015-winstore82/$(PROJECT_NAME).sln $(MSBUILD_PARAMS)
endif
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 576b031bd22..12bef987a0d 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -495,6 +495,12 @@ end
configuration {}
+if _OPTIONS["osd"] == "uwp" then
+ windowstargetplatformversion("10.0.14393.0")
+ windowstargetplatformminversion("10.0.14393.0")
+ premake._filelevelconfig = true
+end
+
msgcompile ("Compiling $(subst ../,,$<)...")
msgcompile_objc ("Objective-C compiling $(subst ../,,$<)...")
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index fc9e157635b..c1bb26e8e6d 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -197,6 +197,11 @@ if _OPTIONS["vs"]=="intel-15" then
}
end
+ configuration { "winstore*" }
+ defines {
+ "NO_GETENV"
+ }
+
configuration { }
files {
@@ -377,6 +382,10 @@ end
"/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration
"/wd4457", -- warning C4457: declaration of 'xxx' hides function parameter
}
+ configuration { "winstore*" }
+ forcedincludes {
+ MAME_DIR .. "src/osd/uwp/uwpcompat.h"
+ }
configuration { }
defines {
@@ -463,6 +472,12 @@ if _OPTIONS["vs"]=="intel-15" then
"/Qwd592", -- error #592: variable "xxx" is used before its value is set
}
end
+
+ configuration { "winstore*" }
+ forcedincludes {
+ MAME_DIR .. "src/osd/uwp/uwpcompat.h",
+ }
+
configuration { }
defines {
"LUA_COMPAT_ALL",
@@ -555,20 +570,35 @@ project "lualibs"
includedirs {
MAME_DIR .. "3rdparty",
+ }
+if (_OPTIONS["osd"] ~= "uwp") then
+ includedirs {
MAME_DIR .. "3rdparty/linenoise-ng/include",
}
+end
includedirs {
ext_includedir("lua"),
ext_includedir("zlib"),
ext_includedir("sqlite3"),
}
+ configuration { "winstore*" }
+ forcedincludes {
+ MAME_DIR .. "src/osd/uwp/uwpcompat.h"
+ }
+
+ configuration {}
+
files {
MAME_DIR .. "3rdparty/lsqlite3/lsqlite3.c",
MAME_DIR .. "3rdparty/lua-zlib/lua_zlib.c",
MAME_DIR .. "3rdparty/luafilesystem/src/lfs.c",
+ }
+if (_OPTIONS["osd"] ~= "uwp") then
+ files {
MAME_DIR .. "3rdparty/lua-linenoise/linenoise.c",
}
+end
--------------------------------------------------
-- SQLite3 library objects
@@ -591,6 +621,11 @@ if _OPTIONS["gcc"]~=nil and string.find(_OPTIONS["gcc"], "clang") then
"-Wno-incompatible-pointer-types-discards-qualifiers",
}
end
+ configuration { "winstore*" }
+ defines {
+ "SQLITE_OS_WINRT",
+ }
+
configuration { }
files {
@@ -1514,7 +1549,7 @@ end
--------------------------------------------------
-- linenoise-ng library
--------------------------------------------------
-
+if (_OPTIONS["osd"] ~= "uwp") then
project "linenoise-ng"
uuid "7320ffc8-2748-4add-8864-ae29b72a8511"
kind (LIBTYPE)
@@ -1537,3 +1572,4 @@ project "linenoise-ng"
MAME_DIR .. "3rdparty/linenoise-ng/src/linenoise.cpp",
MAME_DIR .. "3rdparty/linenoise-ng/src/wcwidth.cpp",
}
+end \ No newline at end of file
diff --git a/scripts/src/osd/uwp.lua b/scripts/src/osd/uwp.lua
new file mode 100644
index 00000000000..20540fbe477
--- /dev/null
+++ b/scripts/src/osd/uwp.lua
@@ -0,0 +1,109 @@
+-- license:BSD-3-Clause
+-- copyright-holders:MAMEdev Team
+
+---------------------------------------------------------------------------
+--
+-- uwp.lua
+--
+-- Rules for the building of UWP OSD
+--
+---------------------------------------------------------------------------
+
+dofile("modules.lua")
+
+function maintargetosdoptions(_target,_subtarget)
+end
+
+project ("qtdbg_" .. _OPTIONS["osd"])
+ uuid (os.uuid("qtdbg_" .. _OPTIONS["osd"]))
+ kind (LIBTYPE)
+
+ dofile("uwp_cfg.lua")
+ includedirs {
+ MAME_DIR .. "src/emu",
+ MAME_DIR .. "src/devices", -- accessing imagedev from debugger
+ MAME_DIR .. "src/osd",
+ MAME_DIR .. "src/lib",
+ MAME_DIR .. "src/lib/util",
+ MAME_DIR .. "src/osd/modules/render",
+ MAME_DIR .. "3rdparty",
+ }
+ removeflags {
+ "SingleOutputDir",
+ }
+
+ files {
+ MAME_DIR .. "src/osd/modules/debugger/debugqt.cpp",
+ }
+
+project ("osd_" .. _OPTIONS["osd"])
+ uuid (os.uuid("osd_" .. _OPTIONS["osd"]))
+ kind (LIBTYPE)
+
+ removeflags {
+ "SingleOutputDir",
+ }
+
+ dofile("uwp_cfg.lua")
+ osdmodulesbuild()
+
+ includedirs {
+ MAME_DIR .. "src/emu",
+ MAME_DIR .. "src/devices", -- accessing imagedev from debugger
+ MAME_DIR .. "src/osd",
+ MAME_DIR .. "src/lib",
+ MAME_DIR .. "src/lib/util",
+ MAME_DIR .. "src/osd/modules/file",
+ MAME_DIR .. "src/osd/modules/render",
+ MAME_DIR .. "3rdparty",
+ }
+
+ includedirs {
+ MAME_DIR .. "src/osd/uwp",
+ MAME_DIR .. "src/osd/windows",
+ }
+
+ files {
+ MAME_DIR .. "src/osd/modules/osdwindow.cpp",
+ MAME_DIR .. "src/osd/modules/osdwindow.h",
+ MAME_DIR .. "src/osd/modules/render/drawnone.cpp",
+ 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/osdepend.h",
+ }
+
+project ("ocore_" .. _OPTIONS["osd"])
+ uuid (os.uuid("ocore_" .. _OPTIONS["osd"]))
+ kind (LIBTYPE)
+
+ removeflags {
+ "SingleOutputDir",
+ }
+
+ dofile("uwp_cfg.lua")
+
+ includedirs {
+ MAME_DIR .. "3rdparty",
+ MAME_DIR .. "src/emu",
+ MAME_DIR .. "src/osd",
+ MAME_DIR .. "src/osd/modules/file",
+ MAME_DIR .. "src/lib",
+ MAME_DIR .. "src/lib/util",
+ }
+
+ files {
+ MAME_DIR .. "src/osd/osdnet.cpp",
+ MAME_DIR .. "src/osd/osdnet.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/windows/winutil.cpp",
+ MAME_DIR .. "src/osd/windows/winutil.h",
+ --MAME_DIR .. "src/osd/modules/lib/osdlib_uwp.cpp",
+ }
diff --git a/scripts/src/osd/uwp_cfg.lua b/scripts/src/osd/uwp_cfg.lua
new file mode 100644
index 00000000000..234327aada0
--- /dev/null
+++ b/scripts/src/osd/uwp_cfg.lua
@@ -0,0 +1,18 @@
+-- license:BSD-3-Clause
+-- copyright-holders:MAMEdev Team
+
+defines {
+ "OSD_UWP=1",
+ "USE_QTDEBUG=0",
+ "SDLMAME_NOASM=1",
+ "USE_OPENGL=0",
+ "NO_USE_MIDI=1",
+ "WINVER=0x0603",
+ "_WIN32_WINNT=0x0603",
+ "NTDDI_VERSION=0x06030000",
+ "MODERN_WIN_API",
+}
+
+flags {
+ "Unicode",
+}
diff --git a/src/osd/asio.h b/src/osd/asio.h
index 1bcf610610f..10c82e69b08 100644
--- a/src/osd/asio.h
+++ b/src/osd/asio.h
@@ -18,7 +18,11 @@
#endif
#if defined(WIN32) && !defined(_WIN32_WINNT)
+#if defined(OSD_WINDOWS)
#define _WIN32_WINNT 0x0501
+#else
+#define _WIN32_WINNT 0x0603
+#endif
#endif
#define ASIO_HEADER_ONLY
#define ASIO_STANDALONE
diff --git a/src/osd/uwp/uwpcompat.cpp b/src/osd/uwp/uwpcompat.cpp
new file mode 100644
index 00000000000..ffd6623ca7d
--- /dev/null
+++ b/src/osd/uwp/uwpcompat.cpp
@@ -0,0 +1,100 @@
+// license:BSD-3-Clause
+// copyright-holders:Brad Hughes, Miodrag Milanovic
+//============================================================
+//
+// uwpcompat.h - Universal Windows Platform compat forced includes
+//
+//============================================================
+
+#include "uwpcompat.h"
+
+#include <errno.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef interface
+
+#include "emu.h"
+
+extern "C" {
+
+ int __cdecl system(const char *command)
+ {
+ return ENOENT;
+ }
+
+ const char *getenv(const char *varname)
+ {
+ return osd_getenv(varname);
+ }
+
+ HANDLE
+ WINAPI
+ CreateFileW(
+ _In_ LPCWSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile
+ )
+ {
+ // TODO: Handle other arguments that go into last param (pCreateExParams)
+ return CreateFile2((wchar_t*)lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
+ }
+
+ HANDLE
+ WINAPI
+ CreateFileA(
+ _In_ LPCSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile
+ )
+ {
+ wchar_t filepath[MAX_PATH + 1];
+ if (MultiByteToWideChar(CP_ACP, 0, lpFileName, strlen(lpFileName), filepath, MAX_PATH))
+ return CreateFileW(filepath, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
+
+ SetLastError(E_FAIL);
+ return INVALID_HANDLE_VALUE;
+ }
+
+ DWORD WINAPI GetTickCount(void)
+ {
+ return osd_ticks();
+ }
+
+ HMODULE WINAPI LoadLibraryExA(
+ _In_ LPCSTR lpLibFileName,
+ _Reserved_ HANDLE hFile,
+ _In_ DWORD dwFlags
+ )
+ {
+ wchar_t libfile_wide[MAX_PATH + 1];
+ if (MultiByteToWideChar(CP_ACP, 0, lpLibFileName, strlen(lpLibFileName), libfile_wide, MAX_PATH))
+ return LoadPackagedLibrary(libfile_wide, 0);
+
+ return nullptr;
+ }
+
+ HMODULE WINAPI LoadLibraryExW(
+ _In_ LPCWSTR lpLibFileName,
+ _Reserved_ HANDLE hFile,
+ _In_ DWORD dwFlags
+ )
+ {
+ return LoadPackagedLibrary(lpLibFileName, 0);
+ }
+
+ DWORD WINAPI GetFileSize(
+ _In_ HANDLE hFile,
+ _Out_opt_ LPDWORD lpFileSizeHigh
+ )
+ {
+ return 0;
+ }
+}
diff --git a/src/osd/uwp/uwpcompat.h b/src/osd/uwp/uwpcompat.h
new file mode 100644
index 00000000000..f155e225b8c
--- /dev/null
+++ b/src/osd/uwp/uwpcompat.h
@@ -0,0 +1,105 @@
+// license:BSD-3-Clause
+// copyright-holders:Brad Hughes, Miodrag Milanovic
+//============================================================
+//
+// uwpcompat.h - Universal Windows Platform compat forced includes
+//
+//============================================================
+
+#ifndef __UWPCOMPAT_H__
+#define __UWPCOMPAT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <stdio.h>
+
+int system(const char *command);
+
+const char *getenv(const char *varname);
+
+HANDLE
+WINAPI
+CreateFileA(
+ _In_ LPCSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile
+ );
+
+HANDLE
+WINAPI
+CreateFileW(
+ _In_ LPCWSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile
+ );
+
+#ifdef UNICODE
+#define CreateFile CreateFileW
+#else
+#define CreateFile CreateFileA
+#endif // !UNICODE
+
+BOOL WINAPI GetVersionEx(
+ _Inout_ LPOSVERSIONINFO lpVersionInfo
+);
+
+DWORD WINAPI GetTickCount(void);
+
+FILE *_popen(
+ const char *command,
+ const char *mode
+ );
+
+int _pclose(
+ FILE *stream);
+
+_Ret_maybenull_
+HMODULE
+WINAPI
+LoadLibraryExA(
+ _In_ LPCSTR lpLibFileName,
+ _Reserved_ HANDLE hFile,
+ _In_ DWORD dwFlags
+ );
+
+_Ret_maybenull_
+HMODULE
+WINAPI
+LoadLibraryExW(
+ _In_ LPCWSTR lpLibFileName,
+ _Reserved_ HANDLE hFile,
+ _In_ DWORD dwFlags
+ );
+
+DWORD
+WINAPI
+GetFileSize(
+ _In_ HANDLE hFile,
+ _Out_opt_ LPDWORD lpFileSizeHigh
+);
+
+#ifdef UNICODE
+#define LoadLibraryEx LoadLibraryExW
+#else
+#define LoadLibraryEx LoadLibraryExA
+#endif // !UNICODE
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __UWPCOMPAT_H__
+
+