Cocoa Port:

- Optimize some utility functions
- Make the OpenGL renderer the default 3D renderer in the legacy port
- Fix compiling issue in the legacy port
- Build frameworks now all use SDK relative paths instead of absolute paths

OpenGL Renderer:
- Allow it to compile using the OS X v10.4 Tiger SDK
- OpenGL feature support checks now run an SDK check in addition to the GPU check
This commit is contained in:
rogerman 2013-01-04 01:40:52 +00:00
parent 9ab3c45c2a
commit 777fd6bc78
8 changed files with 243 additions and 149 deletions

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 shash
Copyright (C) 2008-2012 DeSmuME team
Copyright (C) 2008-2013 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
@ -52,9 +52,14 @@ static void ENDGL() {
#include <GL/glext.h>
#else
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
#include "cocoa/macosx_10_4_compat.h"
#endif
// We're not exactly committing to OpenGL 3.2 Core Profile just yet, so redefine APPLE
// extensions for VAO as a temporary measure.
#ifdef GL_APPLE_vertex_array_object
@ -427,11 +432,15 @@ static void createShaders()
glGetShaderInfoLog == NULL)
NOSHADERS("Shaders aren't supported by your system.");*/
#if !defined(GL_ARB_shader_objects) || !defined(GL_ARB_vertex_shader) || !defined(GL_ARB_fragment_shader) || !defined(GL_ARB_vertex_program)
NOSHADERS("Shaders aren't supported by your system.");
#else
if ((strstr(extString, "GL_ARB_shader_objects") == NULL) ||
(strstr(extString, "GL_ARB_vertex_shader") == NULL) ||
(strstr(extString, "GL_ARB_fragment_shader") == NULL) ||
(strstr(extString, "GL_ARB_vertex_program") == NULL) )
NOSHADERS("Shaders aren't supported by your system.");
#endif
vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
if(!vertexShaderID)
@ -643,7 +652,11 @@ static char OGLInit(void)
#endif
// VBO Setup
#if !defined(GL_ARB_vertex_buffer_object)
isVBOSupported = false;
#else
isVBOSupported = (strstr(extString, "GL_ARB_vertex_buffer_object") == NULL) ? false : true;
#endif
if (isVBOSupported)
{
glGenBuffersARB(1, &vboVertexID);
@ -653,7 +666,11 @@ static char OGLInit(void)
}
// PBO Setup
#if !defined(GL_ARB_pixel_buffer_object)
isPBOSupported = false;
#else
isPBOSupported = (strstr(extString, "GL_ARB_pixel_buffer_object") == NULL) ? false : true;
#endif
if (isPBOSupported)
{
glGenBuffersARB(2, pboRenderDataID);
@ -743,10 +760,14 @@ static char OGLInit(void)
}
// VAO Setup
#if !defined(GL_ARB_vertex_array_object) && !defined(GL_APPLE_vertex_array_object)
isVAOSupported = false;
#else
isVAOSupported = ( !isVBOSupported ||
!isShaderSupported ||
(strstr(extString, "GL_ARB_vertex_array_object") == NULL &&
strstr(extString, "GL_APPLE_vertex_array_object") == NULL) ) ? false : true;
#endif
if (isVAOSupported)
{
glGenVertexArrays(1, &vaoMainStatesID);
@ -765,11 +786,15 @@ static char OGLInit(void)
}
// FBO Setup
isFBOSupported = ( (strstr(extString, "GL_ARB_framebuffer_object") == NULL) &&
(strstr(extString, "GL_EXT_framebuffer_object") == NULL ||
#if ( !defined(GL_ARB_framebuffer_object) ) && ( !defined(GL_EXT_framebuffer_object) || \
!defined(GL_EXT_framebuffer_blit) || \
!defined(GL_EXT_packed_depth_stencil) )
isFBOSupported = false;
#else
isFBOSupported = ( (strstr(extString, "GL_ARB_framebuffer_object") == NULL) && (strstr(extString, "GL_EXT_framebuffer_object") == NULL ||
strstr(extString, "GL_EXT_framebuffer_blit") == NULL ||
strstr(extString, "GL_EXT_packed_depth_stencil") == NULL) ) ? false : true;
#endif
if (isFBOSupported)
{
// ClearImage/Rear-plane

View File

@ -832,6 +832,7 @@
AB73B1D214BDA94800F49C92 /* Icon_Pause_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB73B1C214BDA94800F49C92 /* Icon_Pause_420x420.png */; };
AB73B1D314BDA94800F49C92 /* Icon_Speed1x_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB73B1C314BDA94800F49C92 /* Icon_Speed1x_420x420.png */; };
AB73B1D414BDA94800F49C92 /* Icon_Speed2x_420x420.png in Resources */ = {isa = PBXBuildFile; fileRef = AB73B1C414BDA94800F49C92 /* Icon_Speed2x_420x420.png */; };
AB751A681696535D00AFA00D /* OGLRender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB06CD2E135B8ACE00E977B3 /* OGLRender.cpp */; };
AB7522E414C7D879009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */ = {isa = PBXBuildFile; fileRef = AB7522E314C7D879009B97B3 /* AppIcon_FirmwareConfig.icns */; };
AB7522E514C7D879009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */ = {isa = PBXBuildFile; fileRef = AB7522E314C7D879009B97B3 /* AppIcon_FirmwareConfig.icns */; };
AB7522E614C7D879009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */ = {isa = PBXBuildFile; fileRef = AB7522E314C7D879009B97B3 /* AppIcon_FirmwareConfig.icns */; };
@ -841,6 +842,19 @@
AB8FE37814B652EC009E20B1 /* cocoa_util.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8FE37514B652EC009E20B1 /* cocoa_util.mm */; };
AB8FE37914B652EC009E20B1 /* cocoa_util.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8FE37514B652EC009E20B1 /* cocoa_util.mm */; };
AB8FE48C14B6657D009E20B1 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1D14AACACC00E83E91 /* libz.dylib */; };
AB97D29616964D01002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45116964DF2002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45216964E0A002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45316964E0F002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45416964E14002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45516964E26002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D45616964E2D002AC11B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97324FDCFA39411CA2CEA /* AppKit.framework */; };
AB97D50916964E30002AC11B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97325FDCFA39411CA2CEA /* Foundation.framework */; };
AB97D58716964E34002AC11B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1D14AACACC00E83E91 /* libz.dylib */; };
AB97D58816964E3A002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97D29516964D01002AC11B /* Accelerate.framework */; };
AB97D58916964E3F002AC11B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97324FDCFA39411CA2CEA /* AppKit.framework */; };
AB97D58A16964E42002AC11B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97325FDCFA39411CA2CEA /* Foundation.framework */; };
AB97D58B16964E44002AC11B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1D14AACACC00E83E91 /* libz.dylib */; };
ABAC890914B7943E001B299F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABAC890814B7943E001B299F /* main.m */; };
ABAC890A14B7943E001B299F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABAC890814B7943E001B299F /* main.m */; };
ABAC890B14B7943E001B299F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ABAC890814B7943E001B299F /* main.m */; };
@ -1002,15 +1016,15 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
1F4B55030F53921B00C8B514 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = translations/English.lproj/Localizable.strings; sourceTree = "<group>"; };
1F4B550D0F53928000C8B514 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = translations/Italian.lproj/Localizable.strings; sourceTree = "<group>"; };
1F4B550E0F53928400C8B514 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = translations/Japanese.lproj/Localizable.strings; sourceTree = "<group>"; };
1F4B550F0F53928700C8B514 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = translations/French.lproj/Localizable.strings; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
729BECE60D9D57F600ED561B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
729BECEF0D9D581900ED561B /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
729BECE60D9D57F600ED561B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
729BECEF0D9D581900ED561B /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
72C000020D9D59E60046B7EA /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = English; path = translations/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
7FA9121A1426523900E2ABDD /* tinystr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinystr.cpp; sourceTree = "<group>"; };
7FA9121B1426523900E2ABDD /* tinystr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinystr.h; sourceTree = "<group>"; };
@ -1283,6 +1297,7 @@
AB8FE30A14B647D6009E20B1 /* macosx_10_4_compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macosx_10_4_compat.h; sourceTree = "<group>"; };
AB8FE37414B652EC009E20B1 /* cocoa_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_util.h; sourceTree = "<group>"; };
AB8FE37514B652EC009E20B1 /* cocoa_util.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_util.mm; sourceTree = "<group>"; };
AB97D29516964D01002AC11B /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
ABAC890814B7943E001B299F /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
ABBF045E14B5144D00E505A0 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = "translations/English.lproj/MainMenu (Legacy).xib"; sourceTree = "<group>"; };
ABBF04CB14B51BBB00E505A0 /* Chinese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Chinese; path = translations/Chinese.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -1325,9 +1340,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1EFD51B70F892B1A00B029BB /* Cocoa.framework in Frameworks */,
1EFD51B80F892B1A00B029BB /* OpenGL.framework in Frameworks */,
AB97D58816964E3A002AC11B /* Accelerate.framework in Frameworks */,
AB97D58916964E3F002AC11B /* AppKit.framework in Frameworks */,
1EFD51B90F892B1A00B029BB /* AudioUnit.framework in Frameworks */,
1EFD51B70F892B1A00B029BB /* Cocoa.framework in Frameworks */,
AB97D58A16964E42002AC11B /* Foundation.framework in Frameworks */,
1EFD51B80F892B1A00B029BB /* OpenGL.framework in Frameworks */,
AB97D58B16964E44002AC11B /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1335,11 +1354,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
729BECE70D9D57F600ED561B /* OpenGL.framework in Frameworks */,
729BECF00D9D581900ED561B /* AudioUnit.framework in Frameworks */,
AB97D45216964E0A002AC11B /* Accelerate.framework in Frameworks */,
AB06CCD6135B8AA200E977B3 /* AppKit.framework in Frameworks */,
729BECF00D9D581900ED561B /* AudioUnit.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
AB06CCD7135B8AA300E977B3 /* Foundation.framework in Frameworks */,
729BECE70D9D57F600ED561B /* OpenGL.framework in Frameworks */,
AB0A0D1E14AACACC00E83E91 /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1348,11 +1368,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB0A0DA214AACE9500E83E91 /* Cocoa.framework in Frameworks */,
AB0A0DA314AACE9500E83E91 /* OpenGL.framework in Frameworks */,
AB0A0DA414AACE9500E83E91 /* AudioUnit.framework in Frameworks */,
AB97D29616964D01002AC11B /* Accelerate.framework in Frameworks */,
AB0A0DA514AACE9500E83E91 /* AppKit.framework in Frameworks */,
AB0A0DA414AACE9500E83E91 /* AudioUnit.framework in Frameworks */,
AB0A0DA214AACE9500E83E91 /* Cocoa.framework in Frameworks */,
AB0A0DA614AACE9500E83E91 /* Foundation.framework in Frameworks */,
AB0A0DA314AACE9500E83E91 /* OpenGL.framework in Frameworks */,
AB0A0DA714AACE9500E83E91 /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1361,11 +1382,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB18154E15D212B4007A6CC3 /* Cocoa.framework in Frameworks */,
AB18154F15D212B4007A6CC3 /* OpenGL.framework in Frameworks */,
AB18155015D212B4007A6CC3 /* AudioUnit.framework in Frameworks */,
AB97D45316964E0F002AC11B /* Accelerate.framework in Frameworks */,
AB18155115D212B4007A6CC3 /* AppKit.framework in Frameworks */,
AB18155015D212B4007A6CC3 /* AudioUnit.framework in Frameworks */,
AB18154E15D212B4007A6CC3 /* Cocoa.framework in Frameworks */,
AB18155215D212B4007A6CC3 /* Foundation.framework in Frameworks */,
AB18154F15D212B4007A6CC3 /* OpenGL.framework in Frameworks */,
AB18155315D212B4007A6CC3 /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1374,11 +1396,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB1815EA15D21469007A6CC3 /* Cocoa.framework in Frameworks */,
AB1815EB15D21469007A6CC3 /* OpenGL.framework in Frameworks */,
AB1815EC15D21469007A6CC3 /* AudioUnit.framework in Frameworks */,
AB97D45116964DF2002AC11B /* Accelerate.framework in Frameworks */,
AB1815ED15D21469007A6CC3 /* AppKit.framework in Frameworks */,
AB1815EC15D21469007A6CC3 /* AudioUnit.framework in Frameworks */,
AB1815EA15D21469007A6CC3 /* Cocoa.framework in Frameworks */,
AB1815EE15D21469007A6CC3 /* Foundation.framework in Frameworks */,
AB1815EB15D21469007A6CC3 /* OpenGL.framework in Frameworks */,
AB1815EF15D21469007A6CC3 /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1387,9 +1410,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB18169015D214F2007A6CC3 /* Cocoa.framework in Frameworks */,
AB18169115D214F2007A6CC3 /* OpenGL.framework in Frameworks */,
AB97D45516964E26002AC11B /* Accelerate.framework in Frameworks */,
AB97D45616964E2D002AC11B /* AppKit.framework in Frameworks */,
AB18169215D214F2007A6CC3 /* AudioUnit.framework in Frameworks */,
AB18169015D214F2007A6CC3 /* Cocoa.framework in Frameworks */,
AB97D50916964E30002AC11B /* Foundation.framework in Frameworks */,
AB18169115D214F2007A6CC3 /* OpenGL.framework in Frameworks */,
AB97D58716964E34002AC11B /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1397,11 +1424,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ABFE42AD143E32F0009A3CCE /* Cocoa.framework in Frameworks */,
ABFE42AE143E32F0009A3CCE /* OpenGL.framework in Frameworks */,
ABFE42AF143E32F0009A3CCE /* AudioUnit.framework in Frameworks */,
AB97D45416964E14002AC11B /* Accelerate.framework in Frameworks */,
ABFE42B0143E32F0009A3CCE /* AppKit.framework in Frameworks */,
ABFE42AF143E32F0009A3CCE /* AudioUnit.framework in Frameworks */,
ABFE42AD143E32F0009A3CCE /* Cocoa.framework in Frameworks */,
ABFE42B1143E32F0009A3CCE /* Foundation.framework in Frameworks */,
ABFE42AE143E32F0009A3CCE /* OpenGL.framework in Frameworks */,
AB8FE48C14B6657D009E20B1 /* libz.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1444,6 +1472,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
AB97D29516964D01002AC11B /* Accelerate.framework */,
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
729BECEF0D9D581900ED561B /* AudioUnit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
@ -2914,6 +2943,7 @@
AB18134615D1FB4B007A6CC3 /* Platform.cpp in Sources */,
AB18134915D1FB4B007A6CC3 /* Util.cpp in Sources */,
AB18136E15D1FB73007A6CC3 /* arm_jit.cpp in Sources */,
AB751A681696535D00AFA00D /* OGLRender.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -577,6 +577,10 @@
AB73AA2E1507C9F500A310C8 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABC570D4134431DA00E7B0B1 /* OpenGL.framework */; };
AB73AA2F1507C9F500A310C8 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1914AACA9600E83E91 /* libz.dylib */; };
AB75226F14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns in Resources */ = {isa = PBXBuildFile; fileRef = AB75226D14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns */; };
AB97C554169646D1002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97C553169646D1002AC11B /* Accelerate.framework */; };
AB97D5E516964F3B002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97C553169646D1002AC11B /* Accelerate.framework */; };
AB97D60916964F48002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97C553169646D1002AC11B /* Accelerate.framework */; };
AB97D60C16964F54002AC11B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB97C553169646D1002AC11B /* Accelerate.framework */; };
ABA03570169127C000817C69 /* troubleshootingWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */; };
ABA03571169127C000817C69 /* troubleshootingWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */; };
ABA03572169127C000817C69 /* troubleshootingWindowDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */; };
@ -822,9 +826,9 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AB00E87A14205EAE00DE561F /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = translations/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
AB00E87D14205EBC00DE561F /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/MainMenu.xib; sourceTree = "<group>"; };
@ -918,6 +922,7 @@
AB901BE21420707800348EEC /* Chinese */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = Chinese; path = translations/Chinese.lproj/Localizable.strings; sourceTree = "<group>"; };
AB901BE31420707D00348EEC /* Norwegian */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = Norwegian; path = translations/Norwegian.lproj/Localizable.strings; sourceTree = "<group>"; };
AB901BE41420708200348EEC /* Romanian */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = Romanian; path = translations/Romanian.lproj/Localizable.strings; sourceTree = "<group>"; };
AB97C553169646D1002AC11B /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
AB9971CE134EDA0800531BA7 /* cocoa_globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_globals.h; sourceTree = "<group>"; };
ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = troubleshootingWindowDelegate.h; sourceTree = "<group>"; };
ABA0356F169127C000817C69 /* troubleshootingWindowDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = troubleshootingWindowDelegate.mm; sourceTree = "<group>"; };
@ -1212,6 +1217,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB97D60C16964F54002AC11B /* Accelerate.framework in Frameworks */,
AB2F3C3B15CF9C6000858373 /* AppKit.framework in Frameworks */,
AB2F3C3C15CF9C6000858373 /* AudioUnit.framework in Frameworks */,
AB2F3C3D15CF9C6000858373 /* Cocoa.framework in Frameworks */,
@ -1226,6 +1232,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB97C554169646D1002AC11B /* Accelerate.framework in Frameworks */,
AB711F771481C35F009011C8 /* AppKit.framework in Frameworks */,
AB711F751481C35F009011C8 /* AudioUnit.framework in Frameworks */,
AB711F741481C35F009011C8 /* Cocoa.framework in Frameworks */,
@ -1240,6 +1247,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB97D5E516964F3B002AC11B /* Accelerate.framework in Frameworks */,
AB73AA291507C9F500A310C8 /* AppKit.framework in Frameworks */,
AB73AA2A1507C9F500A310C8 /* AudioUnit.framework in Frameworks */,
AB73AA2B1507C9F500A310C8 /* Cocoa.framework in Frameworks */,
@ -1254,6 +1262,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB97D60916964F48002AC11B /* Accelerate.framework in Frameworks */,
ABAD103F15ACE7A00000EC47 /* AppKit.framework in Frameworks */,
ABAD104015ACE7A00000EC47 /* AudioUnit.framework in Frameworks */,
ABAD104115ACE7A00000EC47 /* Cocoa.framework in Frameworks */,
@ -1309,6 +1318,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
AB97C553169646D1002AC11B /* Accelerate.framework */,
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
ABC570D0134431CE00E7B0B1 /* AudioUnit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,

View File

@ -80,6 +80,9 @@
AB3ACC4314C24D5400D7D192 /* README.MAC in Resources */ = {isa = PBXBuildFile; fileRef = AB3ACC3D14C24D5400D7D192 /* README.MAC */; };
AB3E34C9134AF4500056477A /* cocoa_output.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB3E34C8134AF4500056477A /* cocoa_output.mm */; };
AB4676F314AB12D60002FF94 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB0A0D1914AACA9600E83E91 /* libz.dylib */; };
AB4FCEBD1692AB82000F498F /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB4FCEBC1692AB82000F498F /* Accelerate.framework */; };
AB4FCEBE1692AB82000F498F /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB4FCEBC1692AB82000F498F /* Accelerate.framework */; };
AB4FCEBF1692AB82000F498F /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB4FCEBC1692AB82000F498F /* Accelerate.framework */; };
AB58F32D1364F44B0074C376 /* cocoa_file.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB58F32C1364F44B0074C376 /* cocoa_file.mm */; };
AB64987C13ECC73800EE7DD2 /* FileTypeInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB64987B13ECC73800EE7DD2 /* FileTypeInfo.plist */; };
AB6FBEF6139B6258007BB045 /* slot1_retail_nand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB6FBEF5139B6258007BB045 /* slot1_retail_nand.cpp */; };
@ -559,9 +562,9 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* DeSmuME (Debug).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (Debug).app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB00E87A14205EAE00DE561F /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = translations/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@ -642,6 +645,7 @@
AB3ACC3D14C24D5400D7D192 /* README.MAC */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.MAC; path = ../../README.MAC; sourceTree = SOURCE_ROOT; };
AB3E34C7134AF4500056477A /* cocoa_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_output.h; sourceTree = "<group>"; };
AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = "<group>"; };
AB4FCEBC1692AB82000F498F /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
AB58F32B1364F44B0074C376 /* cocoa_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_file.h; sourceTree = "<group>"; };
AB58F32C1364F44B0074C376 /* cocoa_file.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_file.mm; sourceTree = "<group>"; };
AB64987B13ECC73800EE7DD2 /* FileTypeInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = FileTypeInfo.plist; sourceTree = "<group>"; };
@ -956,6 +960,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB4FCEBE1692AB82000F498F /* Accelerate.framework in Frameworks */,
ABC5720D1344346600E7B0B1 /* AppKit.framework in Frameworks */,
ABC570D1134431CE00E7B0B1 /* AudioUnit.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
@ -970,6 +975,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB4FCEBD1692AB82000F498F /* Accelerate.framework in Frameworks */,
AB796D6615CDCBA200C59155 /* AppKit.framework in Frameworks */,
AB796D6715CDCBA200C59155 /* AudioUnit.framework in Frameworks */,
AB796D6815CDCBA200C59155 /* Cocoa.framework in Frameworks */,
@ -984,6 +990,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB4FCEBF1692AB82000F498F /* Accelerate.framework in Frameworks */,
ABB3C6641501BF8A00E0C22E /* AppKit.framework in Frameworks */,
ABB3C6651501BF8A00E0C22E /* AudioUnit.framework in Frameworks */,
ABB3C6661501BF8A00E0C22E /* Cocoa.framework in Frameworks */,
@ -1040,6 +1047,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
AB4FCEBC1692AB82000F498F /* Accelerate.framework */,
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
ABC570D0134431CE00E7B0B1 /* AudioUnit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2011 Roger Manuel
Copyright (C) 2012 DeSmuME team
Copyright (C) 2013 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
@ -20,6 +20,7 @@
#import "cocoa_globals.h"
#import "types.h"
#include <Accelerate/Accelerate.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include "../version.h"
@ -343,7 +344,9 @@ FORCEINLINE uint32_t RGB888ToRGBA8888(const uint32_t color24)
Takes:
srcBuffer - Pointer to the source 16-bit RGBA5551 pixel buffer.
destBuffer - Pointer to the destination 32-bit RGBA8888 pixel buffer.
numberPixels - The number of pixels to copy.
Returns:
@ -365,13 +368,15 @@ void RGBA5551ToRGBA8888Buffer(const uint16_t *__restrict__ srcBuffer, uint32_t *
}
/********************************************************************************************
RGBA5551ToRGBA8888Buffer()
RGB888ToRGBA8888Buffer()
Copies a 24-bit RGB888 pixel buffer into a 32-bit RGBA8888 pixel buffer.
Takes:
srcBuffer - Pointer to the source 24-bit RGB888 pixel buffer.
destBuffer - Pointer to the destination 32-bit RGBA8888 pixel buffer.
numberPixels - The number of pixels to copy.
Returns:
@ -399,7 +404,9 @@ void RGB888ToRGBA8888Buffer(const uint32_t *__restrict__ srcBuffer, uint32_t *__
Takes:
normalBounds - The rectangular bounds of the normal 2D surface.
scalar - The scalar used to transform the 2D surface.
angleDegrees - The rotation angle, in degrees, to transform the 2D surface.
Returns:
@ -412,80 +419,120 @@ void RGB888ToRGBA8888Buffer(const uint32_t *__restrict__ srcBuffer, uint32_t *__
********************************************************************************************/
NSSize GetTransformedBounds(NSSize normalBounds, double scalar, double angleDegrees)
{
const double angleRadians = angleDegrees * (M_PI/180.0);
// The points are as follows:
//
// (x[3], y[3]) (x[2], y[2])
//
//
//
// (x[0], y[0]) (x[1], y[1])
// Do our scale and rotate transformations.
#ifdef __ACCELERATE__
// Note that although we only need to calculate 3 points, we include 4 points
// here because Accelerate prefers 16-byte alignment.
double x[] = {0.0, normalBounds.width, normalBounds.width, 0.0};
double y[] = {0.0, 0.0, normalBounds.height, normalBounds.height};
cblas_drot(4, x, 1, y, 1, scalar * cos(angleRadians), scalar * sin(angleRadians));
#else // Keep a C-version of this transformation for reference purposes.
const double w = scalar * normalBounds.width;
const double h = scalar * normalBounds.height;
const double d = hypot(w, h);
const double dAngle = atan2(h, w);
const double px = w * cos(angleRadians);
const double py = w * sin(angleRadians);
const double qx = d * cos(dAngle + angleRadians);
const double qy = d * sin(dAngle + angleRadians);
const double rx = h * cos((M_PI/2.0) + angleRadians);
const double ry = h * sin((M_PI/2.0) + angleRadians);
const double x[] = {0.0, px, qx, rx};
const double y[] = {0.0, py, qy, ry};
#endif
// Determine the transformed width, which is dependent on the location of
// the x-coordinate of point (x[2], y[2]).
NSSize transformBounds = {0.0, 0.0};
double angleRadians = angleDegrees * (M_PI/180.0);
double w = scalar * normalBounds.width;
double h = scalar * normalBounds.height;
double d = hypot(w, h);
double dAngle = atan2(h, w);
double px = d * cos(dAngle + angleRadians);
double py = d * sin(dAngle + angleRadians);
double qx = h * cos((M_PI/2.0) + angleRadians);
double qy = h * sin((M_PI/2.0) + angleRadians);
double rx = w * cos(angleRadians);
double ry = w * sin(angleRadians);
double transformWidth = px;
double transformHeight = py;
// Determine the transform width, which is dependent on the location of
// the x-coordinate of point p.
if (px > 0.0)
if (x[2] > 0.0)
{
transformWidth = px;
if (px < qx)
if (x[2] < x[3])
{
transformWidth = qx - rx;
transformBounds.width = x[3] - x[1];
}
else if (px < rx)
else if (x[2] < x[1])
{
transformWidth = rx - qx;
transformBounds.width = x[1] - x[3];
}
else
{
transformBounds.width = x[2];
}
}
else if (px < 0.0)
else if (x[2] < 0.0)
{
transformWidth = -px;
if (px > qx)
if (x[2] > x[3])
{
transformWidth = -(qx - rx);
transformBounds.width = -(x[3] - x[1]);
}
else if (px > rx)
else if (x[2] > x[1])
{
transformWidth = -(rx - qx);
transformBounds.width = -(x[1] - x[3]);
}
else
{
transformBounds.width = -x[2];
}
}
else
{
transformBounds.width = abs(x[1] - x[3]);
}
// Determine the transform height, which is dependent on the location of
// the y-coordinate of point p.
if (py > 0.0)
// Determine the transformed height, which is dependent on the location of
// the y-coordinate of point (x[2], y[2]).
if (y[2] > 0.0)
{
transformHeight = py;
if (py < qy)
if (y[2] < y[3])
{
transformHeight = qy - ry;
transformBounds.height = y[3] - y[1];
}
else if (py < ry)
else if (y[2] < y[1])
{
transformHeight = ry - qy;
transformBounds.height = y[1] - y[3];
}
else
{
transformBounds.height = y[2];
}
}
else if (py < 0.0)
else if (y[2] < 0.0)
{
transformHeight = -py;
if (py > qy)
if (y[2] > y[3])
{
transformHeight = -(qy - ry);
transformBounds.height = -(y[3] - y[1]);
}
else if (py > ry)
else if (y[2] > y[1])
{
transformHeight = -(ry - qy);
transformBounds.height = -(y[1] - y[3]);
}
else
{
transformBounds.height = -y[2];
}
}
transformBounds.width = transformWidth;
transformBounds.height = transformHeight;
else
{
transformBounds.height = abs(y[3] - y[1]);
}
return transformBounds;
}
@ -498,8 +545,11 @@ NSSize GetTransformedBounds(NSSize normalBounds, double scalar, double angleDegr
Takes:
normalBoundsWidth - The rectangular width of the normal 2D surface.
normalBoundsHeight - The rectangular height of the normal 2D surface.
keepInBoundsWidth - The rectangular width of the keep in 2D surface.
keepInBoundsHeight - The rectangular height of the keep in 2D surface.
Returns:
@ -512,35 +562,10 @@ NSSize GetTransformedBounds(NSSize normalBounds, double scalar, double angleDegr
********************************************************************************************/
double GetMaxScalarInBounds(double normalBoundsWidth, double normalBoundsHeight, double keepInBoundsWidth, double keepInBoundsHeight)
{
double maxX;
double maxY;
double maxS;
const double maxX = (normalBoundsWidth <= 0.0) ? 0.0 : keepInBoundsWidth / normalBoundsWidth;
const double maxY = (normalBoundsHeight <= 0.0) ? 0.0 : keepInBoundsHeight / normalBoundsHeight;
if (normalBoundsWidth <= 0.0)
{
maxX = 0.0;
}
else
{
maxX = keepInBoundsWidth / normalBoundsWidth;
}
if (normalBoundsHeight <= 0.0)
{
maxY = 0.0;
}
else
{
maxY = keepInBoundsHeight / normalBoundsHeight;
}
maxS = maxY;
if (maxX < maxY)
{
maxS = maxX;
}
return maxS;
return (maxX <= maxY) ? maxX : maxY;
}
/********************************************************************************************
@ -550,9 +575,13 @@ double GetMaxScalarInBounds(double normalBoundsWidth, double normalBoundsHeight,
Takes:
transformedPt - A point as it exists on a 2D transformed surface.
normalBounds - The rectangular bounds of the normal 2D surface.
transformedBounds - The rectangular bounds of the transformed 2D surface.
scalar - The scalar used on the transformed 2D surface.
angleDegrees - The rotation angle, in degrees, of the transformed 2D surface.
Returns:
@ -563,29 +592,21 @@ double GetMaxScalarInBounds(double normalBoundsWidth, double normalBoundsHeight,
********************************************************************************************/
NSPoint GetNormalPointFromTransformedPoint(NSPoint transformedPt, NSSize normalBounds, NSSize transformBounds, double scalar, double angleDegrees)
{
double angleRadians = angleDegrees * (M_PI/180.0);
double transformedX = 0.0;
double transformedY = 0.0;
double r = 0.0;
double theta = 0.0;
double normalizedAngle = 0.0;
double normalizedX = 0.0;
double normalizedY = 0.0;
NSPoint normalizedPt = {transformedPt.x, transformedPt.y};
const double angleRadians = angleDegrees * (M_PI/180.0);
// Get the coordinates of the transformed point and translate the coordinate
// system so that the origin becomes the center.
transformedX = transformedPt.x - (transformBounds.width / 2.0);
transformedY = transformedPt.y - (transformBounds.height / 2.0);
const double transformedX = transformedPt.x - (transformBounds.width / 2.0);
const double transformedY = transformedPt.y - (transformBounds.height / 2.0);
// Perform rect-polar conversion.
// Get the radius r with respect to the origin.
r = hypot(transformedX, transformedY);
const double r = hypot(transformedX, transformedY);
// Get the angle theta with respect to the origin.
double theta = 0.0;
if (transformedX == 0.0)
{
if (transformedY > 0.0)
@ -613,13 +634,12 @@ NSPoint GetNormalPointFromTransformedPoint(NSPoint transformedPt, NSSize normalB
// Get the normalized angle and use it to rotate about the origin.
// Then do polar-rect conversion and translate back to transformed coordinates
// with a 0 degree rotation.
normalizedAngle = theta - angleRadians;
normalizedX = (r * cos(normalizedAngle)) + (normalBounds.width * scalar / 2.0);
normalizedY = (r * sin(normalizedAngle)) + (normalBounds.height * scalar / 2.0);
const double normalizedAngle = theta - angleRadians;
const double normalizedX = (r * cos(normalizedAngle)) + (normalBounds.width * scalar / 2.0);
const double normalizedY = (r * sin(normalizedAngle)) + (normalBounds.height * scalar / 2.0);
// Scale the location to get a one-to-one correlation to normal coordinates.
normalizedPt.x = (CGFloat)(normalizedX / scalar);
normalizedPt.y = (CGFloat)(normalizedY / scalar);
const NSPoint normalizedPt = { (CGFloat)(normalizedX / scalar), (CGFloat)(normalizedY / scalar) };
return normalizedPt;
}

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2012 DeSmuME team
Copyright (C) 2013 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
@ -18,8 +18,8 @@
#ifndef MACOSX_10_4_COMPATIBILITY_H
#define MACOSX_10_4_COMPATIBILITY_H
// Taken from NSObjCRuntime.h of the Mac OS X 10.5 SDK.
// Defines NSInteger and NSUInteger for Mac OS X 10.4 and earlier.
// Taken from NSObjCRuntime.h of the Mac OS X v10.5 SDK.
// Defines NSInteger and NSUInteger for Mac OS X v10.4 and earlier.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED 1
typedef int NSInteger;
@ -29,8 +29,8 @@ typedef unsigned int NSUInteger;
#define NSUIntegerMax ULONG_MAX
#endif
// Taken from CIVector.h of the Mac OS X 10.5 SDK.
// Defines CGFloat for Mac OS X 10.4 and earlier.
// Taken from CIVector.h of the Mac OS X v10.5 SDK.
// Defines CGFloat for Mac OS X v10.4 and earlier.
#ifndef CGFLOAT_DEFINED
#define CGFLOAT_DEFINED 1
typedef float CGFloat;
@ -39,4 +39,10 @@ typedef float CGFloat;
#define CGFLOAT_IS_DOUBLE 0
#endif
// Overrides for GL_EXT_framebuffer_blit (not available in Mac OS X v10.4)
#if !defined(GL_ARB_framebuffer_object) || !defined(GL_EXT_framebuffer_blit)
#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
#define glBlitFramebufferEXT(a, b, c, d, e, f, g, h, i, j)
#endif
#endif // MACOSX_10_4_COMPATIBILITY_H

View File

@ -1,7 +1,7 @@
/*
Copyright (C) 2007 Jeff Bland
Copyright (C) 2011 Roger Manuel
Copyright (C) 2012 DeSmuME team
Copyright (C) 2013 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
@ -50,9 +50,7 @@ volatile bool execute = true;
GPU3DInterface *core3DList[] = {
&gpu3DNull,
&gpu3DRasterize,
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
&gpu3Dgl,
#endif
NULL
};
@ -176,7 +174,7 @@ bool OSXOpenGLRendererInit()
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)8,
NSOpenGLPFAOffScreen,
NSOpenGLPFAAccelerated,
(NSOpenGLPixelFormatAttribute)0
};
@ -238,13 +236,10 @@ bool OSXOpenGLRendererInit()
{
[context makeCurrentContext];
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
oglrender_init = &OSXOpenGLRendererInit;
//NDS_3D_SetDriver(CORE3DLIST_OPENGL);
NDS_3D_SetDriver(CORE3DLIST_SWRASTERIZE);
#else
NDS_3D_SetDriver(CORE3DLIST_SWRASTERIZE);
#endif
NDS_3D_SetDriver(CORE3DLIST_OPENGL);
//NDS_3D_SetDriver(CORE3DLIST_SWRASTERIZE);
if(!gpu3D->NDS_3D_Init())
[CocoaDSUtil quickDialogUsingTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Unable to initialize OpenGL components", nil)];
}

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2007 Jeff Bland
Copyright (C) 2012 DeSmuME team
Copyright (C) 2013 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
@ -211,7 +211,7 @@ void joinThread_gdb(void *thread_handle)
- (IBAction) bugReport:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_SITE]];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_REPORT_SITE]];
}
- (void) setupSlotMenuItems