diff --git a/shell/apple/emulator-osx/emulator-osx/AppDelegate.swift b/shell/apple/emulator-osx/emulator-osx/AppDelegate.swift index 59aa9d348..0119a128b 100644 --- a/shell/apple/emulator-osx/emulator-osx/AppDelegate.swift +++ b/shell/apple/emulator-osx/emulator-osx/AppDelegate.swift @@ -14,12 +14,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet weak var window: NSWindow! - func applicationDidFinishLaunching(aNotification: NSNotification) { + func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application emu_main(); } - func applicationWillTerminate(aNotification: NSNotification) { + func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } diff --git a/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift b/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift index 320baa974..c7a171012 100644 --- a/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift +++ b/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift @@ -14,8 +14,8 @@ class EmuGLView: NSOpenGLView { return true; } - override func drawRect(dirtyRect: NSRect) { - super.drawRect(dirtyRect) + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) // Drawing code here. // screen_width = view.drawableWidth; @@ -26,16 +26,16 @@ class EmuGLView: NSOpenGLView { openGLContext!.makeCurrentContext() - while !emu_single_frame(Int32(dirtyRect.width), Int32(dirtyRect.height)) { } + while 0==emu_single_frame(Int32(dirtyRect.width), Int32(dirtyRect.height)) { } openGLContext!.flushBuffer() } override func awakeFromNib() { - var renderTimer = NSTimer.scheduledTimerWithTimeInterval(0.001, target: self, selector: Selector("timerTick"), userInfo: nil, repeats: true) + var renderTimer = Timer.scheduledTimer(timeInterval: 0.001, target: self, selector: #selector(EmuGLView.timerTick), userInfo: nil, repeats: true) - NSRunLoop.currentRunLoop().addTimer(renderTimer, forMode: NSDefaultRunLoopMode); - NSRunLoop.currentRunLoop().addTimer(renderTimer, forMode: NSEventTrackingRunLoopMode); + RunLoop.current.add(renderTimer, forMode: RunLoopMode.defaultRunLoopMode); + RunLoop.current.add(renderTimer, forMode: RunLoopMode.eventTrackingRunLoopMode); let attrs:[NSOpenGLPixelFormatAttribute] = [ @@ -49,7 +49,7 @@ class EmuGLView: NSOpenGLView { let pf = NSOpenGLPixelFormat(attributes:attrs) - let context = NSOpenGLContext(format: pf!, shareContext: nil); + let context = NSOpenGLContext(format: pf!, share: nil); self.pixelFormat = pf; self.openGLContext = context; @@ -63,11 +63,11 @@ class EmuGLView: NSOpenGLView { self.needsDisplay = true; } - override func keyDown(e: NSEvent) { + override func keyDown(with e: NSEvent) { emu_key_input(e.characters!, 1); } - override func keyUp(e: NSEvent) { + override func keyUp(with e: NSEvent) { emu_key_input(e.characters!, 0); } diff --git a/shell/apple/emulator-osx/emulator-osx/emulator-osx-Bridging-Header.h b/shell/apple/emulator-osx/emulator-osx/emulator-osx-Bridging-Header.h index 2765dee13..6183158b7 100644 --- a/shell/apple/emulator-osx/emulator-osx/emulator-osx-Bridging-Header.h +++ b/shell/apple/emulator-osx/emulator-osx/emulator-osx-Bridging-Header.h @@ -10,7 +10,7 @@ #define emulator_osx_osx_main_Bridging_Header_h void emu_main(); -bool emu_single_frame(int w, int h); +int emu_single_frame(int w, int h); void emu_gles_init(); void emu_key_input(const char* key, int state); #endif diff --git a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm index 8dccbf7db..a50798401 100644 --- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm +++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm @@ -127,7 +127,7 @@ extern int screen_width,screen_height; bool rend_single_frame(); bool gles_init(); -extern "C" bool emu_single_frame(int w, int h) { +extern "C" int emu_single_frame(int w, int h) { if (!has_init) return true; screen_width = w; @@ -194,4 +194,4 @@ extern "C" void emu_key_input(char* keyt, int state) { case 'i': handle_key(DPad_Up, state); break; case 0xa: handle_key(Btn_Start, state); break; } -} \ No newline at end of file +} diff --git a/shell/apple/emulator-osx/emulator-osxTests/emulator_osxTests.swift b/shell/apple/emulator-osx/emulator-osxTests/emulator_osxTests.swift index 218cea2bc..34a6f5024 100644 --- a/shell/apple/emulator-osx/emulator-osxTests/emulator_osxTests.swift +++ b/shell/apple/emulator-osx/emulator-osxTests/emulator_osxTests.swift @@ -28,7 +28,7 @@ class emulator_osxTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock() { + self.measure() { // Put the code you want to measure the time of here. } } diff --git a/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj b/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj index 818f3c750..4756bdfed 100644 --- a/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj +++ b/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj @@ -192,7 +192,7 @@ 84B7BF7F1B72720200F9733F /* stdclass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B7BEA71B72720200F9733F /* stdclass.cpp */; }; 84B7BF831B727AD700F9733F /* osx-main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84B7BF821B727AD700F9733F /* osx-main.mm */; }; 84B7BF861B72871600F9733F /* EmuGLView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B7BF851B72871600F9733F /* EmuGLView.swift */; }; - EBDF374F1BB96581001191B5 /* audiobackend_coreaudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBDF374D1BB96581001191B5 /* audiobackend_coreaudio.cpp */; settings = {ASSET_TAGS = (); }; }; + EBDF374F1BB96581001191B5 /* audiobackend_coreaudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBDF374D1BB96581001191B5 /* audiobackend_coreaudio.cpp */; }; EBDF37511BB969EE001191B5 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBDF37501BB969EE001191B5 /* CoreAudio.framework */; }; EBDF37531BB969F8001191B5 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBDF37521BB969F8001191B5 /* AudioUnit.framework */; }; /* End PBXBuildFile section */ @@ -1338,9 +1338,11 @@ TargetAttributes = { 84A388B21B1CDD3E000166C0 = { CreatedOnToolsVersion = 6.1; + LastSwiftMigration = 0820; }; 84A388C21B1CDD3F000166C0 = { CreatedOnToolsVersion = 6.1; + LastSwiftMigration = 0820; TestTargetID = 84A388B21B1CDD3E000166C0; }; }; @@ -1706,6 +1708,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_NAME = "reicast-osx"; SWIFT_OBJC_BRIDGING_HEADER = "emulator-osx/emulator-osx-Bridging-Header.h"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1734,6 +1737,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_NAME = "reicast-osx"; SWIFT_OBJC_BRIDGING_HEADER = "emulator-osx/emulator-osx-Bridging-Header.h"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1753,6 +1757,7 @@ INFOPLIST_FILE = "emulator-osxTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_NAME = "reicast-osxTests"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/reicast-osx.app/Contents/MacOS/reicast-osx"; }; name = Debug; @@ -1769,6 +1774,7 @@ INFOPLIST_FILE = "emulator-osxTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_NAME = "reicast-osxTests"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/reicast-osx.app/Contents/MacOS/reicast-osx"; }; name = Release; diff --git a/shell/apple/reicast.xcworkspace/xcshareddata/xcschemes/reicast-osx.xcscheme b/shell/apple/reicast.xcworkspace/xcshareddata/xcschemes/reicast-osx.xcscheme index c327f0db3..87ef230e4 100644 --- a/shell/apple/reicast.xcworkspace/xcshareddata/xcschemes/reicast-osx.xcscheme +++ b/shell/apple/reicast.xcworkspace/xcshareddata/xcschemes/reicast-osx.xcscheme @@ -51,10 +51,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -76,17 +76,21 @@ ReferencedContainer = "container:emulator-osx/reicast-osx.xcodeproj"> + + - + - +