Skip to content

Commit 3835ff7

Browse files
authored
Add/update symbols for main function
1 parent 1110dd1 commit 3835ff7

File tree

5 files changed

+176
-90
lines changed

5 files changed

+176
-90
lines changed

config/symbol_addrs.txt

+71-9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ _start = 0x100008; // type:func
22
_exit = 0x1000B8; // type:func
33

44

5+
// UKNOWN FILE
6+
UpdateSave__FP4SAVE = 0x18bdc8; // type:func
7+
8+
g_save = 0x264A40;
9+
10+
511
// P2/splice/spliceutils.cpp
612
StartupSplice__Fv = 0x11BF70; // type:func
713
ShutdownSplice__Fv = 0x11C040; // type:func
@@ -51,6 +57,11 @@ SetHorizontalJust__8CTextBox2JH = 0x137260; // type:func
5157
SetVerticalJust__8CTextBox2JV = 0x137268; // type:func
5258
_GLOBAL_$I$InitBei__FP3BEIP3CLQffi = 0x137270; // type:func
5359

60+
61+
// P2/cd.c
62+
CdPath__FPcT0i = 0x140b60; // type:func
63+
64+
5465
// P2/chkpnt.c
5566
ResetChkmgrCheckpoints__FP6CHKMGR = 0x140D90; // type:func
5667
SaveChkmgrCheckpoint__FP6CHKMGR3OIDT1 = 0x140E10; // type:func
@@ -87,6 +98,12 @@ g_clock = 0x261858; // size:0x1c
8798
s_tickLastRaw = 0x284b30; // size:0x4
8899

89100

101+
// P2/cm.c
102+
SetupCm__FP2CM = 0x144270; // type:func
103+
104+
g_pcm = 0x261990; // size:0x4
105+
106+
90107
// P2/difficulty.c
91108
PdifficultyEnsureSw = 0x1519E0; // type:func
92109
OnDifficultyGameLoad = 0x151A68; // type:func
@@ -120,6 +137,8 @@ ClearPendingFrame__FP3FRM = 0x15EFE8; // type:func
120137
FlushFrames__Fi = 0x15F210; // type:func
121138
BlendPrevFrame__Fv = 0x15F320; // type:func
122139

140+
g_cframe = 0x2622cc; // size:0x4
141+
123142

124143
// P2/game.c
125144
StartupGame__Fv = 0x160070; // type:func
@@ -137,24 +156,26 @@ DefeatBossFromWid = 0x1603E8; // type:func
137156
UnlockEndgameCutscenesFromFgs = 0x1604B8; // type:func
138157
PlayEndingFromCompletionFlags = 0x160578; // type:func
139158

140-
InitGameState = 0x1605E8; // type:func
159+
InitGameState__FP2GS = 0x1605E8; // type:func
141160

142161
FUN_00160650 = 0x160650; // type:func
143162

144-
SetupGame = 0x160690; // type:func
145-
UpdateGameState = 0x1607D0; // type:func
163+
SetupGame__FPci = 0x160690; // type:func
164+
UpdateGameState__Ff = 0x1607D0; // type:func
165+
146166
LsFromWid = 0x160810; // type:func
147167
GrflsFromWid = 0x160850; // type:func
148-
UnloadGame = 0x160880; // type:func
149-
RetryGame = 0x1608E0; // type:func
168+
169+
UnloadGame__Fv = 0x160880; // type:func
170+
RetryGame__Fv = 0x1608E0; // type:func
150171
StartGame__Fv = 0x160918; // type:func
151172

152173
FUN_00160948 = 0x160948; // type:func
153174
calculate_percent_completion = 0x160B28; // type:func
154175

155-
SetCcharm = 0x160C48; // type:func
156-
FCharmAvailable = 0x160C58; // type:func
157-
PfLookupDialog = 0x160CA0; // type:func
176+
SetCcharm__Fi = 0x160C48; // type:func
177+
FCharmAvailable__Fv = 0x160C58; // type:func
178+
PfLookupDialog__FP2LS3OID = 0x160CA0; // type:func
158179

