Compare commits

...

2 Commits

Author SHA1 Message Date
coah
87a084da31 cleanup(iplSettingButton): rename Unk ring-buffer placeholders
Unk -> CmdEntry; unk_0x64 -> mCmdQueue; capacity/count/read/write
indices. Byte-identical (DOL sha1 unchanged).
2026-10-02 14:06:01 -05:00
coah
00013016df cleanup(iplBS2Manager): name tick/update/abort/restart flags (#857)
unk_0x0C -> mbTickEnabled
unk_0x0D -> mbUpdateRequested
unk_0x0E -> mbAbortRequested
unk_0x0F -> mbRestartRequested

Matching 100% before/after; DOL sha1 unchanged.
2026-10-02 14:03:18 -05:00
4 changed files with 50 additions and 50 deletions

View File

@@ -62,17 +62,17 @@ namespace ipl {
void start_left_event(const char* paneName); void start_left_event(const char* paneName);
void start_trig_event(const char* paneName); void start_trig_event(const char* paneName);
typedef struct Unk { typedef struct CmdEntry {
int command; // 0x00 int command; // 0x00
u32 msgID; // 0x04 u32 msgID; // 0x04
} Unk; } CmdEntry;
Unk unk_0x64[64]; CmdEntry mCmdQueue[64];
int unk_0x264; int mQueueCapacity;
int unk_0x268; int mQueueCount;
int unk_0x26C; int mQueueRead;
int unk_0x270; int mQueueWrite;
int mSettingArg; // 0x274 int mSettingArg; // 0x274

View File

@@ -89,10 +89,10 @@ namespace ipl {
int mIPLState; // 0x04 int mIPLState; // 0x04
volatile BS2State mState; // 0x08 volatile BS2State mState; // 0x08
bool unk_0x0C; bool mbTickEnabled; // 0x0C
bool unk_0x0D; bool mbUpdateRequested; // 0x0D
bool unk_0x0E; bool mbAbortRequested; // 0x0E
bool unk_0x0F; bool mbRestartRequested; // 0x0F
bool mbIsDiagDisc; // 0x10 bool mbIsDiagDisc; // 0x10
bool mbIncludesSeatTitles; // 0x11 bool mbIncludesSeatTitles; // 0x11
u8* mpBannerBuffer; // 0x14 u8* mpBannerBuffer; // 0x14

View File

@@ -15,10 +15,10 @@ namespace ipl {
// clang-format on // clang-format on
SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() { SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() {
unk_0x264 = 64; mQueueCapacity = 64;
unk_0x268 = 0; mQueueCount = 0;
unk_0x26C = 0; mQueueRead = 0;
unk_0x270 = 0; mQueueWrite = 0;
mSettingArg = arg; mSettingArg = arg;
mpLayout = NULL; mpLayout = NULL;
mpLayoutFile = NULL; mpLayoutFile = NULL;
@@ -81,9 +81,9 @@ namespace ipl {
FaderSceneCommand SettingButton::calcNormal() { FaderSceneCommand SettingButton::calcNormal() {
if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() && if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() &&
!mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && unk_0x268 != 0) { !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && mQueueCount != 0) {
Unk unk = unk_0x64[unk_0x26C]; CmdEntry entry = mCmdQueue[mQueueRead];
switch (unk.command) { switch (entry.command) {
case CMD_SHOW_BTN: { case CMD_SHOW_BTN: {
showBtn(); showBtn();
break; break;
@@ -93,16 +93,16 @@ namespace ipl {
break; break;
} }
case CMD_SET_TEXT: { case CMD_SET_TEXT: {
setText(unk.msgID); setText(entry.msgID);
break; break;
} }
} }
if (unk_0x268 != 0) { if (mQueueCount != 0) {
if (++unk_0x26C >= unk_0x264) { if (++mQueueRead >= mQueueCapacity) {
unk_0x26C = 0; mQueueRead = 0;
} }
unk_0x268--; mQueueCount--;
} }
} }
@@ -225,16 +225,16 @@ namespace ipl {
} }
void SettingButton::reserve(int command, u32 msgId) { void SettingButton::reserve(int command, u32 msgId) {
if (unk_0x264 != unk_0x268) { if (mQueueCapacity != mQueueCount) {
int unk = unk_0x270; int writeIdx = mQueueWrite;
unk_0x64[unk].command = command; mCmdQueue[writeIdx].command = command;
unk_0x64[unk].msgID = msgId; mCmdQueue[writeIdx].msgID = msgId;
unk_0x270++; mQueueWrite++;
if (unk_0x270 >= unk_0x264) { if (mQueueWrite >= mQueueCapacity) {
unk_0x270 = 0; mQueueWrite = 0;
} }
unk_0x268++; mQueueCount++;
} }
} }

View File

@@ -14,7 +14,7 @@
namespace ipl { namespace ipl {
namespace bs2 { namespace bs2 {
Manager::Manager(EGG::Heap* pHeap) Manager::Manager(EGG::Heap* pHeap)
: mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), unk_0x0C(true), unk_0x0D(false), unk_0x0E(false), unk_0x0F(false), : mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), mbTickEnabled(true), mbUpdateRequested(false), mbAbortRequested(false), mbRestartRequested(false),
mbIsDiagDisc(false), mbIncludesSeatTitles(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false), mbIsDiagDisc(false), mbIncludesSeatTitles(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false),
mEntries(NULL), mEntrySize(1), mEntryOffset(0) { mEntries(NULL), mEntrySize(1), mEntryOffset(0) {
mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE]; mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE];
@@ -30,13 +30,13 @@ namespace ipl {
return mIPLState; return mIPLState;
} }
if (unk_0x0F && !System::isNandFull()) { if (mbRestartRequested && !System::isNandFull()) {
BS2RestartStateMachine(); BS2RestartStateMachine();
unk_0x0C = true; mbTickEnabled = true;
mIPLState = IPL_STATE_NO_DISK; mIPLState = IPL_STATE_NO_DISK;
unk_0x0F = false; mbRestartRequested = false;
} else if (unk_0x0C) { } else if (mbTickEnabled) {
BOOL old = OSDisableInterrupts(); BOOL old = OSDisableInterrupts();
mState = BS2Tick(); mState = BS2Tick();
@@ -51,7 +51,7 @@ namespace ipl {
if (mbIsDiagDisc && System::isRsrcLoaded()) { if (mbIsDiagDisc && System::isRsrcLoaded()) {
__WPADReconnect(TRUE); __WPADReconnect(TRUE);
unk_0x0C = false; mbTickEnabled = false;
bootNewSystem(); bootNewSystem();
} }
} }
@@ -65,7 +65,7 @@ namespace ipl {
} }
void Manager::startUpdate() { void Manager::startUpdate() {
unk_0x0D = true; mbUpdateRequested = true;
mbStartUpdate = true; mbStartUpdate = true;
mPrevEntry = 0; mPrevEntry = 0;
mPrevFound = 0; mPrevFound = 0;
@@ -88,11 +88,11 @@ namespace ipl {
} }
void Manager::reserveRVLGame() { void Manager::reserveRVLGame() {
unk_0x0C = false; mbTickEnabled = false;
} }
void Manager::reserveGCGame() { void Manager::reserveGCGame() {
unk_0x0C = false; mbTickEnabled = false;
} }
void Manager::startRVLGame() { void Manager::startRVLGame() {
@@ -103,13 +103,13 @@ namespace ipl {
} }
void Manager::abort() { void Manager::abort() {
unk_0x0E = true; mbAbortRequested = true;
unk_0x0F = false; mbRestartRequested = false;
} }
void Manager::restart() { void Manager::restart() {
unk_0x0E = false; mbAbortRequested = false;
unk_0x0F = true; mbRestartRequested = true;
System::checkNandOverFlowFlagAsync(); System::checkNandOverFlowFlagAsync();
} }
@@ -195,7 +195,7 @@ namespace ipl {
break; break;
} }
case BS2_STT_64: { case BS2_STT_64: {
unk_0x0C = false; mbTickEnabled = false;
mIPLState = IPL_STATE_8; mIPLState = IPL_STATE_8;
break; break;
} }
@@ -216,25 +216,25 @@ namespace ipl {
} }
void Manager::execTick(BS2State state) { void Manager::execTick(BS2State state) {
if (unk_0x0D) { if (mbUpdateRequested) {
if (state == BS2_STT_UPDATE_DISK) { if (state == BS2_STT_UPDATE_DISK) {
BS2StartUpdate(); BS2StartUpdate();
} else { } else {
mbStartUpdate = false; mbStartUpdate = false;
} }
} else if (unk_0x0E) { } else if (mbAbortRequested) {
if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK || if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK ||
state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR || state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR ||
state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) { state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) {
unk_0x0C = false; mbTickEnabled = false;
mIPLState = IPL_STATE_8; mIPLState = IPL_STATE_8;
} else { } else {
BS2AbortStateMachine(); BS2AbortStateMachine();
} }
} }
unk_0x0D = false; mbUpdateRequested = false;
unk_0x0E = false; mbAbortRequested = false;
} }
void Manager::updateTick() { void Manager::updateTick() {