Compare commits
48 Commits
agent/fix/
...
agent/w101
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43412cda74 | ||
|
|
db7e2411c4 | ||
|
|
eabdccd0e0 | ||
|
|
ff68f0759f | ||
|
|
1e6808e62e | ||
|
|
1d0e71e9d4 | ||
|
|
6ea8f7c565 | ||
|
|
aab5544fd4 | ||
|
|
100e6799e0 | ||
|
|
e31a07dd1b | ||
|
|
db245bc937 | ||
|
|
1bacdf5931 | ||
|
|
89cedd2cdc | ||
|
|
b77e122fe8 | ||
|
|
397d9799e3 | ||
|
|
df8a4192d1 | ||
|
|
2463589a0a | ||
|
|
a9fec2d2a7 | ||
|
|
bf1978a10f | ||
|
|
2e307c9dd3 | ||
|
|
9141e8a67e | ||
|
|
d069e4d02b | ||
|
|
9fd1c9117b | ||
|
|
226d9ef627 | ||
|
|
e47a8e949d | ||
|
|
fa7f4c26e8 | ||
|
|
239334ba8d | ||
|
|
179cd4e3c3 | ||
|
|
09fc62528e | ||
|
|
dbbdc3dd98 | ||
|
|
4789b7c32f | ||
|
|
ad5b9deae3 | ||
|
|
5046adc6da | ||
|
|
87214ff944 | ||
|
|
54ca052b41 | ||
|
|
2ce8487681 | ||
|
|
47fe453260 | ||
|
|
2d4cfa7094 | ||
|
|
e27d9e090a | ||
|
|
983a6a2448 | ||
|
|
c1e1157d8b | ||
|
|
005d3734f0 | ||
|
|
55891734ae | ||
|
|
20cf9f9f25 | ||
|
|
2a7cc791b1 | ||
|
|
b2c43f5a66 | ||
|
|
d9b8013644 | ||
|
|
40b87edd73 |
@@ -4584,11 +4584,11 @@ enqueueLoadNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB308; // type:f
|
||||
enqueuePageNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB364; // type:function size:0x5C
|
||||
enqueueResultNotice__Q33ipl5scene15SDChannelSelectFUl = .text:0x813DB3C0; // type:function size:0x5C
|
||||
enqueueChannelNotice__Q33ipl5scene15SDChannelSelectFUxUl = .text:0x813DB41C; // type:function size:0x5C
|
||||
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB478; // type:function size:0x5C
|
||||
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUx = .text:0x813DB478; // type:function size:0x5C
|
||||
enqueueStateNotice__Q33ipl5scene15SDChannelSelectFUxUl = .text:0x813DB4D4; // type:function size:0x5C
|
||||
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DB530; // type:function size:0x5C
|
||||
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB58C; // type:function size:0x60
|
||||
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB5EC; // type:function size:0x60
|
||||
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB530; // type:function size:0x5C
|
||||
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB58C; // type:function size:0x60
|
||||
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUx = .text:0x813DB5EC; // type:function size:0x60
|
||||
clearCommandQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB64C; // type:function size:0x40
|
||||
clearNoticeQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB68C; // type:function size:0x40
|
||||
processWorkerCommands__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB6CC; // type:function size:0x518
|
||||
@@ -4617,11 +4617,11 @@ updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // ty
|
||||
setDialogMessage__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DCEF0; // type:function size:0x24
|
||||
isCurrentTitleUsageEnough__Q33ipl5scene15SDChannelSelectCFPCl = .text:0x813DCF14; // type:function size:0xCC
|
||||
getCurrentTitleUsage__Q33ipl5scene15SDChannelSelectCFPlPl = .text:0x813DCFE0; // type:function size:0xCC
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
findAdjacentChannel__Q33ipl5scene15SDChannelSelectCFiPiPi = .text:0x813DDBB4; // type:function size:0xB4
|
||||
setCurrentPageAndRefresh__Q33ipl5scene15SDChannelSelectFiiPQ33ipl5scene12SDChannelObj = .text:0x813DDC68; // type:function size:0x18
|
||||
handleFourPageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDC80; // type:function size:0x58
|
||||
@@ -4762,7 +4762,7 @@ iplSDChannelTitle_updateParentalResult = .text:0x813E69B4; // type:function size
|
||||
iplSDChannelTitle_updateDialogResult = .text:0x813E6B88; // type:function size:0x144
|
||||
iplSDChannelTitle_startCopyProgress = .text:0x813E6CCC; // type:function size:0x158
|
||||
iplSDChannelTitle_updateCopyPrepare = .text:0x813E6E24; // type:function size:0x17C
|
||||
iplSDChannelTitle_copyTitleRange = .text:0x813E6FA0; // type:function size:0x14
|
||||
__as__Q43ipl5scene8SDMemory10TitleRangeFRCQ43ipl5scene8SDMemory10TitleRange = .text:0x813E6FA0; // type:function size:0x14 scope:weak
|
||||
iplSDChannelTitle_updateMemoryCalc = .text:0x813E6FB4; // type:function size:0xC0
|
||||
iplSDChannelTitle_updateCopyStart = .text:0x813E7074; // type:function size:0x130
|
||||
iplSDChannelTitle_updateAfterClearTmp = .text:0x813E71A4; // type:function size:0xA8
|
||||
@@ -4900,8 +4900,8 @@ onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function si
|
||||
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
|
||||
draw__Q33ipl5scene8SDMemoryFv = .text:0x813EEF30; // type:function size:0x88
|
||||
drawTransferTitles__Q33ipl5scene8SDMemoryFv = .text:0x813EEFB8; // type:function size:0x70C
|
||||
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
|
||||
setTitleRowColors__Q23ipl5sceneFPQ34nw4r3lyt7TextBoxRCQ34nw4r2ut5ColorRCQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
|
||||
__ct__Q34nw4r2ut5ColorFiiii = .text:0x813EF6C4; // type:function size:0x14
|
||||
SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
|
||||
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
|
||||
GetEndIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF728; // type:function size:0x8
|
||||
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
|
||||
@@ -23681,8 +23681,8 @@ RegionValid = .sbss:0x81698A48; // type:object size:0x4 data:4byte
|
||||
NandPending = .sbss:0x81698A4C; // type:object size:0x4 scope:local data:4byte
|
||||
CancelNand = .sbss:0x81698A50; // type:object size:0x4 scope:local data:4byte
|
||||
LowReadResult = .sbss:0x81698A54; // type:object size:0x4 scope:local data:4byte
|
||||
CacheCommandComplete = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
|
||||
AudioBufferUnconfigured = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
|
||||
CacheCommandComplete$1963 = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
|
||||
AudioBufferUnconfigured$2065 = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
|
||||
ResetTime = .sbss:0x81698A60; // type:object size:0x8 scope:local data:4byte
|
||||
SpinupDeadline = .sbss:0x81698A68; // type:object size:0x8 scope:local data:4byte
|
||||
CoverPollTime = .sbss:0x81698A70; // type:object size:0x8 data:4byte
|
||||
@@ -23690,15 +23690,13 @@ DriveWasReset = .sbss:0x81698A78; // type:object size:0x4 data:4byte
|
||||
TitleTicketView = .sbss:0x81698A7C; // type:object size:0x4 scope:local data:4byte
|
||||
CurrentTmd = .sbss:0x81698A80; // type:object size:0x4 scope:local data:4byte
|
||||
TitleCode = .sbss:0x81698A84; // type:object size:0x4 data:4byte
|
||||
RequiredIosHigh = .sbss:0x81698A88; // type:object size:0x4 data:4byte
|
||||
RequiredIosLow = .sbss:0x81698A8C; // type:object size:0x4 data:4byte
|
||||
RequiredIos = .sbss:0x81698A88; // type:object size:0x8 data:4byte
|
||||
GamePartition = .sbss:0x81698A90; // type:object size:0x4 data:4byte
|
||||
UpdatePartition = .sbss:0x81698A94; // type:object size:0x4 data:4byte
|
||||
PartitionCursor = .sbss:0x81698A98; // type:object size:0x4 data:4byte
|
||||
DataToc = .sbss:0x81698A9C; // type:object size:0x4 data:4byte
|
||||
GameToc = .sbss:0x81698AA0; // type:object size:0x8 data:4byte
|
||||
CoverOpenTimeHigh = .sbss:0x81698AA8; // type:object size:0x4 data:4byte
|
||||
CoverOpenTimeLow = .sbss:0x81698AAC; // type:object size:0x4 data:4byte
|
||||
CoverOpenTime = .sbss:0x81698AA8; // type:object size:0x8 data:4byte
|
||||
NandTransferred = .sbss:0x81698AB0; // type:object size:0x4 data:4byte
|
||||
NandLength = .sbss:0x81698AB4; // type:object size:0x4 data:4byte
|
||||
NandBuffer = .sbss:0x81698AB8; // type:object size:0x4 data:4byte
|
||||
|
||||
18
configure.py
18
configure.py
@@ -718,7 +718,7 @@ config.libs = [
|
||||
Object(Matching, "BS2/BS2Entry.c"),
|
||||
Object(Matching, "BS2/BS2.c"),
|
||||
Object(Matching, "BS2/BS2Init.c"),
|
||||
Object(NonMatching, "BS2/BS2Mach.c"),
|
||||
Object(Matching, "BS2/BS2Mach.c"),
|
||||
Object(Matching, "BS2/BS2Update.c"),
|
||||
Object(Matching, "BS2/BS2ParentalControl.c"),
|
||||
Object(Matching, "BS2/BS2BringUp.c"),
|
||||
@@ -814,7 +814,7 @@ config.libs = [
|
||||
IPLSection("memoryCard", [
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCard.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCardBase.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCardManager.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplGCSaveData.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplGCWindow.cpp"),
|
||||
]
|
||||
@@ -864,7 +864,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("sdChannelMemory", [
|
||||
Object(NonMatching, "scene/sdChannelMemory/iplSDMemory.cpp"),
|
||||
Object(Matching, "scene/sdChannelMemory/iplSDMemory.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("setting", [
|
||||
@@ -878,9 +878,9 @@ config.libs = [
|
||||
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSSLink.c"),
|
||||
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
|
||||
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline on,noauto"]),
|
||||
Object(Matching, "scene/setting/AOSSData.c"),
|
||||
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
|
||||
Object(NonMatching, "scene/setting/ATERM.c", mw_version="GC/3.0a5", extra_cflags=["-O4,p", "-inline on"]),
|
||||
]
|
||||
),
|
||||
IPLSection("settingSelect", [
|
||||
@@ -1049,7 +1049,7 @@ config.libs = [
|
||||
Object(Matching, "net/hmac.c"),
|
||||
Object(Matching, "net/neterrorcode.c"),
|
||||
Object(Matching, "net/NETVersion.c"),
|
||||
Object(NonMatching, "net/aes.c"),
|
||||
Object(Matching, "net/aes.c"),
|
||||
Object(Matching, "net/wireless_macaddr.c"),
|
||||
]
|
||||
),
|
||||
@@ -1202,7 +1202,7 @@ config.libs = [
|
||||
Object(Matching, "buffer/mkhdec3.c"),
|
||||
Object(Matching, "buffer/buffer_system.c"),
|
||||
Object(Matching, "buffer/getcode.c"),
|
||||
Object(NonMatching, "buffer/idct_block_var.c"),
|
||||
Object(Matching, "buffer/idct_block_var.c"),
|
||||
|
||||
Object(Matching, "api/decapi.c"),
|
||||
|
||||
@@ -1691,7 +1691,7 @@ config.libs = [
|
||||
Object(Matching, "fa/pdm_api.c"),
|
||||
Object(Matching, "fa/pdm_bpb.c"),
|
||||
Object(Matching, "fa/pdm_disk.c"),
|
||||
Object(NonMatching, "fa/pdm_partition.c"),
|
||||
Object(Matching, "fa/pdm_partition.c"),
|
||||
Object(Matching, "fa/pf_cache.c"),
|
||||
Object(Matching, "fa/pf_cluster.c"),
|
||||
Object(Matching, "fa/pf_dir.c"),
|
||||
@@ -1869,7 +1869,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("nup", [
|
||||
Object(NonMatching, "nup/nup.cpp"),
|
||||
Object(Matching, "nup/nup.cpp"),
|
||||
Object(Matching, "nup/nup_nhttp.cpp"),
|
||||
Object(Matching, "nup/nup_mem.cpp"),
|
||||
]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, CHANSVmObjHdr*);
|
||||
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, const CHANSVmObjHdr*);
|
||||
|
||||
typedef struct VmConvertEntry {
|
||||
VmConvertFunc convFunc[6]; // 0x00
|
||||
|
||||
@@ -12,6 +12,7 @@ extern void __sync();
|
||||
extern unsigned int __cntlzw(unsigned int value);
|
||||
extern void __memclr(void* buffer, int len);
|
||||
extern unsigned int __rlwimi(unsigned int a, unsigned int b, unsigned int c, unsigned int d, unsigned int e);
|
||||
extern unsigned int __rlwinm(unsigned int value, unsigned int shift, unsigned int maskBegin, unsigned int maskEnd);
|
||||
extern void* __alloca(unsigned int blockSize);
|
||||
extern int __abs(int n);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace textinput {
|
||||
class Base;
|
||||
class EventHandler;
|
||||
class LayoutByNW4R;
|
||||
struct InputFormAnimationFile;
|
||||
#endif
|
||||
class EditBuffer {
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
@@ -356,6 +357,7 @@ namespace textinput {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
friend class EventHandler;
|
||||
inline const nw4r::lyt::Pane* getLanguageTextPane() const;
|
||||
inline void addButtonAnimation(MEMAllocator*, nw4rmanager::AnmPane*, const InputFormAnimationFile* const&, const char*);
|
||||
#endif
|
||||
public:
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
|
||||
@@ -166,11 +166,11 @@ namespace ipl {
|
||||
void update_file_array(u8 slot);
|
||||
void update_change_cardstate(u8 slot);
|
||||
|
||||
GXTexObj* create_icon(u8 slot, s16 index);
|
||||
GXTexObj* create_icon(u8 slot, s16 index, long start);
|
||||
GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
|
||||
const GXTexObj* create_icon(u8 slot, s16 index);
|
||||
const GXTexObj* create_icon(u8 slot, s16 index, long start);
|
||||
const GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
|
||||
const wchar_t* getComment(u8 slot, s16 index, int which);
|
||||
GXTexObj* create_banner(u8 slot, s16 index);
|
||||
const GXTexObj* create_banner(u8 slot, s16 index);
|
||||
#ifdef IPL_GC_WINDOW_CPP
|
||||
u32 getBlocks(u8 slot, s16 index);
|
||||
#else
|
||||
@@ -187,7 +187,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
private:
|
||||
GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
|
||||
const GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObj(&mFileCell[slot][file].banner, data, CARD_BANNER_WIDTH, CARD_BANNER_HEIGHT,
|
||||
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
return &mFileCell[slot][file].banner;
|
||||
@@ -203,6 +203,22 @@ namespace ipl {
|
||||
return &mFileCell[slot][file].bannerTlut;
|
||||
}
|
||||
|
||||
const GXTexObj* initIconTexture(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObj(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
|
||||
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
return &mFileCell[slot][file].icon;
|
||||
}
|
||||
|
||||
void initIconTextureCI(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
|
||||
GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
}
|
||||
|
||||
GXTlutObj* initIconPalette(u8 slot, s32 file, void* data) {
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, data, GX_TL_RGB5A3, 0x100);
|
||||
return &mFileCell[slot][file].iconTlut;
|
||||
}
|
||||
|
||||
u32 reserved; // 0x00004
|
||||
MCFile mFile[2][CARD_MAX_FILE]; // 0x00008
|
||||
MCFileCell mFileCell[2][CARD_MAX_FILE]; // 0x00FE8
|
||||
|
||||
@@ -142,14 +142,9 @@ namespace ipl {
|
||||
u32 mTransferStatus;
|
||||
u64 mTransferStartTime;
|
||||
s32 mTransferFrame;
|
||||
struct TitleListState {
|
||||
ESTitleId* mpTitles;
|
||||
u32 mCount;
|
||||
ESTitleId* mpSecondaryTitles;
|
||||
u32 mSecondaryCount;
|
||||
ESTitleId* mpNames;
|
||||
u32 mNameCount;
|
||||
} mTitleListState;
|
||||
NandSDWorker::TitleIdList mTitleList;
|
||||
NandSDWorker::TitleIdList mNandTitleList;
|
||||
NandSDWorker::TitleIdList mSDTitleList;
|
||||
scroller mScroller;
|
||||
s32 mButtonState;
|
||||
u8 mControllerFlags[4];
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace ipl {
|
||||
BOOL onEventDerived(const char* paneName, u32 event,
|
||||
controller::Interface* controller);
|
||||
bool collectTitlesByUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
|
||||
static const char* mscChannelPaneNames[PAGE_COUNT][MAX_CHANNEL_INDEX];
|
||||
@@ -197,6 +197,8 @@ namespace ipl {
|
||||
friend class SDChannelSelectEventHandler;
|
||||
friend class SDChannelSelectButtonEventHandler;
|
||||
#endif
|
||||
friend class SDMemory;
|
||||
|
||||
void enqueueStartNotice();
|
||||
bool enqueueFinishNotice();
|
||||
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
|
||||
@@ -204,11 +206,14 @@ namespace ipl {
|
||||
bool enqueuePageNotice();
|
||||
bool enqueueResultNotice(u32 result);
|
||||
bool enqueueChannelNotice(u64 titleId, u32 value);
|
||||
bool enqueueMoveNotice(u32 controller, u32 page, u32 index);
|
||||
bool enqueueMoveNotice(ESTitleId titleId);
|
||||
bool enqueueStateNotice(u64 titleId, u32 state);
|
||||
bool enqueueErrorNotice(u32 page, u32 index);
|
||||
bool enqueueCommandNotice(u32 page, u32 index, u32 command);
|
||||
bool enqueueDeleteNotice(u32 controller, u32 page, u32 index);
|
||||
bool enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
|
||||
NandSDWorker::TitleIdList* replacingTitles);
|
||||
bool enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
|
||||
NandSDWorker::TitleIdList* foundTitles,
|
||||
NandSDWorker::TitleIdList* badTitles);
|
||||
bool enqueueDeleteNotice(ESTitleId titleId);
|
||||
void clearCommandQueue();
|
||||
void clearNoticeQueue();
|
||||
void calcChannelObjects();
|
||||
@@ -233,16 +238,16 @@ namespace ipl {
|
||||
bool isCurrentTitleUsageEnough(const s32* usage) const;
|
||||
void getCurrentTitleUsage(s32* bytes, s32* blocks) const;
|
||||
bool collectTitlesByChannelOrder(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesFromNandUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesBySpecialChannels(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesForMode(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount, int searchMode);
|
||||
bool findAdjacentChannel(int direction, int* page, int* index) const;
|
||||
void setStateAndPlaySelectSound(int state) NO_INLINE;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ipl {
|
||||
Manager(EGG::Heap* heap);
|
||||
|
||||
/** @return The message data in use. */
|
||||
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
|
||||
wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
|
||||
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
|
||||
|
||||
private:
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
/** @return The Message ID as a Wide-string. */
|
||||
static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
|
||||
static wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
|
||||
static message::Manager* getMessageManager() { return smArg.mpMessageMgr; }
|
||||
|
||||
static void* getFont();
|
||||
|
||||
@@ -22,7 +22,11 @@ int strcmp(const char* s1, const char* s2);
|
||||
char* strpbrk(const char* s1, const char* s2);
|
||||
size_t strspn(const char* s1, const char* s2);
|
||||
char* strtok(char* str, const char* delimiters);
|
||||
#ifdef __cplusplus
|
||||
const char* strstr(const char* str, const char* pat);
|
||||
#else
|
||||
char* strstr(const char* str, const char* pat);
|
||||
#endif
|
||||
|
||||
char* strncpy(char* dst, const char* src, size_t length);
|
||||
char* strncat(char* dst, const char* src, size_t length);
|
||||
@@ -39,4 +43,12 @@ int strcmpi(const char* s1, const char* s2);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C++" {
|
||||
inline char* strstr(char* str, const char* pat) {
|
||||
return const_cast<char*>(strstr(static_cast<const char*>(str), pat));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MSL_STRING_H
|
||||
|
||||
@@ -27,7 +27,11 @@ wchar_t* wcscat(wchar_t* dest, const wchar_t* src);
|
||||
wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num);
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num);
|
||||
wchar_t* wcschr(wchar_t* ws, wchar_t wc);
|
||||
#ifndef __cplusplus
|
||||
wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
#else
|
||||
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
#endif
|
||||
|
||||
int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...);
|
||||
int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg);
|
||||
@@ -36,6 +40,12 @@ int wcsnicmp(const char* dst, const char* src, size_t num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
extern "C++" {
|
||||
inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2) {
|
||||
return const_cast<wchar_t*>(wcsstr(static_cast<const wchar_t*>(s1), s2));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MSL_WCHAR_H
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace nw4r {
|
||||
const math::MTX34& GetMtx() const { return mMtx; }
|
||||
void SetMtx(const math::MTX34& mtx) { mMtx = mtx; }
|
||||
|
||||
u8 GetAlpha() { return mAlpha; }
|
||||
u8 GetAlpha() const { return mAlpha; }
|
||||
void SetAlpha(u8 alpha) { mAlpha = alpha; }
|
||||
|
||||
const char* GetName() const { return mName; }
|
||||
|
||||
@@ -55,16 +55,14 @@ namespace nw4r {
|
||||
NW4R_ASSERT(type < TEXTCOLOR_MAX);
|
||||
return mTextColors[type];
|
||||
}
|
||||
#ifdef IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
void SetTextColors(const ut::Color& first, const ut::Color& second) {
|
||||
mTextColors[0] = first;
|
||||
mTextColors[1] = second;
|
||||
}
|
||||
#endif
|
||||
void SetTextColor(u32 type, ut::Color value) {
|
||||
NW4R_ASSERT(type < TEXTCOLOR_MAX);
|
||||
mTextColors[type] = value;
|
||||
}
|
||||
void SetTextColor(ut::Color top, ut::Color bottom) {
|
||||
mTextColors[0] = top;
|
||||
mTextColors[1] = bottom;
|
||||
}
|
||||
|
||||
void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); }
|
||||
void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); }
|
||||
|
||||
@@ -10,10 +10,7 @@ static s32 clampU8(s32 value) {
|
||||
if (inRange) {
|
||||
return value;
|
||||
}
|
||||
if (value < 0) {
|
||||
return 0;
|
||||
}
|
||||
return 255;
|
||||
return value < 0 ? 0 : 255;
|
||||
}
|
||||
|
||||
static s32 clampS8(s32 value) {
|
||||
@@ -31,444 +28,507 @@ static s32 scalingClampU8(s32 value) {
|
||||
return value < 0 ? 0 : 255;
|
||||
}
|
||||
|
||||
static s32 clampLumaDc(s32 coefficient) {
|
||||
return clampU8((coefficient >> 11) + 0x80);
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
s32 workspace[64];
|
||||
s32* workspaceCursor;
|
||||
s32 evenBaseSum;
|
||||
s32 evenRotation;
|
||||
s32 pitch2;
|
||||
s32* dst;
|
||||
s32 rowOddOutput1;
|
||||
int columnAcBits;
|
||||
s32 column;
|
||||
s32 evenOutput3;
|
||||
s32 coefficient2;
|
||||
s32 coefficient1;
|
||||
s32 coefficient4;
|
||||
s32 coefficient5;
|
||||
s32 coefficient6;
|
||||
s32 coefficient7;
|
||||
s32 oddOutput0;
|
||||
s32 m;
|
||||
s32 evenBaseDifference;
|
||||
s32 processedCoefficients;
|
||||
s32 z;
|
||||
s32 evenOutput1;
|
||||
s32 oddOutput3;
|
||||
s32 oddLowRotation;
|
||||
s32 oddHighRotation;
|
||||
s32 evenRotationSum;
|
||||
s32 r;
|
||||
s32 oddOutput1;
|
||||
s32 oddSumRotation;
|
||||
s32 oddSumDifference;
|
||||
s32 oddDifferenceSum;
|
||||
s32 columnsRemaining;
|
||||
s32 oddOutput2;
|
||||
s32 evenOutput0;
|
||||
s32 evenOutput2;
|
||||
s32 coefficient3;
|
||||
s32 rowEvenOutput0;
|
||||
s32 columnC6;
|
||||
s32 columnC4;
|
||||
s32 columnOddSumRotation;
|
||||
s32 rowDc;
|
||||
s32 rowEvenOutput1;
|
||||
s32 columnC1;
|
||||
s32 columnEvenBaseDifference;
|
||||
s32 columnEvenOutput0;
|
||||
s32 columnC2;
|
||||
s32 columnScaledEvenRotation;
|
||||
s32 columnEvenOutput1;
|
||||
s32 columnC5;
|
||||
s32 rowC4;
|
||||
s32 rowOddSumRotation;
|
||||
s32 columnEvenOutput3;
|
||||
s32 columnOddLowSum;
|
||||
s32 columnOddLowDifference;
|
||||
s32 columnOddHighSum;
|
||||
s32 columnC7;
|
||||
s32 columnC3;
|
||||
s32 columnEvenBaseSum;
|
||||
s32 rowEvenBaseDifference;
|
||||
s32 rowEvenOutput2;
|
||||
s32 rowOddOutput0;
|
||||
s32 rowC1;
|
||||
s32 columnOddHighDifference;
|
||||
s32 columnDc;
|
||||
s32 columnOddDifferenceRotation;
|
||||
s32 columnOddOutput1;
|
||||
s32 rowScaledEvenRotation;
|
||||
s32 columnEvenOutput2;
|
||||
s32 columnOddMix;
|
||||
int rowAcBits;
|
||||
s32 columnEvenRotationSum;
|
||||
s32 rowEvenBaseSum;
|
||||
s32 rowC2;
|
||||
s32 rowEvenRotationSum;
|
||||
s32 rowEvenOutput3;
|
||||
s32 rowOddLowDifference;
|
||||
s32 columnOddOutput0;
|
||||
u8* columnOutput;
|
||||
s32 pitch4;
|
||||
s32* src;
|
||||
s32 rowC3;
|
||||
s32 rowOddHighDifference;
|
||||
s32 rowOddHighSum;
|
||||
s32 rowOddOutput3;
|
||||
s32 pitch7;
|
||||
s32 pitch6;
|
||||
s32 rowC6;
|
||||
s32 columnOddOutput2;
|
||||
u8 columnSample;
|
||||
s32 processed;
|
||||
s32 rowOddLowSum;
|
||||
s32 rowOddDifferenceRotation;
|
||||
s32 columnOddOutput3;
|
||||
s32 rowC5;
|
||||
s32 rowOddMix;
|
||||
s32 rowSampleDc;
|
||||
s32 rowOddOutput2;
|
||||
s32 rowC7;
|
||||
s32 rowCount;
|
||||
s32 pitch5;
|
||||
s32 pitch3;
|
||||
s32 workspace[64];
|
||||
s32 rowEvenSum;
|
||||
s32 rowOddLowRotation;
|
||||
s32 rowEvenRotation;
|
||||
s32 rowOddDifferenceSum;
|
||||
s32 rowOddHighRotation;
|
||||
s32 rowOddSumDifference;
|
||||
s32 columnOddDifferenceSum;
|
||||
s32 columnOddHighRotation;
|
||||
s32 columnOddLowRotation;
|
||||
s32 columnEvenRotation;
|
||||
s32 columnOddSumDifference;
|
||||
int columnEvenSum;
|
||||
|
||||
r = (zigzag >> 4) * 8;
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
{
|
||||
for (; processedCoefficients < r; processedCoefficients += 8) {
|
||||
u32 acBits;
|
||||
coefficient4 = block[4];
|
||||
coefficient6 = block[6];
|
||||
coefficient2 = block[2];
|
||||
coefficient1 = block[1];
|
||||
coefficient7 = block[7];
|
||||
coefficient5 = block[5];
|
||||
coefficient3 = block[3];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample = block[0];
|
||||
workspaceCursor[7] = sample;
|
||||
workspaceCursor[6] = sample;
|
||||
workspaceCursor[5] = sample;
|
||||
workspaceCursor[4] = sample;
|
||||
workspaceCursor[3] = sample;
|
||||
workspaceCursor[2] = sample;
|
||||
workspaceCursor[1] = sample;
|
||||
workspaceCursor[0] = sample;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
evenRotation = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
evenRotationSum = coefficient6 + coefficient2;
|
||||
evenRotation = evenRotation * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
evenRotationSum = evenRotation + evenRotationSum;
|
||||
evenOutput1 = evenBaseDifference + evenRotation;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + evenRotationSum;
|
||||
evenOutput3 = evenBaseSum - evenRotationSum;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - evenRotation;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
oddOutput0 = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
workspaceCursor[0] = evenOutput0 + oddOutput0;
|
||||
oddLowRotation = oddLowDifference * 0x8B;
|
||||
workspaceCursor[7] = evenOutput0 - oddOutput0;
|
||||
oddLowRotation >>= 8;
|
||||
workspaceCursor[1] = evenOutput1 + oddOutput1;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
workspaceCursor[6] = evenOutput1 - oddOutput1;
|
||||
workspaceCursor[2] = evenOutput2 + oddOutput2;
|
||||
workspaceCursor[5] = evenOutput2 - oddOutput2;
|
||||
workspaceCursor[3] = evenOutput3 + oddOutput3;
|
||||
workspaceCursor[4] = evenOutput3 - oddOutput3;
|
||||
}
|
||||
block += 8;
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
}
|
||||
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
r = pitch * 8 - pitch;
|
||||
z = pitch * 4;
|
||||
m = pitch * 2;
|
||||
workspaceCursor = workspace + 7;
|
||||
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
|
||||
u32 acBits;
|
||||
u8* output;
|
||||
|
||||
coefficient4 = workspaceCursor[0x20];
|
||||
coefficient6 = workspaceCursor[0x30];
|
||||
coefficient2 = workspaceCursor[0x10];
|
||||
coefficient1 = workspaceCursor[8];
|
||||
coefficient7 = workspaceCursor[0x38];
|
||||
coefficient5 = workspaceCursor[0x28];
|
||||
coefficient3 = workspaceCursor[0x18];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
output = conv_row_ptr + column;
|
||||
if (acBits == 0) {
|
||||
u8 sample = clampU8((*workspaceCursor >> 11) + 0x80);
|
||||
output[r] = sample;
|
||||
output[pitch * 6] = sample;
|
||||
output[z + pitch] = sample;
|
||||
output[z] = sample;
|
||||
output[z - pitch] = sample;
|
||||
output[m] = sample;
|
||||
output[pitch] = sample;
|
||||
output[0] = sample;
|
||||
rowCount = (zigzag >> 4) * 8;
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowC4 = block[4];
|
||||
rowC6 = block[6];
|
||||
rowC2 = block[2];
|
||||
rowC1 = block[1];
|
||||
rowC7 = block[7];
|
||||
rowC5 = block[5];
|
||||
rowC3 = block[3];
|
||||
rowAcBits = rowC4 | rowC6;
|
||||
rowAcBits = rowC2 | rowAcBits;
|
||||
rowAcBits = rowC1 | rowAcBits;
|
||||
rowAcBits = rowC7 | rowAcBits;
|
||||
rowAcBits = rowC5 | rowAcBits;
|
||||
rowAcBits = rowC3 | rowAcBits;
|
||||
if (rowAcBits == 0) {
|
||||
rowSampleDc = block[0];
|
||||
dst[7] = rowSampleDc;
|
||||
dst[6] = rowSampleDc;
|
||||
dst[5] = rowSampleDc;
|
||||
dst[4] = rowSampleDc;
|
||||
dst[3] = rowSampleDc;
|
||||
dst[2] = rowSampleDc;
|
||||
dst[1] = rowSampleDc;
|
||||
dst[0] = rowSampleDc;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 dcValue;
|
||||
|
||||
evenRotation = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
coefficient5 = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
coefficient1 = coefficient1 - coefficient7;
|
||||
evenRotationSum = coefficient6 + coefficient2;
|
||||
coefficient2 = evenRotation * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = coefficient5 + coefficient1;
|
||||
dcValue = *workspaceCursor + 0x40000;
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
evenRotationSum = coefficient2 + evenRotationSum;
|
||||
evenOutput1 = evenBaseDifference + coefficient2;
|
||||
oddDifferenceSum = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + evenRotationSum;
|
||||
evenOutput3 = evenBaseSum - evenRotationSum;
|
||||
oddHighRotation = coefficient1 * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - coefficient2;
|
||||
oddHighRotation = oddHighRotation - oddDifferenceSum;
|
||||
oddLowSum += oddHighRotation;
|
||||
oddOutput0 = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + oddHighRotation;
|
||||
oddLowRotation = coefficient5 * 0x8B >> 8;
|
||||
oddOutput3 = oddDifferenceSum + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
output[0] = scalingClampU8(evenOutput0 + oddOutput0);
|
||||
output[r] = scalingClampU8(evenOutput0 - oddOutput0);
|
||||
output[pitch] = scalingClampU8(evenOutput1 + oddOutput1);
|
||||
output[pitch * 6] = scalingClampU8(evenOutput1 - oddOutput1);
|
||||
output[m] = scalingClampU8(evenOutput2 + oddOutput2);
|
||||
output[z + pitch] = scalingClampU8(evenOutput2 - oddOutput2);
|
||||
output[z - pitch] = scalingClampU8(evenOutput3 + oddOutput3);
|
||||
output[z] = scalingClampU8(evenOutput3 - oddOutput3);
|
||||
rowDc = block[0];
|
||||
rowEvenRotation = rowC2 - rowC6;
|
||||
rowEvenSum = rowC2 + rowC6;
|
||||
rowEvenBaseSum = rowDc + rowC4;
|
||||
rowEvenBaseDifference = rowDc - rowC4;
|
||||
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
|
||||
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
|
||||
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
|
||||
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
|
||||
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
|
||||
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
|
||||
rowOddHighSum = rowC1 + rowC7;
|
||||
rowOddHighDifference = rowC1 - rowC7;
|
||||
rowOddLowSum = rowC5 + rowC3;
|
||||
rowOddLowDifference = rowC5 - rowC3;
|
||||
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
|
||||
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
|
||||
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
|
||||
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
|
||||
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
|
||||
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
|
||||
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
|
||||
rowOddLowSum += rowOddMix;
|
||||
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
|
||||
rowOddOutput1 = rowOddSumRotation + rowOddMix;
|
||||
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
|
||||
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
|
||||
dst[0] = rowEvenOutput0 + rowOddOutput0;
|
||||
dst[7] = rowEvenOutput0 - rowOddOutput0;
|
||||
dst[1] = rowEvenOutput1 + rowOddOutput1;
|
||||
dst[6] = rowEvenOutput1 - rowOddOutput1;
|
||||
dst[2] = rowEvenOutput2 + rowOddOutput2;
|
||||
dst[5] = rowEvenOutput2 - rowOddOutput2;
|
||||
dst[3] = rowEvenOutput3 + rowOddOutput3;
|
||||
dst[4] = rowEvenOutput3 - rowOddOutput3;
|
||||
}
|
||||
workspaceCursor--;
|
||||
block += 8;
|
||||
dst += 8;
|
||||
}
|
||||
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
|
||||
src = workspace + 7;
|
||||
pitch4 = pitch * 4;
|
||||
pitch5 = pitch4 + pitch;
|
||||
pitch3 = pitch4 - pitch;
|
||||
pitch2 = pitch * 2;
|
||||
pitch6 = pitch * 6;
|
||||
pitch7 = pitch * 8 - pitch;
|
||||
for (column = 7; column >= 0; column--) {
|
||||
columnC4 = src[32];
|
||||
columnC6 = src[48];
|
||||
columnC2 = src[16];
|
||||
columnC1 = src[8];
|
||||
columnC7 = src[56];
|
||||
columnC5 = src[40];
|
||||
columnC3 = src[24];
|
||||
columnAcBits = columnC4 | columnC6;
|
||||
columnAcBits = columnC2 | columnAcBits;
|
||||
columnAcBits = columnC1 | columnAcBits;
|
||||
columnAcBits = columnC7 | columnAcBits;
|
||||
columnAcBits = columnC5 | columnAcBits;
|
||||
columnAcBits = columnC3 | columnAcBits;
|
||||
columnOutput = conv_row_ptr + column;
|
||||
if (columnAcBits == 0) {
|
||||
columnSample = clampLumaDc(*src);
|
||||
columnOutput[pitch7] = columnSample;
|
||||
columnOutput[pitch6] = columnSample;
|
||||
columnOutput[pitch5] = columnSample;
|
||||
columnOutput[pitch4] = columnSample;
|
||||
columnOutput[pitch3] = columnSample;
|
||||
columnOutput[pitch2] = columnSample;
|
||||
columnOutput[pitch] = columnSample;
|
||||
columnOutput[0] = columnSample;
|
||||
} else {
|
||||
columnEvenSum = columnC6 + columnC2;
|
||||
columnEvenRotation = columnC2 - columnC6;
|
||||
columnOddLowSum = columnC5 + columnC3;
|
||||
columnOddHighDifference = columnC1 - columnC7;
|
||||
columnOddLowDifference = columnC5 - columnC3;
|
||||
columnOddHighSum = columnC1 + columnC7;
|
||||
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
|
||||
columnDc = *src + 0x40000;
|
||||
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
|
||||
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
|
||||
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
|
||||
columnEvenBaseSum = columnDc + columnC4;
|
||||
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
|
||||
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
|
||||
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
|
||||
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
|
||||
columnOddLowSum += columnOddMix;
|
||||
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
|
||||
columnEvenBaseDifference = columnDc - columnC4;
|
||||
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
|
||||
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
|
||||
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
|
||||
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
|
||||
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
|
||||
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
|
||||
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
|
||||
columnOddOutput1 = columnOddSumRotation + columnOddMix;
|
||||
columnOutput[0] = scalingClampU8(columnEvenOutput0 + columnOddOutput0);
|
||||
columnOutput[pitch7] = scalingClampU8(columnEvenOutput0 - columnOddOutput0);
|
||||
columnOutput[pitch] = scalingClampU8(columnEvenOutput1 + columnOddOutput1);
|
||||
columnOutput[pitch6] = scalingClampU8(columnEvenOutput1 - columnOddOutput1);
|
||||
columnOutput[pitch2] = scalingClampU8(columnEvenOutput2 + columnOddOutput2);
|
||||
columnOutput[pitch5] = scalingClampU8(columnEvenOutput2 - columnOddOutput2);
|
||||
columnOutput[pitch3] = scalingClampU8(columnEvenOutput3 + columnOddOutput3);
|
||||
columnOutput[pitch4] = scalingClampU8(columnEvenOutput3 - columnOddOutput3);
|
||||
}
|
||||
src--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static s32 clampChromaDc(s32 value) {
|
||||
return clampS8(value >> 11);
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
s32 workspace[64];
|
||||
s32* workspaceCursor;
|
||||
s32 evenBaseDifference;
|
||||
s32 columnsRemaining;
|
||||
s32 evenBaseSum;
|
||||
s32 coefficient1;
|
||||
s32 coefficient2;
|
||||
s32 coefficient3;
|
||||
s32 coefficient4;
|
||||
s32 coefficient5;
|
||||
s32 coefficient6;
|
||||
s32 coefficient7;
|
||||
s32 v;
|
||||
s32 rowCoefficientCount;
|
||||
s32 processedCoefficients;
|
||||
s32 rowCount;
|
||||
s32 columnOddSumRotation;
|
||||
s32 rowOddOutput1;
|
||||
s32 columnC1;
|
||||
int rowAcBits;
|
||||
s32 columnEvenBaseDifference;
|
||||
s32 columnC7;
|
||||
s32 rowDc;
|
||||
s32 rowOddSumRotation;
|
||||
s32 rowEvenBaseSum;
|
||||
s32 columnOddDifferenceRotation;
|
||||
s32 columnEvenRotationSum;
|
||||
s32* dst;
|
||||
s32 columnOddOutput2;
|
||||
s32 sparseDc;
|
||||
s32 rowOddDifferenceRotation;
|
||||
s32 columnOddOutput1;
|
||||
s32 rowOddOutput2;
|
||||
s32 columnDc;
|
||||
s32 columnEvenBaseSum;
|
||||
s32* src;
|
||||
s32 rowOuter;
|
||||
s32 processed;
|
||||
s32 columnC6;
|
||||
s32 rowOdd;
|
||||
s32 column;
|
||||
s32 m;
|
||||
s32 n;
|
||||
s32 oddOutput1;
|
||||
s32 oddSumRotation;
|
||||
s32 oddOutput2;
|
||||
s32 evenOutput2;
|
||||
s32 u;
|
||||
s32 evenOutput0;
|
||||
s32 oddOutput3;
|
||||
s32 rotation45;
|
||||
s32 z;
|
||||
s32 oddSumDifference;
|
||||
s32 oddDifferenceSum;
|
||||
s32 oddHighRotation;
|
||||
s32 oddLowRotation;
|
||||
s32 evenOutput3;
|
||||
s32 columnOddOutput3;
|
||||
s32 rowSampleDc;
|
||||
s32 rowOddOutput0;
|
||||
s32 rowC3;
|
||||
s32 columnScaledEvenRotation;
|
||||
s32 rowRotation;
|
||||
s32 rowEvenOutput2;
|
||||
s32 rowC2;
|
||||
s32 rowEvenBaseDifference;
|
||||
s32 columnC5;
|
||||
s32 rowEvenRotationSum;
|
||||
s32 columnOddOutput0;
|
||||
s32 rowC1;
|
||||
int columnAcBits;
|
||||
s32 columnC4;
|
||||
s32 columnOddMix;
|
||||
s32 columnOddLowSum;
|
||||
s32 rowEvenOutput1;
|
||||
s32 rowLowRotation;
|
||||
s32 columnC3;
|
||||
s32 rowOddHighDifference;
|
||||
s32 rowC5;
|
||||
s32 columnEvenOutput0;
|
||||
s32 rowEvenOutput0;
|
||||
s32 rowOddMix;
|
||||
s32 rowEvenOutput3;
|
||||
s32 rowC4;
|
||||
s32 rowInner;
|
||||
s32 rowC6;
|
||||
s32 columnEvenOutput1;
|
||||
s32 rowScaledEvenRotation;
|
||||
s32 rowOddLowDifference;
|
||||
s32 rowC7;
|
||||
s32 rowOddOutput3;
|
||||
s32 columnEvenOutput3;
|
||||
s32 rowMid;
|
||||
s32 columnOddHighDifference;
|
||||
s32 columnEvenOutput2;
|
||||
s32 columnC2;
|
||||
s32 columnOddLowDifference;
|
||||
s32 columnOddHighSum;
|
||||
s32 rowOddHighSum;
|
||||
s32 rowOddLowSum;
|
||||
u8* columnOutput;
|
||||
s32 columnOddLowRotation;
|
||||
s32 rowEvenSum;
|
||||
s32 flatDc;
|
||||
s32 columnEvenRotation;
|
||||
s32 rowOddDifferenceSum;
|
||||
s32 rowOddSumDifference;
|
||||
s32 columnSample;
|
||||
s32 columnOddDifferenceSum;
|
||||
int columnEvenSum;
|
||||
s32 rowOddHighRotation;
|
||||
s32 workspace[64];
|
||||
s32 rowOddLowRotation;
|
||||
s32 rowSample;
|
||||
s32 rowEvenRotation;
|
||||
s32 columnOddHighRotation;
|
||||
s32 columnOddSumDifference;
|
||||
s32 rowMix;
|
||||
|
||||
if (zigzag == 0x11) {
|
||||
s32 sample;
|
||||
sample = clampS8(block[0] >> 11);
|
||||
memset(conv_row_ptr, (s8)sample, 0x40);
|
||||
flatDc = block[0];
|
||||
rowSample = clampS8(flatDc >> 11);
|
||||
memset(conv_row_ptr, (s8)rowSample, 64);
|
||||
return;
|
||||
}
|
||||
|
||||
rowCoefficientCount = (zigzag >> 4) * 8;
|
||||
if ((zigzag & 0xF) > 2) {
|
||||
goto fullRowTransform;
|
||||
}
|
||||
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
|
||||
s32 dcValue;
|
||||
s32 oddCoefficient;
|
||||
|
||||
oddCoefficient = block[1];
|
||||
dcValue = block[0];
|
||||
rotation45 = oddCoefficient * 0xB5 >> 8;
|
||||
v = oddCoefficient * 0x62 >> 8;
|
||||
u = v + rotation45;
|
||||
z = (oddCoefficient * 0x14E >> 8) - v;
|
||||
m = oddCoefficient + z;
|
||||
n = rotation45 + z;
|
||||
workspaceCursor[0] = dcValue + m;
|
||||
workspaceCursor[7] = dcValue - m;
|
||||
workspaceCursor[1] = dcValue + n;
|
||||
workspaceCursor[6] = dcValue - n;
|
||||
workspaceCursor[2] = dcValue + u;
|
||||
workspaceCursor[5] = dcValue - u;
|
||||
workspaceCursor[3] = dcValue + v;
|
||||
workspaceCursor[4] = dcValue - v;
|
||||
workspaceCursor += 8;
|
||||
block += 8;
|
||||
}
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
goto columnTransform;
|
||||
|
||||
fullRowTransform:
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
|
||||
u32 acBits;
|
||||
coefficient4 = block[4];
|
||||
coefficient6 = block[6];
|
||||
coefficient2 = block[2];
|
||||
coefficient1 = block[1];
|
||||
coefficient7 = block[7];
|
||||
coefficient5 = block[5];
|
||||
coefficient3 = block[3];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample;
|
||||
sample = block[0];
|
||||
workspaceCursor[7] = sample;
|
||||
workspaceCursor[6] = sample;
|
||||
workspaceCursor[5] = sample;
|
||||
workspaceCursor[4] = sample;
|
||||
workspaceCursor[3] = sample;
|
||||
workspaceCursor[2] = sample;
|
||||
workspaceCursor[1] = sample;
|
||||
workspaceCursor[0] = sample;
|
||||
rowCount = (zigzag >> 4) * 8;
|
||||
if ((zigzag & 0xF) <= 2) {
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowOdd = block[1];
|
||||
rowRotation = rowOdd * 0xB5 >> 8;
|
||||
rowLowRotation = rowOdd * 0x62 >> 8;
|
||||
sparseDc = block[0];
|
||||
rowMix = (rowOdd * 0x14E >> 8) - rowLowRotation;
|
||||
rowOuter = rowOdd + rowMix;
|
||||
dst[0] = sparseDc + rowOuter;
|
||||
rowInner = rowRotation + rowMix;
|
||||
dst[7] = sparseDc - rowOuter;
|
||||
dst[1] = sparseDc + rowInner;
|
||||
rowMid = rowLowRotation + rowRotation;
|
||||
dst[6] = sparseDc - rowInner;
|
||||
dst[2] = sparseDc + rowMid;
|
||||
dst[5] = sparseDc - rowMid;
|
||||
dst[3] = sparseDc + rowLowRotation;
|
||||
dst[4] = sparseDc - rowLowRotation;
|
||||
dst += 8;
|
||||
block += 8;
|
||||
}
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
} else {
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowC4 = block[4];
|
||||
rowC6 = block[6];
|
||||
rowC2 = block[2];
|
||||
rowC1 = block[1];
|
||||
rowC7 = block[7];
|
||||
rowC5 = block[5];
|
||||
rowC3 = block[3];
|
||||
rowAcBits = rowC4 | rowC6;
|
||||
rowAcBits = rowC2 | rowAcBits;
|
||||
rowAcBits = rowC1 | rowAcBits;
|
||||
rowAcBits = rowC7 | rowAcBits;
|
||||
rowAcBits = rowC5 | rowAcBits;
|
||||
rowAcBits = rowC3 | rowAcBits;
|
||||
if (rowAcBits == 0) {
|
||||
rowSampleDc = block[0];
|
||||
dst[7] = rowSampleDc;
|
||||
dst[6] = rowSampleDc;
|
||||
dst[5] = rowSampleDc;
|
||||
dst[4] = rowSampleDc;
|
||||
dst[3] = rowSampleDc;
|
||||
dst[2] = rowSampleDc;
|
||||
dst[1] = rowSampleDc;
|
||||
dst[0] = rowSampleDc;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
rotation45 = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
u = coefficient6 + coefficient2;
|
||||
rotation45 = rotation45 * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
u = rotation45 + u;
|
||||
v = evenBaseDifference + rotation45;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + u;
|
||||
evenOutput3 = evenBaseSum - u;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - rotation45;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
workspaceCursor[0] = evenOutput0 + n;
|
||||
oddLowRotation = oddLowDifference * 0x8B;
|
||||
workspaceCursor[7] = evenOutput0 - n;
|
||||
oddLowRotation >>= 8;
|
||||
workspaceCursor[1] = v + oddOutput1;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
workspaceCursor[6] = v - oddOutput1;
|
||||
workspaceCursor[2] = evenOutput2 + oddOutput2;
|
||||
workspaceCursor[5] = evenOutput2 - oddOutput2;
|
||||
workspaceCursor[3] = evenOutput3 + oddOutput3;
|
||||
workspaceCursor[4] = evenOutput3 - oddOutput3;
|
||||
rowDc = block[0];
|
||||
rowEvenRotation = rowC2 - rowC6;
|
||||
rowEvenSum = rowC2 + rowC6;
|
||||
rowEvenBaseSum = rowDc + rowC4;
|
||||
rowEvenBaseDifference = rowDc - rowC4;
|
||||
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
|
||||
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
|
||||
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
|
||||
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
|
||||
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
|
||||
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
|
||||
rowOddHighSum = rowC1 + rowC7;
|
||||
rowOddHighDifference = rowC1 - rowC7;
|
||||
rowOddLowSum = rowC5 + rowC3;
|
||||
rowOddLowDifference = rowC5 - rowC3;
|
||||
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
|
||||
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
|
||||
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
|
||||
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
|
||||
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
|
||||
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
|
||||
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
|
||||
rowOddLowSum += rowOddMix;
|
||||
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
|
||||
rowOddOutput1 = rowOddSumRotation + rowOddMix;
|
||||
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
|
||||
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
|
||||
dst[0] = rowEvenOutput0 + rowOddOutput0;
|
||||
dst[7] = rowEvenOutput0 - rowOddOutput0;
|
||||
dst[1] = rowEvenOutput1 + rowOddOutput1;
|
||||
dst[6] = rowEvenOutput1 - rowOddOutput1;
|
||||
dst[2] = rowEvenOutput2 + rowOddOutput2;
|
||||
dst[5] = rowEvenOutput2 - rowOddOutput2;
|
||||
dst[3] = rowEvenOutput3 + rowOddOutput3;
|
||||
dst[4] = rowEvenOutput3 - rowOddOutput3;
|
||||
}
|
||||
block += 8;
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
columnTransform:
|
||||
|
||||
workspaceCursor = workspace + 7;
|
||||
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
|
||||
u32 acBits;
|
||||
u8* output;
|
||||
coefficient4 = workspaceCursor[0x20];
|
||||
output = conv_row_ptr + column;
|
||||
coefficient6 = workspaceCursor[0x30];
|
||||
coefficient2 = workspaceCursor[0x10];
|
||||
coefficient1 = workspaceCursor[8];
|
||||
coefficient7 = workspaceCursor[0x38];
|
||||
coefficient5 = workspaceCursor[0x28];
|
||||
coefficient3 = workspaceCursor[0x18];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample;
|
||||
sample = clampS8(*workspaceCursor >> 11);
|
||||
output[56] = (u8)sample;
|
||||
output[48] = (u8)sample;
|
||||
output[40] = (u8)sample;
|
||||
output[32] = (u8)sample;
|
||||
output[24] = (u8)sample;
|
||||
output[16] = (u8)sample;
|
||||
output[8] = (u8)sample;
|
||||
output[0] = (u8)sample;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
rotation45 = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
u = coefficient6 + coefficient2;
|
||||
rotation45 = rotation45 * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = *workspaceCursor;
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
u = rotation45 + u;
|
||||
v = evenBaseDifference + rotation45;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + u;
|
||||
evenOutput3 = evenBaseSum - u;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - rotation45;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
oddLowRotation = oddLowDifference * 0x8B >> 8;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
output[0] = (u8)clampS8((evenOutput0 + n) >> 11);
|
||||
output[56] = (u8)clampS8((evenOutput0 - n) >> 11);
|
||||
output[8] = (u8)clampS8((v + oddOutput1) >> 11);
|
||||
output[48] = (u8)clampS8((v - oddOutput1) >> 11);
|
||||
output[16] = (u8)clampS8((evenOutput2 + oddOutput2) >> 11);
|
||||
output[40] = (u8)clampS8((evenOutput2 - oddOutput2) >> 11);
|
||||
output[24] = (u8)clampS8((evenOutput3 + oddOutput3) >> 11);
|
||||
output[32] = (u8)clampS8((evenOutput3 - oddOutput3) >> 11);
|
||||
dst += 8;
|
||||
}
|
||||
workspaceCursor--;
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
}
|
||||
|
||||
src = workspace + 7;
|
||||
for (column = 7; column >= 0; column--) {
|
||||
columnC4 = src[32];
|
||||
columnOutput = conv_row_ptr + column;
|
||||
columnC6 = src[48];
|
||||
columnC2 = src[16];
|
||||
columnC1 = src[8];
|
||||
columnC7 = src[56];
|
||||
columnC5 = src[40];
|
||||
columnC3 = src[24];
|
||||
columnAcBits = columnC4 | columnC6;
|
||||
columnAcBits = columnC2 | columnAcBits;
|
||||
columnAcBits = columnC1 | columnAcBits;
|
||||
columnAcBits = columnC7 | columnAcBits;
|
||||
columnAcBits = columnC5 | columnAcBits;
|
||||
columnAcBits = columnC3 | columnAcBits;
|
||||
if (columnAcBits == 0) {
|
||||
columnSample = clampChromaDc(*src);
|
||||
columnOutput[56] = (u8)columnSample;
|
||||
columnOutput[48] = (u8)columnSample;
|
||||
columnOutput[40] = (u8)columnSample;
|
||||
columnOutput[32] = (u8)columnSample;
|
||||
columnOutput[24] = (u8)columnSample;
|
||||
columnOutput[16] = (u8)columnSample;
|
||||
columnOutput[8] = (u8)columnSample;
|
||||
columnOutput[0] = (u8)columnSample;
|
||||
} else {
|
||||
columnOddHighSum = columnC1 + columnC7;
|
||||
columnEvenRotation = columnC2 - columnC6;
|
||||
columnOddLowSum = columnC5 + columnC3;
|
||||
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
|
||||
columnEvenSum = columnC6 + columnC2;
|
||||
columnOddLowDifference = columnC5 - columnC3;
|
||||
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
|
||||
columnOddHighDifference = columnC1 - columnC7;
|
||||
columnDc = *src;
|
||||
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
|
||||
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
|
||||
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
|
||||
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
|
||||
columnEvenBaseDifference = columnDc - columnC4;
|
||||
columnEvenBaseSum = columnDc + columnC4;
|
||||
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
|
||||
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
|
||||
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
|
||||
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
|
||||
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
|
||||
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
|
||||
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
|
||||
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
|
||||
columnOddLowSum += columnOddMix;
|
||||
columnOddOutput1 = columnOddSumRotation + columnOddMix;
|
||||
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
|
||||
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
|
||||
columnOutput[0] = (u8)clampS8((columnEvenOutput0 + columnOddOutput0) >> 11);
|
||||
columnOutput[56] = (u8)clampS8((columnEvenOutput0 - columnOddOutput0) >> 11);
|
||||
columnOutput[8] = (u8)clampS8((columnEvenOutput1 + columnOddOutput1) >> 11);
|
||||
columnOutput[48] = (u8)clampS8((columnEvenOutput1 - columnOddOutput1) >> 11);
|
||||
columnOutput[16] = (u8)clampS8((columnEvenOutput2 + columnOddOutput2) >> 11);
|
||||
columnOutput[40] = (u8)clampS8((columnEvenOutput2 - columnOddOutput2) >> 11);
|
||||
columnOutput[24] = (u8)clampS8((columnEvenOutput3 + columnOddOutput3) >> 11);
|
||||
columnOutput[32] = (u8)clampS8((columnEvenOutput3 - columnOddOutput3) >> 11);
|
||||
}
|
||||
src--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ struct DVDCommandBlock {
|
||||
DVDCommandBlock* prev; // 0x04
|
||||
|
||||
u32 command; // 0x08
|
||||
volatile s32 state;
|
||||
s32 state; // 0x0C
|
||||
|
||||
u32 offset; // 0x10
|
||||
u32 length; // 0x14
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
|
||||
|
||||
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, u8 mipmap, u8 max_lod);
|
||||
|
||||
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
u8 mipmap);
|
||||
void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap,
|
||||
u32 tlut_name);
|
||||
|
||||
@@ -1894,7 +1894,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
|
||||
if (block->state == DVD_STATE_COVER_CLOSED) {
|
||||
retVal = DVD_STATE_BUSY;
|
||||
} else if (block->state == DVD_STATE_COVER_OPENED) {
|
||||
} else if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_OPENED) {
|
||||
retVal = DVD_STATE_NO_DISK;
|
||||
} else if (executing == &__DVDStopMotorCommandBlock) {
|
||||
next = __DVDGetNextWaitingQueue();
|
||||
@@ -1912,7 +1912,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
retVal = block->state;
|
||||
retVal = ((volatile DVDCommandBlock*)block)->state;
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
@@ -8,12 +8,7 @@ static inline pf_u16 read_boot_u16(pf_u8* buf, pf_u32 offset) {
|
||||
return PF_SWAP_16(*(pf_u16*)&buf[(offset + 1) & ~1]);
|
||||
}
|
||||
|
||||
static inline pf_u32 read_partition_u32(const pf_u8* buf, pf_u32 offset) {
|
||||
return (((pf_u32)buf[offset + 2] << 16) + buf[offset]) +
|
||||
(((pf_u32)buf[offset + 3] << 24) + ((pf_u32)buf[offset + 1] << 8));
|
||||
}
|
||||
|
||||
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
|
||||
pf_s32 pdm_part_is_master_boot_sector(volatile pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
|
||||
pf_u32* p_start;
|
||||
pf_u32* p_count;
|
||||
pf_s16 index;
|
||||
@@ -25,8 +20,8 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
|
||||
p_count = count;
|
||||
for (index = 0; index < 4; index++) {
|
||||
*p_start = 0;
|
||||
*p_start = read_partition_u32(buf, 454);
|
||||
*p_count = read_partition_u32(buf, 458);
|
||||
*p_start = MBR_WORD(buf, 454);
|
||||
*p_count = MBR_WORD(buf, 458);
|
||||
if (*p_start != 0 && *p_count != 0) {
|
||||
if (index == 0) { *p_is_mbr = 1; }
|
||||
} else {
|
||||
@@ -36,15 +31,11 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
|
||||
p_count++;
|
||||
buf += 16;
|
||||
}
|
||||
p_start = start;
|
||||
p_count = count;
|
||||
for (index = 0; index < 4; index++) {
|
||||
if (*p_start + *p_count > total) {
|
||||
if (start[index] + count[index] > total) {
|
||||
if (index == 0) { *p_is_mbr = 0; }
|
||||
return 2;
|
||||
}
|
||||
p_start++;
|
||||
p_count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void __GetImageTileCount(GXTexFmt fmt, u16 wd, u16 ht, u32* rowTiles, u32* colTi
|
||||
*cmpTiles = (fmt == GX_TF_RGBA8 || fmt == GX_TF_Z24X8) ? 2 : 1;
|
||||
}
|
||||
|
||||
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
GXBool mipmap) {
|
||||
u32 imageBase;
|
||||
u32 maxLOD;
|
||||
|
||||
@@ -175,7 +175,8 @@ static inline char* __nupFindTag(char* response, const char* startTag, const cha
|
||||
}
|
||||
*value = start + strlen(startTag);
|
||||
*length = end - *value;
|
||||
return end + strlen(endTag);
|
||||
end += strlen(endTag);
|
||||
return end;
|
||||
}
|
||||
|
||||
static s32 __nupParseServerInfo(NUPContextInfo* context, char* response, char* messageId,
|
||||
|
||||
@@ -168,72 +168,86 @@ static const u32 AESiDecryptTable[] = {
|
||||
0xa8017139, 0xcb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0
|
||||
};
|
||||
|
||||
#define ROTATE(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
#define ENCRYPT(state0,state1,state2,state3) (((ROTATE(AESiEncryptTable[((state1)>>16)&255],16) ^ ROTATE(AESiEncryptTable[(state0)>>24],24)) ^ AESiEncryptTable[(state3)&255]) ^ ROTATE(AESiEncryptTable[((state2)>>8)&255],8))
|
||||
#define DECRYPT(state0,state1,state2,state3) (((ROTATE(AESiDecryptTable[((state1)>>16)&255],16) ^ AESiDecryptTable[(state3)&255]) ^ ROTATE(AESiDecryptTable[(state0)>>24],24)) ^ ROTATE(AESiDecryptTable[((state2)>>8)&255],8))
|
||||
#define SUBSTITUTE(table,state0,state1,state2,state3) ((((u32)table[(state0)>>24]<<24) | table[(state3)&255]) | (((u32)table[((state1)>>16)&255]<<16) | ((u32)table[((state2)>>8)&255]<<8)))
|
||||
|
||||
#define DECRYPT_FINAL(table,state0,state1,state2,state3,key) ((table[(state3)&255] ^ ((u32)table[((state2)>>8)&255]<<8)) ^ (((u32)table[((state1)>>16)&255]<<16) ^ ((key) ^ ((u32)table[(state0)>>24]<<24))))
|
||||
#define ROTATE(x, n) __rlwinm((x), (n), 0, 31)
|
||||
#define ROUND_WORD(table, a, b, c, d) (ROTATE(table[(a) >> 24], 24) ^ ROTATE(table[((b) >> 16) & 255], 16) ^ ROTATE(table[((c) >> 8) & 255], 8) ^ table[(d) & 255])
|
||||
#define SUBSTITUTE_WORD(table, a, b, c, d) (((u32)table[(a) >> 24] << 24) | ((u32)table[((b) >> 16) & 255] << 16) | ((u32)table[((c) >> 8) & 255] << 8) | table[(d) & 255])
|
||||
#define DOUBLE_BYTES(x) ((((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b))
|
||||
|
||||
void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
|
||||
const u32* key = context->keys;
|
||||
u32 rounds = context->rounds;
|
||||
const u32* key = context->keys + 4;
|
||||
u32 state0=input[0]^context->keys[0], state1=input[1]^context->keys[1], state2=input[2]^context->keys[2], state3=input[3]^context->keys[3];
|
||||
u32 state0 = input[0];
|
||||
u32 state1 = input[1];
|
||||
u32 state2 = input[2];
|
||||
u32 state3 = input[3];
|
||||
state0 ^= key[0];
|
||||
state1 ^= key[1];
|
||||
state2 ^= key[2];
|
||||
state3 ^= key[3];
|
||||
key += 4;
|
||||
while (--rounds != 0) {
|
||||
u32 nextState0=ENCRYPT(state0,state1,state2,state3);
|
||||
u32 nextState1=ENCRYPT(state1,state2,state3,state0);
|
||||
u32 nextState2=ENCRYPT(state2,state3,state0,state1);
|
||||
u32 nextState3=ENCRYPT(state3,state0,state1,state2);
|
||||
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
|
||||
u32 next0 = ROUND_WORD(AESiEncryptTable, state0, state1, state2, state3);
|
||||
u32 next1 = ROUND_WORD(AESiEncryptTable, state1, state2, state3, state0);
|
||||
u32 next2 = ROUND_WORD(AESiEncryptTable, state2, state3, state0, state1);
|
||||
u32 next3 = ROUND_WORD(AESiEncryptTable, state3, state0, state1, state2);
|
||||
state0 = next0 ^ key[0];
|
||||
state1 = next1 ^ key[1];
|
||||
state2 = next2 ^ key[2];
|
||||
state3 = next3 ^ key[3];
|
||||
key += 4;
|
||||
}
|
||||
output[0] = SUBSTITUTE(AESiSubShiftTable,state0,state1,state2,state3)^key[0];
|
||||
output[1] = SUBSTITUTE(AESiSubShiftTable,state1,state2,state3,state0)^key[1];
|
||||
output[2] = SUBSTITUTE(AESiSubShiftTable,state2,state3,state0,state1)^key[2];
|
||||
output[3] = SUBSTITUTE(AESiSubShiftTable,state3,state0,state1,state2)^key[3];
|
||||
output[0] = SUBSTITUTE_WORD(AESiSubShiftTable, state0, state1, state2, state3) ^ key[0];
|
||||
output[1] = SUBSTITUTE_WORD(AESiSubShiftTable, state1, state2, state3, state0) ^ key[1];
|
||||
output[2] = SUBSTITUTE_WORD(AESiSubShiftTable, state2, state3, state0, state1) ^ key[2];
|
||||
output[3] = SUBSTITUTE_WORD(AESiSubShiftTable, state3, state0, state1, state2) ^ key[3];
|
||||
}
|
||||
|
||||
#define DOUBLE_BYTES(x) ((((x)&0x7f7f7f7f)<<1) ^ ((((x)&0x80808080)>>7)*0x1b))
|
||||
static inline void AESiInvMixColumn(u32* word) {
|
||||
u32 value = *word;
|
||||
u32 timesTwo = DOUBLE_BYTES(value);
|
||||
u32 timesFour = DOUBLE_BYTES(timesTwo);
|
||||
u32 mixed = DOUBLE_BYTES(timesFour) ^ value;
|
||||
mixed ^= timesFour ^ ROTATE(mixed, 8);
|
||||
mixed ^= timesTwo ^ ROTATE(mixed, 8);
|
||||
mixed ^= value ^ ROTATE(mixed, 8);
|
||||
*word = mixed;
|
||||
}
|
||||
|
||||
void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
|
||||
u32 rounds=context->rounds;
|
||||
u32* key=context->keys;
|
||||
u32 state1;
|
||||
u32 state0;
|
||||
u32 state2;
|
||||
u32 state3;
|
||||
key += rounds*4;
|
||||
u32* key = context->keys;
|
||||
u32 rounds = context->rounds;
|
||||
u32 state0, state1, state2, state3;
|
||||
key += rounds * 4;
|
||||
if (context->needsTransform) {
|
||||
u32 round;
|
||||
for (round=1; round<context->rounds; ++round) {
|
||||
for (round = 1; round < context->rounds; round++) {
|
||||
u32 word;
|
||||
for (word=0; word<4; ++word) {
|
||||
u32 value=context->keys[round*4 + word];
|
||||
u32 timesTwo=DOUBLE_BYTES(value);
|
||||
u32 timesFour=DOUBLE_BYTES(timesTwo);
|
||||
u32 timesNine=DOUBLE_BYTES(timesFour)^value;
|
||||
u32 mixed=(ROTATE(timesNine,8) ^ (timesNine ^ timesFour));
|
||||
mixed=(ROTATE(mixed,8) ^ (mixed ^ timesTwo));
|
||||
mixed=(ROTATE(mixed,8) ^ (mixed ^ value));
|
||||
context->keys[round*4 + word]=mixed;
|
||||
for (word = 0; word < 4; word++) {
|
||||
AESiInvMixColumn(&context->keys[round * 4 + word]);
|
||||
}
|
||||
}
|
||||
context->needsTransform=0;
|
||||
context->needsTransform = 0;
|
||||
}
|
||||
state0=input[0]^key[0]; state1=input[1]^key[1]; state2=input[2]^key[2]; state3=input[3]^key[3];
|
||||
key-=4;
|
||||
state0 = input[0] ^ key[0];
|
||||
state1 = input[1] ^ key[1];
|
||||
state2 = input[2] ^ key[2];
|
||||
state3 = input[3] ^ key[3];
|
||||
key -= 4;
|
||||
while (--rounds != 0) {
|
||||
u32 nextState0=DECRYPT(state0,state3,state2,state1);
|
||||
u32 nextState1=DECRYPT(state1,state0,state3,state2);
|
||||
u32 nextState2=DECRYPT(state2,state1,state0,state3);
|
||||
u32 nextState3=DECRYPT(state3,state2,state1,state0);
|
||||
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
|
||||
key-=4;
|
||||
u32 next0 = ROUND_WORD(AESiDecryptTable, state0, state3, state2, state1);
|
||||
u32 next1 = ROUND_WORD(AESiDecryptTable, state1, state0, state3, state2);
|
||||
u32 next2 = ROUND_WORD(AESiDecryptTable, state2, state1, state0, state3);
|
||||
u32 next3 = ROUND_WORD(AESiDecryptTable, state3, state2, state1, state0);
|
||||
state0 = next0 ^ key[0];
|
||||
state1 = next1 ^ key[1];
|
||||
state2 = next2 ^ key[2];
|
||||
state3 = next3 ^ key[3];
|
||||
key -= 4;
|
||||
}
|
||||
output[0]=DECRYPT_FINAL(AESiInvSubShiftTable,state0,state3,state2,state1,key[0]);
|
||||
output[1]=DECRYPT_FINAL(AESiInvSubShiftTable,state1,state0,state3,state2,key[1]);
|
||||
output[2]=DECRYPT_FINAL(AESiInvSubShiftTable,state2,state1,state0,state3,key[2]);
|
||||
output[3]=DECRYPT_FINAL(AESiInvSubShiftTable,state3,state2,state1,state0,key[3]);
|
||||
output[0] = key[0] ^ ((u32)AESiInvSubShiftTable[state0 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state3 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state2 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state1 & 255];
|
||||
output[1] = key[1] ^ ((u32)AESiInvSubShiftTable[state1 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state0 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state3 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state2 & 255];
|
||||
output[2] = key[2] ^ ((u32)AESiInvSubShiftTable[state2 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state1 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state0 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state3 & 255];
|
||||
output[3] = key[3] ^ ((u32)AESiInvSubShiftTable[state3 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state2 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state1 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state0 & 255];
|
||||
}
|
||||
|
||||
BOOL NETAESCreateEx(AESContext* context, const void* key, u32 keyLength, const void* iv, const AESBlockMode* mode) {
|
||||
|
||||
@@ -54,54 +54,50 @@ static u32 BannerBuffer = 0;
|
||||
static u32 BannerAvailable = 0;
|
||||
static u32 Allocator = 0;
|
||||
volatile BOOL StartingGame = FALSE;
|
||||
static u32 RestartRequested = 0;
|
||||
static u32 PartitionOpen = 0;
|
||||
static vu32 RestartRequested = 0;
|
||||
static vu32 PartitionOpen = 0;
|
||||
static u32 CacheSeekComplete = 0;
|
||||
static u32 LoadingTitle = 0;
|
||||
BOOL FatalErrorFlag = FALSE;
|
||||
static vu32 LoadingTitle = 0;
|
||||
volatile BOOL FatalErrorFlag = FALSE;
|
||||
BOOL RetryErrorFlag = FALSE;
|
||||
BOOL UpdateErrorFlag = FALSE;
|
||||
BOOL AbortFlag = FALSE;
|
||||
volatile BOOL AbortFlag = FALSE;
|
||||
volatile int CacheFailed = 0;
|
||||
volatile int RegionValid = 0;
|
||||
static volatile int NandPending = 0;
|
||||
static vu32 CancelNand = 0;
|
||||
static vu32 LowReadResult = 0;
|
||||
static u32 CacheCommandComplete = 0;
|
||||
static u32 AudioBufferUnconfigured = 0;
|
||||
static u64 ResetTime = 0;
|
||||
static u64 SpinupDeadline = 0;
|
||||
u64 CoverPollTime = 0;
|
||||
u32 DriveWasReset = 0;
|
||||
static u32 TitleTicketView = 0;
|
||||
static u32 CurrentTmd = 0;
|
||||
u32 TitleCode = 0;
|
||||
u32 RequiredIosHigh = 0;
|
||||
u32 RequiredIosLow = 0;
|
||||
u32 GamePartition = 0;
|
||||
u32 UpdatePartition = 0;
|
||||
u32 PartitionCursor = 0;
|
||||
u32 DataToc = 0;
|
||||
u64 GameToc = 0;
|
||||
u32 CoverOpenTimeHigh = 0;
|
||||
u32 CoverOpenTimeLow = 0;
|
||||
vu32 NandTransferred = 0;
|
||||
vu32 NandLength = 0;
|
||||
u8 *NandBuffer = NULL;
|
||||
NANDFileInfo *NandFile = NULL;
|
||||
vu32 NandOperation = 0;
|
||||
volatile NANDCallback NandCompletion = NULL;
|
||||
u32 LoaderOffset = 0;
|
||||
vu32 LoaderLength = 0;
|
||||
u32 LoaderAddress = 0;
|
||||
vu32 CacheLength = 0;
|
||||
static vu32 BannerLength = 0;
|
||||
static vu32 DvdTransferLength = 0;
|
||||
static vu32 DvdTransferred = 0;
|
||||
static u32 *DvdProgress = 0;
|
||||
static u32 LoaderClose = 0;
|
||||
static u32 LoaderMain = 0;
|
||||
static u32 LoaderInit = 0;
|
||||
static u32 LoaderInit;
|
||||
static u32 LoaderMain;
|
||||
static u32 LoaderClose;
|
||||
static u32 *DvdProgress;
|
||||
static vu32 DvdTransferred;
|
||||
static vu32 DvdTransferLength;
|
||||
static vu32 BannerLength;
|
||||
vu32 CacheLength;
|
||||
u32 LoaderAddress;
|
||||
vu32 LoaderLength;
|
||||
u32 LoaderOffset;
|
||||
volatile NANDCallback NandCompletion;
|
||||
vu32 NandOperation;
|
||||
NANDFileInfo *NandFile;
|
||||
u8 *NandBuffer;
|
||||
vu32 NandLength;
|
||||
vu32 NandTransferred;
|
||||
OSTime CoverOpenTime;
|
||||
u64 GameToc;
|
||||
u32 DataToc;
|
||||
u32 PartitionCursor;
|
||||
u32 UpdatePartition;
|
||||
u32 GamePartition;
|
||||
u64 RequiredIos;
|
||||
u32 TitleCode;
|
||||
static u32 CurrentTmd;
|
||||
static u32 TitleTicketView;
|
||||
u32 DriveWasReset;
|
||||
u64 CoverPollTime;
|
||||
static u64 SpinupDeadline;
|
||||
static u64 ResetTime;
|
||||
|
||||
|
||||
void BS2Report(const char *msg, ...) {
|
||||
@@ -623,7 +619,7 @@ void BS2StartGame() {
|
||||
u32 (*entry)(void);
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
while (((volatile DVDCommandBlock *)&CoverBlock)->state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
BS2Report("BS2StartGame(1)\n");
|
||||
@@ -667,8 +663,8 @@ void BS2StartGame() {
|
||||
__OSWriteStateFlags(&stateFlags);
|
||||
__OSClearRTCFlags();
|
||||
|
||||
titleType = RequiredIosHigh;
|
||||
titleCode = RequiredIosLow;
|
||||
titleType = (u32)(RequiredIos >> 32);
|
||||
titleCode = (u32)RequiredIos;
|
||||
ticketCount = 1;
|
||||
ticketViews = TicketViews;
|
||||
if ((titleCode | titleType) == 0) {
|
||||
@@ -854,7 +850,7 @@ void BS2StartGCGame() {
|
||||
OSTime time;
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
while (((volatile DVDCommandBlock *)&CoverBlock)->state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
soundMode = SCGetSoundMode();
|
||||
@@ -982,9 +978,7 @@ static BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
|
||||
case 4:
|
||||
case 5:
|
||||
if (State == 7 || State == 9 || State == 10) {
|
||||
u64 systemTime = __OSGetSystemTime();
|
||||
CoverOpenTimeLow = (u32)systemTime;
|
||||
CoverOpenTimeHigh = (u32)(systemTime >> 32);
|
||||
CoverOpenTime = __OSGetSystemTime();
|
||||
State = BS2_STT_66;
|
||||
} else {
|
||||
State = BS2_STT_NO_DISK;
|
||||
@@ -1099,6 +1093,8 @@ static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32
|
||||
}
|
||||
|
||||
static BOOL CheckBS2CommandStatus() {
|
||||
static u32 CacheCommandComplete = 0;
|
||||
|
||||
if (CheckDVDCommandStatus(&Block) == 0) {
|
||||
BS2Report("DVD command is issuing\n");
|
||||
return 0;
|
||||
@@ -1181,8 +1177,8 @@ static BOOL CheckBS2CommandStatus() {
|
||||
if (BS2BootCaching != 0) {
|
||||
BS2Report("Write partition ifno\n");
|
||||
NandPending = 1;
|
||||
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
|
||||
CacheCommandComplete = 1;
|
||||
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
|
||||
if ((unsigned int)CacheLength > 0xb00000) {
|
||||
BS2NANDCallback(-1, NULL);
|
||||
return 1;
|
||||
@@ -1324,6 +1320,7 @@ static void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
|
||||
}
|
||||
|
||||
BS2State BS2Tick() {
|
||||
static u32 AudioBufferUnconfigured;
|
||||
u32 interruptsEnabled = OSDisableInterrupts();
|
||||
u32 loaderAddress;
|
||||
u32 loaderLength;
|
||||
@@ -1338,7 +1335,6 @@ BS2State BS2Tick() {
|
||||
u64 currentTime;
|
||||
BOOL regionMatches;
|
||||
char productRegion;
|
||||
u32 iosHigh;
|
||||
char *ticketByte;
|
||||
u32 entryCount;
|
||||
DVDGameTOC *dataToc;
|
||||
@@ -1351,17 +1347,16 @@ BS2State BS2Tick() {
|
||||
BS2Report("Drive Reset : %d\n", BS2DriveReset);
|
||||
BS2Report("Wait Spinup : %d\n", BS2WaitSpinup);
|
||||
BS2Report("Boot From Cache : %d\n", BS2BootFromCache);
|
||||
DvdProgress = (u32 *)&(*(u32 *)0x800030d4);
|
||||
DvdProgress = (u32 *)0x800030d4;
|
||||
PartitionParams.numTmdBytes = 0;
|
||||
PartitionParams.numCertBytes = 0;
|
||||
PartitionParams.dataWordOffset = 0;
|
||||
(*(u32 *)0x800030d4) = 0;
|
||||
*DvdProgress = 0;
|
||||
DvdTransferred = 0;
|
||||
DvdTransferLength = 0;
|
||||
status = BS2NoDisk;
|
||||
AudioBufferUnconfigured = 1;
|
||||
CoverBlock.state = 0;
|
||||
if (status != 0)
|
||||
if (BS2NoDisk != 0)
|
||||
State = BS2_STT_NO_DISK;
|
||||
else if (BS2DriveReset != 0)
|
||||
State = BS2_STT_2;
|
||||
@@ -1440,13 +1435,14 @@ BS2State BS2Tick() {
|
||||
case 5:
|
||||
status = CheckBS2CommandStatus();
|
||||
if (status != 0) {
|
||||
if ((((const OSBootInfo *)0x80000000)->consoleType & 0xf0000000) == 0) {
|
||||
OSBootInfo *bootInfo = (OSBootInfo *)OSPhysicalToCached(OS_ADDR_BOOT_INFO);
|
||||
|
||||
if ((bootInfo->consoleType & 0xf0000000) == 0) {
|
||||
__OSDeviceCode = 0x8002;
|
||||
State = BS2_STT_8;
|
||||
} else {
|
||||
__OSDeviceCode = DriveInfo.deviceCode | 0x8000;
|
||||
State = BS2_STT_8;
|
||||
}
|
||||
State = BS2_STT_8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@@ -1882,9 +1878,7 @@ invalidRvlRegion:
|
||||
(u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion);
|
||||
BS2Report("Title ID ... 0x%08X%08X\n", (u32)(((ESTitleMeta *)CurrentTmd)->head.titleId >> 32),
|
||||
(u32)((ESTitleMeta *)CurrentTmd)->head.titleId);
|
||||
iosHigh = (u32)(((ESTitleMeta *)CurrentTmd)->head.sysVersion >> 32);
|
||||
RequiredIosLow = (u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion;
|
||||
RequiredIosHigh = iosHigh;
|
||||
RequiredIos = ((ESTitleMeta *)CurrentTmd)->head.sysVersion;
|
||||
titleCode = (u32)((ESTitleMeta *)CurrentTmd)->head.titleId;
|
||||
TitleCode = titleCode;
|
||||
if (((ESTitleMeta *)CurrentTmd)->head.sysVersion == 0x0000000100000010ULL) {
|
||||
@@ -2072,7 +2066,8 @@ invalidRvlRegion:
|
||||
} else {
|
||||
if ((BannerBuffer != 0) && (BannerLength != 0)) {
|
||||
if (BannerLength < ((bannerFile.length + 0x1fU) & 0xffffffe0))
|
||||
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)");
|
||||
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)",
|
||||
bannerFile.length);
|
||||
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
|
||||
} else
|
||||
OSPanic("BS2Mach.c", 0x12da, "BS2 ERROR >>> MEMAllocator and banner buffer is not set");
|
||||
@@ -2176,7 +2171,7 @@ invalidRvlRegion:
|
||||
BS2BootFromCache = 0;
|
||||
BS2BootCaching = 1;
|
||||
LoadingTitle = 0;
|
||||
switch (Block.state) {
|
||||
switch (((volatile DVDCommandBlock *)&Block)->state) {
|
||||
case 4:
|
||||
case 5:
|
||||
CheckDVDCommandStatus(&Block);
|
||||
@@ -2321,7 +2316,7 @@ invalidRvlRegion:
|
||||
break;
|
||||
case 0x42:
|
||||
currentTime = __OSGetSystemTime();
|
||||
if ((OSTime)(currentTime - (((u64)CoverOpenTimeHigh << 32) | CoverOpenTimeLow)) < OSMillisecondsToTicks((OSTime)350))
|
||||
if ((OSTime)(currentTime - CoverOpenTime) < OSMillisecondsToTicks((OSTime)350))
|
||||
break;
|
||||
currentTime = __OSGetSystemTime();
|
||||
CoverPollTime = currentTime;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -412,18 +412,19 @@ extern "C" char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
|
||||
struct ButtonAnimations {
|
||||
KeyType type;
|
||||
const char* paneName;
|
||||
u32 count;
|
||||
u16 _pad_0;
|
||||
u16 count;
|
||||
const char* bindingName;
|
||||
const InputFormAnimationFile* files[12];
|
||||
};
|
||||
|
||||
ButtonAnimations csButtonAnimations[] = {
|
||||
{KT_NormalButton, scP_txtScrll_UP, 8, NULL, {
|
||||
{KT_NormalButton, scP_txtScrll_UP, 0, 8, NULL, {
|
||||
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
|
||||
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
|
||||
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
|
||||
&csAninationFile__Q29textinput9inputform[6], &csAninationFile__Q29textinput9inputform[7]}},
|
||||
{KT_NormalButton, scP_txtScrll_DOWN, 8, csScrollButtonAnimationTarget, {
|
||||
{KT_NormalButton, scP_txtScrll_DOWN, 0, 8, csScrollButtonAnimationTarget, {
|
||||
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
|
||||
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
|
||||
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
|
||||
@@ -1108,7 +1109,36 @@ LayoutByNW4R::LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor
|
||||
mpLanguageData(&csLanguageDependencyDataUEJ__Q29textinput9inputform), mpFontName(fontName),
|
||||
mbUpVisible(false), mbDownVisible(false), mbRepeat(false), mpInputEventHandler(NULL) {}
|
||||
|
||||
static inline const char* selectInputTextName(const nw4rmanager::Layout& layout, const void* const& languageData) {
|
||||
if (layout.getPane(static_cast<const LanguagePaneData*>(languageData)->textBox)) {
|
||||
return static_cast<const LanguagePaneData*>(languageData)->textBox;
|
||||
}
|
||||
return "T_2l_TextBox";
|
||||
}
|
||||
|
||||
inline void LayoutByNW4R::addButtonAnimation(MEMAllocator* allocator, nw4rmanager::AnmPane* animationPane, const InputFormAnimationFile* const& file, const char* bindingName) {
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, file->fileName, NULL);
|
||||
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
|
||||
if (!bindingName) animationPane->addAnimation(allocator, file->id, transform, false, true);
|
||||
else animationPane->forceAddAnimation(allocator, file->id, transform, bindingName, false, true);
|
||||
}
|
||||
|
||||
void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
const char* bindingName;
|
||||
void* handlerMemory;
|
||||
void* memory;
|
||||
nw4r::lyt::Pane* pane;
|
||||
u32 buttonIndex;
|
||||
u16 next;
|
||||
Info_* rows;
|
||||
u16 previous;
|
||||
u16 count;
|
||||
u16 animationIndex;
|
||||
Info_* selected;
|
||||
nw4rmanager::AnmPane* animationPane;
|
||||
nw4r::lyt::TextBox* textBox;
|
||||
u16 selectedIndex;
|
||||
Info_* listEnd;
|
||||
mpAllocator = allocator;
|
||||
textdrawer::Base::create(allocator);
|
||||
mpString = static_cast<tistring::Decolated*>(editBuffer->mpString);
|
||||
@@ -1117,18 +1147,18 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
mriManager.mpAllocator = allocator;
|
||||
mriManager.mpInfo = static_cast<Info_*>(MEMAllocFromAllocator(allocator, (mriManager.mMaxLength + 2) * sizeof(Info_)));
|
||||
mriManager.init();
|
||||
Info_* rows = mriManager.mpInfo;
|
||||
Info_* selected = &rows[rows[mriManager.mMaxLength].Next];
|
||||
u16 previous = selected->Back;
|
||||
u16 next = selected->Next;
|
||||
u16 selectedIndex = rows[next].Back;
|
||||
rows = mriManager.mpInfo;
|
||||
selected = &rows[rows[mriManager.mMaxLength].Next];
|
||||
previous = selected->Back;
|
||||
next = selected->Next;
|
||||
selectedIndex = rows[next].Back;
|
||||
rows[next].Back = previous;
|
||||
rows[previous].Next = next;
|
||||
selected->Back = selectedIndex;
|
||||
selected->Next = selectedIndex;
|
||||
Info_* listEnd = &mriManager.mpInfo[mriManager.mpInfo[static_cast<u16>(mriManager.mMaxLength + 1)].Back];
|
||||
rows = mriManager.mpInfo;
|
||||
if (selected->Back == selected->Next) {
|
||||
listEnd = &mriManager.mpInfo[mriManager.mpInfo[static_cast<u16>(mriManager.mMaxLength + 1)].Back];
|
||||
if (selected->Next == selected->Back) {
|
||||
next = listEnd->Next;
|
||||
selected->Back = rows[next].Back;
|
||||
selected->Next = next;
|
||||
@@ -1138,7 +1168,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
selected->StrCount = 0;
|
||||
selected->DispRowCount = 1;
|
||||
mpCursorLine = selected;
|
||||
void* handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
|
||||
handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
|
||||
mpInputEventHandler = new (handlerMemory) EventHandler(this);
|
||||
nw4rmanager::Layout::createWithEventHandler(allocator, mpInputEventHandler);
|
||||
if (!mpFontName) {
|
||||
@@ -1150,7 +1180,7 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
mpMultiArcResourceAccessor->GetFont(mpFontName)->SetAlternateChar(0xe06b);
|
||||
setFont(*mpMultiArcResourceAccessor->GetFont(mpFontName));
|
||||
}
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName(static_cast<const char*>(mpLayoutData), true));
|
||||
textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName(static_cast<const char*>(mpLayoutData), true));
|
||||
textBox->SetString(L"", 0);
|
||||
mfCharacterSpacing = textBox->GetCharSpace();
|
||||
mfLineSpacing = textBox->GetLineSpace();
|
||||
@@ -1162,29 +1192,24 @@ void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
|
||||
setVisible("N_2line", true);
|
||||
mpPaneManager->setAllComponentTriggerTarget(false);
|
||||
mpPaneManager->setAllBoundingBoxComponentTriggerTarget(true);
|
||||
nw4r::lyt::Pane* pane = mpLayout->GetRootPane()->FindPaneByName(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox, true);
|
||||
if (!pane) pane = mpLayout->GetRootPane()->FindPaneByName(getLanguageTextPane() ? static_cast<const LanguagePaneData*>(mpLanguageData)->textBox : "T_2l_TextBox", true);
|
||||
pane = mpLayout->GetRootPane()->FindPaneByName(static_cast<const LanguagePaneData*>(mpLanguageData)->textBox, true);
|
||||
if (!pane) pane = mpLayout->GetRootPane()->FindPaneByName(selectInputTextName(*this, mpLanguageData), true);
|
||||
mpPaneManager->getPaneComponentByPane(pane)->setTriggerTarget(true);
|
||||
for (u32 buttonIndex = 0; buttonIndex < 2; ++buttonIndex) {
|
||||
for (buttonIndex = 0; buttonIndex < 2; ++buttonIndex) {
|
||||
const ButtonAnimations& button = csButtonAnimations[static_cast<u16>(buttonIndex)];
|
||||
nw4rmanager::AnmPane* animationPane = NULL;
|
||||
animationPane = NULL;
|
||||
switch (button.type) {
|
||||
case KT_NormalButton: {
|
||||
void* memory = MEMAllocFromAllocator(allocator, sizeof(NormalButtonAnmPane));
|
||||
memory = MEMAllocFromAllocator(allocator, sizeof(NormalButtonAnmPane));
|
||||
animationPane = new (memory) NormalButtonAnmPane(getPane(button.paneName), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
nw4r::ut::List_Append(&mAnmPanes, animationPane);
|
||||
u32 count;
|
||||
const char* bindingName = button.bindingName;
|
||||
bindingName = button.bindingName;
|
||||
count = button.count;
|
||||
for (u16 animationIndex = 0; animationIndex < count; ++animationIndex) {
|
||||
const InputFormAnimationFile* const& file = button.files[animationIndex];
|
||||
void* resource = mpMultiArcResourceAccessor->GetResource(0, file->fileName, NULL);
|
||||
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
|
||||
if (!bindingName) animationPane->addAnimation(allocator, file->id, transform, false, true);
|
||||
else animationPane->forceAddAnimation(allocator, file->id, transform, bindingName, false, true);
|
||||
for (animationIndex = 0; animationIndex < count; ++animationIndex) {
|
||||
addButtonAnimation(allocator, animationPane, button.files[animationIndex], bindingName);
|
||||
}
|
||||
}
|
||||
init();
|
||||
@@ -1247,12 +1272,6 @@ void LayoutByNW4R::calc() {
|
||||
}
|
||||
}
|
||||
}
|
||||
static inline const char* selectInputTextName(const nw4rmanager::Layout& layout, const void* const& languageData) {
|
||||
if (layout.getPane(static_cast<const LanguagePaneData*>(languageData)->textBox)) {
|
||||
return static_cast<const LanguagePaneData*>(languageData)->textBox;
|
||||
}
|
||||
return "T_2l_TextBox";
|
||||
}
|
||||
|
||||
void LayoutByNW4R::setLanguage(Language language) {
|
||||
Base::setLanguage(language);
|
||||
@@ -3113,7 +3132,18 @@ bool Base::onCursor(CursorPos* cursor) {
|
||||
return positioned;
|
||||
}
|
||||
|
||||
static inline f32 scaledExtent(f32 scale, f32 start, f32 end) {
|
||||
f32 extent = end - start;
|
||||
return scale * extent;
|
||||
}
|
||||
|
||||
static inline f32 glyphBottom(f32 origin, const Base::DrawInfo& glyph, const nw4r::math::VEC2& scale) {
|
||||
f32 extent = glyph.rect.GetHeight();
|
||||
return origin + scale.y * extent;
|
||||
}
|
||||
|
||||
u32 Base::calcCursorPos(f32 x, f32 y) {
|
||||
f32 zero;
|
||||
f32 cursorX;
|
||||
f32 lineTop;
|
||||
f32 lineBottom;
|
||||
@@ -3127,16 +3157,17 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
|
||||
u32 pos = 0;
|
||||
muWordWrapCounter = 0;
|
||||
mbHyphen = false;
|
||||
zero = 0.0f;
|
||||
while (*string) {
|
||||
DrawInfo info;
|
||||
info.rect.left = 0.0f;
|
||||
info.rect.top = 0.0f;
|
||||
info.rect.right = 0.0f;
|
||||
info.rect.bottom = 0.0f;
|
||||
info.rect.left = zero;
|
||||
info.rect.top = zero;
|
||||
info.rect.right = zero;
|
||||
info.rect.bottom = zero;
|
||||
info.character = *string;
|
||||
calcRect(info);
|
||||
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
|
||||
f32 right = cursorX + scale.x * info.rect.GetWidth();
|
||||
lineBottom = glyphBottom(lineTop, info, scale);
|
||||
f32 right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
|
||||
if (doWordWrap(mpString->getWCString(), pos, cursorX)) {
|
||||
if (localY >= lineTop && localY <= lineBottom) {
|
||||
if (pos != 0) return pos - 1;
|
||||
@@ -3144,35 +3175,35 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
|
||||
}
|
||||
lineTop += scale.y * getLineHeight();
|
||||
cursorX = getScale().x;
|
||||
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
|
||||
right = cursorX + scale.x * info.rect.GetWidth();
|
||||
lineBottom = glyphBottom(lineTop, info, scale);
|
||||
right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
|
||||
}
|
||||
if (right >= scale.x * mRect.GetWidth()) {
|
||||
if (right >= scaledExtent(scale.x, mRect.left, mRect.right)) {
|
||||
if (localY >= lineTop && localY <= lineBottom) return pos;
|
||||
lineTop += scale.y * getLineHeight();
|
||||
cursorX = getScale().x;
|
||||
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
|
||||
right = cursorX + scale.x * info.rect.GetWidth();
|
||||
lineBottom = glyphBottom(lineTop, info, scale);
|
||||
right = cursorX + scaledExtent(scale.x, info.rect.left, info.rect.right);
|
||||
}
|
||||
if (x <= info.rect.left && localY >= lineTop && localY <= lineBottom) return pos;
|
||||
if (*string == L'\n') {
|
||||
if (localY >= lineTop && localY <= lineBottom) return pos;
|
||||
lineTop += scale.y * getLineHeight();
|
||||
cursorX = getScale().x;
|
||||
lineBottom = lineTop + scale.y * (info.rect.bottom - info.rect.top);
|
||||
lineBottom = glyphBottom(lineTop, info, scale);
|
||||
if (!string[1] && localY >= lineTop && localY <= lineBottom) return pos + 1;
|
||||
} else {
|
||||
if (x >= cursorX && x < right && localY >= lineTop && localY < lineBottom) {
|
||||
if (cursorX + 0.5f * (right - cursorX) > x) return pos;
|
||||
if (cursorX + (right - cursorX) / 2.0f > x) return pos;
|
||||
return pos + 1;
|
||||
}
|
||||
cursorX += scale.x * info.rect.GetWidth();
|
||||
cursorX += scaledExtent(scale.x, info.rect.left, info.rect.right);
|
||||
}
|
||||
++string;
|
||||
++pos;
|
||||
if (!*string && localY >= lineTop && localY <= lineBottom) return pos;
|
||||
}
|
||||
if (lineTop + (lineBottom - lineTop) * 0.5f <= localY) {
|
||||
if (lineTop + (lineBottom - lineTop) / 2.0f <= localY) {
|
||||
return Base::calcCursorPos(x, 1.0f + lineTop + mfScrollY);
|
||||
}
|
||||
return Base::calcCursorPos(x, 1.0f);
|
||||
|
||||
@@ -149,6 +149,9 @@ public:
|
||||
}
|
||||
|
||||
void append(wchar_t ch) {
|
||||
if (ch == L'\n') {
|
||||
mCount = 0;
|
||||
}
|
||||
mpOutput[mCount++] = ch;
|
||||
}
|
||||
|
||||
@@ -159,7 +162,7 @@ public:
|
||||
|
||||
private:
|
||||
wchar_t* mpOutput;
|
||||
u32 mCount;
|
||||
u16 mCount;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -195,9 +198,11 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
}
|
||||
nonKana:
|
||||
if (mTranslateMode == 3) {
|
||||
CharacterOutput output(input);
|
||||
output.append(ch);
|
||||
count = output.finish();
|
||||
count = mTranslateMode - 3;
|
||||
input[count] = 0;
|
||||
input[count] = ch;
|
||||
count++;
|
||||
input[count] = 0;
|
||||
mKanaStream.mOutput[0] = 0;
|
||||
} else {
|
||||
count = 1;
|
||||
|
||||
@@ -403,8 +403,8 @@ static inline void sendValidityResponse(u32 command, u32 valid) {
|
||||
u32 value;
|
||||
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
|
||||
} reply;
|
||||
reply.value = valid << 8;
|
||||
reply.fields.command = command;
|
||||
reply.value = command;
|
||||
reply.fields.valid = valid;
|
||||
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
|
||||
@@ -707,49 +707,82 @@ extern "C" void clearAllCardFileEntries(s32 slot) {
|
||||
} while (file < CARD_MAX_FILE);
|
||||
}
|
||||
|
||||
static inline void updateCardIconAnimation(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
s32 iconCount = 0;
|
||||
s32 shift = 0;
|
||||
s32 icon;
|
||||
sThread->icons[slot][fileNo].unk_0x02 = 0;
|
||||
sThread->icons[slot][fileNo].anmMax = 0;
|
||||
sThread->icons[slot][fileNo].anmFrameBits = dir->iconSpeed;
|
||||
sThread->icons[slot][fileNo].unk_0x06 =
|
||||
(dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
|
||||
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
|
||||
s32 iconSpeed = (dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK;
|
||||
if (iconSpeed != 0) {
|
||||
sThread->icons[slot][fileNo].anmMax =
|
||||
sThread->icons[slot][fileNo].anmMax + (iconSpeed << 2);
|
||||
} else {
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
|
||||
return;
|
||||
}
|
||||
iconCount = iconCount + 1;
|
||||
shift = shift + 2;
|
||||
static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo,
|
||||
u32 address, s32 offset, s32 imageSize, u32 transferSize) {
|
||||
s32 sectorSize;
|
||||
if (CARDGetSectorSize(slot, (u32*)§orSize) < CARD_RESULT_READY) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(dir->iconSpeed >> 0xC) & 0xC;
|
||||
|
||||
u32 fileSize = (u32)dir->length * sectorSize;
|
||||
if (address > fileSize) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
if (address + transferSize > fileSize) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (imageSize > 0) {
|
||||
s32 result = CARDRead(fileInfo, sThread->imageReadBuffer, transferSize, address);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
memcpy(sThread->images[slot][fileNo], sThread->imageReadBuffer + offset, imageSize);
|
||||
DCStoreRange(sThread->images[slot][fileNo], transferSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
s32 sectorSize;
|
||||
s32 commentSectorSize;
|
||||
CARDFileInfo fileInfo;
|
||||
u32 iconAddressBase;
|
||||
static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
|
||||
u32 address;
|
||||
s32 result;
|
||||
s32 iconAddressOffset;
|
||||
result = CARDFastOpen(slot, fileNo, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
u32 base;
|
||||
s32 readSize;
|
||||
u32 end;
|
||||
u32 fileSize;
|
||||
s32 offset;
|
||||
s32 sectorSize;
|
||||
address = dir->commentAddr;
|
||||
base = address & 0xFFFFFE00;
|
||||
offset = address - base;
|
||||
readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
|
||||
result = CARDGetSectorSize(slot, (u32*)§orSize);
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
if ((s32)base < 0 || base > (fileSize = (u32)dir->length * sectorSize)) {
|
||||
result = 0;
|
||||
} else {
|
||||
end = base + readSize;
|
||||
if ((s32)end < 0 || end > fileSize) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = CARDRead(fileInfo, sThread->commentBuffer, readSize, base);
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
memcpy(sThread->comments[slot][fileNo], sThread->commentBuffer + offset,
|
||||
CARD_COMMENT_SIZE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
|
||||
s32 imageSize;
|
||||
s32 bannerImageSize = 0;
|
||||
u8 format = dir->bannerFormat & CARD_STAT_BANNER_MASK;
|
||||
u32 iconAddress = dir->iconAddr;
|
||||
iconAddressBase = iconAddress & 0xFFFFFE00;
|
||||
iconAddressOffset = iconAddress - iconAddressBase;
|
||||
u32 transferSize;
|
||||
s32 iconAddressOffset = iconAddress - (iconAddress & 0xFFFFFE00);
|
||||
|
||||
switch (format) {
|
||||
case CARD_STAT_BANNER_C8: {
|
||||
@@ -786,22 +819,42 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 shift = 0;
|
||||
BOOL hasTlut = FALSE;
|
||||
s32 iconImageSize = 0;
|
||||
s32 iconImageSize;
|
||||
s32 paletteSize;
|
||||
s32 icon;
|
||||
s32 iconCount = 0;
|
||||
updateCardIconAnimation(slot, fileNo, dir);
|
||||
BOOL hasTlut;
|
||||
s32 iconCount;
|
||||
s32 shift;
|
||||
|
||||
shift = 0;
|
||||
hasTlut = FALSE;
|
||||
iconImageSize = 0;
|
||||
iconCount = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x02 = 0;
|
||||
sThread->icons[slot][fileNo].anmMax = 0;
|
||||
sThread->icons[slot][fileNo].anmFrameBits = dir->iconSpeed;
|
||||
sThread->icons[slot][fileNo].unk_0x06 = (dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
|
||||
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
|
||||
s32 iconSpeed = (dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK;
|
||||
if (iconSpeed != 0) {
|
||||
sThread->icons[slot][fileNo].anmMax += iconSpeed << 2;
|
||||
} else {
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
|
||||
goto animationDone;
|
||||
}
|
||||
iconCount = iconCount + 1;
|
||||
shift = shift + 2;
|
||||
}
|
||||
sThread->icons[slot][fileNo].unk_0x07 = (dir->iconSpeed >> 0xC) & 0xC;
|
||||
animationDone:
|
||||
if ((dir->iconSpeed & CARD_STAT_SPEED_MASK) == 0 || (dir->iconFormat & CARD_STAT_ICON_MASK) == 0) {
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
iconImageSize = 0;
|
||||
} else {
|
||||
iconCount = 0;
|
||||
shift = 0;
|
||||
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
|
||||
if (((dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK) != 0) {
|
||||
s32 iconFormat = (dir->iconFormat >> shift) & CARD_STAT_ICON_MASK;
|
||||
s32 paletteSize = 0;
|
||||
for (iconCount = 0; iconCount < CARD_ICON_MAX; ++iconCount) {
|
||||
if (((dir->iconSpeed >> (iconCount * 2)) & CARD_STAT_SPEED_MASK) != 0) {
|
||||
s32 iconFormat = (dir->iconFormat >> (iconCount * 2)) & CARD_STAT_ICON_MASK;
|
||||
switch (iconFormat) {
|
||||
case CARD_STAT_ICON_C8:
|
||||
paletteSize = 0x400;
|
||||
@@ -813,14 +866,16 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
sThread->icons[slot][fileNo].iconFmt[iconCount] = GX_TF_RGB5A3;
|
||||
break;
|
||||
case CARD_STAT_ICON_NONE: {
|
||||
u8* iconPalette =
|
||||
&sThread->icons[slot][fileNo].iconFmt[iconCount];
|
||||
*iconPalette = iconPalette[-1];
|
||||
paletteSize = 0;
|
||||
u8* previous = &sThread->icons[slot][fileNo].iconFmt[iconCount - 1];
|
||||
sThread->icons[slot][fileNo].iconFmt[iconCount] = *previous;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
u32* iconOffsets = &sThread->icons[slot][fileNo].iconOffset[0];
|
||||
s32 nextIcon = iconCount + 1;
|
||||
if (iconCount < 7) {
|
||||
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
|
||||
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
@@ -836,8 +891,6 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
break;
|
||||
}
|
||||
++iconCount;
|
||||
shift += 2;
|
||||
}
|
||||
if (hasTlut) {
|
||||
iconImageSize += 0x200;
|
||||
@@ -847,79 +900,25 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
sThread->icons[slot][fileNo].anmDelta = 1;
|
||||
}
|
||||
|
||||
s32 totalImageSize = iconImageSize + bannerImageSize;
|
||||
u32 transferSize = (totalImageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
|
||||
result = CARDGetSectorSize(slot, (u32*)§orSize);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else {
|
||||
u32 fileSize = (u32)dir->length * sectorSize;
|
||||
if (iconAddressBase > fileSize) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else if (iconAddressBase + transferSize > fileSize) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else {
|
||||
if (totalImageSize > 0) {
|
||||
result = CARDRead(&fileInfo, sThread->imageReadBuffer,
|
||||
transferSize, iconAddressBase);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
memcpy(sThread->images[slot][fileNo],
|
||||
sThread->imageReadBuffer + iconAddressOffset,
|
||||
totalImageSize);
|
||||
DCStoreRange(sThread->images[slot][fileNo], transferSize);
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
imageSize = bannerImageSize + iconImageSize;
|
||||
transferSize = (imageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
|
||||
return readCardImages(slot, fileNo, dir, fileInfo, iconAddress & 0xFFFFFE00, iconAddressOffset,
|
||||
imageSize, transferSize);
|
||||
}
|
||||
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
CARDFileInfo fileInfo;
|
||||
s32 result = CARDFastOpen(slot, fileNo, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
|
||||
iconAddress = dir->commentAddr;
|
||||
iconAddressBase = iconAddress & 0xFFFFFE00;
|
||||
s32 commentDataOffset = iconAddress - iconAddressBase;
|
||||
s32 imageSize = ((iconAddress + 0x23F) & 0xFFFFFE00) - iconAddressBase;
|
||||
result = CARDGetSectorSize(slot, (u32*)&commentSectorSize);
|
||||
result = loadCardIconImages(slot, fileNo, dir, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto clearComment;
|
||||
}
|
||||
{
|
||||
u32 fileSize;
|
||||
if ((s32)iconAddressBase < 0 ||
|
||||
iconAddressBase > (fileSize = (u32)dir->length * commentSectorSize)) {
|
||||
result = 0;
|
||||
} else {
|
||||
u32 endOffset = iconAddressBase + imageSize;
|
||||
if ((s32)endOffset < 0 || endOffset > fileSize) {
|
||||
result = 0;
|
||||
goto clearComment;
|
||||
}
|
||||
result = CARDRead(&fileInfo, sThread->commentBuffer, imageSize,
|
||||
iconAddressBase);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto clearComment;
|
||||
}
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
memcpy(sThread->comments[slot][fileNo],
|
||||
sThread->commentBuffer + commentDataOffset, CARD_COMMENT_SIZE);
|
||||
result = 0;
|
||||
goto commentDone;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
clearComment:
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
|
||||
commentDone:
|
||||
result = readCardComment(slot, fileNo, dir, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,8 @@ namespace ipl {
|
||||
mpCaptionString->clear();
|
||||
mpCaptionString->set(System::getMessage(MESG_LETTERWRITER_LETTER_HEADER));
|
||||
|
||||
wchar_t* namePlaceholder = wcsstr(mpCaptionString->getWCString(), L"xxxxxxxxxx");
|
||||
wchar_t* caption = mpCaptionString->getWCString();
|
||||
wchar_t* namePlaceholder = wcsstr(caption, L"xxxxxxxxxx");
|
||||
|
||||
mpCaptionString->replace((namePlaceholder - mpCaptionString->getWCString()), RFL_NAME_LENGTH, headerCaption);
|
||||
return mpCaptionString->getWCString();
|
||||
|
||||
@@ -341,7 +341,7 @@ void MemoryCardManager::update_change_cardstate(u8 slot) {
|
||||
}
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
memorycard::IconState (*icons)[CARD_MAX_FILE] = reinterpret_cast<memorycard::IconState(*)[CARD_MAX_FILE]>(memorycard::getIconStateArray());
|
||||
int total = 0;
|
||||
s16 frame = 0;
|
||||
@@ -355,26 +355,24 @@ GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
return _create_icon(slot, file, frame - 1);
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
|
||||
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
|
||||
memorycard::getIconStateArray();
|
||||
u32 file = mFile[slot][index].fileNo;
|
||||
return _create_icon(slot, file, 0);
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
const GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
if (dirs[slot][file].fileNo == 0) {
|
||||
return NULL;
|
||||
}
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
memorycard::IconState* icon = &icons[slot][file];
|
||||
if ((int)icon->iconFmt[start] == GX_TF_RGB5A3) {
|
||||
GXInitTexObj(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else if ((int)icon->iconFmt[start] == GX_TF_C8) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, reinterpret_cast<u8*>(icon) + icons[slot][file].iconTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXLoadTlut(&mFileCell[slot][file].iconTlut, GX_TLUT0);
|
||||
if ((int)icons[slot][file].iconFmt[start] == GX_TF_RGB5A3) {
|
||||
GXLoadTexObj(initIconTexture(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]), GX_TEXMAP0);
|
||||
} else if ((int)icons[slot][file].iconFmt[start] == GX_TF_C8) {
|
||||
initIconTextureCI(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]);
|
||||
GXTlutObj* tlut = initIconPalette(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconTlutOffset);
|
||||
GXLoadTlut(tlut, GX_TLUT0);
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -424,7 +422,7 @@ const wchar_t* MemoryCardManager::getComment(u8 slot, s16 index, int which) {
|
||||
return mFileCell[slot][file].comment[which];
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
const GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
u32 file = mFile[slot][index].fileNo;
|
||||
@@ -432,7 +430,7 @@ GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
return NULL;
|
||||
}
|
||||
if ((int)icons[slot][file].bannerType == GX_TF_RGB5A3) {
|
||||
GXTexObj* banner = initBannerTexture(slot, file,
|
||||
const GXTexObj* banner = initBannerTexture(slot, file,
|
||||
reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].bannerOffset);
|
||||
GXLoadTexObj(banner, GX_TEXMAP0);
|
||||
} else if ((int)icons[slot][file].bannerType == GX_TF_C8) {
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
#define IPL_SDMEMORY_SD_CHANNEL_SELECT_LAYOUT
|
||||
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
|
||||
#define IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
#define IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
#define IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
|
||||
#include "system/iplDialogWindow.h"
|
||||
#undef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
#include "scene/sdChannelMemory/iplSDMemory.h"
|
||||
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
|
||||
#undef IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
#undef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
|
||||
#undef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
|
||||
#undef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
|
||||
@@ -28,34 +26,12 @@
|
||||
#include "utility/iplLayout.h"
|
||||
#include <revolution/os/OSTime.h>
|
||||
|
||||
extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ipl::scene::SDMemory::TitleRange* nandTitles,
|
||||
ipl::scene::SDMemory::TitleRange* sdTitles,
|
||||
ESTitleId* titleIds, wchar_t* titleNames, u32* titleCount,
|
||||
s32 state);
|
||||
extern "C" bool iplSDChannelSelect_813DB5EC(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId, u32 flags);
|
||||
extern "C" bool iplSDChannelSelect_813DB530(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId** titleNames, ESTitleId** secondaryTitles);
|
||||
extern "C" bool iplSDChannelSelect_813DB478(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId** titles, ESTitleId** secondaryTitles,
|
||||
ESTitleId** names);
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
typedef ::gui::Component GuiComponent;
|
||||
typedef ::gui::PaneComponent GuiPaneComponent;
|
||||
typedef controller::Interface ControllerInterface;
|
||||
|
||||
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth);
|
||||
|
||||
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
|
||||
const nw4r::ut::Color& second) NO_INLINE;
|
||||
|
||||
static const char* sControlPaneNames[] = {
|
||||
"A", "B", "B_BtnA",
|
||||
};
|
||||
@@ -732,8 +708,8 @@ namespace ipl {
|
||||
if (!mpMainLayout->isPlaying(-1)) {
|
||||
switch (mProcessState) {
|
||||
case 0:
|
||||
if (iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2)) {
|
||||
if (mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 2)) {
|
||||
mDialogState = 4;
|
||||
mpTitleLayout->getAnim(0)->initAnmFrame();
|
||||
mpTitleLayout->getAnim(0)->play();
|
||||
@@ -816,8 +792,8 @@ namespace ipl {
|
||||
|
||||
if (System::getDialog()->getLastResult() != -1) {
|
||||
if (mpSDChannelSelect->getWorker()->get_async_result() == NandSDWorker::RESULT_OK) {
|
||||
mNandTitleCount = mTitleListState.mSecondaryCount;
|
||||
mTitleNameCount = mTitleListState.mNameCount;
|
||||
mNandTitleCount = mNandTitleList.count;
|
||||
mTitleNameCount = mSDTitleList.count;
|
||||
} else {
|
||||
mNandTitleCount = 0;
|
||||
mTitleNameCount = 0;
|
||||
@@ -931,8 +907,7 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iplSDChannelSelect_813DB530(mpSDChannelSelect, &mTitleListState.mpNames,
|
||||
&mTitleListState.mpSecondaryTitles)) {
|
||||
if (mpSDChannelSelect->enqueueErrorNotice(&mSDTitleList, &mNandTitleList)) {
|
||||
mDialogState = 19;
|
||||
mCurrentTitleName[0] = L'\0';
|
||||
mCurrentTitle = 0;
|
||||
@@ -1005,7 +980,7 @@ namespace ipl {
|
||||
if (iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) ||
|
||||
iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) {
|
||||
ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) {
|
||||
if (mpSDChannelSelect->enqueueMoveNotice(titleId)) {
|
||||
mDialogState = 14;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1055,7 +1030,7 @@ namespace ipl {
|
||||
|
||||
void SDMemory::onDialogState16() {
|
||||
if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) {
|
||||
if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, mTitleIds[mCurrentTitle], 0)) {
|
||||
if (mpSDChannelSelect->enqueueStateNotice(mTitleIds[mCurrentTitle], 0)) {
|
||||
mDialogState = 16;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1110,7 +1085,7 @@ namespace ipl {
|
||||
System::getDialog()->setTitleForSDMemory(mCurrentTitleName);
|
||||
|
||||
const ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleId)) {
|
||||
if (mpSDChannelSelect->enqueueDeleteNotice(titleId)) {
|
||||
mDialogState = 18;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1269,10 +1244,6 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void setChildrenAlpha(nw4r::lyt::Pane& pane, const u8 alpha);
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void SDMemory::drawTransferTitles() {
|
||||
f32 rowY;
|
||||
f32 rowTop;
|
||||
@@ -1289,16 +1260,13 @@ namespace ipl {
|
||||
nw4r::lyt::Pane* footerPane;
|
||||
u32 nandTitleIndex;
|
||||
u32 titleIndex;
|
||||
s32 visibleRows;
|
||||
s32 row;
|
||||
const wchar_t* messageForCount;
|
||||
wchar_t* messageForCount;
|
||||
s32 lineCount;
|
||||
const wchar_t* messageLine;
|
||||
s32 totalLines;
|
||||
s32 lineIndex;
|
||||
const wchar_t* lineEnd;
|
||||
u32 lineLength;
|
||||
wchar_t* messageLine;
|
||||
nw4r::lyt::TextBox* messageText;
|
||||
s32 lineIndex;
|
||||
wchar_t* lineEnd;
|
||||
u32 lineLength;
|
||||
const nw4r::math::VEC3& translation = mpDialogLayout->FindPaneByName("N_Memo")->GetTranslate();
|
||||
nw4r::math::VEC3 memoPosition;
|
||||
memoPosition.x = translation.x;
|
||||
@@ -1324,20 +1292,16 @@ namespace ipl {
|
||||
if (mNandTitleCount != 0) {
|
||||
messageForCount = System::getMessage(0xCB);
|
||||
lineCount = 0;
|
||||
const wchar_t* newline = wcsstr(messageForCount, L"\n");
|
||||
if (newline != NULL) {
|
||||
do {
|
||||
++lineCount;
|
||||
newline = wcsstr(newline + 1, L"\n");
|
||||
} while (newline != NULL);
|
||||
wchar_t* newline = wcsstr(messageForCount, L"\n");
|
||||
while (newline != NULL) {
|
||||
++lineCount;
|
||||
newline = wcsstr(newline + 1, L"\n");
|
||||
}
|
||||
|
||||
messageLine = System::getMessage(0xCB);
|
||||
messageText = static_cast<nw4r::lyt::TextBox*>(
|
||||
mpDialogLayout->FindPaneByName("T_Header_body"));
|
||||
totalLines = lineCount + 1;
|
||||
lineIndex = 0;
|
||||
for (; lineIndex < totalLines; ++lineIndex) {
|
||||
for (lineIndex = 0; lineIndex < lineCount + 1; ++lineIndex) {
|
||||
lineEnd = wcsstr(messageLine, L"\n");
|
||||
if (lineEnd == NULL) {
|
||||
utility::layout::set_string(messageText, messageLine);
|
||||
@@ -1366,7 +1330,11 @@ namespace ipl {
|
||||
|
||||
titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
|
||||
rowHeight = titleSizePane->GetSize().height;
|
||||
setChildrenAlpha(*titleSizePane, alpha);
|
||||
nw4r::lyt::PaneList::Iterator bodyChild = titleSizePane->GetChildList().GetBeginIter();
|
||||
while (bodyChild != titleSizePane->GetChildList().GetEndIter()) {
|
||||
bodyChild->SetAlpha(alpha);
|
||||
++bodyChild;
|
||||
}
|
||||
|
||||
titleText = static_cast<nw4r::lyt::TextBox*>(
|
||||
mpDialogLayout->FindPaneByName("T_Letter"));
|
||||
@@ -1376,28 +1344,18 @@ namespace ipl {
|
||||
for (titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
|
||||
utility::layout::set_string(titleText, mTitleNames[titleIndex]);
|
||||
if (nandTitleIndex < mNandTitleCount && mTitleIds[titleIndex] == mNandTitleIds[nandTitleIndex]) {
|
||||
GXColor gxActive;
|
||||
++nandTitleIndex;
|
||||
writeFourFlagBytes(&gxActive.r, 0x34, 0xBE, 0xED, 0xFF);
|
||||
GXColor activeColor = gxActive;
|
||||
GXColor activeTop = activeColor;
|
||||
GXColor activeBottom = activeColor;
|
||||
setTitleRowColors(titleText, *reinterpret_cast<const nw4r::ut::Color*>(&activeTop),
|
||||
*reinterpret_cast<const nw4r::ut::Color*>(&activeBottom));
|
||||
nw4r::ut::Color color(0x34, 0xBE, 0xED, 0xFF);
|
||||
titleText->SetTextColor(color, color);
|
||||
} else {
|
||||
GXColor gxInactive;
|
||||
writeFourFlagBytes(&gxInactive.r, 0x64, 0x64, 0x64, 0xFF);
|
||||
GXColor inactiveColor = gxInactive;
|
||||
GXColor inactiveTop = inactiveColor;
|
||||
GXColor inactiveBottom = inactiveColor;
|
||||
setTitleRowColors(titleText, *reinterpret_cast<const nw4r::ut::Color*>(&inactiveTop),
|
||||
*reinterpret_cast<const nw4r::ut::Color*>(&inactiveBottom));
|
||||
nw4r::ut::Color color(0x64, 0x64, 0x64, 0xFF);
|
||||
titleText->SetTextColor(color, color);
|
||||
}
|
||||
|
||||
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
|
||||
rowTop = textRect.bottom - textRect.top;
|
||||
visibleRows = static_cast<s32>(static_cast<f32>(ceil(-rowTop / titleSizePane->GetSize().height)));
|
||||
for (row = 0; row < visibleRows; ++row) {
|
||||
s32 visibleRows = static_cast<s32>(static_cast<f32>(ceil(-rowTop / titleSizePane->GetSize().height)));
|
||||
for (s32 row = 0; row < visibleRows; ++row) {
|
||||
rowY = bodyY + backgroundOffset;
|
||||
if (-500.0f < rowY && rowY < 500.0f) {
|
||||
nw4r::math::VEC2 translation(0.0f, backgroundOffset);
|
||||
@@ -1413,7 +1371,7 @@ namespace ipl {
|
||||
titleText->CalculateMtx(*mpDialogLayout->getDrawInfo());
|
||||
mpDialogLayout->draw(titleText);
|
||||
}
|
||||
titleOffset -= rowHeight * static_cast<f32>(visibleRows);
|
||||
titleOffset -= visibleRows * rowHeight;
|
||||
}
|
||||
|
||||
backgroundOffset += rowHeight;
|
||||
@@ -1435,27 +1393,6 @@ namespace ipl {
|
||||
mpDialogLayout->draw("N_Back");
|
||||
mpDialogLayout->draw("N_Move");
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
static inline void setChildrenAlpha(nw4r::lyt::Pane& pane, const u8 alpha) {
|
||||
nw4r::lyt::PaneList::Iterator child = pane.GetChildList().GetBeginIter();
|
||||
while (child != pane.GetChildList().GetEndIter()) {
|
||||
child->SetAlpha(alpha);
|
||||
++child;
|
||||
}
|
||||
}
|
||||
|
||||
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth) {
|
||||
flags[0] = first;
|
||||
flags[1] = second;
|
||||
flags[2] = third;
|
||||
flags[3] = fourth;
|
||||
}
|
||||
|
||||
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
|
||||
const nw4r::ut::Color& second) NO_INLINE {
|
||||
textBox->SetTextColors(first, second);
|
||||
}
|
||||
|
||||
s32 SDMemory::getControlPaneIndex(const char* paneName) {
|
||||
s32 paneIndex = -1;
|
||||
@@ -1680,23 +1617,23 @@ namespace ipl {
|
||||
switch (paneIndex) {
|
||||
case 0:
|
||||
animator = mpTitleLayout->getAnim(7);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 0);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 0);
|
||||
break;
|
||||
case 1:
|
||||
animator = mpTitleLayout->getAnim(10);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 1);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 1);
|
||||
break;
|
||||
case 2:
|
||||
animator = mpTitleLayout->getAnim(13);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 2);
|
||||
break;
|
||||
case 3:
|
||||
animator = mpTitleLayout->getAnim(16);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 3);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 3);
|
||||
break;
|
||||
case 4:
|
||||
animator = mpTitleLayout->getAnim(4);
|
||||
@@ -1716,16 +1653,13 @@ namespace ipl {
|
||||
memset(mSDTitleIds, 0, sizeof(mSDTitleIds));
|
||||
mNandTitleCount = 0;
|
||||
mTitleNameCount = 0;
|
||||
mTitleListState.mpTitles = mTitleIds;
|
||||
mTitleListState.mCount = mTitleCount;
|
||||
mTitleListState.mpSecondaryTitles = mNandTitleIds;
|
||||
mTitleListState.mSecondaryCount = 0;
|
||||
mTitleListState.mpNames = mSDTitleIds;
|
||||
mTitleListState.mNameCount = 0;
|
||||
iplSDChannelSelect_813DB58C(mpSDChannelSelect,
|
||||
&mTitleListState.mpTitles,
|
||||
&mTitleListState.mpSecondaryTitles,
|
||||
&mTitleListState.mpNames);
|
||||
mTitleList.titleIds = mTitleIds;
|
||||
mTitleList.count = mTitleCount;
|
||||
mNandTitleList.titleIds = mNandTitleIds;
|
||||
mNandTitleList.count = 0;
|
||||
mSDTitleList.titleIds = mSDTitleIds;
|
||||
mSDTitleList.count = 0;
|
||||
mpSDChannelSelect->enqueueCommandNotice(&mTitleList, &mNandTitleList, &mSDTitleList);
|
||||
}
|
||||
|
||||
if (paneIndex == 4) {
|
||||
|
||||
@@ -352,7 +352,7 @@ namespace ipl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueMoveNotice(u32 controller, u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueMoveNotice(ESTitleId titleId) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ namespace ipl {
|
||||
command.type = 6;
|
||||
command.arguments.values[0] = 0;
|
||||
command.arguments.values[1] = 0;
|
||||
command.titleId = ((u64)page << 32) | index;
|
||||
command.titleId = titleId;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
@@ -380,36 +380,39 @@ namespace ipl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueErrorNotice(u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
|
||||
NandSDWorker::TitleIdList* replacingTitles) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SDChannelSelectCommand command;
|
||||
command.type = 11;
|
||||
command.arguments.values[0] = page;
|
||||
command.arguments.values[1] = index;
|
||||
command.arguments.titleLists[0] = newTitles;
|
||||
command.arguments.titleLists[1] = replacingTitles;
|
||||
command.titleId = 0;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueCommandNotice(u32 page, u32 index, u32 commandType) {
|
||||
bool SDChannelSelect::enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
|
||||
NandSDWorker::TitleIdList* foundTitles,
|
||||
NandSDWorker::TitleIdList* badTitles) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SDChannelSelectCommand command;
|
||||
command.arguments.values[0] = page;
|
||||
command.arguments.titleLists[0] = titles;
|
||||
command.type = 12;
|
||||
command.arguments.values[1] = index;
|
||||
command.arguments.values[2] = commandType;
|
||||
command.arguments.titleLists[1] = foundTitles;
|
||||
command.arguments.titleLists[2] = badTitles;
|
||||
command.titleId = 0;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueDeleteNotice(u32 controller, u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueDeleteNotice(ESTitleId titleId) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
@@ -419,7 +422,7 @@ namespace ipl {
|
||||
command.arguments.values[0] = 0;
|
||||
command.arguments.values[1] = 0;
|
||||
command.arguments.values[2] = 0;
|
||||
command.titleId = ((u64)page << 32) | index;
|
||||
command.titleId = titleId;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
@@ -1326,7 +1329,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesByUsage(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1343,7 +1346,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1361,7 +1364,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesFromNandUsage(
|
||||
s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount) {
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1384,7 +1387,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1400,7 +1403,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesByChannelOrder(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
static const int channelOrder[MAX_CHANNEL_INDEX] = {
|
||||
11, 7, 3, 10, 6, 2, 9, 5, 1, 8, 4, 0,
|
||||
};
|
||||
@@ -1427,7 +1430,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(page, channelOrder[order], 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1445,7 +1448,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesBySpecialChannels(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1502,7 +1505,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1528,7 +1531,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1544,7 +1547,7 @@ namespace ipl {
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(
|
||||
hadePage, hadeChannelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1559,7 +1562,7 @@ namespace ipl {
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(
|
||||
hatePage, hateChannelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1575,7 +1578,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesForMode(
|
||||
s32* requiredBytes, s32* requiredBlocks,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount, int searchMode) {
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount, int searchMode) {
|
||||
switch (searchMode) {
|
||||
case 0:
|
||||
return collectTitlesBySpecialChannels(
|
||||
|
||||
@@ -83,7 +83,6 @@ extern "C" void iplSDChannelTitle_setPageAndIndex(SDChannelTitle* scene, int pag
|
||||
extern "C" void iplSDChannelTitle_cleanupAndLeave(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_confirmLeaveToSettings(SDChannelTitle* scene, bool settings);
|
||||
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene);
|
||||
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(SDMemory::TitleRange*, const SDMemory::TitleRange*);
|
||||
|
||||
static inline void setMemoryTitleLists(SDMemory* memory, SDMemory::TitleRange sdRange,
|
||||
SDMemory::TitleRange nandRange) {
|
||||
@@ -764,9 +763,9 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
|
||||
if (static_cast<u32>(scene->mTitleRange.mByteSize) < 0x3800000) {
|
||||
nandRange.mByteSize = 0x3800000;
|
||||
nandRange.mCount = scene->mTitleRange.mCount;
|
||||
iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange);
|
||||
sdRange = scene->mTitleRange;
|
||||
} else {
|
||||
iplSDChannelTitle_copyTitleRange(&nandRange, iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange));
|
||||
nandRange = sdRange = scene->mTitleRange;
|
||||
}
|
||||
SDMemory* memory = &scene->mMemory;
|
||||
setMemoryTitleLists(memory, sdRange, nandRange);
|
||||
@@ -788,14 +787,6 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(
|
||||
SDMemory::TitleRange* target, const SDMemory::TitleRange* source) {
|
||||
s32 bytes = source->mByteSize;
|
||||
target->mCount = source->mCount;
|
||||
target->mByteSize = bytes;
|
||||
return target;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelTitle_updateMemoryCalc(SDChannelTitle* scene) {
|
||||
if (!scene->mMemory.calc()) {
|
||||
return;
|
||||
|
||||
@@ -262,6 +262,10 @@ static char s_manufacturer[] = "MELCO";
|
||||
static s32 s_operationState = -1;
|
||||
static const u8 s_messageId[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
|
||||
static u8 s_responseTypeByState[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
|
||||
typedef struct AOSSWaitDefaults {
|
||||
u16 connection;
|
||||
u16 response;
|
||||
} AOSSWaitDefaults;
|
||||
static const u16 s_defaultOptions[4] = { 0xffff, 0xffff, 0, 0 };
|
||||
|
||||
static void* s_responseBuffer;
|
||||
@@ -269,7 +273,7 @@ static s32 s_socketStarted;
|
||||
static u32 s_errorCode;
|
||||
static u32 s_connectionState;
|
||||
static u8 s_accessPointName[8];
|
||||
static int* s_accessPointConfig;
|
||||
static u32* s_accessPointConfig;
|
||||
static void* s_accessPointList;
|
||||
|
||||
extern int AOSSi_cancel_flag;
|
||||
@@ -386,6 +390,14 @@ cleanup_done:
|
||||
}
|
||||
|
||||
|
||||
static inline void* AOSSCopyManufacturer(AOSSNetworkSettings* settings) {
|
||||
settings->manufacturerLength = strlen(s_manufacturer);
|
||||
if (settings->manufacturerLength > 0xd) {
|
||||
return NULL;
|
||||
}
|
||||
return memcpy(settings->manufacturer, s_manufacturer, settings->manufacturerLength);
|
||||
}
|
||||
|
||||
int AOSS_Init_old(AOSSInitInput* input)
|
||||
{
|
||||
s16 initialWait;
|
||||
@@ -409,31 +421,30 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
int protocolResult;
|
||||
OSTime timeoutTicks;
|
||||
int initializationResult;
|
||||
int socketOptionResult;
|
||||
u8 requestMessageType;
|
||||
u8 replyAddressLength;
|
||||
short attemptCount;
|
||||
u16 remainingWait;
|
||||
short waitAttempt;
|
||||
u16 defaultConnection;
|
||||
u16 defaultResponse;
|
||||
union {
|
||||
struct { s16 connection; s16 response; } limits;
|
||||
struct { u16 connection; u16 response; } defaults;
|
||||
AOSSWaitDefaults defaults;
|
||||
} waitIntervals;
|
||||
AOSSWaitSettings waitSettings;
|
||||
int receivedPackets;
|
||||
u8 failureStatus;
|
||||
AOSSNetworkSettings settings;
|
||||
AOSSRequestRecords requestRecords;
|
||||
AOSSSocketAddress replyAddress;
|
||||
u8 messageIdentity[8];
|
||||
__declspec(align(32)) AOSSSocketAddress socketAddress;
|
||||
AOSSSocketAddress receivedAddress;
|
||||
struct { int seconds; int microseconds; } pollTime;
|
||||
__declspec(align(32)) AOSSSocketAddress socketAddress;
|
||||
u8 messageIdentity[8];
|
||||
AOSSSocketAddress replyAddress;
|
||||
u32 networkAddresses[5];
|
||||
AOSSPollDescriptor pollArguments[2];
|
||||
|
||||
defaultConnection = s_defaultOptions[0];
|
||||
defaultResponse = s_defaultOptions[1];
|
||||
waitIntervals.defaults.connection = defaultConnection;
|
||||
waitIntervals.defaults.response = defaultResponse;
|
||||
waitIntervals.defaults = *(const AOSSWaitDefaults*)s_defaultOptions;
|
||||
waitSettings.value = 0;
|
||||
receivedPackets = 0;
|
||||
protocolState = 0;
|
||||
@@ -474,7 +485,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -498,7 +509,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -511,7 +522,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -525,7 +536,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 2;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -539,7 +550,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 1;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -554,7 +565,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -590,10 +601,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
settings.networkNameLength = strlen("ESSID-AOSS");
|
||||
memcpy(settings.networkName,"ESSID-AOSS",settings.networkNameLength);
|
||||
settings.useManufacturer = 1;
|
||||
settings.manufacturerLength = strlen(s_manufacturer);
|
||||
if (settings.manufacturerLength <= 0xd) {
|
||||
memcpy(settings.manufacturer,s_manufacturer,settings.manufacturerLength);
|
||||
}
|
||||
AOSSCopyManufacturer(&settings);
|
||||
initializationResult = AOSSi_SetNCDIPAddr(0xc0a80b65,0xffffff00,0xc0a80b01,0,0);
|
||||
state = initializationResult;
|
||||
if (state != 0) {
|
||||
@@ -601,7 +609,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -623,12 +631,12 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -648,7 +656,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -663,7 +671,7 @@ wait_for_initial_link:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -672,14 +680,14 @@ wait_for_initial_link:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((state == 0) && ((u32)*s_accessPointConfig == 1u)) goto handle_initial_link;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) goto handle_initial_link;
|
||||
remainingWait = (u16)waitIntervals.limits.response;
|
||||
for (; remainingWait != 0; remainingWait = (u16)(remainingWait - nextSleep)) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -696,7 +704,7 @@ wait_for_initial_link:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -713,7 +721,7 @@ handle_initial_link:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -724,7 +732,7 @@ handle_initial_link:
|
||||
else {
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -732,11 +740,14 @@ handle_initial_link:
|
||||
}
|
||||
{
|
||||
int recordIndex;
|
||||
int sequence;
|
||||
u16* transactionId;
|
||||
for (recordIndex = 0; recordIndex < 3; recordIndex++) {
|
||||
memcpy(requestRecords.records[recordIndex].address, input->optionData, 6);
|
||||
requestRecords.records[recordIndex].transactionId = rand();
|
||||
requestRecords.records[recordIndex].transactionId =
|
||||
SOHtoNs(requestRecords.records[recordIndex].transactionId);
|
||||
sequence = rand();
|
||||
transactionId = &requestRecords.records[recordIndex].transactionId;
|
||||
*transactionId = sequence;
|
||||
*transactionId = SOHtoNs(*transactionId);
|
||||
}
|
||||
}
|
||||
s_socket = SOSocket(2,2,0);
|
||||
@@ -744,7 +755,7 @@ handle_initial_link:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -752,12 +763,12 @@ handle_initial_link:
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else if (initializationResult < 0) {
|
||||
else if (socketOptionResult < 0) {
|
||||
s_errorCode = 0xb;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -786,6 +797,8 @@ handle_initial_link:
|
||||
goto finish_initialization;
|
||||
}
|
||||
{
|
||||
requestMessageType = 0x11;
|
||||
replyAddressLength = sizeof(replyAddress);
|
||||
attemptCount = waitSettings.halfwords.high;
|
||||
settings.gatewayAddress = 0xc0a80b65;
|
||||
settings.ipAddress = 0xc0a80b01;
|
||||
@@ -814,7 +827,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -837,7 +850,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -847,12 +860,12 @@ request_socket_cleanup_complete:
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_runtime.active = '\x01';
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == (int *)0x0) {
|
||||
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -869,7 +882,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -885,7 +898,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -902,7 +915,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -917,7 +930,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -936,7 +949,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -984,7 +997,7 @@ request_socket_cleanup_complete:
|
||||
packetWords->finalLength = SOHtoNs(0);
|
||||
packetWords->finalSequence = SOHtoNs(0);
|
||||
packetWords->reserved = 0;
|
||||
packetWords->messageType = 0x11;
|
||||
packetWords->messageType = requestMessageType;
|
||||
memcpy(packetWords->messageIdentity,messageIdentity,8);
|
||||
memset(&replyAddress,0,8);
|
||||
replyAddress.family = 2;
|
||||
@@ -993,7 +1006,7 @@ request_socket_cleanup_complete:
|
||||
if ((s8)s_runtime.active == 0) {
|
||||
replyAddress.address = 0xffffffff;
|
||||
}
|
||||
replyAddress.length = 8;
|
||||
replyAddress.length = replyAddressLength;
|
||||
SOSendTo(requestSocket,packetWords,0x18,0,&replyAddress);
|
||||
sendResult = 0;
|
||||
|
||||
@@ -1007,7 +1020,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1049,7 +1062,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1066,7 +1079,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1080,7 +1093,7 @@ request_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1092,7 +1105,6 @@ request_socket_cleanup_complete:
|
||||
goto finish_initialization;
|
||||
process_received_packet:
|
||||
{
|
||||
AOSSSocketAddress receivedAddress;
|
||||
u8 addressLength = sizeof(receivedAddress);
|
||||
receivedAddress.length = addressLength;
|
||||
receivedLength = SORecvFrom(s_socket,&packetBuffer->message,0x5dc,0,&receivedAddress);
|
||||
@@ -1128,7 +1140,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1150,7 +1162,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1163,7 +1175,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1177,7 +1189,7 @@ wait_for_packet:
|
||||
input->status = 2;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1190,7 +1202,7 @@ wait_for_packet:
|
||||
input->status = 1;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1199,12 +1211,12 @@ wait_for_packet:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == (int *)0x0) {
|
||||
s_accessPointConfig = (u32 *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1221,7 +1233,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1237,7 +1249,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1254,7 +1266,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1266,7 +1278,7 @@ wait_for_packet:
|
||||
}
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1277,7 +1289,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1296,7 +1308,7 @@ wait_for_packet:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1327,7 +1339,7 @@ advance_protocol_state:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1344,7 +1356,7 @@ advance_protocol_state:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1374,7 +1386,7 @@ protocol_socket_cleanup_complete:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1395,7 +1407,7 @@ protocol_socket_cleanup_complete:
|
||||
input->status = failureStatus;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -1410,7 +1422,7 @@ protocol_socket_cleanup_complete:
|
||||
input->status = 6;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
s_accessPointConfig = 0;
|
||||
}
|
||||
if (s_accessPointList) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
@@ -2510,6 +2522,8 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
|
||||
s32 index;
|
||||
int result = -1;
|
||||
u8* packetBytes;
|
||||
u8* mask;
|
||||
u8* output;
|
||||
|
||||
keyMask = (u8*)AOSSi_Alloc(halfLength);
|
||||
if (keyMask == 0) {
|
||||
@@ -2528,8 +2542,9 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
|
||||
for (round = 0; round < 2; round++) {
|
||||
keyIndex = round % keyLength;
|
||||
for (index = 0; index < halfLength; index++) {
|
||||
keyMask[index] = (u8)index;
|
||||
keyMask[index] = keyMask[index] ^ (u8)key[keyIndex];
|
||||
mask = &keyMask[index];
|
||||
*mask = (u8)index;
|
||||
*mask = *mask ^ (u8)key[keyIndex];
|
||||
keyIndex++;
|
||||
if (keyIndex >= keyLength) {
|
||||
keyIndex = 0;
|
||||
@@ -2537,9 +2552,9 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
|
||||
}
|
||||
|
||||
for (index = 0; index < halfLength; index++) {
|
||||
u8 inputByte = packetHalf[index];
|
||||
inputByte ^= keyMask[index];
|
||||
packetHalf[index] = inputByte;
|
||||
mask = &keyMask[index];
|
||||
output = &packetHalf[index];
|
||||
*output = *output ^ *mask;
|
||||
}
|
||||
|
||||
memcpy(temporary, packetHalf, halfLength);
|
||||
|
||||
@@ -127,15 +127,23 @@ int AOSSi_EndLocal(void) {
|
||||
}
|
||||
|
||||
int AOSSi_WLANGetBSSList(void** output) {
|
||||
int index;
|
||||
int driver;
|
||||
void* buffer;
|
||||
u8* scanBuffer;
|
||||
WDBssDesc* descriptor;
|
||||
int count;
|
||||
struct AOSSAccessPointList* list;
|
||||
int rate;
|
||||
int rateCount;
|
||||
int scanResult;
|
||||
int result = -1;
|
||||
int startupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
int cleanupRetries = 0;
|
||||
int unlockRetries = 0;
|
||||
WDScanParam scan ATTRIBUTE_ALIGN(32);
|
||||
WD_Info info ATTRIBUTE_ALIGN(32);
|
||||
int unlockRetries = 0;
|
||||
int driver;
|
||||
u8* buffer;
|
||||
int cleanupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
u8 macAddress[6];
|
||||
if (!allocateMemory || !releaseMemory) {
|
||||
return -1;
|
||||
@@ -159,6 +167,7 @@ startup:
|
||||
buffer = AOSSi_Alloc(0x3200);
|
||||
if (buffer) {
|
||||
memset(buffer, 0, 0x3200);
|
||||
scanBuffer = (u8*)buffer;
|
||||
scan.channelBit = info.enableChannel;
|
||||
scan.maxChannelTime = 40;
|
||||
memset(scan.bssid, 255, 6);
|
||||
@@ -167,15 +176,11 @@ startup:
|
||||
memset(scan.ssid, 0, 32);
|
||||
memset(scan.ssidMask, 255, 32);
|
||||
while (1) {
|
||||
int scanResult = WD_Scan(&scan, buffer, 0x3200);
|
||||
int count;
|
||||
struct AOSSAccessPointList* list;
|
||||
WDBssDesc* descriptor;
|
||||
int index;
|
||||
scanResult = WD_Scan(&scan, scanBuffer, 0x3200);
|
||||
if (scanResult != 0 && scanResult != WD_INTERNAL_ERR_4) {
|
||||
break;
|
||||
}
|
||||
count = *(u16*)buffer;
|
||||
count = *(u16*)scanBuffer;
|
||||
if (count != 0) {
|
||||
list = AOSSi_Alloc(sizeof(*list) + (count - 1) * sizeof(struct AOSSAccessPoint));
|
||||
if (!list) {
|
||||
@@ -183,10 +188,8 @@ startup:
|
||||
break;
|
||||
}
|
||||
list->count = count;
|
||||
descriptor = (WDBssDesc*)&buffer[2];
|
||||
descriptor = (WDBssDesc*)&scanBuffer[2];
|
||||
for (index = 0; index < count; ++index) {
|
||||
int rate;
|
||||
int rateCount;
|
||||
list->accessPoints[index].ssidLength = descriptor->ssidLength;
|
||||
memcpy(list->accessPoints[index].ssid, descriptor->ssid, 32);
|
||||
list->accessPoints[index].channel = descriptor->channel;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -891,8 +891,7 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
|
||||
|
||||
void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutput, u16 width, u16 height,
|
||||
const long* conversionTable, int format) {
|
||||
u8* cbSource = source + width * height;
|
||||
u8* crSource = source + width * height * 2;
|
||||
u32 planeSize = (u32)width * (u32)height;
|
||||
for (int i = 0; i < width; i++) {
|
||||
s32 red;
|
||||
s32 green;
|
||||
@@ -916,8 +915,8 @@ void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutpu
|
||||
} else {
|
||||
int offset = (i & 7) + (i & ~7) * 4;
|
||||
float y = source[offset] - colorConvert16;
|
||||
float cb = cbSource[offset] - colorConvert128;
|
||||
float cr = crSource[offset] - colorConvert128;
|
||||
float cb = source[planeSize + offset] - colorConvert128;
|
||||
float cr = source[planeSize * 2 + offset] - colorConvert128;
|
||||
red = colorConvertY * y + colorConvertR * cr;
|
||||
green = colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr;
|
||||
blue = colorConvertY * y + colorConvertB * cb;
|
||||
@@ -2025,7 +2024,7 @@ s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* req
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = (sourceCursor[0] << 24 | sourceCursor[1] << 16 | sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
@@ -2081,7 +2080,7 @@ s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* req
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = (sourceCursor[0] << 24 | sourceCursor[1] << 16 | sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= 6; length++) {
|
||||
@@ -2144,7 +2143,7 @@ s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* req
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = (sourceCursor[0] << 24 | sourceCursor[1] << 16 | sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
|
||||
58
tools/decomp-assist/CHANSVm-converter-const-20261009.md
Normal file
58
tools/decomp-assist/CHANSVm-converter-const-20261009.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# CHANSVm converter input types
|
||||
|
||||
Base: `20cf9f9f25b13b8cd6910e07cc5eb71558845d4e`, target 43U only.
|
||||
|
||||
## Change and source review
|
||||
|
||||
`CHANSVmConvertToFloatFromStr` took a pointer-to-const source header while
|
||||
`VmConvertFunc` specified a mutable source header. The conversion table cast
|
||||
hid that incompatible function-pointer type at the indirect call.
|
||||
|
||||
Give all 11 converters and the callback typedef the same pointer-to-const
|
||||
source-header type, and remove the callback cast. All converters either read
|
||||
source values, ignore the source, or pass it through the read-only array-join
|
||||
path. They write only newly allocated result objects. Propagate the input type
|
||||
through `VmArrayJoinCommon`, `VmArrayJoinEstimateStrSize`, `VmArrayJoinSub`, and
|
||||
`VmArraySeekTop`, including the forward declaration. These helpers only read
|
||||
the source header; the join routines write the destination string and local
|
||||
state. `VmArraySeekTop` still returns a mutable chunk pointer because header
|
||||
constness is shallow and other callers can mutate array elements. No cast is
|
||||
needed at the array-join boundary.
|
||||
|
||||
The public `CHANSVmConvertObjectType` input remains mutable: its same-type fast
|
||||
path returns the original mutable object. Passing it to a const-source
|
||||
converter is valid. No executable expressions, flags, data or layout changed.
|
||||
|
||||
## Fresh leaf verification
|
||||
|
||||
Configured using the restored `wii-source-tools/build-43U.sh` tool paths and
|
||||
flags, with commands run in the isolated leaf instead of that script's fixed
|
||||
main directory. Baseline object was freshly compiled before editing.
|
||||
|
||||
- Entire CHANSVm object is byte-identical to that baseline, SHA256
|
||||
`11fa48261cd93668d133d5ef73efbf3c9109181730b21409153b78316189e063`.
|
||||
All 233 sibling function spans, allocated sections and relocations unchanged.
|
||||
- All 15 emitted converter/dispatch/join functions: exact-name objdiff 100.0,
|
||||
raw target function bytes and normalized relocation targets identical
|
||||
(86 code relocations). VmArraySeekTop is inlined.
|
||||
- All target data sections match including alignment padding: `.rodata` 1432,
|
||||
`.data` 4672, `.sdata2` 184, `.sdata` 600, `.sbss` 16 bytes;
|
||||
all 614 data relocations match by resolved section/function target.
|
||||
- Pool: 125/125 strings identical. Dispatch ctxdiff: 47/47 instructions, 0 diffs.
|
||||
FloatFromStr: 83/83 instructions, one textual symbol-alias difference
|
||||
(`VmNaN` versus `lbl_81694F08`); raw bytes and resolved relocation target are
|
||||
identical. This is not represented as a literal ctxdiff-zero result.
|
||||
- Fresh full 43U build, report and `build/43U/ok` pass. DOL SHA1:
|
||||
`26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
- All 1028 unit measures/functions/sections and overall report measures are
|
||||
unchanged against the saved base report. All 22 workflow guards pass with
|
||||
no skips. `git diff --check` passes.
|
||||
|
||||
This is a binary-neutral type correction, not a new matching/linking gain.
|
||||
CHANSVm remains 229/233 exact, 45284/53564 exact code bytes, 6904/6904 matching
|
||||
data bytes, and unlinked. The completion assertion still fails on the existing
|
||||
project-wide incomplete code/link totals; no full-completion claim is made.
|
||||
|
||||
Local evidence: `../vm-converter-const-evidence/` contains baseline/candidate
|
||||
build logs, original baseline object/report, verification script/results,
|
||||
full-build/report/ok logs, pool and ctxdiff results, guards and completion logs.
|
||||
285
tools/decomp-assist/g-aoss.attempts.md
Normal file
285
tools/decomp-assist/g-aoss.attempts.md
Normal file
@@ -0,0 +1,285 @@
|
||||
# g-aoss attempts, 2026-10-09
|
||||
|
||||
Assigned worktree data-d1, branch agent/w1009/g-aoss, base 54ca052b. Scope AOSS_Init_old and AOSSi_WLANConnect. Read opus-common.md, AGENTS.md, unslop, prior AOSS logs and 509c4f11. Preserve rx67c.attempts.md. No pushes, PRs, merges, rebases, other-worktree edits or subagents.
|
||||
|
||||
Initial full 43U build passed. Target AOSS .sdata2 contains ffffffff00000000, 8 bytes with section alignment 8. Opus replay emits four bytes, ffffffff; objdiff rejects the entire 8-byte section, accounting for DATA DROP 2800 -> 2792. Both main and Opus emit 364 bytes in .data versus target 368, because the split includes final section alignment. This .data extent alone is not the reported regression.
|
||||
|
||||
## Attempts
|
||||
|
||||
- opus-replay: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 4}. Replay 509c4f11 without changing its source.
|
||||
- defaults-array-typed-view: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
|
||||
- defaults-array-pairs: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
|
||||
- defaults-union-view: 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Preserve the existing four halfword option defaults and read its connection/response pair as a struct.
|
||||
- connect-alias-void: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
|
||||
- connect-alias-typed: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
|
||||
- connect-alias-bytes: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Typed config view survives into the later NCD call; target has one coalesced config pointer.
|
||||
- connect-local-static-ip: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Local static config limits alias edges, lever 35; trial only until data/order verification.
|
||||
- connect-local-static-both: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Local static config limits alias edges, lever 35; trial only until data/order verification.
|
||||
- connect-memset-result: 14/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Consume the memset return value as the typed config pointer.
|
||||
- connect-success-value: 105/155 positional diffs, 154/155 instructions; sections {'.data': 48}. Use the current initialization success value in related zero stores and memset.
|
||||
- connect-pointer-at-entry: 79/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Initialize the real config pointer at declaration, before wireless setup.
|
||||
|
||||
Full single/pairwise optimizer sweep: AOSS_Init_old best 1264 positional differences; WLANConnect best 2. No pragma hit. Fixed defaults array with typed struct view restores AOSS data 2800/2800 and preserves Opus Init score 97.33775%, 20/21 exact.
|
||||
|
||||
The first Init source-search selected its earlier prototype and found no mutations. This was not Init coverage. Local script now selects the definition.
|
||||
- connect-helper-return-pointer: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
|
||||
- connect-helper-parameter: 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
|
||||
- connect-helper-return-result: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
|
||||
- connect-helper-return-void-pointer: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
|
||||
- connect-helper-return-pointer-scoped: 24/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Factor the complete IPv4 initialization into a real inline helper; no dummy or identity operation.
|
||||
- init-message-type-u8: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-address-length-u8: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-both-u8: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-message-type-u32: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-address-length-u32: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-both-u32: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-message-type-int: objdiff 97.34406%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-address-length-int: objdiff 97.09659%, exact 20, data 2800; 1410/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-both-int: objdiff 97.119316%, exact 20, data 2800; 1344/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the actual protocol message code/socket-address width instead of a loop-wide unrelated constant.
|
||||
- init-poll-named-products: objdiff 97.3125%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Keep native OSTime addition and the existing u32 product truncation; give real products separate names.
|
||||
- init-poll-separate-components: objdiff 97.3125%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Keep native OSTime addition and the existing u32 product truncation; give real products separate names.
|
||||
- init-manufacturer-single-pass-guard: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
|
||||
- init-manufacturer-bounded-copy-loop: objdiff 97.08839%, exact 20, data 2800; 1154/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
|
||||
- init-manufacturer-bounded-copy-for: objdiff 97.08839%, exact 20, data 2800; 1154/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
|
||||
- init-manufacturer-switch-length-range: objdiff 96.98737%, exact 20, data 2800; 1305/1585 positional diffs, 1585/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
|
||||
- init-manufacturer-positive-branch-label: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Express the observed bounded manufacturer copy with a structured exit; same bytes and call count.
|
||||
- init-retry-switch-result: objdiff 97.27146%, exact 20, data 2800; 1314/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
|
||||
- init-retry-nested-success: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
|
||||
- init-retry-continue-then-success: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Natural result dispatch with a single state-success test and the existing config test.
|
||||
- init-preheader-type-u8: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-identity-length-u8: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-both-u8: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-type-u32: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-identity-length-u32: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-both-u32: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-type-int: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-identity-length-int: objdiff 97.33775%, exact 20, data 2800; 1264/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- init-preheader-both-int: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Initialize actual message fields after the unassigned socket-option guard, exactly in the protocol preheader.
|
||||
- compiler-AOSSLink-3.0a5: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSSLink-3.0a3.4: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSSLink-3.0a3.3: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSSLink-2.7: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSSLink-2.6: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSS-3.0a5: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSS-3.0a3.4: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSS-3.0a3.3: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSS-2.7: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
- compiler-AOSS-2.6: compile failed. Check neighboring SDK compiler versions; require all siblings and sections to stay exact before considering a config change.
|
||||
|
||||
## Evidence and retained source
|
||||
|
||||
- AOSS target .sdata2 is 8 bytes, ffffffff00000000. The original two symbols cover offsets 0..2 and 2..8. Preserve the existing u16[4] defaults and read its first pair through AOSSWaitDefaults. All three reconstructed array/union views emit the same eight bytes; retained form keeps the original four halfword initializer.
|
||||
- The target reads r14 at Init instruction 509, relative offset 0x7f4, with cmpwi r14,0. No earlier instruction names r14. Its first write is instruction 576, li r14,0x11. _savegpr_14 stores incoming registers without changing r14. This verifies the saved Opus unassigned socketOptionResult against the target and follows user-approved lever 10. No new undefined-value trick was invented.
|
||||
- Keep requestMessageType initialized to 0x11 after the socket-option guard and successful SOBind, in the real protocol preheader. This moves the protocol constant to the target region and improves objdiff 97.33775 -> 97.39141 without changing instruction count or any exact sibling. The earlier function-entry initializer trials are rejected: they write r14 before the target's unassigned guard.
|
||||
- Source-search: WLANConnect 959 trials in 180 seconds, no gain. Corrected Init definition search 723 trials in 240 seconds, no gain. No automatic mutation is retained. Searches used separate /tmp/g-aoss-* source and object files.
|
||||
- Neighboring GC/3.0a5, 3.0a3.4 and 3.0a3.3 compilers produce identical remaining scores. GC/2.7 and 2.6 reject -ipa file. Compiler configuration is unchanged.
|
||||
- WLANConnect still differs only at instructions 66 and 67. Target sets r5 to 0x7c4 before copying r27 to r3; source performs that copy first. Its 13 exact siblings and 2432 bytes of data are unchanged. Local-static, cross-use alias, return-pointer and real initialization-helper trials did not resolve this scheduler tie. AOSSLink.c is unchanged.
|
||||
- Init remains 1578/1584 instructions. Missing target structure includes the manufacturer ble plus unconditional branch, three consecutive same-compare bne pairs, and protocol constant materialization. The DS implementation has the same bne pairs. No redundant source condition or artificial branch was added to reproduce them. Both owned units remain NonMatching because neither is fully exact.
|
||||
|
||||
Final gate and independent current-object checks follow.
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/setting/AOSS] pool: IDENTICAL
|
||||
[src/scene/setting/AOSS] objdiff: code 9856/16192 data 2800/2800 functions 20/21 fuzzy 98.9792 linked code 0
|
||||
[src/scene/setting/AOSS] instruction-exact functions: 20/21
|
||||
[src/scene/setting/AOSS] section .bss size 2368 match 100.0
|
||||
[src/scene/setting/AOSS] section .data size 368 match 100.0
|
||||
[src/scene/setting/AOSS] section .sbss size 32 match 100.0
|
||||
[src/scene/setting/AOSS] section .sdata size 24 match 100.0
|
||||
[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0
|
||||
[src/scene/setting/AOSS] section .text size 16192 match 98.97925
|
||||
[src/scene/setting/AOSS] below 100: AOSS_Init_old 97.39141
|
||||
[src/scene/setting/AOSS] baseline: code 9856/16192 data 2800 functions 20 fuzzy 98.6781
|
||||
[src/scene/setting/AOSSLink] pool: IDENTICAL
|
||||
[src/scene/setting/AOSSLink] objdiff: code 1576/2196 data 2432/2432 functions 13/14 fuzzy 99.6357 linked code 0
|
||||
[src/scene/setting/AOSSLink] instruction-exact functions: 13/14
|
||||
[src/scene/setting/AOSSLink] section .bss size 2344 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .data size 48 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .sbss size 40 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .text size 2196 match 99.635704
|
||||
[src/scene/setting/AOSSLink] below 100: AOSSi_WLANConnect 98.70968
|
||||
[src/scene/setting/AOSSLink] baseline: code 1576/2196 data 2432 functions 13 fuzzy 99.6357
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 99.20325 -> 99.20325
|
||||
global fuzzy_match_percent: 99.97473 -> 99.97636
|
||||
global complete_code_percent: 94.18519 -> 94.18519
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
Independent focused checks: AOSS pool 1/1 strings identical, AOSSLink 0/0 identical; WLANConnect odiff/ctxdiff 2/155, equal 0x26c sizes. Init odiff/ctxdiff 1263 differences, 1578/1584 instructions, sizes 0x18a8/0x18c0. No new exact functions. The data regression is fully repaired; both units remain unlinked. All experimental AOSSLink and compiler changes were discarded. Retained paths are AOSS.c and this attempts log.
|
||||
|
||||
## Round b, MAX, 2026-10-09
|
||||
|
||||
Branch agent/w1009/g2-aoss, HEAD and fresh origin/main 87214ff9. Full 43U build and both pools passed. Preserve the pre-existing untracked rx67c.attempts.md. Read opus-common.md and round-a source and trial history. Both single/pairwise pragma sweeps were already run on this baseline; repeating unchanged sweeps adds no coverage.
|
||||
|
||||
Register-normalized sequence alignment locates the six missing instructions precisely: manufacturer ble plus b versus bgt, one extra bne after each of the three connection-success comparisons, the preheader address-length 8 materialization, and a fresh zero before the packet reserved byte store. All other count differences in the alignment are instruction movement. Target duplicate branches are at object offsets 0x7f8/0x7fc, 0xd50/0xd54, and 0x1610/0x1614. Source control-flow trials will use one meaningful status predicate rather than introducing duplicate guards.
|
||||
|
||||
- b-init-socklen-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-xor-u8: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-xor-u16: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-xor-u32: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-init-socklen-mem-xor-int: objdiff 97.34091%, exact 20, data 2800; 1265/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the shared socket-address length in the real protocol preheader and consume it at both address-byte stores; optional same-width message operations.
|
||||
- b-connect-ip-late-pointer: compile failed. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
|
||||
- b-connect-ip-late-direct: compile failed. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
|
||||
- b-connect-both-target-order-direct: objdiff 96.019356%, exact 13, data 2432; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
|
||||
- b-connect-both-target-order-pointer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
|
||||
- b-connect-both-ipblock-direct: objdiff 96.019356%, exact 13, data 2432; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Limit config-object scope and preserve target IfConfig-before-IpConfig allocation; use the actual config directly or retain the pointer at its first use.
|
||||
- b-connect-ip-scope-pointer: objdiff 98.70968%, exact 13, data 88; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
|
||||
- b-connect-ip-scope-direct: objdiff 96.019356%, exact 13, data 88; 35/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
|
||||
- b-connect-ip-scope-const-pointer: objdiff 98.70968%, exact 13, data 88; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. C89-valid phase block for the local static IP config; its lifetime spans all initialization and the NCDSetIpConfig call.
|
||||
- b-connect-cpp: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
|
||||
- b-connect-cpp-ipa-off: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
|
||||
- b-connect-cpp-inline-off: compile failed. Test a real C++ translation with C linkage and explicit allocation casts to compare frontend call-argument generation; retain only whole-unit exact output.
|
||||
- b-init-switch-default-first: objdiff 97.32513%, exact 20, data 2800; 1317/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-all: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-all-default-first: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-narrow: objdiff 96.98485%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-enum: objdiff 97.36301%, exact 20, data 2800; 1325/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-manufacturer-default-first: objdiff 97.04104%, exact 20, data 2800; 1306/1585 positional diffs, 1585/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-init-switch-manufacturer-reverse: objdiff 97.23043%, exact 20, data 2800; 1180/1584 positional diffs, 1582/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Dispatch one real connection-success state without repeating a condition, or use an explicit manufacturer default case; compare block counts before register work.
|
||||
- b-connect-cpp-fixed: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
|
||||
- b-connect-cpp-fixed-ipa-off: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
|
||||
- b-connect-cpp-fixed-inline-off: objdiff 98.70968%, exact 12, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Replace the existing language option rather than appending it; real C++ source, C linkage, and allocation casts.
|
||||
- b-connect-proc-750: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-740: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-603e: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-604e: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-601: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-602: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-7400: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-connect-proc-7450: compile failed. Processor scheduling model test from compiler help; compare all 14 function scores and unchanged sections before accepting any flag.
|
||||
- b-init-inline-manufacturer-void: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
|
||||
- b-init-inline-manufacturer-status: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
|
||||
- b-init-inline-link-conjunction: objdiff 96.28661%, exact 20, data 2800; 1266/1590 positional diffs, 1590/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
|
||||
- b-init-inline-link-early-return: objdiff 96.41288%, exact 20, data 2800; 1307/1593 positional diffs, 1593/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
|
||||
- b-init-inline-link-value: objdiff 96.984215%, exact 20, data 2800; 695/1584 positional diffs, 1584/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real reusable manufacturer-copy or connection-status helper, explicit inline-only mode; no duplicate guard or artificial dependency.
|
||||
- b-connect-storage-byte-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
|
||||
- b-connect-storage-word-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
|
||||
- b-connect-storage-record-array: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
|
||||
- b-connect-storage-union-buffer: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Use a complete aligned config buffer with a typed record view; no offset cast or extra storage, and clear its real bytes.
|
||||
- b-init-helper-pending-result: objdiff 95.847855%, exact 20, data 2800; 1326/1597 positional diffs, 1597/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-helper-pending-result-if: objdiff 95.847855%, exact 20, data 2800; 1326/1597 positional diffs, 1597/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-helper-connected-result: objdiff 96.236115%, exact 20, data 2800; 1324/1591 positional diffs, 1591/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-helper-connected-result-early: objdiff 96.18561%, exact 20, data 2800; 1258/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-helper-connected-status: objdiff 96.008835%, exact 20, data 2800; 1259/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-helper-pending-negation: objdiff 96.28661%, exact 20, data 2800; 1266/1590 positional diffs, 1590/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Real helper combines the call result and config connected flag into an attempt result; callers consume it once, with no duplicate source condition.
|
||||
- b-init-manufacturer-void-opt_dead_code-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-init-manufacturer-void-opt_common_subs-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-gekko: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-void-opt_propagation-off: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-750: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-void-ppc_iro_level-0: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-740: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-void-optimization_level-1: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-603e: objdiff 83.08387%, exact 6, data 2432; 31/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-connect-narrow-proc-604e: objdiff 95.16129%, exact 9, data 2432; 14/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-void-optimization_level-2: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-601: objdiff 80.47097%, exact 7, data 2432; 39/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-void-optimization_level-3: objdiff 97.39141%, exact 20, data 2800; 1263/1584 positional diffs, 1578/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Apply the allowed optimizer setting only to a natural early-return bounded-copy helper; leave Init and siblings at their existing settings.
|
||||
- b-connect-narrow-proc-602: objdiff 87.05161%, exact 8, data 2432; 28/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-pointer: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Bounded manufacturer copy returns its actual destination or copied byte count, with an error return for oversized input.
|
||||
- b-connect-narrow-proc-7400: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-manufacturer-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Bounded manufacturer copy returns its actual destination or copied byte count, with an error return for oversized input.
|
||||
- b-connect-narrow-proc-7450: objdiff 95.96774%, exact 11, data 2432; 11/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Diagnostic scheduling models with only the used OS headers, excluding unused paired-single fast-cast definitions. No shared header edits.
|
||||
- b-init-packet-header-void: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Factor the complete final-message header construction into a real typed inline helper; compare the target fresh reserved-byte zero materialization.
|
||||
- b-init-packet-header-packet: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Factor the complete final-message header construction into a real typed inline helper; compare the target fresh reserved-byte zero materialization.
|
||||
- b-connect-size-early: objdiff 98.70968%, exact 13, data 2432; 2/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
|
||||
- b-connect-size-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
|
||||
- b-connect-ushort-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
|
||||
- b-connect-ulong-phase: objdiff 98.6%, exact 13, data 2432; 4/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
|
||||
- b-connect-size-late: objdiff 98.632256%, exact 13, data 2432; 3/155 positional diffs, 155/155 instructions; sections {'.data': 48}. Name the actual initialized config length at its phase boundary; compare the PCode argument setup and preserve one complete clear.
|
||||
- b-init-byte-reply-signed-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-byte-reply-plain-length: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-byte-reserved-signed: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-byte-reserved-plain: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-byte-reply-reserved-signed: objdiff 97.46401%, exact 20, data 2800; 1224/1584 positional diffs, 1579/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-byte-reply-only-named-length: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare genuine byte-field type choices and the distinct reply-address length lifetime; preserve field widths, offsets, values, and all siblings.
|
||||
- b-init-attempt-ready-zero: objdiff 94.22349%, exact 20, data 2800; 1240/1606 positional diffs, 1606/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
|
||||
- b-init-attempt-preserve-result: objdiff 94.98043%, exact 20, data 2800; 1190/1594 positional diffs, 1594/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
|
||||
- b-init-attempt-early-ready: objdiff 94.416664%, exact 20, data 2800; 1228/1603 positional diffs, 1603/1584 instructions; sections {'.data': 364, '.sdata2': 8}. A real inline connection attempt calls the exact existing connection routine and classifies its error, ready, or pending state once.
|
||||
- b-init-header-control-u8-preheader: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-u8-message: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-u16-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-u16-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-u32-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-u32-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-int-preheader: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-header-control-int-message: objdiff 97.429924%, exact 20, data 2800; 1232/1584 positional diffs, 1581/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Name the zero control words of the outgoing packet separately from its reserved byte, at a real protocol or message boundary.
|
||||
- b-init-phase-protocol-limit: objdiff 97.558716%, exact 20, data 2800; 1244/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
|
||||
- b-init-phase-scan-count: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
|
||||
- b-init-phase-both: objdiff 97.58712%, exact 20, data 2800; 1236/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
|
||||
- b-init-phase-protocol-limit-int: objdiff 97.558716%, exact 20, data 2800; 1244/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Give scan attempts and the protocol retry limit their own meaningful lifetimes; retain the same signed limits, arithmetic, and cleanup paths.
|
||||
- b-init-cache-replyAddressLength-u16: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
- b-init-cache-replyAddressLength-u32: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
- b-init-cache-replyAddressLength-int: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
- b-init-cache-requestMessageType-u16: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
- b-init-cache-requestMessageType-u32: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
- b-init-cache-requestMessageType-int: objdiff 97.602905%, exact 20, data 2800; 1235/1584 positional diffs, 1580/1584 instructions; sections {'.data': 364, '.sdata2': 8}. Compare the scalar type of the actual named packet/address byte while retaining both distinct protocol fields and all uses.
|
||||
|
||||
### Round-b retained result and rejected paths
|
||||
|
||||
- Retain the bounded manufacturer-copy helper returning the actual memcpy destination or NULL on oversized input. The whole operation has the original strlen, length store, bounds predicate and memcpy side effects. Its inlined return path produces the target ble plus unconditional branch exactly, recovering one instruction. The void-return control collapses to the earlier bgt and is rejected. No explicit status constant or additional source guard is retained.
|
||||
- Enable explicit inlining with `-inline on,noauto` for AOSS only. The helper leaves no standalone function in the object; all 20 exact siblings and all 2800 data bytes stay exact. No auto-inlining change is applied to other units.
|
||||
- Give the outgoing reply-address length its own protocol-preheader value, `sizeof(replyAddress)`, and use it only for the outgoing address byte. The target caches this outgoing length separately from the bound socket address and materializes the received-address length at SORecvFrom. Sharing one named length across outgoing and received addresses is worse and was rejected. The retained source reaches 1580/1584 instructions and objdiff 97.602905%, from 1578/1584 and 97.39141%.
|
||||
- Remaining Init count/control-flow gaps are the three duplicate target bne pairs and a preheader constant-cache difference. In the retained source, the preheader caches outgoing length 8 and rematerializes message type 0x11 inside case 2; the target caches both and freshly materializes reserved-byte zero in case 2. The target's repeated success branches remain absent. Switch dispatch, actual connection-result helpers, packet-header helpers, field signedness, phase-specific attempt limits and scoped helper pragmas did not reproduce those blocks without regressions or extra instructions. No repeated guard is added.
|
||||
- The existing unassigned socketOptionResult guard is preserved from main and round-a evidence. This round adds no uninitialized local or use-site volatile access.
|
||||
- The correct function-local static order is IfConfig before IpConfig. It emits `AOSSi_NcdIfConfig$546` at .bss offset 0, size 350, and `AOSSi_NcdIpConfig$547` at .bss offset 352, size 1988. Its code still has the same 2/155 WLANConnect differences, so neither the static conversion nor symbols.txt renames are retained. A one-object scoped conversion moves BSS ownership and drops mini-report data to 88; reject it. Direct-object forms have 35 differences.
|
||||
- Fresh baseline WLANConnect mwdbg output is byte-identical to its native object, SHA256 d7bd88764fe0389c06b8152702db15765d5bbc8209385b0988b65acfffd3af83. The differing argument order is present in backend-01 before register allocation and stays unchanged in backend-03 and backend-04. It is not created by final scheduling. Capture is `/tmp/g-aoss-b-mwdbg/connect`.
|
||||
- Typed byte/word/union config buffers, named actual clear lengths, C++ with C linkage, and Gekko/750/740/7400 scheduling models leave WLANConnect at 2 differences. Other processor models regress exact siblings and are rejected. No AOSSLink, SDK header, buffer-layout, compiler-version or processor change is retained.
|
||||
- Re-ran the complete single/pairwise optimizer sweep on both new manufacturer-helper and outgoing-length shapes. Best positional results are their defaults, 1224 and 1235 respectively. No exact hit. Saved sweep output is `/tmp/g-aoss-b-sweep.log` and `/tmp/g-aoss-b-sweep-final.log`.
|
||||
- The first C++ trials appended an existing global language option and remained C, so their compiler failures are not coverage; the corrected trials replace the option. Two late static-declaration forms failed C89 parsing, then compiled in a corrected phase block. These failures are recorded separately.
|
||||
- Target objects are side effects of the DTK split rule, not individual Ninja outputs. An attempted forced rebuild removed the two cached target objects and exposed this rule boundary. `build/tools/dtk dol split config/43U/config.yml build/43U` restored and freshly extracted all 1028 target objects. Final report and gate run after the split completed.
|
||||
|
||||
Round-b coverage: 95 successful compiler trials, 13 compiler failures, 85 distinct successfully compiled source texts, plus two full 121-setting optimizer sweeps. Equivalent source and assembly variants are controls rather than new levers. Both units remain NonMatching.
|
||||
|
||||
### Round-b final verification
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/setting/AOSS] pool: IDENTICAL
|
||||
[src/scene/setting/AOSS] objdiff: code 9856/16192 data 2800/2800 functions 20/21 fuzzy 99.0620 linked code 0
|
||||
[src/scene/setting/AOSS] instruction-exact functions: 20/21
|
||||
[src/scene/setting/AOSS] section .bss size 2368 match 100.0
|
||||
[src/scene/setting/AOSS] section .data size 368 match 100.0
|
||||
[src/scene/setting/AOSS] section .sbss size 32 match 100.0
|
||||
[src/scene/setting/AOSS] section .sdata size 24 match 100.0
|
||||
[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0
|
||||
[src/scene/setting/AOSS] section .text size 16192 match 99.062004
|
||||
[src/scene/setting/AOSS] below 100: AOSS_Init_old 97.602905
|
||||
[src/scene/setting/AOSS] baseline: code 9856/16192 data 2800 functions 20 fuzzy 98.9792
|
||||
[src/scene/setting/AOSSLink] pool: IDENTICAL
|
||||
[src/scene/setting/AOSSLink] objdiff: code 1576/2196 data 2432/2432 functions 13/14 fuzzy 99.6357 linked code 0
|
||||
[src/scene/setting/AOSSLink] instruction-exact functions: 13/14
|
||||
[src/scene/setting/AOSSLink] section .bss size 2344 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .data size 48 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .sbss size 40 match 100.0
|
||||
[src/scene/setting/AOSSLink] section .text size 2196 match 99.635704
|
||||
[src/scene/setting/AOSSLink] below 100: AOSSi_WLANConnect 98.70968
|
||||
[src/scene/setting/AOSSLink] baseline: code 1576/2196 data 2432 functions 13 fuzzy 99.6357
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 99.20325 -> 99.20325
|
||||
global fuzzy_match_percent: 99.97636 -> 99.97681
|
||||
global complete_code_percent: 94.18519 -> 94.18519
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
note: config touched: configure.py (orchestrator reviews every config/symbols change)
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
Focused fresh checks: AOSS pool 1/1 identical; AOSSLink 0/0 identical. Init ctxdiff: src 0x18b0 base 0x18c0 insns 1580/1584; positional odiff 1235/1584. WLANConnect ctxdiff and odiff: 2/155, equal 0x26c sizes. Full report comparison against the fresh 87214ff9 baseline has zero dropped metrics or exact functions. AOSS source object has 21 functions and no standalone manufacturer helper; its SHA256 is 2ba93d96290eb40486ca6bcdd366b473316f0351c9957cedc5211aebe471dbcd. Target SHA256 is 18f927be300389e255324bc1ee9e797788502a837b6eb54dd17cab780b0c3247.
|
||||
|
||||
Retained paths: src/scene/setting/AOSS.c, configure.py, tools/decomp-assist/g-aoss.attempts.md. No new exact function. AOSS remains 20/21 exact with 2800/2800 data; AOSSLink remains 13/14 with 2432/2432. Both units stay NonMatching and unlinked. The source change is a validated partial improvement, not an exact match or completion. Existing rx67c.attempts.md remains untracked and untouched.
|
||||
222
tools/decomp-assist/g-cardseq.attempts.md
Normal file
222
tools/decomp-assist/g-cardseq.attempts.md
Normal file
@@ -0,0 +1,222 @@
|
||||
# g-cardseq attempts
|
||||
|
||||
Assigned sol-med, agent/w1009/g-cardseq, HEAD 54ca052b, identical to fetched origin/main at start. Existing untracked perm5 and swe2ifd0 logs remain untouched. Read opus-common fully before repository work, local AGENTS.md, unslop, writing-for-agents, relevant sol-x3 rounds and o2-cardseq-sdmem histories. Used graphify read-only to locate the thread's calls; live source and target object establish all measurements.
|
||||
|
||||
Acceptance requires both owned functions to have equal size, zero instruction differences and exact-name objdiff 100%, identical pool/data and no sibling regression. Flip configure.py only after the entire unit is exact, then require the target DOL SHA1 and final quick gate. Retain readable source, scoped optimizer pragmas or compiler intrinsics only when verified. The assigned task forbids carrier structs.
|
||||
|
||||
Fresh full 43U build passed and DOL checker passed. Baseline report has 28/30 exact functions, cardThreadMain 99.73422%, loadCardFileIcons 97.31445%, data 1496/1496. Pool identical at all 43 entries. Early single/pair optimizer sweep output is in /tmp/g-cardseq-combosweep.log. Trials compile private source/object files under /tmp/g-cardseq-trials using the live unit flags and check both owned functions, all 28 exact siblings and the pool including literal offsets.
|
||||
|
||||
The first five trial lines report raw allocated-data byte equality, which is false even on the unchanged baseline. These sections contain relocations and are not a valid direct retail-data comparison. Later trials explicitly check pool equality. The final objdiff report independently verifies every owned data section at 100%.
|
||||
|
||||
## Compiled trials
|
||||
|
||||
- baseline: thread 2/301, icons 126/512; exact siblings lost []; data equal False.
|
||||
- reply-intrinsic-direct: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
|
||||
- reply-intrinsic-named: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
|
||||
- reply-intrinsic-assign: thread 3/301, icons 126/512; exact siblings lost []; data equal False.
|
||||
- reply-intrinsic-shift-mask: thread 256/300, icons 126/512; exact siblings lost []; data equal False.
|
||||
- intrinsic-opt_propagation-off: thread 32/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- intrinsic-opt_lifetimes-off: thread 124/302, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- intrinsic-opt_dead_code-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- intrinsic-opt_dead_assignments-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- intrinsic-ppc_iro_level-1: thread 197/303, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- intrinsic-opt_common_subs-off: thread 175/302, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-opt_propagation-off: thread 32/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-opt_lifetimes-off: thread 124/302, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-opt_dead_code-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-opt_dead_assignments-off: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-ppc_iro_level-1: thread 197/303, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- command-packet-opt_common_subs-off: thread 175/302, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-before-sector: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-top-declared: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-after-sector-declared: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- comment-order-address-base-offset-readSize-sectorSize-result: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- comment-order-result-sectorSize-readSize-offset-base-address: thread 2/301, icons 119/512; exact siblings lost []; pool equal True.
|
||||
- comment-order-sectorSize-readSize-offset-base-address-result: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
|
||||
- comment-order-offset-readSize-base-address-sectorSize-result: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
|
||||
- offset-unsigned: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- offset-mask: thread 2/301, icons 477/511; exact siblings lost []; pool equal True.
|
||||
- offset-split: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- offset-after-format: thread 2/301, icons 249/512; exact siblings lost []; pool equal True.
|
||||
- inline-body-readCardImages: compile failed, see /tmp/g-cardseq-trials/inline-body-readCardImages.compile.txt
|
||||
- inline-body-readCardComment: compile failed, see /tmp/g-cardseq-trials/inline-body-readCardComment.compile.txt
|
||||
- inline-body-loadCardIconImages: thread 2/301, icons 241/512; exact siblings lost []; pool equal True.
|
||||
- comment-seven-address-result-base-readSize-end-fileSize-offset: thread 2/301, icons 108/512; exact siblings lost []; pool equal True.
|
||||
- comment-seven-offset-fileSize-end-readSize-base-result-address: thread 2/301, icons 123/512; exact siblings lost []; pool equal True.
|
||||
- comment-seven-result-offset-readSize-base-address-fileSize-end: thread 2/301, icons 119/512; exact siblings lost []; pool equal True.
|
||||
- comment-seven-result-end-fileSize-readSize-offset-base-address: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-parent-top: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-parent-before-offset: thread 2/301, icons 117/512; exact siblings lost []; pool equal True.
|
||||
- image-transfer-parent-after-offset: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- comment-exact-transfer-parent: thread 2/301, icons 99/512; exact siblings lost []; pool equal True.
|
||||
- reply-new-assign-arg: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-order-iconImageSize-hasTlut-icon-iconCount-shift: thread 2/301, icons 86/512; exact siblings lost []; pool equal True.
|
||||
- reply-new-compound-mask: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-order-iconImageSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 86/512; exact siblings lost []; pool equal True.
|
||||
- reply-new-const-packet: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-order-iconImageSize-paletteSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- reply-new-inline-union: thread 3/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- image-order-iconImageSize-paletteSize-hasTlut-icon-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-order-iconCount-shift-hasTlut-iconImageSize-icon: thread 2/301, icons 93/512; exact siblings lost []; pool equal True.
|
||||
- image-order-shift-iconCount-hasTlut-iconImageSize-icon: thread 2/301, icons 99/512; exact siblings lost []; pool equal True.
|
||||
- image-29-order-iconImageSize-paletteSize-icon-hasTlut-shift-iconCount: thread 2/301, icons 40/512; exact siblings lost []; pool equal True.
|
||||
- image-29-order-iconImageSize-paletteSize-icon-iconCount-hasTlut-shift: thread 2/301, icons 73/512; exact siblings lost []; pool equal True.
|
||||
- image-29-order-iconImageSize-paletteSize-hasTlut-shift-iconCount-icon: thread 2/301, icons 40/512; exact siblings lost []; pool equal True.
|
||||
- image-29-order-paletteSize-iconImageSize-icon-hasTlut-iconCount-shift: thread 2/301, icons 38/512; exact siblings lost []; pool equal True.
|
||||
- image-29-order-iconImageSize-icon-paletteSize-hasTlut-iconCount-shift: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-transfer-sum-parentheses: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-transfer-offset-first: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-icon-init-shift-first: thread 2/301, icons 26/512; exact siblings lost []; pool equal True.
|
||||
- image-29-icon-increment-shift-first: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-animation-speed-assignment: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-animation-max-compound: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-iconCount-hasTlut-iconImageSize: thread 2/301, icons 29/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-iconCount-iconImageSize-hasTlut: thread 2/301, icons 28/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-hasTlut-iconCount-iconImageSize: thread 2/301, icons 27/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-hasTlut-iconImageSize-iconCount: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-iconImageSize-iconCount-hasTlut: thread 2/301, icons 28/512; exact siblings lost []; pool equal True.
|
||||
- image-29-init-iconImageSize-hasTlut-iconCount: thread 2/301, icons 26/512; exact siblings lost []; pool equal True.
|
||||
- image-29-second-named-count-first: thread 2/301, icons 211/512; exact siblings lost []; pool equal True.
|
||||
- image-29-second-named-shift-first: thread 2/301, icons 210/512; exact siblings lost []; pool equal True.
|
||||
- image-29-second-named-top: thread 2/301, icons 211/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-init-max: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-count-control: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-shift-control: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-while-count: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-while-shift: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-step-plain: thread 2/301, icons 19/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-init-and-step-shift-first: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-image-total-early: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
|
||||
- image-combined-image-total-late: thread 2/301, icons 39/512; exact siblings lost []; pool equal True.
|
||||
- compiler-GC-3.0a5: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- compiler-GC-3.0a3.4: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- compiler-GC-3.0a3.3: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- compiler-GC-3.0a3.2: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- compiler-GC-2.7: compile failed, see /tmp/g-cardseq-trials/compiler-GC-2.7.compile.txt
|
||||
- flags--inline-deferred: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- flags--inline-noauto: thread 2/301, icons 126/512; exact siblings lost []; pool equal True.
|
||||
- flags--O3-s: thread 297/303, icons 493/527; exact siblings lost ['sendCardCopyCmd__Q23ipl10memorycardFUcs', 'sendCardMoveCmd__Q23ipl10memorycardFUcs', 'sendCardDeleteCmd__Q23ipl10memorycardFUcs', 'pollCardSlot']; pool equal True.
|
||||
- flags--O3-p: thread 1077/1081, icons 463/528; exact siblings lost ['sendCardCopyCmd__Q23ipl10memorycardFUcs', 'sendCardMoveCmd__Q23ipl10memorycardFUcs', 'sendCardDeleteCmd__Q23ipl10memorycardFUcs', 'sendCardThreadStopCmd__Q23ipl10memorycardFv', 'pollCardSlot', 'probeCard__Q23ipl10memorycardFv', 'initCardThread__Q23ipl10memorycardFv', 'refreshCardSlotInfo', 'markAllCardFilesDirty', 'handleCardMountResult', 'reportCardThreadError', 'sendCardSlotState', 'clearAllCardFileEntries', 'runCardMoveOrCopy']; pool equal False.
|
||||
- flags--O4-p: thread 919/926, icons 349/513; exact siblings lost ['sendCardThreadStopCmd__Q23ipl10memorycardFv', 'pollCardSlot', 'probeCard__Q23ipl10memorycardFv', 'initCardThread__Q23ipl10memorycardFv', 'refreshCardSlotInfo', 'markAllCardFilesDirty', 'handleCardMountResult', 'reportCardThreadError', 'sendCardSlotState', 'clearAllCardFileEntries', 'runCardMoveOrCopy']; pool equal False.
|
||||
- image-18-derived-shift: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-18-derived-shift-control-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-18-derived-count: thread 2/301, icons 317/520; exact siblings lost []; pool equal True.
|
||||
- image-18-count-control-early-size: thread 2/301, icons 15/512; exact siblings lost []; pool equal True.
|
||||
- image-18-second-step-init-early-size: thread 2/301, icons 15/512; exact siblings lost []; pool equal True.
|
||||
- image-18-count-step-for: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
|
||||
- image-18-shift-step-for: thread 2/301, icons 18/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-after-first-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-before-animation-loop: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-first-loop-control: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-first-uninitialized-decl: thread 2/301, icons 16/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-store-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-store-pointer: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-store-whole-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-clear-animation-helper: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-lifetime-count-after-second-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-lifetime-count-from-dir-before-loop: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-lifetime-count-after-first-three-stores: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-index-only: thread 2/301, icons 51/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-index-decl-top: thread 2/301, icons 51/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-index-decl-loop: thread 2/301, icons 63/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-increment-shift-before-count: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-increment-postfix: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-shift-derived: thread 2/301, icons 82/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-iconCount-u32: thread 2/301, icons 302/508; exact siblings lost []; pool equal True.
|
||||
- image-2-type-iconCount-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-shift-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-shift-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-icon-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-icon-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-imageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-imageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-paletteSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-paletteSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-iconImageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-iconImageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-bannerImageSize-u32: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-type-bannerImageSize-long: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-row-local: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-array-local: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-array-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-index-store-helper: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-stores-before-counter-inits: thread 2/301, icons 383/513; exact siblings lost []; pool equal True.
|
||||
- image-2-first-store-after-shift: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-store-after-tlut: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-both-stores-before-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-object-pointer: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-object-reference: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-state-and-counter: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-state-and-counter-ref: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-helper-iconCount-shift-icon: thread 2/301, icons 65/512; exact siblings lost []; pool equal True.
|
||||
- image-2-tlut-init-with-decl: thread 2/301, icons 7/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-helper-shift-iconCount-icon: thread 2/301, icons 56/512; exact siblings lost []; pool equal True.
|
||||
- image-2-image-init-with-decl: thread 2/301, icons 8/512; exact siblings lost []; pool equal True.
|
||||
- image-2-animation-helper-icon-iconCount-shift: thread 2/301, icons 65/512; exact siblings lost []; pool equal True.
|
||||
- image-2-count-init-with-decl: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
|
||||
- image-2-shift-init-with-decl: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- reply-intrinsic-valid-type-u8: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- reply-intrinsic-valid-type-s32: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- reply-intrinsic-valid-type-BOOL: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- reply-intrinsic-valid-assignment-after-report: thread 9/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- reply-intrinsic-valid-report-variable: thread 3/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-count-then-store: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-store-then-count: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-shift-then-store: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-store-then-shift: thread 2/301, icons 10/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-size-then-store: thread 2/301, icons 5/512; exact siblings lost []; pool equal True.
|
||||
- image-2-chain-store-then-size: thread 2/301, icons 5/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-count-while: thread 2/301, icons 2/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-count-for-assignment: thread 2/301, icons 4/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-count-shift-begin: thread 2/301, icons 24/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-count-shift-middle: thread 2/301, icons 21/512; exact siblings lost []; pool equal True.
|
||||
- image-2-first-count-shift-end: thread 2/301, icons 21/512; exact siblings lost []; pool equal True.
|
||||
|
||||
## Retained source and remaining differences
|
||||
|
||||
Retained loadCardFileIcons is 512/512 instructions, 2 differences, exact-name objdiff 99.98047%, up from 126 differences and 97.31445%. cardThreadMain is unchanged at 301/301 instructions, 2 differences and 99.73422%. The unit remains 28/30 exact, code 6600/9852, data 1496/1496, fuzzy 99.96346%. No exact function or linked-byte gain is claimed. configure.py remains NonMatching.
|
||||
|
||||
The comment read now declares its real address, result, base, read size, end, file size and offset together before their original assignments. A replay of the fresh allocator capture found the necessary local order, and the compiled source matches the entire comment region. The image read's aligned transfer size is calculated by its caller and passed to readCardImages. Naming the total image size preserves the target addition order. Animation locals and zero initializers follow the measured order, and the frame-duration update uses compound assignment. The icon-format loop uses iconCount directly and derives its bit shift from iconCount * 2, eliminating the second loop's extra source counter. The overwritten initialization immediately before the for initializer was removed; the object remains byte-identical to the winning compiled trial.
|
||||
|
||||
The existing target-proven reserved-format palette path is preserved. Moving paletteSize out of the per-iteration scope gives the target's persistent register value across frames. No initializer or alternate reserved-format behavior was introduced. The original target proof and previously merged implementation are recorded in o2-cardseq-sdmem.attempts.md.
|
||||
|
||||
Fresh captures live under /tmp/g-cardseq-mwdbg/runs/icons-fresh, icons-29 and icons-2. The private launcher uses the previous Opus transport on port 9137, with the same unmodified compiler and real unit flags. Its outputs remain under /tmp/g-cardseq-mwdbg. Baseline regsim reproduces 375/375 virtual registers. Every allocated and relocation section of icons-2/unit.o equals the final independently built Ninja object.
|
||||
|
||||
Remaining icon differences are instruction 135 add r10,r4,r30 instead of add r4,r4,r30 and instruction 136 stb using that address register. In the final capture the first-store address v188 interferes with animation counter v84, whose required target color is r4. Moving initializers, field pointer/reference views, actual count-reset helpers, first-loop forms and chained assignments did not remove this overlap. Reordering the existing declarations cannot assign both interfering values r4. A new source shape must change this edge; the capture does not prove that such a shape is impossible.
|
||||
|
||||
The thread still differs at instructions 48 and 49. Its existing valid-first packet folds to li r4,256 followed by inserting command r19. Command-first bitfields and __rlwimi produce insertion into command r19 using the hoisted constant-one register, then copy to r4. Scoped propagation-off preserves the wanted validity r25 operand but leaves copy coalescing and other differences. Compiler versions GC/3.0a5 and 3.0a3.2 through 3.0a3.4 produce the same baseline; alternative inline modes do too. Lower optimization levels introduce regressions and were discarded. No thread edit or compiler setting is retained.
|
||||
|
||||
159 successfully compiled source/flag candidates were saved and scored. Two missing-helper diagnostic variants and the GC/2.7 trial failed compilation and were discarded. Each of two optimizer sweeps compiled the baseline, 15 single settings and 105 pairs; neither improves its seed. The second sweep's seed already has 2 icon differences. Two loop-update comma variants were diagnostics only and are excluded by the source policy. Every retained change is ordinary C++ with no carrier, assembly, dummy data, volatile cast, added code comment or unrelated edit.
|
||||
|
||||
Fresh pool comparison including literal offsets is identical at all 43 strings. ctxdiff independently confirms both remaining 2-difference streams. All four data sections are 100% in the live objdiff report. A separate whole-report comparison against the frozen beginning-of-run report finds zero code, data, function or link drops and no lost exact function. origin/main advanced during the run; this leaf stays on its assigned 54ca052b baseline without rebase or merge. Parent integration must repeat the gates on its current main.
|
||||
|
||||
## Final gate
|
||||
|
||||
The required final quick gate ran once and passed. The full 43U build succeeds, the DOL SHA1 is independently verified, baseline drops are zero, and the source scan reports zero forbidden additions and zero readability warnings. Final allocator replay reproduces 375/375 virtual registers. The report and object checks still show two nonexact functions; no Matching flip is justified.
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/cardSequence/iplCardSequence] pool: IDENTICAL
|
||||
[src/scene/cardSequence/iplCardSequence] objdiff: code 6600/9852 data 1496/1496 functions 28/30 fuzzy 99.9635 linked code 0
|
||||
[src/scene/cardSequence/iplCardSequence] instruction-exact functions: 28/30
|
||||
[src/scene/cardSequence/iplCardSequence] section .bss size 16 match 100.0
|
||||
[src/scene/cardSequence/iplCardSequence] section .data size 1464 match 100.0
|
||||
[src/scene/cardSequence/iplCardSequence] section .sbss size 8 match 100.0
|
||||
[src/scene/cardSequence/iplCardSequence] section .sdata size 8 match 100.0
|
||||
[src/scene/cardSequence/iplCardSequence] section .text size 9852 match 99.96346
|
||||
[src/scene/cardSequence/iplCardSequence] below 100: cardThreadMain 99.73422
|
||||
[src/scene/cardSequence/iplCardSequence] below 100: loadCardFileIcons 99.98047
|
||||
[src/scene/cardSequence/iplCardSequence] baseline: code 6600/9852 data 1496 functions 28 fuzzy 99.4093
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 99.20325 -> 99.20325
|
||||
global fuzzy_match_percent: 99.97473 -> 99.97657
|
||||
global complete_code_percent: 94.18519 -> 94.18519
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
Only src/scene/cardSequence/iplCardSequence.cpp and this attempts log are retained for a local commit. Existing untracked perm5 and swe2ifd0 logs remain untouched. No push, PR, merge, rebase, subagent or other-worktree edit.
|
||||
109
tools/decomp-assist/g-chansvm.attempts.md
Normal file
109
tools/decomp-assist/g-chansvm.attempts.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# g-chansvm CHANSVmStep
|
||||
|
||||
Base 54ca052b, branch agent/w1009/g-chansvm, worktree data-d2.
|
||||
Baseline CHANSVmStep 5012 bytes, odiff 262/1253 differing, objdiff 97.23%.
|
||||
Pool identical, 125 entries. Unit has one non-exact function.
|
||||
|
||||
Recovered o2 structural findings from /tmp/o2-chansvm/sstr1.c, preserving current
|
||||
const-correct conversion signatures and exact helper implementations.
|
||||
Split five result matrices and five constant objects, replace cross-object
|
||||
base indexing, restore loop/stack object/case-local structure.
|
||||
|
||||
Recovered build: odiff 299/1253, equal 5012-byte size, register-masked diffs 6
|
||||
from scheduling at 511, 598, 836. All 232 other functions exact; pool identical.
|
||||
Early single/pair pragma sweep: best 299, no improvement.
|
||||
|
||||
Allocator capture CHANSVmStep-20261009-082339 reproduces 478/478 GPRs.
|
||||
Centralizing and uniquely naming scalar locals preserves 299/1253 exactly.
|
||||
C++ replay of regsim searched 100000 declaration permutations, seed 11,
|
||||
35 -> 5 saved-register mismatches. Compiled source 299 -> 44 differing.
|
||||
Target enum traversal starts with the left operand; correcting it gives 42.
|
||||
Explicit load/ref object pointers restore CopyObject argument scheduling,
|
||||
42 -> 38, 5012 bytes; one 2-instruction scheduling tie remains.
|
||||
|
||||
Trials on declaration-order source: u16/s16 arraySize, separate byte
|
||||
assignments, widened shift/add forms change instruction count and were rejected.
|
||||
s32/u64/s64 index, split byte temporaries, simple read helpers and property
|
||||
operand/object locals preserve codegen. Separate property index gives 46.
|
||||
Property status/flag assignment order and inline array helper preserve 38.
|
||||
|
||||
String load: direct pVm->pActiveCtx accesses eliminate the ctx/index swap,
|
||||
38 -> 29. A distinct decoded propertyOffset separates it from the absolute
|
||||
program counter and allows in-place masking, 29 -> 26. Remaining 26:
|
||||
GET_PROPERTY_NAME operand/object/index register cycle (12), NEW_ARRAY
|
||||
accumulator/size register swap (12), status/flag scheduling (2).
|
||||
Whole Step inline helper: equal size but 321 differences, rejected.
|
||||
Lookup/read/array helper wrappers: unchanged. Scoped property variables:
|
||||
unchanged or worse. Signed/widened array size: unchanged or extra instructions.
|
||||
Earlier array accumulator lifetime: 36 differences, 14 masked, rejected.
|
||||
Scoped opt_lifetimes off: equal size, 44 differences, same 2 masked ties;
|
||||
other tested optimizer/scheduling pragmas worsen instruction structure.
|
||||
|
||||
Lifetime trials: off + separate propertyIndex scores 25, equal size and two
|
||||
masked scheduling differences. Captures 085030 and 090247 replay exactly
|
||||
(458/458 and 459/459), but each has two GPR passes. Final-pass-only
|
||||
declaration search finds two simulated misses (array accumulator/size),
|
||||
yet compiling its full permutation changes the first-pass rematerialization
|
||||
choices and scores 123. Treat the final-pass graph as insufficient here;
|
||||
freeze high-degree loop values when searching. Default pragma source at 26
|
||||
remains the retained candidate until a full compiler replay improves it.
|
||||
Intrinsic rlwimi forms, array helpers under lifetime-off, output-argument
|
||||
lookup/decode, property symbol locals, and flag output pointers preserve
|
||||
codegen. Direct array header accesses lose one instruction; early/success-only
|
||||
accumulator pointers alter scheduling and were rejected.
|
||||
|
||||
Freezing degree >= 100 locals preserves the first-pass spill/rematerialization
|
||||
choices. Final-pass search seed 62 (100000 permutations) improves 25 -> 14
|
||||
in the full compiler, with all other 232 functions still exact. Retain the
|
||||
function-scoped opt_lifetimes off setting and this declaration order.
|
||||
Use a shared u64 maxIndex = 0xFFFFFFFEULL for the three integer bounds instead
|
||||
of repeated split high/low temporaries; this preserves the 14-diff output.
|
||||
Remove obsolete instruction union, unused ctx and comma expressions.
|
||||
|
||||
Sharing the accumulator pointer between BIT_NOT and NEW_ARRAY gives 14 -> 2.
|
||||
The shared value's interference graph now selects r14 for the array pointer
|
||||
and r17 for the decoded array size, as in the target. Sharing it with the
|
||||
LOAD_STRING_CONST pointer independently reaches the same 2 differences;
|
||||
other accumulator and size-local merges fail to improve or regress.
|
||||
|
||||
Latest capture: CHANSVmStep-20261009-093935 in
|
||||
/mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/.
|
||||
Reduced source build/g-chansvm/twoflagfirst.c reproduces the full function.
|
||||
Regsim reproduces all 458/458 virtual registers. This variant writes status
|
||||
before the flag in C; backend-00-initial-code B261 has li before stw, but
|
||||
backend-01-before-regalloc already moves stw ahead of li. Reversing the two
|
||||
C assignments does not change the final object.
|
||||
|
||||
Remaining exact ctxdiff, 5012 bytes and 1253/1253 instructions:
|
||||
836 source stw r26,0xc(r1); target li r14,0
|
||||
837 source li r14,0; target stw r26,0xc(r1)
|
||||
All registers and all other instructions, including relocations, agree.
|
||||
|
||||
Final tie trials, all rejected: status/flag assignment order; negative
|
||||
property guards; status locals and merged error temporaries; status assigned
|
||||
from DeleteObject; status hoisted ahead of the switch or set in each arm;
|
||||
separate property flag; address-based flag access; flag integer widths and
|
||||
boolean normalization; const/static-const status values; inline flag setter
|
||||
and full property-enumeration helper. Moving result or foundEntry through
|
||||
every scalar declaration position never fixes the scheduling pair.
|
||||
A complete single/pair pragma sweep on the 2-diff source retains 2 as best;
|
||||
explicit scheduling/peephole on also retains 2. Numeric scheduling pragmas
|
||||
are rejected by MWCC. GC/3.0a5 and every available 3.0a3 variant also retain
|
||||
2; 2.7/2.6 reject the unit's ipa option. No compiler-version change retained.
|
||||
|
||||
Fresh final unit report: CHANSVmStep 97.23 -> 99.840385 percent; odiff and
|
||||
relocation-aware ctxdiff 262 -> 2. Exactly 232/233 functions, unchanged.
|
||||
Data 6904/6904 (100 percent), pool identical across 125 strings.
|
||||
Matching flip is withheld because CHANSVmStep is not exact.
|
||||
|
||||
Final gate command:
|
||||
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/channelScript/CHANSVm --quick
|
||||
GATE PASS: full 43U build, 0 regressions, 0 forbidden patterns, 0 readability
|
||||
warnings, identical pool, all five data sections 100 percent.
|
||||
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
Unit remains NonMatching and linked code remains 0; the verified DOL still
|
||||
uses the original CHANSVm object. This is an improvement, not an exact handoff.
|
||||
The pragma's address/lifetime effects are documented in captures 085030,
|
||||
090247 and 093935: ref/load/index frame slots and address recomputation stay
|
||||
at the target locations, while high-degree roots must remain fixed to avoid
|
||||
changing the first-pass rematerialization choice.
|
||||
16418
tools/decomp-assist/g-idct.attempts.md
Normal file
16418
tools/decomp-assist/g-idct.attempts.md
Normal file
File diff suppressed because it is too large
Load Diff
108
tools/decomp-assist/g-keyboard.attempts.md
Normal file
108
tools/decomp-assist/g-keyboard.attempts.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# g-keyboard attempts
|
||||
|
||||
Worktree data-d4; branch agent/w1009/g-keyboard; base 54ca052b.
|
||||
Read opus-common.md in full. No pushes, PRs, rebases, or cross-worktree edits.
|
||||
Initial full 43U build passed; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
Baseline odiff: calcCursorPos 43/326, create 153/356, inputChar 73/136.
|
||||
Two InputForm saved diffs are byte-identical and omit addButtonAnimation declaration.
|
||||
Unrelated preexisting untracked files preserved.
|
||||
|
||||
o2-keyboard.wip.diff: original build fails for missing member declaration. Repaired declaration: pool identical, calcCursorPos 39/326, create 128/356, equal sizes. opus-inputform.wip.diff SHA identical; same source/build/measurement.
|
||||
opus-tistring.wip.diff: compiled, pool identical, 70/136 differing, size 0x210 vs 0x220. Rejected: append tests an always-zero buffer slot and alters generic newline behavior. Restored baseline for honest trials.
|
||||
|
||||
## Compiled trials
|
||||
Single/pair pragma sweep on saved InputForm + original tiString: no exact hits or gains.
|
||||
32 direct rectangle-reference/copy/size-vector forms: best 39, copies worse.
|
||||
28 consistent geometry helper forms: best 50.
|
||||
208 helper-scope pragmas/newline reset variants for inputChar: best 60; none exact.
|
||||
90 chain/temporary/ref-return/clear variants: best 59, none exact.
|
||||
GC versions 3.0a3 through 3.0a5.2: tiString unchanged; older InputForm versions regress 5 functions. GC 2.6/2.7 reject ipa.
|
||||
Create: existing selectInputTextName reuse gives 120 differences; complete scoped declarations 135-138; constrained regsim reaches only 8/15 requested assignments.
|
||||
Read-only prior scratch has a fully consistent calcCursorPos geometry-helper form, reproduced at 8/326. All surviving differences swap the zero constant f29/f30 with scale.x. Prior 20-difference inconsistent-helper forms excluded.
|
||||
Initializer/declaration trials: best stays 8. Malformed generated named-zero-top trials used a self initializer; excluded from all results and never retained.
|
||||
|
||||
Further calc trials: 36 helper order/body forms, 48 scalar-reference forms, 150 scoped single/pair pragma combinations, 14 corrected constant/declaration variants, 30 local-math bodies, 18 glyphBottom signature/definition-order forms. Best remains 8; no exact.
|
||||
Further create trials: 24 free animation-helper forms best 120; 16 whole animation-loop helpers best 106 but runtime count reload changes the target instruction shape. 16 row-helper forms best 117.
|
||||
Fresh allocator trace saved in /tmp/g-keyboard-calc8trace. FPR zero = v89/f30, scale.x = v82/f29, scale.y = v95/f31. Simulator proves moving scale.x beyond v89 or zero below v82 fixes all colors, but the tested readable expressions do not produce that numbering.
|
||||
|
||||
## Retained source
|
||||
Consistent glyphBottom and scaledExtent use at every glyph calculation; no mixed direct/helper forms. Reuse existing selectInputTextName in create and the saved substantial animation-resource helper with its missing header declaration. No optimization pragmas retained.
|
||||
Fresh own-object report: calcCursorPos 93.05215 -> 99.877304, odiff 43 -> 8, 0x518 both; create 96.40169 -> 98.16011, odiff 153 -> 120, 0x590 both. Unit exact functions stay 219/221; data stays 3772/3772.
|
||||
inputChar unchanged, 90.757355%, odiff 73/136; exact functions stay 41/42, data 288/288.
|
||||
No fully exact unit; Matching flips are prohibited for this result.
|
||||
24 glyph-initialization helper and 12 grouped geometry/output helper forms did not beat 8. Compiler tie remains: f29/f30 swap between zero and scale.x. InputChar reset/chain helpers retain a real conditional block or fold the indexed writes; no honest form reproduced the branchless dead compare.
|
||||
|
||||
Final review extended scaledExtent to the input-form width bound as well as every glyph width. It preserves the same 8 differences. Chaining the height helper through scaledExtent was measured separately.
|
||||
Initial gate after retained changes: GATE PASS, zero regressions, zero forbidden patterns, zero readability warnings. Full build and DOL SHA1 passed. A final gate after the width-bound consistency edit follows.
|
||||
|
||||
Final GATE PASS: full 43U build ok; DOL 26116613f624061ba99c8d1a299aaa6efa85670d; identical pools; all owned data sections 100%; 0 regressions; 0 forbidden-pattern additions; 0 readability warnings. No exact function gains. Units remain NonMatching.
|
||||
Height helper chaining gave 81 differences and was rejected. Final instruction counts remain calcCursorPos 8/326, create 120/356, inputChar 73/136.
|
||||
|
||||
|
||||
## Round b, MAX, 2026-10-09
|
||||
|
||||
Assigned worktree data-d4, branch agent/w1009/g2-keyboard, HEAD 5046adc6.
|
||||
Read opus-common.md and this log again. Preserved preexisting untracked files.
|
||||
Fetched origin under /tmp/wii-git.lock; origin/main moved to ad5b9dea during setup.
|
||||
Round-a source remains the starting point. Fresh full 43U build passed with DOL
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d. Both owned pools are identical.
|
||||
Baseline report: tiInputForm 219/221 exact, data 3772/3772; tiString 41/42 exact,
|
||||
data 288/288. calcCursorPos has 8/326 differences, all f29/f30 swapping scale.x
|
||||
and the glyph zero constant. create has 120/356; inputChar has 73/136.
|
||||
Reviewed the prior single/pair pragma sweep rather than repeating its unchanged
|
||||
source candidates. Read the original-object Ghidra bodies, prior allocator trace,
|
||||
levers, and saved inputChar diffs. Used graphify only to check cursor callers;
|
||||
current source and object measurements remain the matching evidence.
|
||||
|
||||
calcCursorPos: 240 new compiled forms covered rectangle-based width helpers,
|
||||
scale-vector parameter forms, a nested axis-scaling helper, and explicit zero
|
||||
arguments for glyph initialization. The best stays 8/326. Vector parameters put
|
||||
the zero constant in f29, but swap scale.x/scale.y in f30/f31 and alter scheduling
|
||||
at wrap transitions, leaving at least 25 differences. Explicit zero arguments
|
||||
preserve the eight-difference baseline. None retained.
|
||||
|
||||
create: 32 new detached-row and normal-button construction helper forms compiled.
|
||||
The best remains 120/356; detached-row forms give 123, and copying button data
|
||||
regresses code generation. None retained. Private compiler source paths rename
|
||||
__sinit_\tiInputForm_cpp; that name-only difference was excluded from the private
|
||||
regression counter. Final measurement uses the real source path.
|
||||
|
||||
calcCursorPos: 32 additional value-returning glyph initialization helper trials;
|
||||
30 compile and change stack placement/instruction count. Two harness-invalid
|
||||
named-zero aggregate forms are excluded. None retained.
|
||||
|
||||
inputChar: the saved R1 diff remeasures at 61/136 and 0x21c, not the historic 12,
|
||||
on the current source. A real CharacterOutput::clear loop plus a u16 member count
|
||||
reaches 13/136 with equal 0x220 size and no other function drops. It clears prior
|
||||
buffer characters before resetting the count when a newline is appended. The
|
||||
caller appends one character to a fresh output, so its observable output is the
|
||||
same as the baseline. This is a lead under review, not an exact match.
|
||||
|
||||
The clearing loop is unnecessary for the 13-difference result. Removed it and
|
||||
kept only newline reset in the existing append method and a u16 member count.
|
||||
This minimal form independently rebuilds to 0x220, 136/136 instructions, 13 diffs.
|
||||
It reconstructs the newline test proved by target instruction 68, cmplwi r4,0xa.
|
||||
The target has no consuming branch; our remaining bne/li and counter allocation
|
||||
are explicitly unresolved. All 13 differences are at instructions 66-78. Both
|
||||
cursor-add paths now match without extra helpers. The caller constructs an empty
|
||||
output and appends one character; resetting its count on newline preserves the
|
||||
output for every character, including newline and the ignored 0xfffe sentinel.
|
||||
The count is bounded by the 8-element buffer and is narrowed in the target.
|
||||
|
||||
32 finish/count/index forms, 48 cursor-advance forms, 24 further real clear-loop
|
||||
forms, 48 output-write helper forms, and 180 scoped single/pair pragma forms do
|
||||
not beat 13. No loops, output-write helpers, cursor helpers, or pragmas retained.
|
||||
48 coupled scale-vector/height-helper forms do not beat calcCursorPos 8; their
|
||||
best is 25. Every rejected source/header experiment stays outside the worktree.
|
||||
Private trial records: 712 attempts, 710 compiled. Two named-zero aggregate factory trials fail to compile and are excluded. Raw records are in /tmp/g-keyboard-b-results.jsonl.
|
||||
|
||||
Final round-b verification: GATE PASS, full 43U build ok, DOL SHA1
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d. Pools identical; all owned data sections
|
||||
100%; 0 regressions; 0 forbidden-pattern additions; 0 readability warnings.
|
||||
Gate output: /tmp/g-keyboard-b-final-gate.txt.
|
||||
Fresh exact-name objdiff: calcCursorPos 99.877304%, create 98.16011%, inputChar
|
||||
90.757355% -> 93.55882%. odiff/ctxdiff inputChar 73 -> 13, size 0x220 both,
|
||||
136/136 instructions. tiInputForm stays 219/221 exact and tiString stays 41/42.
|
||||
No new exact functions. Both units remain NonMatching; no Matching flip is valid.
|
||||
Retained changes: src/keyboard/tiString.cpp and this log only. No push, PR, merge,
|
||||
rebase, other-worktree edit, or modification of preexisting untracked files.
|
||||
@@ -222,3 +222,117 @@ The final diff retains three exact command functions and the palette destination
|
||||
correction and shared loop continuation. All remaining functions have at least
|
||||
three new distinct attempts.
|
||||
Shared headers and configure.py are unchanged. All data sections remain exact.
|
||||
|
||||
## w1011/struct2 probes
|
||||
- cardThreadMain (301v301): pure reg-perms + one merge-order tie — base `mr r4,r19; rlwimi r4,r25,8` vs mine `rlwimi r23,r29,8; mr r4,r23`. Same count, ordering only.
|
||||
- loadCardFileIcons (508v512, -4): base emits per-path `li r?,0; stb` zero-init pairs (dead zero-webs on each switch-case path — `bannerEnable=0` etc. re-materialize the zero instead of sharing), plus split `addis/addi` addr materialization + `lbz -1(r); stb 0(r)` adjacent-field copy where mine fuses. Structural decode incomplete.
|
||||
- runCardMoveOrCopy (608v608?): not yet diffed.
|
||||
|
||||
## w1011/struct2 wave 2 (loadCardFileIcons 508->511/512)
|
||||
- WIN: `s32 icon = 0` decl-init materializes a missing zero-web (+1).
|
||||
- WIN: `u32* iconOffsets = &...iconOffset[0]` + `s32 nextIcon = iconCount + 1` → base's `slwi r,2; lwzx`/`stwx` indexed addressing (+2). Direct member index `iconOffset[iconCount+1]` folds to immediate-offset lwz/stw.
|
||||
- Tried/reverted: `(u16)` index cast (513), `iconFmt[iconCount]=iconFmt[iconCount-1]` direct (510), u16* iconOffsets.
|
||||
- Residual -1 + ~92 reg/order diffs: base materializes `&iconFmt[iconCount]` in one reg with `lbz -1(r); stb 0(r)` where every source form folds to `lbz -0x6fb5/stb -0x6fb4` field offsets (remat-vs-pin family).
|
||||
|
||||
## loadCardFileIcons residual -1 insn + coloring
|
||||
- runCardMoveOrCopy (608v608): normalized-identical, pure coloring tie.
|
||||
- loadCardFileIcons -1 = pinned-result phi: mine emits `mr r24,r3` (callee-pinned result web) after CARDGetSectorSize, base keeps result in r3-arrival and remats `li r3,0` in the error path. Same phi-coalescing tie family as attach_mount (pfrest) — no source lever found.
|
||||
|
||||
## w1011/struct2 wave-2 — web-birth decode (loadCardFileIcons SOLVED -1)
|
||||
|
||||
- `s32 iconCount; ... iconCount = 0;` — UNINIT DECL + SEPARATE ASSIGN
|
||||
splits the zero web's birth so MWCC rematerializes a second `li 0` for
|
||||
the icon-init stores (base's exact remat pattern). Applied in BOTH
|
||||
updateCardIconAnimation and loadCardFileIcons: 511 -> 512 insns,
|
||||
residual now 26 pure callee-renaming diffs (r31/r26 sThread,
|
||||
r7/r4+r10/r6 record ptrs — coloring family).
|
||||
NB: `static s32 iconCount` also produced 512 but emits dead object
|
||||
`iconCount$16368` (forbidden, PR #973) — the lever is web-birth
|
||||
timing, not storage class. Static variant rejected.
|
||||
- cardThreadMain sendValidityResponse: `reply.value = command;
|
||||
reply.fields.valid = valid;` produces base's `mr` + `rlwimi @0xFF00`
|
||||
byte-insert order (vs `reply.value = valid<<8; fields.command=command`
|
||||
which folds to `li 0x100 + rlwimi`). Residual 2 lines: in-place
|
||||
`rlwimi r19` vs base `mr r4,r19; rlwimi r4` — same coalescer
|
||||
dst-operand wall as the or-chain. `|=` folds to ori; bitfield-order
|
||||
emits 2 rlwimi + stw.
|
||||
|
||||
## w1011/struct2 wave-3 — structural probes (icon-record intermediates)
|
||||
|
||||
- `IconState* rec = &sThread->icons[slot][fileNo]` + member accesses:
|
||||
collapses fn to 408 insns — MWCC pins the pointer, kills the
|
||||
per-use rematted add chains. The sThread->icons[slot][fileNo]
|
||||
spelled-out form is load-bearing for the remat structure.
|
||||
- `IconState (*icons)[CARD_MAX_FILE] = sThread->icons` array pointer:
|
||||
collapses to 424 for the same reason. Named intermediates can't
|
||||
reproduce base's pinned-products + remat-adds split.
|
||||
- The 26 residual diffs are a pure callee-window swap: base pins the
|
||||
icon-record PRODUCTS (slot*0x1FC0->r29, fileNo<<6->r30, masked addr
|
||||
->r31) and params->r24-r26; mine pins params high. Chaitin color
|
||||
ordering — documented tie.
|
||||
- cardThreadMain: `OSMessage msg` arg-coalescing local, packed
|
||||
`command | (valid<<8)` single expr (folds, 300), mask+or
|
||||
`(v & ~0xFF00)|(valid<<8)` (rlwinm+ori split) — the mr+rlwimi
|
||||
copy-vs-inplace residual (2 lines) is the coalescer dst-operand wall.
|
||||
|
||||
## w1011/struct2 wave-4 — mr+rlwimi mechanism PROVEN, no free source form
|
||||
|
||||
- `sThread->lastCommand = command;` after sendValidityResponse makes
|
||||
command's web survive the pack → emits base's EXACT `mr r4,r19;
|
||||
rlwimi r4,r25,8` (copy+insert, not in-place). Mechanism confirmed:
|
||||
the rlwimi dst binds to a surviving operand's copy — but the store
|
||||
costs +3 insns and base has no such store. Verified base's r19 dies
|
||||
at the same point (reborn at 0xd58 case-0 reassign).
|
||||
- `command & 0xFF` extract: folds (command provably masked) → in-place.
|
||||
- `command | (valid<<8)`: single-expr fold to li/ori (300, -1).
|
||||
- `(reply.value & ~0xFF00)|(valid<<8)`: rlwinm+ori split.
|
||||
- Residual 2 lines = coalescer dst-operand choice with no source
|
||||
lever that preserves insn count.
|
||||
|
||||
## w1011/struct2 wave-5 (post-rebase 10146c1b) — aoss/chansvm levers exhausted
|
||||
|
||||
- mr-cross-block mechanism (o2-aoss): copy survives iff its uses are in
|
||||
other blocks. Verified base CFG: send block (0xd30) reached only from
|
||||
case-10; `command` (r19) dies there, reborn in case-0 block at 0xd58.
|
||||
No other case reads command → no legitimate later-block use exists;
|
||||
all survival variants add insns. ~28 cumulative forms; wall stands.
|
||||
- declsearch.py: 120 decl-orderings of cardThreadMain's decl block —
|
||||
no improvement ((2,3) floor); operand-dst selection unaffected by
|
||||
vreg numbering.
|
||||
- New levers tried: __rlwinm identity (folds), int-union-member,
|
||||
pointer-param pack helper, packValidity return-value, u8 params,
|
||||
separate `response` temp, second reply.value use (+stw). All fold.
|
||||
|
||||
## cardThreadMain sendValidityResponse pack (wave-6)
|
||||
|
||||
Base: `mr r4,r19; rlwimi r4,r25,8,0x10,0x17` = `reply.value = command`
|
||||
(copy into reply's own web, homed in arg-reg r4) then `reply.fields.valid =
|
||||
valid` (bitfield-insert sourcing validState's own `li r25,1` web).
|
||||
Ours: `rlwimi r19,r29,8,0x10,0x17; mr r4,r19` — MWCC coalesced reply.value
|
||||
onto command's web (in-place insert on r19, sourced shared-1 r29) then copies
|
||||
out. 2-line residual, same dst-operand/home-choice family as the or-chain
|
||||
wall. Tried: `OSMessage reply = command | (valid<<8)` (folds to `ori` —
|
||||
plain `|` canonicalizes, only bitfield-write emits rlwimi), fields-only
|
||||
writes (3-insert chain), fn-scope reply union (still coalesces), comma/select
|
||||
forms. `sThread->lastCommand = command` post-send DOES force `mr`+`rlwimi`
|
||||
(making command's web survive) but costs +3 insns — mechanism proven, no
|
||||
free source lever. Extra base `li r22,0` at 0x1040 = another remat-position
|
||||
diff, same family.
|
||||
|
||||
## w1011/struct2 wave-7 — optimization_level pragma sweep (negative)
|
||||
|
||||
Per-fn `#pragma push` + `#pragma optimization_level N` + `#pragma pop`
|
||||
(g-idct lever: Lumi was O3 inside an O4 unit) swept on cardThreadMain:
|
||||
O1/O2/O3 all emit the identical 302-insn object — `rlwimi r19,r29` in-place
|
||||
+ `mr r4,r19`. The coalescer's dst-operand fold is opt-level-invariant;
|
||||
orig was built at the same -O4,p as ours. Mixed-opt is NOT the explanation
|
||||
for the 2-line residual.
|
||||
|
||||
- wave-8 (opt_propagation): `#pragma opt_propagation off` scoped to
|
||||
sendValidityResponse emitted `rlwimi r19,r29; mr` (same shape, operand
|
||||
web shifted); scoped to cardThreadMain `rlwimi r19,r25; mr` (valid-web
|
||||
operand now matches base) — but the union web still ALIASES to command's
|
||||
dying web, so the insert stays in-place and the mr lands after. The
|
||||
pragma does not touch union-storage aliasing (not copy-prop).
|
||||
- Plain-u32 probe (`u32 reply = command; reply |= valid << 8`): folds to
|
||||
`ori`, 300v301 — worse. Union form remains best (301v301, 2-line wall).
|
||||
|
||||
75
tools/decomp-assist/o2-aes-idct.attempts.md
Normal file
75
tools/decomp-assist/o2-aes-idct.attempts.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# o2-aes-idct attempts
|
||||
|
||||
Worktree data-d11, branch agent/w1009/o2-aes-idct (from origin/main 20cf9f9f). 43U only.
|
||||
|
||||
## Unit-level checks
|
||||
|
||||
- Compiler sweep (all GC and Wii compilers; `-ipa file` dropped for GC < 3.0): aes GC/3.0a3 .. 3.0a5.2
|
||||
identical (7/9), older or Wii compilers worse. idct_block_var GC/3.0a3 .. 3.0a5.2 identical (0/2).
|
||||
Version is not the lever for either unit.
|
||||
- combosweep (single + pairwise pragmas): aes best 137 -> 135 (opt_propagation off), no lead.
|
||||
|
||||
## net/aes: AESiEncryptBlock 137 -> 0, AESiDecryptBlock 215 -> 0 (unit Matching, DOL OK)
|
||||
|
||||
Tooling: `tree.py` symbolically executes a function and compares the expression tree of every
|
||||
store against the target, independent of registers and scheduling. That separated "wrong
|
||||
dataflow" from "wrong allocation", which earlier rounds had mixed together.
|
||||
|
||||
Findings, in order:
|
||||
|
||||
1. The target round is plain rijndael-fst order `hi ^ m16 ^ m8 ^ lo`, then `^ key`. The target
|
||||
tree is `(lo ^ (m8 ^ (hi ^ m16))) ^ key`. At -O3/-O4 MWCC rebalances any 4-leaf XOR chain
|
||||
(tree height reduction): every one of the 120 shapes tried compiled to `(x^y)^(z^w)`. At
|
||||
optimization_level 2 it is not rebalanced, but level 2 cannot unroll the decrypt key loop,
|
||||
which the target does (mtctr 2), so the unit is O4.
|
||||
2. With the rotate written as the `__rlwinm(x, n, 0, 31)` intrinsic instead of the shift/or
|
||||
macro, O4 leaves the chain alone (intrinsic calls are not reassociated), and the natural
|
||||
expression gives exactly the target tree. It also removes the CSE temporaries the shift/or
|
||||
macro created for the table loads (x used twice), which is what had kept the allocation off.
|
||||
3. Final round: encrypt `(hi<<24 | m16<<16 | m8<<8 | lo) ^ key[i]`; decrypt is XOR-based with the
|
||||
key first, `key[i] ^ hi<<24 ^ m16<<16 ^ m8<<8 ^ lo` (O4 rebalances it the target way).
|
||||
4. Encrypt init: `state = input[i]; ... state ^= key[i]` with `key = context->keys` walked by
|
||||
`key += 4` (single-expression init put keys[i] in the state register; 9 diffs).
|
||||
5. Decrypt: `key = context->keys; key += rounds * 4;` (the one-expression form folds +16 into
|
||||
the loads). InvMixColumn as `static inline void AESiInvMixColumn(u32* word)` (pointer
|
||||
parameter) fixes the last r7/r8 swap between value and timesTwo; value-parameter helpers and
|
||||
all local declaration orders left 26+ diffs.
|
||||
|
||||
Rejected along the way: optimization_level 2 pragma (correct tree, wrong key loop), int/long
|
||||
casts between XOR stages (blocks rebalancing but unnatural).
|
||||
|
||||
`include/global/decomp/ide.h`: declared `__rlwinm` for non-MWCC tooling (guarded by
|
||||
`#ifndef __MWERKS__`, no build effect).
|
||||
|
||||
## buffer/idct_block_var: Lumi and Col (in progress)
|
||||
|
||||
Dataflow first (path-based symbolic execution of both objects, `ptree.py`):
|
||||
|
||||
1. Even part: the target computes `rot + (c6 + c2)` into a fresh variable. `x = rot + x` is
|
||||
rewritten by MWCC to `x += rot` (operand order `sum + rot`), and a single-use `evenSum`
|
||||
gets forward-substituted and reassociated (`c2 + (rot + c6)`). Fix: `evenSum = c6 + c2;
|
||||
c2 = evenRotation * 0xB5 >> 8; evenRotationSum = c2 + evenSum;` (the c2 reassignment
|
||||
blocks the substitution). Same in both passes of both functions.
|
||||
2. AC test: the target ORs leaf-first (`c2 | acc`). `acc |= c` or `acc = c | acc` with a u32/s32
|
||||
accumulator is canonicalised to acc-first, a single 7-way expression is rebalanced at O4.
|
||||
An `int` accumulator over `s32` coefficients (`acBits = c2 | acBits;`) keeps leaf-first
|
||||
(the long->int conversion stops the `|=` rewrite).
|
||||
3. Level 2 or 1 cannot be it: no CTR row loop at level 2 (274 vs 257 insns).
|
||||
|
||||
With 1-2, all store/call trees of Lumi (3 paths) and Col (4 paths) equal the target and the
|
||||
frame sizes match. Remaining differences are allocation and scheduling only.
|
||||
|
||||
Allocation findings (mwdbg + regsim, `wantmap.py` maps candidate vregs to target registers by
|
||||
symbolic value):
|
||||
|
||||
- Named locals are numbered per block in reverse declaration order, blocks top-down (function
|
||||
scope first), forward-substituted locals take no number; split webs and inline locals become
|
||||
`@` temps numbered after all named locals.
|
||||
- Column setup now matches exactly: `pitch4/7/6/5/3/2` as named locals assigned before the
|
||||
loop, a separate column cursor (`src`, not a split web of the row cursor), and
|
||||
`for (column = 7; column >= 0; column--)` (CTR trip count becomes a temp colored first).
|
||||
- Declaration-order search inside blocks on the captured graph tops out at 113/153 target
|
||||
registers, and a greedy order-feasibility check stalls on callee-saved claim order, so the
|
||||
column AC block still has a different pre-RA schedule (live ranges).
|
||||
- objdiff fuzzy is the gate metric and disagrees with positional diff counts; searches now
|
||||
score candidates with objdiff itself (`odfuzzy.py`, one-unit objdiff project per slot).
|
||||
84
tools/decomp-assist/o2-aoss.attempts.md
Normal file
84
tools/decomp-assist/o2-aoss.attempts.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# o2-aoss attempts (2026-10-09)
|
||||
|
||||
Worktree data-d1, branch agent/w1009/o2-aoss at origin/main 20cf9f9f.
|
||||
Scratch compiles in /tmp/o2-aoss (same flags as ninja, ~0.2 s per unit).
|
||||
|
||||
## Findings that apply to both AOSSLink functions
|
||||
|
||||
- IRO is skipped for AOSSi_WLANGetBSSList and AOSSi_WLANConnect. Enabling
|
||||
MWCC's own IRO dump (flag byte 0x725e5c, log opened by 0x5ed500 in
|
||||
GC/3.0a5.2) shows both stop after IRO_BuildflowGraph. The cause is the
|
||||
check at 0x5bd060/0x5bd150: any EOBJREF to an object whose qualifiers carry
|
||||
alignment bits (0x1f000000) disables IRO for the whole function. Here that
|
||||
is `WD_Info info ATTRIBUTE_ALIGN(32)` (and `scan`). Removing the attribute
|
||||
makes IRO run, but it also drops the 32-byte frame alignment the target
|
||||
has. Type-level `ATTRIBUTE_ALIGN(32)` on the WD structs is ignored by this
|
||||
compiler (sizeof/alignof unchanged, no aligned frame), so the target also
|
||||
ran without IRO. Source shape maps almost 1:1 to PCode in these functions.
|
||||
- Ported MWCC's pre-RA list scheduler and the 750 machine model to Python
|
||||
(/tmp/o2-aoss/sched.py). It reproduces our B1/B14 of WLANConnect, the
|
||||
target B1, and our B19 of GetBSSList exactly. Facts it needed: stores to
|
||||
the same local at different offsets are independent; a store cannot issue
|
||||
while another store sits in LSU stage 2; ties go count -> height -> opcode
|
||||
rank (MR 0 < STH 1 < ADDI 2 < LHZ 3 < LI 4) -> program order.
|
||||
- With mwdbg extended with dump points before/after pre-RA scheduling and
|
||||
after each COptimizer level-4 pass (private copy, /tmp/o2-aoss/mwdbg2):
|
||||
the scheduler input for both blocks equals our final code minus nothing.
|
||||
Both target orders need one extra instruction in the block at scheduling
|
||||
time that is gone later (RA coalescing or post-schedule cleanup).
|
||||
|
||||
## AOSSi_WLANGetBSSList: 25 -> 3
|
||||
|
||||
regsim with the parameter pinned (/tmp/o2-aoss/ordanneal.py) found 1500
|
||||
declaration orders reaching all 11 target registers. Common constraints:
|
||||
index < driver < buffer < descriptor < count < cleanupRetries < unlockRetries
|
||||
and result < startupRetries < scanRetries. Declared C89-style at the top in
|
||||
that order (block-scoped declarations moved up): 25 -> 3, pool identical.
|
||||
|
||||
Remaining 3: block after `memset(buffer, 0, 0x3200)`, target issues
|
||||
`sth channelBit` before `li r5, 6` (so the lhz temp can be r5). Simulator:
|
||||
any one extra instruction in that block at scheduling time gives the target
|
||||
(dead VN copy, extra addi, ...). Tried, all still 3: `&scan.bssid`, scan
|
||||
pointer local, inline scan-param initializers (2 shapes), inline memset
|
||||
wrappers (void and returning), statement order permutations, unpacked WD
|
||||
structs (header override).
|
||||
|
||||
## AOSSi_WLANConnect: 2 (unchanged)
|
||||
|
||||
Second memset: target `li r4; li r5; mr r3, r27`, ours `li r4; mr r3; li r5`.
|
||||
Simulator: only an extra instruction on the address chain
|
||||
(lis -> addi -> X -> mr r3, X later coalesced) reproduces the target; no
|
||||
reordering of the block's inputs does, and a dead side copy does not.
|
||||
Explicit copies through a second local (i6, n3), inline helpers with a
|
||||
param or a cast local (m0/m1 x void/int x global/var), getter inline,
|
||||
NULL-initialised pointer, extern/global/static/struct-wrapped configs
|
||||
(struct gives `addi r27, r3, 0x160`: right order but one extra insn),
|
||||
array decay, casts: all removed by the COptimizer "pre" phase (peephole 0 +
|
||||
DCE) before scheduling, or by VN. 2 unchanged.
|
||||
|
||||
## AOSSi_WLANGetBSSList: 3 -> 0 (EXACT)
|
||||
|
||||
The missing instruction is a copy that lives until pre-RA scheduling and is
|
||||
coalesced by the allocator afterwards. A copy into a named local survives the
|
||||
COptimizer when its uses are in other blocks (the block-local peephole cannot
|
||||
rewrite them). A typed view of the scan buffer does exactly that:
|
||||
`void* buffer` for alloc/memset/free, `u8* scanBuffer = (u8*)buffer;` right
|
||||
after the memset, used by WD_Scan, the BSS count and the first descriptor.
|
||||
The copy sits in the scan-parameter block at scheduling time, so `sth` of
|
||||
channelBit issues before `li r5, 6` (target), then r24 holds both names.
|
||||
Variants that did not work: alias for the count pointer only (3), alias
|
||||
assigned before the memset (3).
|
||||
|
||||
## AOSSi_WLANConnect: more evidence (still 2)
|
||||
|
||||
- Pass tracing (dump after every COptimizer level-4 call): the in-block copy
|
||||
chain `addi vB; mr vC, vB; mr r3, vC` is collapsed by 0x596850 (block-local
|
||||
copy forwarding + DCE, pre phase); copies created later by value numbering
|
||||
(0x5976e0) get their uses canonicalised to the first holder. So a chain
|
||||
copy in the memset block cannot come from a plain second local.
|
||||
- Simulator searches: no input order, no 1-2 dead extra instructions
|
||||
(return copy, li, mr, addi, lis), no 1-2 side copies reproduce the target.
|
||||
Only (a) a copy on the address chain or (b) r4 and r5 both coming from
|
||||
register copies at scheduling time do.
|
||||
- Pragma sweep (15 single + all pairs, unit-wide, diagnostic): best is
|
||||
baseline 2; `peephole off` 11, `scheduling off` 50.
|
||||
105
tools/decomp-assist/o2-aterm.attempts.md
Normal file
105
tools/decomp-assist/o2-aterm.attempts.md
Normal file
@@ -0,0 +1,105 @@
|
||||
# o2-aterm attempts (ATERM, 2026-10-09)
|
||||
|
||||
Start (a6e74ad2): ATERM 22/26 exact; open: DiscoverAccessPoints 7, BuildEncryptedMessage 2,
|
||||
BuildAssociationRequest 28, RunConfigProtocol 294.
|
||||
End (2882435b): 25/26 exact; BuildEncryptedMessage 2 (scheduler tie-break, below). ATERM stays
|
||||
NonMatching.
|
||||
|
||||
## Prior art: the DS build of the same library
|
||||
|
||||
The DS DWC library ships the same NEC "AtermStation" code with its real static names
|
||||
(CacaBueno64/ie3ogres `lib/TwlDWC_dl/asm/util/atermset.s`, read-only). Name map:
|
||||
ScanAP = DiscoverAccessPoints, CheckAccessPoint = FindChangedApRecord, GetMacEncKey =
|
||||
BuildAssociationRequest, GetWLanSetElement = ParseAssociationResponse, AsciiToHex = ParseHexBytes,
|
||||
StoreNetParam = ApplyScanSecuritySettings, AutoConfigThreadEx = RunConfigProtocol,
|
||||
keywrap_encrypt/decrypt = AesKeyWrap/Unwrap, rijndael* = Aes*, MY_MD5Update = Md5Update,
|
||||
PutHex/PutMac = the hex and MAC formatters (non-inlined on DS, so their bodies are visible).
|
||||
|
||||
## MAC formatter (DiscoverAccessPoints 7 -> 0, BuildAssociationRequest 28 -> 0)
|
||||
|
||||
Cause: the register swap was input pointer r9 vs r5 and low nibble r5 vs r9. With the
|
||||
`nibbles[2]` array helper both nibbles are codegen temps, which are numbered above every inline
|
||||
variable and therefore colored first, so the low nibble always took r5 (array element types,
|
||||
declaration orders, 400 sampled formatter shapes, pragmas and compiler versions: no change).
|
||||
The DS PutHex keeps one nibble variable and rotates it: `h = (c & 0xF0) >> 4; for (2) { emit h;
|
||||
h = c & 0xF; }`. On MWCC the loop-invariant `c & 0xF` becomes an IR temp numbered below the
|
||||
inline locals, so it is colored last (r9), and PutMac's `*mac++` parameter takes r5. Both
|
||||
functions exact; ParseAssociationResponse (GetWLanSetElement calls PutHex on DS) stays exact with
|
||||
the same helper (`key += atermFormatHexByte(key, *optionValue++)`), so the separate straight-line
|
||||
atermEncodeHexByte is gone.
|
||||
|
||||
## Readability: scan buffer header
|
||||
|
||||
`(u16*)scanBuffer + 1` replaced by `((AtermScanBuffer*)scanBuffer)->descriptorWords`
|
||||
(count, then the descriptor word stream): 0 diffs. Typing the scanBuffer local itself as
|
||||
AtermScanBuffer* changes the alignment arithmetic (98 diffs, size 0x418).
|
||||
|
||||
## RunConfigProtocol (294 -> 2) = DS AutoConfigThreadEx
|
||||
|
||||
Rebuilt from the DS layout instead of the hand-inlined body: GetTickCount, Sleep (alarm), SendNotify,
|
||||
SendFrame -> SendBroadcast -> SendFrameViaInterface, GetFrameData/GetCommandElement,
|
||||
GetElementData/GetFirstElement, SetElementData/SetSingleElement/SetSearchRes, RFC 1321 MD5
|
||||
Init/Encode/Final/memset as static inlines, globals used directly (no request/packet/response/session
|
||||
pointer locals). Findings, each measured:
|
||||
- .bss order follows the first reference in the function IR. Passing a cast global address
|
||||
(`(u8*)&gAtermDecodedResponse`, `(u16*)buf`) into a static inline hoists it to the function entry
|
||||
and moves it first. The element buffer is a plain `u8[0x800]` in the original (like FrameData), so
|
||||
it is now one, with an AtermElementHeader view; that keeps the target order without pointer locals.
|
||||
- Inline helper uses of a global address get a hoisted register (r25/r31/r15) while direct call
|
||||
arguments rematerialize `addi rN, base, off`. This is plain MWCC behaviour, matching the target.
|
||||
- MD5: the exact RFC 1321 Encode/MD5_memset text (`unsigned int` lengths, `unsigned char` masks)
|
||||
keeps IRO from unrolling the Encode loops, so the PCode unroller produces the target's
|
||||
load/store order (u32 types: 35 diffs; RFC types: 0).
|
||||
- SetElementData must advance its own cursor parameter (`cursor += recordSize; return cursor;`)
|
||||
for the r16/r17 alternation; the value pointer as `cursor + sizeof(AtermOptionHeader)`.
|
||||
- GetFrameData returns `frame + sizeof(AtermFrameHeader)` (not `packet->payload`), declares
|
||||
`end` before `cursor` (inline locals number in reverse order); SetSingleElement writes through a
|
||||
header pointer local.
|
||||
Remaining 2 at 23addcb1: SetSearchRes' second element folds its value pointer to the first
|
||||
element's base (`addi r3, r16, 0xc`, target `addi r3, r17, 4`).
|
||||
|
||||
## RunConfigProtocol (2 -> 0): the DS SetElementData body with an int pad size
|
||||
|
||||
Found with IRO dumps. The compiler prints them once two dump flags are set: gdb breaks at
|
||||
0x5ed507 (log open) and writes 0x725e5c, then toggles 0x725e5c/0x70f24d per function at
|
||||
0x577716. That is o2-keyboard's /tmp/o2-keyboard/irodump1_gdb.py; the log is `<source>.log`. A
|
||||
copy that keeps its temporary source in this worktree is /tmp/o2-aterm/irod/run.sh. It drops
|
||||
the AES tables and the bodies after RunConfigProtocol, which leaves the function's code identical
|
||||
and takes about a minute.
|
||||
- Elements 1 and 2 share one IRO block. Block-local expression propagation chains element 2's
|
||||
cursor copies back to element 1's cursor temp, so element 2's `cursor + 4` reads element 1's
|
||||
temp. IRO_PropagateSelfAssignments (inc/dec propagation, 0x5f2150) then folds element 1's
|
||||
`+= 8` into it, giving base1 + 0xc. Elements 5 and 4 sit in their own blocks: global copy
|
||||
propagation reaches them one step at a time, so they fold onto the previous element's base,
|
||||
which is what the target does.
|
||||
- Inc/dec propagation is all-or-nothing per `+=` def. Every reached use must have that def as its
|
||||
only reaching definition. More than one use needs the helper at 0x5f24e0, which builds
|
||||
`var op const` and asks a backend predicate (0x56ac90).
|
||||
- The DS SetElementData does `p += sizeof(header); memset(p, 0, pad); memcpy(p, data, len);
|
||||
return p + pad`. A mid-body `+= 4` kills the copy before element 2's value uses. With
|
||||
`cursor += paddedLength; return cursor;` and an `int` (or unsigned int, u16, short) pad size, the
|
||||
first PropagateSelfAssignments round leaves those incs alone. Element 1's `+= 8` therefore
|
||||
reaches element 2's cursor copy (`@c2 = @c1 + 8`, no longer a copy) before any copy
|
||||
propagation reaches the value uses, and they stay `base2 + 4`. With `s32`/`u32` (long) pad
|
||||
sizes, the first round merges the `+= 4`. Second-pass copy propagation then rewrites the
|
||||
value uses to element 1's temp, and the fold comes back (2 diffs). A mini repro with `int`
|
||||
typedefs behaves like the `int` case, which is how the type dependence showed up. Measured
|
||||
variants: E4 (`+= pad; return cursor`) int/unsigned/u16/short: 0. E4 s32/u32: 2. E1 any type: 2.
|
||||
E3 (`return cursor + pad`) any type: 661.
|
||||
- Bisecting the full function (other switch cases, the loop condition, atermSleep, the
|
||||
epilogue) changed nothing. Only the helper text matters.
|
||||
|
||||
## BuildEncryptedMessage (2, unchanged): entry-block scheduler order
|
||||
|
||||
Target `mr r27,r5; mr r30,r3; mr r26,r4; mr r28,r6; mr r3,r27; mr r29,r7`; ours puts
|
||||
`mr r29,r7` before `mr r3,r27`. The mwdbg capture shows the entry block is list-scheduled before
|
||||
register allocation, with the program order r3..r7 parameter moves, `li checksum`, `mr r3,payload`,
|
||||
`li r4`, `li r5`, `bl memset`. The 750 model gives the memset call latency 0, and the GPR
|
||||
anti-dependency edges have latency 0. The call's operand list also clobbers r6 and r7. So the r6
|
||||
copy and the r7 copy have identical dependencies, unlocked-successor counts, heights,
|
||||
criticality and rank. Program order then always places both before `mr r3,payload`, but the
|
||||
target puts r6 before it and r7 after. Not reachable by:
|
||||
- K&R parameter declaration orders
|
||||
- every `#pragma scheduling` model (740/750/7400/altivec/on/reset: 2; others: 12-40)
|
||||
- key copies, extra param copies and inline wrappers (the earlier session)
|
||||
Recorded as a scheduler tie-break.
|
||||
112
tools/decomp-assist/o2-bs2mach.attempts.md
Normal file
112
tools/decomp-assist/o2-bs2mach.attempts.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# o2-bs2mach attempts (BS2Mach: CheckBS2CommandStatus, BS2Tick)
|
||||
|
||||
Worktree data-d7, branch agent/w1009/o2-bs2mach, base 20cf9f9f (origin/main).
|
||||
Start: 27/29 exact, CheckBS2CommandStatus 2/406, BS2Tick 57/1940, data 158528/158528, pool 91/91.
|
||||
|
||||
## CheckBS2CommandStatus (lever 35)
|
||||
|
||||
Target case 0x12 issues `lwz count; stw CacheCommandComplete; slwi`: the completion
|
||||
store fills the load-latency slot, so it has no edge to the partition-count load
|
||||
through `DataToc`. A file-scope static may alias that pointer load, a
|
||||
function-local static whose address is never taken may not.
|
||||
|
||||
1. `static u32 CacheCommandComplete = 0;` inside CheckBS2CommandStatus (it is the
|
||||
only user), completion stored before the length update as in every other case:
|
||||
CheckBS2CommandStatus 0/406. Every other function unchanged, pool identical.
|
||||
The static lands at the end of .sbss (after LoaderInit) instead of 0x50.
|
||||
2. Compiler probe (same flags): initialized objects and function statics are
|
||||
emitted in parse order, tentative definitions after them in reverse definition
|
||||
order (`I1 I2 L$4 I3 T4 T3 T2 T1`).
|
||||
3. AudioBufferUnconfigured..LoaderInit made tentative (initializers dropped) and
|
||||
listed in reverse: .sbss order and offsets identical to the target, 28/29
|
||||
exact, data 158528/158528. Target symbol renamed `CacheCommandComplete$1964`
|
||||
in config/43U/symbols.txt (project convention for function statics).
|
||||
|
||||
## BS2Tick (57 at start)
|
||||
|
||||
4. Same lever in case 0: the target schedules `li 1` first and keeps the
|
||||
`AudioBufferUnconfigured = 1` store free of the absolute `*(u32 *)0x800030d4`
|
||||
store (unknown storage aliases every file-scope object, not a function static).
|
||||
AudioBufferUnconfigured, ResetTime and SpinupDeadline are only used by BS2Tick
|
||||
and sit right after CacheCommandComplete in .sbss. All three as BS2Tick
|
||||
statics: 57 -> 52; only AudioBufferUnconfigured as a static gives the same 52,
|
||||
so ResetTime/SpinupDeadline stay file-scope tentatives. Symbol renamed
|
||||
`AudioBufferUnconfigured$2066`. .sbss order identical.
|
||||
5. Store-before-load pairs the target keeps and we hoist (case 0x30
|
||||
`PartitionOpen = 0; if (RegionValid == 0)`, case 0x34/0x35
|
||||
`LoadingTitle = 0; switch (Block.state)`, case 0x40 `AbortFlag = 0;
|
||||
if (RestartRequested == 0)` and `RestartRequested = 0; if (FatalErrorFlag)`).
|
||||
Compiler probe with the unit's flags (/tmp/o2-bs2mach/probe/t2.c, t3.c): a
|
||||
store to one global followed by a load of another keeps its order only when
|
||||
BOTH are volatile; non-volatile/volatile, volatile/non-volatile, extern and
|
||||
address-taken globals are all reordered. So the target proves PartitionOpen,
|
||||
LoadingTitle, AbortFlag, RestartRequested and FatalErrorFlag volatile
|
||||
(RegionValid and DVDCommandBlock.state already are). AbortFlag is also read in
|
||||
BS2DVDCallback (interrupt context); RestartRequested/AbortFlag writers disable
|
||||
interrupts. One-at-a-time sweeps could not see the case-0x40 chain because it
|
||||
needs all three together. All five: 52 -> 42, other 28 functions unchanged.
|
||||
6. Device-code block (case 5): the initial PCode has a separate `lis 0x8000` per
|
||||
branch and backend value numbering merges them into the consoleType base. Per
|
||||
the MWCC decomp (ValueNumbering.c), `li`/`lis` are only value-numbered when the
|
||||
destination is a temporary inside the coalesce window; named locals never are.
|
||||
Reading consoleType through a named `OSBootInfo *bootInfo` and sharing the
|
||||
`State = BS2_STT_8` tail: 42 -> 28, block exact.
|
||||
7. Case 0: `DvdProgress = (u32 *)0x800030d4; ... *DvdProgress = 0;` (as case 2
|
||||
writes it) and testing `BS2NoDisk` directly: 28 -> 24 -> 12 together with 8.
|
||||
8. CoverOpenTimeHigh/Low are one 8-aligned big-endian OSTime: a single
|
||||
`OSTime CoverOpenTime` keeps CheckDVDCommandStatus exact (u64 store is low word
|
||||
first, as in the target) and makes the case-0x42 zero high word a later temp,
|
||||
fixing that whole register cluster (24 -> 14 at the time).
|
||||
9. Banner check: the target loads bannerFile.length straight into r6 because it is
|
||||
the 4th OSPanic argument; the format string has `(0x%08x)` and our call had no
|
||||
argument. Passing bannerFile.length fixes the cluster.
|
||||
10. RequiredIosHigh/Low are likewise one 8-aligned u64 (BS2StartGame reads it as a
|
||||
title ID with the `== 0 -> 1:3` default). `u64 RequiredIos` gives the target
|
||||
pair coloring (hi r0, lo r3, TMD r4) and keeps BS2StartGame exact.
|
||||
symbols.txt: CoverOpenTime and RequiredIos as size-8 objects (only BS2Mach
|
||||
referenced the halves; every relocation resolves to the same address).
|
||||
BS2Tick 4/1940 left: case 0 `CoverBlock.state = 0` is ordered before the
|
||||
volatile BS2NoDisk load (target: after).
|
||||
|
||||
### Volatile flags: per-flag evidence (current source, BS2Tick 4 diffs)
|
||||
Target pairs a store to one global with a later load of another and keeps that
|
||||
order; MWCC only does so when both are volatile (probe t2/t3: non-volatile,
|
||||
one-sided, extern and address-taken pairs are all reordered).
|
||||
- 0x3b04 case 0x30: `stw PartitionOpen; lwz RegionValid` (RegionValid volatile).
|
||||
- 0x3d68 case 0x34/0x35: `stw LoadingTitle; lwz Block.state` (state volatile).
|
||||
- 0x40a0 case 0x40: `stw AbortFlag; lwz RestartRequested`, then
|
||||
`stw RestartRequested; lwz FatalErrorFlag`.
|
||||
Dropping any single flag: PartitionOpen 4->7, LoadingTitle 4->6, AbortFlag 4->7,
|
||||
RestartRequested 4->9, FatalErrorFlag 4->6; no other function changes.
|
||||
|
||||
### Last 4 diffs: case 0 `CoverBlock.state = 0` vs the BS2NoDisk test
|
||||
Target: `lwz r0,BS2NoDisk; stw r4,AUC; cmpwi r0,0; stw r27,0xc(r3); beq`.
|
||||
Ours: the CoverBlock store precedes the load. Everything else in the block,
|
||||
including every register, already matches.
|
||||
- BS2NoDisk, DvdTransferred and DvdTransferLength are volatile (non-volatile
|
||||
BS2NoDisk hoists the load above both DvdTransfer stores; non-volatile
|
||||
DvdTransferred breaks BS2DVDCallback's order against DvdReadPending).
|
||||
- DVDCommandBlock.state reads are volatile in the target (BS2StartGame and
|
||||
BS2StartGCGame poll it with a re-read every iteration; case 0x34 above). With
|
||||
`state` non-volatile case 0 becomes exact but those break.
|
||||
- So the source reads BS2NoDisk before the store. Holding it in any variable
|
||||
(named, block-scoped, inline parameter/local, any same-width type) makes it a
|
||||
named/`@` local, numbered below statement temps and colored after the constant
|
||||
1: registers rotate (1 r0, BS2NoDisk r4, &PP r4, &0x800030d4 r5), 10 diffs.
|
||||
mwdbg capture o2-bs2mach-st + regsim what-if: coloring that holder first gives
|
||||
exactly the target (only those 4 nodes change). Narrow holders (u8/s8/u16/s16)
|
||||
force a statement temp and get everything right except `clrlwi.` vs `cmpwi`
|
||||
(1 diff). A 64-bit round trip is folded away.
|
||||
- Diagnostic only, both exact 29/29, both forbidden, not committed:
|
||||
`if ((BS2NoDisk | (CoverBlock.state = 0)) != 0)` (read then store in one
|
||||
expression) and `*(s32 *)&CoverBlock.state = 0;` (non-volatile store).
|
||||
No natural spelling found: hoisting a common leading store out of all three
|
||||
branches doesn't happen (size grows); statement order grid (84 builds),
|
||||
inline helpers, casts and holder types all stay at 4-10.
|
||||
- Pragma sweep (combosweep, single + pairwise): BS2Tick 4 -> 4.
|
||||
|
||||
### Tooling note
|
||||
`#pragma push / ppc_iro_level 0 / pop` tightly around BS2Tick (the last function
|
||||
in the file) leaves it byte-identical, which earlier rounds read as "IRO does not
|
||||
run on BS2Tick". A file-level `#pragma ppc_iro_level 0` changes BS2Tick in 1910
|
||||
instructions, so IRO does run; only the scoped placement is not honored for it.
|
||||
110
tools/decomp-assist/o2-cardseq-sdmem.attempts.md
Normal file
110
tools/decomp-assist/o2-cardseq-sdmem.attempts.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# o2-cardseq-sdmem attempts
|
||||
|
||||
Branch `agent/w1009/o2-cardseq-sdmem` from `20cf9f9f`.
|
||||
|
||||
## iplSDMemory: SDMemory::drawTransferTitles (50 -> 0), unit linked
|
||||
|
||||
Start: 50/451 differing, register-only. Earlier Opus run (data-d9 `9b634499`) had brought it
|
||||
363 -> 50 with the MSL `wcsstr` overload and `TextBox::SetTextColor`.
|
||||
|
||||
### Diagnosis with mwdbg + regsim
|
||||
|
||||
Target vs ours, GPRs only:
|
||||
|
||||
- alpha r31 / string-pool base r30 / bodyPane, titleSizePane r29; ours r29 / r31 / r30.
|
||||
- line loop: lineCount r22, totalLines r23, `L"\n"` r24, messageLine r26, messageText r27,
|
||||
lineIndex r28; ours r19 / r19 / r23 / r20 / r26 / r24.
|
||||
|
||||
The capture shows vreg numbering = `this`, named locals (reverse declaration order), frontend
|
||||
temps (reverse creation order), then codegen vregs (string base r70 first). Coloring is reverse
|
||||
simplify order and picks the lowest free register, requesting saved registers from r31 down.
|
||||
Replaying the capture with relabelled vregs (`/tmp` wrapper around `regsim.simulate/color`)
|
||||
reproduced the whole target when:
|
||||
|
||||
1. alpha lives in a codegen vreg created after the string base (any number 71..150),
|
||||
2. totalLines sits between the third wcsstr's `s2` temp (v62) and lineEnd (v106/107),
|
||||
3. row and visibleRows are numbered below every line-loop local,
|
||||
4. messageText is numbered above lineIndex.
|
||||
|
||||
### Source changes that produce it
|
||||
|
||||
1. `nw4r::lyt::Pane::GetAlpha()` is `const` in real NW4R. With the const member the inline's
|
||||
result is a codegen value, not a frontend temp, and alpha moves above the string base.
|
||||
(An explicit `static_cast<u8>` around the call did the same; the const accessor is the real
|
||||
declaration, so that is what landed.) 50 -> 20.
|
||||
2. `visibleRows` / `row` declared in the title loop body (`s32 visibleRows = ...; for (s32 row = 0; ...)`). 20 -> 18.
|
||||
3. `messageText` declared before `lineIndex`. With 2: 13.
|
||||
4. No `totalLines` local: `for (lineIndex = 0; lineIndex < lineCount + 1; ++lineIndex)`.
|
||||
With 1-3: 0 differing.
|
||||
|
||||
Types of alpha tried first (u32, s32, int, u16): no change; s8/char: worse. A named
|
||||
`memoPane` local: no change.
|
||||
|
||||
### Linking the unit (Matching flip)
|
||||
|
||||
Flipping the unit failed to link: the source called six SDChannelSelect members through
|
||||
`extern "C" iplSDChannelSelect_813D....` placeholders. A temporary link with the existing
|
||||
mangled names linked but changed the DOL: one weak function survived dedup,
|
||||
`SDMemory::TitleRange::operator=`, because SDChannelTitle hand-wrote the same compiler-generated
|
||||
function as `extern "C" iplSDChannelTitle_copyTitleRange`. Fixes (all byte-identical where noted):
|
||||
|
||||
- SDChannelTitle: `sdRange = scene->mTitleRange;` / `nandRange = sdRange = scene->mTitleRange;`
|
||||
instead of the hand-written copy; symbols.txt names 0x813E6FA0
|
||||
`__as__Q43ipl5scene8SDMemory10TitleRangeFRCQ43ipl5scene8SDMemory10TitleRange` (scope:weak).
|
||||
The compiler emits it at the same place. Unit stays 69/69.
|
||||
- SDChannelSelect, real parameter types from the command dispatch and NandSDWorker:
|
||||
`enqueueMoveNotice(ESTitleId)` (type 6 -> copy_nand_app_to_sd_async), `enqueueDeleteNotice(ESTitleId)`
|
||||
(type 13), `enqueueErrorNotice(TitleIdList*, TitleIdList*)` (type 11 -> check_backup_fits_async),
|
||||
`enqueueCommandNotice(TitleIdList* x3)` (type 12; the worker casts paramA-C to TitleIdList*),
|
||||
collect* `titleNames` as `wchar_t (*)[21]`. Object bytes identical, only symbol names change
|
||||
(symbols.txt updated for the nine functions). `friend class SDMemory;` for the private members.
|
||||
- SDMemory: `TitleListState` was three `NandSDWorker::TitleIdList`s; it is now
|
||||
`mTitleList / mNandTitleList / mSDTitleList`, and the calls are member calls. Still 66/66.
|
||||
|
||||
Full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d with iplSDMemory Matching.
|
||||
gate.py (SDMemory, SDChannelSelect, SDChannelTitle) --quick: 0 regressions, GATE PASS.
|
||||
|
||||
## iplCardSequence: loadCardFileIcons (213 -> 135, equal size)
|
||||
|
||||
Kept (all functions of the unit otherwise unchanged, pool identical):
|
||||
|
||||
- Format-3 palette left uninitialized (lever 10). Asm proof: in the target icon loop r6 is
|
||||
paletteSize; its only writes are `li r6,0x400` (case 1), `li r6,0x800` (case 2) and `li r6,0`
|
||||
(case 0). Case 3 branches (`cmpwi r4,3; bge`) straight to the iconOffset update that reads r6
|
||||
(`add r22,r6,r22` / `add r21,r6,r21`) and `add r7,r7,r6`; no instruction writes r6 between
|
||||
function entry and the loop. Case 0 sets paletteSize to 0 itself. 213 -> 387 (511 insns) with
|
||||
the array form, -> 192 (512/512) with the existing `u8* iconPalette` pointer form.
|
||||
- Image read as `static inline s32 readCardImages(...)`: the target's CARDRead failure is
|
||||
`bge +8; b <check>` into the shared `if (result < 0)` test, the shape of an inlined early
|
||||
`return` (a goto folds to `blt`, a top-level return branches to the epilogue).
|
||||
- Comment read as `static inline s32 readCardComment(...)`: with only the image helper the two
|
||||
sector-size slots swapped (0x8/0xC); as a second inline its `sectorSize` gets 0x8 again, and
|
||||
its early `return 0` / final `return result` give the target's comment flow.
|
||||
- Banner/icon setup + image read as `loadCardIconImages(...)`, and the block base/offset split
|
||||
as `getCardBlockAddress(address, &offset)`: 231 -> 135, slot/fileNo/dir get r24/r25/r26.
|
||||
|
||||
Allocator analysis (mwdbg + regsim, a want-map derived by aligning backend-01/04 PCode with the
|
||||
target): remaining diffs are register-only. Target colors iconAddressBase r31, then the four
|
||||
CSE multipliers (fileNo*64 r30, slot*8128 r29, fileNo*4 r28, slot*508 r27), dir r26, fileNo r25,
|
||||
slot r24, iconAddressOffset r23; comment base r23 / offset r21 / readSize r22 / result r29.
|
||||
In the current capture iconAddressOffset sits in the last simplify scan (colored first, r31)
|
||||
and iconAddressBase leaves one scan earlier; no numbering of the existing temps fixes both.
|
||||
|
||||
### loadCardFileIcons 135 -> 126
|
||||
|
||||
- NONE case as `u8* previous = &...iconFmt[iconCount - 1]; ...iconFmt[iconCount] = *previous;`:
|
||||
gives the target's `add; lwz; addis; subi; add; lbz -1(p); stb 0(p)` shape (134). The array
|
||||
form and `p[-1]` forms keep the -0x6fb4 in the displacement instead.
|
||||
- Animation setup written in place with the icon loop's own `iconCount`/`shift`/`icon`, initialized
|
||||
`shift, iconCount, hasTlut, iconImageSize` in that order, early exit by `goto animationDone`.
|
||||
PCode value numbering reuses the first `li 0` of the block for the two zero stores; the target
|
||||
reuses the animation shift (r3), which only happens when shift is the first zero in that block.
|
||||
With the old helper the stores reused hasTlut. Anim region instruction order now matches.
|
||||
- Block base as the common subexpression `iconAddress & 0xFFFFFE00` (IRO CSE temp, numbered just
|
||||
above the CSE multipliers, as the simulator requires); offset `iconAddress - (iconAddress & ~0x1FF)`.
|
||||
Base, params and the four multipliers now get the target registers (126).
|
||||
|
||||
Tooling: private mwdbg copy on gdb port 9137 (/tmp/o2-cardseq-sdmem-mwdbg, retrowin32 rebuilt with
|
||||
the port patched) because the shared port queue timed out; IRO log via the known 2-byte patch of a
|
||||
/tmp copy of GC/3.0a5.2 (diagnosis only). Remaining in the simulator: transferSize must be numbered
|
||||
below the image offset, the comment base/offset/readSize above every other temp, result low.
|
||||
111
tools/decomp-assist/o2-chansvm.attempts.md
Normal file
111
tools/decomp-assist/o2-chansvm.attempts.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# o2-chansvm: CHANSVm round 2 (WinEmuWrite, BlobGetHexString, BlobPackCommon, Step)
|
||||
|
||||
Worktree data-d2, branch agent/w1009/o2-chansvm, base 20cf9f9f. Start: WinEmuWrite 5, BlobGetHexString 14,
|
||||
BlobPackCommon 47, CHANSVmStep 262 (odiff differing instructions).
|
||||
Scratch: /tmp/o2-chansvm (score.py = whole-unit compile + per-function diff; t/ = one-function harness
|
||||
that reproduces the unit's codegen in under a second; tmw.sh = mwdbg on a harness file, ~8 s).
|
||||
|
||||
## VmWinEmuWrite: 5 -> 0 (exact)
|
||||
|
||||
Diff: strObj and totalLength swap r27/r29. mwdbg: every node is low-degree, so the color order is plain
|
||||
descending vreg number. Named locals are numbered first (reverse declaration order), then IR temps and
|
||||
inline locals (forward order), then codegen temps. The strObj value survived as the codegen temp of the
|
||||
call result (`mr r40, r3; mr r37, r40` -> r37 propagated away), so it always had the highest number of
|
||||
the loop values and took r29 first.
|
||||
|
||||
Copy-propagation probes on small functions (X1-X12 in t/x*.c): the backend replaces a named local by
|
||||
the call-result temp unless the named local has a copy use (`mr rX, local`). Load-base and compare uses
|
||||
do not block it; a copy use does (X8 vs X7). IRO removes plain `p = o` copies and inline parameters
|
||||
before the backend sees them (X11, X12).
|
||||
|
||||
`strObj = CHANSVmGetArgString(vm, 0)` (the real exported helper, inlined) leaves the inline's return
|
||||
temp (@1501, IR class) with a copy use, so that temp survives instead of the codegen temp. Moving the
|
||||
loop into a static inline helper numbers its locals after that temp, which gives the target order.
|
||||
|
||||
| attempt | Win | others |
|
||||
|---|---|---|
|
||||
| strObj assigned twice (GetArg, then Convert), 3 declaration orders | 5 / 8 / 8 | - |
|
||||
| for loop, guard clause, no `remaining`, if/else inLen, assign-in-if, nested if | 5 .. 54 | - |
|
||||
| GetArgString only | 5 | - |
|
||||
| loop in inline helper only (prior run) | 10 / 13 | - |
|
||||
| GetArgString + inline helper, locals offset, totalLength, buf, outLen, inLen | 5 (outLen/inLen slots swapped) | - |
|
||||
| GetArgString + inline helper, locals offset, totalLength, buf, inLen, outLen | 0 | no change, pool identical |
|
||||
|
||||
## VmBlobGetHexString: 14 -> 0 (exact)
|
||||
|
||||
Diff: loop registers. Target colors IV4 (byte offset +4) r4, the +2 counter r5, src r6, digit chain r7,
|
||||
hexTbl r8; ours had the counter and the digit chain swapped. The digit chain is codegen temps, so the
|
||||
counter and src must be numbered above it: both have to be strength-reduction IVs, created in the order
|
||||
src, counter, IV4.
|
||||
|
||||
Per-pass PCode dumps (private copy of mwdbg with a breakpoint after every pass call in the -O4 driver at
|
||||
0x5964c0, /tmp/o2-chansvm/mwdbgp) showed what each form does:
|
||||
- pass 10 (0x62be80) is strength reduction; pass 14 (0x62e8d0) the CTR conversion.
|
||||
- `src[byteIndex]` makes src an SR IV; `dest[byteIndex * 2]` gives IV4.
|
||||
- A separate +1 counter for the low index (`lowDigitIndex = i * 2 + 1; i++`) gives the target coloring,
|
||||
but SR rewrites i as `mr i, byteIndex`, which keeps byteIndex alive past the CTR conversion: two extra
|
||||
instructions (n=84).
|
||||
- `lowDigitIndex = byteIndex * 2 + 1` with matching signedness is folded by the front end into a
|
||||
displacement (`sth 2(rX)`, n=79).
|
||||
- A signed index variable fed from the unsigned counter blocks that fold: the low index stays
|
||||
`(cnt + 1) << 1` with cnt = SR(byteIndex << 1), created between src and IV4.
|
||||
|
||||
| attempt | Hex |
|
||||
|---|---|
|
||||
| 16 combinations of src (ptr/index) x high (destOff/byteIndex*2/i) x low index | 16 .. 48 |
|
||||
| byteIndex*2+1 low index forms (a1-a7), digitIndex++ forms (q1-q5), dest[j++] x2 (j1-j6) | 38 (n=79) |
|
||||
| separate +1 counter for the low index (m2, n1-n6, 24 declaration orders) | 50 (n=84) |
|
||||
| u32 counter, int/s32 low index (t_u32_int, c1, c5, c6) | 0 |
|
||||
| int highDigitIndex/lowDigitIndex from u32 byteIndex (c7, kept) | 0, no change elsewhere, pool identical |
|
||||
|
||||
## VmBlobPackCommon: 47 -> 0 (exact)
|
||||
|
||||
Diff: argArr (ours r23, target r18) and argCount/writeArgCount (ours r18, target r23). The allocator
|
||||
needs three simplify sweeps here, so sweep membership matters, not only numbering. A graph simulator
|
||||
(/tmp/o2-chansvm/packsim.py, built on regsim) traced remaining degrees per sweep:
|
||||
- Swapping the argArr/writeArgCount declaration slots alone fails: argArr reaches its sweep-2 scan
|
||||
with degree 29, one over the limit, and drags fmtLen/fmtStr/parentBlob into sweep 3.
|
||||
- With argArr one neighbour lighter at that point, the swap plus argCount declared between fmtPos and
|
||||
totalSize reproduces every target register.
|
||||
- Searching single-node renumberings found the neighbour: @10858, the `dataSize` local of the
|
||||
VmBlobCopyPadded inline. Inline locals are numbered after all declared locals; the target needs it
|
||||
in the declared range (ids 36..45), i.e. a local of PackCommon itself. srcOff and dest may sit
|
||||
anywhere (3855/4000 sampled placements hit).
|
||||
|
||||
Kept: the copy code written out in case 4 with writeBlobSrcOff/DataSize/Dest locals of the function,
|
||||
argArr and writeArgCount declarations swapped, argCount declared between fmtPos and totalSize.
|
||||
VmBlobCopyPadded (only used here) removed. Pool identical, no other function changed.
|
||||
|
||||
| attempt | Pack |
|
||||
|---|---|
|
||||
| shared argCount for both passes (merged node), all placements in the simulator | >= 28 misses |
|
||||
| shared counter, restricted declaration-order annealing (6 seeds) | 7 misses best |
|
||||
| simulator: swap only / swap + one edge cut / swap + merged loop constants | 3 / 2 / 0 misses |
|
||||
| simulator: swap + argCount slot + @10858 in declared range | 0 misses |
|
||||
| source: inline copy code with function-scope locals + two declaration moves | 0 |
|
||||
|
||||
## CHANSVmStep (in progress)
|
||||
|
||||
Structure first (opcode stream with registers masked, difflib-aligned; /tmp/o2-chansvm/opdiff.py),
|
||||
then allocation. Findings, each checked against the target object:
|
||||
- The target addresses VmResultTypeTbl and the constant objects off one .rodata base (r28 = .rodata+0,
|
||||
offsets 0x160.. and 0xa0). MWCC pools a section base only when a function references three or more
|
||||
distinct objects in it (/tmp/o2-chansvm/pool/p3.c: two objects never pool, three always do, global or
|
||||
static). VmResultTypeTbl (0xB4) has no relocation anywhere in the target: it is a dtk-inferred
|
||||
aggregate of five 6x6 tables (lever 13). Five separate tables give the pooled base.
|
||||
- `&CHANSVmConstStringObjectUndefined_[4]` takes two addis (array, then element); the target takes one
|
||||
(`addi r5, r28, 0xa0`), so those five 16-byte objects were separate too. With names, the `base[7]`
|
||||
hack in CHANSVmConvertToStrFromFloat goes away and that function stays exact.
|
||||
- `if (stepCount == 0) stepCount = 1;` plus `while (stepCount-- != 0)` (target enters the loop with a
|
||||
branch to the test at the bottom).
|
||||
- Stack: target 0x30 = object behind stackPtr (SET_INDEX), 0x40 = STORE_INDIRECT object, 0x50 load,
|
||||
0x60 operand. MWCC orders frame slots by size, ties in reverse declaration order (pool/s2.c), so
|
||||
`copies[2]` was two separate objects.
|
||||
- operandTypes filled through `&operandTypes[typeIdx]` (target keeps a +4 byte IV), not a walker.
|
||||
- BRANCH_CASE computes into a case-local result (target `li r3, ..` then `mr r14, r3` at the join)
|
||||
and stores the flag only on the OK path after the pop.
|
||||
- GET_PROPERTY_NAME: `foundEntry = 0` before the lookup, a one-case `switch (foundObj->type)` (target
|
||||
`beq +8; b far`), `shouldBranch = foundEntry` before `result = OK`, check reads shouldBranch.
|
||||
- BRANCH_CASE reads pObjStackTopBuf into stackTop before the stackDepth test.
|
||||
With these the opcode stream matches except three scheduling ties (511, 598, 836) that depend on
|
||||
registers; 297 register differences remain.
|
||||
67
tools/decomp-assist/o2-small.attempts.md
Normal file
67
tools/decomp-assist/o2-small.attempts.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# o2-small attempts (2026-10-09)
|
||||
|
||||
Worktree `sol-low`, branch `agent/w1009/o2-mcm-pdm-nup`, base `20cf9f9f` (origin/main). Full build OK, DOL SHA1 `26116613…`.
|
||||
|
||||
## Compiler version check (all three units)
|
||||
|
||||
`/tmp/o2-small/ccsweep.py` compiles the unit with every GC and Wii compiler using the unit's exact flags (`-ipa file` dropped for GC/1.x-2.x, `NO_INLINE` stripped where those can't parse it) and counts instruction-exact functions.
|
||||
|
||||
| Unit | GC/1.x-2.7 | GC/3.0a3 … 3.0a5 | GC/3.0a5.2 | Wii 1.x |
|
||||
|---|---|---|---|---|
|
||||
| fa/pdm_partition | 5-7/20 | 19/20 (3.0a3 17/20 without NO_INLINE) | 19/20 | 15/20 |
|
||||
| nup/nup | 0/23 | 20-21/23 (GetAuditData 12) | 22/23 | 9-10/23 |
|
||||
| iplMemoryCardManager | does not compile | 25/26 (_create_icon 41) | 25/26 (_create_icon 37) | 22/26 |
|
||||
|
||||
All three stay on GC/3.0a5.2. `-proc` sweep for pdm (gekko, 750, 740, 7400, 7450, 603e, 604e, generic, 8xx, e300 …): gekko/750/740/7400 identical (19/20), every other model breaks other functions.
|
||||
|
||||
## Tooling built this round (all under /tmp/o2-small, not committed)
|
||||
|
||||
- `mwdbg/`: private copy of `_mwdbg` (shared lock) with extra PCode dump points: after backend optimizer (0x469383), around 0x596960(func,0) (0x4693a2/0x4693af, a no-op for scheduling), after the real first scheduling pass 0x5995c0(0) (0x4695dd), after 0x59a030 (store→load forwarding, 0x4695ee), before the second pass (0x469548).
|
||||
- `sim/sched750.py` + `model2.py`: the tw2004 (mitsevox/tw2004 tools/matching/sched750.py) GC/2.6 750 scheduler model, fixed for virtual CR fields (`cr10+` were not parsed) and record forms (`add. rD,…,cr0` defines cr0). GC/3.0a5.2's pick function (0x599920) and DAG builder (0x599ac0) were read from the binary: same rules as GC/2.6, except memory edges use the PCode alias objects (+0x1c, `0x5a0150`). Approximating that with "same base register" reproduces both scheduling passes of the pdm loop block exactly and 49/55 blocks over four pdm functions (the misses are blocks where one object is reached through two different base registers).
|
||||
|
||||
## libs/RVL_SDK/src/fa/pdm_partition: pdm_part_is_master_boot_sector (84/86 in repo)
|
||||
|
||||
- Plain-sum LE32 (`b0 + (b1<<8) + (b2<<16) + (b3<<24)`, same as the exact sibling's MBR_WORD) + indexed second loop: 21, equal size, exact add tree and loop 2. Only the first loop's byte-load schedule/registers differ.
|
||||
- First scheduling pass (0x5995c0(0)) input = initial code (the `*p_start` reload is still a `lwz`; 0x59a030 turns it into `mr` after the pass). Model reproduces our pass exactly: `s1` is picked over `s0` at cycle 2 because its shift makes one more successor ready.
|
||||
- Target register sharing (`s3`/`s1` in r9, `s0`/`s1<<8` in r11) needs a pre-allocation order with `s0` loaded before `s1` and `add (s2<<16)+s0` before `s1<<8`. Annealing over all register-consistent pre-allocation orders under the post-RA model: best 10 ('base' alias) / 8 (all memory ops ordered), never 0. Both residual spots are the same pattern: target issues the low byte load before a shift that frees the next load through an anti-dependence. So with these 24 instructions the target is unreachable; the original block had a different DAG (extra node or different alias edges).
|
||||
- Model experiments: an extra copy/zero-extend on `b0` in the first pass gives exactly the target load order (s3,s2,s0,s1 / c3,c2,c0,c1) but breaks the r11 sharing; keeping it through both passes (removed after) best 11.
|
||||
- Source variants tried this round (all 21 or worse): `& 0xFF`, `(pf_u8)`/`(pf_u16)` casts, `<< 0`, byte_at() helper, b0 local, u8-param make_u32 helper (all forms), u8 locals, pointer cursor, array-indexed first loop (24, same first-pass input), accumulator (43).
|
||||
|
||||
## libs/RVL_SDK/src/nup/nup: __nupParseServerInfo (66)
|
||||
|
||||
- Allocator: coloring order is descending vreg for these low-degree nodes; colour = lowest already-claimed callee-saved register that is free, else claim downward from r31 (regsim reproduces 162/162).
|
||||
- Per `__nupFindTag` expansion the vregs are: `start` = base, `endTag` = base+2, `startTag` = base+3, ret = base+4; `end` becomes a late temp (114, 120, …) because the backend copy propagation (0x596400) keeps the `strstr` result temp instead of the named `end` (declaring `end` first does not change that: it still becomes the temp).
|
||||
- Want-list for all 34 FindTag values built from the target. Arbitrary renumbering reaches 34/34 in regsim; constrained to in-block numbering also 34/34, but per-block orders differ: blocks 1-2 need (end < start < endTag < startTag), blocks 3-7 need (end < endTag < startTag < start). No single uniform order gets more than 26/34. Target block 2 claims r18 (end2) before blocks 3-7 reuse it.
|
||||
- Variants: end declared first 66, separate if-statements 469 (size).
|
||||
|
||||
## src/scene/memoryCard/iplMemoryCardManager: _create_icon (37)
|
||||
|
||||
- Callers (iplGCWindow) store the result in `const GXTexObj*`, and GXLoadTexObj takes `const GXTexObj*`. Declaring `create_icon`/`_create_icon` as returning `const GXTexObj*` (return type is not in the mangled name) with the banner-style helpers (`initIconTexture` returning `&cell.icon`, `initIconTextureCI`, `initIconPalette` with direct `&mFileCell[slot][file].iconTlut`) gives 11 with no casts. Address shapes all match; the only diff is the C8-path rotation slot*S r28/file*T r26/cellbase r27 (target r26/r27/r28).
|
||||
- regsim on the captured graph: either swapping the vreg numbers of the two IRO temps (file*T @2824 → r44, slot*S @2826 → r43) or adding the slot↔file*T interference that a `mulli`-before-`mullw` pre-allocation order would create gives the exact target colours.
|
||||
- IroCSE.c (rayanht/mwcc) shows temps are created in linear-IR order of each expression's first redundant occurrence (second loop of IRO_CommonSubs). Here that is the palette helper's address, where file*T is reached first. sol-r11's `cells` local fixes the order (3 diffs) but changes the TLUT address shape.
|
||||
- Variants tried (all ≥11): non-const `GXTexObj*` local 44, texture assigned before the palette 21, tlut local in helper 34, helper param types (u8/u16/u32/int/s16 × s32/u32/s16/u16/long) 11-91, `GXLoadTlut(initIconPalette(...))` 11, getter for the icon 44, `&(mFileCell[slot] + file)->…` 11 (same IR).
|
||||
|
||||
## Round 2 findings (same day)
|
||||
|
||||
### Landed locally
|
||||
- `6b6aeb4d` _create_icon 37 → 3: icon helpers mirroring the banner ones (palette helper walks `mFileCell[slot]`), `create_icon`/`_create_icon` return `const GXTexObj*` (iplGCWindow already stores the result as const; GXLoadTexObj takes const). No casts. Caller objects differ only in `.strtab`; DOL unchanged.
|
||||
- `7086ed4c` pdm_part_is_master_boot_sector 84 → 21: entries read with the file's existing `MBR_WORD` (same add tree as the exact pdm_part_get_start_sector), extent check indexed. Equal size; only the first loop's byte-load schedule differs.
|
||||
|
||||
### MWCC internals used (GC/3.0a5.2)
|
||||
- IRO dump: setting byte `[0x725e5c]` when the log is opened (bp at 0x5ed500) makes the compiler write `<source>.log` next to the source; also setting `[0x70f24d]` dumps the full linear IR after every IRO pass. Private mwdbg copy with its own gdb port (LD_PRELOAD bind remap) in /tmp/o2-small/mwdbg; run with `MWDBG_IRODUMP=full`. Delete the `.log` from the worktree afterwards.
|
||||
- IRO lowering order (rayanht/mwcc IrOptimizer.c): for a binary node the operand with the higher cost is lowered first, ties lower the RIGHT operand first; MUL behaves like cost+2. `&mFileCell[slot][file].x` becomes `((this + C) + slot*S) + file*T`, so file*T is serialized before slot*S.
|
||||
- IRO_CommonSubs mints a temp at the first redundant occurrence in that serialized order (IroCSE.c), and the backend numbers @temps in reverse creation order (earlier temp = higher vreg = coloured first).
|
||||
- IRO_SplitLifetimes renames a temp that is assigned on two exclusive paths: the later path's copy gets a new, late @temp (low vreg, coloured last).
|
||||
- PCode copy propagation (CopyPropagation.c) keeps a copy into a variable only if the variable is in the caller's initial named-object range or one of its uses is itself a move. This is why nup's helper `start` survives (`mr r3, start` feeds the second strstr) while `end` collapses into the late call-result temp.
|
||||
|
||||
### _create_icon status
|
||||
- The C8 rotation (slot*S r26 / file*T r27 / cellbase r28) needs slot*S coloured before file*T. Two sources were found that give it, neither complete:
|
||||
- `R2C2T2`: `GXLoadTexObj(initIconTexture(...))`, C8 `GXLoadTexObj(&mFileCell[slot][file].icon)`, `return &mFileCell[slot][file].icon` after the if/else. The join return makes the RGB and C8 file*T/cellbase temps one object; IRO_SplitLifetimes renames the C8 copies late → C8 exact. But the same join group merges the RGB GXInitTexObj argument with the post-call address (address kept across the call, r26), 8 diffs.
|
||||
- Row-pointer local in the palette helper (committed form): slot*S is minted first, but the TLUT address becomes `(row + file*T) + 0x112c` instead of `(row + 0x112c) + file*T`, 3 diffs.
|
||||
- Type experiments: with the original non-const return type, the RGB path recomputes after the call like the target (the const conversion of the GXInitTexObj argument keeps it out of the join group) but the C8 GXInitTexObjCI argument (non-const prototype) joins the group, 30. Making both GXInit prototypes match the real SDK (non-const) or both const: 27/33/46. SDK header restored each time; not changed.
|
||||
- Tiny-file probes (/tmp/o2-small/t): inner-index multiply is always minted first unless an earlier statement uses the bare row `cells[slot]`.
|
||||
- Function-scoped pragmas around _create_icon: wrapping alone changes size (+4), nothing below 34.
|
||||
|
||||
### nup
|
||||
- Pragma sweep (16 singles + all pairs, function-scoped) on __nupParseServerInfo: nothing below 66.
|
||||
- Literal-tag macro form: tag addresses are rematerialised each time (target keeps them in r22/r25-style registers), size 0x76c; per-block value/length locals: size 0x708. FindTag variants (end first, nested, result var, end+=, param order): 66 or worse.
|
||||
61
tools/decomp-assist/o3-idct.attempts.md
Normal file
61
tools/decomp-assist/o3-idct.attempts.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# o3-idct attempts
|
||||
|
||||
Worktree data-d11, branch agent/w1009/o3-idct (from origin/main 179cd4e3). 43U only.
|
||||
Unit: `libs/RVLMiddleware/TMC_JPEG/src/buffer/idct_block_var`.
|
||||
|
||||
Start: Lumi 11 diffs (O3 pragma), Col 51 diffs.
|
||||
|
||||
## What was wrong (Lumi)
|
||||
|
||||
- Post-RA scheduler model (`/tmp/opus-idct-sched/sched.py`, reproduces all 61 captured blocks)
|
||||
applied to our pre-RA order with only four values recoloured (scaled even rotation and odd
|
||||
difference rotation to r20, even sum and first even output to r10) gives the target order
|
||||
exactly. So the 11 diffs were pure colouring; no schedule or dataflow change was needed.
|
||||
- The retained source made the scaled rotation a split web of `rowC2` (`rowC2 = rot * 0xB5 >> 8`).
|
||||
MWCC's lifetime splitter (`fn_00459420` in the rayanht GC/1.x decomp) turns every web but the
|
||||
first-defined one into an `@` temp numbered after all named locals, so it is coloured early and
|
||||
takes r10. Named locals are numbered in reverse declaration order; single-use locals are forward
|
||||
substituted and become codegen temps numbered in statement order at their use.
|
||||
- regsim on that capture: no declaration order and no single renumbering reaches the target.
|
||||
With a named rotation, the even-sum temp has to be numbered between the rotation temps and the
|
||||
named locals (it must be created before the odd-part temps).
|
||||
|
||||
## The fix (Lumi exact, no pragma)
|
||||
|
||||
- Natural row pass in the 4x4 sibling's shape: even part first (`evenRotation = c2 - c6;
|
||||
evenSum = c2 + c6; ... scaled = evenRotation * 0xB5 >> 8; evenRotationSum = scaled + evenSum;`),
|
||||
then the odd part. Single-use `evenSum` is substituted and MWCC emits `add c6, c2`, as in the
|
||||
target; no reassociation (that came from the old statement order, not from the types).
|
||||
- mwdbg capture of that source (`runs/o3-idct-nat1`), vmap to the target, then an anneal over the
|
||||
order of named locals with regsim: cost 0. Declaring the locals in the solved order compiles
|
||||
to an exact Lumi at O3 and at the unit's O4, so the scoped `optimization_level 3` was dropped.
|
||||
|
||||
## Col (exact)
|
||||
|
||||
- Same natural row pass: 51 -> 28 diffs (dataflow now matches; the old source reassociated the
|
||||
even sum to `c2 + (rot + c6)`).
|
||||
- Compiler-in-the-loop declaration climb: 28 -> 13.
|
||||
- mwdbg capture of the climbed source (`runs/o3-idct-natcol1c1`): regsim reproduced it with only
|
||||
4 wrong registers; the declaration anneal reached cost 0 on four of five seeds and the solved
|
||||
order compiles to an exact Col. A duplicated `rowOddOutput2` statement left over from the splice
|
||||
was removed (still exact).
|
||||
|
||||
## Result
|
||||
|
||||
- Lumi 11 -> 0 diffs, Col 51 -> 0 diffs; `.text` byte-identical, pool identical, symorder ORDER OK.
|
||||
- Unit flipped to `Matching`; full build passes, main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
- No pragmas left in the file (the scoped `optimization_level 3` from #1322 is gone).
|
||||
- Gate: `GATE PASS`, code 2844/2844, functions 2/2, linked code 2844, 0 regressions.
|
||||
|
||||
## Method worth reusing
|
||||
|
||||
1. Make the source natural first and check the dataflow (here: copy the sibling 4x4 butterfly).
|
||||
2. Capture once with mwdbg, map every vreg to the target register (`/tmp/o3-idct/sched/vmap.py`,
|
||||
a copy of the opus-idct one with `andi.` added).
|
||||
3. Anneal the order of named locals with regsim against the full want map
|
||||
(`/tmp/o3-idct/sim/declsearch2.py <capture> <vmap.json> '{}' <seed> <steps>`), then write the
|
||||
declarations in that order. If temps are among the mismatches, no declaration order can fix it:
|
||||
change which values are named or where single-use values are consumed, and recapture.
|
||||
|
||||
Tools tried and not needed: per-function pragma sweep (no lead), grouping row/column declarations
|
||||
(breaks the match; the solved interleaving is required).
|
||||
71
tools/decomp-assist/o3-keyboard.attempts.md
Normal file
71
tools/decomp-assist/o3-keyboard.attempts.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# o3-keyboard attempts (tiInputForm calcCursorPos / LayoutByNW4R::create, tiString inputChar)
|
||||
|
||||
Worktree data-d4, branch agent/w1009/o3-keyboard, base 4789b7c3. Full build at base: DOL SHA1
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d. Baselines: calcCursorPos 8/326, create 120/356, inputChar 13/136.
|
||||
|
||||
## calcCursorPos: EXACT
|
||||
|
||||
The 8 differences were f29/f30 swapped between the glyph-rect zero and scale.x. Target order of the three
|
||||
loop-invariant FPRs is zero < scale.x < scale.y by virtual register number.
|
||||
|
||||
What decides it (verified with mwdbg traces and a per-pass capture, /tmp/o2-keyboard/cap-o3direct):
|
||||
- FPR numbering: named locals first (reverse declaration order), then IRO temps (reverse creation order:
|
||||
late @149xx return temps below early @98xx inline params), then codegen temps in codegen order.
|
||||
- In the helper form scale.x is the scaledExtent parameter temp @9875 (IRO), scale.y is a codegen load in
|
||||
the loop head, and the zero is a codegen load in the loop top. Codegen beats IRO, so zero lands above scale.x.
|
||||
- Computing `right` before `lineBottom` (scale.x loaded first) fixes the registers but breaks the loop-head
|
||||
schedule. A port of MWCC's list scheduler + 750 pipeline model (/tmp/o3-keyboard/schedsim.py, reproduces
|
||||
the direct, helper and width-first schedules exactly) shows the target schedule needs the height chain
|
||||
first with one copy into lineBottom (the helper form), or width-first with two chained copies after the
|
||||
height add. Backend VN (pass 0x5976e0) flattens copy chains inside the block, so the second option is
|
||||
impossible.
|
||||
- Fix: keep the helper form and hold the rect reset value in a named float local declared first. IRO does not
|
||||
propagate a constant into a deeper loop, so the local survives; declared first, it gets the highest
|
||||
named-local number, which colors it right after the two temps (f29). Assigned right before the loop.
|
||||
|
||||
Trials that did not work: 128 helper/direct mixes (best 8), width-first + named-local/chained/struct/array
|
||||
intermediates (7-8, structs 282+), nested inline height helper (7), per-function single/pair pragmas on
|
||||
width-first forms (opt_propagation off: 304, others unchanged), zero via named const global (folded, 8),
|
||||
inline returning 0.0f (propagated, 8), zero local declared inside the loop or right after scale (45),
|
||||
initialized at declaration (35), const local (propagated, 8).
|
||||
|
||||
Result: calcCursorPos 8 -> 0 differing, pool identical, tiInputForm 219 -> 220/221 exact.
|
||||
|
||||
## LayoutByNW4R::create: not exact (120)
|
||||
|
||||
All 120 differences are GPR renames. Target saved-register roles (verified instruction by instruction):
|
||||
r31 AnmPane vtable, r30 table base, r29 bindingName, r28 buttonIndex, r27 button, r26 animationPane,
|
||||
r25 animationIndex, r24 allocator, r23 this, r22 count, r21 NormalButtonAnmPane vtable,
|
||||
r20 zero/textBox/early zero, r19 file pointer (@13697), r18 resource (@10823)/editBuffer.
|
||||
|
||||
Coloring takes the lowest free register in the pool and adds new saved registers from r31 down, so this forces
|
||||
the coloring order ... allocator, this, count, NBAP-vtable, zero, textBox, file, resource. Simplify removes
|
||||
nodes in ascending vreg order per pass (regsim reproduces 137/137), so count must be removed right before
|
||||
`this` and right after the NBAP vtable temp (r164). Parameters are always r32-r34, named locals next (reverse
|
||||
declaration order), IRO temps next, codegen temps last. Scan degrees (/tmp/o3-keyboard/scans.py): count starts
|
||||
at 30 against K=29; `this` cannot stay >= 29 into pass 2 without spills. So count has to be a codegen temp
|
||||
numbered above r164, i.e. a hoisted load. It cannot be one: csButtonAnimations is global .data (STB_GLOBAL in
|
||||
the original object), loads through `button` are fIsPtrOp and CodeMotion never hoists those, and the inner
|
||||
loop calls functions. Unresolved contradiction; the target graph must differ in a way not found.
|
||||
|
||||
regsim: declaration order alone (params pinned) reaches 6/12; with count free as a high temp plus resource and
|
||||
file placed among named locals, 12/12. Tried: count removed (button.count in the condition: reloaded each
|
||||
iteration, 106), count in for-init / block / loop scope (133), const-ref inline helper owning the inner loop
|
||||
(106, still reloaded), addButtonAnimation body written into create with named file/resource (139, moved the
|
||||
vtable temps). Header experiment reverted.
|
||||
|
||||
## inputChar: not exact (13)
|
||||
|
||||
Per-pass capture (/tmp/o2-keyboard/cap-o3ic0) of the current source: the then-block `li mCount, 0` survives
|
||||
every pass. Findings that constrain the original:
|
||||
- GC3 VN records every li but only replaces li whose destination is a codegen temp (coalesce window); VN
|
||||
flattens copy chains to the first holder and deletes `mr d,s` when d already holds s; VN removes
|
||||
overwritten stores in the block.
|
||||
- The first indexed store keeps `slwi/sthx` with r6, so the index had two reaching definitions during both
|
||||
const-prop runs (0x622a20 at passes 02 and 15), and the second definition vanished afterwards (VN 19/25,
|
||||
DCE 20, coalescing, or post-regalloc VN). Only a copy or a window-temp li can vanish that late.
|
||||
- A named `wchar_t* out = input` for the terminator reproduces the target's separate second-store base
|
||||
(post-regalloc VN turns its addi into `mr r4,r5`), u32 index with `clrlwi` count: 60 diffs, only the
|
||||
then-block li left (rb2 in /tmp/o3-keyboard/ic2.txt).
|
||||
- Read-back then-blocks (n = out[n], n = *out, length scan) and ternary index/arms fold in IRO because IRO
|
||||
knows the buffer and n are zero (60-74). switch on u32 still compares with cmpwi (60-73).
|
||||
59
tools/decomp-assist/o3-small.attempts.md
Normal file
59
tools/decomp-assist/o3-small.attempts.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# o3-small attempts (2026-10-09)
|
||||
|
||||
Worktree `sol-low`, branch `agent/w1009/o3-small`, base `ad5b9dea` (origin/main). Full build OK and
|
||||
DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d` before, after nup, and after pdm (both units linked).
|
||||
|
||||
## libs/RVL_SDK/src/nup/nup: __nupParseServerInfo 66 -> 0 (unit flipped to Matching)
|
||||
|
||||
Root cause: the target colors every `__nupFindTag` strstr result as if it were an IRO temp created after
|
||||
inlining, in source order (start_1, end_1, start_2, end_2, ...). Our source had `start` as an inline
|
||||
local (inline object band) and `end` collapsed into the backend call-result temp (numbered last).
|
||||
|
||||
How it was found:
|
||||
- `/tmp/o3-small/nup/vmap2.py` maps every virtual register of an mwdbg capture to the target's
|
||||
physical register (final code aligned by PCode instruction address), giving a want map (92 vregs).
|
||||
- regsim relabel experiments (`/tmp/o3-small/nup/t5`-`t11.py`): no per-expansion order of the 4 values works
|
||||
(matches o2-small), but one band of all start/end values below the inline tag objects, ordered
|
||||
s1 > e1 > s2 > e2 ... (temps created in source order after inlining) gives 0/92 mismatches.
|
||||
- MWCC decomp (rayanht/mwcc): only `CInline.c:InlineWrapResult` creates `EFORCELOAD` (result of an
|
||||
expression-inlined call that contains a load or call), and IRO lowering turns it into a fresh temp.
|
||||
So both strstr calls must go through an expression-inlined function.
|
||||
- Prior art: Petari's MSL `cstring` (SMGCommunity/Petari libs/MSL_C/include/cstring) declares, for C++,
|
||||
`const char* strstr(const char*, const char*)` plus the const-correct overload
|
||||
`extern "C++" inline char* strstr(char*, const char*)`. NUP is C++ and passes `char*`.
|
||||
- Backend copy propagation (`CopyPropagation.c`) still folds `end` into the call-result temp unless a use
|
||||
block kills the copy; `end += strlen(endTag); return end;` does that (wrapper alone: 83, both: 0).
|
||||
|
||||
Change: `libs/MSL/include/string.h` gets the MSL C++ overload (C declaration unchanged for C), and
|
||||
`__nupFindTag` ends with `end += strlen(endTag); return end;`. Other C++ users of strstr
|
||||
(nup_nhttp, iplSetting, iplNandSDWorker, ut_ArchiveFontBase) only change `.strtab`/debug metadata;
|
||||
their code/data sections are byte-identical. nup: 23/23 exact, pool 28/28, symbol order differs only in
|
||||
label names (lbl_ vs @n, `pad$` vs `fillByte$` static name).
|
||||
|
||||
Tried first (all worse, reduced file `/tmp/o3-small/nup/red_base.cpp` scored registers only):
|
||||
value-first helpers (204/477), ternary helpers (478+), shared caller tagStart/tagEnd via pointers (89),
|
||||
call inside the if condition (66), non-inline helper (66), strstr wrapper on one call only (66/83).
|
||||
|
||||
## libs/RVL_SDK/src/fa/pdm_partition: pdm_part_is_master_boot_sector 21 -> 0 (unit flipped to Matching)
|
||||
|
||||
Root cause: the eight MBR byte loads are volatile in the target. Change: the parameter is
|
||||
`volatile pf_u8* buf` (C function, symbol unchanged; no prototype elsewhere; all reads go through it).
|
||||
|
||||
Proof that the target needs ordered (volatile) loads:
|
||||
- Pass-2 scheduler model (`/tmp/o2-small/sim/sched750.py` + `model2.py`) checked against the GC/3.0a5.2
|
||||
binary: pick 0x599920, DAG builder 0x599ac0, add_dependency 0x599e90, 750 can_issue 0x63c880,
|
||||
timing table built at 0x63c1b0 (record forms +2 latency via flags2 0x100000). It reproduces
|
||||
5875/6036 blocks of every mwdbg capture in `_mwdbg/runs` (failures are alias-object cases).
|
||||
- With the final 24 instructions and registers, no pass-2 input order reaches the target (random
|
||||
topological search: best 10 base alias, 8 all alias; every load/store alias subset: best 6;
|
||||
block-split partitions only at unnatural points). The blocker is cycle 2: `slwi r30,r9,24` frees
|
||||
`lbz r9,0x1c7` (WAR) while `lbz r11,0x1c6` frees nothing, so the slwi must issue first.
|
||||
- Adding 0-latency load->load ordering edges (what GC3 adds for PCode flag 0x80 at 0x599b5b)
|
||||
makes the target a fixed point. mwdbg on the volatile build shows LBZ flags 0xa2 (0x22|0x80).
|
||||
- Compiled: `volatile pf_u8* buf` gives 20/20 exact; use-site cast form also exact (not used).
|
||||
The buffer is filled by the disk driver (pdm_disk_physical_read) outside this function.
|
||||
|
||||
Tried first (all 19-85): 120 add-tree shapes (`/tmp/o3-small/v2.py`, reassociation pairs
|
||||
((A+B)+C)+D -> (C+A)+(D+B)), LE32 inline helpers (21), byte loops (43-97), `#pragma scheduling`
|
||||
once/twice/off and every processor model (21-83), Wii/1.x compilers (17-20, siblings break).
|
||||
`#pragma scheduling once` (pass 2 only) exists in GC3 and was never in the combosweep list.
|
||||
47
tools/decomp-assist/odh-source-integrity.attempts.md
Normal file
47
tools/decomp-assist/odh-source-integrity.attempts.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# ODH source-integrity checks
|
||||
|
||||
Base: 3d7e767cf729de96ac1cd88ddbf5c18eaa08187d (43U only).
|
||||
|
||||
- Restored unsigned arithmetic in all three huffmanDecoder word refills by
|
||||
casting the shifted bytes to u32. The combined word and its bitOffset shift
|
||||
now remain unsigned, including input words with the high bit set.
|
||||
- Restored unsigned planeSize indexing in LineConv11. Chroma source pointers
|
||||
are only formed by accesses in the planar-format branch. The RGB565 caller
|
||||
passes a row-offset pointer into Capture's GXGetTexBufferSize allocation;
|
||||
for tile-aligned dimensions that allocation is exactly width*height*2 bytes.
|
||||
Unconditionally adding two planes to a nonzero row pointer could therefore
|
||||
form an out-of-bounds pointer even though RGB565 never dereferences it.
|
||||
- Reviewed the full huffmanDecoder rewrite against its preceding source.
|
||||
Other category shifts and caller/table preconditions were already present;
|
||||
no additional newly introduced arithmetic issue was identified in this pass.
|
||||
|
||||
One candidate, no compiler flags or other source changes. No debugger, compiler
|
||||
memory access, forced registers, assembly, uninitialized values, or online source
|
||||
references were used. Retail objects and disassembly remained local.
|
||||
|
||||
Validation:
|
||||
|
||||
- All allocated source-object sections, function spans, and resolved relocations
|
||||
are identical to the unmodified base object (debug metadata differs).
|
||||
- All 28 retail function spans are raw-byte exact: 14,684 bytes, with all 203
|
||||
relocations identical after resolving local symbols to actual section offsets
|
||||
and code symbols to function-relative targets.
|
||||
- Data matches: .rodata 5,856, .data 464, .sdata2 40 bytes. The source .data is
|
||||
459 bytes plus five zero alignment bytes in the split/link target.
|
||||
- Pool identical, 10/10 strings. huffmanDecoder ctxdiff: 306/306, zero diffs.
|
||||
LineConv11: 146/146; the strict-name local helper prints eight pre-existing
|
||||
label-name differences. Exact bytes, resolved relocation destinations, and
|
||||
referenced data independently match; none were ignored without resolution.
|
||||
- Official objdiff: ODH 28/28 functions; code, data, fuzzy and link all 100%.
|
||||
- Every measure, function and section in all 1,028 report units, plus all global
|
||||
measures, is unchanged from the base report.
|
||||
- Full 43U build and build/43U/ok pass. DOL SHA1:
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
- All 22 workflow-guard tests pass. A host UBSan refill test passes 524,288
|
||||
cases against a 64-bit oracle (every high byte, offsets 0..7).
|
||||
- The global completion checker still fails on pre-existing incomplete units;
|
||||
this change does not claim repository-wide completion.
|
||||
|
||||
Local reproducible evidence: ../odh-unsigned-refills-evidence/verify.py,
|
||||
verification.log, full-build.log, pool.log, guards.log, refill-test.cpp/log,
|
||||
completion.log, status.json and dol.sha1. No publication or merge performed.
|
||||
@@ -109,3 +109,35 @@ AOSS_Init_old 1306/1584, AOSSApplyAuthOptions 22/114, AOSSXorBufferWithKey 34/14
|
||||
AOSSData, 1128/1128). AOSS 18/21 exact (17 -> 18), code 7720 -> 8812/16192, ATERM 20/26 unchanged, pools
|
||||
identical, global matched code 97.12163 -> 97.15810, fuzzy 99.88565 -> 99.88839, data 100%, 0 forbidden, 0
|
||||
readability, DOL SHA1 OK.
|
||||
|
||||
# opus-aoss round 3 (2026-10-09): AOSSXorBufferWithKey, AOSS_Init_old
|
||||
|
||||
Worktree data-d1, branch agent/w1009/o-aoss at origin/main 72e9c8d6. Scratch
|
||||
compiles in /tmp/opus-aoss (same flags as ninja, 0.2 s per unit).
|
||||
|
||||
## AOSSXorBufferWithKey: 34 -> 0
|
||||
|
||||
mwdbg on the old forms (base, compound `^=`, `P = P ^ K`, `output` pointer)
|
||||
showed what decides the unrolled-loop registers. The second loop's index is
|
||||
an IRO temp split late, so it is numbered below the IRO CSE cursors
|
||||
(`packetHalf + index`, `keyMask + index`). With three per-copy values the
|
||||
cursors are high-degree and colored before the index, so the index never got
|
||||
r3. A function-scope `output` pointer (used for load and store) is a named
|
||||
local and survives; a single-use `mask` pointer inside only the second loop
|
||||
is propagated back into a CSE temp.
|
||||
|
||||
The fix is the same `mask` pointer used in both loops (the first loop writes
|
||||
the mask byte through it twice). Then both cursors stay named locals, the
|
||||
index temp is colored first (r3), mask (declared first) gets r4 and output
|
||||
r5, and `mask =` before `output =` gives the target add order.
|
||||
|
||||
| trial | differing |
|
||||
|---|---|
|
||||
| 14 loop-body spellings (compound, P^K, K^P, temps u8/u32/int, casts) | 37-57 |
|
||||
| 256-form sweep (P/K spellings x 16 bodies x shared/new index) | best 24 (`u8* output = &packetHalf[index]`) |
|
||||
| scoped pragma x every form above (15 pragmas) | best 24 |
|
||||
| `output`/`mask` function-scope, `mask` only in loop 2 | 24 |
|
||||
| `mask` in both loops, `output =` before `mask =` | 2 (add order) |
|
||||
| `mask` in both loops, `mask =` before `output =` | **0** |
|
||||
|
||||
Unit after: 20/21 exact, pool identical.
|
||||
|
||||
52
tools/decomp-assist/opus-aterm.attempts.md
Normal file
52
tools/decomp-assist/opus-aterm.attempts.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# opus-aterm attempts (ATERM, 2026-10-09)
|
||||
|
||||
Baseline 72e9c8d6: ATERM 20/26 exact; open: BuildEncryptedMessage 2, AutoConfigThread 3,
|
||||
AesExpandEncryptKey 6, DiscoverAccessPoints 17, BuildAssociationRequest 28, RunConfigProtocol 294.
|
||||
|
||||
## Pragma sweep (combosweep, GC/3.0a5.2)
|
||||
|
||||
Single and pairwise pragmas: no function improves (BEST = base for all six).
|
||||
|
||||
## Compiler version (new finding)
|
||||
|
||||
Compiled the unchanged ATERM.c with every GC/Wii compiler that accepts the unit's flags:
|
||||
|
||||
| compiler | exact | total diffs | AutoConfigThread |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| GC/3.0a3, 3.0a3.2, 3.0a3.3, 3.0a3.4, 3.0a5 | 21/26 | 347 | 0 |
|
||||
| GC/3.0a5.2 (previous) | 20/26 | 350 | 3 |
|
||||
| Wii/* | 7/26 | 1590+ | 5 |
|
||||
|
||||
GC/3.0a5 makes ATERMi_AutoConfigThread exact with no other function changing; pool identical,
|
||||
data 100%. The other third-party middleware in this project (Zi Corp eZiText, NHTTP, bte) is already
|
||||
built with GC/3.0a5. Set `mw_version="GC/3.0a5"` on ATERM.c.
|
||||
|
||||
## ATERMBuildEncryptedMessage (2: entry `mr r29,r7` / `mr r3,r27` swapped)
|
||||
|
||||
Read MWCC's scheduler (rayanht/mwcc decomp: Scheduler.c, MachineSimulation750.c) and wrote a model
|
||||
(/tmp/opus-aterm-sched/sim.py). It reproduces our entry block and six micro-tests exactly (count of
|
||||
unlocked successors, then height, then opcode rank mr < li, then program order; 2 IU slots).
|
||||
The entry block is scheduled once, before register allocation (block flag 8 stops the post-RA pass).
|
||||
Exhaustive search over that model: no order of the same ten PCode instructions with the parameter
|
||||
copies first gives the target, and no single extra/deleted instruction does either. The target order
|
||||
needs the copy of r7 to come after memset's first-argument move in the scheduler input.
|
||||
|
||||
## ATERMAesExpandEncryptKey (6 -> 0, EXACT)
|
||||
|
||||
The function is rijndaelKeySetupEnc from the public reference rijndael-alg-fst.c (Te4 = the
|
||||
substitution table, rcon = the round constants). Earlier forms (initialKey[] array + copy loop,
|
||||
hand-reassociated XOR trees) left the second key word's two XOR halves scheduled in the other order.
|
||||
Trials (all GC/3.0a5): array/scalar/direct stores x seven XOR associations: 9..268; reference
|
||||
GETU32 + reference loops verbatim: 3 (only cmplwi vs cmpwi); with the reference `int keyBits`: 0.
|
||||
|
||||
## ATERMDiscoverAccessPoints (17 -> 7)
|
||||
|
||||
mwdbg: callee-saved colors go r31 downward in decreasing vreg number. The three strength-reduced
|
||||
record pointers (entries[i].ssid, entries[i] base, entries[i].bssid) are compiler temps created in
|
||||
first-use order, so the target's increment order (ssid, base, bssid) means all three were indexed
|
||||
accesses, not named cursors. The descriptor start (scan buffer + 2) has r27 above them, so it is a
|
||||
loop-invariant expression hoisted after strength reduction, not a named local set before the loop.
|
||||
- indexed record fields, named firstDescriptor: 22 (increment order fixed, firstDescriptor r24)
|
||||
- descriptorWords = (u16*)scanBuffer + 1 inside the loop: 7; &((u16*)scanBuffer)[1]: 7;
|
||||
(u16*)(scanBuffer + 2) and (u16*)(scanBuffer + sizeof(u16)): 105 (size changes)
|
||||
Remaining 7: MAC formatter input pointer r9 vs target r5, low nibble r5 vs r9.
|
||||
47
tools/decomp-assist/opus-chansvm.attempts.md
Normal file
47
tools/decomp-assist/opus-chansvm.attempts.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# opus-chansvm: CHANSVm round (ConvertToFloatFromStr, WinEmuWrite, DateDtor, BlobGetHexString, BlobPackCommon, Step)
|
||||
|
||||
Worktree data-d2, branch agent/w1009/o-chansvm, base 72e9c8d6. Start: 227/233 exact.
|
||||
Scratch harness: /tmp/opus-chansvm (score.py compiles the unit with the Ninja flags and diffs every function).
|
||||
|
||||
## combosweep (single + pairwise pragmas, whole unit)
|
||||
|
||||
No setting improves any of the six functions (Float 2, Win 5, Date 7, Hex 14, Pack 47, Step 262).
|
||||
|
||||
## CHANSVmConvertToFloatFromStr: 2 -> 0 (exact)
|
||||
|
||||
Diff: target `lbz type; li 0; stw endPtr; cmplwi`, ours `... cmplwi; stw`.
|
||||
|
||||
Scheduler RE (mwcceppc 0x599ac0 builds the block graph bottom-up; 0x5a0150/0x5a0170 is Alias.c may_alias):
|
||||
a load gets an edge to every later store it may alias, with the load latency as delay. The `obj->type`
|
||||
load had the worst_case alias set, which contains the escaped local endPtr, so LBZ -> STW had delay 2
|
||||
and the compare won the cycle-2 tie. A load whose base register comes from a pointer-to-const (or
|
||||
restrict) variable gets a private pseudo-object alias instead (see zcanann/FFCC-Decomp
|
||||
tools/patch_compiler_rw.py notes), so the edge disappears and the store issues at cycle 1.
|
||||
|
||||
The inlined parser's `const` parameter is copy-propagated into the caller's `object`, so the const has
|
||||
to be on the caller's parameter. Small-harness check: const/restrict on the inline parameter alone keeps
|
||||
the old order; on the caller parameter it gives the target order.
|
||||
|
||||
| attempt | Float | others |
|
||||
|---|---|---|
|
||||
| `const CHANSVmObjHdr* object` on ConvertToFloatFromStr, `(VmConvertFunc)` cast at its table slot | 0 | no change |
|
||||
| VmConvertFunc typedef and all 11 converters take const, cast in StrFromArray | 0 | no change |
|
||||
| `#pragma opt_pointer_analysis on` (diagnostic) | compiler segfaults | - |
|
||||
|
||||
Kept the first (minimal) form. Same lever as CHANSVmParseInt (`const CHANSVmObjHdr* obj`).
|
||||
|
||||
## VmDateDtor: 7 -> 0 (exact)
|
||||
|
||||
Diff: target loads `MonthTbl[mon]` before the outgoing `year` stack-argument store; ours after it.
|
||||
Same mechanism: the stack-argument stores carry the worst_case alias, and global tables are members of
|
||||
it, so every store -> table-load edge had delay 2. The target object has no symbols for the two tables
|
||||
(0xb34, 0xb50 are unnamed local data), so they were never globals.
|
||||
|
||||
| attempt | Date | others |
|
||||
|---|---|---|
|
||||
| file-scope `static` on both tables | 7 | no change |
|
||||
| file-scope `static` on one table (each) | 7 | no change |
|
||||
| both tables as function-scope `static` inside VmDateDtor | 0 | no change, .data bytes identical |
|
||||
| plus direct `date.x` access instead of `datePtr` | 84 | - |
|
||||
|
||||
Kept function-scope statics with the datePtr form.
|
||||
53
tools/decomp-assist/opus-sdmem.attempts.md
Normal file
53
tools/decomp-assist/opus-sdmem.attempts.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# opus-sdmem attempts: SDMemory::drawTransferTitles
|
||||
|
||||
Unit `src/scene/sdChannelMemory/iplSDMemory`, branch `agent/w1009/o-sdmem` from `72e9c8d6`.
|
||||
Start: 363/451 differing, 447/451 instructions, 97.4102%. combosweep: no setting beats 363.
|
||||
|
||||
## Header loops: MSL's C++ `wcsstr` overload
|
||||
|
||||
The target's two guarded loops (`cmpwi; beq` / `addic.; ble`, then a preheader with
|
||||
`li rX, "\n"@sda21`, then `b test`) come from MWCC's `IRO_PullOutInvariantAssignments`
|
||||
(string `IRO_CopyLoopTestToLoopPreheaderAndBranchToSuccNode` in mwcceppc.exe). The pass
|
||||
needs a loop-invariant *assignment* inside the loop. A plain `wcsstr(p, L"\n")` has none,
|
||||
so no loop form, pragma, IRO level or `-O4,p` reproduces it in isolated tests.
|
||||
|
||||
Real MSL (`MSL_C/wstring.h`, see RushRE/SonicRushAdventure-Decomp tools/cw/include) declares,
|
||||
for non-embedded C++, `const wchar_t* wcsstr(const wchar_t*, const wchar_t*)` plus
|
||||
`inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2)` calling the const one. Calling it
|
||||
with a `wchar_t*` inlines the wrapper; its parameter assignment `s2 = L"\n"` is the
|
||||
invariant assignment the IRO pass pulls into a guarded preheader. Isolated test reproduces
|
||||
the target sequence instruction for instruction.
|
||||
|
||||
`message::Message::getMessage` already returns `wchar_t*`; the `Manager`/`System` wrappers
|
||||
now return `wchar_t*` too, so message pointers in this function are non-const and use the
|
||||
overload. The scoped `ppc_iro_level 1` is removed (it suppresses the pass) and the newline
|
||||
counter is a plain `while` loop.
|
||||
|
||||
Result: 88/451 differing, 451/451 instructions, 99.28603%.
|
||||
|
||||
Side effect: `LetterWriter::makeHeaderCaption` passed a call result straight to `wcsstr`;
|
||||
with the overload the literal is evaluated before the virtual call (100 -> 94%). A named
|
||||
`caption` local restores the target order (three spellings tested, all exact). Full report
|
||||
otherwise unchanged vs `72e9c8d6`, DOL SHA1 unchanged.
|
||||
|
||||
## Title colors: real NW4R `TextBox::SetTextColor(ut::Color top, ut::Color bottom)`
|
||||
|
||||
The two helpers after drawTransferTitles were invented names (`iplSDMemory_813EF6C4/6D8`
|
||||
before #254). Their bodies and placement fit weak header inlines that this large function
|
||||
did not inline: `nw4r::ut::Color::Color(int, int, int, int)` (four `stb`) and NW4R's
|
||||
`TextBox::SetTextColor(ut::Color top, ut::Color bottom)` (by-value colors, two calls to the
|
||||
weak `Color::operator=`; same inline in hotlandsoftware/wii-news-channel, declared in Petari).
|
||||
By-value arguments explain the retail stack: the named color sits with the other named
|
||||
locals, the two argument copies are temporaries in source order, the snapshot comes last.
|
||||
`textBox.h` now has that overload instead of the `IPL_SDMEMORY_SET_TEXT_COLORS` hack, the
|
||||
source is `nw4r::ut::Color color(...); titleText->SetTextColor(color, color);`, and
|
||||
symbols.txt names the two functions `__ct__Q34nw4r2ut5ColorFiiii` and
|
||||
`SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color` (both 100%).
|
||||
|
||||
The N_Body alpha loop is written in place like the header/footer loops: through the
|
||||
`setChildrenAlpha` inline its iterator temporaries were allocated after the footer's
|
||||
(inline expansion runs after parsing), retail has them in source order.
|
||||
`titleOffset -= visibleRows * rowHeight` fixes the `fmuls` operand order.
|
||||
|
||||
Result: 50/451 differing, register-blind identical apart from the renamed call targets,
|
||||
99.39024%. Pool and .data/.sdata/.sdata2 identical; full report unchanged otherwise; DOL OK.
|
||||
8
tools/decomp-assist/pdm_partition.attempts.md
Normal file
8
tools/decomp-assist/pdm_partition.attempts.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
## w1011/struct2 wave-2 verification
|
||||
|
||||
- is_master_boot_sector residual re-decoded: both objects emit the SAME
|
||||
add tree ((b0 + b2<<16) + (b1<<8 + b3<<24)) for read_partition_u32 —
|
||||
the + macro form is correct. All 7 residual lines are the load/shift
|
||||
INTERLEAVE order (base loads b3,b2,b0 then shifts; mine b3,b2,b1).
|
||||
Pure scheduler tie — scheduling pragmas previously probed, no lever.
|
||||
@@ -39,3 +39,19 @@ Measured trials:
|
||||
- static initializer attempt 1: src 0x64 base 0x64 insns 25/25; diffs 0: []
|
||||
- static initializer attempt 2: src 0x64 base 0x64 insns 25/25; diffs 22: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
|
||||
- static initializer attempt 3: src 0x64 base 0x64 insns 25/25; diffs 0: []
|
||||
|
||||
## w1011/struct2 continuation (createAnmPane_)
|
||||
- WIN: `const PaneToAnimation* p = &scCandidatePaneData.panes[i]` (pointer, not ref) → 215v216→216v216, fuzzy 92.89→98.91. Base reloads `p->pAnims[j]` through the array slot (lwz 0x20(r23)) per use; ref-form folded the element into a pinned reg.
|
||||
- Regressions reverted: forceAddName moved into loop scope (118 ops), u32 j (86), int i (236), inline p->pAnims[j] at both uses (220), uninit-decl forms.
|
||||
- Residual ~77 reg-name ops = pure coloring: base homes `p+j*4` slot web in r23, panes-base in r24, zero-web in r26; mine r30/r23/r25. Birth-order levers exhausted.
|
||||
- `create` (352v352): insn-identical modulo branch targets; only `lfs f0,0(x)` anonymous .rodata ref offset differs (ties to .data granularity: mine names scPaneNameTable/scW_*/scN_* strings, base emits @9934-@9943 anonymous locals + base lacks mine's `__vt__textinput::gui::GUIComponent` weak emission; scCandidatePaneData 1676 vs 1664B).
|
||||
- `CalcPaneLocate_` (435v435): byte-identical modulo relocs.
|
||||
- loadCardFileIcons (iplCardSequence): 508v512 (-4): base emits extra `li r?,0; stb` zero-init pairs (per-path dead zero-webs) + separate addis/addi addr materialization where mine fuses; untreated structural gap.
|
||||
|
||||
## struct2 wave — structural decode probe
|
||||
|
||||
- `const AnimationFile* animation` (pointer) vs `const&` reference: 50->45
|
||||
diff lines — pointer form closer (matches the p->pAnims[j] slot reload
|
||||
idiom used for p itself). Committed.
|
||||
- Hoisted `const AnimationFile* const* anims = p->pAnims` — no change (45).
|
||||
- Remaining residual = callee-web coloring (same tie family).
|
||||
|
||||
@@ -490,3 +490,77 @@ forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## w1011/struct2 probes (drawCursor/calcCursorPos)
|
||||
- calcCursorPos (326 insns): already byte-identical modulo branch targets — report fuzzy 91.59 was reloc-scoring, no real residual.
|
||||
- drawCursor (70v70): eval-order tie. Base completes `opacity = f32(muGlobalAlpha)/255.0f` fsubs+fdivs BEFORE loading GXColor R/G/B bytes; mine hoists the lbz loads above the fdivs. Moving `GXColor color` decl later regressed 68v70 (splits the loads differently). Kept baseline form; documented sched-order tie.
|
||||
|
||||
## struct2 wave 3 — extern "C" const architecture decoded
|
||||
|
||||
MWCC const-fold vs SDA rule for `extern "C" const` objects:
|
||||
- Source ref folds to anonymous @NNNN pool object when the DEF (with init) is
|
||||
VISIBLE at the use. Ref emits named SDA only when use sees extern decl and
|
||||
def is later (defs at EOF + decls up top) => all value-uses named.
|
||||
- Generated conversion magics (u32/s32->f32/f64) dedup into same-valued named
|
||||
objects INCONSISTENTLY (autoScroll signed conv deduped to
|
||||
scInputFormF32ConvertMagic; init + drawCursor unsigned convs did NOT) —
|
||||
appears tied to .sdata2 emission order (anon pools emit in fn order; defs
|
||||
at EOF emit last). Unresolved: how orig got every generated magic named.
|
||||
- .sdata2 layout = emission order = DEF ORDER when defs precede fns.
|
||||
Base order: ZeroF,640F,F32ConvertMagic(8B),OneF,HalfF,DegToFIdxF,150F,30F,
|
||||
50F,10F,52F,TwoF,140F,90F,253F,20F,ColorR/G/B/A u8s,255F,127F,14592F,
|
||||
[4B pad],F64ConvertMagic(8B),15F,[pad] — copied verbatim to EOF def block.
|
||||
- ALL inline float literals in the file's fn bodies were swapped to named
|
||||
refs (150F/30F/50F/10F/52F/140F/90F/253F/20F/15F/640F/255F/127F/14592F/
|
||||
DegToFIdxF/OneF/HalfF/TwoF/ZeroF + Color*u8). Mass .sdata2 184->124B.
|
||||
- Out-of-namespace uses (fns defined qualified-style at global scope) need
|
||||
textinput::inputform:: qualification (~97 sites).
|
||||
- drawCursor: plain static_cast<f32>(u8/u32) emits the right
|
||||
lis/lbz/stw/stw/lfd/fsubs seq; residual = magic operand @NNNN vs named +
|
||||
eval-order (~11 diff lines). Union-pun form (u32[2]+f64, subtract named
|
||||
magic) gives named operand but fsub+frsp instead of fsubs — WORSE.
|
||||
- autoScroll: orig used `* scInputFormHalfF` not `/ scInputFormTwoF`.
|
||||
- textdrawer::Base() header ctor literals (mfVIWidth 640 etc) — named-const
|
||||
via header gate tried+reverted (orig likely defines ctor in cpp; also
|
||||
regressed sdata2). ctor anon pair {0,640} + GetTextColor {ffffff00,0}
|
||||
remain anonymous.
|
||||
- REMAINING: init @13881 (signed magic dedup didn't fire), ctor pair,
|
||||
GetTextColor pair, drawCursor operand/scheduling, then 'create'.
|
||||
|
||||
Post-rebase states: Base::create(73i) normalized-identical (branch-target
|
||||
artifacts only). LayoutByNW4R::create(357i) residual = callee-web rotation
|
||||
(mine r20/r21/r28 vs base r23/r24/r30) + anonymous 0-operand pools; pure
|
||||
coloring. Unit fuzzy 99.54, data 100.
|
||||
|
||||
## create residual wave (w1011 round 2) — 120 -> 88 normalized diffs
|
||||
|
||||
- `u16` ButtonAnimations::count field + `u16 count` local lands count in base's r22
|
||||
home (late allocator pin). u32/int/s32/short all keep the early pin (~150). Mechanism
|
||||
is likely the u16 narrowing producing a secondary codegen-ordered temp.
|
||||
- Remaining 1 structural diff: `lhz` vs base `lwz` at the count load — orig's web is
|
||||
u32-typed (lwz) yet allocator-late. u32-field+u16-local adds a clrlwi (worse).
|
||||
- declsearch on the 15-local decl block: moving `Info_* selected` up (2nd) and
|
||||
`void* memory` down (11th) fixed 3 renames; converged after 80 evals.
|
||||
- Pointer-param `addButtonAnimations` helper (count load as IRO temp): lands r30
|
||||
(IRO temps number reverse-creation — late inline = LOW temp no. = early pin).
|
||||
`button->count` bound inside helper reloads per-iter (fIsPtrOp, no LICM hoist).
|
||||
- bindingName/count direct member uses, comma decl, split-web `count=0;count=...`,
|
||||
stmt-order swaps on previous/next/selectedIndex: all no-ops or worse.
|
||||
- Residual ~86 renames: mriManager rows/selected/previous/next expression-temp band
|
||||
(r4-r8 volatile order) + residual saved-reg permutations — same tie family.
|
||||
|
||||
- REVERTED: the u16-field form shrinks csButtonAnimations .data bytes (00 08 vs
|
||||
00 00 00 08) — unit matched_data 100 -> 27.5. u32 field + u16 local emits
|
||||
lhz+clrlwi (171). declsearch order alone scored worse under normalized diff
|
||||
(147 vs 150 baseline). Net: create restored to upstream baseline; the
|
||||
u16-numbering mechanism is documented but no usable form found — count's web
|
||||
must be u32-typed AND allocator-late, unproducible so far.
|
||||
|
||||
- SOLVED (partial): count as `u16` field in the LOW half of the u32 slot
|
||||
(`u16 _pad_0; u16 count;` + `0, 8` initializers) — identical .data bytes,
|
||||
u16 web lands at base r22. + declsearch order = 73 normalized diffs.
|
||||
`#pragma opt_propagation off` scoped to create: 176 (regresses).
|
||||
Shared `memory` var across the two allocs: 150 (no-op — single-use defs
|
||||
forward-substitute either way). Residual: rows-copy loop expression-temp
|
||||
orderings (r5-r8 numbering) + callee-home perms (r18/r20 vs r25/r27) —
|
||||
same volatile-temp tie family as before.
|
||||
|
||||
@@ -28,3 +28,53 @@ call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documente
|
||||
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
|
||||
clrlwi (u16) — count is i.
|
||||
Unresolved: what source produces symbolic-index stores + dead compare.
|
||||
# tiString attempts
|
||||
|
||||
## inputChar mode-3 indexed block (upstream main @10146c1b)
|
||||
|
||||
- Base emits `li r6,0; sth r6,0x10; slwi r0,r6,1; addi r5,r1,0x10;
|
||||
sthx r4,r5,r0; addi r6,r6,1; mr r4,r5; li r5,0; slwi r0,r6,1;
|
||||
clrlwi r29,r6; sthx r5,r4,r0; sth r5,0x42` — input[count] INDEXED
|
||||
stores with count a register-born (li+addi) SYMBOLIC web. MWCC folds
|
||||
the FIRST store to immediate offset (count=0 proven) but keeps later
|
||||
stores indexed — index var must be non-const-folded.
|
||||
- Decode: orig's mode-3 path is NOT CharacterOutput (inlines to folded
|
||||
immediates). It's `count=0; input[count]=0; input[count++]=ch;
|
||||
input[count]=0; count` — semantics confirmed; the wall is making
|
||||
count's web symbolic.
|
||||
- ~13 forms: u16/u32/int index locals (all const-propped), struct-with-
|
||||
inline-buffer member index (stays MEMORY: real stw/lwz — too far),
|
||||
CharacterOutput direct + pointer-call (fully promotes + folds),
|
||||
post-inc index (folds). Register-born symbolic web needs phi/call/
|
||||
member-load provenance — none found that emits base's li-born shape.
|
||||
|
||||
## inputChar mode-3 wave-2 (fuzzy 90.8 -> 94.34, still <100)
|
||||
|
||||
PROVEN mechanism — the symbolic index web: base's `slwi r0,r6,1` reads a web
|
||||
with NO definition instruction anywhere in the function. An UNINITIALIZED local
|
||||
(`s32 idx;`) produces exactly that shape: MWCC emits indexed `slwi`+`sthx`
|
||||
reading the undef web's assigned register — the #1270 retail-uninit-read
|
||||
exception applies (the `li r6,0` writes a DIFFERENT web — the store operand).
|
||||
Committed form uses `count = mTranslateMode - 3` instead (fuzzy 94.34, better
|
||||
than undef-idx 92.61 — the undef web homes to r3 and breaks coloring; with
|
||||
`u32 inputIndex` shared with the kana loop it pins r28 = worse). Undef-idx
|
||||
variants give the most faithful structure: `sth`-first-store + indexed sthx +
|
||||
`clrlwi r29,idx-web,0x10` tail all match; only reg home (r3 vs r6) and
|
||||
in-place `addi r6,r6,1` vs new-web `addi r5,r3,1` differ.
|
||||
|
||||
Wall boundary (~30 forms): `li`-born + symbolic is unproduced —
|
||||
`x-x`, `x&0`, `ch-ch`, `input-input`, `x*0`, comma-exprs, `?:`, empty-ifs,
|
||||
phi arms all either fold to `cmpwi`-path or emit real insns (addi/subf/xori).
|
||||
Dead `cmplwi r4,0xa` unproduced (comma/`||`/empty-if all drop it). `mr r4,r5`
|
||||
ptr copy + `li r5,0` zero web = same coalescer home-choice family as
|
||||
cardThreadMain. BEST KEPT: `count = mTranslateMode - 3; input[count] = 0;
|
||||
input[count] = ch; count++; input[count] = 0;` with `u16 count` (94.34).
|
||||
|
||||
## wave-3 — optimization_level pragma sweep (negative)
|
||||
|
||||
Per-fn `#pragma optimization_level 2|3` and whole-unit `-O2,p` probed on
|
||||
inputChar (g-idct lever): per-fn O2 → 134 insns, O3 → 133 (base 137);
|
||||
unit-level O2 → 133 insns / 91 opcode diffs (vs 57 at O4). Lower opt
|
||||
emits the same symbolic-index structure, just worse — orig is -O4,p.
|
||||
The undef-web birth (`slwi r0,r6,1` on a def-less web) is not an
|
||||
opt-level artifact.
|
||||
|
||||
@@ -644,3 +644,46 @@ forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## struct2 wave — idct_block_var (buffer/)
|
||||
|
||||
- IRO probe (directive): ppc_iro_level 0/1/2 all REGRESS Lumi (IRO-0 emits
|
||||
branchy clamp tails — +29 insns 286v257). Reverted. This fn needs the
|
||||
DEFAULT level: its residual was fold-canonicalization, not over-folding.
|
||||
- clampU8 tail: `if (v<0) return 0; return 255;` (2 stmts) emits branchy
|
||||
cmpwi/bge/li/b/li; single `return v<0?0:255;` emits base's mask fold
|
||||
(srawi .1f + andc 0xff). Single-ternary decode: Lumi 258->257 (exact),
|
||||
_Col 455->454 (exact). Both insn counts now match.
|
||||
- Residual: or-chain operand order `or ACC,ACC,NEW` vs base `or ACC,NEW,ACC`
|
||||
— coalescer canonicalizes operand order regardless of source order
|
||||
(reversed `x | acBits` tried, unchanged) — allocator-side coalescing
|
||||
choice, not source-reachable (same wall as texturecvtr or-chains).
|
||||
Remaining diffs are pure reg-renaming in the IDCT butterfly.
|
||||
|
||||
## Scheduling/opt pragma probes (directive wave)
|
||||
|
||||
- MWCC scheduling pragmas probed per-fn via push/pop on the or-chain /
|
||||
scheduling-interleave / coloring residuals:
|
||||
- idct Lumi: `scheduling off` 38->33 diff lines but 257 insns kept and
|
||||
serializes loads (not closer per-insn); `scheduling 601/602/603` 35;
|
||||
`schedule_twice` 38; `peephole off` 18 lines BUT +23 insns (280v257,
|
||||
breaks rlwinm. fusion) — all net regressions or ties.
|
||||
- pdm is_master_boot_sector: baseline 7; `schedule_twice` 7 (same);
|
||||
`scheduling 601` 16; `scheduling off` 31; `peephole off` 22 — all worse.
|
||||
- cardSequence loadCardFileIcons (-1 phi tie): `scheduling off`,
|
||||
`schedule_twice`, `peephole off` all 511 insns unchanged — pragma does
|
||||
not reach pinned-result phi-coalescing.
|
||||
- tiCandidateBox createAnmPane_: baseline 50; `schedule_twice` 50;
|
||||
`scheduling off` 66; `peephole off` 54 — coloring tie stands.
|
||||
- CONCLUSION: or-operand order (or ACC,NEW,ACC vs ACC,ACC,NEW) is set by
|
||||
the coalescer's dst-operand choice, upstream of the scheduler; phi
|
||||
ties are upstream of both. No MWCC scheduling/peephole pragma reaches
|
||||
these — source-level and pragma levers exhausted on these walls.
|
||||
|
||||
## w1011/struct2 wave-3 — or-chain serial probes
|
||||
|
||||
- `acBits = acBits | x` (explicit self-assign) produces a SERIAL
|
||||
or-chain (was pairs-tree) — but operand order still canonicalizes
|
||||
to `or ACC,ACC,NEW` regardless of textual `x | acBits` vs
|
||||
`acBits | x`. Normalized diff unchanged (25). Committed `|=`
|
||||
kept — identical score, cleaner source.
|
||||
|
||||
Reference in New Issue
Block a user