159180
clr_8_bytes_1 = 0x160CC8; // type:func
160181
FUN_00160ce8 = 0x160CE8; // type:func
@@ -193,13 +214,27 @@ AddFcht__Fi = 0x16F430; // type:func
193214
Chetkido__Fv = 0x16F478; // type:func
194215
StartupCodes__Fv = 0x16F588; // type:func
195216

217+
// size of g_joy might be wrong
218+
g_joy = 0x262C70; // size:0xc4
219+
196220

197221
// P2/main.c
198222
main = 0x185758; // type:func
223+
main_epilogue = 0x1858f8; // type:func
199224
StartupVU0__Fv = 0x185A58; // type:func
200225
StartupVU1__Fv = 0x185AC8; // type:func
201226
Startup__Fv = 0x185B38; // type:func
202227

228+
g_chpzArgs = 0x264834; // size:0x4
229+
g_aphzArgs = 0x264838; // size:0x4
230+
231+
232+
// P2/mpeg.c
233+
ExecuteOids__5CMpeg = 0x18f148; // type:func
234+
235+
g_mpeg = 0x269A00;
236+
237+
203238
// P2/phasemem.c
204239
SetPhase__F5PHASE = 0x191E70; // type:func
205240
ClearPhase__Fv = 0x191EB0; // type:func
@@ -215,12 +250,34 @@ End__5CProg = 0x193300; // type:func
215250
Draw__5CProg = 0x193318; // type:func
216251

217252

253+
// P2/render.c
254+
RenderSw__FP2SWP2CM = 0x19d6c0; // type:func
255+
DrawSw__FP2SWP2CM = 0x19DC98; // type:func
256+
257+
218258
// P2/steppower.c
219259
SetFsp__F3FSP = 0x1D29C8; // type:func
220260
UpdateJtActivePowerUp__FP2JTP3JOY = 0x1d2bb8; // type:func
221261
IRotatePowerUp__FP3JOYiiPi = 0x1d3100; // type:func
222262

223263

264+
// P2/sw.c
265+
g_psw = 0x275710; // size:0x4
266+
267+
268+
// P2/transition.c
269+
Execute__11CTransition = 0x1e4ea8; // type:func
270+
271+
g_transition = 0x275af0;
272+
273+
274+
// P2/ui.c
275+
UpdateUi__FP2UI = 0x1e9108; // type:func
276+
DrawUi__Fv = 0x1e9648; // type:func
277+
RenderUi__Fv = 0x1e9668; // type:func
278+
279+
g_ui = 0x275BC0;
280+
224281
// P2/util.c
225282
RadNormalize__Ff = 0x1EA408; // type:func
226283
GLimitAbs = 0x1EA480; // type:func
@@ -266,8 +323,13 @@ FCalculateMuzzleVelocityAngle = 0x1EE290; // type:func
266323
LimitVectorLength = 0x1EE2B0; // type:func
267324

268325

326+
// P2/wipe.c
327+
g_pwipe = 0x275f80;
328+
g_wipe = 0x275f84;
329+
330+
269331
// sce/ee/gcc/src/gcc/libgcc2.c
270-
__main = 0x1fae18; // type:func
332+
__main__Fv = 0x1fae18; // type:func
271333

272334

273335
// sce/rand.c

include/transition.h

+56-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,62 @@
55
#define TRANSITION_H
66

77
#include "common.h"
8+
#include <game.h>
89

