Compare commits

..

1 Commits

Author SHA1 Message Date
coah
4e0efe26db cleanup(iplBS2Manager): name tick/update/abort/restart flags
unk_0x0C -> mbTickEnabled
unk_0x0D -> mbUpdateRequested
unk_0x0E -> mbAbortRequested
unk_0x0F -> mbRestartRequested

Matching 100% before/after; DOL sha1 unchanged.
2026-10-02 13:59:50 -05:00
13 changed files with 77 additions and 77 deletions

View File

@@ -145,7 +145,7 @@ namespace ipl {
ANIM_MAX, ANIM_MAX,
}; };
int mAnimWait; int unk_0x54;
layout::Object* mpLayout; // 0x58 layout::Object* mpLayout; // 0x58
nand::LayoutFile* mpLayoutFile; // 0x5C nand::LayoutFile* mpLayoutFile; // 0x5C

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 CmdEntry { typedef struct Unk {
int command; // 0x00 int command; // 0x00
u32 msgID; // 0x04 u32 msgID; // 0x04
} CmdEntry; } Unk;
CmdEntry mCmdQueue[64]; Unk unk_0x64[64];
int mCmdCapacity; int unk_0x264;
int mCmdCount; int unk_0x268;
int mCmdReadIdx; int unk_0x26C;
int mCmdWriteIdx; int unk_0x270;
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

@@ -219,7 +219,7 @@ struct __zi8_work_data_s {
ziU8 unk_0x17; ziU8 unk_0x17;
ziU8 subLanguage; // 0x18 ziU8 subLanguage; // 0x18
ziU8 unk_0x19; ziU8 unk_0x19;
ziU16 separator; // 0x1A ziU16 unk_0x1A;
ziU8 unk_0x1C[3]; ziU8 unk_0x1C[3];
ziU8 unk_0x1F; ziU8 unk_0x1F;
ziU16 unk_0x20[0x40]; ziU16 unk_0x20[0x40];

View File

@@ -18,7 +18,7 @@ static Zi8UInt Zi8SetFindCand(ziU8* foundCandidates, Zi8UInt ordinal, ziPtr work
} }
ziWChar* ZiGetNextPhonetic(ziWChar* spelling, ziWChar* end ZI_NEED_WORK) { ziWChar* ZiGetNextPhonetic(ziWChar* spelling, ziWChar* end ZI_NEED_WORK) {
while (*spelling && *spelling != ZI_WORK->separator && *spelling != 0xF360 && spelling < end) { while (*spelling && *spelling != ZI_WORK->unk_0x1A && *spelling != 0xF360 && spelling < end) {
++spelling; ++spelling;
} }
if (!*spelling || spelling == end) { if (!*spelling || spelling == end) {
@@ -37,8 +37,8 @@ int ZiPartialMatch(ziWChar* spelling, ziWChar* spellingEnd,
if (spelling == spellingEnd || candidate == candidateEnd || !*spelling || !*candidate) { if (spelling == spellingEnd || candidate == candidateEnd || !*spelling || !*candidate) {
return 1; return 1;
} }
while (*spelling != ZI_WORK->separator && *spelling != 0xF360) { while (*spelling != ZI_WORK->unk_0x1A && *spelling != 0xF360) {
if (*candidate == ZI_WORK->separator || *candidate == 0xF360) { if (*candidate == ZI_WORK->unk_0x1A || *candidate == 0xF360) {
break; break;
} }
if (*spelling != *candidate) { if (*spelling != *candidate) {
@@ -2868,7 +2868,7 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
ziU8 count; ziU8 count;
ziWChar spacedElements[256]; ziWChar spacedElements[256];
struct { ziWChar separator; } savedState; struct { ziWChar separator; } savedState;
savedState.separator = ZI_WORK->separator; savedState.separator = ZI_WORK->unk_0x1A;
if (elementCount <= 1 || !charCount) { if (elementCount <= 1 || !charCount) {
return elementCount; return elementCount;
} }
@@ -2881,9 +2881,9 @@ ziU8 Zi8GetElementCount(ziWChar* elements, ziU8 elementCount, ziU8 charCount ZI_
if (spacedIndex == elementCount) { if (spacedIndex == elementCount) {
return elementCount; return elementCount;
} }
ZI_WORK->separator = 0xF360; ZI_WORK->unk_0x1A = 0xF360;
Zi8ZHaddSpace(elements, elementCount, spacedElements, 256, __zi8_work_data); Zi8ZHaddSpace(elements, elementCount, spacedElements, 256, __zi8_work_data);
ZI_WORK->separator = savedState.separator; ZI_WORK->unk_0x1A = savedState.separator;
spacedIndex = elementIndex = count = 0; spacedIndex = elementIndex = count = 0;
while (charCount && elementIndex < elementCount) { while (charCount && elementIndex < elementCount) {
if (spacedElements[spacedIndex] == 0xF360) { if (spacedElements[spacedIndex] == 0xF360) {

View File

@@ -21,7 +21,7 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ZI_WORK->unk_0x0A = 0xFF; ZI_WORK->unk_0x0A = 0xFF;
ZI_WORK->unk_0x10 = 0x64; ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF; *(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->separator = 0x20; ZI_WORK->unk_0x1A = 0x20;
ZI_WORK->unk_0x1C[2] = 0; ZI_WORK->unk_0x1C[2] = 0;
ZI_WORK->unk_0x1B30 = 0; ZI_WORK->unk_0x1B30 = 0;
ZI_WORK->unk_0x1B3A = 0; ZI_WORK->unk_0x1B3A = 0;

View File

@@ -68,7 +68,7 @@ ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
} }
if (pdst[k - 1] != 0xF360 && if (pdst[k - 1] != 0xF360 &&
(pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) { (pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) {
pdst[k++] = ZI_WORK->separator; pdst[k++] = ZI_WORK->unk_0x1A;
} }
psrc += i; psrc += i;
n -= i; n -= i;

View File

@@ -13,8 +13,8 @@ typedef struct _CDBCryptBuf {
u32 buffer32[0xFB00]; u32 buffer32[0xFB00];
}; // 0x00 }; // 0x00
u32 size; // 0x3EC00 u32 unk_0x3EC00;
u32 offset; // 0x3EC04 u32 unk_0x3EC04;
BOOL allocated; // 0x3EC08 BOOL allocated; // 0x3EC08
u8 unk_0x3EC0C[0x34]; u8 unk_0x3EC0C[0x34];
} CDBCryptBuf; } CDBCryptBuf;

View File

@@ -164,7 +164,7 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
goto open_result_ready; goto open_result_ready;
open_location_ok: open_location_ok:
if (CDBFSSDIsMounted()) { if (CDBFSSDIsMounted()) {
err = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL); err = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->unk_0x3EC00, NULL);
} else { } else {
err = CDB_ERROR_SD_IS_NOT_MOUNTED; err = CDB_ERROR_SD_IS_NOT_MOUNTED;
} }
@@ -174,7 +174,7 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf); CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
return err; return err;
} }
cryptBuf->offset = sizeof(CDBAttrBuf); cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf);
} }
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }
@@ -223,7 +223,7 @@ CDBErr CDBRecordOpenReadOnly_(CDBRecord* record) {
goto result_ready; goto result_ready;
location_ok: location_ok:
if (CDBFSSDIsMounted()) { if (CDBFSSDIsMounted()) {
result = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL); result = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->unk_0x3EC00, NULL);
} else { } else {
result = CDB_ERROR_SD_IS_NOT_MOUNTED; result = CDB_ERROR_SD_IS_NOT_MOUNTED;
} }
@@ -233,7 +233,7 @@ CDBErr CDBRecordOpenReadOnly_(CDBRecord* record) {
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf); CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
return result; return result;
} }
cryptBuf->offset = sizeof(CDBAttrBuf); cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf);
} }
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }

View File

