Compare commits
28 Commits
agent/w101
...
agent/w101
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99d349a055 | ||
|
|
d756857880 | ||
|
|
9739df6fc6 | ||
|
|
283e0f6a1f | ||
|
|
b0197d5ce0 | ||
|
|
b0794c9e2a | ||
|
|
ad5b9deae3 | ||
|
|
5046adc6da | ||
|
|
87214ff944 | ||
|
|
54ca052b41 | ||
|
|
2ce8487681 | ||
|
|
47fe453260 | ||
|
|
2d4cfa7094 | ||
|
|
e27d9e090a | ||
|
|
983a6a2448 | ||
|
|
c1e1157d8b | ||
|
|
005d3734f0 | ||
|
|
55891734ae | ||
|
|
20cf9f9f25 | ||
|
|
2a7cc791b1 | ||
|
|
b2c43f5a66 | ||
|
|
d9b8013644 | ||
|
|
40b87edd73 | ||
|
|
3d7e767cf7 | ||
|
|
10146c1b5f | ||
|
|
82783c6edb | ||
|
|
72e9c8d658 | ||
|
|
0062d65a27 |
@@ -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)
|
||||
|
||||
@@ -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,6 +3131,16 @@ 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 cursorX;
|
||||
f32 lineTop;
|
||||
@@ -3135,8 +3163,8 @@ u32 Base::calcCursorPos(f32 x, f32 y) {
|
||||
info.rect.bottom = 0.0f;
|
||||
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 +3172,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);
|
||||
|
||||
@@ -708,9 +708,8 @@ extern "C" void clearAllCardFileEntries(s32 slot) {
|
||||
}
|
||||
|
||||
static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo,
|
||||
u32 address, s32 offset, s32 imageSize) {
|
||||
u32 address, s32 offset, s32 imageSize, u32 transferSize) {
|
||||
s32 sectorSize;
|
||||
u32 transferSize = (imageSize + offset + 0x1FF) & 0xFFFFFE00;
|
||||
if (CARDGetSectorSize(slot, (u32*)§orSize) < CARD_RESULT_READY) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
@@ -741,18 +740,24 @@ static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInf
|
||||
}
|
||||
|
||||
static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
|
||||
u32 address = dir->commentAddr;
|
||||
u32 base = address & 0xFFFFFE00;
|
||||
s32 offset = address - base;
|
||||
s32 readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
|
||||
u32 address;
|
||||
s32 result;
|
||||
u32 base;
|
||||
s32 readSize;
|
||||
u32 end;
|
||||
u32 fileSize;
|
||||
s32 offset;
|
||||
s32 sectorSize;
|
||||
s32 result = CARDGetSectorSize(slot, (u32*)§orSize);
|
||||
address = dir->commentAddr;
|
||||
base = address & 0xFFFFFE00;
|
||||
offset = address - base;
|
||||
readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
|
||||
result = CARDGetSectorSize(slot, (u32*)§orSize);
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
u32 fileSize;
|
||||
if ((s32)base < 0 || base > (fileSize = (u32)dir->length * sectorSize)) {
|
||||
result = 0;
|
||||
} else {
|
||||
u32 end = base + readSize;
|
||||
end = base + readSize;
|
||||
if ((s32)end < 0 || end > fileSize) {
|
||||
result = 0;
|
||||
} else {
|
||||
@@ -772,9 +777,11 @@ static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileIn
|
||||
}
|
||||
|
||||
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;
|
||||
u32 transferSize;
|
||||
s32 iconAddressOffset = iconAddress - (iconAddress & 0xFFFFFE00);
|
||||
|
||||
switch (format) {
|
||||
@@ -812,15 +819,17 @@ static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFil
|
||||
}
|
||||
}
|
||||
|
||||
s32 shift;
|
||||
BOOL hasTlut;
|
||||
s32 iconImageSize;
|
||||
s32 paletteSize;
|
||||
s32 icon;
|
||||
BOOL hasTlut;
|
||||
s32 iconCount;
|
||||
s32 shift;
|
||||
|
||||
shift = 0;
|
||||
iconCount = 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;
|
||||
@@ -828,7 +837,7 @@ static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFil
|
||||
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);
|
||||
sThread->icons[slot][fileNo].anmMax += iconSpeed << 2;
|
||||
} else {
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
|
||||
@@ -843,12 +852,9 @@ animationDone:
|
||||
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;
|
||||
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;
|
||||
@@ -883,8 +889,6 @@ animationDone:
|
||||
sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
break;
|
||||
}
|
||||
++iconCount;
|
||||
shift += 2;
|
||||
}
|
||||
if (hasTlut) {
|
||||
iconImageSize += 0x200;
|
||||
@@ -894,8 +898,10 @@ animationDone:
|
||||
sThread->icons[slot][fileNo].anmDelta = 1;
|
||||
}
|
||||
|
||||
imageSize = bannerImageSize + iconImageSize;
|
||||
transferSize = (imageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
|
||||
return readCardImages(slot, fileNo, dir, fileInfo, iconAddress & 0xFFFFFE00, iconAddressOffset,
|
||||
bannerImageSize + iconImageSize);
|
||||
imageSize, transferSize);
|
||||
}
|
||||
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
|
||||
@@ -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;
|
||||
@@ -388,7 +392,7 @@ cleanup_done:
|
||||
|
||||
int AOSS_Init_old(AOSSInitInput* input)
|
||||
{
|
||||
short waitAttempt;
|
||||
s16 initialWait;
|
||||
AOSSReceiveBuffer* packetBuffer;
|
||||
AOSSPacketHeader* packetWords;
|
||||
u32 initialSleep;
|
||||
@@ -396,7 +400,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
u32 resultCode;
|
||||
u32 flags;
|
||||
int state;
|
||||
int timeoutMilliseconds;
|
||||
int protocolState;
|
||||
u32 retryWait;
|
||||
u16 retryDelay;
|
||||
u32 delayStep;
|
||||
@@ -405,35 +409,33 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
int requestResult;
|
||||
size_t manufacturerLength;
|
||||
int timeoutSeconds;
|
||||
int protocolState;
|
||||
int timeoutMilliseconds;
|
||||
int protocolResult;
|
||||
OSTime timeoutTicks;
|
||||
int initializationResult;
|
||||
int socketOptionResult;
|
||||
u8 requestMessageType;
|
||||
short attemptCount;
|
||||
u16 remainingWait;
|
||||
s16 initialWait;
|
||||
u16 defaultConnection;
|
||||
u16 defaultResponse;
|
||||
short waitAttempt;
|
||||
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 +476,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 +500,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 +513,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 +527,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 +541,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 +556,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);
|
||||
@@ -601,7 +603,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);
|
||||
@@ -610,7 +612,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
resultCode = 0xffffffff;
|
||||
} else {
|
||||
/* The original initialization path repeats this status check. */
|
||||
if (state != 0) {
|
||||
if (state != 0 || s_accessPointConfig[0] == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
@@ -623,12 +625,12 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if ((int)s_accessPointConfig == 0) {
|
||||
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 +650,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 +665,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 +674,14 @@ wait_for_initial_link:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((state == 0) && (*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 +698,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 +715,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 +726,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 +734,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 +749,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 +757,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 +791,7 @@ handle_initial_link:
|
||||
goto finish_initialization;
|
||||
}
|
||||
{
|
||||
requestMessageType = 0x11;
|
||||
attemptCount = waitSettings.halfwords.high;
|
||||
settings.gatewayAddress = 0xc0a80b65;
|
||||
settings.ipAddress = 0xc0a80b01;
|
||||
@@ -814,7 +820,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 +843,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 +853,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 +875,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);
|
||||
@@ -878,14 +884,14 @@ request_socket_cleanup_complete:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((requestResult == 0) && ((u32)*s_accessPointConfig == 1u)) break;
|
||||
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
|
||||
remainingWait = waitIntervals.limits.response;
|
||||
for (; remainingWait != 0; remainingWait -= initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
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 +908,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 +923,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 +942,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 +990,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;
|
||||
@@ -1007,7 +1013,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 +1055,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 +1072,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 +1086,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 +1098,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 +1133,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 +1155,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 +1168,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 +1182,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 +1195,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 +1204,12 @@ wait_for_packet:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if ((int)s_accessPointConfig == 0) {
|
||||
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 +1226,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);
|
||||
@@ -1230,14 +1235,14 @@ wait_for_packet:
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if ((state == 0) && ((u32)*s_accessPointConfig == 1u)) break;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) break;
|
||||
remainingWait = waitIntervals.limits.response;
|
||||
for (; remainingWait != 0; remainingWait -= initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
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 +1259,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 +1271,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 +1282,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 +1301,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 +1332,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 +1349,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 +1379,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 +1400,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 +1415,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);
|
||||
|
||||
185
tools/decomp-assist/g-aoss.attempts.md
Normal file
185
tools/decomp-assist/g-aoss.attempts.md
Normal file
@@ -0,0 +1,185 @@
|
||||
# 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.
|
||||
|
||||
## w1011/aoss continuation (worker devin-w1011)
|
||||
|
||||
### NEW LEVER: redundant `||` disjunct emits dead same-flags branch
|
||||
`AOSS_Init_old` triple-`bne` decode: orig's `cmpwi r3,0; bne A; bne B; lwz cfg; lwz *cfg; cmplwi 1; beq B` = `if (state != 0) ->A` then `if (state != 0 || *ptr == 1) ->B` — MWCC emits the provably-dead first disjunct's `bne` because `||` conditions do NOT get the dead-branch fold a standalone `if (state != 0)` does (verified: same-var inner if folds entirely; different-var holding same value also folds — VN unifies). Fix applied at the SetNCDIPAddr else-site: inner `if (state != 0 || s_accessPointConfig[0] == 1)` (reloc-verified: insn 373/374 = s_accessPointConfig then *cfg). 1582/1584 insns, 534 positional diffs (was 1578/722). `else if` form breaks braces — kept `else { if (cond||x) {...} work }`.
|
||||
- Residual per-site mapping unclear: my pair landed at MY insn ~304 while orig's three pairs sit at 371/713/1273 — the other two `if (state != 0)` sites (BSSList/CheckAP ~539, wait_for_packet ~1132) likely need the same idiom.
|
||||
- Also remaining: `ble; b` dual-branch at 272 (`manufacturerLength <= 0xd` — orig enters body via taken-ble + unconditional-b; ours single bgt), protocol-constant materialization region ~566-590 (mulhw + lis/addi 0xc0a80b01 store+reload — IP 192.168.11.1 materialized via named constant?), spill-order block ~969-985.
|
||||
- AOSSi_WLANConnect: all sched-copy shapes dead-end (u8* typed view cross-block, shared fillByte, result-as-fill, view-first chain, cfg-block) — swarm's two required internal shapes (chain-copy / r4+r5 both reg-copies) unreachable from source. Confirmed wall.
|
||||
|
||||
## w1011/aoss wave-2 (opt-level + twin-branch decode)
|
||||
|
||||
- `#pragma optimization_level 2` scoped to AOSS_Init_old: 1603 insns/1040 diffs (regression). `optimization_level 3`: inert (identical 1582/534 — O4,p TU flag dominates). `#pragma ppc_iro_level 0/1`: inert. Opt-level hypothesis (idct-style) disproved for this fn.
|
||||
- insn-272 `ble;b` decoded from raw bytes (capstone printed reloc-addend targets — real targets are sign-extended imm): `0x40810008` = ble+8 -> memcpy body; `0x48000014` = b+0x14 -> SetNCDIPAddr args. Orig emits TWIN-BRANCH (ble->body + b->join) vs ours bgt-skip. Failed producers: goto-label form, explicit empty else{}, do{...}while(0), `|| *cfg` at lines 539/1194 (773d regression — orig does NOT deref *cfg at those sites). Likely an MWCC block-layout artifact — unresolved.
|
||||
- Residual bne sites at orig 371/713/1273: NOT `||`-sites (adding *cfg loads regresses); undecoded.
|
||||
|
||||
## w1011/aoss wave-3 (volatile-param lever — assessed N/A)
|
||||
|
||||
- pdm's `volatile pf_u8* buf` idiom (ordered loads from hardware-filled mem) does NOT apply: WLANConnect's 2d is arg-marshal `li r5/mr r3` scheduling — no loads involved. `NCDIpConfig* volatile ipConfig` spills the pointer (166 insns/109d regression); `memset((volatile T*)p,...)` is an illegal qualifier-discard error on MWCC.
|
||||
- Init_old residual regions (twin-branch @272, dead-bne @371/713/1273, materialization ~566-590, spills ~969-985) are control-flow/constant-materialization classes — no reordered buffer loads to pin. `*cfg`/`AOSSi_cancel_flag` reads already emit plain loads matching orig.
|
||||
|
||||
## w1011/aoss wave-4 (opt_propagation off — assessed N/A)
|
||||
|
||||
- Scoped `#pragma push/opt_propagation off/pop` around AOSS_Init_old: INERT (1582/534 identical). File-top unscoped: inert. WLANConnect: inert (2d). Pragma accepted (no warning) — but Init_old's `-O4,p` + `-inline off` + global `-ipa file` leaves nothing for it to change.
|
||||
- Verified no prop-signature in residual: orig's `cmpw/cmplw reg,reg` sites (172/434/635/776/997/1098/1336, e.g. `extsh r0; cmpw r0,r16` loop-limit compares) all sit inside rename regions — mine emits the same reg-reg compares with different coloring, not `cmpwi` constant-folds. The 534d wall is reg allocation + the twin-branch + dead-bne sites, not propagation.
|
||||
|
||||
## w1011/aoss wave-5 (worker devin-w1011, marshal-order link hunt)
|
||||
|
||||
AOSSi_WLANConnect `li r4; li r5; mr r3` marshal order — new mechanism data:
|
||||
|
||||
- **`NCDIpConfig** pp = &ipConfig; memset(*pp, ...)` REPRODUCES base's marshal
|
||||
order exactly: the surviving `*pp` load is the extra sched link that delays
|
||||
the marshal into IU2 (confirmed — this is the "3rd link" the model wants).
|
||||
Cost: `&ipConfig` demotes ipConfig to a memory slot, so the field-store web
|
||||
becomes the codegen load temp which numbers AFTER named local `result`
|
||||
(named locals vreg-number before codegen temps) -> addr web lands r28,
|
||||
result takes r27 — the mirror image of base (~25 diffs, pure r27/r28 swap).
|
||||
- Decl-order permutations (4), late `result = 0`, `pp` decl/init variants: all
|
||||
emit identically — the temp's numbering is structural, not decl-sensitive.
|
||||
`memset` return-value-as-result: 159 insns (garbage).
|
||||
- Null-check block boundary (`if (!ipConfig) return -1;`): the check is NOT
|
||||
deleted — emits real cmplw+b (+3-4 insns); no surviving copy.
|
||||
- Dead store on the same web before memset flips the order but emits `stwu`
|
||||
(155v156). Confirms again: only links that die post-RA without changing web
|
||||
homes can win; every sched-visible link either emits (stw/lwz/branch),
|
||||
folds pre-sched (copies, casts, member views, single-use slots via SRA),
|
||||
or rehomes the web (`**` load).
|
||||
- Per-fn `#pragma scheduling off` / `schedule_twice on`: identical 2-diff —
|
||||
wall is upstream of the -O4,s list scheduler.
|
||||
- `AOSSConnection`/`AOSSConnectionStatus` have no config-pointer member, so no
|
||||
member-load operand exists for the marshal chain.
|
||||
- AOSSi_WLANConnect stands at 2 diffs (marshal order only, 155v155 insns).
|
||||
Remaining theoretical shape: an extra copy of the address whose source is
|
||||
PHYSICAL (call result / param) — no NCD API returns a config pointer, and
|
||||
no legitimately-dead expression produces one.
|
||||
- orig .bss/.sbss fully owned (AOSSi_NcdIfConfig 0x0/0x15e, AOSSi_NcdIpConfig
|
||||
0x160/0x7c4, sbss ip* globals + alloc/release/statusCallback + cancel_flag)
|
||||
— no hidden pointer object; orig had no static config pointer.
|
||||
- Direct-global shape (no ipConfig local, `AOSSi_NcdIpConfig.field` stores):
|
||||
worse — memset arg folds to `addi r3` in-place (no marshal insn at all) and
|
||||
the address web splits (r27/r28 across the two config structs).
|
||||
- `memset(&AOSSi_NcdIpConfig, ...)` arg while keeping ipConfig local: same
|
||||
2-diff (marshal still reads ipConfig's web? no — identical output).
|
||||
- Fill-byte variants (`retries`, `result`, named u8 const): identical 2-diff.
|
||||
`AOSSi_cancel_flag` shifts the block but is semantically wrong (fills with
|
||||
flag value, not 0) — rejected.
|
||||
- ipConfig init-at-decl (`= &AOSSi_NcdIpConfig` at declaration): web born
|
||||
early -> pinned r29 across calls (home change, worse). Cross-block `dst`
|
||||
copies (early def / use-past-branch): all fold.
|
||||
- Exhausted: ~60 source forms + pragmas + decl permutations. The target needs
|
||||
the marshal in IU2 behind a forwarded operand; no non-emitting, non-folding,
|
||||
non-rehoming chain link exists from this source language level.
|
||||
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.
|
||||
39
tools/decomp-assist/g-keyboard.attempts.md
Normal file
39
tools/decomp-assist/g-keyboard.attempts.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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.
|
||||
@@ -1,267 +0,0 @@
|
||||
# settingstruct leaf — attempt log
|
||||
|
||||
Scope: src/scene/setting/AOSS.c, src/scene/setting/AOSSLink.c, src/scene/address/iplAddressEdit.cpp
|
||||
Base: origin/main@9321a926. Lane-clear vs open PRs (only #1156 touches ATERM.c — dropped per orchestrator).
|
||||
Tools: ~/tools/fndiff.py (capstone normalized diff, register-renaming by first-appearance order; `--raw` = literal).
|
||||
|
||||
## Baseline
|
||||
- iplAddressEdit 99.55 — create 97.56 (3280B), get_friendinfo 88.04, update_friendinfo 99.42
|
||||
- AOSSLink 99.01 — AOSSi_WLANGetBSSList 98.48 (908B), AOSSi_WLANConnect 98.71 (620B)
|
||||
- AOSS 98.42 — AOSS_Init_old 96.19 (6336B), AOSSApplyAuthOptions 98.77 (456B), AOSSXorBufferWithKey 98.61
|
||||
- iplAOSSThread 100, AOSSData 100
|
||||
|
||||
## get_friendinfo (88.04, 584B) — text-ptr early-pin wall
|
||||
Orig materializes `addi r29,r28,0x2b4` (mName) and later `addi r29,r28,0x2cc` (mDisplayText)
|
||||
EARLY — inside the FindPaneByName marshal window of each `set_textbox` call — pinning the
|
||||
text-ptr web in callee reg r29 across `bctrl`. Mine remats `addi r5` at the marshal point.
|
||||
Same pattern appears in `create` (r25 pin before `stw` field store + FindPaneByName chain).
|
||||
|
||||
FAILED variants (5+, all documented): `const wchar_t* name` local (MWCC forwards
|
||||
single-use locals to marshal), `pane`+`name` locals, pane-only local, reused `text` local
|
||||
with statement-level assignment, text decl before setName. MWCC remats cheap `this+const`
|
||||
expressions regardless of def site; orig's early materialization requires the web's DAG
|
||||
birth to precede the pane-chain eval — no source lever found.
|
||||
|
||||
## update_friendinfo (99.42) — 2-insn marshal-order swap
|
||||
38=38 insns; only diff: orig marshals `addi r4,r30,0x2b4` (src) before `addi r3,r31,8`
|
||||
(dst) in the wcsncpy marshal; mine dst then src. Named-local and early-birth variants
|
||||
failed — MWCC emits marshal webs in its own ready order.
|
||||
|
||||
## create (97.56, 3280B) — 2 missing insns + pin/rotation
|
||||
808 vs 810 insns. Marshal shape identical L-to-R (`mr r3; addi r4; addi r5; li r6; li r7; bl`).
|
||||
Residual: same text-ptr pin (addi r25,r29,0x2b4 before `stw r0,0x14(r27)` and inside
|
||||
marshal windows) + wholesale callee-window rotation (r30↔r31 const-table vs boardFile
|
||||
pin, deep r25-r31 webs).
|
||||
|
||||
## AOSSi_WLANGetBSSList (98.48, 908B) — sth placement + IV rotation
|
||||
227=227 insns. Two-loop IV web-home rotation (r26/r20 swap) + one `sth r5,0x40(r1)`
|
||||
placement bound to the `lhz` operand web home. Retry webs all init'd (no uninit signature).
|
||||
|
||||
## AOSSi_WLANConnect (98.71, 620B) — single li-placement
|
||||
155=155 insns. Only diff: `li r5,0x7c4` hoisted one slot before `mr r3,r27` in the memset
|
||||
marshal (const-li vs move emission order). `u32 ifConfigSize` named local REGRESSED (4 diffs);
|
||||
reverted. r28/r31 webs verified init'd — no uninit-read signature.
|
||||
|
||||
## AOSSApplyAuthOptions (98.77, 456B) — arg-save order + rotation
|
||||
Two arg-web home swaps (r5-arg→r24 vs orig arg1→r27 first — emission order of `mr` saves
|
||||
at fn entry) + cursor/literal-base swap (r29↔r31). Also `s_responseTypeByState` symbol
|
||||
shows as orig `lbl_81697210` — naming artifact, reloc target identical.
|
||||
|
||||
## AOSSXorBufferWithKey (98.61) — XOR-loop pointer web swap
|
||||
147=147 insns. Loop webs swapped: mine `add r4,r28,r3`/`add r5,r26,r3` vs orig r26/r28;
|
||||
`xor r6` vs `xor r0` result reg. Decl-order swap of `temporaryHalf`/`packetHalf`
|
||||
REGRESSED (moved temp-pointer web homes); reverted.
|
||||
|
||||
## AOSS_Init_old (96.19, 6336B) — deep wall
|
||||
1581 vs 1584 insns (~3 short), 1213 normalized diffs — mass web rotation across the whole
|
||||
fn (different callee layout → different numbering). Per-site: prologue `sth r4,0x28`/li
|
||||
placement, a free-check block ordering (`cmpwi;beq;bl Free;stw` on two globals), one
|
||||
`bne` vs `lwz+cmplwi+beq` shape. No source lever found; prior wave documented the same.
|
||||
|
||||
## uninit-read lever (PR #1270) — checked, N/A
|
||||
Verified orig stores every compared callee reg before use on all paths: WLANConnect
|
||||
`li r28,0`/`li r28,-1` stores before each `cmpwi r28,0`; GetBSSList retry webs init'd;
|
||||
create/AddressEdit inits all present. No fn emits an extra init orig lacks or reaches a
|
||||
compare with a path-unset reg.
|
||||
|
||||
## ppc_iro_level results (post-#1276 lever)
|
||||
- **get_friendinfo → 100%**: `#pragma push` + `ppc_iro_level 0` + named text locals
|
||||
(`const wchar_t* name = mString.mName;`, `text = mString.mDisplayText;`). The named
|
||||
local's def site births the text-ptr web early; IRO-0 blocks the remat that previously
|
||||
folded it to the marshal — orig's `addi r29,r28,0x2b4` early-pin reproduces
|
||||
(`_savegpr_28`/`_restgpr_28` match; residual = bare `bl` reloc offsets). Neither the
|
||||
local alone (forwarded) nor IRO-0 alone (still remat) sufficed — both needed.
|
||||
- **create 97.56 → 98.73** with `ppc_iro_level 1` (friendText locals already present).
|
||||
Levels 0 and 1 produce identical output here. Residual = callee-window rotation.
|
||||
- FAILED: AOSSi_WLANConnect (identical at 1/2, explodes to 219 at 0 — marshal swap
|
||||
unaffected), AOSSi_WLANGetBSSList (46 diffs at 0/1 = baseline), AOSSApplyAuthOptions
|
||||
(IRO-1 drops fuzzy 98.77→97.94 despite fewer normalized diffs — reverted),
|
||||
AOSSXorBufferWithKey (61→154 at IRO — reverted), AOSS_Init_old (1213 diffs at 0/1 =
|
||||
baseline — pragma no effect), update_friendinfo (IRO regresses 2→11 — reverted).
|
||||
|
||||
## Status
|
||||
**get_friendinfo is a NEW 100% fn** — owner PR bar (≥1 new 100% + zero regressions) met
|
||||
for a source-only PR. create improved to 98.73. Remaining fns stay at documented ties;
|
||||
units stay NonMatching.
|
||||
|
||||
## Post-#1277 rebase (origin/main@c723136f)
|
||||
Owner merged get_friendinfo+update_friendinfo via #1277 (IRO-1 + named locals — same
|
||||
decode). Branch now keeps only create's `ppc_iro_level 1` (98.73) + this log.
|
||||
|
||||
## libs/RevoEX/src/net/aes.c (added to leaf)
|
||||
- AESiEncryptBlock 65.81 (158=158 insns): whole-body table-load issue-order interleave.
|
||||
Orig hoists all 16 byte-extract rlwinm webs to the loop top then interleaves
|
||||
lwzx/rotlwi/xor; next-round key loads land mid-body. TRIED: IRO-0 (195 diffs, worse
|
||||
than 183 baseline), IRO-1 (same 195), `nextState[4]` array (183 = scalarized
|
||||
identical), `state[4]`+`nextState[4]` arrays (180), fused key-XOR into nextState
|
||||
assignments (192, savegpr_20). All reverted — issue-order wall, no lever.
|
||||
- AESiDecryptBlock 78.96 (246=246 insns): IRO-0/IRO-1 both drop fuzzy to ~70 (+7 insns,
|
||||
266 normalized diffs vs 290 baseline — normalized counts mislead again). Reverted.
|
||||
Allhands exhaustive-decl-order docs predate IRO but the pragma is verified harmful
|
||||
here — remaining residual is the same table-load scheduler family.
|
||||
|
||||
## MWCC scheduling-pragmas sweep (post-#1296 orchestrator hint)
|
||||
|
||||
Target: AESiEncryptBlock/DecryptBlock table-load interleave (orig hoists ~11 rlwinm
|
||||
extracts before first lwzx; ours issues loads after ~4).
|
||||
|
||||
Per-fn pragma results (normalized diffs -> objdiff fuzzy):
|
||||
- `#pragma scheduling off` EncryptBlock 183->178 norm, fuzzy 65.81->36.20 (revert)
|
||||
- `#pragma scheduling once` EncryptBlock 183->179 norm, fuzzy ->40.54 (revert)
|
||||
- `#pragma scheduling twice` EncryptBlock 183 (no change), DecryptBlock 290 (no change)
|
||||
- `#pragma scheduling 600` rejected by MWCC 3.0a5.2 (CPU names only)
|
||||
- `#pragma scheduling 750`/`gekko` 183 (=default), `603`/`generic` 237 (worse)
|
||||
- `#pragma schedule_twice on`/`scheduling on`/`twice` 183 (no-ops)
|
||||
- `-opt schedule_twice` cflag: not a valid -opt for 3.0a5.2 (opts: prop,strength,dead,peep,schedule,display|dump)
|
||||
- `-schedule twice|twice,750|=twice` cflag: all rejected by 3.0a5.2 arg parser
|
||||
- `-opt schedule` cflag: 183 (no change)
|
||||
|
||||
Source restructures (all reverted, fuzzy-measured):
|
||||
- 16 named table-value temps (t0..t15): 149 norm but fuzzy 65.81->58.99
|
||||
- named index vars i0..i15 + 16 loads: 149 norm (index vars forwarded/CSE'd), fuzzy also down
|
||||
- column-order extraction (all >>24, then >>16, >>8, &255): 228 norm (worse)
|
||||
|
||||
Cross-check on AOSS fns:
|
||||
- AOSSi_WLANConnect `scheduling twice`: norm 28->2 (li r5,0x7c4/mr r3,r27 pair only)
|
||||
BUT fuzzy unchanged 98.71 - remaining residual is the same marshal-order operand tie.
|
||||
- AOSSi_WLANGetBSSList `once` 46->43 norm, fuzzy 98.48->93.53 (harmful); `twice` no-op; `off` 69
|
||||
- AOSSXorBufferWithKey `twice` 61 (no-op); `off` 142 (worse)
|
||||
- AOSS_Init_old `twice` 1263 (no-op)
|
||||
|
||||
Conclusion: the AES interleave is NOT a scheduling-pragma wall - MWCC's default
|
||||
gekko scheduler already matches orig's pass config; the residual is allocator
|
||||
web-lifetime/ready-set structure with no known source lever. `scheduling twice`
|
||||
is a real lever ONLY for instruction-issue-order residuals (marshal pairs), and
|
||||
even there fixes ordering without moving objdiff fuzzy.
|
||||
|
||||
## Round 2: structural decode attempts on AESiEncryptBlock (orchestrator hint)
|
||||
|
||||
Baseline macro form remains best (183 norm, fuzzy 65.81). All reverted:
|
||||
- key as `const u32 (*key)[4]` pointer-to-row (+key++): identical 183
|
||||
- state[4]/nextState[4] with strided (i+k)&3 indices + for-loops: 230
|
||||
- fused `nextStateN = ENCRYPT(...) ^ key[N]` (states assigned at end): 231
|
||||
- state copied to t0..t3 temps at loop top: 183 (CSE folds)
|
||||
- two-phase combines (all rotated-halves then all tail-halves): 231
|
||||
- xor tree rebalance `(A^B)^(C^D)` and raw-term-first reorder: 175 norm, fuzzy 60.0/60.3
|
||||
- TU cflags -O4,s: 263 norm (worse); -O3: 177 norm, fuzzy 60.3/70.2 (worse)
|
||||
- prologue emits `srwi` extract before the input xors complete in BOTH objects;
|
||||
158=158 insns, all residuals are regname + issue-order inside an identical op set
|
||||
- AOSSi_WLANConnect residual is 2 diffs (mr r3,r27 / li r5,0x7c4 marshal order);
|
||||
pointer-local decl moved adjacent to memset: no change (baseline was already 2);
|
||||
direct-global &AOSSi_NcdIfConfig form: 163 (the local web is required)
|
||||
|
||||
Conclusion: the AES loop-body interleave is an allocator ready-set artifact;
|
||||
the register-lifetime shape that produces orig's ordering is not expressible
|
||||
through these source levers. No scheduling/-O lever improves fuzzy.
|
||||
|
||||
## Round 3: fn-local static lever (swarm #1299 hint) + pragma combos
|
||||
|
||||
Refuted for this leaf:
|
||||
- Op-multiset check: EncryptBlock and DecryptBlock emit IDENTICAL opcode
|
||||
histograms vs orig (158=158, same op counts) — residual is pure
|
||||
issue-order + regname. Any memory-backed intermediate (static buffer)
|
||||
ADDS lwz/stw ops orig provably lacks.
|
||||
- No SDA/r13/r2-relative accesses in orig AESi*Block, WLANConnect,
|
||||
WLANGetBSSList, AOSS_Init_old — globals go through lis+addi.
|
||||
- `static u32 sbuf[4]/nbuf[4]` state buffers: 305 norm diffs (lwz/stw
|
||||
traffic), reverted.
|
||||
- Pragma combos: iro1+sched-twice 195, iro0+sched-twice 195, iro2+sched-twice
|
||||
177 (all worse than 183 baseline or no better), iro1 alone 195.
|
||||
- mw_version lever reported dead by orchestrator (swept, identical/worse).
|
||||
|
||||
Standing wall: AESiEncryptBlock/DecryptBlock = allocator ready-set ordering
|
||||
inside an identical instruction multiset. No scheduling/IRO/O-level/cflag/
|
||||
static/source-structure lever changes it in the right direction.
|
||||
AOSSi_WLANConnect: 2-insn marshal-order pair (mr r3,r27 vs li r5,0x7c4);
|
||||
all decl/static/source forms tried.
|
||||
|
||||
## Round 4: const-source + scoped-table hint (#1304) + Init_old op-diff decode
|
||||
|
||||
Post-#1296 rebase state: AOSSXorBufferWithKey landed by swarm (100). Remaining
|
||||
in leaf: AOSS_Init_old 96.62, AOSSi_WLANGetBSSList 98.48,
|
||||
AOSSi_WLANConnect 98.71, AESi*Block (stays as-is per orchestrator).
|
||||
|
||||
AOSS_Init_old op-histogram diffs (M=mine vs orig): add +1, b -1, bgt +1,
|
||||
ble -1, bne -3, cmplw +2, cmplwi -2, li -1, mr +1 — real structural gap:
|
||||
- Mine emits `cmplw r3,r27` at the two AOSSi_Alloc NULL checks (0xc94/0x154c)
|
||||
where orig emits `cmpwi r3,0` — the classic pinned-zero wall: MWCC shared
|
||||
one zero web in r27 across the fn's many li 0/cmpwi sites; orig
|
||||
rematerializes. All 4 pragma variants (iro 0/1/2, iro1+sched-twice) no-op.
|
||||
- Orig keeps 3 more `bne` and 2 more `cmplwi r0,1` (0xd60/0x1620 = likely
|
||||
AOSSi_cancel_flag==1 sites where mine fused differently).
|
||||
|
||||
Scoped-retry-counter attempt (move unlockRetries/cleanupRetries/scanRetries
|
||||
to uninit decls + assign before each loop — births webs later per the scoped-
|
||||
locals hint): GetBSSList 46->167 diffs, reverted.
|
||||
|
||||
WLANConnect memset(&AOSSi_NcdIfConfig) direct-global + memsetTarget alias
|
||||
forms: both still forward to the r27 web, 2 diffs unchanged.
|
||||
|
||||
const-table analysis: ipAddress/etc are non-const .data (written by
|
||||
AOSS_SetStaticIpConfig) — can't be const; supportedRates is .data non-const
|
||||
matching orig's sections (no .rodata in orig .o) — const would break data.
|
||||
|
||||
## Round 5: Init_old u32-deref decode (orchestrator's missing-checks lead)
|
||||
|
||||
Orchestrator hypothesized missing cancel_flag reads — refuted: 14 lwz
|
||||
AOSSi_cancel_flag sites in BOTH objects. Orig's extra cmplwi r0,1 at
|
||||
0xd60/0x1620 are `*s_accessPointConfig == 1` compares: MWCC emits cmplwi
|
||||
(unsigned) vs my cmpwi (signed) keyed off the COMPARE OPERAND's type —
|
||||
s_accessPointConfig stays `int*` (file is full of (int*)0x0 literal casts)
|
||||
but the deref needs an unsigned compare: `(u32)*s_accessPointConfig == 1u`
|
||||
at the two wait-loop break sites (lines 881/1233) matching line 675's
|
||||
existing pattern. All 3 sites now cmplwi r0,1; cmplwi count 17=17.
|
||||
Init_old 96.62 -> 96.69; fn now 1581 vs orig 1584 insns.
|
||||
|
||||
Remaining real gaps: pinned-zero cmplw r3,r27 at both AOSSi_Alloc NULL
|
||||
checks vs orig cmpwi r3,0 (all pragma forms no-op); bgt-vs-ble+b layout at
|
||||
the manufacturerLength<=0xd memcpy guard (goto form folds back to bgt —
|
||||
orig's 2-branch layout implies a merge/region structure source can't
|
||||
reproduce); net -3 insns somewhere in mass-rotation noise.
|
||||
|
||||
## Round 6: #1311 levers (declsearch, inline-helper, marshal forms) post-#1314
|
||||
|
||||
Post-rebase scope: GetBSSList matched by swarm #1314; aes Matching #1311
|
||||
(object rebuilds identical). Remaining: AOSS_Init_old 96.70,
|
||||
AOSSi_WLANConnect 98.71.
|
||||
|
||||
WLANConnect 2-insn marshal swap (li r5,0x7c4 vs mr r3,r27 order) refuted
|
||||
with ALL new levers: (void*)ipConfig, sizeof(AOSSi_NcdIpConfig), folded
|
||||
`memset(ipConfig = &...,...)` assignment form, and static-inline
|
||||
pointer-param helper AOSSi_ClearIpConfig — every form keeps the r27 web and
|
||||
MWCC emits mr-first. Pure marshal-order tie; declsearch found only the 2
|
||||
leading decls (no improvement).
|
||||
|
||||
Init_old: declsearch.py --lines 391 435 (45-decl block, 100 evals) found a
|
||||
marginally better order (waitAttempt front, initialWait later): kept,
|
||||
96.69 -> 96.70. Pinned-zero root located: `li r27,0`@0xb34 — ONE shared
|
||||
zero web pinned fn-wide (stw/sth stores + addc/adde + 2 cmplw) where orig
|
||||
pins `input` in r27 (addi r27,r4,0) and remats zero per-site. Orig's
|
||||
pinned-input vs pinned-zero callee choice is an allocator web-priority
|
||||
decision; source can't declare which constant webs win a callee reg.
|
||||
|
||||
## Round 7: cross-block-use copies (o2-aoss doc), Init_old pinned-zero crack
|
||||
|
||||
o2-aoss.attempts.md methodology applied. WLANConnect second-memset marshal:
|
||||
cross-block-use copy is refuted structurally — the ONLY post-copy use of an
|
||||
ipConfig alias is NCDSetIpConfig, which sits in the SAME block as the copy
|
||||
birth (the if-test IS the block terminator) — block-local copy forwarding
|
||||
(0x596850) kills it. Verified: configMem-as-takeover (all later uses),
|
||||
configMem-as-parallel-web (NCDSetIpConfig only), configMem = &AOSSi_NcdIpConfig
|
||||
(second materialization — CSE'd into r27 web), (u8*) typed view, void* view —
|
||||
all 2 diffs. No other-block use exists in the fn (field writes + call all in
|
||||
the memset block). Doc's alternatives already covered: struct-wrap gives
|
||||
right order +1 insn (addi r27,r3,0x160).
|
||||
|
||||
Init_old pinned-zero pair cracked for ONE site: `(int)s_accessPointConfig == 0`
|
||||
at line ~1203 gives orig's `cmpwi r3,0` at 0x154c (the pinned r27-zero web is
|
||||
not live there). Same cast at line 627 site (0xc94) stays `cmplw r3,r27` —
|
||||
the r27 web (born 0xb34) is live at that point so MWCC prefers reg-compare;
|
||||
named `allocCheck` local folds via VN canonicalization. 0xc18 `cmplw r3,r4`
|
||||
vs `r3,r0` is the u64 bound-check idiom, pure operand-name drift.
|
||||
|
||||
Allocator analysis: orig splits input's web (r15 early -> addi r27,r4,0 re-home
|
||||
at 0xb1c for the 0x14/0x10/0x18 field reads) and remats `li r0,0` at ~25 sites.
|
||||
Mine keeps input in r15 fn-wide and fuses all zeroes into the r27 web.
|
||||
The re-home is a backend web-split, not a source copy (copies die in COpt
|
||||
pre-phase). Remaining levers exhausted: declsearch r2 pending.
|
||||
Reference in New Issue
Block a user