From e55df3de9641b4686c4e5e05fb3917bf432d22a8 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Fri, 25 Aug 2017 17:01:31 -0400 Subject: [PATCH] build SheepShaver against SDL2, when using its Xcode 8 project file --- BasiliskII/src/SDL/video_sdl.cpp | 22 +--- .../project.pbxproj | 121 ++++++++++++++++-- SheepShaver/src/Unix/main_unix.cpp | 11 ++ 3 files changed, 120 insertions(+), 34 deletions(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 31da853a..babc1750 100755 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -136,7 +136,7 @@ static SDL_Renderer * sdl_renderer = NULL; // Handle to SDL2 renderer static SDL_threadID sdl_renderer_thread_id = 0; // Thread ID where the SDL_renderer was created, and SDL_renderer ops should run (for compatibility w/ d3d9) static SDL_Texture * sdl_texture = NULL; // Handle to a GPU texture, with which to draw guest_surface to static int screen_depth; // Depth of current screen -//static SDL_Cursor *sdl_cursor; // Copy of Mac cursor +static SDL_Cursor *sdl_cursor = NULL; // Copy of Mac cursor static SDL_Palette *sdl_palette = NULL; // Color palette to be used as CLUT and gamma table static bool sdl_palette_changed = false; // Flag: Palette changed, redraw thread must set new colors static bool toggle_fullscreen = false; @@ -1728,25 +1728,7 @@ bool video_can_change_cursor(void) if (display_type != DISPLAY_WINDOW) return false; -#if defined(__APPLE__) - static char driver[] = "Quartz?"; - static int quartzok = -1; - - if (quartzok < 0) { - if (SDL_VideoDriverName(driver, sizeof driver) == NULL || strncmp(driver, "Quartz", sizeof driver)) - quartzok = true; - else { - // Quartz driver bug prevents cursor changing in SDL 1.2.11 to 1.2.14. - const SDL_version *vp = SDL_Linked_Version(); - int version = SDL_VERSIONNUM(vp->major, vp->minor, vp->patch); - quartzok = (version <= SDL_VERSIONNUM(1, 2, 10) || version >= SDL_VERSIONNUM(1, 2, 15)); - } - } - - return quartzok; -#else return true; -#endif } #endif @@ -1781,7 +1763,7 @@ void video_set_cursor(void) if (visible) { int x, y; SDL_GetMouseState(&x, &y); - SDL_WarpMouse(x, y); + SDL_WarpMouseGlobal(x, y); } } } diff --git a/SheepShaver/src/MacOSX/SheepShaver_Xcode8.xcodeproj/project.pbxproj b/SheepShaver/src/MacOSX/SheepShaver_Xcode8.xcodeproj/project.pbxproj index bdde7b99..61a7539c 100644 --- a/SheepShaver/src/MacOSX/SheepShaver_Xcode8.xcodeproj/project.pbxproj +++ b/SheepShaver/src/MacOSX/SheepShaver_Xcode8.xcodeproj/project.pbxproj @@ -31,7 +31,6 @@ 0846E4C114B1268B00574779 /* jit-cache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CDCD14A99EEF000B1711 /* jit-cache.cpp */; }; 0846E4C214B1269600574779 /* basic-dyngen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CDC514A99EEF000B1711 /* basic-dyngen.cpp */; }; 0846E51314B128ED00574779 /* sheepshaver_glue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CDBB14A99EEF000B1711 /* sheepshaver_glue.cpp */; }; - 0846E65414B513CE00574779 /* SDL.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 0856D17414A9A1A2000B1711 /* SDL.framework */; }; 0856CFC114A99EF0000B1711 /* adb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CD4B14A99EEF000B1711 /* adb.cpp */; }; 0856CFC214A99EF0000B1711 /* audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CD4C14A99EEF000B1711 /* audio.cpp */; }; 0856CFE214A99EF0000B1711 /* cdrom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CD7814A99EEF000B1711 /* cdrom.cpp */; }; @@ -54,7 +53,6 @@ 0856D06014A99EF1000B1711 /* rsrc_patches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE8D14A99EF0000B1711 /* rsrc_patches.cpp */; }; 0856D06114A99EF1000B1711 /* scsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE8E14A99EF0000B1711 /* scsi.cpp */; }; 0856D06214A99EF1000B1711 /* audio_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE9014A99EF0000B1711 /* audio_sdl.cpp */; }; - 0856D06414A99EF1000B1711 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE9314A99EF0000B1711 /* SDLMain.m */; }; 0856D06514A99EF1000B1711 /* video_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE9414A99EF0000B1711 /* video_sdl.cpp */; }; 0856D06614A99EF1000B1711 /* serial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE9514A99EF0000B1711 /* serial.cpp */; }; 0856D06714A99EF1000B1711 /* bootp.c in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE9714A99EF0000B1711 /* bootp.c */; }; @@ -94,7 +92,6 @@ 0856D11714A99EF1000B1711 /* user_strings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CF7714A99EF0000B1711 /* user_strings.cpp */; }; 0856D11814A99EF1000B1711 /* video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CF7814A99EF0000B1711 /* video.cpp */; }; 0856D13F14A99EF1000B1711 /* xpram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CFC014A99EF0000B1711 /* xpram.cpp */; }; - 0856D17514A9A1A2000B1711 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0856D17414A9A1A2000B1711 /* SDL.framework */; }; 0856D21514A9A6C6000B1711 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0856D21414A9A6C6000B1711 /* IOKit.framework */; }; 0856D33514A9A704000B1711 /* VMSettingsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 0856D30714A9A704000B1711 /* VMSettingsWindow.nib */; }; 0856D33914A9A704000B1711 /* VMSettingsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0856D31214A9A704000B1711 /* VMSettingsController.mm */; }; @@ -105,6 +102,8 @@ 08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */; }; 08CD42E814B7B8AA009CA2A2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42E714B7B8AA009CA2A2 /* Carbon.framework */; }; 08E877521E0640E800A90A2C /* clip_macosx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0856CE2C14A99EF0000B1711 /* clip_macosx.cpp */; }; + 7539EDF51F50C40100454E81 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7539EDE91F50C3D600454E81 /* SDL2.framework */; }; + 7539EDF61F50C40100454E81 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 7539EDE91F50C3D600454E81 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; A7B1921418C35D4700791D8D /* DiskType.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B1921318C35D4700791D8D /* DiskType.m */; }; /* End PBXBuildFile section */ @@ -123,6 +122,41 @@ remoteGlobalIDString = 0846E49914B124DE00574779; remoteInfo = kpx_cpu; }; + 7539EDE81F50C3D600454E81 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF66C0761BA81005FE872; + remoteInfo = Framework; + }; + 7539EDEA1F50C3D600454E81 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF6B30761BA81005FE872; + remoteInfo = "Static Library"; + }; + 7539EDEC1F50C3D600454E81 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DB31407717554B71006C0E22; + remoteInfo = "Shared Library"; + }; + 7539EDEE1F50C3D600454E81 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BECDF6BE0761BA81005FE872; + remoteInfo = "Standard DMG"; + }; + 7539EDF71F50C40100454E81 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = BECDF5FE0761BA81005FE872; + remoteInfo = Framework; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -132,7 +166,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 0846E65414B513CE00574779 /* SDL.framework in Copy Frameworks */, + 7539EDF61F50C40100454E81 /* SDL2.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -276,8 +310,6 @@ 0856CE8E14A99EF0000B1711 /* scsi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scsi.cpp; path = ../scsi.cpp; sourceTree = SOURCE_ROOT; }; 0856CE9014A99EF0000B1711 /* audio_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audio_sdl.cpp; sourceTree = ""; }; 0856CE9114A99EF0000B1711 /* keycodes */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keycodes; sourceTree = ""; }; - 0856CE9214A99EF0000B1711 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = ""; }; - 0856CE9314A99EF0000B1711 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = ""; }; 0856CE9414A99EF0000B1711 /* video_sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_sdl.cpp; sourceTree = ""; }; 0856CE9514A99EF0000B1711 /* serial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = serial.cpp; path = ../serial.cpp; sourceTree = SOURCE_ROOT; }; 0856CE9714A99EF0000B1711 /* bootp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bootp.c; sourceTree = ""; }; @@ -348,7 +380,6 @@ 0856CF7714A99EF0000B1711 /* user_strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = user_strings.cpp; path = ../user_strings.cpp; sourceTree = SOURCE_ROOT; }; 0856CF7814A99EF0000B1711 /* video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = video.cpp; path = ../video.cpp; sourceTree = SOURCE_ROOT; }; 0856CFC014A99EF0000B1711 /* xpram.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xpram.cpp; path = ../xpram.cpp; sourceTree = SOURCE_ROOT; }; - 0856D17414A9A1A2000B1711 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; 0856D21414A9A6C6000B1711 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 0856D30814A9A704000B1711 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/VMSettingsWindow.nib; sourceTree = ""; }; 0856D31114A9A704000B1711 /* VMSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMSettingsController.h; sourceTree = ""; }; @@ -377,6 +408,7 @@ 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 08CD42E714B7B8AA009CA2A2 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 08D93A15159FE174003B04EC /* clip_macosx64.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clip_macosx64.mm; sourceTree = ""; }; + 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../../../external/SDL/Xcode/SDL/SDL.xcodeproj; sourceTree = ""; }; A7B1921218C35D4700791D8D /* DiskType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskType.h; sourceTree = ""; }; A7B1921318C35D4700791D8D /* DiskType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiskType.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -400,10 +432,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0856D17514A9A1A2000B1711 /* SDL.framework in Frameworks */, 0856D21514A9A6C6000B1711 /* IOKit.framework in Frameworks */, 08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */, 08CD42E814B7B8AA009CA2A2 /* Carbon.framework in Frameworks */, + 7539EDF51F50C40100454E81 /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -435,6 +467,7 @@ 0856CCAC14A99DE0000B1711 = { isa = PBXGroup; children = ( + 7539EDE01F50C3BE00454E81 /* external */, 0856CCC814A99E30000B1711 /* Sources */, 08CD42DF14B7B865009CA2A2 /* Frameworks */, 0856CCC214A99E1C000B1711 /* Products */, @@ -735,8 +768,6 @@ children = ( 0856CE9014A99EF0000B1711 /* audio_sdl.cpp */, 0856CE9114A99EF0000B1711 /* keycodes */, - 0856CE9214A99EF0000B1711 /* SDLMain.h */, - 0856CE9314A99EF0000B1711 /* SDLMain.m */, 0856CE9414A99EF0000B1711 /* video_sdl.cpp */, ); name = SDL; @@ -872,11 +903,29 @@ 08CD42E714B7B8AA009CA2A2 /* Carbon.framework */, 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */, 0856D21414A9A6C6000B1711 /* IOKit.framework */, - 0856D17414A9A1A2000B1711 /* SDL.framework */, ); name = Frameworks; sourceTree = ""; }; + 7539EDE01F50C3BE00454E81 /* external */ = { + isa = PBXGroup; + children = ( + 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */, + ); + name = external; + sourceTree = ""; + }; + 7539EDE21F50C3D600454E81 /* Products */ = { + isa = PBXGroup; + children = ( + 7539EDE91F50C3D600454E81 /* SDL2.framework */, + 7539EDEB1F50C3D600454E81 /* libSDL2.a */, + 7539EDED1F50C3D600454E81 /* libSDL2.dylib */, + 7539EDEF1F50C3D600454E81 /* Standard DMG */, + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -947,6 +996,7 @@ dependencies = ( 0846E4A714B1253500574779 /* PBXTargetDependency */, 082AC26814AA5A4800071F5E /* PBXTargetDependency */, + 7539EDF81F50C40100454E81 /* PBXTargetDependency */, ); name = SheepShaver; productName = SheepShaver; @@ -974,6 +1024,12 @@ mainGroup = 0856CCAC14A99DE0000B1711; productRefGroup = 0856CCC214A99E1C000B1711 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 7539EDE21F50C3D600454E81 /* Products */; + ProjectRef = 7539EDE11F50C3D600454E81 /* SDL.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 0856CCC014A99E1C000B1711 /* SheepShaver */, @@ -983,6 +1039,37 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 7539EDE91F50C3D600454E81 /* SDL2.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = SDL2.framework; + remoteRef = 7539EDE81F50C3D600454E81 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7539EDEB1F50C3D600454E81 /* libSDL2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.a; + remoteRef = 7539EDEA1F50C3D600454E81 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7539EDED1F50C3D600454E81 /* libSDL2.dylib */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.dylib"; + path = libSDL2.dylib; + remoteRef = 7539EDEC1F50C3D600454E81 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7539EDEF1F50C3D600454E81 /* Standard DMG */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = "Standard DMG"; + remoteRef = 7539EDEE1F50C3D600454E81 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 0856CCBD14A99E1C000B1711 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1096,7 +1183,6 @@ 0856D06014A99EF1000B1711 /* rsrc_patches.cpp in Sources */, 0856D06114A99EF1000B1711 /* scsi.cpp in Sources */, 0856D06214A99EF1000B1711 /* audio_sdl.cpp in Sources */, - 0856D06414A99EF1000B1711 /* SDLMain.m in Sources */, 0856D06514A99EF1000B1711 /* video_sdl.cpp in Sources */, 0856D06614A99EF1000B1711 /* serial.cpp in Sources */, 0856D06714A99EF1000B1711 /* bootp.c in Sources */, @@ -1161,6 +1247,11 @@ target = 0846E49914B124DE00574779 /* kpx_cpu */; targetProxy = 0846E4A614B1253500574779 /* PBXContainerItemProxy */; }; + 7539EDF81F50C40100454E81 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Framework; + targetProxy = 7539EDF71F50C40100454E81 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -1337,7 +1428,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", ./config/, ../Unix, ../MacOSX/Launcher, @@ -1350,6 +1441,7 @@ INFOPLIST_PREFIX_HEADER = ""; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = ""; OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; @@ -1394,7 +1486,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( - /Library/Frameworks/SDL.framework/Versions/A/Headers/, + "$(BUILT_PRODUCTS_DIR)/SDL2.framework/Headers", ./config/, ../Unix, ../MacOSX/Launcher, @@ -1408,6 +1500,7 @@ INFOPLIST_PREFIX_HEADER = ""; INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = ""; OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index 3d0ee43e..a99e5b53 100644 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -754,6 +754,17 @@ int main(int argc, char **argv) } break; } + +#if defined(__APPLE__) && defined(__MACH__) + // Mac OS X likes to pass in various options of its own, when launching an app. + // Attempt to ignore these. + const char * mac_psn_prefix = "-psn_"; + if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { + argv[i] = NULL; + } else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) { + argv[i] = NULL; + } +#endif } // Remove processed arguments