Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions config/RSPE01_01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7660,19 +7660,19 @@ fn_801A3F08 = .text:0x801A3F08; // type:function size:0x10C
fn_801A4014 = .text:0x801A4014; // type:function size:0xA8
fn_801A40BC = .text:0x801A40BC; // type:function size:0x814
fn_801A48D0 = .text:0x801A48D0; // type:function size:0x60
beginDrawScreen__16RPSysHomeMenuMgrFv = .text:0x801A4930; // type:function size:0x24
drawBanIcon__16RPSysHomeMenuMgrFv = .text:0x801A4930; // type:function size:0x24
draw__16RPSysHomeMenuMgrFv = .text:0x801A4954; // type:function size:0x2C
update__16RPSysHomeMenuMgrFv = .text:0x801A4980; // type:function size:0x390
startBlackOut__16RPSysHomeMenuMgrFv = .text:0x801A4D10; // type:function size:0x58
clearMenu__16RPSysHomeMenuMgrFv = .text:0x801A4D68; // type:function size:0x124
updateOutside__16RPSysHomeMenuMgrFv = .text:0x801A4E8C; // type:function size:0x12C
LoadResource__16RPSysHomeMenuMgrFv = .text:0x801A4FB8; // type:function size:0x224
softReset__16RPSysHomeMenuMgrFv = .text:0x801A4D10; // type:function size:0x58
checkMenuEnd__16RPSysHomeMenuMgrFv = .text:0x801A4D68; // type:function size:0x124
checkMenuStart__16RPSysHomeMenuMgrFv = .text:0x801A4E8C; // type:function size:0x12C
initHomeButtonInfo__16RPSysHomeMenuMgrFv = .text:0x801A4FB8; // type:function size:0x224
init__16RPSysHomeMenuMgrFv = .text:0x801A51DC; // type:function size:0x68
__dt__16RPSysHomeMenuMgrFv = .text:0x801A5244; // type:function size:0x40
__ct__16RPSysHomeMenuMgrFPQ23EGG4Heap = .text:0x801A5284; // type:function size:0x1AC
soundCallBack__16RPSysHomeMenuMgrFiUl = .text:0x801A5430; // type:function size:0x54
drawScreen__Q216RPSysHomeMenuMgr12fileAccessorFv = .text:0x801A5484; // type:function size:0x158
fn_801A55DC = .text:0x801A55DC; // type:function size:0x11C
soundCallback__16RPSysHomeMenuMgrFii = .text:0x801A5430; // type:function size:0x54
draw__Q216RPSysHomeMenuMgr7BanIconFv = .text:0x801A5484; // type:function size:0x158
calc__Q216RPSysHomeMenuMgr7BanIconFv = .text:0x801A55DC; // type:function size:0x11C
CreateInstance__16RPSysHomeMenuMgrFPQ23EGG4Heap = .text:0x801A56F8; // type:function size:0x60
GetValidNum__15RPSysOfficialDBFv = .text:0x801A5758; // type:function size:0xA8
Reset__15RPSysOfficialDBFv = .text:0x801A5800; // type:function size:0x7C
Expand Down Expand Up @@ -20454,7 +20454,7 @@ lbl_804BDBD8 = .sdata:0x804BDBD8; // type:object size:0x8
lbl_804BDBE0 = .sdata:0x804BDBE0; // type:object size:0x8
lbl_804BDBE8 = .sdata:0x804BDBE8; // type:object size:0x8
lbl_804BDBF0 = .sdata:0x804BDBF0; // type:object size:0x8
lbl_804BDBF8 = .sdata:0x804BDBF8; // type:object size:0x8 data:4byte
sSoundHeapSize__16RPSysHomeMenuMgr = .sdata:0x804BDBF8; // type:object size:0x4 data:4byte
sSuccess__17RPSysNWC24Manager = .sdata:0x804BDC00; // type:object size:0x4 data:4byte
lbl_804BDC08 = .sdata:0x804BDC08; // type:object size:0x4 data:4byte
lbl_804BDC0C = .sdata:0x804BDC0C; // type:object size:0x4 data:4byte
Expand Down
10 changes: 10 additions & 0 deletions include/Pack/RPAudio/RPSndHomeMenuArcMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ class RPSndHomeMenuArcMgr : public EGG::SoundHeapMgr, public EGG::ArcPlayer {
*/
bool setupArchive(const void* pBinary);

/**
* @brief Attempts to start the specified sound
*
* @param id Sound ID
* @return Success
*/
bool startSe(u32 id) {
return startSound(&mSoundHandle, id);
}

private:
//! Active sound handle
nw4r::snd::SoundHandle mSoundHandle; // at 0x6A4
Expand Down
248 changes: 194 additions & 54 deletions include/Pack/RPKernel/RPSysHomeMenuMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,79 +12,219 @@
//! @{

/**
* @brief Home menu manager
* @brief HOME Menu manager
*/
class RPSysHomeMenuMgr {
RP_SINGLETON_DECL_EX(RPSysHomeMenuMgr);

public:
//! This uses its own scheme instead of HBMSelectBtnNum for some reason
enum homeButtonState {
BUTTON_NONE, // used when inactive or returning to Wii Menu
BUTTON_OPEN,
BUTTON_CLOSE, // exiting Home Menu, but game still running
BUTTON_RESET,
BUTTON_MAX
/**
* @brief Icon when HOME Menu is disabled
*/
class BanIcon {
public:
/**
* @brief Constructor
*/
BanIcon();

/**
* @brief Updates this icon's state
*/
void calc();

/**
* @brief Renders this icon's state
*/
void draw();

/**
* @brief Resets this icon's state
*/
void clear() {
mState = EState_Hide;
mTimer = 0;
mAlpha = 0;
}

/**
* @brief Enables this icon
*/
void switchOn() {
mState = EState_FadeIn;
mTimer = 0;
mAlpha = 0;
}

/**
* @brief Tests whether this icon is visible
*/
bool isDisp() const {
return mState != EState_Hide;
}

/**
* @brief Attaches a texture to this icon
*
* @param pTexture Icon texture
*/
void setTexture(const EGG::ResTIMG* pTexture) {
mpTexture = pTexture;
}

private:
/**
* @brief State machine state
*/
enum EState {
EState_Hide, //!< Icon is not displaying
EState_FadeIn, //!< Icon is appearing
EState_Disp, //!< Icon is fully visible
EState_FadeOut, //!< Icon is disappearing
};

//! Time to fade in/out the icon, in frames
static const int FADE_LENGTH = 15;
//! Time to fully display the icon, in frames
static const int DISP_LENGTH = 60;

private:
//! Ban icon texture
const EGG::ResTIMG* mpTexture; // at 0x0

//! State machine state
EState mState; // at 0x4
//! Duration of the current state
s16 mTimer; // at 0x8

//! Calculated icon transparency
u16 mAlpha; // at 0xA
};

struct fileAccessor {
void* file;
BOOL UNK_0x04; // set to 1 if DVD error occurs in function 801A4E8C
u16 UNK_0x08;
u16 UNK_0x0A;
void drawScreen();
/**
* @brief HOME Menu state
*/
enum EMenuState {
EMenuState_End, //!< Menu is closing
EMenuState_Start, //!< Menu is opening
EMenuState_Open, //!< Menu is interactable
EMenuState_Reset, //!< Menu is performing a soft reset
};

bool soundCallBack(int unk, u32 id);
public:
/**
* @brief Initializes this manager's state
*/
void init();
void LoadResource();
void updateOutside();
void clearMenu();
BOOL startBlackOut();

/**
* @brief Initializes the HBM library
*/
void initHomeButtonInfo();

/**
* @brief Performs a soft reset
*
* @return Whether HBM will perform the reset
*/
bool softReset();

/**
* @brief Updates this manager's state
*/
void update();

/**
* @brief Renders the HOME Menu if it is visible
*/
void draw();
void beginDrawScreen();

bool isOpen() const {
return mIsOpen;
/**
* @brief Renders the ban icon if it is visible
*/
void drawBanIcon();

/**
* @brief Toggles whether the HOME Menu is disabled
*
* @param disable Whether to disable the menu
*/
void disable(bool disable) {
mIsDisabled = disable;
}

/**
* @brief Tests whether the HOME Menu is currently active
*/
bool isActive() const {
return mIsActive;
}

private:
//! HBM work memory size
static const u32 HBM_WORK_SIZE = OS_MEM_KB_TO_B(512);
//! Size of the HBM config.txt file
static const u32 HBM_CONFIG_SIZE = 0x23;

private:
/**
* @brief HBM library sound callback
*
* @param event HBM event
* @param arg Event argument
* @return Whether this callback handled the playback for HBM
*/
static BOOL soundCallback(int event, int arg);

/**
* @brief Checks whether the HOME Menu should be opened
*/
void checkMenuStart();

bool mResLoaded; // at 0x08
bool mUNK_0x09;
bool mUNK_0x0A;
bool mIsOpen; // at 0x0B
u8 mUNK_0x0C;
bool mBlackOutCalled; // at 0x0D
homeButtonState mButtonState; // at 0x10
u16 mUNK_0x14;
RPSysProjectLocal* mProjectLocal; // at 0x18
fileAccessor* mFileAccessor; // at 0x1C
HBMDataInfo* mMenuDataInfo; // at 0x20
u32 mUNK_0x24;
u32 mUNK_0x28;
u32 mUNK_0x2C;
void* mUNK_0x30;
void* mSoundCallback; // at 0x34
u32 mUNK_0x38;
u32 mUNK_0x3C;
u32 mUNK_0x40;
u32 mUNK_0x44; // Seemingly skipped in constructor?
u32 mUNK_0x48;
u32 mUNK_0x4C;
f32 mUNK_0x50; // Set to 1.2 if the console is in PAL 50 Hz mode,
// otherwise 1.0
f32 mScaleX;
f32 mAdjScaleX;
u32 mUNK_0x5C;
const HBMControllerData* mHbmControllerData;
Vec2 mVec2;
u8 mUNK_0x6C[50];
KPADStatus mKpadStatus; //todo(texline) why is this duped?
u8 mPadding[396];
/**
* @brief Checks whether the HOME Menu should be closed
*/
void checkMenuEnd();

private:
//! HOME Menu sound archive manager
static RPSndHomeMenuArcMgr* spHomeMenuArcMgr;
//! Sound archive heap size
static u32 sSoundHeapSize;

//! Whether the HBM resources have been initialized
bool mIsInitialized; // at 0x8

//! Whether the menu is disabled
bool mIsDisabled; // at 0x9
//! Whether the menu is opening due to a button press
bool mIsStarting; // at 0xA
//! Whether the menu is interactable
bool mIsActive; // at 0xB
//! Whether the menu should be drawn
bool mIsVisible; // at 0xC

//! Whether a soft reset is in progress
bool mIsSoftReset; // at 0xD

//! Current state machine state
EMenuState mMenuState; // at 0x10
//! Current state duration
s16 mStateTimer; // at 0x14

//! Runtime project localization
RPSysProjectLocal* mpProjectLocal; // at 0x18

//! Menu ban icon
BanIcon* mpBanIcon; // at 0x1C

//! HBM library configuration
HBMDataInfo mHBMDataInfo; // at 0x20

//! HBM controller input state
HBMControllerData mHBMControllerData; // at 0x60
//! Local controller input state
KPADStatus mKPADStatus[KPAD_MAX_CONTROLLERS]; // at 0xA0
};

//! @}
Expand Down
18 changes: 13 additions & 5 deletions include/Pack/RPSystem/RPSysProjectLocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ class RPSysProjectLocal {
EArea_USA
};

/**
* @brief Target framerate
*/
enum EFrameRate {
EFrameRate_60Hz, //!< NTSC/PAL60 (60Hz)
EFrameRate_50Hz, //!< PAL50 (50Hz)
};

/**
* @brief Storage device
*/
Expand Down Expand Up @@ -105,10 +113,10 @@ class RPSysProjectLocal {
}

/**
* @brief Tests whether the game is expected to run at 50Hz
* @brief Gets the target framerate
*/
bool isPal50() const {
return mIsPal50;
EFrameRate getFrameRate() const {
return mFrameRate;
}

/**
Expand All @@ -127,8 +135,8 @@ class RPSysProjectLocal {
EArea mLocale; // at 0x10
//! Game language
EArea mLanguage; // at 0x14
//! Whether the display is 50Hz
BOOL mIsPal50; // at 0x18
//! Target framerate
EFrameRate mFrameRate; // at 0x18
//! Sound archive storage device
EStorage mSoundStorage; // at 0x1C
};
Expand Down
2 changes: 1 addition & 1 deletion include/homebuttonMiniLib/HBMTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef struct HBMDataInfo {
BOOL backFlag; // at 0x18
int region; // at 0x1C
BOOL cursor; // at 0x20
BOOL messageFlag; // at 0x24
int messageFlag; // at 0x24
u32 configBufSize; // at 0x28
u32 memSize; // at 0x2C
f32 frameDelta; // at 0x30
Expand Down
Loading
Loading