From eba1fa9f411cb1537b200f4803fac8fa5ebe2ebc Mon Sep 17 00:00:00 2001
From: intns <84647527+intns@users.noreply.github.com>
Date: Sun, 30 Jun 2024 18:02:49 +0100
Subject: [PATCH] CLEAN!!!
---
docs/recommended_todo.md | 10 +-
include/Game/Data.h | 2 +-
include/Game/EnemyIterator.h | 2 +-
include/Game/GameMessage.h | 8 +-
include/Game/MemoryCard/Mgr.h | 12 +-
include/Game/VsGame.h | 2 +-
include/Game/VsGameSection.h | 4 +-
include/Game/updateMgr.h | 6 +-
include/SysShape/KeyEvent.h | 2 +-
include/System.h | 4 +-
src/plugProjectKandoU/aiWeed.cpp | 28 ++-
src/plugProjectKandoU/baseGameSection.cpp | 5 +-
src/plugProjectKandoU/naviState.cpp | 8 +-
src/plugProjectKandoU/onyonMgr.cpp | 4 +-
src/plugProjectKandoU/singleGS_CaveGame.cpp | 8 +-
src/plugProjectKandoU/singleGS_MainGame.cpp | 12 +-
src/plugProjectKandoU/updateMgr.cpp | 50 ++---
src/plugProjectKandoU/vsGS_Game.cpp | 22 +--
src/plugProjectKandoU/vsGS_VSGame.cpp | 2 +-
src/plugProjectKandoU/vsGameSection.cpp | 14 +-
src/plugProjectKandoU/vsStageData.cpp | 6 +-
src/sysGCU/commonSaveData.cpp | 2 +-
src/sysGCU/pikmin2MemoryCardMgr.cpp | 203 ++++++++++----------
src/sysGCU/system.cpp | 4 +-
24 files changed, 227 insertions(+), 193 deletions(-)
diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md
index 068381c23..6cc9feb81 100644
--- a/docs/recommended_todo.md
+++ b/docs/recommended_todo.md
@@ -83,10 +83,10 @@
| collinfo.cpp | 43044 | cellPyramid.cpp | 48067 |
| fakePiki.cpp | 50426 | aiFormation.cpp | 53253 |
| pelletState.cpp | 63252 | itemUjamushi.cpp | 64495 |
-| itemPlant.cpp | 73525 | baseGameSection.cpp | 86433 |
+| itemPlant.cpp | 73525 | baseGameSection.cpp | 86375 |
| aiPrimitives.cpp | 117085 | pelletMgr.cpp | 134788 |
| navi.cpp | 148896 | pikiState.cpp | 155487 |
-| naviState.cpp | 163231 | singleGS_Zukan.cpp | 163810 |
+| naviState.cpp | 163290 | singleGS_Zukan.cpp | 163810 |
| gameMapParts.cpp | 164131 | | |
###
@@ -143,7 +143,7 @@
| ---- | ---- | ---- | ---- |
| ogCopyPane.cpp | 7678 | ogCounterSlot.cpp | 15278 |
| ogMenuMgr.cpp | 18723 | ogObjContena.cpp | 31668 |
-| ogObjVs.cpp | 44612 | ogObjSMenuMap.cpp | 53588 |
+| ogObjVs.cpp | 44612 | ogObjSMenuMap.cpp | 53594 |
###
| File | Size (bytes) | File | Size (bytes) |
@@ -172,9 +172,9 @@
| sysShapeModel.cpp | 15500 | titleSection.cpp | 19709 |
| JSTObjectActor.cpp | 20961 | JSTObjectSystem.cpp | 22652 |
| matMath.cpp | 26236 | moviePlayer.cpp | 26335 |
-| windowMessage.cpp | 29493 | system.cpp | 29872 |
+| windowMessage.cpp | 29493 | system.cpp | 29884 |
| memoryCard.cpp | 31350 | bootSection.cpp | 38573 |
-| movieMessage.cpp | 44324 | pikmin2MemoryCardMgr.cpp | 50866 |
+| movieMessage.cpp | 44324 | pikmin2MemoryCardMgr.cpp | 51339 |
| graphics.cpp | 76184 | messageRendering.cpp | 100334 |
###
diff --git a/include/Game/Data.h b/include/Game/Data.h
index 18b6548eb..7313ef4ec 100644
--- a/include/Game/Data.h
+++ b/include/Game/Data.h
@@ -152,7 +152,7 @@ struct Mgr : public PlayCommonData {
char padding; // _21
u16 _22; // _22
u32 _24; // _24
- u32 _28; // _28
+ u32 mSaveSlotIndex; // _28
u32 _2C; // _2C
u64 mCardSerialNo; // _30
u8 mSoundMode; // _38, TODO: Replace with Soundmode enum
diff --git a/include/Game/EnemyIterator.h b/include/Game/EnemyIterator.h
index 016a2b251..b8d566c0f 100644
--- a/include/Game/EnemyIterator.h
+++ b/include/Game/EnemyIterator.h
@@ -63,7 +63,7 @@ struct EnemyIterator {
inline bool satisfy() { return mCondition->satisfy(mContainer->get(mIndex)); }
// VTBL _00
- void* mIndex; // _04;
+ void* mIndex; // _04
GenericContainer* mContainer; // _08
Condition* mCondition; // _0C
};
diff --git a/include/Game/GameMessage.h b/include/Game/GameMessage.h
index 0e49666ea..5acee3226 100644
--- a/include/Game/GameMessage.h
+++ b/include/Game/GameMessage.h
@@ -89,16 +89,16 @@ struct GameMessageVsGetDoping : public GameMessage {
struct GameMessageVsGetOtakara : public GameMessage {
inline GameMessageVsGetOtakara(u32 onyonType)
- : _04(onyonType)
- , _08(1)
+ : mOnionType(onyonType)
+ , mUnused08(1)
{
}
virtual bool actVs(VsGameSection*); // _10
// _00 = VTBL
- u32 _04; // _04, onyon type according to ghidra, but that enum is meant to be a short
- int _08; // _08
+ u32 mOnionType; // _04, onyon type according to ghidra, but that enum is meant to be a short
+ int mUnused08; // _08
};
struct GameMessageVsGotCard : public GameMessage {
diff --git a/include/Game/MemoryCard/Mgr.h b/include/Game/MemoryCard/Mgr.h
index 68aca00ca..48d03fa88 100644
--- a/include/Game/MemoryCard/Mgr.h
+++ b/include/Game/MemoryCard/Mgr.h
@@ -14,12 +14,14 @@ struct PlayerFileInfo;
struct PlayerInfoHeader;
struct PlayerInfo {
- u32 _00; // _00
- u32 _04; // _04
+ u32 mMagic; // _00
+ u32 mVersionType; // _04
};
+
struct OptionInfo {
- u32 _00; // _00
- u32 _04; // _04
+ u32 mMagic; // _00
+ u32 mVersionType; // _04
+ u32 mSaveSlotIndex; // _08
};
enum MemoryCardMgrFlags {
@@ -127,7 +129,7 @@ struct Mgr : public MemoryCardMgr {
inline bool isCardInvalid() { return !mIsCard && checkStatus() != MCS_11; }
// _00-_E8 = MemoryCardMgr
- u32 _D8; // _D8
+ u32 mErrorCode; // _D8
void* mBannerImageFile; // _DC
void* mIconImageFile; // _E0
BitFlag mFlags; // _E4
diff --git a/include/Game/VsGame.h b/include/Game/VsGame.h
index c33212f3f..66df53074 100644
--- a/include/Game/VsGame.h
+++ b/include/Game/VsGame.h
@@ -47,7 +47,7 @@ enum VsCaveInfoType {
enum LoseReasonFlags {
VSLOSE_Unk1 = 0x1,
VSLOSE_Extinction = 0x2,
- VSLOSE_Unk3 = 0x4,
+ VSLOSE_Finished = 0x4,
VSLOSE_Marble = 0x80,
};
diff --git a/include/Game/VsGameSection.h b/include/Game/VsGameSection.h
index db120006e..f2a8080fa 100644
--- a/include/Game/VsGameSection.h
+++ b/include/Game/VsGameSection.h
@@ -35,8 +35,8 @@ struct State;
struct VsGameSection : public BaseGameSection {
typedef VsGame::State StateType;
struct DropCardArg {
- f32 _00; // _00
- f32 _04; // _04
+ f32 mDropMinDistance; // _00
+ f32 mDropMaximumDistance; // _04
};
VsGameSection(JKRHeap*, bool);
diff --git a/include/Game/updateMgr.h b/include/Game/updateMgr.h
index d67c792ce..fc97ad417 100644
--- a/include/Game/updateMgr.h
+++ b/include/Game/updateMgr.h
@@ -17,7 +17,7 @@ struct UpdateContext {
UpdateMgr* mMgr; // _00
int mClientIndex; // _04
- bool _08; // _08
+ bool mIsActive; // _08
bool mDoForceActive; // _09
};
@@ -35,10 +35,10 @@ struct UpdateMgr {
void showInfo(Graphics&, int, int);
int mMaxClientId; // _00
- u32 _04; // _04
+ u32 mClientCount; // _04
int* mClientListA; // _08
int* mClientListB; // _0C
- u32 _10; // _10
+ u32 mCurrentIndex; // _10
u32 _14; // _14
};
diff --git a/include/SysShape/KeyEvent.h b/include/SysShape/KeyEvent.h
index feb8353bf..cdf0f27f6 100644
--- a/include/SysShape/KeyEvent.h
+++ b/include/SysShape/KeyEvent.h
@@ -29,7 +29,7 @@ struct KeyEvent : public CNode {
inline KeyEvent()
{
mFrame = 0;
- mType = 0;
+ mType = KEYEVENT_LOOP_START;
mAnimIdx = -1;
}
diff --git a/include/System.h b/include/System.h
index 509093304..df8a80646 100644
--- a/include/System.h
+++ b/include/System.h
@@ -111,8 +111,8 @@ struct System : public OSMutex {
struct GXVerifyArg {
GXVerifyArg();
- u32 _00; // _00
- u8 _04; // _04
+ u32 mUnused00; // _00
+ u8 mUnused04; // _04
};
System();
diff --git a/src/plugProjectKandoU/aiWeed.cpp b/src/plugProjectKandoU/aiWeed.cpp
index f39c6bca3..831e12e5f 100644
--- a/src/plugProjectKandoU/aiWeed.cpp
+++ b/src/plugProjectKandoU/aiWeed.cpp
@@ -127,39 +127,50 @@ int ActWeed::exec()
if (!mIsAttacking) {
return ACTEXEC_Fail;
}
+
if (mWeed == nullptr) {
return ACTEXEC_Fail;
}
+
switch (mState) {
case WEED_Attack: {
int flockAttackResult = mFlockAttack->exec();
+
if (flockAttackResult == ACTEXEC_Success) {
if (!mWeed->isAlive()) {
return ACTEXEC_Success;
}
+
decideTarget();
initAdjust();
} else if (flockAttackResult == ACTEXEC_Fail) {
decideTarget();
initAdjust();
}
- } break;
+
+ break;
+ }
case WEED_Adjust: {
if (mTargetFlockIdx == -1) {
decideTarget();
initAdjust();
}
+
if (!mWeed->isAlive()) {
return ACTEXEC_Success;
}
+
calcAttackPos();
mApproachPos->mGoalPosition = mAttackPosition;
- int approachResult = mApproachPos->exec();
+
+ int approachResult = mApproachPos->exec();
if (approachResult == ACTEXEC_Success && mState == WEED_Adjust) {
initStickAttack();
}
- } break;
+
+ break;
+ }
}
return ACTEXEC_Continue;
}
@@ -210,6 +221,7 @@ void ActFlockAttack::init(ActionArg* arg)
isFlockArg = true;
}
}
+
P2ASSERTLINE(276, isFlockArg);
FlockAttackActionArg* flockArg = static_cast(arg);
@@ -217,6 +229,7 @@ void ActFlockAttack::init(ActionArg* arg)
mTarget = flockArg->mTarget;
mDamage = flockArg->mDamage;
mFlockIndex = flockArg->mFlockIndex;
+
if (flockArg->mType == Game::ItemWeed::WEEDTYPE_Grass) {
mWeedType = Game::ItemWeed::WEEDTYPE_Grass;
mAnimIdx = Game::IPikiAnims::NUKU;
@@ -224,6 +237,7 @@ void ActFlockAttack::init(ActionArg* arg)
mAnimIdx = Game::IPikiAnims::ATTACK1;
mWeedType = Game::ItemWeed::WEEDTYPE_Stone;
}
+
mParent->startMotion(mAnimIdx, mAnimIdx, this, nullptr);
mFlags.clear();
mParent->mTargetVelocity = Vector3f(0.0f);
@@ -238,22 +252,28 @@ int ActFlockAttack::exec()
if (!mTarget) {
return ACTEXEC_Success;
}
+
if (!mTarget->isAlive()) {
return ACTEXEC_Success;
}
+
if (isFlag(FLOCK_AnimFinished)) {
int result = ACTEXEC_Fail;
if (isFlag(FLOCK_Dead)) {
result = ACTEXEC_Success;
}
+
return result;
}
+
if (!mParent->assertMotion(mAnimIdx)) {
return ACTEXEC_Fail;
}
+
if (isFlag(FLOCK_AttackReady) && !isFlag(FLOCK_AttackFinished)) {
int idx = mFlockIndex;
Game::InteractFlockAttack interaction(mParent, idx, mDamage, false);
+
if (mTarget->stimulate(interaction)) {
// we're hitting rocks/stone
if (mWeedType == Game::ItemWeed::WEEDTYPE_Stone) {
@@ -281,9 +301,11 @@ int ActFlockAttack::exec()
wp.create(&arg);
mParent->startSound(mTarget, PSSE_PK_SE_PULL_GRASS, true);
}
+
if (interaction.mIsFlockDead) {
setFlag(FLOCK_Dead);
}
+
setFlag(FLOCK_AttackFinished);
}
}
diff --git a/src/plugProjectKandoU/baseGameSection.cpp b/src/plugProjectKandoU/baseGameSection.cpp
index dd6e5ccc3..3f20c9bb0 100644
--- a/src/plugProjectKandoU/baseGameSection.cpp
+++ b/src/plugProjectKandoU/baseGameSection.cpp
@@ -657,10 +657,7 @@ void BaseGameSection::initGenerators()
void* plantsgenFile = LoadTextFile(filenameCharArr);
if (plantsgenFile) {
RamStream plantsGenTxt(plantsgenFile, -1);
- plantsGenTxt.mMode = 1;
- if (plantsGenTxt.mMode == 1) {
- plantsGenTxt.mTabCount = 0;
- }
+ plantsGenTxt.setMode(STREAM_MODE_TEXT, 1);
plantsGeneratorMgr->read(plantsGenTxt, false);
plantsGeneratorMgr->updateUseList();
generatorFiles[fileIdx] = plantsgenFile;
diff --git a/src/plugProjectKandoU/naviState.cpp b/src/plugProjectKandoU/naviState.cpp
index 902e4eff6..6a7300791 100644
--- a/src/plugProjectKandoU/naviState.cpp
+++ b/src/plugProjectKandoU/naviState.cpp
@@ -4180,10 +4180,10 @@ void NaviAbsorbState::exec(Navi* navi)
void NaviAbsorbState::onKeyEvent(Navi* navi, SysShape::KeyEvent const& key)
{
switch (key.mType) {
- case 0:
+ case KEYEVENT_LOOP_START:
_10 = 1;
break;
- case 1:
+ case KEYEVENT_LOOP_END:
P2ASSERTLINE(3956, mDrop->mObjectTypeID == OBJTYPE_Honey);
ItemHoney::Item* item = mDrop;
if (!mDrop->isAlive() || !item->isShrinking()) {
@@ -4863,9 +4863,9 @@ lbl_80186148:
void NaviThrowWaitState::onKeyEvent(SysShape::KeyEvent const& key)
{
switch (key.mType) {
- case 2:
+ case KEYEVENT_2:
break;
- case 1:
+ case KEYEVENT_LOOP_END:
if (mHoldChargeLevel < 3) {
mHoldChargeLevel++;
}
diff --git a/src/plugProjectKandoU/onyonMgr.cpp b/src/plugProjectKandoU/onyonMgr.cpp
index 34010bc00..57f372393 100644
--- a/src/plugProjectKandoU/onyonMgr.cpp
+++ b/src/plugProjectKandoU/onyonMgr.cpp
@@ -442,10 +442,10 @@ bool InteractSuckDone::actOnyon(Onyon* item)
}
if (gameSystem->isVersusMode()) {
- const char* peltnames[2] = { VsOtakaraName::cBedamaRed, VsOtakaraName::cBedamaBlue };
+ const char* pelletNames[2] = { VsOtakaraName::cBedamaRed, VsOtakaraName::cBedamaBlue };
for (int i = 0; i < 2; i++) {
- if (!strcmp(peltnames[i], pellet->mConfig->mParams.mName.mData)) {
+ if (!strcmp(pelletNames[i], pellet->mConfig->mParams.mName.mData)) {
if (i == 1 - item->mOnyonType) {
_08 = 1;
diff --git a/src/plugProjectKandoU/singleGS_CaveGame.cpp b/src/plugProjectKandoU/singleGS_CaveGame.cpp
index 6ce35cb6c..461c79d59 100644
--- a/src/plugProjectKandoU/singleGS_CaveGame.cpp
+++ b/src/plugProjectKandoU/singleGS_CaveGame.cpp
@@ -495,11 +495,11 @@ void CaveState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32,
Screen::Game2DMgr::GameOverTitle naviType;
if (naviID == 0) {
naviType = Screen::Game2DMgr::GOTITLE_OlimarDown;
- game->setPlayerMode(0);
+ game->setPlayerMode(NAVIID_Olimar);
} else {
naviType = (playData->mStoryFlags & STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown
: Screen::Game2DMgr::GOTITLE_LouieDown;
- game->setPlayerMode(1);
+ game->setPlayerMode(NAVIID_Louie);
}
Screen::gGame2DMgr->open_GameOver(naviType);
}
@@ -624,9 +624,9 @@ void CaveState::onMovieDone(Game::SingleGameSection* game, Game::MovieConfig* co
naviMgr->getAt(naviID)->setDeadLaydown();
if (naviMgr->mDeadNavis != 2) {
if ((int)naviID == 0) {
- gameSystem->mSection->setPlayerMode(1);
+ gameSystem->mSection->setPlayerMode(NAVIID_Louie);
} else {
- gameSystem->mSection->setPlayerMode(0);
+ gameSystem->mSection->setPlayerMode(NAVIID_Olimar);
}
} else {
Piki* pikilist[MAX_PIKI_COUNT];
diff --git a/src/plugProjectKandoU/singleGS_MainGame.cpp b/src/plugProjectKandoU/singleGS_MainGame.cpp
index 92a1fce47..887c40166 100644
--- a/src/plugProjectKandoU/singleGS_MainGame.cpp
+++ b/src/plugProjectKandoU/singleGS_MainGame.cpp
@@ -77,9 +77,9 @@ void GameState::init(SingleGameSection* game, StateArg* arg)
game->mIsExitingMap = false;
if ((playData->mDeadNaviID & 1) == 0) {
- game->setPlayerMode(0);
+ game->setPlayerMode(NAVIID_Olimar);
} else {
- game->setPlayerMode(1);
+ game->setPlayerMode(NAVIID_Louie);
}
game->setCamController();
if (game->mWeatherEfx) {
@@ -629,11 +629,11 @@ void GameState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32,
Screen::Game2DMgr::GameOverTitle naviType;
if (naviID == 0) {
naviType = Screen::Game2DMgr::GOTITLE_OlimarDown;
- game->setPlayerMode(0);
+ game->setPlayerMode(NAVIID_Olimar);
} else {
naviType = (playData->mStoryFlags & STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown
: Screen::Game2DMgr::GOTITLE_LouieDown;
- game->setPlayerMode(1);
+ game->setPlayerMode(NAVIID_Louie);
}
Screen::gGame2DMgr->open_GameOver(naviType);
}
@@ -867,9 +867,9 @@ void GameState::onMovieDone(SingleGameSection* game, MovieConfig* config, u32, u
naviMgr->getAt(id)->setDeadLaydown();
if (naviMgr->mDeadNavis != 2) {
if ((int)id == NAVIID_Olimar) {
- gameSystem->mSection->setPlayerMode(1);
+ gameSystem->mSection->setPlayerMode(NAVIID_Louie);
} else {
- gameSystem->mSection->setPlayerMode(0);
+ gameSystem->mSection->setPlayerMode(NAVIID_Olimar);
}
} else {
gameSystem->resetFlag(GAMESYS_IsGameWorldActive);
diff --git a/src/plugProjectKandoU/updateMgr.cpp b/src/plugProjectKandoU/updateMgr.cpp
index 3e0eab4fa..1d853f411 100644
--- a/src/plugProjectKandoU/updateMgr.cpp
+++ b/src/plugProjectKandoU/updateMgr.cpp
@@ -57,7 +57,7 @@ void UpdateContext::exit()
mMgr->removeClient(this);
mMgr = nullptr;
}
- _08 = false;
+ mIsActive = false;
}
}
@@ -67,11 +67,11 @@ void UpdateContext::exit()
*/
UpdateMgr::UpdateMgr()
{
- mClientListA = nullptr;
- mClientListB = nullptr;
- mMaxClientId = 0;
- _04 = 0;
- _10 = 0;
+ mClientListA = nullptr;
+ mClientListB = nullptr;
+ mMaxClientId = 0;
+ mClientCount = 0;
+ mCurrentIndex = 0;
}
/**
@@ -81,11 +81,13 @@ UpdateMgr::UpdateMgr()
*/
void UpdateMgr::update()
{
- int i = ++_10;
+ int i = ++mCurrentIndex;
+
if (i < mMaxClientId) {
return;
}
- _10 = 0;
+
+ mCurrentIndex = 0;
}
/**
@@ -98,7 +100,7 @@ bool UpdateMgr::updatable(UpdateContext* context)
if (context == nullptr) {
return false;
}
- return (u8)(context->mClientIndex == _10);
+ return (u8)(context->mClientIndex == mCurrentIndex);
}
/**
@@ -110,11 +112,11 @@ void UpdateMgr::create(int count)
if (count <= 0) {
count = 1;
}
- mMaxClientId = count;
- mClientListA = new int[count];
- mClientListB = new int[count];
- _04 = 0;
- _10 = 0;
+ mMaxClientId = count;
+ mClientListA = new int[count];
+ mClientListB = new int[count];
+ mClientCount = 0;
+ mCurrentIndex = 0;
for (int i = 0; i < mMaxClientId; i++) {
mClientListA[i] = nullptr;
mClientListB[i] = nullptr;
@@ -131,22 +133,24 @@ void UpdateMgr::addClient(UpdateContext* context)
if (context->mClientIndex != -1) {
removeClient(context);
}
- int v1 = mMaxClientId;
+
int smallestValueIndex = -1;
int smallestValue = 10000;
+
for (int i = 0; i < mMaxClientId; i++) {
if (mClientListA[i] < smallestValue) {
smallestValueIndex = i;
smallestValue = mClientListA[i];
}
}
+
if (smallestValueIndex != -1) {
context->mClientIndex = smallestValueIndex;
mClientListA[smallestValueIndex]++;
- if (context->_08) {
+ if (context->mIsActive) {
mClientListB[smallestValueIndex]++;
}
- _04++;
+ mClientCount++;
}
}
@@ -156,14 +160,16 @@ void UpdateMgr::addClient(UpdateContext* context)
*/
void UpdateMgr::removeClient(UpdateContext* context)
{
- int clientIDMaybe = context->mClientIndex;
- if (clientIDMaybe != -1) {
- JUT_ASSERTLINE(155, (clientIDMaybe >= 0 && clientIDMaybe < mMaxClientId), "mail to [%d-%d] %d\n", 0, mMaxClientId, clientIDMaybe);
+ int clientId = context->mClientIndex;
+ if (clientId != -1) {
+ JUT_ASSERTLINE(155, (clientId >= 0 && clientId < mMaxClientId), "mail to [%d-%d] %d\n", 0, mMaxClientId, clientId);
+
mClientListA[context->mClientIndex]--;
- if (context->_08) {
+ if (context->mIsActive) {
mClientListB[context->mClientIndex]--;
}
- _04--;
+
+ mClientCount--;
context->mClientIndex = -1;
}
}
diff --git a/src/plugProjectKandoU/vsGS_Game.cpp b/src/plugProjectKandoU/vsGS_Game.cpp
index 030ddeb6f..1699c61f4 100644
--- a/src/plugProjectKandoU/vsGS_Game.cpp
+++ b/src/plugProjectKandoU/vsGS_Game.cpp
@@ -56,11 +56,11 @@ void GameState::init(VsGameSection* section, StateArg* stateArg)
section->clearCaveMenus();
if (!gameSystem->isMultiplayerMode()) {
- section->setPlayerMode(0);
+ section->setPlayerMode(NAVIID_Olimar);
}
if (gameSystem->isVersusMode()) {
- section->setPlayerMode(2);
+ section->setPlayerMode(NAVIID_Multiplayer);
clearLoseCauses();
Screen::gGame2DMgr->startFadeBG_Floor();
}
@@ -345,7 +345,7 @@ void GameState::exec(VsGameSection* section)
int redReason = -1;
int blueReason = -1;
- if (isLoseCause(VSPLAYER_Red, VSLOSE_Unk3)) {
+ if (isLoseCause(VSPLAYER_Red, VSLOSE_Finished)) {
blueReason = 3;
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_Unk1)) {
@@ -357,7 +357,7 @@ void GameState::exec(VsGameSection* section)
if (blueReason == 3) {
- } else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Unk3)) {
+ } else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Finished)) {
redReason = 3;
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Unk1)) {
@@ -534,13 +534,13 @@ void GameState::cleanup(VsGameSection* section)
* @note Address: 0x8022A824
* @note Size: 0x34
*/
-void GameState::onBattleFinished(VsGameSection* section, int winnerMaybe, bool check)
+void GameState::onBattleFinished(VsGameSection* section, int winningPlayerIndex, bool check)
{
if (mSubState) {
return;
}
- setLoseCause(1 - winnerMaybe, VSLOSE_Unk3);
+ setLoseCause(1 - winningPlayerIndex, VSLOSE_Finished);
if (check) {
mSubState = 1;
@@ -572,7 +572,7 @@ void GameState::onRedOrBlueSuckStart(VsGameSection* section, int player, bool is
mSubState = 1;
- u8 loseReason = VSLOSE_Unk3;
+ u8 loseReason = VSLOSE_Finished;
if (!isYellow) {
loseReason |= VSLOSE_Marble;
}
@@ -640,12 +640,12 @@ void GameState::onMovieStart(VsGameSection* section, MovieConfig* movie, u32 p1,
if (p2 == 0) {
gameOverTitle = Screen::Game2DMgr::GOTITLE_OlimarDown;
if (!gameSystem->isMultiplayerMode()) {
- section->setPlayerMode(0);
+ section->setPlayerMode(NAVIID_Olimar);
}
} else {
gameOverTitle = Screen::Game2DMgr::GOTITLE_LouieDown;
if (!gameSystem->isMultiplayerMode()) {
- section->setPlayerMode(1);
+ section->setPlayerMode(NAVIID_Louie);
}
}
Screen::gGame2DMgr->open_GameOver(gameOverTitle);
@@ -691,7 +691,7 @@ void GameState::onMovieStart(VsGameSection* section, MovieConfig* movie, u32 p1,
void GameState::onMovieDone(VsGameSection* section, MovieConfig* config, u32 p1, u32 p2)
{
if (gameSystem->isMultiplayerMode()) {
- section->setPlayerMode(2);
+ section->setPlayerMode(NAVIID_Multiplayer);
}
RoomMapMgr* mgr = static_cast(mapMgr);
@@ -755,7 +755,7 @@ void GameState::onMovieDone(VsGameSection* section, MovieConfig* config, u32 p1,
if (!gameSystem->isVersusMode()) {
MoviePlayArg movieArg("e00_E3_cavestart", nullptr, section->mMovieFinishCallback, 0);
if (gameSystem->isMultiplayerMode()) {
- section->setPlayerMode(0);
+ section->setPlayerMode(NAVIID_Olimar);
}
section->setCamController();
movieArg.mDelegateStart = section->mMovieStartCallback;
diff --git a/src/plugProjectKandoU/vsGS_VSGame.cpp b/src/plugProjectKandoU/vsGS_VSGame.cpp
index 308f8edbe..d6ecc8e53 100644
--- a/src/plugProjectKandoU/vsGS_VSGame.cpp
+++ b/src/plugProjectKandoU/vsGS_VSGame.cpp
@@ -27,7 +27,7 @@ void VSState::do_init(VsGameSection* gameSection)
{
gameSystem->mMode = GSM_VERSUS_MODE;
- gameSection->setPlayerMode(2);
+ gameSection->setPlayerMode(NAVIID_Multiplayer);
gameSection->setCamController();
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
diff --git a/src/plugProjectKandoU/vsGameSection.cpp b/src/plugProjectKandoU/vsGameSection.cpp
index 31c92f14c..f07e46c6d 100644
--- a/src/plugProjectKandoU/vsGameSection.cpp
+++ b/src/plugProjectKandoU/vsGameSection.cpp
@@ -828,10 +828,10 @@ bool GameMessageVsRedOrSuckStart::actVs(VsGameSection* section)
bool GameMessageVsGetOtakara::actVs(VsGameSection* section)
{
if (section->mCurrentState) {
- section->mYellowMarbleCounts[_04 - 2]++;
- PSSetLastBeedamaDirection(_04 == 0, section->mYellowMarbleCounts[_04 - 2] == 3);
- if (section->mYellowMarbleCounts[_04 - 2] >= 4) {
- section->mCurrentState->onBattleFinished(section, _04, true);
+ section->mYellowMarbleCounts[mOnionType - 2]++;
+ PSSetLastBeedamaDirection(mOnionType == 0, section->mYellowMarbleCounts[mOnionType - 2] == 3);
+ if (section->mYellowMarbleCounts[mOnionType - 2] >= 4) {
+ section->mCurrentState->onBattleFinished(section, mOnionType, true);
}
}
@@ -1158,8 +1158,8 @@ void VsGameSection::updateCardGeneration()
if (mSpawnTimer <= 0.0f) {
mSpawnTimer = 3.0f * randFloat() + 10.0f;
DropCardArg arg;
- arg._00 = factor1;
- arg._04 = factor2;
+ arg.mDropMinDistance = factor1;
+ arg.mDropMaximumDistance = factor2;
dropCard(arg);
}
}
@@ -1179,7 +1179,7 @@ void VsGameSection::useCard()
void VsGameSection::dropCard(VsGameSection::DropCardArg& arg)
{
Vector3f spawn;
- Cave::randMapMgr->getItemDropPosition(spawn, arg._00, arg._04);
+ Cave::randMapMgr->getItemDropPosition(spawn, arg.mDropMinDistance, arg.mDropMaximumDistance);
f32 radius = (randFloat() * 20.0f);
f32 angle = randFloat() * TAU;
diff --git a/src/plugProjectKandoU/vsStageData.cpp b/src/plugProjectKandoU/vsStageData.cpp
index fe6322d24..ec0333baa 100644
--- a/src/plugProjectKandoU/vsStageData.cpp
+++ b/src/plugProjectKandoU/vsStageData.cpp
@@ -79,14 +79,14 @@ StageList::StageList()
*/
void StageList::read(Stream& stream)
{
- bool b = (gameSystem) ? gameSystem->mSection->disableAllocHalt() : true;
- s32 stageNum = stream.readInt();
+ bool isAllocationHalted = (gameSystem) ? gameSystem->mSection->disableAllocHalt() : true;
+ s32 stageNum = stream.readInt();
for (int i = 0; i < stageNum; i++) {
StageData* currStageData = new StageData;
currStageData->read(stream);
mStageData.add(currStageData);
}
- if (gameSystem && b) {
+ if (gameSystem && isAllocationHalted) {
gameSystem->mSection->enableAllocHalt();
}
}
diff --git a/src/sysGCU/commonSaveData.cpp b/src/sysGCU/commonSaveData.cpp
index 25564aed6..01e5171f9 100644
--- a/src/sysGCU/commonSaveData.cpp
+++ b/src/sysGCU/commonSaveData.cpp
@@ -23,7 +23,7 @@ void Mgr::setDefault()
{
mFlags.clear();
mCardSerialNo = 0;
- _28 = 0;
+ mSaveSlotIndex = 0;
mSoundMode = 0;
mMusicVol = 0xFF;
mSeVol = -1;
diff --git a/src/sysGCU/pikmin2MemoryCardMgr.cpp b/src/sysGCU/pikmin2MemoryCardMgr.cpp
index f603f7ae0..cdcdbd2bd 100644
--- a/src/sysGCU/pikmin2MemoryCardMgr.cpp
+++ b/src/sysGCU/pikmin2MemoryCardMgr.cpp
@@ -80,7 +80,7 @@ Resource::~Resource() { mMgr->destroyResource(); }
*/
Mgr::Mgr()
: MemoryCardMgr()
- , _D8(0)
+ , mErrorCode(0)
, mBannerImageFile(0)
, mIconImageFile(0)
{
@@ -374,7 +374,7 @@ bool Mgr::doCardProc(void*, MemoryCardMgrCommand* command)
int heapSize = JKRHeap::getCurrentHeap()->getTotalFreeSize();
JKRHeap* currHeap = JKRHeap::getCurrentHeap();
- _D8 = 0;
+ mErrorCode = 0;
switch (command->_00) {
case 7:
setFlag(MCMFLAG_IsWriting);
@@ -711,47 +711,53 @@ bool Mgr::varifyCardStatus()
* @note Address: 0x804444CC
* @note Size: 0x1C0
*/
-bool Mgr::commandSaveGameOption(bool param_1, bool param_2)
+bool Mgr::commandSaveGameOption(bool isForceSave, bool skipReadCheck)
{
- bool result = false;
- if (param_1 || checkSerialNo(false)) {
- u32* buffer = new (mHeap, -32) u32[0x800];
- P2ASSERTLINE(1500, buffer);
- int icheck = -1;
- bool check = false;
- if (!param_2) {
+ bool saveSuccessful = false;
+
+ if (isForceSave || checkSerialNo(false)) {
+ u32* optionBuffer = new (mHeap, -32) u32[0x800];
+ P2ASSERTLINE(1500, optionBuffer);
+
+ int selectedSlot = -1;
+ bool hasWriteFailed = false;
+ if (!skipReadCheck) {
for (int i = 0; i < 2; i++) {
- if (!read(CARDSLOT_Unk0, cFileName, (u8*)buffer, 0x2000, i * 0x2000 + 0x2000)) {
- check = true;
+ if (!read(CARDSLOT_Unk0, cFileName, (u8*)optionBuffer, 0x2000, i * 0x2000 + 0x2000)) {
+ hasWriteFailed = true;
break;
}
- bool checkOption = checkOptionInfo((OptionInfo*)buffer) == 0; // sigh. sure, why not.
+
+ bool checkOption = checkOptionInfo((OptionInfo*)optionBuffer) == 0;
if (checkOption) {
- icheck = i;
+ selectedSlot = i;
break;
}
}
}
- if (icheck == -1) {
- icheck = sys->mPlayData->_28 + 1 & 1;
+
+ if (selectedSlot == -1) {
+ selectedSlot = sys->mPlayData->mSaveSlotIndex + 1 & 1;
}
- if (!check) {
- sys->mPlayData->_28++;
- buffer[0] = 'OpVa';
- buffer[1] = '0002';
- buffer[2] = sys->mPlayData->_28;
- RamStream ramStream(&buffer[3], 0x1C00);
+
+ if (!hasWriteFailed) {
+ sys->mPlayData->mSaveSlotIndex++;
+ optionBuffer[0] = 'OpVa';
+ optionBuffer[1] = '0002';
+ optionBuffer[2] = sys->mPlayData->mSaveSlotIndex;
+
+ RamStream ramStream(&optionBuffer[3], 0x1C00);
writeGameOption(ramStream);
- buffer[0x7FF] = calcCheckSumOptionInfo((OptionInfo*)buffer);
- check = write(CARDSLOT_Unk0, cFileName, (u8*)buffer, 0x2000, icheck * 0x2000 + 0x2000);
- result = check;
+ optionBuffer[0x7FF] = calcCheckSumOptionInfo((OptionInfo*)optionBuffer);
+ hasWriteFailed = write(CARDSLOT_Unk0, cFileName, (u8*)optionBuffer, 0x2000, selectedSlot * 0x2000 + 0x2000);
+ saveSuccessful = hasWriteFailed;
}
- delete (buffer);
+ delete (optionBuffer);
}
- if (result) {
+ if (saveSuccessful) {
sys->clearOptionBlockSaveFlag();
}
- return result;
+ return saveSuccessful;
}
/**
@@ -792,7 +798,7 @@ bool Mgr::commandLoadGameOption()
bool check2 = checkOptionInfo(info2);
// if both checks pass, pick buffer with higher value at 0xC, or first if equal
if (check1 && check2) {
- if (info1[1]._00 >= info2[1]._00) {
+ if (info1[1].mMagic >= info2[1].mMagic) {
optionResult = info1;
} else {
optionResult = info2;
@@ -809,14 +815,14 @@ bool Mgr::commandLoadGameOption()
// if none passed, set default
if (!optionResult) {
- _D8 = 1;
+ mErrorCode = 1;
sys->mPlayData->setDefault();
// use buffer info to set playData variable
} else {
- result = true;
- sys->mPlayData->_28 = optionResult[1]._00;
- RamStream ramStream((void*)&optionResult[1]._04, 0x1c00);
+ result = true;
+ sys->mPlayData->mSaveSlotIndex = optionResult[1].mMagic;
+ RamStream ramStream((void*)&optionResult[1].mVersionType, 0x1c00);
readGameOption(ramStream);
}
@@ -855,7 +861,7 @@ bool Mgr::checkSerialNo(bool param_1)
bool result = false;
if (!(sys->mPlayData->mFlags.isSet(1))) {
if (param_1) {
- _D8 = 3;
+ mErrorCode = 3;
}
result = true;
} else {
@@ -1015,8 +1021,8 @@ int Mgr::getIndexPlayerInfo(s8 fileIndex, PlayerInfoHeader* infoHeader, bool* pa
doLoop = true;
break;
} else {
- index = -1;
- _D8 = 2;
+ index = -1;
+ mErrorCode = 2;
break;
}
} else {
@@ -1049,8 +1055,8 @@ bool Mgr::commandLoadPlayer(s8 fileIndex)
u64 serial;
P2ASSERTBOUNDSLINE(2264, 0, fileIndex, 3);
commandLoadGameOption();
- if ((s32)_D8 == 1)
- _D8 = 0;
+ if ((s32)mErrorCode == 1)
+ mErrorCode = 0;
if (!isErrorOccured()) {
if (readCardSerialNo(&serial, CARDSLOT_Unk0)) {
u32* buffer = new (mHeap, -32) u32[0x3000];
@@ -1089,28 +1095,29 @@ bool Mgr::loadPlayerForNoCard(s8 fileIndex)
* @note Address: 0x80445330
* @note Size: 0x178
*/
-bool Mgr::loadPlayerProc(s8 fileIndex, u8* param_2)
+bool Mgr::loadPlayerProc(s8 fileIndex, u8* playerDataBuffer)
{
- bool result = false;
+ bool loadSuccess = false;
P2ASSERTBOUNDSLINE(2407, 0, fileIndex, 3);
+
PlayerInfoHeader infoHeader;
int playerInfo = getIndexPlayerInfo(fileIndex, &infoHeader, nullptr);
if (playerInfo >= 0 && playerInfo < 4) {
- if ((result = read(CARDSLOT_Unk0, cFileName, param_2, 0xC000, playerInfo * 0xC000 + 0x6000), result)
- && !checkPlayerInfo((PlayerInfo*)param_2)) {
- result = false;
- _D8 = 2;
+ if ((loadSuccess = read(CARDSLOT_Unk0, cFileName, playerDataBuffer, 0xC000, playerInfo * 0xC000 + 0x6000), loadSuccess)
+ && !checkPlayerInfo((PlayerInfo*)playerDataBuffer)) {
+ loadSuccess = false;
+ mErrorCode = 2;
}
} else {
if (infoHeader._00 == 'PlIn') {
sys->mPlayData->resetPlayer((s8)fileIndex);
playData->reset();
} else {
- result = false;
- _D8 = 2;
+ loadSuccess = false;
+ mErrorCode = 2;
}
}
- return result;
+ return loadSuccess;
}
/**
@@ -1125,7 +1132,7 @@ bool Mgr::commandDeletePlayer(s8 fileIndex)
result = writeInvalidPlayerInfo(playerInfo, (s8)fileIndex);
} else {
if (!modifyPlayerInfo(fileIndex, nullptr)) {
- _D8 = 2;
+ mErrorCode = 2;
}
}
return result;
@@ -1144,7 +1151,7 @@ bool Mgr::savePlayerProc(s8 fileIndex, u8* param_2, bool param_3)
P2ASSERTBOUNDSLINE(2506, 0, fileIndex, 3);
if (getIndexInvalidPlayerInfo(&idx, &tempIndex, fileIndex, ((u32*)param_2)[4], param_3)) {
if (idx < 0 || idx >= 4) {
- _D8 = 2;
+ mErrorCode = 2;
modifyPlayerInfo(fileIndex, nullptr);
} else {
((u32*)param_2)[0x2FFF] = calcCheckSumPlayerInfo((PlayerInfo*)param_2);
@@ -1174,8 +1181,8 @@ bool Mgr::commandCheckSerialNo()
{
bool result = false;
if (!(sys->mPlayData->mFlags.isSet(1))) {
- result = true;
- _D8 = 3;
+ result = true;
+ mErrorCode = 3;
} else {
if (verifyCardSerialNo(&sys->mPlayData->mCardSerialNo, CARDSLOT_Unk0)) {
result = true;
@@ -1221,7 +1228,7 @@ void Mgr::readPlayer(Stream& stream) { playData->read(stream); }
*/
bool Mgr::checkOptionInfo(OptionInfo* optionInfo)
{
- return _D0 && testCheckSumOptionInfo(optionInfo) && optionInfo->_00 == 'OpVa' && optionInfo->_04 == '0002';
+ return _D0 && testCheckSumOptionInfo(optionInfo) && optionInfo->mMagic == 'OpVa' && optionInfo->mVersionType == '0002';
}
/**
@@ -1234,7 +1241,7 @@ u32 Mgr::calcCheckSumOptionInfo(OptionInfo* optionInfo) { return calcCheckSum(op
* @note Address: 0x804459E8
* @note Size: 0x40
*/
-bool Mgr::testCheckSumOptionInfo(OptionInfo* optionInfo) { return (calcCheckSum(optionInfo, 0x1FFC) == optionInfo[0x3FF]._04); }
+bool Mgr::testCheckSumOptionInfo(OptionInfo* optionInfo) { return (calcCheckSum(optionInfo, 0x1FFC) == optionInfo[0x3FF].mVersionType); }
/**
* @note Address: 0x80445A28
@@ -1243,7 +1250,7 @@ bool Mgr::testCheckSumOptionInfo(OptionInfo* optionInfo) { return (calcCheckSum(
bool Mgr::checkPlayerInfo(PlayerInfo* playerInfo)
{
bool result = false;
- if (_D0 != 0 && testCheckSumPlayerInfo(playerInfo) && playerInfo->_00 == 'PlVa' && playerInfo->_04 == '0003') {
+ if (_D0 != 0 && testCheckSumPlayerInfo(playerInfo) && playerInfo->mMagic == 'PlVa' && playerInfo->mVersionType == '0003') {
result = true;
}
return result;
@@ -1259,7 +1266,7 @@ u32 Mgr::calcCheckSumPlayerInfo(PlayerInfo* playerInfo) { return calcCheckSum(pl
* @note Address: 0x80445AC4
* @note Size: 0x48
*/
-bool Mgr::testCheckSumPlayerInfo(PlayerInfo* playerInfo) { return (calcCheckSum(playerInfo, 0xBFFC) == playerInfo[0x17FF]._04); }
+bool Mgr::testCheckSumPlayerInfo(PlayerInfo* playerInfo) { return (calcCheckSum(playerInfo, 0xBFFC) == playerInfo[0x17FF].mVersionType); }
/**
* @note Address: 0x80445B0C
@@ -1269,7 +1276,7 @@ u32 Mgr::getCardStatus()
{
u32 result;
if (checkStatus() == 2) {
- switch (_D8) {
+ switch (mErrorCode) {
case 0:
result = 2;
break;
@@ -1391,18 +1398,18 @@ bool Mgr::checkPlayerNoPlayerInfo(int param_1, s8 param_2, PlayerInfoHeader* inf
* @note Address: 0x80445FA4
* @note Size: 0x380
*/
-bool Mgr::getIndexInvalidPlayerInfo(int* param_1, s8* param_2, s8 param_3, u32 param_4, bool param_5)
+bool Mgr::getIndexInvalidPlayerInfo(int* playerInfoIndex, s8* playerType, s8 targetType, u32 targetValue, bool checkValue)
{
- int array1[4]; // _24
- int array2[4]; // _14
+ int playerTypes[4]; // _24
+ int playerValues[4]; // _14
for (int i = 0; i < 4; i++) {
- array1[i] = -1;
- array2[i] = 0xCDCDCDCD;
+ playerTypes[i] = -1;
+ playerValues[i] = 0xCDCDCDCD;
}
- bool result = true;
- int idx = -1;
+ bool isValid = true;
+ int foundIndex = -1;
u32* buffer = new (mHeap, -32) u32[0x80];
P2ASSERTLINE(3071, buffer);
@@ -1412,70 +1419,70 @@ bool Mgr::getIndexInvalidPlayerInfo(int* param_1, s8* param_2, s8 param_3, u32 p
u32 bufVal = buffer[0];
s8 bufByte = ((u8*)buffer)[8];
- array1[i] = bufByte;
+ playerTypes[i] = bufByte;
- array2[i] = bufVal;
- if (idx == -1 && bufByte == param_3 && bufVal != 'PlVa') {
- *param_2 = param_3;
- idx = i;
+ playerValues[i] = bufVal;
+ if (foundIndex == -1 && bufByte == targetType && bufVal != 'PlVa') {
+ *playerType = targetType;
+ foundIndex = i;
}
- if (*(s8*)(buffer + 2) == param_3 && buffer[0] == 'PlVa' && param_5 && buffer[4] >= param_4) {
- JUT_ASSERTLINE(3148, param_4 == 1, "card [%d] memory[%d]\n", buffer[4], param_4);
- result = false;
- _D8 = 3;
+ if (*(s8*)(buffer + 2) == targetType && buffer[0] == 'PlVa' && checkValue && buffer[4] >= targetValue) {
+ JUT_ASSERTLINE(3148, targetValue == 1, "card [%d] memory[%d]\n", buffer[4], targetValue);
+ isValid = false;
+ mErrorCode = 3;
break;
}
} else {
- result = false;
+ isValid = false;
break;
}
}
delete (buffer);
- if (result && idx == -1) {
+ if (isValid && foundIndex == -1) {
int array3[3];
array3[0] = -1;
array3[1] = -1;
array3[2] = -1;
- u32 check = idx;
+ u32 check = foundIndex;
for (int i = 0; i < 4; i++) {
- if (array1[i] >= 0 && array1[i] < 3) {
- if (array3[array1[i]] == -1) {
- array3[array1[i]] = i;
+ if (playerTypes[i] >= 0 && playerTypes[i] < 3) {
+ if (array3[playerTypes[i]] == -1) {
+ array3[playerTypes[i]] = i;
continue;
- } else if (array2[i] == 'PlVa' && array2[array3[array1[i]]] != 'PlVa') {
- idx = array3[array1[i]];
- } else if (array2[i] != 'PlVa' && array2[array3[array1[i]]] == 'PlVa') {
- idx = i;
- } else if (array2[i] != 'PlVa' && array2[array3[array1[i]]] != 'PlVa') {
- idx = i;
+ } else if (playerValues[i] == 'PlVa' && playerValues[array3[playerTypes[i]]] != 'PlVa') {
+ foundIndex = array3[playerTypes[i]];
+ } else if (playerValues[i] != 'PlVa' && playerValues[array3[playerTypes[i]]] == 'PlVa') {
+ foundIndex = i;
+ } else if (playerValues[i] != 'PlVa' && playerValues[array3[playerTypes[i]]] != 'PlVa') {
+ foundIndex = i;
}
- if (idx != -1) {
- param_2[0] = param_3;
+ if (foundIndex != -1) {
+ playerType[0] = targetType;
break;
}
}
}
- if (result && idx == -1) {
+ if (isValid && foundIndex == -1) {
for (int i = 0; i < 4; i++) {
- if (array1[i] < 0 || array1[i] > 2) {
- idx = i;
- } else if (array2[i] != 'PlVa' && array2[i] != 'PlIn') {
- idx = i;
+ if (playerTypes[i] < 0 || playerTypes[i] > 2) {
+ foundIndex = i;
+ } else if (playerValues[i] != 'PlVa' && playerValues[i] != 'PlIn') {
+ foundIndex = i;
}
- if (idx != -1) {
- param_2[0] = param_3;
+ if (foundIndex != -1) {
+ playerType[0] = targetType;
break;
}
}
}
}
- *param_1 = idx;
- return result;
+ *playerInfoIndex = foundIndex;
+ return isValid;
}
inline bool Mgr::checkCheckSum(u32* buffer) { return _D0 && buffer[0x2FFF] == calcCheckSum(buffer, 0xBFFC); }
@@ -1961,7 +1968,7 @@ bool Mgr::verifyCardSerialNo(u64* serial, MemoryCardMgr::ECardSlot cardSlot)
if (serialDat == *serial) {
result = true;
} else {
- _D8 = 3;
+ mErrorCode = 3;
}
}
return result;
@@ -1975,8 +1982,8 @@ bool Mgr::resetError()
{
bool result;
if (CARDProbe(0)) {
- result = cardMount();
- _D8 = 0;
+ result = cardMount();
+ mErrorCode = 0;
} else {
result = true;
}
diff --git a/src/sysGCU/system.cpp b/src/sysGCU/system.cpp
index b43ef6953..5189e3543 100644
--- a/src/sysGCU/system.cpp
+++ b/src/sysGCU/system.cpp
@@ -686,8 +686,8 @@ void System::loadSoundResource()
*/
System::GXVerifyArg::GXVerifyArg()
{
- _00 = 1;
- _04 = 0;
+ mUnused00 = 1;
+ mUnused04 = 0;
}
/**