Compare commits
11 Commits
scene4-cle
...
agent/bitt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
306ff59554 | ||
|
|
813660b96e | ||
|
|
e82417345a | ||
|
|
230c2f8d34 | ||
|
|
524350ed8f | ||
|
|
c62453dac9 | ||
|
|
6b17698b84 | ||
|
|
f9358f6e46 | ||
|
|
3aa9daf94a | ||
|
|
dc48b109b0 | ||
|
|
b6f2304efc |
@@ -37,6 +37,9 @@ force_active:
|
||||
|
||||
# textinput::toolbar::csPaneToAnimation points one past the end of csAninationFile.
|
||||
block_relocations:
|
||||
# Run establishes a fixed stack at 0x81600000, not __pformatter + 0x280.
|
||||
- source: .text:0x8137B468
|
||||
- source: .text:0x8137B46C
|
||||
- source: .data:0x8165E15C
|
||||
- source: .data:0x8165E19C
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -92,18 +92,20 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
dst[0] = val;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
t = b2 - b6;
|
||||
oddLowSum = b5 + b3;
|
||||
b5 = b5 - b3;
|
||||
oddLowDifference = b5 - b3;
|
||||
oddHighSum = b1 + b7;
|
||||
b1 = b1 - b7;
|
||||
oddHighDifference = b1 - b7;
|
||||
u = b6 + b2;
|
||||
t = t * 0xB5 >> 8;
|
||||
x_factor = oddHighSum - oddLowSum;
|
||||
z_factor = b5 + b1;
|
||||
z_factor = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
a = dcValue - b4;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
@@ -113,14 +115,14 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
z = z_factor * 0x62 >> 8;
|
||||
w = d + u;
|
||||
y = d - u;
|
||||
m_part = b1 * 0x14E >> 8;
|
||||
m_part = oddHighDifference * 0x14E >> 8;
|
||||
e = a - t;
|
||||
m = m_part - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
o = x + m;
|
||||
dst[0] = w + n;
|
||||
p_part = b5 * 0x8B;
|
||||
p_part = oddLowDifference * 0x8B;
|
||||
dst[7] = w - n;
|
||||
p_part >>= 8;
|
||||
dst[1] = v + o;
|
||||
|
||||
@@ -816,7 +816,6 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
|
||||
u8* luminance;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 value;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 cbValue;
|
||||
@@ -844,17 +843,17 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
|
||||
for (column = x; column < xEnd; column++) {
|
||||
cbValue = (s8)*cb++;
|
||||
crValue = (s8)*cr++;
|
||||
value = *luminance++;
|
||||
green = value + (-(cbValue * 88 + crValue * 183) >> 8);
|
||||
red = value + ((crValue * 359) >> 8);
|
||||
blue = value + ((cbValue * 454) >> 8);
|
||||
red = *luminance++;
|
||||
green = red + (-(cbValue * 88 + crValue * 183) >> 8);
|
||||
blue = red + ((cbValue * 454) >> 8);
|
||||
red = red + ((crValue * 359) >> 8);
|
||||
if ((blue | green | red) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
output[(column & 3) + (((column >> 2) + tileRow) << 4)] =
|
||||
((blue & 0xF8) >> 3) + ((red & 0xF8) << 8) + ((green & 0xFC) << 3);
|
||||
((blue & 0xF8) >> 3) + (((red & 0xF8) << 8) + ((green & 0xFC) << 3));
|
||||
}
|
||||
luminance += rowSkip;
|
||||
cb += rowSkip;
|
||||
|
||||
@@ -656,10 +656,10 @@ static void TMCJPEGDEC_converterYUV420toRGBA8edge(TMCCJPEGDecWork* work, s32 x,
|
||||
blueOffset = (cbValue * 454) >> 8;
|
||||
}
|
||||
{
|
||||
s32 value = *luminance++;
|
||||
s32 green = value + greenOffset;
|
||||
s32 red = value + redOffset;
|
||||
s32 blue = value + blueOffset;
|
||||
s32 red = *luminance++;
|
||||
s32 green = red + greenOffset;
|
||||
s32 blue = red + blueOffset;
|
||||
red = red + redOffset;
|
||||
if ((green | red | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
|
||||
@@ -920,8 +920,7 @@ selectDictionary:
|
||||
if ((((wordLength == 0) && (*punctuationCursor != 0)) && (dictionaryExact != 0)) &&
|
||||
((((ZiAlphaWork*)workData)->singleCharacter != 0 && (parameters->elementCount == 2)))) {
|
||||
*wordCursor = ((ZiAlphaWork*)workData)->singleCharacter;
|
||||
wordCursor[1] = *punctuationCursor;
|
||||
punctuationCursor = punctuationCursor + 1;
|
||||
wordCursor[1] = *punctuationCursor++;
|
||||
wordCursor[2] = 0;
|
||||
wordLength = 2;
|
||||
}
|
||||
@@ -1208,10 +1207,8 @@ emitCandidate:
|
||||
if (((ZiAlphaOptions*)optionData)->maxResults <= candidateCount) goto finishCandidates;
|
||||
} else {
|
||||
if (((ZiAlphaOptions*)optionData)->lookupMode != '\0') {
|
||||
for (index = 0;
|
||||
(index <= (int)wordLength &&
|
||||
(wordCursor[index] == ((ZiAlphaOptions*)optionData)->dictionary[index]));
|
||||
index = index + 1) {
|
||||
for (index = 0; index <= wordLength; index++) {
|
||||
if (wordCursor[index] != ((ZiAlphaOptions*)optionData)->dictionary[index]) break;
|
||||
}
|
||||
if ((((((ZiAlphaWork*)workData)->operation != '\0') || ((int)wordLength <= index))
|
||||
&& ((((ZiAlphaWork*)workData)->operation == '\0' ||
|
||||
@@ -1382,21 +1379,17 @@ finishDictionaryPass:;
|
||||
}
|
||||
if (((candidateCount == 0) && (punctuationCandidate)) && (firstCandidate == 0)) {
|
||||
candidateCount = 1;
|
||||
if ((((ZiAlphaOptions*)optionData)->countOnly == '\0') && ((parameters->getOptions & 0xfd) != 0x81)) {
|
||||
*encodedOutput = 0x3e;
|
||||
encodedOutput[2] = 0;
|
||||
encodedOutput[1] = 0;
|
||||
}
|
||||
else {
|
||||
if (((ZiAlphaOptions*)optionData)->countOnly != 0 || (parameters->getOptions & 0xFD) == 0x81) {
|
||||
if (parameters->getMode == 1) {
|
||||
*wordCursor = *elements;
|
||||
} else {
|
||||
*wordCursor = 0x3E;
|
||||
}
|
||||
else {
|
||||
*wordCursor = 0x3e;
|
||||
}
|
||||
wordCursor[2] = 0;
|
||||
wordCursor[1] = 0;
|
||||
wordCursor = wordCursor + 2;
|
||||
wordCursor[1] = wordCursor[2] = 0;
|
||||
wordCursor += 2;
|
||||
} else {
|
||||
*encodedOutput = 0x3E;
|
||||
encodedOutput[1] = encodedOutput[2] = 0;
|
||||
}
|
||||
if (((ZiAlphaOptions*)optionData)->lookupMode == '\0') {
|
||||
((ZiAlphaWork*)workData)->singleCharacter = 0;
|
||||
|
||||
@@ -242,14 +242,63 @@ 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);
|
||||
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
|
||||
|
||||
// The application stack is fixed; it is unrelated to the formatter.
|
||||
lis r1, 0x8160
|
||||
ori r1, r1, 0
|
||||
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 +852,7 @@ void BS2StartGCGame() {
|
||||
OSTime time;
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
soundMode = SCGetSoundMode();
|
||||
@@ -1796,11 +1845,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");
|
||||
|
||||
@@ -7207,7 +7207,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
u32 cmpLow;
|
||||
struct {
|
||||
CHANSVmObjType operandTypes[2];
|
||||
u64 floatBits;
|
||||
double floatLiteral;
|
||||
CHANSVmObjHdr copies[2];
|
||||
CHANSVmObjHdr load;
|
||||
CHANSVmObjHdr operand;
|
||||
@@ -7291,8 +7291,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
case CHANS_VM_OP_LOAD_FLOAT: {
|
||||
opSize = 9;
|
||||
operandBuf = VmGetOperand(vm, 1, 9);
|
||||
memcpy(&scratch.floatBits, operandBuf, 8);
|
||||
result = CHANSVmSetFloat(vm, &pVm->accumulator, *(double*)&scratch.floatBits);
|
||||
memcpy(&scratch.floatLiteral, operandBuf, 8);
|
||||
result = CHANSVmSetFloat(vm, &pVm->accumulator, scratch.floatLiteral);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7769,8 +7769,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
arrayIdx = (u32)stackPtr->value.int_v;
|
||||
goto set_index_ok;
|
||||
case CHANS_VM_OBJ_TYPE_FLOAT: {
|
||||
double stackFloat = *(double*)stackPtr;
|
||||
if (stackFloat <= 4294967294.0 && 0.0 <= stackFloat) {
|
||||
double stackFloat = stackPtr->value.float_v;
|
||||
if (stackFloat >= 0.0 && stackFloat <= 4294967294.0) {
|
||||
arrayIdx = (u32)stackFloat;
|
||||
goto set_index_ok;
|
||||
}
|
||||
@@ -8004,34 +8004,27 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
|
||||
if (pVm->pActiveCtx->stackDepth != 0 && pVm->pObjStackTopBuf + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) {
|
||||
CHANSVmObjHdr* stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
|
||||
isTypeMatch = 0;
|
||||
if (pVm->accumulator.type == stackTop->type) {
|
||||
if (stackTop->type == pVm->accumulator.type) {
|
||||
switch (stackTop->type) {
|
||||
case CHANS_VM_OBJ_TYPE_INTEGER: {
|
||||
u32 low1 = *(u32*)stackTop;
|
||||
u32 low2 = *(u32*)&pVm->accumulator;
|
||||
u32 high1 = *((u32*)stackTop + 1);
|
||||
u32 high2 = *((u32*)&pVm->accumulator + 1);
|
||||
u32 xor1 = low1 ^ low2;
|
||||
u32 xor2 = high1 ^ high2;
|
||||
isTypeMatch = !(xor1 | xor2);
|
||||
isTypeMatch = stackTop->value.int_v == pVm->accumulator.value.int_v;
|
||||
goto end_branch_check;
|
||||
}
|
||||
case CHANS_VM_OBJ_TYPE_FLOAT: {
|
||||
double stackFloat = stackTop->value.float_v;
|
||||
double accFloat = pVm->accumulator.value.float_v;
|
||||
isTypeMatch = stackFloat == accFloat ? 1 : 0;
|
||||
isTypeMatch = stackTop->value.float_v == pVm->accumulator.value.float_v;
|
||||
goto end_branch_check;
|
||||
}
|
||||
case CHANS_VM_OBJ_TYPE_STRING: {
|
||||
u32 len1, len2;
|
||||
CHANSVmObjHdr* stackObj = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
|
||||
const vmWStringObjVal* accumulatorString = pVm->accumulator.value.wstring_v;
|
||||
const vmWStringObjVal* stackString = stackTop->value.wstring_v;
|
||||
u32 strEqual;
|
||||
isTypeMatch = 0;
|
||||
len1 = stackObj->value.wstring_v->len;
|
||||
len2 = pVm->accumulator.value.wstring_v->len;
|
||||
len1 = stackString->len;
|
||||
len2 = accumulatorString->len;
|
||||
if (len1 == len2) {
|
||||
strEqual = 0;
|
||||
if (len1 == 0 || memcmp(stackObj->value.wstring_v->spData, pVm->accumulator.value.wstring_v->spData, len1) == 0) {
|
||||
if (len1 == 0 || memcmp(stackString->spData, accumulatorString->spData, len1) == 0) {
|
||||
strEqual = 1;
|
||||
}
|
||||
if (strEqual) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1379,30 +1379,34 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
ext_ead::www::BrowserThread* browser = surface->GetBrowserThread();
|
||||
if (browser == NULL) {
|
||||
// One pointer, overwritten by the standard-buffer fetch, so the
|
||||
// browser `this` and standardBuffer share a callee-saved reg.
|
||||
void* held = surface->GetBrowserThread();
|
||||
if (held == NULL) {
|
||||
return;
|
||||
}
|
||||
if (browser->GetTextureBuffer(0, NULL) == NULL) {
|
||||
if (static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ext_ead::www::BrowserWindow* browserWindow =
|
||||
static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
|
||||
if ((browserWindow != NULL ? browserWindow->unk_0x2C4[3] : 0) != 0) {
|
||||
static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]);
|
||||
if ((browserWindow == NULL ? 0 : browserWindow->unk_0x2C4[3]) != 0) {
|
||||
unk_0x91C[2] = 1;
|
||||
mState = 0;
|
||||
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
|
||||
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]);
|
||||
if (browserWindow != NULL) {
|
||||
browserWindow->unk_0x2C4[3] = 0;
|
||||
}
|
||||
www::trasition::ScrollState scrollState = www::trasition::GetScrollState();
|
||||
browserScrollDirection = scrollState == www::trasition::SCROLL_LEFT
|
||||
? 1
|
||||
: (scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0);
|
||||
if (scrollState == www::trasition::SCROLL_LEFT) {
|
||||
browserScrollDirection = 1;
|
||||
} else {
|
||||
browserScrollDirection = scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0;
|
||||
}
|
||||
www::trasition::ResetScrollState();
|
||||
void* changedWideBuffer = browser->GetTextureBuffer(1, NULL);
|
||||
void* changedStandardBuffer = browser->GetTextureBuffer(0, NULL);
|
||||
void* changedWideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, NULL);
|
||||
void* changedStandardBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL);
|
||||
OSReport("changed %p %p\n", changedStandardBuffer, changedWideBuffer);
|
||||
ext_ead::www::Heap::reportLeaHeap();
|
||||
}
|
||||
@@ -1415,8 +1419,9 @@ namespace ipl {
|
||||
|
||||
WWWRect* standardRect;
|
||||
WWWRect* wideRect;
|
||||
void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
|
||||
void* standardBuffer = browser->GetTextureBuffer(0, &standardRect);
|
||||
void* wideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, &wideRect);
|
||||
held = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, &standardRect);
|
||||
void* standardBuffer = held;
|
||||
nw4r::ut::Rect projection4x3;
|
||||
System::getProjectionRect4x3(&projection4x3);
|
||||
int screenWidth = abs(static_cast<int>(projection4x3.GetWidth()));
|
||||
@@ -1443,33 +1448,33 @@ namespace ipl {
|
||||
int wideWidth = abs(static_cast<int>(projection16x9.GetWidth()));
|
||||
int wideHeight = abs(static_cast<int>(projection16x9.GetHeight()));
|
||||
f32 wideLeft = -wideWidth / 2;
|
||||
f32 wideTop = wideHeight / 2;
|
||||
f32 wideTopL = wideHeight / 2;
|
||||
f32 wideRight = wideWidth / 2;
|
||||
nw4r::ut::Rect leftSide(wideLeft, wideTop,
|
||||
f32 wideTopR = wideHeight / 2;
|
||||
nw4r::ut::Rect leftSide(wideLeft, wideTopL,
|
||||
wideLeft + sideDescriptor->textureHeader->width,
|
||||
wideTop - sideDescriptor->textureHeader->height);
|
||||
wideTopL - sideDescriptor->textureHeader->height);
|
||||
nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width,
|
||||
wideTop, wideRight, wideTop - sideDescriptor->textureHeader->height);
|
||||
|
||||
wideTopR, wideRight, wideTopR - sideDescriptor->textureHeader->height);
|
||||
if (browserScrollDirection != 0) {
|
||||
nw4r::lyt::Material* wideMaterial =
|
||||
void* wideMaterial =
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0");
|
||||
nw4r::lyt::Material* firstStandardMaterial =
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1");
|
||||
nw4r::lyt::Material* secondStandardMaterial =
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2");
|
||||
wideMaterial->SetTexture(0, wideTexture);
|
||||
static_cast<nw4r::lyt::Material*>(wideMaterial)->SetTexture(0, wideTexture);
|
||||
firstStandardMaterial->SetTexture(0, standardTexture);
|
||||
secondStandardMaterial->SetTexture(0, standardTexture);
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
|
||||
if (browserScrollDirection == 1) {
|
||||
utility::FrameController* animation = mpSecondAnimation;
|
||||
animation->initFrame();
|
||||
animation->restart();
|
||||
wideMaterial = mpSecondAnimation;
|
||||
static_cast<utility::FrameController*>(wideMaterial)->initFrame();
|
||||
static_cast<utility::FrameController*>(wideMaterial)->restart();
|
||||
} else {
|
||||
utility::FrameController* animation = mpFirstAnimation;
|
||||
animation->initFrame();
|
||||
animation->restart();
|
||||
wideMaterial = mpFirstAnimation;
|
||||
static_cast<utility::FrameController*>(wideMaterial)->initFrame();
|
||||
static_cast<utility::FrameController*>(wideMaterial)->restart();
|
||||
}
|
||||
mpChangeLayout->calc();
|
||||
browserScrollDirection = 0;
|
||||
@@ -1509,13 +1514,44 @@ namespace ipl {
|
||||
}
|
||||
|
||||
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
|
||||
GXRenderModeObj renderMode = *System::getRenderModeObj();
|
||||
GXRenderModeObj* pRmode = System::getRenderModeObj();
|
||||
GXRenderModeObj renderMode;
|
||||
volatile GXRenderModeObj* srcMode = pRmode;
|
||||
volatile GXRenderModeObj* dstMode = &renderMode;
|
||||
int n = 12;
|
||||
u8* src;
|
||||
u8* dst = &renderMode.aa;
|
||||
src = &pRmode->aa;
|
||||
dstMode->viTVmode = srcMode->viTVmode;
|
||||
dstMode->fbWidth = srcMode->fbWidth;
|
||||
dstMode->efbHeight = srcMode->efbHeight;
|
||||
dstMode->xfbHeight = srcMode->xfbHeight;
|
||||
dstMode->viXOrigin = srcMode->viXOrigin;
|
||||
dstMode->viYOrigin = srcMode->viYOrigin;
|
||||
dstMode->viWidth = srcMode->viWidth;
|
||||
dstMode->viHeight = srcMode->viHeight;
|
||||
dstMode->xFBmode = srcMode->xFBmode;
|
||||
dstMode->field_rendering = srcMode->field_rendering;
|
||||
dstMode->aa = srcMode->aa;
|
||||
for (; n != 0; n--) {
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
dstMode->vfilter[0] = srcMode->vfilter[0];
|
||||
dstMode->vfilter[1] = srcMode->vfilter[1];
|
||||
dstMode->vfilter[2] = srcMode->vfilter[2];
|
||||
dstMode->vfilter[3] = srcMode->vfilter[3];
|
||||
dstMode->vfilter[4] = srcMode->vfilter[4];
|
||||
dstMode->vfilter[5] = srcMode->vfilter[5];
|
||||
dstMode->vfilter[6] = srcMode->vfilter[6];
|
||||
u32 left;
|
||||
u32 top;
|
||||
u32 width;
|
||||
u32 height;
|
||||
GXGetScissor(&left, &top, &width, &height);
|
||||
GXSetScissor(0, renderMode.efbHeight / 2 - 0xA4, renderMode.fbWidth, 0x132);
|
||||
GXSetScissor(0, dstMode->efbHeight / 2 - 0xA4, dstMode->fbWidth, 0x132);
|
||||
mpMainLayout->draw();
|
||||
GXSetScissor(left, top, width, height);
|
||||
}
|
||||
|
||||
@@ -931,17 +931,15 @@ void CArGBAOdh::cdj_c_makeHeader(SArCDJ_OdhMaster* master, u32 size) {
|
||||
}
|
||||
|
||||
s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int format) {
|
||||
u32 paddedWidth;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u8* workPlane;
|
||||
int sourceStride;
|
||||
u8* crPlane;
|
||||
u8* cbPlane;
|
||||
u8* crPlane;
|
||||
u16* dimensions;
|
||||
int rowIndex;
|
||||
int sourceStride;
|
||||
int i;
|
||||
u16 dimension;
|
||||
u16 paddedDimensions[2];
|
||||
|
||||
dimensions = &master->width;
|
||||
@@ -952,11 +950,11 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
|
||||
height = dimensions[1];
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
dimension = dimensions[i];
|
||||
if ((dimension & 7) != 0) {
|
||||
paddedDimensions[i] = (dimension + 8) - (dimension & 7);
|
||||
u16 remainder = dimensions[i] & 7;
|
||||
if (remainder != 0) {
|
||||
paddedDimensions[i] = (dimensions[i] + 8) - remainder;
|
||||
} else {
|
||||
paddedDimensions[i] = dimension;
|
||||
paddedDimensions[i] = dimensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,13 +970,12 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
|
||||
}
|
||||
}
|
||||
|
||||
paddedWidth = paddedDimensions[0];
|
||||
for (rowIndex = 0; rowIndex < (s32)height; rowIndex++) {
|
||||
LineConv11(sourceData + (rowIndex & 3) * 8 + rowIndex / 4 * sourceStride, workPlane, cbPlane, crPlane,
|
||||
dimensions[0], dimensions[1], (const long*)gArConvPlttTbl, format);
|
||||
workPlane += paddedWidth;
|
||||
cbPlane += paddedWidth;
|
||||
crPlane += paddedWidth;
|
||||
workPlane += paddedDimensions[0];
|
||||
cbPlane += paddedDimensions[0];
|
||||
crPlane += paddedDimensions[0];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1362,12 +1359,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 +1375,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 +1405,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 +1447,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 +1470,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 +1536,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 +1593,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 +1611,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 +1626,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 +1645,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 +1690,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;
|
||||
}
|
||||
|
||||
@@ -978,33 +978,37 @@ namespace ipl {
|
||||
ESMisc::ChangeUid(SYSMENU_TITLE_ID);
|
||||
}
|
||||
|
||||
static inline void DeleteTicketsForce(EGG::Heap* heap, ESTitleId titleId, u8* ticketViews, u32* ticketViewCount) {
|
||||
static inline s32 DeleteTicketsForce(EGG::Heap* heap, ESTitleId titleId, u8* ticketViews, u32* ticketViewCount) {
|
||||
ESTicketView* ticketViewList = NULL;
|
||||
s32 ret;
|
||||
memset(ticketViews, 0, OSRoundUp32B(sizeof(ESTicketView)));
|
||||
ret = ES_GetTicketViews(titleId, NULL, ticketViewCount);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
|
||||
} else if (*ticketViewCount != 0) {
|
||||
ticketViewList = (ESTicketView*)heap->alloc(*ticketViewCount * OSRoundUp32B(sizeof(ESTicketView)), -DEFAULT_ALIGN);
|
||||
ret = ES_GetTicketViews(titleId, ticketViewList, ticketViewCount);
|
||||
goto cleanup;
|
||||
}
|
||||
if (*ticketViewCount == 0) {
|
||||
return ret;
|
||||
}
|
||||
ticketViewList = (ESTicketView*)heap->alloc(*ticketViewCount * OSRoundUp32B(sizeof(ESTicketView)), -DEFAULT_ALIGN);
|
||||
ret = ES_GetTicketViews(titleId, ticketViewList, ticketViewCount);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
|
||||
goto cleanup;
|
||||
}
|
||||
for (u32 j = 0; j < *ticketViewCount; j++) {
|
||||
memcpy(ticketViews, (u8*)ticketViewList + j * sizeof(ESTicketView), sizeof(ESTicketView));
|
||||
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
|
||||
} else {
|
||||
for (u32 j = 0; j < *ticketViewCount; j++) {
|
||||
memcpy(ticketViews, (u8*)ticketViewList + j * sizeof(ESTicketView), sizeof(ESTicketView));
|
||||
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret,
|
||||
((ESTicketView*)ticketViews)->ticketId);
|
||||
}
|
||||
}
|
||||
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret,
|
||||
((ESTicketView*)ticketViews)->ticketId);
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (ticketViewList != NULL) {
|
||||
heap->free(ticketViewList);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline s32 InitSavedata(EGG::Heap* heap) {
|
||||
@@ -1032,20 +1036,23 @@ namespace ipl {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < titleCount; i++) {
|
||||
if ((titleIds[i] & 0xFFFFFFFFFFFFFF00ULL) == 0x00010000525A4400ULL) {
|
||||
verifySavedataZD(heap, titleIds[i], &fileInfo);
|
||||
continue;
|
||||
}
|
||||
switch (titleIds[i]) {
|
||||
case 0x0001000844495343ULL:
|
||||
case 0x000100014A4F4449ULL:
|
||||
case 0x0001000148415858ULL:
|
||||
case 0x0001000844564458ULL:
|
||||
case 0x000100084449534BULL:
|
||||
ES_DeleteTitle(titleIds[i]);
|
||||
DeleteTicketsForce(heap, titleIds[i], ticketViews, &ticketViewCount);
|
||||
break;
|
||||
{
|
||||
u8* ticketScratch = ticketViews;
|
||||
for (u32 i = 0; i < titleCount; i++) {
|
||||
if ((titleIds[i] & 0xFFFFFFFFFFFFFF00ULL) == 0x00010000525A4400ULL) {
|
||||
verifySavedataZD(heap, titleIds[i], &fileInfo);
|
||||
continue;
|
||||
}
|
||||
switch (titleIds[i]) {
|
||||
case 0x0001000844495343ULL:
|
||||
case 0x000100014A4F4449ULL:
|
||||
case 0x0001000148415858ULL:
|
||||
case 0x0001000844564458ULL:
|
||||
case 0x000100084449534BULL:
|
||||
ES_DeleteTitle(titleIds[i]);
|
||||
DeleteTicketsForce(heap, titleIds[i], ticketScratch, &ticketViewCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# CHANSVm typed comparison reconstruction
|
||||
|
||||
Baseline: ec75ddb0. This candidate is separate from the accepted load-string and opcode-error-path work. Those commits and their logs are unchanged. Only CHANSVm.c and this log changed; no headers, linking classifications, metadata, or original assets changed.
|
||||
|
||||
## Retained reconstruction
|
||||
|
||||
- LOAD_FLOAT copies the eight-byte literal into a double scratch member and passes that value directly. This replaces a u64 temporary followed by a double-pointer reinterpretation. Scratch alignment, member offsets, and emitted code are unchanged.
|
||||
- SET_INDEX reads the floating operand through its union member and checks its lower bound before its upper bound, matching the target's comparison order. The accepted interval remains [0, 4294967294], with NaN and infinities rejected.
|
||||
- Strict integer equality uses the declared 64-bit integer values rather than four offset-based u32 loads and manual XOR/OR expressions.
|
||||
- Strict floating equality uses the declared floating values directly.
|
||||
- Strict string equality uses named, read-only payload pointers rather than recreating a header pointer. The stack operand is consistently first in the outer type comparison, following the target.
|
||||
|
||||
This is structural/type reconstruction, not a newly discovered behavior fix. No register forcing, declaration sweep, or alignment padding was introduced.
|
||||
|
||||
## Target evidence
|
||||
|
||||
After rebuilding, the integer-comparison block (Step instructions 1093-1102), floating-comparison block (1103-1108), string-comparison block (1109-1128), and floating-index block (703-712) have the same instructions, control flow, constants, and memory offsets as the target after register names are normalized. This comparison is advisory: register differences remain, and Step is not exact.
|
||||
|
||||
The floating range's instruction forms now use the target's lower-bound-first order. Integer equality emits the same target ten-instruction two-word equality sequence naturally from the 64-bit value comparison. LOAD_FLOAT retains its original eight-byte copy and call sequence without a pointer reinterpretation.
|
||||
|
||||
## Measurements
|
||||
|
||||
- Instruction-exact functions: 221/233 -> 221/233; no previously exact function regressed.
|
||||
- Unit Decompiled/fuzzy: 99.406320% -> 99.413185%.
|
||||
- Step: 96.913800% -> 96.987230%; 1253/1253 instructions; differing positions 285 -> 276.
|
||||
- Exact code: unchanged at 37608/53564 bytes (70.211334%).
|
||||
- Exact data: unchanged at 6904/6904 bytes (100%).
|
||||
- Per-function score regressions: zero.
|
||||
- Unit remains NonMatching/unlinked, with twelve non-exact functions.
|
||||
|
||||
## Attempts
|
||||
|
||||
- Direct 64-bit equality alone: Step 96.933760%, data 100%; retained for combination.
|
||||
- Typed integer/float/string comparison paths: 96.971270%, data 100%; retained.
|
||||
- Those typed paths plus a separate strict-comparison local error result: 1254 instructions, table relocations moved; rejected.
|
||||
- Floating index member access alone preserves the typed-comparison score. Lower-bound-first range checking raises it to 96.983240%, data 100%; retained.
|
||||
- A union literal temporary produced the same code; simplified to a direct double member instead, also with identical code.
|
||||
- Stack-first type comparison raises Step to 96.987230% with unchanged data; retained.
|
||||
|
||||
## Verification
|
||||
|
||||
- Full 43U build passed with the assigned wrapper and WIBO_SJIS_MISSING_IMPORTS=1.
|
||||
- DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
- pool_diff: all 125 strings identical.
|
||||
- .data: 4672/4672 raw bytes and 352/352 canonical relocations identical.
|
||||
- .rodata: 1432/1432 raw bytes and 258/258 canonical relocations identical.
|
||||
- All 233 functions checked with ctxdiff/odiff: 221 instruction-exact; no falsely exact objdiff functions.
|
||||
- Literal-reference audit: 233 functions analyzed, 40 resolvable call-string arguments checked, no candidates/errors/skips.
|
||||
- Source-extracted host C harnesses passed 20 strict-comparison cases, nine floating-index-bound cases, and eight floating-literal bit patterns. Coverage includes signed integer extremes, differing high words, signed zero, NaN, infinities, strings, references, deletion errors, and literal payload preservation. They stub surrounding dependencies and do not constitute Wii runtime execution.
|
||||
- git diff --check passed.
|
||||
|
||||
Source is paused for independent parent verification.
|
||||
@@ -0,0 +1,65 @@
|
||||
# Alpha output and scan reconstruction follow-on, 2026-10-02
|
||||
|
||||
Parent candidate: `94b7f57e`. Its source/log were left unchanged during
|
||||
independent side experiments. No ABI/header/linking changes are included.
|
||||
Changed source: `libs/RVLMiddleware/eZiText/src/clib/zi8alpha.c` only.
|
||||
|
||||
## Target evidence and retained changes
|
||||
|
||||
- At `Zi8AlphaGetCandidates +0x3178`, the original emits wide-character
|
||||
output before the encoded-byte alternative. The wide path assigns the
|
||||
same zero to output elements 2 and 1 (+0x31A4/+0x31A8), then advances by
|
||||
two characters. The encoded path likewise shares its zero assignment.
|
||||
Restored that positive branch and ordinary chained zero assignments.
|
||||
- The dictionary comparison loop branches from +0x2904 to its bound check
|
||||
at +0x292C. The comparison body exits on a character mismatch at +0x2924;
|
||||
a matched character increments the index at +0x2928. Replaced the merged
|
||||
`for` condition with the corresponding bounded loop and explicit break.
|
||||
- The punctuation output block at +0x1B0C..+0x1B1C reads the current cursor,
|
||||
emits its character and advances that same cursor. Expressed this with
|
||||
`wordCursor[1] = *punctuationCursor++`. It does not reuse a mutated index
|
||||
in another operand or introduce an unsequenced read/write.
|
||||
|
||||
## Independently compiled, isolated trials
|
||||
|
||||
Each trial used the exact 43U MWCC flags from the live Ninja command and a
|
||||
separate object/report under `/tmp/ezi-side`, without altering the reviewed
|
||||
worktree candidate. Report columns below are function fuzzy, unit fuzzy,
|
||||
matched data bytes and exact-function count:
|
||||
|
||||
- Early candidate-skip block: 94.65585, 96.10635, 408, 11; excluded
|
||||
- Wide output first: 94.887985, 96.27548, 516, 11; retained
|
||||
- Next-dictionary switches: 94.4037, 95.92264, 408, 11; excluded
|
||||
- Explicit dictionary-scan break: 94.62088, 96.08087, 516, 11; retained
|
||||
- Combined candidate-count limit: 94.35884, 95.88995, 408, 11; excluded
|
||||
- Punctuation cursor increment: 94.4782, 95.97692, 516, 11; retained
|
||||
- Wide output plus scan: 95.02306, 96.37389, 516, 11
|
||||
- Final three-change subset: 95.02813, 96.37759, 516, 11
|
||||
|
||||
## Full current-worktree validation
|
||||
|
||||
Fresh report: `/tmp/ezi-alpha-followup.json`.
|
||||
Full build log: `/tmp/ezi-alpha-followup-build.log`.
|
||||
Exact functions 11/12 unchanged; exact code 5880/21664 unchanged;
|
||||
exact data 516/564 unchanged. Unit fuzzy 95.97323% -> 96.37759%.
|
||||
Function fuzzy 94.47314% -> 95.02813%, about 88 additional weighted bytes.
|
||||
Relative to initial 449529d9, unit fuzzy improves 94.17892% -> 96.37759%.
|
||||
|
||||
Pool first: identical (no narrow strings in either pool).
|
||||
Main function: 3946/3946 instructions, 0x3DA8 bytes each, frame 0x2B0.
|
||||
Strict ctxdiff remains nonzero (3745 differences), dominated by the known
|
||||
scalar-stack displacement, instruction placement and GPR allocation. No
|
||||
new exact function is claimed. Each of the existing 11 exact functions
|
||||
retains identical instruction counts and ctxdiff diffs 0.
|
||||
|
||||
All non-text section scores match the parent: .rodata, extab and extabindex
|
||||
remain 100%; the existing 48-byte generated switch table remains unmatched.
|
||||
The advisory register-normalized/control-flow alignment checked 701 branch
|
||||
pairs with zero destination mismatches and 73/73 helper calls. This is a
|
||||
coverage check, not an exactness claim.
|
||||
|
||||
Full 43U build succeeds with the approved wrapper and
|
||||
`WIBO_SJIS_MISSING_IMPORTS=1`. DOL SHA1:
|
||||
`26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
`git diff --check` succeeds. No new assembly, volatile workaround, register
|
||||
forcing, undefined value, dummy storage, prototype or shared-header change.
|
||||
@@ -127,3 +127,73 @@ The harness is supplemental behavioral validation, not a retail runtime test.
|
||||
|
||||
GATE: focused decompilation improvement; full 43U/DOL and no-regression checks
|
||||
pass; exact-matching gate remains incomplete at 30/31. No linking claimed.
|
||||
|
||||
## Follow-on: recover the last ESMisc structural differences
|
||||
|
||||
Baseline for this follow-on is the accepted reconstruction `1f9db89d`:
|
||||
30/31 exact functions, function 95.830734%, unit 99.33143%, 446/449 instructions,
|
||||
data 4416/4416. The source/header correction remains intact.
|
||||
|
||||
Natural source attempts, in order:
|
||||
|
||||
| Attempt | Instructions | Function fuzzy | Disposition |
|
||||
| --- | ---: | ---: | --- |
|
||||
| Ticket helper uses error-first cleanup and returns early with no tickets | 446/449 | 95.830734% | Same generated code |
|
||||
| Caller gives aligned ticket scratch an explicit pointer lifetime | 448/449 | 98.004456% | Improved |
|
||||
| Move aligned ticket scratch into the ticket helper | 446/449 | 95.817375% | Rejected |
|
||||
| Scope caller's scratch pointer to successful title enumeration | 448/449 | 98.89755% | Retained |
|
||||
| Restore nested ticket helper with scoped scratch | 448/449 | 98.89755% | Same generated code |
|
||||
| Ticket helper returns its actual ES operation status | 449/449 | 99.14254% | Retained |
|
||||
|
||||
The scratch pointer is initialized only in the block reached after successful
|
||||
second enumeration, and remains live across the title loop. This restores the
|
||||
saved scratch cursor and per-iteration 64-bit mask materialization. No pointer
|
||||
is used before initialization and no artificial use extends its lifetime.
|
||||
|
||||
The private ticket helper now returns the status already obtained from
|
||||
ES_GetTicketViews or ES_DeleteTicket, including its zero-ticket early return
|
||||
and normal cleanup. Its caller intentionally discards that status. The return
|
||||
contract of an independently emitted original helper cannot be established
|
||||
because this helper was fully inlined; this is a natural equivalent source
|
||||
form whose zero-ticket branch structure is confirmed by the target. It does
|
||||
not overwrite the outer enumeration status or change the public ABI further.
|
||||
|
||||
Final ctxdiff: 449/449 instructions, 74 differences. Every mnemonic,
|
||||
non-register operand, stack offset, resolved call target and branch target
|
||||
agrees. The remaining differences are register substitutions, including the
|
||||
title list, scratch cursor, title index, verifier flags and title halves. No
|
||||
register/declaration permutation search was performed after reaching this
|
||||
structural agreement.
|
||||
|
||||
Measurements after a fresh full report:
|
||||
|
||||
- ESMisc exact functions 30/31 -> 30/31
|
||||
- ESMisc exact code 9404/11200 -> 9404/11200
|
||||
- ESMisc fuzzy 99.33143% -> 99.8625%
|
||||
- DeleteUnauthorizedData fuzzy 95.830734% -> 99.14254%
|
||||
- Matched data 4416/4416 -> 4416/4416
|
||||
- Pool: all 114 strings identical
|
||||
- Literal audit: 204 arguments in 30 exact functions, no candidates/errors
|
||||
- Every other unit's full report is unchanged
|
||||
- Full 43U build/check and DOL SHA1 pass:
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
- The same 12 ASan/UBSan host control-flow scenarios pass on helper bodies
|
||||
freshly extracted from this final candidate (LeakSanitizer disabled only
|
||||
for the environment limitation already noted)
|
||||
- git diff --check passes
|
||||
|
||||
This remains a partial matching improvement, not an exact function or unit.
|
||||
|
||||
### Rejected ATERM ownership experiment
|
||||
|
||||
Read-only target evidence identified that the old typed reply view spans the
|
||||
last eight bytes of one BSS object and the following option-buffer allocation.
|
||||
With parent approval, tried a real two-object protocol-workspace aggregate and
|
||||
corresponding narrow metadata consolidation. It preserved storage, addresses,
|
||||
all 17 exact functions and matched data, and reduced the main protocol from
|
||||
972 to 959 instructions (target 951). However, its unit fuzzy regressed from
|
||||
96.624664% to 96.49781%; wider grouping and a decoder-helper experiment also
|
||||
failed the no-regression condition. All ATERM source and symbol metadata were
|
||||
restored. Fresh report after restoration was identical to the accepted ESMisc
|
||||
baseline, and the DOL hash passed. Detailed rejected source/metadata and
|
||||
address evidence were kept privately for future work; none is in this commit.
|
||||
|
||||
23
tools/decomp-assist/attempts/iplSetting-worker3-draw.md
Normal file
23
tools/decomp-assist/attempts/iplSetting-worker3-draw.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# iplSetting worker3 — Setting::draw (Oct 2 2026)
|
||||
|
||||
Worktree: `/workspace/worktrees/iplSetting-draw`
|
||||
Branch: `agent/grok/decomp-worker-3/draw`
|
||||
Unit: `src/scene/setting/iplSetting.cpp` `Setting::draw` only.
|
||||
`scanAP` / `convertRevIP` source not touched. File stays `NonMatching` (not linked).
|
||||
|
||||
## Result
|
||||
|
||||
**632/632 byte-identical** to retail (`draw__Q33ipl5scene7SettingFv`, 2528 bytes, 0 diffs).
|
||||
A HEAD compile of the same TU differs from this object only in `draw`. No sibling codegen change (`-ipa file`).
|
||||
|
||||
## Levers that closed it
|
||||
|
||||
1. `wideTopL` / `wideTopR` as separate locals (no CSE of the int-to-float). Gets `xoris r6,r6` and `fsubs f2`.
|
||||
2. One `void* held` is the browser thread, then overwritten by the standard-buffer fetch, so browser and `standardBuffer` share r31.
|
||||
3. Tex0 material pointer reused as the scroll `FrameController*` (`wideMaterial`), with `initFrame`/`restart` duplicated in each arm.
|
||||
4. Field copy through `volatile GXRenderModeObj*` so loads and stores interleave on r4/r0.
|
||||
5. Sample-pattern loop is direct `dst[1]=src[1]; dst[2]=src[2]` with `src` declared before `dst` is assigned (`u8* src; u8* dst = ...; src = ...`).
|
||||
|
||||
## Not linked
|
||||
|
||||
`configure.py` still has `Object(NonMatching, "scene/setting/iplSetting.cpp")`. DOL SHA1 is unchanged because this TU is not linked. Do not flip the object to Matching until `scanAP` / `convertRevIP` (and the rest of the TU) match.
|
||||
26
tools/decomp-assist/attempts/odh-worker2.md
Normal file
26
tools/decomp-assist/attempts/odh-worker2.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
## colorConv (2026-10-02)
|
||||
|
||||
`cdj_c_colorConv` **77/77, 0 diffs, byte-identical** (308 bytes). Was 18, then 13, then 8.
|
||||
|
||||
- Drop `paddedWidth`. The row loop adds `paddedDimensions[0]`, which hoists `lhz r24` and `lis r23` / `addi r10, r23, 0`.
|
||||
- Pad loop: `u16 remainder = dimensions[i] & 7`, then `(dimensions[i] + 8) - remainder`. Width stays r8, the indexed load stays r7, the mask stays r9. Naming both a dimension and a remainder swaps width off r8.
|
||||
- Declare `sourceStride` after `rowIndex` (cb/cr stay above it). That assigns stride r29 and `cbPlane` r22. Computing stride before the planes shortens the function to 76 and shifts the callee-saves. huffmanDecoder and LineConv11 were not edited. `cdj_d_decompressLoop` stays 899/899.
|
||||
276
tools/decomp-assist/jpeg-remainder-attempts.md
Normal file
276
tools/decomp-assist/jpeg-remainder-attempts.md
Normal file
@@ -0,0 +1,276 @@
|
||||
# JPEG remainder: semantic audit and source-shape reconstruction
|
||||
|
||||
Baseline: `449529d9`, branch `agent/bittle/allhands-jpeg-decompile`, 4.3U only.
|
||||
No remote writes, header changes, configuration changes, linking changes, assembly,
|
||||
volatile forcing, padding, or edits to the separately owned entropy decoder.
|
||||
|
||||
## Result
|
||||
|
||||
All 28 owned functions were already implemented. No semantic mismatch was found
|
||||
in a bounded differential comparison of their current compiled PPC against their
|
||||
original ELF function bodies. This is additional test evidence, not a formal
|
||||
proof of equivalence and not a Wii runtime test.
|
||||
|
||||
Three natural source-shape changes improved the report without a function-score
|
||||
regression:
|
||||
|
||||
- Luminance IDCT now uses explicit odd-coefficient sum/difference temporaries,
|
||||
matching the existing chroma first-pass butterfly. Function fuzzy
|
||||
82.31518 -> 83.05058; 257/257 instructions, 187 ctxdiff differences remain
|
||||
- RGB444 consumes the luminance temporary as the red channel and uses the
|
||||
existing exact edge sibling's red/green packing association. Function fuzzy
|
||||
97.96703 -> 98.71429; 91/91 instructions, 13 ctxdiff differences remain
|
||||
- RGBA420 edge consumes the luminance temporary as red after calculating the
|
||||
other channels. Function fuzzy 87.4 -> 87.458336; 120/120 instructions,
|
||||
77 ctxdiff differences remain
|
||||
|
||||
No new exact matches. This candidate is not an exact-matching or linking result.
|
||||
|
||||
| Unit | Exact before -> after | Fuzzy before -> after | Allocated data |
|
||||
| --- | --- | --- | --- |
|
||||
| Texture_MCUtoRGBA8 | 2/13 -> 2/13 | 90.318985 -> 90.32323 | 0 bytes; 100% |
|
||||
| Texture_MCUtoRGB565 | 6/13 -> 6/13 | 96.40103 -> 96.44502 | 0 bytes; 100% |
|
||||
| idct_block_var | 0/2 -> 0/2 | 88.80309 -> 89.06892 | 0 bytes; 100% |
|
||||
|
||||
All eight previously exact functions still have exact-name objdiff 100% and
|
||||
ctxdiff zero differences. Each setter remains 169/170 instructions, with one
|
||||
folded buffer-base address operation; the other 26 functions retain their
|
||||
original instruction counts. Every owned function and both input objects were
|
||||
checked for allocated non-code sections: none. Pool checks were run before tuning and after the final build; all three were
|
||||
identical, with zero strings.
|
||||
|
||||
The baseline comparison was regenerated by rebuilding saved unmodified versions
|
||||
of the three owned sources, reporting them, then restoring/rebuilding the final
|
||||
sources. All 28 function scores were compared; zero regressions.
|
||||
|
||||
Full build: PASS. `git diff --check`: PASS.
|
||||
DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
|
||||
Commands used:
|
||||
|
||||
```sh
|
||||
python3 configure.py --version 43U --wrapper ../toolchain/wibo-build/wibo
|
||||
WIBO_SJIS_MISSING_IMPORTS=1 ../.venv/bin/ninja
|
||||
build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json
|
||||
PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/pool_diff.py <source-object> <original-object>
|
||||
PYTHONPATH=../local-tools ../.venv/bin/python tools/decomp-assist/ctxdiff.py <unit> <symbol>
|
||||
../.venv/bin/python tools/decomp-assist/jpeg_differential_audit.py
|
||||
sha1sum build/43U/main.dol
|
||||
```
|
||||
|
||||
## Differential test scope and limitations
|
||||
|
||||
The committed `jpeg_differential_audit.py` is a bounded integer PPC interpreter
|
||||
and deterministic test generator. It reads the locally available source/original
|
||||
ELF objects and does not distribute original executable bytes. Capstone and
|
||||
pyelftools are required. Run it from the repository root after building the
|
||||
three objects; do not run Python with assertions disabled.
|
||||
|
||||
- 9,456 paired calls across all 28 functions, seed 449529
|
||||
- Normal and edge converters: scales 1, 2, 4, 8; multiple MCU origins; both
|
||||
edge-dimension branches; zero, partial and full extents; constant and random
|
||||
luminance/chroma bytes, including negative signed chroma and clipping
|
||||
- Setters: all 256 component selectors and four supported IDCT sizes;
|
||||
randomized 16-bit image dimensions; return values, converter identities and
|
||||
non-stack side effects compared
|
||||
- IDCT: all row extents 1..8 and column-mode representatives 1, 2, 3, 8;
|
||||
DC-only, sparse and dense coefficients; positive/negative coefficients and
|
||||
clipping-boundary DC values; pitches 8, 16, 32
|
||||
- Every non-stack byte is compared, including guard regions, along with setter
|
||||
return values. Stack pointer, LR and GPR14..GPR31 restoration are checked
|
||||
- Full instruction-address coverage was reached for all 20 non-grayscale
|
||||
converter bodies and both IDCT functions. This does not mean exhaustive
|
||||
branch/path/input coverage. Four grayscale bodies retain 19 unvisited
|
||||
instructions each in saturation paths that follow an unsigned byte load;
|
||||
each setter has one unvisited negative-selector branch instruction
|
||||
- Function address relocations are normalized to deterministic symbol tokens,
|
||||
with collision checks. Real linked addresses and integration are not tested
|
||||
- Only the observed integer instruction subset is implemented. Unsupported
|
||||
instructions/relocations/callees fail closed. No FPU, exceptions, cache/MMIO,
|
||||
timing, alignment faults, XER behavior or complete condition-register model
|
||||
- `memset` is modeled by its memory effects and ABI-permitted volatile-register
|
||||
clobbers; its actual library machine code is not executed
|
||||
- Inputs are bounded samples. Invalid pointers, zero scale, arbitrary invalid
|
||||
IDCT descriptors, all 32-bit coefficient patterns, concurrency, real JPEG
|
||||
streams and other units are not covered
|
||||
- This custom interpreter is itself test tooling rather than a formally verified
|
||||
CPU implementation. Official objdiff, ctxdiff and full-DOL checks remain the
|
||||
matching/integration authority
|
||||
|
||||
Exact run output is preserved in `jpeg-remainder-differential-results.txt`.
|
||||
|
||||
## Attempts
|
||||
|
||||
Only strictly improved candidates without other function regressions were kept.
|
||||
No declaration-order permutation search was performed. Failed/equal candidates
|
||||
were restored. The one temporary compile error in the luminance-consumption
|
||||
script was a duplicate local declaration; it was corrected and no broken
|
||||
candidate was retained.
|
||||
|
||||
### type-trials
|
||||
|
||||
```text
|
||||
TMCJPEGDEC_converterYUV411toRGBA8 signed-chroma-pointers: 82.603300 -> 82.500000; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8 signed-chroma-coefficients: 82.603300 -> 82.603300; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8 signed-chroma-domain: 82.603300 -> 81.570250; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge signed-chroma-pointers: 93.883930 -> 91.964290; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge signed-chroma-coefficients: 93.883930 -> 93.750000; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge signed-chroma-domain: 93.883930 -> 92.187500; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 signed-chroma-pointers: 87.722980 -> 87.722980; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 signed-chroma-coefficients: 87.722980 -> 87.722980; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 signed-chroma-domain: 87.722980 -> 87.722980; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 byte-luminance: 87.722980 -> 87.689186; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge signed-chroma-pointers: 90.088490 -> 90.088490; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge signed-chroma-coefficients: 90.088490 -> 90.088490; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge signed-chroma-domain: 90.088490 -> 88.628320; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge byte-luminance: 90.088490 -> 90.088490; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 signed-chroma-pointers: 89.405230 -> 89.176470; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 signed-chroma-coefficients: 89.405230 -> 89.307190; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 signed-chroma-domain: 89.405230 -> 86.464050; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 byte-luminance: 89.405230 -> 87.379080; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge signed-chroma-pointers: 87.400000 -> 80.666664; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge signed-chroma-domain: 87.400000 -> 80.666664; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 signed-chroma-pointers: 91.153850 -> 91.153850; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 signed-chroma-coefficients: 91.153850 -> 91.153850; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 signed-chroma-domain: 91.153850 -> 91.153850; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 byte-luminance: 91.153850 -> 91.153850; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge signed-chroma-pointers: 92.000000 -> 91.869570; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge signed-chroma-coefficients: 92.000000 -> 91.869570; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge signed-chroma-domain: 92.000000 -> 91.869570; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 signed-chroma-pointers: 90.670105 -> 90.515465; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 signed-chroma-coefficients: 90.670105 -> 90.515465; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 signed-chroma-domain: 90.670105 -> 90.618550; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 byte-luminance: 90.670105 -> 90.670105; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge signed-chroma-pointers: 88.909090 -> 88.909090; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge signed-chroma-coefficients: 88.909090 -> 88.909090; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge signed-chroma-domain: 88.909090 -> 87.645454; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge byte-luminance: 88.909090 -> 88.909090; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 signed-chroma-pointers: 90.599075 -> 90.599075; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 signed-chroma-coefficients: 90.599075 -> 90.599075; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 signed-chroma-domain: 90.599075 -> 90.599075; restore
|
||||
TMCJPEGDEC_converterYUV422toRGB565 signed-chroma-pointers: 96.691180 -> 96.691180; restore
|
||||
TMCJPEGDEC_converterYUV422toRGB565 signed-chroma-coefficients: 96.691180 -> 96.691180; restore
|
||||
TMCJPEGDEC_converterYUV422toRGB565 signed-chroma-domain: 96.691180 -> 96.691180; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 signed-chroma-pointers: 94.609930 -> 94.609930; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 signed-chroma-coefficients: 94.609930 -> 94.609930; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 signed-chroma-domain: 94.609930 -> 94.609930; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 byte-luminance: 94.609930 -> 92.907800; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 signed-chroma-pointers: 97.967030 -> 97.362640; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 signed-chroma-coefficients: 97.967030 -> 97.802200; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 signed-chroma-domain: 97.967030 -> 97.340660; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 byte-luminance: 97.967030 -> 91.373630; restore
|
||||
```
|
||||
|
||||
### idct-trials
|
||||
|
||||
```text
|
||||
TMCJPEGDEC_IdctBlock_Lumi nested-odd-output-sum: 82.315180 -> 79.708170; restore
|
||||
TMCJPEGDEC_IdctBlock_Lumi explicit-ac-or-tree: 82.315180 -> 74.984436; restore
|
||||
TMCJPEGDEC_IdctBlock_Lumi ac-coefficients-direct-condition: 82.315180 -> 74.984436; restore
|
||||
TMCJPEGDEC_IdctBlock_Lumi nested-even-output-sum: 82.315180 -> 82.315180; restore
|
||||
TMCJPEGDEC_IdctBlock_Lumi direct-product-shifts: 82.315180 -> 82.315180; restore
|
||||
TMCJPEGDEC_IdctBlock_Col nested-odd-output-sum: 92.475770 -> 87.907486; restore
|
||||
TMCJPEGDEC_IdctBlock_Col explicit-ac-or-tree: 92.475770 -> 90.651985; restore
|
||||
TMCJPEGDEC_IdctBlock_Col ac-coefficients-direct-condition: 92.475770 -> 90.651985; restore
|
||||
TMCJPEGDEC_IdctBlock_Col nested-even-output-sum: 92.475770 -> 92.475770; restore
|
||||
TMCJPEGDEC_IdctBlock_Col direct-product-shifts: 92.475770 -> 92.475770; restore
|
||||
```
|
||||
|
||||
### packing-trials
|
||||
|
||||
```text
|
||||
TMCJPEGDEC_converterYUV411toRGBA8 explicit-channel-clamp-branches: 82.603300 -> 61.962810; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8 structured-nonnegative-clamp: 82.603300 -> 68.442150; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge explicit-channel-clamp-branches: 93.883930 -> 80.008930; restore
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge structured-nonnegative-clamp: 93.883930 -> 85.714290; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 explicit-channel-clamp-branches: 87.722980 -> 71.222980; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8 structured-nonnegative-clamp: 87.722980 -> 75.533780; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge explicit-channel-clamp-branches: 90.088490 -> 76.097340; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge structured-nonnegative-clamp: 90.088490 -> 82.123890; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 explicit-channel-clamp-branches: 89.405230 -> 73.372550; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8 structured-nonnegative-clamp: 89.405230 -> 76.797386; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge explicit-channel-clamp-branches: 87.400000 -> 77.841670; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge structured-nonnegative-clamp: 87.400000 -> 82.400000; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 explicit-channel-clamp-branches: 91.153850 -> 74.701920; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 structured-nonnegative-clamp: 91.153850 -> 82.211540; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge explicit-channel-clamp-branches: 92.000000 -> 77.730440; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge structured-nonnegative-clamp: 92.000000 -> 84.043480; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 explicit-channel-clamp-branches: 90.670105 -> 73.030930; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 structured-nonnegative-clamp: 90.670105 -> 81.082470; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge explicit-channel-clamp-branches: 88.909090 -> 75.463640; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge structured-nonnegative-clamp: 88.909090 -> 81.000000; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 normalize-packed-channels: 90.599075 -> 87.004610; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 group-red-green-packing: 90.599075 -> 88.755760; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 pack-before-output-address: 90.599075 -> 90.599075; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 explicit-channel-clamp-branches: 90.599075 -> 59.511520; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565 structured-nonnegative-clamp: 90.599075 -> 71.640560; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge normalize-packed-channels: 95.377360 -> 93.820755; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge group-red-green-packing: 95.377360 -> 93.613205; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge pack-before-output-address: 95.377360 -> 95.377360; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge explicit-channel-clamp-branches: 95.377360 -> 79.801890; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge structured-nonnegative-clamp: 95.377360 -> 86.179245; restore
|
||||
TMCJPEGDEC_converterYUV422toRGB565 explicit-channel-clamp-branches: 96.691180 -> 78.507355; restore
|
||||
TMCJPEGDEC_converterYUV422toRGB565 structured-nonnegative-clamp: 96.691180 -> 79.044120; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 normalize-packed-channels: 94.609930 -> 90.248230; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 group-red-green-packing: 94.609930 -> 91.560290; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 pack-before-output-address: 94.609930 -> 94.609930; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 explicit-channel-clamp-branches: 94.609930 -> 73.127660; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565 structured-nonnegative-clamp: 94.609930 -> 76.751770; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge normalize-packed-channels: 94.692986 -> 89.912280; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge group-red-green-packing: 94.692986 -> 91.798250; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge pack-before-output-address: 94.692986 -> 94.692986; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge explicit-channel-clamp-branches: 94.692986 -> 81.894740; restore
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge structured-nonnegative-clamp: 94.692986 -> 86.315790; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 normalize-packed-channels: 97.967030 -> 96.648350; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 group-red-green-packing: 97.967030 -> 98.681320; RETAIN
|
||||
TMCJPEGDEC_converterYUV444toRGB565 explicit-channel-clamp-branches: 98.681320 -> 85.120880; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 structured-nonnegative-clamp: 98.681320 -> 82.802200; restore
|
||||
```
|
||||
|
||||
### control-trials
|
||||
|
||||
```text
|
||||
structured-col-low-mode-first: {'TMCJPEGDEC_IdctBlock_Lumi': 82.31518, 'TMCJPEGDEC_IdctBlock_Col': 92.47577} -> {'TMCJPEGDEC_IdctBlock_Lumi': 82.31518, 'TMCJPEGDEC_IdctBlock_Col': 92.47577}; restore
|
||||
structured-col-high-mode-first: {'TMCJPEGDEC_IdctBlock_Lumi': 82.31518, 'TMCJPEGDEC_IdctBlock_Col': 92.47577} -> {'TMCJPEGDEC_IdctBlock_Lumi': 82.31518, 'TMCJPEGDEC_IdctBlock_Col': 50.55066}; restore
|
||||
shared-full-row-butterfly: {'TMCJPEGDEC_IdctBlock_Lumi': 82.31518, 'TMCJPEGDEC_IdctBlock_Col': 92.47577} -> {'TMCJPEGDEC_IdctBlock_Lumi': 83.05058, 'TMCJPEGDEC_IdctBlock_Col': 92.47577}; RETAIN
|
||||
```
|
||||
|
||||
### luma-reuse-trials
|
||||
|
||||
```text
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge consume-luminance-as-blue: 90.088490 -> 90.088490; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge consume-luminance-as-red: 90.088490 -> 89.955750; restore
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge consume-luminance-as-green: 90.088490 -> 90.088490; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge consume-luminance-as-blue: 87.400000 -> 87.400000; restore
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge consume-luminance-as-red: 87.400000 -> 87.458336; RETAIN
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 consume-luminance-as-blue: 91.153850 -> 91.153850; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 consume-luminance-as-red: 91.153850 -> 86.067310; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8 consume-luminance-as-green: 91.153850 -> 78.307690; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge consume-luminance-as-blue: 92.000000 -> 91.565216; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge consume-luminance-as-red: 92.000000 -> 87.617390; restore
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge consume-luminance-as-green: 92.000000 -> 79.547830; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 consume-luminance-as-blue: 90.670105 -> 90.670105; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 consume-luminance-as-red: 90.670105 -> 85.216490; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8 consume-luminance-as-green: 90.670105 -> 74.577320; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge consume-luminance-as-blue: 88.909090 -> 88.909090; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge consume-luminance-as-red: 88.909090 -> 85.645454; restore
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge consume-luminance-as-green: 88.909090 -> 78.772730; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge consume-luminance-as-blue: 95.377360 -> 91.396225; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge consume-luminance-as-red: 95.377360 -> 93.707550; restore
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge consume-luminance-as-green: 95.377360 -> 95.330185; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 consume-luminance-as-blue: 98.681320 -> 98.681320; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 consume-luminance-as-red: 98.681320 -> 98.714290; RETAIN
|
||||
```
|
||||
|
||||
### rgb444-trials
|
||||
|
||||
```text
|
||||
TMCJPEGDEC_converterYUV444toRGB565 reused-luminance-green-red-group: 98.714290 -> 89.923080; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 reused-luminance-blue-green-group: 98.714290 -> 98.549450; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 reused-luminance-red-blue-group: 98.714290 -> 90.945050; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 reused-luminance-red-green-group: 98.714290 -> 98.714290; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 separate-luminance-green-red-group: 98.714290 -> 98.131870; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 separate-luminance-blue-green-group: 98.714290 -> 98.516490; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 separate-luminance-red-blue-group: 98.714290 -> 91.406590; restore
|
||||
TMCJPEGDEC_converterYUV444toRGB565 separate-luminance-red-green-group: 98.714290 -> 98.681320; restore
|
||||
```
|
||||
29
tools/decomp-assist/jpeg-remainder-differential-results.txt
Normal file
29
tools/decomp-assist/jpeg-remainder-differential-results.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
TMCJPEGDEC_converterYUV411toRGBA8: 100 cases PASS; instruction coverage source 242/242, original 242/242
|
||||
TMCJPEGDEC_converterYUV411toRGBA8edge: 400 cases PASS; instruction coverage source 112/112, original 112/112
|
||||
TMCJPEGDEC_converterYUV422toRGBA8: 100 cases PASS; instruction coverage source 148/148, original 148/148
|
||||
TMCJPEGDEC_converterYUV422toRGBA8edge: 400 cases PASS; instruction coverage source 113/113, original 113/113
|
||||
TMCJPEGDEC_converterYUV420toRGBA8: 100 cases PASS; instruction coverage source 153/153, original 153/153
|
||||
TMCJPEGDEC_converterYUV420toRGBA8edge: 400 cases PASS; instruction coverage source 120/120, original 120/120
|
||||
TMCJPEGDEC_converterYUV211toRGBA8: 100 cases PASS; instruction coverage source 104/104, original 104/104
|
||||
TMCJPEGDEC_converterYUV211toRGBA8edge: 400 cases PASS; instruction coverage source 115/115, original 115/115
|
||||
TMCJPEGDEC_converterYUV444toRGBA8: 100 cases PASS; instruction coverage source 97/97, original 97/97
|
||||
TMCJPEGDEC_converterYUV444toRGBA8edge: 400 cases PASS; instruction coverage source 110/110, original 110/110
|
||||
TMCJPEGDEC_converterYUV400toRGBA8: 100 cases PASS; instruction coverage source 57/76, original 57/76
|
||||
TMCJPEGDEC_converterYUV400toRGBA8edge: 400 cases PASS; instruction coverage source 70/89, original 70/89
|
||||
TMCJPEGDEC_set_converterRGBA8: 1024 cases PASS; instruction coverage source 168/169, original 169/170
|
||||
TMCJPEGDEC_converterYUV411toRGB565: 100 cases PASS; instruction coverage source 217/217, original 217/217
|
||||
TMCJPEGDEC_converterYUV411toRGB565edge: 400 cases PASS; instruction coverage source 106/106, original 106/106
|
||||
TMCJPEGDEC_converterYUV422toRGB565: 100 cases PASS; instruction coverage source 136/136, original 136/136
|
||||
TMCJPEGDEC_converterYUV422toRGB565edge: 400 cases PASS; instruction coverage source 107/107, original 107/107
|
||||
TMCJPEGDEC_converterYUV420toRGB565: 100 cases PASS; instruction coverage source 141/141, original 141/141
|
||||
TMCJPEGDEC_converterYUV420toRGB565edge: 400 cases PASS; instruction coverage source 114/114, original 114/114
|
||||
TMCJPEGDEC_converterYUV211toRGB565: 100 cases PASS; instruction coverage source 98/98, original 98/98
|
||||
TMCJPEGDEC_converterYUV211toRGB565edge: 400 cases PASS; instruction coverage source 109/109, original 109/109
|
||||
TMCJPEGDEC_converterYUV444toRGB565: 100 cases PASS; instruction coverage source 91/91, original 91/91
|
||||
TMCJPEGDEC_converterYUV444toRGB565edge: 400 cases PASS; instruction coverage source 104/104, original 104/104
|
||||
TMCJPEGDEC_converterYUV400toRGB565: 100 cases PASS; instruction coverage source 51/70, original 51/70
|
||||
TMCJPEGDEC_converterYUV400toRGB565edge: 400 cases PASS; instruction coverage source 64/83, original 64/83
|
||||
TMCJPEGDEC_set_converterRGB565: 1024 cases PASS; instruction coverage source 168/169, original 169/170
|
||||
TMCJPEGDEC_IdctBlock_Lumi: 704 cases PASS; instruction coverage source 257/257, original 257/257
|
||||
TMCJPEGDEC_IdctBlock_Col: 704 cases PASS; instruction coverage source 454/454, original 454/454
|
||||
TOTAL: 9456 differential cases PASS; GPR14-GPR31, stack pointer and LR preserved
|
||||
319
tools/decomp-assist/jpeg_differential_audit.py
Normal file
319
tools/decomp-assist/jpeg_differential_audit.py
Normal file
@@ -0,0 +1,319 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only, bounded PPC integer interpreter for differential JPEG checks.
|
||||
Loads source and original ELF .text; never copies original code into sources.
|
||||
Only memset is external. No FPU/system instructions are supported.
|
||||
"""
|
||||
import random
|
||||
import re
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
import capstone
|
||||
from elftools.elf.elffile import ELFFile
|
||||
U32 = 0xFFFFFFFF
|
||||
|
||||
def signed(x):
|
||||
x &= U32
|
||||
return x - 0x100000000 if x & 0x80000000 else x
|
||||
|
||||
def rotate(x, n):
|
||||
return (x << n | x >> (32 - n if n else 32)) & U32
|
||||
|
||||
def mask(b, e):
|
||||
return sum((1 << 31 - i for i in range(32) if b <= i <= e or (b > e and (i >= b or i <= e))))
|
||||
|
||||
def load_object(path):
|
||||
with open(path, 'rb') as f:
|
||||
e = ELFFile(f)
|
||||
section = e.get_section_by_name('.text')
|
||||
data = bytearray(section.data())
|
||||
syms = e.get_section_by_name('.symtab')
|
||||
calls = {}
|
||||
symbol_addresses = {}
|
||||
rel = e.get_section_by_name('.rela.text')
|
||||
if rel:
|
||||
for r in rel.iter_relocations():
|
||||
name = syms.get_symbol(r['r_info_sym']).name
|
||||
off = r['r_offset']
|
||||
typ = r['r_info_type']
|
||||
addr = 0x800000 + (zlib.crc32(name.encode()) & 0x7FFF) * 4 + r['r_addend']
|
||||
assert addr not in symbol_addresses or symbol_addresses[addr] == name
|
||||
symbol_addresses[addr] = name
|
||||
if typ == 10:
|
||||
calls[off] = name
|
||||
elif typ == 4:
|
||||
data[off:off + 2] = struct.pack('>H', addr & 65535)
|
||||
elif typ == 6:
|
||||
data[off:off + 2] = struct.pack('>H', addr + 0x8000 >> 16 & 65535)
|
||||
else:
|
||||
raise ValueError(('relocation', typ))
|
||||
dis = capstone.Cs(capstone.CS_ARCH_PPC, capstone.CS_MODE_32 | capstone.CS_MODE_BIG_ENDIAN)
|
||||
funcs = {}
|
||||
for sym in syms.iter_symbols():
|
||||
if sym['st_info']['type'] != 'STT_FUNC' or not sym['st_size']:
|
||||
continue
|
||||
start = sym['st_value']
|
||||
size = sym['st_size']
|
||||
inst = {}
|
||||
for i in dis.disasm(bytes(data[start:start + size]), start):
|
||||
ops = []
|
||||
for o in i.op_str.split(', '):
|
||||
if not o:
|
||||
continue
|
||||
if o.startswith('cr'):
|
||||
ops.append(('cr', int(o[2:])))
|
||||
elif o.startswith('r'):
|
||||
ops.append(int(o[1:]))
|
||||
elif '(' in o:
|
||||
off, reg = o.split('(')
|
||||
ops.append((int(off, 0), int(reg[1:-1])))
|
||||
else:
|
||||
ops.append(int(o, 0))
|
||||
inst[i.address] = (i.mnemonic, ops)
|
||||
funcs[sym.name] = (start, inst, calls)
|
||||
return funcs
|
||||
|
||||
def run(fn, initial, args):
|
||||
pc, ins, calls = fn
|
||||
mem = bytearray(initial)
|
||||
r = [i * 1122867 & U32 for i in range(32)]
|
||||
r[1] = 0x3F000
|
||||
r[3:3 + len(args)] = args
|
||||
saved_registers = r[14:].copy()
|
||||
cr = [0] * 8
|
||||
ctr = 0
|
||||
lr = 0
|
||||
steps = 0
|
||||
coverage = set()
|
||||
|
||||
def ld(a, n):
|
||||
assert 0 <= a <= len(mem) - n, hex(a)
|
||||
return int.from_bytes(mem[a:a + n], 'big')
|
||||
|
||||
def st(a, v, n):
|
||||
assert 0 <= a <= len(mem) - n, hex(a)
|
||||
mem[a:a + n] = (v & (1 << 8 * n) - 1).to_bytes(n, 'big')
|
||||
while True:
|
||||
steps += 1
|
||||
if steps > 100000:
|
||||
raise RuntimeError('step bound')
|
||||
coverage.add(pc)
|
||||
op, a = ins[pc]
|
||||
pc += 4
|
||||
dot = op.endswith('.')
|
||||
op = op.rstrip('.')
|
||||
val = None
|
||||
if op == 'blr':
|
||||
break
|
||||
elif op == 'bl':
|
||||
assert calls.get(pc - 4) == 'memset', calls.get(pc - 4)
|
||||
assert r[3] + r[5] <= len(mem)
|
||||
mem[r[3]:r[3] + r[5]] = bytes([r[4] & 255]) * r[5]
|
||||
# Model ABI-permitted call clobbers rather than preserving temporaries.
|
||||
for reg in [0] + list(range(4, 13)):
|
||||
r[reg] = (0xBAD00000 + reg) & U32
|
||||
for field in [0, 1, 5, 6, 7]:
|
||||
cr[field] = -1
|
||||
lr = pc
|
||||
elif op == 'b':
|
||||
pc = a[0]
|
||||
elif op == 'bdnz':
|
||||
ctr = ctr - 1 & U32
|
||||
if ctr:
|
||||
pc = a[0]
|
||||
elif op in ['beq', 'bne', 'ble', 'bge', 'blt', 'bgt']:
|
||||
c = cr[a[0][1]] if len(a) > 1 else cr[0]
|
||||
if {'beq': c == 0, 'bne': c != 0, 'ble': c <= 0, 'bge': c >= 0, 'blt': c < 0, 'bgt': c > 0}[op]:
|
||||
pc = a[-1]
|
||||
elif op in ['cmpwi', 'cmpw', 'cmplw']:
|
||||
c = a[0][1] if isinstance(a[0], tuple) else 0
|
||||
a = ins[pc - 4][1]
|
||||
if isinstance(a[0], tuple):
|
||||
a = a[1:]
|
||||
x = r[a[0]]
|
||||
y = a[1] if op == 'cmpwi' else r[a[1]]
|
||||
if op != 'cmplw':
|
||||
x = signed(x)
|
||||
y = signed(y)
|
||||
cr[c] = (x > y) - (x < y)
|
||||
elif op in ['lbz', 'lhz', 'lwz', 'lmw']:
|
||||
off, reg = a[1]
|
||||
addr = (r[reg] if reg else 0) + off & U32
|
||||
if op == 'lmw':
|
||||
for j in range(a[0], 32):
|
||||
r[j] = ld(addr + (j - a[0]) * 4, 4)
|
||||
else:
|
||||
r[a[0]] = ld(addr, {'lbz': 1, 'lhz': 2, 'lwz': 4}[op])
|
||||
elif op in ['stb', 'sth', 'stw', 'stwu', 'stmw']:
|
||||
off, reg = a[1]
|
||||
addr = (r[reg] if reg else 0) + off & U32
|
||||
if op == 'stmw':
|
||||
for j in range(a[0], 32):
|
||||
st(addr + (j - a[0]) * 4, r[j], 4)
|
||||
else:
|
||||
st(addr, r[a[0]], {'stb': 1, 'sth': 2, 'stw': 4, 'stwu': 4}[op])
|
||||
if op == 'stwu':
|
||||
r[reg] = addr
|
||||
elif op in ['stbx', 'sthx']:
|
||||
st((r[a[1]] if a[1] else 0) + r[a[2]] & U32, r[a[0]], 1 if op == 'stbx' else 2)
|
||||
elif op == 'mflr':
|
||||
r[a[0]] = lr
|
||||
elif op == 'mtlr':
|
||||
lr = r[a[0]]
|
||||
elif op == 'mtctr':
|
||||
ctr = r[a[0]]
|
||||
else:
|
||||
d = a[0]
|
||||
if op == 'li':
|
||||
val = a[1]
|
||||
elif op == 'lis':
|
||||
val = a[1] << 16
|
||||
elif op == 'mr':
|
||||
val = r[a[1]]
|
||||
elif op == 'add':
|
||||
val = r[a[1]] + r[a[2]]
|
||||
elif op == 'addi':
|
||||
val = (r[a[1]] if a[1] else 0) + a[2]
|
||||
elif op == 'addis':
|
||||
val = (r[a[1]] if a[1] else 0) + (a[2] << 16)
|
||||
elif op == 'subf':
|
||||
val = r[a[2]] - r[a[1]]
|
||||
elif op == 'subfic':
|
||||
val = a[2] - r[a[1]]
|
||||
elif op == 'mulli':
|
||||
val = r[a[1]] * a[2]
|
||||
elif op == 'mullw':
|
||||
val = r[a[1]] * r[a[2]]
|
||||
elif op == 'divw':
|
||||
x = signed(r[a[1]])
|
||||
y = signed(r[a[2]])
|
||||
val = abs(x) // abs(y) * (-1 if (x < 0) != (y < 0) else 1)
|
||||
elif op == 'or':
|
||||
val = r[a[1]] | r[a[2]]
|
||||
elif op == 'andc':
|
||||
val = r[a[1]] & ~r[a[2]]
|
||||
elif op == 'andi':
|
||||
val = r[a[1]] & a[2]
|
||||
elif op == 'neg':
|
||||
val = -r[a[1]]
|
||||
elif op == 'extsb':
|
||||
val = (r[a[1]] & 255) - (256 if r[a[1]] & 128 else 0)
|
||||
elif op == 'srawi':
|
||||
val = signed(r[a[1]]) >> a[2]
|
||||
elif op == 'srwi':
|
||||
val = r[a[1]] >> a[2]
|
||||
elif op == 'slwi':
|
||||
val = r[a[1]] << a[2]
|
||||
elif op == 'clrlwi':
|
||||
val = r[a[1]] & (1 << 32 - a[2]) - 1
|
||||
elif op == 'rotlwi':
|
||||
val = rotate(r[a[1]], a[2])
|
||||
elif op == 'rlwinm':
|
||||
val = rotate(r[a[1]], a[2]) & mask(a[3], a[4])
|
||||
else:
|
||||
raise ValueError((hex(pc - 4), op, a))
|
||||
r[d] = val & U32
|
||||
if dot:
|
||||
cr[0] = (signed(val) > 0) - (signed(val) < 0)
|
||||
assert r[1] == 0x3F000, 'Stack pointer not restored'
|
||||
assert lr == 0, 'Link register not restored'
|
||||
assert r[14:] == saved_registers, 'Nonvolatile registers not restored'
|
||||
return (mem, r[3], coverage)
|
||||
|
||||
def put(m, a, v, n=4):
|
||||
m[a:a + n] = (v & (1 << 8 * n) - 1).to_bytes(n, 'big')
|
||||
|
||||
def compare(src, orig, name, m, args, case, returns=False):
|
||||
a, ra, ca = run(src[name], m, args)
|
||||
b, rb, cb = run(orig[name], m, args)
|
||||
# The stack can differ because each implementation owns its frame.
|
||||
if a[:0x3E000] != b[:0x3E000]:
|
||||
diff = [hex(i) for i in range(0x3E000) if a[i] != b[i]][:12]
|
||||
raise AssertionError((name, case, 'memory mismatch', diff))
|
||||
if returns and ra != rb:
|
||||
raise AssertionError((name, case, 'return', ra, rb))
|
||||
return (ca, cb)
|
||||
|
||||
def main():
|
||||
total_cases = 0
|
||||
rng = random.Random(449529)
|
||||
root = 'build/43U/{}/libs/RVLMiddleware/TMC_JPEG/src/{}'
|
||||
for unit in ['texturecvtr/Texture_MCUtoRGBA8', 'texturecvtr/Texture_MCUtoRGB565', 'buffer/idct_block_var']:
|
||||
src = load_object(root.format('src', unit) + '.o')
|
||||
orig = load_object(root.format('obj', unit) + '.o')
|
||||
assert src.keys() == orig.keys(), (unit, 'Function sets differ')
|
||||
assert len(src) == (2 if unit.startswith('buffer/') else 13)
|
||||
for name in src:
|
||||
n = 0
|
||||
sa = set()
|
||||
sb = set()
|
||||
if 'IdctBlock' in name:
|
||||
for rows in range(1, 9):
|
||||
for cols in [1, 2, 3, 8]:
|
||||
for pattern in range(22):
|
||||
m = bytearray([0xA5]) * 0x40000
|
||||
block = [0] * 64
|
||||
for y in range(rows):
|
||||
for x in range(cols):
|
||||
if pattern < 6:
|
||||
block[y * 8 + x] = [0, 1, -1, 0x3FFFF, 0x40000, -0x40000][pattern] if x == 0 and y == 0 else 0
|
||||
elif pattern < 14:
|
||||
block[y * 8 + x] = rng.randrange(-10000, 10001) if rng.randrange(4) == 0 else 0
|
||||
else:
|
||||
block[y * 8 + x] = rng.randrange(-150000, 150001)
|
||||
for i, v in enumerate(block):
|
||||
put(m, 0x1000 + i * 4, v)
|
||||
pitch = [8, 16, 32][pattern % 3]
|
||||
args = [0x1000, 0x2000, pitch, rows << 4 | cols]
|
||||
ca, cb = compare(src, orig, name, m, args, (rows, cols, pattern))
|
||||
sa |= ca
|
||||
sb |= cb
|
||||
n += 1
|
||||
elif 'set_converter' in name:
|
||||
for component in range(256):
|
||||
for mode in [1, 2, 4, 8]:
|
||||
m = bytearray([0xA5]) * 0x40000
|
||||
work = 0x1000
|
||||
state = 0x4000
|
||||
put(m, work + 0x17FC, component, 1)
|
||||
put(m, work + 0x19DC, mode, 1)
|
||||
put(m, work + 0x19E4, state)
|
||||
put(m, state + 0x24, rng.randrange(65536), 2)
|
||||
put(m, state + 0x26, rng.randrange(65536), 2)
|
||||
ca, cb = compare(src, orig, name, m, [work], (component, mode), True)
|
||||
sa |= ca
|
||||
sb |= cb
|
||||
n += 1
|
||||
else:
|
||||
sampling = re.search('YUV(\\d+)to', name)[1]
|
||||
w, h = {'411': (32, 8), '422': (16, 8), '420': (16, 16), '211': (8, 16), '444': (8, 8), '400': (8, 8)}[sampling]
|
||||
for scale in [1, 2, 4, 8]:
|
||||
for pattern in range(25):
|
||||
for border in range(4 if name.endswith('edge') else 1):
|
||||
m = bytearray([0xA5]) * 0x40000
|
||||
work = 0x1000
|
||||
state = 0x4000
|
||||
tex = 0x8000
|
||||
x = 32 * (pattern % 2)
|
||||
y = 16 * (pattern % 3)
|
||||
ww = w // scale
|
||||
hh = h // scale
|
||||
put(m, work + 0x19E4, state)
|
||||
put(m, state + 0x20, scale, 1)
|
||||
put(m, state + 0x2C, 96)
|
||||
put(m, state + 0x48, tex)
|
||||
put(m, state + 0x18, x if border & 1 else x + 1)
|
||||
put(m, state + 0x1C, y if border & 2 else y + 1)
|
||||
put(m, state + 0x16, pattern % (ww + 1), 1)
|
||||
put(m, state + 0x17, pattern % (hh + 1), 1)
|
||||
for i in range(0x184):
|
||||
m[work + 0x1858 + i] = [0, 127, 128, 255][pattern % 4] if pattern < 4 else rng.randrange(256)
|
||||
ca, cb = compare(src, orig, name, m, [work, x, y], (scale, pattern, border))
|
||||
sa |= ca
|
||||
sb |= cb
|
||||
n += 1
|
||||
total_cases += n
|
||||
print(f'{name}: {n} cases PASS; instruction coverage source {len(sa)}/{len(src[name][1])}, original {len(sb)}/{len(orig[name][1])}', flush=True)
|
||||
print(f'TOTAL: {total_cases} differential cases PASS; GPR14-GPR31, stack pointer and LR preserved')
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
130
tools/decomp-assist/revisit.attempts.md
Normal file
130
tools/decomp-assist/revisit.attempts.md
Normal 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.
|
||||
51
tools/decomp-assist/run-fixed-stack.attempts.md
Normal file
51
tools/decomp-assist/run-fixed-stack.attempts.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Run fixed-stack relocation correction
|
||||
|
||||
This is a narrow follow-up to #973, not another Run implementation or a new
|
||||
match. The existing assembly, cache loop, register clearing, labels and handoff
|
||||
remain intact. No linking flag changes.
|
||||
|
||||
## Evidence
|
||||
|
||||
The hash-verified original DOL and linked ELF contain Run at 0x8137B3EC,
|
||||
size 0xAC (43 instructions). Its instructions at 0x8137B468/0x8137B46C establish
|
||||
SP as 0x81600000. This architectural stack value should not depend on placement
|
||||
of an unrelated formatted-output routine.
|
||||
|
||||
Automatic extraction had attached two relocations to __pformatter + 0x280:
|
||||
R_PPC_ADDR16_HI at Run+0x7E and R_PPC_ADDR16_LO at Run+0x82. The linked formatter
|
||||
address happens to make this expression equal 0x81600000 in this target, but
|
||||
that is a false semantic dependency in the reconstruction.
|
||||
|
||||
DTK block_relocations uses instruction addresses, not ELF halfword offsets.
|
||||
The two exclusions are therefore .text:0x8137B468 and .text:0x8137B46C.
|
||||
The source removes the unrelated extern and uses the fixed high/low immediate.
|
||||
No other source instructions or original bytes are replaced.
|
||||
|
||||
## Independent validation
|
||||
|
||||
- Full 43U all_source, progress, report and DOL check pass.
|
||||
- Original app and rebuilt DOL SHA1 both remain
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
- Run remains 100%, 43/43 instructions, ctxdiff zero. No new match attribution.
|
||||
- Whole report is unchanged: no code, data, function, linking or fuzzy delta.
|
||||
- Pool: all 91 strings identical.
|
||||
- All 1027 native source objects compared: only BS2Mach .text changes; size
|
||||
16960 is unchanged. Exactly the two false text relocations are removed.
|
||||
All other allocated objects and data sections are unchanged.
|
||||
- All 1027 active extracted objects compared, plus the same obsolete cached
|
||||
tiManager.o in both trees. Only BS2Mach .text changes: size 16980 unchanged;
|
||||
only Run's high immediate placeholder bytes at +0x7E/+0x7F become 0x81,0x60.
|
||||
Exactly the two formatter relocations disappear, with no added relocations.
|
||||
Defined target symbols and non-text sections stay unchanged.
|
||||
- Supplemental integer-PPC contract model checks the compiled source for 1,
|
||||
4 and 131072 cache lines, preserved LR entry, SP 0x81600000, cleared GPRs and
|
||||
alternating dcbz/dcbf events. The zero-count prefix retains the original CTR
|
||||
wrap to 0xFFFFFFFF; the full 2^32-iteration path is not executed. This is an
|
||||
abstract contract test, not actual cache/MMIO or console execution.
|
||||
- Workflow/literal/jump-table/pool tests: 8/36/27/8 passed.
|
||||
- Diff check passes.
|
||||
|
||||
Assembly was already introduced by #973. The original isolated full-Run
|
||||
experiment is deliberately not included here. This correction adds no new
|
||||
assembly instructions, forced register uses, retail .s objects or padding.
|
||||
Please review the metadata/source constant attribution explicitly.
|
||||
Reference in New Issue
Block a user