From 872a7b2efde01039ad2aa888ae6460467704ff71 Mon Sep 17 00:00:00 2001 From: megazig Date: Sat, 19 Sep 2009 11:57:34 -0500 Subject: updated to 1.9 with lots of changes --- brlyt.h | 280 ++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 193 insertions(+), 87 deletions(-) (limited to 'brlyt.h') diff --git a/brlyt.h b/brlyt.h index 262c8a7..9f009d1 100644 --- a/brlyt.h +++ b/brlyt.h @@ -12,41 +12,42 @@ typedef struct { - fourcc magic; // RLYT - u32 unk1; // 0xFEFF0008 - u32 filesize; // The filesize of the brlyt. - u16 lyt_offset; // Offset to the lyt1 section. - u16 unk2; // Number of sections. + fourcc magic; // RLYT + u32 version; // 0xFEFF0008 + u32 filesize; // The filesize of the brlyt. + u16 lyt_offset; // Offset to the lyt1 section. + u16 sections; // Number of sections. } brlyt_header; typedef struct { - fourcc magic; // The magic. - u32 length; // How long the entry is. + fourcc magic; // The magic. + u32 length; // How long the entry is. } brlyt_entry_header; typedef struct { - fourcc magic; // The magic. - u32 length; // How long the entry is. - u32 data_location; // The location of the data in the BRLYT file. + fourcc magic; // The magic. + u32 length; // How long the entry is. + u32 data_location; // The location of the data in the BRLYT file. } brlyt_entry; typedef struct { - u8 flag1; - u8 flag2; + u8 flag1; // bits: 31-visibility 30-aspect_affected 29-?? + u8 origin; u8 alpha; - u8 alpha2; - char name[24]; - float x; - float y; - float z; - float flip_x; - float flip_y; - float angle; - float xmag; - float ymag; + u8 pad; + char name[0x10]; + char userdata[0x08]; + float XTrans; + float YTrans; + float ZTrans; + float XRotate; + float YRotate; + float ZRotate; + float XScale; + float YScale; float width; float height; } brlyt_pane_chunk; @@ -55,10 +56,10 @@ typedef struct { u16 len1; u16 len2; - u16 mat_off; + u16 mat_num; u16 font_idx; u8 alignment; - u8 pad[3]; // [0, 0, 0] + u8 pad[3]; u32 name_offs; u32 color1; u32 color2; @@ -70,72 +71,49 @@ typedef struct typedef struct { - u32 vtx_colors[4]; // [4294967295L, 4294967295L, 4294967295L, 4294967295L] - u16 mat_off; + u32 vtx_colors[4]; // [4294967295L, 4294967295L, 4294967295L, 4294967295L] + u16 mat_num; u8 num_texcoords; - u8 padding; // 0 + u8 padding; // 0 } brlyt_pic_chunk; typedef struct { - float unk1[4]; // all 0x00000000 - u8 count; // 0x01 - u8 padding[3]; // 0x00 0x00 0x00 - u32 offset1; // 0x00000068 offset to 0xffffffff's - u32 offset2; // 0x0000007c offset to last 8bytes of wnd1 + float coords[4]; // all 0x00000000 + u8 frame_count; // 0x01 + u8 padding[3]; // 0x00 0x00 0x00 + u32 offset1; // 0x00000068 offset to brlyt_wnd1 colors + u32 offset2; // 0x0000007c offset to frame offset list } brlyt_wnd; -typedef struct // pointed at by offset1 +typedef struct // pointed at by offset1 { - u32 unk1[4]; // all 0xffffffff + u32 colors[4]; // all 0xffffffff + u16 material; // 0x0000 + u8 coordinate_count; // 0x01 + u8 padding; // 0x00 } brlyt_wnd1; typedef struct { - u16 unk1[6]; // 0x0019 0x0000 0x0000 0x0080 0x001a 0x0000 -} brlyt_wnd2ish; - -typedef struct -{ - u16 unk1; // 0x0000 - u16 unk2; // 0x0100 -} brlyt_wnd2; - -typedef struct -{ - float texcoords[8]; // 0x00 0x00 3f800000 0x00 0x00 3f800000 3f800000 3f800000 + float texcoords[8]; // 0x00 0x00 3f800000 0x00 0x00 3f800000 3f800000 3f800000 } brlyt_wnd3; -typedef struct // pointed to by offset2 +typedef struct // pointed to by offset2 { - u32 offset; // offset to something + u32 offset; // offset to something } brlyt_wnd4; typedef struct { - u32 unk1; // material number ?? + u16 material; // material number + u8 index; + u8 padding; } brlyt_wnd4_mat; -typedef struct // 0003-0005 -{ - u32 unk1[2]; // 0xb4 0xb8 - u16 unk2[8]; // 0x0012 0x0000 0x0013 0x0000 0x0014 0x0500 0x0015 0x0200 -} brlyt_wnd_addon2; - -// !! bytes 0-7 header -// !! bytes 8-b flags/alpha -// !! bytes c-23 name -// !! floats 24-4b -// ! floats 4c-5b -// ! byte 5c count -// ! bytes 60-63 offset // 4 8 and c are words 12 is a byte following that is tex coords -// ! byte 64-67 offset -// words that are an offset to a struct of (short, bytes) short is a mat offset - - typedef struct { - char a; + char drawnFromMiddle;// related to whether is drawn from middle // 1 = TRUE 2 = FALSE char pad[3]; float width; float height; @@ -159,7 +137,7 @@ typedef struct char name[20]; s16 forecolor[4]; s16 backcolor[4]; - s16 unk_color_2[4]; + s16 colorReg3[4]; u32 tev_kcolor[4]; u32 flags; } brlyt_material_chunk; @@ -177,36 +155,164 @@ typedef struct u8 wrap_t; } brlyt_texref_chunk; -typedef struct // SRT Array +typedef struct +{ + float XTrans; + float YTrans; + float Rotate; + float XScale; + float YScale; +} brlyt_tex_srt; + +typedef struct +{ + char tgen_type; + char tgen_src; + char mtxsrc; + char padding; +} brlyt_tex_coordgen; + +typedef struct +{ + char color_matsrc; + char alpha_matsrc; + char padding1; + char padding2; +} brlyt_tex_chanctrl; + +typedef struct +{ + u8 red; + u8 green; + u8 blue; + u8 alpha; +} brlyt_tex_matcol; + +typedef struct { - float x1; - float y1; - float angle; - float x2; - float y2; -} brlyt_tex_coords; + unsigned red : 2; + unsigned green : 2; + unsigned blue : 2; + unsigned alpha : 2; +} brlyt_tev_swapmode; typedef struct { - u8 unk[4]; -} brlyt_4b_chunk; + unsigned Texture : 4; + unsigned TexSRT : 4; + unsigned TexCoord : 4; + unsigned ua6 : 1; + unsigned ua7 : 2; + unsigned ua8 : 3; + unsigned ua9 : 5; + unsigned uaa : 1; + unsigned uab : 1; + unsigned ua4 : 1; + unsigned padding1 : 1; + unsigned ua5 : 1; + unsigned padding2 : 4; +} mat_flags; + +// 0000 0000 0000 0000 0000 0000 0000 0000 +// xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx +// ---- 5-4b a999 9988 8776 3333 2222 1111 typedef struct { - u32 a; // floating point - u32 b; // floating point - float c; - float d; - float e; -} brlyt_ua7_chunk; + union + { + mat_flags flag; + u32 flags; + }; +} mat1_flags; typedef struct { - u8 unk[16]; -} brlyt_10b_chunk; + u8 one; + u8 two; + u8 three; + u8 four; +} brlyt_tev_swapmodetable; -void swapBytes(unsigned char* char1, unsigned char* char2); -int bitExtraction(unsigned int num, unsigned int start, unsigned int end); +typedef struct +{ + float XTrans; + float YTrans; + float Rotate; + float XScale; + float YScale; +} brlyt_indtex_srt; + +typedef struct +{ + u8 tex_coord; + u8 tex_map; + u8 scale_s; + u8 scale_t; +} brlyt_indtex_order; + +typedef struct +{ + unsigned texcoord : 8; // GX_SetTevOrder( i , this , * , * ); + unsigned color : 8; // GX_SetTevOrder( i , * , * , this ); + unsigned texmapbot : 8; // GX_SetTevOrder( i , * , this | *2 , * ); *1 + unsigned texmaptop : 1; // GX_SetTevOrder( i , * , *1 | this , * ); *2 + unsigned ras_sel : 2; // GX_SetTevSwapMode( i , this , * ); + unsigned tex_sel : 2; // GX_SetTevSwapMode( i , * , this ); + unsigned empty1 : 3;//pad + unsigned aC : 4; // GX_SetTevColorIn( i , this , * , * , * ); + unsigned bC : 4; // GX_SetTevColorIn( i , * , this , * , * ); + unsigned cC : 4; // GX_SetTevColorIn( i , * , * , this , * ); + unsigned dC : 4; // GX_SetTevColorIn( i , * , * , * , this ); + unsigned tevscaleC : 2; // GX_SetTevColorOp( i , * , * , this , * , * ); + unsigned tevbiasC : 2; // GX_SetTevColorOp( i , * , this , * , * , * ); + unsigned tevopC : 4; // GX_SetTevColorOp( i , this , * , * , * , * ); + unsigned tevregidC : 1; // GX_SetTevColorOp( i , * , * , * , * , this ); + unsigned clampC : 2; // GX_SetTecColorOp( i , * , * , * , this , * ); + unsigned selC : 5; // GX_SetTevKColorSel( i , this ); + unsigned aA : 4; // GX_SetTevAlphaIn( i , this , * , * , * ); + unsigned bA : 4; // GX_SetTevAlphaIn( i , * , this , * , * ); + unsigned cA : 4; // GX_SetTevAlphaIn( i , * , * , this , * ); + unsigned dA : 4; // GX_SetTevAlphaIn( i , * , * , * , this ); + unsigned tevscaleA : 2; // GX_SetTevAlphaOp( i , * , * , this , * , * ); + unsigned tevbiasA : 2; // GX_SetTevAlphaOp( i , * , this , * , * , * ); + unsigned tevopA : 4; // GX_SetTevAlphaOp( i , this , * , * , * , * ); + unsigned tevregidA : 1; // GX_SetTevAlphaOp( i , * , * , * , * , this ); + unsigned clampA : 2; // GX_SetTecAlphaOp( i , * , * , * , this , * ); + unsigned selA : 5; // GX_SetTevKAlphaSel( i , this ); + unsigned indtexid : 8; // GX_SetTevIndirect( i , this , * , * , * , * , * , * , * , * ); + unsigned bias : 3; // GX_SetTevIndirect( i , * , * , this , * , * , * , * , * , * ); + unsigned mtxid : 4; // GX_SetTevIndirect( i , * , * , * , this , * , * , * , * , * ); + unsigned empty2 : 1;//pad + unsigned wrap_s : 3; // GX_SetTevIndirect( i , * , * , * , * , this , * , * , * , * ); + unsigned wrap_t : 3; // GX_SetTevIndirect( i , * , * , * , * , * , this , * , * , * ); + unsigned empty3 : 2;//pad + unsigned format : 2; // GX_SetTevIndirect( i , * , this , * , * , * , * , * , * , * ); + unsigned addprev : 1; // GX_SetTevIndirect( i , * , * , * , * , * , * , this , * , * ); + unsigned utclod : 1; // GX_SetTevIndirect( i , * , * , * , * , * , * , * , this , * ); + unsigned aIND : 2; // GX_SetTevIndirect( i , * , * , * , * , * , * , * , * , this ); + unsigned empty4 : 2;//pad +} TevStages; + +typedef struct +{ + unsigned comp0 : 4; + unsigned comp1 : 4; // had to switch + unsigned aop : 8; + unsigned ref0 : 8; + unsigned ref1 : 8; +} brlyt_alpha_compare; + +typedef struct +{ + u8 type; + u8 src_fact; + u8 dst_fact; + u8 op; +} brlyt_blend_mode; + +u8 swapBits( u8 char1 ); +u32 bitExtraction(u32 num, u32 start, u32 end); void parse_brlyt(char *filename, char *filenameout); void make_brlyt(char* infile, char* outfile); -- cgit v1.3.1