Compare commits
41 Commits
agent/w101
...
agent/w100
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d630361de | ||
|
|
ef3e9df9dc | ||
|
|
587d640ddf | ||
|
|
60f6583e56 | ||
|
|
183c61ace2 | ||
|
|
d2a123cc06 | ||
|
|
00b26b2e79 | ||
|
|
de4c63b4df | ||
|
|
e02ee681ba | ||
|
|
641927194a | ||
|
|
378258fcdb | ||
|
|
b275eb2d99 | ||
|
|
e47a8e949d | ||
|
|
fa7f4c26e8 | ||
|
|
239334ba8d | ||
|
|
179cd4e3c3 | ||
|
|
09fc62528e | ||
|
|
dbbdc3dd98 | ||
|
|
4789b7c32f | ||
|
|
ad5b9deae3 | ||
|
|
5046adc6da | ||
|
|
87214ff944 | ||
|
|
54ca052b41 | ||
|
|
2ce8487681 | ||
|
|
47fe453260 | ||
|
|
2d4cfa7094 | ||
|
|
e27d9e090a | ||
|
|
983a6a2448 | ||
|
|
c1e1157d8b | ||
|
|
005d3734f0 | ||
|
|
55891734ae | ||
|
|
20cf9f9f25 | ||
|
|
2a7cc791b1 | ||
|
|
b2c43f5a66 | ||
|
|
d9b8013644 | ||
|
|
40b87edd73 | ||
|
|
3d7e767cf7 | ||
|
|
10146c1b5f | ||
|
|
82783c6edb | ||
|
|
72e9c8d658 | ||
|
|
0062d65a27 |
@@ -42,7 +42,7 @@ AppLoaderHdr = .bss:0x810ABF40; // type:object size:0x20 align:32 data:4byte
|
||||
bi2 = .bss:0x810ABF60; // type:object size:0x2000 align:32 data:4byte
|
||||
UpdateDiskID = .bss:0x810ADF60; // type:object size:0x20 align:32 data:4byte
|
||||
TicketViewsBuf = .bss:0x810ADF80; // type:object size:0x3600 scope:local align:32
|
||||
Flags0 = .bss:0x810B1580; // type:object size:0x800 scope:local
|
||||
Flags0$1129 = .bss:0x810B1580; // type:object size:0x800 scope:local
|
||||
Flags1 = .bss:0x810B1D80; // type:object size:0x800 scope:local
|
||||
Thread = .bss:0x810B2580; // type:object size:0x318 scope:local
|
||||
UpdateHeader0 = .bss:0x810B38A0; // type:object size:0x20 scope:local
|
||||
@@ -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
|
||||
@@ -17727,7 +17727,7 @@ __vt__Q39textinput4util9Animation = .data:0x8165D258; // type:object size:0x24
|
||||
@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl = .data:0x8165D28C; // type:object size:0x41 data:string
|
||||
scT_prdc_Text_00 = .data:0x8165D2D0; // type:object size:0xF data:string
|
||||
scP_prdc_scrl_Left = .data:0x8165D2E0; // type:object size:0x11 data:string
|
||||
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x680
|
||||
csPaneToAnimation__Q29textinput12candidatebox = .data:0x8165D2F8; // type:object size:0x680 scope:local
|
||||
@9934 = .data:0x8165D978; // type:object size:0x9 scope:local data:string
|
||||
@9935 = .data:0x8165D984; // type:object size:0x9 scope:local data:string
|
||||
@9936 = .data:0x8165D990; // type:object size:0xB scope:local data:string
|
||||
@@ -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
|
||||
|
||||
28
configure.py
28
configure.py
@@ -658,7 +658,7 @@ config.libs = [
|
||||
Object(Matching, "system/iplChannelRsoThread.cpp"),
|
||||
Object(Matching, "system/RsoSystem.cpp"),
|
||||
Object(Matching, "system/iplCdbBackup.cpp"),
|
||||
Object(NonMatching, "system/odh.cpp"),
|
||||
Object(Matching, "system/odh.cpp"),
|
||||
Object(Matching, "system/iplSDVFWorker.cpp"),
|
||||
Object(Matching, "system/iplNandWrapper.cpp"),
|
||||
Object(Matching, "system/main.cpp"),
|
||||
@@ -718,8 +718,8 @@ config.libs = [
|
||||
Object(Matching, "BS2/BS2Entry.c"),
|
||||
Object(Matching, "BS2/BS2.c"),
|
||||
Object(Matching, "BS2/BS2Init.c"),
|
||||
Object(NonMatching, "BS2/BS2Mach.c"),
|
||||
Object(NonMatching, "BS2/BS2Update.c"),
|
||||
Object(Matching, "BS2/BS2Mach.c"),
|
||||
Object(Matching, "BS2/BS2Update.c"),
|
||||
Object(Matching, "BS2/BS2ParentalControl.c"),
|
||||
Object(Matching, "BS2/BS2BringUp.c"),
|
||||
Object(Matching, "BS2/BS2Reset.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", [
|
||||
@@ -912,7 +912,7 @@ config.libs = [
|
||||
Object(Matching, "keyboard/tiPcKeyboard.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiCellPhone.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiPredictLang.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -942,7 +942,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("channelScript", [
|
||||
Object(NonMatching, "channelScript/CHANSVm.c"),
|
||||
Object(Matching, "channelScript/CHANSVm.c"),
|
||||
Object(Matching, "channelScript/systemmenu/VmSystem.c"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSSystem.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSLayout.cpp"),
|
||||
@@ -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"),
|
||||
]
|
||||
@@ -1886,7 +1886,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("kbd", [
|
||||
Object(NonMatching, "kbd/kbd_lib.c"),
|
||||
Object(Matching, "kbd/kbd_lib.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_jp.c"),
|
||||
Object(Matching, "kbd/kbd_lib_map_us.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_eu.c"),
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace textinput {
|
||||
|
||||
class Base : public CommandSender {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
Base(Manager* manager) : mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
|
||||
#endif
|
||||
virtual ~Base();
|
||||
@@ -114,7 +114,7 @@ namespace textinput {
|
||||
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
#endif
|
||||
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) override; // 0x18
|
||||
@@ -302,7 +302,7 @@ namespace textinput {
|
||||
// TODO
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mEventHandler(this), mpTiString(NULL),
|
||||
mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this), mOnOffButton(3, this, this),
|
||||
@@ -371,6 +371,15 @@ namespace textinput {
|
||||
bool mbActive;
|
||||
};
|
||||
|
||||
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
class CandidateTextAnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
CandidateTextAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -31,444 +31,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;
|
||||
|
||||
@@ -396,6 +396,8 @@ static void kbdProcKey(u32 key, u32 pressed, u32 channel) {
|
||||
kbdSendKey(&event);
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma opt_propagation off
|
||||
static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
|
||||
KBDChannel* data;
|
||||
u32 modState;
|
||||
@@ -524,6 +526,7 @@ static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
|
||||
finalState = modState | 0x1000;
|
||||
KBDSetModState(channel, finalState);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
static void kbdSendKey(KBDKeyEventData* event) {
|
||||
KBDChannel* data;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT] = {0};
|
||||
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT] = {0};
|
||||
static OSThread Thread = {0};
|
||||
static u8 ThreadStack[4096] = {0};
|
||||
static BS2UpdateHeader UpdateHeader0 ALIGN32 = {0};
|
||||
static BS2UpdateHeader UpdateHeader1 ALIGN32 = {0};
|
||||
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
|
||||
static OSThread Thread;
|
||||
static u8 ThreadStack[4096];
|
||||
static BS2UpdateHeader UpdateHeader0 ALIGN32;
|
||||
static BS2UpdateHeader UpdateHeader1 ALIGN32;
|
||||
|
||||
BS2UpdateEntry DiscEntries[BS2_UPDATE_ENTRY_COUNT] ADDRESS(0x80480000);
|
||||
|
||||
@@ -50,32 +49,8 @@ char* getSuffix(const char* path) {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
void BS2UpdateInit(void* allocator) {
|
||||
BS2Report("initialize BS2Update\n");
|
||||
ConsoleType = OSGetConsoleType();
|
||||
VersionES = __OSGetHollywoodRev();
|
||||
VersionMEM2 = OSGetPhysicalMem2Size();
|
||||
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
|
||||
BS2Report("Console Type : %08X\n", ConsoleType);
|
||||
BS2Report("Hollywood Rev : %08X\n", VersionES);
|
||||
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
|
||||
MemAllocator = allocator;
|
||||
State = 0;
|
||||
CurrentEntry = NULL;
|
||||
pEntries = NULL;
|
||||
EntriesCount = 0;
|
||||
memset(DiscEntries, 0, 0x40000);
|
||||
memset(EntriesToImport, 0, 0x40000);
|
||||
memset(Flags1, 0, sizeof(Flags1));
|
||||
BS2Report("Create update thread\n");
|
||||
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
|
||||
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
|
||||
OSResumeThread(&Thread);
|
||||
}
|
||||
|
||||
static inline u32 BS2SelectUpdateEntries(void) {
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
|
||||
BOOL missingFile;
|
||||
u32 index;
|
||||
u32 selectedCount;
|
||||
@@ -418,6 +393,31 @@ selection_complete:
|
||||
return selectedCount;
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
void BS2UpdateInit(void* allocator) {
|
||||
BS2Report("initialize BS2Update\n");
|
||||
ConsoleType = OSGetConsoleType();
|
||||
VersionES = __OSGetHollywoodRev();
|
||||
VersionMEM2 = OSGetPhysicalMem2Size();
|
||||
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
|
||||
BS2Report("Console Type : %08X\n", ConsoleType);
|
||||
BS2Report("Hollywood Rev : %08X\n", VersionES);
|
||||
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
|
||||
MemAllocator = allocator;
|
||||
State = 0;
|
||||
CurrentEntry = NULL;
|
||||
pEntries = NULL;
|
||||
EntriesCount = 0;
|
||||
memset(DiscEntries, 0, 0x40000);
|
||||
memset(EntriesToImport, 0, 0x40000);
|
||||
memset(Flags1, 0, sizeof(Flags1));
|
||||
BS2Report("Create update thread\n");
|
||||
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
|
||||
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
|
||||
OSResumeThread(&Thread);
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument) {
|
||||
u32 index;
|
||||
s32 importResult;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
||||
#define TI_CANDIDATEBOX_IMPLEMENTATION
|
||||
#define TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
#include "keyboard/tiCandidateBox.h"
|
||||
#undef TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
|
||||
#include "keyboard/tiManager.h"
|
||||
|
||||
@@ -60,11 +62,7 @@ namespace textinput {
|
||||
{ANM_InvalidOff, "fs_VK_predictInput_a_invalidMode_OFF.brlan"},
|
||||
};
|
||||
|
||||
struct CandidatePaneData {
|
||||
PaneToAnimation panes[26];
|
||||
};
|
||||
|
||||
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
|
||||
static const PaneToAnimation csPaneToAnimation[] = {
|
||||
{KT_CandidateText, "N_predictInput", 1, NULL, {&csAninationFile[0]}},
|
||||
{KT_ScrollButton,
|
||||
"P_prdc_scrl_Left",
|
||||
@@ -195,7 +193,7 @@ namespace textinput {
|
||||
6,
|
||||
NULL,
|
||||
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
|
||||
}};
|
||||
};
|
||||
|
||||
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
|
||||
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
|
||||
@@ -376,50 +374,44 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
|
||||
u32 animationCount;
|
||||
const char* forceAddName;
|
||||
u16 i;
|
||||
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
|
||||
const PaneToAnimation& p = scCandidatePaneData.panes[i];
|
||||
for (u16 i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
|
||||
const PaneToAnimation& paneAnimations = csPaneToAnimation[i];
|
||||
CandidateTextAnmPane* pane = NULL;
|
||||
switch (p.type) {
|
||||
switch (paneAnimations.type) {
|
||||
case KT_ScrollButton: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
|
||||
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(p.paneName), NULL);
|
||||
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(paneAnimations.paneName), NULL);
|
||||
break;
|
||||
}
|
||||
case KT_CandidateText: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateTextAnmPane));
|
||||
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(p.paneName), NULL);
|
||||
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(paneAnimations.paneName), NULL);
|
||||
break;
|
||||
}
|
||||
case KT_OnOffButton: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(OnOffAnmPane));
|
||||
pane = new (pBtnBuf) OnOffAnmPane(getPane(p.paneName), &mOnOffButton);
|
||||
pane = new (pBtnBuf) OnOffAnmPane(getPane(paneAnimations.paneName), &mOnOffButton);
|
||||
break;
|
||||
}
|
||||
|
||||
case KT_Window: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(PredictWindow));
|
||||
pane = new (pBtnBuf) PredictWindow(getPane(p.paneName), &mTextWindow);
|
||||
pane = new (pBtnBuf) PredictWindow(getPane(paneAnimations.paneName), &mTextWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
|
||||
forceAddName = p.forceAddName;
|
||||
animationCount = p.count;
|
||||
for (u16 j = 0; j < animationCount; j++) {
|
||||
const AnimationFile* const& animation = p.pAnims[j];
|
||||
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
|
||||
for (u16 j = 0; j < paneAnimations.count; j++) {
|
||||
void* pResource = mpMultiArcResourceAccessor->GetResource(0, paneAnimations.pAnims[j]->fileName);
|
||||
AnimTransformPane* transform =
|
||||
static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(pResource, mpMultiArcResourceAccessor));
|
||||
|
||||
if (forceAddName == NULL) {
|
||||
pane->addAnimation(allocator, animation->id, transform, false, true);
|
||||
if (paneAnimations.forceAddName == NULL) {
|
||||
pane->addAnimation(allocator, paneAnimations.pAnims[j]->id, transform, false, true);
|
||||
} else {
|
||||
pane->forceAddAnimation(allocator, animation->id, transform, forceAddName, false, true);
|
||||
pane->forceAddAnimation(allocator, paneAnimations.pAnims[j]->id, transform, paneAnimations.forceAddName, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,8 +670,8 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::cancelStateFocusIn() {
|
||||
const PaneToAnimation* pane = scCandidatePaneData.panes;
|
||||
for (int i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
|
||||
const PaneToAnimation* pane = csPaneToAnimation;
|
||||
for (int i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
|
||||
CandidateTextAnmPane* p = static_cast<CandidateTextAnmPane*>(searchAnmPane(pane->paneName));
|
||||
if (p != NULL) {
|
||||
switch (p->getKeyType()) {
|
||||
@@ -1766,3 +1758,48 @@ namespace textinput {
|
||||
|
||||
} // namespace candidatebox
|
||||
} // namespace textinput
|
||||
|
||||
inline void textinput::util::Animation::startAnm(AnimObserver* observer, f32 start, f32 end, f32 duration, void* data) {
|
||||
mfStartPoint = start;
|
||||
mfEndPoint = end;
|
||||
mfAnimationTime = duration;
|
||||
mfCurrentFrame = 0.0f;
|
||||
mbInAnimation = true;
|
||||
mpAnimObserver = observer;
|
||||
mpData = data;
|
||||
mbSE = false;
|
||||
if (observer) observer->onAnmEvent(AnimObserver::AE_0, data);
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::calc() {
|
||||
if (mbInAnimation) {
|
||||
if (mfCurrentFrame < mfAnimationTime) {
|
||||
mfCurrentFrame = 1.0f + mfCurrentFrame;
|
||||
} else {
|
||||
if (mbInAnimation && mpAnimObserver) {
|
||||
mpAnimObserver->onAnmEvent(AnimObserver::AE_1, mpData);
|
||||
}
|
||||
mbInAnimation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline f32 textinput::util::Animation::getValue() {
|
||||
return hermiteInterporation(mfCurrentFrame, 0.0f, mfStartPoint, 0.0f, mfAnimationTime, mfEndPoint, 0.0f);
|
||||
}
|
||||
|
||||
inline bool textinput::util::Animation::isActive() {
|
||||
return mbInAnimation;
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::setSEFlag(bool flag) {
|
||||
mbSE = flag;
|
||||
}
|
||||
|
||||
inline bool textinput::util::Animation::isSEFlag() {
|
||||
return mbSE;
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::stop() {
|
||||
mbInAnimation = false;
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,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) {
|
||||
Info_* listEnd;
|
||||
void* memory;
|
||||
nw4r::lyt::Pane* pane;
|
||||
const char* bindingName;
|
||||
u16 next;
|
||||
Info_* rows;
|
||||
u16 previous;
|
||||
void* handlerMemory;
|
||||
u32 count;
|
||||
u16 animationIndex;
|
||||
Info_* selected;
|
||||
nw4rmanager::AnmPane* animationPane;
|
||||
nw4r::lyt::TextBox* textBox;
|
||||
u16 selectedIndex;
|
||||
u32 buttonIndex;
|
||||
mpAllocator = allocator;
|
||||
textdrawer::Base::create(allocator);
|
||||
mpString = static_cast<tistring::Decolated*>(editBuffer->mpString);
|
||||
@@ -1117,18 +1146,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 +1167,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 +1179,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 +1191,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 +1271,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 +3131,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 +3156,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 +3174,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;
|
||||
}
|
||||
|
||||
@@ -171,7 +174,8 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
input[2] = 0;
|
||||
input[1] = 0;
|
||||
input[0] = 0;
|
||||
u16 count;
|
||||
u32 count;
|
||||
s32 mode = mTranslateMode;
|
||||
if (static_cast<u32>(mTranslateMode) - 1 > 1) {
|
||||
goto nonKana;
|
||||
}
|
||||
@@ -195,9 +199,21 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
}
|
||||
nonKana:
|
||||
if (mTranslateMode == 3) {
|
||||
CharacterOutput output(input);
|
||||
output.append(ch);
|
||||
count = output.finish();
|
||||
u32 ia[2];
|
||||
u32 i = 0;
|
||||
wchar_t *p = input;
|
||||
input[0] = i;
|
||||
if (mode == 3) {
|
||||
ia[1] = ia[0];
|
||||
}
|
||||
if (ch == L'\n') {
|
||||
i = ia[1];
|
||||
}
|
||||
p[i] = ch;
|
||||
i++;
|
||||
count = i;
|
||||
wchar_t *q = p;
|
||||
q[i] = 0;
|
||||
mKanaStream.mOutput[0] = 0;
|
||||
} else {
|
||||
count = 1;
|
||||
|
||||
@@ -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,9 +866,9 @@ 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:
|
||||
@@ -836,8 +889,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 +898,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
@@ -892,68 +892,62 @@ 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) {
|
||||
u32 planeSize = (u32)width * (u32)height;
|
||||
const s32* table = conversionTable;
|
||||
u32 pixelIndex = 0;
|
||||
|
||||
for (int i = 0; i < width; i++) {
|
||||
s32 red;
|
||||
s32 green;
|
||||
s32 blue;
|
||||
s32 red;
|
||||
s32 green;
|
||||
s32 blue;
|
||||
s32 cbValue;
|
||||
s32 crValue;
|
||||
|
||||
if (format == ODH_FORMAT_RGB565) {
|
||||
u8* pixelSource = source + (pixelIndex & 0x1FFFFFFC) * 8 + (pixelIndex & 3) * 2;
|
||||
u16 pixel = pixelSource[1];
|
||||
pixel |= (u16)pixelSource[0] << 8;
|
||||
red = (pixel >> 11) & 0x1F;
|
||||
green = (pixel >> 6) & 0x1F;
|
||||
blue = pixel & 0x1F;
|
||||
} else if (format == ODH_FORMAT_RGBA8) {
|
||||
int blueOrPixelOffset = (pixelIndex & 0xFFFFFFFC) * 0x10 + (pixelIndex & 3) * 2;
|
||||
u8* pixel = source + blueOrPixelOffset;
|
||||
red = pixel[1] >> 3;
|
||||
green = pixel[0x20] >> 3;
|
||||
blue = pixel[0x21] >> 3;
|
||||
} else {
|
||||
int sourceOffset = (pixelIndex & 7) + (pixelIndex & 0x3FFFFFF8) * 4;
|
||||
float y = (float)source[sourceOffset] - colorConvert16;
|
||||
float cb = (float)source[planeSize + sourceOffset] - colorConvert128;
|
||||
float cr = (float)source[planeSize * 2 + sourceOffset] - colorConvert128;
|
||||
red = (int)(colorConvertY * y + colorConvertR * cr);
|
||||
green = (int)(colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr);
|
||||
blue = (int)(colorConvertY * y + colorConvertB * cb);
|
||||
|
||||
if (red < 0) {
|
||||
red = 0;
|
||||
}
|
||||
if (0xFF < red) {
|
||||
red = 0xFF;
|
||||
}
|
||||
if (green < 0) {
|
||||
green = 0;
|
||||
}
|
||||
if (0xFF < green) {
|
||||
green = 0xFF;
|
||||
}
|
||||
if (blue < 0) {
|
||||
blue = 0;
|
||||
}
|
||||
if (0xFF < blue) {
|
||||
blue = 0xFF;
|
||||
}
|
||||
|
||||
red >>= 3;
|
||||
green >>= 3;
|
||||
blue >>= 3;
|
||||
if (format == ODH_FORMAT_RGB565) {
|
||||
int offset = (i & ~3) * 8 + (i & 3) * 2;
|
||||
u16 pixel = source[offset];
|
||||
pixel <<= 8;
|
||||
pixel |= source[offset + 1];
|
||||
red = (pixel >> 11) & 0x1F;
|
||||
green = (pixel >> 6) & 0x1F;
|
||||
blue = pixel & 0x1F;
|
||||
} else if (format == ODH_FORMAT_RGBA8) {
|
||||
int offset = (i & ~3) * 16 + (i & 3) * 2;
|
||||
red = source[offset + 1] >> 3;
|
||||
green = source[offset + 0x20] >> 3;
|
||||
blue = source[offset + 0x21] >> 3;
|
||||
} else {
|
||||
int offset = (i & 7) + (i & ~7) * 4;
|
||||
float y = source[offset] - colorConvert16;
|
||||
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;
|
||||
if (red < 0) {
|
||||
red = 0;
|
||||
}
|
||||
if (red > 0xFF) {
|
||||
red = 0xFF;
|
||||
}
|
||||
if (green < 0) {
|
||||
green = 0;
|
||||
}
|
||||
if (green > 0xFF) {
|
||||
green = 0xFF;
|
||||
}
|
||||
if (blue < 0) {
|
||||
blue = 0;
|
||||
}
|
||||
if (blue > 0xFF) {
|
||||
blue = 0xFF;
|
||||
}
|
||||
red >>= 3;
|
||||
green >>= 3;
|
||||
blue >>= 3;
|
||||
}
|
||||
|
||||
int cbValue = (table[red + 0x60] + table[green + 0x80] + table[blue + 0xA0]) >> 16;
|
||||
int crValue = (table[red + 0xC0] + table[green + 0xE0] + table[blue + 0x100]) >> 16;
|
||||
int luma = (table[red + 0] + table[green + 0x20] + table[blue + 0x40]) >> 16;
|
||||
|
||||
*lumaOutput++ = (u8)luma;
|
||||
*cbOutput++ = (u8)cbValue;
|
||||
*crOutput++ = (u8)crValue;
|
||||
pixelIndex++;
|
||||
cbValue = (conversionTable[red + 0x60] + conversionTable[green + 0x80] + conversionTable[blue + 0xA0]) >> 16;
|
||||
crValue = (conversionTable[red + 0xC0] + conversionTable[green + 0xE0] + conversionTable[blue + 0x100]) >> 16;
|
||||
*lumaOutput++ = (conversionTable[red] + conversionTable[green + 0x20] + conversionTable[blue + 0x40]) >> 16;
|
||||
*cbOutput++ = cbValue;
|
||||
*crOutput++ = crValue;
|
||||
}
|
||||
}
|
||||
void CArGBAOdh::fdct_fast(u32* coefficients, u8* samples, u32 stride, u32* quantizationTable) {
|
||||
@@ -2007,208 +2001,206 @@ void CArGBAOdh::LineDeconv22(u8* dest, u8* y, u8* cb, u8* cr, u16 width, u16 hei
|
||||
}
|
||||
|
||||
s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* request, u16** huffmanTables, int component, u32 sourceLimit) {
|
||||
u32 bitBuffer;
|
||||
u32 tableCount;
|
||||
s32 decodeResult;
|
||||
int bitIndex;
|
||||
s32 maximumBitLength;
|
||||
int maxHuffmanBits;
|
||||
u16 tableEntry;
|
||||
s32 valueCategory;
|
||||
u32 tableIndex;
|
||||
u32 magnitudeMask;
|
||||
int bytesConsumed;
|
||||
u8* sourceCursor;
|
||||
u32 decodedSymbol;
|
||||
u32 bitCountAndMask;
|
||||
u32 bitOffset;
|
||||
int coefficient;
|
||||
s32 category;
|
||||
int bytesConsumed;
|
||||
u32 bitBuffer;
|
||||
int length;
|
||||
u32 tableIndex;
|
||||
int maxLength;
|
||||
u32 value;
|
||||
u32 mask;
|
||||
u32 leafIndex;
|
||||
u32 run;
|
||||
u32 i;
|
||||
|
||||
bytesConsumed = request->bytesConsumed;
|
||||
sourceCursor = request->bitstream;
|
||||
u32 bitOffset = *request->bitCount;
|
||||
bitOffset = *request->bitCount;
|
||||
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
} else {
|
||||
maximumBitLength = 0xB;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitOffset;
|
||||
if (component == 0) {
|
||||
maximumBitLength = 9;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
maxHuffmanBits = (int)maximumBitLength;
|
||||
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
|
||||
tableEntry = huffmanTables[0][tableIndex];
|
||||
decodedSymbol = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + decodedSymbol];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + decodedSymbol;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
u32 leafIndex = tableIndex + decodedSymbol + 1;
|
||||
valueCategory = huffmanTables[0][leafIndex];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + decodedSymbol + 1;
|
||||
}
|
||||
}
|
||||
if (bitIndex > maxHuffmanBits) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= maxLength; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[0][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[0][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (valueCategory > 0) {
|
||||
bitCountAndMask = (1 << (valueCategory)) - 1;
|
||||
bitBuffer = bitCountAndMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
|
||||
bitBuffer = bitBuffer + 1 | ~bitCountAndMask;
|
||||
}
|
||||
} else {
|
||||
bitBuffer = 0;
|
||||
if (node & 0x4000) {
|
||||
leafIndex = tableIndex + branch + 1;
|
||||
category = huffmanTables[0][leafIndex];
|
||||
break;
|
||||
}
|
||||
u32** predictors = request->predictors;
|
||||
u32* predictor = predictors[component >> 1];
|
||||
bitCountAndMask = bitOffset + bitIndex + valueCategory;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
decodedSymbol = 1;
|
||||
bitIndex = (int)bitBuffer + *predictor;
|
||||
*coefficientOutput = bitIndex;
|
||||
*predictors[component >> 1] = bitIndex;
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
do {
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitCountAndMask;
|
||||
maximumBitLength = 6;
|
||||
for (; maximumBitLength != 0; maximumBitLength--) {
|
||||
tableEntry = huffmanTables[1][tableIndex];
|
||||
tableCount = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[1][tableIndex + tableCount];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
valueCategory = huffmanTables[1][tableIndex + tableCount + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount + 1;
|
||||
}
|
||||
bitIndex++;
|
||||
}
|
||||
if (bitIndex > 6) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
if (valueCategory == 7) {
|
||||
bitCountAndMask += bitIndex;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (valueCategory > 0) {
|
||||
tableIndex = (u32)(1 << (valueCategory)) - 1 &
|
||||
(bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((tableIndex & (u32)(1 << (valueCategory - 1))) == 0) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
} else {
|
||||
tableIndex = 0;
|
||||
}
|
||||
for (u32 zeroIndex = 0; zeroIndex < tableIndex; zeroIndex++) {
|
||||
coefficientOutput[decodedSymbol] = 0;
|
||||
decodedSymbol++;
|
||||
}
|
||||
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
maximumBitLength = 0xB;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitCountAndMask;
|
||||
if (component == 0) {
|
||||
maximumBitLength = 9;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
maxHuffmanBits = (int)maximumBitLength;
|
||||
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
|
||||
tableEntry = huffmanTables[0][tableIndex];
|
||||
tableCount = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + tableCount];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + tableCount + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount + 1;
|
||||
}
|
||||
}
|
||||
if (bitIndex > maxHuffmanBits) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
if (valueCategory > 0) {
|
||||
magnitudeMask = (1 << (valueCategory)) - 1;
|
||||
bitBuffer = magnitudeMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
|
||||
bitBuffer = bitBuffer + 1 | ~magnitudeMask;
|
||||
}
|
||||
} else {
|
||||
bitBuffer = 0;
|
||||
}
|
||||
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
|
||||
coefficientOutput[decodedSymbol] = bitBuffer;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
decodedSymbol = decodedSymbol + 1;
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
} while ((int)decodedSymbol < 0x40);
|
||||
for (; (int)decodedSymbol < 0x40; decodedSymbol++) {
|
||||
coefficientOutput[decodedSymbol] = 0;
|
||||
}
|
||||
request->bytesConsumed = bytesConsumed;
|
||||
decodeResult = 0;
|
||||
request->bitstream = sourceCursor;
|
||||
*request->bitCount = bitCountAndMask;
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
finishDecode:
|
||||
return decodeResult;
|
||||
}
|
||||
|
||||
if (length > maxLength) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
mask = (1 << category) - 1;
|
||||
value = mask & (bitBuffer >> (32 - length - category));
|
||||
if ((value & (1 << (category - 1))) == 0) {
|
||||
value = (value + 1) | ~mask;
|
||||
}
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
bitOffset += length + category;
|
||||
coefficient = 1;
|
||||
coefficientOutput[0] = value + *request->predictors[component >> 1];
|
||||
*request->predictors[component >> 1] = coefficientOutput[0];
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
|
||||
do {
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= 6; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[1][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[1][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (node & 0x4000) {
|
||||
category = huffmanTables[1][tableIndex + branch + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (length > 6) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category == 7) {
|
||||
bitOffset += length;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
run = ((1 << category) - 1) & (bitBuffer >> (32 - length - category));
|
||||
if ((run & (1 << (category - 1))) == 0) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
} else {
|
||||
run = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < run; i++) {
|
||||
coefficientOutput[coefficient] = 0;
|
||||
coefficient++;
|
||||
}
|
||||
|
||||
bitOffset += length + category;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= maxLength; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[0][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[0][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (node & 0x4000) {
|
||||
category = huffmanTables[0][tableIndex + branch + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (length > maxLength) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
mask = (1 << category) - 1;
|
||||
value = mask & (bitBuffer >> (32 - length - category));
|
||||
if ((value & (1 << (category - 1))) == 0) {
|
||||
value = (value + 1) | ~mask;
|
||||
}
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
coefficientOutput[coefficient++] = value;
|
||||
bitOffset += length + category;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
} while (coefficient < 64);
|
||||
|
||||
for (; coefficient < 64; coefficient++) {
|
||||
coefficientOutput[coefficient] = 0;
|
||||
}
|
||||
|
||||
request->bytesConsumed = bytesConsumed;
|
||||
request->bitstream = sourceCursor;
|
||||
*request->bitCount = bitOffset;
|
||||
return 0;
|
||||
}
|
||||
void CArGBAOdh::idct_fast(const u8* rangeLimitTable, u32* coefficients, u32* quantizationTable, u8* destination, u32 stride) {
|
||||
int evenPart0, evenPart1, evenPart2, evenPart3, oddPart3, oddPart2, oddPart1, oddPart0;
|
||||
int butterflyTerm0, butterflyTerm1, butterflyTerm2, evenInnerSum;
|
||||
|
||||
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.
|
||||
@@ -1479,3 +1479,83 @@ forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## CHANSVmStep objs[4] frame decode (w1009/update)
|
||||
|
||||
- Base places operand@r1+0x60, load@0x30, copies elems @0x40/0x50 = a single `CHANSVmObjHdr objs[4]` array (objs[0]=load, objs[1..2]=copies, objs[3]=operand). Declaring separate `operand/load/copies[2]` packs operand first at 0x40. Rewriting uses as `&objs[N]`/`objs[N].` fixed the frame (263->259 diffs).
|
||||
- `ppc_iro_level 0` around CHANSVmStep: +11 insns (unfuses the stepCount select but adds mrs) — rejected.
|
||||
- stepCount head: `stepCount += (stepCount == 0)` folds to cntlzw+srwi+add (1253 insns, 259 diffs); `if (stepCount == 0) { stepCount = 1; }` emits base's cmpwi+bne+li but 1254 insns and shifts every downstream block target — rejected. Base's extra `b 0xd0fc` is a test-first loop entry: `while (stepCount-- != 1)` reproduces it but emits +3 insns (1256) — rejected. Orig plausibly used if-clamp + while-loop; neither form converges alone.
|
||||
- insnClass==0 guard: `(raw & 0xC0)`/((u8)raw) emit mask-only rlwinm like base but +1 insn (fields.bitfield access keeps union web differently); kept `fields.instructionClass`.
|
||||
- `lis r28/addi r28` symbol-materialization at head = `&VmResultTypeTbl` pointer web, NOT a static copies[].
|
||||
- Residual 259 diffs: head select-fold + callee web-homing ties (r26/r21, r23/r17, r24 rotations).
|
||||
|
||||
## aes-lever sweep (w1009/update, post-#1315 rebase)
|
||||
|
||||
Leaf reduced to CHANSVmStep + nup __nupParseServerInfo (VmWinEmuWrite/VmBlobGetHexString/VmBlobPackCommon landed upstream #1315).
|
||||
|
||||
- declsearch.py (needed a __-symbol fix — patched copy at /tmp): nup decl block (6 decls, 36 evals) and CHANSVmStep block (8 decls, 50 evals) — current order is optimal in both; rotations are web-priority, not decl order.
|
||||
- nup all-static locals (`static` on all 5 shared decls): 507 insns, frame -0x40 + savegpr_20 — rejected. (Base's r28+off materializations are the .data tag-string pool, present in mine identically.)
|
||||
- nup `char*&`/`size_t&` reference params on __nupFindTag: 79 diffs — rejected.
|
||||
- nup FindTag `start += strlen(tag); *value = start;` (self-add web merge): +8 insns — rejected.
|
||||
- CHANSVmStep `__rlwinm(raw,0,24,25)==0` and `(raw & 0xC0)==0` for instructionClass: both +1 insn (1254) — bitfield access kept (1253/259).
|
||||
|
||||
## o2-chansvm roadmap transfer (w1009/update)
|
||||
|
||||
Their Step findings (o2-chansvm.attempts.md) applied and measured on this leaf:
|
||||
- `if (stepCount==0) stepCount=1;` + `while (stepCount-- != 0)`: loop tail matches byte-exact (cmpwi r16,0;addi r16,-1;bne) and base's entry `b` to the test site is reproduced — but net +2 insns (1255), so it needs the rest of their restructure to converge.
|
||||
- Frame decode retained: `CHANSVmObjHdr objs[4]` gives exact base slots (operand@0x60 etc.) — their map: 0x30=stackPtr obj, 0x40=STORE_INDIRECT obj, 0x50=load, 0x60=operand (separate decls in orig; frame identical either way).
|
||||
- Batched application of their remaining items (operandTypes[indexed] + BRANCH_CASE early stackTop + GET_PROPERTY_NAME foundEntry/shouldBranch) → 1260 insns, reverted. These must land as a set with their numbering context, not piecemeal.
|
||||
- Their meta-levers: copy-use (`mr` copy keeps a named local's web), static-inline helper numbering, signedness mixing (int index over u32 counter), pass 10=SR / pass 14=CTR conversion — all relevant to the residual 259 web-coloring diffs; apply with a score.py whole-unit harness.
|
||||
|
||||
## CHANSVmStep final-2 post-#1321 (w1009/update)
|
||||
|
||||
Post-#1321 the fn is 1253/1253 with one real diff: insns 836/837 —
|
||||
base `li r26,0; li r14,0; stw r26,0xc(r1)` vs mine `li r26,0; stw r26,0xc(r1); li r14,0`
|
||||
(the shouldBranch stack-store vs result=OK materialization order at the
|
||||
GET_PROPERTY_NAME join block; foundEntry is const-0 on all join paths so both
|
||||
are pure-independent ops — a backend list-scheduler tie).
|
||||
Rejected probes: source-order swap (backend reorders anyway — g-chansvm saw the
|
||||
same in backend-01), s32 foundEntry, foundEntry=0+read foundEntry at
|
||||
property_done (-3 insns, orig DOES emit the separate shouldBranch store),
|
||||
tautology ternary, drop shouldBranch=foundEntry (1251 — store must exist).
|
||||
Stack slot 0xc = shouldBranch (vmBoolInt/BOOL, fn-scope, memory-homed: live
|
||||
across ~800 insns of calls). g-chansvm already exhausted decl positions
|
||||
(100k permutations), per-arm/hoisted status, flag forms, pragmas, compiler
|
||||
versions. No source lever found; documented as scheduler-tie wall.
|
||||
|
||||
## nup ParseServerInfo rotation analysis (w1009/update)
|
||||
|
||||
71 diffs = cyclic web-creation-order rotation, identical insn stream/call sites
|
||||
(orig inlines __nupFindTag to strstr/strlen exactly as ours).
|
||||
Per-block1 base homes: startTagPtr=r22, result=r23, res1(start)=r24,
|
||||
endTagPtr=r25, res2(end)=r26. Mine: res2=r22, startTagPtr=r24, res1=r26 —
|
||||
the res2/end web is created FIRST in mine; base creates tagPtr first.
|
||||
Base arg homes: context=r30, response=r31 (last-numbered), messageId=r21,
|
||||
deviceId=r19:r20.
|
||||
Rejected: named tag locals (+3 diffs), per-block-scoped start/afterEnd/
|
||||
valueLength (+16B frame — out-params are address-taken, must share stack
|
||||
slots), block-scoped afterEnd-only (neutral). Earlier: declsearch optimal,
|
||||
all-static (507), ref-params (79), self-add (+8).
|
||||
Theory tested and rejected: FindTag `char* start; char* end;` decl swap
|
||||
(neutral — res2 doesn't come from inline-local decl order).
|
||||
|
||||
## optimization_level sweep (w1009/update)
|
||||
|
||||
- CHANSVmStep: O3 → 43 diffs (web renumber), O2 → 1254 insns (frame -0x30), O1 → 1256 — O4 confirmed (current 2-diff state under opt_lifetimes off).
|
||||
- nup ParseServerInfo: O3 → same 71 (rotation untouched — it's numbering, not opt folding), O2 → 454 insns — O4 confirmed.
|
||||
|
||||
## CHANSVmStep final-2 wave 3 (w1009/update, post-#1323)
|
||||
|
||||
optimization_level sweep exhausted (O3→43, O2→1254, O1→1256; O4 confirmed).
|
||||
Additional probes on the li-vs-stw join pair, all rejected:
|
||||
- `foundEntry = 0; result = OK; shouldBranch = foundEntry;` — foundEntry's
|
||||
fresh const-0 merges the two zero webs: emits `stw r14` (result web) and
|
||||
drops the li → -3 insns (1250). Base keeps r26/r14 as DISTINCT zero webs:
|
||||
the flag store's operand must be a const-folded-but-separate web, matching
|
||||
the plain `shouldBranch = foundEntry` form.
|
||||
- Named temp `branchFlag = foundEntry; shouldBranch = branchFlag` — MWCC
|
||||
forward-substitutes, identical 2 diffs.
|
||||
- Conclusion: with identical web structure (g-chansvm's regsim 458/458), the
|
||||
remaining pair is a deterministic-looking backend scheduling tie that no
|
||||
source lever reached. Needs a pass-level dump (mwdbg backend-01+) to see
|
||||
which operand the scheduler's ready-list orders differently.
|
||||
|
||||
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.
|
||||
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.
|
||||
56
tools/decomp-assist/o3-chansvm.attempts.md
Normal file
56
tools/decomp-assist/o3-chansvm.attempts.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# o3-chansvm: CHANSVmStep li/stw scheduling pair
|
||||
|
||||
Worktree data-d2, branch agent/w1009/o3-chansvm, base 239334ba. Start: CHANSVmStep 2 differing
|
||||
instructions (836 `li r14, 0` / 837 `stw r26, 0xc(r1)` swapped), unit 232/233 exact, NonMatching.
|
||||
Scratch: /tmp/o3-chansvm (score.py = whole-unit compile + per-function compare, 0.6 s; t/ = a
|
||||
40-line reproduction of the GET_PROPERTY_NAME control flow, 0.3 s per compile).
|
||||
|
||||
## Why the scheduler always put the store first
|
||||
|
||||
Scheduler model from rayanht/mwcc `Scheduler.c` and `MachineSimulation750.c`, checked against our
|
||||
captures (B261 in backend-00/01 of _mwdbg/runs/o3-chansvm-base):
|
||||
- On the 750 model `li` has latency 1 and `stw` latency 2. Each node without successors gets a
|
||||
latency-0 edge to the block's branch, so height(stw) = 2 and height(li) = 1.
|
||||
- `select_ready_coloring_node` prefers the node whose latest cycle has been reached. At cycle 0 the
|
||||
store is urgent and the li is not, so the store is issued first whatever the source order. That is
|
||||
why every statement order, type and status-local variant in g/g2-chansvm kept the same pair.
|
||||
- `Scheduler_Schedule` only schedules blocks with more than two instructions. A two-instruction
|
||||
block keeps source order in both passes (harness: li stays first when the block falls through).
|
||||
|
||||
## What the target block really was
|
||||
|
||||
The target's three early exits (`beq/bne 0xcac8` at 759/762/769) and the `b 0xcac8` after the store
|
||||
fit this layout before assembly:
|
||||
- B261 = `li result; stw shouldBranch` (two instructions, never scheduled, source order).
|
||||
- X = `mr result, <status>; b property_done`, reached by B261's fallthrough and by the three early
|
||||
exits, so MergeAdjacentBlocks cannot merge it into B261.
|
||||
- The allocator coalesces the status with `result` (both r14) and deletes the copy, leaving X as a
|
||||
lone `b`. `optimize_branches` in PCodeAssembly then threads the early exits through X to
|
||||
property_done, so the final code shows no trace of X.
|
||||
|
||||
In C this is a case-local status for GET_PROPERTY_NAME, like the case-local results the other cases
|
||||
already use (booleanResult, loadResult, arrayResult, deleteResult, caseResult), copied into `result`
|
||||
after the property block, with the OK assignment written before the flag store. IRO cannot fold the
|
||||
copy: the status is ERR on the early-exit paths and OK after the enumeration.
|
||||
|
||||
## Attempts
|
||||
|
||||
| attempt | Step diffs | others |
|
||||
|---|---|---|
|
||||
| harness: flag/status order, u8/s8/u16/s16 flag, inline setter, pointer to the flag, opt_propagation off | stw first | - |
|
||||
| harness: do/while(0) breaks, goto early exits, extra end label, else branch | stw first | - |
|
||||
| harness: B261 falling straight into property_done (error block moved) | li first | layout differs from target |
|
||||
| harness: case-local status, OK before flag store, `result = status` after the if | li first, target layout | - |
|
||||
| harness: same with the flag store first | stw first | - |
|
||||
| CHANSVmStep: `propertyResult`, declared in each of the 74 local slots | 0 in 57 slots, 115 in slots 43-59 | all 232 others exact |
|
||||
| kept: declared after `result` | 0 | pool identical, 233/233 |
|
||||
|
||||
## Result
|
||||
|
||||
CHANSVmStep 2 -> 0 (1253/1253, 5012 bytes). CHANSVm 233/233 exact, flipped to Matching.
|
||||
Full build links build/43U/src/src/channelScript/CHANSVm.o; main.dol SHA1
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d. Unit report: code 53564/53564, data 6904/6904, complete
|
||||
code and data 100%.
|
||||
|
||||
`gate.py src/channelScript/CHANSVm --quick`: GATE PASS, 0 regressions, 0 forbidden patterns,
|
||||
0 readability warnings, all six sections 100%. Global complete code 94.67 -> 96.46 percent.
|
||||
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.
|
||||
44
tools/decomp-assist/opus-bs2update.attempts.md
Normal file
44
tools/decomp-assist/opus-bs2update.attempts.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# opus-bs2update UpdateThread attempts
|
||||
|
||||
Worktree data-d10, branch agent/w1009/o-bs2update, base 72e9c8d6 (origin/main). Owned `src/BS2/BS2Update.c`; the fix also needs a one-line rename in `config/43U/symbols.txt` and the Matching flip in `configure.py`. Read opus-common, levers, the effort-policy entries, sol-x8, sol-y3 (`git show 4925fde2`) and sol-z1.
|
||||
|
||||
Start: UpdateThread 6/913 differing, equal size 0xe44. The other nine functions are exact. The remaining diffs are the three seat-loop scheduling swaps described by sol-x8, sol-y3 and sol-z1.
|
||||
|
||||
combosweep (single and pairwise allowed pragmas): `BEST src/BS2/BS2Update UpdateThread base 6 -> 6 []`. No pragma moves it.
|
||||
|
||||
## Diagnosis
|
||||
|
||||
The decompiled 1.2.5 scheduler (rayanht/mwcc `src/backend/Scheduler.c`, inspiredrobot/mwcc `docs/SCHEDULER.md`) adds a store-to-later-load edge for every memory pair the alias test cannot separate, with the store's latency. sol-y3's capture already showed that the seat loads carry a worst-case alias set that contains Flags0's bit, so `Flags0[index] = 0` wins the height race against the seat address `add`. The target schedules the `add` first. That is the order you get when no such edge exists.
|
||||
|
||||
I tested small probe functions with the unit's exact compiler flags: a loop that stores `FlagsX[i] = 0` and then tests `p[i].attr & 1`. The results:
|
||||
|
||||
| Seat entries come from | Flag array | Edge (store first)? |
|
||||
| --- | --- | --- |
|
||||
| absolute `T a[] : addr` (array, struct, single entry, const, static) | file-scope static | yes |
|
||||
| integer cast `(T*)0x80480000 + n` (folds to `addis`, wrong form anyway) | file-scope static | yes |
|
||||
| pointer parameter | file-scope static | yes |
|
||||
| normal relocated global array | file-scope static | no, but needs `lis/addi` with relocs (wrong form) |
|
||||
| absolute array (target's `lis r0,0x8048; add` form) | file-scope static, initialized or tentative, extern | yes |
|
||||
| absolute array | **function-local static** | **no** |
|
||||
| absolute array | global scalar / local stack array | no |
|
||||
|
||||
An unknown pointer (absolute storage counts as unknown) may alias every file-scope object, but not a function-local static whose address is never taken. The target keeps the absolute `lis r0, 0x8048; add` form and has no edge. So Flags0 was a function-local static of the selection code.
|
||||
|
||||
## .bss order
|
||||
|
||||
The target order is Flags0, Flags1, Thread, ThreadStack, UpdateHeader0, UpdateHeader1. Probes on the same compiler show the emission rules:
|
||||
- initialized objects are emitted where they are defined;
|
||||
- tentative definitions are emitted at their first use;
|
||||
- a function static is emitted when its function is parsed.
|
||||
|
||||
So the static has to come from a function parsed before BS2UpdateInit, and the other five arrays have to be tentative definitions. Init first uses Flags1, Thread and ThreadStack, and the inlined selection code first uses UpdateHeader0 and UpdateHeader1. That gives exactly the target order.
|
||||
|
||||
## Trials
|
||||
|
||||
1. `seatEntries = (BS2UpdateEntry*)0x80480000 + wadCount`: 549/912 (address folds into `addis`; the swaps stay). Rejected.
|
||||
2. `static u32 Flags0[...] = {0};` inside BS2SelectUpdateEntries, everything else unchanged: 18/913. All three swaps gone; the 18 left are .bss offsets because Flags0 lands after UpdateHeader1. Init 4 diffs from the same shift.
|
||||
3. As 2, but the Flags1/Thread/ThreadStack/UpdateHeader0/UpdateHeader1 definitions are tentative (the `= {0}` initializers dropped) and BS2SelectUpdateEntries is defined before BS2UpdateInit: **UpdateThread 0/913, all 10 functions exact**. .bss layout identical to the target, pool 55/55 identical.
|
||||
4. Rename the target symbol `Flags0` to the compiler's local-static name `Flags0$1129` in config/43U/symbols.txt. This is the project convention for function statics (144 `name$N` entries). Report: code 4052/4052, data 10488/10488, every section 100%, functions 10/10.
|
||||
5. Flip BS2Update to Matching and run the full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. build.ninja links build/43U/src/src/BS2/BS2Update.o.
|
||||
|
||||
No pragma, asm, volatile change, carrier, padding or dummy is added. The source change is: the selection helper moves above BS2UpdateInit, Flags0 becomes its function static, and five `= {0}` initializers are removed.
|
||||
61
tools/decomp-assist/opus-candbox.attempts.md
Normal file
61
tools/decomp-assist/opus-candbox.attempts.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# opus-candbox attempts
|
||||
|
||||
Worktree `sol-high`, branch `agent/w1009/o-candbox`, base `72e9c8d6`. Unit `src/keyboard/tiCandidateBox`, last open function `LayoutByNW4R::createAnmPane_` (6/216, count r23 and slot r31 swapped). Read opus-common.md, levers.md, effort-policy entries, sol-x9 log, sol-m4 log (branch `agent/w1009/candbox-max`), saved sol-r12/sol-y11 diffs.
|
||||
|
||||
Baseline: full build OK, DOL `26116613...`, odiff 6/216, pool identical 57/57. combosweep (single and pairwise pragmas): `base 6 -> 6`, no hit.
|
||||
|
||||
## Root cause
|
||||
|
||||
`tiPredictLang::create` is already exact and has the same inner loop with the same struct (`char paneName[20]`, `count`, `forceAddName`, `pAnims[8]`). Its target has count r31 and slot r23, which is what createAnmPane_ needs.
|
||||
|
||||
A private mwdbg trace of `tiPredictLang::create` (port 19931 copy of the launcher, shared tool unchanged) shows why. The slot base `p + j*4` is IRO CSE temp `@7026` (vreg r45) and forceAddName is IRO temp `@7028` (r44). Both are numbered after the named locals and before the hoisted constructor constants, so they simplify before the constants and color after them (slot r23). Count is a late anonymous load hoisted out of the loop condition (r131), so it colors first (r31).
|
||||
|
||||
The same natural loop inside tiCandidateBox (`j < paneAnimations.count`, `paneAnimations.pAnims[j]->` three times) gives 220 insns. No IRO temps are created, the slot is recomputed in each branch, and constant `2` survives pass-1 spilling.
|
||||
|
||||
Table declaration trials with that loop:
|
||||
|
||||
| trial | table | result |
|
||||
| --- | --- | --- |
|
||||
| 01 | `extern "C" const CandidatePaneData scCandidatePaneData` (struct wrapper, aligned(8)) | 158/220 |
|
||||
| 02 | `static const CandidatePaneData` (struct wrapper) | 158/220 |
|
||||
| 03 | `extern "C" const PaneToAnimation[]` (plain array) | 158/220 |
|
||||
| 04 | `static const PaneToAnimation[]` (plain array, no aligned) | **0/216** |
|
||||
|
||||
IRO only CSEs the table loads and addresses when the table is a static plain array, which is how every sibling unit declares it (`csPaneToAnimation`). The `CandidatePaneData` wrapper and `extern "C"` were decomp scaffolding. Without `aligned(8)` the table still lands at .data 0x28, size 0x680.
|
||||
|
||||
## Source changes
|
||||
|
||||
- Table: `static const PaneToAnimation csPaneToAnimation[]`, same name as tiToolBar/tiPredictLang/pctype. Removed the unused `CandidatePaneData` struct.
|
||||
- `createAnmPane_`: the tiPredictLang/tiToolBar loop form, with no count/forceAddName/animation locals.
|
||||
- symbols.txt: `scCandidatePaneData` -> `csPaneToAnimation__Q29textinput12candidatebox` (scope:local). Same address and size. Only tiCandidateBox referenced the old name.
|
||||
|
||||
Unit after this: 112/112 functions, code 100%, data 100%, all sections 100%, pool identical.
|
||||
|
||||
## Link (Matching flip)
|
||||
|
||||
First flip: DOL `8d444a7b...`. Two causes, both checked against the original objects:
|
||||
|
||||
1. Thunk order. Target `@36@__dt__` comes before `@36@setRootPaneScaleFor4x3..init`; ours put it last (already true on the old baseline). This is the "move to end on touch" thunk list (eggAudioExpMgr, lever 12). tiPredictLang/tiToolBar/tiCellPhone fix it with a header `Sample : public LayoutByNW4R` behind a `*_SAMPLE_CLASS` macro, and `__vt__Q39textinput12candidatebox6Sample` exists in the DOL. A Sample with only `virtual ~Sample() {}` does not move the thunks. It needs the inline constructor, so the Base/EventHandler/LayoutByNW4R constructor guards also accept `TI_CANDIDATEBOX_SAMPLE_CLASS`, as tiPredictLang.h does. After that, all 112 common functions are in target order. Proof it is required: removing it leaves the wrong thunk order and DOL `5507fb9e...`.
|
||||
2. Weak vtable hole. The target has 0x40 zero bytes between `__vt__...AnmObserver` (0xd48) and `__vt__Q39textinput4util12AnimObserver` (0xd94). Ours left only the deduplicated gui::EventHandler copy (0x18), so everything after shifted by -0x20/-0x24. util::Animation methods were inline in the original: they sit as scattered weak functions in tiInputForm's .text, and MyTiManager.cpp already defines them `inline`. UITextArea has a `util::Animation` member, so the original object also emitted a weak `__vt__Q39textinput4util9Animation` (0x24, kept from tiInputForm). EventHandler 0x18 at 0xd58 + Animation 0x24 at 0xd70 ends at 0xd94. I added the same inline definitions as MyTiManager.cpp at the end of tiCandidateBox.cpp, with startAnm in this TU's declared parameter order. Only virtual calls exist, so no code changes. .data is now 0xda0, the target size.
|
||||
|
||||
Flip with both: full build OK, `build/43U/main.dol` SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
|
||||
Trial snapshots: `/tmp/opus-candbox/trials/`. Captures: `/tmp/opus-candbox-cap-predictlang`, `/tmp/opus-candbox-cap-f01`.
|
||||
|
||||
## Gate
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/keyboard/tiCandidateBox] pool: IDENTICAL
|
||||
[src/keyboard/tiCandidateBox] objdiff: code 24000/24000 data 4652/4652 functions 112/112 fuzzy 100.0000 linked code 24000
|
||||
[src/keyboard/tiCandidateBox] instruction-exact functions: 112/112
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 98.14728 -> 98.17613
|
||||
global complete_code_percent: 91.22256 -> 92.02384
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
origin/main moved to `82783c6e` during the run (BS2Update lines in configure.py/symbols.txt only, no overlap). Not rebased.
|
||||
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.
|
||||
68
tools/decomp-assist/opus-odh.attempts.md
Normal file
68
tools/decomp-assist/opus-odh.attempts.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# opus-odh attempts (src/system/odh)
|
||||
|
||||
Worktree data-d6, branch agent/w1009/o-odh from origin/main 72e9c8d6. Read opus-common.md, sol-r4 and
|
||||
sol-m2 logs, effort-policy entries, levers.md, the mwdbg README and the allocator reference.
|
||||
|
||||
Baseline: LineConv11 12/146, huffmanDecoder 171/306, unit 26/28 exact, pool identical.
|
||||
|
||||
## combosweep (run first)
|
||||
|
||||
- main source: LineConv11 12 -> 12, huffmanDecoder 171 -> 166 (opt_propagation off). No exact.
|
||||
- sol-m2 seed: LineConv11 6 -> 6, huffmanDecoder 114 -> 114. No exact.
|
||||
|
||||
## LineConv11: EXACT
|
||||
|
||||
mwdbg capture of the seed: inside the loop r8 is the only free volatile GPR, so every other temp takes a
|
||||
saved register and the lowest claimed one wins. The packed RGB565 word (v68) was colored before the
|
||||
high byte (v66) and took r8. The target needs the high byte on r8, the pointer on r29, and the packed word
|
||||
colored after cbValue claims r25. So the packed word has to be a named local numbered below cbValue.
|
||||
|
||||
Petari's matching SMG source (SMGCommunity/Petari src/Game/Screen/odh.cpp, read-only) does exactly that:
|
||||
cbValue/crValue are declared with red/green/blue before the format chain, and `pixel` is built high byte
|
||||
first (`pixel = src[o]; pixel <<= 8; pixel |= src[o + 1];`) inside the RGB565 block. Ported as-is with
|
||||
this file's names: LineConv11 0/146, ctxdiff diffs 0, pool identical, no other function changes.
|
||||
|
||||
Lever isolation (each from the exact version):
|
||||
- cbValue/crValue declared at their assignment instead: 5 diffs.
|
||||
- pixel low byte first (`pixel = src[o + 1]; pixel |= src[o] << 8`): 6 diffs.
|
||||
- pixel as one expression `(src[o] << 8) | src[o + 1]`: 6 diffs.
|
||||
- planeSize indexing instead of cbSource/crSource pointers: 0 (either form works).
|
||||
|
||||
## huffmanDecoder: EXACT
|
||||
|
||||
Started from a fresh natural rewrite (early returns, `length`/`tableIndex`/`category` names, Petari-style
|
||||
tree walks) instead of the Ghidra-shaped seed: 170 diffs, same 306 instructions. Structural fixes first:
|
||||
- `coefficient = 1` before the first refill loop (the target sets it in the DC block): 163.
|
||||
- DC leaf through a named `leafIndex` (target keeps `(idx + off + 1) * 2` + lhzx only in the DC walk).
|
||||
- `length = 1;` before `tableIndex = 0;` in every walk (li order): 139, 0 structural left.
|
||||
|
||||
Then allocator work with mwdbg + a per-vreg want list built by aligning backend-04 PCode with the target
|
||||
object (/tmp/opus-odh-want.py), and an annealer over the numbering (/tmp/opus-odh-anneal.py):
|
||||
- A full renumbering (temps included) reached 1 miss and showed both maxLength values must be colored
|
||||
after their walk temps, i.e. behave as codegen temps. `maxLength = component == 0 ? 9 : 11;` gets
|
||||
copy-propagated into the ternary temp: 139 -> 80.
|
||||
- `dc` must be colored before the predictor-index temp, so no named `dc`:
|
||||
`coefficientOutput[0] = value + *pred; *pred = coefficientOutput[0];` (store forwarded, no reload): 68.
|
||||
- AC tail: target creates the store address before `length + category`:
|
||||
`coefficientOutput[coefficient++] = value; bitOffset += length + category;`: 66.
|
||||
- Remaining misses were named-local order only. Simulator: declare sourceCursor, bitOffset, coefficient,
|
||||
category before bytesConsumed (sourceCursor colors first and takes r12, bitOffset claims r31, then
|
||||
coefficient r30, category r29, bytesConsumed r28). C89 declarations at the top of the function: 9.
|
||||
- Last 9: the run walk needs `branch` numbered above `node` (declared first). Per-walk C89 blocks
|
||||
`u32 branch; u16 node;` then assignments: 0. Only the run walk needs it; using it in all three walks
|
||||
is also exact, so the final source is uniform.
|
||||
|
||||
Checked and rejected along the way: function-scope shared node/branch (always 9, any position);
|
||||
`value += *pred` (80); chained assignment for the predictor works (68) but the two-statement form reads
|
||||
better. maxLength/value/mask/leafIndex/run/i can sit anywhere in the top declaration list.
|
||||
|
||||
Final: huffmanDecoder 0/306, ctxdiff diffs 0, pool identical, unit 28/28, code 14684/14684, data 6360/6360.
|
||||
|
||||
## Link
|
||||
|
||||
Flipped system/odh.cpp to Matching. ODHEncodeRGBA8/ODHEncodeY8U8V8/ODHDecodeY8U8V8 are in the source but
|
||||
not in the split target (unreferenced, dead-stripped); the link output is unchanged.
|
||||
Full build: main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, "system/odh.cpp: linked True".
|
||||
|
||||
Gate (`gate.py src/system/odh --quick`): GATE PASS, 28/28 instruction-exact, linked code 14684,
|
||||
0 regressions, 0 forbidden patterns, 0 readability warnings. Global matched code 98.14728 -> 98.20765.
|
||||
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.
|
||||
144
tools/decomp-assist/sol-m12.attempts.md
Normal file
144
tools/decomp-assist/sol-m12.attempts.md
Normal file
@@ -0,0 +1,144 @@
|
||||
# sol-m12 CHANSVm big functions, MAX
|
||||
|
||||
Worktree data-d2, branch agent/w1009/chansvm-big, initial HEAD bbd98e1e. Requested full Ninja build passed before edits, required DOL SHA1 verified by the build. Source initially clean. Read sol-common, brief-v2, all levers, AGENTS.md, unslop, writing-for-agents, graphify query instructions, 11b01025:sol-m8, 50eb9be2:sol-c1, ef500621:sol-y4, archived and repository histories, and every CHANSVm effort-policy entry. History inventory and prior trial labels are /tmp/sol-m12-history.json and /tmp/sol-m12-prior-rows.json. Graph query resolved its ambiguous name to src/channelScript/CHANSVm.c::VmBlobPackCommon.
|
||||
|
||||
## Excluded repetitions
|
||||
|
||||
- No unchanged-graph declaration permutations. Prior 218-node Pack models prove the array/counter swap needs a changed interference graph.
|
||||
- No whole Pack measure/write wrappers, complete packing helper, element-size/format-specific writers, typed argument-selection wrappers, named remaining-count/format-length/blob-length getters, sequential generic argument reuse, or shared pass counters/format positions already tried.
|
||||
- No Step scratch carrier, out-parameters hoisting locals, dead locals, duplicated control flags, redundant conditions, raw offset casts, table-identity getters, previously tested late-table getters, readonly-view cleanup helpers, named immediate getters, instruction-union variants, or countdown normalization variants.
|
||||
- No compiler-version/unit-flag sweep or standalone scoped-setting repeat. No small-function work outside Pack and Step.
|
||||
|
||||
## Acceptance and method
|
||||
|
||||
Replay the saved Pack-only best, remove any unused local, and check equivalent behavior and all existing exact functions before retaining it. The task explicitly authorizes committing clean improvements below exactness; record them as partial results. Align opcode plus resolved-relocation streams with difflib, locate count differences first, then scheduling and allocation. For Step, map the switch table and inspect the least-different cases first. Preserve the pool, all data sections and existing exact functions. Run the requested final quick gate once. Keep all source experiments in this worktree and temporary files under /tmp/sol-m12-. No push, PR, merge, rebase, subagent or Matching flip without a fully exact unit.
|
||||
|
||||
## Measurements
|
||||
- {"label": "pack-clean-replay", "counts": {"VmBlobPackCommon": {"diff": 151, "insns": [666, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c18451afb381"} Removed unused hexadecimal length local and pure getter from historical best. All separated locals carry genuine pass-specific values.
|
||||
- {"label": "pack-clean-unused-result-call", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Target instruction 604 prepares writeHexStrObj and 605 calls VmGetIntFromObjHdr. Return is unused in the remaining hex block. Preserve that original call without a dead local.
|
||||
|
||||
Pack clean replay is 47/668 versus 230/668 at HEAD. All 47 aligned differences are the r18/r23 array-counter exchange. Target hex block explicitly calls VmGetIntFromObjHdr and discards its result, so the required source call is retained without declaring a dead local. The rest of the function keeps identical call order, branches, instruction count, all allocated data, and every other function. Unit report after replay: {"fuzzy_match_percent": 99.66164, "total_code": "53564", "matched_code": "44588", "matched_code_percent": 83.24248, "total_data": "6904", "matched_data": "6904", "matched_data_percent": 100.0, "total_functions": 233, "matched_functions": 227, "matched_functions_percent": 97.4249, "total_units": 1}. Task authorizes this partial checkpoint. No exact match claimed.
|
||||
- {"label": "pack-integer-store-words", "counts": {"VmBlobPackCommon": {"diff": 325, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "34b5f067b570"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-store-integer", "counts": {"VmBlobPackCommon": {"diff": 325, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c75536b1e87b"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-store-integer-case-scope", "build": "FAIL"} Same new serialization boundary, with integer-loop values declared in their owning case.
|
||||
- {"label": "pack-integer-store-object", "counts": {"VmBlobPackCommon": {"diff": 321, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b0afd352444d"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-store-object-case-scope", "build": "FAIL"} Same new serialization boundary, with integer-loop values declared in their owning case.
|
||||
- {"label": "pack-integer-swap-words", "counts": {"VmBlobPackCommon": {"diff": 56, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "434ff2985dbf"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-encode-words", "counts": {"VmBlobPackCommon": {"diff": 333, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "46cb1062b4df"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-encode-integer", "counts": {"VmBlobPackCommon": {"diff": 333, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "37020ec61736"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-encode-integer-case-scope", "counts": {"VmBlobPackCommon": {"diff": 334, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1e8a9605e258"} Same new serialization boundary, with integer-loop values declared in their owning case.
|
||||
- {"label": "pack-integer-encode-object", "counts": {"VmBlobPackCommon": {"diff": 329, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "389b97208b09"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
|
||||
- {"label": "pack-integer-encode-object-case-scope", "counts": {"VmBlobPackCommon": {"diff": 330, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "73d7c8ffa5e6"} Same new serialization boundary, with integer-loop values declared in their owning case.
|
||||
- {"label": "pack-restore-after-integer-helpers", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore the best reviewed packing shape after serialized helper trials.
|
||||
- {"label": "step-case-float-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 266, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "5a5c1246d7a2"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
|
||||
- {"label": "step-case-string-index-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "19ecec628150"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
|
||||
- {"label": "step-case-new-array-index-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c16b93768a1c"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
|
||||
- {"label": "step-case-call-operand-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "52188babcf52"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
|
||||
- {"label": "step-single-function-scope-opSize", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0bcda653f75c"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-single-function-scope-operandBuf", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "70349864ce40"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-single-function-scope-copyResult", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "e302683194b4"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-single-function-scope-foundObj", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c0c7872f13d2"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-single-function-scope-result", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "621e11cb0158"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-single-function-scope-newPos", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "72977265684a"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
|
||||
- {"label": "step-case-helper-VmLoadIndirect", "build": "FAIL"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
|
||||
- {"label": "step-case-helper-VmDeleteIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a78209fb7d99"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
|
||||
- {"label": "step-case-helper-VmLogicalNot", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "78a1e07de24a"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
|
||||
- {"label": "step-internal-readonly-VmResultTypeTbl", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d7acb65b18d2"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
|
||||
- {"label": "step-internal-readonly-CHANSVmConstStringObjectUndefined_", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "29f94ee37b0f"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
|
||||
- {"label": "step-internal-readonly-both", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "9ffa6e38abd1"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
|
||||
- {"label": "step-restore-after-case-trials", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best reviewed source after opcode and scope trials.
|
||||
- {"label": "pack-real-serialization-buffer-signed-words", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "953ba41006c9"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
|
||||
- {"label": "pack-real-serialization-buffer-bytes", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "68bdeb48da60"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
|
||||
- {"label": "pack-real-serialization-buffer-integer", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c817b37a562e"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
|
||||
- {"label": "pack-hex-real-phase-indexed-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 125, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "8037667d9caf"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-hex-real-phase-indexed-vmBool", "counts": {"VmBlobPackCommon": {"diff": 125, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d10098e4f2c2"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-hex-real-phase-remaining-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 235, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "51a8b18b0da5"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-hex-real-phase-remaining-vmBool", "counts": {"VmBlobPackCommon": {"diff": 235, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "25983a62b93c"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-hex-real-phase-pointer-end-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 255, "insns": [673, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "73d1cf266113"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-hex-real-phase-pointer-end-vmBool", "counts": {"VmBlobPackCommon": {"diff": 255, "insns": [673, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d1915f38ce30"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
|
||||
- {"label": "pack-restore-after-buffer-and-phase", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best reviewed source after actual buffer and nibble traversal shapes.
|
||||
- {"label": "step-property-found-init-before-lookup", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1105, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "554f8359dc13"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
|
||||
- {"label": "step-property-found-init-after-lookup", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1105, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1f0ce1b9b7c3"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
|
||||
- {"label": "step-property-found-init-guard", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 649, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "48ba164a012a"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
|
||||
- {"label": "step-property-operation-output-last", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "49695948b8e6"} Real property lookup operation returns CHANSVmErr and an actual found result, like CHANSVmGetBoolean. The output controls the bytecode branch and does not hoist helper temporaries.
|
||||
- {"label": "step-property-operation-output-last-format-scope", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b23ec141e9bc"} Same property operation, with formatting temporaries in their actual owning scope. Original 64-bit snprintf argument is preserved.
|
||||
- {"label": "step-property-operation-output-first", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0d4424248f8e"} Real property lookup operation returns CHANSVmErr and an actual found result, like CHANSVmGetBoolean. The output controls the bytecode branch and does not hoist helper temporaries.
|
||||
- {"label": "step-property-operation-output-first-format-scope", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b94e4670e35e"} Same property operation, with formatting temporaries in their actual owning scope. Original 64-bit snprintf argument is preserved.
|
||||
- {"label": "step-operation-helper-VmLoadStringConstant", "build": "FAIL"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
|
||||
- {"label": "step-operation-helper-VmCreateArrayOpcode", "build": "FAIL"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
|
||||
- {"label": "step-operation-helper-VmStoreIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1eb11d802892"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
|
||||
- {"label": "step-operation-helper-VmLoadIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bd99a82f2c25"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
|
||||
- {"label": "step-restore-after-property-operation", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after new property and object-operation boundaries.
|
||||
- {"label": "pack-consume-argument-advance-call-Blob", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b559537f4f93"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-Integer", "counts": {"VmBlobPackCommon": {"diff": 354, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f660f73ecb6a"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-String", "counts": {"VmBlobPackCommon": {"diff": 253, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "08ba492b44e7"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-Hex", "counts": {"VmBlobPackCommon": {"diff": 187, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "390460abe825"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-Integer-String", "counts": {"VmBlobPackCommon": {"diff": 350, "insns": [672, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "ca6636c2679e"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 253, "insns": [672, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "83e444dc541f"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-advance-call-Blob-Integer-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [676, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "365e81430a1d"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-Blob", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b559537f4f93"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-Integer", "counts": {"VmBlobPackCommon": {"diff": 354, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "75618b2bc41c"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-String", "counts": {"VmBlobPackCommon": {"diff": 251, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "49deaae31879"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-Hex", "counts": {"VmBlobPackCommon": {"diff": 250, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "04cbe5619579"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-Integer-String", "counts": {"VmBlobPackCommon": {"diff": 350, "insns": [671, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "67e5b3e35451"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 303, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f4f5cef096fa"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-consume-argument-nested-conversion-Blob-Integer-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 463, "insns": [674, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "3cce13c8aeff"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
|
||||
- {"label": "pack-measure-count-after-size-Integer", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c92bdc893fbe"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
|
||||
- {"label": "pack-measure-count-after-size-String", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0055b2fe1791"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
|
||||
- {"label": "pack-measure-count-after-size-Hex", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a7e4638108c1"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
|
||||
- {"label": "pack-measure-count-after-size-all", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "30d118739d6f"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
|
||||
- {"label": "pack-restore-after-argument-shapes", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after actual cursor lifetime changes.
|
||||
|
||||
## Fresh backend evidence
|
||||
|
||||
Pack capture /tmp/sol-m12-pack-capture has executable bytes, resolved text relocations and every allocated data section identical to the ordinary Ninja object. Simulator reproduces 218/218, and the manually checked array/counter want-list reaches only 2/3. All 47 baseline differences are the r18/r23 exchange. Step capture /tmp/sol-m12-step-capture likewise equals normal compilation in all allocated sections and resolved relocations and reproduces 491/491. The 10-name diagnostic reaches 8/10, but the stock search can reorder compiler @ aliases and parameters, so it is not a writable source order and no proposed ordering is applied. Maps are /tmp/sol-m12-pack-vmap.txt and /tmp/sol-m12-step-vmap.txt.
|
||||
|
||||
Opcode/relocation alignment includes HA/LO relocations stored at instruction offset +2. It identifies Step target shared rodata base 0, source separate bases 352 and 96; early count normalization and pretest branch; stack object locations; enum indexing; property flag/output stack stores; and later branch cleanup. The source jump tables currently match all 121 relocation destinations. Case priority is /tmp/sol-m12-step-case-priority.json. POP, IS_CLASS, DELETE_INDIRECT, LOG_NOT and BIT_NOT bodies already match; the first positive-difference cases differ by the shared instruction-size register. Property lookup has 92 differing positions in its 134-instruction block. Internal linkage on the real readonly globals changes no instructions. No fake common-base aggregate or cross-object pointer arithmetic is introduced.
|
||||
- {"label": "step-operation-helper-VmLoadStringConstant-fixed", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "6282fff9aa19"} Corrected helper generator retains original case declarations. Same opcode operation boundary and original call order, without hoisted local outputs.
|
||||
- {"label": "step-operation-helper-VmLoadStringConstant-decoded-input", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 695, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "550e55657ba8"} Actual decoded string index or array extent is the operation input; keep decoding at the caller and object creation inside the helper.
|
||||
- {"label": "step-operation-helper-VmCreateArrayOpcode-fixed", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f3e3f9a42c40"} Corrected helper generator retains original case declarations. Same opcode operation boundary and original call order, without hoisted local outputs.
|
||||
- {"label": "step-operation-helper-VmCreateArrayOpcode-decoded-input", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "6b1fff6c9d84"} Actual decoded string index or array extent is the operation input; keep decoding at the caller and object creation inside the helper.
|
||||
- {"label": "step-property-output-last-pretest", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1227, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "7d34bf2d9d62"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-property-output-last-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1099, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "2cb470409b7e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-property-output-last-pretest-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1222, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "59a1cb761b4e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-property-output-first-pretest", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1227, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "23cf3deee40e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-property-output-first-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1099, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bff9685e9c39"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-property-output-first-pretest-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1222, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "11b5acc54f47"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
|
||||
- {"label": "step-case-property-object-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "06ad45705671"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
|
||||
- {"label": "step-case-property-operand-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 614, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "17f609f5347f"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
|
||||
- {"label": "step-case-index-object-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d5a261278a30"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
|
||||
- {"label": "step-case-index-operand-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 703, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bdd38f3134bd"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
|
||||
- {"label": "step-restore-final-best", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after combined operation and indexed-operand shapes.
|
||||
- {"label": "pack-integer-store-integer-case-scope-fixed", "counts": {"VmBlobPackCommon": {"diff": 326, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0b8f526b806a"} Corrected generator identifies the outer format case with an anchored pattern. Real loop index and converted argument are owned by that case.
|
||||
- {"label": "pack-integer-store-object-case-scope-fixed", "counts": {"VmBlobPackCommon": {"diff": 322, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "4278fbf87ee4"} Corrected generator identifies the outer format case with an anchored pattern. Real loop index and converted argument are owned by that case.
|
||||
- {"label": "step-case-property-real-operands", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 614, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "9bdcba724a96"} Remove the generated unused per-case array-index local. Keep only real operand buffer and decoded index values; reject if target count or table offsets differ.
|
||||
- {"label": "final-retained-checkpoint", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Retain only the committed clean Pack replay; all new non-exact experiments are rejected.
|
||||
- {"label": "pack-typed-buffer-index", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a0f7d087c354"} The source scan flags cast-plus-offset spelling in the replay. Use actual typed array indexing for the known eight-byte serialization buffer; store width and order remain identical. The measurement completed successfully; an unquoted separator in its trailing shell note then attempted an unrelated command and returned 127. The later independent final checks below pass.
|
||||
|
||||
## Final result and handoff
|
||||
|
||||
The log contains 92 measurement rows: 87 successful compilations/checkpoints and five generator failures. After the cleaned replay, there are 38 compiled Pack variants (37 distinct source hashes) and 39 Step variants. These are measured variations, not 77 independent ideas: parameter orders, unchanged-code controls and the composed pretest/indexing controls are labeled above. The failed generators were corrected. The generated property-operand trial with an unused array-index local was rejected and corrected to use only real operands. Every follow-up source experiment was restored.
|
||||
|
||||
Retain the inherited Pack replay from sol-c1, with the unused hexadecimal length local removed and the signed word store written as typed array indexing. The target's explicit unused-result getter call remains. Pack improves from 230 to 47 differences, 668/668 instructions, fuzzy 98.0988 to 99.588326. There is no new exact function. The remaining 47 differences exchange the argument-array and argument-counter registers r18/r23; their opcode and resolved-relocation streams align without insertions or deletions. Fresh backend evidence reproduces the allocator, but does not supply an honest source change that fixes the exchange.
|
||||
|
||||
Step remains 262 differences, 1253/1253 instructions, fuzzy 97.23225. Its function text equals the initial bbd98e1e function exactly. The smallest differing opcode bodies mostly inherit the shared opSize register. Full property-operation boundaries, genuine case-owned inputs and object handles, readonly linkage, and operand-type/pretest compositions either preserve the original differences or change instruction counts and jump-table relocations. The target common readonly base, operand storage, property flag and loop control remain unresolved; none justifies a scratch carrier or fabricated object layout. All 121 data-table relocation destinations and every previously exact sibling are preserved in the retained object.
|
||||
|
||||
Final source SHA256: a0f7d087c354b113fcdbc456fa90f651a739af74353db4673aadac3cfc9f395c. Changed repository paths are src/channelScript/CHANSVm.c and this log. Source checkpoint ae3810af contains the clean replay; the final checkpoint also contains the typed-index spelling and this audit. The focused source diff is saved as /mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-m12.CHANSVm.diff.
|
||||
|
||||
Ran the requested final gate exactly once:
|
||||
|
||||
```
|
||||
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/channelScript/CHANSVm --quick
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
pool: IDENTICAL
|
||||
objdiff: code 44588/53564 data 6904/6904 functions 227/233 fuzzy 99.66164 linked code 0
|
||||
instruction-exact functions: 227/233
|
||||
all five allocated data sections: 100.0
|
||||
regressions vs baseline: 0
|
||||
forbidden patterns added: 0
|
||||
readability warnings: 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
The gate baseline is bbd98e1e, unit fuzzy 99.58733. Final live report was regenerated with Ninja progress and build/43U/report.json. Independent final ctxdiff reports Pack 47 and Step 262; pool_diff reports 125/125 identical; git diff --check passes. Direct executable-byte and resolved-relocation comparison against the initial object finds no changed sibling, exact-function drop or allocated-data change. Final evidence is /tmp/sol-m12-gate.txt, /tmp/sol-m12-final-VmBlobPackCommon.ctxdiff.txt, /tmp/sol-m12-final-CHANSVmStep.ctxdiff.txt and /tmp/sol-m12-final-pool.txt. This is a validated partial replay, with the unit still NonMatching and unlinked.
|
||||
@@ -28,3 +28,142 @@ 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.
|
||||
|
||||
## inputChar (w1009 wave — post-#1319 structure)
|
||||
Base: 136 insns. g-keyboard baseline (u16 mCount member + newline reset): 13 diffs
|
||||
at 66-78 — rlwinm per-access masks (u16 index) + live bne on the newline compare.
|
||||
|
||||
Decode landed: mCount is a **u32** member — orig emits `slwi` (no mask) on the
|
||||
index and ONE `clrlwi r29` (u16 narrow for count), not per-access rlwinm.
|
||||
`u32 mCount` removes all mask diffs -> 135 insns vs 136.
|
||||
|
||||
Remaining (unresolved):
|
||||
1. `if (ch == L'\n') mCount = 0;` — orig's compare is a DEAD fossil (cmplwi kept,
|
||||
no consuming branch, block straight-line). Tried and rejected: mpOutput[0]=0 /
|
||||
mpOutput[mCount]=0 conditional stores (MWCC never dedups conditional memory
|
||||
stores — kept `bne; sth`); ternary/switch/empty-if/goto-next (frontend folds
|
||||
compare AND kills the mCount phi -> index collapses to direct sth, mode3 block
|
||||
merges into else shape); mCount=0 else=0 (same collapse); adjacent backward
|
||||
redundant store (kept bne;sth). Constraint pair: mCount must stay OPAQUE
|
||||
(phi/web, else index folds) AND the if's only effect must die late. The live
|
||||
`if(ch=='\n') mCount=0` phi is currently what keeps the index symbolic —
|
||||
any fossil form that kills the branch also kills the phi. Needs the reset to
|
||||
target something else (member load/codegen temp per orchestrator hint).
|
||||
2. Cursor add re-narrow x2: base emits `clrlwi r0,r29,0x10` before
|
||||
`mCursorStart + count` — count's u32/s32 web is UNPROVEN at the use (phi
|
||||
provenance lost). Tried: u32/s32/u16 count + static_cast<u16>, (u16)(s32)
|
||||
double-cast, & 0xffff, plain +count — MWCC folds all since all 3 phi inputs
|
||||
(clrlwi-0x18 kana, clrlwi-0x10 mode3, li 1 else) are provably narrow. Base's
|
||||
count web must be dirty through a different mechanism (member web? call
|
||||
boundary? different var shape).
|
||||
3. 1 missing insn in mode3 tail: base has `mr r4,r5` + `li r5,0` (buf re-copied
|
||||
into r4 for the terminator store) — mine shares r5 (append and finish inlined
|
||||
reads coalesce the mpOutput web).
|
||||
|
||||
## inputChar — opt_propagation wave (w1009, post-#1323)
|
||||
Scoped `#pragma opt_propagation off` around inputChar + u32 mCount: block shape
|
||||
changed slightly (li/sth/addi ordering) but no wall cracked — live bne persists,
|
||||
re-narrow still folds, mr r4,r5 still missing. Pragma does not reproduce the
|
||||
fossil (compare emission is frontend, before IR prop runs).
|
||||
|
||||
`finish(wchar_t* p)` + `output.finish(input)`: emits `addi r4,r1,0x10` for the
|
||||
buf web — SEPARATE web created (operand order matches base sthx r5,r4) but
|
||||
remat, not `mr r4,r5`. `finish(output.mpOutput)` folds fully (single web). The
|
||||
`mr` is a codegen remat-vs-copy tie: buf#2's web is a COPY of r5 in base —
|
||||
needs a reg-valued (non-remat) arg source; no honest source form found.
|
||||
|
||||
Dead-cmplwi fossil — ~12 more mechanisms rejected:
|
||||
- `if(ch=='\n') mCount=0` arm stays LIVE in every member shape (u32 member,
|
||||
ctor-reordered init, hoisted input[0]=0). MWCC does NOT value-track member
|
||||
stores post-inline (`cmpwi r6,0` emitted on provably-0 mCount proves it) —
|
||||
so the arm can never be redundant-eliminated.
|
||||
- `if(ch=='\n') mOutput[0]=0` arm (killed-by-later-unconditional member):
|
||||
`bne;sth` kept — no member-store DSE across the block.
|
||||
- `if(ch=='\n') count=0` arm (var killed by later `count=finish()`): arm does
|
||||
die BUT removing the mCount write collapses the index web -> input[0] fold.
|
||||
- `i=i`, `mCount=mCount` self-stores: deleted -> compare deleted -> collapse.
|
||||
- nested `if(mCount!=0) mCount=0`: inner stays live (+3).
|
||||
- `input[i]=0` arm (indexed, dedup vs ctor): index folds (single-def) -> collapse.
|
||||
Wall restated: index needs mCount phi'd (multi-def -> unprovable), arm must be
|
||||
dead (no insns) — but every arm that dies removes the phi input. Any dead-arm
|
||||
form must leave a SECOND mCount def that MWCC can't prove equal — no such form
|
||||
found for var/member/local-arm writes.
|
||||
|
||||
u32 mCount retained (removes all rlwinm per-access mask diffs): 135 vs base 136.
|
||||
|
||||
## inputChar — orchestrator-diff wave 2 (w1009)
|
||||
Plain-local decode confirmed pieces:
|
||||
- `u32 i = 0; input[0] = i;` — stores i's web directly: `sth r5,0x10` shares ONE
|
||||
web with `slwi r0,r5` — reproduces base's single `li` web (vs two separate li
|
||||
webs in the member form). With `if(ch=='\n') i=0` arm kept: symbolic slwi +
|
||||
shared store web both landed — but arm stays LIVE (bne;li) as always.
|
||||
- `i = (ch=='\n') ? 0 : i` select: folds entirely (compare deleted, index
|
||||
collapses to input[0]).
|
||||
- `i = output.mCount` overwrite: member-read folds to init-0 -> collapse.
|
||||
- `if(ch=='\n') input[i]=0` arm (dedup vs later input[i]=ch): i single-def ->
|
||||
index folds -> collapse.
|
||||
Established: the arm's def is the ONLY phi input keeping `input[i]` symbolic;
|
||||
MWCC 3.0a5.2 eliminates neither redundant var-stores nor member stores, and
|
||||
deleting the arm's def always collapses the phi -> literal fold. The dead
|
||||
cmplwi needs a pass ordering where the phi survives the arm's deletion —
|
||||
no source form found. ~50 total probe forms on this wall across sessions.
|
||||
|
||||
## inputChar fossil decode (session ~197k, leaf update)
|
||||
|
||||
### SOLVED — the dead-`cmplwi` fossil (was the main wall, ~50 prior probes)
|
||||
`cmplwi ch,0xa` survives with NO branch via TWO mechanisms combined:
|
||||
1. **2-pred join** (o-tistr model): `if (mode == 3) { ia[1] = ia[0]; }` — a dead a2r
|
||||
store (`u32 ia[2]` local array). `ia[0]` never written → both elements undef →
|
||||
the store dies AT EMISSION but the if-block survives as a separate block →
|
||||
the `cmplwi` block has 2 predecessors at every MergeAdjacentBlocks pass.
|
||||
2. **undef a2r read**: `if (ch == '\n') { i = ia[1]; }` — `i = ia[1]` reads an
|
||||
undef array element → ZERO instructions emitted (undef web) but `i`'s phi
|
||||
keeps a second reaching def → `input[i]` stays a symbolic index (no fold
|
||||
to offsets) AND the `\n`-compare survives branch-free.
|
||||
Compiler warns (10185) 'ia' is not initialized — warning only, not banned.
|
||||
|
||||
### SOLVED — epilogue `clrlwi r0,r29` re-narrow (2 sites)
|
||||
`+ (u16)count` emits `clrlwi` iff count's phi has a NON-NARROW input. `count` u32
|
||||
+ `count = i` (u32 index → `addi`/`mr` — non-narrow web) → emits at both sites.
|
||||
u16 count / `count = (u16)i` / u8-return / `&0xff` / `(s32)` / `(u32)` double-cast
|
||||
all produce narrow-flagged webs → `(u16)` folds → `add` only.
|
||||
u8-return: `KPRPutChar` returns u8 — `count = ret & 0xff` — narrow everywhere.
|
||||
|
||||
### SOLVED — `input[0] = i` single-web zero
|
||||
`input[0] = i` (the VARIABLE) produces orig's ONE `li`/`sth`/`slwi` web shared
|
||||
by the store and the index. Literal `input[0] = 0` creates a second li web.
|
||||
|
||||
### UNSOLVED — `clrlwi r29` def vs `addi r29` (~1 insn)
|
||||
`count = i` (u32,u32) emits `addi` — needed non-narrow for epilogue.
|
||||
`count = (u16)i` emits `clrlwi` but flags count narrow → epilogue clrlwi dies.
|
||||
Contradiction for one var; split-var models: `j = (u16)i` coalesces into the
|
||||
`addi` web or gets dead-eliminated (j unused); `u16 j` + `j = i` emits `clrlwi`
|
||||
but u16-var promotions elide the use-side too.
|
||||
Candidate left untried: `count` live via a use that keeps the `(u16)` def but
|
||||
adds no insns — not found.
|
||||
|
||||
### UNSOLVED — `mr r4,r5` buf-copy (1 insn)
|
||||
Base: `addi r5,r1,0x10` buf→r5; `mr r4,r5` copies buf→r4 because `li r5,0`
|
||||
(zero-web for input[i]=0 + sth 0x42) then clobbers r5 → allocator copy-out.
|
||||
Mine: buf=r6, zero=r4 — no conflict → sthx uses r6 twice.
|
||||
- `wchar_t *q = input` mid-block → `addi r4,r1,0x10` remat (colors match, wrong
|
||||
insn — remat not mr).
|
||||
- `wchar_t *q = p` → forward-substituted (VN merge) even with
|
||||
`#pragma opt_propagation off` (forward-sub is a different pass).
|
||||
- `q = p` in the `\n` dead arm → arm non-empty → fossil breaks.
|
||||
Needs: buf + zero homing on same reg to force copy-out — allocator tie.
|
||||
|
||||
### Diff state: 134v136 — real diffs: `addi r29`(→clrlwi), missing `mr r4,r5`,
|
||||
plus operand-color ties (r5/r6/r4 homes) elsewhere.
|
||||
|
||||
### Final probes (before swarm #1336 landed it)
|
||||
- `u16 count` + `count = i` emits the mode-3 `clrlwi r29` def ✓ but every
|
||||
epilogue cast form (`(u32)`, `(s32)`, `(u16)`, double-cast) elides to `add`
|
||||
— u16-var promotions never materialize a use-side clrlwi.
|
||||
- `u32 count` + `count = i` + `+ (u16)count` emits BOTH epilogue clrlwis ✓ but
|
||||
the mode-3 def is `addi` not `clrlwi` — narrow-def/non-narrow-phi contradiction.
|
||||
- `wchar_t *p = input` as a named pointer local HOISTS the buf `addi` to block
|
||||
top (web born at def); orig never keeps buf in a vreg — it's a remat base at
|
||||
each sthx (`input[i]` direct, not p[i]).
|
||||
- Pure `input[i]` form gets buf mid-block but homes stay swapped: i→r5/buf→r6
|
||||
vs orig i→r6/buf→r5 — `li r5,0` never vacates buf → no `mr r4,r5` copy-out.
|
||||
|
||||
Reference in New Issue
Block a user