Skip to content

Commit 2505aaa

Browse files
committed
no more hook files, add test files
1 parent a7584d4 commit 2505aaa

File tree

15 files changed

+122
-46
lines changed

15 files changed

+122
-46
lines changed

include/ctr/nd.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
#include <ctr/macros.h>
55
#include <ctr/math.h>
66

7-
void ND_Music_SetIntro();
87
void ND_LOAD_XnfFile(char* filename, u32 address, char* dummy);
98
s32 ND_SquareRoot0_stub(s32 n);
10-
s32 ND_MATH_VectorLength(const SVec3* vector);
119
int ND_printf(const char* format, ...);
1210
void ND_LOAD_InitCD();
1311

12+
/* MATH */
13+
s32 ND_MATH_Sin(u32 angle);
14+
s32 ND_MATH_Cos(u32 angle);
15+
s32 ND_MATH_Sqrt(u32 n, u32 shift);
16+
void ND_MATH_GetInverseMatrixTransformation(Matrix* out, const Matrix* matrix);
17+
s32 ND_MATH_VectorLength(const SVec3* vector);
18+
void ND_MATH_VectorNormalize(SVec3* vector);
19+
void ND_MATH_CombineMatrixTransformation(Matrix* out, const Matrix* m, const Matrix* n);
20+
void ND_MATH_MatrixMultiplication(Matrix* out, const Matrix* m, const Matrix* n);
21+
1422
#endif

include/ctr/test.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef TEST_H
2+
#define TEST_H
3+
4+
#include <ctr/macros.h>
5+
6+
void LoadTestPatches();
7+
8+
#define TEST_MATH_IMPL
9+
10+
#ifdef TEST_MATH_IMPL
11+
void TEST_MATH_Sin(u32 angle, s32 res);
12+
#else
13+
#define TEST_MATH_Sin(angle, res)
14+
#endif
15+
16+
#endif

rewrite/buildList.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,4 @@ common, header, 0x8000B0B8, 0x0, src/hooks/dll/load_decomp.c
44

55
// decomp files
66
common, DLL, 0x80200000, 0x0, src/math.c src/prim.c, DECOMP.BIN
7-
8-
// decomp hooks
9-
common, exe, ND_MATH_Sin, 0x0, src/hooks/math/Sin.s
10-
common, exe, ND_MATH_Cos, 0x0, src/hooks/math/Cos.s
11-
common, exe, ND_MATH_FastSqrt, 0x0, src/hooks/math/Sqrt.s
12-
common, exe, ND_MATH_GetInverseMatrixTransformation, 0x0, src/hooks/math/GetInverseMatrixTransformation.s
13-
common, exe, ND_MATH_VectorLength, 0x0, src/hooks/math/VectorLength.s
14-
common, exe, ND_MATH_VectorNormalize, 0x0, src/hooks/math/VectorNormalize.s
15-
common, exe, ND_MATH_MatrixMul, 0x0, src/hooks/math/CombineMatrixTransformation.s
16-
common, exe, ND_MatrixRotate, 0x0, src/hooks/math/MatrixMultiplication.s
7+
common, DLL, 0x80600000, 0x0, src/tests/test.c, TESTS.BIN
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
#include <ctr/macros.h>
12
#include <ctr/nd.h>
3+
#include <ctr/test.h>
24

35
void LoadDecomp()
46
{
5-
const u32 address = 0x80200000;
7+
const u32 testAddr = 0x80600000;
8+
const u32 decompAddr = 0x80200000;
69
char dummy;
710
ND_LOAD_InitCD();
8-
ND_LOAD_XnfFile("\\DECOMP.BIN;1", address, &dummy);
11+
ND_LOAD_XnfFile("\\TESTS.BIN;1", testAddr, &dummy);
12+
LoadTestPatches();
13+
ND_LOAD_XnfFile("\\DECOMP.BIN;1", decompAddr, &dummy);
914
}

rewrite/src/hooks/math/CombineMatrixTransformation.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

rewrite/src/hooks/math/Cos.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

rewrite/src/hooks/math/GetInverseMatrixTransformation.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

rewrite/src/hooks/math/MatrixMultiplication.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

rewrite/src/hooks/math/Sin.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

rewrite/src/hooks/math/Sqrt.s

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)