Skip to content

Commit aa5c6b7

Browse files
committed
Add become iPadOS switch
1 parent db5c4af commit aa5c6b7

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

Sources/ContentView.swift

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ struct ContentView: View {
5353
Text("Select or drag and drop a pairing file to continue. More info: https://docs.sidestore.io/docs/getting-started/pairing-file")
5454
}
5555
}
56+
Section {
57+
Button("Bypass 3 app limit") {
58+
testBypassAppLimit()
59+
}
60+
.disabled(taskRunning)
61+
} footer: {
62+
Text("Hide free developer apps from installd, so you could install more than 3 apps. You need to apply this for each 3 apps you install or update.")
63+
}
5664
Section {
5765
Toggle("Action Button", isOn: bindingForMGKeys(["cT44WE1EohiwRzhsZ8xEsw"]))
5866
.disabled(requiresVersion(17))
@@ -97,12 +105,12 @@ struct ContentView: View {
97105
Text("Only change device model if you're downloading Apple Intelligence models. Face ID may break.")
98106
}
99107
Section {
100-
Button("Bypass 3 app limit") {
101-
testBypassAppLimit()
102-
}
103-
.disabled(taskRunning)
108+
let cacheExtra = mobileGestalt["CacheExtra"] as! NSMutableDictionary
109+
Toggle("Become iPadOS", isOn: bindingForTrollPad())
110+
// validate DeviceClass
111+
.disabled(cacheExtra["+3Uf0Pm5F8Xy7Onyvko0vA"] as! String != "iPhone")
104112
} footer: {
105-
Text("Hide free developer apps from installd, so you could install more than 3 apps. You need to apply this for each 3 apps you install or update.")
113+
Text("Override user interface idiom to iPadOS, so you could use all iPadOS multitasking features on iPhone. Gives you the same capabilities as TrollPad, but may cause some issues.")
106114
}
107115
Section {
108116
Toggle("Reboot after finish restoring", isOn: $reboot)
@@ -227,7 +235,6 @@ Thanks to:
227235
set: { enabled in
228236
if enabled {
229237
eligibilityData = try! Data(contentsOf: Bundle.main.url(forResource: "eligibility", withExtension: "plist")!)
230-
cacheExtra[key] = 1
231238
featureFlagsData = try! Data(contentsOf: Bundle.main.url(forResource: "FeatureFlags_Global", withExtension: "plist")!)
232239
cacheExtra[key] = 1
233240
} else {
@@ -240,6 +247,43 @@ Thanks to:
240247
)
241248
}
242249

250+
func bindingForTrollPad() -> Binding<Bool> {
251+
// We're going to overwrite DeviceClassNumber but we can't do it via CacheExtra, so we need to do it via CacheData instead
252+
// However, CacheData is still a black box, as nobody has yet to document this data, so we're leaving a hardcoded offset for now
253+
let valueOffset = 0x2e0
254+
let cacheData = mobileGestalt["CacheData"] as! NSMutableData
255+
//print("Read value from \(cacheData.mutableBytes.load(fromByteOffset: valueOffset, as: Int.self))")
256+
257+
let cacheExtra = mobileGestalt["CacheExtra"] as! NSMutableDictionary
258+
let keys = [
259+
"uKc7FPnEO++lVhHWHFlGbQ", // ipad
260+
"mG0AnH/Vy1veoqoLRAIgTA", // MedusaFloatingLiveAppCapability
261+
"UCG5MkVahJxG1YULbbd5Bg", // MedusaOverlayAppCapability
262+
"ZYqko/XM5zD3XBfN5RmaXA", // MedusaPinnedAppCapability
263+
"nVh/gwNpy7Jv1NOk00CMrw", // MedusaPIPCapability,
264+
"qeaj75wk3HF4DwQ8qbIi7g", // DeviceSupportsEnhancedMultitasking
265+
]
266+
return Binding(
267+
get: {
268+
if let value = cacheExtra[keys.first!] as? Int? {
269+
return value == 1
270+
}
271+
return false
272+
},
273+
set: { enabled in
274+
cacheData.mutableBytes.storeBytes(of: enabled ? 3 : 1, toByteOffset: valueOffset, as: Int.self)
275+
for key in keys {
276+
if enabled {
277+
cacheExtra[key] = 1
278+
} else {
279+
// just remove the key as it will be pulled from device tree if missing
280+
cacheExtra.removeObject(forKey: key)
281+
}
282+
}
283+
}
284+
)
285+
}
286+
243287
func bindingForMGKeys<T: Equatable>(_ keys: [String], type: T.Type = Int.self, defaultValue: T? = 0, enableValue: T? = 1) -> Binding<Bool> {
244288
let cacheExtra = mobileGestalt["CacheExtra"] as! NSMutableDictionary
245289
return Binding(

0 commit comments

Comments
 (0)