ctrtool: tmd savesize detection & smarter exheader pre check

This commit is contained in:
applestash
2014-09-22 21:42:33 +10:00
parent b240ea8045
commit c7f8b1833e
5 changed files with 38 additions and 4 deletions
+9 -1
View File
@@ -86,6 +86,7 @@ void tmd_print(tmd_context* ctx)
ctr_tmd_header_2048* header2048 = 0;
ctr_tmd_body* body = 0;
unsigned int contentcount = 0;
unsigned int savesize = 0;
unsigned int i;
if (type == TMD_RSA_2048_SHA256 || type == TMD_RSA_2048_SHA1)
@@ -104,7 +105,8 @@ void tmd_print(tmd_context* ctx)
body = tmd_get_body(ctx);
contentcount = getbe16(body->contentcount);
savesize = getle32(body->savedatasize);
fprintf(stdout, "\nTMD header:\n");
fprintf(stdout, "Signature type: %s\n", tmd_get_type_string(type));
fprintf(stdout, "Issuer: %s\n", body->issuer);
@@ -115,6 +117,12 @@ void tmd_print(tmd_context* ctx)
memdump(stdout, "Title id: ", body->titleid, 8);
fprintf(stdout, "Title type: %08x\n", getbe32(body->titletype));
fprintf(stdout, "Group id: %04x\n", getbe16(body->groupid));
if(savesize < sizeKB)
fprintf(stdout, "Save Size: %08x\n", savesize);
else if(savesize < sizeMB)
fprintf(stdout, "Save Size: %dKB (%08x)\n", savesize/sizeKB, savesize);
else
fprintf(stdout, "Save Size: %dMB (%08x)\n", savesize/sizeMB, savesize);
fprintf(stdout, "Access rights: %08x\n", getbe32(body->accessrights));
fprintf(stdout, "Title version: %04x\n", getbe16(body->titleversion));
fprintf(stdout, "Content count: %04x\n", getbe16(body->contentcount));