1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 11:56:42 +00:00

Merge pull request #97 from JeffVi/Lockpick-1.19.10-bdk-upgrade

Keep DeviceSettings when running a system wipe
This commit is contained in:
Sims 2024-05-28 21:02:31 +02:00 committed by GitHub
commit 6bc0772647
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
#REQUIRE KEYS #REQUIRE KEYS
is=["8000000000000120","8000000000000000"] is=["8000000000000120","8000000000000053","8000000000000000"]
p=println p=println
pr=print pr=print
pe={pause() exit()} pe={pause() exit()}
@ -97,45 +97,110 @@ f=readdir("bis:/save")
if(f.folders.len()!=0){p("Folders in save dir???")pe()} if(f.folders.len()!=0){p("Folders in save dir???")pe()}
f.files.foreach("x"){if(!is.contains(x)){if(delfile("bis:/save/"+x)){p("File deletion failed: ", x)pe()}}} f.files.foreach("x"){if(!is.contains(x)){if(delfile("bis:/save/"+x)){p("File deletion failed: ", x)pe()}}}
pr("Done!\nSetting up indexer save...") pr("Done!\nSetting up indexer save...")
s=getfilesize("bis:/save/"+is[0])
ba0=["BYTE[]",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00] if(fsexists("bis:/save/"+is[0]))
ba120=["BYTE[]",0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x80] {
s1=s&0xFF ba0=["BYTE[]",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
s2=(s>>8)&0xFF ba120=["BYTE[]",0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x80]
s3=(s>>16)&0xFF ba53=["BYTE[]",0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x80]
s4=(s>>24)&0xFF imen=["BYTE[]",0x49,0x4D,0x45,0x4E,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00]
idb=["BYTE[]",0x49,0x4D,0x4B,0x56,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x49,0x4D,0x45,0x4E,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00].copy()
idb.addrange(ba0) idb=["BYTE[]",0x49,0x4D,0x4B,0x56,0x00,0x00,0x00,0x00].copy() # imkv
idb.addrange(ba0)
idb.addrange(ba0) skip53 = !fsexists("bis:/save/"+is[1])
idb.addrange(ba120)
idb.addrange(ba0) if(skip53)
idb.addrange(ba0) {
idb.addrange(ba0) idb.add(0x01) # 0x01 imen
idb.addrange(ba0) pr("053 save not found!!! Skip indexing it...")
idb.addrange(ba120) }.else()
idb.add(s1) {
idb.add(s2) idb.add(0x02) # 0x02 imens
idb.add(s3) }
idb.add(s4)
idb.add(0x00) idb.add(0x00)
idb.add(0x00) idb.add(0x00)
idb.add(0x00) idb.add(0x00)
idb.add(0x00)
idb.addrange(ba0) # 120 save
idb.addrange(ba0) s=getfilesize("bis:/save/"+is[0])
idb.addrange(ba0) s1=s&0xFF
idb.addrange(ba0) s2=(s>>8)&0xFF
idb.addrange(ba0) s3=(s>>16)&0xFF
idb.addrange(ba0) s4=(s>>24)&0xFF
idxs=readsave("bis:/save/"+is[1]) idb.addrange(imen)
if(idxs.resize("/imkvdb.arc",idb.len())){p("imkvdb resize failed")pe()} idb.addrange(ba0)
if(idxs.write("/imkvdb.arc",idb)){p("imkvdb write failed")pe()} idb.addrange(ba0)
if(idxs.resize("/lastPublishedId",ba0.len())){p("lastPublishedId resize failed")pe()} idb.addrange(ba0)
if(idxs.write("/lastPublishedId",ba0)){p("lastPublishedId write failed")pe()} idb.addrange(ba120)
if(idxs.commit()){p("Indexer save commit failed")pe()} idb.addrange(ba0)
idxs=0 idb.addrange(ba0)
pr("Done!\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"] idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba120)
idb.add(s1)
idb.add(s2)
idb.add(s3)
idb.add(s4)
idb.add(0x00)
idb.add(0x00)
idb.add(0x00)
idb.add(0x00)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
if(!skip53)
{
# 53 save
s=getfilesize("bis:/save/"+is[1])
s1=s&0xFF
s2=(s>>8)&0xFF
s3=(s>>16)&0xFF
s4=(s>>24)&0xFF
idb.addrange(imen)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba53)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba53)
idb.add(s1)
idb.add(s2)
idb.add(s3)
idb.add(s4)
idb.add(0x00)
idb.add(0x00)
idb.add(0x00)
idb.add(0x00)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
idb.addrange(ba0)
}
idxs=readsave("bis:/save/"+is[2])
if(idxs.resize("/imkvdb.arc",idb.len())){p("imkvdb resize failed")pe()}
if(idxs.write("/imkvdb.arc",idb)){p("imkvdb write failed")pe()}
if(idxs.resize("/lastPublishedId",ba0.len())){p("lastPublishedId resize failed")pe()}
if(idxs.write("/lastPublishedId",ba0)){p("lastPublishedId write failed")pe()}
if(idxs.commit()){p("Indexer save commit failed")pe()}
idxs=0
pr("Done!")
}.else()
{
pr("120 save not found!!! Skip editing indexer save!!!")
}
pr("\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"]
if(mount("USER")){p("Mount failed!")pe()} if(mount("USER")){p("Mount failed!")pe()}
ud.foreach("x"){pr("\n"+x,"")if(deldir("bis:/"+x)){p("Dir deletion failed")pe()}mkdir("bis:/"+x)} ud.foreach("x"){pr("\n"+x,"")if(deldir("bis:/"+x)){p("Dir deletion failed")pe()}mkdir("bis:/"+x)}
mkdir("bis:/Contents/placehld")mkdir("bis:/Contents/registered") mkdir("bis:/Contents/placehld")mkdir("bis:/Contents/registered")