mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Fix issues on macOS
Note: Doesn't add the ability to make windows, so GSdx won't actually play games on macOS with this
This commit is contained in:
parent
99b8168ea8
commit
7fa6740710
|
@ -98,7 +98,7 @@ endif()
|
|||
# -X11
|
||||
# -zlib
|
||||
#---------------------------------------
|
||||
if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND ZLIB_FOUND AND PNG_FOUND AND FREETYPE_FOUND AND LIBLZMA_FOUND AND EGL_FOUND AND X11_XCB_FOUND)
|
||||
if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND ZLIB_FOUND AND PNG_FOUND AND FREETYPE_FOUND AND LIBLZMA_FOUND AND ((EGL_FOUND AND X11_XCB_FOUND) OR APPLE))
|
||||
set(GSdx TRUE)
|
||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/GSdx")
|
||||
set(GSdx FALSE)
|
||||
|
|
|
@ -207,6 +207,10 @@ if(Windows)
|
|||
resource.h
|
||||
targetver.h
|
||||
)
|
||||
elseif(APPLE)
|
||||
LIST(APPEND GSdxSources
|
||||
Window/GSLinuxDialog.cpp
|
||||
)
|
||||
else()
|
||||
LIST(APPEND GSdxSources
|
||||
Window/GSLinuxDialog.cpp
|
||||
|
@ -240,6 +244,12 @@ if(USE_VTUNE)
|
|||
set(GSdxFinalLibs ${GSdxFinalLibs} ${VTUNE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_library(APPKIT_LIBRARY AppKit)
|
||||
set(GSdxFinalFlags ${GSdxFinalFlags} -fobjc-arc)
|
||||
set(GSdxFinalLibs ${GSdxFinalLibs} ${APPKIT_LIBRARY} -fobjc-link-runtime)
|
||||
endif()
|
||||
|
||||
set(RESOURCE_FILES
|
||||
res/logo-ogl.bmp
|
||||
res/fxaa.fx
|
||||
|
|
|
@ -43,6 +43,11 @@ static HRESULT s_hr = E_FAIL;
|
|||
|
||||
#include "Window/GSWndEGL.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <gtk/gtk.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
extern bool RunLinuxDialog();
|
||||
|
||||
#endif
|
||||
|
@ -244,6 +249,8 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
// No windows available for macOS at the moment
|
||||
#else
|
||||
wnds.push_back(std::make_shared<GSWndWGL>());
|
||||
#endif
|
||||
|
@ -251,6 +258,8 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
default:
|
||||
#ifdef _WIN32
|
||||
wnds.push_back(std::make_shared<GSWndDX>());
|
||||
#elif defined(__APPLE__)
|
||||
// No windows available for macOS at the moment
|
||||
#else
|
||||
wnds.push_back(std::make_shared<GSWndEGL_X11>());
|
||||
#endif
|
||||
|
@ -749,6 +758,20 @@ EXPORT_C GSconfigure()
|
|||
theApp.SetCurrentRendererType(GSRendererType::Undefined);
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
// Rest of macOS UI doesn't use GTK so we need to init it now
|
||||
gtk_init(nullptr, nullptr);
|
||||
// GTK expects us to be using its event loop, rather than Cocoa's
|
||||
// If we call its stuff right now, it'll attempt to drain a static autorelease pool that was already drained by Cocoa (see https://github.com/GNOME/gtk/blob/8c1072fad1cb6a2e292fce2441b4a571f173ce0f/gdk/quartz/gdkeventloop-quartz.c#L640-L646)
|
||||
// We can convince it that touching that pool would be unsafe by running all GTK calls within a CFRunLoop
|
||||
// (Blocks submitted to the main queue by dispatch_async are run by its CFRunLoop)
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (RunLinuxDialog()) {
|
||||
theApp.ReloadConfig();
|
||||
// Force a reload of the gs state
|
||||
theApp.SetCurrentRendererType(GSRendererType::Undefined);
|
||||
}
|
||||
});
|
||||
#else
|
||||
|
||||
if (RunLinuxDialog()) {
|
||||
|
@ -802,7 +825,7 @@ EXPORT_C_(std::wstring*) GSsetupRecording(int start)
|
|||
printf("GSdx: no s_gs for recording\n");
|
||||
return nullptr;
|
||||
}
|
||||
#if defined(__unix__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
if (!theApp.GetConfigB("capture_enabled")) {
|
||||
printf("GSdx: Recording is disabled\n");
|
||||
return nullptr;
|
||||
|
@ -1302,7 +1325,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(__unix__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
|
||||
inline unsigned long timeGetTime()
|
||||
{
|
||||
|
@ -1316,7 +1339,9 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
|
|||
{
|
||||
GLLoader::in_replayer = true;
|
||||
// Required by multithread driver
|
||||
#ifndef __APPLE__
|
||||
XInitThreads();
|
||||
#endif
|
||||
|
||||
GSinit();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void GSPerfMon::Put(counter_t c, double val)
|
|||
#ifndef DISABLE_PERF_MON
|
||||
if(c == Frame)
|
||||
{
|
||||
#if defined(__unix__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
// clock on linux will return CLOCK_PROCESS_CPUTIME_ID.
|
||||
// CLOCK_THREAD_CPUTIME_ID is much more useful to measure the fps
|
||||
struct timespec ts;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "GSRenderer.h"
|
||||
#if defined(__unix__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
|
@ -570,7 +570,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
|||
|
||||
int step = m_shift_key ? -1 : 1;
|
||||
|
||||
#if defined(__unix__)
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
#define VK_F5 XK_F5
|
||||
#define VK_F6 XK_F6
|
||||
#define VK_DELETE XK_Delete
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "GSdx.h"
|
||||
#include "GS.h"
|
||||
|
||||
#ifdef __unix__
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate = NULL;
|
||||
#endif
|
||||
PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT = NULL;
|
||||
|
|
|
@ -114,7 +114,7 @@ typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLin
|
|||
// #define ENABLE_GL_VERSION_4_6 1
|
||||
|
||||
// It should be done by ENABLE_GL_VERSION_1_4 but it conflicts with the old gl.h
|
||||
#ifdef __unix__
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate;
|
||||
#endif
|
||||
extern PFNGLTEXTUREPAGECOMMITMENTEXTPROC glTexturePageCommitmentEXT;
|
||||
|
|
|
@ -33,7 +33,7 @@ void GSWndGL::PopulateGlFunction()
|
|||
#include "PFN_WND.h"
|
||||
|
||||
// GL1.X mess
|
||||
#ifdef __unix__
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
GL_EXT_LOAD(glBlendFuncSeparate);
|
||||
#endif
|
||||
GL_EXT_LOAD_OPT(glTexturePageCommitmentEXT);
|
||||
|
|
|
@ -43,6 +43,6 @@
|
|||
//#define ENABLE_EXTRA_LOG // print extra log
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) && !(defined(_DEBUG) || defined(_DEVEL))
|
||||
#if (defined(__unix__) || defined(__APPLE__)) && !(defined(_DEBUG) || defined(_DEVEL))
|
||||
#define DISABLE_PERF_MON // Burn cycle for nothing in release mode
|
||||
#endif
|
||||
|
|
|
@ -155,7 +155,8 @@ void* vmalloc(size_t size, bool code)
|
|||
|
||||
if(code) {
|
||||
prot |= PROT_EXEC;
|
||||
#ifdef _M_AMD64
|
||||
#if defined(_M_AMD64) && !defined(__APPLE__)
|
||||
// macOS doesn't allow any mappings in the first 4GB of address space
|
||||
flags |= MAP_32BIT;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue