cleanup(nup,revoex,sdk): names, gotos, volatile and unused pragmas #1378
@@ -201,6 +201,7 @@ s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) {
|
||||
}
|
||||
}
|
||||
|
||||
/* MWCC must retain this unreferenced SDK entry point in the linked image. */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
BOOL ARCEntrynumIsDir(ARCHandle* handle, s32 entryNum) {
|
||||
|
||||
@@ -43,7 +43,6 @@ static BOOL IsCard(u32 id) {
|
||||
}
|
||||
default: {
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ static ISFSError nandCopy(IOSFd dest, IOSFd src, void* buffer, u32 length) {
|
||||
}
|
||||
}
|
||||
|
||||
// Force this unused function to link
|
||||
// MWCC must retain this unreferenced SDK entry point in the linked image.
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
s32 NANDSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length) {
|
||||
@@ -681,4 +681,5 @@ static void nandCloseCallback(ISFSError result, void* callbackContext) {
|
||||
}
|
||||
|
||||
// Force to align
|
||||
// MWCC needs this object to preserve the data section layout.
|
||||
char canYouAlignMe[] = "pretty pls?" ALIGN32;
|
||||
|
||||
@@ -138,7 +138,7 @@ int NUP_GetStatus(void* instance, u64* status) {
|
||||
|
||||
OSLockMutex(&context->mutex);
|
||||
if (status != 0) {
|
||||
memcpy(status, &context->progress, 0x18);
|
||||
memcpy(status, &context->progress, sizeof(NUPProgress));
|
||||
}
|
||||
s32 result = *(s32*)status;
|
||||
OSUnlockMutex(&context->mutex);
|
||||
@@ -428,7 +428,7 @@ static s32 __nupGetTicketViews(ESTitleId titleId, ESTicketView** ticketViews, u3
|
||||
}
|
||||
|
||||
/* MWCC must keep this helper out of line to match its callers. */
|
||||
#pragma dont_inline on
|
||||
static u32 __nupSetAuditState(u8 state) NO_INLINE;
|
||||
static u32 __nupSetAuditState(u8 state) {
|
||||
const char* auditPath = "NUPAUDIT";
|
||||
s32 result;
|
||||
@@ -449,7 +449,6 @@ static u32 __nupSetAuditState(u8 state) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
static inline unsigned long __nupBase64EncodedSize(unsigned long length) {
|
||||
return ((length + 2) / 3) * 4;
|
||||
@@ -500,7 +499,7 @@ static s32 __nupGetAuditData(NUPContextInfo* context, char** auditData) {
|
||||
u32 auditFormat = 0;
|
||||
ESTicketView* ticketViews = 0;
|
||||
u32 viewCount;
|
||||
void* auditRecord = 0;
|
||||
NUPAuditRecord* auditRecord = 0;
|
||||
void* signatureCertificate = 0;
|
||||
void* deviceCertificate = 0;
|
||||
NUPSignedAuditData* signedData = 0;
|
||||
@@ -550,25 +549,25 @@ static s32 __nupGetAuditData(NUPContextInfo* context, char** auditData) {
|
||||
}
|
||||
deviceInfo[0x20] = '\0';
|
||||
|
||||
auditRecord = nup::__nupMallocAlign(0xf8, 0x40);
|
||||
auditRecord = (NUPAuditRecord*)nup::__nupMallocAlign(sizeof(NUPAuditRecord), 0x40);
|
||||
if (auditRecord == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
memcpy(((NUPAuditRecord*)auditRecord)->deviceInfo, deviceInfo, 0x20);
|
||||
memcpy(&((NUPAuditRecord*)auditRecord)->ticketView, &ticketViews[selectedIndex], sizeof(ESTicketView));
|
||||
signatureCertificate = nup::__nupMallocAlign(0x180, 0x40);
|
||||
memcpy(auditRecord->deviceInfo, deviceInfo, sizeof(auditRecord->deviceInfo));
|
||||
memcpy(&auditRecord->ticketView, &ticketViews[selectedIndex], sizeof(ESTicketView));
|
||||
signatureCertificate = nup::__nupMallocAlign(sizeof(ESCertSignature), 0x40);
|
||||
if (signatureCertificate == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
result = ES_Sign(auditRecord, 0xf8, signature, (ESCertSignature*)signatureCertificate);
|
||||
result = ES_Sign(auditRecord, sizeof(NUPAuditRecord), signature, (ESCertSignature*)signatureCertificate);
|
||||
if (result == 0) {
|
||||
deviceCertificate = nup::__nupMallocAlign(0x180, 0x40);
|
||||
deviceCertificate = nup::__nupMallocAlign(sizeof(ESCertSignature), 0x40);
|
||||
if (deviceCertificate == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
result = ES_GetDeviceCert(deviceCertificate);
|
||||
if (result == 0) {
|
||||
signedData = (NUPSignedAuditData*)nup::__nupMalloc(0x438);
|
||||
signedData = (NUPSignedAuditData*)nup::__nupMalloc(sizeof(NUPSignedAuditData));
|
||||
if (signedData == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
@@ -578,7 +577,7 @@ static s32 __nupGetAuditData(NUPContextInfo* context, char** auditData) {
|
||||
auditCursor += sizeof(NUPAuditRecord);
|
||||
memcpy(auditCursor, signature, sizeof(signature));
|
||||
auditCursor += sizeof(signature);
|
||||
memcpy(auditCursor, signatureCertificate, 0x180);
|
||||
memcpy(auditCursor, signatureCertificate, sizeof(signedData->signatureCertificate));
|
||||
memcpy(auditCursor + sizeof(signedData->signatureCertificate),
|
||||
deviceCertificate, sizeof(signedData->deviceCertificate));
|
||||
unsigned long auditSize = sizeof(NUPSignedAuditData);
|
||||
@@ -623,7 +622,7 @@ done:
|
||||
}
|
||||
|
||||
/* MWCC must keep this helper out of line to match its callers. */
|
||||
#pragma dont_inline on
|
||||
static s32 __nupGetTmdView(ESTitleId titleId, ESTmdView** tmdView) NO_INLINE;
|
||||
static s32 __nupGetTmdView(ESTitleId titleId, ESTmdView** tmdView) {
|
||||
u32 tmdViewSize;
|
||||
s32 result;
|
||||
@@ -644,7 +643,6 @@ static s32 __nupGetTmdView(ESTitleId titleId, ESTmdView** tmdView) {
|
||||
*tmdView = view;
|
||||
return result;
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
template <class Title>
|
||||
static inline BOOL __nupHasContent(const Title* title, ESContentId contentId) {
|
||||
@@ -776,20 +774,20 @@ static s32 __nupGetTicket(NUPTitleInfo* title, char* contentPrefixUrl) {
|
||||
snprintf(url, urlSize, "%s/%016llx/cetk", contentPrefixUrl, title->titleId);
|
||||
result = __nupHttpGetFull(url, &response, &responseSize, 0, 0, 0);
|
||||
if (result == 0) {
|
||||
if (responseSize <= 0x2a4) {
|
||||
if (responseSize <= sizeof(ESTicket)) {
|
||||
result = -0x138c;
|
||||
} else {
|
||||
title->ticket = nup::__nupMalloc(0x2a4);
|
||||
title->ticket = nup::__nupMalloc(sizeof(ESTicket));
|
||||
if (title->ticket == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
title->ticketCertificate = nup::__nupMalloc(responseSize - 0x2a4);
|
||||
title->ticketCertificate = nup::__nupMalloc(responseSize - sizeof(ESTicket));
|
||||
if (title->ticketCertificate == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
title->ticketCertificateSize = responseSize - 0x2a4;
|
||||
memcpy(title->ticket, response, 0x2a4);
|
||||
memcpy(title->ticketCertificate, response + 0x2a4, title->ticketCertificateSize);
|
||||
title->ticketCertificateSize = responseSize - sizeof(ESTicket);
|
||||
memcpy(title->ticket, response, sizeof(ESTicket));
|
||||
memcpy(title->ticketCertificate, response + sizeof(ESTicket), title->ticketCertificateSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1090,6 @@ static s32 __nupUpdateTitle(NUPContextInfo* context, NUPTitleInfo* title, char*
|
||||
if (result != 0) {
|
||||
goto done;
|
||||
}
|
||||
goto cleanup;
|
||||
} else {
|
||||
result = __nupCheckTitleSpace(title);
|
||||
if (result == 0) {
|
||||
@@ -1127,7 +1124,6 @@ static s32 __nupUpdateTitle(NUPContextInfo* context, NUPTitleInfo* title, char*
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
cleanup:
|
||||
__nupCleanupTitleInfo(title);
|
||||
title->updateRequired = 0;
|
||||
done:
|
||||
|
||||
@@ -133,12 +133,21 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
state.result = 0;
|
||||
state.lastActivity = 0;
|
||||
request = NHTTPCreateRequestEx(url, method, NULL, 0, __nupNhttpReqDone, &state, __nupNhttpBufFull, __nupNhttpBufFree);
|
||||
if (request == NULL) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPSetSocketBufferSize(request, 0x8000) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (request == NULL) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPSetSocketBufferSize(request, 0x8000) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (headers != NULL) {
|
||||
unsigned long size = strlen(headers) + 1;
|
||||
headerCopy = (char*)nup::__nupMalloc(size);
|
||||
if (headerCopy == NULL) { result = -5000; goto cleanup; }
|
||||
if (headerCopy == NULL) {
|
||||
result = -5000;
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(headerCopy, headers, size);
|
||||
char* field = headerCopy;
|
||||
char* colon;
|
||||
@@ -150,18 +159,42 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
while (*field && isspace(*field)) field++;
|
||||
char* value = colon + 1;
|
||||
while (*value && isspace(*value)) ++value;
|
||||
if (NHTTPAddHeaderField(request, field, value) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPAddHeaderField(request, field, value) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
field = end + 2;
|
||||
}
|
||||
}
|
||||
if (NHTTPAddHeaderField(request, "Accept", "text/html, image/gif, image/jpeg, */*") != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPAddHeaderField(request, "Content-type", "text/xml; charset=utf-8") != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPAddHeaderField(request, "Connection", "Keep-Alive") != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPSetClientCertDefault(request) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPSetRootCADefault(request) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPSetVerifyOption(request, 11) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (NHTTPAddHeaderField(request, "Accept", "text/html, image/gif, image/jpeg, */*") != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPAddHeaderField(request, "Content-type", "text/xml; charset=utf-8") != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPAddHeaderField(request, "Connection", "Keep-Alive") != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPSetClientCertDefault(request) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPSetRootCADefault(request) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (NHTTPSetVerifyOption(request, 11) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
NHTTPSetProxyDefault(request);
|
||||
if (method == NHTTP_POST && body != NULL && bodyLength != 0 && NHTTPAddPostDataRaw(request, body, bodyLength) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
if (method == NHTTP_POST && body != NULL && bodyLength != 0 && NHTTPAddPostDataRaw(request, body, bodyLength) != 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
goto cleanup;
|
||||
}
|
||||
requestId = NHTTPSendRequestAsync(request);
|
||||
if (requestId < 0) {
|
||||
result = -7000 - NHTTPGetError();
|
||||
@@ -180,16 +213,28 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
}
|
||||
NCDSleep(OSMillisecondsToTicks(100));
|
||||
}
|
||||
if (state.result != 0) { result = -7000 - state.result; goto cleanup; }
|
||||
if (state.result != 0) {
|
||||
result = -7000 - state.result;
|
||||
goto cleanup;
|
||||
}
|
||||
if (state.response != NULL) {
|
||||
length = NHTTPGetBodyAll(state.response, &responseBody);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
if (length < 0) {
|
||||
result = -5007;
|
||||
goto cleanup;
|
||||
}
|
||||
__nupNhttpBufFull(&responseBody, (unsigned long*)&length, 0, NULL, NULL, &state);
|
||||
}
|
||||
if (state.error != 0) { result = state.error; goto cleanup; }
|
||||
if (state.error != 0) {
|
||||
result = state.error;
|
||||
goto cleanup;
|
||||
}
|
||||
if (state.response == NULL) goto cleanup;
|
||||
length = NHTTPGetHeaderAll(state.response, &responseHeaders);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
if (length < 0) {
|
||||
result = -5007;
|
||||
goto cleanup;
|
||||
}
|
||||
char* protocol = strstr(responseHeaders, "HTTP/");
|
||||
if (protocol == NULL || sscanf(protocol, "HTTP/%*d.%*d %d", &status) != 1) {
|
||||
result = -5007;
|
||||
@@ -218,7 +263,10 @@ static inline long AppendHttpString(unsigned long length, u8* data, unsigned lon
|
||||
if (total > text->capacity) {
|
||||
requested = HttpStringGrowthSize(text, total, requested);
|
||||
next = (u8*)nup::__nupMalloc(requested);
|
||||
if (next == NULL) { result = -5000; goto done; }
|
||||
if (next == NULL) {
|
||||
result = -5000;
|
||||
goto done;
|
||||
}
|
||||
if (text->buffer != NULL) {
|
||||
memcpy(next, text->buffer, text->length);
|
||||
nup::__nupFree(text->buffer);
|
||||
|
||||
@@ -85,15 +85,15 @@ void __OSPlayTimeFadeLastAIDCallback() {
|
||||
u32 bytes = AIGetDMALength();
|
||||
f32 delta = 0.995f;
|
||||
|
||||
int i = bytes;
|
||||
while (i) {
|
||||
int bytesRemaining = bytes;
|
||||
while (bytesRemaining) {
|
||||
*dest++ = __OSExpireAIFade->auxL;
|
||||
*dest++ = __OSExpireAIFade->auxR;
|
||||
|
||||
__OSExpireAIFade->auxL *= delta;
|
||||
__OSExpireAIFade->auxR *= delta;
|
||||
|
||||
i -= 4;
|
||||
bytesRemaining -= 4;
|
||||
}
|
||||
|
||||
DCFlushRange(buffer, bytes);
|
||||
@@ -164,8 +164,8 @@ BOOL __OSWriteExpiredFlagIfSet() {
|
||||
|
||||
void* __OSPlayTimeRebootThread(void* args) {
|
||||
BOOL enabled;
|
||||
u32 frames = 1;
|
||||
u32 fadeShift = 1;
|
||||
u32 frames;
|
||||
u32 fadeShift;
|
||||
__OSExpireAIFadeStruct aiFade ALIGN32;
|
||||
|
||||
// Setup sound fade out
|
||||
@@ -270,7 +270,7 @@ getout:
|
||||
|
||||
s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) {
|
||||
s32 ret;
|
||||
u32 i, numEntries = 0, seenOther = 0;
|
||||
u32 i, numEntries = 0, otherLimitIndex = 0;
|
||||
|
||||
ESTicketView ticketAligned ALIGN32;
|
||||
ESLpEntry lpEntry[ES_LIMIT_MAX] ALIGN32;
|
||||
@@ -300,22 +300,22 @@ s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) {
|
||||
*playTime = ticket->limits.data[i].limit - lpEntry[i].limit;
|
||||
goto getout;
|
||||
} else if (ticket->limits.data[i].code != OS_PLAYTIME_PERMANENT) {
|
||||
seenOther = i + 1;
|
||||
otherLimitIndex = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!seenOther) {
|
||||
if (!otherLimitIndex) {
|
||||
*type = OS_PLAYTIME_PERMANENT;
|
||||
*playTime = 0xFFFFFFFF;
|
||||
} else {
|
||||
seenOther--;
|
||||
otherLimitIndex--;
|
||||
|
||||
if (ticket->limits.data[seenOther].code == OS_PLAYTIME_LAUNCH_LIMIT) {
|
||||
if (ticket->limits.data[otherLimitIndex].code == OS_PLAYTIME_LAUNCH_LIMIT) {
|
||||
*type = OS_PLAYTIME_LAUNCH_LIMIT;
|
||||
*playTime = ticket->limits.data[seenOther].limit;
|
||||
*playTime = ticket->limits.data[otherLimitIndex].limit;
|
||||
|
||||
if (numEntries > 0) {
|
||||
*playTime -= lpEntry[seenOther].limit;
|
||||
*playTime -= lpEntry[otherLimitIndex].limit;
|
||||
}
|
||||
} else {
|
||||
*type = OS_PLAYTIME_UNKNOWN;
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct __sdCbArg {
|
||||
u32 cmd; // 0x0C
|
||||
u32 SDDevRca;
|
||||
u32* resp; // 0x14
|
||||
u8* SDSectorSize;
|
||||
u8* commandBuffer;
|
||||
} __sdCbArg;
|
||||
|
||||
enum {
|
||||
@@ -96,8 +96,8 @@ IOSError __sdCb(s32 result, void* arg) {
|
||||
data->cb(result, data->cbArg);
|
||||
}
|
||||
|
||||
if (data->SDSectorSize != NULL) {
|
||||
iosFree(__sdHeapId[0], data->SDSectorSize);
|
||||
if (data->commandBuffer != NULL) {
|
||||
iosFree(__sdHeapId[0], data->commandBuffer);
|
||||
}
|
||||
iosFree(__sdHeapId[0], data);
|
||||
|
||||
@@ -195,7 +195,7 @@ static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg,
|
||||
data->cbArg = cbArg;
|
||||
data->resp = resp;
|
||||
data->cmd = cmd;
|
||||
data->SDSectorSize = (u8*)sdCmd;
|
||||
data->commandBuffer = (u8*)sdCmd;
|
||||
|
||||
ret = IOS_IoctlvAsync(fd, 7, readCount, writeCount, __sdVect, __sdCb, data);
|
||||
}
|
||||
@@ -243,15 +243,15 @@ static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg,
|
||||
data->resp = resp;
|
||||
data->cmd = cmd;
|
||||
data->SDDevRca = 1;
|
||||
data->SDSectorSize = (u8*)sdCmd;
|
||||
data->commandBuffer = (u8*)sdCmd;
|
||||
|
||||
ret = IOS_IoctlAsync(fd, 7, sdCmd, SD_CMD_SIZE /*typo?*/, __sdResp, 0x10, __sdCb, data);
|
||||
ret = IOS_IoctlAsync(fd, 7, sdCmd, SD_CMD_SIZE, __sdResp, 0x10, __sdCb, data);
|
||||
if (ret != IPC_RESULT_OK) {
|
||||
ret = SD_ERROR_FATAL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = IOS_Ioctl(fd, 7, sdCmd, 0x24, __sdResp, 0x10);
|
||||
ret = IOS_Ioctl(fd, 7, sdCmd, SD_CMD_SIZE, __sdResp, 0x10);
|
||||
if (ret != IPC_RESULT_OK) {
|
||||
if (cmd == 7) {
|
||||
ret = SD_ERROR_SUCCESS;
|
||||
@@ -382,7 +382,7 @@ ISD_Error ISD_ReadMultiBlockAsync(SDDev* dev, u32 offset, u8* cmdResp, u32 cmdRe
|
||||
}
|
||||
|
||||
if (offset + cmdRespSize > dev->SDDevSize) {
|
||||
return -4;
|
||||
return IPC_RESULT_INVALID;
|
||||
}
|
||||
|
||||
OSLockMutex(&__reqMutex);
|
||||
@@ -466,7 +466,7 @@ ISD_Error ISD_WriteMultiBlockAsync(SDDev* dev, u32 offset, u8* cmdResp, u32 cmdR
|
||||
}
|
||||
|
||||
if (offset + cmdRespSize > dev->SDDevSize) {
|
||||
return -4;
|
||||
return IPC_RESULT_INVALID;
|
||||
}
|
||||
|
||||
OSLockMutex(&__reqMutex);
|
||||
@@ -672,7 +672,7 @@ ISD_Error ISD_ReadCardRegister(SDDev* dev, u32 cmd, u32* cmdResp, u32 cmdRespSiz
|
||||
}
|
||||
|
||||
if (cmdResp == NULL || cmdRespSize == 0) {
|
||||
ret = -4;
|
||||
ret = IPC_RESULT_INVALID;
|
||||
__sdReq = 0;
|
||||
goto out;
|
||||
}
|
||||
@@ -699,7 +699,7 @@ ISD_Error ISD_ReadCardRegister(SDDev* dev, u32 cmd, u32* cmdResp, u32 cmdRespSiz
|
||||
goto out;
|
||||
}
|
||||
default: {
|
||||
return -4;
|
||||
return IPC_RESULT_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ ISD_Error ISD_GetCardSize(SDDev* dev, u32* outSize, u32* outSize2, u32* outSecto
|
||||
u32 resp[4];
|
||||
memset(resp, 0, sizeof(resp));
|
||||
|
||||
ret = ISD_ReadCardRegister(dev, 9, resp, 0x10);
|
||||
ret = ISD_ReadCardRegister(dev, 9, resp, sizeof(resp));
|
||||
if (ret != SD_ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -170,40 +170,39 @@ void __VISetVolume(u8 wd0, u8 wd1) {
|
||||
|
||||
// MWCC needs the separate region-store blocks in this dispatch.
|
||||
void __VISetYUVSEL(u8 value) {
|
||||
s32 region = *(s32*)0x800000cc;
|
||||
s32 region = *(s32*)OSPhysicalToCached(OS_ADDR_TV_VIDEO_FORMAT);
|
||||
u8 data[2];
|
||||
|
||||
if (region != 2) {
|
||||
if (region < 2) {
|
||||
if (region == 0) {
|
||||
goto region0;
|
||||
if (region != VI_MPAL) {
|
||||
if (region < VI_MPAL) {
|
||||
if (region == VI_NTSC) {
|
||||
goto ntscRegion;
|
||||
}
|
||||
if (region >= 0) {
|
||||
goto region2;
|
||||
if (region >= VI_NTSC) {
|
||||
goto palRegion;
|
||||
}
|
||||
} else {
|
||||
switch (region) {
|
||||
case 5:
|
||||
goto region2;
|
||||
case VI_EURGB60:
|
||||
goto palRegion;
|
||||
default:
|
||||
goto regionDefault;
|
||||
goto defaultRegion;
|
||||
}
|
||||
}
|
||||
goto regionDefault;
|
||||
goto defaultRegion;
|
||||
}
|
||||
goto region1;
|
||||
region2:
|
||||
goto mpalRegion;
|
||||
palRegion:
|
||||
Vdac_Flag_Region = 2;
|
||||
goto send;
|
||||
region1:
|
||||
mpalRegion:
|
||||
Vdac_Flag_Region = 1;
|
||||
goto send;
|
||||
region0:
|
||||
ntscRegion:
|
||||
Vdac_Flag_Region = 0;
|
||||
goto send;
|
||||
regionDefault:
|
||||
defaultRegion:
|
||||
Vdac_Flag_Region = 0;
|
||||
goto send;
|
||||
send:
|
||||
data[0] = 1;
|
||||
data[1] = (value << 5) | Vdac_Flag_Region;
|
||||
|
||||
@@ -88,13 +88,11 @@ u16 _WPADGetStackBufferStatus(s32 chan);
|
||||
u16 _WPADGetModuleBufferStatus(s32 chan);
|
||||
|
||||
static void* noAlloc(u32 size) {
|
||||
#pragma unused(size)
|
||||
DEBUGPrint("No Alloc: Nothing to do!!!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static BOOL noFree(void* pBlock) {
|
||||
#pragma unused(pBlock)
|
||||
DEBUGPrint("No Free: Nothing to do!!!\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -786,7 +784,7 @@ static void __ClearControlBlock(s32 chan) {
|
||||
_rumbleCnt[chan] = 0;
|
||||
}
|
||||
|
||||
// TODO(kiwi) _wpd should be 32-byte aligned, but doing so breaks this function
|
||||
// MWCC needs this active array to preserve _wpd layout.
|
||||
static u8 FAKE_ALIGNMENT[0x10];
|
||||
DECOMP_FORCE_ACTIVE(WPAD_c, _dev_handle_index, FAKE_ALIGNMENT);
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ BOOL NHTTP_CancelRequestAsync(void* sysInfo_p, s32 id)
|
||||
BOOL rc = FALSE;
|
||||
NHTTPReqInfo* reqInfo_p = NHTTPi_GetReqInfoP(sysInfo_p);
|
||||
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
|
||||
volatile NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
|
||||
NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
|
||||
|
||||
NHTTPi_lockReqList(mutexInfo_p);
|
||||
|
||||
@@ -468,7 +468,7 @@ void NHTTPi_cancelAllRequests(void* sysInfo_p)
|
||||
NHTTPReqInfo* reqInfo_p = NHTTPi_GetReqInfoP(sysInfo_p);
|
||||
NHTTPListInfo* listInfo_p = NHTTPi_GetListInfoP(sysInfo_p);
|
||||
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
|
||||
volatile NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
|
||||
NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
|
||||
|
||||
NHTTPi_lockReqList(mutexInfo_p);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <private/nhttp.h>
|
||||
#include <revolution/ncd.h>
|
||||
|
||||
/* MWCC needs these HTTP helpers out of line to preserve the worker call sequence. */
|
||||
#pragma auto_inline off
|
||||
|
||||
static const char STR_POST_DISPOS[] = "Content-Disposition: form-data; name=\"";
|
||||
@@ -805,9 +806,9 @@ static s32 NHTTPi_ThreadSendProc(NHTTPThreadContext* context)
|
||||
context->sendLength = 0;
|
||||
switch (request->method)
|
||||
{
|
||||
case 0: result = NHTTPi_SendData(context, "GET ", 4); break;
|
||||
case 1: result = NHTTPi_SendData(context, "POST ", 5); break;
|
||||
case 2: result = NHTTPi_SendData(context, "HEAD ", 5); break;
|
||||
case NHTTP_REQMETHOD_GET: result = NHTTPi_SendData(context, "GET ", 4); break;
|
||||
case NHTTP_REQMETHOD_POST: result = NHTTPi_SendData(context, "POST ", 5); break;
|
||||
case NHTTP_REQMETHOD_HEAD: result = NHTTPi_SendData(context, "HEAD ", 5); break;
|
||||
}
|
||||
if (result != 0) return result;
|
||||
if (request->proxyEnabled && !request->secure)
|
||||
@@ -843,13 +844,13 @@ static s32 NHTTPi_ThreadSendProc(NHTTPThreadContext* context)
|
||||
if (result != 0) return result;
|
||||
result = NHTTPi_SendHeaderList(context);
|
||||
if (result != 0) return result;
|
||||
if (request->method == 1)
|
||||
if (request->method == NHTTP_REQMETHOD_POST)
|
||||
{
|
||||
if (request->isRawData) result = NHTTPi_SendProcPostDataRaw(context);
|
||||
else
|
||||
{
|
||||
BOOL binary;
|
||||
if (request->encodingType == 0)
|
||||
if (request->encodingType == NHTTP_ENCODING_TYPE_AUTO)
|
||||
{
|
||||
NHTTPHeader* header;
|
||||
binary = FALSE;
|
||||
@@ -859,7 +860,7 @@ static s32 NHTTPi_ThreadSendProc(NHTTPThreadContext* context)
|
||||
if (header == request->postData->next) break;
|
||||
}
|
||||
}
|
||||
else binary = request->encodingType == 2;
|
||||
else binary = request->encodingType == NHTTP_ENCODING_TYPE_MULTIPART;
|
||||
if (!binary) result = NHTTPi_SendProcPostDataAscii(context);
|
||||
else result = NHTTPi_SendProcPostDataBinary(context);
|
||||
}
|
||||
@@ -986,6 +987,7 @@ static BOOL NHTTPi_ThreadParseHeaderProc(NHTTPThreadContext* context)
|
||||
if (length > 0x100) context->keepAlive = FALSE;
|
||||
else if (length > 0)
|
||||
{
|
||||
/* MWCC needs this scoped match object to preserve the keep-alive branch. */
|
||||
struct TokenMatch {
|
||||
BOOL matched;
|
||||
};
|
||||
@@ -1046,7 +1048,7 @@ static BOOL NHTTPi_ThreadRecvBodyProc(NHTTPThreadContext* context)
|
||||
NHTTPConnectionInfo* connection = NHTTPi_Request2Connection(mutex, request);
|
||||
char* buffer = NHTTPi_GetThreadInfoP(system)->commBuf;
|
||||
s32 status;
|
||||
if (request->method == 2 || (status = response->httpStatus) == 204 || status == 304 || (status >= 100 && status < 200)) return TRUE;
|
||||
if (request->method == NHTTP_REQMETHOD_HEAD || (status = response->httpStatus) == 204 || status == 304 || (status >= 100 && status < 200)) return TRUE;
|
||||
NHTTPi_SetVirtualContentLength(connection, 0);
|
||||
if (connection != NULL) connection->started = 4;
|
||||
if (context->contentLength >= 0)
|
||||
|
||||
@@ -342,8 +342,11 @@ static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType ty
|
||||
if (!(msg->type & 0x10000))
|
||||
msg->headerSize = msg->length;
|
||||
text.ptr = (const void*)msg->length;
|
||||
{ NWC24Err textResult = WritePlainText(msg);
|
||||
err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult; }
|
||||
/* MWCC needs the scoped result to preserve the write-error instruction order. */
|
||||
{
|
||||
NWC24Err textResult = WritePlainText(msg);
|
||||
err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult;
|
||||
}
|
||||
if (err != NWC24_OK) {
|
||||
NWC24FClose(&file);
|
||||
result = err;
|
||||
@@ -395,6 +398,7 @@ finish:
|
||||
else if (type == NWC24_MBOX_TYPE_SEND)
|
||||
msg->type |= 0x10;
|
||||
err = NWC24iMBoxAddMsgObj(type, msg);
|
||||
/* MWCC needs this status guard to retain the original error branches. */
|
||||
if (result != NWC24_OK)
|
||||
err = result;
|
||||
result = err;
|
||||
|
||||
@@ -111,12 +111,11 @@ NWC24Err NWC24ReadMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject, u32* su
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -164,12 +163,11 @@ NWC24Err NWC24ReadMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textSize
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
131
tools/decomp-assist/clean3-c5.attempts.md
Normal file
131
tools/decomp-assist/clean3-c5.attempts.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# clean3-c5 cleanup attempts
|
||||
|
||||
Worktree `/mnt/drive2/projects/wii-ipl-workers/clean3-c5`, branch `agent/w1009/clean3-c5`, baseline `8a67b68cf`.
|
||||
Read clean3-head.md, cleanup-common.md, AGENTS.md, unslop, writing-for-agents, and the prior cleanup logs for the owned files. Queried the existing nup graph. Baseline completion checker returned DECOMPLETE_OK; DOL SHA1 is 26116613f624061ba99c8d1a299aaa6efa85670d. Source and object snapshots are in `/tmp/clean3-c5-baseline`.
|
||||
|
||||
Acceptance: every retained trial preserves every allocated section, layout, exported symbol, and resolved relocation against the exact initial object. Compiler local label names resolve to section and offset. Reject and rebuild any trial that changes bytes. Gate all touched units at the end, regenerate the report, require DECOMPLETE_OK and the DOL SHA1, and commit each changed source separately.
|
||||
|
||||
Prior evidence rules out repeating plain AxManager IRO deletion, pointer/local/scoped/positive-guard/do-while variants; plain FAT32-builder IRO deletion and combined media/direct-write variants; WDScan constant/definition-level volatile substitutions and section deletion; NUP no-inline deletion, null-check deletion, unreachable-status simplification and tag-assignment hoisting; HTTP header-loop assignment hoisting and pointer-switch simplification; NWC24 conversion dispatch and success-guard alternatives; VI switch/nested-region rewrites; OSPlayTime result self-copy deletion; ARC moving the search bounds into its inner loop. Common error, cleanup and unlock exits stay. Wave 3 experiments require a different source hypothesis.
|
||||
|
||||
## Trials
|
||||
- KEEP `libs/RevoEX/src/nhttp/NHTTP_request` remove volatile from the two request-queue locals: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nand/NANDOpenClose` remove export force-active scope, retaining the ordinary function definition: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/arc/arc` remove export force-active scope, retaining the ordinary function definition: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/NW4R/src/snd/snd_AxManager` remove IRO scope with a typed inline free-voice initialization helper: section .text; relocations .text; exported symbols. Init__Q44nw4r3snd6detail9AxManagerFv: 51 raw instruction words differ, 62/63 instructions
|
||||
- REVERT `libs/RVL_SDK/src/fa/driver/sd_drv` remove builder IRO scope with branch-local reserved-sector helper returns: section .text; relocations .text; exported symbols. pfd_sddrv_build_fat32_mbr_bpb: 104 raw instruction words differ, 228/222 instructions
|
||||
- KEEP `libs/RVL_SDK/src/nand/NANDOpenClose` remove obsolete force-link comment: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RevoEX/src/nhttp/NHTTP_thread` remove file-wide auto-inline prohibition: section .text; relocations .text; exported symbols. NHTTPi_CheckHeaderEnd: function removed or added; NHTTPi_CommThreadProcMain: 108 raw instruction words differ, 156/129 instructions; NHTTPi_SendData: function removed or added; NHTTPi_SendHeaderList: 59 raw instruction words differ, 158/62 instructions; NHTTPi_SendProcPostDataAscii: 135 raw instruction words differ, 385/177 instructions
|
||||
- REVERT `libs/RevoEX/src/wd/WDScan` replace OUI volatile macros with plain extern const declarations before the definitions: section .sdata; section .sdata2; section .text; relocations .text; exported symbols. WDGetPrivacyMode: 113 raw instruction words differ, 117/115 instructions
|
||||
- REVERT `libs/NW4R/src/snd/snd_AxManager` remove IRO scope using a named end iterator for the list insertion: section .text; relocations .text; exported symbols. Init__Q44nw4r3snd6detail9AxManagerFv: 51 raw instruction words differ, 62/63 instructions
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` replace two dont-inline scopes with the existing NO_INLINE declaration convention: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` use the named progress type size in status copy: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` use the existing audit types for allocation, signature and certificate sizes: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RevoEX/src/nwc24/NWC24MsgSubject` NWC24ReadMsgSubjectPublic use switch break for the immediate shared return: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RevoEX/src/nwc24/NWC24MsgSubject` NWC24ReadMsgTextPublic use switch break for the immediate shared return: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RevoEX/src/nwc24/NWC24MsgCommit` keep successful message finalization inside its success branch: section .text; relocations .text. NWC24CommitMsgInternal: 75 raw instruction words differ, 826/827 instructions
|
||||
- KEEP `libs/RevoEX/src/nwc24/NWC24MsgCommit` format the scoped plain-text status conversion as ordinary statements: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/vi/vi3in1` remove the jump immediately before the shared transmit label: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/vi/vi3in1` name YUV dispatch labels by their video regions: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RVL_SDK/src/os/OSPlayTime` remove unused interrupt local and overwritten fade-loop initializations: compile failure, MWCC 10140 at enabled = OSDisableInterrupts(). The interrupt local is used later in this function. Restored immediately; the corrected initialization-only trial follows.
|
||||
- KEEP `libs/RVL_SDK/src/os/OSPlayTime` name remaining audio bytes and the last non-permanent ticket-limit index: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/os/OSPlayTime` remove only the overwritten fade-loop initializations, keeping the used interrupt state: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RVL_SDK/src/wpad/WPAD` remove unused-parameter pragmas from the allocation callbacks: exported symbols. FORCEACTIVEWPAD_c789: function removed or added; FORCEACTIVEWPAD_c791: function removed or added
|
||||
- KEEP `libs/RVL_SDK/src/card/CARDMount` remove the unreachable break after the rejected-card return: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/sdi/sdi_api` name the callback-owned command buffer and use the existing command/response sizes: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/sdi/sdi_api` use the existing IPC invalid-argument constant: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RevoEX/src/nhttp/NHTTP_thread` replace the one-field token-match struct with a boolean: section .text; relocations .text. NHTTPi_ThreadParseHeaderProc: 20 raw instruction words differ, 191/191 instructions
|
||||
- KEEP `libs/RevoEX/src/nhttp/NHTTP_thread` use the existing HTTP method and encoding enum names: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RevoEX/src/nhttp/NHTTP_thread` document the required out-of-line HTTP helper calls: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup_nhttp` expand the dense cleanup branches into ordinary multiline statements: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
|
||||
WPAD comparator correction: removing two directives shifts the line-derived FORCEACTIVEWPAD_c791 symbol to FORCEACTIVEWPAD_c789. All allocated bytes and resolved relocations were already identical. The existing DECOMP_FORCE_ACTIVE macro derives this dead helper's name from __LINE__; its address, size and binding are unchanged. Normalize only that generated suffix when comparing exported symbols, then retest. Ordinary export names remain strict.
|
||||
- KEEP `libs/RVL_SDK/src/wpad/WPAD` remove unused-parameter pragmas with the generated line-number symbol normalized: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RVL_SDK/src/wpad/WPAD` remove the unused alignment array and its activation stub: section .bss; section .text; relocations .data; relocations .text; exported symbols. FORCEACTIVEWPAD_c791: function removed or added; WPADiInitSub: 1 raw instruction words differ, 132/132 instructions
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` remove the redundant boot-update jump before the if/else cleanup join: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` use the ticket type size for response splitting: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RevoEX/src/nhttp/NHTTP_thread` document the token-match object needed by the keep-alive branch: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RevoEX/src/nwc24/NWC24MsgCommit` remove the status overwrite already excluded by the failure branch: section .text; relocations .text. NWC24CommitMsgInternal: 35 raw instruction words differ, 824/827 instructions
|
||||
- REVERT `libs/RevoEX/src/nwc24/NWC24MsgCommit` use ordinary null-text status handling without the scoped result local: section .text. NWC24CommitMsgInternal: 4 raw instruction words differ, 827/827 instructions
|
||||
- KEEP `libs/RVL_SDK/src/nup/nup` use the audit-record pointer type and remove its repeated casts: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/vi/vi3in1` use named video regions and the existing boot-video-format address: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/wpad/WPAD` replace the alignment TODO with the measured compiler requirement: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RevoEX/src/nwc24/NWC24MsgCommit` explain the retained scoped result and final status guard: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
|
||||
## Full gate correction
|
||||
|
||||
The first full gate failed the DOL checksum, cf9aab55069c8ddadf2b06cd321acfe51e894155, despite all 308 owned functions remaining instruction-exact, every reported section at 100%, and zero regressions. ARCEntrynumIsDir and NANDSafeOpen lose the 0x00080000 flag in MWCC's non-allocated .comment linker metadata when their force-active scopes are removed. Their code and ordinary ELF symbol records remain identical, but the linker drops the unreferenced exports. The early KEEP results for these two scopes are superseded by REVERT. Restore both scopes; retain a one-line compiler requirement beside each.
|
||||
|
||||
Strengthened the trial comparator to include the complete MWCC .comment metadata. It was unchanged in every other owned unit, including NUP's NO_INLINE conversion and WPAD's generated helper rename. The final DOL gate remains the acceptance authority. NANDOpenClose's extra raw string is inherited: both baseline and candidate have the same fourth trailing source string, while the retail extracted object has three. Reported data and every section are 100%; this cleanup does not change that pool.
|
||||
- KEEP `libs/RVL_SDK/src/arc/arc` explain why ARCEntrynumIsDir retains force-active metadata: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nand/NANDOpenClose` explain why NANDSafeOpen retains force-active metadata: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- REVERT `libs/RVL_SDK/src/nand/NANDOpenClose` remove the unreferenced aligned trailing string object: section .comment; section .data; exported symbols.
|
||||
- KEEP `libs/RVL_SDK/src/nand/NANDOpenClose` explain the retained trailing object alignment: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
- KEEP `libs/RVL_SDK/src/nand/NANDOpenClose` state the measured data-layout requirement precisely: all allocated sections, layout, exported symbols and resolved relocations identical.
|
||||
|
||||
## Final source decisions
|
||||
|
||||
- nup.cpp: four dont-inline directives become two existing NO_INLINE declarations, so the helpers still stay out of line. Removed the redundant boot-update cleanup jump and label. Uses sizeof for progress, audit, ticket and certificate types, plus a typed audit-record pointer instead of repeated casts. The other 46 gotos are common return/error/cleanup exits. Keep the proven short-circuit tag searches, redundant title guard and negative-status alternatives.
|
||||
- nup_nhttp.cpp: expanded dense error/cleanup branches into normal multiline statements. Keep the 23 common cleanup exits, allocation switch, header-condition assignments and no-inline helper declaration already proven necessary by wave 2.
|
||||
- NWC24MsgSubject.c: removed the two immediate-return switch gotos and unused labels. Keeps the 32 common return/error exits, short-circuit encoding setup and success-only switches already measured in wave 2.
|
||||
- NWC24MsgCommit.c: formatted the scoped plain-text status conversion and explained it. Rewriting it as ordinary null-status handling changes four instruction words. Removing the final status guard drops three instructions; folding finalization into the success branch drops one. Keep its shared report and file-cancellation exits and the measured status guard.
|
||||
- NHTTP_thread.c: uses existing HTTP method and encoding enums. No unk/local/field/var/temp placeholders remain in this baseline. Removing auto_inline off changes multiple helper bodies and call sequences; flattening TokenMatch to BOOL changes 20 instruction words. Both retained forms now have compiler notes. Reserved fields with no proven role stay.
|
||||
- NHTTP_request.c: removed both volatile request-queue local qualifiers. The header's volatile request pointer still supplies the same reloads; code, data, relocations and linker metadata remain identical. Shared error cleanup stays.
|
||||
- WDScan.c: unchanged. Moving OUI definitions after plain extern declarations fails to reproduce the existing loads and storage. Existing volatile-access and .sdata notes stay; the prior constant and definition-level volatile trials are not repeated.
|
||||
- sdi_api.c: renamed the callback's SDSectorSize pointer to commandBuffer because it owns the allocated SD command packet and frees it on completion. Uses SD_CMD_SIZE, sizeof(resp) and IPC_RESULT_INVALID; removed the speculative typo comment. Common error/return exits stay. The unused SDDevRca callback field has no proven role and stays.
|
||||
- OSPlayTime.c: named remaining DMA bytes and the non-permanent ticket-limit index. Removed fade-loop initializations overwritten before their first reads. Kept the interrupt local actually used later in the function; the mistaken deletion was restored immediately. Existing result self-copies and common exits stay under prior instruction evidence.
|
||||
- vi3in1.c: removed the final immediate transmit jump. Dispatch labels name NTSC, PAL and MPAL, comparisons use existing VI enum names, and the boot video-format load uses OS_ADDR_TV_VIDEO_FORMAT. Keep the separate region-store blocks under the existing compiler note.
|
||||
- WPAD.c: removed the two unused-parameter pragmas. Normalized only the line-derived activation helper name for comparison; every byte and link flag stays identical. Removing FAKE_ALIGNMENT and its existing helper changes data and one instruction in WPADiInitSub, so both stay with the measured layout note. Common callback/error exits stay.
|
||||
- CARDMount.c: removed the unreachable break after the invalid-card return. Common unmount/unlock error exits stay.
|
||||
- sd_drv.c: unchanged. Branch-local reserved-sector helper returns without the builder IRO scope change the builder from 222 to 228 instructions. Keep the IRO 0 scope and its existing compiler note; earlier media/direct-write variants are not repeated.
|
||||
- NANDOpenClose.c: retained the restored force-active scope with its linker requirement explained. Deleting canYouAlignMe changes data and MWCC metadata, so its existing object stays with a layout note. The inherited extra raw pool string remains unchanged.
|
||||
- arc.c: retained the restored export force-active scope with its linker requirement explained. The documented hierarchy-search join remains under the prior failed structured-loop evidence.
|
||||
- snd_AxManager.cpp: unchanged. A typed inline free-voice helper and a named insertion end iterator at default IRO each remove one instruction. Keep IRO 0 and the existing voice-address note; prior pointer/scope/guard/do-while variants are not repeated.
|
||||
|
||||
Retained changes remove four gotos, six pragma directives and two local volatile qualifiers. Both force-active scopes remain. All 16 units, including the three unchanged optimizer cases, are included in the final gate. No header, configuration, upstream, other-worktree, push, PR, merge, rebase or subagent work was performed.
|
||||
|
||||
## Source commits
|
||||
|
||||
- `87283f41637bd58c1541d0db66e7a9b1d697db86`: `libs/RVL_SDK/src/nup/nup.cpp`.
|
||||
- `1c1adc4545f18d4619642508c116309f48a86955`: `libs/RVL_SDK/src/nup/nup_nhttp.cpp`.
|
||||
- `8654252e8d0fd5d2bb4fca5cb359cc0f92594cb5`: `libs/RevoEX/src/nwc24/NWC24MsgSubject.c`.
|
||||
- `fa89f0cda62c44db3040eb7721d6ddae73d46277`: `libs/RevoEX/src/nwc24/NWC24MsgCommit.c`.
|
||||
- `60d468a6cf34caa25f750095fc541cf234f1e65d`: `libs/RevoEX/src/nhttp/NHTTP_thread.c`.
|
||||
- `682ec84e8f7552ab0ca6aa0b814d2bf814099d90`: `libs/RevoEX/src/nhttp/NHTTP_request.c`.
|
||||
- `b192d817ef510c4938065c5ae4f747fc12b943cf`: `libs/RVL_SDK/src/sdi/sdi_api.c`.
|
||||
- `37cc96285e744209175c28040ca6b6744bfb8c23`: `libs/RVL_SDK/src/os/OSPlayTime.c`.
|
||||
- `eabe15c8774d5d6c1afa024c05eba5dd3546becd`: `libs/RVL_SDK/src/vi/vi3in1.c`.
|
||||
- `20bb756172f3f73857bf64c503c857c79779f38d`: `libs/RVL_SDK/src/wpad/WPAD.c`.
|
||||
- `cabdc7a09a49096ddc1554b2221b5364c9e75ae6`: `libs/RVL_SDK/src/card/CARDMount.c`.
|
||||
- `db1249c7b9f2858104530920229a96158e497166`: `libs/RVL_SDK/src/nand/NANDOpenClose.c`.
|
||||
- `83931f879c191defd054e6b0a86959ea08a13d10`: `libs/RVL_SDK/src/arc/arc.c`.
|
||||
|
||||
## Final verification
|
||||
|
||||
Final committed-source gate: GATE PASS. Full 43U build and build/43U/ok pass; all 308 owned functions are instruction-exact and every reported code/data section is 100%. Zero regressions, forbidden-pattern additions or readability warnings. All 16 complete baseline objects, including MWCC linker metadata, remain identical after normalizing only WPAD's generated line-number helper name.
|
||||
|
||||
Fresh report: DECOMPLETE_OK; all 1028 units and 12563 functions remain exact and linked. Fresh unit measures and all code/data/function entries equal the initial complete baseline. ASM INVENTORY PASS retains 162 original functions, 164 bodies/blocks, zero placeholders. DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d. git diff --check passes.
|
||||
|
||||
All 16 raw pools match the baseline. Fifteen match retail directly; NANDOpenClose retains the unchanged trailing canYouAlignMe string at offset 64, beyond the retail-owned data. The final linked data and DOL match exactly. All 30 focused ctxdiff checks report diffs 0 and equal instruction counts.
|
||||
|
||||
| Unit | Exact functions before -> after | Code | Data |
|
||||
| --- | --- | --- | --- |
|
||||
| `libs/RVL_SDK/src/nup/nup` | 23/23 -> 23/23 | 10764/10764 | 1720/1720 |
|
||||
| `libs/RVL_SDK/src/nup/nup_nhttp` | 9/9 -> 9/9 | 2588/2588 | 144/144 |
|
||||
| `libs/RevoEX/src/nwc24/NWC24MsgSubject` | 12/12 -> 12/12 | 5352/5352 | 232/232 |
|
||||
| `libs/RevoEX/src/nwc24/NWC24MsgCommit` | 18/18 -> 18/18 | 8532/8532 | 904/904 |
|
||||
| `libs/RevoEX/src/nhttp/NHTTP_thread` | 26/26 -> 26/26 | 11292/11292 | 504/504 |
|
||||
| `libs/RevoEX/src/nhttp/NHTTP_request` | 7/7 -> 7/7 | 2512/2512 | 48/48 |
|
||||
| `libs/RevoEX/src/wd/WDScan` | 5/5 -> 5/5 | 2180/2180 | 16/16 |
|
||||
| `libs/RVL_SDK/src/sdi/sdi_api` | 22/22 -> 22/22 | 5948/5948 | 248/248 |
|
||||
| `libs/RVL_SDK/src/os/OSPlayTime` | 7/7 -> 7/7 | 2176/2176 | 160/160 |
|
||||
| `libs/RVL_SDK/src/vi/vi3in1` | 18/18 -> 18/18 | 6976/6976 | 1512/1512 |
|
||||
| `libs/RVL_SDK/src/wpad/WPAD` | 67/67 -> 67/67 | 31040/31040 | 15096/15096 |
|
||||
| `libs/RVL_SDK/src/card/CARDMount` | 7/7 -> 7/7 | 2380/2380 | 64/64 |
|
||||
| `libs/RVL_SDK/src/fa/driver/sd_drv` | 26/26 -> 26/26 | 11760/11760 | 3592/3592 |
|
||||
| `libs/RVL_SDK/src/nand/NANDOpenClose` | 22/22 -> 22/22 | 5056/5056 | 88/88 |
|
||||
| `libs/RVL_SDK/src/arc/arc` | 14/14 -> 14/14 | 2464/2464 | 120/120 |
|
||||
| `libs/NW4R/src/snd/snd_AxManager` | 25/25 -> 25/25 | 6364/6364 | 42040/42040 |
|
||||
|
||||
Evidence: `/tmp/clean3-c5-final-gate-committed.log`, `/tmp/clean3-c5-final-checks.log`, `/tmp/clean3-c5-final-pools.log`, `/tmp/clean3-c5-final-ctxdiff.log`, `/tmp/clean3-c5-source-commits.json`.
|
||||
|
||||
GATE PASS
|
||||
Reference in New Issue
Block a user