@@ -264,8 +264,8 @@ CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* rea
CDBCryptBuf* cryptBuf = record->cryptBuf; CDBCryptBuf* cryptBuf = record->cryptBuf;
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
u32 unk = cryptBuf->size - cryptBuf->offset; u32 unk = cryptBuf->unk_0x3EC00 - cryptBuf->unk_0x3EC04;
if (cryptBuf->size < unk) { if (cryptBuf->unk_0x3EC00 < unk) {
unk = 0; unk = 0;
} }
@@ -274,8 +274,8 @@ CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* rea
} }
if (unk != 0) { if (unk != 0) {
memcpy(buffer, (u8*)&cryptBuf->buffer[cryptBuf->offset], unk); memcpy(buffer, (u8*)&cryptBuf->buffer[cryptBuf->unk_0x3EC04], unk);
cryptBuf->offset += unk; cryptBuf->unk_0x3EC04 += unk;
} }
if (readSize != NULL) { if (readSize != NULL) {
@@ -300,16 +300,16 @@ CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek) {
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
switch (seek) { switch (seek) {
case CDB_SEEK_BEGIN: { case CDB_SEEK_BEGIN: {
cryptBuf->offset = sizeof(CDBAttrBuf); cryptBuf->unk_0x3EC04 = sizeof(CDBAttrBuf);
cryptBuf->offset += offset; cryptBuf->unk_0x3EC04 += offset;
break; break;
} }
case CDB_SEEK_END: { case CDB_SEEK_END: {
cryptBuf->offset = (cryptBuf->size - 1) - offset; cryptBuf->unk_0x3EC04 = (cryptBuf->unk_0x3EC00 - 1) - offset;
break; break;
} }
case CDB_SEEK_CUR: { case CDB_SEEK_CUR: {
cryptBuf->offset += offset; cryptBuf->unk_0x3EC04 += offset;
break; break;
} }
} }
@@ -329,7 +329,7 @@ int CDBRecordFileTellData(CDBRecord* record) {
CDBCryptBuf* cryptBuf = record->cryptBuf; CDBCryptBuf* cryptBuf = record->cryptBuf;
if (cryptBuf != NULL) { if (cryptBuf != NULL) {
return cryptBuf->offset - sizeof(CDBAttrBuf); return cryptBuf->unk_0x3EC04 - sizeof(CDBAttrBuf);
} }
return CDBFTellData(&recordFile->bridgeFile, record->key.location); return CDBFTellData(&recordFile->bridgeFile, record->key.location);
} }

View File

@@ -31,7 +31,7 @@ namespace ipl {
}; };
// clang-format on // clang-format on
SDButton::SDButton(EGG::Heap* heap) : Base(heap), mAnimWait(0) { SDButton::SDButton(EGG::Heap* heap) : Base(heap), unk_0x54(0) {
setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW);
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@@ -114,10 +114,10 @@ namespace ipl {
} }
void SDButton::calc() { void SDButton::calc() {
if (mAnimWait == 1) { if (unk_0x54 == 1) {
if (!mpLayout->isPlaying(ANIM_HELP_BTN_ROLL_ON)) { if (!mpLayout->isPlaying(ANIM_HELP_BTN_ROLL_ON)) {
reset_gui(); reset_gui();
mAnimWait = 0; unk_0x54 = 0;
} }
} }
@@ -347,7 +347,7 @@ namespace ipl {
switch (animNo) { switch (animNo) {
case IDANIM_HELP_BTN_CLICK: { case IDANIM_HELP_BTN_CLICK: {
anim = mpLayout->getAnim(ANIM_HELP_BTN_ROLL_ON); anim = mpLayout->getAnim(ANIM_HELP_BTN_ROLL_ON);
mAnimWait = 1; unk_0x54 = 1;
break; break;
} }
case IDANIM_ARROW_RIGHT_CLICK: { case IDANIM_ARROW_RIGHT_CLICK: {

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() {
mCmdCapacity = 64; unk_0x264 = 64;
mCmdCount = 0; unk_0x268 = 0;
mCmdReadIdx = 0; unk_0x26C = 0;
mCmdWriteIdx = 0; unk_0x270 = 0;
mSettingArg = arg; mSettingArg = arg;
mpLayout = NULL; mpLayout = NULL;
mpLayoutFile = NULL; mpLayoutFile = NULL;
@@ -81,8 +81,8 @@ 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() && mCmdCount != 0) { !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && unk_0x268 != 0) {
CmdEntry unk = mCmdQueue[mCmdReadIdx]; Unk unk = unk_0x64[unk_0x26C];
switch (unk.command) { switch (unk.command) {
case CMD_SHOW_BTN: { case CMD_SHOW_BTN: {
showBtn(); showBtn();
@@ -98,11 +98,11 @@ namespace ipl {
} }
} }
if (mCmdCount != 0) { if (unk_0x268 != 0) {
if (++mCmdReadIdx >= mCmdCapacity) { if (++unk_0x26C >= unk_0x264) {
mCmdReadIdx = 0; unk_0x26C = 0;
} }
mCmdCount--; unk_0x268--;
} }
} }
@@ -225,16 +225,16 @@ namespace ipl {
} }
void SettingButton::reserve(int command, u32 msgId) { void SettingButton::reserve(int command, u32 msgId) {
if (mCmdCapacity != mCmdCount) { if (unk_0x264 != unk_0x268) {
int unk = mCmdWriteIdx; int unk = unk_0x270;
mCmdQueue[unk].command = command; unk_0x64[unk].command = command;
mCmdQueue[unk].msgID = msgId; unk_0x64[unk].msgID = msgId;
mCmdWriteIdx++; unk_0x270++;
if (mCmdWriteIdx >= mCmdCapacity) { if (unk_0x270 >= unk_0x264) {
mCmdWriteIdx = 0; unk_0x270 = 0;
} }
mCmdCount++; unk_0x268++;
} }
} }

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() {