Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more C file splits #134

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config/sly1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ segments:
- [0x1f560, c, P2/brx]
- [0x1fe70, asm, P2/ac]
#- [0x, asm, P2/act]
#- [0x, asm, P2/actseg]
- [0x23f28, c, P2/actseg]
- [0x243c0, asm, P2/alarm]
- [0x24dc0, asm, P2/alo]
#- [0x, asm, P2/aseg]
#- [0x, asm, P2/asega]
#- [0x, asm, P2/barrier]
- [0x30cf0, asm, P2/bas]
- [0x310e8, asm, P2/basic]
- [0x31168, asm, P2/bez]
- [0x310e8, c, P2/basic]
- [0x31168, c, P2/bez]
- [0x31f48, c, P2/binoc]
- [0x38290, c, P2/bis]
- [0x395a0, asm, P2/bbmark]
Expand Down Expand Up @@ -200,8 +200,8 @@ segments:
#- [0x, asm, P2/shape]
- [0xb3988, asm, P2/shd]
- [0xb5920, asm, P2/shdanim]
#- [0x, asm, P2/sky]
#- [0x, asm, P2/slotheap]
- [0xb6cd8, c, P2/sky]
- [0xb6d80, asm, P2/slotheap]
- [0xb6f50, asm, P2/sm]
#- [0x, asm, P2/smartguard]
- [0xb8968, asm, P2/so]
Expand Down
38 changes: 38 additions & 0 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,37 @@ LoadSwObjectsFromBrx__FP2SWP3ALOP18CBinaryInputStream = 0x11ECB8; // type:func
SetLoDefaults__FP2LO = 0x11EDA8; // type:func


////////////////////////////////////////////////////////////////
// P2/actseg.c
////////////////////////////////////////////////////////////////
RetractActseg__FP6ACTSEGi = 0x122F28; // type:func
CloneActseg__FP6ACTSEGT0 = 0x122F88; // type:func
GetActsegPositionGoal__FP6ACTSEGfP6VECTORT2 = 0x122FE0; // type:func
GetActsegRotationGoal__FP6ACTSEGfP7MATRIX3P6VECTOR = 0x123120; // type:func
GetActsegTwistGoal__FP6ACTSEGPfT1 = 0x123270; // type:func
GetActsegScale__FP6ACTSEGP7MATRIX3 = 0x1232E8; // type:func
GGetActsegPoseGoal__FP6ACTSEGi = 0x123358; // type:func


////////////////////////////////////////////////////////////////
// P2/basic.c
////////////////////////////////////////////////////////////////
FIsBasicDerivedFrom__FP5BASIC3CID = 0x1300e8; // type:func
EnsureBasicSidebag__FP5BASIC = 0x130110; // type:func


////////////////////////////////////////////////////////////////
// P2/bez.c
////////////////////////////////////////////////////////////////
EvaluateBezierWeightedFloat__FfffffffffPfN29 = 0x130168; // type:func
EvaluateBezierFloat__FfffffffPfN27 = 0x1303F0; // type:func
EvaluateBezierPos__FfffP6VECTORN63 = 0x130540; // type:func
EvaluateBezierMat__FfffP7MATRIX3P6VECTORT3T4T3T4T4 = 0x130748; // type:func
TesselateBezier__FfffP6VECTORN33iT3 = 0x130B48; // type:func
SBezierPosLength__FffP6VECTORN32 = 0x130C20; // type:func
LimitBezierMulti__Fie = 0x130C58; // type:func


////////////////////////////////////////////////////////////////
// P2/binoc.c
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1172,6 +1203,13 @@ g_unkblot11 = 0x26eed0; // size:0x280
g_totals = 0x26f138; // size:0x280


////////////////////////////////////////////////////////////////
// P2/sky.c
////////////////////////////////////////////////////////////////
PostSkyLoad__FP3SKY = 0x1c9a18; // type:func
UpdateSky__FP3SKYf = 0x1c9a58; // type:func


////////////////////////////////////////////////////////////////
// P2/sound.c
////////////////////////////////////////////////////////////////
Expand Down
27 changes: 27 additions & 0 deletions include/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "common.h"
#include <splice/sidebag.h>
#include <cid.h>

/**
* @brief Basic object.
Expand All @@ -22,4 +23,30 @@ struct BASIC
CSidebag *psidebag;
};

/**
* @brief Check if the basic object is derived from the given class ID.
*
* @param pbasic The object.
* @param cid The class ID to check.
*
* @retval 1 if the object is derived from the class.
* @retval 0 if the object is not derived from the class.
*/
int FIsBasicDerivedFrom(BASIC *pbasic, CID cid);

