diff options
author | Treeki <treeki@gmail.com> | 2012-09-25 23:03:30 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-25 23:03:30 +0200 |
commit | 46b65dfd76411bec6f8356c581f337f8a1944013 (patch) | |
tree | 016b4487a80bd6373589006e69b8c6bbbcf9188e | |
parent | f4be7c3e4a44a6ec870eb61863a3d294da6f10ae (diff) | |
download | kamek-46b65dfd76411bec6f8356c581f337f8a1944013.tar.gz kamek-46b65dfd76411bec6f8356c581f337f8a1944013.zip |
added Remocon and GameMgr definitions, and made map HUD buttons work
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 85 | ||||
-rw-r--r-- | kamek_pal.x | 6 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 18 | ||||
-rw-r--r-- | src/koopatlas/hud.h | 4 | ||||
-rw-r--r-- | src/palaceDude.cpp | 2 | ||||
-rw-r--r-- | src/replay.S | 6 | ||||
-rw-r--r-- | src/switchblock.S | 6 |
7 files changed, 112 insertions, 15 deletions
diff --git a/include/game.h b/include/game.h index 7911880..e31e675 100755 --- a/include/game.h +++ b/include/game.h @@ -80,9 +80,60 @@ struct StartLevelInfo { unsigned char level2; // 0x0F
};
-extern void *GameMgr;
+class GMgr8 {
+ public:
+ virtual ~GMgr8();
+
+ int _4;
+ float _8, _C;
+ u32 _10, _14;
+ u8 _18, _19, _1A, _1B, _1C;
+ u32 _20, _24, _28, _2C, _30;
+};
+
+struct GMgrA0 {
+ u32 _0, _4, _8;
+ u8 _C;
+};
+
+class GameMgr {
+ public:
+ virtual ~GameMgr();
+
+ u32 _4;
+ GMgr8 eight;
+ u32 _3C, _40, _44, _48, _4C, _50, _54, _58;
+ u32 _5C, _60, _64, _68, _6C;
+ u32 _70[10];
+ u8 _98;
+ u32 _9C;
+ GMgrA0 _A0[40];
+ u32 _320[10], _348[10];
+ u32 _370, _374, _378, _37C;
+ u8 switchPalaceFlag;
+ u32 CharIDs[4];
+ u8 _394;
+ u8 _395[10];
+ u8 _39F[10];
+ u8 _3A9[10];
+ u8 _3B3;
+ u32 numberToInsertInThing[7];
+ u32 msgCategory, msgID;
+ u8 _3D8;
+ u8 currentControllerType, layoutShadowFlag;
+ u32 numberToInsertInThing10, numberToInsertInThing11;
+ u32 _3E4, _3E8, _3EC, _3F0, _3F4, _3F8;
+ // unmapped data from 3FC..AEC (0x6F0)
+ u8 _3FC[0x6F0];
+ u32 _AEC, _AF0, _AF4, _AF8;
+ u8 _AFC, _AFD, _AFE[88];
+ u8 _B56[4];
+ u8 _B5A, _B5B;
+};
+
+extern GameMgr *GameMgrP;
inline void *GetGameMgr() {
- return GameMgr;
+ return GameMgrP;
}
bool QueryPlayerAvailability(int id);
@@ -219,9 +270,31 @@ inline SaveHandler *GetSaveHandler() { #define WPAD_MINUS 0x1000
#define WPAD_HOME 0x8000
+struct Remocon {
+ virtual ~Remocon();
+ int id;
+ int controllerType;
+ u32 untouchedButtons;
+ u32 lastUntouchedButtons;
+ u32 heldButtons;
+ u32 lastHeldButtons;
+ u32 nowPressed;
+ u32 _20, _24, _28, _2C, _30;
+ Vec acc, lastAcc;
+ Vec2 accVertical, lastAccVertical;
+ Vec2 vec_5C, lastVec_5C;
+ Vec2 vec_6C;
+ Vec2 vec_74, lastVec_74;
+ float wiimoteMoveDistanceOrSomething;
+ float lastWiimoteMoveDistanceOrSomething;
+ u8 isShaking, _8D;
+ u16 tiltAmount;
+ u8 _90, _91, _92;
+};
+
struct RemoconMngClass {
void *vtable;
- void *controllers[4];
+ Remocon *controllers[4];
};
/*
@@ -246,7 +319,7 @@ inline int GetActiveWiimoteID() { return ActiveWiimoteID;
}
-inline void *GetActiveRemocon() {
+inline Remocon *GetActiveRemocon() {
return GetRemoconMng()->controllers[GetActiveWiimoteID()];
}
@@ -254,11 +327,11 @@ inline void *GetActiveWiimote() { return ActiveWiimote;
}
-inline unsigned int Remocon_GetButtons(void *self) {
+inline unsigned int Remocon_GetButtons(Remocon *self) {
return *((unsigned int*)((u32)self+0x18));
}
-inline unsigned int Remocon_GetPressed(void *self) {
+inline unsigned int Remocon_GetPressed(Remocon *self) {
return *((unsigned int*)((u32)self+0x1C));
}
diff --git a/kamek_pal.x b/kamek_pal.x index 80ad1ce..75613ad 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -11,6 +11,10 @@ SECTIONS { __dt__18BGGMEffectRendererFv = 0x80092E30; __vt__18BGGMEffectRenderer = 0x80311908; __construct_array = 0x802DCC90; + + GetBMG__Fv = 0x800CDD50; + WriteBMGToTextBox__FPQ34nw4r3lyt7TextBoxPQ27dScript5Res_ciiie = 0x800C9B50; + m2d__Anm_c__Load = 0x801644F0; m2d__AnmResHandler_c__Load = 0x80163FA0; @@ -979,7 +983,7 @@ SECTIONS { ArchiveHeap = 0x8042A72C; DVDClass = 0x8042A318; - GameMgr = 0x8042A25C; + GameMgrP = 0x8042A25C; SaveFileInstance = 0x8042A320; SaveHandlerInstance = 0x8042A298; RemoconMng = 0x8042A230; diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index b7effce..c9124d2 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -14,6 +14,7 @@ dWMHud_c *dWMHud_c::build() { dWMHud_c::dWMHud_c() { layoutLoaded = false; + displayedControllerType = -1; } enum WMHudAnimation { @@ -112,6 +113,8 @@ int dWMHud_c::onExecute() { playShowHeaderAnim(); } + updatePressableButtonThingies(); + layout.execAnimations(); layout.update(); @@ -278,4 +281,19 @@ void dWMHud_c::setupLives() { N_IconPosXP_00[playerCount - 1]->SetVisible(true); } +void dWMHud_c::updatePressableButtonThingies() { + int cntType = RemoconMng->controllers[0]->controllerType; + + if (cntType != displayedControllerType) { + displayedControllerType = cntType; + + int beef = (cntType == 0) ? 0 : 1; + GameMgrP->currentControllerType = beef; + + WriteBMGToTextBox( + layout.findTextBoxByName("ItemsButtonInfo"), + GetBMG(), 4, 15, 0); + } +} + diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h index 07dde77..e507aea 100644 --- a/src/koopatlas/hud.h +++ b/src/koopatlas/hud.h @@ -18,7 +18,6 @@ class dWMHud_c : public dBase_c { static dWMHud_c *build(); static dWMHud_c *instance; - void enteredNode(dKPNode_s *node = 0); void leftNode(); @@ -32,6 +31,9 @@ class dWMHud_c : public dBase_c { bool willShowHeader; dKPNode_s *nodeForHeader; + int displayedControllerType; + void updatePressableButtonThingies(); + nw4r::lyt::Pane *N_IconPosXP_00[4]; diff --git a/src/palaceDude.cpp b/src/palaceDude.cpp index 6a8d7ff..8eb4a99 100644 --- a/src/palaceDude.cpp +++ b/src/palaceDude.cpp @@ -29,7 +29,7 @@ int dPalaceDude_c::onExecute() { dMsgBoxManager_c::instance->showMessage(settings & 0xFFFFFFF); SaveBlock *save = GetSaveFile()->GetBlock(-1); - *((u8*)(((u32)GameMgr)+0x380)) |= (1 << (settings >> 28)); + GameMgrP->switchPalaceFlag|= (1 << (settings >> 28)); } } diff --git a/src/replay.S b/src/replay.S index 8c3f6c7..89868cf 100644 --- a/src/replay.S +++ b/src/replay.S @@ -27,7 +27,7 @@ .extern EGG__Heap__free__FPvPv .extern GameHeap2 .extern EggControllerClassPtrMaybe -.extern GameMgr +.extern GameMgrP .extern StrangeReplayValue1 .extern StrangeReplayValue2 .extern StrangeReplayValue3 @@ -192,8 +192,8 @@ replayStartLoop: lwzx r3, r3, r6 stw r3, 0x18(r4) - lis r3, GameMgr@h - ori r3, r3, GameMgr@l + lis r3, GameMgrP@h + ori r3, r3, GameMgrP@l lwz r3, 0(r3) lbz r3, 0x380(r3) stb r3, 0x21(r4) diff --git a/src/switchblock.S b/src/switchblock.S index b86d5e2..4df2433 100644 --- a/src/switchblock.S +++ b/src/switchblock.S @@ -11,14 +11,14 @@ #endif .align 4 -.extern GameMgr +.extern GameMgrP .extern BG_GM_ptr .extern _restgpr_27 .global BG_GM_InitRedSwitchFlag_Patch BG_GM_InitRedSwitchFlag_Patch: - lis r5, GameMgr@h - ori r5, r5, GameMgr@l + lis r5, GameMgrP@h + ori r5, r5, GameMgrP@l lwz r5, 0(r5) addis r4, r3, 9 |