mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
Make 3rdparty compile for UWP and start adding new OSD for UWP based on previous Brad work (nw)
This commit is contained in:
parent
5799b36a3a
commit
0d1f5b6be4
2
3rdparty/luafilesystem/src/lfs.c
vendored
2
3rdparty/luafilesystem/src/lfs.c
vendored
@ -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);
|
||||
|
2
makefile
2
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
|
||||
|
@ -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 ../,,$<)...")
|
||||
|
@ -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
|
109
scripts/src/osd/uwp.lua
Normal file
109
scripts/src/osd/uwp.lua
Normal file
@ -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",
|
||||
}
|
18
scripts/src/osd/uwp_cfg.lua
Normal file
18
scripts/src/osd/uwp_cfg.lua
Normal file
@ -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",
|
||||
}
|
@ -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
|
||||
|
100
src/osd/uwp/uwpcompat.cpp
Normal file
100
src/osd/uwp/uwpcompat.cpp
Normal file
@ -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;
|
||||
}
|
||||
}
|
105
src/osd/uwp/uwpcompat.h
Normal file
105
src/osd/uwp/uwpcompat.h
Normal file
@ -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__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user