mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
port: 64-bit: get rid of host_ structs; further cleanup
This commit is contained in:
1 parent
2f221b9a1e
commit
163dbf9495
14 files changed
+395
-746
No files matched your search
@@ -3,14 +3,14 @@
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
typedef u8* (*preprocessfunc)(u8 *data, u32 size, u32 *outSize);
|
||||
typedef u8 *(*preprocessfunc)(u8 *data, u32 size, u32 *outSize);
|
||||
|
||||
u8* preprocessAnimations(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessMpConfigs(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessFont(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessJpnFont(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessALBankFile(u8 *data, u32 size, u32 *outSize);
|
||||
void preprocessALCMidiHdr(u8 *data, u32 size);
|
||||
u8 *preprocessALCMidiHdr(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessSequences(u8 *data, u32 size, u32 *outSize);
|
||||
u8* preprocessTexturesList(u8 *data, u32 size, u32 *outSize);
|
||||
|
||||
@@ -20,7 +20,6 @@ void preprocessBgSection3(u8* data, u32 size);
|
||||
void preprocessBgSection1Header(u8 *data, u32 size);
|
||||
void preprocessBgSection2Header(u8 *data, u32 size);
|
||||
void preprocessBgSection3Header(u8 *data, u32 size);
|
||||
void preprocessBgLights(u8 *data, u32 ofs);
|
||||
u32 preprocessBgRoom(u8* data, u32 size, u32 room_ofs);
|
||||
|
||||
u8 *preprocessLangFile(u8 *data, u32 size, u32 *outSize);
|
||||
|
||||
@@ -31,7 +31,7 @@ static inline void* swapPtr(void** x) { return (void*)PD_BEPTR((uintptr_t)x); }
|
||||
static inline struct coord swapCrd(struct coord crd) { crd.x = swapF32(crd.x); crd.y = swapF32(crd.y); crd.z = swapF32(crd.z); return crd; }
|
||||
static inline u32 swapUnk(u32 x) { assert(0 && "unknown type"); return x; }
|
||||
|
||||
#define PD_SWAP_VAL(x) x = _Generic((x), \
|
||||
#define PD_SWAPPED_VAL(x) _Generic((x), \
|
||||
f32: swapF32, \
|
||||
u32: swapU32, \
|
||||
s32: swapS32, \
|
||||
@@ -41,6 +41,8 @@ static inline u32 swapUnk(u32 x) { assert(0 && "unknown type"); return x; }
|
||||
default: swapUnk \
|
||||
)(x)
|
||||
|
||||
#define PD_SWAP_VAL(x) x = PD_SWAPPED_VAL(x)
|
||||
|
||||
#define PD_SWAP_PTR(x) x = swapPtr((void *)(x))
|
||||
|
||||
// ptr marker functions
|
||||
|
||||
@@ -14,7 +14,6 @@ struct n64_stagesetup {
|
||||
u32 ptr_padfiledata;
|
||||
};
|
||||
|
||||
|
||||
struct n64_coord {
|
||||
f32 x;
|
||||
f32 y;
|
||||
|
||||
+52
-119
@@ -70,49 +70,13 @@ struct host_primaryheader {
|
||||
uintptr_t unused2;
|
||||
};
|
||||
|
||||
struct n64_room {
|
||||
struct n64_bgroom {
|
||||
u32 ptr_gfxdata;
|
||||
u32 pos[3];
|
||||
struct coord pos;
|
||||
u8 br_light_min;
|
||||
u8 br_light_max;
|
||||
};
|
||||
|
||||
struct host_room {
|
||||
uintptr_t ptr_gfxdata;
|
||||
u32 pos[3];
|
||||
u8 br_light_min;
|
||||
u8 br_light_max;
|
||||
};
|
||||
|
||||
struct portal {
|
||||
u16 verticesoffset;
|
||||
s16 roomnum1;
|
||||
s16 roomnum2;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
struct generic_portalvertices {
|
||||
u8 count;
|
||||
u32 vertices[1][3];
|
||||
};
|
||||
|
||||
/*
|
||||
struct light {
|
||||
u16 roomnum;
|
||||
u16 colour;
|
||||
u8 brightness;
|
||||
u8 sparkable : 1;
|
||||
u8 healthy : 1;
|
||||
u8 on : 1;
|
||||
u8 sparking : 1;
|
||||
u8 vulnerable : 1;
|
||||
u8 brightnessmult;
|
||||
s8 dirx;
|
||||
s8 diry;
|
||||
s8 dirz;
|
||||
s16 bbox[4][3];
|
||||
};*/
|
||||
|
||||
struct n64_roomblock {
|
||||
u8 type;
|
||||
u32 ptr_next;
|
||||
@@ -121,14 +85,6 @@ struct n64_roomblock {
|
||||
u32 ptr_colours;
|
||||
};
|
||||
|
||||
struct host_roomblock {
|
||||
u8 type;
|
||||
uintptr_t ptr_next;
|
||||
uintptr_t ptr_gdl;
|
||||
uintptr_t ptr_vertices;
|
||||
uintptr_t ptr_colours;
|
||||
};
|
||||
|
||||
struct n64_roomgfxdata {
|
||||
u32 ptr_vertices;
|
||||
u32 ptr_colours;
|
||||
@@ -141,18 +97,6 @@ struct n64_roomgfxdata {
|
||||
// roomblocks[]
|
||||
};
|
||||
|
||||
struct host_roomgfxdata {
|
||||
uintptr_t ptr_vertices;
|
||||
uintptr_t ptr_colours;
|
||||
uintptr_t ptr_opablocks;
|
||||
uintptr_t ptr_xlublocks;
|
||||
s16 lightsindex;
|
||||
s16 numlights;
|
||||
s16 numvertices;
|
||||
s16 numcolours;
|
||||
// roomblocks[]
|
||||
};
|
||||
|
||||
struct vtx {
|
||||
s16 coord[3];
|
||||
u8 flag;
|
||||
@@ -161,38 +105,32 @@ struct vtx {
|
||||
u16 t;
|
||||
};
|
||||
|
||||
int m_NumRooms;
|
||||
|
||||
u32 m_AllocSizes[512];
|
||||
|
||||
static void convertPrimaryRooms(u8 *dst, u32 *dstpos, u8 *src, u32 *srcpos)
|
||||
{
|
||||
struct n64_room *n64_rooms = (struct n64_room *) &src[*srcpos];
|
||||
struct host_room *host_rooms = (struct host_room *) &dst[*dstpos];
|
||||
struct n64_bgroom *n64_rooms = (struct n64_bgroom *) &src[*srcpos];
|
||||
struct bgroom *host_rooms = (struct bgroom *) &dst[*dstpos];
|
||||
|
||||
m_NumRooms = 0;
|
||||
s32 numRooms = 0;
|
||||
|
||||
for (int i = 1; n64_rooms[i].ptr_gfxdata != 0; i++) {
|
||||
m_NumRooms++;
|
||||
numRooms++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_NumRooms + 1; i++) {
|
||||
host_rooms[i].ptr_gfxdata = PD_BE32(n64_rooms[i].ptr_gfxdata);
|
||||
host_rooms[i].pos[0] = PD_BE32(n64_rooms[i].pos[0]);
|
||||
host_rooms[i].pos[1] = PD_BE32(n64_rooms[i].pos[1]);
|
||||
host_rooms[i].pos[2] = PD_BE32(n64_rooms[i].pos[2]);
|
||||
for (int i = 0; i < numRooms + 1; i++) {
|
||||
host_rooms[i].unk00 = PD_BE32(n64_rooms[i].ptr_gfxdata);
|
||||
host_rooms[i].pos = PD_SWAPPED_VAL(n64_rooms[i].pos);
|
||||
host_rooms[i].br_light_min = n64_rooms[i].br_light_min;
|
||||
host_rooms[i].br_light_max = n64_rooms[i].br_light_max;
|
||||
}
|
||||
|
||||
*srcpos += sizeof(*n64_rooms) * (m_NumRooms + 2);
|
||||
*dstpos += sizeof(*host_rooms) * (m_NumRooms +2);
|
||||
*srcpos += sizeof(*n64_rooms) * (numRooms + 2);
|
||||
*dstpos += sizeof(*host_rooms) * (numRooms +2);
|
||||
}
|
||||
|
||||
static void convertPrimaryPortals(u8 *dst, u32 *dstpos, u8 *src, u32 *srcpos, u32 *src_portalvtxs, u32 *dst_portalvtxs)
|
||||
{
|
||||
struct portal *n64_portals = (struct portal *) &src[*srcpos];
|
||||
struct portal *host_portals = (struct portal *) &dst[*dstpos];
|
||||
struct bgportal *n64_portals = (struct bgportal *) &src[*srcpos];
|
||||
struct bgportal *host_portals = (struct bgportal *) &dst[*dstpos];
|
||||
|
||||
// Count portals
|
||||
int numportals = 0;
|
||||
@@ -216,18 +154,13 @@ static void convertPrimaryPortals(u8 *dst, u32 *dstpos, u8 *src, u32 *srcpos, u3
|
||||
*dst_portalvtxs = *dstpos;
|
||||
|
||||
while (1) {
|
||||
struct generic_portalvertices *n64_pvertices = (struct generic_portalvertices*)&src[*srcpos];
|
||||
struct generic_portalvertices*host_pvertices = (struct generic_portalvertices*)&dst[*dstpos];
|
||||
struct portalvertices *n64_pvertices = (struct portalvertices *)&src[*srcpos];
|
||||
struct portalvertices *host_pvertices = (struct portalvertices *)&dst[*dstpos];
|
||||
|
||||
host_pvertices->count = n64_pvertices->count;
|
||||
|
||||
for (int j = 0; j < host_pvertices->count; j++) {
|
||||
//host_pvertices->vertices[j].x = PD_BE32(n64_pvertices->vertices[j].x);
|
||||
//host_pvertices->vertices[j].y = PD_BE32(n64_pvertices->vertices[j].y);
|
||||
//host_pvertices->vertices[j].z = PD_BE32(n64_pvertices->vertices[j].z);
|
||||
host_pvertices->vertices[j][0] = PD_BE32(n64_pvertices->vertices[j][0]);
|
||||
host_pvertices->vertices[j][1] = PD_BE32(n64_pvertices->vertices[j][1]);
|
||||
host_pvertices->vertices[j][2] = PD_BE32(n64_pvertices->vertices[j][2]);
|
||||
host_pvertices->vertices[j] = PD_SWAPPED_VAL(n64_pvertices->vertices[j]);
|
||||
}
|
||||
|
||||
*srcpos += 4 + host_pvertices->count * 12;
|
||||
@@ -320,43 +253,43 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
int numgdls = 0;
|
||||
|
||||
struct n64_roomgfxdata *src_header = (struct n64_roomgfxdata*)src;
|
||||
struct host_roomgfxdata *dst_header = (struct host_roomgfxdata*)dst;
|
||||
struct roomgfxdata *dst_header = (struct roomgfxdata*)dst;
|
||||
|
||||
dst_header->ptr_vertices = PD_BE32(src_header->ptr_vertices);
|
||||
dst_header->ptr_colours = PD_BE32(src_header->ptr_colours);
|
||||
dst_header->ptr_opablocks = PD_BE32(src_header->ptr_opablocks);
|
||||
dst_header->ptr_xlublocks = PD_BE32(src_header->ptr_xlublocks);
|
||||
dst_header->vertices = (void *)(uintptr_t)PD_BE32(src_header->ptr_vertices);
|
||||
dst_header->colours = (void *)(uintptr_t)PD_BE32(src_header->ptr_colours);
|
||||
dst_header->opablocks = (void *)(uintptr_t)PD_BE32(src_header->ptr_opablocks);
|
||||
dst_header->xlublocks = (void *)(uintptr_t)PD_BE32(src_header->ptr_xlublocks);
|
||||
dst_header->lightsindex = PD_BE16(src_header->lightsindex);
|
||||
dst_header->numlights = PD_BE16(src_header->numlights);
|
||||
dst_header->numvertices = PD_BE16(src_header->numvertices);
|
||||
dst_header->numcolours = PD_BE16(src_header->numcolours);
|
||||
|
||||
intptr_t endpos = dst_header->ptr_vertices - src_ofs;
|
||||
intptr_t endpos = (uintptr_t)dst_header->vertices - src_ofs;
|
||||
uintptr_t curpos_src = sizeof(struct n64_roomgfxdata);
|
||||
uintptr_t curpos_dst = sizeof(struct host_roomgfxdata);
|
||||
uintptr_t curpos_dst = sizeof(struct roomgfxdata);
|
||||
|
||||
// roomblocks
|
||||
int ncoords = 0;
|
||||
|
||||
// save the ptr to roomblocks here to iterate later to fix the pointers
|
||||
struct host_roomblock *ptr_dst_roomblocks = (struct host_roomblock*)&dst[curpos_dst];
|
||||
struct roomblock *ptr_dst_roomblocks = (struct roomblock*)&dst[curpos_dst];
|
||||
|
||||
int numblocks = 0;
|
||||
while ((intptr_t)(curpos_src + sizeof(struct n64_roomblock)) <= endpos) {
|
||||
struct n64_roomblock *src_roomblock = (struct n64_roomblock*)&src[curpos_src];
|
||||
struct host_roomblock *dest_roomblock = (struct host_roomblock*)&dst[curpos_dst];
|
||||
struct roomblock *dest_roomblock = (struct roomblock*)&dst[curpos_dst];
|
||||
|
||||
dest_roomblock->type = src_roomblock->type;
|
||||
dest_roomblock->ptr_next = PD_BE32(src_roomblock->ptr_next);
|
||||
dest_roomblock->ptr_gdl = PD_BE32(src_roomblock->ptr_gdl);
|
||||
dest_roomblock->ptr_vertices = PD_BE32(src_roomblock->ptr_vertices);
|
||||
dest_roomblock->ptr_colours = PD_BE32(src_roomblock->ptr_colours);
|
||||
dest_roomblock->next = (void *)(uintptr_t)PD_BE32(src_roomblock->ptr_next);
|
||||
dest_roomblock->gdl = (void *)(uintptr_t)PD_BE32(src_roomblock->ptr_gdl);
|
||||
dest_roomblock->vertices = (void *)(uintptr_t)PD_BE32(src_roomblock->ptr_vertices);
|
||||
dest_roomblock->colours = (void *)(uintptr_t)PD_BE32(src_roomblock->ptr_colours);
|
||||
|
||||
ptrAdd(curpos_src + src_ofs, curpos_dst + dst_roomoffset);
|
||||
|
||||
if (src_roomblock->type == BLOCK_PARENT) {
|
||||
ncoords++;
|
||||
uintptr_t vtx_ptr = dest_roomblock->ptr_vertices - src_ofs;
|
||||
uintptr_t vtx_ptr = (uintptr_t)dest_roomblock->vertices - src_ofs;
|
||||
if (vtx_ptr < endpos) endpos = vtx_ptr;
|
||||
}
|
||||
else if (src_roomblock->ptr_gdl) {
|
||||
@@ -364,7 +297,7 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
}
|
||||
|
||||
curpos_src += sizeof(struct n64_roomblock);
|
||||
curpos_dst += sizeof(struct host_roomblock);
|
||||
curpos_dst += sizeof(struct roomblock);
|
||||
numblocks++;
|
||||
}
|
||||
|
||||
@@ -390,15 +323,15 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
curpos_dst = ALIGN8(curpos_dst);
|
||||
|
||||
// vertices
|
||||
uintptr_t ptr_src_vertices = curpos_src = ALIGN8(dst_header->ptr_vertices - src_ofs);
|
||||
uintptr_t ptr_src_vertices = curpos_src = ALIGN8((uintptr_t)dst_header->vertices - src_ofs);
|
||||
uintptr_t ptr_dst_vertices = curpos_dst + dst_roomoffset;
|
||||
|
||||
ptrAdd(curpos_src + src_ofs, curpos_dst + dst_roomoffset);
|
||||
|
||||
uintptr_t vtx_end = dst_header->ptr_colours - src_ofs;
|
||||
uintptr_t vtx_end = (uintptr_t)dst_header->colours - src_ofs;
|
||||
|
||||
while (dst_header->ptr_colours && curpos_src < vtx_end) {
|
||||
struct vtx *src_vtx = (struct vtx*)(src + curpos_src);
|
||||
while (dst_header->colours && curpos_src < vtx_end) {
|
||||
struct vtx *src_vtx = (struct vtx*)(src + curpos_src);
|
||||
struct vtx *dst_vtx = (struct vtx*)(dst + curpos_dst);
|
||||
|
||||
dst_vtx->coord[0] = PD_BE16(src_vtx->coord[0]);
|
||||
@@ -421,8 +354,8 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
uintptr_t ptr_src_colors = 0;
|
||||
uintptr_t ptr_dst_colors = 0;
|
||||
|
||||
if (dst_header->ptr_colours) {
|
||||
ptr_src_colors = curpos_src = ALIGN8(dst_header->ptr_colours - src_ofs);
|
||||
if (dst_header->colours) {
|
||||
ptr_src_colors = curpos_src = ALIGN8((uintptr_t)dst_header->colours - src_ofs);
|
||||
ptr_dst_colors = curpos_dst + dst_roomoffset;
|
||||
|
||||
ptrAdd(curpos_src + src_ofs, curpos_dst + dst_roomoffset);
|
||||
@@ -437,7 +370,7 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
|
||||
// gdls
|
||||
gbiSetVtx(src_header->ptr_vertices, ptr_src_vertices);
|
||||
gbiSetSegment(0x0e, dst_header->ptr_vertices);
|
||||
gbiSetSegment(0x0e, (uintptr_t)dst_header->vertices);
|
||||
|
||||
uintptr_t gdlstart = curpos_dst;
|
||||
for (size_t i = 0; i < numgdls; i++) {
|
||||
@@ -447,29 +380,29 @@ static u32 convertRoomGfxData(u8 *dst, u8 *src, u32 infsize, u32 src_ofs)
|
||||
|
||||
// relink ptrs: roomblocks
|
||||
for (size_t i = 0; i < numblocks; i++) {
|
||||
struct host_roomblock *block = (struct host_roomblock*)&ptr_dst_roomblocks[i];
|
||||
|
||||
relinkPtr((uintptr_t*)&block->ptr_next);
|
||||
struct roomblock *block = (struct roomblock*)&ptr_dst_roomblocks[i];
|
||||
|
||||
relinkPtr((uintptr_t*)&block->next);
|
||||
|
||||
if (block->type == BLOCK_LEAF) {
|
||||
relinkPtr((uintptr_t*)&block->ptr_gdl);
|
||||
u32 offset_vtx = block->ptr_vertices - ptr_src_vertices - src_ofs;
|
||||
u32 offset_col = block->ptr_colours - ptr_src_colors - src_ofs;
|
||||
relinkPtr((uintptr_t*)&block->gdl);
|
||||
u32 offset_vtx = (uintptr_t)block->vertices - ptr_src_vertices - src_ofs;
|
||||
u32 offset_col = (uintptr_t)block->colours - ptr_src_colors - src_ofs;
|
||||
|
||||
block->ptr_vertices = ptr_dst_vertices + offset_vtx;
|
||||
block->ptr_colours = ptr_dst_colors + offset_col;
|
||||
block->vertices = (void *)(ptr_dst_vertices + offset_vtx);
|
||||
block->colours = (void *)(ptr_dst_colors + offset_col);
|
||||
}
|
||||
else {
|
||||
relinkPtr((uintptr_t*)&block->ptr_gdl); // child
|
||||
relinkPtr((uintptr_t*)&block->ptr_vertices); // coord
|
||||
relinkPtr((uintptr_t*)&block->gdl); // child
|
||||
relinkPtr((uintptr_t*)&block->vertices); // coord
|
||||
}
|
||||
}
|
||||
|
||||
// relink ptrs: header
|
||||
relinkPtr((uintptr_t*)&dst_header->ptr_vertices);
|
||||
relinkPtr((uintptr_t*)&dst_header->ptr_colours);
|
||||
relinkPtr((uintptr_t*)&dst_header->ptr_opablocks);
|
||||
relinkPtr((uintptr_t*)&dst_header->ptr_xlublocks);
|
||||
relinkPtr((uintptr_t*)&dst_header->vertices);
|
||||
relinkPtr((uintptr_t*)&dst_header->colours);
|
||||
relinkPtr((uintptr_t*)&dst_header->opablocks);
|
||||
relinkPtr((uintptr_t*)&dst_header->xlublocks);
|
||||
|
||||
return curpos_dst;
|
||||
}
|
||||
|
||||
+173
-318
@@ -76,7 +76,7 @@ static const struct alignconfig alignConfigs[] = {
|
||||
static struct marker contentMarkers[1024];
|
||||
static int numContentMarkers;
|
||||
|
||||
struct src_modeldef {
|
||||
struct n64_modeldef {
|
||||
u32 ptr_rootnode;
|
||||
u32 ptr_skel;
|
||||
u32 ptr_parts;
|
||||
@@ -88,19 +88,7 @@ struct src_modeldef {
|
||||
u32 ptr_texconfigs;
|
||||
};
|
||||
|
||||
struct dst_modeldef {
|
||||
uintptr_t ptr_rootnode;
|
||||
uintptr_t ptr_skel;
|
||||
uintptr_t ptr_parts;
|
||||
s16 numparts;
|
||||
s16 nummatrices;
|
||||
u32 scale;
|
||||
u16 rwdatalen;
|
||||
u16 numtexconfigs;
|
||||
uintptr_t ptr_texconfigs;
|
||||
};
|
||||
|
||||
struct src_modelnode {
|
||||
struct n64_modelnode {
|
||||
u16 type;
|
||||
u32 ptr_rodata;
|
||||
u32 ptr_parent;
|
||||
@@ -109,30 +97,7 @@ struct src_modelnode {
|
||||
u32 ptr_child;
|
||||
};
|
||||
|
||||
struct dst_modelnode {
|
||||
u16 type;
|
||||
uintptr_t ptr_rodata;
|
||||
uintptr_t ptr_parent;
|
||||
uintptr_t ptr_next;
|
||||
uintptr_t ptr_prev;
|
||||
uintptr_t ptr_child;
|
||||
};
|
||||
|
||||
struct generic_rodata_chrinfo {
|
||||
u16 animpart;
|
||||
s16 mtxindex;
|
||||
u32 unk04;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct generic_rodata_position {
|
||||
u32 pos[3];
|
||||
u16 part;
|
||||
s16 mtxindexes[3];
|
||||
u32 drawdist;
|
||||
};
|
||||
|
||||
struct src_rodata_gundl {
|
||||
struct n64_modelrodata_gundl {
|
||||
u32 ptr_opagdl;
|
||||
u32 ptr_xlugdl;
|
||||
u32 ptr_baseaddr;
|
||||
@@ -141,75 +106,34 @@ struct src_rodata_gundl {
|
||||
s16 unk12;
|
||||
};
|
||||
|
||||
struct dst_rodata_gundl {
|
||||
uintptr_t ptr_opagdl;
|
||||
uintptr_t ptr_xlugdl;
|
||||
uintptr_t ptr_baseaddr;
|
||||
uintptr_t ptr_vertices;
|
||||
s16 numvertices;
|
||||
s16 unk12;
|
||||
};
|
||||
|
||||
struct src_rodata_distance {
|
||||
u32 near;
|
||||
u32 far;
|
||||
struct n64_modelrodata_distance {
|
||||
f32 near;
|
||||
f32 far;
|
||||
u32 ptr_target;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct dst_rodata_distance {
|
||||
u32 near;
|
||||
u32 far;
|
||||
uintptr_t ptr_target;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct src_rodata_reorder {
|
||||
u32 unk00;
|
||||
u32 unk04;
|
||||
u32 unk08;
|
||||
u32 unk0c[3];
|
||||
struct n64_modelrodata_reorder {
|
||||
f32 unk00;
|
||||
f32 unk04;
|
||||
f32 unk08;
|
||||
f32 unk0c[3];
|
||||
u32 ptr_node_unk18;
|
||||
u32 ptr_node_unk1c;
|
||||
s16 side;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct dst_rodata_reorder {
|
||||
u32 unk00;
|
||||
u32 unk04;
|
||||
u32 unk08;
|
||||
u32 unk0c[3];
|
||||
uintptr_t ptr_node_unk18;
|
||||
uintptr_t ptr_node_unk1c;
|
||||
s16 side;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct generic_rodata_bbox {
|
||||
s32 hitpart;
|
||||
u32 bbox[6];
|
||||
};
|
||||
|
||||
struct src_rodata_chrgunfire {
|
||||
u32 pos[3];
|
||||
u32 dim[3];
|
||||
struct n64_modelrodata_chrgunfire {
|
||||
struct coord pos;
|
||||
struct coord dim;
|
||||
u32 ptr_texture;
|
||||
u32 unk1c;
|
||||
f32 unk1c;
|
||||
u16 rwdataindex;
|
||||
u32 ptr_baseaddr;
|
||||
};
|
||||
|
||||
struct dst_rodata_chrgunfire {
|
||||
u32 pos[3];
|
||||
u32 dim[3];
|
||||
uintptr_t ptr_texture;
|
||||
u32 unk1c;
|
||||
u16 rwdataindex;
|
||||
uintptr_t ptr_baseaddr;
|
||||
};
|
||||
|
||||
struct src_rodata_type11 {
|
||||
struct n64_modelrodata_type11 {
|
||||
u32 unk00;
|
||||
u32 unk04;
|
||||
u32 unk08;
|
||||
@@ -220,52 +144,19 @@ struct src_rodata_type11 {
|
||||
u32 extra2;
|
||||
};
|
||||
|
||||
struct dst_rodata_type11 {
|
||||
u32 unk00;
|
||||
u32 unk04;
|
||||
u32 unk08;
|
||||
u32 unk0c;
|
||||
u32 unk10;
|
||||
u32 unk14;
|
||||
u32 extra1;
|
||||
u32 extra2;
|
||||
};
|
||||
|
||||
struct src_rodata_toggle {
|
||||
struct n64_modelrodata_toggle {
|
||||
u32 ptr_target;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct dst_rodata_toggle {
|
||||
uintptr_t ptr_target;
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct generic_rodata_positionheld {
|
||||
u32 pos[3];
|
||||
s16 mtxindex;
|
||||
u32 unk10;
|
||||
};
|
||||
|
||||
struct src_rodata_stargunfire {
|
||||
struct n64_modelrodata_stargunfire {
|
||||
u32 unk00;
|
||||
u32 ptr_vertices;
|
||||
u32 ptr_gdl;
|
||||
u32 ptr_baseaddr;
|
||||
};
|
||||
|
||||
struct dst_rodata_stargunfire {
|
||||
u32 unk00;
|
||||
uintptr_t ptr_vertices;
|
||||
uintptr_t ptr_gdl;
|
||||
uintptr_t ptr_baseaddr;
|
||||
};
|
||||
|
||||
struct generic_rodata_headspot {
|
||||
u16 rwdataindex;
|
||||
};
|
||||
|
||||
struct src_rodata_dl {
|
||||
struct n64_modelrodata_dl {
|
||||
u32 ptr_opagdl;
|
||||
u32 ptr_xlugdl;
|
||||
u32 ptr_colours;
|
||||
@@ -276,23 +167,7 @@ struct src_rodata_dl {
|
||||
u16 numcolours;
|
||||
};
|
||||
|
||||
struct dst_rodata_dl {
|
||||
uintptr_t ptr_opagdl;
|
||||
uintptr_t ptr_xlugdl;
|
||||
uintptr_t ptr_colours;
|
||||
uintptr_t ptr_vertices; // colours follow this array
|
||||
s16 numvertices;
|
||||
s16 mcount;
|
||||
u16 rwdataindex;
|
||||
u16 numcolours;
|
||||
};
|
||||
|
||||
struct generic_rodata_type19 {
|
||||
u32 numvertices;
|
||||
u32 vertices[3];
|
||||
};
|
||||
|
||||
struct src_texconfig {
|
||||
struct n64_textureconfig {
|
||||
u32 ptr;
|
||||
u8 width;
|
||||
u8 height;
|
||||
@@ -304,18 +179,6 @@ struct src_texconfig {
|
||||
u8 unk0b;
|
||||
};
|
||||
|
||||
struct dst_texconfig {
|
||||
uintptr_t ptr;
|
||||
u8 width;
|
||||
u8 height;
|
||||
u8 level;
|
||||
u8 format;
|
||||
u8 depth;
|
||||
u8 s;
|
||||
u8 t;
|
||||
u8 unk0b;
|
||||
};
|
||||
|
||||
static inline uintptr_t minPtr(uintptr_t a, uintptr_t b) {
|
||||
return (a && (a < b || !b)) ? a : b;
|
||||
}
|
||||
@@ -400,18 +263,18 @@ static void populateMarkers(u8 *src)
|
||||
|
||||
switch (marker->type) {
|
||||
case CT_MODELDEF:
|
||||
struct src_modeldef *src_modeldef = src_thing;
|
||||
struct n64_modeldef *src_modeldef = src_thing;
|
||||
int num_texconfigs = PD_BE16(src_modeldef->numtexconfigs);
|
||||
u32 texconfigpos = PD_BE32(src_modeldef->ptr_texconfigs);
|
||||
setMarker(PD_BE32(src_modeldef->ptr_rootnode), CT_NODE, marker->src_offset);
|
||||
setMarker(PD_BE32(src_modeldef->ptr_parts), CT_PARTS, marker->src_offset);
|
||||
|
||||
for (int i = 0; i < num_texconfigs; i++) {
|
||||
setMarker(texconfigpos + sizeof(struct src_texconfig) * i, CT_TEXCONFIG, marker->src_offset);
|
||||
setMarker(texconfigpos + sizeof(struct n64_textureconfig) * i, CT_TEXCONFIG, marker->src_offset);
|
||||
}
|
||||
break;
|
||||
case CT_NODE:
|
||||
struct src_modelnode *src_node = src_thing;
|
||||
struct n64_modelnode *src_node = src_thing;
|
||||
u32 node_type = PD_BE16(src_node->type) & 0xff;
|
||||
setMarker(PD_BE32(src_node->ptr_rodata), nodeTypeToContentType[node_type], marker->src_offset);
|
||||
setMarker(PD_BE32(src_node->ptr_parent), CT_NODE, marker->src_offset);
|
||||
@@ -420,13 +283,13 @@ static void populateMarkers(u8 *src)
|
||||
setMarker(PD_BE32(src_node->ptr_child), CT_NODE, marker->src_offset);
|
||||
break;
|
||||
case CT_TEXCONFIG:
|
||||
struct src_texconfig *src_texconfig = src_thing;
|
||||
struct n64_textureconfig *src_texconfig = src_thing;
|
||||
if ((PD_BE32(src_texconfig->ptr) & 0xff000000) == 0x05000000) {
|
||||
setMarker(PD_BE32(src_texconfig->ptr), CT_TEXDATA, marker->src_offset);
|
||||
}
|
||||
break;
|
||||
case CT_PARTS:
|
||||
struct src_modeldef *src_modeldef2 = (struct src_modeldef *) src;
|
||||
struct n64_modeldef *src_modeldef2 = (struct n64_modeldef *) src;
|
||||
u32 *src_parts = (u32 *) src_thing;
|
||||
int num_parts = PD_BE16(src_modeldef2->numparts);
|
||||
|
||||
@@ -439,30 +302,30 @@ static void populateMarkers(u8 *src)
|
||||
case CT_RODATA_POSITION:
|
||||
break;
|
||||
case CT_RODATA_GUNDL:
|
||||
struct src_rodata_gundl *src_gundl = src_thing;
|
||||
struct n64_modelrodata_gundl *src_gundl = src_thing;
|
||||
setMarker(PD_BE32(src_gundl->ptr_opagdl), CT_GDL, marker->src_offset);
|
||||
setMarker(PD_BE32(src_gundl->ptr_xlugdl), CT_GDL, marker->src_offset);
|
||||
setMarker(PD_BE32(src_gundl->ptr_vertices), CT_VTXCOL, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_DISTANCE:
|
||||
struct src_rodata_distance *src_dist = src_thing;
|
||||
struct n64_modelrodata_distance *src_dist = src_thing;
|
||||
setMarker(PD_BE32(src_dist->ptr_target), CT_NODE, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_REORDER:
|
||||
struct src_rodata_reorder *src_reorder = src_thing;
|
||||
struct n64_modelrodata_reorder *src_reorder = src_thing;
|
||||
setMarker(PD_BE32(src_reorder->ptr_node_unk18), CT_NODE, marker->src_offset);
|
||||
setMarker(PD_BE32(src_reorder->ptr_node_unk1c), CT_NODE, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_CHRGUNFIRE:
|
||||
struct src_rodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
struct n64_modelrodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
setMarker(PD_BE32(src_chrgunfire->ptr_texture), CT_TEXCONFIG, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_TOGGLE:
|
||||
struct src_rodata_toggle *src_toggle = src_thing;
|
||||
struct n64_modelrodata_toggle *src_toggle = src_thing;
|
||||
setMarker(PD_BE32(src_toggle->ptr_target), CT_NODE, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_STARGUNFIRE:
|
||||
struct src_rodata_stargunfire *src_stargunfire = src_thing;
|
||||
struct n64_modelrodata_stargunfire *src_stargunfire = src_thing;
|
||||
colstart = PD_BE32(src_stargunfire->unk00)*4*(sizeof(s16) * 6);
|
||||
u32 vtxstart = PD_BE32(src_stargunfire->ptr_vertices);
|
||||
u32 vtxend = vtxstart + colstart;
|
||||
@@ -475,7 +338,7 @@ static void populateMarkers(u8 *src)
|
||||
setMarker(PD_BE32(src_stargunfire->ptr_gdl), CT_GDL, marker->src_offset);
|
||||
break;
|
||||
case CT_RODATA_DL:
|
||||
struct src_rodata_dl *src_dl = src_thing;
|
||||
struct n64_modelrodata_dl *src_dl = src_thing;
|
||||
setMarker(PD_BE32(src_dl->ptr_opagdl), CT_GDL, marker->src_offset);
|
||||
setMarker(PD_BE32(src_dl->ptr_xlugdl), CT_GDL, marker->src_offset);
|
||||
setMarker(PD_BE32(src_dl->ptr_colours), CT_VTXCOL, marker->src_offset);
|
||||
@@ -534,9 +397,9 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
|
||||
switch (marker->type) {
|
||||
case CT_MODELDEF:
|
||||
struct src_modeldef *src_modeldef = src_thing;
|
||||
struct dst_modeldef *dst_modeldef = dst_thing;
|
||||
dst_modeldef->ptr_skel = PD_BE32(src_modeldef->ptr_skel);
|
||||
struct n64_modeldef *src_modeldef = src_thing;
|
||||
struct modeldef *dst_modeldef = dst_thing;
|
||||
dst_modeldef->skel = (void *)(uintptr_t)PD_BE32(src_modeldef->ptr_skel);
|
||||
dst_modeldef->numparts = PD_BE16(src_modeldef->numparts);
|
||||
dst_modeldef->nummatrices = PD_BE16(src_modeldef->nummatrices);
|
||||
dst_modeldef->scale = PD_BE32(src_modeldef->scale);
|
||||
@@ -545,18 +408,18 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
dstpos += sizeof(*dst_modeldef);
|
||||
break;
|
||||
case CT_NODE:
|
||||
struct src_modelnode *src_node = src_thing;
|
||||
struct dst_modelnode *dst_node = dst_thing;
|
||||
struct n64_modelnode *src_node = src_thing;
|
||||
struct modelnode *dst_node = dst_thing;
|
||||
dst_node->type = PD_BE16(src_node->type);
|
||||
dstpos += sizeof(*dst_node);
|
||||
break;
|
||||
case CT_TEXCONFIG:
|
||||
struct src_texconfig *src_texconfig = src_thing;
|
||||
struct dst_texconfig *dst_texconfig = dst_thing;
|
||||
struct n64_textureconfig *src_texconfig = src_thing;
|
||||
struct textureconfig *dst_texconfig = dst_thing;
|
||||
|
||||
while (src_len >= sizeof(*src_texconfig)) {
|
||||
if ((PD_BE32(src_texconfig->ptr) & 0xff000000) != 0x05000000) {
|
||||
dst_texconfig->ptr = PD_BE32(src_texconfig->ptr);
|
||||
dst_texconfig->textureptr = (void *)(uintptr_t)PD_BE32(src_texconfig->ptr);
|
||||
}
|
||||
|
||||
dst_texconfig->width = src_texconfig->width;
|
||||
@@ -579,7 +442,7 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
dstpos += src_len;
|
||||
break;
|
||||
case CT_PARTS:
|
||||
struct src_modeldef *src_modeldef2 = (struct src_modeldef *) src;
|
||||
struct n64_modeldef *src_modeldef2 = (struct n64_modeldef *) src;
|
||||
u32 *src_parts = (u32 *) src_thing;
|
||||
uintptr_t *dst_parts = (uintptr_t *) dst_thing;
|
||||
int num_parts = PD_BE16(src_modeldef2->numparts);
|
||||
@@ -605,27 +468,27 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
u32 dst_vtx;
|
||||
|
||||
if (parent->type == CT_RODATA_GUNDL) {
|
||||
struct src_rodata_gundl *src_rodata = (struct src_rodata_gundl *) &src[parent->src_offset];
|
||||
struct dst_rodata_gundl *dst_rodata = (struct dst_rodata_gundl *) &dst[parent->dst_offset];
|
||||
struct n64_modelrodata_gundl *src_rodata = (struct n64_modelrodata_gundl *) &src[parent->src_offset];
|
||||
struct modelrodata_gundl *dst_rodata = (struct modelrodata_gundl *) &dst[parent->dst_offset];
|
||||
src_vtx = PD_BE32(src_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = (dst_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = ((uintptr_t)dst_rodata->vertices) & 0x00ffffff;
|
||||
} else if (parent->type == CT_RODATA_STARGUNFIRE) {
|
||||
struct src_rodata_stargunfire *src_rodata = (struct src_rodata_stargunfire *) &src[parent->src_offset];
|
||||
struct dst_rodata_stargunfire *dst_rodata = (struct dst_rodata_stargunfire *) &dst[parent->dst_offset];
|
||||
struct n64_modelrodata_stargunfire *src_rodata = (struct n64_modelrodata_stargunfire *) &src[parent->src_offset];
|
||||
struct modelrodata_stargunfire *dst_rodata = (struct modelrodata_stargunfire *) &dst[parent->dst_offset];
|
||||
src_vtx = PD_BE32(src_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = (dst_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = ((uintptr_t)dst_rodata->vertices) & 0x00ffffff;
|
||||
} else if (parent->type == CT_RODATA_DL) {
|
||||
struct src_rodata_dl *src_rodata = (struct src_rodata_dl *) &src[parent->src_offset];
|
||||
struct dst_rodata_dl *dst_rodata = (struct dst_rodata_dl *) &dst[parent->dst_offset];
|
||||
struct n64_modelrodata_dl *src_rodata = (struct n64_modelrodata_dl *) &src[parent->src_offset];
|
||||
struct modelrodata_dl *dst_rodata = (struct modelrodata_dl *) &dst[parent->dst_offset];
|
||||
src_vtx = PD_BE32(src_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = (dst_rodata->ptr_vertices) & 0x00ffffff;
|
||||
dst_vtx = ((uintptr_t)dst_rodata->vertices) & 0x00ffffff;
|
||||
}
|
||||
|
||||
dstpos = gbiConvertGdl(dst, dstpos, src, marker->src_offset, 0);
|
||||
break;
|
||||
case CT_RODATA_CHRINFO:
|
||||
struct generic_rodata_chrinfo *src_chrinfo = src_thing;
|
||||
struct generic_rodata_chrinfo *dst_chrinfo = dst_thing;
|
||||
struct modelrodata_chrinfo *src_chrinfo = src_thing;
|
||||
struct modelrodata_chrinfo *dst_chrinfo = dst_thing;
|
||||
dst_chrinfo->animpart = PD_BE16(src_chrinfo->animpart);
|
||||
dst_chrinfo->mtxindex = PD_BE16(src_chrinfo->mtxindex);
|
||||
dst_chrinfo->unk04 = PD_BE32(src_chrinfo->unk04);
|
||||
@@ -633,116 +496,108 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
dstpos += sizeof(*dst_chrinfo);
|
||||
break;
|
||||
case CT_RODATA_POSITION:
|
||||
struct generic_rodata_position *src_position = src_thing;
|
||||
struct generic_rodata_position *dst_position = dst_thing;
|
||||
dst_position->pos[0] = PD_BE32(src_position->pos[0]);
|
||||
dst_position->pos[1] = PD_BE32(src_position->pos[1]);
|
||||
dst_position->pos[2] = PD_BE32(src_position->pos[2]);
|
||||
struct modelrodata_position *src_position = src_thing;
|
||||
struct modelrodata_position *dst_position = dst_thing;
|
||||
dst_position->pos = PD_SWAPPED_VAL(src_position->pos);
|
||||
dst_position->part = PD_BE16(src_position->part);
|
||||
dst_position->mtxindexes[0] = PD_BE16(src_position->mtxindexes[0]);
|
||||
dst_position->mtxindexes[1] = PD_BE16(src_position->mtxindexes[1]);
|
||||
dst_position->mtxindexes[2] = PD_BE16(src_position->mtxindexes[2]);
|
||||
dst_position->drawdist = PD_BE32(src_position->drawdist);
|
||||
dst_position->drawdist = PD_SWAPPED_VAL(src_position->drawdist);
|
||||
dstpos += sizeof(*dst_position);
|
||||
break;
|
||||
case CT_RODATA_GUNDL:
|
||||
struct src_rodata_gundl *src_gundl = src_thing;
|
||||
struct dst_rodata_gundl *dst_gundl = dst_thing;
|
||||
dst_gundl->ptr_vertices = 0;
|
||||
struct n64_modelrodata_gundl *src_gundl = src_thing;
|
||||
struct modelrodata_gundl *dst_gundl = dst_thing;
|
||||
dst_gundl->vertices = NULL;
|
||||
dst_gundl->numvertices = PD_BE16(src_gundl->numvertices);
|
||||
dst_gundl->unk12 = PD_BE16(src_gundl->unk12);
|
||||
dstpos += sizeof(*dst_gundl);
|
||||
break;
|
||||
case CT_RODATA_DISTANCE:
|
||||
struct src_rodata_distance *src_dist = src_thing;
|
||||
struct dst_rodata_distance *dst_dist = dst_thing;
|
||||
dst_dist->near = PD_BE32(src_dist->near);
|
||||
dst_dist->far = PD_BE32(src_dist->far);
|
||||
struct n64_modelrodata_distance *src_dist = src_thing;
|
||||
struct modelrodata_distance *dst_dist = dst_thing;
|
||||
dst_dist->near = PD_SWAPPED_VAL(src_dist->near);
|
||||
dst_dist->far = PD_SWAPPED_VAL(src_dist->far);
|
||||
dst_dist->rwdataindex = PD_BE16(src_dist->rwdataindex);
|
||||
dstpos += sizeof(*dst_dist);
|
||||
break;
|
||||
case CT_RODATA_REORDER:
|
||||
struct src_rodata_reorder *src_reorder = src_thing;
|
||||
struct dst_rodata_reorder *dst_reorder = dst_thing;
|
||||
dst_reorder->unk00 = PD_BE32(src_reorder->unk00);
|
||||
dst_reorder->unk04 = PD_BE32(src_reorder->unk04);
|
||||
dst_reorder->unk08 = PD_BE32(src_reorder->unk08);
|
||||
dst_reorder->unk0c[0] = PD_BE32(src_reorder->unk0c[0]);
|
||||
dst_reorder->unk0c[1] = PD_BE32(src_reorder->unk0c[1]);
|
||||
dst_reorder->unk0c[2] = PD_BE32(src_reorder->unk0c[2]);
|
||||
struct n64_modelrodata_reorder *src_reorder = src_thing;
|
||||
struct modelrodata_reorder *dst_reorder = dst_thing;
|
||||
dst_reorder->unk00 = PD_SWAPPED_VAL(src_reorder->unk00);
|
||||
dst_reorder->unk04 = PD_SWAPPED_VAL(src_reorder->unk04);
|
||||
dst_reorder->unk08 = PD_SWAPPED_VAL(src_reorder->unk08);
|
||||
dst_reorder->unk0c[0] = PD_SWAPPED_VAL(src_reorder->unk0c[0]);
|
||||
dst_reorder->unk0c[1] = PD_SWAPPED_VAL(src_reorder->unk0c[1]);
|
||||
dst_reorder->unk0c[2] = PD_SWAPPED_VAL(src_reorder->unk0c[2]);
|
||||
dst_reorder->side = PD_BE16(src_reorder->side);
|
||||
dst_reorder->rwdataindex = PD_BE16(src_reorder->rwdataindex);
|
||||
dstpos += sizeof(*dst_reorder);
|
||||
break;
|
||||
case CT_RODATA_BBOX:
|
||||
struct generic_rodata_bbox *src_bbox = src_thing;
|
||||
struct generic_rodata_bbox *dst_bbox = dst_thing;
|
||||
struct modelrodata_bbox *src_bbox = src_thing;
|
||||
struct modelrodata_bbox *dst_bbox = dst_thing;
|
||||
dst_bbox->hitpart = PD_BE32(src_bbox->hitpart);
|
||||
dst_bbox->bbox[0] = PD_BE32(src_bbox->bbox[0]);
|
||||
dst_bbox->bbox[1] = PD_BE32(src_bbox->bbox[1]);
|
||||
dst_bbox->bbox[2] = PD_BE32(src_bbox->bbox[2]);
|
||||
dst_bbox->bbox[3] = PD_BE32(src_bbox->bbox[3]);
|
||||
dst_bbox->bbox[4] = PD_BE32(src_bbox->bbox[4]);
|
||||
dst_bbox->bbox[5] = PD_BE32(src_bbox->bbox[5]);
|
||||
dst_bbox->xmin = PD_SWAPPED_VAL(src_bbox->xmin);
|
||||
dst_bbox->xmax = PD_SWAPPED_VAL(src_bbox->xmax);
|
||||
dst_bbox->ymin = PD_SWAPPED_VAL(src_bbox->ymin);
|
||||
dst_bbox->ymax = PD_SWAPPED_VAL(src_bbox->ymax);
|
||||
dst_bbox->zmin = PD_SWAPPED_VAL(src_bbox->zmin);
|
||||
dst_bbox->zmax = PD_SWAPPED_VAL(src_bbox->zmax);
|
||||
dstpos += sizeof(*dst_bbox);
|
||||
break;
|
||||
case CT_RODATA_CHRGUNFIRE:
|
||||
struct src_rodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
struct dst_rodata_chrgunfire *dst_chrgunfire = dst_thing;
|
||||
dst_chrgunfire->pos[0] = PD_BE32(src_chrgunfire->pos[0]);
|
||||
dst_chrgunfire->pos[1] = PD_BE32(src_chrgunfire->pos[1]);
|
||||
dst_chrgunfire->pos[2] = PD_BE32(src_chrgunfire->pos[2]);
|
||||
dst_chrgunfire->dim[0] = PD_BE32(src_chrgunfire->dim[0]);
|
||||
dst_chrgunfire->dim[1] = PD_BE32(src_chrgunfire->dim[1]);
|
||||
dst_chrgunfire->dim[2] = PD_BE32(src_chrgunfire->dim[2]);
|
||||
dst_chrgunfire->unk1c = PD_BE32(src_chrgunfire->unk1c);
|
||||
struct n64_modelrodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
struct modelrodata_chrgunfire *dst_chrgunfire = dst_thing;
|
||||
dst_chrgunfire->pos = PD_SWAPPED_VAL(src_chrgunfire->pos);
|
||||
dst_chrgunfire->dim = PD_SWAPPED_VAL(src_chrgunfire->dim);
|
||||
dst_chrgunfire->unk1c = PD_SWAPPED_VAL(src_chrgunfire->unk1c);
|
||||
dst_chrgunfire->rwdataindex = PD_BE16(src_chrgunfire->rwdataindex);
|
||||
dst_chrgunfire->ptr_baseaddr = 0;
|
||||
dst_chrgunfire->baseaddr = NULL;
|
||||
dstpos += sizeof(*dst_chrgunfire);
|
||||
break;
|
||||
case CT_RODATA_11:
|
||||
struct src_rodata_type11 *src_type11 = src_thing;
|
||||
struct dst_rodata_type11 *dst_type11 = dst_thing;
|
||||
struct n64_modelrodata_type11 *src_type11 = src_thing;
|
||||
struct modelrodata_type11 *dst_type11 = dst_thing;
|
||||
dst_type11->unk00 = PD_BE32(src_type11->unk00);
|
||||
dst_type11->unk04 = PD_BE32(src_type11->unk04);
|
||||
dst_type11->unk08 = PD_BE32(src_type11->unk08);
|
||||
dst_type11->unk0c = PD_BE32(src_type11->unk0c);
|
||||
dst_type11->unk10 = PD_BE32(src_type11->unk10);
|
||||
dst_type11->extra1 = PD_BE32(src_type11->extra1);
|
||||
dst_type11->extra2 = PD_BE32(src_type11->extra2);
|
||||
dst_type11->unk14 = (void *)(uintptr_t)PD_BE32(src_type11->extra1);
|
||||
dst_type11->unk18 = PD_BE32(src_type11->extra2);
|
||||
dstpos += sizeof(*dst_type11);
|
||||
break;
|
||||
case CT_RODATA_TOGGLE:
|
||||
struct src_rodata_toggle *src_toggle = src_thing;
|
||||
struct dst_rodata_toggle *dst_toggle = dst_thing;
|
||||
struct n64_modelrodata_toggle *src_toggle = src_thing;
|
||||
struct modelrodata_toggle *dst_toggle = dst_thing;
|
||||
dst_toggle->rwdataindex = PD_BE16(src_toggle->rwdataindex);
|
||||
dstpos += sizeof(*dst_toggle);
|
||||
break;
|
||||
case CT_RODATA_POSITIONHELD:
|
||||
struct generic_rodata_positionheld *src_posheld = src_thing;
|
||||
struct generic_rodata_positionheld *dst_posheld = dst_thing;
|
||||
dst_posheld->pos[0] = PD_BE32(src_posheld->pos[0]);
|
||||
dst_posheld->pos[1] = PD_BE32(src_posheld->pos[1]);
|
||||
dst_posheld->pos[2] = PD_BE32(src_posheld->pos[2]);
|
||||
struct modelrodata_positionheld *src_posheld = src_thing;
|
||||
struct modelrodata_positionheld *dst_posheld = dst_thing;
|
||||
dst_posheld->pos = PD_SWAPPED_VAL(src_posheld->pos);
|
||||
dst_posheld->mtxindex = PD_BE16(src_posheld->mtxindex);
|
||||
dst_posheld->unk10 = PD_BE32(src_posheld->unk10);
|
||||
dstpos += sizeof(*dst_posheld);
|
||||
break;
|
||||
case CT_RODATA_STARGUNFIRE:
|
||||
struct src_rodata_stargunfire *src_stargunfire = src_thing;
|
||||
struct dst_rodata_stargunfire *dst_stargunfire = dst_thing;
|
||||
struct n64_modelrodata_stargunfire *src_stargunfire = src_thing;
|
||||
struct modelrodata_stargunfire *dst_stargunfire = dst_thing;
|
||||
dst_stargunfire->unk00 = PD_BE32(src_stargunfire->unk00);
|
||||
dstpos += sizeof(*dst_stargunfire);
|
||||
break;
|
||||
case CT_RODATA_HEADSPOT:
|
||||
struct generic_rodata_headspot *src_headspot = src_thing;
|
||||
struct generic_rodata_headspot *dst_headspot = dst_thing;
|
||||
struct modelrodata_headspot *src_headspot = src_thing;
|
||||
struct modelrodata_headspot *dst_headspot = dst_thing;
|
||||
dst_headspot->rwdataindex = PD_BE16(src_headspot->rwdataindex);
|
||||
dstpos += sizeof(*dst_headspot);
|
||||
break;
|
||||
case CT_RODATA_DL:
|
||||
struct src_rodata_dl *src_dl = src_thing;
|
||||
struct dst_rodata_dl *dst_dl = dst_thing;
|
||||
struct n64_modelrodata_dl *src_dl = src_thing;
|
||||
struct modelrodata_dl *dst_dl = dst_thing;
|
||||
dst_dl->numvertices = PD_BE16(src_dl->numvertices);
|
||||
dst_dl->mcount = PD_BE16(src_dl->mcount);
|
||||
dst_dl->rwdataindex = PD_BE16(src_dl->rwdataindex);
|
||||
@@ -750,8 +605,8 @@ static u32 convertContent(u8 *dst, u8 *src, u32 src_file_len)
|
||||
dstpos += sizeof(*dst_dl);
|
||||
break;
|
||||
case CT_RODATA_19:
|
||||
struct generic_rodata_type19 *src_type19 = src_thing;
|
||||
struct generic_rodata_type19 *dst_type19 = dst_thing;
|
||||
struct modelrodata_type19 *src_type19 = src_thing;
|
||||
struct modelrodata_type19 *dst_type19 = dst_thing;
|
||||
u32 *src_vertices = src_thing + sizeof(u32);
|
||||
u32 *dst_vertices = dst_thing + sizeof(u32);
|
||||
int num_vertices = PD_BE32(src_type19->numvertices);
|
||||
@@ -799,33 +654,33 @@ static u8 *relinkPointers(u8 *dst, u8 *src)
|
||||
|
||||
switch (marker->type) {
|
||||
case CT_MODELDEF:
|
||||
struct src_modeldef *src_modeldef = src_thing;
|
||||
struct dst_modeldef *dst_modeldef = dst_thing;
|
||||
dst_modeldef->ptr_rootnode = (resolvePointer(PD_BE32(src_modeldef->ptr_rootnode)));
|
||||
dst_modeldef->ptr_parts = (resolvePointer(PD_BE32(src_modeldef->ptr_parts)));
|
||||
dst_modeldef->ptr_texconfigs = (resolvePointer(PD_BE32(src_modeldef->ptr_texconfigs)));
|
||||
struct n64_modeldef *src_modeldef = src_thing;
|
||||
struct modeldef *dst_modeldef = dst_thing;
|
||||
dst_modeldef->rootnode = (void *)(uintptr_t)resolvePointer(PD_BE32(src_modeldef->ptr_rootnode));
|
||||
dst_modeldef->parts = (void *)(uintptr_t)resolvePointer(PD_BE32(src_modeldef->ptr_parts));
|
||||
dst_modeldef->texconfigs = (void *)(uintptr_t)resolvePointer(PD_BE32(src_modeldef->ptr_texconfigs));
|
||||
break;
|
||||
case CT_NODE:
|
||||
struct src_modelnode *src_node = src_thing;
|
||||
struct dst_modelnode *dst_node = dst_thing;
|
||||
dst_node->ptr_rodata = (resolvePointer(PD_BE32(src_node->ptr_rodata)));
|
||||
dst_node->ptr_parent = (resolvePointer(PD_BE32(src_node->ptr_parent)));
|
||||
dst_node->ptr_next = (resolvePointer(PD_BE32(src_node->ptr_next)));
|
||||
dst_node->ptr_prev = (resolvePointer(PD_BE32(src_node->ptr_prev)));
|
||||
dst_node->ptr_child = (resolvePointer(PD_BE32(src_node->ptr_child)));
|
||||
struct n64_modelnode *src_node = src_thing;
|
||||
struct modelnode *dst_node = dst_thing;
|
||||
dst_node->rodata = (void *)(uintptr_t)resolvePointer(PD_BE32(src_node->ptr_rodata));
|
||||
dst_node->parent = (void *)(uintptr_t)resolvePointer(PD_BE32(src_node->ptr_parent));
|
||||
dst_node->next = (void *)(uintptr_t)resolvePointer(PD_BE32(src_node->ptr_next));
|
||||
dst_node->prev = (void *)(uintptr_t)resolvePointer(PD_BE32(src_node->ptr_prev));
|
||||
dst_node->child = (void *)(uintptr_t)resolvePointer(PD_BE32(src_node->ptr_child));
|
||||
|
||||
lowestptr = dst_node->ptr_rodata;
|
||||
lowestptr = (uintptr_t)dst_node->rodata;
|
||||
break;
|
||||
case CT_TEXCONFIG:
|
||||
struct src_texconfig *src_texconfig = src_thing;
|
||||
struct dst_texconfig *dst_texconfig = dst_thing;
|
||||
struct n64_textureconfig *src_texconfig = src_thing;
|
||||
struct textureconfig *dst_texconfig = dst_thing;
|
||||
if ((PD_BE32(src_texconfig->ptr) & 0xff000000) == 0x05000000) {
|
||||
dst_texconfig->ptr = (resolvePointer(PD_BE32(src_texconfig->ptr)));
|
||||
gbiAddTexAddr(PD_BE32(src_texconfig->ptr), dst_texconfig->ptr);
|
||||
dst_texconfig->textureptr = (void *)(uintptr_t)resolvePointer(PD_BE32(src_texconfig->ptr));
|
||||
gbiAddTexAddr(PD_BE32(src_texconfig->ptr), (uintptr_t)dst_texconfig->textureptr);
|
||||
}
|
||||
break;
|
||||
case CT_PARTS:
|
||||
struct src_modeldef *src_modeldef2 = (struct src_modeldef *) src;
|
||||
struct n64_modeldef *src_modeldef2 = (struct n64_modeldef *) src;
|
||||
u32 *src_parts = (u32 *) src_thing;
|
||||
uintptr_t *dst_parts = (uintptr_t *) dst_thing;
|
||||
int num_parts = PD_BE16(src_modeldef2->numparts);
|
||||
@@ -839,84 +694,84 @@ static u8 *relinkPointers(u8 *dst, u8 *src)
|
||||
case CT_RODATA_POSITION:
|
||||
break;
|
||||
case CT_RODATA_GUNDL:
|
||||
struct src_rodata_gundl *src_gundl = src_thing;
|
||||
struct dst_rodata_gundl *dst_gundl = dst_thing;
|
||||
dst_gundl->ptr_opagdl = (resolvePointer(PD_BE32(src_gundl->ptr_opagdl)));
|
||||
dst_gundl->ptr_xlugdl = (resolvePointer(PD_BE32(src_gundl->ptr_xlugdl)));
|
||||
dst_gundl->ptr_vertices = (resolvePointer(PD_BE32(src_gundl->ptr_vertices)));
|
||||
struct n64_modelrodata_gundl *src_gundl = src_thing;
|
||||
struct modelrodata_gundl *dst_gundl = dst_thing;
|
||||
dst_gundl->opagdl = (void *)(uintptr_t)resolvePointer(PD_BE32(src_gundl->ptr_opagdl));
|
||||
dst_gundl->xlugdl = (void *)(uintptr_t)resolvePointer(PD_BE32(src_gundl->ptr_xlugdl));
|
||||
dst_gundl->vertices = (void *)(uintptr_t)resolvePointer(PD_BE32(src_gundl->ptr_vertices));
|
||||
|
||||
gbiConvertVtx(dst, dst_gundl->ptr_vertices & 0x00ffffff, dst_gundl->numvertices);
|
||||
gbiConvertVtx(dst, ((uintptr_t)dst_gundl->vertices) & 0x00ffffff, dst_gundl->numvertices);
|
||||
|
||||
gbiSetVtx(PD_BE32(src_gundl->ptr_vertices), dst_gundl->ptr_vertices);
|
||||
gbiSetSegment(0x04, dst_gundl->ptr_vertices);
|
||||
gbiSetVtx(PD_BE32(src_gundl->ptr_vertices), (uintptr_t)dst_gundl->vertices);
|
||||
gbiSetSegment(0x04, (uintptr_t)dst_gundl->vertices);
|
||||
|
||||
gbiGdlRewriteAddrs(dst, dst_gundl->ptr_opagdl);
|
||||
gbiGdlRewriteAddrs(dst, dst_gundl->ptr_xlugdl);
|
||||
gbiGdlRewriteAddrs(dst, (uintptr_t)dst_gundl->opagdl);
|
||||
gbiGdlRewriteAddrs(dst, (uintptr_t)dst_gundl->xlugdl);
|
||||
|
||||
if (dst_gundl->ptr_opagdl) dst_gundl->ptr_opagdl |= 1;
|
||||
if (dst_gundl->ptr_xlugdl) dst_gundl->ptr_xlugdl |= 1;
|
||||
if (dst_gundl->opagdl) dst_gundl->opagdl = SEGADDR(dst_gundl->opagdl);
|
||||
if (dst_gundl->xlugdl) dst_gundl->xlugdl = SEGADDR(dst_gundl->xlugdl);
|
||||
|
||||
lowestptr = minPtr3(dst_gundl->ptr_opagdl, dst_gundl->ptr_xlugdl, dst_gundl->ptr_vertices);
|
||||
lowestptr = minPtr3((uintptr_t)dst_gundl->opagdl, (uintptr_t)dst_gundl->xlugdl, (uintptr_t)dst_gundl->vertices);
|
||||
break;
|
||||
case CT_RODATA_DISTANCE:
|
||||
struct src_rodata_distance *src_dist = src_thing;
|
||||
struct dst_rodata_distance *dst_dist = dst_thing;
|
||||
dst_dist->ptr_target = (resolvePointer(PD_BE32(src_dist->ptr_target)));
|
||||
struct n64_modelrodata_distance *src_dist = src_thing;
|
||||
struct modelrodata_distance *dst_dist = dst_thing;
|
||||
dst_dist->target = (void *)(uintptr_t)resolvePointer(PD_BE32(src_dist->ptr_target));
|
||||
break;
|
||||
case CT_RODATA_REORDER:
|
||||
struct src_rodata_reorder *src_reorder = src_thing;
|
||||
struct dst_rodata_reorder *dst_reorder = dst_thing;
|
||||
dst_reorder->ptr_node_unk18 = (resolvePointer(PD_BE32(src_reorder->ptr_node_unk18)));
|
||||
dst_reorder->ptr_node_unk1c = (resolvePointer(PD_BE32(src_reorder->ptr_node_unk1c)));
|
||||
struct n64_modelrodata_reorder *src_reorder = src_thing;
|
||||
struct modelrodata_reorder *dst_reorder = dst_thing;
|
||||
dst_reorder->unk18 = (void *)(uintptr_t)resolvePointer(PD_BE32(src_reorder->ptr_node_unk18));
|
||||
dst_reorder->unk1c = (void *)(uintptr_t)resolvePointer(PD_BE32(src_reorder->ptr_node_unk1c));
|
||||
break;
|
||||
case CT_RODATA_CHRGUNFIRE:
|
||||
struct src_rodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
struct dst_rodata_chrgunfire *dst_chrgunfire = dst_thing;
|
||||
dst_chrgunfire->ptr_texture = (resolvePointer(PD_BE32(src_chrgunfire->ptr_texture)));
|
||||
if ((PD_BE32(dst_chrgunfire->ptr_texture) & 0xff000000) == 0x05000000) {
|
||||
gbiAddTexAddr(PD_BE32(dst_chrgunfire->ptr_texture), dst_chrgunfire->ptr_texture);
|
||||
struct n64_modelrodata_chrgunfire *src_chrgunfire = src_thing;
|
||||
struct modelrodata_chrgunfire *dst_chrgunfire = dst_thing;
|
||||
dst_chrgunfire->texture = (void *)(uintptr_t)resolvePointer(PD_BE32(src_chrgunfire->ptr_texture));
|
||||
if ((PD_BE32((u32)(uintptr_t)dst_chrgunfire->texture) & 0xff000000) == 0x05000000) {
|
||||
gbiAddTexAddr(PD_BE32((u32)(uintptr_t)dst_chrgunfire->texture), (uintptr_t)dst_chrgunfire->texture);
|
||||
}
|
||||
break;
|
||||
case CT_RODATA_TOGGLE:
|
||||
struct src_rodata_toggle *src_toggle = src_thing;
|
||||
struct dst_rodata_toggle *dst_toggle = dst_thing;
|
||||
dst_toggle->ptr_target = (resolvePointer(PD_BE32(src_toggle->ptr_target)));
|
||||
struct n64_modelrodata_toggle *src_toggle = src_thing;
|
||||
struct modelrodata_toggle *dst_toggle = dst_thing;
|
||||
dst_toggle->target = (void *)(uintptr_t)resolvePointer(PD_BE32(src_toggle->ptr_target));
|
||||
break;
|
||||
case CT_RODATA_STARGUNFIRE:
|
||||
struct src_rodata_stargunfire *src_stargunfire = src_thing;
|
||||
struct dst_rodata_stargunfire *dst_stargunfire = dst_thing;
|
||||
dst_stargunfire->ptr_vertices = (resolvePointer(PD_BE32(src_stargunfire->ptr_vertices)));
|
||||
dst_stargunfire->ptr_gdl = (resolvePointer(PD_BE32(src_stargunfire->ptr_gdl)));
|
||||
struct n64_modelrodata_stargunfire *src_stargunfire = src_thing;
|
||||
struct modelrodata_stargunfire *dst_stargunfire = dst_thing;
|
||||
dst_stargunfire->vertices = (void *)(uintptr_t)resolvePointer(PD_BE32(src_stargunfire->ptr_vertices));
|
||||
dst_stargunfire->gdl = (void *)(uintptr_t)resolvePointer(PD_BE32(src_stargunfire->ptr_gdl));
|
||||
|
||||
gbiConvertVtx(dst, dst_stargunfire->ptr_vertices & 0x00ffffff, dst_stargunfire->unk00*4);
|
||||
gbiConvertVtx(dst, ((uintptr_t)dst_stargunfire->vertices) & 0x00ffffff, dst_stargunfire->unk00*4);
|
||||
|
||||
gbiSetVtx(PD_BE32(src_stargunfire->ptr_vertices), dst_stargunfire->ptr_vertices);
|
||||
gbiSetSegment(0x04, dst_stargunfire->ptr_vertices);
|
||||
gbiGdlRewriteAddrs(dst, dst_stargunfire->ptr_gdl);
|
||||
if (dst_stargunfire->ptr_gdl) dst_stargunfire->ptr_gdl |= 1;
|
||||
gbiSetVtx(PD_BE32(src_stargunfire->ptr_vertices), (uintptr_t)dst_stargunfire->vertices);
|
||||
gbiSetSegment(0x04, (uintptr_t)dst_stargunfire->vertices);
|
||||
gbiGdlRewriteAddrs(dst, (uintptr_t)dst_stargunfire->gdl);
|
||||
if (dst_stargunfire->gdl) dst_stargunfire->gdl = SEGADDR(dst_stargunfire->gdl);
|
||||
|
||||
lowestptr = minPtr(dst_stargunfire->ptr_gdl, dst_stargunfire->ptr_vertices);
|
||||
lowestptr = minPtr((uintptr_t)dst_stargunfire->gdl, (uintptr_t)dst_stargunfire->vertices);
|
||||
break;
|
||||
case CT_RODATA_DL:
|
||||
struct src_rodata_dl *src_dl = src_thing;
|
||||
struct dst_rodata_dl *dst_dl = dst_thing;
|
||||
dst_dl->ptr_opagdl = (resolvePointer(PD_BE32(src_dl->ptr_opagdl)));
|
||||
dst_dl->ptr_xlugdl = (resolvePointer(PD_BE32(src_dl->ptr_xlugdl)));
|
||||
dst_dl->ptr_colours = (resolvePointer(PD_BE32(src_dl->ptr_colours)));
|
||||
dst_dl->ptr_vertices = (resolvePointer(PD_BE32(src_dl->ptr_vertices)));
|
||||
struct n64_modelrodata_dl *src_dl = src_thing;
|
||||
struct modelrodata_dl *dst_dl = dst_thing;
|
||||
dst_dl->opagdl = (void *)(uintptr_t)resolvePointer(PD_BE32(src_dl->ptr_opagdl));
|
||||
dst_dl->xlugdl = (void *)(uintptr_t)resolvePointer(PD_BE32(src_dl->ptr_xlugdl));
|
||||
dst_dl->colours = (void *)(uintptr_t)resolvePointer(PD_BE32(src_dl->ptr_colours));
|
||||
dst_dl->vertices = (void *)(uintptr_t)resolvePointer(PD_BE32(src_dl->ptr_vertices));
|
||||
|
||||
gbiConvertVtx(dst, dst_dl->ptr_vertices & 0x00ffffff, dst_dl->numvertices);
|
||||
gbiConvertVtx(dst, ((uintptr_t)dst_dl->vertices) & 0x00ffffff, dst_dl->numvertices);
|
||||
|
||||
gbiSetVtx(PD_BE32(src_dl->ptr_vertices), dst_dl->ptr_vertices);
|
||||
gbiSetSegment(0x04, dst_dl->ptr_vertices);
|
||||
gbiGdlRewriteAddrs(dst, dst_dl->ptr_opagdl);
|
||||
gbiGdlRewriteAddrs(dst, dst_dl->ptr_xlugdl);
|
||||
gbiSetVtx(PD_BE32(src_dl->ptr_vertices), (uintptr_t)dst_dl->vertices);
|
||||
gbiSetSegment(0x04, (uintptr_t)dst_dl->vertices);
|
||||
gbiGdlRewriteAddrs(dst, (uintptr_t)dst_dl->opagdl);
|
||||
gbiGdlRewriteAddrs(dst, (uintptr_t)dst_dl->xlugdl);
|
||||
|
||||
if (dst_dl->ptr_opagdl) dst_dl->ptr_opagdl |= 1;
|
||||
if (dst_dl->ptr_xlugdl) dst_dl->ptr_xlugdl |= 1;
|
||||
if (dst_dl->opagdl) dst_dl->opagdl = SEGADDR(dst_dl->opagdl);
|
||||
if (dst_dl->xlugdl) dst_dl->xlugdl = SEGADDR(dst_dl->xlugdl);
|
||||
|
||||
lowestptr = minPtr3(dst_dl->ptr_opagdl, dst_dl->ptr_xlugdl, dst_dl->ptr_colours);
|
||||
lowestptr = minPtr(lowestptr, dst_dl->ptr_vertices);
|
||||
lowestptr = minPtr3((uintptr_t)dst_dl->opagdl, (uintptr_t)dst_dl->xlugdl, (uintptr_t)dst_dl->colours);
|
||||
lowestptr = minPtr(lowestptr, (uintptr_t)dst_dl->vertices);
|
||||
break;
|
||||
case CT_TEXDATA:
|
||||
case CT_VTXCOL:
|
||||
|
||||
@@ -35,33 +35,13 @@ struct n64_waypoint {
|
||||
s32 step;
|
||||
};
|
||||
|
||||
struct host_waypoint {
|
||||
s32 padnum;
|
||||
uintptr_t ptr_neighbours;
|
||||
s32 groupnum;
|
||||
s32 step;
|
||||
};
|
||||
|
||||
struct n64_waygroup {
|
||||
u32 ptr_neighbours;
|
||||
u32 ptr_waypoints;
|
||||
s32 step;
|
||||
};
|
||||
|
||||
struct host_waygroup {
|
||||
uintptr_t ptr_neighbours;
|
||||
uintptr_t ptr_waypoints;
|
||||
s32 step;
|
||||
};
|
||||
|
||||
struct generic_coverdefinition {
|
||||
u32 pos[3];
|
||||
u32 dir[3];
|
||||
u16 flags;
|
||||
u16 unk1a;
|
||||
};
|
||||
|
||||
static int convertPads(u8 *dst, int dstpos, u8 *src, int srcpos, int num_pads)
|
||||
static u32 convertPads(u8 *dst, u32 dstpos, u8 *src, u32 srcpos, int num_pads)
|
||||
{
|
||||
u16 *src_offsets = (u16 *) &src[srcpos];
|
||||
u16 *dst_offsets = (u16 *) &dst[dstpos];
|
||||
@@ -152,22 +132,22 @@ static int convertPads(u8 *dst, int dstpos, u8 *src, int srcpos, int num_pads)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertWayPoints(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertWayPoints(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_waypoint *n64_waypoints = (struct n64_waypoint *) &src[srcpos];
|
||||
struct host_waypoint *host_waypoints = (struct host_waypoint *) &dst[dstpos];
|
||||
struct waypoint *host_waypoints = (struct waypoint *) &dst[dstpos];
|
||||
int num_waypoints;
|
||||
|
||||
for (num_waypoints = 0; n64_waypoints[num_waypoints].padnum != -1; num_waypoints++);
|
||||
|
||||
dstpos += (num_waypoints + 1) * sizeof(struct host_waypoint);
|
||||
dstpos += (num_waypoints + 1) * sizeof(struct waypoint);
|
||||
|
||||
u32 *host_neighbours = (u32 *) &dst[dstpos];
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < num_waypoints; i++) {
|
||||
host_waypoints[i].padnum = PD_BE32(n64_waypoints[i].padnum);
|
||||
host_waypoints[i].ptr_neighbours = (dstpos);
|
||||
host_waypoints[i].neighbours = (void *)(uintptr_t)dstpos;
|
||||
host_waypoints[i].groupnum = PD_BE32(n64_waypoints[i].groupnum);
|
||||
host_waypoints[i].step = 0;
|
||||
|
||||
@@ -184,29 +164,29 @@ static int convertWayPoints(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
|
||||
// Terminator
|
||||
host_waypoints[num_waypoints].padnum = 0xffffffff;
|
||||
host_waypoints[num_waypoints].ptr_neighbours = 0;
|
||||
host_waypoints[num_waypoints].neighbours = NULL;
|
||||
host_waypoints[num_waypoints].groupnum = 0;
|
||||
host_waypoints[num_waypoints].step = 0;
|
||||
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertWayGroups(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertWayGroups(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_waygroup *n64_waygroups = (struct n64_waygroup *) &src[srcpos];
|
||||
struct host_waygroup *host_waygroups = (struct host_waygroup *) &dst[dstpos];
|
||||
struct waygroup *host_waygroups = (struct waygroup *) &dst[dstpos];
|
||||
int num_waygroups;
|
||||
|
||||
for (num_waygroups = 0; n64_waygroups[num_waygroups].ptr_neighbours != 0; num_waygroups++);
|
||||
|
||||
dstpos += (num_waygroups + 1) * sizeof(struct host_waygroup);
|
||||
dstpos += (num_waygroups + 1) * sizeof(struct waygroup);
|
||||
|
||||
// Waygroups and child waypoints
|
||||
u32 *host_waypoints = (u32 *) &dst[dstpos];
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < num_waygroups; i++) {
|
||||
host_waygroups[i].ptr_waypoints = (dstpos);
|
||||
host_waygroups[i].waypoints = (void *)(uintptr_t)dstpos;
|
||||
host_waygroups[i].step = 0;
|
||||
|
||||
u32 *n64_waypoints = (u32 *) &src[PD_BE32(n64_waygroups[i].ptr_waypoints)];
|
||||
@@ -221,8 +201,8 @@ static int convertWayGroups(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
}
|
||||
|
||||
// Terminator
|
||||
host_waygroups[num_waygroups].ptr_neighbours = 0;
|
||||
host_waygroups[num_waygroups].ptr_waypoints = 0;
|
||||
host_waygroups[num_waygroups].neighbours = NULL;
|
||||
host_waygroups[num_waygroups].waypoints = NULL;
|
||||
host_waygroups[num_waygroups].step = 0;
|
||||
|
||||
// Waygroup neighbours
|
||||
@@ -230,7 +210,7 @@ static int convertWayGroups(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
n = 0;
|
||||
|
||||
for (int i = 0; i < num_waygroups; i++) {
|
||||
host_waygroups[i].ptr_neighbours = (dstpos);
|
||||
host_waygroups[i].neighbours = (void *)(uintptr_t)dstpos;
|
||||
|
||||
u32 *n64_neighbours = (u32 *) &src[PD_BE32(n64_waygroups[i].ptr_neighbours)];
|
||||
|
||||
@@ -246,30 +226,26 @@ static int convertWayGroups(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertCover(u8 *dst, int dstpos, u8 *src, int srcpos, int num_covers)
|
||||
static u32 convertCover(u8 *dst, u32 dstpos, u8 *src, u32 srcpos, int num_covers)
|
||||
{
|
||||
struct generic_coverdefinition *n64_covers = (struct generic_coverdefinition *) &src[srcpos];
|
||||
struct generic_coverdefinition *host_covers = (struct generic_coverdefinition *) &dst[dstpos];
|
||||
struct coverdefinition *n64_covers = (struct coverdefinition *) &src[srcpos];
|
||||
struct coverdefinition *host_covers = (struct coverdefinition *) &dst[dstpos];
|
||||
|
||||
for (int i = 0; i < num_covers; i++) {
|
||||
host_covers[i].pos[0] = PD_BE32(n64_covers[i].pos[0]);
|
||||
host_covers[i].pos[1] = PD_BE32(n64_covers[i].pos[1]);
|
||||
host_covers[i].pos[2] = PD_BE32(n64_covers[i].pos[2]);
|
||||
host_covers[i].dir[0] = PD_BE32(n64_covers[i].dir[0]);
|
||||
host_covers[i].dir[1] = PD_BE32(n64_covers[i].dir[1]);
|
||||
host_covers[i].dir[2] = PD_BE32(n64_covers[i].dir[2]);
|
||||
host_covers[i].pos = PD_SWAPPED_VAL(n64_covers[i].pos);
|
||||
host_covers[i].look = PD_SWAPPED_VAL(n64_covers[i].look);
|
||||
host_covers[i].flags = PD_BE16(n64_covers[i].flags);
|
||||
host_covers[i].unk1a = PD_BE16(n64_covers[i].unk1a);
|
||||
}
|
||||
|
||||
dstpos += num_covers * sizeof(struct generic_coverdefinition);
|
||||
dstpos += num_covers * sizeof(struct coverdefinition);
|
||||
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertPadsFile(u8 *dst, u8 *src)
|
||||
static u32 convertPadsFile(u8 *dst, u8 *src)
|
||||
{
|
||||
int dstpos = 0;
|
||||
u32 dstpos = 0;
|
||||
struct n64_header *n64_header = (struct n64_header *) src;
|
||||
struct host_header *host_header = (struct host_header *) dst;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "preprocess/common.h"
|
||||
#include "preprocess/setup.h"
|
||||
|
||||
extern u32 chraiGetAilistLength(u8 *list);
|
||||
|
||||
static inline void convF32(f32 *dst, f32 src) { *(u32*)dst = PD_BE32(*(u32*)&src); }
|
||||
static inline void convU32(u32 *dst, u32 src) { *dst = PD_BE32(src); }
|
||||
static inline void convS32(s32 *dst, s32 src) { *dst = PD_BE32(src); }
|
||||
@@ -36,7 +38,7 @@ static inline void convUnk(u32 x) { assert(0 && "unknown type"); }
|
||||
|
||||
#define PD_CONV_PTR(dst, src, type) dst = (type)(uintptr_t)PD_BE32(src)
|
||||
|
||||
static u32 obj_size(struct n64_defaultobj *obj)
|
||||
static inline u32 objSizeN64(struct n64_defaultobj *obj)
|
||||
{
|
||||
switch (obj->type) {
|
||||
case OBJTYPE_CHR: return sizeof(struct n64_packedchr) / sizeof(u32);
|
||||
@@ -100,8 +102,7 @@ static u32 obj_size(struct n64_defaultobj *obj)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void conv_tvscreen(struct tvscreen* dstobj, struct n64_tvscreen* srcobj)
|
||||
static void convTvScreen(struct tvscreen* dstobj, struct n64_tvscreen* srcobj)
|
||||
{
|
||||
PD_CONV_PTR(dstobj->cmdlist, srcobj->ptr_cmdlist, u32*);
|
||||
PD_CONV_VAL(dstobj->offset, srcobj->offset);
|
||||
@@ -144,7 +145,7 @@ void conv_tvscreen(struct tvscreen* dstobj, struct n64_tvscreen* srcobj)
|
||||
PD_CONV_VAL(dstobj->colinc, srcobj->colinc);
|
||||
}
|
||||
|
||||
void convertDefaultObjHdr(struct defaultobj* dstobj, struct n64_defaultobj* srcobj)
|
||||
static void convertDefaultObjHdr(struct defaultobj* dstobj, struct n64_defaultobj* srcobj)
|
||||
{
|
||||
PD_CONV_VAL(dstobj->extrascale, srcobj->extrascale);
|
||||
|
||||
@@ -164,7 +165,7 @@ void convertDefaultObjHdr(struct defaultobj* dstobj, struct n64_defaultobj* srco
|
||||
dst_unk00_2[1] = src_unk00_2[1];
|
||||
}
|
||||
|
||||
void convertDefaultObj(struct defaultobj* dstobj, struct n64_defaultobj* srcobj)
|
||||
static void convertDefaultObj(struct defaultobj* dstobj, struct n64_defaultobj* srcobj)
|
||||
{
|
||||
PD_CONV_VAL(dstobj->extrascale, srcobj->extrascale);
|
||||
PD_CONV_VAL(dstobj->hidden2, srcobj->hidden2);
|
||||
@@ -187,7 +188,7 @@ void convertDefaultObj(struct defaultobj* dstobj, struct n64_defaultobj* srcobj)
|
||||
PD_CONV_VAL(dstobj->geocount, srcobj->geocount);
|
||||
}
|
||||
|
||||
u32 convertProps(u8* dst, u8* src)
|
||||
static u32 convertProps(u8* dst, u8* src)
|
||||
{
|
||||
u8* start = dst;
|
||||
struct n64_defaultobj* cmd = (struct n64_defaultobj*)src;
|
||||
@@ -373,7 +374,7 @@ u32 convertProps(u8* dst, u8* src)
|
||||
struct singlemonitorobj* dstobj = (struct singlemonitorobj*)dst;
|
||||
|
||||
convertDefaultObj(&dstobj->base, cmd);
|
||||
conv_tvscreen(&dstobj->screen, &srcobj->screen);
|
||||
convTvScreen(&dstobj->screen, &srcobj->screen);
|
||||
|
||||
PD_CONV_VAL(dstobj->owneroffset, srcobj->owneroffset);
|
||||
PD_CONV_VAL(dstobj->ownerpart, srcobj->ownerpart);
|
||||
@@ -390,7 +391,7 @@ u32 convertProps(u8* dst, u8* src)
|
||||
convertDefaultObj(&dstobj->base, cmd);
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
conv_tvscreen(&dstobj->screens[i], &srcobj->screens[i]);
|
||||
convTvScreen(&dstobj->screens[i], &srcobj->screens[i]);
|
||||
|
||||
PD_CONV_ARRAY(dstobj->imagenums, srcobj->imagenums);
|
||||
dst += sizeof(struct multimonitorobj);
|
||||
@@ -990,7 +991,7 @@ u32 convertProps(u8* dst, u8* src)
|
||||
}
|
||||
}
|
||||
|
||||
cmd = (struct n64_defaultobj*)((u32*)cmd + obj_size(cmd));
|
||||
cmd = (struct n64_defaultobj*)((u32*)cmd + objSizeN64(cmd));
|
||||
type = cmd->type;
|
||||
}
|
||||
|
||||
@@ -1099,8 +1100,6 @@ static u32 convertAiLists(u8* dst, u8* src)
|
||||
return (u32)((u8 *)dstailist - dst + sizeof(uintptr_t));
|
||||
}
|
||||
|
||||
extern u32 chraiGetAilistLength(u8 *list);
|
||||
|
||||
static u32 convertLists(u8 *dst, u8 *src, u32 dstpos, u32 src_ofs)
|
||||
{
|
||||
ptrReset();
|
||||
@@ -1137,7 +1136,7 @@ static u32 convertLists(u8 *dst, u8 *src, u32 dstpos, u32 src_ofs)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertSetup(u8 *dst, u8 *src, u32 srclen)
|
||||
static u32 convertSetup(u8 *dst, u8 *src, u32 srclen)
|
||||
{
|
||||
struct n64_stagesetup *src_header = (struct n64_stagesetup*)src;
|
||||
struct stagesetup *dst_header = (struct stagesetup*)dst;
|
||||
|
||||
@@ -18,7 +18,7 @@ struct tile {
|
||||
u16 floorcol;
|
||||
};
|
||||
|
||||
u32 convertTiles(u8 *dst, u8 *src, size_t srclen)
|
||||
static u32 convertTiles(u8 *dst, u8 *src, size_t srclen)
|
||||
{
|
||||
int num_rooms = PD_BE32(*(u32 *) src);
|
||||
|
||||
|
||||
+21
-21
@@ -27,46 +27,46 @@ struct texaddr {
|
||||
u32 dst;
|
||||
};
|
||||
|
||||
u32 m_Segments[16];
|
||||
u32 m_SrcVtxOffset;
|
||||
u32 m_DstVtxOffset;
|
||||
static u32 gbiSegments[16];
|
||||
static u32 srcVtxOffset;
|
||||
static u32 dstVtxOffset;
|
||||
|
||||
struct texaddr m_TexAddrs[64];
|
||||
int m_NumTexAddr;
|
||||
static struct texaddr texAddrs[64];
|
||||
static int numTexAddrs;
|
||||
|
||||
void gbiReset(void)
|
||||
{
|
||||
for (int i = 0; i < ARRAYCOUNT(m_Segments); i++) {
|
||||
m_Segments[i] = 0;
|
||||
for (int i = 0; i < ARRAYCOUNT(gbiSegments); i++) {
|
||||
gbiSegments[i] = 0;
|
||||
}
|
||||
|
||||
m_SrcVtxOffset = 0;
|
||||
m_DstVtxOffset = 0;
|
||||
m_NumTexAddr = 0;
|
||||
srcVtxOffset = 0;
|
||||
dstVtxOffset = 0;
|
||||
numTexAddrs = 0;
|
||||
}
|
||||
|
||||
void gbiSetSegment(int segment, u32 offset)
|
||||
{
|
||||
m_Segments[segment] = offset & 0x00ffffff;
|
||||
gbiSegments[segment] = offset & 0x00ffffff;
|
||||
}
|
||||
|
||||
void gbiSetVtx(u32 src_offset, u32 dst_offset)
|
||||
{
|
||||
m_SrcVtxOffset = src_offset & 0x00ffffff;
|
||||
m_DstVtxOffset = dst_offset & 0x00ffffff;
|
||||
srcVtxOffset = src_offset & 0x00ffffff;
|
||||
dstVtxOffset = dst_offset & 0x00ffffff;
|
||||
}
|
||||
|
||||
void gbiAddTexAddr(u32 src_offset, u32 dst_offset)
|
||||
{
|
||||
m_TexAddrs[m_NumTexAddr].src = src_offset & 0x00ffffff;
|
||||
m_TexAddrs[m_NumTexAddr++].dst = dst_offset & 0x00ffffff;
|
||||
texAddrs[numTexAddrs].src = src_offset & 0x00ffffff;
|
||||
texAddrs[numTexAddrs++].dst = dst_offset & 0x00ffffff;
|
||||
}
|
||||
|
||||
u32 gbiFindTexAddr(u32 src_offset)
|
||||
{
|
||||
for (int i = 0; i < m_NumTexAddr; i++) {
|
||||
if (m_TexAddrs[i].src == src_offset)
|
||||
return m_TexAddrs[i].dst;
|
||||
for (int i = 0; i < numTexAddrs; i++) {
|
||||
if (texAddrs[i].src == src_offset)
|
||||
return texAddrs[i].dst;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -128,11 +128,11 @@ static u64 gbiRewriteAddr(u64 cmd, u8 opcode)
|
||||
offset = gbiFindTexAddr(offset);
|
||||
}
|
||||
else {
|
||||
if (offset < m_SrcVtxOffset) {
|
||||
sysFatalError("Tried to load data from offset 0x%x but segment starts at 0x%x\n", offset, m_SrcVtxOffset);
|
||||
if (offset < srcVtxOffset) {
|
||||
sysFatalError("Tried to load data from offset 0x%x but segment starts at 0x%x\n", offset, srcVtxOffset);
|
||||
}
|
||||
|
||||
offset = offset - m_SrcVtxOffset + m_DstVtxOffset;
|
||||
offset = offset - srcVtxOffset + dstVtxOffset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "preprocess/common.h"
|
||||
|
||||
u8* preprocessAnimations(u8* data, u32 size, u32* outSize)
|
||||
u8 *preprocessAnimations(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
// set the anim table pointers as well
|
||||
extern u8 *_animationsTableRomStart;
|
||||
@@ -38,10 +38,11 @@ u8* preprocessAnimations(u8* data, u32 size, u32* outSize)
|
||||
anim->data = 0xffffffff;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u8* preprocessMpConfigs(u8* data, u32 size, u32* outSize)
|
||||
u8 *preprocessMpConfigs(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
const u32 count = size / sizeof(struct mpconfig);
|
||||
struct mpconfig *cfg = (struct mpconfig *)data;
|
||||
@@ -71,38 +72,11 @@ u8* preprocessMpConfigs(u8* data, u32 size, u32* outSize)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u8* preprocessJpnFont(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
// ???
|
||||
return 0;
|
||||
}
|
||||
|
||||
void preprocessALCMidiHdr(u8 *data, u32 size)
|
||||
{
|
||||
ALCMidiHdr *hdr = (ALCMidiHdr *)data;
|
||||
PD_SWAP_VAL(hdr->division);
|
||||
for (s32 i = 0; i < ARRAYCOUNT(hdr->trackOffset); ++i) {
|
||||
PD_SWAP_VAL(hdr->trackOffset[i]);
|
||||
}
|
||||
}
|
||||
|
||||
u8* preprocessSequences(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
struct seqtable *seq = (struct seqtable *)data;
|
||||
PD_SWAP_VAL(seq->count);
|
||||
|
||||
for (s16 i = 0; i < seq->count; ++i) {
|
||||
PD_SWAP_VAL(seq->entries[i].binlen);
|
||||
PD_SWAP_VAL(seq->entries[i].ziplen);
|
||||
PD_SWAP_VAL(seq->entries[i].romaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8* preprocessTexturesList(u8* data, u32 size, u32* outSize)
|
||||
u8 *preprocessTexturesList(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
struct texture *tex = (struct texture *)data;
|
||||
const u32 count = size / sizeof(*tex);
|
||||
@@ -116,5 +90,6 @@ u8* preprocessTexturesList(u8* data, u32 size, u32* outSize)
|
||||
tex->soundsurfacetype = tex->surfacetype;
|
||||
tex->surfacetype = tmp;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
+79
-153
@@ -6,58 +6,13 @@
|
||||
|
||||
#include "preprocess/common.h"
|
||||
|
||||
struct generic_adpcm_book {
|
||||
s32 order;
|
||||
s32 npredictors;
|
||||
s16 book[128];
|
||||
};
|
||||
|
||||
struct generic_adpcm_loop {
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 count;
|
||||
s16 state[16];
|
||||
};
|
||||
|
||||
struct generic_raw_loop {
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 count;
|
||||
};
|
||||
|
||||
struct generic_envelope {
|
||||
s32 attackTime;
|
||||
s32 decayTime;
|
||||
s32 releaseTime;
|
||||
u8 attackVolume;
|
||||
u8 decayVolume;
|
||||
};
|
||||
|
||||
struct generic_keymap {
|
||||
u8 velocityMin;
|
||||
u8 velocityMax;
|
||||
u8 keyMin;
|
||||
u8 keyMax;
|
||||
u8 keyBase;
|
||||
s8 detune;
|
||||
};
|
||||
|
||||
struct n64_adpcm_waveinfo {
|
||||
u32 loop; // ptr to struct generic_adpcm_loop
|
||||
u32 book; // ptr to struct generic_adpcm_book
|
||||
};
|
||||
|
||||
struct host_adpcm_waveinfo {
|
||||
uintptr_t loop; // ptr to struct generic_adpcm_loop
|
||||
uintptr_t book; // ptr to struct generic_adpcm_book
|
||||
u32 loop; // ptr to ALADPCMloop
|
||||
u32 book; // ptr to ALADPCMBook
|
||||
};
|
||||
|
||||
struct n64_raw_waveinfo {
|
||||
u32 loop; // ptr to struct generic_raw_loop
|
||||
};
|
||||
|
||||
struct host_raw_waveinfo {
|
||||
uintptr_t loop; // ptr to struct generic_raw_loop
|
||||
u32 loop; // ptr to ALRawLoop
|
||||
};
|
||||
|
||||
struct n64_wavetable {
|
||||
@@ -71,35 +26,15 @@ struct n64_wavetable {
|
||||
} waveInfo;
|
||||
};
|
||||
|
||||
struct host_wavetable {
|
||||
uintptr_t base;
|
||||
s32 len;
|
||||
u8 type;
|
||||
u8 flags;
|
||||
union {
|
||||
struct host_adpcm_waveinfo adpcmWave;
|
||||
struct host_raw_waveinfo rawWave;
|
||||
} waveInfo;
|
||||
};
|
||||
|
||||
struct n64_sound {
|
||||
u32 envelope; // ptr to struct generic_envelope
|
||||
u32 keyMap; // ptr to struct generic_keymap
|
||||
u32 envelope; // ptr to ALEnvelope
|
||||
u32 keyMap; // ptr to ALKeyMap
|
||||
u32 wavetable; // ptr to struct n64_wavetable
|
||||
u8 samplePan;
|
||||
u8 sampleVolume;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
struct host_sound {
|
||||
uintptr_t envelope; // ptr to struct generic_envelope
|
||||
uintptr_t keyMap; // ptr to struct generic_keymap
|
||||
uintptr_t wavetable; // ptr to struct host_wavetable
|
||||
u8 samplePan;
|
||||
u8 sampleVolume;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
struct n64_instrument {
|
||||
u8 volume;
|
||||
u8 pan;
|
||||
@@ -118,24 +53,6 @@ struct n64_instrument {
|
||||
u32 soundArray[1]; // ptr to struct n64_sound
|
||||
};
|
||||
|
||||
struct host_instrument {
|
||||
u8 volume;
|
||||
u8 pan;
|
||||
u8 priority;
|
||||
u8 flags;
|
||||
u8 tremType;
|
||||
u8 tremRate;
|
||||
u8 tremDepth;
|
||||
u8 tremDelay;
|
||||
u8 vibType;
|
||||
u8 vibRate;
|
||||
u8 vibDepth;
|
||||
u8 vibDelay;
|
||||
s16 bendRange;
|
||||
s16 soundCount;
|
||||
uintptr_t soundArray[1]; // ptr to struct host_sound
|
||||
};
|
||||
|
||||
struct n64_bank {
|
||||
s16 instCount;
|
||||
u8 flags;
|
||||
@@ -145,44 +62,29 @@ struct n64_bank {
|
||||
u32 instArray[1]; // ptr to struct n64_instrument
|
||||
};
|
||||
|
||||
struct host_bank {
|
||||
s16 instCount;
|
||||
u8 flags;
|
||||
u8 pad;
|
||||
s32 sampleRate;
|
||||
uintptr_t percussion; // ptr to struct host_instrument
|
||||
uintptr_t instArray[1]; // ptr to struct host_instrument
|
||||
};
|
||||
|
||||
struct n64_bankfile {
|
||||
s16 revision;
|
||||
s16 bankCount;
|
||||
u32 bankArray[1]; // ptr to struct n64_bank
|
||||
};
|
||||
|
||||
struct host_bankfile {
|
||||
s16 revision;
|
||||
s16 bankCount;
|
||||
uintptr_t bankArray[1]; // ptr to struct host_bank
|
||||
};
|
||||
|
||||
// only proceeds to convert the next item if it's not already converted
|
||||
#define AL_NEXT_ITEM(field, func) { \
|
||||
struct ptrmarker *marker = ptrFind(srcpos); \
|
||||
if (marker == NULL) { \
|
||||
field = (dstpos); \
|
||||
ptrAdd(srcpos, field); \
|
||||
field = (void *)(uintptr_t)(dstpos); \
|
||||
ptrAdd(srcpos, (uintptr_t)(field)); \
|
||||
dstpos = func(dst, dstpos, src, srcpos); \
|
||||
} else { \
|
||||
field = marker->ptr_host; } \
|
||||
field = (void *)marker->ptr_host; } \
|
||||
}
|
||||
|
||||
static int convertAudioEnvelope(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioEnvelope(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct generic_envelope *n64_envelope = (struct generic_envelope *) &src[srcpos];
|
||||
struct generic_envelope *host_envelope = (struct generic_envelope *) &dst[dstpos];
|
||||
ALEnvelope *n64_envelope = (ALEnvelope *) &src[srcpos];
|
||||
ALEnvelope *host_envelope = (ALEnvelope *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct generic_envelope);
|
||||
dstpos += sizeof(ALEnvelope);
|
||||
|
||||
host_envelope->attackTime = PD_BE32(n64_envelope->attackTime);
|
||||
host_envelope->decayTime = PD_BE32(n64_envelope->decayTime);
|
||||
@@ -193,12 +95,12 @@ static int convertAudioEnvelope(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioKeyMap(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioKeyMap(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct generic_keymap *n64_keymap = (struct generic_keymap *) &src[srcpos];
|
||||
struct generic_keymap *host_keymap = (struct generic_keymap *) &dst[dstpos];
|
||||
ALKeyMap *n64_keymap = (ALKeyMap *) &src[srcpos];
|
||||
ALKeyMap *host_keymap = (ALKeyMap *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct generic_keymap);
|
||||
dstpos += sizeof(ALKeyMap);
|
||||
|
||||
host_keymap->velocityMin = n64_keymap->velocityMin;
|
||||
host_keymap->velocityMax = n64_keymap->velocityMax;
|
||||
@@ -210,12 +112,12 @@ static int convertAudioKeyMap(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioAdpcmLoop(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioAdpcmLoop(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct generic_adpcm_loop *n64_loop = (struct generic_adpcm_loop *) &src[srcpos];
|
||||
struct generic_adpcm_loop *host_loop = (struct generic_adpcm_loop *) &dst[dstpos];
|
||||
ALADPCMloop *n64_loop = (ALADPCMloop *) &src[srcpos];
|
||||
ALADPCMloop *host_loop = (ALADPCMloop *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct generic_adpcm_loop);
|
||||
dstpos += sizeof(ALADPCMloop);
|
||||
|
||||
host_loop->start = PD_BE32(n64_loop->start);
|
||||
host_loop->end = PD_BE32(n64_loop->end);
|
||||
@@ -228,12 +130,12 @@ static int convertAudioAdpcmLoop(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioAdpcmBook(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioAdpcmBook(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct generic_adpcm_book *n64_book = (struct generic_adpcm_book *) &src[srcpos];
|
||||
struct generic_adpcm_book *host_book = (struct generic_adpcm_book *) &dst[dstpos];
|
||||
ALADPCMBook *n64_book = (ALADPCMBook *) &src[srcpos];
|
||||
ALADPCMBook *host_book = (ALADPCMBook *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct generic_adpcm_book);
|
||||
dstpos += sizeof(ALADPCMBook);
|
||||
|
||||
host_book->order = PD_BE32(n64_book->order);
|
||||
host_book->npredictors = PD_BE32(n64_book->npredictors);
|
||||
@@ -245,12 +147,12 @@ static int convertAudioAdpcmBook(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioRawLoop(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioRawLoop(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct generic_raw_loop *n64_loop = (struct generic_raw_loop *) &src[srcpos];
|
||||
struct generic_raw_loop *host_loop = (struct generic_raw_loop *) &dst[dstpos];
|
||||
ALRawLoop *n64_loop = (ALRawLoop *) &src[srcpos];
|
||||
ALRawLoop *host_loop = (ALRawLoop *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct generic_raw_loop);
|
||||
dstpos += sizeof(ALRawLoop);
|
||||
|
||||
host_loop->start = PD_BE32(n64_loop->start);
|
||||
host_loop->end = PD_BE32(n64_loop->end);
|
||||
@@ -259,14 +161,14 @@ static int convertAudioRawLoop(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioWaveTable(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioWaveTable(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_wavetable *n64_wavetable = (struct n64_wavetable *) &src[srcpos];
|
||||
struct host_wavetable *host_wavetable = (struct host_wavetable *) &dst[dstpos];
|
||||
ALWaveTable *host_wavetable = (ALWaveTable *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct host_wavetable);
|
||||
dstpos += sizeof(ALWaveTable);
|
||||
|
||||
host_wavetable->base = PD_BE32(n64_wavetable->base);
|
||||
host_wavetable->base = (void *)(uintptr_t)PD_BE32(n64_wavetable->base);
|
||||
host_wavetable->len = PD_BE32(n64_wavetable->len);
|
||||
host_wavetable->type = n64_wavetable->type;
|
||||
host_wavetable->flags = n64_wavetable->flags;
|
||||
@@ -276,53 +178,53 @@ static int convertAudioWaveTable(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
srcpos = PD_BE32(n64_wavetable->waveInfo.adpcmWave.loop);
|
||||
AL_NEXT_ITEM(host_wavetable->waveInfo.adpcmWave.loop, convertAudioAdpcmLoop);
|
||||
} else {
|
||||
host_wavetable->waveInfo.adpcmWave.loop = 0;
|
||||
host_wavetable->waveInfo.adpcmWave.loop = NULL;
|
||||
}
|
||||
|
||||
if (n64_wavetable->waveInfo.adpcmWave.book) {
|
||||
srcpos = PD_BE32(n64_wavetable->waveInfo.adpcmWave.book);
|
||||
AL_NEXT_ITEM(host_wavetable->waveInfo.adpcmWave.book, convertAudioAdpcmBook);
|
||||
} else {
|
||||
host_wavetable->waveInfo.adpcmWave.book = 0;
|
||||
host_wavetable->waveInfo.adpcmWave.book = NULL;
|
||||
}
|
||||
} else if (host_wavetable->type == AL_RAW16_WAVE) {
|
||||
if (n64_wavetable->waveInfo.rawWave.loop) {
|
||||
srcpos = PD_BE32(n64_wavetable->waveInfo.rawWave.loop);
|
||||
AL_NEXT_ITEM(host_wavetable->waveInfo.rawWave.loop, convertAudioRawLoop);
|
||||
} else {
|
||||
host_wavetable->waveInfo.rawWave.loop = 0;
|
||||
host_wavetable->waveInfo.rawWave.loop = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioSound(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioSound(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_sound *n64_sound = (struct n64_sound *) &src[srcpos];
|
||||
struct host_sound *host_sound = (struct host_sound *) &dst[dstpos];
|
||||
ALSound *host_sound = (ALSound *) &dst[dstpos];
|
||||
|
||||
dstpos += sizeof(struct host_sound);
|
||||
dstpos += sizeof(ALSound);
|
||||
|
||||
if (n64_sound->envelope) {
|
||||
srcpos = PD_BE32(n64_sound->envelope);
|
||||
AL_NEXT_ITEM(host_sound->envelope, convertAudioEnvelope);
|
||||
} else {
|
||||
host_sound->envelope = 0;
|
||||
host_sound->envelope = NULL;
|
||||
}
|
||||
|
||||
if (n64_sound->keyMap) {
|
||||
srcpos = PD_BE32(n64_sound->keyMap);
|
||||
AL_NEXT_ITEM(host_sound->keyMap, convertAudioKeyMap);
|
||||
} else {
|
||||
host_sound->keyMap = 0;
|
||||
host_sound->keyMap = NULL;
|
||||
}
|
||||
|
||||
if (n64_sound->wavetable) {
|
||||
srcpos = PD_BE32(n64_sound->wavetable);
|
||||
AL_NEXT_ITEM(host_sound->wavetable, convertAudioWaveTable);
|
||||
} else {
|
||||
host_sound->wavetable = 0;
|
||||
host_sound->wavetable = NULL;
|
||||
}
|
||||
|
||||
host_sound->samplePan = n64_sound->samplePan;
|
||||
@@ -332,11 +234,11 @@ static int convertAudioSound(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioInstrument(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioInstrument(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_instrument *n64_instrument = (struct n64_instrument *) &src[srcpos];
|
||||
struct host_instrument *host_instrument = (struct host_instrument *) &dst[dstpos];
|
||||
int soundCount = PD_BE16(n64_instrument->soundCount);
|
||||
ALInstrument *host_instrument = (ALInstrument *) &dst[dstpos];
|
||||
const s16 soundCount = PD_BE16(n64_instrument->soundCount);
|
||||
|
||||
host_instrument->volume = n64_instrument->volume;
|
||||
host_instrument->pan = n64_instrument->pan;
|
||||
@@ -353,7 +255,7 @@ static int convertAudioInstrument(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
host_instrument->bendRange = PD_BE16(n64_instrument->bendRange);
|
||||
host_instrument->soundCount = (soundCount);
|
||||
|
||||
dstpos = dstpos + sizeof(struct host_instrument) + sizeof(uintptr_t) * (soundCount - 1);
|
||||
dstpos = dstpos + sizeof(ALInstrument) + sizeof(uintptr_t) * (soundCount - 1);
|
||||
|
||||
for (int i = 0; i < soundCount; i++) {
|
||||
srcpos = PD_BE32(n64_instrument->soundArray[i]);
|
||||
@@ -363,18 +265,18 @@ static int convertAudioInstrument(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioBank(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
static u32 convertAudioBank(u8 *dst, u32 dstpos, u8 *src, u32 srcpos)
|
||||
{
|
||||
struct n64_bank *n64_bank = (struct n64_bank *) &src[srcpos];
|
||||
struct host_bank *host_bank = (struct host_bank *) &dst[dstpos];
|
||||
int instCount = PD_BE16(n64_bank->instCount);
|
||||
ALBank *host_bank = (ALBank *) &dst[dstpos];
|
||||
const s16 instCount = PD_BE16(n64_bank->instCount);
|
||||
|
||||
host_bank->instCount = (instCount);
|
||||
host_bank->flags = n64_bank->flags;
|
||||
host_bank->pad = n64_bank->pad;
|
||||
host_bank->sampleRate = PD_BE32(n64_bank->sampleRate);
|
||||
|
||||
dstpos = dstpos + sizeof(struct host_bank) + sizeof(uintptr_t) * (instCount - 1);
|
||||
dstpos = dstpos + sizeof(ALBank) + sizeof(uintptr_t) * (instCount - 1);
|
||||
|
||||
if (n64_bank->percussion) {
|
||||
srcpos = PD_BE32(n64_bank->percussion);
|
||||
@@ -391,20 +293,19 @@ static int convertAudioBank(u8 *dst, int dstpos, u8 *src, int srcpos)
|
||||
return dstpos;
|
||||
}
|
||||
|
||||
static int convertAudioBankFile(u8 *dst, u8 *src)
|
||||
static u32 convertAudioBankFile(u8 *dst, u8 *src)
|
||||
{
|
||||
struct n64_bankfile *n64_bankfile = (struct n64_bankfile *)src;
|
||||
struct host_bankfile *host_bankfile = (struct host_bankfile *)dst;
|
||||
int bankCount = PD_BE16(n64_bankfile->bankCount);
|
||||
ALBankFile *host_bankfile = (ALBankFile *)dst;
|
||||
const s16 bankCount = PD_BE16(n64_bankfile->bankCount);
|
||||
|
||||
host_bankfile->revision = PD_BE16(n64_bankfile->revision);
|
||||
host_bankfile->bankCount = (bankCount);
|
||||
|
||||
|
||||
u32 dstpos = sizeof(struct host_bankfile) + sizeof(uintptr_t) * (bankCount - 1);
|
||||
u32 dstpos = sizeof(ALBankFile) + sizeof(uintptr_t) * (bankCount - 1);
|
||||
|
||||
for (int i = 0; i < bankCount; i++) {
|
||||
host_bankfile->bankArray[i] = (dstpos);
|
||||
host_bankfile->bankArray[i] = (void *)(uintptr_t)(dstpos);
|
||||
u32 srcpos = PD_BE32(n64_bankfile->bankArray[i]);
|
||||
dstpos = convertAudioBank(dst, dstpos, src, srcpos);
|
||||
}
|
||||
@@ -423,3 +324,28 @@ u8 *preprocessALBankFile(u8 *src, u32 size, u32 *outSize)
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
u8 *preprocessALCMidiHdr(u8 *data, u32 size, u32 *outSize)
|
||||
{
|
||||
ALCMidiHdr *hdr = (ALCMidiHdr *)data;
|
||||
PD_SWAP_VAL(hdr->division);
|
||||
for (s32 i = 0; i < ARRAYCOUNT(hdr->trackOffset); ++i) {
|
||||
PD_SWAP_VAL(hdr->trackOffset[i]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u8 *preprocessSequences(u8* data, u32 size, u32 *outSize)
|
||||
{
|
||||
struct seqtable *seq = (struct seqtable *)data;
|
||||
PD_SWAP_VAL(seq->count);
|
||||
|
||||
for (s16 i = 0; i < seq->count; ++i) {
|
||||
PD_SWAP_VAL(seq->entries[i].binlen);
|
||||
PD_SWAP_VAL(seq->entries[i].ziplen);
|
||||
PD_SWAP_VAL(seq->entries[i].romaddr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "preprocess/common.h"
|
||||
|
||||
struct n64fontchar {
|
||||
struct n64_fontchar {
|
||||
u8 index;
|
||||
s8 baseline;
|
||||
u8 height;
|
||||
@@ -15,16 +15,7 @@ struct n64fontchar {
|
||||
u32 pixeldata;
|
||||
};
|
||||
|
||||
struct hostfontchar {
|
||||
u8 index;
|
||||
s8 baseline;
|
||||
u8 height;
|
||||
u8 width;
|
||||
s32 kerningindex;
|
||||
uintptr_t pixeldata;
|
||||
};
|
||||
|
||||
struct n64fontcharjpn {
|
||||
struct n64_fontcharjpn {
|
||||
u16 index;
|
||||
s8 baseline;
|
||||
u8 height;
|
||||
@@ -33,21 +24,6 @@ struct n64fontcharjpn {
|
||||
u32 pixeldata;
|
||||
};
|
||||
|
||||
struct hostfontcharjpn {
|
||||
u16 index;
|
||||
s8 baseline;
|
||||
u8 height;
|
||||
u8 width;
|
||||
s16 kerningindex;
|
||||
uintptr_t pixeldata;
|
||||
};
|
||||
|
||||
struct fontdef {
|
||||
const char *name;
|
||||
u32 offsets[3];
|
||||
int pal_extra_chars;
|
||||
};
|
||||
|
||||
u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
{
|
||||
int num_chars = 94;
|
||||
@@ -63,7 +39,7 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t dstlen = srclen - (num_chars * sizeof(struct n64fontchar)) + (num_chars * sizeof(struct hostfontchar)) + 0x20;
|
||||
size_t dstlen = srclen - (num_chars * sizeof(struct n64_fontchar)) + (num_chars * sizeof(struct fontchar)) + 0x20;
|
||||
u8* dst = sysMemZeroAlloc(dstlen);
|
||||
|
||||
// Kerning table
|
||||
@@ -79,9 +55,9 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
|
||||
// Character table
|
||||
#if VERSION == VERSION_JPN_FINAL
|
||||
struct n64fontcharjpn *src_char_table = (struct n64fontcharjpn *) &src[src_offset];
|
||||
struct n64_fontcharjpn *src_char_table = (struct n64_fontcharjpn *) &src[src_offset];
|
||||
struct hostfontcharjpn *dst_char_table = (struct hostfontcharjpn *) &dst[dst_offset];
|
||||
u32 diff = (dst_offset + num_chars * sizeof(struct hostfontcharjpn)) - (src_offset + num_chars * sizeof(struct n64fontcharjpn));
|
||||
u32 diff = (dst_offset + num_chars * sizeof(struct hostfontcharjpn)) - (src_offset + num_chars * sizeof(struct n64_fontcharjpn));
|
||||
|
||||
for (int i = 0; i < num_chars; i++) {
|
||||
dst_char_table[i].index = PD_BE16(src_char_table[i].index);
|
||||
@@ -89,15 +65,15 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
dst_char_table[i].height = src_char_table[i].height;
|
||||
dst_char_table[i].width = src_char_table[i].width;
|
||||
dst_char_table[i].kerningindex = PD_BE16(src_char_table[i].kerningindex);
|
||||
dst_char_table[i].pixeldata = src_char_table[i].pixeldata ? PD_BE32(src_char_table[i].pixeldata) + diff : 0;
|
||||
dst_char_table[i].pixeldata = (void *)(uintptr_t)(src_char_table[i].pixeldata ? PD_BE32(src_char_table[i].pixeldata) + diff : 0);
|
||||
}
|
||||
|
||||
src_offset += num_chars * sizeof(struct n64fontcharjpn);
|
||||
src_offset += num_chars * sizeof(struct n64_fontcharjpn);
|
||||
dst_offset += num_chars * sizeof(struct hostfontcharjpn);
|
||||
#else
|
||||
struct n64fontchar *src_char_table = (struct n64fontchar *) &src[src_offset];
|
||||
struct hostfontchar *dst_char_table = (struct hostfontchar *) &dst[dst_offset];
|
||||
u32 diff = (dst_offset + num_chars * sizeof(struct hostfontchar)) - (src_offset + num_chars * sizeof(struct n64fontchar));
|
||||
struct n64_fontchar *src_char_table = (struct n64_fontchar *) &src[src_offset];
|
||||
struct fontchar *dst_char_table = (struct fontchar *) &dst[dst_offset];
|
||||
u32 diff = (dst_offset + num_chars * sizeof(struct fontchar)) - (src_offset + num_chars * sizeof(struct n64_fontchar));
|
||||
|
||||
for (int i = 0; i < num_chars; i++) {
|
||||
dst_char_table[i].index = src_char_table[i].index;
|
||||
@@ -105,11 +81,11 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
dst_char_table[i].height = src_char_table[i].height;
|
||||
dst_char_table[i].width = src_char_table[i].width;
|
||||
dst_char_table[i].kerningindex = PD_BE32(src_char_table[i].kerningindex);
|
||||
dst_char_table[i].pixeldata = src_char_table[i].pixeldata ? PD_BE32(src_char_table[i].pixeldata) + diff : 0;
|
||||
dst_char_table[i].pixeldata = (void *)(uintptr_t)(src_char_table[i].pixeldata ? PD_BE32(src_char_table[i].pixeldata) + diff : 0);
|
||||
}
|
||||
|
||||
src_offset += num_chars * sizeof(struct n64fontchar);
|
||||
dst_offset += num_chars * sizeof(struct hostfontchar);
|
||||
src_offset += num_chars * sizeof(struct n64_fontchar);
|
||||
dst_offset += num_chars * sizeof(struct fontchar);
|
||||
#endif
|
||||
|
||||
// Pixel data
|
||||
@@ -120,3 +96,9 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize)
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
u8 *preprocessJpnFont(u8* data, u32 size, u32* outSize)
|
||||
{
|
||||
// ???
|
||||
return NULL;
|
||||
}
|
||||
@@ -538,6 +538,7 @@ struct modelrodata_type11 { // type 0x11
|
||||
u32 unk0c;
|
||||
u32 unk10;
|
||||
void *unk14;
|
||||
u32 unk18;
|
||||
};
|
||||
|
||||
struct modelrodata_toggle { // type 0x12
|
||||
@@ -548,6 +549,7 @@ struct modelrodata_toggle { // type 0x12
|
||||
struct modelrodata_positionheld { // type 0x15
|
||||
struct coord pos;
|
||||
s16 mtxindex;
|
||||
s32 unk10;
|
||||
};
|
||||
|
||||
struct modelrodata_stargunfire { // type 0x16
|
||||
@@ -2844,6 +2846,7 @@ struct coverdefinition {
|
||||
struct coord pos;
|
||||
struct coord look;
|
||||
u16 flags;
|
||||
u16 unk1a;
|
||||
};
|
||||
|
||||
struct cover {
|
||||
|
||||
+1
-1
@@ -1697,7 +1697,7 @@ bool seqPlay(struct seqinstance *seq, s32 tracknum)
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
preprocessALCMidiHdr(binstart, ziplen);
|
||||
preprocessALCMidiHdr(binstart, ziplen, NULL);
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
|
||||
Reference in new issue
Block a user