Skip to content

Commit f1aea9d

Browse files
committed
profiler disables LoadTestPatches
1 parent b4ec3a5 commit f1aea9d

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

rewrite/src/hooks/dll/load_decomp.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ void LoadDecomp()
77
{
88
const u32 testAddr = 0x80600000;
99
const u32 decompAddr = 0x80200000;
10+
const u32 profilerAddr = 0x80500000;
1011
char dummy;
12+
1113
ND_LOAD_InitCD();
12-
ND_LOAD_XnfFile("\\TESTS.BIN;1", testAddr, &dummy);
13-
LoadTestPatches();
14+
15+
#ifndef REWRITE_PROFILER
16+
ND_LOAD_XnfFile("\\TESTS.BIN;1", testAddr, &dummy);
17+
LoadTestPatches();
18+
#endif
19+
1420
ND_LOAD_XnfFile("\\DECOMP.BIN;1", decompAddr, &dummy);
1521

16-
#ifdef REWRITE_PROFILER // ctr/profiler.h
17-
const u32 profilerAddr = 0x80500000;
18-
ND_LOAD_XnfFile("\\PROFILER.BIN;1", profilerAddr, &dummy);
19-
LoadProfilerPatches();
22+
#ifdef REWRITE_PROFILER
23+
ND_LOAD_XnfFile("\\PROFILER.BIN;1", profilerAddr, &dummy);
24+
LoadProfilerPatches();
2025
#endif
2126
}

rewrite/src/profiler/benchmark.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ void RunTest_RW_COLL_PPTE_STACK()
2222
{
2323
COLL_ProjectPointToEdge(&out, &v1, &v2, &point);
2424
}
25+
26+
ND_printf("Done\n");
2527
}
2628

2729
void RunTest_ND_COLL_PPTE_STACK()
@@ -36,14 +38,13 @@ void RunTest_ND_COLL_PPTE_STACK()
3638
SVec3 v2 = {0xFD00, 0x2EC, 0xEA58};
3739
SVec3 point = {0xFD6F, 0x2F5, 0xEDCE};
3840

39-
// Revert the Hook from OG -> DECOMP
40-
PatchFunction_Beg((u32*)(&ND_COLL_ProjectPointToEdge));
41-
4241
// million
4342
for(int i = 0; i < 1000000; i++)
4443
{
4544
ND_COLL_ProjectPointToEdge(&out, &v1, &v2, &point);
4645
}
46+
47+
ND_printf("Done\n");
4748
}
4849

4950
void RunTest_RW_COLL_PPTE_SCRATCH()
@@ -74,6 +75,8 @@ void RunTest_RW_COLL_PPTE_SCRATCH()
7475
{
7576
COLL_ProjectPointToEdge(out, v1, v2, point);
7677
}
78+
79+
ND_printf("Done\n");
7780
}
7881

7982
void RunTest_ND_COLL_PPTE_SCRATCH()
@@ -99,14 +102,13 @@ void RunTest_ND_COLL_PPTE_SCRATCH()
99102
point->v[1] = 0x2F5;
100103
point->v[2] = 0xEDCE;
101104

102-
// Revert the Hook from OG -> DECOMP
103-
PatchFunction_Beg((u32*)(&ND_COLL_ProjectPointToEdge));
104-
105105
// million
106106
for(int i = 0; i < 1000000; i++)
107107
{
108108
ND_COLL_ProjectPointToEdge(out, v1, v2, point);
109109
}
110+
111+
ND_printf("Done\n");
110112
}
111113

112114
// Always run RW (rewrite) before OG (original)

rewrite/src/profiler/profiler.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ void RunTest()
131131
ND_EnterCriticalSection();
132132

133133
ND_ResetRCnt(0xf2000001);
134+
ND_printf("%d\n", ND_GetRCnt(0xf2000001));
134135
tests[testIndex].funcPtr();
135136
tests[testIndex].val = ND_GetRCnt(0xf2000001);
137+
ND_printf("%d\n", ND_GetRCnt(0xf2000001));
136138

137139
ND_ExitCriticalSection();
138140

0 commit comments

Comments
 (0)