9-
// ...
10+
/**
11+
* @brief Transition flags.
12+
*/
13+
enum FTRANS {
14+
FTRANS_None = 0,
15+
FTRANS_Checkpoint = 1,
16+
FTRANS_RetryWorld = 2,
17+
FTRANS_ClearGame = 4,
18+
FTRANS_SameWorld = 8,
19+
FTRANS_ShowLives = 16
20+
};
21+
22+
/**
23+
* @brief Transition flags integer type.
24+
*/
25+
typedef int GRFTRANS;
26+
27+
/**
28+
* @brief Transition data
29+
*
30+
* Responsible for holding data bout a level transition.
31+
*/
32+
struct TRANS
33+
{
34+
uint32_t fSet;
35+
struct LevelTableStruct *pchzWorld; // Current file thats loading struct
36+
OID oidWarp; // Checkpoint Warps
37+
OID trans_mod_flags;
38+
GRFTRANS grftrans; // Lost all lives flags
39+
};
40+
41+
/**
42+
* @brief Transition
43+
*/
44+
class CTransition
45+
{
46+
protected:
47+
char *m_pchzWorld; // This is the ptr to enc level sector offset and size in memory
48+
OID m_oidWarp; // Which checkpoint you spawn at when you start a level
49+
OID m_oidWarpContext;
50+
51+
public:
52+
GRFTRANS grftrans; // Flags that affect level loading, one of them checks if you lost all lives when you die.
53+
char m_achzWorldCur[64]; // File description contents.
54+
int m_fPending; // Basically like a level pending flag.
55+
56+
// Reloads the current level. The value of FTRANS affects the load.
57+
void ResetWorld(FTRANS ftrans);
58+
59+
// Sets the conditions on the level if you died or loading a level
60+
void Set(char *pchzWorld, OID oidWarp, OID oidWarpContext, GRFTRANS grftrans);
61+
62+
// Executes the conditions from CTransition::Set by setting some engine vaules to default and loading the level file
63+
void Execute();
64+
};
1065

1166
#endif // TRANSITION_H

include/wipe.h

+38-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,44 @@
55
#define WIPE_H
66

77
#include "common.h"
8+
#include <transition.h>
89

9-
// ...
10+
/**
11+
* @brief Wipe Kind
12+
*/
13+
enum WIPEK
14+
{
15+
WIPEK_Fade = 0,
16+
WIPEK_Keyhole = 1,
17+
WIPEK_WorldMap = 2,
18+
WIPEK_Frozen = 3,
19+
WIPEK_Max = 4
20+
};
21+
22+
/**
23+
* @brief Wipe State
24+
*/
25+
enum WIPES
26+
{
27+
WIPES_Idle = 0,
28+
WIPES_WipingOut = 1,
29+
WIPES_Black = 2,
30+
WIPES_WipingIn = 3,
31+
WIPES_Max = 4
32+
};
33+
34+
/**
35+
* @brief Wipe
36+
*/
37+
struct WIPE
38+
{
39+
WIPES wipes;
40+
float tWipes;
41+
float uBlack;
42+
TRANS trans;
43+
WIPEK wipek;
44+
TRANS transButton;
45+
WIPEK wipekButton;
46+
};
1047

1148
#endif // WIPE_H

src/P2/game.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,34 @@ INCLUDE_ASM(const s32, "P2/game", UnlockEndgameCutscenesFromFgs);
2929

3030
INCLUDE_ASM(const s32, "P2/game", PlayEndingFromCompletionFlags);
3131

32-
INCLUDE_ASM(const s32, "P2/game", InitGameState);
32+
INCLUDE_ASM(const s32, "P2/game", InitGameState__FP2GS);
3333

3434
INCLUDE_ASM(const s32, "P2/game", FUN_00160650);
3535

36-
INCLUDE_ASM(const s32, "P2/game", SetupGame);
36+
INCLUDE_ASM(const s32, "P2/game", SetupGame__FPci);
3737

38-
INCLUDE_ASM(const s32, "P2/game", UpdateGameState);
38+
INCLUDE_ASM(const s32, "P2/game", UpdateGameState__Ff);
3939

4040
INCLUDE_ASM(const s32, "P2/game", LsFromWid);
4141

4242
INCLUDE_ASM(const s32, "P2/game", GrflsFromWid);
4343

44-
INCLUDE_ASM(const s32, "P2/game", UnloadGame);
44+
INCLUDE_ASM(const s32, "P2/game", UnloadGame__Fv);
4545

