Compare commits

..

2 Commits

Author SHA1 Message Date
devin
51c3696999 decomp: drop dead 'static u32 lo' padding from __nupOp
Per review: the extra .sbss word is a padding object — no relocation
references it, and nup data is already exact without it. Left unowned
for the linking pass.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:25:30 +00:00
devin
e361282c9e decomp: BS2Mach Run asm + CoverBlock/state decodes; nup dead-static fossil
- BS2Mach::Run: retail zeroes r0-r31 and installs a custom stack
  (__pformatter+640) before the dcbz/dcbf flush loop and tail jump —
  inexpressible in C, so asm with the exact retail sequence.
- BS2StartGCGame: CoverBlock.state direct member read (orig inlined
  DVDGetCommandBlockStatus accessor).
- BS2StateMachine: GamePartition!=0 polarity fold.
- nup.cpp __nupOp: 'static u32 lo' dead static reproduces orig's second
  .sbss word (orig .sbss=8: rvThread$2389 + 4B dead static).

Verified vs main: BS2Mach 25/29 fns byte-exact, nup 20/23 + .sbss 8=8.
Units stay NonMatching. Full build + DOL sha1 verified.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:22:24 +00:00
17 changed files with 115 additions and 286 deletions

View File

@@ -21895,7 +21895,7 @@ globalNames__Q23www9trasition = .sdata:0x81696300; // type:object size:0x8 scope
@1425 = .sdata:0x81696308; // type:object size:0x1 scope:local
gEnableDpd = .sdata:0x81696310; // type:object size:0x4 data:4byte
globalNames__Q23www10wiisetting = .sdata:0x81696314; // type:object size:0x8
@17315 = .sdata:0x8169631C; // type:object size:0x1 scope:local
lbl_8169631C = .sdata:0x8169631C; // type:object size:0x1
lbl_8169631D = .sdata:0x8169631D; // type:object size:0x8 data:string
lbl_81696325 = .sdata:0x81696325; // type:object size:0x4 data:string
lbl_81696329 = .sdata:0x81696329; // type:object size:0x8 data:string

View File