/**
* @brief Check if the basic has a sidebag, and if not, create one.
*
* @param pbasic The object.
*/
void EnsureBasicSidebag(BASIC *pbasic);

/**
* @brief Get the basic object's CID.
*
* @param pbasic The object.
* @param pcid Return CID.
*/
void GetBasicCid(BASIC *pbasic, CID *pcid);

#endif // BASIC_H
15 changes: 14 additions & 1 deletion include/bez.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/**
* @file bez.h
*
* @brief Bezier curves.
*
* @todo Add function parameters and documentation.
*/
#ifndef BEZ_H
#define BEZ_H

#include "common.h"
#include <vec.h>
#include <mat.h>

// ...
void EvaluateBezierWeightedFloat(float, float, float, float, float, float, float, float, float, float *, float *, float *);
void EvaluateBezierFloat(float, float, float, float, float, float, float, float *, float *, float *);
void EvaluateBezierPos(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *);
void EvaluateBezierMat(float, float, float, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, VECTOR *);
void TesselateBezier(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, int, VECTOR *);
float SBezierPosLength(float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *);

void LimitBezierMulti(int c, ...);

#endif // BEZ_H
37 changes: 37 additions & 0 deletions include/sky.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @file sky.h
*
* @brief Skyboxes.
*/
#ifndef SKY_H
#define SKY_H

#include "common.h"

/**
* @brief Skybox structure.
*
* @todo Fill out the structure.
*/
struct SKY
{
// ...
};

/**
* @brief Initializes the sky with default values.
* Calls super function PostAloLoad().
*
* @param psky Pointer to the sky.
*/
void PostSkyLoad(SKY *psky);

/**
* @brief Updates the given sky.
*
* @param psky Pointer to the sky.
* @param dt Delta time.
*/
void UpdateSky(SKY *psky, float dt);

#endif // SKY_H
2 changes: 2 additions & 0 deletions include/sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ struct SW

extern SW *g_psw;

void IncrementSwHandsOff(SW *psw);

#endif // SW_H
15 changes: 15 additions & 0 deletions src/P2/actseg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "common.h"

INCLUDE_ASM(const s32, "P2/actseg", RetractActseg__FP6ACTSEGi);

INCLUDE_ASM(const s32, "P2/actseg", CloneActseg__FP6ACTSEGT0);

INCLUDE_ASM(const s32, "P2/actseg", GetActsegPositionGoal__FP6ACTSEGfP6VECTORT2);

INCLUDE_ASM(const s32, "P2/actseg", GetActsegRotationGoal__FP6ACTSEGfP7MATRIX3P6VECTOR);

INCLUDE_ASM(const s32, "P2/actseg", GetActsegTwistGoal__FP6ACTSEGPfT1);

INCLUDE_ASM(const s32, "P2/actseg", GetActsegScale__FP6ACTSEGP7MATRIX3);

INCLUDE_ASM(const s32, "P2/actseg", GGetActsegPoseGoal__FP6ACTSEGi);
7 changes: 7 additions & 0 deletions src/P2/basic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <basic.h>

INCLUDE_ASM(const s32, "P2/basic", FIsBasicDerivedFrom__FP5BASIC3CID);

INCLUDE_ASM(const s32, "P2/basic", EnsureBasicSidebag__FP5BASIC);

INCLUDE_ASM(const s32, "P2/basic", func_00130158);
15 changes: 15 additions & 0 deletions src/P2/bez.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bez.h>

INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierWeightedFloat__FfffffffffPfN29);

INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierFloat__FfffffffPfN27);

INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierPos__FfffP6VECTORN63);

INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierMat__FfffP7MATRIX3P6VECTORT3T4T3T4T4);

INCLUDE_ASM(const s32, "P2/bez", TesselateBezier__FfffP6VECTORN33iT3);

INCLUDE_ASM(const s32, "P2/bez", SBezierPosLength__FffP6VECTORN32);

INCLUDE_ASM(const s32, "P2/bez", LimitBezierMulti__Fie);
5 changes: 5 additions & 0 deletions src/P2/sky.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "sky.h"

INCLUDE_ASM(const s32, "P2/sky", func_001B5CD8);

INCLUDE_ASM(const s32, "P2/sky", func_001B5D28);
1 change: 1 addition & 0 deletions src/P2/xform2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <xform.h>
#include <sw.h>

INCLUDE_ASM(const s32, "P2/xform2", LoadWarpFromBrx__FP4WARPP18CBinaryInputStream);

Expand Down