Compare commits

..

3 Commits

Author SHA1 Message Date
devin
5516ac7f3f decomp: iplSetting copy-assign + AOSS/ATERM decode via NOVTABLE gate (stays NonMatching)
iplSetting fuzzy 99.29->99.70, AOSS 96.78->97.32, ATERM 96.62->96.66.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:33:46 +00:00
devin-ai-integration[bot]
3aa9daf94a decomp: emission gates for iplSDChannelTitle + MemoryCardManager decodes (#972)
IPL_SD_CHANNEL_TITLE_CPP gates move inline members to declarations so the
TU emits non-inlined calls like retail (same dedup-loss pattern as
#834's vtable restoration): iplInterporation::get, math::VEC3 ctor,
FaderSceneBase::initCalcNormal/calcCommonAfter, SceneBase::isReady/
isResetProcessDone/getParent/getChild/getNext/getPrev, NANDTask::
isFinished/checkData, Graphics::setOrthoTrans/setOrthoScale,
ut::Rect/RuntimeTypeInfo.

Verified vs main: iplSDChannelTitle 68/69 fns byte-exact (152B tail
residual in iplSDChannelTitle_flushSaveBeforeExit), iplMemoryCardManager
18/26. Units stay NonMatching; documented walls in revisit.attempts.md.

Co-authored-by: devin <devin@cognition.ai>
Co-authored-by: coah80 <usernamecole7@gmail.com>
2026-10-02 17:22:10 -05:00
coah
dc48b109b0 match(odh): cdj_d_decompressLoop byte-identical (#971)
Keep the updated 2x2 plane in requiredBlockEnd so MWCC uses r15 for the
plane and r16 for the block end. 899/899, 0 diffs.
2026-10-02 17:15:30 -05:00
20 changed files with 338 additions and 148 deletions

View File

@@ -20,7 +20,7 @@ namespace gui {
class Manager;
class EventHandler;
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
class __declspec(novtable) Interface {
#else
class Interface {
@@ -34,14 +34,14 @@ namespace gui {
virtual void draw(Mtx& mtx) {} // 0x14 (0x05)
virtual void draw() {} // 0x18 (0x06)
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
virtual ~Interface(); // 0x1C (0x07)
#else
virtual ~Interface() {} // 0x1C (0x07)
#endif
};
#if defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
#if defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
class __declspec(novtable) EventHandler {
#else
class EventHandler {

View File

@@ -24,7 +24,7 @@ namespace ipl {
mbDisableCon(bDisableCon) {}
#endif
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
virtual ~PaneManager();
#else
virtual ~PaneManager() {}

View File

@@ -163,6 +163,9 @@ 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;
@@ -181,6 +184,7 @@ 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)
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {

View File

@@ -31,8 +31,12 @@ namespace ipl {
virtual void calc();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void initCalcNormal();
#else
virtual void initCalcNormal() {
} // 0x4C
#endif
virtual void initCalcFadeout() {
} // 0x50
@@ -49,8 +53,12 @@ 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,7 +62,11 @@ 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
@@ -73,7 +77,11 @@ 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() {}
@@ -86,10 +94,17 @@ 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,8 +65,13 @@ 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,12 +51,17 @@ 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:
#ifdef IPL_SOUND_RECT_OUT_OF_LINE
#if defined(IPL_SOUND_RECT_OUT_OF_LINE) || defined(IPL_SD_CHANNEL_TITLE_CPP)
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)
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP) && !defined(IPL_SD_CHANNEL_TITLE_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)
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
TDerived DynamicCast(TBase* pPtr);
#else
inline TDerived DynamicCast(TBase* pPtr) {

View File

@@ -242,64 +242,14 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
extern vu32 BS2VideoMode;
extern vu32 __DVDLayoutFormat;
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
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);
}
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
@@ -853,7 +803,7 @@ void BS2StartGCGame() {
OSTime time;
StartingGame = TRUE;
while (CoverBlock.state != DVD_STATE_IDLE) {
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
}
soundMode = SCGetSoundMode();
@@ -1846,12 +1796,11 @@ invalidRvlRegion:
State = BS2_STT_RESET_SYSTEM;
break;
}
if (GamePartition != 0)
State = BS2_STT_37;
else {
if (GamePartition == 0) {
State = BS2_STT_54;
break;
}
State = BS2_STT_37;
case 0x25:
if (BS2BootFromCache != 0) {
BS2Report("Open partition from cache.dat\n");

View File

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

View File

@@ -3,6 +3,10 @@
#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"
@@ -1554,15 +1558,5 @@ 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

@@ -616,6 +616,17 @@ int AOSS_Init_old(AOSSInitInput* input)
s_accessPointList = 0;
}
resultCode = 0xffffffff;
} else if (state != 0) {
input->status = 0xf;
if (s_accessPointConfig) {
AOSSi_Free(s_accessPointConfig);
s_accessPointConfig = (int *)0x0;
}
if (s_accessPointList) {
AOSSi_Free(s_accessPointList);
s_accessPointList = 0;
}
resultCode = 0xffffffff;
} else {
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
if (s_accessPointConfig == 0) {
@@ -801,7 +812,7 @@ perform_request:
if (s_socketStarted == 1) {
s_socketStarted = 0;
requestResult = SOCleanup();
if (-1 < requestResult) goto request_socket_cleanup_complete;
if (0 <= requestResult) goto request_socket_cleanup_complete;
requestResult = -1;
}
else {
@@ -874,7 +885,7 @@ request_socket_cleanup_complete:
resultCode = 0xffffffff;
goto finish_initialization;
}
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
if ((requestResult == 0) && ((u32)*s_accessPointConfig == 1u)) break;
remainingWait = waitIntervals.limits.response;
for (; remainingWait != 0; remainingWait -= initialSleep) {
if (AOSSi_cancel_flag == 1) {
@@ -1028,11 +1039,9 @@ request_socket_cleanup_complete:
if (0 < requestResult) goto process_received_packet;
receivedPackets = receivedPackets + 1;
if (receivedPackets > attemptCount) {
switch (protocolState) {
case 0: s_errorCode = 0xf; break;
case 1: s_errorCode = 0x10; break;
default: s_errorCode = 0x11; break;
}
if (protocolState == 0) s_errorCode = 0xf;
else if (protocolState == 1) s_errorCode = 0x10;
else s_errorCode = 0x11;
protocolResult = -1;
goto close_protocol_socket;
}
@@ -1220,7 +1229,7 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
if ((state == 0) && (*s_accessPointConfig == 1)) break;
if ((state == 0) && ((u32)*s_accessPointConfig == 1u)) break;
remainingWait = waitIntervals.limits.response;
for (; remainingWait != 0; remainingWait -= initialSleep) {
if (AOSSi_cancel_flag == 1) {
@@ -1299,11 +1308,9 @@ wait_for_packet:
}
protocolState = requestResult;
if (receivedPackets > waitSettings.halfwords.high) {
switch (requestResult) {
case 0: s_errorCode = 0xf; break;
case 1: s_errorCode = 0x10; break;
default: s_errorCode = 0x11; break;
}
if (requestResult == 0) s_errorCode = 0xf;
else if (requestResult == 1) s_errorCode = 0x10;
else s_errorCode = 0x11;
protocolResult = -1;
goto close_protocol_socket;
}
@@ -1322,10 +1329,9 @@ wait_for_packet:
resultCode = 0xffffffff;
goto finish_initialization;
}
if (retryDelay > 100) AOSSi_Sleep(100);
else AOSSi_Sleep(retryDelay);
if (retryDelay > 100) delayStep = 100;
else delayStep = retryDelay;
AOSSi_Sleep(retryDelay > 100 ? 100 : retryDelay);
if (retryDelay <= 100) delayStep = retryDelay;
else delayStep = 100;
}
if (AOSSi_cancel_flag == 1) {
input->status = 0xf;
@@ -1350,7 +1356,7 @@ close_protocol_socket:
if (s_socketStarted == 1) {
s_socketStarted = 0;
state = SOCleanup();
if (-1 < state) goto protocol_socket_cleanup_complete;
if (0 <= state) goto protocol_socket_cleanup_complete;
state = -1;
}
else {

View File

@@ -1547,6 +1547,7 @@ s32 ATERMRunConfigProtocol(void) {
break;
case 5:
{
s32 messageLength;
u8 optionIds[7] = {6, 0, 1, 2, 3, 4, 5};
AtermRequestOption8* shortOption = (AtermRequestOption8*)gAtermRequestOptions;
AtermRequestOption16* longOption;
@@ -1589,13 +1590,14 @@ s32 ATERMRunConfigProtocol(void) {
longOption++;
}
optionEnd = (u8*)longOption;
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 2,
messageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 2,
(u16*)response->data, optionEnd - gAtermRequestOptions + 8, NULL);
gAtermMessageLength = messageLength;
sendAddress.length = 8;
sendAddress.family = 2;
sendAddress.address = 0xFFFFFFFF;
sendAddress.port = SOHtoNs(0xE601);
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, messageLength, 0, &sendAddress);
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
gAtermProtocolState = 6;
break;
@@ -1656,6 +1658,10 @@ s32 ATERMRunConfigProtocol(void) {
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
u32 index;
u32 digestBytes;
u32 state0;
u32 state1;
u32 state2;
u32 state3;
memcpy(response->authentication.challenge,
optionValue, 8);
digestContext.bitCountHigh = 0;
@@ -1677,22 +1683,26 @@ s32 ATERMRunConfigProtocol(void) {
ATERMMd5Update(&digestContext, gAtermDigestFill,
digestBytes < 56 ? 56 - digestBytes : 120 - digestBytes);
ATERMMd5Update(&digestContext, digestLength, sizeof(digestLength));
response->authentication.digest[0] = digestContext.state[0];
response->authentication.digest[1] = digestContext.state[0] >> 8;
response->authentication.digest[2] = digestContext.state[0] >> 16;
response->authentication.digest[3] = digestContext.state[0] >> 24;
response->authentication.digest[4] = digestContext.state[1];
response->authentication.digest[5] = digestContext.state[1] >> 8;
response->authentication.digest[6] = digestContext.state[1] >> 16;
response->authentication.digest[7] = digestContext.state[1] >> 24;
response->authentication.digest[8] = digestContext.state[2];
response->authentication.digest[9] = digestContext.state[2] >> 8;
response->authentication.digest[10] = digestContext.state[2] >> 16;
response->authentication.digest[11] = digestContext.state[2] >> 24;
response->authentication.digest[12] = digestContext.state[3];
response->authentication.digest[13] = digestContext.state[3] >> 8;
response->authentication.digest[14] = digestContext.state[3] >> 16;
response->authentication.digest[15] = digestContext.state[3] >> 24;
state0 = digestContext.state[0];
state1 = digestContext.state[1];
state2 = digestContext.state[2];
state3 = digestContext.state[3];
response->authentication.digest[0] = state0;
response->authentication.digest[1] = state0 >> 8;
response->authentication.digest[2] = state0 >> 16;
response->authentication.digest[3] = state0 >> 24;
response->authentication.digest[4] = state1;
response->authentication.digest[5] = state1 >> 8;
response->authentication.digest[6] = state1 >> 16;
response->authentication.digest[7] = state1 >> 24;
response->authentication.digest[8] = state2;
response->authentication.digest[9] = state2 >> 8;
response->authentication.digest[10] = state2 >> 16;
response->authentication.digest[11] = state2 >> 24;
response->authentication.digest[12] = state3;
response->authentication.digest[13] = state3 >> 8;
response->authentication.digest[14] = state3 >> 16;
response->authentication.digest[15] = state3 >> 24;
{
u8* contextByte = (u8*)&digestContext;
for (index = 0; index < sizeof(digestContext); index++) {
@@ -1720,6 +1730,7 @@ s32 ATERMRunConfigProtocol(void) {
{
AtermRequestOption16* option = (AtermRequestOption16*)response->authentication.decoded.options;
AtermSocketAddress sendAddress;
s32 messageLength;
memset(response->data, 0, 8);
memset(option, 0, 4);
option->type = SOHtoNs(0x102);
@@ -1728,13 +1739,14 @@ s32 ATERMRunConfigProtocol(void) {
memcpy(option->value, response->authentication.digest, 8);
gAtermReplyLength = (u8*)(option + 1) - response->data;
response->authentication.decoded.length = gAtermReplyLength - 8;
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 4,
messageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 4,
(u16*)response->data, gAtermReplyLength, gAtermConfigurationResult.connectionPrefix);
gAtermMessageLength = messageLength;
sendAddress.length = 8;
sendAddress.family = 2;
sendAddress.address = 0xFFFFFFFF;
sendAddress.port = SOHtoNs(0xE601);
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, messageLength, 0, &sendAddress);
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
memset(&gScanSettings, 0, 0x254);
gAtermProtocolState = 8;

View File

@@ -1,3 +1,4 @@
#define IPL_SETTING_NOVTABLE
#define IPL_SETTING_RECT_OUT_OF_LINE
#define IPL_SETTING_IMPLEMENTATION
#include "scene/setting/iplSetting.h"
@@ -1509,7 +1510,8 @@ namespace ipl {
}
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
GXRenderModeObj renderMode = *System::getRenderModeObj();
GXRenderModeObj renderMode;
renderMode = *System::getRenderModeObj();
u32 left;
u32 top;
u32 width;

View File

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

View File

@@ -0,0 +1,18 @@
# 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

@@ -0,0 +1,130 @@
# 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

@@ -0,0 +1,48 @@
# setting leaf — attempt log
## Decode landed this wave
### iplSetting::draw — struct-copy emission split (91.53 → 97.69, unit 99.29 → 99.70)
`GXRenderModeObj renderMode = *System::getRenderModeObj();` emitted a memcpy-style
word-copy loop (lwzu/stwu, ~8 insns). Orig emits a memberwise copy (lhz/sth for u16
fields, lwz/stw for u32, lbz/stb for the u8 arrays — ~30 insns).
Fix: split declaration from assignment:
```
GXRenderModeObj renderMode;
renderMode = *System::getRenderModeObj();
```
Copy-INITIALIZATION of a C++ POD goes through MWCC's aggregate/memcpy path;
copy-ASSIGNMENT expands memberwise. draw now 629 vs orig 632 insns.
### AOSS_Init_old (prior session, committed this wave)
dead-but-emitted else arm (`else if (state != 0)` chained-beq form), `0 <= x`
bound form, `(u32)*ptr == 1u` cast, two switch→if/else decodes, ternary-arg Sleep.
## Walls verified (ties, not structure)
### scanAP — `subi+cntlzw` bool-materialization family (3 sites)
`if (!mpMainLayout->getAnim(i)->isPlaying())` — orig materializes the callee's
bool (`addi r0,r3,-1; cntlzw; rlwinm. r0,r0,27,5,31; bne`), mine fuses to
`cmpwi 1; beq`. Tried: bool local, named Animator* local, `== true`, `== false`,
`!= 0` on the inline's return, `AnimState`-typed and `u32`-typed mState —
MWCC folds every form to the direct compare. No out-of-line isPlaying exists on
either side. Residual also includes 2-3 insns of lwz/addi scheduling ties.
### convertRevIP (98.70)
Normalized-identical instruction stream (73=73 insns); fuzzy residual is a
word-level register binding — regname family.
### draw residual (97.69, -3 insns)
Two clusters: a `bne`/`beq+lbz+b` 3-insn branch-layout diff around the
browserWindow guard (O56-62), and an int→f32 divide/store scheduling window
(`srawi/stw/lfd/fsubs/fmr`, O275-293). The `beq '#F'` diffs in the normalized
log are normalization artifacts (branch-target immediates), not real diffs.
### AOSS/AOSSSendHelloRequest
Identical unrolled CRC x8 structure verified; residual is table-base pinning.
### ATERM Md5Update
Index-form kept (fuzzy 91.26 > pointer-walk 84.21 — fuzzy is positional).
## Owner ruling (PR #973)
Dead objects that only pad a section are forbidden; unreferenced .sbss/.data
gaps stay unowned unless a target relocation references the address.