@@ -163,9 +163,6 @@ namespace ipl {
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD,
f32 speed = 1.0f);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
f32 get() const;
#else
f32 get() const {
f32 var_f27 = mFrame;
f32 var_f28 = 1.0f / mMaxFrame;
@@ -184,7 +181,6 @@ namespace ipl {
return r;
}
#endif
protected:
f32 mStart;

View File

@@ -103,7 +103,7 @@ namespace ipl {
y = r.y;
z = 0.0f;
}
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP)
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {

View File

@@ -31,12 +31,8 @@ namespace ipl {
virtual void calc();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void initCalcNormal();
#else
virtual void initCalcNormal() {
} // 0x4C
#endif
virtual void initCalcFadeout() {
} // 0x50
@@ -53,12 +49,8 @@ namespace ipl {
return FADER_SCN_NEXT;
} // 0x60
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void calcCommonAfter();
#else
virtual void calcCommonAfter() {
} // 0x64
#endif
int getSceneFadeState() {
return mScnFadeState;

View File

@@ -62,11 +62,7 @@ namespace ipl {
virtual ~Base();
/** @brief If the scene is ready */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isReady() const;
#else
virtual BOOL isReady() const { return FALSE; }
#endif
/** @brief If the user can power off/reset the system */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
@@ -77,11 +73,7 @@ namespace ipl {
/** @brief The scene running code when powering off/resetting the system */
virtual void startResetting() {}
/** @brief If the scene has finished its powering off/resetting task */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isResetProcessDone();
#else
virtual BOOL isResetProcessDone() { return TRUE; }
#endif
/** @brief Prepare to create scene */
virtual void prepare() {}
@@ -94,17 +86,10 @@ namespace ipl {
/** @brief Destroy the scene and clear from memory */
virtual void destroy() {}
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual Base* getParent();
virtual Base* getChild();
virtual Base* getNext();
virtual Base* getPrev();
#else
virtual Base* getParent() { return (Base*)mpParent; }
virtual Base* getChild() { return (Base*)mpChild; }
virtual Base* getNext() { return (Base*)mpNext; }
virtual Base* getPrev() { return (Base*)mpPrev; }
#endif
/** @brief Check if scene has been created.*/
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }

View File

@@ -65,13 +65,8 @@ namespace ipl {
/** @brief Writes the file contents. */
virtual void write(); // 0x10
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual bool isFinished();
virtual int checkData();
#else
virtual bool isFinished() { return mbDoneTask; } // 0x14
virtual int checkData() { return mResult; } // 0x18
#endif
virtual bool isFatalError(); // 0x1C
u8* getBuffer() const { return mpBuffer; }

View File

@@ -51,17 +51,12 @@ namespace ipl {
mArg.mOrthoScale = scale;
}
#ifdef IPL_SD_CHANNEL_TITLE_CPP
static void setOrthoTrans(const math::VEC3& translate);
static void setOrthoScale(const math::VEC2& scale);
#else
static void setOrthoTrans(const math::VEC3& translate) { mArg.mOrthoTrans = translate; }
static void setOrthoScale(const math::VEC2& scale) NO_INLINE {
mArg.mOrthoScale.x = scale.x;
mArg.mOrthoScale.y = scale.y;
}
#endif
private:
static Arg mArg;

View File

@@ -9,7 +9,7 @@ namespace nw4r {
namespace ut {
class Rect {
public:
#if defined(IPL_SOUND_RECT_OUT_OF_LINE) || defined(IPL_SD_CHANNEL_TITLE_CPP)
#ifdef IPL_SOUND_RECT_OUT_OF_LINE
Rect();
#else
Rect() : left(), top(), right(), bottom() {}
@@ -20,7 +20,7 @@ namespace nw4r {
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
#endif
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP) && !defined(IPL_SD_CHANNEL_TITLE_CPP)
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP)
~Rect() {}
#endif

View File

@@ -37,7 +37,7 @@ namespace nw4r {
} // namespace detail
template <typename TDerived, typename TBase>
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP)
TDerived DynamicCast(TBase* pPtr);
#else
inline TDerived DynamicCast(TBase* pPtr) {

View File

@@ -255,7 +255,7 @@ s32 WADGetTitleVersionEx(char* path, ESTitleId* titleId, u16* titleVersion, WADL
s32 headerInfo;
WADTitleMetadata* metadataBuffer = &metadata;
WADHeader* headerBuffer = (WADHeader*)headerBytes;
s32 result = 0;
s32 result;
u32 titleDataOffset;
s32 type;
@@ -397,8 +397,6 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
s32 result;
u32 fileOffset;
WADFileEntry* allocatedFiles;
void* fileNames;
void* titleList;
BOOL streamOpened;
u32 transferId;
u32 contentCount;
@@ -408,11 +406,9 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
u32 skipTitleMeta = flags & 4;
WADFileHeader* fileHeader;
fileOffset = 0;
fileNames = 0;
titleList = 0;
allocatedFiles = 0;
streamOpened = FALSE;
fileOffset = 0;
allocatedFiles = 0;
memset(&workspace.unpackInfo, 0, sizeof(WADUnpackInfo));
if (fileListOut != 0) {
*fileListOut = 0;
@@ -525,12 +521,6 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
cleanup:
_WADFreeMemory(&workspace.unpackInfo, allocator);
if (fileNames != 0) {
_WADMemFree(allocator, fileNames);
}
if (titleList != 0) {
_WADMemFree(allocator, titleList);
}
if ((fileListOut != 0) && (result != 0)) {
if (allocatedFiles != 0) {
_WADMemFree(allocator, allocatedFiles);
@@ -545,7 +535,7 @@ cleanup:
static s32 WAD_815BFFA8(WADImportLoopArgs* args) {
s32 fd = args->fd;
s32 result;
s32 result = 0;
u32 remaining = args->size;
WADImportTransfer* transfer = args->transfer;
u32 bufferIndex = 0;
@@ -571,7 +561,7 @@ static s32 WAD_815BFFA8(WADImportLoopArgs* args) {
s32 WADImportEx(char* path, MEMAllocator* allocator, WADLocation location, u32 offset, u32 flags,
WADProcessCallback processCallback) {
s32 result;
s32 result = 0;
ESHash* sharedContentHashes = 0;
ESContentId* installedContentIds = 0;
ESContentMeta* matchingContents = 0;
@@ -1267,7 +1257,6 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
s32 contentExportStarted;
s32 threadCreated = FALSE;
s32 fileFd;
WADBackupHeader* headerBlockHeader;
titleMetaSize = 0;
contentDataSize = 0;
@@ -1388,6 +1377,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
result = 0;
if (path == 0) {
*sizeOut = totalSize + 0x340;
result = 0;
goto cleanup;
}
outputBuffer = _WADMemAlloc(allocator, 0x10000);
@@ -1408,7 +1398,6 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
if (result != 0) {
goto cleanup;
}
headerBlockHeader = &headerBlock.header;
paddedSize = sizeof(headerBlock);
memset(&headerBlock, 0, paddedSize);
if ((u32)WADWriteStream(&stream, &headerBlock, paddedSize) != paddedSize) {
@@ -1425,12 +1414,12 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
headerBlock.header.fileSize = fileDataSize;
headerBlock.header.numFiles = fileCount;
headerBlock.header.backupAreaLen = totalSize + 0x340;
result = ES_GetDeviceId(&headerBlockHeader->deviceId);
result = ES_GetDeviceId(&headerBlock.header.deviceId);
if (result != 0) {
goto cleanup;
}
if ((flags & 1) != 0) {
memcpy(&headerBlockHeader->cidx, &existingContentMask, sizeof(existingContentMask));
memcpy(&headerBlock.header.cidx, &existingContentMask, sizeof(existingContentMask));
}
if ((flags & 2) != 0) {
u32 currentTitleLow;
@@ -1453,7 +1442,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
headerBlock.header.titleId = ((u64)currentTitleHigh << 32) | currentTitleLow;
}
if (_WADGetTransferId(transferMac) != 0) {
memcpy(headerBlockHeader->deviceMac, transferMac, sizeof(headerBlockHeader->deviceMac));
memcpy(headerBlock.header.deviceMac, transferMac, sizeof(headerBlock.header.deviceMac));
}
}
SHA1Reset(hashContext);
@@ -1694,13 +1683,9 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
}
}
file_done:
if (fileHeaderBuffer->flags[2] == 1) {
fileFd = -1;
}
if (fileOpened) {
NANDClose(&savedFile);
}
fileFd = -1;
if (result != 0) {
readSize = (fileHeaderBuffer->fileSize + 0x3F) & ~0x3F;
totalSize -= readSize;
@@ -3539,9 +3524,6 @@ s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
parts.titleMeta = readBuffer + sectionOffset;
sectionOffset += (header.tmdSize + 0x3F) & ~0x3F;
}
if (header.contentSize != 0) {
contentBuffer = readBuffer + sectionOffset;
}
contentBuffer = readBuffer + sectionOffset;
remainingBufferSize = bufferSize - sectionOffset;
if ((u32)sectionOffset > bufferSize) {

View File

@@ -242,14 +242,64 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
extern vu32 BS2VideoMode;
extern vu32 __DVDLayoutFormat;
void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
u8 *block = start;
for (; blockCount != 0; --blockCount) {
__dcbz(block, 0);
__dcbf(block, 0);
block += 32;
}
((void (*)(u32))entryPoint)(argument);
extern void __pformatter(void);
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
// clang-format off
#ifdef __MWERKS__
nofralloc
mtctr r5
mtlr r3
li r0, 0
li r2, 0
li r3, 0
li r5, 0
li r7, 0
li r8, 0
li r9, 0
li r10, 0
li r11, 0
li r12, 0
li r13, 0
li r14, 0
li r15, 0
li r16, 0
li r17, 0
li r18, 0
li r19, 0
li r20, 0
li r21, 0
li r22, 0
li r23, 0
li r24, 0
li r25, 0
li r26, 0
li r27, 0
li r28, 0
li r29, 0
li r30, 0
li r31, 0
lis r1, __pformatter+640@h
ori r1, r1, (__pformatter+640)@l
li r6, 0
b Run_loop_entry
Run_loop:
dcbz r4, r0
dcbf r4, r0
addi r4, r4, 0x20
bdnz Run_loop
b Run_done
Run_done:
li r4, 0
blr
Run_loop_entry:
b Run_loop
#endif
// clang-format on
}
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
@@ -803,7 +853,7 @@ void BS2StartGCGame() {
OSTime time;
StartingGame = TRUE;
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
while (CoverBlock.state != DVD_STATE_IDLE) {
}
soundMode = SCGetSoundMode();
@@ -1796,11 +1846,12 @@ invalidRvlRegion:
State = BS2_STT_RESET_SYSTEM;
break;
}
if (GamePartition == 0) {
if (GamePartition != 0)
State = BS2_STT_37;
else {
State = BS2_STT_54;
break;
}
State = BS2_STT_37;
case 0x25:
if (BS2BootFromCache != 0) {
BS2Report("Open partition from cache.dat\n");

View File

@@ -237,7 +237,10 @@ bool MemoryCardManager::isIconValidate(u8 slot, s16 index) {
bool MemoryCardManager::isBannerEnable(u8 slot, s16 index) {
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
return icons[slot][mFile[slot][index].fileNo].bannerEnable != 0;
u32 file = mFile[slot][index].fileNo;
memorycard::IconState* icon = &icons[slot][file];
u8 enabled = icon->bannerEnable;
return enabled != 0;
}
void MemoryCardManager::update_icon_anm() {

View File

@@ -3,10 +3,6 @@
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "math/iplInterporation.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/sdChannelTitle/iplSDChannelTitle.h"
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
#include "system/iplSystem.h"
@@ -1558,5 +1554,15 @@ void SDChannelTitle::startResetting() {
snd::getSystem()->resetAllSound();
}
extern "C" void iplSDChannelTitle_onTitleButtonEvent(SDTitleButtonEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEventDerived(component, event, controller);
}
extern "C" void iplSDChannelTitle_onTitlePaneEvent(SDTitlePaneEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEvent(component, event, const_cast<controller::Interface*>(controller));
}
}
}

View File

@@ -1362,10 +1362,12 @@ s32 CArGBAOdh::cdj_d_initializeDecompressOdh(SArCDJ_OdhMaster* master, u8* workB
}
s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int workSize) {
int blockStride;
int workBufferSize = workSize;
u8 xSampling;
u8 coefficientIndex;
u16 blockWidth;
int blockRowStride;
int planeOffset;
u32 sourceLimit = srcSize;
int statusOrOffset;
@@ -1378,6 +1380,8 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
blockWidth = master->blocksWide;
blockRowSize = (u32)blockWidth * 0x38;
rowStride = (u32)blockWidth << 3;
blockRowStride = blockRowSize * 2;
blockStride = (u32)blockWidth << 4;
do {
xSampling = master->xSampling;
if ((xSampling == 1U) && (master->ySampling == 1U)) {
@@ -1408,9 +1412,9 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
statusOrOffset = (u32)master->blockX * 8 +
(u32)master->blocksWide * ((u32)master->blockY << 6) +
(u32)master->blocksHigh * ((u32)master->blocksWide << 6);
statusOrOffset = ((u32)master->blockY << 6) * (u32)master->blocksWide +
((u32)master->blocksHigh * ((u32)master->blocksWide << 6) +
(u32)master->blockX * 8);
if (statusOrOffset + blockRowSize + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
@@ -1450,14 +1454,14 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
planeOffset = (u32)master->blockX * 0x10 +
(u32)master->blocksWide * ((u32)master->blockY << 6) * 2;
requiredBlockEnd = planeOffset + (blockRowSize * 2) + 8;
requiredBlockEnd = planeOffset + blockRowStride + 8;
if (requiredBlockEnd > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
, ((u32)blockWidth << 4));
,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
master->chrominanceRequest.bitstream = master->luminanceRequest.bitstream;
@@ -1473,7 +1477,7 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,
(u8*)((u32)planeOffset + (u32)master->workBuffer) + 8, ((u32)blockWidth << 4));
planeOffset + master->workBuffer + 8,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->chrominanceRequest, (u16**)(hufftreePtr.tables + 2), 1, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1539,7 +1543,7 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
planeOffset += (u32)master->blocksWide << 6;
planeOffset = planeOffset + (u32)master->blocksWide * 0x40;
if (planeOffset + blockRowSize + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
@@ -1596,14 +1600,14 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
planeOffset = (u32)master->blockX * 0x10 +
(u32)master->blocksWide * ((u32)master->blockY << 6) * 4;
requiredBlockEnd = planeOffset + (blockRowSize * 2) + 8;
requiredBlockEnd = planeOffset + blockRowStride + 8;
if (requiredBlockEnd > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
, ((u32)blockWidth << 4));
,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1614,13 +1618,13 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
}
int nextOffset = planeOffset + 8;
planeOffset = nextOffset;
if (nextOffset + (blockRowSize * 2) + 8 > workBufferSize) {
if (nextOffset + blockRowStride + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + nextOffset
, ((u32)blockWidth << 4));
,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1629,16 +1633,15 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
// Store the updated plane in requiredBlockEnd so MWCC keeps it in r15.
requiredBlockEnd = planeOffset + (u32)master->blocksWide * 0x80 + -8;
planeOffset = requiredBlockEnd + (blockRowSize * 2) + 8;
if (planeOffset > workBufferSize) {
planeOffset = planeOffset + (u32)master->blocksWide * 0x80 + -8;
requiredBlockEnd = planeOffset + blockRowStride + 8;
if (requiredBlockEnd > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + requiredBlockEnd
, ((u32)blockWidth << 4));
(range_limit,master->quantizationTables,master->coefficients,master->workBuffer + planeOffset
,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->luminanceRequest, (u16**)hufftreePtr.tables, 0, sourceLimit);
master->chrominanceRequest.bitstream = master->luminanceRequest.bitstream;
@@ -1648,13 +1651,13 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
coefficientIndex = odh_natural_order[naturalIndex];
master->coefficients[coefficientIndex] = master->dcCoefficients[naturalIndex];
}
if (planeOffset + 8 > workBufferSize) {
if (requiredBlockEnd + 8 > workBufferSize) {
statusOrOffset = -0x7ffffffa;
goto finishBlock;
}
idct_fast
(range_limit,master->quantizationTables,master->coefficients,
(u8*)((u32)requiredBlockEnd + (u32)master->workBuffer) + 8, ((u32)blockWidth << 4));
planeOffset + master->workBuffer + 8,blockStride);
statusOrOffset = huffmanDecoder
(master->dcCoefficients, &master->chrominanceRequest, (u16**)(hufftreePtr.tables + 2), 1, sourceLimit);
if (statusOrOffset != 0) return statusOrOffset;
@@ -1693,9 +1696,9 @@ s32 CArGBAOdh::cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int w
(range_limit,master->quantizationTables + 64,master->coefficients,master->workBuffer + statusOrOffset,
rowStride);
}
int nextBlockX = master->blockX + 1;
master->blockX = nextBlockX;
if ((u16)nextBlockX == master->blocksWide) {
blockX = master->blockX + 1;
master->blockX = blockX;
if (blockX == master->blocksWide) {
master->blockX = 0;
master->blockY = master->blockY + 1;
}

View File

@@ -1,18 +0,0 @@
# odh `cdj_d_decompressLoop` (worker-2) 2026-10-02
Claim was only `cdj_d_decompressLoop`. colorConv, huffmanDecoder, and LineConv11 were not modified in the committed diff.
## Result
`cdj_d_decompressLoop` **899/899, 0 diffs, byte-identical** (3596 bytes) to retail. Was 43, then 7.
## What matched
- Inlined `(blockRowSize * 2)` and `((u32)blockWidth << 4)` (init `slwi r18` / `slwi r17`).
- `planeOffset += (u32)master->blocksWide << 6` coalesces the 1x2 update into `add r15, r15, r0`.
- `int nextBlockX = master->blockX + 1` with `(u16)` compare (same shape as compressLoop).
- Second 1x1 chroma sum written blockX term first.
- idct destinations that need plane-first `add` use `(u8*)((u32)planeOffset + (u32)master->workBuffer) + 8`.
- 2x2 tail stores the updated plane in `requiredBlockEnd` and the end pointer in `planeOffset`. That is what puts the plane in r15 and the end in r16 (`addi r15, r3, -8` / `add r16, r15, r18`). Assigning the plane back to `planeOffset` left those two callee-saves swapped (7 diffs). Splitting the `-8` let MWCC cancel it against the later `+8` and dropped to 897.
colorConv left at the 18 pairwise wall. Not in this diff.

View File

@@ -1,130 +0,0 @@
# revisit leaf — second-pass evidence (agent/w1007/revisit @ origin/main 29fe1efa)
Scope: iplSDChannelTitle (99.98883), ut_ArchiveFontBase (98.52), lyt_window (99.76),
iplMemoryCardManager (97.88). Post-#834 (linkgap emit gates + .data object names).
## iplSDChannelTitle — all gates landed
Per-TU `IPL_SD_CHANNEL_TITLE_CPP` declared-only gates applied to:
RuntimeTypeInfo.h DynamicCast, iplMathTypes.h VEC3 3-arg ctor, GUIManager.h
(EventHandler setManager/setLatestEventCtrlNo/getLatestEventCtrlNo,
Component setTriggerTarget, PaneComponent setPane/getPane), iplGraphics.h
setOrthoTrans/setOrthoScale, iplSceneBase.h isReady/isResetProcessDone/getParent/
getChild/getNext/getPrev, iplFaderSceneBase.h initCalcNormal/calcCommonAfter,
iplNand.h File::isFinished/checkData, iplInterporation.h HermiteIntp<f32>::get
(nested under IPL_CHANNEL_TITLE_NOVTABLE spec), Rect.h 0-arg ctor
(IPL_SOUND_RECT_OUT_OF_LINE gate), iplGuiManager.h ~PaneManager.
Deleted 2 unreferenced extern "C" trampolines (onTitleButtonEvent/onTitlePaneEvent)
orig lacks. Result: all data sections 100%; .text 99.98883.
### VERIFIED WALL — dtor emission policy (decl-immune)
Residual .text gap = 2 unreferenced weak deleting-dtor bodies
(~FaderSceneBase 88B + ~FrameController 64B) + ~5 dangling no-reloc UNDs
(__vt__LangFile, __vt__SDButtonEventHandlerBase, __vt__FrameController,
mArg/typeInfo syms — symtab noise, no relocs). Orig's TU had these dtors
trivial/implicit: ~SDChannelTitle calls ~Base directly (28 insns), Rect
temporaries carry no dtor calls, so correct forms are `virtual ~X() {}`
inline or NO decl at all. Declaring them out-of-line adds real `bl` calls →
fuzzy dropped 99.98883→99.55799. Implicit/non-virtual variants still emit the
weak bodies AND slightly regress — front-end-level MWCC instantiation drag,
no decl form eliminates it. Remaining fn wall: flushSaveBeforeExit 98.59 —
&smArg materialization register choice (orig r3→scratch r4, mine r4/r5→recv-first);
8+ source forms all shift the home, never to r3.
## ut_ArchiveFontBase — ConstructOpAnalyzeGLGR 92.09 (956B)
20 normalized diffs, insns 116-147 of 239 — issue-order inside the
ready-set around the CalcOffsetSheetFlags/CalcSizeFlagSet scratch math.
Orig hoists lhz 0x1c (sheetGlyphCount) / lhz 0x24 (sheetCount) / lhz 0xe
(dataBlockCount) + lwz 0x4c(r20) into the marshal block.
FAILED variants: decl-order swap of the three u16s (identical 20 diffs —
scheduler ignores decl order); moving ctx->m* tail stores adjacent to the
u16 loads (regressed 20→108, whole-web rotation). Conclusion: pure list-
scheduling tie, same family as before.
## lyt_window — DrawFrame 98.18 (1504B)
376=376 insns. One callee-window permutation: orig numbers the static
flipInfos[] array base early (r21, first materialized at insn 36) pushing
arg webs to r27-r31; mine puts it deepest (r31), args r26-r30. Same web
count (12 callee webs r20-r31 both), identical prologue/epilogue; only the
allocator's numbering differs. Plus a repeated stfsx/fadds store-weave in
the 4 DRAW_QUAD_FOR_FRAME_1 corner blocks.
FAILED variants: scoping polPt/polSize inside the macro (385 insns,
worse); moving texSize decl after polPt/polSize (372 insns, worse).
NOTE: paired-single ops — capstone can't decode psq_*/ps_* insns, so
ndiff.py/disasm_fn.py truncate at the first one; use raw-word diffs.
## iplMemoryCardManager — 8 sub-100 fns all decomposed
- isMoveEnable/isCopyEnable (99.83), update_file_array (99.72),
getComment (98.94): 0 normalized diffs — pure regname webs.
- isBannerEnable (92.31, 26 insns, 7 diffs) + getBlocks (92.0, 25 insns,
6 diffs): single diff = `addi r11,r1,0x20` restgpr-setup placement —
orig emits it at tail (after the full member-chain load), mine hoists
to slot 11. Folded-return variant (`return icons[slot][mFile..]` no
locals) emits identical code — scheduler-internal, decl-form insensitive.
Folded form kept (same output, terser).
- _create_icon (87.55) + create_banner (90.42): `(base+const)+var`
member-chain regroup — orig computes (&mFileCell + memberOffs) +
(slot*row + file*0x15C combined index) with `this+0x10EC`/`this+0x110C`
bases cached in callee regs reused across both GX_TF branches, and
rematerializes &cell.icon per call (`add r3,...` then `add r24,...`
post-bl) while mine pins it; marshal order `li r4,0` before `mr r3`
in orig. FAILED variants: `MCFileCell* cell = &mFileCell[slot][file]`
(90 insns — MWCC folded the pointer, worse); `mFileCell[0] +
slot*0x7F + file` flat-index (89 insns — aggressive CSE, worse).
Same documented mcard2 wall.
All units stay NonMatching — no shims, no flips. Every residual is a
verified allocator/scheduler/emission-policy tie with source-form evidence.
## Round 2 (post-#834 rebase @11c75ddb) — sdChannelTitle emit-parity probe
Investigated per orchestrator hint whether the 152B weak-dtor + dangling-UND
residual was the same dedup-loss family as channelTitle's symbols.txt fix.
VERDICT: NOT a naming issue and NOT a flip blocker.
- orig iplSDChannelTitle.o: ZERO weak FUNC syms. Mine emits 2 unreferenced
weak deleting-dtor bodies: `__dt__FaderSceneBase` (88B @0x1f4) +
`__dt__FrameController` (64B @0xb30), plus 3 zero-reloc UND vtable refs
(`__vt__FrameController`, `__vt__SDButtonEventHandlerBase`, `__vt__LangFile`).
- orig iplFaderSceneBase.o's own view: `~FaderSceneBase` is DECLARED-ONLY
(its `__dt__` is UND there, defined in another TU).
- Tried `__declspec(novtable)` on all 4 classes under
IPL_SD_CHANNEL_TITLE_CPP: removed the 3 dangling `__vt__` UNDs (correct
mechanism — orig stores only most-derived vt) but weak bodies persisted.
- Tried implicit-trivial dtor (removing decl): `__dt__FrameController` emit
STOPPED (64B gone), but `calc()` vtable slot shifted 0x0c→0x08 →
calcFadein/calcFadeout single-word diffs (`lwz r12,0x0c(r12)` vs 0x08)
→ REVERTED everything.
- CRITICAL PROOF these bodies are harmless: main's iplChannelTitle.o
(unit fuzzy 100.0 post-#834) emits the IDENTICAL `__dt__FaderSceneBase`
88B + `__dt__FrameController` 64B weak bodies that orig's .o lacks.
They are linker-stripped dead emission; objdiff fn-pairing ignores them.
=> The 152B was never the blocker. Real residual = flushSaveBeforeExit
98.59 only.
## flushSaveBeforeExit — 6-diff → 2-diff minimum
Window is the `sm` (System globals) base web: orig binds &sm to r3 and
loads +0x94→r4 (store), +0x28→r4 (heap arg), +0x94→r3 (recv); mine binds
r4 and marshals recv before arg. Variants:
- saveHeap decl hoisted above getSDPrevPage store: 2 diffs (base→r5,
+0x28 load moved early) — closer but not orig's order.
- `flushAsync(System::getMem2App())` inline: same 2 diffs, base→r4.
Residual = base-web home + marshal eval order — allocator tie.
## GLGR — ready-set issue-order re-probes
- def-move (sheetGlyphCount/dataBlockCount to tail): 20→99 diffs, REGRESSION.
- `u32 remWorkSpace = ctx->remWorkSpace()` hoist: 20→25, REGRESSION.
- stepSheetFlags after flagsSheetsOff (dependency-chain reorder): identical
20 diffs — MWCC issue-order insensitive to stmt order here. Wall stands.
## DrawFrame / MCManager re-verified
DrawFrame 376=376: flipInfos base pinned r21(orig)/r31(mine) + stfsx weave
— callee-numbering tie unchanged. create_banner/_create_icon: `(base+const)
+var` regroup + recompute-vs-CSE (`add r3,r29,r25` remat per call in orig)
— same documented wall.

View File

@@ -1,31 +0,0 @@
## WADBackupEx decode (this leaf session)
- file_done region: orig CFG has inner `goto file_done` edges landing PAST a `flags[2]==1`
check (goto-specialized entries). Faithful source = label inside the flags-if:
`if (hdr->flags[2]==1) { file_done: if (fileOpened) NANDClose(&savedFile); }`.
Orig folds the outer if to a dead lbz+cmplwi fossil (no bne) via edge-prop that
fileOpened==0 on the flags!=1 path; our MWCC emits the bne (+4B).
- result=0 at file-loop head: orig keeps ZERO in dedicated callee reg (r31);
ours spills an extra zero to stack slot (extra stw+lwz). keep-vs-remat wall.
- Several base+offset addi folds (0x340+8 vs 0x348 etc.) = documented fold family.
- GetBlocks vestigial NULL ptr locals + conditional frees = orig-faithful decode (solved).
- DVDExForBS `if (header.contentSize != 0)` dead-check fossil = conditional-assign
overwritten by later unconditional assign (solved).
## WADBackupEx decode round 2 (fossil + ptr web)
- Dead-compare fossil SOLVED: `if (A) { X = v; } ... X = v;` — conditional assign whose
store is killed by a later unconditional assign → MWCC keeps lbz+cmplwi, drops bne.
Applied: `if (flags[2]==1) { fileFd = -1; } if (fileOpened) NANDClose; fileFd = -1;`
reproduces orig's exact `lbz;cmplwi;lwz;cmpwi;beq` sequence (-8B wall gone).
- file_done label placement: label sits BEFORE the flags-if (inner gotos land past it,
outer bne/beq edges land on it) — `file_done:` above the fossil if.
- result=0 redundant-store dedup inside `if (path==0)` arm: orig omits it (already 0).
- &headerBlock member-address chains: orig emits `addi r3,r1,0x340; addi r3,r3,+off`
(remat base + member offset) for deviceId/cidx/deviceMac args. Best source form =
`WADBackupHeader* headerBlockHeader = &headerBlock.header` used for the three
member args → `addi r3,r18,+off` (structurally right; r18-kept vs orig remat =
keep-vs-remat wall). `(&x)->y` and `x.y` fold to absolute; per-site ptr assigns
fold remat+offset — all worse.
- Remaining diffs (all documented keep-vs-remat/web-coloring): `li 0;stw` vs `li;mr`
for result head store, `addi r1,0x340` remats vs r18/mr, stw 0x814/lwz 0x80c spill
webs, `li -1` fileFd slot, addi+0x80 loop-IV position, `addi r1,0x3c0` remat order.