playmus/playwave XCode: remove SDL-1.2 leftover SDLMain.*. fix SDL2[_mixer] framework names.
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 06 Oct 2019 17:37:02 +0300
changeset 95415b7b98a85c7
parent 952 c951ed864a0f
child 955 865a65fcd09a
playmus/playwave XCode: remove SDL-1.2 leftover SDLMain.*. fix SDL2[_mixer] framework names.
Xcode/playmus/SDLMain.h
Xcode/playmus/SDLMain.m
Xcode/playmus/playmus.xcodeproj/project.pbxproj
Xcode/playwave/SDLMain.h
Xcode/playwave/SDLMain.m
Xcode/playwave/playwave.xcodeproj/project.pbxproj
     1.1 --- a/Xcode/playmus/SDLMain.h	Sun Oct 06 12:55:01 2019 +0300
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,16 +0,0 @@
     1.4 -/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
     1.5 -       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
     1.6 -       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
     1.7 -
     1.8 -    Feel free to customize this file to suit your needs
     1.9 -*/
    1.10 -
    1.11 -#ifndef _SDLMain_h_
    1.12 -#define _SDLMain_h_
    1.13 -
    1.14 -#import <Cocoa/Cocoa.h>
    1.15 -
    1.16 -@interface SDLMain : NSObject
    1.17 -@end
    1.18 -
    1.19 -#endif /* _SDLMain_h_ */
     2.1 --- a/Xcode/playmus/SDLMain.m	Sun Oct 06 12:55:01 2019 +0300
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,383 +0,0 @@
     2.4 -/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
     2.5 -       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
     2.6 -       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
     2.7 -
     2.8 -    Feel free to customize this file to suit your needs
     2.9 -*/
    2.10 -
    2.11 -#include <SDL/SDL.h>
    2.12 -#include "SDLMain.h"
    2.13 -#include <sys/param.h> /* for MAXPATHLEN */
    2.14 -#include <unistd.h>
    2.15 -
    2.16 -/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
    2.17 - but the method still is there and works. To avoid warnings, we declare
    2.18 - it ourselves here. */
    2.19 -@interface NSApplication(SDL_Missing_Methods)
    2.20 -- (void)setAppleMenu:(NSMenu *)menu;
    2.21 -@end
    2.22 -
    2.23 -/* Use this flag to determine whether we use SDLMain.nib or not */
    2.24 -#define     SDL_USE_NIB_FILE    0
    2.25 -
    2.26 -/* Use this flag to determine whether we use CPS (docking) or not */
    2.27 -#define     SDL_USE_CPS     1
    2.28 -#ifdef SDL_USE_CPS
    2.29 -/* Portions of CPS.h */
    2.30 -typedef struct CPSProcessSerNum
    2.31 -{
    2.32 -    UInt32      lo;
    2.33 -    UInt32      hi;
    2.34 -} CPSProcessSerNum;
    2.35 -
    2.36 -extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
    2.37 -extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    2.38 -extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
    2.39 -
    2.40 -#endif /* SDL_USE_CPS */
    2.41 -
    2.42 -static int    gArgc;
    2.43 -static char  **gArgv;
    2.44 -static BOOL   gFinderLaunch;
    2.45 -static BOOL   gCalledAppMainline = FALSE;
    2.46 -
    2.47 -static NSString *getApplicationName(void)
    2.48 -{
    2.49 -    const NSDictionary *dict;
    2.50 -    NSString *appName = 0;
    2.51 -
    2.52 -    /* Determine the application name */
    2.53 -    dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    2.54 -    if (dict)
    2.55 -        appName = [dict objectForKey: @"CFBundleName"];
    2.56 -
    2.57 -    if (![appName length])
    2.58 -        appName = [[NSProcessInfo processInfo] processName];
    2.59 -
    2.60 -    return appName;
    2.61 -}
    2.62 -
    2.63 -#if SDL_USE_NIB_FILE
    2.64 -/* A helper category for NSString */
    2.65 -@interface NSString (ReplaceSubString)
    2.66 -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
    2.67 -@end
    2.68 -#endif
    2.69 -
    2.70 -@interface SDLApplication : NSApplication
    2.71 -@end
    2.72 -
    2.73 -@implementation SDLApplication
    2.74 -/* Invoked from the Quit menu item */
    2.75 -- (void)terminate:(id)sender
    2.76 -{
    2.77 -    /* Post a SDL_QUIT event */
    2.78 -    SDL_Event event;
    2.79 -    event.type = SDL_QUIT;
    2.80 -    SDL_PushEvent(&event);
    2.81 -}
    2.82 -@end
    2.83 -
    2.84 -/* The main class of the application, the application's delegate */
    2.85 -@implementation SDLMain
    2.86 -
    2.87 -/* Set the working directory to the .app's parent directory */
    2.88 -- (void) setupWorkingDirectory:(BOOL)shouldChdir
    2.89 -{
    2.90 -    if (shouldChdir)
    2.91 -    {
    2.92 -        char parentdir[MAXPATHLEN];
    2.93 -        CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
    2.94 -        CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
    2.95 -        if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
    2.96 -            chdir(parentdir);   /* chdir to the binary app's parent */
    2.97 -        }
    2.98 -        CFRelease(url);
    2.99 -        CFRelease(url2);
   2.100 -    }
   2.101 -}
   2.102 -
   2.103 -#if SDL_USE_NIB_FILE
   2.104 -
   2.105 -/* Fix menu to contain the real app name instead of "SDL App" */
   2.106 -- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
   2.107 -{
   2.108 -    NSRange aRange;
   2.109 -    NSEnumerator *enumerator;
   2.110 -    NSMenuItem *menuItem;
   2.111 -
   2.112 -    aRange = [[aMenu title] rangeOfString:@"SDL App"];
   2.113 -    if (aRange.length != 0)
   2.114 -        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
   2.115 -
   2.116 -    enumerator = [[aMenu itemArray] objectEnumerator];
   2.117 -    while ((menuItem = [enumerator nextObject]))
   2.118 -    {
   2.119 -        aRange = [[menuItem title] rangeOfString:@"SDL App"];
   2.120 -        if (aRange.length != 0)
   2.121 -            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
   2.122 -        if ([menuItem hasSubmenu])
   2.123 -            [self fixMenu:[menuItem submenu] withAppName:appName];
   2.124 -    }
   2.125 -    [ aMenu sizeToFit ];
   2.126 -}
   2.127 -
   2.128 -#else
   2.129 -
   2.130 -static void setApplicationMenu(void)
   2.131 -{
   2.132 -    /* warning: this code is very odd */
   2.133 -    NSMenu *appleMenu;
   2.134 -    NSMenuItem *menuItem;
   2.135 -    NSString *title;
   2.136 -    NSString *appName;
   2.137 -
   2.138 -    appName = getApplicationName();
   2.139 -    appleMenu = [[NSMenu alloc] initWithTitle:@""];
   2.140 -
   2.141 -    /* Add menu items */
   2.142 -    title = [@"About " stringByAppendingString:appName];
   2.143 -    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
   2.144 -
   2.145 -    [appleMenu addItem:[NSMenuItem separatorItem]];
   2.146 -
   2.147 -    title = [@"Hide " stringByAppendingString:appName];
   2.148 -    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
   2.149 -
   2.150 -    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
   2.151 -    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
   2.152 -
   2.153 -    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
   2.154 -
   2.155 -    [appleMenu addItem:[NSMenuItem separatorItem]];
   2.156 -
   2.157 -    title = [@"Quit " stringByAppendingString:appName];
   2.158 -    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
   2.159 -
   2.160 -
   2.161 -    /* Put menu into the menubar */
   2.162 -    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
   2.163 -    [menuItem setSubmenu:appleMenu];
   2.164 -    [[NSApp mainMenu] addItem:menuItem];
   2.165 -
   2.166 -    /* Tell the application object that this is now the application menu */
   2.167 -    [NSApp setAppleMenu:appleMenu];
   2.168 -
   2.169 -    /* Finally give up our references to the objects */
   2.170 -    [appleMenu release];
   2.171 -    [menuItem release];
   2.172 -}
   2.173 -
   2.174 -/* Create a window menu */
   2.175 -static void setupWindowMenu(void)
   2.176 -{
   2.177 -    NSMenu      *windowMenu;
   2.178 -    NSMenuItem  *windowMenuItem;
   2.179 -    NSMenuItem  *menuItem;
   2.180 -
   2.181 -    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
   2.182 -
   2.183 -    /* "Minimize" item */
   2.184 -    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
   2.185 -    [windowMenu addItem:menuItem];
   2.186 -    [menuItem release];
   2.187 -
   2.188 -    /* Put menu into the menubar */
   2.189 -    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
   2.190 -    [windowMenuItem setSubmenu:windowMenu];
   2.191 -    [[NSApp mainMenu] addItem:windowMenuItem];
   2.192 -
   2.193 -    /* Tell the application object that this is now the window menu */
   2.194 -    [NSApp setWindowsMenu:windowMenu];
   2.195 -
   2.196 -    /* Finally give up our references to the objects */
   2.197 -    [windowMenu release];
   2.198 -    [windowMenuItem release];
   2.199 -}
   2.200 -
   2.201 -/* Replacement for NSApplicationMain */
   2.202 -static void CustomApplicationMain (int argc, char **argv)
   2.203 -{
   2.204 -    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
   2.205 -    SDLMain             *sdlMain;
   2.206 -
   2.207 -    /* Ensure the application object is initialised */
   2.208 -    [SDLApplication sharedApplication];
   2.209 -
   2.210 -#ifdef SDL_USE_CPS
   2.211 -    {
   2.212 -        CPSProcessSerNum PSN;
   2.213 -        /* Tell the dock about us */
   2.214 -        if (!CPSGetCurrentProcess(&PSN))
   2.215 -            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
   2.216 -                if (!CPSSetFrontProcess(&PSN))
   2.217 -                    [SDLApplication sharedApplication];
   2.218 -    }
   2.219 -#endif /* SDL_USE_CPS */
   2.220 -
   2.221 -    /* Set up the menubar */
   2.222 -    [NSApp setMainMenu:[[NSMenu alloc] init]];
   2.223 -    setApplicationMenu();
   2.224 -    setupWindowMenu();
   2.225 -
   2.226 -    /* Create SDLMain and make it the app delegate */
   2.227 -    sdlMain = [[SDLMain alloc] init];
   2.228 -    [NSApp setDelegate:sdlMain];
   2.229 -
   2.230 -    /* Start the main event loop */
   2.231 -    [NSApp run];
   2.232 -
   2.233 -    [sdlMain release];
   2.234 -    [pool release];
   2.235 -}
   2.236 -
   2.237 -#endif
   2.238 -
   2.239 -
   2.240 -/*
   2.241 - * Catch document open requests...this lets us notice files when the app
   2.242 - *  was launched by double-clicking a document, or when a document was
   2.243 - *  dragged/dropped on the app's icon. You need to have a
   2.244 - *  CFBundleDocumentsType section in your Info.plist to get this message,
   2.245 - *  apparently.
   2.246 - *
   2.247 - * Files are added to gArgv, so to the app, they'll look like command line
   2.248 - *  arguments. Previously, apps launched from the finder had nothing but
   2.249 - *  an argv[0].
   2.250 - *
   2.251 - * This message may be received multiple times to open several docs on launch.
   2.252 - *
   2.253 - * This message is ignored once the app's mainline has been called.
   2.254 - */
   2.255 -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   2.256 -{
   2.257 -    const char *temparg;
   2.258 -    size_t arglen;
   2.259 -    char *arg;
   2.260 -    char **newargv;
   2.261 -
   2.262 -    if (!gFinderLaunch)  /* MacOS is passing command line args. */
   2.263 -        return FALSE;
   2.264 -
   2.265 -    if (gCalledAppMainline)  /* app has started, ignore this document. */
   2.266 -        return FALSE;
   2.267 -
   2.268 -    temparg = [filename UTF8String];
   2.269 -    arglen = SDL_strlen(temparg) + 1;
   2.270 -    arg = (char *) SDL_malloc(arglen);
   2.271 -    if (arg == NULL)
   2.272 -        return FALSE;
   2.273 -
   2.274 -    newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
   2.275 -    if (newargv == NULL)
   2.276 -    {
   2.277 -        SDL_free(arg);
   2.278 -        return FALSE;
   2.279 -    }
   2.280 -    gArgv = newargv;
   2.281 -
   2.282 -    SDL_strlcpy(arg, temparg, arglen);
   2.283 -    gArgv[gArgc++] = arg;
   2.284 -    gArgv[gArgc] = NULL;
   2.285 -    return TRUE;
   2.286 -}
   2.287 -
   2.288 -
   2.289 -/* Called when the internal event loop has just started running */
   2.290 -- (void) applicationDidFinishLaunching: (NSNotification *) note
   2.291 -{
   2.292 -    int status;
   2.293 -
   2.294 -    /* Set the working directory to the .app's parent directory */
   2.295 -    [self setupWorkingDirectory:gFinderLaunch];
   2.296 -
   2.297 -#if SDL_USE_NIB_FILE
   2.298 -    /* Set the main menu to contain the real app name instead of "SDL App" */
   2.299 -    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
   2.300 -#endif
   2.301 -
   2.302 -    /* Hand off to main application code */
   2.303 -    gCalledAppMainline = TRUE;
   2.304 -    status = SDL_main (gArgc, gArgv);
   2.305 -
   2.306 -    /* We're done, thank you for playing */
   2.307 -    exit(status);
   2.308 -}
   2.309 -@end
   2.310 -
   2.311 -
   2.312 -@implementation NSString (ReplaceSubString)
   2.313 -
   2.314 -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
   2.315 -{
   2.316 -    unsigned int bufferSize;
   2.317 -    unsigned int selfLen = [self length];
   2.318 -    unsigned int aStringLen = [aString length];
   2.319 -    unichar *buffer;
   2.320 -    NSRange localRange;
   2.321 -    NSString *result;
   2.322 -
   2.323 -    bufferSize = selfLen + aStringLen - aRange.length;
   2.324 -    buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   2.325 -
   2.326 -    /* Get first part into buffer */
   2.327 -    localRange.location = 0;
   2.328 -    localRange.length = aRange.location;
   2.329 -    [self getCharacters:buffer range:localRange];
   2.330 -
   2.331 -    /* Get middle part into buffer */
   2.332 -    localRange.location = 0;
   2.333 -    localRange.length = aStringLen;
   2.334 -    [aString getCharacters:(buffer+aRange.location) range:localRange];
   2.335 -
   2.336 -    /* Get last part into buffer */
   2.337 -    localRange.location = aRange.location + aRange.length;
   2.338 -    localRange.length = selfLen - localRange.location;
   2.339 -    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   2.340 -
   2.341 -    /* Build output string */
   2.342 -    result = [NSString stringWithCharacters:buffer length:bufferSize];
   2.343 -
   2.344 -    NSDeallocateMemoryPages(buffer, bufferSize);
   2.345 -
   2.346 -    return result;
   2.347 -}
   2.348 -
   2.349 -@end
   2.350 -
   2.351 -
   2.352 -
   2.353 -#ifdef main
   2.354 -#  undef main
   2.355 -#endif
   2.356 -
   2.357 -
   2.358 -/* Main entry point to executable - should *not* be SDL_main! */
   2.359 -int main (int argc, char **argv)
   2.360 -{
   2.361 -    /* Copy the arguments into a global variable */
   2.362 -    /* This is passed if we are launched by double-clicking */
   2.363 -    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
   2.364 -        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
   2.365 -        gArgv[0] = argv[0];
   2.366 -        gArgv[1] = NULL;
   2.367 -        gArgc = 1;
   2.368 -        gFinderLaunch = YES;
   2.369 -    } else {
   2.370 -        int i;
   2.371 -        gArgc = argc;
   2.372 -        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
   2.373 -        for (i = 0; i <= argc; i++)
   2.374 -            gArgv[i] = argv[i];
   2.375 -        gFinderLaunch = NO;
   2.376 -    }
   2.377 -
   2.378 -#if SDL_USE_NIB_FILE
   2.379 -    [SDLApplication poseAsClass:[NSApplication class]];
   2.380 -    NSApplicationMain (argc, argv);
   2.381 -#else
   2.382 -    CustomApplicationMain (argc, argv);
   2.383 -#endif
   2.384 -    return 0;
   2.385 -}
   2.386 -
     3.1 --- a/Xcode/playmus/playmus.xcodeproj/project.pbxproj	Sun Oct 06 12:55:01 2019 +0300
     3.2 +++ b/Xcode/playmus/playmus.xcodeproj/project.pbxproj	Sun Oct 06 17:37:02 2019 +0300
     3.3 @@ -7,13 +7,11 @@
     3.4  	objects = {
     3.5  
     3.6  /* Begin PBXBuildFile section */
     3.7 -		BE1FA98C07AF9AAE004B6283 /* SDLMain.h in Headers */ = {isa = PBXBuildFile; fileRef = F5A47A9D01A0482F01D3D55B /* SDLMain.h */; };
     3.8  		BE1FA98E07AF9AAE004B6283 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
     3.9 -		BE1FA99007AF9AAE004B6283 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = F5A47A9E01A0483001D3D55B /* SDLMain.m */; };
    3.10  		BE1FA99107AF9AAE004B6283 /* playmus.c in Sources */ = {isa = PBXBuildFile; fileRef = F567D67401CD945F01F3E8B9 /* playmus.c */; };
    3.11  		BE1FA99307AF9AAE004B6283 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
    3.12 -		BE1FA99B07AF9B6E004B6283 /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA99907AF9B6E004B6283 /* SDL_mixer.framework */; };
    3.13 -		BE1FA99C07AF9B6E004B6283 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA99A07AF9B6E004B6283 /* SDL.framework */; };
    3.14 +		BE1FA99B07AF9B6E004B6283 /* SDL2_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA99907AF9B6E004B6283 /* SDL2_mixer.framework */; };
    3.15 +		BE1FA99C07AF9B6E004B6283 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA99A07AF9B6E004B6283 /* SDL2.framework */; };
    3.16  /* End PBXBuildFile section */
    3.17  
    3.18  /* Begin PBXFileReference section */
    3.19 @@ -23,11 +21,9 @@
    3.20  		29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
    3.21  		BE1FA99407AF9AAE004B6283 /* Info-playmus__Upgraded_.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-playmus__Upgraded_.plist"; sourceTree = "<group>"; };
    3.22  		BE1FA99507AF9AAE004B6283 /* playmus.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = playmus.app; sourceTree = BUILT_PRODUCTS_DIR; };
    3.23 -		BE1FA99907AF9B6E004B6283 /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = "<absolute>"; };
    3.24 -		BE1FA99A07AF9B6E004B6283 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
    3.25 +		BE1FA99907AF9B6E004B6283 /* SDL2_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2_mixer.framework; path = /Library/Frameworks/SDL2_mixer.framework; sourceTree = "<absolute>"; };
    3.26 +		BE1FA99A07AF9B6E004B6283 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
    3.27  		F567D67401CD945F01F3E8B9 /* playmus.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = playmus.c; path = ../../playmus.c; sourceTree = SOURCE_ROOT; };
    3.28 -		F5A47A9D01A0482F01D3D55B /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; };
    3.29 -		F5A47A9E01A0483001D3D55B /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; };
    3.30  /* End PBXFileReference section */
    3.31  
    3.32  /* Begin PBXFrameworksBuildPhase section */
    3.33 @@ -36,28 +32,19 @@
    3.34  			buildActionMask = 2147483647;
    3.35  			files = (
    3.36  				BE1FA99307AF9AAE004B6283 /* Cocoa.framework in Frameworks */,
    3.37 -				BE1FA99B07AF9B6E004B6283 /* SDL_mixer.framework in Frameworks */,
    3.38 -				BE1FA99C07AF9B6E004B6283 /* SDL.framework in Frameworks */,
    3.39 +				BE1FA99B07AF9B6E004B6283 /* SDL2_mixer.framework in Frameworks */,
    3.40 +				BE1FA99C07AF9B6E004B6283 /* SDL2.framework in Frameworks */,
    3.41  			);
    3.42  			runOnlyForDeploymentPostprocessing = 0;
    3.43  		};
    3.44  /* End PBXFrameworksBuildPhase section */
    3.45  
    3.46  /* Begin PBXGroup section */
    3.47 -		080E96DDFE201D6D7F000001 /* Classes */ = {
    3.48 -			isa = PBXGroup;
    3.49 -			children = (
    3.50 -				F5A47A9D01A0482F01D3D55B /* SDLMain.h */,
    3.51 -				F5A47A9E01A0483001D3D55B /* SDLMain.m */,
    3.52 -			);
    3.53 -			name = Classes;
    3.54 -			sourceTree = "<group>";
    3.55 -		};
    3.56  		1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
    3.57  			isa = PBXGroup;
    3.58  			children = (
    3.59 -				BE1FA99907AF9B6E004B6283 /* SDL_mixer.framework */,
    3.60 -				BE1FA99A07AF9B6E004B6283 /* SDL.framework */,
    3.61 +				BE1FA99907AF9B6E004B6283 /* SDL2_mixer.framework */,
    3.62 +				BE1FA99A07AF9B6E004B6283 /* SDL2.framework */,
    3.63  				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
    3.64  			);
    3.65  			name = "Linked Frameworks";
    3.66 @@ -83,7 +70,6 @@
    3.67  		29B97314FDCFA39411CA2CEA /* SDL App */ = {
    3.68  			isa = PBXGroup;
    3.69  			children = (
    3.70 -				080E96DDFE201D6D7F000001 /* Classes */,
    3.71  				29B97315FDCFA39411CA2CEA /* Other Sources */,
    3.72  				29B97317FDCFA39411CA2CEA /* Resources */,
    3.73  				29B97323FDCFA39411CA2CEA /* Frameworks */,
    3.74 @@ -120,23 +106,11 @@
    3.75  		};
    3.76  /* End PBXGroup section */
    3.77  
    3.78 -/* Begin PBXHeadersBuildPhase section */
    3.79 -		BE1FA98B07AF9AAE004B6283 /* Headers */ = {
    3.80 -			isa = PBXHeadersBuildPhase;
    3.81 -			buildActionMask = 2147483647;
    3.82 -			files = (
    3.83 -				BE1FA98C07AF9AAE004B6283 /* SDLMain.h in Headers */,
    3.84 -			);
    3.85 -			runOnlyForDeploymentPostprocessing = 0;
    3.86 -		};
    3.87 -/* End PBXHeadersBuildPhase section */
    3.88 -
    3.89  /* Begin PBXNativeTarget section */
    3.90  		BE1FA98A07AF9AAE004B6283 /* playmus */ = {
    3.91  			isa = PBXNativeTarget;
    3.92  			buildConfigurationList = 00B7E4D5097ECFD800826121 /* Build configuration list for PBXNativeTarget "playmus" */;
    3.93  			buildPhases = (
    3.94 -				BE1FA98B07AF9AAE004B6283 /* Headers */,
    3.95  				BE1FA98D07AF9AAE004B6283 /* Resources */,
    3.96  				BE1FA98F07AF9AAE004B6283 /* Sources */,
    3.97  				BE1FA99207AF9AAE004B6283 /* Frameworks */,
    3.98 @@ -191,7 +165,6 @@
    3.99  			isa = PBXSourcesBuildPhase;
   3.100  			buildActionMask = 2147483647;
   3.101  			files = (
   3.102 -				BE1FA99007AF9AAE004B6283 /* SDLMain.m in Sources */,
   3.103  				BE1FA99107AF9AAE004B6283 /* playmus.c in Sources */,
   3.104  			);
   3.105  			runOnlyForDeploymentPostprocessing = 0;
   3.106 @@ -219,10 +192,10 @@
   3.107  				);
   3.108  				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
   3.109  				HEADER_SEARCH_PATHS = (
   3.110 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   3.111 -					/Library/Frameworks/SDL.framework/Headers,
   3.112 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   3.113 -					/Library/Frameworks/SDLmixer.framework/Headers,
   3.114 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   3.115 +					/Library/Frameworks/SDL2.framework/Headers,
   3.116 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   3.117 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   3.118  				);
   3.119  				INFOPLIST_FILE = "Info-playmus__Upgraded_.plist";
   3.120  				INSTALL_PATH = "$(HOME)/Applications";
   3.121 @@ -251,10 +224,10 @@
   3.122  				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
   3.123  				GCC_OPTIMIZATION_LEVEL = 0;
   3.124  				HEADER_SEARCH_PATHS = (
   3.125 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   3.126 -					/Library/Frameworks/SDL.framework/Headers,
   3.127 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   3.128 -					/Library/Frameworks/SDLmixer.framework/Headers,
   3.129 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   3.130 +					/Library/Frameworks/SDL2.framework/Headers,
   3.131 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   3.132 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   3.133  				);
   3.134  				INFOPLIST_FILE = "Info-playmus__Upgraded_.plist";
   3.135  				INSTALL_PATH = "$(HOME)/Applications";
   3.136 @@ -280,10 +253,10 @@
   3.137  				);
   3.138  				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
   3.139  				HEADER_SEARCH_PATHS = (
   3.140 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   3.141 -					/Library/Frameworks/SDL.framework/Headers,
   3.142 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   3.143 -					/Library/Frameworks/SDLmixer.framework/Headers,
   3.144 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   3.145 +					/Library/Frameworks/SDL2.framework/Headers,
   3.146 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   3.147 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   3.148  				);
   3.149  				INFOPLIST_FILE = "Info-playmus__Upgraded_.plist";
   3.150  				INSTALL_PATH = "$(HOME)/Applications";
     4.1 --- a/Xcode/playwave/SDLMain.h	Sun Oct 06 12:55:01 2019 +0300
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,16 +0,0 @@
     4.4 -/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
     4.5 -       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
     4.6 -       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
     4.7 -
     4.8 -    Feel free to customize this file to suit your needs
     4.9 -*/
    4.10 -
    4.11 -#ifndef _SDLMain_h_
    4.12 -#define _SDLMain_h_
    4.13 -
    4.14 -#import <Cocoa/Cocoa.h>
    4.15 -
    4.16 -@interface SDLMain : NSObject
    4.17 -@end
    4.18 -
    4.19 -#endif /* _SDLMain_h_ */
     5.1 --- a/Xcode/playwave/SDLMain.m	Sun Oct 06 12:55:01 2019 +0300
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,383 +0,0 @@
     5.4 -/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
     5.5 -       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
     5.6 -       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
     5.7 -
     5.8 -    Feel free to customize this file to suit your needs
     5.9 -*/
    5.10 -
    5.11 -#include <SDL/SDL.h>
    5.12 -#include "SDLMain.h"
    5.13 -#include <sys/param.h> /* for MAXPATHLEN */
    5.14 -#include <unistd.h>
    5.15 -
    5.16 -/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
    5.17 - but the method still is there and works. To avoid warnings, we declare
    5.18 - it ourselves here. */
    5.19 -@interface NSApplication(SDL_Missing_Methods)
    5.20 -- (void)setAppleMenu:(NSMenu *)menu;
    5.21 -@end
    5.22 -
    5.23 -/* Use this flag to determine whether we use SDLMain.nib or not */
    5.24 -#define     SDL_USE_NIB_FILE    0
    5.25 -
    5.26 -/* Use this flag to determine whether we use CPS (docking) or not */
    5.27 -#define     SDL_USE_CPS     1
    5.28 -#ifdef SDL_USE_CPS
    5.29 -/* Portions of CPS.h */
    5.30 -typedef struct CPSProcessSerNum
    5.31 -{
    5.32 -    UInt32      lo;
    5.33 -    UInt32      hi;
    5.34 -} CPSProcessSerNum;
    5.35 -
    5.36 -extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
    5.37 -extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    5.38 -extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
    5.39 -
    5.40 -#endif /* SDL_USE_CPS */
    5.41 -
    5.42 -static int    gArgc;
    5.43 -static char  **gArgv;
    5.44 -static BOOL   gFinderLaunch;
    5.45 -static BOOL   gCalledAppMainline = FALSE;
    5.46 -
    5.47 -static NSString *getApplicationName(void)
    5.48 -{
    5.49 -    const NSDictionary *dict;
    5.50 -    NSString *appName = 0;
    5.51 -
    5.52 -    /* Determine the application name */
    5.53 -    dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    5.54 -    if (dict)
    5.55 -        appName = [dict objectForKey: @"CFBundleName"];
    5.56 -
    5.57 -    if (![appName length])
    5.58 -        appName = [[NSProcessInfo processInfo] processName];
    5.59 -
    5.60 -    return appName;
    5.61 -}
    5.62 -
    5.63 -#if SDL_USE_NIB_FILE
    5.64 -/* A helper category for NSString */
    5.65 -@interface NSString (ReplaceSubString)
    5.66 -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
    5.67 -@end
    5.68 -#endif
    5.69 -
    5.70 -@interface SDLApplication : NSApplication
    5.71 -@end
    5.72 -
    5.73 -@implementation SDLApplication
    5.74 -/* Invoked from the Quit menu item */
    5.75 -- (void)terminate:(id)sender
    5.76 -{
    5.77 -    /* Post a SDL_QUIT event */
    5.78 -    SDL_Event event;
    5.79 -    event.type = SDL_QUIT;
    5.80 -    SDL_PushEvent(&event);
    5.81 -}
    5.82 -@end
    5.83 -
    5.84 -/* The main class of the application, the application's delegate */
    5.85 -@implementation SDLMain
    5.86 -
    5.87 -/* Set the working directory to the .app's parent directory */
    5.88 -- (void) setupWorkingDirectory:(BOOL)shouldChdir
    5.89 -{
    5.90 -    if (shouldChdir)
    5.91 -    {
    5.92 -        char parentdir[MAXPATHLEN];
    5.93 -        CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
    5.94 -        CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
    5.95 -        if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
    5.96 -            chdir(parentdir);   /* chdir to the binary app's parent */
    5.97 -        }
    5.98 -        CFRelease(url);
    5.99 -        CFRelease(url2);
   5.100 -    }
   5.101 -}
   5.102 -
   5.103 -#if SDL_USE_NIB_FILE
   5.104 -
   5.105 -/* Fix menu to contain the real app name instead of "SDL App" */
   5.106 -- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
   5.107 -{
   5.108 -    NSRange aRange;
   5.109 -    NSEnumerator *enumerator;
   5.110 -    NSMenuItem *menuItem;
   5.111 -
   5.112 -    aRange = [[aMenu title] rangeOfString:@"SDL App"];
   5.113 -    if (aRange.length != 0)
   5.114 -        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
   5.115 -
   5.116 -    enumerator = [[aMenu itemArray] objectEnumerator];
   5.117 -    while ((menuItem = [enumerator nextObject]))
   5.118 -    {
   5.119 -        aRange = [[menuItem title] rangeOfString:@"SDL App"];
   5.120 -        if (aRange.length != 0)
   5.121 -            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
   5.122 -        if ([menuItem hasSubmenu])
   5.123 -            [self fixMenu:[menuItem submenu] withAppName:appName];
   5.124 -    }
   5.125 -    [ aMenu sizeToFit ];
   5.126 -}
   5.127 -
   5.128 -#else
   5.129 -
   5.130 -static void setApplicationMenu(void)
   5.131 -{
   5.132 -    /* warning: this code is very odd */
   5.133 -    NSMenu *appleMenu;
   5.134 -    NSMenuItem *menuItem;
   5.135 -    NSString *title;
   5.136 -    NSString *appName;
   5.137 -
   5.138 -    appName = getApplicationName();
   5.139 -    appleMenu = [[NSMenu alloc] initWithTitle:@""];
   5.140 -
   5.141 -    /* Add menu items */
   5.142 -    title = [@"About " stringByAppendingString:appName];
   5.143 -    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
   5.144 -
   5.145 -    [appleMenu addItem:[NSMenuItem separatorItem]];
   5.146 -
   5.147 -    title = [@"Hide " stringByAppendingString:appName];
   5.148 -    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
   5.149 -
   5.150 -    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
   5.151 -    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
   5.152 -
   5.153 -    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
   5.154 -
   5.155 -    [appleMenu addItem:[NSMenuItem separatorItem]];
   5.156 -
   5.157 -    title = [@"Quit " stringByAppendingString:appName];
   5.158 -    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
   5.159 -
   5.160 -
   5.161 -    /* Put menu into the menubar */
   5.162 -    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
   5.163 -    [menuItem setSubmenu:appleMenu];
   5.164 -    [[NSApp mainMenu] addItem:menuItem];
   5.165 -
   5.166 -    /* Tell the application object that this is now the application menu */
   5.167 -    [NSApp setAppleMenu:appleMenu];
   5.168 -
   5.169 -    /* Finally give up our references to the objects */
   5.170 -    [appleMenu release];
   5.171 -    [menuItem release];
   5.172 -}
   5.173 -
   5.174 -/* Create a window menu */
   5.175 -static void setupWindowMenu(void)
   5.176 -{
   5.177 -    NSMenu      *windowMenu;
   5.178 -    NSMenuItem  *windowMenuItem;
   5.179 -    NSMenuItem  *menuItem;
   5.180 -
   5.181 -    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
   5.182 -
   5.183 -    /* "Minimize" item */
   5.184 -    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
   5.185 -    [windowMenu addItem:menuItem];
   5.186 -    [menuItem release];
   5.187 -
   5.188 -    /* Put menu into the menubar */
   5.189 -    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
   5.190 -    [windowMenuItem setSubmenu:windowMenu];
   5.191 -    [[NSApp mainMenu] addItem:windowMenuItem];
   5.192 -
   5.193 -    /* Tell the application object that this is now the window menu */
   5.194 -    [NSApp setWindowsMenu:windowMenu];
   5.195 -
   5.196 -    /* Finally give up our references to the objects */
   5.197 -    [windowMenu release];
   5.198 -    [windowMenuItem release];
   5.199 -}
   5.200 -
   5.201 -/* Replacement for NSApplicationMain */
   5.202 -static void CustomApplicationMain (int argc, char **argv)
   5.203 -{
   5.204 -    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
   5.205 -    SDLMain             *sdlMain;
   5.206 -
   5.207 -    /* Ensure the application object is initialised */
   5.208 -    [SDLApplication sharedApplication];
   5.209 -
   5.210 -#ifdef SDL_USE_CPS
   5.211 -    {
   5.212 -        CPSProcessSerNum PSN;
   5.213 -        /* Tell the dock about us */
   5.214 -        if (!CPSGetCurrentProcess(&PSN))
   5.215 -            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
   5.216 -                if (!CPSSetFrontProcess(&PSN))
   5.217 -                    [SDLApplication sharedApplication];
   5.218 -    }
   5.219 -#endif /* SDL_USE_CPS */
   5.220 -
   5.221 -    /* Set up the menubar */
   5.222 -    [NSApp setMainMenu:[[NSMenu alloc] init]];
   5.223 -    setApplicationMenu();
   5.224 -    setupWindowMenu();
   5.225 -
   5.226 -    /* Create SDLMain and make it the app delegate */
   5.227 -    sdlMain = [[SDLMain alloc] init];
   5.228 -    [NSApp setDelegate:sdlMain];
   5.229 -
   5.230 -    /* Start the main event loop */
   5.231 -    [NSApp run];
   5.232 -
   5.233 -    [sdlMain release];
   5.234 -    [pool release];
   5.235 -}
   5.236 -
   5.237 -#endif
   5.238 -
   5.239 -
   5.240 -/*
   5.241 - * Catch document open requests...this lets us notice files when the app
   5.242 - *  was launched by double-clicking a document, or when a document was
   5.243 - *  dragged/dropped on the app's icon. You need to have a
   5.244 - *  CFBundleDocumentsType section in your Info.plist to get this message,
   5.245 - *  apparently.
   5.246 - *
   5.247 - * Files are added to gArgv, so to the app, they'll look like command line
   5.248 - *  arguments. Previously, apps launched from the finder had nothing but
   5.249 - *  an argv[0].
   5.250 - *
   5.251 - * This message may be received multiple times to open several docs on launch.
   5.252 - *
   5.253 - * This message is ignored once the app's mainline has been called.
   5.254 - */
   5.255 -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   5.256 -{
   5.257 -    const char *temparg;
   5.258 -    size_t arglen;
   5.259 -    char *arg;
   5.260 -    char **newargv;
   5.261 -
   5.262 -    if (!gFinderLaunch)  /* MacOS is passing command line args. */
   5.263 -        return FALSE;
   5.264 -
   5.265 -    if (gCalledAppMainline)  /* app has started, ignore this document. */
   5.266 -        return FALSE;
   5.267 -
   5.268 -    temparg = [filename UTF8String];
   5.269 -    arglen = SDL_strlen(temparg) + 1;
   5.270 -    arg = (char *) SDL_malloc(arglen);
   5.271 -    if (arg == NULL)
   5.272 -        return FALSE;
   5.273 -
   5.274 -    newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
   5.275 -    if (newargv == NULL)
   5.276 -    {
   5.277 -        SDL_free(arg);
   5.278 -        return FALSE;
   5.279 -    }
   5.280 -    gArgv = newargv;
   5.281 -
   5.282 -    SDL_strlcpy(arg, temparg, arglen);
   5.283 -    gArgv[gArgc++] = arg;
   5.284 -    gArgv[gArgc] = NULL;
   5.285 -    return TRUE;
   5.286 -}
   5.287 -
   5.288 -
   5.289 -/* Called when the internal event loop has just started running */
   5.290 -- (void) applicationDidFinishLaunching: (NSNotification *) note
   5.291 -{
   5.292 -    int status;
   5.293 -
   5.294 -    /* Set the working directory to the .app's parent directory */
   5.295 -    [self setupWorkingDirectory:gFinderLaunch];
   5.296 -
   5.297 -#if SDL_USE_NIB_FILE
   5.298 -    /* Set the main menu to contain the real app name instead of "SDL App" */
   5.299 -    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
   5.300 -#endif
   5.301 -
   5.302 -    /* Hand off to main application code */
   5.303 -    gCalledAppMainline = TRUE;
   5.304 -    status = SDL_main (gArgc, gArgv);
   5.305 -
   5.306 -    /* We're done, thank you for playing */
   5.307 -    exit(status);
   5.308 -}
   5.309 -@end
   5.310 -
   5.311 -
   5.312 -@implementation NSString (ReplaceSubString)
   5.313 -
   5.314 -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
   5.315 -{
   5.316 -    unsigned int bufferSize;
   5.317 -    unsigned int selfLen = [self length];
   5.318 -    unsigned int aStringLen = [aString length];
   5.319 -    unichar *buffer;
   5.320 -    NSRange localRange;
   5.321 -    NSString *result;
   5.322 -
   5.323 -    bufferSize = selfLen + aStringLen - aRange.length;
   5.324 -    buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   5.325 -
   5.326 -    /* Get first part into buffer */
   5.327 -    localRange.location = 0;
   5.328 -    localRange.length = aRange.location;
   5.329 -    [self getCharacters:buffer range:localRange];
   5.330 -
   5.331 -    /* Get middle part into buffer */
   5.332 -    localRange.location = 0;
   5.333 -    localRange.length = aStringLen;
   5.334 -    [aString getCharacters:(buffer+aRange.location) range:localRange];
   5.335 -
   5.336 -    /* Get last part into buffer */
   5.337 -    localRange.location = aRange.location + aRange.length;
   5.338 -    localRange.length = selfLen - localRange.location;
   5.339 -    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   5.340 -
   5.341 -    /* Build output string */
   5.342 -    result = [NSString stringWithCharacters:buffer length:bufferSize];
   5.343 -
   5.344 -    NSDeallocateMemoryPages(buffer, bufferSize);
   5.345 -
   5.346 -    return result;
   5.347 -}
   5.348 -
   5.349 -@end
   5.350 -
   5.351 -
   5.352 -
   5.353 -#ifdef main
   5.354 -#  undef main
   5.355 -#endif
   5.356 -
   5.357 -
   5.358 -/* Main entry point to executable - should *not* be SDL_main! */
   5.359 -int main (int argc, char **argv)
   5.360 -{
   5.361 -    /* Copy the arguments into a global variable */
   5.362 -    /* This is passed if we are launched by double-clicking */
   5.363 -    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
   5.364 -        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
   5.365 -        gArgv[0] = argv[0];
   5.366 -        gArgv[1] = NULL;
   5.367 -        gArgc = 1;
   5.368 -        gFinderLaunch = YES;
   5.369 -    } else {
   5.370 -        int i;
   5.371 -        gArgc = argc;
   5.372 -        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
   5.373 -        for (i = 0; i <= argc; i++)
   5.374 -            gArgv[i] = argv[i];
   5.375 -        gFinderLaunch = NO;
   5.376 -    }
   5.377 -
   5.378 -#if SDL_USE_NIB_FILE
   5.379 -    [SDLApplication poseAsClass:[NSApplication class]];
   5.380 -    NSApplicationMain (argc, argv);
   5.381 -#else
   5.382 -    CustomApplicationMain (argc, argv);
   5.383 -#endif
   5.384 -    return 0;
   5.385 -}
   5.386 -
     6.1 --- a/Xcode/playwave/playwave.xcodeproj/project.pbxproj	Sun Oct 06 12:55:01 2019 +0300
     6.2 +++ b/Xcode/playwave/playwave.xcodeproj/project.pbxproj	Sun Oct 06 17:37:02 2019 +0300
     6.3 @@ -7,13 +7,11 @@
     6.4  	objects = {
     6.5  
     6.6  /* Begin PBXBuildFile section */
     6.7 -		BE1FA9DE07AF9BE7004B6283 /* SDLMain.h in Headers */ = {isa = PBXBuildFile; fileRef = F5A47A9D01A0482F01D3D55B /* SDLMain.h */; };
     6.8  		BE1FA9E007AF9BE7004B6283 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
     6.9 -		BE1FA9E207AF9BE7004B6283 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = F5A47A9E01A0483001D3D55B /* SDLMain.m */; };
    6.10  		BE1FA9E307AF9BE7004B6283 /* playwave.c in Sources */ = {isa = PBXBuildFile; fileRef = F567D66E01CD930A01F3E8B9 /* playwave.c */; };
    6.11  		BE1FA9E507AF9BE7004B6283 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
    6.12 -		BE1FA9E607AF9BE7004B6283 /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA9CC07AF9BD0004B6283 /* SDL_mixer.framework */; };
    6.13 -		BE1FA9E707AF9BE7004B6283 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA9CD07AF9BD0004B6283 /* SDL.framework */; };
    6.14 +		BE1FA9E607AF9BE7004B6283 /* SDL2_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA9CC07AF9BD0004B6283 /* SDL2_mixer.framework */; };
    6.15 +		BE1FA9E707AF9BE7004B6283 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE1FA9CD07AF9BD0004B6283 /* SDL2.framework */; };
    6.16  /* End PBXBuildFile section */
    6.17  
    6.18  /* Begin PBXFileReference section */
    6.19 @@ -21,13 +19,11 @@
    6.20  		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
    6.21  		29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
    6.22  		29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
    6.23 -		BE1FA9CC07AF9BD0004B6283 /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = "<absolute>"; };
    6.24 -		BE1FA9CD07AF9BD0004B6283 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
    6.25 +		BE1FA9CC07AF9BD0004B6283 /* SDL2_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2_mixer.framework; path = /Library/Frameworks/SDL2_mixer.framework; sourceTree = "<absolute>"; };
    6.26 +		BE1FA9CD07AF9BD0004B6283 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
    6.27  		BE1FA9E807AF9BE7004B6283 /* Info-playwave__Upgraded_.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-playwave__Upgraded_.plist"; sourceTree = "<group>"; };
    6.28  		BE1FA9E907AF9BE7004B6283 /* playwave.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = playwave.app; sourceTree = BUILT_PRODUCTS_DIR; };
    6.29  		F567D66E01CD930A01F3E8B9 /* playwave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = playwave.c; path = ../../playwave.c; sourceTree = SOURCE_ROOT; };
    6.30 -		F5A47A9D01A0482F01D3D55B /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; };
    6.31 -		F5A47A9E01A0483001D3D55B /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; };
    6.32  /* End PBXFileReference section */
    6.33  
    6.34  /* Begin PBXFrameworksBuildPhase section */
    6.35 @@ -36,28 +32,19 @@
    6.36  			buildActionMask = 2147483647;
    6.37  			files = (
    6.38  				BE1FA9E507AF9BE7004B6283 /* Cocoa.framework in Frameworks */,
    6.39 -				BE1FA9E607AF9BE7004B6283 /* SDL_mixer.framework in Frameworks */,
    6.40 -				BE1FA9E707AF9BE7004B6283 /* SDL.framework in Frameworks */,
    6.41 +				BE1FA9E607AF9BE7004B6283 /* SDL2_mixer.framework in Frameworks */,
    6.42 +				BE1FA9E707AF9BE7004B6283 /* SDL2.framework in Frameworks */,
    6.43  			);
    6.44  			runOnlyForDeploymentPostprocessing = 0;
    6.45  		};
    6.46  /* End PBXFrameworksBuildPhase section */
    6.47  
    6.48  /* Begin PBXGroup section */
    6.49 -		080E96DDFE201D6D7F000001 /* Classes */ = {
    6.50 -			isa = PBXGroup;
    6.51 -			children = (
    6.52 -				F5A47A9D01A0482F01D3D55B /* SDLMain.h */,
    6.53 -				F5A47A9E01A0483001D3D55B /* SDLMain.m */,
    6.54 -			);
    6.55 -			name = Classes;
    6.56 -			sourceTree = "<group>";
    6.57 -		};
    6.58  		1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
    6.59  			isa = PBXGroup;
    6.60  			children = (
    6.61 -				BE1FA9CC07AF9BD0004B6283 /* SDL_mixer.framework */,
    6.62 -				BE1FA9CD07AF9BD0004B6283 /* SDL.framework */,
    6.63 +				BE1FA9CC07AF9BD0004B6283 /* SDL2_mixer.framework */,
    6.64 +				BE1FA9CD07AF9BD0004B6283 /* SDL2.framework */,
    6.65  				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
    6.66  			);
    6.67  			name = "Linked Frameworks";
    6.68 @@ -83,7 +70,6 @@
    6.69  		29B97314FDCFA39411CA2CEA /* SDL App */ = {
    6.70  			isa = PBXGroup;
    6.71  			children = (
    6.72 -				080E96DDFE201D6D7F000001 /* Classes */,
    6.73  				29B97315FDCFA39411CA2CEA /* Other Sources */,
    6.74  				29B97317FDCFA39411CA2CEA /* Resources */,
    6.75  				29B97323FDCFA39411CA2CEA /* Frameworks */,
    6.76 @@ -120,23 +106,11 @@
    6.77  		};
    6.78  /* End PBXGroup section */
    6.79  
    6.80 -/* Begin PBXHeadersBuildPhase section */
    6.81 -		BE1FA9DD07AF9BE7004B6283 /* Headers */ = {
    6.82 -			isa = PBXHeadersBuildPhase;
    6.83 -			buildActionMask = 2147483647;
    6.84 -			files = (
    6.85 -				BE1FA9DE07AF9BE7004B6283 /* SDLMain.h in Headers */,
    6.86 -			);
    6.87 -			runOnlyForDeploymentPostprocessing = 0;
    6.88 -		};
    6.89 -/* End PBXHeadersBuildPhase section */
    6.90 -
    6.91  /* Begin PBXNativeTarget section */
    6.92  		BE1FA9DC07AF9BE7004B6283 /* playwave */ = {
    6.93  			isa = PBXNativeTarget;
    6.94  			buildConfigurationList = 00B7E503097ED1A000826121 /* Build configuration list for PBXNativeTarget "playwave" */;
    6.95  			buildPhases = (
    6.96 -				BE1FA9DD07AF9BE7004B6283 /* Headers */,
    6.97  				BE1FA9DF07AF9BE7004B6283 /* Resources */,
    6.98  				BE1FA9E107AF9BE7004B6283 /* Sources */,
    6.99  				BE1FA9E407AF9BE7004B6283 /* Frameworks */,
   6.100 @@ -191,7 +165,6 @@
   6.101  			isa = PBXSourcesBuildPhase;
   6.102  			buildActionMask = 2147483647;
   6.103  			files = (
   6.104 -				BE1FA9E207AF9BE7004B6283 /* SDLMain.m in Sources */,
   6.105  				BE1FA9E307AF9BE7004B6283 /* playwave.c in Sources */,
   6.106  			);
   6.107  			runOnlyForDeploymentPostprocessing = 0;
   6.108 @@ -222,10 +195,10 @@
   6.109  				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
   6.110  				GCC_OPTIMIZATION_LEVEL = 0;
   6.111  				HEADER_SEARCH_PATHS = (
   6.112 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   6.113 -					/Library/Frameworks/SDL.framework/Headers,
   6.114 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   6.115 -					/Library/Frameworks/SDLmixer.framework/Headers,
   6.116 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   6.117 +					/Library/Frameworks/SDL2.framework/Headers,
   6.118 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   6.119 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   6.120  				);
   6.121  				INFOPLIST_FILE = "Info-playwave__Upgraded_.plist";
   6.122  				INSTALL_PATH = "$(HOME)/Applications";
   6.123 @@ -252,10 +225,10 @@
   6.124  					/Library/Frameworks,
   6.125  				);
   6.126  				HEADER_SEARCH_PATHS = (
   6.127 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   6.128 -					/Library/Frameworks/SDL.framework/Headers,
   6.129 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   6.130 -					/Library/Frameworks/SDLmixer.framework/Headers,
   6.131 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   6.132 +					/Library/Frameworks/SDL2.framework/Headers,
   6.133 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   6.134 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   6.135  				);
   6.136  				INFOPLIST_FILE = "Info-playwave__Upgraded_.plist";
   6.137  				INSTALL_PATH = "$(HOME)/Applications";
   6.138 @@ -281,10 +254,10 @@
   6.139  					/Library/Frameworks,
   6.140  				);
   6.141  				HEADER_SEARCH_PATHS = (
   6.142 -					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
   6.143 -					/Library/Frameworks/SDL.framework/Headers,
   6.144 -					"$(HOME)/Library/Frameworks/SDLmixer.framework/Headers",
   6.145 -					/Library/Frameworks/SDLmixer.framework/Headers,
   6.146 +					"$(HOME)/Library/Frameworks/SDL2.framework/Headers",
   6.147 +					/Library/Frameworks/SDL2.framework/Headers,
   6.148 +					"$(HOME)/Library/Frameworks/SDL2_mixer.framework/Headers",
   6.149 +					/Library/Frameworks/SDL2_mixer.framework/Headers,
   6.150  				);
   6.151  				INFOPLIST_FILE = "Info-playwave__Upgraded_.plist";
   6.152  				INSTALL_PATH = "$(HOME)/Applications";