Add find.c and flash.c, and fill in related headers

This commit is contained in:
Zac 2024-07-06 17:18:37 +00:00 committed by GitHub
parent 48095bdee8
commit e02d2c77b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 177 additions and 32 deletions

View File

@ -142,8 +142,8 @@ segments:
- [0x5aca0, asm] #? unknown file
- [0x5af20, asm, P2/find]
- [0x5b8b0, asm, P2/flash]
- [0x5af20, c, P2/find]
- [0x5b8b0, c, P2/flash]
- [0x5bae0, asm, P2/fly]
- [0x5d188, asm, P2/font]
- [0x5f810, c, P2/frm]
@ -499,7 +499,10 @@ segments:
#- [0x, data, P2/stepzap]
#- [0x, data, P2/stream]
#- [0x, data,, P2/suv]
#- [0x, data, P2/sw]
- [0x176710, data, P2/sw]
- [0x176714, data]
#- [0x, data,, P2/tail]
#- [0x, data,, P2/tank]
#- [0x, data,, P2/target]
@ -519,7 +522,10 @@ segments:
#- [0x, data, P2/vis]
#- [0x, data, P2/water]
#- [0x, data, P2/waypoint]
#- [0x, data, P2/wipe]
- [0x176f80, data, P2/wipe]
- [0x176fc0, data]
#- [0x, data, P2/wm]
#- [0x, data, P2/xform]
#- [0x, data, P2/zap]

View File

@ -236,6 +236,28 @@ g_difficultyEasy = 0x261e90; // size:0x5c
g_difficulty = 0x261ef0; // size:0x20
// P2/find.c
PdlFromSwOid__FP2SW3OID = 0x159F20; // type:func
MatchSwObject__FP2LOiiiT0iPiPP2LOT6 = 0x159F48; // type:func
CploFindSwObjects__FP2SWi3OIDP2LOiPP2LO = 0x15A198; // type:func
PloFindSwObject__FP2SWi3OIDP2LO = 0x15A418; // type:func
PloFindSwNearest__FP2SW3OIDP2LO = 0x15A448; // type:func
PloFindSwChild__FP2SW3OIDP3ALO = 0x15A480; // type:func
FIsCidDerivedFrom__F3CIDT0 = 0x15A4B8; // type:func
CploFindSwObjectsByClass__FP2SWi3CIDP2LOiPP2LO = 0x15A4F0; // type:func
PloFindSwObjectByClass__FP2SWi3CIDP2LO = 0x15A838; // type:func
PaloFindLoCommonParent__FP2LOT0 = 0x15A868; // type:func
// P2/flash.c
InitFlash__FP5FLASH = 0x15A8B0; // type:func
LoadFlashFromBrx__FP5FLASHP18CBinaryInputStream = 0x15A918; // type:func
UpdateFlash__FP5FLASHf = 0x15A960; // type:func
RenderFlashSelf__FP5FLASHP2CMP2RO = 0x15A9A8; // type:func
FPosFlashWithin__FP5FLASHP6VECTOR = 0x15AA50; // type:func
// P2/font.c
g_pfont = 0x26227C; // size:0x4

View File

@ -5,7 +5,28 @@
#define FIND_H
#include "common.h"
#include <alo.h>
#include <sw.h>
#include <cid.h>
// ...
DL *PdlFromSwOid(SW *psw, OID oid);
void MatchSwObject(LO *ploMatch, int grffsoMask, int fIncludeRemoved, int fProxyMatch, LO *ploContext, int cploMax, int *pcploMatch, LO **aplo, int *pcpaloBest);
int CploFindSwObjects(SW *psw, int grffso, OID oid, LO *ploContext, int cploMax, LO **aplo);
LO *PloFindSwObject(SW *psw, int grffso, OID oid, LO *ploContext);
LO *PloFindSwNearest(SW *psw, OID oid, LO *ploContext);
LO *PloFindSwChild(SW *psw, OID oid, ALO *paloAncestor);
int FIsCidDerivedFrom(int cid, int cidAncestor);
int CploFindSwObjectsByClass(SW *psw, ulong grffso, CID cid, LO *ploContext, int cploMax, LO **aplo);
LO *PloFindSwObjectByClass(SW *psw, int grffso, CID cid, LO *ploContext);
ALO *PaloFindLoCommonParent(LO *plo, LO *ploOther);
#endif // FIND_H

View File

