Difference between revisions of "Talk:Nintendo DS Cart Whitelist"
Jump to navigation
Jump to search
(New page: == C representations == typedef struct { char ID[4]; // An ID unsigned char pad[0x84]; } sHNHA_Header; typedef struct { char TID[4]; // Title ID unsigned long ver; // Title ver...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
typedef struct { | typedef struct { | ||
char ID[4]; // An ID | char ID[4]; // An ID | ||
− | unsigned char pad[ | + | unsigned char pad[0x80]; |
+ | unsigned long number; // number of titles | ||
} sHNHA_Header; | } sHNHA_Header; | ||
− | + | ||
typedef struct { | typedef struct { | ||
char TID[4]; // Title ID | char TID[4]; // Title ID | ||
Line 10: | Line 11: | ||
unsigned char SHA[2][20]; // the two SHA-1 sums | unsigned char SHA[2][20]; // the two SHA-1 sums | ||
} sHNHA_Title; | } sHNHA_Title; | ||
− | --[[User:Ludo6431|Ludo6431]] 19: | + | |
+ | typedef struct { | ||
+ | unsigned char pad[0x18]; | ||
+ | } sHNHA_Footer; | ||
+ | --[[User:Ludo6431|Ludo6431]] 19:59, 5 August 2009 (UTC) | ||
== C dumper == | == C dumper == | ||
Line 26: | Line 31: | ||
sHNHA_Header header; | sHNHA_Header header; | ||
sHNHA_Title title; | sHNHA_Title title; | ||
+ | sHNHA_Footer footer; | ||
fread(&header, 1, 0x88, fd); // read the header | fread(&header, 1, 0x88, fd); // read the header | ||
+ | printf("\nnumber of titles : %d", header.number); | ||
+ | |||
+ | size_t count=header.number; | ||
+ | while(count--) { // read each title | ||
+ | fread(&title, 1, sizeof(sHNHA_Title), fd); | ||
− | |||
printf("\nTID="); | printf("\nTID="); | ||
myprint("%c", title.TID, 4); | myprint("%c", title.TID, 4); | ||
Line 38: | Line 48: | ||
myprint("%02X", title.SHA[1], 20); | myprint("%02X", title.SHA[1], 20); | ||
} | } | ||
+ | |||
+ | fread(&footer, 1, sizeof(sHNHA_Footer), fd); // read the footer | ||
+ | |||
+ | if(fgetc(fd)!=EOF) printf("error"); | ||
fclose(fd); | fclose(fd); | ||
} | } | ||
--[[User:Ludo6431|Ludo6431]] 19:24, 5 August 2009 (UTC) | --[[User:Ludo6431|Ludo6431]] 19:24, 5 August 2009 (UTC) |
Latest revision as of 20:59, 5 August 2009
C representations
typedef struct { char ID[4]; // An ID unsigned char pad[0x80]; unsigned long number; // number of titles } sHNHA_Header; typedef struct { char TID[4]; // Title ID unsigned long ver; // Title version unsigned char SHA[2][20]; // the two SHA-1 sums } sHNHA_Title; typedef struct { unsigned char pad[0x18]; } sHNHA_Footer;
--Ludo6431 19:59, 5 August 2009 (UTC)
C dumper
void myprint(char *format, unsigned char *data, size_t datasize) { while(datasize--) printf(format, (unsigned char)*data++); } int main(int argc, char *argv[]) { if(argc!=2) exit(1); FILE *fd=fopen(argv[1], "rb"); if(!fd) exit(1); sHNHA_Header header; sHNHA_Title title; sHNHA_Footer footer; fread(&header, 1, 0x88, fd); // read the header printf("\nnumber of titles : %d", header.number); size_t count=header.number; while(count--) { // read each title fread(&title, 1, sizeof(sHNHA_Title), fd); printf("\nTID="); myprint("%c", title.TID, 4); printf("\nver=%d", title.version); printf("\nSHA="); myprint("%02X", title.SHA[0], 20); printf("\nSHA="); myprint("%02X", title.SHA[1], 20); } fread(&footer, 1, sizeof(sHNHA_Footer), fd); // read the footer if(fgetc(fd)!=EOF) printf("error"); fclose(fd); }
--Ludo6431 19:24, 5 August 2009 (UTC)