From cbebd35178391c7dcc119e5af3cbab03be270b45 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:41:13 +0000 Subject: [PATCH] refactor(keyboard,www,utility,sound,nw4r): named constants and cast cleanup (rx34) (worker 924a779f) --- libs/NW4R/src/db/db_exception.cpp | 36 +-- libs/NW4R/src/lyt/lyt_common.cpp | 4 +- libs/NW4R/src/lyt/lyt_material.cpp | 4 +- libs/NW4R/src/lyt/lyt_pane.cpp | 4 +- libs/NW4R/src/snd/snd_AxVoice.cpp | 4 +- libs/NW4R/src/snd/snd_BankFile.cpp | 2 +- libs/NW4R/src/snd/snd_RemoteSpeaker.cpp | 6 +- libs/NW4R/src/snd/snd_SoundThread.cpp | 2 +- libs/NW4R/src/snd/snd_StrmChannel.cpp | 2 +- libs/NW4R/src/snd/snd_StrmPlayer.cpp | 2 +- libs/NW4R/src/snd/snd_TaskThread.cpp | 4 +- libs/NW4R/src/snd/snd_WavePlayer.cpp | 4 +- libs/NW4R/src/snd/snd_WsdPlayer.cpp | 2 +- libs/NW4R/src/ut/ut_CharWriter.cpp | 18 +- libs/NW4R/src/ut/ut_ResFontBase.cpp | 6 +- src/iplwww/www_arcreader.cpp | 2 +- src/iplwww/www_window.cpp | 2 +- src/keyboard/MyTiInputForm.cpp | 22 +- src/keyboard/MyTiLetterForm.cpp | 6 +- src/keyboard/MyTiManager.cpp | 8 +- src/keyboard/tiCandidateBox.cpp | 63 ++--- src/keyboard/tiCellPhone.cpp | 54 ++-- src/keyboard/tiDebug.cpp | 12 +- src/keyboard/tiGUIManager.cpp | 6 +- src/keyboard/tiInputForm.cpp | 180 ++++++------ src/keyboard/tiKeyboard.cpp | 4 +- src/keyboard/tiPcKeyboard.cpp | 52 ++-- src/keyboard/tiSignWindow.cpp | 14 +- src/keyboard/tiTextDrawer.cpp | 2 +- src/layout/GUIManager.cpp | 6 +- src/layout/iplLayout.cpp | 4 +- src/sound/iplSound.cpp | 12 +- src/utility/iplFrameController.cpp | 2 +- src/utility/iplGraphics.cpp | 10 +- src/utility/iplJpegDecoder.cpp | 4 +- src/utility/iplThread.cpp | 2 +- src/utility/iplUtility.cpp | 2 +- tools/decomp-assist/rx34.cleanup.md | 352 ++++++++++++++++++++++++ 38 files changed, 635 insertions(+), 286 deletions(-) create mode 100644 tools/decomp-assist/rx34.cleanup.md diff --git a/libs/NW4R/src/db/db_exception.cpp b/libs/NW4R/src/db/db_exception.cpp index 876f7bb1..6e6c0d90 100644 --- a/libs/NW4R/src/db/db_exception.cpp +++ b/libs/NW4R/src/db/db_exception.cpp @@ -79,7 +79,7 @@ namespace nw4r { sException.frameMemory = NULL; sException.exceptionRenderObj = NULL; - OSCreateThread(&sException.thread, RunThread_, NULL, sThreadBuffer + 0x4000, 0x4000, 0, 1); + OSCreateThread(&sException.thread, RunThread_, NULL, sThreadBuffer + 0x4000, 0x4000, 0, OS_THREAD_ATTR_DETACH); OSInitMessageQueue(&sException.queue, sMessageBuffer, 1); OSResumeThread(&sException.thread); @@ -98,7 +98,7 @@ namespace nw4r { sException.FPCSR_COPY = context->fpscr; OSFillFPUContext(context); OSSetErrorHandler(error, NULL); - if (error == 0xf) { + if (error == OS_EXCEPTION_MEMORY_PROTECTION) { OSProtectRange(0, 0, 0, 3); OSProtectRange(1, 0, 0, 3); OSProtectRange(2, 0, 0, 3); @@ -111,7 +111,7 @@ namespace nw4r { param.dsisr = dsisr; param.dar = dar; - OSSendMessage(&sException.queue, ¶m, 1); + OSSendMessage(&sException.queue, ¶m, OS_MESSAGE_BLOCK); OSEnableScheduler(); OSYieldThread(); @@ -138,7 +138,7 @@ namespace nw4r { u32 msr = PPCMfmsr(); PPCMtmsr(msr & ~(MSR_FE0 | MSR_FE1)); - OSReceiveMessage(&sException.queue, &message, 1); + OSReceiveMessage(&sException.queue, &message, OS_MESSAGE_BLOCK); OSDisableInterrupts(); VISetPreRetraceCallback(NULL); @@ -303,46 +303,46 @@ namespace nw4r { if (error == OS_EXCEPTION_FLOATING_POINT_EXCEPTION) { u32 fpcsr = sException.FPCSR_COPY; fpcsr &= (((fpcsr & 0xf8) << 0x16) | 0x01f80700); - if ((fpcsr & 0x20000000) != 0) { + if ((fpcsr & FPSCR_VX) != 0) { Exception_Printf_(" FPE: Invalid operation\n"); - if ((sException.FPCSR_COPY & 0x1000000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXSNAN) != 0) { Exception_Printf_(" SNaN\n"); } - if ((sException.FPCSR_COPY & 0x800000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXISI) != 0) { Exception_Printf_(" Infinity - Infinity\n"); } - if ((sException.FPCSR_COPY & 0x400000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXIDI) != 0) { Exception_Printf_(" Infinity / Infinity\n"); } - if ((sException.FPCSR_COPY & 0x200000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXZDZ) != 0) { Exception_Printf_(" 0 / 0\n"); } - if ((sException.FPCSR_COPY & 0x100000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXIMZ) != 0) { Exception_Printf_(" Infinity * 0\n"); } - if ((sException.FPCSR_COPY & 0x80000) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXVC) != 0) { Exception_Printf_(" Invalid compare\n"); } - if ((sException.FPCSR_COPY & 0x400) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXSOFT) != 0) { Exception_Printf_(" Software request\n"); } - if ((sException.FPCSR_COPY & 0x200) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXSQRT) != 0) { Exception_Printf_(" Invalid square root\n"); } - if ((sException.FPCSR_COPY & 0x100) != 0) { + if ((sException.FPCSR_COPY & FPSCR_VXCVI) != 0) { Exception_Printf_(" Invalid integer convert\n"); } } - if ((fpcsr & 0x10000000) != 0) { + if ((fpcsr & FPSCR_OX) != 0) { Exception_Printf_(" FPE: Overflow\n"); } - if ((fpcsr & 0x8000000) != 0) { + if ((fpcsr & FPSCR_UX) != 0) { Exception_Printf_(" FPE: Underflow\n"); } - if ((fpcsr & 0x4000000) != 0) { + if ((fpcsr & FPSCR_ZX) != 0) { Exception_Printf_(" FPE: Zero division\n"); } - if ((fpcsr & 0x2000000) != 0) { + if ((fpcsr & FPSCR_XX) != 0) { Exception_Printf_(" FPE: Inexact result\n"); } } diff --git a/libs/NW4R/src/lyt/lyt_common.cpp b/libs/NW4R/src/lyt/lyt_common.cpp index dd639aac..93863438 100644 --- a/libs/NW4R/src/lyt/lyt_common.cpp +++ b/libs/NW4R/src/lyt/lyt_common.cpp @@ -135,12 +135,12 @@ namespace nw4r { for (int i = 0; i < texCoordNum; i++) { GXSetVtxDesc(static_cast(GX_VA_TEX0 + i), GX_DIRECT); } - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0); if (bModulate) { GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); } for (int i = 0; i < texCoordNum; i++) { - GXSetVtxAttrFmt(GX_VTXFMT0, static_cast(GX_VA_TEX0 + i), GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, static_cast(GX_VA_TEX0 + i), GX_TEX_ST, GX_F32, 0); } } diff --git a/libs/NW4R/src/lyt/lyt_material.cpp b/libs/NW4R/src/lyt/lyt_material.cpp index bca59b59..d5f4a6c8 100644 --- a/libs/NW4R/src/lyt/lyt_material.cpp +++ b/libs/NW4R/src/lyt/lyt_material.cpp @@ -968,8 +968,8 @@ namespace nw4r { for (u8 id = 0; id < tevStageNum; id++) { GXTevStageID tevStage = static_cast(id); - GXSetTevColorOp(tevStage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); - GXSetTevAlphaOp(tevStage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevColorOp(tevStage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaOp(tevStage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevDirect(tevStage); GXSetTevSwapMode(tevStage, GX_TEV_SWAP0, GX_TEV_SWAP0); diff --git a/libs/NW4R/src/lyt/lyt_pane.cpp b/libs/NW4R/src/lyt/lyt_pane.cpp index 2611ef73..1cade0e4 100644 --- a/libs/NW4R/src/lyt/lyt_pane.cpp +++ b/libs/NW4R/src/lyt/lyt_pane.cpp @@ -411,8 +411,8 @@ namespace nw4r { mtxPtr = mGlbMtx; } - GXLoadPosMtxImm(mtxPtr, 0); - GXSetCurrentMtx(0); + GXLoadPosMtxImm(mtxPtr, GX_PNMTX0); + GXSetCurrentMtx(GX_PNMTX0); } math::VEC2 Pane::GetVtxPos() const { diff --git a/libs/NW4R/src/snd/snd_AxVoice.cpp b/libs/NW4R/src/snd/snd_AxVoice.cpp index 44568655..f4b171a9 100644 --- a/libs/NW4R/src/snd/snd_AxVoice.cpp +++ b/libs/NW4R/src/snd/snd_AxVoice.cpp @@ -808,7 +808,7 @@ namespace nw4r { } else { u16 a0, b0; - if (mVpb[0][0]->pb.lpf.on == TRUE) { + if (mVpb[0][0]->pb.lpf.on == AX_PB_LPF_ON) { AXGetLpfCoefs(freq, &a0, &b0); for (int j = 0; j < mChannelCount; j++) { @@ -817,7 +817,7 @@ namespace nw4r { } else { AXPBLPF lpf; - lpf.on = TRUE; + lpf.on = AX_PB_LPF_ON; lpf.yn1 = 0; AXGetLpfCoefs(freq, &lpf.a0, &lpf.b0); diff --git a/libs/NW4R/src/snd/snd_BankFile.cpp b/libs/NW4R/src/snd/snd_BankFile.cpp index b736e929..d167b2f1 100644 --- a/libs/NW4R/src/snd/snd_BankFile.cpp +++ b/libs/NW4R/src/snd/snd_BankFile.cpp @@ -148,7 +148,7 @@ namespace nw4r { return NULL; } - pSub = reinterpret_cast(pIndexTable->ref + (splitKey - pIndexTable->min)); + pSub = pIndexTable->ref + (splitKey - pIndexTable->min); break; } } diff --git a/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp b/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp index e0e77a48..394535cb 100644 --- a/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp +++ b/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp @@ -61,9 +61,9 @@ namespace nw4r { if (mPlayFlag) { if (playFlag) { - wencMode = 1; + wencMode = WENC_FLAG_USER_INFO; } else { - wencMode = 1; + wencMode = WENC_FLAG_USER_INFO; lastFlag = true; } } else { @@ -71,7 +71,7 @@ namespace nw4r { if (mFirstEncodeFlag) { wencMode = 0; } else { - wencMode = 1; + wencMode = WENC_FLAG_USER_INFO; } mFirstEncodeFlag = false; diff --git a/libs/NW4R/src/snd/snd_SoundThread.cpp b/libs/NW4R/src/snd/snd_SoundThread.cpp index 2ec5c139..80dc745a 100644 --- a/libs/NW4R/src/snd/snd_SoundThread.cpp +++ b/libs/NW4R/src/snd/snd_SoundThread.cpp @@ -58,7 +58,7 @@ namespace nw4r { OSMessage message; while (true) { - OSReceiveMessage(&mMsgQueue, &message, 1); + OSReceiveMessage(&mMsgQueue, &message, OS_MESSAGE_BLOCK); if (reinterpret_cast(message) == MSG_AX_CALLBACK) { ut::AutoMutexLock autoMutex(mMutex); diff --git a/libs/NW4R/src/snd/snd_StrmChannel.cpp b/libs/NW4R/src/snd/snd_StrmChannel.cpp index ef2fd740..3a5ec828 100644 --- a/libs/NW4R/src/snd/snd_StrmChannel.cpp +++ b/libs/NW4R/src/snd/snd_StrmChannel.cpp @@ -52,7 +52,7 @@ namespace nw4r { u8 mask = 1 << 0; - for (int j = 0; j < 8; j++, mask <<= 1) { + for (int j = 0; j < BITS_PER_BYTE; j++, mask <<= 1) { // Block represented by this bit is in use if (flag & mask) { continue; diff --git a/libs/NW4R/src/snd/snd_StrmPlayer.cpp b/libs/NW4R/src/snd/snd_StrmPlayer.cpp index ec403a11..3bfdc9ec 100644 --- a/libs/NW4R/src/snd/snd_StrmPlayer.cpp +++ b/libs/NW4R/src/snd/snd_StrmPlayer.cpp @@ -718,7 +718,7 @@ namespace nw4r { } void StrmPlayer::NotifyStrmHeaderAsyncEndCallback(bool result, const StrmHeader* header, void* userData) { - StrmPlayer* player = reinterpret_cast(userData); + StrmPlayer* player = static_cast(userData); if (result) { player->Setup(header); } else { diff --git a/libs/NW4R/src/snd/snd_TaskThread.cpp b/libs/NW4R/src/snd/snd_TaskThread.cpp index f0106f8d..c5e59fec 100644 --- a/libs/NW4R/src/snd/snd_TaskThread.cpp +++ b/libs/NW4R/src/snd/snd_TaskThread.cpp @@ -33,7 +33,7 @@ namespace nw4r { void* TaskThread::ThreadFunc(void* arg) { TaskThread* thread = static_cast(arg); - OSInitMessageQueue(&thread->mMsgQueue, thread->mMsgBuffer, 8); + OSInitMessageQueue(&thread->mMsgQueue, thread->mMsgBuffer, MSG_QUEUE_CAPACITY); thread->ThreadProc(); @@ -44,7 +44,7 @@ namespace nw4r { OSMessage msg; while (true) { - OSReceiveMessage(&mMsgQueue, &msg, 1); + OSReceiveMessage(&mMsgQueue, &msg, OS_MESSAGE_BLOCK); if (reinterpret_cast(msg) == MSG_EXECUTE) { TaskManager::GetInstance().Execute(); diff --git a/libs/NW4R/src/snd/snd_WavePlayer.cpp b/libs/NW4R/src/snd/snd_WavePlayer.cpp index 5e5a7173..2f8247bb 100644 --- a/libs/NW4R/src/snd/snd_WavePlayer.cpp +++ b/libs/NW4R/src/snd/snd_WavePlayer.cpp @@ -160,7 +160,7 @@ namespace nw4r { void WavePlayer::Pause(bool flag) { ut::AutoInterruptLock lock; - if (mStartFlag == false) { + if (!mStartFlag) { return; } @@ -224,7 +224,7 @@ namespace nw4r { } void WavePlayer::VoiceCallbackFunc(detail::AxVoice* voice, detail::AxVoice::CallbackStatus status, void* arg) { - WavePlayer* wavePlayer = reinterpret_cast(arg); + WavePlayer* wavePlayer = static_cast(arg); switch (status) { case detail::AxVoice::CALLBACK_STATUS_FINISH_WAVE: case detail::AxVoice::CALLBACK_STATUS_INVALIDATE_WAVE: { diff --git a/libs/NW4R/src/snd/snd_WsdPlayer.cpp b/libs/NW4R/src/snd/snd_WsdPlayer.cpp index d22a67b1..9770ac14 100644 --- a/libs/NW4R/src/snd/snd_WsdPlayer.cpp +++ b/libs/NW4R/src/snd/snd_WsdPlayer.cpp @@ -250,7 +250,7 @@ namespace nw4r { } if (!mPauseFlag && !mSkipFlag) { if (mHomeButtonMenuFlag || !AxManager::GetInstance().IsHomeButtonMenu()) { - if (ParseNextTick(true) != 0) { + if (ParseNextTick(true)) { FinishPlayer(); return; } diff --git a/libs/NW4R/src/ut/ut_CharWriter.cpp b/libs/NW4R/src/ut/ut_CharWriter.cpp index 959850b7..0c4e81b5 100644 --- a/libs/NW4R/src/ut/ut_CharWriter.cpp +++ b/libs/NW4R/src/ut/ut_CharWriter.cpp @@ -109,7 +109,7 @@ namespace nw4r { } Color CharWriter::GetTextColor() const { - return *reinterpret_cast(&mTextColor); + return mTextColor.start; } void CharWriter::SetScale(f32 hScale, f32 vScale) { @@ -274,8 +274,8 @@ namespace nw4r { if (loadInfo != mLoadingTexture) { GXTexObj tobj; - GXInitTexObj(&tobj, glyph.pTexture, glyph.texWidth, glyph.texHeight, glyph.texFormat, GX_CLAMP, GX_CLAMP, 0); - GXInitTexObjLOD(&tobj, mFilter.atSmall, mFilter.atLarge, 0.0f, 0.0f, 0.0f, false, false, GX_ANISO_1); + GXInitTexObj(&tobj, glyph.pTexture, glyph.texWidth, glyph.texHeight, glyph.texFormat, GX_CLAMP, GX_CLAMP, GX_FALSE); + GXInitTexObjLOD(&tobj, mFilter.atSmall, mFilter.atLarge, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); GXLoadTexObj(&tobj, slot); mLoadingTexture = loadInfo; @@ -333,14 +333,14 @@ namespace nw4r { GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_ZERO); GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO); - GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); - GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO); GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO); - GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); - GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); SetupVertexFormat(); } @@ -354,8 +354,8 @@ namespace nw4r { GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC); GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_RASA, GX_CA_ZERO); - GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); - GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); SetupVertexFormat(); } diff --git a/libs/NW4R/src/ut/ut_ResFontBase.cpp b/libs/NW4R/src/ut/ut_ResFontBase.cpp index 23ed07cf..3d4ff8e7 100644 --- a/libs/NW4R/src/ut/ut_ResFontBase.cpp +++ b/libs/NW4R/src/ut/ut_ResFontBase.cpp @@ -200,10 +200,10 @@ namespace nw4r { glyph->pTexture = pSheet; glyph->widths = GetCharWidthsFromIndex(index); - glyph->height = static_cast(tg.cellHeight); + glyph->height = tg.cellHeight; glyph->texFormat = static_cast(tg.sheetFormat); - glyph->texWidth = static_cast(tg.sheetWidth); - glyph->texHeight = static_cast(tg.sheetHeight); + glyph->texWidth = tg.sheetWidth; + glyph->texHeight = tg.sheetHeight; glyph->cellX = cellPixelX + 1; glyph->cellY = cellPixelY + 1; } diff --git a/src/iplwww/www_arcreader.cpp b/src/iplwww/www_arcreader.cpp index 1b7f78d6..1e1643fe 100644 --- a/src/iplwww/www_arcreader.cpp +++ b/src/iplwww/www_arcreader.cpp @@ -77,7 +77,7 @@ namespace www { for (i = 0; i < ARRAY_LENGTH(mFlags); i++) { if (mFlags[i]) continue; - if (ARCInitHandle((void*)data, mHandles + i) != 0) { + if (ARCInitHandle((void*)data, mHandles + i)) { mFlags[i] = true; } break; diff --git a/src/iplwww/www_window.cpp b/src/iplwww/www_window.cpp index 47a07500..381bcdf5 100644 --- a/src/iplwww/www_window.cpp +++ b/src/iplwww/www_window.cpp @@ -70,7 +70,7 @@ namespace ext_ead { for (int j = 0; j < (int)ARRAY_LENGTH(mTexBufArr[0]); j++) { mTexDisplayRects[i][j] = rect; - u32 texBufSize = GXGetTexBufferSize(texW, texH, GX_TF_RGB565, 0, 0); + u32 texBufSize = GXGetTexBufferSize(texW, texH, GX_TF_RGB565, GX_FALSE, 0); mTexBufArr[i][j] = Heap::allocMem2(texBufSize, 32); memset(mTexBufArr[i][j], 0, texBufSize); diff --git a/src/keyboard/MyTiInputForm.cpp b/src/keyboard/MyTiInputForm.cpp index 371b7d0a..8a0fcaba 100644 --- a/src/keyboard/MyTiInputForm.cpp +++ b/src/keyboard/MyTiInputForm.cpp @@ -419,12 +419,12 @@ void InputForm::onArrowLTrig() { bool InputForm::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) { if (meEditMode == EM_Disp) { - if (hold & 0x400) return textinput::InputForm::updateInput(chan, 0.0f, 0.0f, 0, 0, 0, data); - if (trig & 8) mpScrollButton->changeAnimation(false, 4); - if (release & 8) mpScrollButton->changeAnimation(false, 3); - if (trig & 4) mpScrollButton->changeAnimation(true, 4); - if (release & 4) mpScrollButton->changeAnimation(true, 3); - if (hold & 8) { + if (hold & WPAD_BUTTON_B) return textinput::InputForm::updateInput(chan, 0.0f, 0.0f, 0, 0, 0, data); + if (trig & WPAD_BUTTON_UP) mpScrollButton->changeAnimation(false, 4); + if (release & WPAD_BUTTON_UP) mpScrollButton->changeAnimation(false, 3); + if (trig & WPAD_BUTTON_DOWN) mpScrollButton->changeAnimation(true, 4); + if (release & WPAD_BUTTON_DOWN) mpScrollButton->changeAnimation(true, 3); + if (hold & WPAD_BUTTON_UP) { if (getScrollMin() <= mfScroll) { setScroll(mfScroll - 3.5f); if (mfScroll <= getScrollMin()) setScroll(getScrollMin()); @@ -432,7 +432,7 @@ bool InputForm::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 rele } mpScrollButton->changeAnimation(false, 4); } else mpScrollButton->changeAnimation(false, 3); - if (hold & 4) { + if (hold & WPAD_BUTTON_DOWN) { if (getScrollMax() >= mfScroll) { setScroll(3.5f + mfScroll); if (mfScroll >= getScrollMax()) setScroll(getScrollMax()); @@ -492,7 +492,7 @@ static nw4r::math::VEC2 transformedOrigin(const nw4r::ut::Rect& rect, const Mtx& position.x = rect.left; position.y = rect.bottom; position.z = 0.0f; - PSMTXMultVec(matrix, reinterpret_cast(&position), reinterpret_cast(&position)); + PSMTXMultVec(matrix, position, position); return nw4r::math::VEC2(position.x, -position.y); } @@ -765,17 +765,17 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in inputform::EventHandler::onTiEvent(component, event, input); const char* name = component->getPane()->GetName(); if (name[0] == 'B') { - if (event == 4 && (input->trigger & 0x800)) { + if (event == gui::EventHandler::ON_TRIG && (input->trigger & WPAD_BUTTON_A)) { if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonTrig(); if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRTrig(); if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLTrig(); } - if (event == 0) { + if (event == gui::EventHandler::ON_POINT) { if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonPoint(); if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRPoint(); if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLPoint(); } - if (event == 1) { + if (event == gui::EventHandler::ON_LEFT) { if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonLeft(); if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRLeft(); if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLLeft(); diff --git a/src/keyboard/MyTiLetterForm.cpp b/src/keyboard/MyTiLetterForm.cpp index dba63b8e..77de9e5c 100644 --- a/src/keyboard/MyTiLetterForm.cpp +++ b/src/keyboard/MyTiLetterForm.cpp @@ -259,14 +259,14 @@ void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input nw4r::lyt::Pane* pane = paneComponent->getPane(); const char* paneName = pane->GetName(); if (paneName[0] == 'B') { - if (event == gui::GUIComponent::EVENT_TRIG && (input->trigger & 0x800) && + if (event == gui::GUIComponent::EVENT_TRIG && (input->trigger & WPAD_BUTTON_A) && util::strcmp("B_Pic", paneName)) { static_cast(mpMemoForm)->onPhotoTrig(); } - if (event == 0 && util::strcmp("B_Pic", paneName)) { + if (event == gui::EventHandler::ON_POINT && util::strcmp("B_Pic", paneName)) { static_cast(mpMemoForm)->onPhotoPoint(); } - if (event == 1 && util::strcmp("B_Pic", paneName)) { + if (event == gui::EventHandler::ON_LEFT && util::strcmp("B_Pic", paneName)) { static_cast(mpMemoForm)->onPhotoLeft(); } } diff --git a/src/keyboard/MyTiManager.cpp b/src/keyboard/MyTiManager.cpp index 933f5aec..28abd8b8 100644 --- a/src/keyboard/MyTiManager.cpp +++ b/src/keyboard/MyTiManager.cpp @@ -295,13 +295,13 @@ void Manager::changeState(StateTimeLine stateTimeLine) { void Manager::setState(StateType stateType) { switch (stateType) { case ST_Hidden: - getEventObserverForMemo()->onSE(static_cast(27)); + getEventObserverForMemo()->onSE(sound::SE_OPEN); mpCurrentState->end(); mpCurrentState = &sAppearMemoState; mpCurrentState->start(); break; case ST_Appearing: - getEventObserverForMemo()->onSE(static_cast(28)); + getEventObserverForMemo()->onSE(sound::SE_APPEARED); mpCurrentState->end(); mpCurrentState = &sEditMemoState; mpCurrentState->start(); @@ -312,7 +312,7 @@ void Manager::setState(StateType stateType) { mpCurrentState->start(); break; case ST_Disappearing: - getEventObserverForMemo()->onSE(static_cast(29)); + getEventObserverForMemo()->onSE(sound::SE_DISAPPEARD); mpCurrentState->end(); mpCurrentState = &sDispMemoState; mpCurrentState->start(); @@ -582,7 +582,7 @@ void Manager::configNormalBigTextWithoutLineFeedWithSign() { void Manager::configNormalWithoutLineFeedWithSign() { configDefault(); textinput::Manager::init(); - meConfigType = static_cast(10); + meConfigType = CT_NormalBigTextWithoutLineFeedWithSign; getCellPhoneKeyboardForMemo()->setLineFeedButton(false); getPCKeyboardForMemo()->setLineFeedButton(false); getCandidateBoxForMemo()->setActive(false); diff --git a/src/keyboard/tiCandidateBox.cpp b/src/keyboard/tiCandidateBox.cpp index b0b01f61..482db87f 100644 --- a/src/keyboard/tiCandidateBox.cpp +++ b/src/keyboard/tiCandidateBox.cpp @@ -331,10 +331,10 @@ namespace textinput { void Base::updateFromReceiver(u32 cmd, void* data) { // TODO - enum if ((int)cmd == 34) { - setInvalid(*reinterpret_cast(data)); + setInvalid(*static_cast(data)); } if ((int)cmd == 35) { - *reinterpret_cast(data) = isInvalid(); + *static_cast(data) = isInvalid(); } } @@ -1496,30 +1496,29 @@ namespace textinput { } else { ChangeBaseIdx_(mnBaseIdx + dat); } - UIObj::riseEvent(0x100, reinterpret_cast(0)); + UIObj::riseEvent(0x100, NULL); } } void UITextArea::onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input) { - // TODO event enum? - if (mgr()->isInScroll() && event != 1 && event != 0) { + if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) { return; } - if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == 1) { + if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) { if (!mgr()->isInvalid()) { switch (event) { - case 4: - if (input->trigger == 0x800) { + case gui::EventHandler::ON_TRIG: + if (input->trigger == WPAD_BUTTON_A) { s32 idx = GetSelectedPaneIdx(); if (mnFocusedIdx >= 0 && idx >= 0) { mpTextBoxPane[idx]->init(); mpBoundingPane[idx]->init(); mpTextAnmPane[idx]->onAnmEvent(nw4rmanager::AnmPane::PE_0); - riseEvent(0x101, reinterpret_cast(0)); + riseEvent(0x101, NULL); } } break; - case 0: + case gui::EventHandler::ON_POINT: if (&component == mpTextAreaPane) { mbOnTextArea = true; for (int i = 0; i < NUM_PANES; i++) { @@ -1539,7 +1538,7 @@ namespace textinput { } } break; - case 1: + case gui::EventHandler::ON_LEFT: if (&component == mpTextAreaPane) { mbOnTextArea = false; for (int i = 0; i < NUM_PANES; i++) { @@ -1621,8 +1620,8 @@ namespace textinput { } void UITextWindow::onChangeAnmState(AnmEvent anmEvent, nw4rmanager::AnmPane* anmPane, nw4rmanager::Anim* anim) { - if (anim->muID == 0 && anmEvent == E_1) { - riseEvent(0x400, reinterpret_cast(0)); + if (anim->muID == ANM_Normal && anmEvent == E_1) { + riseEvent(0x400, NULL); } } @@ -1653,15 +1652,14 @@ namespace textinput { } void UIButton::onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input) { - // TODO event enum? - if (mgr()->isInScroll() && event != 1 && event != 0) { + if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) { return; } - if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == 1) { + if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) { if (!mgr()->isInvalid()) { switch (event) { - case 4: - if (input->trigger == 0x800) { + case gui::EventHandler::ON_TRIG: + if (input->trigger == WPAD_BUTTON_A) { mpButtonAnmPane->onAnmEvent(nw4rmanager::AnmPane::PE_0); if (getID() == 1) { mgr()->onLeftPageScroll(); @@ -1670,8 +1668,8 @@ namespace textinput { } } break; - case 2: - if (input->hold == 0x800 && !(input->trigger & 0x800) && + case gui::EventHandler::ON_MOVE: + if (input->hold == WPAD_BUTTON_A && !(input->trigger & WPAD_BUTTON_A) && component.getFlightDuration(input->controller) % 20 != 0) { mpButtonAnmPane->onAnmEvent(nw4rmanager::AnmPane::PE_0); if (getID() == 1) { @@ -1681,10 +1679,10 @@ namespace textinput { } } break; - case 1: + case gui::EventHandler::ON_LEFT: mpButtonAnmPane->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; - case 0: + case gui::EventHandler::ON_POINT: mpButtonAnmPane->onAnmEvent(nw4rmanager::AnmPane::PE_1); riseEvent(0, reinterpret_cast(4)); break; @@ -1753,22 +1751,21 @@ namespace textinput { void UIOnOffButton::onChangeAnmState(AnmEvent anmEvent, nw4rmanager::AnmPane* anmPane, nw4rmanager::Anim* anim) { if (anmPane == mpOnAnmPane) { - if (anim->muID == 7 && anmEvent == E_1) { - riseEvent(0x301, reinterpret_cast(0)); + if (anim->muID == ANM_OnOffPushed && anmEvent == E_1) { + riseEvent(0x301, NULL); } } else if (anmPane == mpOffAnmPane) { - if (anim->muID == 7 && anmEvent == E_1) { - riseEvent(0x300, reinterpret_cast(0)); + if (anim->muID == ANM_OnOffPushed && anmEvent == E_1) { + riseEvent(0x300, NULL); } } } void UIOnOffButton::onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input) { - // TODO event enum? - if (mgr()->isInScroll() && event != 1 && event != 0) { + if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) { return; } - if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == 1) { + if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) { OnOffAnmPane* p; if (&component == mpOnBoundPane) { p = mpOnAnmPane; @@ -1776,15 +1773,15 @@ namespace textinput { p = mpOffAnmPane; } switch (event) { - case 4: - if (input->trigger & 0x800) { + case gui::EventHandler::ON_TRIG: + if (input->trigger & WPAD_BUTTON_A) { mgr()->onOnOffButton(true); } break; - case 1: + case gui::EventHandler::ON_LEFT: p->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; - case 0: + case gui::EventHandler::ON_POINT: p->onAnmEvent(nw4rmanager::AnmPane::PE_1); riseEvent(0, reinterpret_cast(4)); break; diff --git a/src/keyboard/tiCellPhone.cpp b/src/keyboard/tiCellPhone.cpp index fecbd39b..6a71ad74 100644 --- a/src/keyboard/tiCellPhone.cpp +++ b/src/keyboard/tiCellPhone.cpp @@ -111,33 +111,33 @@ namespace textinput { }; static const PaneNameToControlKey csPaneNameToControlKey[] = { - {"B_CPkey_LF", 0}, - {"B_CPkey_DELETE", 1}, - {"B_othersBT_JP", 9}, - {"B_ChngTag_00", 0x12}, - {"B_ChngTag_01", 0x13}, - {"B_ChngTag_02", 0x0B}, - {"B_ChngTag_03", 0x0D}, - {"B_othersBT_EU", 9}, - {"B_CPkey_Prdc_JP", 0x0A}, - {"B_prdcModeBT_EU", 0x0A}, - {"B_smlCptChngeBT", 0x17}, + {"B_CPkey_LF", VK_LINE_FEED}, + {"B_CPkey_DELETE", VK_DELETE}, + {"B_othersBT_JP", VK_SIGN_INPUT}, + {"B_ChngTag_00", VK_INPUT_MODE_00}, + {"B_ChngTag_01", VK_INPUT_MODE_01}, + {"B_ChngTag_02", VK_INPUT_MODE_02}, + {"B_ChngTag_03", VK_INPUT_MODE_03}, + {"B_othersBT_EU", VK_SIGN_INPUT}, + {"B_CPkey_Prdc_JP", VK_PREDICT_LANGUAGE}, + {"B_prdcModeBT_EU", VK_PREDICT_LANGUAGE}, + {"B_smlCptChngeBT", VK_TOGGLE_ABC_MODE}, {"B_spaceBT_JP", 2}, }; static const AnimationFileForControlKey csAninationFileForControlKey[] = { - {0, "fs_VK_cellPhone_a_normal.brlan"}, - {1, "fs_VK_cellPhone_a_Focus-IN.brlan"}, - {2, "fs_VK_cellPhone_a_Focus-OUT.brlan"}, - {4, "fs_VK_cellPhone_a_Pushed.brlan"}, - {3, "fs_VK_cellPhone_a_Roll_over.brlan"}, + {ANM_Normal, "fs_VK_cellPhone_a_normal.brlan"}, + {ANM_FocusIn, "fs_VK_cellPhone_a_Focus-IN.brlan"}, + {ANM_FocusOut, "fs_VK_cellPhone_a_Focus-OUT.brlan"}, + {ANM_Pushed, "fs_VK_cellPhone_a_Pushed.brlan"}, + {ANM_RollOver, "fs_VK_cellPhone_a_Roll_over.brlan"}, }; static const AnimationFileForControlKey csAnimationFileForToggleKey[] = { - {0, "fs_VK_cellPhone_a_normal.brlan"}, - {1, "fs_VK_cellPhone_a_Focus-IN.brlan"}, - {2, "fs_VK_cellPhone_a_Focus-OUT.brlan"}, - {4, "fs_VK_cellPhone_a_Pushed.brlan"}, + {ANM_Normal, "fs_VK_cellPhone_a_normal.brlan"}, + {ANM_FocusIn, "fs_VK_cellPhone_a_Focus-IN.brlan"}, + {ANM_FocusOut, "fs_VK_cellPhone_a_Focus-OUT.brlan"}, + {ANM_Pushed, "fs_VK_cellPhone_a_Pushed.brlan"}, {5, "fs_VK_cellPhone_a_toggle-ON.brlan"}, {6, "fs_VK_cellPhone_a_toggle-OFF.brlan"}, }; @@ -1339,8 +1339,8 @@ namespace textinput { if (animation) { switch (static_cast(event)) { case gui::EventHandler::ON_TRIG: - if ((input->trigger & 0x800) || - ((input->trigger & 0x400) && isNormalCellPhoneKey(paneName))) { + if ((input->trigger & WPAD_BUTTON_A) || + ((input->trigger & WPAD_BUTTON_B) && isNormalCellPhoneKey(paneName))) { if (animation->getKeyType() == KT_ControlButton) { nw4r::ut::List& panes = mpLayoutByNW4R->getAnmPaneList(); CellPhoneAnmPane* other = static_cast(nw4r::ut::List_GetNext(&panes, NULL)); @@ -1358,7 +1358,7 @@ namespace textinput { animation->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; case gui::EventHandler::ON_POINT: - mpEventObserver->onSE(static_cast(4)); + mpEventObserver->onSE(sound::SE_SELECT); mpLayoutByNW4R->setPaneLastDrawReceived(animation->getPane()); animation->onAnmEvent(nw4rmanager::AnmPane::PE_1); break; @@ -1373,10 +1373,10 @@ namespace textinput { u8 repeat; } keyEvent = {paneName, 0, 0}; if (event == gui::EventHandler::ON_TRIG) { - if (input->trigger & 0x800) { + if (input->trigger & WPAD_BUTTON_A) { keyEvent.state = 0; mpLayoutByNW4R->onKey(gui::EventHandler::ON_TRIG, &keyEvent); - } else if ((input->trigger & 0x400) && isNormalCellPhoneKey(paneName)) { + } else if ((input->trigger & WPAD_BUTTON_B) && isNormalCellPhoneKey(paneName)) { keyEvent.state = 1; mpLayoutByNW4R->onKey(gui::EventHandler::ON_TRIG, &keyEvent); paneComponent->setFlightDuration(input->controller, 0); @@ -1385,8 +1385,8 @@ namespace textinput { if (event == gui::EventHandler::ON_LEFT) { mpLayoutByNW4R->onKey(gui::EventHandler::ON_LEFT, &keyEvent); } - if (event == gui::EventHandler::ON_MOVE && (input->hold & 0x800) && - !(input->trigger & 0x800) && + if (event == gui::EventHandler::ON_MOVE && (input->hold & WPAD_BUTTON_A) && + !(input->trigger & WPAD_BUTTON_A) && (util::strcmp(csPaneNameNormalKey[13], paneName) || util::strcmp(csPaneNameNormalKey[16], paneName)) && paneComponent->isDragging(input->controller)) { u32 duration = mpLayoutByNW4R->getFlightDuration(input->controller, paneName); diff --git a/src/keyboard/tiDebug.cpp b/src/keyboard/tiDebug.cpp index ed16a2ec..4af9fc31 100644 --- a/src/keyboard/tiDebug.cpp +++ b/src/keyboard/tiDebug.cpp @@ -33,13 +33,13 @@ namespace textinput { GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); - GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetNumTexGens(0); GXSetNumTevStages(1); @@ -57,7 +57,7 @@ namespace textinput { MTXScale(mtxScale, scale, scale, scale); MTXTrans(mtx, centerX, centerY, z); MTXConcat(mtx, mtxScale, mtx); - GXLoadPosMtxImm(mtx, 0); + GXLoadPosMtxImm(mtx, GX_PNMTX0); draw_rect(iVertex(left - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), iVertex(right - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), @@ -74,13 +74,13 @@ namespace textinput { GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); - GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetNumTexGens(0); GXSetNumTevStages(1); @@ -92,7 +92,7 @@ namespace textinput { Mtx mtx; MTXTrans(mtx, 0.0f, 0.0f, 0.0f); - GXLoadPosMtxImm(mtx, 0); + GXLoadPosMtxImm(mtx, GX_PNMTX0); GXSetLineWidth(width, GX_TO_ZERO); diff --git a/src/keyboard/tiGUIManager.cpp b/src/keyboard/tiGUIManager.cpp index 92a73cba..9ee00c31 100644 --- a/src/keyboard/tiGUIManager.cpp +++ b/src/keyboard/tiGUIManager.cpp @@ -13,13 +13,13 @@ namespace textinput { GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); - GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetNumTexGens(0); GXSetNumTevStages(1); @@ -31,7 +31,7 @@ namespace textinput { Mtx mtx; MTXTrans(mtx, 0.0f, 0.0f, 0.0f); - GXLoadPosMtxImm(mtx, 0); + GXLoadPosMtxImm(mtx, GX_PNMTX0); GXSetLineWidth(width, GX_TO_ZERO); diff --git a/src/keyboard/tiInputForm.cpp b/src/keyboard/tiInputForm.cpp index 37633a30..10c7fde5 100644 --- a/src/keyboard/tiInputForm.cpp +++ b/src/keyboard/tiInputForm.cpp @@ -251,7 +251,7 @@ void Base::inputInputting_(wchar_t character) { current->setCandidate(character); } } - if (character != 0) onSE(static_cast(10)); + if (character != 0) onSE(sound::SE_CHAR_INPUT); meScrollFlag = SF_ScrollOn; } void Base::inputCharDefault_(wchar_t character, u32 modifiers) { @@ -279,8 +279,8 @@ void Base::inputCharDefault_(wchar_t character, u32 modifiers) { } } } else current->inputChar(character); - if (character == L' ') onSE(static_cast(9)); - else if (character != L'\n') onSE(static_cast(10)); + if (character == L' ') onSE(sound::SE_CHAR_DECIDE); + else if (character != L'\n') onSE(sound::SE_CHAR_INPUT); meScrollFlag = SF_ScrollOn; } @@ -615,7 +615,7 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { } if (mDKStream.lookAhead()) mDKStream.putChar(0xffff); else mDKStream.putChar(L' '); - if (mDKStream.isEmpty()) onSE(static_cast(10)); + if (mDKStream.isEmpty()) onSE(sound::SE_CHAR_INPUT); { tistring::WithAtok* unfix = mpUnfixString; if (getCurrentString(false) == unfix) unfix->isConverting(); @@ -665,7 +665,7 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { if (input->deadKey) character = DeadKeyStream::ToCombineClass(meLanguage, character); if (character == L' ' && mDKStream.lookAhead()) mDKStream.putChar(0xffff); else mDKStream.putChar(character); - if (mDKStream.isEmpty()) onSE(static_cast(10)); + if (mDKStream.isEmpty()) onSE(sound::SE_CHAR_INPUT); { tistring::WithAtok* unfix = mpUnfixString; if (getCurrentString(false) == unfix) unfix->isConverting(); @@ -698,8 +698,8 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { break; } case 1: - if (current->canBackSpace()) onSE(static_cast(7)); - else onSE(static_cast(8)); + if (current->canBackSpace()) onSE(sound::SE_CHAR_DELETE); + else onSE(sound::SE_CHAR_DELETE_ERROR); if (current == mpString) { resetInputRelation(); mpString->getCursorPos(); @@ -724,11 +724,11 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { break; case 2: if (current != fixed) { - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); return; } - if (!fixed->deleteForward()) onSE(static_cast(8)); - else onSE(static_cast(7)); + if (!fixed->deleteForward()) onSE(sound::SE_CHAR_DELETE_ERROR); + else onSE(sound::SE_CHAR_DELETE); break; case 7: if (current == fixed) { @@ -757,7 +757,7 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { bool atLimit = true; if (muLimitRowNum >= static_cast(getLine() + 1) && !mpManager->getCandidateBox()->isActive()) atLimit = false; if (allowed) { - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); mpString->getCursorPos(); mpString->inputChar(L'\n'); mpString->getCursorPos(); @@ -767,12 +767,12 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { } } else { if (atLimit) { - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); return; } else return; } } else if (current == mpZiString) { - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); if (getPredictMode() == PM_11 || getPredictMode() == PM_12) confirmInput_(); else if (!(mbCursorSelected | mbZuSelected) && mpManager->getToolBar()->isQwerty()) { if (mbPredictOn && mePredictMode != PM_Atok) { @@ -787,7 +787,7 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { } } else confirmInput_(); } else { - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); if (mpUnfixString->isConverting()) { mpUnfixString->commitPredicted(mpUnfixString->getSelectedConverting()); updateCandidateState_(); @@ -809,8 +809,8 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { if (!input->character) return; confirmInputting_(input->character, input->direct, input->letterMode, input->confirmOnly, input->holdingKey); if (!input->silent) { - if (input->confirmOnly) onSE(static_cast(9)); - else onSE(static_cast(10)); + if (input->confirmOnly) onSE(sound::SE_CHAR_DECIDE); + else onSE(sound::SE_CHAR_INPUT); } meScrollFlag = SF_ScrollOn; if (checkHeadOfSentence(true)) onCommand(static_cast(33), NULL); @@ -832,11 +832,11 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { nw4r::math::VEC2 origin = getGlobalLeftTopPos(); nw4r::math::VEC2* cursor = static_cast(data); current->setCursorPos(calcCursorPos(cursor->x - origin.x, cursor->y - origin.y)); - onSE(static_cast(5)); + onSE(sound::SE_CHAR_CURSOR); onCommand(static_cast(12), NULL); resetInputRelation(); } else { - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); onCommand(static_cast(6), NULL); } return; @@ -856,7 +856,7 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { nw4r::math::VEC2* cursor = static_cast(data); u32 position = calcCursorPos(cursor->x - origin.x, cursor->y - origin.y); current->setCursorPos(position); - if (previous != position) onSE(static_cast(5)); + if (previous != position) onSE(sound::SE_CHAR_CURSOR); meScrollFlag = SF_ScrollOn; } return; @@ -924,10 +924,10 @@ void Base::onCommand(INPUT_COMMAND command, void* data) { } meScrollFlag = SF_ScrollOn; return; - case 25: current->converDakuten(); onSE(static_cast(10)); break; - case 26: current->converHandaku(); onSE(static_cast(10)); break; + case 25: current->converDakuten(); onSE(sound::SE_CHAR_INPUT); break; + case 26: current->converHandaku(); onSE(sound::SE_CHAR_INPUT); break; case 27: current->convertAll(); break; - case 28: current->converSmall(); onSE(static_cast(10)); break; + case 28: current->converSmall(); onSE(sound::SE_CHAR_INPUT); break; case 29: { PredictionState* prediction = static_cast(data); mePredictMode = prediction->mode; @@ -1056,7 +1056,7 @@ void Base::onHKBCtrlCode(HVKCode code, u32 modifiers) { case 18: if (mePredictMode == PM_Atok) { if (mpManager->getPCKeyboard()->getTranslateMode() == keyboard::pctype::Base::TM_00 && !mbPredictOn) { - if (!mpManager->getPCKeyboard()->isQwertyOnly()) onSE(static_cast(6)); + if (!mpManager->getPCKeyboard()->isQwertyOnly()) onSE(sound::SE_CHAR_CURSOR_FIX); } else toggleAtokMode_(2); } break; @@ -1165,7 +1165,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) { mfFontHeight = textBox->GetFontSize().height; mRect = textBox->GetPaneRect(mDrawInfo); AdjustPaneMtx(mMtx.m, mDrawInfo, textBox->GetGlobalMtx()); - csCharColor = textBox->GetTextColor(0); + csCharColor = textBox->GetTextColor(nw4r::lyt::TEXTCOLOR_TOP); setVisible("N_2line", true); mpPaneManager->setAllComponentTriggerTarget(false); mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true); @@ -1202,8 +1202,8 @@ inline const nw4r::lyt::Pane* LayoutByNW4R::getLanguageTextPane() const { void LayoutByNW4R::init() { Base::init(); - searchAnmPane("P_txtScrll_UP")->changeAnimation(7); - searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7); + searchAnmPane("P_txtScrll_UP")->changeAnimation(ANM_Off); + searchAnmPane("P_txtScrll_DOWN")->changeAnimation(ANM_Off); mbUpVisible = false; mbDownVisible = false; mUpRepeat = 0; @@ -1303,7 +1303,7 @@ void LayoutByNW4R::onCommand(INPUT_COMMAND command, void* data) { mpString->getCursorPos(&start, &end); if (start >= limit && !mpString->isKanaFix()) { mpString->clearKana(); - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); } if (!mpString->isKanaFix()) limit = muLimitStringLength - 1; } @@ -1311,7 +1311,7 @@ void LayoutByNW4R::onCommand(INPUT_COMMAND command, void* data) { u32 start, end; mpString->getCursorPos(&start, &end); if (start > limit || end > limit) { - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); Base::onCommand(static_cast(36), &limit); } } @@ -1327,7 +1327,7 @@ void LayoutByNW4R::onCommand(INPUT_COMMAND command, void* data) { mpString->setLength(static_cast(trimLimit)); mpEventObserver->onOutOfLength(); if (command == 6 || command == 5 || command == 0 || command == 38 || command == 21 || command == 7) { - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); } } break; @@ -1339,7 +1339,7 @@ void LayoutByNW4R::onCommand(INPUT_COMMAND command, void* data) { if (mpString->getLength() > excessPos) mpString->getLength(); mpString->setLength(static_cast(excessPos)); mpEventObserver->onOutOfLength(); - onSE(static_cast(8)); + onSE(sound::SE_CHAR_DELETE_ERROR); Base::onCommand(static_cast(36), &rowLimit); if (meLanguage == KR && !mpString->isKanaFix()) { rowLimit = isOverRowLimit(muLimitRowNum, mpString->getWCString()); @@ -1359,7 +1359,7 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in cursor.y = -input->y; if (name[0] == 'B') { util::replaceChar(animationName, 17, name, 0, 'P'); - if (event == 4 && (input->trigger & 0x800) && !mpInputForm->isInScroll()) { + if (event == gui::EventHandler::ON_TRIG && (input->trigger & WPAD_BUTTON_A) && !mpInputForm->isInScroll()) { if (mpInputForm->isAbleToUp() && util::strcmp("P_txtScrll_UP", animationName)) { textdrawer::Base::CursorPos movement = {0, 0.0f, 0.0f}; movement.fCursorY = mpInputForm->getLineHeight(); @@ -1372,7 +1372,7 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in mpInputForm->searchAnmPane(animationName)->onAnmEvent(nw4rmanager::AnmPane::PE_0); } } - if (event == 2 && (input->hold & 0x800) && !(input->trigger & 0x800)) { + if (event == gui::EventHandler::ON_MOVE && (input->hold & WPAD_BUTTON_A) && !(input->trigger & WPAD_BUTTON_A)) { if (mpInputForm->isAbleToUp() && util::strcmp("P_txtScrll_UP", animationName)) { if (component->isDragging(input->controller)) { u32 duration = mpInputForm->getFlightDuration(input->controller, name); @@ -1398,10 +1398,10 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in AnmPane* animation = static_cast(mpInputForm->searchAnmPane(animationName)); if (animation) { switch (event) { - case 1: animation->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; - case 0: + case gui::EventHandler::ON_LEFT: animation->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; + case gui::EventHandler::ON_POINT: if (animation->getState() != ANM_Off) { - mpEventObserver->onSE(static_cast(4)); + mpEventObserver->onSE(sound::SE_SELECT); animation->onAnmEvent(nw4rmanager::AnmPane::PE_1); } break; @@ -1411,15 +1411,15 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in AnmPane* animation = static_cast(mpInputForm->searchAnmPane(name)); if (animation) { switch (event) { - case 0: + case gui::EventHandler::ON_POINT: if (animation->getState() != ANM_Off) { - mpEventObserver->onSE(static_cast(4)); + mpEventObserver->onSE(sound::SE_SELECT); animation->onAnmEvent(nw4rmanager::AnmPane::PE_1); } break; - case 1: + case gui::EventHandler::ON_LEFT: if (animation->getState() != ANM_Off) { - mpEventObserver->onSE(static_cast(4)); + mpEventObserver->onSE(sound::SE_SELECT); animation->onAnmEvent(nw4rmanager::AnmPane::PE_2); } break; @@ -1432,9 +1432,9 @@ void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* in if (layout.getPane(static_cast(form->mpLanguageData)->textBox)) textPane = static_cast(form->mpLanguageData)->textBox; else textPane = "T_2l_TextBox"; if (util::strcmp(name, textPane)) { - if (event == 4 && (input->trigger & 0x800)) mpInputForm->onCommand(static_cast(14), &cursor); - if (event == 5 && (input->release & 0x800)) mpInputForm->onCommand(static_cast(15), &cursor); - if (event == 2 && (input->hold & 0x800)) mpInputForm->onCommand(static_cast(16), &cursor); + if (event == gui::EventHandler::ON_TRIG && (input->trigger & WPAD_BUTTON_A)) mpInputForm->onCommand(static_cast(14), &cursor); + if (event == gui::EventHandler::ON_RELEASE && (input->release & WPAD_BUTTON_A)) mpInputForm->onCommand(static_cast(15), &cursor); + if (event == gui::EventHandler::ON_MOVE && (input->hold & WPAD_BUTTON_A)) mpInputForm->onCommand(static_cast(16), &cursor); } } } @@ -1534,12 +1534,12 @@ void Base::autoScroll() { if (cursorY < 0.0f) { s32 lines = s32(cursorY / getLineHeight() - 1.0f); mScrollAnm.startAnm(mfScrollY, mfScrollY - lines * getLineHeight(), 15.0f, NULL, NULL); - onSE(static_cast(11)); + onSE(sound::SE_LINE_SCROLL); } if (cursorY >= (mRect.top - mRect.bottom) * getScale().y) { s32 lines = s32((cursorY - (mRect.top - mRect.bottom) * getScale().y) / getLineHeight()) + 1; mScrollAnm.startAnm(mfScrollY, mfScrollY - lines * getLineHeight(), 15.0f, NULL, NULL); - onSE(static_cast(11)); + onSE(sound::SE_LINE_SCROLL); } meScrollFlag = SF_NoScroll; } @@ -1704,7 +1704,7 @@ void Base::updateCandidateState_() { mpString->confirm(confirmed); mpString->getCursorPos(); mpUnfixString->enableConfirmedString(false); - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); } bool suppress = false; CommandReceiver::onCommand(static_cast(35), &suppress); @@ -1733,8 +1733,8 @@ void Base::moveCursorUp() { if (-(mfCursorY - mfScrollY) >= 0.0f) { u32 start, end; mpString->getCursorPos(&start, &end); - if (start == 0 && end == 0) onSE(static_cast(6)); - else onSE(static_cast(5)); + if (start == 0 && end == 0) onSE(sound::SE_CHAR_CURSOR_FIX); + else onSE(sound::SE_CHAR_CURSOR); mpString->setCursorPos(0); } else { y = mfCursorY >= 0.0f ? mfCursorY : 0.0f; @@ -1742,7 +1742,7 @@ void Base::moveCursorUp() { f32 targetY = 1.0f + (y - lineHeight); u32 position = calcCursorPos(mfCursorX, targetY); mpString->setCursorPos(position); - onSE(static_cast(5)); + onSE(sound::SE_CHAR_CURSOR); } meScrollFlag = SF_ScrollOn; } @@ -1751,14 +1751,14 @@ void Base::moveCursorDown() { if (-(mfCursorY - mfScrollY) < mfMinScrollY) { u32 start, end; mpString->getCursorPos(&start, &end); - if (start == mpString->getLength() && end == mpString->getLength()) onSE(static_cast(6)); - else onSE(static_cast(5)); + if (start == mpString->getLength() && end == mpString->getLength()) onSE(sound::SE_CHAR_CURSOR_FIX); + else onSE(sound::SE_CHAR_CURSOR); mpString->setCursorPos(mpString->getLength()); } else { f32 lineHeight = getLineHeight(); f32 y = mfCursorY + lineHeight; mpString->setCursorPos(calcCursorPos(mfCursorX, 1.0f + y)); - onSE(static_cast(5)); + onSE(sound::SE_CHAR_CURSOR); } meScrollFlag = SF_ScrollOn; } @@ -1813,7 +1813,7 @@ void Base::confirmInputting_(wchar_t character, bool direct, u16 letterMode, boo onCommand(static_cast(6), NULL); mpZiString->changeLetterMode(static_cast(letterMode)); mpZiString->inputChar(character); - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); updateCandidateState_(); return; } @@ -1851,7 +1851,7 @@ void Base::confirmInputting_(wchar_t character, bool direct, u16 letterMode, boo } } } - onSE(static_cast(10)); + onSE(sound::SE_CHAR_INPUT); } } @@ -1884,7 +1884,7 @@ void Base::inputCharZi_(wchar_t character, u32 modifiers) { mpZiString->update(); } } - onSE(static_cast(9)); + onSE(sound::SE_CHAR_DECIDE); } else { u16 letterMode; switch (modifiers & 3) { @@ -1993,7 +1993,7 @@ void Base::onSpaceKeyHWKB(u32 modifiers) { mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); } } - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); } } else { @@ -2048,7 +2048,7 @@ void Base::onPressUp() { moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); } - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } } else if (mpUnfixString->getInputStringLength()) { mpUnfixString->startConverting(); @@ -2099,7 +2099,7 @@ void Base::onPressDown() { moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); } - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } } else if (mpUnfixString->getInputStringLength()) { mpUnfixString->startConverting(); @@ -2179,7 +2179,7 @@ void Base::onPressDownHWKB() { moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); } - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } } } else { @@ -2224,8 +2224,8 @@ void Base::onPressLeftHWKB() { mpManager->getHWKeyboard()->resetQuoteState(); mpUnfixString->resetRelation(); updateCandidateState_(); - if (current->moveCursorLeft()) onSE(static_cast(5)); - else onSE(static_cast(6)); + if (current->moveCursorLeft()) onSE(sound::SE_CHAR_CURSOR); + else onSE(sound::SE_CHAR_CURSOR_FIX); } else if (current == mpUnfixString) { if (mpManager->getCandidateBox()->isInScroll()) return; if (mpUnfixString->getCurrentNumPredicted() <= 0) return; @@ -2238,7 +2238,7 @@ void Base::onPressLeftHWKB() { else if (selected < 0) selected = static_cast(mpUnfixString->getCurrentNumPredicted() - 1); moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } else if (current == mpZiString) { if (mpManager->getCandidateBox()->isInScroll()) return; bool selectedAlready = mbZuSelected; @@ -2249,7 +2249,7 @@ void Base::onPressLeftHWKB() { if (selected < 0) selected = mpZiString->getCurrentNumPredicted() - 1; moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } meScrollFlag = SF_ScrollOn; } @@ -2281,21 +2281,21 @@ void Base::onPressRightHWKB() { mpManager->getHWKeyboard()->resetQuoteState(); mpUnfixString->resetRelation(); updateCandidateState_(); - if (current->moveCursorRight()) onSE(static_cast(6)); - else onSE(static_cast(5)); + if (current->moveCursorRight()) onSE(sound::SE_CHAR_CURSOR_FIX); + else onSE(sound::SE_CHAR_CURSOR); } else if (current == mpUnfixString) { if (mpManager->getCandidateBox()->isInScroll()) return; if (mpUnfixString->getCurrentNumPredicted() <= 0) return; if (mpUnfixString->isConverting()) { current->moveCursorRight(); - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); updateCandidateState_(); } else { s32 selected = static_cast(mpUnfixString->getSelectedCandidate() + 1); if (selected >= mpUnfixString->getCurrentNumPredicted()) selected = 0; moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } } else if (current == mpZiString) { if (mpManager->getCandidateBox()->isInScroll()) return; @@ -2308,7 +2308,7 @@ void Base::onPressRightHWKB() { if (selected < 0) selected = 0; moveCandidateToIdx(selected); mpManager->getCandidateBox()->getTextArea().ScrollToSelectedText(); - onSE(static_cast(6)); + onSE(sound::SE_CHAR_CURSOR_FIX); } meScrollFlag = SF_ScrollOn; } @@ -2339,8 +2339,8 @@ void Base::onPressLeft() { resetInputRelation(); if (mpUnfixString->getCandidate() == L' ') return; } - if (current->moveCursorLeft()) onSE(static_cast(5)); - else onSE(static_cast(6)); + if (current->moveCursorLeft()) onSE(sound::SE_CHAR_CURSOR); + else onSE(sound::SE_CHAR_CURSOR_FIX); if (current == mpUnfixString) updateCandidateState_(); meScrollFlag = SF_ScrollOn; } @@ -2374,10 +2374,10 @@ void Base::onPressRight() { if (current->moveCursorRight() && mbRightWithSpace) { CharacterInput space = {L' ', 0, false, false, 0}; onCommand(static_cast(0), &space); - onSE(static_cast(5)); + onSE(sound::SE_CHAR_CURSOR); } - if (current == mpZiString || current == mpUnfixString) onSE(static_cast(6)); - else onSE(static_cast(5)); + if (current == mpZiString || current == mpUnfixString) onSE(sound::SE_CHAR_CURSOR_FIX); + else onSE(sound::SE_CHAR_CURSOR); if (current == mpUnfixString) updateCandidateState_(); meScrollFlag = SF_ScrollOn; } @@ -2728,42 +2728,42 @@ EditBuffer::~EditBuffer() { } void LayoutByNW4R::updateInputCommon(int chan, u32 trig, u32 hold, u32 release, void* data) { updateRepeatInput(trig, hold); - if (mRepeatButtons & 0x1000) onCommand(static_cast(1), NULL); + if (mRepeatButtons & WPAD_BUTTON_MINUS) onCommand(static_cast(1), NULL); } void LayoutByNW4R::updateRepeatInput(u32 trig, u32 hold) { mRepeatButtons = trig; - if (hold & 1) { + if (hold & WPAD_BUTTON_LEFT) { if (--mLeftRepeat == 0) { - mRepeatButtons |= 1; + mRepeatButtons |= WPAD_BUTTON_LEFT; mLeftRepeat = 9; } } else mLeftRepeat = 30; - if (hold & 2) { + if (hold & WPAD_BUTTON_RIGHT) { if (--mRightRepeat == 0) { trig = mRepeatButtons; mRightRepeat = 9; - mRepeatButtons = trig | 2; + mRepeatButtons = trig | WPAD_BUTTON_RIGHT; } } else mRightRepeat = 30; - if (hold & 8) { + if (hold & WPAD_BUTTON_UP) { if (--mUpRepeat == 0) { trig = mRepeatButtons; mUpRepeat = 9; - mRepeatButtons = trig | 8; + mRepeatButtons = trig | WPAD_BUTTON_UP; } } else mUpRepeat = 30; - if (hold & 4) { + if (hold & WPAD_BUTTON_DOWN) { if (--mDownRepeat == 0) { trig = mRepeatButtons; mDownRepeat = 9; - mRepeatButtons = trig | 4; + mRepeatButtons = trig | WPAD_BUTTON_DOWN; } } else mDownRepeat = 30; - if (hold & 0x1000) { + if (hold & WPAD_BUTTON_MINUS) { if (--mDeleteRepeat == 0) { trig = mRepeatButtons; mDeleteRepeat = 9; - mRepeatButtons = trig | 0x1000; + mRepeatButtons = trig | WPAD_BUTTON_MINUS; } } else mDeleteRepeat = 30; } @@ -3370,7 +3370,7 @@ void Base::doScroll(Scroll* scroll) { mfScrollX += scroll->x; mScrollAnm.startAnm(mfScrollY, mfScrollY + scroll->y, 15.0f, NULL, NULL); } - onSE(static_cast(11)); + onSE(sound::SE_LINE_SCROLL); } void Base::doBeforeDrawProcess(const wchar_t* string, u32 position, const DrawInfo& info) { @@ -3544,15 +3544,15 @@ bool LayoutByNW4R::isAbleToDown() { bool LayoutByNW4R::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) { u32 buttons = mRepeatButtons; - if (buttons & 1) onCommand(static_cast(8), NULL); - if (buttons & 2) onCommand(static_cast(9), NULL); - if (buttons & 8) onCommand(static_cast(10), NULL); - if (buttons & 4) onCommand(static_cast(11), NULL); + if (buttons & WPAD_BUTTON_LEFT) onCommand(static_cast(8), NULL); + if (buttons & WPAD_BUTTON_RIGHT) onCommand(static_cast(9), NULL); + if (buttons & WPAD_BUTTON_UP) onCommand(static_cast(10), NULL); + if (buttons & WPAD_BUTTON_DOWN) onCommand(static_cast(11), NULL); bool handled = nw4rmanager::Layout::updateInput(chan, x, y, trig, hold, release, data); - if ((release & 0x800) && mpString->isOnSustain()) { + if ((release & WPAD_BUTTON_A) && mpString->isOnSustain()) { onCommand(static_cast(13), NULL); } - if (!handled && (hold & 0x800) && mpString->isOnSustain()) { + if (!handled && (hold & WPAD_BUTTON_A) && mpString->isOnSustain()) { nw4r::math::VEC2 point; point.x = x; point.y = y; diff --git a/src/keyboard/tiKeyboard.cpp b/src/keyboard/tiKeyboard.cpp index cab1016f..8d0d204f 100644 --- a/src/keyboard/tiKeyboard.cpp +++ b/src/keyboard/tiKeyboard.cpp @@ -105,13 +105,13 @@ void Manager::create(MEMAllocator*) { mpPredictLanguageDialog->create(mpAllocator); mpSignWindow = static_cast(createSignWindow()); mpSignWindow->create(mpAllocator); - if (SCGetAspectRatio() == 1) { setLayoutScaleFor16x9(); mbAspectRatio4x3 = false; } + if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { setLayoutScaleFor16x9(); mbAspectRatio4x3 = false; } else { setLayoutScaleFor4x3(); mbAspectRatio4x3 = true; } init(); } void Manager::initAspect() { - if (SCGetAspectRatio() == 1) { setLayoutScaleFor16x9(); mbAspectRatio4x3 = false; } + if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { setLayoutScaleFor16x9(); mbAspectRatio4x3 = false; } else { setLayoutScaleFor4x3(); mbAspectRatio4x3 = true; } } diff --git a/src/keyboard/tiPcKeyboard.cpp b/src/keyboard/tiPcKeyboard.cpp index 6bcb7a31..715bb56f 100644 --- a/src/keyboard/tiPcKeyboard.cpp +++ b/src/keyboard/tiPcKeyboard.cpp @@ -2138,7 +2138,7 @@ namespace textinput { mKeyState.abcFlags = ((mKeyState.abcFlags ^ 64) & 64) | (mKeyState.abcFlags & ~64); mKeyState.refresh_(); mCapsButton.SetState((mKeyState.abcFlags >> 6) & 1, 11); - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); } inline void UIModifierButton::SetState(bool enabled, u32 inactiveAnimation) { @@ -2160,7 +2160,7 @@ namespace textinput { } mShiftButton.SetState(true, 5); if (sound) - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); } void LayoutByNW4R::onReleasedShift() { @@ -2204,7 +2204,7 @@ namespace textinput { mCapsButton.mpAnimation->onAnmEvent(static_cast(10)); else mCapsButton.mpAnimation->onAnmEvent(static_cast(11)); - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); break; } @@ -2227,33 +2227,33 @@ namespace textinput { mShiftButton.mpAnimation->onAnmEvent(static_cast(10)); else mShiftButton.mpAnimation->onAnmEvent(static_cast(11)); - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); break; } case 0: - mpEventObserver->onSE(static_cast(9)); + mpEventObserver->onSE(sound::SE_CHAR_DECIDE); break; case 11: if (!isABC()) { - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); searchAnmPane("W_JP_Chng_KANA")->changeAnimation(6); } break; case 12: if (isABC()) { - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); searchAnmPane("W_JP_Chng_ABC")->changeAnimation(6); } break; case 18: if ((mKeyState.aiuFlags & 15) == 1) { - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); searchAnmPane("P_katakana")->changeAnimation(6); } break; case 19: if ((mKeyState.aiuFlags & 15) == 0) { - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); searchAnmPane("P_hiragana")->changeAnimation(6); } break; @@ -2527,7 +2527,7 @@ namespace textinput { u32 oldMode = mKeyState.abcFlags & 15; Base::setTranslateMode(mode); if (oldMode != (mKeyState.abcFlags & 15)) { - mpEventObserver->onSE(static_cast(13)); + mpEventObserver->onSE(sound::SE_KETAI_MODE_SWITCHING); switch (static_cast(oldMode)) { case 0: searchAnmPane("P_Mode_direct")->changeAnimation(6); @@ -2561,7 +2561,7 @@ namespace textinput { bool handled = nw4rmanager::Layout::updateInput(chan, x, y, trig, hold, release, data); LayoutGather& gather = LayoutGather::Singleton::getInstance(); bool wasShift = gather.isHoldingShift(); - if (!(!(hold & 0x400))) { + if (hold & WPAD_BUTTON_B) { gather.setPressedShiftB(true); input::HKBManager::getInstance().SetForceModifierState(2, 2); if (!wasShift) { @@ -2740,34 +2740,34 @@ namespace textinput { } nw4rmanager::AnmPane* animation = mpKeyboard->searchAnmPane(animationName); switch (static_cast(event)) { - case 4: - if (input->trigger & 0x800) { + case gui::EventHandler::ON_TRIG: + if (input->trigger & WPAD_BUTTON_A) { if (animation != NULL) animation->onAnmEvent(nw4rmanager::AnmPane::PE_0); - mpKeyboard->onKey(4, animationName); + mpKeyboard->onKey(gui::EventHandler::ON_TRIG, animationName); } break; - case 1: + case gui::EventHandler::ON_LEFT: if (animation != NULL) animation->onAnmEvent(nw4rmanager::AnmPane::PE_2); - mpKeyboard->onKey(1, animationName); + mpKeyboard->onKey(gui::EventHandler::ON_LEFT, animationName); break; - case 0: + case gui::EventHandler::ON_POINT: if (animation != NULL) { - mpEventObserver->onSE(static_cast(4)); + mpEventObserver->onSE(sound::SE_SELECT); mpKeyboard->setPaneLastDrawReceived(animation->getPane()); animation->onAnmEvent(nw4rmanager::AnmPane::PE_1); } break; } - if (event == 2 && (input->hold & 0x800) && !(input->trigger & 0x800) && + if (event == gui::EventHandler::ON_MOVE && (input->hold & WPAD_BUTTON_A) && !(input->trigger & WPAD_BUTTON_A) && (util::strcmp("P_key_DELETE", animationName) || util::strcmp("P_Gkey_DELETE", animationName) || util::strcmp("P_key_SPACE", animationName) || util::strcmp("P_Gkey_SPACE", animationName)) && component->isDragging(input->controller)) { u32 frames = mpKeyboard->getFlightDuration(input->controller, name); if (frames >= 30 && frames % 9 == 0) { animation->onAnmEvent(nw4rmanager::AnmPane::PE_0); - mpKeyboard->onKey(4, animationName); + mpKeyboard->onKey(gui::EventHandler::ON_TRIG, animationName); } } } @@ -3143,16 +3143,16 @@ namespace textinput { if (mId == 1) name = "P_key_SHIFT"; switch (static_cast(event)) { - case 4: - if (input->trigger & 0x800) - mpLayout->onKey(4, const_cast(name)); + case gui::EventHandler::ON_TRIG: + if (input->trigger & WPAD_BUTTON_A) + mpLayout->onKey(gui::EventHandler::ON_TRIG, const_cast(name)); break; - case 1: + case gui::EventHandler::ON_LEFT: mpAnimation->onAnmEvent(AnmPane::PE_2); - mpLayout->onKey(1, const_cast(name)); + mpLayout->onKey(gui::EventHandler::ON_LEFT, const_cast(name)); break; - case 0: + case gui::EventHandler::ON_POINT: if (mpListener != NULL) mpListener->onEvent(this, 0, reinterpret_cast(4)); mpLayout->setPaneLastDrawReceived(mpAnimation->getPane()); diff --git a/src/keyboard/tiSignWindow.cpp b/src/keyboard/tiSignWindow.cpp index d6ce2fed..6360c0d5 100644 --- a/src/keyboard/tiSignWindow.cpp +++ b/src/keyboard/tiSignWindow.cpp @@ -484,9 +484,9 @@ bool LayoutByNW4R::updateInput(input::HKBManager& manager) { void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) { s32 eventType = event; const char* name = paneComponent->getPane()->GetName(); - if (!mpLayoutByNW4R->isLocked() || event != 4) { - if (event == 4 && (input->trigger & 0x800) != 0) { - mpLayoutByNW4R->onKey(4, const_cast(name)); + if (!mpLayoutByNW4R->isLocked() || event != gui::EventHandler::ON_TRIG) { + if (event == gui::EventHandler::ON_TRIG && (input->trigger & WPAD_BUTTON_A) != 0) { + mpLayoutByNW4R->onKey(gui::EventHandler::ON_TRIG, const_cast(name)); } if (name[0] == 'B') { char paneName[24]; @@ -496,15 +496,15 @@ void EventHandler::onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input AnmPane* pane = static_cast(mpLayoutByNW4R->searchAnmPane(paneName)); if (pane != NULL) { switch (eventType) { - case 4: - if ((input->trigger & 0x800) != 0) { + case gui::EventHandler::ON_TRIG: + if ((input->trigger & WPAD_BUTTON_A) != 0) { pane->onAnmEvent(nw4rmanager::AnmPane::PE_0); } break; - case 1: + case gui::EventHandler::ON_LEFT: pane->onAnmEvent(nw4rmanager::AnmPane::PE_2); break; - case 0: + case gui::EventHandler::ON_POINT: mpEventObserver->onSE(sound::SE_SELECT); mpLayoutByNW4R->setPaneLastDrawReceived(pane->getPane()); pane->onAnmEvent(nw4rmanager::AnmPane::PE_1); diff --git a/src/keyboard/tiTextDrawer.cpp b/src/keyboard/tiTextDrawer.cpp index 12004e01..c0e39b63 100644 --- a/src/keyboard/tiTextDrawer.cpp +++ b/src/keyboard/tiTextDrawer.cpp @@ -293,7 +293,7 @@ namespace textinput { } GXSetScissor(x, y, viewportWidth, viewportHeight); PSMTXIdentity(matrix); - GXLoadPosMtxImm(matrix, 0); + GXLoadPosMtxImm(matrix, GX_PNMTX0); mfMinScrollY = GetCursorY(); muLine = 0; } diff --git a/src/layout/GUIManager.cpp b/src/layout/GUIManager.cpp index 422b3951..b119542f 100644 --- a/src/layout/GUIManager.cpp +++ b/src/layout/GUIManager.cpp @@ -8,13 +8,13 @@ void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); - GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetNumTexGens(0); GXSetNumTevStages(1); @@ -26,7 +26,7 @@ void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) Mtx mtx; MTXTrans(mtx, 0.0f, 0.0f, 0.0f); - GXLoadPosMtxImm(mtx, 0); + GXLoadPosMtxImm(mtx, GX_PNMTX0); GXSetLineWidth(width, GX_TO_ZERO); diff --git a/src/layout/iplLayout.cpp b/src/layout/iplLayout.cpp index f22edc4d..03851ea8 100644 --- a/src/layout/iplLayout.cpp +++ b/src/layout/iplLayout.cpp @@ -29,10 +29,10 @@ namespace ipl { utility::FrameController::init(anmType, maxFrame, 0.0f); - if (bRecursive != FALSE) { + if (bRecursive) { mFlags |= (1 << FLAG_RECURSIVE); } - if (bUnused != FALSE) { + if (bUnused) { mFlags |= (1 << FLAG_UNUSED); } } diff --git a/src/sound/iplSound.cpp b/src/sound/iplSound.cpp index 45cf3169..ddbdf726 100644 --- a/src/sound/iplSound.cpp +++ b/src/sound/iplSound.cpp @@ -138,18 +138,18 @@ namespace ipl { } block = FIsSEActive(sndName); - if (block != NULL && block->handle.GetId() == 0x39) { + if (block != NULL && block->handle.GetId() == WIPL_SE_GRAY_BUTTON) { goto return_block; } if (block == NULL) { goto continue_block; } - if (block->handle.GetId() != 0x35) { + if (block->handle.GetId() != WIPL_SE_ERROR) { goto continue_block; } return_block: - return reinterpret_cast(block); + return &block->handle; continue_block: if (block == NULL) { @@ -163,7 +163,7 @@ namespace ipl { EGG::ArcPlayer::startSound(&block->handle, sndName); block->name = sndName; block->id = block->handle.GetId(); - return reinterpret_cast(block); + return &block->handle; } int System::startSEIndex(u32 sndIndex) { @@ -174,13 +174,13 @@ namespace ipl { } block = FIsSEActive(sndIndex); - if (block != NULL && block->handle.GetId() == 0x39) { + if (block != NULL && block->handle.GetId() == WIPL_SE_GRAY_BUTTON) { goto return_block_index; } if (block == NULL) { goto continue_block_index; } - if (block->handle.GetId() != 0x35) { + if (block->handle.GetId() != WIPL_SE_ERROR) { goto continue_block_index; } diff --git a/src/utility/iplFrameController.cpp b/src/utility/iplFrameController.cpp index b8dde4ae..3bc3ae55 100644 --- a/src/utility/iplFrameController.cpp +++ b/src/utility/iplFrameController.cpp @@ -60,7 +60,7 @@ namespace ipl { // Animate and alternate direction; Once reaching the maximum frame, it then animates forwards. // And once reaching the minimum frame, it animates backwards. Then repeat. case ANIM_TYPE_ALTERNATE: { - if (mbAlternateBack == false) { + if (!mbAlternateBack) { if ((mFrame += speed) >= mMaxFrame) { mFrame = mMaxFrame; mbAlternateBack = true; diff --git a/src/utility/iplGraphics.cpp b/src/utility/iplGraphics.cpp index a7056733..c03482ae 100644 --- a/src/utility/iplGraphics.cpp +++ b/src/utility/iplGraphics.cpp @@ -76,7 +76,7 @@ namespace ipl { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GXSetNumChans(1); @@ -91,7 +91,7 @@ namespace ipl { GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); - GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_CLAMP, GX_AF_NONE); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE); GXSetColorUpdate(GX_TRUE); GXSetAlphaUpdate(GX_TRUE); @@ -168,8 +168,8 @@ namespace ipl { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U8, 0); GXSetNumChans(0); GXSetNumTexGens(1); @@ -183,7 +183,7 @@ namespace ipl { GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); - GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE, 0x7D); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY); GXSetColorUpdate(GX_TRUE); GXSetAlphaUpdate(GX_TRUE); diff --git a/src/utility/iplJpegDecoder.cpp b/src/utility/iplJpegDecoder.cpp index 5bff5c46..049cbd66 100644 --- a/src/utility/iplJpegDecoder.cpp +++ b/src/utility/iplJpegDecoder.cpp @@ -125,7 +125,7 @@ namespace ipl { GXSetProjection(projMtx, GX_ORTHOGRAPHIC); Graphics::calcOrthoCamera(); - Graphics::setCamera(0); + Graphics::setCamera(GX_PNMTX0); GXTexObj texObj; GXInitTexObj(&texObj, mpTextureBuffer, mTMCState.jpegWidth, mTMCState.jpegHeight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); @@ -135,7 +135,7 @@ namespace ipl { GXColor col = {255, 255, 255, 255}; nw4r::ut::Rect destRect(0.0f, 0.0f, mCaptureWidth, mCaptureHeight); - int orient = (int)mOrientation + col.a - col.a; + int orient = (int)mOrientation; switch (orient) { case 1: { diff --git a/src/utility/iplThread.cpp b/src/utility/iplThread.cpp index 5b17094e..a2253251 100644 --- a/src/utility/iplThread.cpp +++ b/src/utility/iplThread.cpp @@ -5,7 +5,7 @@ namespace ipl { void* ut_thread::ThreadMain_(void* param) { OSInitFastCast(); - ut_thread* thread = reinterpret_cast(param); + ut_thread* thread = static_cast(param); return thread->Run(); } diff --git a/src/utility/iplUtility.cpp b/src/utility/iplUtility.cpp index b7cbd15b..3f20211f 100644 --- a/src/utility/iplUtility.cpp +++ b/src/utility/iplUtility.cpp @@ -720,7 +720,7 @@ namespace ipl { u32 mask = 0; u32 info[1]; for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { - if (WPADProbe(i, info) == 0 && info[0] != 0xFD) { + if (WPADProbe(i, info) == WPAD_ERR_OK && info[0] != WPAD_DEV_NOT_FOUND) { mask |= 1 << i; } } diff --git a/tools/decomp-assist/rx34.cleanup.md b/tools/decomp-assist/rx34.cleanup.md new file mode 100644 index 00000000..02d6a133 --- /dev/null +++ b/tools/decomp-assist/rx34.cleanup.md @@ -0,0 +1,352 @@ +# rx34 expression cleanup + +Baseline: `38ade13d6fb4320b5779d1e6df4b9250a018b7d8`, branch `agent/w1005/rx34`. +The initial full 4.3U build passed with DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. + +The expression-cleanup task requires unchanged output, so existing unmatched functions stay at their baseline scores. No matching or linking changes are attempted. The matching-round requirement to increase exact counts does not apply to this round. + +All 139 permitted source files were inventoried. Before edits, their source and complete object files were copied to `/tmp/rx34`, along with the live report and hashes of all 1,027 compiled objects. Each trial rebuilds only its object and compares the complete ELF file with that baseline. A changed object or compile error causes immediate source restoration and another rebuild. + +Scope excludes `src/channelScript/systemmenu` and all nine files assigned to other workers. No shared header, configuration, symbol map, or gate code is edited. + +## Trials + +Trial counts are replacement sites; a replacement spanning two arguments counts once here. Final category totals count each changed argument separately. KEEP means complete object identity, including code, data, relocations, symbols, and section layout. Every REVERT trial below compiled but changed object bytes, so its source was restored. Final pool, report, full-build, and gate results follow this table. + +| Trial | File | Category | Change | Count | Result | +| --- | --- | --- | --- | --- | --- | +| 1 | `libs/NW4R/src/lyt/lyt_common.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 2 | KEEP | +| 2 | `libs/NW4R/src/lyt/lyt_material.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 2 | KEEP | +| 3 | `libs/NW4R/src/lyt/lyt_pane.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 2 | KEEP | +| 4 | `libs/NW4R/src/ut/ut_CharWriter.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 8 | KEEP | +| 5 | `src/iplwww/www_window.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 1 | KEEP | +| 6 | `src/keyboard/tiDebug.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 6 | KEEP | +| 7 | `src/keyboard/tiGUIManager.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 3 | KEEP | +| 8 | `src/keyboard/tiKeyboard.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 2 | KEEP | +| 9 | `src/keyboard/tiTextDrawer.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 1 | KEEP | +| 10 | `src/layout/GUIManager.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 3 | KEEP | +| 11 | `src/utility/iplGraphics.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 5 | KEEP | +| 12 | `src/utility/iplJpegDecoder.cpp` | constants | Use SDK names for graphics attributes, flags, matrix IDs, or aspect ratio | 1 | KEEP | +| 13 | `libs/NW4R/src/db/db_exception.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 2 | KEEP | +| 14 | `libs/NW4R/src/snd/snd_SoundThread.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 1 | KEEP | +| 15 | `libs/NW4R/src/snd/snd_TaskThread.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 1 | KEEP | +| 16 | `src/keyboard/MyTiInputForm.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 8 | KEEP | +| 17 | `src/keyboard/MyTiLetterForm.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 1 | KEEP | +| 18 | `src/keyboard/tiCandidateBox.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 5 | KEEP | +| 19 | `src/keyboard/tiCellPhone.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 6 | KEEP | +| 20 | `src/keyboard/tiInputForm.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 19 | KEEP | +| 21 | `src/keyboard/tiPcKeyboard.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 5 | KEEP | +| 22 | `src/keyboard/tiSignWindow.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 2 | KEEP | +| 23 | `src/utility/iplUtility.cpp` | constants | Use named WPAD buttons, probe results, or blocking message flags | 2 | KEEP | +| 24 | `src/sound/iplSound.cpp` | constants | Name the error and gray-button sound IDs | 4 | KEEP | +| 25 | `src/sound/iplSound.cpp` | members | Return the named sound handle member | 2 | KEEP | +| 26 | `libs/NW4R/src/ut/ut_CharWriter.cpp` | members | Read the first text color through its named member | 1 | KEEP | +| 27 | `libs/NW4R/src/ut/ut_ResFontBase.cpp` | casts | Remove casts of glyph fields to their declared types | 3 | KEEP | +| 28 | `libs/NW4R/src/snd/snd_StrmChannel.cpp` | casts | Read the u8 allocation flag without a u8 cast | 1 | REVERT | +| 29 | `libs/NW4R/src/snd/snd_SoundArchivePlayer.cpp` | casts | Remove the u32 cast around a u32 RoundUp result | 1 | REVERT | +| 30 | `libs/NW4R/src/snd/snd_StrmPlayer.cpp` | casts | Use static_cast for a void callback context | 1 | KEEP | +| 31 | `libs/NW4R/src/snd/snd_WavePlayer.cpp` | casts | Use static_cast for a void callback context | 1 | KEEP | +| 32 | `src/utility/iplThread.cpp` | casts | Use static_cast for a void thread argument | 1 | KEEP | +| 33 | `src/keyboard/tiCandidateBox.cpp` | casts | Use static_cast for void command data | 2 | KEEP | +| 34 | `src/keyboard/tiCandidateBox.cpp` | casts | Use NULL for null event data | 5 | KEEP | +| 35 | `src/layout/iplLayout.cpp` | control | Test bool constructor arguments directly | 2 | KEEP | +| 36 | `src/keyboard/tiKeyboard.cpp` | control | Test the bool aspect ratio argument directly | 1 | REVERT | +| 37 | `src/keyboard/tiPcKeyboard.cpp` | control | Remove double negation from the B-button test | 1 | KEEP | +| 38 | `src/keyboard/tiGUIManager.cpp` | control | Negate the pressed-button result directly | 1 | REVERT | +| 39 | `src/iplwww/www_arcreader.cpp` | control | Test the ARCInitHandle BOOL result directly | 1 | KEEP | +| 40 | `src/utility/iplMessageBase.cpp` | control | Return OSSendMessage BOOL without normalization | 1 | REVERT | +| 41 | `src/utility/iplMessageBase.cpp` | control | Return OSJamMessage BOOL without normalization | 1 | REVERT | +| 42 | `src/utility/iplMessageBase.cpp` | control | Return OSReceiveMessage BOOL without normalization | 1 | REVERT | +| 43 | `src/iplwww/www_message.cpp` | control | Return OSSendMessage BOOL without normalization | 1 | REVERT | +| 44 | `src/iplwww/www_message.cpp` | control | Return OSJamMessage BOOL without normalization | 1 | REVERT | +| 45 | `src/iplwww/www_message.cpp` | control | Return OSReceiveMessage BOOL without normalization | 1 | REVERT | +| 46 | `src/keyboard/tiCellPhone.cpp` | constants | Name virtual keys in the control-pane table | 11 | KEEP | +| 47 | `src/keyboard/tiCellPhone.cpp` | constants | Name the common animation IDs in resource tables | 9 | KEEP | +| 48 | `src/keyboard/tiInputForm.cpp` | constants | Name scroll-button off animation and top text color | 3 | KEEP | +| 49 | `libs/NW4R/src/snd/snd_BankFile.cpp` | casts | Use the already typed index-table region pointer | 1 | KEEP | +| 50 | `libs/NW4R/src/snd/snd_NandSoundArchive.cpp` | casts | Convert the info chunk offset without pointer aliasing | 1 | REVERT | +| 51 | `libs/NW4R/src/snd/snd_NandSoundArchive.cpp` | casts | Convert the label chunk offset without pointer aliasing | 1 | REVERT | +| 52 | `libs/NW4R/src/snd/snd_WavePlayer.cpp` | control | Negate the bool start flag directly | 1 | KEEP | +| 53 | `libs/NW4R/src/snd/snd_WsdPlayer.cpp` | control | Test the ParseNextTick BOOL directly | 1 | KEEP | +| 54 | `src/utility/iplFrameController.cpp` | control | Negate the bool alternate-direction flag directly | 1 | KEEP | +| 55 | `src/keyboard/tiKeyboard.cpp` | control | Test the bool aspect-ratio field directly | 1 | REVERT | +| 56 | `src/keyboard/tiInputForm.cpp` | control | Use the prediction enabled bool without normalization | 1 | REVERT | +| 57 | `libs/NW4R/src/snd/snd_BasicSound.cpp` | control | Compare bool pause state without normalization | 1 | REVERT | +| 58 | `libs/NW4R/src/snd/snd_BasicSound.cpp` | control | Return the bool pause flag directly | 1 | REVERT | +| 59 | `libs/NW4R/src/snd/snd_BasicSound.cpp` | control | Pass the bool pause flag directly | 1 | REVERT | +| 60 | `src/keyboard/tiPcKeyboard.cpp` | control | Negate a bool visibility result directly | 1 | REVERT | +| 61 | `src/keyboard/tiPcKeyboard.cpp` | control | Invert the branch with a redundant bool self-assignment | 1 | REVERT | +| 62 | `libs/NW4R/src/lyt/lyt_textBox.cpp` | control | Express the nested color clamp as early returns | 1 | REVERT | +| 63 | `src/keyboard/MyTiInputForm.cpp` | constants | Name GUI event comparisons in onTiEvent | 3 | KEEP | +| 64 | `src/keyboard/MyTiLetterForm.cpp` | constants | Name GUI event comparisons in onTiEvent | 2 | KEEP | +| 65 | `src/keyboard/tiInputForm.cpp` | constants | Name GUI event comparisons in onTiEvent | 5 | KEEP | +| 66 | `src/keyboard/tiPcKeyboard.cpp` | constants | Name GUI event comparisons in onTiEvent | 1 | KEEP | +| 67 | `src/keyboard/tiSignWindow.cpp` | constants | Name GUI event comparisons in onTiEvent | 2 | KEEP | +| 68 | `libs/NW4R/src/snd/snd_AxVoice.cpp` | control | Return the predicate without an if/else wrapper | 1 | REVERT | +| 69 | `src/keyboard/tiGUIManager.cpp` | control | Return the predicate without an if/else wrapper | 1 | REVERT | +| 70 | `src/keyboard/tiUtil.cpp` | control | Return the predicate without an if/else wrapper | 1 | REVERT | +| 71 | `src/layout/GUIManager.cpp` | control | Return the predicate without an if/else wrapper | 1 | REVERT | +| 72 | `src/keyboard/MyTiInputForm.cpp` | casts | Use VEC3 conversions instead of explicit Vec pointer casts | 2 | KEEP | +| 73 | `src/keyboard/tiCandidateBox.cpp` | members | Base::updateCandidate: iterate through typed candidate rows | 4 | REVERT | +| 74 | `src/keyboard/tiCandidateBox.cpp` | members | LayoutByNW4R::updateCandidate: iterate through typed candidate rows | 4 | REVERT | +| 75 | `src/keyboard/MyTiManager.cpp` | constants | Use existing descriptive keyboard sound IDs | 3 | KEEP | +| 76 | `src/keyboard/tiCellPhone.cpp` | constants | Use existing descriptive keyboard sound IDs | 1 | KEEP | +| 77 | `src/keyboard/tiInputForm.cpp` | constants | Use existing descriptive keyboard sound IDs | 61 | KEEP | +| 78 | `src/keyboard/tiPcKeyboard.cpp` | constants | Use existing descriptive keyboard sound IDs | 11 | KEEP | +| 79 | `libs/NW4R/src/snd/snd_TaskThread.cpp` | constants | Use the declared message queue capacity | 1 | KEEP | +| 80 | `libs/NW4R/src/snd/snd_StrmChannel.cpp` | constants | Use the declared bits per allocation flag | 1 | KEEP | +| 81 | `libs/NW4R/src/snd/snd_AxVoice.cpp` | constants | Name the low-pass filter enabled state | 1 | KEEP | +| 82 | `src/keyboard/MyTiManager.cpp` | constants | Use the existing configuration enum member | 1 | KEEP | +| 83 | `libs/NW4R/src/db/db_exception.cpp` | constants | Name exception, detached-thread, and FPSCR flag values | 16 | KEEP | +| 84 | `libs/NW4R/src/snd/snd_RemoteSpeaker.cpp` | constants | Name the encoder flag that uses previous sample state | 3 | KEEP | +| 85 | `src/sound/iplSound.cpp` | control | Negate the bool banner validation result directly | 1 | REVERT | +| 86 | `src/utility/iplJpegDecoder.cpp` | control | Remove canceling alpha terms from the orientation expression | 1 | KEEP | +| 87 | `libs/NW4R/src/snd/snd_AxVoice.cpp` | constants | Use the named low-pass state when enabling the filter | 1 | KEEP | +| 88 | `src/keyboard/tiCandidateBox.cpp` | constants | Name GUI switch labels and forwarded events | 6 | KEEP | +| 89 | `src/keyboard/tiCandidateBox.cpp` | constants | Name GUI switch labels and forwarded events | 7 | KEEP | +| 90 | `src/keyboard/tiCandidateBox.cpp` | constants | Name GUI switch labels and forwarded events | 6 | KEEP | +| 91 | `src/keyboard/tiInputForm.cpp` | constants | Name GUI switch labels and forwarded events | 4 | KEEP | +| 92 | `src/keyboard/tiPcKeyboard.cpp` | constants | Name GUI switch labels and forwarded events | 7 | KEEP | +| 93 | `src/keyboard/tiPcKeyboard.cpp` | constants | Name GUI switch labels and forwarded events | 5 | KEEP | +| 94 | `src/keyboard/tiSignWindow.cpp` | constants | Name GUI switch labels and forwarded events | 4 | KEEP | +| 95 | `src/keyboard/tiCandidateBox.cpp` | constants | Name normal and on/off-pushed animation completion IDs | 3 | KEEP | +| 96 | `src/keyboard/tiInputForm.cpp` | constants | Name the repeated direction-button masks | 4 | KEEP | + +Source review: restored the outer `case 0` in `tiPcKeyboard::EventHandler::onTiEvent`; that switch tests `util::strcmp`, not a GUI event. The event-switch trial remains in the history above; subtract one constant replacement from the retained total. Rebuilt object remains byte-identical. + +## Retained cleanup + +37 source files; 302 changed subexpressions: 275 named constants, 16 cast cleanups, 8 condition/expression simplifications, and 3 named-member accesses. The trial table contains 69 retained batches and 27 restored batches. The final constant count adds the second argument changed in trials 4 and 11 and excludes the unrelated switch label restored after trial 92. + +The named constants come from existing SDK and class headers: graphics attributes/matrices/flags, WPAD buttons and probe codes, GUI events, animation states, keyboard keys and sounds, OS queue/thread/exception flags, FPSCR flags, and audio constants. The orientation cleanup removes the canceling `+ col.a - col.a` terms. Member access replaces the sound-handle and text-color layout casts. + +All 139 permitted files were surveyed. Existing casts, comparisons, raw candidate-row pointers, and control flow whose trials changed bytes remain as they were. The two candidate-row rewrites were restored; neither introduced a retained struct layout assumption. Remaining unnamed numeric values without a proven descriptive constant were left alone. + +## Validation + +- Final non-quick `gate.py` invocation used all 37 units listed below and `--base 38ade13d6fb4320b5779d1e6df4b9250a018b7d8`. It deleted and rebuilt `build/43U`, then printed `GATE PASS`. +- All 1,027 rebuilt source objects have the same complete ELF SHA256 as the initial baseline; no other translation unit changed. Per-file hashes for the 37 edited units are below. +- A fresh `objdiff-cli report generate -p . -o /tmp/rx34/final-report.json -f json` produced a JSON document identical to `/tmp/rx34/baseline-report.json`, including every unit, function, section, and global measure. +- `pool_diff.py` against retail objects passed for all 37 edited units. Their extracted strings and offsets also equal the saved pre-edit source objects. +- Full 4.3U DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`. +- Gate regressions: 0. Added forbidden patterns: 0. Added readability warnings: 0. `git diff --check` passed. +- Only permitted `.cpp` files and this log changed. No shared headers, configuration, symbol maps, assembly files, or other workers' files changed. + +| Measure in edited units | Before | After | +| --- | ---: | ---: | +| Instruction-exact functions | 1544/1549 | 1544/1549 | +| Objdiff 100% functions | 1545/1549 | 1545/1549 | +| Matched code bytes | 279672/284672 | 279672/284672 | +| Matched data bytes | 105788/105788 | 105788/105788 | + +Representative exact-name instruction checks: + +```text +libs/NW4R/src/ut/ut_CharWriter: GetTextColor__Q34nw4r2ut10CharWriterCFv +src 0x24 base 0x24 insns 9/9 +diffs 0: [] +src/utility/iplJpegDecoder: makeRawData__Q33ipl7utility11JpegDecoderFv +src 0x24c base 0x24c insns 147/147 +diffs 0: [] +src/sound/iplSound: startSE__Q33ipl3snd6SystemFPCc +src 0xf0 base 0xf0 insns 60/60 +diffs 0: [] +src/utility/iplThread: ThreadMain___Q33ipl7utility9ut_threadFPv +src 0x48 base 0x48 insns 18/18 +diffs 0: [] +``` + +## Changed files + +Hashes are SHA256 of the complete baseline and final object; both are identical. C = constants, X = casts, E = conditions/expressions, M = member accesses. + +| File | C | X | E | M | Object SHA256 before = after | +| --- | ---: | ---: | ---: | ---: | --- | +| `libs/NW4R/src/db/db_exception.cpp` | 18 | 0 | 0 | 0 | `57f06833a0dd1a257c6c50778b450a3b301d3cb6b9e1ba63ec59e65cae3588ec` | +| `libs/NW4R/src/lyt/lyt_common.cpp` | 2 | 0 | 0 | 0 | `a1734ddfb776843776f9a505320fd23b2f561ead3502546c2204ccc4dff301e6` | +| `libs/NW4R/src/lyt/lyt_material.cpp` | 2 | 0 | 0 | 0 | `a73905f7c8d067cc580b0c3a9e4b4fefd2042ce65d4feded123bfe6c39230c8f` | +| `libs/NW4R/src/lyt/lyt_pane.cpp` | 2 | 0 | 0 | 0 | `cb58aceee09d62be8527ab7b0853b082368fda3e2f762fa483eea36c15144614` | +| `libs/NW4R/src/snd/snd_AxVoice.cpp` | 2 | 0 | 0 | 0 | `7327b399e3caf40f0448b8cace18287458b4d7342e3350ff920c1d557955bf3f` | +| `libs/NW4R/src/snd/snd_BankFile.cpp` | 0 | 1 | 0 | 0 | `dcab2ff9361e8e9bcc091bafd8864fb594292c233c316fb3b946d83541ba277a` | +| `libs/NW4R/src/snd/snd_RemoteSpeaker.cpp` | 3 | 0 | 0 | 0 | `46d19533250295f787cac4cd232ac7c701c46e562fe00accbdfbd567d2c37bd8` | +| `libs/NW4R/src/snd/snd_SoundThread.cpp` | 1 | 0 | 0 | 0 | `baf081ffd42fa745d4873b989cd48b336b55e28315512d5008bb536c7e18474f` | +| `libs/NW4R/src/snd/snd_StrmChannel.cpp` | 1 | 0 | 0 | 0 | `2e0081497f226c9324d23d21b444034fc859e3a384d7b99f9825d8edd119718c` | +| `libs/NW4R/src/snd/snd_StrmPlayer.cpp` | 0 | 1 | 0 | 0 | `16b73b1175fd2449aabdf234bab964bdefecd9945f826314492d1a1eda7f3ccf` | +| `libs/NW4R/src/snd/snd_TaskThread.cpp` | 2 | 0 | 0 | 0 | `77cedb5ef5cc9e706ee6e98f4dab9e012fd035fd13f8ae0cf5a9be3ab68b016d` | +| `libs/NW4R/src/snd/snd_WavePlayer.cpp` | 0 | 1 | 1 | 0 | `db116bd2e765dce9ddf3af6e0ea368bb320e4a9cc5c7d64432cd3dea08f6b33e` | +| `libs/NW4R/src/snd/snd_WsdPlayer.cpp` | 0 | 0 | 1 | 0 | `12c26a8076537d036894634ecfd6928d0f92aac3b28d181dbff81f29e07994dc` | +| `libs/NW4R/src/ut/ut_CharWriter.cpp` | 9 | 0 | 0 | 1 | `2b27e2efb93b6b1b8e7351aa7c42f174e40f7059213a5b597578882bbeb80122` | +| `libs/NW4R/src/ut/ut_ResFontBase.cpp` | 0 | 3 | 0 | 0 | `a3204d9858b73f831cedb1136f962ee6abf649c1649c9a733b2075b3029cc8bf` | +| `src/iplwww/www_arcreader.cpp` | 0 | 0 | 1 | 0 | `777daf840ab75994761150a3faf476bf574a870562ddded138a15ff50e908545` | +| `src/iplwww/www_window.cpp` | 1 | 0 | 0 | 0 | `2d8db99f61601b701d8310a4c648a81d734dacd10a6da4650f58b06e18c484c2` | +| `src/keyboard/MyTiInputForm.cpp` | 11 | 2 | 0 | 0 | `2ebf6558cfb482d9453dbf6b861c59b785dcad68d436126200b445e707fa960f` | +| `src/keyboard/MyTiLetterForm.cpp` | 3 | 0 | 0 | 0 | `916d565bfbf3eb381a21beeac77b7508734141a32007ac8357b2d814c088b29a` | +| `src/keyboard/MyTiManager.cpp` | 4 | 0 | 0 | 0 | `17255c58a0e1310b209d090ba2b431988df0df7bdd89ff58dc6066d1448da74d` | +| `src/keyboard/tiCandidateBox.cpp` | 27 | 7 | 0 | 0 | `b3a52f551c2ac0f28f5580a332789e837446b5bd139512989bd2e020f09c85e4` | +| `src/keyboard/tiCellPhone.cpp` | 27 | 0 | 0 | 0 | `7d36e88e8927f58b3bff156ffa6d5f9b0f096ce90ed0017a682ecdfc86e3cc9a` | +| `src/keyboard/tiDebug.cpp` | 6 | 0 | 0 | 0 | `2eee04a0cc66dcccdf3670c08a50fec3a8d3490eee6e8fc47a6274fdfc61c4d6` | +| `src/keyboard/tiGUIManager.cpp` | 3 | 0 | 0 | 0 | `6c7120d70d75ed3f03a5bbbee56c0b0de882455830f25e88b5dd5266e3f53df7` | +| `src/keyboard/tiInputForm.cpp` | 96 | 0 | 0 | 0 | `47d380602ce3b965f2df3c5c946d36a0a0b56860cade9746ff7f5c51267ad8c3` | +| `src/keyboard/tiKeyboard.cpp` | 2 | 0 | 0 | 0 | `2fd827d028e91eff0b700f29ea554b79091612ca3528f3c578796a1977fbaa5d` | +| `src/keyboard/tiPcKeyboard.cpp` | 28 | 0 | 1 | 0 | `bebf956d5e9fa2a21b8121e967bceda0a50fc7ce17a6c214cc52321d57e65e6a` | +| `src/keyboard/tiSignWindow.cpp` | 8 | 0 | 0 | 0 | `2db302ebed7612e2a2e982e4dbf9ad2978a82a4a75c332d622437b098f9d74ac` | +| `src/keyboard/tiTextDrawer.cpp` | 1 | 0 | 0 | 0 | `caab2fc8157c3695bd60b5c03240ae3d030ad2f701b0926e92afcac3c9c26067` | +| `src/layout/GUIManager.cpp` | 3 | 0 | 0 | 0 | `7393ef94444ca2e8714be9e98be12e035aa037af0819cf7fc13e88cad9b23342` | +| `src/layout/iplLayout.cpp` | 0 | 0 | 2 | 0 | `4aebae393e3f38af2a94e9447051ffc2a1b6623a89d43888ad587e37babc2b2e` | +| `src/sound/iplSound.cpp` | 4 | 0 | 0 | 2 | `7f2599fb558201a60bde02e0b819979bac32b64aad4a7c7268f65112176020f6` | +| `src/utility/iplFrameController.cpp` | 0 | 0 | 1 | 0 | `a93dbe6b620b0b74a765d23138880800c7563442122f0819423ddae13b4fe89f` | +| `src/utility/iplGraphics.cpp` | 6 | 0 | 0 | 0 | `288b95c81daa3b049d6d740c73dd7129ffb0b225a28bc0c09b938397d59e1c23` | +| `src/utility/iplJpegDecoder.cpp` | 1 | 0 | 1 | 0 | `9e27a5fb4e2210c12d6a2af68ea96159c86253b004c55483ef1353540600155b` | +| `src/utility/iplThread.cpp` | 0 | 1 | 0 | 0 | `c995a1c039a1834650310ef2fbf2a234fa5789fc04a8971344e55b391c2b47cd` | +| `src/utility/iplUtility.cpp` | 2 | 0 | 0 | 0 | `006badb24cd3adfa72be43e836b0c82b4102fdfb0221b68f918e60031e3c21a2` | + +## Existing differences + +These functions were already below 100% before cleanup. Their complete source objects and function measurements are unchanged. Matching them was outside this expression-cleanup round. + +| Function | Objdiff before = after | Existing instruction evidence | +| --- | ---: | --- | +| `textinput::inputform::Base::calcCursorPos(float, float)` | 93.05215% | 326/326 instructions, 43 differences including floating-point register allocation. | +| `textinput::inputform::LayoutByNW4R::create(MEMAllocator*, textinput::inputform::EditBuffer*)` | 96.40169% | 356/356 instructions, 153 differences including saved-register allocation. | +| `textinput::candidatebox::LayoutByNW4R::create(MEMAllocator*)` | 95.99148% | 356/352 instructions; stack frame 0x30/0x20. | +| `textinput::candidatebox::LayoutByNW4R::createAnmPane_(MEMAllocator*)` | 98.49537% | 216/216 instructions, 64 differences including saved-register allocation. | + +The fifth gap in the instruction-exact count is the pre-existing retail symbol `__dt__Q33ipl3snd6UnkClsFv` in `src/sound/iplSound`. Objdiff reports 100%, but the gate cannot find that exact name in the source object; `ctxdiff.py` raises `KeyError` for it. This cleanup did not rename, delete, add, or alter that symbol. The report and full source object are unchanged. + +No unresolved uncertainty affects the retained edits. The remaining load-bearing expressions and pre-existing matcher differences are listed above. + +## Final full-gate unit output + +Copied verbatim from `/tmp/rx34/full-gate.txt`; section and baseline detail are omitted here. + +```text +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[libs/NW4R/src/db/db_exception] pool: IDENTICAL +[libs/NW4R/src/db/db_exception] objdiff: code 3708/3708 data 18808/18808 functions 10/10 fuzzy 100.0000 linked code 3708 +[libs/NW4R/src/db/db_exception] instruction-exact functions: 10/10 +[libs/NW4R/src/lyt/lyt_common] pool: IDENTICAL +[libs/NW4R/src/lyt/lyt_common] objdiff: code 3324/3324 data 56/56 functions 17/17 fuzzy 100.0000 linked code 3324 +[libs/NW4R/src/lyt/lyt_common] instruction-exact functions: 17/17 +[libs/NW4R/src/lyt/lyt_material] pool: IDENTICAL +[libs/NW4R/src/lyt/lyt_material] objdiff: code 13704/13704 data 144/144 functions 27/27 fuzzy 100.0000 linked code 13704 +[libs/NW4R/src/lyt/lyt_material] instruction-exact functions: 27/27 +[libs/NW4R/src/lyt/lyt_pane] pool: IDENTICAL +[libs/NW4R/src/lyt/lyt_pane] objdiff: code 4660/4660 data 220/220 functions 34/34 fuzzy 100.0000 linked code 4660 +[libs/NW4R/src/lyt/lyt_pane] instruction-exact functions: 34/34 +[libs/NW4R/src/snd/snd_AxVoice] pool: IDENTICAL +[libs/NW4R/src/snd/snd_AxVoice] objdiff: code 13568/13568 data 104/104 functions 52/52 fuzzy 100.0000 linked code 13568 +[libs/NW4R/src/snd/snd_AxVoice] instruction-exact functions: 52/52 +[libs/NW4R/src/snd/snd_BankFile] pool: IDENTICAL +[libs/NW4R/src/snd/snd_BankFile] objdiff: code 1032/1032 data 8/8 functions 4/4 fuzzy 100.0000 linked code 1032 +[libs/NW4R/src/snd/snd_BankFile] instruction-exact functions: 4/4 +[libs/NW4R/src/snd/snd_RemoteSpeaker] pool: IDENTICAL +[libs/NW4R/src/snd/snd_RemoteSpeaker] objdiff: code 1156/1156 data None/None functions 5/5 fuzzy 100.0000 linked code 1156 +[libs/NW4R/src/snd/snd_RemoteSpeaker] instruction-exact functions: 5/5 +[libs/NW4R/src/snd/snd_SoundThread] pool: IDENTICAL +[libs/NW4R/src/snd/snd_SoundThread] objdiff: code 1016/1016 data 9136/9136 functions 6/6 fuzzy 100.0000 linked code 1016 +[libs/NW4R/src/snd/snd_SoundThread] instruction-exact functions: 6/6 +[libs/NW4R/src/snd/snd_StrmChannel] pool: IDENTICAL +[libs/NW4R/src/snd/snd_StrmChannel] objdiff: code 544/544 data None/None functions 4/4 fuzzy 100.0000 linked code 544 +[libs/NW4R/src/snd/snd_StrmChannel] instruction-exact functions: 4/4 +[libs/NW4R/src/snd/snd_StrmPlayer] pool: IDENTICAL +[libs/NW4R/src/snd/snd_StrmPlayer] objdiff: code 7916/7916 data 16628/16628 functions 60/60 fuzzy 100.0000 linked code 7916 +[libs/NW4R/src/snd/snd_StrmPlayer] instruction-exact functions: 60/60 +[libs/NW4R/src/snd/snd_TaskThread] pool: IDENTICAL +[libs/NW4R/src/snd/snd_TaskThread] objdiff: code 372/372 data 9072/9072 functions 4/4 fuzzy 100.0000 linked code 372 +[libs/NW4R/src/snd/snd_TaskThread] instruction-exact functions: 4/4 +[libs/NW4R/src/snd/snd_WavePlayer] pool: IDENTICAL +[libs/NW4R/src/snd/snd_WavePlayer] objdiff: code 3552/3552 data 76/76 functions 19/19 fuzzy 100.0000 linked code 3552 +[libs/NW4R/src/snd/snd_WavePlayer] instruction-exact functions: 19/19 +[libs/NW4R/src/snd/snd_WsdPlayer] pool: IDENTICAL +[libs/NW4R/src/snd/snd_WsdPlayer] objdiff: code 2944/2944 data 220/220 functions 48/48 fuzzy 100.0000 linked code 2944 +[libs/NW4R/src/snd/snd_WsdPlayer] instruction-exact functions: 48/48 +[libs/NW4R/src/ut/ut_CharWriter] pool: IDENTICAL +[libs/NW4R/src/ut/ut_CharWriter] objdiff: code 6984/6984 data 72/72 functions 33/33 fuzzy 100.0000 linked code 6984 +[libs/NW4R/src/ut/ut_CharWriter] instruction-exact functions: 33/33 +[libs/NW4R/src/ut/ut_ResFontBase] pool: IDENTICAL +[libs/NW4R/src/ut/ut_ResFontBase] objdiff: code 1708/1708 data 104/104 functions 26/26 fuzzy 100.0000 linked code 1708 +[libs/NW4R/src/ut/ut_ResFontBase] instruction-exact functions: 26/26 +[src/iplwww/www_arcreader] pool: IDENTICAL +[src/iplwww/www_arcreader] objdiff: code 952/952 data 152/152 functions 5/5 fuzzy 100.0000 linked code 952 +[src/iplwww/www_arcreader] instruction-exact functions: 5/5 +[src/iplwww/www_window] pool: IDENTICAL +[src/iplwww/www_window] objdiff: code 3392/3392 data 1264/1264 functions 18/18 fuzzy 100.0000 linked code 3392 +[src/iplwww/www_window] instruction-exact functions: 18/18 +[src/keyboard/MyTiInputForm] pool: IDENTICAL +[src/keyboard/MyTiInputForm] objdiff: code 14532/14532 data 3032/3032 functions 84/84 fuzzy 100.0000 linked code 14532 +[src/keyboard/MyTiInputForm] instruction-exact functions: 84/84 +[src/keyboard/MyTiLetterForm] pool: IDENTICAL +[src/keyboard/MyTiLetterForm] objdiff: code 3496/3496 data 2032/2032 functions 26/26 fuzzy 100.0000 linked code 3496 +[src/keyboard/MyTiLetterForm] instruction-exact functions: 26/26 +[src/keyboard/MyTiManager] pool: IDENTICAL +[src/keyboard/MyTiManager] objdiff: code 20196/20196 data 1132/1132 functions 91/91 fuzzy 100.0000 linked code 20196 +[src/keyboard/MyTiManager] instruction-exact functions: 91/91 +[src/keyboard/tiCandidateBox] pool: IDENTICAL +[src/keyboard/tiCandidateBox] objdiff: code 21728/24000 data 4652/4652 functions 110/112 fuzzy 99.7107 linked code 0 +[src/keyboard/tiCandidateBox] instruction-exact functions: 110/112 +[src/keyboard/tiCellPhone] pool: IDENTICAL +[src/keyboard/tiCellPhone] objdiff: code 19028/19028 data 3860/3860 functions 86/86 fuzzy 100.0000 linked code 19028 +[src/keyboard/tiCellPhone] instruction-exact functions: 86/86 +[src/keyboard/tiDebug] pool: IDENTICAL +[src/keyboard/tiDebug] objdiff: code 1556/1556 data 24/24 functions 2/2 fuzzy 100.0000 linked code 1556 +[src/keyboard/tiDebug] instruction-exact functions: 2/2 +[src/keyboard/tiGUIManager] pool: IDENTICAL +[src/keyboard/tiGUIManager] objdiff: code 5916/5916 data 392/392 functions 42/42 fuzzy 100.0000 linked code 5916 +[src/keyboard/tiGUIManager] instruction-exact functions: 42/42 +[src/keyboard/tiInputForm] pool: IDENTICAL +[src/keyboard/tiInputForm] objdiff: code 47928/50656 data 3772/3772 functions 219/221 fuzzy 99.7200 linked code 0 +[src/keyboard/tiInputForm] instruction-exact functions: 219/221 +[src/keyboard/tiKeyboard] pool: IDENTICAL +[src/keyboard/tiKeyboard] objdiff: code 8368/8368 data 2708/2708 functions 62/62 fuzzy 100.0000 linked code 8368 +[src/keyboard/tiKeyboard] instruction-exact functions: 62/62 +[src/keyboard/tiPcKeyboard] pool: IDENTICAL +[src/keyboard/tiPcKeyboard] objdiff: code 28484/28484 data 18564/18564 functions 141/141 fuzzy 100.0000 linked code 28484 +[src/keyboard/tiPcKeyboard] instruction-exact functions: 141/141 +[src/keyboard/tiSignWindow] pool: IDENTICAL +[src/keyboard/tiSignWindow] objdiff: code 7184/7184 data 3468/3468 functions 56/56 fuzzy 100.0000 linked code 7184 +[src/keyboard/tiSignWindow] instruction-exact functions: 56/56 +[src/keyboard/tiTextDrawer] pool: IDENTICAL +[src/keyboard/tiTextDrawer] objdiff: code 3476/3476 data 1608/1608 functions 24/24 fuzzy 100.0000 linked code 3476 +[src/keyboard/tiTextDrawer] instruction-exact functions: 24/24 +[src/layout/GUIManager] pool: IDENTICAL +[src/layout/GUIManager] objdiff: code 4964/4964 data 408/408 functions 43/43 fuzzy 100.0000 linked code 4964 +[src/layout/GUIManager] instruction-exact functions: 43/43 +[src/layout/iplLayout] pool: IDENTICAL +[src/layout/iplLayout] objdiff: code 5328/5328 data 208/208 functions 50/50 fuzzy 100.0000 linked code 5328 +[src/layout/iplLayout] instruction-exact functions: 50/50 +[src/sound/iplSound] pool: IDENTICAL +[src/sound/iplSound] objdiff: code 5576/5576 data 3316/3316 functions 57/57 fuzzy 100.0000 linked code 5576 +[src/sound/iplSound] instruction-exact functions: 56/57 +[src/utility/iplFrameController] pool: IDENTICAL +[src/utility/iplFrameController] objdiff: code 432/432 data None/None functions 3/3 fuzzy 100.0000 linked code 432 +[src/utility/iplFrameController] instruction-exact functions: 3/3 +[src/utility/iplGraphics] pool: IDENTICAL +[src/utility/iplGraphics] objdiff: code 2216/2216 data 164/164 functions 12/12 fuzzy 100.0000 linked code 2216 +[src/utility/iplGraphics] instruction-exact functions: 12/12 +[src/utility/iplJpegDecoder] pool: IDENTICAL +[src/utility/iplJpegDecoder] objdiff: code 2304/2304 data 32/32 functions 10/10 fuzzy 100.0000 linked code 2304 +[src/utility/iplJpegDecoder] instruction-exact functions: 10/10 +[src/utility/iplThread] pool: IDENTICAL +[src/utility/iplThread] objdiff: code 496/496 data 48/48 functions 10/10 fuzzy 100.0000 linked code 496 +[src/utility/iplThread] instruction-exact functions: 10/10 +[src/utility/iplUtility] pool: IDENTICAL +[src/utility/iplUtility] objdiff: code 5932/5932 data 304/304 functions 45/45 fuzzy 100.0000 linked code 5932 +[src/utility/iplUtility] instruction-exact functions: 45/45 +regressions vs baseline: 0 +global matched_code_percent: 93.82541 -> 93.82541 +global fuzzy_match_percent: 99.81117 -> 99.81117 +global complete_code_percent: 79.26653 -> 79.26653 +global matched_data_percent: 99.99410 -> 99.99410 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +GATE PASS +``` + +## Local source commits + +- `13c21e83b1bdb0c192ceb305d0832d8e753f21e1`: clean up keyboard expressions without changing objects (12 files). +- `650826ccc50048a8dc785ccb1050045bd783716d`: clean up menu utility and layout expressions (10 files). +- `fa34ba0b6218286752429b169ce6cf6c51e47958`: clean up nw4r constants and expressions (15 files). + +The validation above covers the source tree in all three commits. A separate final commit records this log. No push, PR, merge, or branch change was performed. -- 2.49.1