Other small fixes

This commit is contained in:
Maschell 2016-03-02 21:13:13 +01:00
parent 146de37d27
commit bc5c84498e
3 changed files with 23 additions and 18 deletions

Binary file not shown.

View File

@ -169,16 +169,16 @@ public class NUSTitle {
setLongNameFolder(String.format("%016X", getTitleID()));
if(tmd.isUpdate()){
byte[] metaxml = fst.metaFENtry.downloadAsByteArray();
if(metaxml != null){
InputStream bis = new ByteArrayInputStream(metaxml);
NUSTitleInformation nusinfo = readMeta(bis);
String folder = nusinfo.getLongnameEN() + " [" + nusinfo.getID6() + "]";
String subfolder = "/" + "updates" + "/" + "v" + tmd.titleVersion;
setTargetPath(folder + subfolder);
setLongNameFolder(folder);
}
byte[] metaxml = fst.metaFENtry.downloadAsByteArray();
if(metaxml != null){
InputStream bis = new ByteArrayInputStream(metaxml);
NUSTitleInformation nusinfo = readMeta(bis);
String folder = nusinfo.getLongnameEN() + " [" + nusinfo.getID6() + "]";
String subfolder = "";
if(tmd.isUpdate()) subfolder = "/" + "updates" + "/" + "v" + tmd.titleVersion;
setTargetPath(folder + subfolder);
setLongNameFolder(folder);
}
if(Settings.downloadContent){
@ -201,15 +201,20 @@ public class NUSTitle {
Util.createSubfolder(getContentPath());
Downloader.getInstance().downloadTMD(titleID,version,getContentPath());
Downloader.getInstance().downloadTicket(titleID,getContentPath());
tmd.downloadContents(progress);
try{
Downloader.getInstance().downloadTicket(titleID,getContentPath());
FileOutputStream fos = new FileOutputStream(getContentPath() + "/title.cert");
fos.write(ticket.cert0);
fos.write(tmd.cert);
fos.write(ticket.cert1);
fos.close();
}catch(Exception e){
Logger.log("Random error.");
}
FileOutputStream fos = new FileOutputStream(getContentPath() +"/title.cert");
fos.write(ticket.cert0);
fos.write(tmd.cert);
fos.write(ticket.cert1);
fos.close();
}
NUSTitleInformation readMeta(InputStream bis) {

View File

@ -164,7 +164,7 @@ public class TitleMetaData {
}
public boolean isUpdate() {
return (titleID & 0x5000000000000L) == 0x5000000000000L;
return (titleID & 0x5000E00000000L) == 0x5000E00000000L;
}
public void downloadContents(Progress progress) throws IOException{