1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-29 23:32:06 +00:00
TegraExplorer/scripts/FirmwareDump.te

53 lines
1.6 KiB
Text
Raw Normal View History

#REQUIRE KEYS
p=println
pe={pause() exit()}
fwstr={fw=maj.str()+"."+min.str()+"."+pat.str()}
fv={a=readsave("bis:/save/8000000000000120")
b=a.readFile("/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()}
if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}
fv()
sysfw=fw
p("Sys' fw is",fw)
emufw=""
2021-07-24 22:00:05 +01:00
if (emu()){if(!mountemu("SYSTEM")){fv()emufw=fw p("Emu's fw is",fw)}}
op=["Exit","Dump sysmmc"].copy()
if (emufw!=""){op+"Dump emummc"}
2021-07-24 22:00:05 +01:00
p()r=menu(op,0)clear()
if(r==0){exit()}
if(r==1){fw=sysfw if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
if(r==2){fw=emufw if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
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()