summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--3rdparty/bgfx/src/renderer_null.cpp8
-rw-r--r--3rdparty/bx/include/bx/os.h5
-rw-r--r--3rdparty/bx/include/bx/platform.h7
-rw-r--r--3rdparty/portmidi/porttime/ptlinux.c12
-rw-r--r--makefile24
-rw-r--r--scripts/src/3rdparty.lua12
-rw-r--r--scripts/toolchain.lua29
-rw-r--r--src/osd/osdmini/minifile.c19
8 files changed, 103 insertions, 13 deletions
diff --git a/3rdparty/bgfx/src/renderer_null.cpp b/3rdparty/bgfx/src/renderer_null.cpp
index ce5f812448b..5a86523fc57 100644
--- a/3rdparty/bgfx/src/renderer_null.cpp
+++ b/3rdparty/bgfx/src/renderer_null.cpp
@@ -33,7 +33,7 @@ namespace bgfx { namespace noop
{
}
- void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/, uint8_t /*_flags*/) BX_OVERRIDE
+ void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/, uint16_t /*_flags*/) BX_OVERRIDE
{
}
@@ -49,7 +49,7 @@ namespace bgfx { namespace noop
{
}
- void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint8_t /*_flags*/) BX_OVERRIDE
+ void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) BX_OVERRIDE
{
}
@@ -57,7 +57,7 @@ namespace bgfx { namespace noop
{
}
- void createDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/, uint8_t /*_flags*/) BX_OVERRIDE
+ void createDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) BX_OVERRIDE
{
}
@@ -69,7 +69,7 @@ namespace bgfx { namespace noop
{
}
- void createDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/, uint8_t /*_flags*/) BX_OVERRIDE
+ void createDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) BX_OVERRIDE
{
}
diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h
index 4fcd2c08079..5daae404b8c 100644
--- a/3rdparty/bx/include/bx/os.h
+++ b/3rdparty/bx/include/bx/os.h
@@ -17,11 +17,12 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NACL \
+ || BX_PLATFORM_NETBSD \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_RPI
# include <sched.h> // sched_yield
-# if BX_PLATFORM_FREEBSD || BX_PLATFORM_IOS || BX_PLATFORM_NACL || BX_PLATFORM_OSX
+# if BX_PLATFORM_FREEBSD || BX_PLATFORM_IOS || BX_PLATFORM_NACL || BX_PLATFORM_NETBSD || BX_PLATFORM_OSX
# include <pthread.h> // mach_port_t
# endif // BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
@@ -93,7 +94,7 @@ namespace bx
return (pid_t)::syscall(SYS_gettid);
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
return (mach_port_t)::pthread_mach_thread_np(pthread_self() );
-#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_NACL
+#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_NACL || BX_PLATFORM_NETBSD
// Casting __nc_basic_thread_data*... need better way to do this.
return *(uint32_t*)::pthread_self();
#else
diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h
index 08b31bf787f..962a8a6fc6d 100644
--- a/3rdparty/bx/include/bx/platform.h
+++ b/3rdparty/bx/include/bx/platform.h
@@ -18,6 +18,7 @@
#define BX_PLATFORM_IOS 0
#define BX_PLATFORM_LINUX 0
#define BX_PLATFORM_NACL 0
+#define BX_PLATFORM_NETBSD 0
#define BX_PLATFORM_OSX 0
#define BX_PLATFORM_PS4 0
#define BX_PLATFORM_QNX 0
@@ -187,6 +188,9 @@
#elif defined(__FreeBSD__)
# undef BX_PLATFORM_FREEBSD
# define BX_PLATFORM_FREEBSD 1
+#elif defined(__NetBSD__)
+# undef BX_PLATFORM_NETBSD
+# define BX_PLATFORM_NETBSD 1
#else
# error "BX_PLATFORM_* is not defined!"
#endif //
@@ -198,6 +202,7 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NACL \
+ || BX_PLATFORM_NETBSD \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_QNX \
|| BX_PLATFORM_RPI \
@@ -250,6 +255,8 @@
#elif BX_PLATFORM_NACL
# define BX_PLATFORM_NAME "NaCl " \
BX_STRINGIZE(BX_PLATFORM_NACL)
+#elif BX_PLATFORM_NETBSD
+# define BX_PLATFORM_NAME "NetBSD"
#elif BX_PLATFORM_OSX
# define BX_PLATFORM_NAME "OSX"
#elif BX_PLATFORM_PS4
diff --git a/3rdparty/portmidi/porttime/ptlinux.c b/3rdparty/portmidi/porttime/ptlinux.c
index 768dd4847f7..c58107c36ad 100644
--- a/3rdparty/portmidi/porttime/ptlinux.c
+++ b/3rdparty/portmidi/porttime/ptlinux.c
@@ -38,7 +38,7 @@ CHANGE LOG
#define FALSE 0
static int time_started_flag = FALSE;
-static struct timeb time_offset = {0, 0, 0, 0};
+static struct timeval time_offset = {0, 0};
static pthread_t pt_thread_pid;
static int pt_thread_created = FALSE;
@@ -79,7 +79,7 @@ static void *Pt_CallbackProc(void *p)
PtError Pt_Start(int resolution, PtCallback *callback, void *userData)
{
if (time_started_flag) return ptNoError;
- ftime(&time_offset); /* need this set before process runs */
+ gettimeofday(&time_offset, NULL); /* need this set before process runs */
if (callback) {
int res;
pt_callback_parameters *parms = (pt_callback_parameters *)
@@ -121,10 +121,10 @@ int Pt_Started()
PtTimestamp Pt_Time()
{
long seconds, milliseconds;
- struct timeb now;
- ftime(&now);
- seconds = now.time - time_offset.time;
- milliseconds = now.millitm - time_offset.millitm;
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ seconds = now.tv_sec - time_offset.tv_sec;
+ milliseconds = now.tv_usec - time_offset.tv_usec;
return seconds * 1000 + milliseconds;
}
diff --git a/makefile b/makefile
index 68e610dcc69..78b0ddc4f99 100644
--- a/makefile
+++ b/makefile
@@ -297,6 +297,10 @@ ifeq ($(TARGETOS),freebsd)
OSD := sdl
endif
+ifeq ($(TARGETOS),netbsd)
+OSD := sdl
+endif
+
ifeq ($(TARGETOS),solaris)
OSD := sdl
endif
@@ -1007,6 +1011,26 @@ freebsd_x86: generate $(PROJECTDIR)/gmake-freebsd/Makefile
#-------------------------------------------------
+# gmake-netbsd
+#-------------------------------------------------
+
+
+$(PROJECTDIR)/gmake-netbsd/Makefile: makefile $(SCRIPTS) $(GENIE)
+ $(SILENT) $(GENIE) $(PARAMS) --gcc=netbsd --gcc_version=$(GCC_VERSION) gmake
+
+.PHONY: netbsd_x64
+netbsd_x64: generate $(PROJECTDIR)/gmake-netbsd/Makefile
+ $(SILENT) $(MAKE) -C $(PROJECTDIR)/gmake-netbsd config=$(CONFIG)64
+
+.PHONY: netbsd
+netbsd: netbsd_x86
+
+.PHONY: netbsd_x86
+netbsd_x86: generate $(PROJECTDIR)/gmake-netbsd/Makefile
+ $(SILENT) $(MAKE) -C $(PROJECTDIR)/gmake-netbsd config=$(CONFIG)32
+
+
+#-------------------------------------------------
# Clean/bootstrap
#-------------------------------------------------
diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua
index 889a6737cd5..5247517dce0 100644
--- a/scripts/src/3rdparty.lua
+++ b/scripts/src/3rdparty.lua
@@ -534,6 +534,13 @@ project "portmidi"
MAME_DIR .. "3rdparty/portmidi/porttime/ptlinux.c",
}
end
+ if _OPTIONS["targetos"]=="netbsd" then
+ files {
+ MAME_DIR .. "3rdparty/portmidi/pm_linux/pmlinux.c",
+ MAME_DIR .. "3rdparty/portmidi/pm_linux/finddefault.c",
+ MAME_DIR .. "3rdparty/portmidi/porttime/ptlinux.c",
+ }
+ end
if _OPTIONS["targetos"]=="macosx" then
files {
MAME_DIR .. "3rdparty/portmidi/pm_mac/pmmac.c",
@@ -591,6 +598,11 @@ project "bgfx"
MAME_DIR .. "3rdparty/bx/include/compat/freebsd",
}
+ configuration { "netbsd" }
+ includedirs {
+ MAME_DIR .. "3rdparty/bx/include/compat/freebsd",
+ }
+
configuration { "gmake" }
buildoptions {
"-Wno-uninitialized",
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index 91d1f29884e..589db7bc6fa 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -24,6 +24,7 @@ newoption {
{ "mingw-clang", "MinGW (clang compiler)" },
{ "nacl", "Native Client" },
{ "nacl-arm", "Native Client - ARM" },
+ { "netbsd", "NetBSD" },
{ "osx", "OSX (GCC compiler)" },
{ "osx-clang", "OSX (Clang compiler)" },
{ "pnacl", "Native Client - PNaCl" },
@@ -147,6 +148,10 @@ function toolchain(_buildDir, _subDir)
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-freebsd")
end
+ if "netbsd" == _OPTIONS["gcc"] then
+ location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-netbsd")
+ end
+
if "ios-arm" == _OPTIONS["gcc"] then
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
@@ -590,7 +595,29 @@ function toolchain(_buildDir, _subDir)
configuration { "freebsd", "x64", "Debug" }
targetdir (_buildDir .. "freebsd" .. "/bin/x64/Debug")
-
+
+ configuration { "netbsd", "x32" }
+ objdir (_buildDir .. "netbsd" .. "/obj")
+ buildoptions {
+ "-m32",
+ }
+ configuration { "netbsd", "x32", "Release" }
+ targetdir (_buildDir .. "netbsd" .. "/bin/x32/Release")
+
+ configuration { "netbsd", "x32", "Debug" }
+ targetdir (_buildDir .. "netbsd" .. "/bin/x32/Debug")
+
+ configuration { "netbsd", "x64" }
+ objdir (_buildDir .. "netbsd" .. "/obj")
+ buildoptions {
+ "-m64",
+ }
+ configuration { "netbsd", "x64", "Release" }
+ targetdir (_buildDir .. "netbsd" .. "/bin/x64/Release")
+
+ configuration { "netbsd", "x64", "Debug" }
+ targetdir (_buildDir .. "netbsd" .. "/bin/x64/Debug")
+
configuration { "android-*" }
includedirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
diff --git a/src/osd/osdmini/minifile.c b/src/osd/osdmini/minifile.c
index f2f899744fc..86b816d3ce2 100644
--- a/src/osd/osdmini/minifile.c
+++ b/src/osd/osdmini/minifile.c
@@ -102,6 +102,25 @@ file_error osd_write(osd_file *file, const void *buffer, UINT64 offset, UINT32 l
//============================================================
+// osd_truncate
+//============================================================
+
+file_error osd_truncate(osd_file *file, UINT64 offset)
+{
+ UINT32 result;
+
+ if (!file)
+ return FILERR_FAILURE;
+
+ result = ftruncate(fileno((FILE *)file), offset);
+ if (result)
+ return FILERR_FAILURE;
+
+ return FILERR_NONE;
+}
+
+
+//============================================================
// osd_rmfile
//============================================================