changed the brlyt stuff a bit

This commit is contained in:
thedarkness1981 2009-07-31 12:49:13 +00:00
parent 6e3bc5607e
commit 8d3e04b666
2 changed files with 50 additions and 30 deletions

View File

@ -15,6 +15,20 @@
#include "brlyt.h"
#include "openingbnr.h"
brlyt_header brlytheader;
lyt1_header lyt1header;
txl1_header txl1header;
txl1_offset **txl1offsets;
tpl_files **tplss;
mat1_header mat1header;
mat1_offset **mat1offsets;
mat1_material **mat1materials;
pic1_header **pic1header;
pae1_header pae1header;
grp1_header grp1header;
int BRLYT_Initialize(const char *rootpath)
{
//fatInitDefault();
@ -22,10 +36,6 @@ FILE * fp = fopen(rootpath,"rb");
if (fp == NULL) return 0;
brlyt_header brlytheader;
lyt1_header lyt1header;
txl1_header txl1header;
fread((void*)&brlytheader,1,sizeof(brlytheader),fp);
fread((void*)&lyt1header,1,sizeof(lyt1header),fp);
fread((void*)&txl1header,1,sizeof(txl1header),fp);
@ -33,7 +43,7 @@ fread((void*)&txl1header,1,sizeof(txl1header),fp);
//printf("Filesize: %i\n",be32((u8*)&brlytheader.file_size));
//printf("Num Textures: %i\n",be16((u8*)&txl1header.num_textures));
txl1_offset **txl1offsets = (txl1_offset**)malloc(sizeof(txl1_offset*)*be16((u8*)&txl1header.num_textures));
txl1offsets = (txl1_offset**)malloc(sizeof(txl1_offset*)*be16((u8*)&txl1header.num_textures));
if(txl1offsets == NULL)
{
@ -54,7 +64,7 @@ for(i = 0; i < be16((u8*)&txl1header.num_textures); i++)
//printf("Offset Filename: %i\n",be32((u8*)&txl1offsets[i]->offset_filename));
}
tpl_files **tplss = (tpl_files**)malloc(sizeof(tpl_files*)*be16((u8*)&txl1header.num_textures));
tplss = (tpl_files**)malloc(sizeof(tpl_files*)*be16((u8*)&txl1header.num_textures));
if(tplss == NULL)
{
fprintf(stderr, "out of memory\n");
@ -101,7 +111,7 @@ for(i = 0; i < be16((u8*)&mat1header.num_materials); i++)
//printf("%i. Material Offset: %X\n",i,be32((u8*)&mat1offsets[i]->offset));
}
mat1_material **mat1materials = (mat1_material**)malloc(sizeof(mat1_material*)*be16((u8*)&mat1header.num_materials));
mat1materials = (mat1_material**)malloc(sizeof(mat1_material*)*be16((u8*)&mat1header.num_materials));
if(mat1materials == NULL)
{
fprintf(stderr, "out of memory\n");
@ -152,15 +162,29 @@ for(i = 0; i < be16((u8*)&mat1header.num_materials); i++)
// printf("%i. Pic1 Names: %s\n",i,pic1header[i]->name);
}
pae1_header pae1header;
fread((void*)&pae1header,1,sizeof(pae1header),fp);
grp1_header grp1header;
fread((void*)&grp1header,1,sizeof(grp1header),fp);
//Close File
fclose(fp);
return 1;
}
int BRLYT_ReadObjects(BRLYT_object** objs)
{
return 0;
}
void BRLYT_Finish()
{
}
void BRLYT_FreeMem()
{
int i = 0;
//free memory
for(i = 0; i < be16((u8*)&txl1header.num_textures); i++)
free(txl1offsets[i]);
@ -186,16 +210,4 @@ for(i = 0; i < be16((u8*)&mat1header.num_materials); i++)
free(pic1header[i]);
free(pic1header);
return 1;
}
int BRLYT_ReadObjects(BRLYT_object** objs)
{
return 0;
}
void BRLYT_Finish()
{
}

View File

@ -3,7 +3,7 @@
* Parses brlyt file
*
* by nIxx
* http://wiibrew.org/wiki/Wii_Animations#Textures_and_Material_lists_.28.2A.brlyt.29
* Infos: http://wiibrew.org/wiki/Wii_Animations#Textures_and_Material_lists_.28.2A.brlyt.29
*
*/
@ -40,7 +40,7 @@ typedef struct
{
char sig [4]; // "lyt1" in ASCII.
u32 size_header;
u32 unk2;
u32 a;
u32 width;
u32 height;
} lyt1_header;
@ -76,8 +76,8 @@ typedef struct
typedef struct
{
char name[20];
s16 tev_color[4];
s16 unk_color[4];
s16 black_color[4];
s16 white_color[4];
s16 unk_color_2[4];
u32 tev_kcolor[4];
u32 flags;
@ -87,7 +87,8 @@ typedef struct
{
char sig [4]; // "pan1" in ASCII.
u32 size_section;
u32 unk; // Always 01 04 FF 00?
u16 flag;
u16 alpha;
char pane_name [0x18]; // Pane name in ASCII.
float x;
float y;
@ -95,7 +96,7 @@ typedef struct
float xFlip;
float yFlip;
float zFlip; //rotate
float xMag;
float xMag; //Zoom
float yMag;
float width;
float height;
@ -107,8 +108,6 @@ typedef struct
u32 size_section;
} pas1_header;
typedef struct
{
char sig [4]; // "pic1" in ASCII.
@ -116,7 +115,16 @@ typedef struct
u16 flags;
u16 alpha;
char name[0x18];
float coords[10]; // x, y, unk, unk, unk, angle, xmag, ymag, width, height.
float x;
float y;
float z;
float xFlip;
float yFlip;
float zFlip; //rotate
float xMag;
float yMag; //zoom
float width;
float height;
} pic1_header;
typedef struct