@@ -16,6 +16,10 @@ struct ContentView: View {
1616 private let kwriteMethodOptions = [ " dup " , " sem_open " ]
1717 @State private var kwriteMethod = 1
1818
19+ @State private var extra_checks = true
20+
21+ @State private var errorAlert = false
22+
1923 @State private var res_y = 2796
2024 @State private var res_x = 1290
2125
@@ -29,6 +33,7 @@ struct ContentView: View {
2933 @State private var hideLSIcons = false
3034 @State private var enableCustomSysColors = false
3135 @State private var enableDynamicIsland = false
36+ @State private var changeRegion = false
3237
3338 var body : some View {
3439 NavigationView {
@@ -60,10 +65,10 @@ struct ContentView: View {
6065 // Resolution
6166 Toggle ( isOn: $enableResSet) {
6267 HStack ( spacing: 20 ) {
63- Image ( systemName: enableResSet ? " arrow .up.circle.fill" : " arrow.down .circle.fill " )
68+ Image ( systemName: enableResSet ? " arrowshape .up.circle.fill" : " arrowshape.up .circle" )
6469 . foregroundColor ( . purple)
6570 . imageScale ( . large)
66- Text ( " Enable 14 Pro Max Resolution" ) . font ( . headline)
71+ Text ( " Change Resolution" ) . font ( . headline)
6772 }
6873 } . frame ( minWidth: 0 , maxWidth: . infinity)
6974 . foregroundColor ( . purple)
@@ -145,22 +150,43 @@ struct ContentView: View {
145150 } . frame ( minWidth: 0 , maxWidth: . infinity)
146151 . foregroundColor ( . purple)
147152
148- Spacer ( )
153+ // Region Changer
154+ Toggle ( isOn: $changeRegion) {
155+ HStack ( spacing: 20 ) {
156+ Image ( systemName: changeRegion ? " globe.americas.fill " : " globe.americas " )
157+ . foregroundColor ( . purple)
158+ . imageScale ( . large)
159+ Text ( " Change Region " ) . font ( . headline)
160+ }
161+ } . frame ( minWidth: 0 , maxWidth: . infinity)
162+ . foregroundColor ( . purple)
149163
164+ Spacer ( )
165+
150166 Button ( " Apply Tweaks & Respring " ) {
151167 puafPages = puafPagesOptions [ puafPagesIndex]
152- kfd = do_kopen ( UInt64 ( puafPages) , UInt64 ( puafMethod) , UInt64 ( kreadMethod) , UInt64 ( kwriteMethod) )
153- let tweaks = enabledTweaks ( )
154- var cTweaks : [ UnsafeMutablePointer < CChar > ? ] = tweaks. map { strdup ( $0) }
155- cTweaks. append ( nil )
156- cTweaks. withUnsafeMutableBufferPointer { buffer in
157- do_fun ( buffer. baseAddress, Int32 ( buffer. count - 1 ) , res_y, res_x)
168+ kfd = do_kopen ( UInt64 ( puafPages) , UInt64 ( puafMethod) , UInt64 ( kreadMethod) , UInt64 ( kwriteMethod) , extra_checks)
169+ if ( kfd != 0 ) {
170+ let tweaks = enabledTweaks ( )
171+ var cTweaks : [ UnsafeMutablePointer < CChar > ? ] = tweaks. map { strdup ( $0) }
172+ cTweaks. append ( nil )
173+ cTweaks. withUnsafeMutableBufferPointer { buffer in
174+ do_fun ( buffer. baseAddress, Int32 ( buffer. count - 1 ) , Int32 ( res_y) , Int32 ( res_x) )
175+ }
176+ cTweaks. forEach { free ( $0) }
177+ do_kclose ( )
178+ backboard_respring ( )
179+ } else {
180+ errorAlert = true
158181 }
159- cTweaks. forEach { free ( $0) }
160- do_kclose ( )
161- backboard_respring ( )
162182 } . frame ( minWidth: 0 , maxWidth: . infinity)
163183 . foregroundColor ( . purple)
184+ . alert ( isPresented: $errorAlert) {
185+ Alert (
186+ title: Text ( " Device Unsupported " ) ,
187+ message: Text ( " Try without extra checks? " )
188+ )
189+ }
164190
165191 }
166192 . listRowBackground ( Color . clear)
@@ -179,7 +205,7 @@ struct ContentView: View {
179205 }
180206
181207 private var settingsView : some View {
182- SettingsView ( puafPagesIndex: $puafPagesIndex, puafMethod: $puafMethod, kreadMethod: $kreadMethod, kwriteMethod: $kwriteMethod, res_y: $res_y, res_x: $res_x)
208+ SettingsView ( puafPagesIndex: $puafPagesIndex, puafMethod: $puafMethod, kreadMethod: $kreadMethod, kwriteMethod: $kwriteMethod, extra_checks : $extra_checks , res_y: $res_y, res_x: $res_x)
183209 . navigationBarTitle ( " Settings " )
184210 }
185211
@@ -215,6 +241,9 @@ struct ContentView: View {
215241 if enableDynamicIsland {
216242 enabledTweaks. append ( " enableDynamicIsland " )
217243 }
244+ if changeRegion {
245+ enabledTweaks. append ( " changeRegion " )
246+ }
218247
219248 return enabledTweaks
220249 }
@@ -225,13 +254,21 @@ struct SettingsView: View {
225254 @Binding var puafMethod : Int
226255 @Binding var kreadMethod : Int
227256 @Binding var kwriteMethod : Int
257+ @Binding var extra_checks : Bool
228258 @Binding var res_y : Int
229259 @Binding var res_x : Int
230260
231261 private let puafPagesOptions = [ 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 ]
232262 private let puafMethodOptions = [ " physpuppet " , " smith " ]
233263 private let kreadMethodOptions = [ " kqueue_workloop_ctl " , " sem_open " ]
234264 private let kwriteMethodOptions = [ " dup " , " sem_open " ]
265+
266+ // Dyanmic Island Stuff
267+ private let ogDynamicOptions = [ " Auto (iPhone X-14) " , " 569 (iPhone 8/SE2/SE3) " , " 570 (iPhone 8+) " ]
268+ @State var ogDynamicOptions_num = [ 0 , 569 , 570 ]
269+ @State var ogDynamicOptions_sel = 0
270+ @State var ogsubtype = 0
271+
235272
236273 var body : some View {
237274 Form {
@@ -259,15 +296,34 @@ struct SettingsView: View {
259296 Text ( self . kwriteMethodOptions [ $0] )
260297 }
261298 }
299+
300+ Toggle ( isOn: $extra_checks) {
301+ Text ( " extra offset checks " )
302+ }
262303 }
263304
264- Section ( header: Text ( " Tweak Settings " ) ) {
305+ Section ( header: Text ( " Resolution " ) ) {
265306 Text ( " Resolution Width: " )
266307 TextField ( " Resolution Width " , value: $res_x, formatter: NumberFormatter ( ) )
267308 Text ( " Resolution Height: " )
268309 TextField ( " Resolution Height " , value: $res_y, formatter: NumberFormatter ( ) )
269310 }
270311
312+ Section ( header: Text ( " Dynamic Island " ) ) {
313+ Picker ( " Original SubType: " , selection: $ogDynamicOptions_sel) {
314+ ForEach ( 0 ..< ogDynamicOptions. count, id: \. self) {
315+ Text ( self . ogDynamicOptions [ $0] )
316+ }
317+ }
318+ Button ( " Revert SubType " ) {
319+ ogsubtype = ogDynamicOptions_num [ ogDynamicOptions_sel]
320+ if ( ogsubtype == 0 ) {
321+ ogsubtype = Int ( UIScreen . main. nativeBounds. height)
322+ }
323+ DynamicKFD ( Int32 ( ogsubtype) )
324+ }
325+ }
326+
271327 Section ( header: Text ( " Extras " ) ) {
272328 Button ( action: {
273329 respring ( )
@@ -291,8 +347,7 @@ struct SettingsView: View {
291347 . cornerRadius ( 10 )
292348 }
293349 }
294- }
295- . navigationBarTitle ( " Settings " , displayMode: . inline)
350+ } . navigationBarTitle ( " Settings " , displayMode: . inline)
296351 }
297352}
298353
0 commit comments