@ -5,7 +5,45 @@
#define FLASH_H
#include "common.h"
#include <mat.h>
#include <sm.h>
#include <shd.h>
#include <cm.h>
// ...
struct RO
{
MATRIX4 mat;
float uAlpha;
float uAlphaCelBorder;
undefined4 unk0;
undefined4 unk1;
};
/**
* @brief Flash.
*/
struct FLASH : public ALO
{
int ctsurf;
TSURF *atsurf;
int ctbsp;
TBSP *atbsp;
SMP smpScale;
float gScaleCur;
float gScaleTarget;
undefined4 unk0;
undefined4 unk1;
undefined4 unk2;
};
void InitFlash(FLASH *pflash);
void LoadFlashFromBrx(FLASH *pflash, CBinaryInputStream *pbis);
void UpdateFlash(FLASH *pflash, float dt);
void RenderFlashSelf(FLASH *pflash, CM *pcm, RO *pro);
int FPosFlashWithin(FLASH *pflash, VECTOR *ppos);
#endif // FLASH_H

View File

@ -7,6 +7,7 @@
#include "common.h"
#include <binoc.h>
#include <geom.h>
#include <surf.h>
#include <sce/gs.h>
typedef struct SHD; // Forward declaration
@ -93,26 +94,6 @@ union QW
float ag[4];
};
// MARK: Surface?
struct SUR
{
int cb;
void *pvSrc;
void *pvDst;
int cvtx;
};
struct SURF
{
VECTOR normal;
float gDot;
EDGE *pedge;
EDGE *pedgeOther;
short grfsurf;
short ipos;
};
// MARK: SAIR
struct SAIR

View File

@ -16,6 +16,7 @@ struct SM;
struct SMA;
struct SMT;
struct SMS;
struct SMP;
/**
* @brief State machine.
@ -70,4 +71,13 @@ struct SMS
undefined4 unk_0;
};
/**
* @brief State machine something(?).
*/
struct SMP
{
float svSlow;
float dtFast;
};
#endif // SM_H

View File

@ -1,13 +1,43 @@
/**
* @file stream.h
* @file surf.h
*
* @brief Surface?
*/
#ifndef STREAM_H
#define STREAM_H
#ifndef SURF_H
#define SURF_H
#include "common.h"
#include <vec.h>
#include <geom.h>
//todo implement structs
struct TSURF;
// todo define struct
struct TBSP;
#endif // STREAM_H
struct SUR
{
int cb;
void *pvSrc;
void *pvDst;
int cvtx;
};
struct SURF
{
VECTOR normal;
float gDot;
EDGE *pedge;
EDGE *pedgeOther;
short grfsurf;
short ipos;
};
struct TSURF
{
float gDot;
undefined4 unk1;
undefined4 unk2;
undefined4 unk3;
VECTOR normal;
};
#endif // SURF_H

View File

@ -11,4 +11,6 @@ struct SW
{
};
extern SW *g_psw;
#endif // SW_H

View File

@ -45,4 +45,7 @@ struct WIPE
WIPEK wipekButton;
};
extern WIPE *g_pwipe;
extern WIPE g_wipe;
#endif // WIPE_H

21
src/P2/find.c Normal file
View File

@ -0,0 +1,21 @@
#include <find.h>
INCLUDE_ASM(const s32, "P2/find", PdlFromSwOid__FP2SW3OID);
INCLUDE_ASM(const s32, "P2/find", MatchSwObject__FP2LOiiiT0iPiPP2LOT6);
INCLUDE_ASM(const s32, "P2/find", CploFindSwObjects__FP2SWi3OIDP2LOiPP2LO);
INCLUDE_ASM(const s32, "P2/find", PloFindSwObject__FP2SWi3OIDP2LO);
INCLUDE_ASM(const s32, "P2/find", PloFindSwNearest__FP2SW3OIDP2LO);
INCLUDE_ASM(const s32, "P2/find", PloFindSwChild__FP2SW3OIDP3ALO);
INCLUDE_ASM(const s32, "P2/find", FIsCidDerivedFrom__F3CIDT0);
INCLUDE_ASM(const s32, "P2/find", CploFindSwObjectsByClass__FP2SWi3CIDP2LOiPP2LO);
INCLUDE_ASM(const s32, "P2/find", PloFindSwObjectByClass__FP2SWi3CIDP2LO);
INCLUDE_ASM(const s32, "P2/find", PaloFindLoCommonParent__FP2LOT0);

11
src/P2/flash.c Normal file
View File

@ -0,0 +1,11 @@
#include <flash.h>
INCLUDE_ASM(const s32, "P2/flash", InitFlash__FP5FLASH);
INCLUDE_ASM(const s32, "P2/flash", LoadFlashFromBrx__FP5FLASHP18CBinaryInputStream);
INCLUDE_ASM(const s32, "P2/flash", UpdateFlash__FP5FLASHf);
INCLUDE_ASM(const s32, "P2/flash", RenderFlashSelf__FP5FLASHP2CMP2RO);
INCLUDE_ASM(const s32, "P2/flash", FPosFlashWithin__FP5FLASHP6VECTOR);