1#include <game/bases/d_s_boot.hpp>
2#include <game/bases/d_system.hpp>
3#include <game/bases/d_game_com.hpp>
4#include <game/bases/d_graph.hpp>
6#include <game/bases/d_info.hpp>
7#include <game/bases/d_s_stage.hpp>
9#include <game/bases/d_reset.hpp>
10#include <game/bases/d_remocon_manager.hpp>
11#include <game/bases/d_dylink.hpp>
12#include <game/bases/d_hbm.hpp>
13#include <game/bases/d_fader.hpp>
14#include <game/bases/d_wipe_kuppa.hpp>
15#include <game/bases/d_wipe_dokan.hpp>
16#include <game/bases/d_wipe_mario.hpp>
17#include <game/bases/d_wipe_circle.hpp>
18#include <game/bases/d_nand_thread.hpp>
19#include <game/bases/d_s_restart_crsin.hpp>
20#include <game/bases/d_save_mng.hpp>
21#include <game/bases/d_warning_manager.hpp>
22#include <game/mLib/m_pad.hpp>
23#include <revolution/VI.h>
40 if (s_DBasesDMC.load_async()) {
48 if (s_EnemiesDMC.load_async()) {
56 if (s_En_BossDMC.load_async()) {
65 dDyl::LinkASync(fProfile::CRSIN) == 1 &&
66 dDyl::LinkASync(fProfile::STAGE) == 1 &&
67 dDyl::LinkASync(fProfile::RESTART_CRSIN) == 1 &&
68 dDyl::LinkASync(fProfile::GAMEOVER) == 1 &&
69 dDyl::LinkASync(fProfile::RESULT) == 1 &&
70 dDyl::LinkASync(fProfile::MOVIE) == 1
78 if (dDyl::LinkASync(fProfile::BOOT) == 1) {
89 if (dDyl::LinkASync(fProfile::WORLD_9_DEMO) == 1) {
96 if (dDyl::LinkASync(fProfile::WORLD_MAP) == 1) {
103 if (dDyl::LinkASync(fProfile::GAME_SETUP) == 1) {
110 if (dDyl::LinkASync(fProfile::MULTI_PLAY_COURSE_SELECT) == 1) {
146 dWarningManager_c::CreateWarningManager();
147 dWarningManager_c::addWarningForbid();
153 dGraph_c::ms_Instance->mpPainterFunc = painter;
157sPhase_c::phaseMethod myCreate_PhaseMethod[] = {
164sPhase_c myCreate_InitPhase(myCreate_PhaseMethod, ARRAY_SIZE(myCreate_PhaseMethod));
168void *BootSound(
void *) {
174 s_dvdcb = mDvd_callback_c::createOrDie(BootSound,
nullptr);
179 if (!s_dvdcb->mDone) {
185 dAudio::loadSceneSnd();
191 if (dAudio::isLoadedSceneSnd()) {
207 const char *saveBannerPath =
"/EU/save_banner";
208 static const char saveBannerName[] =
"save_banner";
214const char *l_env_names[] = {
269 if (!dWarningManager_c::m_Created) {
302sPhase_c::phaseMethod myBackGround_PhaseMethod[] = {
304 dSystem::createFontManagerPhase,
305 dSystem::createMessageManagerPhase,
306 myCreate_CreateYesNoWindow,
307 myCreate_YesNoWindowReady,
308 myCreate_ExtensionMng,
309 myReadArc_ExtensionMng,
311 myReadArc_MakeControllerInformation,
312 myCreate_ControllerInformationReady,
315 myReadArc_resSndWait,
316 myReadArc_SaveBanner,
318 myDylinkInitPhase_0a,
319 myDylinkInitPhase_0b,
320 myDylinkInitPhase_0c,
321 myDylinkInitPhase_2a,
322 myDylinkInitPhase_2b,
323 myDylinkInitPhase_2c,
324 myDylinkInitPhase_2d,
325 myDylinkInitPhase_2e,
326 myDylinkInitPhase_3a,
327 myDylinkInitPhase_3b,
333 myReadArc_WipeCircle,
334 dSystem::createEffectManagerPhase1
338sPhase_c myBackGround_Phase(myBackGround_PhaseMethod, ARRAY_SIZE(myBackGround_PhaseMethod));
379 dSys_c::setClearColor(nw4r::ut::Color::BLACK);
380 dSys_c::setFrameRate(1);
389 dScStage_c::setTitleReplayRandomTable();
390 dGameCom::initGame();
395 VIEnableDimming(
true);
401 dGraph_c::ms_Instance->mpPainterFunc =
nullptr;
410 dRemoconMng_c::dConnect_c::m_isBoot = 0;
421 dSystem::createEffectManagerPhase2(
nullptr);
435 myBackGround_Phase.callMethod(
this);
451void dScBoot_c::initializeState_ResetWait() {
456void dScBoot_c::executeState_ResetWait() {
464void dScBoot_c::finalizeState_ResetWait() {}
466void dScBoot_c::initializeState_ResetFadeOut() {
469 dFader_c::setFader(dFader_c::FADE);
474void dScBoot_c::executeState_ResetFadeOut() {
484 if (dWarningManager_c::m_instance->m_b00 >= 1) {
485 dWarningManager_c::m_instance->AllWarningEnd(
false);
489 finalizeState_ResetFadeIn();
492 dSelectCursor_c::m_instance->Cancel(0);
503void dScBoot_c::finalizeState_ResetFadeOut() {
508 dWarningManager_c::m_instance->AllWarningEnd(
false);
522void dScBoot_c::initializeState_ResetFadeIn() {
524 dFader_c::setFader(dFader_c::FADE);
529void dScBoot_c::executeState_ResetFadeIn() {
535void dScBoot_c::finalizeState_ResetFadeIn() {
553void dScBoot_c::initializeState_FadeOutWait() {}
555void dScBoot_c::executeState_FadeOutWait() {
561void dScBoot_c::finalizeState_FadeOutWait() {}
565void dScBoot_c::initializeState_WiiStrapKeyWait() {
571void dScBoot_c::executeState_WiiStrapKeyWait() {
579void dScBoot_c::finalizeState_WiiStrapKeyWait() {}
581void dScBoot_c::initializeState_WiiStrapDispEndWait() {}
583void dScBoot_c::executeState_WiiStrapDispEndWait() {
586 WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP |
587 WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_1 | WPAD_BUTTON_2 |
588 WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS |
589 WPAD_BUTTON_FS_Z | WPAD_BUTTON_FS_C
596void dScBoot_c::finalizeState_WiiStrapDispEndWait() {}
598void dScBoot_c::initializeState_WiiStrapFadeOut() {
600 dFader_c::setFader(dFader_c::FADE);
606void dScBoot_c::executeState_WiiStrapFadeOut() {
615void dScBoot_c::finalizeState_WiiStrapFadeOut() {
616 dWarningManager_c::m_instance->AllWarningEnd(
false);
619void dScBoot_c::initializeState_ControllerInformationFadeIn() {
620 dFader_c::setFader(dFader_c::FADE);
625void dScBoot_c::executeState_ControllerInformationFadeIn() {
631void dScBoot_c::finalizeState_ControllerInformationFadeIn() {
635 dWarningManager_c::subWarningForbid();
638void dScBoot_c::initializeState_ControllerInformationSoundWait() {
644void dScBoot_c::executeState_ControllerInformationSoundWait() {
656void dScBoot_c::finalizeState_ControllerInformationSoundWait() {}
658void dScBoot_c::initializeState_ControllerInformationKeyWait() {}
660void dScBoot_c::executeState_ControllerInformationKeyWait() {
671void dScBoot_c::finalizeState_ControllerInformationKeyWait() {}
673void dScBoot_c::initializeState_ControllerInformationDispEndWait() {}
675void dScBoot_c::executeState_ControllerInformationDispEndWait() {
680 WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP |
681 WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_1 | WPAD_BUTTON_2 |
682 WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS |
683 WPAD_BUTTON_FS_Z | WPAD_BUTTON_FS_C
694void dScBoot_c::finalizeState_ControllerInformationDispEndWait() {}
696void dScBoot_c::initializeState_NandCommandEndWait() {}
698void dScBoot_c::executeState_NandCommandEndWait() {
699 if (dNandThread_c::m_instance->mState == 0) {
706void dScBoot_c::finalizeState_NandCommandEndWait() {}
708void dScBoot_c::initializeState_ExistFileCheck() {
711 dNandThread_c::m_instance->cmdExistCheck();
715void dScBoot_c::finalizeState_ExistFileCheck() {}
717void dScBoot_c::executeState_ExistFileCheck() {
718 if (dSaveMng_c::m_instance->isNandBusy()) {
721 if (dNandThread_c::m_instance->mError != 0) {
723 }
else if (dNandThread_c::m_instance->mFileExists) {
730void dScBoot_c::initializeState_NandSpaceCheck() {
731 dNandThread_c::m_instance->cmdSpaceCheck();
734void dScBoot_c::finalizeState_NandSpaceCheck() {}
736void dScBoot_c::executeState_NandSpaceCheck() {
737 if (dSaveMng_c::m_instance->isNandBusy()) {
740 if (dNandThread_c::m_instance->mError != 0) {
743 const char *save_icon =
"save_icon.bti";
744 const char *save_banner =
"save_banner";
751void dScBoot_c::initializeState_CreateFile() {
752 dSaveMng_c *saveMng = dSaveMng_c::m_instance;
759 saveMng->startNandSave();
762void dScBoot_c::executeState_CreateFile() {
763 if (dSaveMng_c::m_instance->isNandBusy()) {
766 if (dNandThread_c::m_instance->mError == 0) {
773void dScBoot_c::finalizeState_CreateFile() {}
775void dScBoot_c::initializeState_Load() {
776 dSaveMng_c::m_instance->startNandLoad();
779void dScBoot_c::executeState_Load() {
780 if (dSaveMng_c::m_instance->isNandBusy()) {
783 if (dNandThread_c::m_instance->mError != 0) {
792void dScBoot_c::finalizeState_Load() {}
794void dScBoot_c::initializeState_ProcEnd() {}
796void dScBoot_c::executeState_ProcEnd() {
797 dScRestartCrsin_c::startTitle(0,
false);
800void dScBoot_c::finalizeState_ProcEnd() {}
802void dScBoot_c::initializeState_NewSaveFileDisp() {
807void dScBoot_c::executeState_NewSaveFileDisp() {
813void dScBoot_c::finalizeState_NewSaveFileDisp() {
817void dScBoot_c::initializeState_ButtonInputWait() {
821void dScBoot_c::executeState_ButtonInputWait() {
822 if (mPad::g_currentCore->downTrigger(WPAD_BUTTON_A | WPAD_BUTTON_2) ||
dInfo_c::mGameFlag & 0x80000) {
828void dScBoot_c::finalizeState_ButtonInputWait() {}
830void dScBoot_c::initializeState_WindowExitWait() {
834void dScBoot_c::executeState_WindowExitWait() {
843void dScBoot_c::finalizeState_WindowExitWait() {}
845void dScBoot_c::initializeState_GoToErrorFadeOut() {
847 dFader_c::setFader(dFader_c::FADE);
852void dScBoot_c::executeState_GoToErrorFadeOut() {
860void dScBoot_c::finalizeState_GoToErrorFadeOut() {}
862void dScBoot_c::initializeState_GoToErrorFadeIn() {
863 dFader_c::setFader(dFader_c::FADE);
867void dScBoot_c::executeState_GoToErrorFadeIn() {
880void dScBoot_c::finalizeState_GoToErrorFadeIn() {
884void dScBoot_c::initializeState_ErrorWindowOnStageWait() {
885 dWarningManager_c::m_instance->setError(dNandThread_c::m_instance->mError);
888void dScBoot_c::executeState_ErrorWindowOnStageWait() {
889 dWarningManager_c *warningMgr = dWarningManager_c::m_instance;
891 if (warningMgr->mErrorID == 6) {
892 if (!warningMgr->m_b09) {
896 }
else if (!dWarningManager_c::isError()) {
902void dScBoot_c::finalizeState_ErrorWindowOnStageWait() {}
904void dScBoot_c::initializeState_ErrorInfinityDisp() {}
906void dScBoot_c::executeState_ErrorInfinityDisp() {}
908void dScBoot_c::finalizeState_ErrorInfinityDisp() {}
static bool startFadeOut(u16 duration)
Starts a fade out with the current fader.
static bool startFadeIn(u16 duration)
Starts a fade in with the current fader.
static dHbm::Manage_c * GetInstance()
Gets a pointer to the instance of this class.
static unsigned int mGameFlag
See GAME_FLAG_e.
void initialize()
Initializes the slot data.
A higher-level archive resource management class.
static dResMng_c * m_instance
The instance of this class.
static dReset::Manage_c * GetInstance()
Gets a pointer to the instance of this class.
This scene handles the game's boot process. It does the following:
dSelectCursor_c * mpSelectCursor
The select cursor instance.
virtual int create()
do method for the create operation.
sFStateMgr_c< dScBoot_c, sStateMethodUsr_FI_c > mResetStateMgr
The state manager for the ResetXXX states.
virtual void deleteReady()
Informs the base that it's about to be deleted.
virtual int doDelete()
do method for the delete operation.
bool mSceneSoundLoaded
Whether the sound (for the button press) has finished loading.
static sFStateID_c< dScBoot_c > StateID_WiiStrapFadeOut
The Wii strap screen is fading out.
static sFStateID_c< dScBoot_c > StateID_GoToErrorFadeIn
Fading in the error message.
static sFStateID_c< dScBoot_c > StateID_ButtonInputWait
Waiting for button input after creating new save data.
dScBoot_c()
Creates a new scene.
static sFStateID_c< dScBoot_c > StateID_ResetFadeOut
Fading out the game for the reset.
static sFStateID_c< dScBoot_c > StateID_ExistFileCheck
Checking for existing save data.
static sFStateID_c< dScBoot_c > StateID_CreateFile
Creating new save data.
static sFStateID_c< dScBoot_c > StateID_ControllerInformationSoundWait
Waiting for the scene sound to load.
dYesNoWindow_c * mpYesNoWindow
The yes/no window instance.
static sFStateID_c< dScBoot_c > StateID_ResetFadeIn
Fading back in after the reset.
bool mResetFaderDone
Whether the reset fade-out has completed.
int mAutoAdvanceTimer
The number of frames after which the scene will automatically advance.
dControllerInformation_c * mpControllerInformation
The controller information instance.
static sFStateID_c< dScBoot_c > StateID_FadeOutWait
Waiting for fade out to complete.
static sFStateID_c< dScBoot_c > StateID_ControllerInformationKeyWait
Forced delay before key press is accepted.
static sFStateID_c< dScBoot_c > StateID_WiiStrapDispEndWait
Waiting for key press to continue.
static sFStateID_c< dScBoot_c > StateID_ResetWait
Waiting for a reset event.
bool mNewSaveFileCreated
Whether new save data was created during boot.
bool mSaveDataCreatedMessageShown
Whether the "new save data created" message has been shown.
static sFStateID_c< dScBoot_c > StateID_GoToErrorFadeOut
Fading out to show an error message.
static sFStateID_c< dScBoot_c > StateID_ErrorInfinityDisp
Showing an irrecoverable error message.
virtual int preExecute()
pre method for the execute operation.
int mMinWaitTimer
The minimum number of frames to wait before a button may be pressed to advance the scene.
virtual int draw()
do method for the draw operation.
virtual ~dScBoot_c()
Destroys the scene.
static sFStateID_c< dScBoot_c > StateID_ErrorWindowOnStageWait
Showing an error message.
static sFStateID_c< dScBoot_c > StateID_Load
Loading existing save data.
bool mResetFadeOutStarted
Whether the reset fade-out has started.
dWiiStrapScreen_c * mpWiiStrapScreen
The Wii strap screen instance.
static sFStateID_c< dScBoot_c > StateID_NandSpaceCheck
Checking for sufficient NAND space for the save data.
virtual int execute()
do method for the execute operation.
static sFStateID_c< dScBoot_c > StateID_NewSaveFileDisp
Animating in the "new save data created" message.
static sFStateID_c< dScBoot_c > StateID_WiiStrapKeyWait
Forced delay before key press is accepted.
static sFStateID_c< dScBoot_c > StateID_ControllerInformationFadeIn
The controller information screen is fading in.
static dScBoot_c * m_instance
The singleton instance of the boot scene.
sFStateMgr_c< dScBoot_c, sStateMethodUsr_FI_c > mStateMgr
The main state manager for the boot scene.
bool mIsResetting
Whether the game is currently resetting.
static sFStateID_c< dScBoot_c > StateID_ControllerInformationDispEndWait
Waiting for key press to continue.
static sFStateID_c< dScBoot_c > StateID_ProcEnd
Going to the title screen.
static sFStateID_c< dScBoot_c > StateID_WindowExitWait
Waiting for the "save data created" window to close.
static sFStateID_c< dScBoot_c > StateID_NandCommandEndWait
Waiting for the system to be ready for a NAND command.
virtual int preExecute()
pre method for the execute operation.
static void setFadeInFrame(unsigned short length)
Sets the duration of the next fade-in transition to length.
static void setFadeOutFrame(unsigned short length)
Sets the duration of the next fade-out transition to length.
static bool m_isAutoFadeIn
If a fade-in should automatically be performed on scene load.
sPhase_c * mpPhase
The phase used for scene initialization.
static dWipeCircle_c * m_instance
The instance of the fader.
static dWipeDokan_c * m_instance
The instance of the fader.
static dWipeKuppa_c * m_instance
The instance of the fader.
static dWipeMario_c * m_instance
The instance of the fader.
Displays a confirmation prompt.
bool mIsActive
Whether the window is currently open.
bool mHasLoadedLayout
Whether the layout has been loaded.
static fBase_c * createChild(ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType)
Creates a child base under the given parent.
@ NOT_READY
The step could not completed at this time.
@ SUCCEEDED
The step was completed successfully.
@ HIDDEN
The screen is completely unblocked.
@ OPAQUE
The screen is completely blacked out.
static bool isStatus(mFaderBase_c::EStatus status)
Checks if the current fader's status matches status .
A phase is a list of methods to be called in order.
METHOD_RESULT_e
Return value of a phase method and callMethod.
@ OK
Proceed to the next method in the phase.
@ WAIT
Do not proceed to the next method in the phase.
#define SAVE_SLOT_COUNT
The total save slot count.
#define BASE_PROFILE(profName, className)
Creates a basic profile, using the profile number as the execute and draw order value.
@ CONTROLLER_INFORMATION
The profile for dControllerInformation_c.
@ YES_NO_WINDOW
The profile for dYesNoWindow_c.
void draw()
Draws all registered 2D objects.
void initRandomSeed()
Initializes the random seed used for randomness.
#define STATE_DEFINE(class, name)
Defines a state.