start rest of PSGame.cpp

This commit is contained in:
PikHacker 2024-01-07 21:29:12 -05:00
parent 29febee9aa
commit 80368ebaab
16 changed files with 187 additions and 42 deletions

View File

@ -85,9 +85,9 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSBnkMgr.cpp">PSBnkMgr.cpp</a> | 8931 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSSystemIF.cpp">PSSystemIF.cpp</a> | 8981 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSDirector.cpp">PSDirector.cpp</a> | 10323 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSSe.cpp">PSSe.cpp</a> | 22070 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSSeq.cpp">PSSeq.cpp</a> | 54453 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSAutoBgm.cpp">PSAutoBgm.cpp</a> | 66685 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSGame.cpp">PSGame.cpp</a> | 101987 | | |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSDirector.cpp">PSDirector.cpp</a> | 10323 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSSe.cpp">PSSe.cpp</a> | 22069 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSSeq.cpp">PSSeq.cpp</a> | 54453 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSAutoBgm.cpp">PSAutoBgm.cpp</a> | 66682 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectHikinoU/PSGame.cpp">PSGame.cpp</a> | 106937 | | |
### <section id="plugProjectKandoU">plugProjectKandoU</section>
| File | Size (bytes) | File | Size (bytes) |

View File

@ -23,7 +23,7 @@ struct Conductor : public JADUtility::PrmSetRc<PSAutoBgm::Track> {
virtual void* getEraseLink() { return &_98; } // _1C (weak)
void removeCallback(u8, void*);
u32 seqCpuSync_AutoBgm(JASTrack*, u16, u32, JASTrack*);
u16 seqCpuSync_AutoBgm(JASTrack*, u16, u32, JASTrack*);
void createTables(JASTrack*);
// _00 = VTABLE

View File

@ -16,12 +16,12 @@ struct Module;
* @size = 0x40
*/
struct CycleBase {
virtual void play(JASTrack*); // _08
virtual u16 play(JASTrack*); // _08
virtual int getCycleType() { return 1; } // _0C (weak)
virtual u32 avoidCheck() { return 0; } // _10 (weak)
u32 cycleTop(JASTrack*);
u32 checkCloser(JASTrack*);
u16 cycleTop(JASTrack*);
u16 checkCloser(JASTrack*);
// _00 = VTABLE
Module* mModule; // _04
@ -36,7 +36,7 @@ struct CycleBase {
struct OnCycle : public CycleBase {
OnCycle(Module*);
virtual void play(JASTrack*); // _08
virtual u16 play(JASTrack*); // _08
virtual int getCycleType() { return 0; } // _0C (weak)
virtual u32 avoidCheck(); // _10

View File

@ -20,7 +20,7 @@ struct Module : public JADUtility::PrmSetBase {
static void removeCallback(u8, void*);
u32 seqCpuSync_AutoBgm_Module(JASTrack*, u16, u32, JASTrack*);
void setTableAddress(JASTrack*);
void cycleLoop(JASTrack*);
u16 cycleLoop(JASTrack*);
// _00 = VTABLE
// _04-_64 = PrmSetBase
@ -41,6 +41,7 @@ struct Module : public JADUtility::PrmSetBase {
u8 _2AC; // _2AC - unknown
uint _2B0; // _2B0
u8 _2B4; // _2B4
u16 _2B6; // _2B6
CycleBase* _2B8[2]; // _2B8 - 0 = OnCycle, 1 = OffCycle
u8 _2C0; // _2C0 - cycle index?
u8 _2C1; // _2C1

View File

@ -1,5 +1,5 @@
#ifndef _PSGAME_RAPPA_H
#define _PSGAME_RAPPA_H
#ifndef _PSGAME_PSSE_H
#define _PSGAME_PSSE_H
#include "types.h"
#include "JSystem/JKernel/JKRDisposer.h"
@ -16,8 +16,8 @@ struct Rappa : public JKRDisposer {
void init(u16);
void setId(u32);
JAISound* playRappa(bool, f32, f32, JAInter::Object*);
u32 syncCpu_WaitChk(JASTrack*);
u32 syncCpu_TblNo(JASTrack*);
u16 syncCpu_WaitChk(JASTrack*);
u16 syncCpu_TblNo(JASTrack*);
// _00 = VTBL
// _00-_18 = JKRDisposer
@ -25,6 +25,12 @@ struct Rappa : public JKRDisposer {
u16 mWait; // _1C
u16 mTblNo; // _1E
static inline Rappa* getRappa(u8 id)
{
P2ASSERTLINE(28, sRappa[id]);
return sRappa[id];
}
static Rappa* sRappa[2];
static u16 cBaseWaitTime;
static f32 cRatio;

View File

@ -2,7 +2,7 @@
#define _PSM_NAVI_H
#include "PSM/CreatureObj.h"
#include "PSGame/Rappa.h"
#include "PSGame/PSSe.h"
namespace Game {
struct Navi;

View File

@ -62,7 +62,7 @@ inline PSGame::SoundTable::SePerspInfo* getSoundCategoryInfo(PSGame::SoundTable:
}; // namespace PSSystem
namespace PSGame {
void seqCpuSync(JASTrack* track, u16 command);
u16 seqCpuSync(JASTrack* track, u16 command);
};
#endif

View File

@ -125,7 +125,7 @@ struct JumpBgmSeq : public DirectedBgm {
virtual u8 getCastType() { return 4; } // _24 (weak)
virtual void onPlayingFrame(); // _30
virtual PSSystem::SeqTrackRoot* newSeqTrackRoot(); // _44
virtual int getSeqStartPoint(); // _4C
virtual u16 getSeqStartPoint(); // _4C
virtual void requestJumpBgmQuickly(u16); // _50
virtual void requestJumpBgmOnBeat(u16); // _54
virtual void requestJumpBgmEveryBeat(u16); // _58

View File

@ -27,7 +27,7 @@ struct BeatMgr {
* @size 0x2C
*/
struct SeqTrackBase {
virtual bool update(); // _08
virtual u16 update(); // _08
virtual void init(JASTrack*); // _0C
virtual void onStopSeq() = 0; // _10
@ -42,7 +42,7 @@ struct SeqTrackBase {
struct SeqTrackRoot : public SeqTrackBase {
SeqTrackRoot();
virtual bool update() // _08 (weak)
virtual u16 update() // _08 (weak)
{
mBeatMgr.proc();
return SeqTrackBase::update();

View File

@ -3,16 +3,10 @@
#include "CNode.h"
#include "SysShape/AnimInfo.h"
#include "PSGame/SoundCreatureMgr.h"
struct JKRFileLoader;
namespace PSGame {
class SoundCreatureMgr {
public:
void registerAnime(J3DAnmBase*, const char*);
};
} // namespace PSGame
namespace SysShape {
struct Model;

View File

@ -59,7 +59,7 @@ void Conductor::removeCallback(u8 p1, void* p2)
* @note Address: 0x803392E8
* @note Size: 0x11C
*/
u32 Conductor::seqCpuSync_AutoBgm(JASTrack* track1, u16 cmd, u32 p3, JASTrack* track2)
u16 Conductor::seqCpuSync_AutoBgm(JASTrack* track1, u16 cmd, u32 p3, JASTrack* track2)
{
switch (cmd) {
case 0x300:
@ -1403,7 +1403,7 @@ lbl_8033AEC4:
* @note Address: 0x8033AEF4
* @note Size: 0x154
*/
void Module::cycleLoop(JASTrack*)
u16 Module::cycleLoop(JASTrack*)
{
/*
stwu r1, -0x10(r1)
@ -1516,7 +1516,7 @@ lbl_8033B030:
* @note Address: 0x8033B048
* @note Size: 0x10
*/
u32 CycleBase::cycleTop(JASTrack* track)
u16 CycleBase::cycleTop(JASTrack* track)
{
_3C = 0;
return 0;
@ -1526,7 +1526,7 @@ u32 CycleBase::cycleTop(JASTrack* track)
* @note Address: 0x8033B058
* @note Size: 0x1BC
*/
void CycleBase::play(JASTrack* track)
u16 CycleBase::play(JASTrack* track)
{
/*
stwu r1, -0x30(r1)
@ -1661,7 +1661,7 @@ lbl_8033B1F8:
* @note Address: 0x8033B214
* @note Size: 0x78
*/
u32 CycleBase::checkCloser(JASTrack*)
u16 CycleBase::checkCloser(JASTrack*)
{
if (mModule->_F4.mValue == 1 && _3C != mModule->_2B4) {
return 0;
@ -1790,7 +1790,7 @@ lbl_8033B3CC:
* @note Address: 0x8033B468
* @note Size: 0x360
*/
void OnCycle::play(JASTrack*)
u16 OnCycle::play(JASTrack*)
{
/*
stwu r1, -0x30(r1)

View File

@ -20,10 +20,10 @@ void BeatMgr::proc()
* @note Address: 0x803422D4
* @note Size: 0x28
*/
bool SeqTrackBase::update()
u16 SeqTrackBase::update()
{
mTaskEntryMgr.update();
return false;
return 0;
}
/**

View File

@ -16,6 +16,8 @@
#include "PSSystem/PSGame.h"
#include "JSystem/JAudio/JALCalc.h"
#include "JSystem/JAudio/JAI/JAInter/SeMgr.h"
#include "Game/gamePlayData.h"
#include "PSGame/PSSe.h"
namespace PSGame {
@ -704,6 +706,8 @@ f32 SoundTable::SePerspInfo::getDistVol(f32 factor, u8 flag)
}
}
const f32 CameraMgr::sDefaultVol = 0.8f;
/**
* @note Address: 0x80334CC8
* @note Size: 0xA8
@ -3322,13 +3326,156 @@ void ConductorSelector::getConductorFile(char const* path, CaveFloorInfo&, u8*,
* @note Address: 0x803372E0
* @note Size: 0x94C
*/
void seqCpuSync(JASTrack* track, u16 command)
u16 seqCpuSync(JASTrack* track, u16 command)
{
switch (command) {
case 0x3000:
// even though the inline already HAS an assertion
P2ASSERTLINE(1875, Rappa::getRappa(0));
return Rappa::getRappa(0)->syncCpu_TblNo(track);
case 0x3001:
P2ASSERTLINE(1879, Rappa::getRappa(0));
return Rappa::getRappa(0)->syncCpu_WaitChk(track);
case 0x3002:
P2ASSERTLINE(1883, Rappa::getRappa(1));
return Rappa::getRappa(1)->syncCpu_TblNo(track);
case 0x3003:
P2ASSERTLINE(1887, Rappa::getRappa(1));
return Rappa::getRappa(1)->syncCpu_WaitChk(track);
case 0x5000:
return Game::playData->mStoryFlags & Game::STORY_DebtPaid;
case 0:
u16 ret = 0;
for (int i = 0; i < JAIGlobalParameter::getParamSeqPlayTrackMax(); i++) {
if (JAInter::SequenceMgr::getPlayTrackInfo(i)->mSequence) {
JAISequence* seq = JAInter::SequenceMgr::getPlayTrackInfo(i)->mSequence;
JASTrack* temp;
JASTrack* ref = &seq->mSeqParameter.mTrack;
if (JAInter::SequenceMgr::getPlayTrackInfo(i)->mSequence->mSoundID & 0x800) {
temp = track->mParentTrack->mParentTrack;
} else {
temp = track->mParentTrack;
}
if (ref == temp) {
u32 route = JAInter::routeToTrack(track->_348);
PSSystem::SeqBase* childSeq = PSMGetSceneMgrCheck()->findSeq(track);
P2ASSERTLINE(1923, childSeq);
JAInter::SystemInterface::outerInit(JAInter::SequenceMgr::getPlayTrackInfo(i), temp, route, childSeq->mSoundInfo.mFlag,
0);
JAInter::SequenceMgr::getPlayTrackInfo(i)->_04 |= 1 << route;
ret = 0;
i = JAIGlobalParameter::getParamSeqPlayTrackMax(); // stupid way to break but ok
}
}
}
return ret;
case 1:
JAIBasic::setParameterSeqSync(track, 1);
break;
return JAIBasic::setParameterSeqSync(track, command);
}
P2ASSERTLINE(1948, PSSystem::spSceneMgr);
u32 testID = track->_348;
JASTrack* root = track;
while (root->mParentTrack) {
root = root->mParentTrack;
}
PSSystem::SeqBase* seq = PSSystem::spSceneMgr->getPlayingSeq(root);
P2ASSERTLINE(1957, seq);
JAISound** se = seq->getHandleP();
u32 seExists = *se != nullptr;
if (seExists == 0) {
switch (command) {
case 0x2e00:
return 30;
case 0x900:
return 1;
case 0xc00:
return 4;
case 0xd00:
return 1;
case 0x300:
return 0;
case 0x800:
case 0x600:
return 10;
default:
return 0;
}
} else {
switch (command) {
case 0x1e00: {
PSSystem::SeqTrackRoot* roottrack = (PSSystem::SeqTrackRoot*)PSSystem::getObject(track, 18);
return roottrack->update();
}
case 0x1f00: {
if (seExists <= 0) {
return 0;
}
PSSystem::SeqTrackRoot* roottrack = (PSSystem::SeqTrackRoot*)PSSystem::getObject(track, 18);
return roottrack->update();
}
case 0x2e00: {
PSSystem::SeqTrackRoot* roottrack = (PSSystem::SeqTrackRoot*)PSSystem::getObject(track, 18);
return roottrack->beatUpdate();
}
case 0x900: {
PSAutoBgm::Module* module = (PSAutoBgm::Module*)PSSystem::getObject(track, 20);
P2ASSERTLINE(2028, module);
return module->cycleLoop(track);
}
case 0xa00: {
PSAutoBgm::Module* module = (PSAutoBgm::Module*)PSSystem::getObject(track, 20);
P2ASSERTLINE(2036, module);
return module->_2B8[module->_2C0]->cycleTop(track);
}
case 0xc00: {
PSAutoBgm::Module* module = (PSAutoBgm::Module*)PSSystem::getObject(track, 20);
P2ASSERTLINE(2043, module);
return module->_2B8[module->_2C0]->play(track);
}
case 0xd00: {
PSAutoBgm::Module* module = (PSAutoBgm::Module*)PSSystem::getObject(track, 20);
P2ASSERTLINE(2049, module);
return module->_2B8[module->_2C0]->checkCloser(track);
}
case 0xb00: {
PSAutoBgm::Module* module = (PSAutoBgm::Module*)PSSystem::getObject(track, 20);
P2ASSERTLINE(2055, module);
module->_2B6 = -1;
return 0;
}
}
}
if (!seq) {
seq = PSSystem::spSceneMgr->findSeq(track);
}
switch (command) {
case 0x4000:
P2ASSERTLINE(2085, seq->getCastType() == 4);
return static_cast<PSSystem::JumpBgmSeq*>(seq)->getSeqStartPoint();
case 0x4001:
P2ASSERTLINE(2095, seq->getCastType() == 4);
return static_cast<PSSystem::JumpBgmSeq*>(seq)->outputJumpRequest();
case 0xe00:
P2ASSERTBOOLLINE(2107, seq->getCastType() == 2 || seq->getCastType() == 4 || seq->getCastType() == 3);
static_cast<PSSystem::DirectedBgm*>(seq)->initRootTrack_onPlaying(track);
return 0;
case 0xf00:
P2ASSERTBOOLLINE(2117, seq->getCastType() == 2 || seq->getCastType() == 4 || seq->getCastType() == 3);
static_cast<PSSystem::DirectedBgm*>(seq)->initChildTrack_onPlaying(track, track->_348 & 0xf);
return 0;
case 0x600:
case 0x300:
case 0x800:
JADUtility::PrmSetRc<PSAutoBgm::Track>* prm = static_cast<PSAutoBgm::AutoBgm*>(seq)->mConductorMgr.mPrmSetRc;
P2ASSERTLINE(2128, prm);
return ((PSAutoBgm::Conductor*)prm)->seqCpuSync_AutoBgm(track, command, testID, root);
default:
return 0;
}
/*
stwu r1, -0x30(r1)
mflr r0

View File

@ -1,5 +1,5 @@
#include "PSGame/SeMgr.h"
#include "PSGame/Rappa.h"
#include "PSGame/PSSe.h"
#include "PSGame/EnvSe.h"
#include "JSystem/JAudio/JALCalc.h"
#include "PSSystem/PSSystemIF.h"

View File

@ -2228,7 +2228,7 @@ u16 JumpBgmSeq::outputJumpRequest() { return mJumpPort.output(); }
* @note Address: 0x80333950
* @note Size: 0x40
*/
int JumpBgmSeq::getSeqStartPoint()
u16 JumpBgmSeq::getSeqStartPoint()
{
int start = mJumpPort._50;
onJump(start);

View File

@ -394,9 +394,6 @@ JAIStream* SysIF::makeStream()
* @note Address: 0x80338C5C
* @note Size: 0x58
*/
StreamSound::StreamSound()
{
// broken until StreamSound inherits public JAIStream
}
StreamSound::StreamSound() { }
} // namespace PSSystem