diff --git a/.gitignore b/.gitignore index 294e96329..1ba9b2611 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ Release/ **/*.sln **/*.vcxproj **/*.vcxproj.filters +.DS_Store diff --git a/Makefile b/Makefile index 54875c35a..f552a35d6 100644 --- a/Makefile +++ b/Makefile @@ -285,21 +285,11 @@ else ifneq (,$(findstring osx,$(platform))) LDFLAGS += -stdlib=libc++ fpic = -fPIC - HAVE_THR_AL=1 - HAVE_PARALLEL=0 PLATCFLAGS += -D__MACOSX__ -DOSX PLATFORM_EXT := unix PLATCFLAGS += -DHAVE_POSIX_MEMALIGN - # Disable hardware rendered graphics plugins for ARM for now - ifeq ($(shell uname -p),arm) - WITH_DYNAREC = - CFLAGS += -DDONT_WANT_ARM_OPTIMIZATIONS - HAVE_OPENGL=0 - else - # OpenGL is broken on non-ARM now, too - HAVE_OPENGL=0 - endif + COREFLAGS += -DOS_MAC_OS_X -stdlib=libc++ # Target Dynarec ifeq ($(ARCH), $(filter $(ARCH), ppc)) @@ -307,17 +297,11 @@ else ifneq (,$(findstring osx,$(platform))) endif ifeq ($(CROSS_COMPILE),1) - TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT) + TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) CFLAGS += $(TARGET_RULE) CPPFLAGS += $(TARGET_RULE) CXXFLAGS += $(TARGET_RULE) LDFLAGS += $(TARGET_RULE) - - ifeq ($(arch),arm) - HAVE_OPENGL=0 - WITH_DYNAREC = - CFLAGS += -DDONT_WANT_ARM_OPTIMIZATIONS - endif endif CFLAGS += $(ARCHFLAGS) @@ -1032,6 +1016,12 @@ else $(CC_AS) $(ASFLAGS) -c $< $(OBJOUT)$@ endif +mupen64plus-video-gliden64/src/%.o: mupen64plus-video-gliden64/src/%.c + $(CC) -I$(VIDEODIR_GLIDEN64)/src -I$(VIDEODIR_GLIDEN64)/src/osal $(CPPFLAGS) $(CFLAGS) -c $< $(OBJOUT)$@ + +mupen64plus-video-gliden64/src/%.o: mupen64plus-video-gliden64/src/%.cpp + $(CXX) -I$(VIDEODIR_GLIDEN64)/src -I$(VIDEODIR_GLIDEN64)/src/osal $(CPPFLAGS) $(CXXFLAGS) -c $< $(OBJOUT)$@ + %.o: %.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(OBJOUT)$@ diff --git a/Makefile.common b/Makefile.common index 81ad63ce0..b779f4242 100644 --- a/Makefile.common +++ b/Makefile.common @@ -40,8 +40,6 @@ INCFLAGS += \ -I$(CORE_DIR)/src \ -I$(CORE_DIR)/src/api \ -I$(ROOT_DIR)/include \ - -I$(VIDEODIR_GLIDEN64)/src \ - -I$(VIDEODIR_GLIDEN64)/src/osal \ -I$(AUDIO_LIBRETRO_DIR) \ -I$(LIBRETRO_COMM_DIR)/include \ -I$(LIBRETRO_DIR) diff --git a/custom/dependencies/libpng/config.h b/custom/dependencies/libpng/config.h index edfcc2874..4ea17ba08 100644 --- a/custom/dependencies/libpng/config.h +++ b/custom/dependencies/libpng/config.h @@ -1,4 +1,4 @@ -/* config.h. Generated from config.h.in by configure. */ +/* config.h. Generated from .in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ diff --git a/custom/dependencies/libzlib/gzguts.h b/custom/dependencies/libzlib/gzguts.h index d87659d03..6cb3bf873 100644 --- a/custom/dependencies/libzlib/gzguts.h +++ b/custom/dependencies/libzlib/gzguts.h @@ -3,6 +3,12 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#ifdef __APPLE__ +#include +#include +#include +#endif + #ifdef _LARGEFILE64_SOURCE # ifndef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 diff --git a/gles2rice/src/osal_opengl.h b/gles2rice/src/osal_opengl.h index 6b8c559f3..478af7412 100644 --- a/gles2rice/src/osal_opengl.h +++ b/gles2rice/src/osal_opengl.h @@ -62,4 +62,10 @@ #define glTexEnvi(x,y,z) #define glTexEnvfv(x,y,z) +#ifdef __APPLE__ +#define GL_CLAMP 0x2900 +#define GL_MAX_TEXTURE_UNITS 8 +#define GL_INTERPOLATE 0x8575 +#endif + #endif // OSAL_OPENGL_H diff --git a/glide2gl/src/Glitch64/glitch64_textures.c b/glide2gl/src/Glitch64/glitch64_textures.c index 746f5ad3a..0199e09f9 100644 --- a/glide2gl/src/Glitch64/glitch64_textures.c +++ b/glide2gl/src/Glitch64/glitch64_textures.c @@ -24,6 +24,13 @@ #include "glitchmain.h" #include "uthash.h" +#ifdef __APPLE__ +#define GL_LUMINANCE8 0x8040 +#define GL_INTENSITY8 0x804b +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#endif + /* Napalm extensions to GrTextureFormat_t */ #define GR_TEXFMT_ARGB_8888 0x12 #define GR_TEXFMT_YUYV_422 0x13 diff --git a/include/GL/glext.h b/include/GL/glext.h index 44ab7c62e..344e224db 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -6162,8 +6162,12 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for program/shader text and shader object handles */ typedef char GLcharARB; +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else typedef unsigned int GLhandleARB; #endif +#endif /* GL type for "half" precision (s10e5) float data in host memory */ #ifndef GL_ARB_half_float_pixel diff --git a/libretro/libretro.c b/libretro/libretro.c index 299bc394f..8e9a929b8 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -723,6 +723,8 @@ static void emu_step_initialize(void) CoreDoCommand(M64CMD_EXECUTE, 0, NULL); } +extern void gliden64RomOpen(); +extern void gliden64RomClosed(); void reinit_gfx_plugin(void) { if(first_context_reset) diff --git a/libretro/msvc/GL/glext.h b/libretro/msvc/GL/glext.h index 2b8da1c20..40159df7c 100644 --- a/libretro/msvc/GL/glext.h +++ b/libretro/msvc/GL/glext.h @@ -6162,8 +6162,12 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for program/shader text and shader object handles */ typedef char GLcharARB; +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else typedef unsigned int GLhandleARB; #endif +#endif /* GL type for "half" precision (s10e5) float data in host memory */ #ifndef GL_ARB_half_float_pixel diff --git a/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h b/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h index 8da146d32..f896e06be 100644 --- a/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h +++ b/mupen64plus-video-gliden64/src/Graphics/OpenGLContext/GLFunctions.h @@ -21,6 +21,21 @@ #include #include +// This is going to blow up so badly +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); + +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_CLIENT_STORAGE_BIT 0x0200 #elif defined(OS_IOS) #include #include @@ -69,6 +84,9 @@ typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloa #define CHECKED_GL_FUNCTION_WITH_RETURN(proc_name, ReturnType, ...) proc_name(__VA_ARGS__) #endif +#define CHECKED_GL_FUNCTION_UNCHECKED(proc_name, ...) proc_name(__VA_ARGS__) +#define CHECKED_GL_FUNCTION_UNCHECKED_WITH_RETURN(proc_name, ReturnType, ...) proc_name(__VA_ARGS__) + #define IS_GL_FUNCTION_VALID(proc_name) g_##proc_name != nullptr #define GET_GL_FUNCTION(proc_name) g_##proc_name @@ -87,8 +105,8 @@ typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloa #define glBindTexture(...) CHECKED_GL_FUNCTION(g_glBindTexture, __VA_ARGS__) #define glTexImage2D(...) CHECKED_GL_FUNCTION(g_glTexImage2D, __VA_ARGS__) #define glTexParameteri(...) CHECKED_GL_FUNCTION(g_glTexParameteri, __VA_ARGS__) -#define glGetIntegerv(...) CHECKED_GL_FUNCTION(g_glGetIntegerv, __VA_ARGS__) -#define glGetString(...) CHECKED_GL_FUNCTION_WITH_RETURN(g_glGetString, const GLubyte*, __VA_ARGS__) +#define glGetIntegerv(...) CHECKED_GL_FUNCTION_UNCHECKED(g_glGetIntegerv, __VA_ARGS__) +#define glGetString(...) CHECKED_GL_FUNCTION_UNCHECKED_WITH_RETURN(g_glGetString, const GLubyte*, __VA_ARGS__) #define glReadPixels(...) CHECKED_GL_FUNCTION(g_glReadPixels, __VA_ARGS__) #define glTexSubImage2D(...) CHECKED_GL_FUNCTION(g_glTexSubImage2D, __VA_ARGS__) #define glDrawArrays(...) CHECKED_GL_FUNCTION(g_glDrawArrays, __VA_ARGS__) diff --git a/mupen64plus-video-gliden64/src/common/CommonAPIImpl_common.cpp b/mupen64plus-video-gliden64/src/common/CommonAPIImpl_common.cpp index 284136dd5..14da08eb8 100644 --- a/mupen64plus-video-gliden64/src/common/CommonAPIImpl_common.cpp +++ b/mupen64plus-video-gliden64/src/common/CommonAPIImpl_common.cpp @@ -19,6 +19,8 @@ #include "Graphics/Context.h" #include +extern "C" void Config_LoadConfig(); + PluginAPI & PluginAPI::get() { static PluginAPI api; diff --git a/mupen64plus-video-gliden64/src/mupenplus/CommonAPIImpl_mupenplus.cpp b/mupen64plus-video-gliden64/src/mupenplus/CommonAPIImpl_mupenplus.cpp index ba8872d31..ecb0b2430 100644 --- a/mupen64plus-video-gliden64/src/mupenplus/CommonAPIImpl_mupenplus.cpp +++ b/mupen64plus-video-gliden64/src/mupenplus/CommonAPIImpl_mupenplus.cpp @@ -12,6 +12,11 @@ #include #endif +#ifdef __APPLE__ +#include +#include +#endif + #include extern retro_environment_t environ_cb; @@ -93,8 +98,8 @@ void PluginAPI::FindPluginPath(wchar_t * _strPath) } #elif defined(OS_MAC_OS_X) char path[MAXPATHLEN]; - uint32_t pathLen = MAXPATHLEN * 2; - if (_NSGetExecutablePath(path, pathLen) == 0) { + uint32_t pathLen = MAXPATHLEN; + if (_NSGetExecutablePath(path, &pathLen) == 0) { _getWSPath(path, _strPath); } #elif defined(ANDROID) diff --git a/scripts/build-mac.sh b/scripts/build-mac.sh new file mode 100644 index 000000000..6909da756 --- /dev/null +++ b/scripts/build-mac.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# To be used on Manjaro with MinGW packages installed +LIBRETRO_APPLE_PLATFORM=x86_64-apple-macos10.7 \ +CROSS_COMPILE=1 \ +platform=osx \ +ARCH=x86_64 \ +CC=clang \ +CXX=clang++ \ +make WITH_DYNAREC=x86_64 HAVE_THR_AL=1 HAVE_PARALLEL=1 HAVE_PARALLEL_RSP=1 -j12