Compare commits
1 Commits
setting-cl
...
agent/bitt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1c364269a |
@@ -20,7 +20,7 @@ namespace gui {
|
||||
class Manager;
|
||||
class EventHandler;
|
||||
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
class __declspec(novtable) Interface {
|
||||
#else
|
||||
class Interface {
|
||||
@@ -34,14 +34,14 @@ namespace gui {
|
||||
virtual void draw(Mtx& mtx) {} // 0x14 (0x05)
|
||||
virtual void draw() {} // 0x18 (0x06)
|
||||
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
virtual ~Interface(); // 0x1C (0x07)
|
||||
#else
|
||||
virtual ~Interface() {} // 0x1C (0x07)
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
|
||||
#if defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
class __declspec(novtable) EventHandler {
|
||||
#else
|
||||
class EventHandler {
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ipl {
|
||||
mbDisableCon(bDisableCon) {}
|
||||
#endif
|
||||
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) || defined(IPL_SETTING_NOVTABLE)
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
virtual ~PaneManager();
|
||||
#else
|
||||
virtual ~PaneManager() {}
|
||||
|
||||
@@ -163,9 +163,6 @@ namespace ipl {
|
||||
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD,
|
||||
f32 speed = 1.0f);
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
f32 get() const;
|
||||
#else
|
||||
f32 get() const {
|
||||
f32 var_f27 = mFrame;
|
||||
f32 var_f28 = 1.0f / mMaxFrame;
|
||||
@@ -184,7 +181,6 @@ namespace ipl {
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
f32 mStart;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace ipl {
|
||||
y = r.y;
|
||||
z = 0.0f;
|
||||
}
|
||||
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
|
||||
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP)
|
||||
VEC3(f32 fx, f32 fy, f32 fz);
|
||||
#else
|
||||
VEC3(f32 fx, f32 fy, f32 fz) {
|
||||
|
||||
@@ -31,12 +31,8 @@ namespace ipl {
|
||||
|
||||
virtual void calc();
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual void initCalcNormal();
|
||||
#else
|
||||
virtual void initCalcNormal() {
|
||||
} // 0x4C
|
||||
#endif
|
||||
virtual void initCalcFadeout() {
|
||||
} // 0x50
|
||||
|
||||
@@ -53,12 +49,8 @@ namespace ipl {
|
||||
return FADER_SCN_NEXT;
|
||||
} // 0x60
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual void calcCommonAfter();
|
||||
#else
|
||||
virtual void calcCommonAfter() {
|
||||
} // 0x64
|
||||
#endif
|
||||
|
||||
int getSceneFadeState() {
|
||||
return mScnFadeState;
|
||||
|
||||
@@ -62,11 +62,7 @@ namespace ipl {
|
||||
virtual ~Base();
|
||||
|
||||
/** @brief If the scene is ready */
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual BOOL isReady() const;
|
||||
#else
|
||||
virtual BOOL isReady() const { return FALSE; }
|
||||
#endif
|
||||
|
||||
/** @brief If the user can power off/reset the system */
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
@@ -77,11 +73,7 @@ namespace ipl {
|
||||
/** @brief The scene running code when powering off/resetting the system */
|
||||
virtual void startResetting() {}
|
||||
/** @brief If the scene has finished its powering off/resetting task */
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual BOOL isResetProcessDone();
|
||||
#else
|
||||
virtual BOOL isResetProcessDone() { return TRUE; }
|
||||
#endif
|
||||
|
||||
/** @brief Prepare to create scene */
|
||||
virtual void prepare() {}
|
||||
@@ -94,17 +86,10 @@ namespace ipl {
|
||||
/** @brief Destroy the scene and clear from memory */
|
||||
virtual void destroy() {}
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual Base* getParent();
|
||||
virtual Base* getChild();
|
||||
virtual Base* getNext();
|
||||
virtual Base* getPrev();
|
||||
#else
|
||||
virtual Base* getParent() { return (Base*)mpParent; }
|
||||
virtual Base* getChild() { return (Base*)mpChild; }
|
||||
virtual Base* getNext() { return (Base*)mpNext; }
|
||||
virtual Base* getPrev() { return (Base*)mpPrev; }
|
||||
#endif
|
||||
|
||||
/** @brief Check if scene has been created.*/
|
||||
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }
|
||||
|
||||
@@ -65,13 +65,8 @@ namespace ipl {
|
||||
/** @brief Writes the file contents. */
|
||||
virtual void write(); // 0x10
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
virtual bool isFinished();
|
||||
virtual int checkData();
|
||||
#else
|
||||
virtual bool isFinished() { return mbDoneTask; } // 0x14
|
||||
virtual int checkData() { return mResult; } // 0x18
|
||||
#endif
|
||||
virtual bool isFatalError(); // 0x1C
|
||||
|
||||
u8* getBuffer() const { return mpBuffer; }
|
||||
|
||||
@@ -51,17 +51,12 @@ namespace ipl {
|
||||
mArg.mOrthoScale = scale;
|
||||
}
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_TITLE_CPP
|
||||
static void setOrthoTrans(const math::VEC3& translate);
|
||||
static void setOrthoScale(const math::VEC2& scale);
|
||||
#else
|
||||
static void setOrthoTrans(const math::VEC3& translate) { mArg.mOrthoTrans = translate; }
|
||||
|
||||
static void setOrthoScale(const math::VEC2& scale) NO_INLINE {
|
||||
mArg.mOrthoScale.x = scale.x;
|
||||
mArg.mOrthoScale.y = scale.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Arg mArg;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace nw4r {
|
||||
namespace ut {
|
||||
class Rect {
|
||||
public:
|
||||
#if defined(IPL_SOUND_RECT_OUT_OF_LINE) || defined(IPL_SD_CHANNEL_TITLE_CPP)
|
||||
#ifdef IPL_SOUND_RECT_OUT_OF_LINE
|
||||
Rect();
|
||||
#else
|
||||
Rect() : left(), top(), right(), bottom() {}
|
||||
@@ -20,7 +20,7 @@ namespace nw4r {
|
||||
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
|
||||
#endif
|
||||
|
||||
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP) && !defined(IPL_SD_CHANNEL_TITLE_CPP)
|
||||
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP)
|
||||
~Rect() {}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace nw4r {
|
||||
} // namespace detail
|
||||
|
||||
template <typename TDerived, typename TBase>
|
||||
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP)
|
||||
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP)
|
||||
TDerived DynamicCast(TBase* pPtr);
|
||||
#else
|
||||
inline TDerived DynamicCast(TBase* pPtr) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -237,7 +237,10 @@ bool MemoryCardManager::isIconValidate(u8 slot, s16 index) {
|
||||
|
||||
bool MemoryCardManager::isBannerEnable(u8 slot, s16 index) {
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
return icons[slot][mFile[slot][index].fileNo].bannerEnable != 0;
|
||||
u32 file = mFile[slot][index].fileNo;
|
||||
memorycard::IconState* icon = &icons[slot][file];
|
||||
u8 enabled = icon->bannerEnable;
|
||||
return enabled != 0;
|
||||
}
|
||||
|
||||
void MemoryCardManager::update_icon_anm() {
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
|
||||
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
|
||||
|
||||
#define IPL_CHANNEL_TITLE_NOVTABLE
|
||||
#include "math/iplInterporation.h"
|
||||
#undef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
|
||||
#include "scene/sdChannelTitle/iplSDChannelTitle.h"
|
||||
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
|
||||
#include "system/iplSystem.h"
|
||||
@@ -1558,5 +1554,15 @@ void SDChannelTitle::startResetting() {
|
||||
snd::getSystem()->resetAllSound();
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelTitle_onTitleButtonEvent(SDTitleButtonEventHandler* handler, u32 component,
|
||||
u32 event, const controller::Interface* controller) {
|
||||
handler->onEventDerived(component, event, controller);
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelTitle_onTitlePaneEvent(SDTitlePaneEventHandler* handler, u32 component,
|
||||
u32 event, const controller::Interface* controller) {
|
||||
handler->onEvent(component, event, const_cast<controller::Interface*>(controller));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,17 +616,6 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
} else if (state != 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
} else {
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == 0) {
|
||||
@@ -812,7 +801,7 @@ perform_request:
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
requestResult = SOCleanup();
|
||||
if (0 <= requestResult) goto request_socket_cleanup_complete;
|
||||
if (-1 < requestResult) goto request_socket_cleanup_complete;
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
@@ -885,7 +874,7 @@ request_socket_cleanup_complete:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((requestResult == 0) && ((u32)*s_accessPointConfig == 1u)) break;
|
||||
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
|
||||
remainingWait = waitIntervals.limits.response;
|
||||
for (; remainingWait != 0; remainingWait -= initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
@@ -1039,9 +1028,11 @@ request_socket_cleanup_complete:
|
||||
if (0 < requestResult) goto process_received_packet;
|
||||
receivedPackets = receivedPackets + 1;
|
||||
if (receivedPackets > attemptCount) {
|
||||
if (protocolState == 0) s_errorCode = 0xf;
|
||||
else if (protocolState == 1) s_errorCode = 0x10;
|
||||
else s_errorCode = 0x11;
|
||||
switch (protocolState) {
|
||||
case 0: s_errorCode = 0xf; break;
|
||||
case 1: s_errorCode = 0x10; break;
|
||||
default: s_errorCode = 0x11; break;
|
||||
}
|
||||
protocolResult = -1;
|
||||
goto close_protocol_socket;
|
||||
}
|
||||
@@ -1229,7 +1220,7 @@ wait_for_packet:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((state == 0) && ((u32)*s_accessPointConfig == 1u)) break;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) break;
|
||||
remainingWait = waitIntervals.limits.response;
|
||||
for (; remainingWait != 0; remainingWait -= initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
@@ -1308,9 +1299,11 @@ wait_for_packet:
|
||||
}
|
||||
protocolState = requestResult;
|
||||
if (receivedPackets > waitSettings.halfwords.high) {
|
||||
if (requestResult == 0) s_errorCode = 0xf;
|
||||
else if (requestResult == 1) s_errorCode = 0x10;
|
||||
else s_errorCode = 0x11;
|
||||
switch (requestResult) {
|
||||
case 0: s_errorCode = 0xf; break;
|
||||
case 1: s_errorCode = 0x10; break;
|
||||
default: s_errorCode = 0x11; break;
|
||||
}
|
||||
protocolResult = -1;
|
||||
goto close_protocol_socket;
|
||||
}
|
||||
@@ -1329,9 +1322,10 @@ wait_for_packet:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
AOSSi_Sleep(retryDelay > 100 ? 100 : retryDelay);
|
||||
if (retryDelay <= 100) delayStep = retryDelay;
|
||||
else delayStep = 100;
|
||||
if (retryDelay > 100) AOSSi_Sleep(100);
|
||||
else AOSSi_Sleep(retryDelay);
|
||||
if (retryDelay > 100) delayStep = 100;
|
||||
else delayStep = retryDelay;
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
@@ -1356,7 +1350,7 @@ close_protocol_socket:
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
state = SOCleanup();
|
||||
if (0 <= state) goto protocol_socket_cleanup_complete;
|
||||
if (-1 < state) goto protocol_socket_cleanup_complete;
|
||||
state = -1;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1547,7 +1547,6 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
s32 messageLength;
|
||||
u8 optionIds[7] = {6, 0, 1, 2, 3, 4, 5};
|
||||
AtermRequestOption8* shortOption = (AtermRequestOption8*)gAtermRequestOptions;
|
||||
AtermRequestOption16* longOption;
|
||||
@@ -1590,14 +1589,13 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
longOption++;
|
||||
}
|
||||
optionEnd = (u8*)longOption;
|
||||
messageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 2,
|
||||
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 2,
|
||||
(u16*)response->data, optionEnd - gAtermRequestOptions + 8, NULL);
|
||||
gAtermMessageLength = messageLength;
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, messageLength, 0, &sendAddress);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
gAtermProtocolState = 6;
|
||||
break;
|
||||
@@ -1658,10 +1656,6 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
u32 index;
|
||||
u32 digestBytes;
|
||||
u32 state0;
|
||||
u32 state1;
|
||||
u32 state2;
|
||||
u32 state3;
|
||||
memcpy(response->authentication.challenge,
|
||||
optionValue, 8);
|
||||
digestContext.bitCountHigh = 0;
|
||||
@@ -1683,26 +1677,22 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
ATERMMd5Update(&digestContext, gAtermDigestFill,
|
||||
digestBytes < 56 ? 56 - digestBytes : 120 - digestBytes);
|
||||
ATERMMd5Update(&digestContext, digestLength, sizeof(digestLength));
|
||||
state0 = digestContext.state[0];
|
||||
state1 = digestContext.state[1];
|
||||
state2 = digestContext.state[2];
|
||||
state3 = digestContext.state[3];
|
||||
response->authentication.digest[0] = state0;
|
||||
response->authentication.digest[1] = state0 >> 8;
|
||||
response->authentication.digest[2] = state0 >> 16;
|
||||
response->authentication.digest[3] = state0 >> 24;
|
||||
response->authentication.digest[4] = state1;
|
||||
response->authentication.digest[5] = state1 >> 8;
|
||||
response->authentication.digest[6] = state1 >> 16;
|
||||
response->authentication.digest[7] = state1 >> 24;
|
||||
response->authentication.digest[8] = state2;
|
||||
response->authentication.digest[9] = state2 >> 8;
|
||||
response->authentication.digest[10] = state2 >> 16;
|
||||
response->authentication.digest[11] = state2 >> 24;
|
||||
response->authentication.digest[12] = state3;
|
||||
response->authentication.digest[13] = state3 >> 8;
|
||||
response->authentication.digest[14] = state3 >> 16;
|
||||
response->authentication.digest[15] = state3 >> 24;
|
||||
response->authentication.digest[0] = digestContext.state[0];
|
||||
response->authentication.digest[1] = digestContext.state[0] >> 8;
|
||||
response->authentication.digest[2] = digestContext.state[0] >> 16;
|
||||
response->authentication.digest[3] = digestContext.state[0] >> 24;
|
||||
response->authentication.digest[4] = digestContext.state[1];
|
||||
response->authentication.digest[5] = digestContext.state[1] >> 8;
|
||||
response->authentication.digest[6] = digestContext.state[1] >> 16;
|
||||
response->authentication.digest[7] = digestContext.state[1] >> 24;
|
||||
response->authentication.digest[8] = digestContext.state[2];
|
||||
response->authentication.digest[9] = digestContext.state[2] >> 8;
|
||||
response->authentication.digest[10] = digestContext.state[2] >> 16;
|
||||
response->authentication.digest[11] = digestContext.state[2] >> 24;
|
||||
response->authentication.digest[12] = digestContext.state[3];
|
||||
response->authentication.digest[13] = digestContext.state[3] >> 8;
|
||||
response->authentication.digest[14] = digestContext.state[3] >> 16;
|
||||
response->authentication.digest[15] = digestContext.state[3] >> 24;
|
||||
{
|
||||
u8* contextByte = (u8*)&digestContext;
|
||||
for (index = 0; index < sizeof(digestContext); index++) {
|
||||
@@ -1730,7 +1720,6 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
{
|
||||
AtermRequestOption16* option = (AtermRequestOption16*)response->authentication.decoded.options;
|
||||
AtermSocketAddress sendAddress;
|
||||
s32 messageLength;
|
||||
memset(response->data, 0, 8);
|
||||
memset(option, 0, 4);
|
||||
option->type = SOHtoNs(0x102);
|
||||
@@ -1739,14 +1728,13 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
memcpy(option->value, response->authentication.digest, 8);
|
||||
gAtermReplyLength = (u8*)(option + 1) - response->data;
|
||||
response->authentication.decoded.length = gAtermReplyLength - 8;
|
||||
messageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 4,
|
||||
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 4,
|
||||
(u16*)response->data, gAtermReplyLength, gAtermConfigurationResult.connectionPrefix);
|
||||
gAtermMessageLength = messageLength;
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, messageLength, 0, &sendAddress);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
memset(&gScanSettings, 0, 0x254);
|
||||
gAtermProtocolState = 8;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#define IPL_SETTING_NOVTABLE
|
||||
#define IPL_SETTING_RECT_OUT_OF_LINE
|
||||
#define IPL_SETTING_IMPLEMENTATION
|
||||
#include "scene/setting/iplSetting.h"
|
||||
@@ -1510,8 +1509,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
|
||||
GXRenderModeObj renderMode;
|
||||
renderMode = *System::getRenderModeObj();
|
||||
GXRenderModeObj renderMode = *System::getRenderModeObj();
|
||||
u32 left;
|
||||
u32 top;
|
||||
u32 width;
|
||||
|
||||
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()
|
||||
@@ -1,130 +0,0 @@
|
||||
# revisit leaf — second-pass evidence (agent/w1007/revisit @ origin/main 29fe1efa)
|
||||
|
||||
Scope: iplSDChannelTitle (99.98883), ut_ArchiveFontBase (98.52), lyt_window (99.76),
|
||||
iplMemoryCardManager (97.88). Post-#834 (linkgap emit gates + .data object names).
|
||||
|
||||
## iplSDChannelTitle — all gates landed
|
||||
|
||||
Per-TU `IPL_SD_CHANNEL_TITLE_CPP` declared-only gates applied to:
|
||||
RuntimeTypeInfo.h DynamicCast, iplMathTypes.h VEC3 3-arg ctor, GUIManager.h
|
||||
(EventHandler setManager/setLatestEventCtrlNo/getLatestEventCtrlNo,
|
||||
Component setTriggerTarget, PaneComponent setPane/getPane), iplGraphics.h
|
||||
setOrthoTrans/setOrthoScale, iplSceneBase.h isReady/isResetProcessDone/getParent/
|
||||
getChild/getNext/getPrev, iplFaderSceneBase.h initCalcNormal/calcCommonAfter,
|
||||
iplNand.h File::isFinished/checkData, iplInterporation.h HermiteIntp<f32>::get
|
||||
(nested under IPL_CHANNEL_TITLE_NOVTABLE spec), Rect.h 0-arg ctor
|
||||
(IPL_SOUND_RECT_OUT_OF_LINE gate), iplGuiManager.h ~PaneManager.
|
||||
Deleted 2 unreferenced extern "C" trampolines (onTitleButtonEvent/onTitlePaneEvent)
|
||||
orig lacks. Result: all data sections 100%; .text 99.98883.
|
||||
|
||||
### VERIFIED WALL — dtor emission policy (decl-immune)
|
||||
Residual .text gap = 2 unreferenced weak deleting-dtor bodies
|
||||
(~FaderSceneBase 88B + ~FrameController 64B) + ~5 dangling no-reloc UNDs
|
||||
(__vt__LangFile, __vt__SDButtonEventHandlerBase, __vt__FrameController,
|
||||
mArg/typeInfo syms — symtab noise, no relocs). Orig's TU had these dtors
|
||||
trivial/implicit: ~SDChannelTitle calls ~Base directly (28 insns), Rect
|
||||
temporaries carry no dtor calls, so correct forms are `virtual ~X() {}`
|
||||
inline or NO decl at all. Declaring them out-of-line adds real `bl` calls →
|
||||
fuzzy dropped 99.98883→99.55799. Implicit/non-virtual variants still emit the
|
||||
weak bodies AND slightly regress — front-end-level MWCC instantiation drag,
|
||||
no decl form eliminates it. Remaining fn wall: flushSaveBeforeExit 98.59 —
|
||||
&smArg materialization register choice (orig r3→scratch r4, mine r4/r5→recv-first);
|
||||
8+ source forms all shift the home, never to r3.
|
||||
|
||||
## ut_ArchiveFontBase — ConstructOpAnalyzeGLGR 92.09 (956B)
|
||||
|
||||
20 normalized diffs, insns 116-147 of 239 — issue-order inside the
|
||||
ready-set around the CalcOffsetSheetFlags/CalcSizeFlagSet scratch math.
|
||||
Orig hoists lhz 0x1c (sheetGlyphCount) / lhz 0x24 (sheetCount) / lhz 0xe
|
||||
(dataBlockCount) + lwz 0x4c(r20) into the marshal block.
|
||||
FAILED variants: decl-order swap of the three u16s (identical 20 diffs —
|
||||
scheduler ignores decl order); moving ctx->m* tail stores adjacent to the
|
||||
u16 loads (regressed 20→108, whole-web rotation). Conclusion: pure list-
|
||||
scheduling tie, same family as before.
|
||||
|
||||
## lyt_window — DrawFrame 98.18 (1504B)
|
||||
|
||||
376=376 insns. One callee-window permutation: orig numbers the static
|
||||
flipInfos[] array base early (r21, first materialized at insn 36) pushing
|
||||
arg webs to r27-r31; mine puts it deepest (r31), args r26-r30. Same web
|
||||
count (12 callee webs r20-r31 both), identical prologue/epilogue; only the
|
||||
allocator's numbering differs. Plus a repeated stfsx/fadds store-weave in
|
||||
the 4 DRAW_QUAD_FOR_FRAME_1 corner blocks.
|
||||
FAILED variants: scoping polPt/polSize inside the macro (385 insns,
|
||||
worse); moving texSize decl after polPt/polSize (372 insns, worse).
|
||||
NOTE: paired-single ops — capstone can't decode psq_*/ps_* insns, so
|
||||
ndiff.py/disasm_fn.py truncate at the first one; use raw-word diffs.
|
||||
|
||||
## iplMemoryCardManager — 8 sub-100 fns all decomposed
|
||||
|
||||
- isMoveEnable/isCopyEnable (99.83), update_file_array (99.72),
|
||||
getComment (98.94): 0 normalized diffs — pure regname webs.
|
||||
- isBannerEnable (92.31, 26 insns, 7 diffs) + getBlocks (92.0, 25 insns,
|
||||
6 diffs): single diff = `addi r11,r1,0x20` restgpr-setup placement —
|
||||
orig emits it at tail (after the full member-chain load), mine hoists
|
||||
to slot 11. Folded-return variant (`return icons[slot][mFile..]` no
|
||||
locals) emits identical code — scheduler-internal, decl-form insensitive.
|
||||
Folded form kept (same output, terser).
|
||||
- _create_icon (87.55) + create_banner (90.42): `(base+const)+var`
|
||||
member-chain regroup — orig computes (&mFileCell + memberOffs) +
|
||||
(slot*row + file*0x15C combined index) with `this+0x10EC`/`this+0x110C`
|
||||
bases cached in callee regs reused across both GX_TF branches, and
|
||||
rematerializes &cell.icon per call (`add r3,...` then `add r24,...`
|
||||
post-bl) while mine pins it; marshal order `li r4,0` before `mr r3`
|
||||
in orig. FAILED variants: `MCFileCell* cell = &mFileCell[slot][file]`
|
||||
(90 insns — MWCC folded the pointer, worse); `mFileCell[0] +
|
||||
slot*0x7F + file` flat-index (89 insns — aggressive CSE, worse).
|
||||
Same documented mcard2 wall.
|
||||
|
||||
All units stay NonMatching — no shims, no flips. Every residual is a
|
||||
verified allocator/scheduler/emission-policy tie with source-form evidence.
|
||||
|
||||
## Round 2 (post-#834 rebase @11c75ddb) — sdChannelTitle emit-parity probe
|
||||
|
||||
Investigated per orchestrator hint whether the 152B weak-dtor + dangling-UND
|
||||
residual was the same dedup-loss family as channelTitle's symbols.txt fix.
|
||||
VERDICT: NOT a naming issue and NOT a flip blocker.
|
||||
|
||||
- orig iplSDChannelTitle.o: ZERO weak FUNC syms. Mine emits 2 unreferenced
|
||||
weak deleting-dtor bodies: `__dt__FaderSceneBase` (88B @0x1f4) +
|
||||
`__dt__FrameController` (64B @0xb30), plus 3 zero-reloc UND vtable refs
|
||||
(`__vt__FrameController`, `__vt__SDButtonEventHandlerBase`, `__vt__LangFile`).
|
||||
- orig iplFaderSceneBase.o's own view: `~FaderSceneBase` is DECLARED-ONLY
|
||||
(its `__dt__` is UND there, defined in another TU).
|
||||
- Tried `__declspec(novtable)` on all 4 classes under
|
||||
IPL_SD_CHANNEL_TITLE_CPP: removed the 3 dangling `__vt__` UNDs (correct
|
||||
mechanism — orig stores only most-derived vt) but weak bodies persisted.
|
||||
- Tried implicit-trivial dtor (removing decl): `__dt__FrameController` emit
|
||||
STOPPED (64B gone), but `calc()` vtable slot shifted 0x0c→0x08 →
|
||||
calcFadein/calcFadeout single-word diffs (`lwz r12,0x0c(r12)` vs 0x08)
|
||||
→ REVERTED everything.
|
||||
- CRITICAL PROOF these bodies are harmless: main's iplChannelTitle.o
|
||||
(unit fuzzy 100.0 post-#834) emits the IDENTICAL `__dt__FaderSceneBase`
|
||||
88B + `__dt__FrameController` 64B weak bodies that orig's .o lacks.
|
||||
They are linker-stripped dead emission; objdiff fn-pairing ignores them.
|
||||
=> The 152B was never the blocker. Real residual = flushSaveBeforeExit
|
||||
98.59 only.
|
||||
|
||||
## flushSaveBeforeExit — 6-diff → 2-diff minimum
|
||||
|
||||
Window is the `sm` (System globals) base web: orig binds &sm to r3 and
|
||||
loads +0x94→r4 (store), +0x28→r4 (heap arg), +0x94→r3 (recv); mine binds
|
||||
r4 and marshals recv before arg. Variants:
|
||||
- saveHeap decl hoisted above getSDPrevPage store: 2 diffs (base→r5,
|
||||
+0x28 load moved early) — closer but not orig's order.
|
||||
- `flushAsync(System::getMem2App())` inline: same 2 diffs, base→r4.
|
||||
Residual = base-web home + marshal eval order — allocator tie.
|
||||
|
||||
## GLGR — ready-set issue-order re-probes
|
||||
|
||||
- def-move (sheetGlyphCount/dataBlockCount to tail): 20→99 diffs, REGRESSION.
|
||||
- `u32 remWorkSpace = ctx->remWorkSpace()` hoist: 20→25, REGRESSION.
|
||||
- stepSheetFlags after flagsSheetsOff (dependency-chain reorder): identical
|
||||
20 diffs — MWCC issue-order insensitive to stmt order here. Wall stands.
|
||||
|
||||
## DrawFrame / MCManager re-verified
|
||||
|
||||
DrawFrame 376=376: flipInfos base pinned r21(orig)/r31(mine) + stfsx weave
|
||||
— callee-numbering tie unchanged. create_banner/_create_icon: `(base+const)
|
||||
+var` regroup + recompute-vs-CSE (`add r3,r29,r25` remat per call in orig)
|
||||
— same documented wall.
|
||||
@@ -1,48 +0,0 @@
|
||||
# setting leaf — attempt log
|
||||
|
||||
## Decode landed this wave
|
||||
|
||||
### iplSetting::draw — struct-copy emission split (91.53 → 97.69, unit 99.29 → 99.70)
|
||||
`GXRenderModeObj renderMode = *System::getRenderModeObj();` emitted a memcpy-style
|
||||
word-copy loop (lwzu/stwu, ~8 insns). Orig emits a memberwise copy (lhz/sth for u16
|
||||
fields, lwz/stw for u32, lbz/stb for the u8 arrays — ~30 insns).
|
||||
Fix: split declaration from assignment:
|
||||
```
|
||||
GXRenderModeObj renderMode;
|
||||
renderMode = *System::getRenderModeObj();
|
||||
```
|
||||
Copy-INITIALIZATION of a C++ POD goes through MWCC's aggregate/memcpy path;
|
||||
copy-ASSIGNMENT expands memberwise. draw now 629 vs orig 632 insns.
|
||||
|
||||
### AOSS_Init_old (prior session, committed this wave)
|
||||
dead-but-emitted else arm (`else if (state != 0)` chained-beq form), `0 <= x`
|
||||
bound form, `(u32)*ptr == 1u` cast, two switch→if/else decodes, ternary-arg Sleep.
|
||||
|
||||
## Walls verified (ties, not structure)
|
||||
|
||||
### scanAP — `subi+cntlzw` bool-materialization family (3 sites)
|
||||
`if (!mpMainLayout->getAnim(i)->isPlaying())` — orig materializes the callee's
|
||||
bool (`addi r0,r3,-1; cntlzw; rlwinm. r0,r0,27,5,31; bne`), mine fuses to
|
||||
`cmpwi 1; beq`. Tried: bool local, named Animator* local, `== true`, `== false`,
|
||||
`!= 0` on the inline's return, `AnimState`-typed and `u32`-typed mState —
|
||||
MWCC folds every form to the direct compare. No out-of-line isPlaying exists on
|
||||
either side. Residual also includes 2-3 insns of lwz/addi scheduling ties.
|
||||
|
||||
### convertRevIP (98.70)
|
||||
Normalized-identical instruction stream (73=73 insns); fuzzy residual is a
|
||||
word-level register binding — regname family.
|
||||
|
||||
### draw residual (97.69, -3 insns)
|
||||
Two clusters: a `bne`/`beq+lbz+b` 3-insn branch-layout diff around the
|
||||
browserWindow guard (O56-62), and an int→f32 divide/store scheduling window
|
||||
(`srawi/stw/lfd/fsubs/fmr`, O275-293). The `beq '#F'` diffs in the normalized
|
||||
log are normalization artifacts (branch-target immediates), not real diffs.
|
||||
|
||||
### AOSS/AOSSSendHelloRequest
|
||||
Identical unrolled CRC x8 structure verified; residual is table-base pinning.
|
||||
### ATERM Md5Update
|
||||
Index-form kept (fuzzy 91.26 > pointer-walk 84.21 — fuzzy is positional).
|
||||
|
||||
## Owner ruling (PR #973)
|
||||
Dead objects that only pad a section are forbidden; unreferenced .sbss/.data
|
||||
gaps stay unowned unless a target relocation references the address.
|
||||
Reference in New Issue
Block a user