-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAppDelegate.swift
792 lines (670 loc) · 21.6 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
//
// AppDelegate.swift
// GoD Tool
//
// Created by StarsMmd on 29/06/2016.
// Copyright © 2016 StarsMmd. All rights reserved.
//
import AppKit
let appDelegate = (NSApp.delegate as! AppDelegate)
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var homeViewController : GoDHomeViewController!
@IBOutlet weak var scriptClassesMenuItem: NSMenuItem!
@IBOutlet weak var scriptCompilerMenuItem: NSMenuItem!
@IBOutlet weak var experimentalFeaturesMenuItem: NSMenuItem!
@IBOutlet weak var ereaderSubMenu: NSMenuItem!
@IBOutlet weak var ereaderSeparator: NSMenuItem!
@IBOutlet weak var godtoolmenuitem: NSMenuItem!
@IBOutlet weak var godtoolaboutmenuitem: NSMenuItem!
@IBOutlet weak var quitgodtoolmenuitem: NSMenuItem!
@IBOutlet weak var godtoolhelpmenuitem: NSMenuItem!
@IBOutlet weak var specialUtilities: NSMenuItem!
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
if game == .Colosseum {
scriptClassesMenuItem.isHidden = true
scriptCompilerMenuItem.isHidden = true
godtoolmenuitem.title = "Colosseum Tool"
godtoolaboutmenuitem.title = "About Colosseum Tool"
quitgodtoolmenuitem.title = "Quit Colosseum Tool"
godtoolhelpmenuitem.title = "Colosseum Tool Help"
}
#if !GAME_PBR
if game != .Colosseum {
ereaderSubMenu.isHidden = true
ereaderSeparator.isHidden = true
}
#endif
experimentalFeaturesMenuItem.isEnabled = false
var countDownDate: Date?
var posterFile: XGFiles?
var musicScriptFile: XGFiles?
var iso: XGFiles?
var argsAreInvalid = false
var verbose = false
let args = CommandLine.arguments
for i in 0 ..< args.count {
guard i < args.count - 1 else { continue }
let arg = args[i]
let next = args[i + 1]
if arg == "--launch-dpp-date" {
countDownDate = Date.fromString(next)
if countDownDate == nil {
let secondsToDecember: Double = 31_104_000
print("Invalid arg for \(arg) \(next)\nDate must be of format:", Date(timeIntervalSince1970: secondsToDecember).referenceString())
argsAreInvalid = true
}
} else if arg == "--launch-dpp-secs",
let seconds = next.integerValue {
countDownDate = Date(timeIntervalSinceNow: Double(seconds))
} else if arg == "--launch-dpp-poster" {
let file = XGFiles.path(next)
if XGFileTypes.imageFormats.contains(file.fileType) {
posterFile = file
if !file.exists {
print("Invalid arg for \(arg).\nFile doesn't exist:", file.path)
argsAreInvalid = true
}
} else {
print("Invalid arg for \(arg): \(file.path).\nThese image formats are supported:", XGFileTypes.imageFormats.map{$0.fileExtension})
argsAreInvalid = true
}
} else if arg == "--launch-dpp-music" {
let file = XGFiles.path(next)
musicScriptFile = file
if !file.exists {
print("Invalid arg for \(arg).\nFile doesn't exist:", file.path)
argsAreInvalid = true
}
} else if arg == "-i" || arg == "--iso" {
let file = XGFiles.path(next)
if file.fileType == .iso {
iso = file
}
if !file.exists {
print("Invalid arg for \(arg).\nFile doesn't exist:", file.path)
argsAreInvalid = true
}
} else if arg == "-s" || arg == "--silent-logs" {
silentLogs = true
}
if arg == "-v" || arg == "--verbose" {
verbose = true
}
}
if argsAreInvalid {
ToolProcess.terminate()
}
if let isoFile = iso {
XGISO.loadISO(file: isoFile)
}
XGSettings.current.verbose = verbose
if let date = countDownDate {
let timer = Timer(timeInterval: 2, repeats: false) { (t) in
self.launchDPP(startDate: date, posterFile: posterFile, musicScriptFile: musicScriptFile)
}
RunLoop.current.add(timer, forMode: .common)
}
}
func decodeInputFiles(_ files: [XGFiles]) {
// if no iso has been loaded then the tool needs to load these files without context from the rest of the iso
fileDecodingMode = XGISO.inputISOFile == nil
for file in files {
guard file.exists else {
printg("cannot open file:", file.path, "\nIt doesn't exist.")
continue
}
printg("opening filepath:", file.path)
switch file.fileType {
case .gtx, .atx:
let texture = file.texture
let vc = GoDGTXViewController()
vc.texture = texture
present(vc)
case .msg:
let table = file.stringTable
let storyboard = NSStoryboard(name: "Messages", bundle: nil)
if let vc = storyboard.instantiateInitialController() as? GoDMessageViewController {
vc.singleTable = table
present(vc)
}
case .fsys:
let outputFolder = XGFolders.nameAndFolder(file.fileName.removeFileExtensions(), file.folder)
outputFolder.createDirectory()
printg("Unzipping contents of \(file.path) to \(outputFolder.path)")
let fsysData = file.fsysData
fsysData.extractFilesToFolder(folder: outputFolder, decode: true)
default:
break
}
}
fileDecodingMode = false
}
func application(_ application: NSApplication, open urls: [URL]) {
if urls.count > 0 {
let files = urls.map { (fileurl) -> XGFiles in
return fileurl.file
}.filter{$0.fileType != .unknown}
openFiles(files)
}
}
func openFiles(_ files: [XGFiles]) {
guard files.count > 0 else {
printg("No input files given.")
return
}
defer {
updateExperimentalMenuItem()
}
if let isoFile = files.first(where: {$0.fileType == .iso && $0.exists}) {
printg("opening ISO:", isoFile.path)
guard XGISO.loadISO(file: isoFile) else {
return
}
homeViewController.reload()
} else {
decodeInputFiles(files)
return
}
let noDocumentsFolder = !XGFolders.Documents.exists
XGFolders.setUpFolderFormat()
if noDocumentsFolder {
printg("Created folder structure at:", XGFolders.Documents.path)
}
}
func applicationWillTerminate(_ aNotification: Notification) {
printg("The tool is now closing.")
if XGFolders.LZSS.files.count > 0 {
printg("deleting LZSS files...")
}
for file in XGFolders.LZSS.files where file.fileType == .lzss {
file.delete()
}
}
@IBAction func openFilePicker(_ sender: Any) {
let panel = NSOpenPanel()
panel.allowsMultipleSelection = true
panel.canChooseDirectories = false
panel.canChooseFiles = true
panel.canDownloadUbiquitousContents = false
panel.canResolveUbiquitousConflicts = false
panel.isAccessoryViewDisclosed = false
panel.resolvesAliases = true
panel.allowedFileTypes = ["gtx", "atx", "msg", "fsys", "iso"]
panel.begin { (result) in
if result == .OK {
let urls = panel.urls
if urls.count > 0 {
self.application(NSApplication.shared, open: urls)
}
}
}
}
@IBAction func addFileToISO(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
let panel = NSOpenPanel()
panel.allowsMultipleSelection = true
panel.canChooseDirectories = false
panel.canChooseFiles = true
panel.canDownloadUbiquitousContents = false
panel.canResolveUbiquitousConflicts = false
panel.isAccessoryViewDisclosed = false
panel.resolvesAliases = true
panel.begin { (result) in
if result == .OK {
let urls = panel.urls
if urls.count > 0 {
let files = urls.map { (fileurl) -> XGFiles in
return fileurl.file
}.filter{$0.fileType != .unknown}
XGISO.current.addFiles(files, save: true)
}
}
}
}
#if !GUI && os(macOS) && !GAME_PBR
lazy var discordDiscordPlaysOrre: DiscordPlaysOrre? = {
guard let botID = XGSettings.current.dppControllerBotID else {
displayAlert(title: "Missing bot token", description: "Missing setting for dpp bot token.\nCheck \(settingsFile.path)")
return nil
}
return DiscordPlaysOrre(discordBotToken: botID)
}()
#else
let discordDiscordPlaysOrre: DiscordPlaysOrre? = nil
#endif
func launchDPP(startDate: Date? = nil, posterFile: XGFiles? = nil, musicScriptFile: XGFiles? = nil) {
guard homeViewController.checkRequiredFiles() else {
return
}
#if !GAME_PBR
GoDCountDownViewController.launch(
endDate: startDate ?? .init(timeIntervalSinceNow: 0),
image: posterFile,
musicScript: musicScriptFile,
isFullScreen: true
) { countdownVC in
XGThreadManager.manager.runInBackgroundAsync(queue: 3) { [weak self] in
self?.discordDiscordPlaysOrre?.launch()
}
}
#endif
}
@IBAction func specialButton(_ sender: Any) {
launchDPP(startDate: .init(timeIntervalSinceNow: 0), posterFile: .nameAndFolder("poster.gif", .Documents), musicScriptFile: .nameAndFolder("music.sh", .Documents))
}
@IBAction func specialButton2(_ sender: Any) {
launchDPP(startDate: .init(timeIntervalSinceNow: 60), posterFile: .nameAndFolder("poster.gif", .Documents), musicScriptFile: .nameAndFolder("music.sh", .Documents))
}
@IBAction func specialButton3(_ sender: Any) {
launchDPP(startDate: .init(timeIntervalSinceNow: 3600), posterFile: .nameAndFolder("poster.gif", .Documents), musicScriptFile: .nameAndFolder("music.sh", .Documents))
}
@IBAction func getFreeStringID(_ sender: Any) {
#if !GAME_PBR
guard homeViewController.checkRequiredFiles() else {
return
}
guard !isSearchingForFreeStringID else {
displayAlert(title: "Please wait", description: "Please wait for previous string id search to complete.")
return
}
printg("Searching for free string id...")
XGThreadManager.manager.runInBackgroundAsync {
if let id = freeMSGID() {
XGThreadManager.manager.runInForegroundAsync {
displayAlert(title: "Free String ID", description: "The next free id is: \(id) (\(id.hexString()))")
}
} else {
XGThreadManager.manager.runInForegroundAsync {
displayAlert(title: "Free String ID", description: "Failed to find a free string id")
}
}
}
#endif
}
@IBAction func enableExperimentalFeatures(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGSettings.current.enableExperimentalFeatures = !XGSettings.current.enableExperimentalFeatures
XGSettings.current.save()
updateExperimentalMenuItem()
}
func updateExperimentalMenuItem() {
experimentalFeaturesMenuItem.title = XGSettings.current.enableExperimentalFeatures ? "Disable Experimental Features" : "Enable Experimental Features"
experimentalFeaturesMenuItem.isEnabled = XGISO.inputISOFile != nil
}
@IBAction func setVerboseLogs(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
printg("Set verbose logs")
XGSettings.current.verbose = true
XGSettings.current.save()
}
@IBAction func setFastLogs(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
printg("Set fast logs")
XGSettings.current.verbose = false
XGSettings.current.save()
}
@IBAction func deleteLogs(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
printg("Deleting logs...")
for file in XGFolders.Logs.files where file.fileType == .txt {
file.delete()
}
printg("Logs deleted")
}
@IBAction func extractISO(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
printg("extracting iso")
XGFolders.setUpFolderFormat()
XGUtility.extractAllFiles(decode: false)
printg("extraction complete")
displayAlert(title: "ISO Extraction Complete", description: "Done.")
}
@IBAction func extractAndDecodeISO(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
printg("extracting iso")
XGFolders.setUpFolderFormat()
XGUtility.extractAllFiles(decode: true)
printg("extraction complete")
displayAlert(title: "ISO Extraction Complete", description: "Done.")
}
var isBuilding = false
@IBAction func quickBuildISO(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
guard !isBuilding else {
displayAlert(title: "Please wait", description: "Please wait for previous build to complete.")
return
}
isBuilding = true
printg("Quick building ISO...")
XGThreadManager.manager.runInBackgroundAsync {
XGUtility.compileMainFiles()
if filesTooLargeForReplacement != nil {
var text = "Files too large to replace:"
for file in filesTooLargeForReplacement! {
text += "\n\(file.fileName)"
}
text += "\n\nSet 'ISO > Enable File Size Increases' to include them."
filesTooLargeForReplacement = nil
displayAlert(title: "Quick Build Incomplete", description: text)
} else {
displayAlert(title: "Done", description: "Quick build completed successfully!")
}
self.isBuilding = false
}
}
@IBAction func rebuildISO(_ sender: AnyObject) {
guard homeViewController.checkRequiredFiles() else {
return
}
guard !isBuilding else {
displayAlert(title: "Please wait", description: "Please wait for previous build to complete.")
return
}
isBuilding = true
printg("Rebuilding ISO...")
XGThreadManager.manager.runInBackgroundAsync {
XGUtility.compileAllFiles()
if filesTooLargeForReplacement != nil {
var text = "Files too large to replace:"
for file in filesTooLargeForReplacement! {
text += "\n\(file.fileName)"
}
text += "\n\nSet 'ISO > Enable File Size Increases' to include them."
filesTooLargeForReplacement = nil
displayAlert(title: "Reuild Incomplete", description: text)
} else {
displayAlert(title: "Done", description: "ISO rebuild completed successfully!")
}
self.isBuilding = false
}
}
@IBAction func getXDSMacros(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGThreadManager.manager.runInBackgroundAsync {
if game != .PBR {
XGUtility.documentMacrosXDS()
printg("Finished saving XDS macros file.")
}
}
}
@IBAction func getXDSClasses(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGThreadManager.manager.runInBackgroundAsync {
if game == .XD {
XGUtility.documentXDSClasses()
printg("Finished saving XDS classes file.")
}
}
}
@IBAction func saveSublime(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGThreadManager.manager.runInBackgroundAsync {
let formatName = game == .Colosseum ? "CMS" : "XDS"
let files : [XGResources] = [
XGResources.sublimeSyntax("\(formatName)cript"),
XGResources.sublimeSettings("\(formatName)ript"),
XGResources.sublimeColourScheme("\(formatName)ript"),
XGResources.sublimeSyntax("SCD"),
XGResources.sublimeColourScheme("SCD"),
XGResources.sublimePreferences("Comments")
]
let folder = XGFolders.nameAndFolder("Sublime", .Reference)
for file in files {
printg("Saving: \(file.fileName) to folder: \(folder.path)")
let data = file.data
data.file = .nameAndFolder(file.fileName, folder)
data.save()
}
printg("Saving: \(formatName)ript.sublime-completions to folder: \(folder.path). This may take a while")
if !fileDecodingMode {
XGUtility.documentXDSAutoCompletions(toFile: .nameAndFolder("\(formatName)ript.sublime-completions", folder))
}
printg("saved sublime files.")
}
}
@IBAction func installSublime(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
let formatName = game == .Colosseum ? "CMS" : "XDS"
printg("Installing \(formatName) Plugin files for Sublime Text 3...")
XGThreadManager.manager.runInBackgroundAsync {
let files : [XGResources] = [
XGResources.sublimeSyntax("\(formatName)cript"),
XGResources.sublimeSettings("\(formatName)cript"),
XGResources.sublimeColourScheme("\(formatName)cript"),
XGResources.sublimeSyntax("SCD"),
XGResources.sublimeColourScheme("SCD"),
XGResources.sublimePreferences("Comments")
]
let path = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true)[0] + "/Application Support/Sublime Text 3/Packages"
let folder = XGFolders.nameAndPath("User", path)
folder.createDirectory()
if folder.exists {
for file in files {
let saveFile = XGFiles.nameAndFolder(file.fileName, folder)
printg("Installing: \(file.fileName) to path: \(saveFile.path)")
let data = file.data
data.file = saveFile
data.save()
}
let saveFile = XGFiles.nameAndFolder("\(formatName)cript.sublime-completions", folder)
printg("Installing: \(formatName)cript.sublime-completions to path: \(saveFile.path). This may take a while.")
if !fileDecodingMode {
XGUtility.documentXDSAutoCompletions(toFile: saveFile)
}
printg("Installation Complete.")
} else {
printg("Failed to install. Couldn't find folder: \(folder.path)")
}
}
}
@IBAction func dumpTextures(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
displayAlert(title: "Dumping Textures", description: "This will run in the background. It will take a while. There will be an alert once it is done.")
XGThreadManager.manager.runInBackgroundAsync {
XGUtility.extractAllTextures(forDolphin: false)
displayAlert(title: "Texture Dump Finsihed", description: "Done.")
}
}
@IBAction func dumpDolphinTextures(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
displayAlert(title: "Dumping Textures", description: "This will run in the background. It will take a while. There will be an alert once it is done.")
XGThreadManager.manager.runInBackgroundAsync {
XGUtility.extractAllTextures(forDolphin: true)
displayAlert(title: "Texture Dump Finsihed", description: "Done.")
}
}
@IBAction func ironmon(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGUtility.setupIronMonRules()
}
@IBAction func increaseNPCLevelsBy10(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGUtility.increasePokemonLevelsByPercentage(10)
}
@IBAction func increaseNPCLevelsBy20(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGUtility.increasePokemonLevelsByPercentage(20)
}
@IBAction func increaseNPCLevelsBy50(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGUtility.increasePokemonLevelsByPercentage(50)
}
@IBAction func decryptEreaderCards(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
if game == .Colosseum {
XGUtility.decryptEReaderCards()
}
}
@IBAction func decodeEreaderCards(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
if game == .Colosseum {
XGUtility.decodeEReaderCards()
}
}
@IBAction func encodeEreaderCards(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
if game == .Colosseum {
XGUtility.encodeEReaderCards()
}
}
@IBAction func encryptEreaderCards(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
if game == .Colosseum {
XGUtility.encryptEReaderCards()
}
}
@IBAction func decryptAndDecodeEreaderCards(_ sender: Any) {
decryptEreaderCards(self)
decodeEreaderCards(self)
}
@IBAction func encodeAndEncryptEreaderCards(_ sender: Any) {
encodeEreaderCards(self)
encryptEreaderCards(self)
}
#if GAME_PBR
@IBAction func create1Pokemon(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGPatcher.increasePokemonTotal(by: 1)
}
@IBAction func create10Pokemon(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGPatcher.increasePokemonTotal(by: 10)
}
@IBAction func create100Pokemon(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
XGPatcher.increasePokemonTotal(by: 100)
}
#endif
@IBAction func showHexCalculator(_ sender: Any) {
homeViewController.performSegue(withIdentifier: "toHexCalcVC", sender: self.homeViewController)
}
@IBAction func showStringIDTool(_ sender: Any) {
performSegue("toStringVC")
}
func present(_ controller: NSViewController) {
homeViewController.presentAsModalWindow(controller)
}
func show(_ controller: NSViewController) {
let window = NSWindow(contentViewController: controller)
NSWindowController().showWindow(window)
}
@IBAction func showAbout(_ sender: AnyObject) {
displayAlert(title: "About GoD Tool", description: aboutMessage())
}
@IBAction func showHelp(_ sender: Any) {
self.performSegue("toHelpVC")
}
func performSegue(_ name: String) {
let alwaysAllowedSegues = ["toAlertVC", "toAboutVC"]
guard alwaysAllowedSegues.contains(name) || homeViewController.checkRequiredFiles() else {
return
}
homeViewController.performSegue(withIdentifier: name, sender: self)
}
@IBAction func openTextureImporter(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toTextureVC")
}
@IBAction func openScriptCompiler(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toScriptVC")
}
@IBAction func openStatsEditor(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toStatsVC")
}
@IBAction func openMoveEditor(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toMoveVC")
}
@IBAction func openGiftEditor(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toGiftVC")
}
@IBAction func openPatchEditor(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toPatchVC")
}
@IBAction func openContextTool(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toContextVC")
}
@IBAction func openRandomiser(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toRandomiserVC")
}
@IBAction func exporeISO(_ sender: Any) {
guard homeViewController.checkRequiredFiles() else {
return
}
performSegue("toISOVC")
}
}