From 95822a165d0794e147bbfd77ead97376f3b8d3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 1 Jan 2016 14:08:23 +0100 Subject: [PATCH] Fix Mac build --- Core/Core.cpp | 6 ++++-- Core/Core.h | 2 ++ UI/NativeApp.cpp | 1 + ext/native/base/PCMain.cpp | 14 ++++++++------ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Core/Core.cpp b/Core/Core.cpp index 356f105262..f588b8c38d 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -58,6 +58,10 @@ static GraphicsContext *graphicsContext; extern InputState input_state; +void Core_SetGraphicsContext(GraphicsContext *ctx) { + graphicsContext = ctx; +} + void Core_NotifyWindowHidden(bool hidden) { windowHidden = hidden; // TODO: Wait until we can react? @@ -314,10 +318,8 @@ reswitch: return; } } - } - void Core_EnableStepping(bool step) { if (step) { sleep_ms(1); diff --git a/Core/Core.h b/Core/Core.h index afda12b26a..8b8edfa699 100644 --- a/Core/Core.h +++ b/Core/Core.h @@ -27,6 +27,8 @@ void UpdateRunLoop(); void Core_Run(GraphicsContext *ctx); void Core_Stop(); void Core_ErrorPause(); +// For platforms that don't call Core_Run +void Core_SetGraphicsContext(GraphicsContext *ctx); // called from gui void Core_EnableStepping(bool step); void Core_DoSingleStep(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 8c8c769037..adf7da59e9 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -507,6 +507,7 @@ void NativeInit(int argc, const char *argv[], } void NativeInitGraphics(GraphicsContext *graphicsContext) { + Core_SetGraphicsContext(graphicsContext); thin3d = graphicsContext->CreateThin3DContext(); ui_draw2d.SetAtlas(&ui_atlas); diff --git a/ext/native/base/PCMain.cpp b/ext/native/base/PCMain.cpp index 0141174719..be10f4a2d1 100644 --- a/ext/native/base/PCMain.cpp +++ b/ext/native/base/PCMain.cpp @@ -46,6 +46,13 @@ SDLJoystick *joystick = NULL; #include "Core/Config.h" #include "Common/GraphicsContext.h" +class GLDummyGraphicsContext : public DummyGraphicsContext { +public: + Thin3DContext *CreateThin3DContext() override { + return T3DCreateGLContext(); + } +}; + GlobalUIState lastUIState = UISTATE_MENU; GlobalUIState GetUIState(); @@ -619,7 +626,7 @@ int main(int argc, char *argv[]) { printf("Pixels: %i x %i\n", pixel_xres, pixel_yres); printf("Virtual pixels: %i x %i\n", dp_xres, dp_yres); - GraphicsContext *graphicsContext = new DummyGraphicsContext(); + GraphicsContext *graphicsContext = new GLDummyGraphicsContext(); NativeInitGraphics(graphicsContext); NativeResized(); @@ -851,12 +858,7 @@ int main(int argc, char *argv[]) { SimulateGamepad(keys, &input_state); input_state.pad_buttons = pad_buttons; UpdateInputState(&input_state, true); -#ifdef PPSSPP UpdateRunLoop(); -#else - NativeUpdate(input_state); - NativeRender(graphicsContext); -#endif if (g_QuitRequested) break; #if defined(PPSSPP) && !defined(MOBILE_DEVICE)