diff --git a/desmume/src/arm_jit.cpp b/desmume/src/arm_jit.cpp index 7dc5c616a..e7b1151d6 100644 --- a/desmume/src/arm_jit.cpp +++ b/desmume/src/arm_jit.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2011 Loren Merritt - Copyright (C) 2012-2017 DeSmuME team + Copyright (C) 2012-2021 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,8 +31,14 @@ #include #include #include +// The static code buffer relies on write+execute privileges provided by mprotect(), +// which isn't supported by the macOS v10.15 SDK and later, as well as Apple's other +// modern operating systems. Therefore, we are disabling this on all Apple systems +// for now. +#ifndef __APPLE__ #define HAVE_STATIC_CODE_BUFFER #endif +#endif #include "utils/bits.h" #include "utils/AsmJit/AsmJit.h" diff --git a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp index fc788d37c..03f6b304d 100644 --- a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp +++ b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp @@ -5613,7 +5613,7 @@ OGLImage::~OGLImage() } delete this->_vf; - free(_vfMasterDstBuffer); + free_aligned(_vfMasterDstBuffer); } bool OGLImage::GetFiltersPreferGPU() @@ -6090,7 +6090,7 @@ void OGLImage::SetCPUPixelScalerOGL(const VideoFilterTypeID filterID) glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); _vfMasterDstBuffer = newMasterBuffer; - free(oldMasterBuffer); + free_aligned(oldMasterBuffer); } this->_vf->ChangeFilterByID(filterID); diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index cd09a3392..1894e882c 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 DeSmuME team + Copyright (C) 2013-2021 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,11 +36,13 @@ #import "userinterface/MacMetalDisplayView.h" #endif +#define GPU_3D_RENDERER_COUNT 3 + #ifdef BOOL #undef BOOL #endif -GPU3DInterface *core3DList[] = { +GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = { &gpu3DNull, &gpu3DRasterize, &gpu3Dgl, @@ -394,6 +396,15 @@ public: - (void) setRender3DRenderingEngine:(NSInteger)rendererID { + if (rendererID < CORE3DLIST_NULL) + { + rendererID = CORE3DLIST_NULL; + } + else if (rendererID > GPU_3D_RENDERER_COUNT) + { + rendererID = CORE3DLIST_SWRASTERIZE; + } + gpuEvent->ApplyRender3DSettingsLock(); GPU->Set3DRendererByID(rendererID); gpuEvent->ApplyRender3DSettingsUnlock();