From eef25991e27e4432ca37bad74be4c05866773309 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 01:36:09 +0000 Subject: [PATCH] pf_path, iplAddressEdit closer (worker 1bceaa8f) --- README.md | 2 +- libs/RVL_SDK/src/fa/pf_path.c | 26 +++-- src/scene/address/iplAddressEdit.cpp | 110 +++++++----------- src/scene/cardSequence/iplCardSequence.cpp | 56 +++++---- .../sdChannelSelect/iplSDChannelSelect.cpp | 27 +++-- src/system/odh.cpp | 45 +++---- 6 files changed, 126 insertions(+), 140 deletions(-) diff --git a/README.md b/README.md index 4ab8b555..c294de8a 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 98.90% | 86.34% | 60.34% | 90.92% | +| 98.91% | 86.34% | 60.34% | 90.92% | units 902/1027 complete, functions 12138/12563 matched. diff --git a/libs/RVL_SDK/src/fa/pf_path.c b/libs/RVL_SDK/src/fa/pf_path.c index eff9a473..fab0d89d 100644 --- a/libs/RVL_SDK/src/fa/pf_path.c +++ b/libs/RVL_SDK/src/fa/pf_path.c @@ -400,20 +400,22 @@ pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* match case '*': { do { pattern_width = volume->codeset.oem_char_width(pattern); - if (pattern_width == 1) { - pattern_char = pf_toupper(*pattern); + if (pattern_width != 1) { + read_char = (pf_u16)PF_GET_LE_U16((const pf_u8*)pattern); } else { - pattern_char = PF_GET_LE_U16((const pf_u8*)pattern); + read_char = pf_toupper(*pattern); } + pattern_char = (pf_u16)read_char; pattern += pattern_width; if (pattern_char == '?') { if (name_char == 0) { return 1; } name += name_width; name_width = volume->codeset.oem_char_width(name); - if (name_width == 1) { name_char = pf_toupper(*name); } - else { name_char = PF_GET_LE_U16((const pf_u8*)name); } + if (name_width == 1) { read_char = pf_toupper(*name); } + else { read_char = (pf_u16)PF_GET_LE_U16((const pf_u8*)name); } + name_char = (pf_u16)read_char; } - } while (pattern_char == '*' || pattern_char == '?'); + } while (pattern_char == '?' || pattern_char == '*'); if (pattern_char == 0) { return 0; } @@ -428,21 +430,21 @@ pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* match } name_width = volume->codeset.oem_char_width(name); if (name_width == 1) { - name_char = pf_toupper(*name); + read_char = pf_toupper(*name); } else { - name_char = PF_GET_LE_U16((const pf_u8*)name); + read_char = (pf_u16)PF_GET_LE_U16((const pf_u8*)name); } + name_char = (pf_u16)read_char; + } + if (*name == 0 || *pattern == 0) { + *matched_end = 1; } - return 1; } default: if (name_char != pattern_char) { return 1; } break; } name += name_width; - if (*name == 0 || *pattern == 0) { - *matched_end = 1; - } } return *name != 0; } diff --git a/src/scene/address/iplAddressEdit.cpp b/src/scene/address/iplAddressEdit.cpp index 3dfa5186..44b900eb 100644 --- a/src/scene/address/iplAddressEdit.cpp +++ b/src/scene/address/iplAddressEdit.cpp @@ -2209,86 +2209,62 @@ done: return; } -void ipl::scene::AddressEdit::start_left_event( - const char* paneName) { +void ipl::scene::AddressEdit::start_left_event(const char* paneName) { int buttonNo = get_button_no(paneName); switch (mState) { - case 0x22: - goto state22; case 0: switch (buttonNo) { + case 0: { + if (mpFriendCache->getInfo(mSelectedFriend).attr.status != 2) { + break; + } + s32* count = &mPointCount[buttonNo]; + if (*count == 1) { + layout::Animator* animator = mpCodeLayout->getAnim(buttonNo + 11); + animator->initFrame(); + animator->restart(); + } + if (*count > 0) { + --*count; + } + break; + } case 3: - goto state0Button3; - case 0: - goto state0Friend; + if (mPointCount[buttonNo] == 1) { + mpBalloon->fadeoutForce(); + } case 1: - case 2: - goto state0Common; + case 2: { + s32* count = &mPointCount[buttonNo]; + if (*count == 1) { + layout::Animator* animator = mpCodeLayout->getAnim(buttonNo + 11); + animator->initFrame(); + animator->restart(); + } + if (*count > 0) { + --*count; + } + break; + } default: break; } break; + case 0x22: + switch (buttonNo) { + case 3: { + s32* count = &mPointCount[buttonNo]; + if (*count == 1) { + mpBalloon->fadeoutForce(); + } + --*count; + break; + } + } + break; default: break; } - goto done; - -state0Friend: { - u32 friendIndex = mSelectedFriend; - u32 friendType = mpFriendCache->getInfo(friendIndex).attr.status; - if (friendType != 2) { - goto done; - } - s32* count = &mPointCount[buttonNo]; - if (*count == 1) { - ipl::layout::Object* layout = mpCodeLayout; - ipl::layout::Animator* pane = layout->getAnim(buttonNo + 0xb); - pane->initFrame(); - pane->restart(); - } - if (*count > 0) { - --*count; - } - goto done; - } - -state0Button3: { - s32* count = &mPointCount[buttonNo]; - if (*count == 1) { - (mpBalloon)->fadeoutForce(); - } - --*count; - goto done; - } - -state0Common: { - s32* count = &mPointCount[buttonNo]; - if (*count == 1) { - ipl::layout::Object* layout = mpCodeLayout; - ipl::layout::Animator* pane = layout->getAnim(buttonNo + 0xb); - pane->initFrame(); - pane->restart(); - } - if (*count > 0) { - --*count; - } - goto done; - } - -state22: - if (buttonNo != 3) { - goto done; - } - { - s32* count = &mPointCount[buttonNo]; - if (*count == 1) { - (mpBalloon)->fadeoutForce(); - } - --*count; - } - -done: - return; } void ipl::scene::AddressEdit::start_trig_event( diff --git a/src/scene/cardSequence/iplCardSequence.cpp b/src/scene/cardSequence/iplCardSequence.cpp index 873808c0..64337f5c 100644 --- a/src/scene/cardSequence/iplCardSequence.cpp +++ b/src/scene/cardSequence/iplCardSequence.cpp @@ -697,16 +697,19 @@ extern "C" s32 CardSequence_813D3424(s32 slot, s32 fileNo, CARDDir* dir) { s32 sectorSize; CARDFileInfo fileInfo; } local; - s32 result = CARDFastOpen(slot, fileNo, &local.fileInfo); + s32 result; + u32 iconAddressBase; + s32 iconAddressOffset; + result = CARDFastOpen(slot, fileNo, &local.fileInfo); if (result < 0) { return result; } - u32 bannerImageSize = 0; + s32 bannerImageSize = 0; u8 format = dir->bannerFormat & 3; u32 iconAddress = dir->iconAddr; - u32 iconAddressBase = iconAddress & 0xFFFFFE00; - s32 iconAddressOffset = iconAddress - iconAddressBase; + iconAddressBase = iconAddress & 0xFFFFFE00; + iconAddressOffset = iconAddress - iconAddressBase; switch (format) { case 1: { @@ -827,7 +830,7 @@ iconSpeedDone: sThread->icons[slot][fileNo].anmDelta = 1; } - s32 totalImageSize = bannerImageSize + iconImageSize; + s32 totalImageSize = iconImageSize + bannerImageSize; u32 transferSize = (totalImageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00; result = CARDGetSectorSize(slot, (u32*)&local.sectorSize); if (result < 0) { @@ -854,9 +857,14 @@ iconSpeedDone: (u8*)sThread->imageReadBuffer + iconAddressOffset, totalImageSize); DCStoreRange(sThread->images[slot][fileNo], transferSize); + result = 0; } } + if (result < 0) { + goto closeFile; + } + iconAddress = dir->commentAddr; iconAddressBase = iconAddress & 0xFFFFFE00; s32 commentDataOffset = iconAddress - iconAddressBase; @@ -865,26 +873,30 @@ iconSpeedDone: if (result < 0) { goto clearComment; } - if ((s32)iconAddressBase >= 0) { + if ((s32)iconAddressBase < 0) { + result = 0; + } else { u32 fileSize = (u32)dir->length * local.commentSectorSize; - if (iconAddressBase <= fileSize) { - u32 endOffset = iconAddressBase + imageSize; - if ((s32)endOffset >= 0 && endOffset <= fileSize) { - result = CARDRead(&local.fileInfo, sThread->commentBuffer, imageSize, - iconAddressBase); - if (result < 0) { - goto clearComment; - } - memset(sThread->comments[slot][fileNo], 0, 0x40); - memcpy(sThread->comments[slot][fileNo], - sThread->commentBuffer + commentDataOffset, 0x40); - result = 0; - goto commentDone; - } + if (iconAddressBase > fileSize) { + result = 0; + goto clearComment; } + u32 endOffset = iconAddressBase + imageSize; + if ((s32)endOffset < 0 || endOffset > fileSize) { + result = 0; + goto clearComment; + } + result = CARDRead(&local.fileInfo, sThread->commentBuffer, imageSize, + iconAddressBase); + if (result < 0) { + goto clearComment; + } + memset(sThread->comments[slot][fileNo], 0, 0x40); + memcpy(sThread->comments[slot][fileNo], + sThread->commentBuffer + commentDataOffset, 0x40); + result = 0; + goto commentDone; } - result = 0; - goto clearComment; clearComment: memset(sThread->comments[slot][fileNo], 0, 0x40); diff --git a/src/scene/sdChannelSelect/iplSDChannelSelect.cpp b/src/scene/sdChannelSelect/iplSDChannelSelect.cpp index 82697a00..910063ad 100644 --- a/src/scene/sdChannelSelect/iplSDChannelSelect.cpp +++ b/src/scene/sdChannelSelect/iplSDChannelSelect.cpp @@ -1453,32 +1453,40 @@ namespace ipl { bool SDChannelSelect::collectTitlesBySpecialChannels( const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds, char* titleNames, u32* titleCount) { + s32 bytes; + s32 blocks; + getCurrentTitleUsage(&bytes, &blocks); int hateUsageIndex = -1; int hatePage = -1; int hateChannelIndex = -1; int hadeUsageIndex = -1; int hadePage = -1; int hadeChannelIndex = -1; - s32 bytes; - s32 blocks; - getCurrentTitleUsage(&bytes, &blocks); for (u32 usageIndex = 0; usageIndex < mNandTitleCount; ++usageIndex) { - ESTitleId titleId = mpNandTitleInfo[usageIndex].curTitleId; + const ESTitleId titleId = mpNandTitleInfo[usageIndex].curTitleId; if (titleId == ES_TITLE_ID(0x00010001, 0x48415445)) { hateUsageIndex = usageIndex; + int foundPage = -1; + int foundIndex = -1; System::getChannelManager()->hasChannel( - ES_TITLE_ID(0x00010001, 0x48415445), &hatePage, &hateChannelIndex); + ES_TITLE_ID(0x00010001, 0x48415445), &foundPage, &foundIndex); + hatePage = foundPage; + hateChannelIndex = foundIndex; } else if (titleId == ES_TITLE_ID(0x00010001, 0x48414445)) { hadeUsageIndex = usageIndex; + int foundPage = -1; + int foundIndex = -1; System::getChannelManager()->hasChannel( - ES_TITLE_ID(0x00010001, 0x48414445), &hadePage, &hadeChannelIndex); + ES_TITLE_ID(0x00010001, 0x48414445), &foundPage, &foundIndex); + hadePage = foundPage; + hadeChannelIndex = foundIndex; } } *titleCount = 0; for (int usageIndex = mNandTitleCount - 1; usageIndex >= 0; --usageIndex) { - ESTitleId titleId = mpNandTitleInfo[usageIndex].curTitleId; + const ESTitleId titleId = mpNandTitleInfo[usageIndex].curTitleId; if (titleId == 0x48415A41 || titleId == ES_TITLE_ID(0x00010001, 0x48415445) || titleId == ES_TITLE_ID(0x00010001, 0x48414445)) { continue; } @@ -1562,10 +1570,7 @@ namespace ipl { } } - if (bytes >= firstUsage[0] && blocks >= firstUsage[1]) { - return true; - } - return false; + return bytes >= firstUsage[0] && blocks >= firstUsage[1]; } bool SDChannelSelect::collectTitlesForMode( diff --git a/src/system/odh.cpp b/src/system/odh.cpp index dcd45790..413a16fa 100644 --- a/src/system/odh.cpp +++ b/src/system/odh.cpp @@ -986,15 +986,8 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutput, u16 width, u16 height, const long* conversionTable, int format) { - u32 in__r9 = (u32)width * (u32)height; + u32 planeSize = (u32)width * (u32)height; const s32* table = (const s32*)conversionTable; - float pixelBias = colorConvert16; - float chromaBias = colorConvert128; - float lumaScale = colorConvertY; - float crToRedScale = colorConvertR; - float cbToGreenScale = colorConvertG1; - float crToGreenScale = colorConvertG2; - double cbToBlueScale = colorConvertB; u32 pixelIndex = 0; for (int i = 0; i < width; i++) { @@ -1003,9 +996,10 @@ void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutpu s32 blue; if (format == 0) { - u8* pixelSource = (u8*)(((pixelIndex << 1) & 6) + (u32)source + ((pixelIndex << 3) & 0xFFFFFFE0)); - u8 firstByte = pixelSource[0]; - u16 pixel = (u16)firstByte << 8 | pixelSource[1]; + u8* pixelSource = source + ((pixelIndex << 3) & 0xFFFFFFE0); + pixelSource += (pixelIndex & 3) * 2; + u16 pixel = pixelSource[1]; + pixel |= (u16)pixelSource[0] << 8; red = (pixel >> 11) & 0x1F; green = (pixel >> 6) & 0x1F; blue = pixel & 0x1F; @@ -1017,13 +1011,13 @@ void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutpu blue = pixel[0x21] >> 3; } else { int sourceOffset = (pixelIndex & 7) + (pixelIndex & 0x3FFFFFF8) * 4; - float y = (float)source[sourceOffset] - pixelBias; - float cb = (float)source[in__r9 + sourceOffset] - chromaBias; - float cr = (float)source[in__r9 * 2 + sourceOffset] - chromaBias; - float luma = lumaScale * y; - int blueOrPixelOffset = (int)(luma + cbToBlueScale * cb); - int convertedRed = (int)(luma + crToRedScale * cr); - int convertedGreen = (int)(luma - cbToGreenScale * cb - crToGreenScale * cr); + float y = (float)source[sourceOffset] - colorConvert16; + float cb = (float)source[planeSize + sourceOffset] - colorConvert128; + float cr = (float)source[planeSize * 2 + sourceOffset] - colorConvert128; + float luma = colorConvertY * y; + int convertedRed = (int)(luma + colorConvertR * cr); + int convertedGreen = (int)(luma - colorConvertG1 * cb - colorConvertG2 * cr); + int blueOrPixelOffset = (int)(luma + colorConvertB * cb); if (convertedRed < 0) { convertedRed = 0; @@ -1052,16 +1046,13 @@ void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutpu s32* redTable = (s32*)(table + red); s32* blueTable = (s32*)(table + blue); s32* greenTable = (s32*)(table + green); - int redSum = redTable[0x60] + blueTable[0xA0]; - redSum = greenTable[0x80] + redSum; - int blueSum = blueTable[0x100] + redTable[0xC0]; - blueSum = greenTable[0xE0] + blueSum; - int luma = redTable[0] + greenTable[0x20]; - luma = blueTable[0x40] + luma; + int cbValue = (greenTable[0x80] + (blueTable[0xA0] + redTable[0x60])) >> 16; + int crValue = (greenTable[0xE0] + (blueTable[0x100] + redTable[0xC0])) >> 16; + int luma = (greenTable[0x20] + (blueTable[0x40] + redTable[0])) >> 16; - *lumaOutput++ = (u8)((u32)luma >> 0x10); - *cbOutput++ = (u8)((u32)redSum >> 0x10); - *crOutput++ = (u8)((u32)blueSum >> 0x10); + *lumaOutput++ = (u8)luma; + *cbOutput++ = (u8)cbValue; + *crOutput++ = (u8)crValue; pixelIndex++; } } -- 2.49.1