diff --git a/Makefile b/Makefile index ba6fd8f27e..03c820d069 100644 --- a/Makefile +++ b/Makefile @@ -585,7 +585,7 @@ EGCS_O_FILES += $(BUILD_DIR)/src/code/z_sram.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_En_Mag/z_en_mag.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_End_Title/z_end_title.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_Fishing/z_fishing.o -# EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.o +EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_opening/z_opening.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_title/z_title.o EGCS_O_FILES += $(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.o diff --git a/baseroms/ique-cn/config.yml b/baseroms/ique-cn/config.yml index ccf9232bd7..e01f3c0a09 100644 --- a/baseroms/ique-cn/config.yml +++ b/baseroms/ique-cn/config.yml @@ -928,8 +928,8 @@ assets: end_offset: 0x59D0 - name: overlays/ovl_file_choose xml_path: assets/xml/overlays/ovl_file_choose.xml - start_offset: 0xEC40 - end_offset: 0xF320 + start_offset: 0xF6E0 + end_offset: 0xFDC0 - name: overlays/ovl_Magic_Dark xml_path: assets/xml/overlays/ovl_Magic_Dark.xml start_offset: 0xC90 diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 52dec16582..6c641e1da5 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1140,7 +1140,7 @@ static s16 sQuestItemFlags[] = { QUEST_MEDALLION_WATER, QUEST_MEDALLION_SPIRIT, QUEST_MEDALLION_SHADOW, QUEST_MEDALLION_LIGHT, }; -#if OOT_NTSC && OOT_VERSION < GC_JP_CE +#if (OOT_NTSC && OOT_VERSION < GC_JP_CE) || PLATFORM_IQUE static void* sSaveXTextures[] = { gFileSelSaveXJPNTex, gFileSelSaveXENGTex }; #endif diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index a8ae9da91a..9c6e8ff2db 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -1,5 +1,8 @@ #include "file_select.h" +// In iQue versions, this file contains many workarounds for EGCS internal +// compiler errors (see docs/compilers.md) + // when choosing a file to copy or erase, the 6 main menu buttons are placed at these offsets static s16 sChooseFileYOffsets[] = { -48, -48, -48, -24, -24, 0 }; @@ -19,7 +22,11 @@ void FileSelect_SetupCopySource(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 yStep; s16 i; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = (ABS(this->buttonYOffsets[i] - sChooseFileYOffsets[i])) / this->actionTimer; @@ -29,6 +36,18 @@ void FileSelect_SetupCopySource(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = (ABS(array[i] - sChooseFileYOffsets[i])) / this->actionTimer; + + if (array[i] >= sChooseFileYOffsets[i]) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif this->actionButtonAlpha[FS_BTN_ACTION_COPY] -= 25; this->actionButtonAlpha[FS_BTN_ACTION_ERASE] -= 25; @@ -124,27 +143,65 @@ void FileSelect_SetupCopyDest1(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 yStep; s16 i; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { yStep = ABS(this->buttonYOffsets[i] - D_8081248C[this->buttonIndex][i]) / this->actionTimer; - if (D_8081248C[this->buttonIndex][i] >= this->buttonYOffsets[i]) { + if (this->buttonYOffsets[i] <= D_8081248C[this->buttonIndex][i]) { this->buttonYOffsets[i] += yStep; } else { this->buttonYOffsets[i] -= yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 3; i++) { + yStep = ABS(array[i] - D_8081248C[this->buttonIndex][i]) / this->actionTimer; + if (array[i] <= D_8081248C[this->buttonIndex][i]) { + array[i] += yStep; + } else { + array[i] -= yStep; + } + } +#endif + +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; this->nameBoxAlpha[this->buttonIndex] -= 25; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; + array = this->nameBoxAlpha; + array[this->buttonIndex] -= 25; +#endif this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->buttonYOffsets[this->buttonIndex] = D_8081248C[this->buttonIndex][this->buttonIndex]; +#else + array = this->buttonYOffsets; + array[this->buttonIndex] = D_8081248C[this->buttonIndex][this->buttonIndex]; +#endif + this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->actionTimer = 8; this->configMode++; } @@ -156,14 +213,33 @@ void FileSelect_SetupCopyDest1(GameState* thisx) { */ void FileSelect_SetupCopyDest2(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->nameBoxAlpha[this->buttonIndex] -= 25; this->fileInfoAlpha[this->buttonIndex] += 25; +#else + array = this->nameBoxAlpha; + array[this->buttonIndex] -= 25; + array = this->fileInfoAlpha; + array[this->buttonIndex] += 25; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->nameBoxAlpha[this->buttonIndex] = 0; this->fileInfoAlpha[this->buttonIndex] = 200; +#else + array = this->nameBoxAlpha; + array[this->buttonIndex] = 0; + array = this->fileInfoAlpha; + array[this->buttonIndex] = 200; +#endif + this->buttonIndex = FS_BTN_COPY_QUIT; this->actionTimer = 8; this->configMode = CM_SELECT_COPY_DEST; @@ -250,15 +326,35 @@ void FileSelect_SelectCopyDest(GameState* thisx) { */ void FileSelect_ExitToCopySource1(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->fileInfoAlpha[this->buttonIndex] -= 25; this->nameBoxAlpha[this->buttonIndex] += 25; +#else + array = this->fileInfoAlpha; + array[this->buttonIndex] -= 25; + array = this->nameBoxAlpha; + array[this->buttonIndex] += 25; +#endif + this->actionTimer--; if (this->actionTimer == 0) { this->nextTitleLabel = FS_TITLE_COPY_FROM; + +#if !PLATFORM_IQUE this->nameBoxAlpha[this->buttonIndex] = 200; this->fileInfoAlpha[this->buttonIndex] = 0; +#else + array = this->nameBoxAlpha; + array[this->buttonIndex] = 200; + array = this->fileInfoAlpha; + array[this->buttonIndex] = 0; +#endif + this->actionTimer = 8; this->configMode++; } @@ -273,7 +369,11 @@ void FileSelect_ExitToCopySource2(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { yStep = ABS(this->buttonYOffsets[i] - sChooseFileYOffsets[i]) / this->actionTimer; @@ -283,15 +383,42 @@ void FileSelect_ExitToCopySource2(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 3; i++) { + yStep = ABS(array[i] - sChooseFileYOffsets[i]) / this->actionTimer; + if (array[i] >= sChooseFileYOffsets[i]) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->buttonIndex = FS_BTN_COPY_QUIT; this->configMode = CM_SELECT_COPY_SOURCE; } @@ -307,36 +434,79 @@ void FileSelect_SetupCopyConfirm1(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) { this->fileButtonAlpha[i] -= 25; if (SLOT_OCCUPIED(sramCtx, i)) { - this->connectorAlpha[i] -= 31; this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i]; + this->connectorAlpha[i] -= 31; } - } else { - if (this->copyDestFileIndex == i) { - yStep = ABS(this->buttonYOffsets[i] - D_808124A4[i]) / this->actionTimer; - this->buttonYOffsets[i] += yStep; + } else if (i == this->copyDestFileIndex) { + yStep = ABS(this->buttonYOffsets[i] - D_808124A4[i]) / this->actionTimer; + this->buttonYOffsets[i] += yStep; - if (this->buttonYOffsets[i] >= D_808124A4[i]) { - this->buttonYOffsets[i] = D_808124A4[i]; - } + if (this->buttonYOffsets[i] >= D_808124A4[i]) { + this->buttonYOffsets[i] = D_808124A4[i]; } } } +#else + for (i = 0; i < 3; i++) { + if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) { + array = this->fileButtonAlpha; + array[i] -= 25; + + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] -= 31; + } + } else if (i == this->copyDestFileIndex) { + array = this->buttonYOffsets; + yStep = ABS(array[i] - D_808124A4[i]) / this->actionTimer; + array[i] += yStep; + + if (array[i] >= D_808124A4[i]) { + array[i] = D_808124A4[i]; + } + } + } +#endif this->actionTimer--; if (this->actionTimer == 0) { this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->actionTimer = 8; this->configMode++; } @@ -403,11 +573,23 @@ void FileSelect_ReturnToCopyDest(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; this->actionButtonAlpha[FS_BTN_ACTION_YES] -= 25; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] -= 25; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) { this->fileButtonAlpha[i] += 25; @@ -420,19 +602,55 @@ void FileSelect_ReturnToCopyDest(GameState* thisx) { yStep = ABS(this->buttonYOffsets[i] - D_8081248C[this->selectedFileIndex][i]) / this->actionTimer; - if (D_8081248C[this->selectedFileIndex][i] >= this->buttonYOffsets[i]) { + if (this->buttonYOffsets[i] <= D_8081248C[this->selectedFileIndex][i]) { this->buttonYOffsets[i] += yStep; } else { this->buttonYOffsets[i] -= yStep; } } +#else + for (i = 0; i < 3; i++) { + if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) { + array = this->fileButtonAlpha; + array[i] += 25; + + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] += 31; + } + } + + array = this->buttonYOffsets; + yStep = ABS(array[i] - D_8081248C[this->selectedFileIndex][i]) / this->actionTimer; + + if (array[i] <= D_8081248C[this->selectedFileIndex][i]) { + array[i] += yStep; + } else { + array[i] -= yStep; + } + } +#endif this->actionTimer--; if (this->actionTimer == 0) { this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->actionTimer = 8; this->buttonIndex = FS_BTN_COPY_QUIT; this->configMode = CM_SELECT_COPY_DEST; @@ -467,24 +685,55 @@ void FileSelect_CopyAnim1(GameState* thisx) { void FileSelect_CopyAnim2(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->fileInfoAlpha[this->copyDestFileIndex] += 25; this->nameAlpha[this->copyDestFileIndex] += 25; this->titleAlpha[1] += 31; - yStep = ABS(this->fileNamesY[this->copyDestFileIndex] + 56) / this->actionTimer; +#else + array = this->fileInfoAlpha; + array[this->copyDestFileIndex] += 25; + array = this->nameAlpha; + array[this->copyDestFileIndex] += 25; + array = this->titleAlpha; + array[1] += 31; +#endif + +#if !PLATFORM_IQUE + yStep = ABS(this->fileNamesY[this->copyDestFileIndex] - -56) / this->actionTimer; this->fileNamesY[this->copyDestFileIndex] -= yStep; if (this->fileNamesY[this->copyDestFileIndex] <= -56) { this->fileNamesY[this->copyDestFileIndex] = -56; } +#else + array = this->fileNamesY; + yStep = ABS(array[this->copyDestFileIndex] - -56) / this->actionTimer; + array[this->copyDestFileIndex] -= yStep; + + if (array[this->copyDestFileIndex] <= -56) { + array[this->copyDestFileIndex] = -56; + } +#endif this->actionTimer--; if (this->actionTimer == 0) { this->actionTimer = 90; this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode++; } } @@ -523,16 +772,36 @@ void FileSelect_CopyAnim3(GameState* thisx) { */ void FileSelect_CopyAnim4(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; + s16* array; +#if !PLATFORM_IQUE this->fileInfoAlpha[this->selectedFileIndex] -= 25; this->fileInfoAlpha[this->copyDestFileIndex] -= 25; this->nameBoxAlpha[this->selectedFileIndex] += 25; this->nameBoxAlpha[this->copyDestFileIndex] += 25; this->titleAlpha[0] -= 31; +#else + array = this->fileInfoAlpha; + array[this->selectedFileIndex] -= 25; + array[this->copyDestFileIndex] -= 25; + array = this->nameBoxAlpha; + array[this->selectedFileIndex] += 25; + array[this->copyDestFileIndex] += 25; + array = this->titleAlpha; + array[0] -= 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->fileNamesY[this->copyDestFileIndex] = this->buttonYOffsets[3] = 0; +#else + array = this->fileNamesY; + array[this->copyDestFileIndex] = 0; + this->buttonYOffsets[3] = 0; +#endif + this->actionTimer = 8; this->titleAlpha[0] = 0; this->configMode++; @@ -548,7 +817,11 @@ void FileSelect_CopyAnim5(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = ABS(this->buttonYOffsets[i]) / this->actionTimer; @@ -558,7 +831,20 @@ void FileSelect_CopyAnim5(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = ABS(array[i]) / this->actionTimer; + if (array[i] >= 0) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if (i != this->buttonIndex) { this->fileButtonAlpha[i] += 25; @@ -569,32 +855,98 @@ void FileSelect_CopyAnim5(GameState* thisx) { } } } +#else + for (i = 0; i < 3; i++) { + if (i != this->buttonIndex) { + array = this->fileButtonAlpha; + array[i] += 25; + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] += 31; + } + } + } +#endif + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] += 25; this->actionButtonAlpha[FS_BTN_ACTION_ERASE] += 25; this->optionButtonAlpha += 25; this->titleAlpha[1] += 31; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] += 25; + array[FS_BTN_ACTION_ERASE] += 25; + this->optionButtonAlpha += 25; + array = this->titleAlpha; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { - this->connectorAlpha[i] = 0; this->fileButtonAlpha[i] = 200; - this->nameBoxAlpha[i] = this->nameAlpha[i] = this->connectorAlpha[i]; + this->nameBoxAlpha[i] = this->nameAlpha[i] = this->connectorAlpha[i] = 0; if (SLOT_OCCUPIED(sramCtx, i)) { - this->connectorAlpha[i] = 255; this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i]; + this->connectorAlpha[i] = 255; } } +#else + for (i = 0; i < 3; i++) { + array = this->fileButtonAlpha; + array[i] = 200; + array = this->nameBoxAlpha; + array[i] = 0; + array = this->nameAlpha; + array[i] = 0; + array = this->connectorAlpha; + array[i] = 0; + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] = 255; + } + } +#endif + +#if !PLATFORM_IQUE this->fileNamesY[this->selectedFileIndex] = 0; +#else + array = this->fileNamesY; + array[this->selectedFileIndex] = 0; +#endif + this->highlightColor[3] = 70; this->highlightPulseDir = 1; XREG(35) = XREG(36); this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode = CM_MAIN_MENU; } } @@ -607,7 +959,11 @@ void FileSelect_ExitCopyToMain(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = ABS(this->buttonYOffsets[i]) / this->actionTimer; @@ -617,24 +973,66 @@ void FileSelect_ExitCopyToMain(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = ABS(array[i]) / this->actionTimer; + if (array[i] >= 0) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] += 25; this->actionButtonAlpha[FS_BTN_ACTION_QUIT] -= 25; this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] += 25; + array[FS_BTN_ACTION_QUIT] -= 25; + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] = 200; this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 0; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] = 200; + array[FS_BTN_ACTION_QUIT] = 0; +#endif + this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode = CM_MAIN_MENU; } +#if !PLATFORM_IQUE this->optionButtonAlpha = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->actionButtonAlpha[FS_BTN_ACTION_COPY]; +#else + array = this->actionButtonAlpha; + this->optionButtonAlpha = array[FS_BTN_ACTION_ERASE] = array[FS_BTN_ACTION_COPY]; +#endif } /** @@ -645,7 +1043,11 @@ void FileSelect_SetupEraseSelect(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = ABS(this->buttonYOffsets[i] - sChooseFileYOffsets[i]) / this->actionTimer; @@ -655,19 +1057,46 @@ void FileSelect_SetupEraseSelect(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = ABS(array[i] - sChooseFileYOffsets[i]) / this->actionTimer; + if (array[i] >= sChooseFileYOffsets[i]) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] -= 50; this->actionButtonAlpha[FS_BTN_ACTION_ERASE] -= 50; this->optionButtonAlpha -= 50; this->actionButtonAlpha[FS_BTN_ACTION_QUIT] += 25; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] -= 50; + array[FS_BTN_ACTION_ERASE] -= 50; + this->optionButtonAlpha -= 50; + array[FS_BTN_ACTION_QUIT] += 25; +#endif if (this->actionButtonAlpha[FS_BTN_ACTION_COPY] <= 0) { this->actionButtonAlpha[FS_BTN_ACTION_COPY] = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->optionButtonAlpha = 0; } +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { @@ -676,10 +1105,25 @@ void FileSelect_SetupEraseSelect(GameState* thisx) { XREG(35) = XREG(36); this->actionButtonAlpha[FS_BTN_ACTION_COPY] = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->optionButtonAlpha = 0; + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 200; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_QUIT] = 200; +#endif + this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->buttonIndex = FS_BTN_ERASE_QUIT; this->configMode++; } @@ -757,22 +1201,56 @@ void FileSelect_SetupEraseConfirm1(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if (i != this->buttonIndex) { this->fileButtonAlpha[i] -= 25; if (SLOT_OCCUPIED(sramCtx, i)) { - this->connectorAlpha[i] -= 31; this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i]; + this->connectorAlpha[i] -= 31; } } else { this->nameBoxAlpha[i] -= 25; } } +#else + for (i = 0; i < 3; i++) { + if (i != this->buttonIndex) { + array = this->fileButtonAlpha; + array[i] -= 25; + + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] -= 31; + } + } else { + array = this->nameBoxAlpha; + array[i] -= 25; + } + } +#endif + +#if !PLATFORM_IQUE this->titleAlpha[0] -= 15; this->titleAlpha[1] += 15; +#else + array = this->titleAlpha; + array[0] -= 15; + array[1] += 15; +#endif +#if !PLATFORM_IQUE yStep = ABS(this->buttonYOffsets[this->buttonIndex] - D_808124AC[this->buttonIndex]) / this->actionTimer; if (this->buttonYOffsets[this->buttonIndex] >= D_808124AC[this->buttonIndex]) { @@ -780,24 +1258,63 @@ void FileSelect_SetupEraseConfirm1(GameState* thisx) { } else { this->buttonYOffsets[this->buttonIndex] += yStep; } +#else + array = this->buttonYOffsets; + yStep = ABS(array[this->buttonIndex] - D_808124AC[this->buttonIndex]) / this->actionTimer; + + if (array[this->buttonIndex] >= D_808124AC[this->buttonIndex]) { + array[this->buttonIndex] -= yStep; + } else { + array[this->buttonIndex] += yStep; + } +#endif this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if (i != this->buttonIndex) { this->fileButtonAlpha[i] = 0; if (SLOT_OCCUPIED(sramCtx, i)) { + this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i]; this->connectorAlpha[i] = 0; - this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i] = 0; } } else { this->nameBoxAlpha[i] = 0; } } +#else + for (i = 0; i < 3; i++) { + if (i != this->buttonIndex) { + array = this->fileButtonAlpha; + array[i] = 0; + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] = 0; + } + } else { + array = this->nameBoxAlpha; + array[i] = 0; + } + } +#endif + +#if !PLATFORM_IQUE this->buttonYOffsets[this->buttonIndex] = D_808124AC[this->buttonIndex]; +#else + array = this->buttonYOffsets; + array[this->buttonIndex] = D_808124AC[this->buttonIndex]; +#endif + this->actionTimer = 8; this->configMode++; } @@ -809,19 +1326,43 @@ void FileSelect_SetupEraseConfirm1(GameState* thisx) { */ void FileSelect_SetupEraseConfirm2(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_YES] += 25; this->titleAlpha[0] -= 15; this->titleAlpha[1] += 15; this->fileInfoAlpha[this->buttonIndex] += 25; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] += 25; + array = this->titleAlpha; + array[0] -= 15; + array[1] += 15; + array = this->fileInfoAlpha; + array[this->buttonIndex] += 25; +#endif + this->actionTimer--; if (this->actionTimer == 0) { this->actionTimer = 8; this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->fileInfoAlpha[this->buttonIndex] = this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; this->actionButtonAlpha[FS_BTN_ACTION_YES] = 200; +#else + array = this->titleAlpha; + this->fileInfoAlpha[this->buttonIndex] = array[0] = 255; + array[1] = 0; + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] = 200; +#endif + this->buttonIndex = FS_BTN_CONFIRM_QUIT; this->configMode = CM_ERASE_CONFIRM; } @@ -865,15 +1406,35 @@ void FileSelect_EraseConfirm(GameState* thisx) { */ void FileSelect_ExitToEraseSelect1(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE this->fileInfoAlpha[this->buttonIndex] -= 25; this->nameBoxAlpha[this->buttonIndex] += 25; this->actionButtonAlpha[FS_BTN_ACTION_YES] -= 25; +#else + array = this->fileInfoAlpha; + array[this->buttonIndex] -= 25; + array = this->nameBoxAlpha; + array[this->buttonIndex] += 25; + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] -= 25; +#endif + this->actionTimer--; if (this->actionTimer == 0) { this->actionTimer = 8; + +#if !PLATFORM_IQUE this->fileInfoAlpha[this->buttonIndex] = 0; +#else + array = this->fileInfoAlpha; + array[this->buttonIndex] = 0; +#endif + this->configMode++; } } @@ -887,7 +1448,11 @@ void FileSelect_ExitToEraseSelect2(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE yStep = ABS(this->buttonYOffsets[this->buttonIndex] - sChooseFileYOffsets[this->buttonIndex]) / this->actionTimer; if (this->buttonYOffsets[this->buttonIndex] >= sChooseFileYOffsets[this->buttonIndex]) { @@ -895,7 +1460,18 @@ void FileSelect_ExitToEraseSelect2(GameState* thisx) { } else { this->buttonYOffsets[this->buttonIndex] += yStep; } +#else + array = this->buttonYOffsets; + yStep = ABS(array[this->buttonIndex] - sChooseFileYOffsets[this->buttonIndex]) / this->actionTimer; + if (array[this->buttonIndex] >= sChooseFileYOffsets[this->buttonIndex]) { + array[this->buttonIndex] -= yStep; + } else { + array[this->buttonIndex] += yStep; + } +#endif + +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { if (i != this->buttonIndex) { this->fileButtonAlpha[i] += 25; @@ -906,18 +1482,58 @@ void FileSelect_ExitToEraseSelect2(GameState* thisx) { } } } +#else + for (i = 0; i < 3; i++) { + if (i != this->buttonIndex) { + array = this->fileButtonAlpha; + array[i] += 25; + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] += 31; + } + } + } +#endif + +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->buttonYOffsets[this->buttonIndex] = sChooseFileYOffsets[this->buttonIndex]; +#else + array = this->buttonYOffsets; + array[this->buttonIndex] = sChooseFileYOffsets[this->buttonIndex]; +#endif + this->actionTimer = 8; this->buttonIndex = FS_BTN_ERASE_QUIT; this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode = CM_ERASE_SELECT; } } @@ -931,6 +1547,9 @@ void FileSelect_EraseAnim1(GameState* thisx) { static s16 D_80813800; FileSelectState* this = (FileSelectState*)thisx; SramContext* sramCtx = &this->sramCtx; +#if PLATFORM_IQUE + s16* array; +#endif if (sEraseDelayTimer == 0) { if (this->actionTimer == 8) { @@ -938,25 +1557,54 @@ void FileSelect_EraseAnim1(GameState* thisx) { } if (this->actionTimer != 0) { +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; this->fileInfoAlpha[this->selectedFileIndex] -= 25; this->actionButtonAlpha[FS_BTN_ACTION_YES] -= 25; this->actionButtonAlpha[FS_BTN_ACTION_QUIT] -= 25; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; + array = this->fileInfoAlpha; + array[this->selectedFileIndex] -= 25; + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] -= 25; + array[FS_BTN_ACTION_QUIT] -= 25; +#endif } +#if !PLATFORM_IQUE this->fileNamesY[this->selectedFileIndex] -= D_80813800; - this->actionTimer--; +#else + array = this->fileNamesY; + array[this->selectedFileIndex] -= D_80813800; +#endif + D_80813800 += 2; + this->actionTimer--; if (this->actionTimer == 0) { Sram_EraseSave(this, sramCtx); this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = this->connectorAlpha[this->selectedFileIndex] = 0; - this->fileInfoAlpha[this->selectedFileIndex] = this->nameBoxAlpha[this->selectedFileIndex] = this->actionButtonAlpha[FS_BTN_ACTION_YES] = this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = this->connectorAlpha[this->selectedFileIndex] = 0; + array = this->fileInfoAlpha; + array[this->selectedFileIndex] = 0; + array = this->nameBoxAlpha; + array[this->selectedFileIndex] = 0; + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_YES] = array[FS_BTN_ACTION_QUIT] = 0; +#endif this->configMode++; this->actionTimer = 90; @@ -998,7 +1646,11 @@ void FileSelect_EraseAnim3(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = ABS(this->buttonYOffsets[i]) / this->actionTimer; @@ -1008,7 +1660,20 @@ void FileSelect_EraseAnim3(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = ABS(array[i]) / this->actionTimer; + if (array[i] >= 0) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE for (i = 0; i < 3; i++) { this->fileButtonAlpha[i] += 25; @@ -1017,30 +1682,88 @@ void FileSelect_EraseAnim3(GameState* thisx) { this->connectorAlpha[i] += 31; } } +#else + for (i = 0; i < 3; i++) { + array = this->fileButtonAlpha; + array[i] += 25; + if (SLOT_OCCUPIED(sramCtx, i)) { + s16* nameBoxAlpha = this->nameBoxAlpha; + s16* nameAlpha = this->nameAlpha; + s16* fileButtonAlpha = this->fileButtonAlpha; + + nameBoxAlpha[i] = nameAlpha[i] = fileButtonAlpha[i]; + + array = this->connectorAlpha; + array[i] += 31; + } + } +#endif + +#if !PLATFORM_IQUE if (this->fileButtonAlpha[this->selectedFileIndex] >= 200) { this->fileButtonAlpha[this->selectedFileIndex] = 200; } +#else + array = this->fileButtonAlpha; + if (array[this->selectedFileIndex] >= 200) { + array[this->selectedFileIndex] = 200; + } +#endif +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { +#if !PLATFORM_IQUE this->fileNamesY[this->selectedFileIndex] = 0; +#else + array = this->fileNamesY; + array[this->selectedFileIndex] = 0; +#endif + this->highlightColor[3] = 70; this->highlightPulseDir = 1; XREG(35) = XREG(36); + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] = 200; this->actionButtonAlpha[FS_BTN_ACTION_YES] = this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 0; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] = 200; + array[FS_BTN_ACTION_YES] = array[FS_BTN_ACTION_QUIT] = 0; +#endif + this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode = CM_MAIN_MENU; } +#if !PLATFORM_IQUE this->optionButtonAlpha = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->actionButtonAlpha[FS_BTN_ACTION_COPY]; +#else + array = this->actionButtonAlpha; + this->optionButtonAlpha = array[FS_BTN_ACTION_ERASE] = array[FS_BTN_ACTION_COPY]; +#endif } /** @@ -1051,7 +1774,11 @@ void FileSelect_ExitEraseToMain(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; s16 i; s16 yStep; +#if PLATFORM_IQUE + s16* array; +#endif +#if !PLATFORM_IQUE for (i = 0; i < 5; i++) { yStep = ABS(this->buttonYOffsets[i]) / this->actionTimer; @@ -1061,7 +1788,20 @@ void FileSelect_ExitEraseToMain(GameState* thisx) { this->buttonYOffsets[i] += yStep; } } +#else + array = this->buttonYOffsets; + for (i = 0; i < 5; i++) { + yStep = ABS(array[i]) / this->actionTimer; + if (array[i] >= 0) { + array[i] -= yStep; + } else { + array[i] += yStep; + } + } +#endif + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] += 25; this->actionButtonAlpha[FS_BTN_ACTION_ERASE] += 25; this->optionButtonAlpha += 25; @@ -1070,23 +1810,62 @@ void FileSelect_ExitEraseToMain(GameState* thisx) { if (this->actionButtonAlpha[FS_BTN_ACTION_QUIT] <= 0) { this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 0; } +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] += 25; + array[FS_BTN_ACTION_ERASE] += 25; + this->optionButtonAlpha += 25; + array[FS_BTN_ACTION_QUIT] -= 50; + if (array[FS_BTN_ACTION_QUIT] <= 0) { + array[FS_BTN_ACTION_QUIT] = 0; + } +#endif + +#if !PLATFORM_IQUE this->titleAlpha[0] -= 31; this->titleAlpha[1] += 31; +#else + array = this->titleAlpha; + array[0] -= 31; + array[1] += 31; +#endif + this->actionTimer--; if (this->actionTimer == 0) { this->highlightColor[3] = 70; this->highlightPulseDir = 1; XREG(35) = XREG(36); + +#if !PLATFORM_IQUE this->actionButtonAlpha[FS_BTN_ACTION_COPY] = 200; this->actionButtonAlpha[FS_BTN_ACTION_QUIT] = 0; +#else + array = this->actionButtonAlpha; + array[FS_BTN_ACTION_COPY] = 200; + array[FS_BTN_ACTION_QUIT] = 0; +#endif + this->titleLabel = this->nextTitleLabel; + +#if !PLATFORM_IQUE this->titleAlpha[0] = 255; this->titleAlpha[1] = 0; +#else + array = this->titleAlpha; + array[0] = 255; + array[1] = 0; +#endif + this->configMode = CM_MAIN_MENU; } +#if !PLATFORM_IQUE this->optionButtonAlpha = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] = this->actionButtonAlpha[FS_BTN_ACTION_COPY]; +#else + array = this->actionButtonAlpha; + this->optionButtonAlpha = array[FS_BTN_ACTION_ERASE] = array[FS_BTN_ACTION_COPY]; +#endif } diff --git a/tools/disasm/ique-cn/files_ovl_file_choose.csv b/tools/disasm/ique-cn/files_ovl_file_choose.csv index d1c024e666..c850ed0ca5 100644 --- a/tools/disasm/ique-cn/files_ovl_file_choose.csv +++ b/tools/disasm/ique-cn/files_ovl_file_choose.csv @@ -6,8 +6,8 @@ offset,vram,.text offset,vram,.data F6E0,80812DE0,src/overlays/gamestates/ovl_file_choose/z_file_nameset_data FDC0,808134C0,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase -FE00,80813500,src/overlays/gamestates/ovl_file_choose/z_file_nameset -FFA0,808136A0,src/overlays/gamestates/ovl_file_choose/z_file_choose +FDF0,808134F0,src/overlays/gamestates/ovl_file_choose/z_file_nameset +FF90,80813690,src/overlays/gamestates/ovl_file_choose/z_file_choose offset,vram,.rodata 10280,80813980,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase