Decompile Game_16 (#167)

* Game_16 OK

* Remove unnecessary FadeControl constructor definition

* Define HW_RESET_PARAMETER_BUF macro to replace hardcoded address

* Refactor Game constructor to use proper C++ initialization

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

* Fix Game constructor and FadeControl initialization

- 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

* Remove explicit call to mangled constructor symbol

- 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

* Update symbols.txt for func_0202cf44 signature change

Changed mangled name from _ZN4Game13func_0202cf44Ev to
_ZN4Game13func_0202cf44EPS_ to reflect the function becoming
static with a Game* parameter.
This commit is contained in:
Aurel
2026-05-23 17:10:58 +02:00
committed by GitHub
parent 0bb7400136
commit 51640eb100
6 changed files with 95 additions and 20 deletions
+39 -2
View File
@@ -1,4 +1,41 @@
#include "Game/Game.hpp"
Game::Game() {}
void Game::func_ov016_0211fd68() {}
#include <nds/system.h>
#include "GameStart/GameStart.hpp"
#include "Render/FadeController.hpp"
#include "System/OverlayManager.hpp"
extern "C" void func_0200d938(void *);
ARM Game::Game() :
mModeId(1),
mPrevModeId(1),
mMode(NULL),
mUnk_00c(Game::func_0202cf44, this, 0),
mFadeControl() {
mUnk_0f0 = 0;
mUnk_0f2 = 1;
mUnk_0f4 = 0;
mUnk_0f8 = 0;
mUnk_0fc = 0;
mUnk_0fe = 0;
mUnk_100 = false;
mUnk_101 = 0;
mUnk_102 = false;
mUnk_103 = 0;
}
ARM void Game::func_ov016_0211fd68() {
mFadeControl.Register();
mFadeControl.mUnk_20 = false;
gFadeController.func_0202d77c(&mFadeControl);
if (HW_RESET_PARAMETER_BUF == 2) {
gOverlayManager.LoadGameMode(1);
GameStart::func_ov008_02112e88();
gOverlayManager.UnloadGameMode();
mPrevModeId = 4;
mModeId = 3;
}
func_0200d938(mUnk_00c.pad_0x00);
}
+13 -13
View File
@@ -467,38 +467,38 @@ THUMB void Game::func_0202cf34() {
}
extern "C" void func_02017cd0();
ARM void Game::func_0202cf44() {
ARM void Game::func_0202cf44(Game *game) {
while (true) {
if (mUnk_100) {
mUnk_0f4 += 1;
if (game->mUnk_100) {
game->mUnk_0f4 += 1;
while (REG_GFX_RAM_COUNT_2 != 0) {
}
func_02005778();
func_02017cd0();
if (mUnk_0fc != mUnk_0fe) {
this->func_0202c678();
if (game->mUnk_0fc != game->mUnk_0fe) {
game->func_0202c678();
}
if (data_027e080c.func_0202eef8()) {
data_027e08f8.mUnk_1 = true;
} else {
data_027e0c54.func_02036240(&mUnk_0f0);
data_027e0c38.func_02033d84(&mUnk_0f0);
mMode->vfunc_0c(&mUnk_0f0);
gMessageManager.func_02036c50(&mUnk_0f0);
data_027e0c54.func_02036240(&game->mUnk_0f0);
data_027e0c38.func_02033d84(&game->mUnk_0f0);
game->mMode->vfunc_0c(&game->mUnk_0f0);
gMessageManager.func_02036c50(&game->mUnk_0f0);
if ((s32) (data_027e080c.mUnk_04 == 3 || data_027e080c.mUnk_08 == 3) == 0) {
gFadeController.SetScreenBrightness(mUnk_103);
gFadeController.SetScreenBrightness(game->mUnk_103);
}
data_027e0cbc.func_0203d67c(&mUnk_0f0);
data_027e0cbc.func_0203d67c(&game->mUnk_0f0);
if (gOverlayManager.mLoadedOverlays[0] != OverlayId_None) {
data_027e0db0.func_ov000_0207b43c();
}
if (mModeId == 2) {
if (game->mModeId == 2) {
data_027e077c.func_ov009_0211653c();
}
data_02068894.func_0203235c();
data_02075dac.func_0203f974();
}
mUnk_100 = false;
game->mUnk_100 = false;
}
data_027e08e4.func_0202f2ac();
}