singleGS minor fixes

This commit is contained in:
HeartPiece 2024-04-17 11:58:16 +10:00
parent 1a0635b615
commit ddf3606072
6 changed files with 36 additions and 225 deletions

View File

@ -83,7 +83,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 10813 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 11601 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemHoney.cpp">itemHoney.cpp</a> | 12289 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBreakGate.cpp">aiBreakGate.cpp</a> | 13962 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/texCaster.cpp">texCaster.cpp</a> | 16071 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCaveInfo.cpp">gameCaveInfo.cpp</a> | 16103 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 19670 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemCave.cpp">itemCave.cpp</a> | 20160 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 19624 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemCave.cpp">itemCave.cpp</a> | 20160 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 20316 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/dynCreature.cpp">dynCreature.cpp</a> | 21624 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDynamics.cpp">gameDynamics.cpp</a> | 24672 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemPikihead.cpp">itemPikihead.cpp</a> | 26219 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCPlate.cpp">gameCPlate.cpp</a> | 26452 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsCardMgr.cpp">vsCardMgr.cpp</a> | 30623 |
@ -93,7 +93,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGeneratorCache.cpp">gameGeneratorCache.cpp</a> | 40204 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/collinfo.cpp">collinfo.cpp</a> | 43410 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgr.cpp">mapMgr.cpp</a> | 43418 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pikiMgr.cpp">pikiMgr.cpp</a> | 47880 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiFormation.cpp">aiFormation.cpp</a> | 52263 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellPyramid.cpp">cellPyramid.cpp</a> | 52507 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/navi_demoCheck.cpp">navi_demoCheck.cpp</a> | 57635 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveGame.cpp">singleGS_CaveGame.cpp</a> | 57674 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveGame.cpp">singleGS_CaveGame.cpp</a> | 52628 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/navi_demoCheck.cpp">navi_demoCheck.cpp</a> | 57635 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemWeed.cpp">itemWeed.cpp</a> | 62058 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pelletState.cpp">pelletState.cpp</a> | 62915 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemUjamushi.cpp">itemUjamushi.cpp</a> | 63548 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/fakePiki.cpp">fakePiki.cpp</a> | 65612 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePlayData.cpp">gamePlayData.cpp</a> | 66045 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemPlant.cpp">itemPlant.cpp</a> | 73150 |

View File

@ -389,4 +389,10 @@ inline void PSMStartMainSeq()
mgr->mScenes->mChild->startMainSeq();
}
inline void PSMDoFirstLoad()
{
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
mgr->doFirstLoad();
}
#endif

View File

@ -21,15 +21,30 @@ inline SceneMgr* getSceneMgr()
inline void checkSceneMgr(SceneMgr* mgr) { P2ASSERTLINE(476, mgr); }
inline SeqBase* getSeqData(SceneMgr* mgr, int id)
inline Scene* getChildScene(SceneMgr* mgr)
{
Scene* scene = mgr->mScenes->mChild;
P2ASSERTLINE(485, scene);
return scene;
}
inline SeqBase* getSeqFromScene(Scene* scene, u32 id)
{
SeqBase* seq = scene->mSeqMgr.getSeq(id);
P2ASSERTLINE(487, seq);
return seq;
}
inline SeqBase* getSeqData(SceneMgr* mgr, int id)
{
return getSeqFromScene(getChildScene(mgr), id);
// Scene* scene = mgr->mScenes->mChild;
// P2ASSERTLINE(485, scene);
// SeqBase* seq = scene->mSeqMgr.getSeq(id);
// P2ASSERTLINE(487, seq);
// return seq;
}
inline SeqBase* getSeqDataCheck(SceneMgr* mgr, int id)
{
mgr->checkScene();
@ -46,13 +61,6 @@ inline PSGame::SeMgr* getSeMgrInstance()
return static_cast<PSGame::SeMgr*>(SingletonBase<PSGame::SeMgr>::sInstance);
}
inline SeqBase* getSeqFromScene(Scene* scene, u32 id)
{
SeqBase* seq = scene->mSeqMgr.getSeq(id);
P2ASSERTLINE(487, seq);
return seq;
}
inline PSGame::SoundTable::SePerspInfo* getSoundCategoryInfo(PSGame::SoundTable::CategoryMgr* mgr, u8 id)
{
P2ASSERTLINE(93, mgr->mPerspInfo[id]);

View File

@ -118,6 +118,8 @@ struct System : public OSMutex {
~System();
static _GXRenderModeObj* getRenderModeObj();
static int getRenderModeWidth() { return getRenderModeObj()->fbWidth; }
static int getRenderModeHeight() { return getRenderModeObj()->efbHeight; }
static int assert_fragmentation(char*);
static void loadSoundResource();
static void initialize();

View File

@ -54,10 +54,11 @@ void CaveState::init(SingleGameSection* game, StateArg* arg)
game->setFixNearFar(true, 1.0f, 12800.0f);
// I assume this is meant to check if the 'active' navi is dead and if so, swap to the other navi
// but good lord this is weird
// THIS CANNOT BE WHAT THE DEVS WROTE
int naviID = playData->mCaveSaveData.mActiveNaviID;
u8* deadNaviID = &playData->mDeadNaviID;
if (((1 << naviID * 8) & deadNaviID[naviID]) != false) {
int shiftedID = naviID >> 3;
if (1 << (naviID - (shiftedID << 3)) & *(deadNaviID - shiftedID)) {
naviID = 1 - naviID;
}
@ -98,212 +99,6 @@ void CaveState::init(SingleGameSection* game, StateArg* arg)
} else {
game->mNeedTreasureCalc = false;
}
/*
stwu r1, -0x70(r1)
mflr r0
stw r0, 0x74(r1)
li r0, 0
stw r31, 0x6c(r1)
mr r31, r4
stw r30, 0x68(r1)
mr r30, r3
stw r29, 0x64(r1)
stw r28, 0x60(r1)
stw r0, mSoundDeathCount__Q24Game8DeathMgr@sda21(r13)
lwz r3, moviePlayer__4Game@sda21(r13)
bl reset__Q24Game11MoviePlayerFv
li r0, 0
mr r3, r31
stb r0, 0x10(r30)
stb r0, 0x18(r30)
bl setupCaveGames__Q24Game17SingleGameSectionFv
li r0, 0
li r4, 1
stb r0, 0x194(r31)
lwz r3, sys@sda21(r13)
bl heapStatusDump__6SystemFb
lwz r4, gameSystem__4Game@sda21(r13)
li r0, 1
lfs f1, lbl_8051A000@sda21(r2)
mr r3, r31
lwz r6, 0x40(r4)
li r4, 1
lfs f2, lbl_8051A004@sda21(r2)
lwz r5, 0x240(r6)
ori r5, r5, 1
stw r5, 0x240(r6)
lwz r6, gameSystem__4Game@sda21(r13)
lbz r5, 0x3c(r6)
ori r5, r5, 0x20
stb r5, 0x3c(r6)
lwz r5, gGame2DMgr__6Screen@sda21(r13)
lwz r5, 0x18(r5)
stb r0, 0x91(r5)
lwz r5, gameSystem__4Game@sda21(r13)
stb r0, 0x48(r5)
bl setFixNearFar__Q24Game15BaseGameSectionFbff
lwz r3, playData__4Game@sda21(r13)
li r6, 1
lbz r4, 0x78(r3)
addi r0, r3, 0x20
srawi r3, r4, 3
slwi r5, r3, 3
subf r3, r3, r0
subf r5, r5, r4
lbz r0, 0(r3)
slw r3, r6, r5
and. r0, r3, r0
beq lbl_80217840
subfic r4, r4, 1
lbl_80217840:
mr r3, r31
bl setPlayerMode__Q24Game15BaseGameSectionFi
mr r3, r31
bl setCamController__Q24Game15BaseGameSectionFv
lwz r3, naviMgr__4Game@sda21(r13)
li r4, 0
lwz r12, 0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
mr r0, r3
lwz r3, naviMgr__4Game@sda21(r13)
mr r29, r0
li r4, 1
lwz r12, 0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
mr r0, r3
mr r3, r29
lwz r12, 0(r29)
mr r28, r0
lwz r12, 0xa8(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_8021790C
mr r3, r28
lwz r12, 0(r28)
lwz r12, 0xa8(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_8021790C
lis r4, __vt__Q24Game11Interaction@ha
lis r3, __vt__Q24Game11InteractFue@ha
addi r0, r4, __vt__Q24Game11Interaction@l
li r5, 0
stw r0, 0x18(r1)
addi r6, r3, __vt__Q24Game11InteractFue@l
li r0, 1
mr r3, r28
stw r29, 0x1c(r1)
addi r4, r1, 0x18
stw r6, 0x18(r1)
stb r5, 0x20(r1)
stb r0, 0x21(r1)
lwz r12, 0(r28)
lwz r12, 0x1a4(r12)
mtctr r12
bctrl
lbl_8021790C:
lwz r6, 0xc8(r31)
lis r3, lbl_8048244C@ha
li r0, 0
lfs f0, lbl_8051A008@sda21(r2)
addi r4, r3, lbl_8048244C@l
stw r0, 0x28(r1)
addi r29, r1, 0x3c
lwz r3, mapMgr__4Game@sda21(r13)
stw r4, 0x24(r1)
mr r4, r29
li r5, 0
stw r6, 0x30(r1)
stfs f0, 0x3c(r1)
stfs f0, 0x40(r1)
stfs f0, 0x44(r1)
stfs f0, 0x48(r1)
stw r0, 0x4c(r1)
stw r0, 0x34(r1)
stw r0, 0x2c(r1)
stw r0, 0x50(r1)
stw r0, 0x38(r1)
stw r0, 0x54(r1)
lwz r0, 0xcc(r31)
stw r0, 0x34(r1)
lwz r12, 4(r3)
lwz r12, 0x10(r12)
mtctr r12
bctrl
lwz r3, mgr__Q24Game9ItemOnyon@sda21(r13)
lwz r3, 0xac(r3)
cmplwi r3, 0
beq lbl_802179A0
lwz r12, 0(r3)
lwz r12, 0x64(r12)
mtctr r12
bctrl
stfs f1, 0x48(r1)
lbl_802179A0:
lwz r3, mapMgr__4Game@sda21(r13)
mr r4, r29
lwz r12, 4(r3)
lwz r12, 0x28(r12)
mtctr r12
bctrl
lwz r3, mapMgr__4Game@sda21(r13)
mr r4, r29
lwz r12, 4(r3)
lwz r12, 0x28(r12)
mtctr r12
bctrl
stfs f1, 0x40(r1)
addi r4, r1, 0x24
lwz r3, moviePlayer__4Game@sda21(r13)
bl play__Q24Game11MoviePlayerFRQ24Game12MoviePlayArg
lwz r3, gGame2DMgr__6Screen@sda21(r13)
bl startCount_Floor__Q26Screen9Game2DMgrFv
mr r3, r31
bl clearCaveMenus__Q24Game17SingleGameSectionFv
li r7, 0
lis r3, "zero__10Vector3<f>"@ha
stb r7, 0x11(r30)
addi r4, r3, "zero__10Vector3<f>"@l
lfs f1, lbl_8051A00C@sda21(r2)
addi r5, r1, 0xc
lwz r3, gameSystem__4Game@sda21(r13)
addi r6, r1, 8
lbz r0, 0x3c(r3)
rlwinm r0, r0, 0, 0x1f, 0x1d
stb r0, 0x3c(r3)
stb r7, 0x23d(r31)
lwz r3, mgr__5Radar@sda21(r13)
bl "calcNearestTreasure__Q25Radar3MgrFR10Vector3<f>fR10Vector3<f>Rf"
cmpwi r3, 0
bne lbl_80217A3C
li r0, 1
stb r0, 0x23e(r31)
b lbl_80217A44
lbl_80217A3C:
li r0, 0
stb r0, 0x23e(r31)
lbl_80217A44:
lwz r0, 0x74(r1)
lwz r31, 0x6c(r1)
lwz r30, 0x68(r1)
lwz r29, 0x64(r1)
lwz r28, 0x60(r1)
mtlr r0
addi r1, r1, 0x70
blr
*/
}
/**
@ -615,9 +410,9 @@ void CaveState::onMovieCommand(SingleGameSection* game, int command)
f32 zero = 0.0f;
f32 calc = randFloat() * zero + 1.0f;
if (calc < 0.0f) {
if (calc > 1.0f) {
calc = 1.0f;
}
calc = 0.0f;
} else if (calc > 1.0f) {
calc = 1.0f;
}
game->mDoTrackCarcass = true;

View File

@ -88,10 +88,10 @@ void CaveResultState::loadResource()
mResultTextures = new ResultTexMgr::Mgr;
mResultTextures->create(arg);
JUTTexture* texture = new JUTTexture(sys->getRenderModeObj()->fbWidth, sys->getRenderModeObj()->efbHeight, GX_TF_RGB565);
JUTTexture* texture = new JUTTexture(sys->getRenderModeWidth(), sys->getRenderModeHeight(), GX_TF_RGB565);
texture->mMinFilter = 0;
texture->mMagFilter = 0;
mSection->_168 = texture;
mSection->_168 = (JUTTexture*)texture;
createResultNodes();
@ -99,8 +99,8 @@ void CaveResultState::loadResource()
sceneInfo.mSceneType = PSGame::SceneInfo::CAVE_RESULTS;
sceneInfo.mCameras = 0;
PSMSetSceneInfo(sceneInfo);
PSMGetSceneMgr()->mScenes->getChildScene()->scene1stLoadSync();
PSMGetSceneMgrCheck()->getChildScene()->startMainSeq();
PSSystem::getSceneMgr()->doFirstLoad();
PSMGetChildScene()->startMainSeq();
/*
stwu r1, -0x60(r1)