Skip to content

Commit

Permalink
reworked install
Browse files Browse the repository at this point in the history
  • Loading branch information
marzent committed Dec 26, 2021
1 parent 0d633cf commit 8e28b5b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
filePath = "XIV on Mac/ViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "57"
endingLineNumber = "57"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "regedit(_:)"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -62,8 +62,8 @@
filePath = "XIV on Mac/Setup.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "80"
endingLineNumber = "80"
startingLineNumber = "82"
endingLineNumber = "82"
landmarkName = "XL()"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -78,8 +78,8 @@
filePath = "XIV on Mac/Setup.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
startingLineNumber = "74"
endingLineNumber = "74"
landmarkName = "XL()"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -94,8 +94,8 @@
filePath = "XIV on Mac/Setup.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "82"
endingLineNumber = "82"
startingLineNumber = "84"
endingLineNumber = "84"
landmarkName = "XL()"
landmarkType = "7">
</BreakpointContent>
Expand Down
2 changes: 1 addition & 1 deletion XIV on Mac/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Npe-xH-VEe">
<rect key="frame" x="-2" y="0.0" width="635" height="133"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Installing dependencies...." id="lcD-hh-CeT">
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Downloading dependencies...." id="lcD-hh-CeT">
<font key="font" metaFont="system" size="24"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down
10 changes: 9 additions & 1 deletion XIV on Mac/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@
import Foundation

extension Notification.Name {
static let depInstallDone = Notification.Name("DepInstallDonerNotification")
static let depInstall = Notification.Name("DepInstallNotification")
static let depInstallDone = Notification.Name("DepInstallDoneNotification")
static let depDownloadDone = Notification.Name("DepDownloadDoneNotification")
}

extension Notification {
enum dep: String {
case name
}
}
6 changes: 4 additions & 2 deletions XIV on Mac/Setup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Setup {
"https://download.visualstudio.microsoft.com/download/pr/1f5af042-d0e4-4002-9c59-9ba66bcf15f6/089f837de42708daacaae7c04b7494db/NDP472-KB4054530-x86-x64-AllOS-ENU.exe" : false,
"https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/abd170b4b0ec15ad0222a809b761a036/ndp48-x86-x64-allos-enu.exe" : false,]

static func dependencies() {
static func downloadDeps() {
for (url, _) in dep_urls {
FileDownloader.loadFileAsync(url: url, onFinish: downloadDone)
}
Expand All @@ -26,7 +26,7 @@ struct Setup {
static func downloadDone(url: String) {
dep_urls[url] = true
if dep_urls.allSatisfy({$0.value}) {
installDeps()
NotificationCenter.default.post(name: .depDownloadDone, object: nil)
}
}

Expand All @@ -42,6 +42,8 @@ struct Setup {
Util.launchWine(args: [Util.cache.appendingPathComponent("NDP472-KB4054530-x86-x64-AllOS-ENU.exe").path, "/norestart"], blocking: true)
setWine(version: "win10")
Util.launchWine(args: [Util.cache.appendingPathComponent("ndp48-x86-x64-allos-enu.exe").path, "/norestart"], blocking: true)
Setup.DXVK()
Setup.XL()
NotificationCenter.default.post(name: .depInstallDone, object: nil)

}
Expand Down
25 changes: 17 additions & 8 deletions XIV on Mac/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class XIVController: NSViewController {

override func viewDidAppear() {
super.viewDidAppear()
NotificationCenter.default.addObserver(self,selector: #selector(downloadDone(_:)),name: .depDownloadDone, object: nil)
NotificationCenter.default.addObserver(self,selector: #selector(depsDone(_:)),name: .depInstallDone, object: nil)
if !FileManager.default.fileExists(atPath: Util.localSettings + "XIVLauncher") {
NotificationCenter.default.addObserver(self,selector: #selector(depsDone(_:)),name: .depInstallDone, object: nil)
button.isHidden = true
DispatchQueue.main.async {
Setup.dependencies()
Setup.DXVK()
Setup.downloadDeps()
}
}
else {
Expand All @@ -28,12 +28,21 @@ class XIVController: NSViewController {
}
}

@objc
func downloadDone(_ notif: Notification) {
DispatchQueue.main.async {
self.status.stringValue = "Installing dependencies...."
Setup.installDeps()
}
}

@objc
func depsDone(_ notif: Notification) {
Setup.XL()
button.isHidden = false
self.view.window?.title = "XIV on Mac"
self.status.stringValue = "Click Play to start the game"
DispatchQueue.main.async {
self.button.isHidden = false
self.view.window?.title = "XIV on Mac"
self.status.stringValue = "Click Play to start the game"
}
}

@IBAction func play(_ sender: Any) {
Expand All @@ -42,7 +51,7 @@ class XIVController: NSViewController {
}

@IBAction func installDeps(_ sender: Any) {
Setup.dependencies()
Setup.downloadDeps()
}

@IBAction func installDXVK(_ sender: Any) {
Expand Down

0 comments on commit 8e28b5b

Please sign in to comment.