From d730ba6064fa4b33a15d64ea638cf25a78b9f96d Mon Sep 17 00:00:00 2001 From: megazig Date: Fri, 13 Mar 2009 05:15:49 -0500 Subject: fixed error for fnl also --- brlyt.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/brlyt.c b/brlyt.c index 721e16a..e7aecb7 100644 --- a/brlyt.c +++ b/brlyt.c @@ -208,18 +208,14 @@ void PrintBRLYTEntry_txl1(brlyt_entry entry, u8* brlyt_file) printf(" unk: %08x\n", be32(data2.unk)); int tempLocation = BRLYT_fileoffset; BRLYT_fileoffset = entry.data_location + bpos + be32(data2.offset); - int toRead = (be32(entry.length)*2) - BRLYT_fileoffset - 12; - //printf("size of entry: %08x", be32(entry.length)); - //printf("name offset: %08x", BRLYT_fileoffset); + int toRead = (be32(entry.length) + entry.data_location - 8) - BRLYT_fileoffset; char nameRead[toRead]; BRLYT_ReadDataFromMemory(nameRead, brlyt_file, sizeof(nameRead)); //char nameRead[toRead] the name of the tpls null terminated between - //printf("size of name: %08x", sizeof(nameRead)); char tpl = 0; char *ending = memchr(nameRead, tpl, toRead); int end = ending - nameRead; - char name[end]; - //printf("length of name: %08x", sizeof(name)); + char name[end+1]; memcpy(name, nameRead, sizeof(name)); printf(" name: %s\n", name); BRLYT_fileoffset = tempLocation; @@ -231,7 +227,6 @@ void PrintBRLYTEntry_fnl1(brlyt_entry entry, u8* brlyt_file) brlyt_numoffs_chunk data; BRLYT_fileoffset = entry.data_location; BRLYT_ReadDataFromMemory(&data, brlyt_file, sizeof(brlyt_numoffs_chunk)); - //PRINT CRAP printf(" Type: %c%c%c%c\n", entry.magic[0], entry.magic[1], entry.magic[2], entry.magic[3]); printf(" num: %08x\n", be16(data.num)); printf(" offs: %08x\n", be16(data.offs)); @@ -239,20 +234,26 @@ void PrintBRLYTEntry_fnl1(brlyt_entry entry, u8* brlyt_file) pos += data.offs; int bpos = pos; int n = 0; - for (n;n