46-
INCLUDE_ASM(const s32, "P2/game", RetryGame);
46+
INCLUDE_ASM(const s32, "P2/game", RetryGame__Fv);
4747

4848
INCLUDE_ASM(const s32, "P2/game", StartGame__Fv);
4949

5050
INCLUDE_ASM(const s32, "P2/game", FUN_00160948);
5151

5252
INCLUDE_ASM(const s32, "P2/game", calculate_percent_completion);
5353

54-
INCLUDE_ASM(const s32, "P2/game", SetCcharm);
54+
INCLUDE_ASM(const s32, "P2/game", SetCcharm__Fi);
5555

56-
INCLUDE_ASM(const s32, "P2/game", FCharmAvailable);
56+
INCLUDE_ASM(const s32, "P2/game", FCharmAvailable__Fv);
5757
INCLUDE_ASM(const s32, "P2/game", func_00160C90);
5858

59-
INCLUDE_ASM(const s32, "P2/game", PfLookupDialog);
59+
INCLUDE_ASM(const s32, "P2/game", PfLookupDialog__FP2LS3OID);
6060

6161
INCLUDE_ASM(const s32, "P2/game", clr_8_bytes_1);
6262

src/P2/main.c

+3-71
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,11 @@
11
#include "common.h"
22
#include <game.h>
33

4-
//extern g_chpzArgs;
5-
//extern g_aphzArgs;
4+
// extern g_chpzArgs;
5+
// extern g_aphzArgs;
66

77
INCLUDE_ASM(const s32, "P2/main", main);
8-
/*int main(int cphzArgs, char* aphzArgs[])
9-
{
10-
__main(); // from libgcc2
11-
12-
g_chpzArgs = cphzArgs;
13-
g_aphzArgs = aphzArgs;
14-
15-
Startup();
16-
17-
while (true)
18-
{
19-
// Check if g_mpeg has an mpeg queued to be played
20-
if ((g_mpeg.oid_1 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
21-
{
22-
////FlushFrames(1);
23-
g_mpeg.ExecuteOids();
24-
}
25-
26-
// Check if g_transition has a pending transition
27-
if (g_transition.m_fPending != 0)
28-
{
29-
////FlushFrames(1);
30-
g_transition.Execute();
31-
}
32-
33-
// Check AGAIN if g_mpeg has an mpeg queued (in case two were queued back-to-back)
34-
if ((g_mpeg.oid_2 != OID_Unknown) && (g_wipe.wipes != WIPES_Idle))
35-
{
36-
////FlushFrames(1);
37-
g_mpeg.ExecuteOids();
38-
}
39-
40-
// Call update functions
41-
UpdateJoy(&g_joy);
42-
UpdateCodes();
43-
////UpdateSave(&g_save);
44-
UpdateUi(&g_ui);
45-
UpdateGameState(g_clock.dt);
46-
47-
// Render and draw current frame
48-
if (g_psw != NULL)
49-
{
50-
// Prepare to render frame
51-
SetupCm(g_pcm);
52-
OpenFrame();
53-
MarkClockTick(&g_clock);
54-
55-
// This ends up calling UpdateSw down the line
56-
void* pv = g_psw + 0x54;
57-
if (pv != NULL)
58-
{
59-
////(*pv)(g_clock.dt);
60-
}
61-
62-
// Render frame
63-
RenderSw(g_psw, g_pcm);
64-
RenderUi();
65-
66-
// Draw frame
67-
DrawSw(g_psw, g_pcm);
68-
DrawUi();
69-
70-
CloseFrame();
71-
}
72-
73-
// Increment the global frame counter
74-
g_cframe += 1;
75-
}
76-
}*/
8+
INCLUDE_ASM(const s32, "P2/main", main_epilogue);
779

7810
INCLUDE_ASM(const s32, "P2/main", StartupVU0__Fv);
7911

0 commit comments

Comments
 (0)