From 3af59c1d1c9bd022ac6a3a85956a081804e48ab4 Mon Sep 17 00:00:00 2001 From: megazig Date: Fri, 14 May 2010 15:31:31 -0500 Subject: fixed version and endian for brlyt. fixed proper spacing for the specs on pat1 --- brlan.c | 4 ++-- brlyt.c | 15 +++++++++++---- brlyt.h | 3 ++- general.h | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/brlan.c b/brlan.c index 9cad469..6b721a3 100644 --- a/brlan.c +++ b/brlan.c @@ -1037,8 +1037,8 @@ void write_brlan(char *infile, char* outfile) if ( first != NULL ) get_value(first, temp1, 0x10); u32 temp1_len = strlen(temp1); - if ( temp1_len % 8 ) - temp1_len += (8 - (temp1_len % 8)); + if ( temp1_len % 4 ) + temp1_len += (4 - (temp1_len % 4)); fwrite(temp1, temp1_len, 1, fp); //pathead.unk4_offset = be32(be32(pathead.unk3_offset) + temp1_len); pathead.unk4_offset = be32(0x1C + temp1_len); diff --git a/brlyt.c b/brlyt.c index 1907704..19aa3a8 100644 --- a/brlyt.c +++ b/brlyt.c @@ -451,9 +451,14 @@ void BRLYT_CheckHeaderSanity(brlyt_header header, size_t filesize) printf("magic: %.4s\n", header.magic); exit(1); } - if((header.version != be32(0xfeff0008) )&&(header.version != be32(0xfeff000a))){ + if(header.endian != short_swap_bytes(0xFEFF)){ + printf("BRLYT endian is not set for big\n"); + printf("endian: %04x\n", short_swap_bytes(header.endian) ); + exit(1); + } + if((header.version != short_swap_bytes(0x0008) )&&(header.version != short_swap_bytes(0x000a))){ printf("BRLYT version not right\n"); - printf("version: %08x\n", be32(header.version) ); + printf("version: %04x\n", short_swap_bytes(header.version) ); exit(1); } if(filesize != be32(header.filesize)) { @@ -1320,7 +1325,7 @@ void parse_brlyt(char *filename, char *filenameout) xml = mxmlNewXML("1.0"); xmlyt = mxmlNewElement(xml, "xmlyt"); mxmlElementSetAttrf(xmlyt, "version", "%d.%d.%d%s", BENZIN_VERSION_MAJOR, BENZIN_VERSION_MINOR, BENZIN_VERSION_BUILD, BENZIN_VERSION_OTHER); - mxmlElementSetAttrf(xmlyt, "brlyt_version", "%08x", be32(header.version)); + mxmlElementSetAttrf(xmlyt, "brlyt_version", "%04x", be32(header.version)); PrintBRLYTEntries(entries, entrycount, brlyt_file, xmlyt); mxmlSaveFile(xml, xmlFile, whitespace_cb); fclose(xmlFile); @@ -3726,7 +3731,8 @@ void WriteBRLYTHeader(brlyt_header rlythead, FILE* fp) writehead.magic[1] = rlythead.magic[1]; writehead.magic[2] = rlythead.magic[2]; writehead.magic[3] = rlythead.magic[3]; - writehead.version = be32(rlythead.version); + writehead.endian = short_swap_bytes(rlythead.endian); + writehead.version = short_swap_bytes(rlythead.version); writehead.filesize = be32(rlythead.filesize); writehead.lyt_offset = short_swap_bytes(rlythead.lyt_offset); writehead.sections = short_swap_bytes(rlythead.sections); @@ -3779,6 +3785,7 @@ void write_brlyt(char *infile, char *outfile) rlythead.magic[2] = 'Y'; rlythead.magic[3] = 'T'; //rlythead.version = 0xFEFF0008; + rlythead.endian = 0xFEFF; rlythead.version = versionn; rlythead.filesize = 0; rlythead.lyt_offset = sizeof(brlyt_header); diff --git a/brlyt.h b/brlyt.h index c4fafbb..76de9c3 100644 --- a/brlyt.h +++ b/brlyt.h @@ -18,7 +18,8 @@ typedef struct { fourcc magic; // RLYT - u32 version; // 0xFEFF0008 + u16 endian; // 0xFEFF + u16 version; // 0x0008 u32 filesize; // The filesize of the brlyt. u16 lyt_offset; // Offset to the lyt1 section. u16 sections; // Number of sections. diff --git a/general.h b/general.h index ddd9fa4..08b1595 100644 --- a/general.h +++ b/general.h @@ -12,7 +12,7 @@ #define BENZIN_VERSION_MAJOR 2 #define BENZIN_VERSION_MINOR 1 -#define BENZIN_VERSION_BUILD 8 +#define BENZIN_VERSION_BUILD 9 #define BENZIN_VERSION_OTHER "BETA" #define INFORMATION_TEXT \ -- cgit v1.3.1