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) {
145 dWarningManager_c::CreateWarningManager();
146 dWarningManager_c::addWarningForbid();
152 dGraph_c::ms_Instance->mpPainterFunc = painter;
156sPhase_c::phaseMethod myCreate_PhaseMethod[] = {
163sPhase_c myCreate_InitPhase(myCreate_PhaseMethod, ARRAY_SIZE(myCreate_PhaseMethod));
167void *BootSound(
void *) {
173 s_dvdcb = mDvd_callback_c::createOrDie(BootSound,
nullptr);
178 if (!s_dvdcb->mDone) {
184 dAudio::loadSceneSnd();
190 if (dAudio::isLoadedSceneSnd()) {
206 const char *saveBannerPath =
"/EU/save_banner";
207 static const char saveBannerName[] =
"save_banner";
213const char *l_env_names[] = {
268 if (!dWarningManager_c::m_Created) {
301sPhase_c::phaseMethod myBackGround_PhaseMethod[] = {
302 myCreate_linkWaitProc,
303 dSystem::createFontManagerPhase,
304 dSystem::createMessageManagerPhase,
305 myCreate_CreateYesNoWindow,
306 myCreate_YesNoWindowReady,
307 myCreate_ExtensionMng,
308 myReadArc_ExtensionMng,
310 myReadArc_MakeControllerInformation,
311 myCreate_ControllerInformationReady,
314 myReadArc_resSndWait,
315 myReadArc_SaveBanner,
317 myDylinkInitPhase_0a,
318 myDylinkInitPhase_0b,
319 myDylinkInitPhase_0c,
320 myDylinkInitPhase_2a,
321 myDylinkInitPhase_2b,
322 myDylinkInitPhase_2c,
323 myDylinkInitPhase_2d,
324 myDylinkInitPhase_2e,
325 myDylinkInitPhase_3a,
326 myDylinkInitPhase_3b,
332 myReadArc_WipeCircle,
333 dSystem::createEffectManagerPhase1
337sPhase_c myBackGround_Phase(myBackGround_PhaseMethod, ARRAY_SIZE(myBackGround_PhaseMethod));
378 dSys_c::setClearColor(nw4r::ut::Color::BLACK);
379 dSys_c::setFrameRate(1);
388 dScStage_c::setTitleReplayRandomTable();
389 dGameCom::initGame();
394 VIEnableDimming(
true);
400 dGraph_c::ms_Instance->mpPainterFunc =
nullptr;
409 dRemoconMng_c::dConnect_c::m_isBoot = 0;
420 dSystem::createEffectManagerPhase2(
nullptr);
434 myBackGround_Phase.callMethod(
this);
450void dScBoot_c::initializeState_ResetWait() {
455void dScBoot_c::executeState_ResetWait() {
463void dScBoot_c::finalizeState_ResetWait() {}
465void dScBoot_c::initializeState_ResetFadeOut() {
468 dFader_c::setFader(dFader_c::FADE);
473void dScBoot_c::executeState_ResetFadeOut() {
483 if (dWarningManager_c::m_instance->m_b00 >= 1) {
484 dWarningManager_c::m_instance->AllWarningEnd(
false);
488 finalizeState_ResetFadeIn();
491 dSelectCursor_c::m_instance->Cancel(0);
502void dScBoot_c::finalizeState_ResetFadeOut() {
507 dWarningManager_c::m_instance->AllWarningEnd(
false);
521void dScBoot_c::initializeState_ResetFadeIn() {
523 dFader_c::setFader(dFader_c::FADE);
528void dScBoot_c::executeState_ResetFadeIn() {
534void dScBoot_c::finalizeState_ResetFadeIn() {
552void dScBoot_c::initializeState_FadeOutWait() {}
554void dScBoot_c::executeState_FadeOutWait() {
560void dScBoot_c::finalizeState_FadeOutWait() {}
564void dScBoot_c::initializeState_WiiStrapKeyWait() {
570void dScBoot_c::executeState_WiiStrapKeyWait() {
578void dScBoot_c::finalizeState_WiiStrapKeyWait() {}
580void dScBoot_c::initializeState_WiiStrapDispEndWait() {}
582void dScBoot_c::executeState_WiiStrapDispEndWait() {
585 WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP |
586 WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_1 | WPAD_BUTTON_2 |
587 WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS |
588 WPAD_BUTTON_FS_Z | WPAD_BUTTON_FS_C
595void dScBoot_c::finalizeState_WiiStrapDispEndWait() {}
597void dScBoot_c::initializeState_WiiStrapFadeOut() {
599 dFader_c::setFader(dFader_c::FADE);
605void dScBoot_c::executeState_WiiStrapFadeOut() {
614void dScBoot_c::finalizeState_WiiStrapFadeOut() {
615 dWarningManager_c::m_instance->AllWarningEnd(
false);
618void dScBoot_c::initializeState_ControllerInformationFadeIn() {
619 dFader_c::setFader(dFader_c::FADE);
624void dScBoot_c::executeState_ControllerInformationFadeIn() {
630void dScBoot_c::finalizeState_ControllerInformationFadeIn() {
634 dWarningManager_c::subWarningForbid();
637void dScBoot_c::initializeState_ControllerInformationSoundWait() {
643void dScBoot_c::executeState_ControllerInformationSoundWait() {
655void dScBoot_c::finalizeState_ControllerInformationSoundWait() {}
657void dScBoot_c::initializeState_ControllerInformationKeyWait() {}
659void dScBoot_c::executeState_ControllerInformationKeyWait() {
670void dScBoot_c::finalizeState_ControllerInformationKeyWait() {}
672void dScBoot_c::initializeState_ControllerInformationDispEndWait() {}
674void dScBoot_c::executeState_ControllerInformationDispEndWait() {
679 WPAD_BUTTON_LEFT | WPAD_BUTTON_RIGHT | WPAD_BUTTON_DOWN | WPAD_BUTTON_UP |
680 WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_1 | WPAD_BUTTON_2 |
681 WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS |
682 WPAD_BUTTON_FS_Z | WPAD_BUTTON_FS_C
693void dScBoot_c::finalizeState_ControllerInformationDispEndWait() {}
695void dScBoot_c::initializeState_NandCommandEndWait() {}
697void dScBoot_c::executeState_NandCommandEndWait() {
698 if (dNandThread_c::m_instance->mState == 0) {
705void dScBoot_c::finalizeState_NandCommandEndWait() {}
707void dScBoot_c::initializeState_ExistFileCheck() {
710 dNandThread_c::m_instance->cmdExistCheck();
714void dScBoot_c::finalizeState_ExistFileCheck() {}
716void dScBoot_c::executeState_ExistFileCheck() {
717 if (dSaveMng_c::m_instance->isNandBusy()) {
720 if (dNandThread_c::m_instance->mError != 0) {
722 }
else if (dNandThread_c::m_instance->mFileExists) {
729void dScBoot_c::initializeState_NandSpaceCheck() {
730 dNandThread_c::m_instance->cmdSpaceCheck();
733void dScBoot_c::finalizeState_NandSpaceCheck() {}
735void dScBoot_c::executeState_NandSpaceCheck() {
736 if (dSaveMng_c::m_instance->isNandBusy()) {
739 if (dNandThread_c::m_instance->mError != 0) {
742 const char *save_icon =
"save_icon.bti";
743 const char *save_banner =
"save_banner";
750void dScBoot_c::initializeState_CreateFile() {
751 dSaveMng_c *saveMng = dSaveMng_c::m_instance;
758 saveMng->startNandSave();
761void dScBoot_c::executeState_CreateFile() {
762 if (dSaveMng_c::m_instance->isNandBusy()) {
765 if (dNandThread_c::m_instance->mError == 0) {
772void dScBoot_c::finalizeState_CreateFile() {}
774void dScBoot_c::initializeState_Load() {
775 dSaveMng_c::m_instance->startNandLoad();
778void dScBoot_c::executeState_Load() {
779 if (dSaveMng_c::m_instance->isNandBusy()) {
782 if (dNandThread_c::m_instance->mError != 0) {
791void dScBoot_c::finalizeState_Load() {}
793void dScBoot_c::initializeState_ProcEnd() {}
795void dScBoot_c::executeState_ProcEnd() {
796 dScRestartCrsin_c::startTitle(0,
false);
799void dScBoot_c::finalizeState_ProcEnd() {}
801void dScBoot_c::initializeState_NewSaveFileDisp() {
806void dScBoot_c::executeState_NewSaveFileDisp() {
812void dScBoot_c::finalizeState_NewSaveFileDisp() {
816void dScBoot_c::initializeState_ButtonInputWait() {
820void dScBoot_c::executeState_ButtonInputWait() {
821 if (mPad::g_currentCore->downTrigger(WPAD_BUTTON_A | WPAD_BUTTON_2) ||
dInfo_c::mGameFlag & 0x80000) {
827void dScBoot_c::finalizeState_ButtonInputWait() {}
829void dScBoot_c::initializeState_WindowExitWait() {
833void dScBoot_c::executeState_WindowExitWait() {
842void dScBoot_c::finalizeState_WindowExitWait() {}
844void dScBoot_c::initializeState_GoToErrorFadeOut() {
846 dFader_c::setFader(dFader_c::FADE);
851void dScBoot_c::executeState_GoToErrorFadeOut() {
859void dScBoot_c::finalizeState_GoToErrorFadeOut() {}
861void dScBoot_c::initializeState_GoToErrorFadeIn() {
862 dFader_c::setFader(dFader_c::FADE);
866void dScBoot_c::executeState_GoToErrorFadeIn() {
879void dScBoot_c::finalizeState_GoToErrorFadeIn() {
883void dScBoot_c::initializeState_ErrorWindowOnStageWait() {
884 dWarningManager_c::m_instance->setError(dNandThread_c::m_instance->mError);
887void dScBoot_c::executeState_ErrorWindowOnStageWait() {
888 dWarningManager_c *warningMgr = dWarningManager_c::m_instance;
890 if (warningMgr->mErrorID == 6) {
891 if (!warningMgr->m_b09) {
895 }
else if (!dWarningManager_c::isError()) {
901void dScBoot_c::finalizeState_ErrorWindowOnStageWait() {}
903void dScBoot_c::initializeState_ErrorInfinityDisp() {}
905void dScBoot_c::executeState_ErrorInfinityDisp() {}
907void 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.