diff --git a/Ample.xcodeproj/project.pbxproj b/Ample.xcodeproj/project.pbxproj index 3eb1427..5418721 100644 --- a/Ample.xcodeproj/project.pbxproj +++ b/Ample.xcodeproj/project.pbxproj @@ -62,6 +62,8 @@ B6152B5725F4549F00605E6E /* Slot.m in Sources */ = {isa = PBXBuildFile; fileRef = B6152B5525F4549F00605E6E /* Slot.m */; }; B6152B5A25F5B57E00605E6E /* Media.m in Sources */ = {isa = PBXBuildFile; fileRef = B6152B5925F5B57E00605E6E /* Media.m */; }; B6152B5B25F5B57E00605E6E /* Media.m in Sources */ = {isa = PBXBuildFile; fileRef = B6152B5925F5B57E00605E6E /* Media.m */; }; + B615A99F26640940001FBF99 /* NewSlotView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B6E9A18125088B36005E7525 /* NewSlotView.xib */; }; + B615A9A026640A70001FBF99 /* NewSlotViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B6E9A17F25088B1B005E7525 /* NewSlotViewController.m */; }; B6374AC4260EBBCF0045CA16 /* pty_shell.c in Sources */ = {isa = PBXBuildFile; fileRef = B6374AB6260EBB970045CA16 /* pty_shell.c */; }; B6374AC5260EBC5A0045CA16 /* pty_shell in CopyFiles */ = {isa = PBXBuildFile; fileRef = B6374ABD260EBBC90045CA16 /* pty_shell */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; B6374AD1260ECB400045CA16 /* macclas2.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6374AC9260ECB3F0045CA16 /* macclas2.plist */; }; @@ -892,6 +894,29 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B6DDECD62505A86E0093587A /* eject-16x16.png in Resources */, + B6DDECCC2505A86E0093587A /* eject-16x16@2x.png in Resources */, + B6DDECCE2505A86E0093587A /* eject-16x16@3x.png in Resources */, + B6DDECD02505A86E0093587A /* eject-hover-16x16.png in Resources */, + B6DDECD22505A86E0093587A /* eject-hover-16x16@2x.png in Resources */, + B6DDECD42505A86E0093587A /* eject-hover-16x16@3x.png in Resources */, + B6DE323826044C1100418375 /* caution.png in Resources */, + B6DE323626044C1100418375 /* caution@2x.png in Resources */, + B6DE323B26044DB800418375 /* caution@3x.png in Resources */, + B6DDECC025057A550093587A /* drag-handle-4x10.png in Resources */, + B6DDECC225057A550093587A /* drag-handle-4x10@2x.png in Resources */, + B6DDECC425057A550093587A /* drag-handle-4x10@3x.png in Resources */, + B6BA258224E99BEB005FB8FF /* Assets.xcassets in Resources */, + B6D6DE3E24FADF8B00661A5F /* LaunchWindow.xib in Resources */, + B6004DF124FB05D600D38596 /* LogWindow.xib in Resources */, + B6BA258524E99BEB005FB8FF /* MainMenu.xib in Resources */, + B6665C1C265C639A00254939 /* Autocomplete.xib in Resources */, + B64AF1EE250EC35B00A09B9B /* DiskImages.xib in Resources */, + B63C1B9625008A2700511A71 /* DownloadWindow.xib in Resources */, + B61099E824F5F231005CB652 /* MediaView.xib in Resources */, + B6E9A18325088B36005E7525 /* NewSlotView.xib in Resources */, + B6D6DE3924FAC8B500661A5F /* Preferences.xib in Resources */, + B63C1F0B25B143C50016A611 /* CheatSheet.xib in Resources */, B6109A3324F5F377005CB652 /* apple2eeuk.plist in Resources */, B6374ADB260ECB400045CA16 /* maciix.plist in Resources */, B6109A2424F5F377005CB652 /* las128ex.plist in Resources */, @@ -901,24 +926,18 @@ B6374AD9260ECB400045CA16 /* maciicx.plist in Resources */, B6109A3F24F5F377005CB652 /* agat9.plist in Resources */, B63C1B9D250192D800511A71 /* cece.plist in Resources */, - B6D6DE3E24FADF8B00661A5F /* LaunchWindow.xib in Resources */, B6109A3124F5F377005CB652 /* apple1.plist in Resources */, B6374AD3260ECB400045CA16 /* macii.plist in Resources */, B6109A3524F5F377005CB652 /* ace100.plist in Resources */, B65085BB25B616AC00354EC9 /* maclc3.plist in Resources */, B6109A3424F5F377005CB652 /* am64.plist in Resources */, - B6DDECCC2505A86E0093587A /* eject-16x16@2x.png in Resources */, B6DE32462605482500418375 /* macclasc.plist in Resources */, - B6004DF124FB05D600D38596 /* LogWindow.xib in Resources */, B6DE32502605482500418375 /* macse.plist in Resources */, - B6BA258224E99BEB005FB8FF /* Assets.xcassets in Resources */, B6109A1724F5F377005CB652 /* apple2e.plist in Resources */, B6109A3C24F5F377005CB652 /* am100.plist in Resources */, - B6DDECD02505A86E0093587A /* eject-hover-16x16.png in Resources */, B6109A2524F5F377005CB652 /* laser2c.plist in Resources */, B6109A3D24F5F377005CB652 /* laser128.plist in Resources */, B6109A2824F5F377005CB652 /* apple2ep.plist in Resources */, - B6DDECC225057A550093587A /* drag-handle-4x10@2x.png in Resources */, B6109A1924F5F377005CB652 /* apple2ees.plist in Resources */, B6DE32482605482500418375 /* mac512ke.plist in Resources */, B6109A3924F5F377005CB652 /* prav8c.plist in Resources */, @@ -930,65 +949,48 @@ B6109A2E24F5F377005CB652 /* apple2eefr.plist in Resources */, B6109A2C24F5F377005CB652 /* spectred.plist in Resources */, B6109A4124F5F377005CB652 /* apple2cp.plist in Resources */, - B6BA258524E99BEB005FB8FF /* MainMenu.xib in Resources */, B6109A3A24F5F377005CB652 /* prav82.plist in Resources */, B6DD1FE825B407E7004A3242 /* maclc.plist in Resources */, B6109A2024F5F377005CB652 /* apple2euk.plist in Resources */, B6DE324C2605482500418375 /* macplus.plist in Resources */, - B6DE323826044C1100418375 /* caution.png in Resources */, B6109A2F24F5F377005CB652 /* uniap2ti.plist in Resources */, - B6DDECD42505A86E0093587A /* eject-hover-16x16@3x.png in Resources */, - B6DDECD62505A86E0093587A /* eject-16x16.png in Resources */, B6109A1E24F5F377005CB652 /* apple2c.plist in Resources */, B6109A1A24F5F377005CB652 /* microeng.plist in Resources */, B6374AD5260ECB400045CA16 /* maciisi.plist in Resources */, B6109A3E24F5F377005CB652 /* albert.plist in Resources */, - B6665C1C265C639A00254939 /* Autocomplete.xib in Resources */, B66236C124FDB7A6006CABD7 /* Credits.rtf in Resources */, B6109A4224F5F377005CB652 /* apple2p.plist in Resources */, B65085B925B616AC00354EC9 /* maclc2.plist in Resources */, B6109A1824F5F377005CB652 /* hkc8800a.plist in Resources */, B6109A2324F5F377005CB652 /* apple2gsr0.plist in Resources */, B63C1BA1250192D800511A71 /* cecg.plist in Resources */, - B6DE323626044C1100418375 /* caution@2x.png in Resources */, B63C1BA3250192D800511A71 /* cec2000.plist in Resources */, B6109A2624F5F377005CB652 /* mprof3.plist in Resources */, B63C1B9F250192D800511A71 /* ceci.plist in Resources */, B6109A3224F5F377005CB652 /* basis108.plist in Resources */, - B6DE323B26044DB800418375 /* caution@3x.png in Resources */, B6109A4324F5F377005CB652 /* agat7.plist in Resources */, B6DE324E2605482500418375 /* mac512k.plist in Resources */, - B6DDECC425057A550093587A /* drag-handle-4x10@3x.png in Resources */, B6109A2B24F5F377005CB652 /* elppa.plist in Resources */, B63C1B8E25004C6D00511A71 /* mame-data.tgz in Resources */, - B6DDECCE2505A86E0093587A /* eject-16x16@3x.png in Resources */, - B64AF1EE250EC35B00A09B9B /* DiskImages.xib in Resources */, B6109A3B24F5F377005CB652 /* apple2gsr1.plist in Resources */, B65085BD25B616AC00354EC9 /* maciici.plist in Resources */, B6374AE3260ECDDD0045CA16 /* maciihmu.plist in Resources */, B6374ADF260ECB400045CA16 /* macse30.plist in Resources */, B63C1F1225B147E10016A611 /* CheatSheet.html in Resources */, - B63C1B9625008A2700511A71 /* DownloadWindow.xib in Resources */, B6D6DE3B24FACF4F00661A5F /* Defaults.plist in Resources */, B6109A2224F5F377005CB652 /* models.plist in Resources */, B6109A4024F5F377005CB652 /* craft2p.plist in Resources */, B6109A1B24F5F377005CB652 /* uniap2pt.plist in Resources */, B6109A3724F5F377005CB652 /* las128e2.plist in Resources */, - B61099E824F5F231005CB652 /* MediaView.xib in Resources */, B6374AE5260ECDDD0045CA16 /* mac2fdhd.plist in Resources */, B63C1B90250088DD00511A71 /* roms.plist in Resources */, B6109A2724F5F377005CB652 /* uniap2en.plist in Resources */, B6109A2A24F5F377005CB652 /* apple3.plist in Resources */, B6109A2124F5F377005CB652 /* apple2ee.plist in Resources */, B63C1BA5250192D800511A71 /* cecm.plist in Resources */, - B6E9A18325088B36005E7525 /* NewSlotView.xib in Resources */, - B6DDECC025057A550093587A /* drag-handle-4x10.png in Resources */, - B6DDECD22505A86E0093587A /* eject-hover-16x16@2x.png in Resources */, B6109A3624F5F377005CB652 /* dodo.plist in Resources */, - B6D6DE3924FAC8B500661A5F /* Preferences.xib in Resources */, B6109A2924F5F377005CB652 /* apple2gs.plist in Resources */, B6109A1F24F5F377005CB652 /* apple2jp.plist in Resources */, - B63C1F0B25B143C50016A611 /* CheatSheet.xib in Resources */, B6374AD7260ECB400045CA16 /* maciivi.plist in Resources */, B6374AD1260ECB400045CA16 /* macclas2.plist in Resources */, B6DE324A2605482500418375 /* macsefd.plist in Resources */, @@ -1001,7 +1003,18 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B6DDECD72505A86E0093587A /* eject-16x16.png in Resources */, + B6DDECCD2505A86E0093587A /* eject-16x16@2x.png in Resources */, B6DDECCF2505A86E0093587A /* eject-16x16@3x.png in Resources */, + B6DDECD12505A86E0093587A /* eject-hover-16x16.png in Resources */, + B6DDECD32505A86E0093587A /* eject-hover-16x16@2x.png in Resources */, + B6DDECD52505A86E0093587A /* eject-hover-16x16@3x.png in Resources */, + B6DE323926044C1100418375 /* caution.png in Resources */, + B6DE323726044C1100418375 /* caution@2x.png in Resources */, + B6DE323C26044DB800418375 /* caution@3x.png in Resources */, + B6DDECC125057A550093587A /* drag-handle-4x10.png in Resources */, + B6DDECC325057A550093587A /* drag-handle-4x10@2x.png in Resources */, + B6DDECC525057A550093587A /* drag-handle-4x10@3x.png in Resources */, B6374AE6260ECDDD0045CA16 /* mac2fdhd.plist in Resources */, B6374ADC260ECB400045CA16 /* maciix.plist in Resources */, B6E4B5BC24FDE2670094A35C /* apple2eeuk.plist in Resources */, @@ -1013,7 +1026,6 @@ B6E4B5BF24FDE2670094A35C /* agat9.plist in Resources */, B6E4B5C024FDE2670094A35C /* LaunchWindow.xib in Resources */, B6665C1D265C639A00254939 /* Autocomplete.xib in Resources */, - B6DE323726044C1100418375 /* caution@2x.png in Resources */, B6E4B5C124FDE2670094A35C /* apple1.plist in Resources */, B6E4B5C224FDE2670094A35C /* ace100.plist in Resources */, B6374AD6260ECB400045CA16 /* maciisi.plist in Resources */, @@ -1028,20 +1040,18 @@ B6E4B5C724FDE2670094A35C /* am100.plist in Resources */, B6E4B5C824FDE2670094A35C /* laser2c.plist in Resources */, B6374ADA260ECB400045CA16 /* maciicx.plist in Resources */, - B6DDECC125057A550093587A /* drag-handle-4x10.png in Resources */, + B615A99F26640940001FBF99 /* NewSlotView.xib in Resources */, B63C1F0C25B143C50016A611 /* CheatSheet.xib in Resources */, B6374AE0260ECB400045CA16 /* macse30.plist in Resources */, B6E4B5C924FDE2670094A35C /* laser128.plist in Resources */, B646D10C263A5DF30014C586 /* ace1000.plist in Resources */, B6E4B5CA24FDE2670094A35C /* apple2ep.plist in Resources */, - B6DDECCD2505A86E0093587A /* eject-16x16@2x.png in Resources */, B6E4B5CB24FDE2670094A35C /* apple2ees.plist in Resources */, B6E4B5CC24FDE2670094A35C /* prav8c.plist in Resources */, B6E4B5CD24FDE2670094A35C /* ivelultr.plist in Resources */, B6E4B5CE24FDE2670094A35C /* maxxi.plist in Resources */, B6DE324B2605482500418375 /* macsefd.plist in Resources */, B6E4B5CF24FDE2670094A35C /* apple2eefr.plist in Resources */, - B6DE323926044C1100418375 /* caution.png in Resources */, B6374AD8260ECB400045CA16 /* maciivi.plist in Resources */, B6E4B5D124FDE2670094A35C /* spectred.plist in Resources */, B63C1B9725008A2700511A71 /* DownloadWindow.xib in Resources */, @@ -1056,22 +1066,17 @@ B6E4B5D924FDE2670094A35C /* albert.plist in Resources */, B6E4B5DA24FDE2670094A35C /* Credits.rtf in Resources */, B6E4B5DB24FDE2670094A35C /* apple2p.plist in Resources */, - B6DDECD12505A86E0093587A /* eject-hover-16x16.png in Resources */, B65085BE25B616AC00354EC9 /* maciici.plist in Resources */, B6DE32512605482500418375 /* macse.plist in Resources */, B65085BC25B616AC00354EC9 /* maclc3.plist in Resources */, B6DE32492605482500418375 /* mac512ke.plist in Resources */, B6DE32452605482500418375 /* mac128k.plist in Resources */, B63C1BA4250192D800511A71 /* cec2000.plist in Resources */, - B6DDECD32505A86E0093587A /* eject-hover-16x16@2x.png in Resources */, B6E4B5DC24FDE2670094A35C /* hkc8800a.plist in Resources */, B6374AE4260ECDDD0045CA16 /* maciihmu.plist in Resources */, - B6DDECC525057A550093587A /* drag-handle-4x10@3x.png in Resources */, B6E4B5DD24FDE2670094A35C /* apple2gsr0.plist in Resources */, - B6DE323C26044DB800418375 /* caution@3x.png in Resources */, B6E4B5DE24FDE2670094A35C /* mprof3.plist in Resources */, B6E4B5DF24FDE2670094A35C /* basis108.plist in Resources */, - B6DDECD52505A86E0093587A /* eject-hover-16x16@3x.png in Resources */, B6DD1FE925B407E7004A3242 /* maclc.plist in Resources */, B6E4B5E024FDE2670094A35C /* agat7.plist in Resources */, B6E4B5E124FDE2670094A35C /* elppa.plist in Resources */, @@ -1093,11 +1098,9 @@ B6DE324D2605482500418375 /* macplus.plist in Resources */, B6E4B5ED24FDE2670094A35C /* Preferences.xib in Resources */, B6374ADE260ECB400045CA16 /* maciivx.plist in Resources */, - B6DDECD72505A86E0093587A /* eject-16x16.png in Resources */, B6E4B5EF24FDE2670094A35C /* apple2gs.plist in Resources */, B6E4B5F024FDE2670094A35C /* apple2jp.plist in Resources */, B6E4B5F124FDE2670094A35C /* apple2.plist in Resources */, - B6DDECC325057A550093587A /* drag-handle-4x10@2x.png in Resources */, B6E4B5F224FDE2670094A35C /* prav8m.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1190,6 +1193,7 @@ B6E4B5B324FDE2670094A35C /* MediaViewController.m in Sources */, B64AF1F7250ED5E400A09B9B /* TableCellView.m in Sources */, B6E4B5B424FDE2670094A35C /* FlippedView.m in Sources */, + B615A9A026640A70001FBF99 /* NewSlotViewController.m in Sources */, B6665C15265A0E3E00254939 /* AutocompleteControl.m in Sources */, B6E4B5B524FDE2670094A35C /* AppDelegate.m in Sources */, B66D0FE82611386C000902F1 /* SoftwareList.m in Sources */, @@ -1373,7 +1377,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1425,7 +1429,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = macosx; diff --git a/Ample/AppDelegate.m b/Ample/AppDelegate.m index 22c94bc..518f876 100644 --- a/Ample/AppDelegate.m +++ b/Ample/AppDelegate.m @@ -96,10 +96,15 @@ @"xfz", path ]; - [task setExecutableURL: [NSURL fileURLWithPath: @"/usr/bin/tar"]]; + if (@available(macOS 10.13, *)) { + [task setExecutableURL: [NSURL fileURLWithPath: @"/usr/bin/tar"]]; + [task setCurrentDirectoryURL: sd]; + } else { + [task setLaunchPath: @"/usr/bin/tar"]; + [task setCurrentDirectoryPath: SupportDirectoryPath()]; + } [task setArguments: argv]; - [task setCurrentDirectoryURL: sd]; - + dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)); [task setTerminationHandler: ^(NSTask *task){ diff --git a/Ample/AutocompleteControl.m b/Ample/AutocompleteControl.m index b54876f..4bc23ae 100644 --- a/Ample/AutocompleteControl.m +++ b/Ample/AutocompleteControl.m @@ -411,8 +411,11 @@ Todo -- -(void)_init { _backgroundColor = [NSColor windowBackgroundColor]; - _selectedColor = [NSColor selectedContentBackgroundColor]; - + if (@available(macOS 10.14, *)) { + _selectedColor = [NSColor selectedContentBackgroundColor]; + } else { + _selectedColor = [NSColor selectedTextBackgroundColor]; + } NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveInActiveApp; _trackingArea = [[NSTrackingArea alloc] initWithRect: NSZeroRect options: options diff --git a/Ample/Base.lproj/CheatSheet.xib b/Ample/Base.lproj/CheatSheet.xib index c480414..c1068d8 100644 --- a/Ample/Base.lproj/CheatSheet.xib +++ b/Ample/Base.lproj/CheatSheet.xib @@ -1,16 +1,12 @@ - - - - @@ -23,19 +19,6 @@ - - - diff --git a/Ample/Base.lproj/LaunchWindow.xib b/Ample/Base.lproj/LaunchWindow.xib index 5299d12..5cdd854 100644 --- a/Ample/Base.lproj/LaunchWindow.xib +++ b/Ample/Base.lproj/LaunchWindow.xib @@ -1,7 +1,6 @@ - diff --git a/Ample/Base.lproj/MediaView.xib b/Ample/Base.lproj/MediaView.xib index 4973f51..ee41653 100644 --- a/Ample/Base.lproj/MediaView.xib +++ b/Ample/Base.lproj/MediaView.xib @@ -1,7 +1,6 @@ - diff --git a/Ample/CheatSheetWindowController.m b/Ample/CheatSheetWindowController.m index 3a5db93..7b7e4ae 100644 --- a/Ample/CheatSheetWindowController.m +++ b/Ample/CheatSheetWindowController.m @@ -27,6 +27,20 @@ - (void)windowDidLoad { [super windowDidLoad]; + if (!_webView) { + WKWebView *webView; + NSWindow *window = [self window]; + CGRect frame = [[window contentView] frame]; + + + webView = [WKWebView new]; + [webView setFrame: frame]; + [webView setNavigationDelegate: self]; + [[window contentView]addSubview: webView]; + _webView = webView; + } + + [_webView setHidden: YES]; NSBundle *bundle = [NSBundle mainBundle]; NSURL *url = [bundle URLForResource: @"CheatSheet" withExtension: @"html"]; diff --git a/Ample/DiskImagesWindowController.m b/Ample/DiskImagesWindowController.m index 3ac659b..f76c49c 100644 --- a/Ample/DiskImagesWindowController.m +++ b/Ample/DiskImagesWindowController.m @@ -67,8 +67,11 @@ [window setRestorable: YES]; [window setRestorationClass: [self class]]; - - [_tableView registerForDraggedTypes: @[NSPasteboardTypeFileURL]]; + if (@available(macOS 10.13, *)) { + [_tableView registerForDraggedTypes: @[NSPasteboardTypeFileURL]]; + } else { + [_tableView registerForDraggedTypes: @[ (NSString *)kUTTypeFileURL ]]; + } [_tableView setDraggingSourceOperationMask: NSDragOperationCopy forLocal: NO]; // enable drag/drop to othr apps. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. @@ -95,6 +98,11 @@ [nc addObserver: self selector: @selector(willTerminate:) name: NSApplicationWillTerminateNotification object: nil]; } +-(void)timerCallback: (NSTimer *)timer { + _timer = nil; + [self saveFile]; +} + -(void)diskImageAdded: (NSNotification *)notification { NSURL *url = [notification object]; @@ -105,11 +113,15 @@ -(void)markDirty { _dirty = YES; if (_timer) [_timer invalidate]; + _timer = [NSTimer scheduledTimerWithTimeInterval: 5 * 60 target: self selector: @selector(timerCallback:) userInfo: nil repeats: NO]; +#if 0 + // 10.12+ _timer = [NSTimer scheduledTimerWithTimeInterval: 5 * 60 repeats: NO block: ^(NSTimer *t) { self->_timer = nil; [self saveFile]; }]; +#endif } -(void)saveFile { @@ -306,11 +318,16 @@ for (NSPasteboardItem *item in [pb pasteboardItems]) { // need to convert from a string to a url back to a file in case it's a file id url? - NSString *s = [item stringForType: NSPasteboardTypeFileURL]; + NSString *s; + if (@available(macOS 10.13, *)) { + s = [item stringForType: NSPasteboardTypeFileURL]; + } else { + // El Capitan still has kUTTypeFileURL aka public.file-url but doesn't have NSPasteboardTypeFileURL + s = [item stringForType: (NSString *)kUTTypeFileURL]; + } if (!s) continue; NSURL *url = [NSURL URLWithString: s]; if (!url) continue; - ok |= [self addFile: url]; } return ok; diff --git a/Ample/LogWindowController.m b/Ample/LogWindowController.m index d73d307..d7d53d5 100644 --- a/Ample/LogWindowController.m +++ b/Ample/LogWindowController.m @@ -53,9 +53,16 @@ static NSMutableSet *LogWindows; } NSTask *task = [NSTask new]; - [task setExecutableURL: url]; + + if (@available(macOS 10.13, *)) { + [task setExecutableURL: url]; + [task setCurrentDirectoryURL: MameWorkingDirectory()]; + } else { + [task setLaunchPath: MamePath()]; + [task setCurrentDirectoryPath: MameWorkingDirectoryPath()]; + } + [task setArguments: args]; - [task setCurrentDirectoryURL: MameWorkingDirectory()]; return [LogWindowController controllerForTask: task]; } @@ -84,20 +91,39 @@ static NSMutableSet *LogWindows; if (_task) return nil; - NSError *error = nil; NSPipe *pipe = [NSPipe pipe]; // window not yet loaded until [self window] called. - const char *path = [[task executableURL] fileSystemRepresentation]; -// if (cp) [self appendString: [NSString stringWithFormat: @"MAME path: %s", cp]]; - const char *wd = [[task currentDirectoryURL] fileSystemRepresentation]; -// if (cp) [self appendString: [NSString stringWithFormat: @"Working Directory: %s", cp]]; + + const char *path = nil; + const char *wd = nil; + [task setStandardError: pipe]; [task setStandardOutput: pipe]; - [task launchAndReturnError: &error]; - + if (@available(macOS 10.13, *)) { + NSError *error = nil; + path = [[task executableURL] fileSystemRepresentation]; + wd = [[task currentDirectoryURL] fileSystemRepresentation]; + [task launchAndReturnError: &error]; + if (error) { + NSLog(@"NSTask error. Path = %s error = %@", path, error); + } + return error; + } else { + path = [[task launchPath] fileSystemRepresentation]; + wd = [[task currentDirectoryPath] fileSystemRepresentation]; + @try { + [task launch]; + } @catch (NSException *exception) { + + NSLog(@"NSTask exception. Path = %s exception = %@", path, exception); + return nil; // ? + } + } + +#if 0 if (error) { // NSURL *url = [task executableURL]; // NSString *path = [NSString stringWithCString: [url fileSystemRepresentation] encoding: NSUTF8StringEncoding]; @@ -106,6 +132,7 @@ static NSMutableSet *LogWindows; // [self appendString: [error description]]; return error; } +#endif _task = task; NSString *title = [NSString stringWithFormat: @"Ample Log - %u", [task processIdentifier]]; [[self window] setTitle: title]; diff --git a/Ample/MediaViewController.m b/Ample/MediaViewController.m index 318b10f..1827451 100644 --- a/Ample/MediaViewController.m +++ b/Ample/MediaViewController.m @@ -222,15 +222,20 @@ [pc bind: @"enabled" toObject: self withKeyPath: @"valid" options: options]; [button unbind: @"enabled"]; - [button unbind: @"contentTintColor"]; t = [NSValueTransformer valueTransformerForName: NSIsNotNilTransformerName]; options = @{ NSValueTransformerBindingOption: t}; [button bind: @"enabled" toObject: self withKeyPath: @"url" options: options]; - t = [NSValueTransformer valueTransformerForName: @"ValidColorTransformer"]; - options = @{ NSValueTransformerBindingOption: t}; - [button bind: @"contentTintColor" toObject: self withKeyPath: @"valid" options: options]; - + + if (@available(macOS 10.14, *)) { + [button unbind: @"contentTintColor"]; + + t = [NSValueTransformer valueTransformerForName: @"ValidColorTransformer"]; + options = @{ NSValueTransformerBindingOption: t}; + [button bind: @"contentTintColor" toObject: self withKeyPath: @"valid" options: options]; + } else { + // El Capitan TODO... + } #if 0 NSColor *tintColor = nil; if (!_valid) tintColor = [NSColor systemRedColor]; diff --git a/Ample/Slot.m b/Ample/Slot.m index be17ff5..d3b65d3 100644 --- a/Ample/Slot.m +++ b/Ample/Slot.m @@ -323,12 +323,15 @@ static NSDictionary *IndexMap = nil; [button unbind: @"selectedIndex"]; NSMenu *menu = [button menu]; NSArray *menuItems = [self menuItems]; - + + // [menu setItemArray: ] doesn't work prior to 10.14, apparently. + [menu removeAllItems]; if (_index == kSMARTPORT) { - [menu setItemArray: @[]]; + //[menu setItemArray: @[]]; [button setHidden: YES]; } else { - [menu setItemArray: menuItems]; + //[menu setItemArray: menuItems]; + for (NSMenuItem *x in menuItems) [menu addItem: x]; [button bind: @"selectedIndex" toObject: self withKeyPath: @"selectedIndex" options: nil]; [button setHidden: NO]; } diff --git a/Ample/SoftwareList.m b/Ample/SoftwareList.m index e19562f..7781f82 100644 --- a/Ample/SoftwareList.m +++ b/Ample/SoftwareList.m @@ -367,7 +367,7 @@ NSArray *SoftwareListForMachine(NSString *machine) { NSLog(@"SoftwareListForMachine: %@ %@: %@", machine, xml, error); continue; } - [cache setObject: sw forKey: xml]; + if (sw) [cache setObject: sw forKey: xml]; } if (filter) { sw = [sw filter: filter]; @@ -479,7 +479,7 @@ NSArray *SoftwareListForMachine(NSString *machine) { NSLog(@"SoftwareListForMachine: %@ %@: %@", machine, xml, error); continue; } - [cache setObject: sw forKey: xml]; + if (sw) [cache setObject: sw forKey: xml]; } if (filter) { sw = [sw filter: filter]; diff --git a/embedded/download-sdl.sh b/embedded/download-sdl.sh new file mode 100644 index 0000000..045abd3 --- /dev/null +++ b/embedded/download-sdl.sh @@ -0,0 +1,16 @@ + +#!/bin/sh + +DMG=SDL2-2.0.14.dmg +URL=https://www.libsdl.org/release/SDL2-2.0.14.dmg +FRAMEWORK=SDL2.framework + +if [ -e $FRAMEWORK ] ; then exit 0 ; fi + +if [ ! -e $DMG ] ; then curl -OL $URL ; fi + +hdiutil attach $DMG -noverify -nobrowse -mountpoint /Volumes/sdl_disk_image + +# cp -r /sdl_disk_image/$FRAMEWORK ./ +ditto /Volumes/sdl_disk_image/$FRAMEWORK $FRAMEWORK +hdiutil detach /Volumes/sdl_disk_image