Skip to content

Commit

Permalink
1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Aug 2, 2023
1 parent 71c6af6 commit 8e9f10d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dopamine/Dopamine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Dopamine/bootstrap",
);
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
OTHER_LDFLAGS = (
"-framework",
IOKit,
Expand Down Expand Up @@ -624,7 +624,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Dopamine/bootstrap",
);
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
OTHER_LDFLAGS = (
"-framework",
IOKit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,41 @@ public struct Fugu15 {
throw Fugu15LaunchError.environmentStartFailed(reply: reply ?? [])
}
}
public static func compareVersions(_ version1: String, _ version2: String) -> Int {
let v1Components = version1.split(separator: ".").compactMap { Int($0) }
let v2Components = version2.split(separator: ".").compactMap { Int($0) }

// Pad version components with 0s to ensure equal length
let maxLength = max(v1Components.count, v2Components.count)
let paddedV1 = v1Components + Array(repeating: 0, count: maxLength - v1Components.count)
let paddedV2 = v2Components + Array(repeating: 0, count: maxLength - v2Components.count)

for (v1, v2) in zip(paddedV1, paddedV2) {
if v1 < v2 {
return -1 // version1 is older
} else if v1 > v2 {
return 1 // version1 is newer
}
}

return 0 // versions are equal
}
public static func prepareJailbreakUpdate() {
let bootInfoURL = URL(fileURLWithPath: prebootPath("basebin/boot_info.plist"))
let bootInfo = NSDictionary(contentsOf: bootInfoURL) ?? NSDictionary()
let preUpdateVersion = bootInfo["basebin-version"] as! String

if compareVersions(preUpdateVersion, "1.1.3") < 0 {
// When updating from 1.1.2 or below to 1.1.3 or above, we need to do a full reboot
if reboot3(0x8000000000000000, 0) != 0 {
sync()
reboot(0)
}
}

let suc = updateBasebinOffsets()
exit(suc ? Int32(0) : Int32(1))
}

/**
* Call this method from your main function. Only returns if invoked without a Fugu15 command.
Expand Down Expand Up @@ -297,8 +332,7 @@ public struct Fugu15 {
break

case "prepare_jbupdate":
let suc = updateBasebinOffsets()
exit(suc ? Int32(0) : Int32(1))
prepareJailbreakUpdate()
break

case "reboot":
Expand Down

0 comments on commit 8e9f10d

Please sign in to comment.