Cocoa Port: Fix crashes and improve stability.
- Fixes a crash that can occur on startup or when modifying the Video Pixel Scaler in Preferences. Fixes #321. (Regression from commit 0663661.) - Fixes a crash on startup where write+execute privileges returned by mprotect() are not supported when compiled against the macOS v10.15 SDK or later. Fixes #335. - Fixes a possible crash that can occur if an invalid ID is sent when trying to set the 3D Rendering Engine. Maybe fixes #342.
This commit is contained in:
parent
92cb90f433
commit
64cbba2e24
|
@ -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 <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
// 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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue