-
Notifications
You must be signed in to change notification settings - Fork 52
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
decompile func_us_8018C90C #1634
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes needed but overall it looks promising.
We found that whenever we had to use an array (e.g. D_us_8019AF2A[]
) to obtain a match, the field will most likely be part of a struct
. I think it is safe to assume that g_Statues
, D_us_8019AF2A
and probably D_us_8019AF2C
too are part of the same struct. I am not sure if g_CutsceneFlags
is also part of the same struct.
Unfortunately most of this stuff is guess work. Sometimes we might find the answer by observing recurring patterns on new overlays. Sometimes we get confirmation by cross-referencing multiple versions together (PSX, PSP and Saturn). Other times we are just at the mercy of what the compiler wants and we might never have a clear answer.
g_Player.padSim = PAD_RIGHT; | ||
} | ||
g_Player.D_80072EFC = 1; | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return; | |
break; |
Let's standardize the code a bit and put a break;
instead of a return;
at the end of every switch case. This would be especially useful for moddability in the future. My comment is also valid for the other return;
s
@@ -21,4 +21,50 @@ INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018B74C); | |||
|
|||
INCLUDE_ASM("boss/mar/nonmatchings/AFC4", EntityMariaCutscene); | |||
|
|||
INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018C90C); | |||
extern s32 D_80097400[]; | |||
extern u16 D_80180A60; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern u16 D_80180A60; | |
extern u16 D_80180A60[]; |
If you give a look at src/boss/mar/e_init.c
you will find that is an array. You get the hint from the InitializeEntity
implementation.
|
||
switch (self->step) { | ||
case 0: | ||
InitializeEntity(&D_80180A60); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InitializeEntity(&D_80180A60); | |
InitializeEntity(D_80180A60); |
Once D_80180A60
is declared as an array, you can remove the &
operator
@@ -21,4 +21,50 @@ INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018B74C); | |||
|
|||
INCLUDE_ASM("boss/mar/nonmatchings/AFC4", EntityMariaCutscene); | |||
|
|||
INCLUDE_ASM("boss/mar/nonmatchings/AFC4", func_us_8018C90C); | |||
extern s32 D_80097400[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what we call a "fake" symbol. It is a field that is part of g_unkGraphicsStruct
and it needs to become g_unkGraphicsStruct.unk0
.
You can get the hint by looking at build/us/bomar.map
:
0x00000000800973f8 g_unkGraphicsStruct = 0x800973f8
0x00000000800973fc D_800973FC = 0x800973fc
0x0000000080097400 D_80097400 = 0x80097400 👈 here
0x0000000080097408 D_80097408 = 0x80097408
that is just 8 bytes below g_unkGraphicsStruct
, right? g_unkGraphicsStruct
is of type unkGraphicsStruct
, which is big enough to incorporate D_80097400
. Sometimes we put comments in the struct like /* 0x80097400 */ s32 unk0;
, so doing a global search with CTRL+Shift+F on 80097400
will give you a hint as well, but do not count too much on that.
not sure where to put these externs, I didnt see a header file for this.
also, the
D_us_8019AF2A[0] ^= 1;
construct is sus for two reasons: