mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-09-03 09:59:24 -04:00
Decompile modeldef0f1a7560
This commit is contained in:
+59
-130
@@ -105,132 +105,61 @@ struct skeleton *g_Skeletons[] = {
|
||||
&g_SkelBB,
|
||||
};
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel modeldef0f1a7560
|
||||
/* f1a7560: 27bdff70 */ addiu $sp,$sp,-144
|
||||
/* f1a7564: afb3002c */ sw $s3,0x2c($sp)
|
||||
/* f1a7568: 00809825 */ or $s3,$a0,$zero
|
||||
/* f1a756c: 30a4ffff */ andi $a0,$a1,0xffff
|
||||
/* f1a7570: afbf0044 */ sw $ra,0x44($sp)
|
||||
/* f1a7574: afb20028 */ sw $s2,0x28($sp)
|
||||
/* f1a7578: afb10024 */ sw $s1,0x24($sp)
|
||||
/* f1a757c: 00e08825 */ or $s1,$a3,$zero
|
||||
/* f1a7580: 00c09025 */ or $s2,$a2,$zero
|
||||
/* f1a7584: afbe0040 */ sw $s8,0x40($sp)
|
||||
/* f1a7588: afb7003c */ sw $s7,0x3c($sp)
|
||||
/* f1a758c: afb60038 */ sw $s6,0x38($sp)
|
||||
/* f1a7590: afb50034 */ sw $s5,0x34($sp)
|
||||
/* f1a7594: afb40030 */ sw $s4,0x30($sp)
|
||||
/* f1a7598: afb00020 */ sw $s0,0x20($sp)
|
||||
/* f1a759c: afa50094 */ sw $a1,0x94($sp)
|
||||
/* f1a75a0: 0fc59ca5 */ jal fileGetAllocationSize
|
||||
/* f1a75a4: afa40058 */ sw $a0,0x58($sp)
|
||||
/* f1a75a8: 00408025 */ or $s0,$v0,$zero
|
||||
/* f1a75ac: 0fc59ca0 */ jal fileGetLoadedSize
|
||||
/* f1a75b0: 8fa40058 */ lw $a0,0x58($sp)
|
||||
/* f1a75b4: afa20088 */ sw $v0,0x88($sp)
|
||||
/* f1a75b8: afa00074 */ sw $zero,0x74($sp)
|
||||
/* f1a75bc: 02602025 */ or $a0,$s3,$zero
|
||||
/* f1a75c0: 27a50074 */ addiu $a1,$sp,0x74
|
||||
/* f1a75c4: 0c008c67 */ jal modelIterateDisplayLists
|
||||
/* f1a75c8: 27a6006c */ addiu $a2,$sp,0x6c
|
||||
/* f1a75cc: 8fb6006c */ lw $s6,0x6c($sp)
|
||||
/* f1a75d0: 3c1700ff */ lui $s7,0xff
|
||||
/* f1a75d4: 36f7ffff */ ori $s7,$s7,0xffff
|
||||
/* f1a75d8: 12c00049 */ beqz $s6,.L0f1a7700
|
||||
/* f1a75dc: 02c0a825 */ or $s5,$s6,$zero
|
||||
/* f1a75e0: 8fb80088 */ lw $t8,0x88($sp)
|
||||
/* f1a75e4: 02d77824 */ and $t7,$s6,$s7
|
||||
/* f1a75e8: 026f2021 */ addu $a0,$s3,$t7
|
||||
/* f1a75ec: 0093c823 */ subu $t9,$a0,$s3
|
||||
/* f1a75f0: 03193023 */ subu $a2,$t8,$t9
|
||||
/* f1a75f4: 02061823 */ subu $v1,$s0,$a2
|
||||
/* f1a75f8: 02644023 */ subu $t0,$s3,$a0
|
||||
/* f1a75fc: 00684821 */ addu $t1,$v1,$t0
|
||||
/* f1a7600: afa90084 */ sw $t1,0x84($sp)
|
||||
/* f1a7604: 0fc5d7bd */ jal tex0f175ef4
|
||||
/* f1a7608: 00732821 */ addu $a1,$v1,$s3
|
||||
/* f1a760c: 8fbe00a0 */ lw $s8,0xa0($sp)
|
||||
/* f1a7610: 8e640018 */ lw $a0,0x18($s3)
|
||||
/* f1a7614: 86650016 */ lh $a1,0x16($s3)
|
||||
/* f1a7618: 02323823 */ subu $a3,$s1,$s2
|
||||
/* f1a761c: 0fc5cd0d */ jal texLoadFromConfigs
|
||||
/* f1a7620: 03c03025 */ or $a2,$s8,$zero
|
||||
/* f1a7624: 8faa0074 */ lw $t2,0x74($sp)
|
||||
/* f1a7628: 5140002b */ beqzl $t2,.L0f1a76d8
|
||||
/* f1a762c: 02b74824 */ and $t1,$s5,$s7
|
||||
/* f1a7630: 8fb0006c */ lw $s0,0x6c($sp)
|
||||
.L0f1a7634:
|
||||
/* f1a7634: 8fb10074 */ lw $s1,0x74($sp)
|
||||
/* f1a7638: 02602025 */ or $a0,$s3,$zero
|
||||
/* f1a763c: 27a50074 */ addiu $a1,$sp,0x74
|
||||
/* f1a7640: 0c008c67 */ jal modelIterateDisplayLists
|
||||
/* f1a7644: 27a6006c */ addiu $a2,$sp,0x6c
|
||||
/* f1a7648: 8fb6006c */ lw $s6,0x6c($sp)
|
||||
/* f1a764c: 02602025 */ or $a0,$s3,$zero
|
||||
/* f1a7650: 02202825 */ or $a1,$s1,$zero
|
||||
/* f1a7654: 12c00004 */ beqz $s6,.L0f1a7668
|
||||
/* f1a7658: 02003025 */ or $a2,$s0,$zero
|
||||
/* f1a765c: 02d0a023 */ subu $s4,$s6,$s0
|
||||
/* f1a7660: 10000006 */ b .L0f1a767c
|
||||
/* f1a7664: 02179024 */ and $s2,$s0,$s7
|
||||
.L0f1a7668:
|
||||
/* f1a7668: 8fab0088 */ lw $t3,0x88($sp)
|
||||
/* f1a766c: 02179024 */ and $s2,$s0,$s7
|
||||
/* f1a7670: 01736021 */ addu $t4,$t3,$s3
|
||||
/* f1a7674: 01936823 */ subu $t5,$t4,$s3
|
||||
/* f1a7678: 01b2a023 */ subu $s4,$t5,$s2
|
||||
.L0f1a767c:
|
||||
/* f1a767c: 0c008cc5 */ jal modelNodeReplaceGdl
|
||||
/* f1a7680: 02a03825 */ or $a3,$s5,$zero
|
||||
/* f1a7684: 962e0000 */ lhu $t6,0x0($s1)
|
||||
/* f1a7688: 24010018 */ addiu $at,$zero,0x18
|
||||
/* f1a768c: 02727821 */ addu $t7,$s3,$s2
|
||||
/* f1a7690: 15c10004 */ bne $t6,$at,.L0f1a76a4
|
||||
/* f1a7694: 8fb80084 */ lw $t8,0x84($sp)
|
||||
/* f1a7698: 8e220004 */ lw $v0,0x4($s1)
|
||||
/* f1a769c: 10000002 */ b .L0f1a76a8
|
||||
/* f1a76a0: 8c43000c */ lw $v1,0xc($v0)
|
||||
.L0f1a76a4:
|
||||
/* f1a76a4: 00001825 */ or $v1,$zero,$zero
|
||||
.L0f1a76a8:
|
||||
/* f1a76a8: 02b7c824 */ and $t9,$s5,$s7
|
||||
/* f1a76ac: 02793021 */ addu $a2,$s3,$t9
|
||||
/* f1a76b0: 01f82021 */ addu $a0,$t7,$t8
|
||||
/* f1a76b4: 02802825 */ or $a1,$s4,$zero
|
||||
/* f1a76b8: 03c03825 */ or $a3,$s8,$zero
|
||||
/* f1a76bc: 0fc5d5b0 */ jal tex0f1756c0
|
||||
/* f1a76c0: afa30010 */ sw $v1,0x10($sp)
|
||||
/* f1a76c4: 8fa80074 */ lw $t0,0x74($sp)
|
||||
/* f1a76c8: 02a2a821 */ addu $s5,$s5,$v0
|
||||
/* f1a76cc: 5500ffd9 */ bnezl $t0,.L0f1a7634
|
||||
/* f1a76d0: 8fb0006c */ lw $s0,0x6c($sp)
|
||||
/* f1a76d4: 02b74824 */ and $t1,$s5,$s7
|
||||
.L0f1a76d8:
|
||||
/* f1a76d8: 02695021 */ addu $t2,$s3,$t1
|
||||
/* f1a76dc: 01533023 */ subu $a2,$t2,$s3
|
||||
/* f1a76e0: 24c6000f */ addiu $a2,$a2,0xf
|
||||
/* f1a76e4: 2401fff0 */ addiu $at,$zero,-16
|
||||
/* f1a76e8: 00c15824 */ and $t3,$a2,$at
|
||||
/* f1a76ec: 01603025 */ or $a2,$t3,$zero
|
||||
/* f1a76f0: 8fa40058 */ lw $a0,0x58($sp)
|
||||
/* f1a76f4: 02602825 */ or $a1,$s3,$zero
|
||||
/* f1a76f8: 0fc59caa */ jal fileSetSize
|
||||
/* f1a76fc: 8fa700a4 */ lw $a3,0xa4($sp)
|
||||
.L0f1a7700:
|
||||
/* f1a7700: 8fbf0044 */ lw $ra,0x44($sp)
|
||||
/* f1a7704: 8fb00020 */ lw $s0,0x20($sp)
|
||||
/* f1a7708: 8fb10024 */ lw $s1,0x24($sp)
|
||||
/* f1a770c: 8fb20028 */ lw $s2,0x28($sp)
|
||||
/* f1a7710: 8fb3002c */ lw $s3,0x2c($sp)
|
||||
/* f1a7714: 8fb40030 */ lw $s4,0x30($sp)
|
||||
/* f1a7718: 8fb50034 */ lw $s5,0x34($sp)
|
||||
/* f1a771c: 8fb60038 */ lw $s6,0x38($sp)
|
||||
/* f1a7720: 8fb7003c */ lw $s7,0x3c($sp)
|
||||
/* f1a7724: 8fbe0040 */ lw $s8,0x40($sp)
|
||||
/* f1a7728: 03e00008 */ jr $ra
|
||||
/* f1a772c: 27bd0090 */ addiu $sp,$sp,0x90
|
||||
);
|
||||
void modeldef0f1a7560(struct modelfiledata *modeldef, u16 filenum, u32 arg2, u32 arg3, struct texturething *arg4, bool arg5)
|
||||
{
|
||||
s32 allocsize;
|
||||
s32 loadedsize;
|
||||
s32 sp84;
|
||||
u32 s0;
|
||||
u32 s4;
|
||||
u32 s5;
|
||||
struct modelnode *node;
|
||||
struct modelnode *prevnode;
|
||||
u32 gdl;
|
||||
struct gfxvtx *vertices;
|
||||
|
||||
allocsize = fileGetAllocationSize(filenum);
|
||||
loadedsize = fileGetLoadedSize(filenum);
|
||||
node = NULL;
|
||||
|
||||
modelIterateDisplayLists(modeldef, &node, (Gfx **)&gdl);
|
||||
|
||||
s5 = gdl;
|
||||
|
||||
if (gdl) {
|
||||
s32 v1 = allocsize - (loadedsize - (s32)(((u32)modeldef + (gdl & 0xffffff)) - (u32)modeldef));
|
||||
sp84 = (s32)v1 + (s32)((s32)modeldef - ((u32)modeldef + (gdl & 0xffffff)));
|
||||
|
||||
tex0f175ef4((u32)modeldef + (gdl & 0xffffff), v1 + (u32)modeldef, loadedsize - (s32)(((u32)modeldef + (gdl & 0xffffff)) - (u32)modeldef));
|
||||
texLoadFromConfigs(modeldef->texconfigs, modeldef->numtexconfigs, arg4, arg3 - arg2);
|
||||
|
||||
while (node) {
|
||||
prevnode = node;
|
||||
s0 = gdl;
|
||||
|
||||
modelIterateDisplayLists(modeldef, &node, &gdl);
|
||||
|
||||
if (gdl) {
|
||||
s4 = gdl - s0;
|
||||
} else {
|
||||
s4 = loadedsize + (u32)modeldef - (u32)modeldef - (s0 & 0xffffff);
|
||||
}
|
||||
|
||||
modelNodeReplaceGdl(modeldef, prevnode, s0, s5);
|
||||
|
||||
if (prevnode->type == MODELNODETYPE_DL) {
|
||||
struct modelrodata_dl *rodata = &prevnode->rodata->dl;
|
||||
vertices = rodata->vertices;
|
||||
} else {
|
||||
vertices = NULL;
|
||||
}
|
||||
|
||||
s5 += tex0f1756c0((u32)modeldef + (s0 & 0xffffff) + sp84, s4, (u32)modeldef + (s5 & 0xffffff), arg4, vertices);
|
||||
}
|
||||
|
||||
fileSetSize(filenum, modeldef, (((u32)modeldef + (s5 & 0xffffff)) - (u32)modeldef + 0xf) & ~0xf, arg5);
|
||||
}
|
||||
}
|
||||
|
||||
void modelPromoteTypeToPointer(struct modelfiledata *filedata)
|
||||
{
|
||||
@@ -246,7 +175,7 @@ void modelPromoteTypeToPointer(struct modelfiledata *filedata)
|
||||
}
|
||||
}
|
||||
|
||||
struct modelfiledata *modeldefLoad(u16 fileid, u8 *dst, s32 size, s32 *arg3)
|
||||
struct modelfiledata *modeldefLoad(u16 fileid, u8 *dst, s32 size, struct texturething *arg3)
|
||||
{
|
||||
struct modelfiledata *filedata;
|
||||
|
||||
@@ -260,17 +189,17 @@ struct modelfiledata *modeldefLoad(u16 fileid, u8 *dst, s32 size, s32 *arg3)
|
||||
|
||||
modelPromoteTypeToPointer(filedata);
|
||||
modelPromoteOffsetsToPointers(filedata, 0x5000000, (u32) filedata);
|
||||
modeldef0f1a7560(filedata, fileid, 0x5000000, filedata, arg3, dst == NULL);
|
||||
modeldef0f1a7560(filedata, fileid, 0x5000000, (u32)filedata, arg3, dst == NULL);
|
||||
|
||||
return filedata;
|
||||
}
|
||||
|
||||
void *modeldefLoadToNew(u16 fileid)
|
||||
struct modelfiledata *modeldefLoadToNew(u16 fileid)
|
||||
{
|
||||
return modeldefLoad(fileid, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
void *modeldefLoadToAddr(u16 fileid, u8 *dst, s32 size)
|
||||
struct modelfiledata *modeldefLoadToAddr(u16 fileid, u8 *dst, s32 size)
|
||||
{
|
||||
return modeldefLoad(fileid, dst, size, NULL);
|
||||
}
|
||||
|
||||
+7
-7
@@ -1275,7 +1275,7 @@ void playerTickChrBody(void)
|
||||
|
||||
if (g_Vars.currentplayer->haschrbody == false) {
|
||||
struct chrdata *chr;
|
||||
s32 sp100[4];
|
||||
struct texturething sp100;
|
||||
struct modelfiledata *bodyfiledata;
|
||||
struct modelfiledata *headfiledata = NULL;
|
||||
struct modelfiledata *weaponfiledata;
|
||||
@@ -1397,12 +1397,12 @@ void playerTickChrBody(void)
|
||||
offset2 += 0x4000;
|
||||
bgunCalculateGunMemCapacity();
|
||||
spe8 = g_Vars.currentplayer->gunmem2 + offset2;
|
||||
func0f172e70(sp100, spe8, bgunCalculateGunMemCapacity() - offset2);
|
||||
bodyfiledata = modeldefLoad(g_HeadsAndBodies[bodynum].filenum, allocation + offset1, offset2 - offset1, sp100);
|
||||
func0f172e70(&sp100, spe8, bgunCalculateGunMemCapacity() - offset2);
|
||||
bodyfiledata = modeldefLoad(g_HeadsAndBodies[bodynum].filenum, allocation + offset1, offset2 - offset1, &sp100);
|
||||
offset1 = ALIGN64(fileGetLoadedSize(g_HeadsAndBodies[bodynum].filenum) + offset1);
|
||||
|
||||
if (headnum >= 0) {
|
||||
headfiledata = modeldefLoad(g_HeadsAndBodies[headnum].filenum, allocation + offset1, offset2 - offset1, sp100);
|
||||
headfiledata = modeldefLoad(g_HeadsAndBodies[headnum].filenum, allocation + offset1, offset2 - offset1, &sp100);
|
||||
offset1 = ALIGN64(fileGetLoadedSize(g_HeadsAndBodies[headnum].filenum) + offset1);
|
||||
}
|
||||
|
||||
@@ -1417,7 +1417,7 @@ void playerTickChrBody(void)
|
||||
|
||||
model->unk02 = 256;
|
||||
|
||||
func0f172f54(sp100);
|
||||
func0f172f54(&sp100);
|
||||
|
||||
// @TODO: Figure out these arguments
|
||||
osSyncPrintf("Jo using %d bytes gunmem (gunmemsize %d)\n");
|
||||
@@ -1425,7 +1425,7 @@ void playerTickChrBody(void)
|
||||
osSyncPrintf("Gunmem: tex block free 0x%08x\n");
|
||||
osSyncPrintf("Gunmem: Free at end %d\n");
|
||||
|
||||
func0f172f54(sp100);
|
||||
func0f172f54(&sp100);
|
||||
} else {
|
||||
// 2-4 players
|
||||
if (g_HeadsAndBodies[bodynum].filedata == NULL) {
|
||||
@@ -1500,7 +1500,7 @@ void playerTickChrBody(void)
|
||||
|
||||
if (weaponmodelnum >= 0) {
|
||||
if (g_Vars.mplayerisrunning == false) {
|
||||
weaponfiledata = modeldefLoad(g_ModelStates[weaponmodelnum].fileid, allocation + offset1, offset2 - offset1, sp100);
|
||||
weaponfiledata = modeldefLoad(g_ModelStates[weaponmodelnum].fileid, allocation + offset1, offset2 - offset1, &sp100);
|
||||
fileGetLoadedSize(g_ModelStates[weaponmodelnum].fileid);
|
||||
modelCalculateRwDataLen(weaponfiledata);
|
||||
} else {
|
||||
|
||||
@@ -3231,9 +3231,9 @@ s32 func0f172f44(struct texturething *arg0)
|
||||
return (u32)arg0->unk0c - (u32)arg0->unk08;
|
||||
}
|
||||
|
||||
s32 func0f172f54(s32 *arg0)
|
||||
struct texloadthing *func0f172f54(struct texturething *arg0)
|
||||
{
|
||||
return arg0[2];
|
||||
return arg0->unk08;
|
||||
}
|
||||
|
||||
void texLoadFromDisplayList(Gfx *gdl, struct texturething *arg1, s32 arg2)
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void modeldef0f1a7560(void *ptr, u16 fileid, u32 arg2, void *arg3, s32 *arg4, bool arg5);
|
||||
void modeldef0f1a7560(struct modelfiledata *modeldef, u16 filenum, u32 arg2, u32 arg3, struct texturething *arg4, bool arg5);
|
||||
void modelPromoteTypeToPointer(struct modelfiledata *filedata);
|
||||
struct modelfiledata *modeldefLoad(u16 fileid, u8 *arg1, s32 arg2, s32 *arg3);
|
||||
void *modeldefLoadToNew(u16 fileid);
|
||||
struct modelfiledata *modeldefLoad(u16 fileid, u8 *arg1, s32 arg2, struct texturething *arg3);
|
||||
struct modelfiledata *modeldefLoadToNew(u16 fileid);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ u32 tex0f175308(void);
|
||||
u32 tex0f175490(void);
|
||||
u32 tex0f1755dc(void);
|
||||
u32 tex0f17563c(void);
|
||||
s32 tex0f1756c0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
s32 tex0f1756c0(s32 arg0, s32 arg1, s32 arg2, struct texturething *arg3, struct gfxvtx *arg4);
|
||||
void tex0f175ef4(s32 arg0, s32 arg1, s32 arg2);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,10 +27,10 @@ s32 texInflateLookup(s32 width, s32 height, u8 *dst, u8 *lookup, s32 numcolours,
|
||||
s32 texInflateLookupFromBuffer(u8 *src, s32 width, s32 height, u8 *dst, u8 *lookup, s32 numcolours, s32 format);
|
||||
void texSwapAltRowBytes(u8 *arg0, s32 width, s32 height, s32 format);
|
||||
void texBlur(u8 *pixels, s32 width, s32 height, s32 method, s32 chansize);
|
||||
void func0f172e70(s32 *arg0, void *arg1, s32 arg2);
|
||||
void func0f172e70(struct texturething *arg0, void *arg1, s32 arg2);
|
||||
struct texloadthing *tex0f172e8c(s32 texturenum, struct texturething *arg1);
|
||||
s32 func0f172f44(struct texturething *arg0);
|
||||
s32 func0f172f54(s32 *arg0);
|
||||
struct texloadthing *func0f172f54(struct texturething *arg0);
|
||||
void texLoadFromDisplayList(Gfx *gdl, struct texturething *arg1, s32 arg2);
|
||||
void texLoad(u32 *texturenum, struct texturething *arg1, s32 arg2);
|
||||
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texturething *arg2, s32 arg3);
|
||||
|
||||
+2
-1
@@ -696,7 +696,8 @@ struct modelfiledata {
|
||||
s16 nummatrices;
|
||||
f32 unk10;
|
||||
s16 rwdatalen; // in words
|
||||
void *unk18;
|
||||
s16 numtexconfigs;
|
||||
struct textureconfig *texconfigs;
|
||||
};
|
||||
|
||||
struct model {
|
||||
|
||||
+1
-1
@@ -7104,7 +7104,7 @@ void modelPromoteOffsetsToPointers(struct modelfiledata *filedata, u32 vma, u32
|
||||
|
||||
PROMOTE(filedata->rootnode);
|
||||
PROMOTE(filedata->parts);
|
||||
PROMOTE(filedata->unk18);
|
||||
PROMOTE(filedata->texconfigs);
|
||||
|
||||
for (i = 0; i < filedata->numparts; i++) {
|
||||
PROMOTE(filedata->parts[i]);
|
||||
|
||||
Reference in New Issue
Block a user