mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-03 08:57:00 -04:00
started copying code over to new disasm
This commit is contained in:
@@ -2,5 +2,19 @@
|
||||
#define C_LIST_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_node.h"
|
||||
|
||||
typedef struct node_list_class {
|
||||
node_class* mpHead;
|
||||
node_class* mpTail;
|
||||
int mSize;
|
||||
} node_list_class;
|
||||
|
||||
void cLs_Init(node_list_class* pList);
|
||||
int cLs_SingleCut(node_class* pNode);
|
||||
int cLs_Addition(node_list_class* pList, node_class* pNode);
|
||||
int cLs_Insert(node_list_class* pList, int idx, node_class* pNode);
|
||||
node_class* cLs_GetFirst(node_list_class* pList);
|
||||
void cLs_Create(node_list_class* pList);
|
||||
|
||||
#endif /* C_LIST_H */
|
||||
|
||||
@@ -2,5 +2,10 @@
|
||||
#define C_LIST_ITER_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_list.h"
|
||||
#include "SSystem/SComponent/c_node_iter.h"
|
||||
|
||||
int cLsIt_Method(node_list_class* pList, cNdIt_MethodFunc pMethod, void* pUserData);
|
||||
void* cLsIt_Judge(node_list_class* pList, cNdIt_JudgeFunc pJudge, void* pUserData);
|
||||
|
||||
#endif /* C_LIST_ITER_H */
|
||||
|
||||
@@ -3,4 +3,17 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
// TODO: move to correct include
|
||||
struct JKRHeap {
|
||||
/* 802CE4D4 */ void *alloc(u32, int);
|
||||
/* 802CE548 */ void free(void*);
|
||||
};
|
||||
|
||||
struct cMl {
|
||||
static JKRHeap *Heap;
|
||||
/* 80263220 */ static void init(JKRHeap*);
|
||||
/* 80263228 */ static void *memalignB(int, u32);
|
||||
/* 80263260 */ static void free(void*);
|
||||
};
|
||||
|
||||
#endif /* C_MALLOC_H */
|
||||
|
||||
@@ -3,4 +3,17 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
s16 cM_rad2s(float);
|
||||
u16 U_GetAtanTable(float, float);
|
||||
s16 cM_atan2s(float, float);
|
||||
float cM_atan2f(float, float);
|
||||
void cM_initRnd(int, int, int);
|
||||
float cM_rnd(void);
|
||||
float cM_rndF(float);
|
||||
float cM_rndFX(float);
|
||||
void cM_initRnd2(int, int, int);
|
||||
float cM_rnd2(void);
|
||||
float cM_rndF2(float);
|
||||
float cM_rndFX2(float);
|
||||
|
||||
#endif /* C_MATH_H */
|
||||
|
||||
@@ -3,4 +3,27 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef struct node_class {
|
||||
struct node_class* mpPrevNode;
|
||||
void* mpData;
|
||||
struct node_class* mpNextNode;
|
||||
} node_class;
|
||||
|
||||
void cNd_Join(node_class* pA, node_class* pB);
|
||||
int cNd_LengthOf(node_class* pNode);
|
||||
node_class* cNd_First(node_class* pNode);
|
||||
node_class* cNd_Last(node_class* pNode);
|
||||
node_class* cNd_Order(node_class* pNode, int idx);
|
||||
void cNd_SingleCut(node_class* pNode);
|
||||
void cNd_Cut(node_class* pNode);
|
||||
void cNd_Addition(node_class* pA, node_class* pB);
|
||||
void cNd_Insert(node_class* pA, node_class* pB);
|
||||
void cNd_SetObject(node_class* pNode, void* pData);
|
||||
void cNd_ClearObject(node_class* pNode);
|
||||
void cNd_ForcedClear(node_class* pNode);
|
||||
void cNd_Create(node_class* pNode, void* pData);
|
||||
|
||||
#define NODE_GET_PREV(pNode) (pNode ? pNode->mpPrevNode : NULL)
|
||||
#define NODE_GET_NEXT(pNode) (pNode ? pNode->mpNextNode : NULL)
|
||||
|
||||
#endif /* C_NODE_H */
|
||||
|
||||
@@ -2,5 +2,12 @@
|
||||
#define C_NODE_ITER_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_node.h"
|
||||
|
||||
typedef int (*cNdIt_MethodFunc)(node_class* pNode, void* pUserData);
|
||||
int cNdIt_Method(node_class* pNode, cNdIt_MethodFunc pMethod, void* pUserData);
|
||||
|
||||
typedef void* (*cNdIt_JudgeFunc)(node_class* pNode, void* pUserData);
|
||||
void* cNdIt_Judge(node_class* pNode, cNdIt_JudgeFunc pJudge, void* pUserData);
|
||||
|
||||
#endif /* C_NODE_ITER_H */
|
||||
|
||||
@@ -3,4 +3,28 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef int (*cPhs__Handler)(void*);
|
||||
|
||||
enum cPhs__Step {
|
||||
cPhs_ZERO_e = 0x00,
|
||||
// names from Wind Waker debug strings
|
||||
cPhs_COMPLEATE_e = 0x04,
|
||||
cPhs_ERROR_e = 0x05,
|
||||
cPhs_NEXT_e = 0x06,
|
||||
};
|
||||
|
||||
typedef struct request_of_phase_process_class {
|
||||
cPhs__Handler* mpHandlerTable;
|
||||
int mPhaseStep;
|
||||
} request_of_phase_process_class;
|
||||
|
||||
void cPhs_Reset(request_of_phase_process_class* pPhase);
|
||||
void cPhs_Set(request_of_phase_process_class* pPhase, cPhs__Handler* pHandlerTable);
|
||||
void cPhs_UnCompleate(request_of_phase_process_class* pPhase);
|
||||
int cPhs_Compleate(request_of_phase_process_class* pPhase);
|
||||
int cPhs_Next(request_of_phase_process_class* pPhase);
|
||||
int cPhs_Do(request_of_phase_process_class* pPhase, void* pUserData);
|
||||
int cPhs_Handler(request_of_phase_process_class* pPhase, cPhs__Handler* pHandlerTable,
|
||||
void* pUserData);
|
||||
|
||||
#endif /* C_PHASE_H */
|
||||
|
||||
@@ -2,5 +2,23 @@
|
||||
#define C_TAG_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_list.h"
|
||||
#include "SSystem/SComponent/c_node.h"
|
||||
#include "SSystem/SComponent/c_tree.h"
|
||||
|
||||
typedef struct create_tag_class {
|
||||
node_class mpNode;
|
||||
void* mpTagData;
|
||||
s8 mbIsUse;
|
||||
} create_tag_class;
|
||||
|
||||
int cTg_IsUse(create_tag_class* pTag);
|
||||
int cTg_SingleCutFromTree(create_tag_class* pTag);
|
||||
int cTg_AdditionToTree(node_lists_tree_class* pTree, int listIdx, create_tag_class* pTag);
|
||||
int cTg_InsertToTree(node_lists_tree_class* pTree, int listIdx, create_tag_class* pTag, int idx);
|
||||
node_class* cTg_GetFirst(node_list_class* pTag);
|
||||
int cTg_SingleCut(create_tag_class* pTag);
|
||||
int cTg_Addition(node_list_class* pList, create_tag_class* pTag);
|
||||
void cTg_Create(create_tag_class* pTag, void* pData);
|
||||
|
||||
#endif /* C_TAG_H */
|
||||
|
||||
@@ -2,5 +2,21 @@
|
||||
#define C_TAG_ITER_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_node_iter.h"
|
||||
#include "SSystem/SComponent/c_tag.h"
|
||||
|
||||
typedef struct method_filter {
|
||||
cNdIt_MethodFunc mpMethodFunc;
|
||||
void* mpUserData;
|
||||
} method_filter;
|
||||
|
||||
typedef struct judge_filter {
|
||||
cNdIt_JudgeFunc mpJudgeFunc;
|
||||
void* mpUserData;
|
||||
} judge_filter;
|
||||
|
||||
int cTgIt_MethodCall(create_tag_class* pTag, method_filter* pMethodFilter);
|
||||
void* cTgIt_JudgeFilter(create_tag_class* pTag, judge_filter* pJudgeFilter);
|
||||
|
||||
|
||||
#endif /* C_TAG_ITER_H */
|
||||
|
||||
@@ -2,5 +2,17 @@
|
||||
#define C_TREE_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_list.h"
|
||||
#include "SSystem/SComponent/c_node.h"
|
||||
|
||||
typedef struct node_lists_tree_class {
|
||||
node_list_class* mpLists;
|
||||
int mNumLists;
|
||||
} node_lists_tree_class;
|
||||
|
||||
int cTr_SingleCut(node_class* pNode);
|
||||
int cTr_Addition(node_lists_tree_class* pTree, int listIdx, node_class* pNode);
|
||||
int cTr_Insert(node_lists_tree_class* pTree, int listIdx, node_class* pNode, int idx);
|
||||
void cTr_Create(node_lists_tree_class* pTree, node_list_class* pLists, int numLists);
|
||||
|
||||
#endif /* C_TREE_H */
|
||||
|
||||
@@ -2,5 +2,11 @@
|
||||
#define C_TREE_ITER_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "SSystem/SComponent/c_node_iter.h"
|
||||
#include "SSystem/SComponent/c_tree.h"
|
||||
|
||||
int cTrIt_Method(node_lists_tree_class* pTree, cNdIt_MethodFunc pJudgeFunc, void* pUserData);
|
||||
void* cTrIt_Judge(node_lists_tree_class* pTree, cNdIt_JudgeFunc pJudgeFunc, void* pUserData);
|
||||
|
||||
|
||||
#endif /* C_TREE_ITER_H */
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef MSL_MATH_H_
|
||||
#define MSL_MATH_H_
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
f64 acos(f64);
|
||||
f32 acosf(f32);
|
||||
f64 asin(f64);
|
||||
f64 atan(f64);
|
||||
f64 atan2(f64);
|
||||
f64 ceil(f64);
|
||||
f64 copysign(f64, f64);
|
||||
f64 cos(f64);
|
||||
f32 cosf(f32);
|
||||
f64 exp(f64);
|
||||
|
||||
extern f32 __fabsf(f32);
|
||||
inline f64 fabs(f64 f) {
|
||||
return __fabsf(f);
|
||||
}
|
||||
inline f64 fabsf2(f32 f) {
|
||||
return __fabsf(f);
|
||||
}
|
||||
inline f32 fabsf(f32 f) {
|
||||
return fabsf2(f);
|
||||
}
|
||||
|
||||
f64 floor(f64);
|
||||
f64 fmod(f64, f64);
|
||||
inline f32 fmodf(f32 f1, f32 f2) {
|
||||
return fmod(f1, f2);
|
||||
}
|
||||
inline s32 fpclassify(f32 f) {
|
||||
u32 var = *(u32*)&f;
|
||||
switch (var & 0x7F800000) {
|
||||
case 0x7F800000:
|
||||
if ((var & 0x7FFFFF) != 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
case 0:
|
||||
if ((var & 0x7FFFFF) != 0) {
|
||||
return 5;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
f64 frexp(f64, s32*);
|
||||
f64 ldexp(f64, s32);
|
||||
f64 modf(f64, f64*);
|
||||
f64 pow(f64, f64);
|
||||
f64 sin(f64);
|
||||
f32 sinf(f32);
|
||||
f64 sqrt(f64);
|
||||
f64 tan(f64);
|
||||
f32 tanf(f32);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MSL_STRING_H_
|
||||
#define MSL_STRING_H_
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
void memcpy(void*, const void*, s32);
|
||||
void* memset(void* dest, int ch, u32 count);
|
||||
char* strrchr(const char* s, int c);
|
||||
char* strchr(const char* s, int c);
|
||||
int strncmp(const char* s1, const char* s2, u32 n);
|
||||
int strcmp(const char* s1, const char* s2);
|
||||
char* strcat(char* dest, const char* source);
|
||||
char* strncpy(char* dest, const char* source, u32 n);
|
||||
char* strcpy(char* dest, const char* source);
|
||||
u32 strlen(const char* s);
|
||||
int tolower(int);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef MTX_VEC_H_
|
||||
#define MTX_VEC_H_
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct Vec {
|
||||
float x, y, z;
|
||||
float GetX() const { return x; }
|
||||
float GetY() const { return y; }
|
||||
float GetZ() const { return z; }
|
||||
float getXDiff(const Vec* other) const { return x - other->x; }
|
||||
float getYDiff(const Vec* other) const { return y - other->y; }
|
||||
float getZDiff(const Vec* other) const { return z - other->z; }
|
||||
};
|
||||
|
||||
struct Quaternion {
|
||||
float x, y, z, w;
|
||||
};
|
||||
|
||||
typedef float Mtx[3][4];
|
||||
|
||||
extern "C" {
|
||||
void PSMTXIdentity(Mtx matrix);
|
||||
void PSMTXCopy(const Mtx src, Mtx dst);
|
||||
void PSMTXConcat(const Mtx src_a, const Mtx src_b, Mtx dst);
|
||||
u32 PSMTXInverse(const Mtx src, Mtx dst);
|
||||
void PSMTXRotRad(Mtx matrix, u8 axis, float rad);
|
||||
void PSMTXRotTrig(Mtx matrix, u8 axis, float sin, float cos);
|
||||
double __PSMTXRotAxisRadInternal(double param_1, double param_2, int param_3, int param_4);
|
||||
void PSMTXRotAxisRad(Mtx matrix, const Vec* axis, float rad);
|
||||
void PSMTXTrans(Mtx matrix, float x_trans, float y_trans, float z_trans);
|
||||
void PSMTXTransApply(const Mtx src, Mtx dst, float x, float y, float z);
|
||||
void PSMTXScale(Mtx matrix, float x_scale, float y_scale, float z_scale);
|
||||
void PSMTXScaleApply(const Mtx src, Mtx dst, float x_scale, float y_scale, float z_scale);
|
||||
void PSMTXQuat(Mtx matrix, const Quaternion* quat);
|
||||
void C_MTXLookAt(Mtx param_1, const Vec* param_2, const Vec* param_3, const Vec* param_4);
|
||||
void C_MTXLightPerspective(Mtx matrix, float fov_y, float aspect, float scale_s, float scale_t,
|
||||
float trans_s, float trans_t);
|
||||
void C_MTXLightOrtho(Mtx matrix, float top, float bottom, float left, float right, float scale_s,
|
||||
float scale_t, float trans_s, float trans_t);
|
||||
void PSMTXMultVec(const Mtx matrix, const Vec* src, Vec* dst);
|
||||
void PSMTXMultVecArray(const Mtx matrix, const Vec* src, Vec* dst, u32 count);
|
||||
void PSMTXMultVecSR(const Mtx matrix, const Vec* src, Vec* dst);
|
||||
void PSMTXMultVecArraySR(const Mtx matrix, const Vec* src, Vec* dst, u32 count);
|
||||
void C_MTXPerspective(Mtx matrix, float fov_y, float aspect, float near, float far);
|
||||
void C_MTXOrtho(Mtx matrix, float top, float bottom, float left, float right, float near,
|
||||
float far);
|
||||
void PSVECAdd(const Vec* src_a, const Vec* src_b, Vec* dst);
|
||||
void PSVECSubtract(const Vec* a, const Vec* b, Vec* dst);
|
||||
void PSVECScale(const Vec* src, Vec* dst, float scale);
|
||||
void PSVECNormalize(const Vec* src, Vec* dst);
|
||||
float PSVECSquareMag(const Vec* vec);
|
||||
float PSVECMag(const Vec* data);
|
||||
float PSVECDotProduct(const Vec* a, const Vec* b);
|
||||
void PSVECCrossProduct(const Vec* src_a, const Vec* src_b, Vec* dst);
|
||||
void C_VECHalfAngle(const Vec* incident, const Vec* line_of_sight, Vec* out_half);
|
||||
void C_VECReflect(const Vec* src, const Vec* surface_normal, Vec* dst);
|
||||
float PSVECSquareDistance(const Vec* a, const Vec* b);
|
||||
float PSVECDistance(const Vec* a, const Vec* b);
|
||||
void PSQUATMultiply(const Quaternion* src_a, const Quaternion* src_b, Quaternion* dst);
|
||||
void C_QUATRotAxisRad(Quaternion* quat, const Vec* axis, float rad);
|
||||
void C_QUATSlerp(const Quaternion* p, const Quaternion* q, Quaternion* r, float t);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user