diff --git a/include/Kameda/Pause2D.h b/include/Kameda/Pause2D.h index a2e355a1..bc6b0bd8 100644 --- a/include/Kameda/Pause2D.h +++ b/include/Kameda/Pause2D.h @@ -54,5 +54,8 @@ class Pause2D { // Autogenerated static void *mPrintMessageTag; static void *mStarTag; static void *mStarDrawTag; + +private: + u8 _0[0x174]; }; // class Pause2D #endif // PAUSE2D_H diff --git a/include/Kameda/PauseManager.h b/include/Kameda/PauseManager.h index 56ffb50d..7b1044e2 100644 --- a/include/Kameda/PauseManager.h +++ b/include/Kameda/PauseManager.h @@ -1,53 +1,77 @@ #ifndef PAUSEMANAGER_H #define PAUSEMANAGER_H +#include "JSystem/J2D/J2DGrafContext.h" +#include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JKernel/JKRHeap.h" +#include "Kameda/Pause2D.h" +#include "Kameda/PrintMemoryCard.h" +#include "Kameda/Result2D.h" #include "Osako/kartPad.h" #include "types.h" -class PauseManager { +class PauseManager +{ public: - PauseManager(JKRHeap *); // 0x801343d0 - void reset(); // 0x801345fc - void draw(); // 0x801346d0 - void exec(); // 0x801348f8 - static bool tstPause(); // 0x80135288 - void wipeOut(int); // 0x80135290 - static int getPauseChoice(); // 0x801352d0 - void setTA(); // 0x8013541c - - void setResultStartFlag(bool flag) {mResultStart = flag; } + PauseManager(JKRHeap *heap); // 0x801343d0 + void reset(); // 0x801345fc + void draw(); // 0x801346d0 + void exec(); // 0x801348f8 + static bool tstPause(); // 0x80135288 + void wipeOut(int); // 0x80135290 + static int getPauseChoice(); // 0x801352d0 + void setTA(); // 0x8013541c + + void setResultStartFlag(bool flag) { mResultStart = flag; } void setGameOverFlag(bool flag) { mGameOver = flag; } void setExecFlag(bool flag) { mExec = flag; } void setPauseEndFlag(bool flag) { mPauseEnd = flag; } - + void enablePause() { _14 = 0; } - static PauseManager *getManager() { - return mThis; - } + static PauseManager *getManager() { return mThis; } bool isResultStart() const { return mResultStart; } private: - static PauseManager *mThis; // 0x80416298 - static bool mIsPause; // 0x8041629c - static int mPauseSelector; // 0x804162a0 - static int mPauseChoice; // 0x804162a4 - static int mPauseNextChoice; // 0x804162a8 - static KartGamePad *mPausePad; // 0x804162ac - - u8 _0[0xe]; - bool mResultStart; - bool _f; - bool mGameOver; - u8 _11[0x13 - 0x11]; - bool mExec; - u32 _14; - bool mPauseEnd; - u8 _19[0x3c - 0x19]; + static PauseManager *mThis; // 0x80416298 + static bool mIsPause; // 0x8041629c + static int mPauseSelector; // 0x804162a0 + static int mPauseChoice; // 0x804162a4 + static int mPauseNextChoice; // 0x804162a8 + static KartGamePad *mPausePad; // 0x804162ac + + bool mNetFlag; // 0x00 + u8 _1[3]; // 0x01 + JKRArchive *mArchive; // 0x04 + PrintMemoryCard *mPrintMemoryCard; // 0x08 + u8 _c; // 0x0c + u8 _d; // 0x0d + bool mResultStart; // 0x0e + bool _f; // 0x0f + bool mGameOver; // 0x10 + u8 _11; // 0x11 + u8 _12; // 0x12 + bool mExec; // 0x13 + s32 _14; // 0x14 + bool mPauseEnd; // 0x18 + u8 _19; // 0x19 + u8 _1a; // 0x1a + u8 _1b; // 0x1b + Pause2D *mPause2D; // 0x1c + Result2D *mResult2D; // 0x20 + J2DOrthoGraph *mOrthoGraph; // 0x24 + s32 _28; // 0x28 + s32 _2c; // 0x2c + s32 _30; // 0x30 + u32 _34; // 0x30 + bool _38; // 0x38 + u8 _39[3]; // 0x39 }; -inline PauseManager *GETPauseManager() { return PauseManager::getManager(); } +inline PauseManager *GETPauseManager() +{ + return PauseManager::getManager(); +} #endif diff --git a/include/Kameda/Result2D.h b/include/Kameda/Result2D.h index 5a111778..c1c5e04c 100644 --- a/include/Kameda/Result2D.h +++ b/include/Kameda/Result2D.h @@ -57,7 +57,7 @@ class Result2D { // Autogenerated void setDrawVS(); // 0x8014cb58 void setDrawTA(); // 0x8014cc10 void setDrawMG(); // 0x8014cd94 - void getResultSelector(); // 0x8014ce48 + static int getResultSelector(); // 0x8014ce48 void setRaceRank(); // 0x8014ce50 void setGPRank(); // 0x8014d924 void setVS(); // 0x8014df84 @@ -81,9 +81,12 @@ class Result2D { // Autogenerated void getFrameColor(JUTColor &); // 0x80150500 void getScale(int); // 0x8015057c void setScale(int); // 0x801505c4 - void setGPClr(); // 0x80150804 - void getAnmEnd(); // 0x80150830 - + static void setGPClr(); // 0x80150804 + bool getAnmEnd(); // 0x80150830 + static bool getDrawFlag(); + + static void setDrawFlag(bool drawFlag); + static const u64 mSetWordLineTag[9]; // 0x8036ec18 static const u64 mResultLayoutTag[11]; // 0x8036ec60 static const u64 mResultLineTag[20]; // 0x8036ecb8 @@ -101,6 +104,9 @@ class Result2D { // Autogenerated // Inline/Unused ~Result2D(); void getCharPos(int); + +public: + u8 _0[0x1c24]; }; // class Result2D #endif // RESULT2D_H diff --git a/include/Kameda/SequenceInfo.h b/include/Kameda/SequenceInfo.h index c785ca40..e72b6f63 100644 --- a/include/Kameda/SequenceInfo.h +++ b/include/Kameda/SequenceInfo.h @@ -127,8 +127,10 @@ class SequenceInfo JMARandFast mRnd; // 00 int mStartNo[8]; // 004 KartGamePad *mDecidePad; // 024 +public: u8 _28; // 028 int _2c; // 02C +private: int _30; // 030 u8 mGhostFlags; // 034 u8 _35[0x3C - 0x35]; // 035 diff --git a/include/Kameda/WipeManager.h b/include/Kameda/WipeManager.h index 07833c4c..8511ec6a 100644 --- a/include/Kameda/WipeManager.h +++ b/include/Kameda/WipeManager.h @@ -71,6 +71,8 @@ class WipeManager void startWipe(int idx) { mMoveFlag[idx] = true; } void stopWipe(int idx) { mMoveFlag[idx] = false; } int getScreenCount() const { return mScrnCount; } + TWipeCurtain *getWipeCurtain() const { return mWipeCurtain; } + Mario *getMario() const { return mMario; } static WipeManager *getManager() { return mThis; } diff --git a/include/Osako/PadRecorder.h b/include/Osako/PadRecorder.h index bdcc8b22..934a6940 100644 --- a/include/Osako/PadRecorder.h +++ b/include/Osako/PadRecorder.h @@ -40,12 +40,12 @@ class PadRecorder KartPadRecord *getGhostRecord(u8 no); void playGhost(); // Inline - u32 getFrame() { return mFrame; }; + s32 getFrame() { return mFrame; }; void setFrame(u32 frame) { mFrame = frame; } static PadRecorder *mspRecorder; private: - u32 mFrame; + s32 mFrame; PadState mState; KartPadData mPadData[NUM_PLAYERPADS]; JUTGamePad::CButton mButton[NUM_PLAYERPADS]; diff --git a/src/Kameda/PauseManager.cpp b/src/Kameda/PauseManager.cpp index f84c724b..3e1fa71e 100644 --- a/src/Kameda/PauseManager.cpp +++ b/src/Kameda/PauseManager.cpp @@ -1,34 +1,1079 @@ #include "Kameda/PauseManager.h" -#include "mathHelper.h" -PauseManager *PauseManager::mThis; // 0x80416298 +#include "Inagaki/GameAudioMain.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "Kameda/Goal2D.h" +#include "Kameda/J2DManager.h" +#include "Kameda/Pause2D.h" +#include "Kameda/PrintMemoryCard.h" +#include "Kameda/Result2D.h" +#include "Kameda/SequenceInfo.h" +#include "Kameda/WipeManager.h" +#include "Kaneshige/RaceInfo.h" +#include "Kaneshige/RaceMgr.h" +#include "Osako/NetGameMgr.h" +#include "Osako/RaceApp.h" +#include "Osako/ResMgr.h" +#include "Osako/kartPad.h" +#include "Osako/system.h" +#include "mathHelper.h" // For unused data + +PauseManager *PauseManager::mThis; bool PauseManager::mIsPause; int PauseManager::mPauseSelector; int PauseManager::mPauseChoice; int PauseManager::mPauseNextChoice; KartGamePad *PauseManager::mPausePad; -PauseManager::PauseManager(JKRHeap *) {} +static int button; + +PauseManager::PauseManager(JKRHeap *heap) +{ + if (!heap) + { + heap = JKRHeap::getCurrentHeap(); + } + + mArchive = ResMgr::getArchive(ResMgr::mcArcMRAMLoc); + mOrthoGraph = System::getJ2DOrtho(); + mPrintMemoryCard = new (heap, 0) PrintMemoryCard(heap); + + mThis = this; + + mNetFlag = NetGameMgr::ptr()->getState() != 0; + _12 = 0; + mExec = false; + + mPause2D = new (heap, 0) Pause2D(heap); + mResult2D = new (heap, 0) Result2D(heap); + + _11 = 1; + for (int i = 0; i < RaceMgr::getManager()->getKartNumber(); ++i) + { + for (int j = 0; j < 2; ++j) + { + if (gSequenceInfo.getPad2Player(gRaceInfo.getKartInfo(i)->getPad(j)) != -1) + { + _11 = 0; + } + } + } + + reset(); +} + +void PauseManager::reset() +{ + _12 = 1; + mExec = true; + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + + mIsPause = false; + mPauseSelector = 0; + mPauseChoice = 13; + mPauseNextChoice = 13; + mPausePad = 0; + + _c = 0; + _d = 0; + mResultStart = false; + _f = 0; + mGameOver = false; + _14 = -1; + mPauseEnd = false; + mPause2D->init(); + mResult2D->init(); + _28 = 0; + _2c = 0; + _30 = 0; + _34 = 0; + _38 = 0; + + if (RaceMgr::getManager()->isReplayMode() && RaceMgr::getManager()->getRaceMode() == GRAND_PRIX) + { + Result2D::setGPClr(); + } + + mPrintMemoryCard->init(PrintMemoryCard::mcMsg40); +} + +void PauseManager::draw() +{ + if (!_12) + return; + + if (!mNetFlag) + { + mResult2D->draw(); + } + + if (_11 || (!mResultStart && !RaceMgr::getManager()->isReplayMode())) + { + mPause2D->draw(); + } + + if (_28) + { + switch (mPauseNextChoice) + { + case 1: + case 7: + WipeManager::getManager()->getMario()->draw((f32)(_28 + 1) / 40.0f, JUTColor(0x00, 0x00, 0x00, 0xFF)); + break; + default: + _28 = 1; + } + } + + if (_2c > 0 && _30 > 0) + { + f32 f = (f32)_2c / (f32)_30; + if (f > 1.0f) + { + f = 1.0f; + } + + WipeManager::getManager()->getWipeCurtain()->calc(J2DManager::getManager()->getStatus2Kart(0x0), + f, + JUTColor(0x00, 0x00, 0x00, 0xFF)); + + WipeManager::getManager()->getWipeCurtain()->draw(J2DManager::getManager()->getStatus2Kart(0x0), + f, + JUTColor(0x00, 0x00, 0x00, 0xFF)); + } + + if (_c) + { + mPrintMemoryCard->draw(); + } +} + +void PauseManager::exec() +{ + if (!mExec) + return; + + if (_14 >= 0) + { + _14 += 1; + } + + if (_c) + { + mPrintMemoryCard->calc(); + + switch (mPrintMemoryCard->get_14Thing()) + { + case 0: + _c = 0; + if (_d) + { + goto labelA; + } + break; + case 1: + _c = 0; + mPrintMemoryCard->init(PrintMemoryCard::mcMsg40); + mPrintMemoryCard->setStuff(0, 0, 0); + break; + } + return; +#if 0 + PrintMemoryCard::calc(*(PrintMemoryCard **)(this + 8)); + iVar1 = *(int *)(this + 8); + if ((*(int *)(iVar1 + 0x1c) == 2) && + ((*(int *)(iVar1 + 0x20) == 0 || (*(int *)(iVar1 + 0x20) == 0x19)))) + { + iVar1 = *(int *)(iVar1 + 0x14); + } + else + { + iVar1 = 2; + } + if (iVar1 == 1) + { + this[0xc] = (PauseManager)0x0; + PrintMemoryCard::init(*(PrintMemoryCard **)(this + 8), (EVP_PKEY_CTX *)0x28); + iVar1 = *(int *)(this + 8); + *(undefined *)(iVar1 + 0xc) = 0; + *(undefined *)(iVar1 + 0xd) = 0; + *(undefined *)(iVar1 + 0xe) = 0; + return; + } + if (0 < iVar1) + { + return; + } + if (iVar1 < 0) + { + return; + } + this[0xc] = (PauseManager)0x0; + PVar9 = extraout_r4; + if (this[0xd] == (PauseManager)0x0) + { + ... + } +#endif + } -void PauseManager::reset() {} + if (_2c > 0 && _30 > 0) + { + if (_2c == _30) + { + JUTFader *fader = System::mspDisplay->getFader(); + if (fader) + { + fader->startFadeOut(1); + } + } + _2c += 1; + } -void PauseManager::draw() {} + int var_28 = _28; + if (var_28) + { + if (var_28 < 40) + { + _28 = var_28 + 1; + return; + } -void PauseManager::exec() { - //void Result2D::getDrawFlag() {} - //void Result2D::setDrawFlag(bool) {} + mPauseChoice = mPauseNextChoice; + mPausePad = 0; + + J2DManager::getManager()->startPreRace(); + + _28 = 0; + Result2D::setDrawFlag(_38); + return; + } + +#if 0 + if ((0 < *(int *)(this + 0x2c)) && (0 < *(int *)(this + 0x30))) + { + if ((*(int *)(this + 0x2c) == *(int *)(this + 0x30)) && + (piVar2 = *(int **)(*(int *)(unaff_r13 + -0x5618) + 4), piVar2 != (int *)0x0)) + { + (**(code **)(*piVar2 + 0x10))(piVar2, 1); + in_r4 = extraout_r4_03; + } + *(int *)(this + 0x2c) = *(int *)(this + 0x2c) + 1; + } + iVar1 = *(int *)(this + 0x28); + if (iVar1 != 0) + { + if (iVar1 < 0x28) + { + *(int *)(this + 0x28) = iVar1 + 1; + return; + } + *(undefined4 *)(unaff_r13 + -0x5cd4) = 0; + *(undefined4 *)(unaff_r13 + -0x5cdc) = *(undefined4 *)(unaff_r13 + -0x5cd8); + J2DManager::startPreRace(*(J2DManager **)(unaff_r13 + -0x5cf8)); + *(undefined4 *)(this + 0x28) = 0; + Result2D::setDrawFlag((Result2D *)(uint)(byte)this[0x38], extraout_r4_04); + return; + } +#endif + + int var_34 = _34; + if (var_34) + { + if (var_34 < 11) + { + _34 = var_34 + 1; + } + else + { + mPauseChoice = mPauseNextChoice; + mPausePad = 0; + _34 = 0; + Result2D::setDrawFlag(_38); + + switch (mPauseNextChoice) + { + case 1: + case 7: + mPauseChoice = 13; + _28 = 1; + GameAudio::Main::getAudio()->fadeOutAll(40); + break; + default: + { + switch (mPauseNextChoice) + { + case 13: + if (!_38) + { + mIsPause = 0; + } + break; + default: + _34 = 1; + break; + } + break; + } + } + } + + mResult2D->calc(gSequenceInfo.getDecidePad()); + return; + } + + if (_14 < 120) + return; + +#if 0 + iVar1 = *(int *)(this + 0x34); + if (iVar1 != 0) + { + if (iVar1 < 0xb) + { + *(int *)(this + 0x34) = iVar1 + 1; + } + else + { + *(undefined4 *)(unaff_r13 + -0x5cd4) = 0; + *(undefined4 *)(unaff_r13 + -0x5cdc) = *(undefined4 *)(unaff_r13 + -0x5cd8); + *(undefined4 *)(this + 0x34) = 0; + Result2D::setDrawFlag((Result2D *)(uint)(byte)this[0x38], (bool)in_r4); + iVar1 = *(int *)(unaff_r13 + -0x5cd8); + if ((iVar1 == 7) || ((iVar1 < 7 && (iVar1 == 1)))) + { + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0xd; + *(undefined4 *)(this + 0x28) = 1; + GameAudio::Main::fadeOutAll(*(Main **)(unaff_r13 + -0x5d68), 0x28); + } + else if (iVar1 == 0xd) + { + if (this[0x38] == (PauseManager)0x0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 0; + } + } + else + { + *(undefined4 *)(this + 0x34) = 1; + } + } + pKVar3 = + (KartGamePad *)SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + Result2D::calc(*(Result2D **)(this + 0x20), pKVar3); + return; + } + if (*(int *)(this + 0x14) < 0x78) + { + return; + } +#endif + + if (!tstPause() && !RaceMgr::getManager()->isReplayMode()) + { + if (_11) + { + mPausePad = &gGamePad1P; + mPauseSelector = 0; + mPauseChoice = 13; + } + else + { + KartGamePad *kartgamePad = gpaGamePad[0]; + if (kartgamePad && kartgamePad->testTrigger(JUTGamePad::START)) + { + mPausePad = kartgamePad; + mPauseSelector = 0; + mPauseChoice = 13; + } + } + } + +#if 0 + cVar7 = tstPause((PauseManager *)0x0); + if ((cVar7 == '\0') && ((*(ushort *)(*(int *)(unaff_r13 + -0x5bd8) + 0x2c) & 1) == 0)) + { + if (this[0x11] == (PauseManager)0x0) + { + if ((OsakoM::gpaGamePad != (undefined *)0x0) && + ((*(uint *)(OsakoM::gpaGamePad + 0x1c) & 0x1000) != 0)) + { + *(undefined **)(unaff_r13 + -0x5cd4) = OsakoM::gpaGamePad; + *(undefined4 *)(unaff_r13 + -0x5ce0) = 0; + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0xd; + } + } + else + { + *(undefined **)(unaff_r13 + -0x5cd4) = &OsakoM::gGamePad1P; + *(undefined4 *)(unaff_r13 + -0x5ce0) = 0; + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0xd; + } + } +#endif + + if (!mNetFlag && ((mResultStart && Goal2D::mDrawEndFlag) || RaceMgr::getManager()->isReplayMode())) + { + mResult2D->calc(gSequenceInfo.getDecidePad()); + + if (RaceMgr::getManager()->isReplayMode() && + RaceApp::ptr()->getPadRecorder()->getFrame() >= MAX_INPUT_FRAME_COUNT) + { + mIsPause = 1; + mPause2D->init(); + Pause2D::setPauseStatus((Pause2D::PauseStatus)1); + GameAudio::Main::getAudio()->fadeOutAll(40); + mPauseNextChoice = 7; + _34 = 1; + _38 = 0; + } + else + { + KartGamePad *decidePad = gSequenceInfo.getDecidePad(); + if (decidePad->testTrigger(JUTGamePad::A) && Result2D::mResultState == 2 && mResult2D->getAnmEnd()) + { + if (Result2D::getDrawFlag()) + { + switch (Result2D::getResultSelector()) + { + case 1: + case 7: + GameAudio::Main::getAudio()->startSystemSe(0x20002); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + GameAudio::Main::getAudio()->fadeOutAll(40); + + mPauseNextChoice = Result2D::getResultSelector(); + _34 = 1; + _38 = 0; + mResult2D->_0[0x1980] = 1; + break; + case 8: + mPauseNextChoice = Result2D::getResultSelector(); + if (!RaceMgr::getManager()->isRaceModeGp()) + { + GameAudio::Main::getAudio()->startSystemSe(0x20023); + goto labelA; + } + _c = 1; + _d = 0; + mPrintMemoryCard->init(PrintMemoryCard::mcMsg39); + mPrintMemoryCard->calc(); + goto labelC; + default: + GameAudio::Main::getAudio()->startSystemSe(0x20002); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + mPauseNextChoice = Result2D::getResultSelector(); + _34 = 1; + _38 = 0; + mResult2D->_0[0x1920] = 1; + } + } +#if 0 + pRVar4 = (Result2D *)Result2D::getDrawFlag(pRVar4); + if (((uint)pRVar4 & 0xff) != 0) + { + pRVar4 = (Result2D *)Result2D::getResultSelector(pRVar4); + if (pRVar4 == (Result2D *)&DAT_00000007) + { + LAB_80134cc4: + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20002); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 2); + pRVar4 = (Result2D *)GameAudio::Main::fadeOutAll( + *(Main **)(unaff_r13 + -0x5d68), + 0x28); + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + else + { + if ((int)pRVar4 < 7) + { + if (pRVar4 == (Result2D *)&DAT_00000001) + goto LAB_80134cc4; + } + else if ((int)pRVar4 < 9) + { + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + if (*(int *)(*(int *)(*(int *)(unaff_r13 + -0x5bd8) + 0x38) + 8) != + 2) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20023); + goto LAB_80134d64; + } + this[0xc] = (PauseManager)0x1; + this[0xd] = (PauseManager)0x0; + PrintMemoryCard::init(*(PrintMemoryCard **)(this + 8), + (EVP_PKEY_CTX *)0x27); + PrintMemoryCard::calc(*(PrintMemoryCard **)(this + 8)); + goto LAB_80134fa0; + } + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20002); + pRVar4 = (Result2D *)GameAudio::Main::setPause( + *(Main **)(unaff_r13 + -0x5d68), + 2); + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } +#endif + } + else + { + if (gSequenceInfo.getDecidePad()->testTrigger(JUTGamePad::START)) + { + if (!RaceMgr::getManager()->isReplayMode()) + { + if (Result2D::getDrawFlag()) + { + if (!mResult2D->getAnmEnd()) + { + GameAudio::Main::getAudio()->startSystemSe(0x20009); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)0); + mPauseNextChoice = 13; + _34 = 1; + _38 = 0; + mResult2D->_0[0x1980] = 1; + } + } + else + { + mIsPause = 1; + mPause2D->init(); + Pause2D::setPauseStatus((Pause2D::PauseStatus)1); + GameAudio::Main::getAudio()->startSystemSe(0x20008); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)1); + mPauseNextChoice = 13; + _34 = 1; + _38 = 1; + Result2D::setDrawFlag(true); + mResult2D->init(); + } + } + } + else + { + if (gSequenceInfo.getDecidePad()->testTrigger(JUTGamePad::A)) + { + if (!Result2D::getDrawFlag()) + { + mIsPause = 1; + mPause2D->init(); + Pause2D::setPauseStatus((Pause2D::PauseStatus)1); + GameAudio::Main::getAudio()->startSystemSe(0x20008); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)1); + mPauseNextChoice = 13; + _34 = 1; + _38 = 1; + Result2D::setDrawFlag(true); + mResult2D->init(); + } + } + else if (gSequenceInfo.getDecidePad()->testTrigger(JUTGamePad::B) && + RaceMgr::getManager()->isReplayMode() && Result2D::getDrawFlag()) + { + GameAudio::Main::getAudio()->startSystemSe(0x20009); + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)0); + mPauseNextChoice = 13; + _34 = 1; + _38 = 0; + mResult2D->_0[0x1980] = 1; + } + } +#if 0 + iVar1 = SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((*(uint *)(iVar1 + 0x1c) & 0x1000) == 0) + { + iVar1 = SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((*(uint *)(iVar1 + 0x1c) & 0x100) == 0) + { + iVar1 = + SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((((*(uint *)(iVar1 + 0x1c) & 0x200) != 0) && + ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != + 0)) && + (cVar7 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)), + cVar7 != '\0')) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20009); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 0); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } + else if ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0) + { + uVar10 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)); + pEVar8 = (EVP_PKEY_CTX *)uVar10; + if ((uVar10 & 0xff00000000) == 0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + Pause2D::init(*(Pause2D **)(this + 0x1c), pEVar8); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, + (PauseStatus)pEVar8); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20008); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 1); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x1; + Result2D::setDrawFlag((Result2D *)&DAT_00000001, extraout_r4_06); + Result2D::init(*(Result2D **)(this + 0x20), ctx_01); + } + } + } + else if ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0) + { + uVar10 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)); + pEVar8 = (EVP_PKEY_CTX *)uVar10; + if ((uVar10 & 0xff00000000) == 0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + Pause2D::init(*(Pause2D **)(this + 0x1c), pEVar8); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, (PauseStatus)pEVar8); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20008); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 1); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x1; + Result2D::setDrawFlag((Result2D *)&DAT_00000001, extraout_r4_05); + Result2D::init(*(Result2D **)(this + 0x20), ctx_00); + } + else + { + cVar7 = Result2D::getAnmEnd(*(Result2D **)(this + 0x20)); + if (cVar7 != '\0') + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20009); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 0); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } + } +#endif + } + } + } + +#if 0 + if ((*this == (PauseManager)0x0) && + (((this[0xe] != (PauseManager)0x0 && (*(char *)(unaff_r13 + -0x5cf0) != '\0')) || + ((*(ushort *)(*(int *)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0)))) + { + pKVar3 = + (KartGamePad *)SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + Result2D::calc(*(Result2D **)(this + 0x20), pKVar3); + if (((*(ushort *)(*(int *)(unaff_r13 + -0x5bd8) + 0x2c) & 1) == 0) || + (**(int **)(*(int *)(unaff_r13 + -0x5668) + 0x28) < 0x45c8)) + { + iVar1 = SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if (((*(uint *)(iVar1 + 0x1c) & 0x100) == 0) || + ((*(int *)(unaff_r13 + -0x5c90) != 2 || + (pRVar4 = (Result2D *)Result2D::getAnmEnd(*(Result2D **)(this + 0x20)), + ((uint)pRVar4 & 0xff) == 0)))) + { + iVar1 = SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((*(uint *)(iVar1 + 0x1c) & 0x1000) == 0) + { + iVar1 = SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((*(uint *)(iVar1 + 0x1c) & 0x100) == 0) + { + iVar1 = + SequenceInfo::getDecidePad((SequenceInfo *)&KamedaM::gSequenceInfo); + if ((((*(uint *)(iVar1 + 0x1c) & 0x200) != 0) && + ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != + 0)) && + (cVar7 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)), + cVar7 != '\0')) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20009); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 0); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } + else if ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0) + { + uVar10 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)); + pEVar8 = (EVP_PKEY_CTX *)uVar10; + if ((uVar10 & 0xff00000000) == 0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + Pause2D::init(*(Pause2D **)(this + 0x1c), pEVar8); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, + (PauseStatus)pEVar8); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20008); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 1); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x1; + Result2D::setDrawFlag((Result2D *)&DAT_00000001, extraout_r4_06); + Result2D::init(*(Result2D **)(this + 0x20), ctx_01); + } + } + } + else if ((*(ushort *)(*(Result2D **)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0) + { + uVar10 = Result2D::getDrawFlag(*(Result2D **)(unaff_r13 + -0x5bd8)); + pEVar8 = (EVP_PKEY_CTX *)uVar10; + if ((uVar10 & 0xff00000000) == 0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + Pause2D::init(*(Pause2D **)(this + 0x1c), pEVar8); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, (PauseStatus)pEVar8); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20008); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 1); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x1; + Result2D::setDrawFlag((Result2D *)&DAT_00000001, extraout_r4_05); + Result2D::init(*(Result2D **)(this + 0x20), ctx_00); + } + else + { + cVar7 = Result2D::getAnmEnd(*(Result2D **)(this + 0x20)); + if (cVar7 != '\0') + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20009); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 0); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 0xd; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } + } + } + else + { + pRVar4 = (Result2D *)Result2D::getDrawFlag(pRVar4); + if (((uint)pRVar4 & 0xff) != 0) + { + pRVar4 = (Result2D *)Result2D::getResultSelector(pRVar4); + if (pRVar4 == (Result2D *)&DAT_00000007) + { + LAB_80134cc4: + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20002); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 2); + pRVar4 = (Result2D *)GameAudio::Main::fadeOutAll( + *(Main **)(unaff_r13 + -0x5d68), + 0x28); + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + else + { + if ((int)pRVar4 < 7) + { + if (pRVar4 == (Result2D *)&DAT_00000001) + goto LAB_80134cc4; + } + else if ((int)pRVar4 < 9) + { + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + if (*(int *)(*(int *)(*(int *)(unaff_r13 + -0x5bd8) + 0x38) + 8) != + 2) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20023); + goto LAB_80134d64; + } + this[0xc] = (PauseManager)0x1; + this[0xd] = (PauseManager)0x0; + PrintMemoryCard::init(*(PrintMemoryCard **)(this + 8), + (EVP_PKEY_CTX *)0x27); + PrintMemoryCard::calc(*(PrintMemoryCard **)(this + 8)); + goto LAB_80134fa0; + } + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), + 0x20002); + pRVar4 = (Result2D *)GameAudio::Main::setPause( + *(Main **)(unaff_r13 + -0x5d68), + 2); + uVar6 = Result2D::getResultSelector(pRVar4); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + } + } + } + } + else + { + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + pEVar8 = ctx; + Pause2D::init(*(Pause2D **)(this + 0x1c), ctx); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, (PauseStatus)pEVar8); + GameAudio::Main::fadeOutAll(*(Main **)(unaff_r13 + -0x5d68), 0x28); + *(undefined4 *)(unaff_r13 + -0x5cd8) = 7; + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + } + } +#endif + +#if 0 +LAB_80134fa0: + if (*(KartGamePad **)(unaff_r13 + -0x5cd4) == (KartGamePad *)0x0) + { + return; + } + if (*this != (PauseManager)0x0) + { + return; + } + if ((this[0x18] != (PauseManager)0x0) && (this[0x11] == (PauseManager)0x0)) + { + return; + } + if ((*(ushort *)(*(int *)(unaff_r13 + -0x5bd8) + 0x2c) & 1) != 0) + { + return; + } + this_00 = (PauseManager *)Pause2D::calc(*(Pause2D **)(this + 0x1c), + *(KartGamePad **)(unaff_r13 + -0x5cd4)); + uVar10 = tstPause(this_00); + pEVar8 = (EVP_PKEY_CTX *)uVar10; + if ((uVar10 & 0xff00000000) == 0) + { + if ((*(uint *)(*(int *)(unaff_r13 + -0x5cd4) + 0x1c) & 0x1000) == 0) + { + return; + } + *(undefined *)(unaff_r13 + -0x5ce4) = 1; + Pause2D::init(*(Pause2D **)(this + 0x1c), pEVar8); + Pause2D::setPauseStatus((Pause2D *)&DAT_00000001, (PauseStatus)pEVar8); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20008); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 1); + return; + } + uVar11 = Pause2D::getPauseStatus((Pause2D *)(uVar10 >> 0x20)); + pPVar5 = (Pause2D *)((ulonglong)uVar11 >> 0x20); + if (pPVar5 != (Pause2D *)&DAT_00000003) + { + iVar1 = Pause2D::getPauseStatus(pPVar5); + if (iVar1 != 0) + { + return; + } + iVar1 = *(int *)(unaff_r13 + -0x5cd0); + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0xd; + if (iVar1 != 1) + { + if ((iVar1 < 1) && (-1 < iVar1)) + { + pPVar5 = (Pause2D *)Pause2D::getPauseSelector((Pause2D *)0xd); + if (pPVar5 == (Pause2D *)0x0) + { + *(undefined *)(unaff_r13 + -0x5ce4) = 0; + pPVar5 = + (Pause2D *)GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), + 0); + } + uVar6 = Pause2D::getPauseSelector(pPVar5); + *(undefined4 *)(unaff_r13 + -0x5cdc) = uVar6; + *(undefined4 *)(unaff_r13 + -0x5cd4) = 0; + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 2); + return; + } + this_01 = (JUTAssertion *)JUTAssertion::getSDevice((JUTAssertion *)0xd); + JUTAssertion::showAssert_f(this_01, + 0x8036d790, + (char *)0x229, + unaff_r2 + -0x63f0, + (char *)(unaff_r2 + -0x63ec), + in_r8); + Dolphin::OSPanic(s_PauseManager.cpp_8036d790, 0x229, unaff_r2 + -0x6408); + return; + } + *(undefined *)(unaff_r13 + -0x5ce4) = 0; + *(undefined4 *)(unaff_r13 + -0x5ce0) = 0; + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0; + *(undefined4 *)(unaff_r13 + -0x5cd4) = 0; + return; + } + *(undefined4 *)(unaff_r13 + -0x5cdc) = 0xd; + pPVar5 = *(Pause2D **)(*(int *)(unaff_r13 + -0x5cd4) + 0x1c); + if (((uint)pPVar5 & 0x100) == 0) + { + if (((uint)pPVar5 & 0x1000) == 0) + { + return; + } + *(undefined4 *)(unaff_r13 + -0x5cd0) = 1; + Pause2D::setPauseStatus((Pause2D *)0x4, (PauseStatus)uVar11); + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20009); + GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 0); + return; + } + iVar1 = Pause2D::getPauseSelector(pPVar5); + if (iVar1 == 1) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20023); + *(undefined4 *)(this + 0x28) = 1; + GameAudio::Main::fadeOutAll(*(Main **)(unaff_r13 + -0x5d68), 0x28); + pPVar5 = (Pause2D *)GameAudio::Main::setPause(*(Main **)(unaff_r13 + -0x5d68), 2); + uVar6 = Pause2D::getPauseSelector(pPVar5); + *(undefined4 *)(unaff_r13 + -0x5cd8) = uVar6; + return; + } + if (iVar1 < 1) + { + if (-1 < iVar1) + { + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20009); + *(undefined4 *)(unaff_r13 + -0x5cd0) = 0; + Pause2D::setPauseStatus((Pause2D *)0x4, extraout_r4_01); + return; + } + } + else if (iVar1 == 8) + { + if (*(int *)(*(int *)(*(int *)(unaff_r13 + -0x5bd8) + 0x38) + 8) == 2) + { + this[0xc] = (PauseManager)0x1; + this[0xd] = (PauseManager)0x1; + PrintMemoryCard::init(*(PrintMemoryCard **)(this + 8), (EVP_PKEY_CTX *)0x27); + PrintMemoryCard::calc(*(PrintMemoryCard **)(this + 8)); + return; + } + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20023); + PVar9 = extraout_r4_00; + goto LAB_801350c4; + } + GameAudio::Main::startSystemSe(*(Main **)(unaff_r13 + -0x5d68), 0x20023); + *(undefined4 *)(unaff_r13 + -0x5cd0) = 0; + Pause2D::setPauseStatus((Pause2D *)0x4, extraout_r4_02); +#endif + +labelA: + _34 = 1; + _38 = 0; + mResult2D->_0[0x1980] = 1; + goto labelB; +labelB: + +labelC: + button = 0; + Pause2D::setPauseStatus((Pause2D::PauseStatus)0x4); + +#if 0 + LAB_80134d64: + *(undefined4 *)(this + 0x34) = 1; + this[0x38] = (PauseManager)0x0; + *(undefined4 *)(*(int *)(this + 0x20) + 0x1980) = 1; + goto LAB_80134fa0; + } + LAB_801350c4: + *(undefined4 *)(unaff_r13 + -0x5cd0) = 0; + Pause2D::setPauseStatus((Pause2D *)0x4, PVar9); +#endif } -bool PauseManager::tstPause() { +bool PauseManager::tstPause() +{ return mIsPause; } -void PauseManager::wipeOut(int) {} +void PauseManager::wipeOut(int param) +{ + _2c = 1; + _30 = param; + + WipeManager::getManager()->getWipeCurtain()->reset(); +} + +int PauseManager::getPauseChoice() +{ + if (mPauseChoice == 8) + { + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + } -int PauseManager::getPauseChoice() {} + if (mThis->_f) + { + mPauseChoice = 5; + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + } + + if (mThis->mGameOver) + { + mPauseChoice = 9; + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + } + + switch (mPauseChoice) + { + case 2: + case 3: + case 4: + case 6: + gSequenceInfo._28 = 1; + break; + } + + switch (mPauseChoice) + { + case 4: + gSequenceInfo._2c = 0; + break; + case 6: + gSequenceInfo._2c = 1; + break; + } + + if (mPauseChoice == 5) + { + GameAudio::Main::getAudio()->setPause((GameAudio::Main::PAUSE_STATUS)2); + + if (gSequenceInfo.isEndGP()) + { + if (gSequenceInfo.isGameClr()) + { + mPauseChoice = 11; + } + else + { + mPauseChoice = 12; + } + } + } + + return mPauseChoice; +} -void PauseManager::setTA() { - +void PauseManager::setTA() +{ + mResult2D->setTA(); } -#include "JSystem/JAudio/JASFakeMatch2.h" +#include "JSystem/JAudio/JASFakeMatch2.h" // For static initializer diff --git a/src/Kameda/Result2D.cpp b/src/Kameda/Result2D.cpp index 535a4c9a..1f337c54 100644 --- a/src/Kameda/Result2D.cpp +++ b/src/Kameda/Result2D.cpp @@ -165,7 +165,10 @@ void Result2D::setDrawTA() {} void Result2D::setDrawMG() {} -void Result2D::getResultSelector() {} +int Result2D::getResultSelector() +{ + return mResultSelector; +} void Result2D::setRaceRank() {} @@ -215,6 +218,12 @@ void Result2D::setScale(int) {} void Result2D::setGPClr() {} -void Result2D::getAnmEnd() {} +bool Result2D::getAnmEnd() {} + +bool Result2D::getDrawFlag() { return mDrawFlag; } +void Result2D::setDrawFlag(bool drawFlag) +{ + mDrawFlag = drawFlag; +} #include "JSystem/JAudio/JASFakeMatch2.h"