Skip to content

Commit

Permalink
singleGS dayend and mainresult progress
Browse files Browse the repository at this point in the history
  • Loading branch information
PikHacker committed Sep 19, 2023
1 parent c6b52ef commit 5e501a6
Show file tree
Hide file tree
Showing 9 changed files with 466 additions and 1,044 deletions.
18 changes: 9 additions & 9 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c">TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c</a> | 5554 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtx44.c">mtx/mtx44.c</a> | 5987 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/os/OSReboot.c">os/OSReboot.c</a> | 6397 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXGeometry.c">gx/GXGeometry.c</a> | 6983 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c">TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c</a> | 10320 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/exi/EXIUart.c">exi/EXIUart.c</a> | 10329 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/ai/ai.c">ai/ai.c</a> | 11124 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 11230 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 12046 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12379 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14151 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 14624 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 11230 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 12046 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12379 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14151 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 14624 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPixel.c">gx/GXPixel.c</a> | 15806 |

### <section id="JSystem">JSystem</section>
| File | Size (bytes) | File | Size (bytes) |
Expand Down Expand Up @@ -98,13 +98,13 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 16714 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBattle.cpp">aiBattle.cpp</a> | 17401 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureLOD.cpp">creatureLOD.cpp</a> | 18468 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/texCaster.cpp">texCaster.cpp</a> | 20776 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiRescue.cpp">aiRescue.cpp</a> | 21024 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameResultTexMgr.cpp">gameResultTexMgr.cpp</a> | 21221 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 22845 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiCrop.cpp">aiCrop.cpp</a> | 26982 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiTransport.cpp">aiTransport.cpp</a> | 27275 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSystem.cpp">gameSystem.cpp</a> | 27890 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 28318 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiAttack.cpp">aiAttack.cpp</a> | 28457 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_MainResult.cpp">singleGS_MainResult.cpp</a> | 29713 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureStick.cpp">creatureStick.cpp</a> | 29831 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_MainResult.cpp">singleGS_MainResult.cpp</a> | 21236 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 22845 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiCrop.cpp">aiCrop.cpp</a> | 26982 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiTransport.cpp">aiTransport.cpp</a> | 27275 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSystem.cpp">gameSystem.cpp</a> | 27890 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 28318 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiAttack.cpp">aiAttack.cpp</a> | 28457 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureStick.cpp">creatureStick.cpp</a> | 29831 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsCardMgr.cpp">vsCardMgr.cpp</a> | 31129 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 31721 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDynamics.cpp">gameDynamics.cpp</a> | 34058 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBore.cpp">aiBore.cpp</a> | 34883 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_DayEnd.cpp">singleGS_DayEnd.cpp</a> | 35056 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 35202 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_DayEnd.cpp">singleGS_DayEnd.cpp</a> | 31850 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDynamics.cpp">gameDynamics.cpp</a> | 34058 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBore.cpp">aiBore.cpp</a> | 34883 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 35202 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePlayDataMemCard.cpp">gamePlayDataMemCard.cpp</a> | 36035 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/piki.cpp">piki.cpp</a> | 36397 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGeneratorCache.cpp">gameGeneratorCache.cpp</a> | 37575 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiWeed.cpp">aiWeed.cpp</a> | 38056 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/collinfo.cpp">collinfo.cpp</a> | 42246 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiFormation.cpp">aiFormation.cpp</a> | 43348 |
Expand Down
2 changes: 1 addition & 1 deletion include/Game/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Result {
struct TNode : public DNode {
TNode();

virtual ~TNode(); // _08 (weak)
virtual ~TNode() { } // _08 (weak)

void setTNode(u64 mesgTag, JUTTexture* texture, int quantity, int totalPokos, int pokoValue);
void setTNode(u64 mesgTag, JUTTexture* texture, int quantity, int totalPokos, int pokoValue, int lostNum);
Expand Down
4 changes: 2 additions & 2 deletions include/Game/ResultTexMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ struct Arg {
mHeap = nullptr;
mItemConfigList = nullptr;
mOtakaraConfigList = nullptr;
_0C = -1;
mRegionMode = -1;
}

PelletConfigList* mOtakaraConfigList; // _00
PelletConfigList* mItemConfigList; // _04
JKRHeap* mHeap; // _08
s8 _0C; // _0C
s8 mRegionMode; // _0C
};

struct Mgr : public JKRDisposer {
Expand Down
57 changes: 28 additions & 29 deletions include/Game/SingleGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ struct CaveState : public State {

struct DayEndArg : public StateArg {
DayEndArg(u16 p1)
: _00(p1)
: mEndType(p1)
{
}

u16 _00;
u16 mEndType;
};

/**
Expand All @@ -207,10 +207,10 @@ struct DayEndState : public State {

// _00 = VTBL
// _00-_10 = State
u16 _10; // _10
s16 _12; // _12
f32 _14; // _14
PikiContainer _18; // _18
u16 mDayEndType; // _10
u16 mStatus; // _12
f32 mTimer; // _14
PikiContainer mLeftBehindPikis; // _18
};

struct EndingArg : public StateArg {
Expand Down Expand Up @@ -411,38 +411,37 @@ struct LoadState : public State {
struct MainResultState : public State {
MainResultState();

virtual void init(SingleGameSection*, StateArg*); // _08
virtual void exec(SingleGameSection*); // _0C
virtual void cleanup(SingleGameSection*); // _10
virtual void draw(SingleGameSection*, Graphics&); // _20
virtual void onMovieDone(SingleGameSection*, MovieConfig*, u32, u32); // _2C
virtual void init(SingleGameSection* game, StateArg* arg); // _08
virtual void exec(SingleGameSection* game); // _0C
virtual void cleanup(SingleGameSection* game); // _10
virtual void draw(SingleGameSection* game, Graphics& gfx); // _20
virtual void onMovieDone(SingleGameSection* game, MovieConfig* config, u32, u32); // _2C

void beforeSave();
void createResultNodes();
void loadResource();

// Unused/inlined:
unknown open2D(SingleGameSection*);
unknown open2D(SingleGameSection* game);

// _00 = VTBL
// _00-_10 = State
s16 _10; // _10
f32 _14; // _14
Controller* _18; // _18
u8 _1C; // _1C
u8 _1D[0x3]; // _1D, unknown/probably padding
u8 _20[4]; // _20
ResultTexMgr::Mgr _24; // _24
u8 _64[4]; // _64
Result::TNode _68; // _68
kh::Screen::IncP* _B8; // _B8
u8 _BC[4]; // _BC
JKRHeap* _C0; // _C0
TObjectNode<GenericObjectMgr>* _C4; // _C4
Delegate<MainResultState>* _C8; // _C8
DvdThreadCommand _CC; // _CC
SingleGameSection* _138; // _138
Delegate<MainResultState>* _13C; // _13C
u16 mStatus; // _10
f32 mStartTimer; // _14
Controller* mControl; // _18
u8 _1C; // _1C
int mCounter; // _20
ResultTexMgr::Mgr mResultTex; // _24
u8 _64[4]; // _64
Result::TNode mResultNode; // _68
kh::Screen::IncP* mIncP; // _B8
u8 _BC[4]; // _BC
JKRHeap* mMainHeap; // _C0
TObjectNode<GenericObjectMgr>* mPelletMgr; // _C4
Delegate<MainResultState>* mLoadDelegate; // _C8
DvdThreadCommand mDvdThread; // _CC
SingleGameSection* mGameSect; // _138
Delegate<MainResultState>* mBeforeSaveDelegate; // _13C
};

struct MovieArg : public StateArg {
Expand Down
17 changes: 13 additions & 4 deletions include/Game/gamePlayData.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ struct KindCounter {
void copyFrom(KindCounter&);
inline void addTo(KindCounter&);

inline int calcCollectedNum()
{
int ret = 0;
for (int i = 0; i < mNumKinds; i++) {
ret += *operator()(i);
}
return ret;
}

u16 mNumKinds; // _00
u8* mKinds; // _04
};
Expand Down Expand Up @@ -410,15 +419,15 @@ struct PlayData : public CNode {
return stream.getStreamDistance(streamStartPos) + generatorCache->getHeapUsedSize();
}

inline void setSaveFlag(int a)
inline void setSaveFlag(int a, void* delegate)
{
mLoadType = a;
_1C = 0;
mLoadType = a;
mBeforeSaveDelegate = delegate;
}

bool _18; // _18
u8 mLoadType; // _19, see SaveFlags enum
u32 _1C; // _1C
void* mBeforeSaveDelegate; // _1C
u8 mDeadNaviID; // _20
f32 mNaviLifeMax[2]; // _24
u8 mHasContainerFlags; // _2C
Expand Down
17 changes: 16 additions & 1 deletion include/kh/khDayEndResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ namespace Screen {

////////////////////////////////////////////
// DATA STRUCTS
enum MailCategory {

enum MailCategory {
// Acutal checking for these conditions are done in singlleGS_MainResult
PokoUnder3000 = 0x31,
PokoUnder5000 = 0x32,
PokoUnder8000 = 0x33,
PokoUnder10000 = 0x34,
PayDebt = 0x35,
SavedLouie = 0x36,
AllTreasures = 0x37,
};

struct MailSaveData {
Expand Down Expand Up @@ -121,6 +129,13 @@ struct DispDayEndResultTitl : public og::Screen::DispMemberBase {
};

struct DispDayEndResult : public og::Screen::DispMemberBase {
DispDayEndResult(Game::Result::TNode* node, int treasures, int pokos, bool paydebt, IncP* incp, JKRHeap* mailheap,
MailCategory mailtype)
: mItem(node, treasures, pokos, paydebt)
, mIncP(incp)
, mMail(mailheap, mailtype)
{
}

virtual u32 getSize() { return sizeof(DispDayEndResult); } // _08 (weak)
virtual u32 getOwnerID() { return OWNER_KH; } // _0C (weak)
Expand Down
Loading

0 comments on commit 5e501a6

Please sign in to comment.