1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-08 13:11:54 +00:00
TegraExplorer/scripts/FirmwareDump.te

58 lines
1.6 KiB
Text
Raw Normal View History

#REQUIRE KEYS
#REQUIRE SD
p=println
pe={pause() exit()}
fwstr={fw=maj.str()+"."+min.str()+"."+pat.str()}
fv={a=readsave("bis:/save/8000000000000120")
2021-07-26 00:45:35 +01:00
b=a.read("/meta/imkvdb.arc")
c=["BYTE[]",9,8,0,0,0,0,0,1]
d=b.find(c)
if(d>0){
e=b.slice(d+8,4).project()
ver=(e[3]<<24)|(e[2]<<16)|(e[1]<<8)|(e[0])
pat=((ver>>16)&((1<<4)- 1))
min=((ver>>20)&((1<<6)- 1))
maj=((ver>>26)&((1<<6)- 1))
}.else(){print("Fw not found")pe()}
a=0 fwstr()}
2023-10-11 10:16:43 +01:00
op=["Exit","Dump sysmmc"].copy()
2023-10-11 10:16:43 +01:00
if (emu()){op+"Dump emummc"}
2021-07-24 22:00:05 +01:00
p()r=menu(op,0)clear()
if(r==0){exit()}
2023-10-11 10:16:43 +01:00
if(r==1){if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
if(r==2){if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
clear()
fv()
p("Found firmware",fw)
p("Press Power or A to dump firmware, any other key to exit")
a = pause()
if (!a.a) {exit()}
clear()
2021-07-21 14:19:27 +01:00
mkdir("sd:/tegraexplorer")
mkdir("sd:/tegraexplorer/Firmware")
2021-07-24 22:00:05 +01:00
bsp="sd:/tegraexplorer/Firmware/"+fw
if(fsexists(bsp)){p("Dir already exists! Press power to replace, any other key to exit") a=pause() if(!a.power){exit()} deldir(bsp)}
mkdir(bsp)
p("Dumping to",bsp)
con=readdir("bis:/Contents/registered")
if(con.result!=0){println("Fail reading dir")pe()}
c=(con.files.len()+con.folders.len()).str()
i=1 f=0 t=timer()
dump={
fi.foreach("x"){
if(f){fp="bis:/Contents/registered/"+x+"/00"}
.else(){fp="bis:/Contents/registered/"+x}
name=x
if(ncatype(fp)==1){name=name- 4+".cnmt.nca"}
color(0x00FF00)
print("\r["+i.str()+"/"+c+"]", x)
if(copyfile(fp,bsp+"/"+name)){println("\nErr during copy")pe()}
i=i+1
2021-07-21 14:19:27 +01:00
}
}
fi=con.files dump()
f=1 fi=con.folders dump()
2021-07-24 22:05:09 +01:00
p("\nDone! Took",timer()-t/1000,"s")pause()