Decompile Game_16#167
Conversation
Yanis002
left a comment
There was a problem hiding this comment.
just some ctor stuff, otherwise looks good to me
| func_ov016_0211fab8(mUnk_00c, (void (*)()) _ZN4Game13func_0202cf44Ev, this, 0); | ||
| _ZN11FadeControlC2Ev(&mFadeControl); |
There was a problem hiding this comment.
this looks a little bit wrong, C2 is a constructor used to initialise a base class when a class is derived from another, I think this ctor is probably like ARM Game::Game() : mModeId(1), mPrevModeId(1), mMode(NULL), mUnk_00c(Game::func_0202cf44, this, 0) {...}
mUnk_00c must be defined as:
typedef void (*UnkCallback)();
class Game_0c {
public:
Game_0c(UnkCallback callback, void* param2, unk32 param3); // func_ov016_0211fab8
};then for mFadeControl the type must be FadeControl, the class is already existing iirc, also Game::func_0202cf44 must be static, looks like it's a static function taking Game as a parameter according to what ghidra shows me
idk how much you know about c++ but basically I think this requires a ctor init list (iirc that's how it's called) to initialize members before those ctor calls
btw feel free to join the discord server if you have any questions
There was a problem hiding this comment.
I was curious about the fadecontrol stuff so: https://decomp.me/scratch/XfIou, I'm not sure if it's supposed to be derived or if the symbol is simply mislabeled, either way that scratch should be more explicit than my previous explanations
if you have any questions feel free to ask of course
Address Yanis' review comments: - Make Game::func_0202cf44 static with Game* parameter to allow passing as callback pointer - Replace raw mUnk_00c array with Game_0c class containing constructor - Add Game_0c constructor with inline initialization calling func_ov016_0211fab8 - Add FadeControl_Derived1 class for mFadeControl member - Use C++ initializer list in Game constructor for mModeId, mPrevModeId, mMode, mUnk_00c, and mFadeControl
Report for eur (0bb7400 - 5b73154)📈 Matched code: 2.77% (+0.01%, +228 bytes) ✅ 3 new matches
🥀 1 broken match
Report for usa (0bb7400 - 5b73154)📈 Matched code: 2.75% (+0.01%, +228 bytes) ✅ 3 new matches
🥀 1 broken match
|
|
|
||
| void FadeControl::Register() {} | ||
| void FadeControl::Unregister() {} | ||
| FadeControl::FadeControl() {} |
There was a problem hiding this comment.
this change is confusing me a bit, is it not building with that defined in the source? 🤔
There was a problem hiding this comment.
yeah, the build was failing with it. I'm not sure why but I added it back in the last commit
- Use PAD macro in Game_0c instead of unk8 pad[] - Pass 'this' instead of 'pad' to func_ov016_0211fab8 - Add FadeControl constructor that calls _ZN11FadeControlC2Ev - FadeControl_Derived1 now uses empty constructor (base class ctor called automatically) - Update mUnk_00c.pad to mUnk_00c.pad_0x00 (PAD macro creates named member) - Add types.h include to nds/system.h
Yanis002
left a comment
There was a problem hiding this comment.
last thing I promise 🙏
- Removed _ZN11FadeControlC2Ev call from FadeControl constructor - FadeControl now has an empty constructor (called automatically by derived classes) - FadeControl_Derived1 uses empty constructor which calls base class ctor
AetiasHax
left a comment
There was a problem hiding this comment.
One quick thing before merging, there's a broken match as you can see in the decomp.dev comment above. I put some instructions in my review comment.
Changed mangled name from _ZN4Game13func_0202cf44Ev to _ZN4Game13func_0202cf44EPS_ to reflect the function becoming static with a Game* parameter.
Closes #105
First PR on the project, let me know if anything needs fixing!