Skip to content

Commit defb4c2

Browse files
committed
Added Ui Improvements and other things
1 parent c4efd07 commit defb4c2

File tree

8 files changed

+100
-53
lines changed

8 files changed

+100
-53
lines changed

sm_osx.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
CODE_SIGN_IDENTITY = "Apple Development";
322322
CODE_SIGN_STYLE = Automatic;
323323
COMBINE_HIDPI_IMAGES = YES;
324-
CURRENT_PROJECT_VERSION = 20;
324+
CURRENT_PROJECT_VERSION = 21;
325325
DEVELOPMENT_ASSET_PATHS = "\"sm_osx/Preview Content\"";
326326
DEVELOPMENT_TEAM = 25RK3JMVLT;
327327
ENABLE_HARDENED_RUNTIME = NO;
@@ -335,7 +335,7 @@
335335
"$(inherited)",
336336
"@executable_path/../Frameworks",
337337
);
338-
MARKETING_VERSION = 1.1.8;
338+
MARKETING_VERSION = 1.1.9;
339339
ONLY_ACTIVE_ARCH = NO;
340340
PRODUCT_BUNDLE_IDENTIFIER = "com.CubingStudios.sm-osx";
341341
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -353,7 +353,7 @@
353353
CODE_SIGN_IDENTITY = "Apple Development";
354354
CODE_SIGN_STYLE = Automatic;
355355
COMBINE_HIDPI_IMAGES = YES;
356-
CURRENT_PROJECT_VERSION = 20;
356+
CURRENT_PROJECT_VERSION = 21;
357357
DEVELOPMENT_ASSET_PATHS = "\"sm_osx/Preview Content\"";
358358
DEVELOPMENT_TEAM = 25RK3JMVLT;
359359
ENABLE_HARDENED_RUNTIME = NO;
@@ -367,7 +367,7 @@
367367
"$(inherited)",
368368
"@executable_path/../Frameworks",
369369
);
370-
MARKETING_VERSION = 1.1.8;
370+
MARKETING_VERSION = 1.1.9;
371371
ONLY_ACTIVE_ARCH = NO;
372372
PRODUCT_BUNDLE_IDENTIFIER = "com.CubingStudios.sm-osx";
373373
PRODUCT_NAME = "$(TARGET_NAME)";

sm_osx/LauncherView.swift

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ import UserNotifications
1212
struct LauncherView: View {
1313

1414
@State var repoView = false
15+
@AppStorage("devMode") var devMode = true
1516
var shell = Shell()
1617
@Environment(\.managedObjectContext) var moc
1718
@FetchRequest(sortDescriptors:[SortDescriptor(\.title)]) var launcherRepos: FetchedResults<LauncherRepos>
1819
@State var existingRepo = URL(string: "")
1920
@State var repoTitle = ""
20-
@State var currentVersion = "v1.1.8\n"
21+
@State var currentVersion = "v1.1.9\n"
2122
@State var updateAlert = false
2223
@State var latestVersion = ""
2324
@State var repoArgs = ""
@@ -143,6 +144,47 @@ struct LauncherView: View {
143144

144145
Spacer()
145146

147+
Menu {
148+
Button(action: {
149+
150+
for i in 0...launcherRepos.count - 1 {
151+
launcherRepos[i].isEditing = false
152+
}
153+
154+
print(try? launcherShell("\(LauncherRepo.path ?? "its broken") \(LauncherRepo.args ?? "")"))
155+
156+
beginLogging = true
157+
158+
print(LauncherRepo.path ?? "")
159+
}) {
160+
Text("Log")
161+
162+
Image(systemName: "arrow.right.circle.fill")
163+
}
164+
165+
Button(action: {
166+
167+
for i in 0...launcherRepos.count - 1 {
168+
launcherRepos[i].isEditing = false
169+
}
170+
171+
let launcherRepo = launcherRepos[i]
172+
173+
moc.delete(launcherRepo)
174+
175+
do {
176+
try moc.save()
177+
}
178+
catch {
179+
print("Error: its broken: \(error)")
180+
}
181+
}) {
182+
Text("Remove Repo")
183+
}
184+
} label: {
185+
Text("...")
186+
}.frame(width: 40)
187+
146188
Button(action: {
147189

148190
for iEdit in 0...launcherRepos.count - 1 {
@@ -196,43 +238,6 @@ struct LauncherView: View {
196238
}
197239
}
198240

199-
Button(action: {
200-
201-
for i in 0...launcherRepos.count - 1 {
202-
launcherRepos[i].isEditing = false
203-
}
204-
205-
let launcherRepo = launcherRepos[i]
206-
207-
moc.delete(launcherRepo)
208-
209-
do {
210-
try moc.save()
211-
}
212-
catch {
213-
print("Error: its broken: \(error)")
214-
}
215-
}) {
216-
Image(systemName: "trash")
217-
}
218-
219-
Button(action: {
220-
221-
for i in 0...launcherRepos.count - 1 {
222-
launcherRepos[i].isEditing = false
223-
}
224-
225-
print(try? launcherShell("\(LauncherRepo.path ?? "its broken") \(LauncherRepo.args ?? "")"))
226-
227-
beginLogging = true
228-
229-
print(LauncherRepo.path ?? "")
230-
}) {
231-
Text("Log")
232-
233-
Image(systemName: "arrow.right.circle.fill")
234-
}
235-
236241
Button(action: {
237242

238243
for i in 0...launcherRepos.count - 1 {
@@ -352,7 +357,10 @@ struct LauncherView: View {
352357

353358
print("its intel's turn nerd what an idiot man")
354359

355-
print(try? shell.intelShell("/usr/local/bin/brew install gcc gcc@9 sdl2 pkg-config glew glfw3 libusb audiofile coreutils"))
360+
do {
361+
try shell.intelShell("/usr/local/bin/brew install gcc gcc@9 sdl2 pkg-config glew glfw3 libusb audiofile coreutils")
362+
}
363+
catch {}
356364

357365
let content = UNMutableNotificationContent()
358366
content.title = "Finished installing dependencies"

sm_osx/Patches.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
enum Patches: String {
1111
case omm = "https://github.com/PeachyPeachSM64/sm64pc-omm.git"
1212
case highfps = "60Fps"
13+
case debug = "Debug"
1314
case extMoveset = "Extended Moveset"
1415
case bettercam = "Better Camera"
1516
case drawdistance = "No Draw Distance"

sm_osx/PatchesView.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct PatchesView: View {
1717
@State var isCam = false
1818
@State var isDist = false
1919
@State var extData = false
20+
@State var debug = false
2021
@State var timeTrials = false
2122
@State var isQOLFeat = false
2223
@State var isQOLFix = false
@@ -34,6 +35,24 @@ struct PatchesView: View {
3435
Spacer()
3536

3637
List {
38+
39+
if repo == .sm64ex_coop || repo == .sm64ex_coop_dev {
40+
Toggle(isOn: $debug) {
41+
Text("Debug")
42+
.lineLimit(nil)
43+
}.onChange(of: debug) { _ in
44+
45+
if debug {
46+
patches.append(.debug)
47+
}
48+
else {
49+
if let i = patches.firstIndex(of: .debug) {
50+
patches.remove(at: i)
51+
}
52+
}
53+
}
54+
}
55+
3756
if repo == .sm64ex || repo == .moon64 || repo == .sm64ex_alo {
3857
Toggle(isOn: $isFPS) {
3958
Text("60 FPS")
@@ -114,8 +133,8 @@ struct PatchesView: View {
114133
}
115134

116135
}
117-
if repo == .sm64ex || repo == .sm64ex_coop || repo == .render96ex || repo == .moonshine || repo == .moon64 || repo == .sm64ex_master || repo == .sm64ex_alo {
118-
if repo != .sm64ex_coop {
136+
if repo == .sm64ex || repo == .sm64ex_coop || repo == .render96ex || repo == .moonshine || repo == .moon64 || repo == .sm64ex_master || repo == .sm64ex_alo || repo == .sm64ex_coop_dev {
137+
if repo != .sm64ex_coop && repo != .sm64ex_coop_dev {
119138
Toggle(isOn: $isCam) {
120139
Text("Better Camera")
121140
.lineLimit(nil)
@@ -150,7 +169,7 @@ struct PatchesView: View {
150169
}
151170
}
152171

153-
if repo != .sm64ex_coop {
172+
if repo != .sm64ex_coop && repo != .sm64ex_coop_dev {
154173
Toggle(isOn: $isDist) {
155174
Text("No Draw Distance")
156175
.lineLimit(nil)

sm_osx/RepoView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct RepoView: View {
1111

1212
@State var shell = RomView(patch: [Patches](), repo: .sm64ex, repoView: .constant(false))
1313
@Binding var repoView: Bool
14+
@AppStorage("devMode") var devMode = true
1415

1516
var body: some View {
1617
NavigationView {
@@ -50,6 +51,14 @@ struct RepoView: View {
5051
.lineLimit(nil)
5152
}
5253

54+
if devMode {
55+
NavigationLink(destination: PatchesView(repo: .sm64ex_coop_dev, repoView: $repoView)) {
56+
57+
Text("sm64ex-coop-dev (Only avalible to devs)")
58+
.lineLimit(nil)
59+
}
60+
}
61+
5362
NavigationLink(destination: PatchesView(repo: .render96ex, repoView: $repoView)) {
5463

5564
Text("Render96ex")

sm_osx/Repos.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ enum Repo: String {
1616
case moon64 = "https://github.com/EmeraldLoc/Moon64"
1717
case render96ex = "https://github.com/EmeraldLoc/sm64ex.git --branch alpha"
1818
case sm64ex_coop = "https://github.com/djoslin0/sm64ex-coop.git"
19+
case sm64ex_coop_dev = "https://github.com/sm64ex-coop-dev/sm64ex-coop.git"
1920
}

sm_osx/RomView.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Shell {
1212

1313
@State var log = ""
1414

15-
func intelShell(_ command: String) throws -> String {
15+
func intelShell(_ command: String, _ doNonAsync: Bool = true) throws -> String {
1616

1717
var error: NSDictionary?
1818
var returnOutput = ""
@@ -28,7 +28,7 @@ class Shell {
2828
returnOutput.append("NSAppleScriptError: \(String(describing: error))")
2929
}
3030
}
31-
31+
3232
return returnOutput
3333
}
3434

@@ -113,6 +113,7 @@ struct RomView: View {
113113
@State var highFPS = 0
114114
@State var qolFix = 0
115115
@State var qolFeatures = 0
116+
@State var debug = 0
116117
@State var doLog = false
117118
@State var compSpeed: Speed = .normal
118119
@State var extData = 0
@@ -134,12 +135,12 @@ struct RomView: View {
134135
ZStack {
135136
VStack {
136137

137-
if repo == .sm64ex_coop || repo == .moon64 {
138+
if repo == .sm64ex_coop || repo == .moon64 || repo == .sm64ex_coop_dev {
138139
Text("\n For this repo, make sure you have the intel version of homebrew. To do this, launch your terminal with rosetta and follow install instructions at brew.sh")
139140
.lineLimit(nil)
140141
}
141142

142-
if repo == .sm64ex_coop {
143+
if repo == .sm64ex_coop || repo == .sm64ex_coop_dev {
143144
Button(action: {
144145

145146
log = ""
@@ -183,7 +184,7 @@ struct RomView: View {
183184
//buffer
184185
print(try shell.shell("ls ."))
185186

186-
log.append(try shell.intelShell("cd ~/SM64Repos/sm64ex-coop && gmake OSX_BUILD=1 TARGET_ARCH=x86_64-apple-darwin TARGET_BITS=64 EXTERNAL_DATA=\(extData) \(compSpeed.rawValue)"))
187+
log.append(try shell.intelShell("cd ~/SM64Repos/sm64ex-coop && gmake OSX_BUILD=1 TARGET_ARCH=x86_64-apple-darwin TARGET_BITS=64 EXTERNAL_DATA=\(extData) DEBUG=\(debug) \(compSpeed.rawValue)"))
187188
}
188189
catch {
189190
status = .error
@@ -193,7 +194,7 @@ struct RomView: View {
193194

194195
status = .finishingUp
195196

196-
var execPath = "sm64ex-coop-build"
197+
var execPath = "\(repo)-build"
197198

198199
if doKeepRepo {
199200
let checkExecPath = try? shell.shell("ls ~/SM64Repos/")
@@ -232,7 +233,7 @@ struct RomView: View {
232233
if doLauncher {
233234
let launcherRepo = LauncherRepos(context: moc)
234235

235-
launcherRepo.title = "sm64ex-coop"
236+
launcherRepo.title = "\(repo)"
236237
launcherRepo.isEditing = false
237238
launcherRepo.path = "~/SM64Repos/\(execPath)/sm64.us.f3dex2e"
238239
launcherRepo.args = ""
@@ -817,6 +818,9 @@ struct RomView: View {
817818
if patch.contains(.highfps) {
818819
highFPS = 1
819820
}
821+
if patch.contains(.debug) {
822+
debug = 1
823+
}
820824

821825
doLog = logData
822826
compSpeed = compilationSpeed

sm_osx/SettingsView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct SettingsView: View {
1111

1212
@AppStorage("logData") var logData = false
1313
@AppStorage("launchEntry") var launchEntry = true
14+
@AppStorage("devMode") var devMode = true
1415
@AppStorage("compilationSpeed") var compilationSpeed: Speed = .normal
1516

1617
var body: some View {
@@ -37,6 +38,10 @@ struct SettingsView: View {
3738
Text("Fastest")
3839
.tag(Speed.fastest)
3940
}
41+
42+
Toggle(isOn: $devMode) {
43+
Text("Enable dev repos (Not recommended)")
44+
}
4045
}
4146
}
4247
}

0 commit comments

Comments
 (0)