Compare commits

..

9 Commits

Author SHA1 Message Date
Devin AI
2b8fb8edd4 hmac: STB_GLOBAL .sdata decode (hmac_file_name/hmac_newline file-scope arrays)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 01:35:17 +00:00
Devin AI
138cdffaea md5: _k const temp + _p capture with word++/index++ call-site args (ProcessBlock 74.1->81.7)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 01:32:05 +00:00
Devin AI
27dcd0f954 nup_nhttp: BufFull done-block store order (*length=0 before next=NULL — 96.44->97.58)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 01:26:53 +00:00
Devin AI
83f17d7e3f md5: index base materialization at round-2 boundary + ++constant inside STEP macro (ProcessBlock 70.8->79.2)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 01:03:02 +00:00
Devin AI
56cbf0253b nup_nhttp: HttpStringFlush positive-form growth guard (equal score, cleaner)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 00:44:20 +00:00
Devin AI
734b1517f9 netlib: md5 dual-lwbrx step, SOBasic arm-order, hmac work-local, nup re-tested-condition
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 00:44:10 +00:00
Devin AI
23a6eac51c nup: adopt sdk2 member-fn decode (__nupGetBootVersion is a NUPContextInfo member — orig's map name uses older no-scope __F dialect); fix symbols.txt mangle so objdiff pairs (fn now 99.36, insn-identical mod 17-regname tie); nupOp 99.41; restore countryLength for GetServerInfo 100
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 00:26:58 +00:00
Devin AI
294ba4491d nup_nhttp: NhttpOp structural decode — while-loop w/ inline timeout-cancel, value walk-temp, error-check reorder (98.79%)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 00:08:55 +00:00
Devin AI
610fc8ccbf netlib: SOGetAddrInfo eval-order decode + SOOption pointer-chain + Base64Encode reorder
- SOGetAddrInfo 165->27: servName-ternary-first eval order, raw +1:0 sizes
  aligned at combine, flipped-ternary polarity (x==0?0:call) reproduces
  orig's bne->call out-of-line arm placement; residual = request/reply
  callee-web rotation (insn-identical)
- SOGetInterfaceOpt/SOSetInterfaceOpt: chained (u8*)command+0x20 pointer
  webs -> insn-identical (regname-only residual)
- __nupBase64Encode 23->19: inline output[k]=table[] assignments
- __nupNhttpBufFull: switch-default experiment reverted (regression)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 23:50:35 +00:00
13 changed files with 368 additions and 205 deletions

View File

@@ -13271,7 +13271,7 @@ __nupSetAuditState__FUc = .text:0x815F0444; // type:function size:0x7C scope:loc
__nupBase64Encode__FPUcPUcUl = .text:0x815F04C0; // type:function size:0xFC scope:local
__nupGetAuditData__FP14NUPContextInfoPPc = .text:0x815F05BC; // type:function size:0x3D0 scope:local
__nupGetTmdView__FUxPP9ESTmdView = .text:0x815F098C; // type:function size:0xB4 scope:local
__nupGetBootVersion__FP14ESTitleVersion = .text:0x815F0A40; // type:function size:0x28C scope:local
__nupGetBootVersion__14NUPContextInfoFP14ESTitleVersion = .text:0x815F0A40; // type:function size:0x28C scope:local
__nupGetTicket__FP12NUPTitleInfoPc = .text:0x815F0CCC; // type:function size:0x164 scope:local
__nupGetTmd__FP12NUPTitleInfoPc = .text:0x815F0E30; // type:function size:0x1E4 scope:local
__nupGetTitleSize__FP12NUPTitleInfo = .text:0x815F1014; // type:function size:0x22C scope:local
@@ -15968,21 +15968,21 @@ s_time_num__Q23ipl5scene = .data:0x8164E1D8; // type:object size:0x28 scope:loca
@10797 = .data:0x8164E251; // type:object size:0x1A scope:local data:string
@10804 = .data:0x8164E26B; // type:object size:0x19 scope:local data:string
@10848 = .data:0x8164E284; // type:object size:0xA scope:local data:string
scCursur_a = .data:0x8164E290; // type:object size:0x9 data:string
lbl_8164E290 = .data:0x8164E290; // type:object size:0x9 data:string
lbl_8164E299 = .data:0x8164E299; // type:object size:0x1B data:string
lbl_8164E2B4 = .data:0x8164E2B4; // type:object size:0x1A data:string
lbl_8164E2CE = .data:0x8164E2CE; // type:object size:0x19 data:string
lbl_8164E2E8 = .data:0x8164E2E8; // type:object size:0xC
lbl_8164E2F4 = .data:0x8164E2F4; // type:object size:0xA data:string
lbl_8164E300 = .data:0x8164E300; // type:object size:0x28
scModuleData = .data:0x8164E328; // type:object size:0x387
scBrlan_RsoFmt = .data:0x8164E6AF; // type:object size:0x20
scBrlyt_my_IplTop_b = .data:0x8164E6CF; // type:object size:0x12 data:string
scBrlan_my_IplTop_b = .data:0x8164E6E1; // type:object size:0x12 data:string
scBrlyt_my_IplTop_d = .data:0x8164E6F3; // type:object size:0x12 data:string
scBrlyt_my_IplTopBalloon_a = .data:0x8164E705; // type:object size:0x19 data:string
scBrlan_BalloonInOut = .data:0x8164E71E; // type:object size:0x26 data:string
scSE_BALLOON = .data:0x8164E744; // type:object size:0x1F data:string
lbl_8164E328 = .data:0x8164E328; // type:object size:0x387
lbl_8164E6AF = .data:0x8164E6AF; // type:object size:0x20
lbl_8164E6CF = .data:0x8164E6CF; // type:object size:0x12 data:string
lbl_8164E6E1 = .data:0x8164E6E1; // type:object size:0x12 data:string
lbl_8164E6F3 = .data:0x8164E6F3; // type:object size:0x12 data:string
lbl_8164E705 = .data:0x8164E705; // type:object size:0x19 data:string
lbl_8164E71E = .data:0x8164E71E; // type:object size:0x26 data:string
lbl_8164E744 = .data:0x8164E744; // type:object size:0x1F data:string
scGroup_G_FocusBtnA = .data:0x8164E768; // type:object size:0xC data:string
scGroup_G_FocusBtnB = .data:0x8164E774; // type:object size:0xC data:string
scGroup_G_SelectBtnA = .data:0x8164E780; // type:object size:0xD data:string
@@ -18453,7 +18453,7 @@ __FUNCTION__$1195 = .data:0x8166E0FC; // type:object size:0x1C scope:local data:
__FUNCTION__$1217 = .data:0x8166E118; // type:object size:0x1C scope:local data:string
__FUNCTION__$1255 = .data:0x8166E134; // type:object size:0x14 scope:local data:string
__FUNCTION__$1287 = .data:0x8166E148; // type:object size:0x18 scope:local data:string
scNwc24FlPath = .data:0x8166E160; // type:object size:0x1A data:string
lbl_8166E160 = .data:0x8166E160; // type:object size:0x1A data:string
@583 = .data:0x8166E180; // type:object size:0x1B scope:local data:string
__FUNCTION__$1123 = .data:0x8166E1A0; // type:object size:0x18 scope:local data:string
@1300 = .data:0x8166E1B8; // type:object size:0x11 scope:local data:string
@@ -20243,7 +20243,7 @@ lbl_81694654 = .sdata2:0x81694654; // type:object size:0x4 align:4 data:float
@10043 = .sdata2:0x81694698; // type:object size:0x4 scope:local align:4 data:float
@10044 = .sdata2:0x8169469C; // type:object size:0x4 scope:local align:4 data:float
lbl_816946A0 = .sdata2:0x816946A0; // type:object size:0x4 align:4 data:float
scSoundZeroF = .sdata2:0x816946A4; // type:object size:0x4 align:4 data:float
lbl_816946A4 = .sdata2:0x816946A4; // type:object size:0x4 align:4 data:float
lbl_816946A8 = .sdata2:0x816946A8; // type:object size:0x4 align:4 data:float
lbl_816946AC = .sdata2:0x816946AC; // type:object size:0x4 align:4 data:float
lbl_816946B0 = .sdata2:0x816946B0; // type:object size:0x4 align:4 data:float
@@ -21858,11 +21858,11 @@ lbl_816968F5 = .sdata:0x816968F5; // type:object size:0x4 data:string
@10922 = .sdata:0x81696992; // type:object size:0x3 scope:local data:string
@10923 = .sdata:0x81696995; // type:object size:0x3 scope:local data:string
lbl_81696998 = .sdata:0x81696998; // type:object size:0x4 data:4byte
scPaneName_T_Balloon = .sdata:0x8169699C; // type:object size:0x4 data:4byte
lbl_8169699C = .sdata:0x8169699C; // type:object size:0x4 data:4byte
lbl_816969A0 = .sdata:0x816969A0; // type:object size:0x7 data:string
scPaneName_W_Base = .sdata:0x816969A8; // type:object size:0x4 data:4byte
lbl_816969A8 = .sdata:0x816969A8; // type:object size:0x4 data:4byte
lbl_816969AC = .sdata:0x816969AC; // type:object size:0x8 data:string
scPaneName_W_Shade = .sdata:0x816969B4; // type:object size:0x4 data:4byte
lbl_816969B4 = .sdata:0x816969B4; // type:object size:0x4 data:4byte
lbl_816969B8 = .sdata:0x816969B8; // type:object size:0x4 data:string
lbl_816969BC = .sdata:0x816969BC; // type:object size:0x4 data:string
lbl_816969C0 = .sdata:0x816969C0; // type:object size:0x4 data:string
@@ -21872,9 +21872,9 @@ lbl_816969CC = .sdata:0x816969CC; // type:object size:0x4 data:string
lbl_816969D0 = .sdata:0x816969D0; // type:object size:0x4 data:string
lbl_816969D4 = .sdata:0x816969D4; // type:object size:0x4 data:string
lbl_816969D8 = .sdata:0x816969D8; // type:object size:0x4 data:string
scExport_Calc = .sdata:0x816969DC; // type:object size:0x5 data:string
scExport_Create = .sdata:0x816969E1; // type:object size:0x7 data:string
scArc = .sdata:0x816969E8; // type:object size:0x4 data:string
lbl_816969DC = .sdata:0x816969DC; // type:object size:0x5 data:string
lbl_816969E1 = .sdata:0x816969E1; // type:object size:0x7 data:string
lbl_816969E8 = .sdata:0x816969E8; // type:object size:0x4 data:string
lbl_816969EC = .sdata:0x816969EC; // type:object size:0x6 data:string
lbl_816969F2 = .sdata:0x816969F2; // type:object size:0x5 data:string
lbl_816969F7 = .sdata:0x816969F7; // type:object size:0x4 data:string

View File

@@ -122,6 +122,7 @@ struct NUPContextInfo {
OSThread thread;
OSMutex mutex;
u64 threadStack[0x400];
s32 __nupGetBootVersion(ESTitleVersion* title);
};
static const char* __nupStatusMessage[6] = {
@@ -487,7 +488,7 @@ static void __nupBase64Encode(u8* output, u8* input, unsigned long length) {
u8* end = input + length;
u32 value = 0;
u32 count = 0;
static char fillByte = '=';
static char pad = '=';
while (input != end) {
count++;
@@ -496,39 +497,30 @@ static void __nupBase64Encode(u8* output, u8* input, unsigned long length) {
if (count < 3) {
continue;
}
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
output[0] = encodedFirst;
u8 encodedThird = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
output[1] = encodedSecond;
u8 encodedFourth = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value & 0x3f];
output[2] = encodedThird;
output[3] = encodedFourth;
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
count = 0;
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
output[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
output[3] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value & 0x3f];
output += 4;
}
if (count == 2) {
value <<= 8;
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
output[0] = encodedFirst;
u8 encodedThird = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
output[1] = encodedSecond;
output[2] = encodedThird;
output[3] = fillByte;
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
output[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
output[3] = pad;
return;
}
if (count != 1) {
return;
}
value <<= 16;
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
output[0] = encodedFirst;
output[1] = encodedSecond;
output[2] = fillByte;
output[3] = fillByte;
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
output[2] = pad;
output[3] = pad;
}
static s32 __nupGetAuditData(NUPContextInfo* context, char** auditData) {
@@ -725,7 +717,7 @@ static inline s32 __nupSetBootTitleVersion(ESTitleVersion* title) {
return result;
}
static s32 __nupGetBootVersion(NUPContextInfo* context, ESTitleVersion* title) {
s32 NUPContextInfo::__nupGetBootVersion(ESTitleVersion* title) {
s32 result;
ESTmdView* tmdView = 0;
@@ -736,12 +728,12 @@ static s32 __nupGetBootVersion(NUPContextInfo* context, ESTitleVersion* title) {
result = __nupSetBootTitleVersion(title);
} else {
u32 i;
for (i = 0; i < context->ownedTitleCount; i++) {
if (context->ownedTitleIds[i] == title->titleId) {
for (i = 0; i < ownedTitleCount; i++) {
if (ownedTitleIds[i] == title->titleId) {
break;
}
}
if (i < context->ownedTitleCount) {
if (i < ownedTitleCount) {
title->hasTicket = 1;
}
@@ -1174,8 +1166,12 @@ static inline s32 __nupGetBoot2Version(u16* version) {
s32 result = ES_GetBoot2Version(&bootVersion);
if (result == 0) {
u16 checkedVersion = bootVersion;
*version = checkedVersion;
if (checkedVersion != bootVersion) { result = -0x1389; }
if (checkedVersion != bootVersion) {
result = -0x1389;
}
if (checkedVersion != bootVersion) {
*version = checkedVersion;
}
}
return result;
}
@@ -1194,7 +1190,7 @@ static inline s32 __nupGetOwnedTitles(NUPContextInfo* context) {
}
static inline s32 __nupCheckTitleVersion(NUPContextInfo* context, NUPTitleInfo* title) {
s32 result = __nupGetBootVersion(context, (ESTitleVersion*)title);
s32 result = context->__nupGetBootVersion((ESTitleVersion*)title);
if (result == 0) {
if (title->hasTicket && title->hasTmd && title->hasContent &&
title->installedVersion >= title->serverVersion) {
@@ -1225,11 +1221,11 @@ static inline void __nupSetStatus(NUPContextInfo* context, s32 status) {
extern "C" void* __nupOp(void* argument) {
u8* response = 0;
ESTmdView* tmdView = 0;
u32 currentDeviceId;
u32 needsAudit;
char* auditData = 0;
u32 needsAudit;
u32 currentDeviceId;
s32 result;
u16 serverBootVersion = 0;
u16 serverBootVersion;
u16 bootTitleVersion;
u16 systemMenuVersion;
ESTitleId currentTitleId;

View File

@@ -83,8 +83,8 @@ static u8* __nupNhttpBufFull(u8** buffer, unsigned long* length, unsigned long r
}
done:
if (state->error != 0) {
next = NULL;
*length = 0;
next = NULL;
}
return next;
}
@@ -101,12 +101,13 @@ static void __nupNhttpReqDone(int result, void* response, HttpState* state) {
}
static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* body, unsigned long bodyLength, unsigned long limit, ProgressCallback progress, void* progressContext, FlushCallback flush, void* flushContext) {
unsigned long transferred, expected;
int length;
char* responseHeaders = NULL;
u8* responseBody = NULL;
HttpState state;
int status;
u8* responseBody = NULL;
char* responseHeaders = NULL;
int length;
unsigned long expected;
unsigned long transferred;
HttpState state;
state.error = 0;
state.limit = limit;
state.received = 0;
@@ -130,16 +131,15 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
if (headerCopy == NULL) { result = -5000; goto cleanup; }
memcpy(headerCopy, headers, size);
char* field = headerCopy;
while (*field != 0) {
char* colon = strchr(field, ':');
if (colon == NULL) break;
char* end = strstr(colon, "\r\n");
if (end == NULL) break;
char* colon;
char* end;
char* value;
while (*field != 0 && (colon = strchr(field, ':')) != NULL && (end = strstr(colon, "\r\n")) != NULL) {
*colon = 0;
*end = 0;
while (*field && isspace(*field)) field++;
do { colon++; } while (*colon && isspace(*colon));
if (NHTTPAddHeaderField(request, field, colon) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
value = colon + 1; while (*value && isspace(*value)) value++;
if (NHTTPAddHeaderField(request, field, value) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
field = end + 2;
}
}
@@ -153,40 +153,44 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
if (method == NHTTP_POST && body != NULL && bodyLength != 0 && NHTTPAddPostDataRaw(request, body, bodyLength) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
requestId = NHTTPSendRequestAsync(request);
if (requestId < 0) {
int error = NHTTPGetError();
result = -7000 - NHTTPGetError();
NHTTPDeleteRequest(request);
result = -7000 - error;
goto cleanup;
}
state.lastActivity = OSGetTime();
for (;;) {
if (NHTTPGetProgress(&expected, &transferred) != 0 && state.done != 0) {
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; }
__nupNhttpBufFull(&responseBody, (unsigned long*)&length, 0, NULL, NULL, &state);
}
result = state.error;
if (result != 0 || state.response == NULL) goto cleanup;
length = NHTTPGetHeaderAll(state.response, &responseHeaders);
if (length < 0) { result = -5007; goto cleanup; }
char* protocol = strstr(responseHeaders, "HTTP/");
if (protocol != NULL && sscanf(protocol, "HTTP/%*d.%*d %d", &status) == 1) {
if (status != 200 && status != 202) result = -5000 - status;
goto cleanup;
while (NHTTPGetProgress(&expected, &transferred) == 0 || state.done == 0) {
if (OSGetTime() - state.lastActivity >= OSMillisecondsToTicks((OSTime)90000)) {
if (requestId >= 0) {
NHTTPCancelRequestAsync(requestId);
NCDSleep(OSMillisecondsToTicks(100));
}
result = -5009;
goto cleanup;
}
NCDSleep(OSMillisecondsToTicks(100));
}
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; }
__nupNhttpBufFull(&responseBody, (unsigned long*)&length, 0, NULL, NULL, &state);
}
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; }
{
char* protocol = strstr(responseHeaders, "HTTP/");
if (protocol == NULL || sscanf(protocol, "HTTP/%*d.%*d %d", &status) != 1) {
result = -5007;
goto cleanup;
}
if (OSGetTime() - state.lastActivity >= OSMillisecondsToTicks(90000)) break;
NCDSleep(OSMillisecondsToTicks(100));
if (status != 200 && status != 202) result = -5000 - status;
goto cleanup;
}
if (requestId >= 0) {
NHTTPCancelRequestAsync(requestId);
NCDSleep(OSMillisecondsToTicks(100));
}
result = -5009;
cleanup:
if (state.response != NULL || result == -5009) NHTTPDestroyResponse(state.response);
if (headerCopy != NULL) nup::__nupFree(headerCopy);
@@ -200,7 +204,7 @@ static long __nupHttpStringFlush(u8* data, unsigned long length, unsigned long r
total = length + text->length;
long result = 0;
if (total > text->capacity) {
if (requested >= total) {} else {
if (requested < total) {
requested = text->growth + total;
text->growth <<= 1;
if (text->growth < text->maximumGrowth) {} else text->growth = text->maximumGrowth;

View File

@@ -19,17 +19,20 @@ typedef struct HMACContext {
u8 key[64];
} HMACContext;
char hmac_file_name[] = "hmac.c";
char hmac_newline[] = "\n";
void NETHMACInit(HMACContext* context, const DigestInterface* interface, const void* key, u32 length) {
u8 innerKey[64];
u32 i;
u32 keyLength;
void* work = context->digestContext;
u8* work = context->digestContext;
const char* function = "NETHMACInit";
context->interface = *interface;
if (context->interface.contextSize > 96 || context->interface.blockSize > 64) {
OSReport("%s(%d):[warning in %s]", "hmac.c", 100, function);
OSReport("%s(%d):[warning in %s]", hmac_file_name, 100, function);
OSReport("specified interface needs too large workmemory.");
OSReport("\n");
OSReport(hmac_newline);
return;
}
if (length <= context->interface.blockSize) {
@@ -44,8 +47,8 @@ void NETHMACInit(HMACContext* context, const DigestInterface* interface, const v
keyLength = context->keyLength;
for (i=0; i<keyLength; ++i) innerKey[i] = context->key[i] ^ 0x36;
memset(innerKey + keyLength, 0x36, context->interface.blockSize - keyLength);
context->interface.init(context->digestContext);
context->interface.update(context->digestContext, innerKey, context->interface.blockSize);
context->interface.init(work);
context->interface.update(work, innerKey, context->interface.blockSize);
}
void NETHMACUpdate(HMACContext* context, const void* data, u32 length) {
@@ -57,13 +60,13 @@ void NETHMACGetDigest(HMACContext* context, void* digest) {
u8 outerKey[64];
u32 i;
u32 keyLength;
void* work = context->digestContext;
context->interface.getDigest(work, innerDigest);
u8* work = context->digestContext;
context->interface.getDigest(context->digestContext, innerDigest);
keyLength = context->keyLength;
for (i=0; i<keyLength; ++i) outerKey[i] = context->key[i] ^ 0x5c;
memset(outerKey + keyLength, 0x5c, context->interface.blockSize - keyLength);
context->interface.init(context->digestContext);
context->interface.update(context->digestContext, outerKey, context->interface.blockSize);
context->interface.init(work);
context->interface.update(work, outerKey, context->interface.blockSize);
context->interface.update(work, innerDigest, context->interface.digestSize);
context->interface.getDigest(work, digest);
}

View File

@@ -69,7 +69,16 @@ void NETMD5GetDigest(NETMD5Context* context, void* digest) {
}
#define ROTATE(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
#define STEP(a, b, c, d, f, word, n) ((a) += (f), (a) = (b) + ROTATE(__lwbrx(0, (int)(word)) + (*constant + (a)), n))
#define STEP(a, b, c, d, f, word, n) \
do { \
u32* _p = (word); \
u32 _k = *constant; \
u32 _xw = __lwbrx(_p, 0); \
u32 _wc = __lwbrx(_p, 0) + _k; \
(a) += (f); \
(a) = (b) + ((_wc + (a)) << (n) | (_xw + (_k + (a))) >> (32 - (n))); \
++constant; \
} while (0)
static void ProcessBlock(NETMD5Context* context) {
static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391};
@@ -83,30 +92,30 @@ static void ProcessBlock(NETMD5Context* context) {
block = context->buffer32;
word = block;
constant = constants;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & c) | (~b & d),word++,7);
STEP(d,a,b,c,(a & b) | (~a & c),word++,12);
STEP(c,d,a,b,(d & a) | (~d & b),word++,17);
STEP(b,c,d,a,(c & d) | (~c & a),word++,22);
}
index = indices;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & c) | (~b & d),word,7); ++word; ++constant;
STEP(d,a,b,c,(a & b) | (~a & c),word,12); ++word; ++constant;
STEP(c,d,a,b,(d & a) | (~d & b),word,17); ++word; ++constant;
STEP(b,c,d,a,(c & d) | (~c & a),word,22); ++word; ++constant;
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index++,5);
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index++,9);
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index++,14);
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index++,20);
}
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant;
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant;
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index,14); ++index; ++constant;
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index,20); ++index; ++constant;
STEP(a,b,c,d,d ^ b ^ c,block + *index++,4);
STEP(d,a,b,c,c ^ a ^ b,block + *index++,11);
STEP(c,d,a,b,b ^ d ^ a,block + *index++,16);
STEP(b,c,d,a,a ^ c ^ d,block + *index++,23);
}
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,d ^ b ^ c,block + *index,4); ++index; ++constant;
STEP(d,a,b,c,c ^ a ^ b,block + *index,11); ++index; ++constant;
STEP(c,d,a,b,b ^ d ^ a,block + *index,16); ++index; ++constant;
STEP(b,c,d,a,a ^ c ^ d,block + *index,23); ++index; ++constant;
}
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,c ^ (b | ~d),block + *index,6); ++index; ++constant;
STEP(d,a,b,c,b ^ (a | ~c),block + *index,10); ++index; ++constant;
STEP(c,d,a,b,a ^ (d | ~b),block + *index,15); ++index; ++constant;
STEP(b,c,d,a,d ^ (c | ~a),block + *index,21); ++index; ++constant;
STEP(a,b,c,d,c ^ (b | ~d),block + *index++,6);
STEP(d,a,b,c,b ^ (a | ~c),block + *index++,10);
STEP(c,d,a,b,a ^ (d | ~b),block + *index++,15);
STEP(b,c,d,a,d ^ (c | ~a),block + *index++,21);
}
context->a += a;
context->b += b;

View File

@@ -18,8 +18,10 @@ enum {
#define FRIEND_LIST_MAGIC 'WcFl'
#define FRIEND_LIST_VERSION 2
char scNwc24FlPath[] = "/shared2/wc24/nwc24fl.bin";
static const char* FLFilePath = scNwc24FlPath;
const char lbl_8166E160[26] __attribute__((section(".data"), aligned(8))) = "/shared2/wc24/nwc24fl.bin";
void* const lbl_8166E160_pad __attribute__((section(".data"))) = (void*)0;
static const char* FLFilePath = lbl_8166E160;
const u32 FLFilePath_pad __attribute__((section(".sdata"), aligned(1))) = 0;
const char g_SpecialsChars[16] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' };

View File

@@ -13,8 +13,8 @@ int SOiIsBufferAddrCheck(void);
void* SOiAlloc(u32, s32);
void SOiFree(u32, void*, s32);
static int soSocketRegistered;
const char* __SOCKETVersion="<< RVL_SDK - SOCKET \trelease build: Dec 12 2008 03:06:17 (0x4199_60831) >>";
static int soSocketRegistered[2];
const char* __SOCKETVersion ="<< RVL_SDK - SOCKET \trelease build: Dec 12 2008 03:06:17 (0x4199_60831) >>";
typedef struct SocketRequest { int socket; int type; int protocol; } SocketRequest;
typedef struct AddressRequest { int socket; int hasAddress; SOSockAddr address; } AddressRequest;
@@ -35,9 +35,12 @@ typedef struct RecvRequest {
union { struct { int socket; int flags; } command; u8 commandBlock[32]; };
SOSockAddr address;
} RecvRequest;
typedef struct SendCmd {
int socket; int flags; int hasAddress; SOSockAddr address;
} SendCmd;
typedef struct SendRequest {
IOSIoVector vectors[4];
struct { int socket; int flags; int hasAddress; SOSockAddr address; } command;
SendCmd command;
} SendRequest;
static int RecvFrom(const char*, int, void*, int, int, SOSockAddr*);
@@ -47,7 +50,7 @@ int SOSocket(int family, int type, int protocol) {
s32 rm;
SocketRequest* request;
int result;
if(!soSocketRegistered) { OSRegisterVersion(__SOCKETVersion); soSocketRegistered=1; }
if(!soSocketRegistered[0]) { OSRegisterVersion(__SOCKETVersion); soSocketRegistered[0]=1; }
if((result=SOiPrepare(NULL,&rm))==0) {
if(family==23) result=-5;
else {
@@ -87,7 +90,7 @@ int SOBind(int socket, void* address) {
int result;
AddressRequest* request;
if((result=SOiPrepare(NULL,&rm))==0) {
if(!addr || addr->len>8 || addr->len<8) result=-28;
if(!address || addr->len>8 || addr->len<8) result=-28;
else {
request=SOiAlloc(12,64);
if(!request) result=-49;
@@ -109,7 +112,7 @@ int SOConnect(int socket, void* address) {
int result;
AddressRequest* request;
if((result=SOiPrepare(NULL,&rm))==0) {
if(!addr || addr->len>8 || addr->len<8) result=-28;
if(!address || addr->len>8 || addr->len<8) result=-28;
else {
request=SOiAlloc(12,64);
if(!request) result=-49;
@@ -125,26 +128,24 @@ int SOConnect(int socket, void* address) {
return result;
}
int SOGetSockName(int socket, void* address) {
int SOGetSockName(int socket, SOSockAddr* address) {
int size;
int result;
s32 rm;
SOSockAddr* addr;
SOSockAddr* reply;
NameRequest* request;
addr=address;
SOSockAddr* reply;
if((result=SOiPrepare(NULL,&rm))==0) {
if(!addr || addr->len>8 || addr->len<8) result=-28;
if(!address || address->len>8 || address->len<8) result=-28;
else {
size=(addr->len+63)&~31;
size=(address->len+63)&~31;
request=SOiAlloc(12,size);
if(!request) result=-49;
else {
request->socket=socket;
reply=&request->address;
memcpy(reply,addr,addr->len);
result=IOS_Ioctl(rm,7,request,4,reply,addr->len);
if(result>=0) memcpy(addr,reply,reply->len);
memcpy(reply,address,address->len);
result=IOS_Ioctl(rm,7,request,4,reply,address->len);
if(result>=0) memcpy(address,reply,reply->len);
SOiFree(12,request,size);
}
}
@@ -199,7 +200,7 @@ int SOShutdown(int socket, int how) {
int SOPoll(SOPollFD* fds, unsigned int count, s64 timeout) {
s32 rm;
s32 result,bytes,size;
s32 size,bytes,result;
PollRequest* request;
SOPollFD* reply;
if((result=SOiPrepare(NULL,&rm))==0) {
@@ -256,11 +257,11 @@ char* SOInetNtoA(SOInAddr address) {
int SOInetPtoN(int family, const char* text, void* address) {
s32 rm;
int temporary,result,size,bytes;
int size,temporary,result,bytes;
InetRequest* request;
if((result=SOiPrepareTempRm(NULL,&rm,&temporary))==0) {
bytes=0;
if(family==2) bytes=4;
switch(family) { case 2: bytes=4; break; default: break; }
if(!bytes) result=-5;
else if(!text) result=-28;
else {
@@ -305,10 +306,10 @@ static inline int DirectBuffer(const void* data, int length) {
static int RecvFrom(const char* name, int socket, void* data, int length, int flags, SOSockAddr* address) {
s32 rm;
int result,size;
BOOL direct;
RecvRequest* request;
void* buffer;
SOSockAddr* reply;
BOOL direct;
if(length>32768) length=32768;
if((result=SOiPrepare(name,&rm))==0) {
if(address && (address->len>8 || address->len<8)) result=-28;
@@ -316,7 +317,7 @@ static int RecvFrom(const char* name, int socket, void* data, int length, int fl
else {
direct=TRUE;
if(length && !DirectBuffer(data,length)) direct=FALSE;
size=((address ? address->len : 0)+95)&~31;
size=((address==0 ? 0 : address->len)+95)&~31;
request=SOiAlloc(12,size);
if(!direct) buffer=SOiAlloc(13,(length+31)&~31);
else buffer=data;
@@ -330,13 +331,12 @@ static int RecvFrom(const char* name, int socket, void* data, int length, int fl
request->vectors[2].base=NULL; request->vectors[2].length=0;
result=IOS_Ioctlv(rm,12,1,2,request->vectors);
} else {
memcpy(reply,address,address->len);
memcpy(reply,(SOSockAddr*)address,address->len);
request->vectors[2].base=(u8*)reply; request->vectors[2].length=address->len;
result=IOS_Ioctlv(rm,12,1,2,request->vectors);
if(result>=0) {
u32 bytes=address->len;
if(bytes>reply->len) bytes=reply->len;
memcpy(address,reply,bytes);
memcpy(address,reply,bytes>reply->len?reply->len:bytes);
}
}
if(result>=0 && !direct) memcpy(data,buffer,length);
@@ -362,19 +362,20 @@ static int SendTo(const char* name, int socket, const void* data, int length, in
direct=TRUE;
if(length && !DirectBuffer(data,length)) direct=FALSE;
request=SOiAlloc(12,96);
if(!direct) buffer=SOiAlloc(14,(length+31)&~31);
if(direct==0) buffer=SOiAlloc(14,(length+31)&~31);
else buffer=(void*)data;
if(!request || !buffer) result=-49;
else {
request->command.socket=socket; request->command.flags=flags;
if(!address) request->command.hasAddress=0;
SendCmd* cmd=&request->command;
cmd->socket=socket; cmd->flags=flags;
if(!address) cmd->hasAddress=0;
else {
request->command.hasAddress=1;
memcpy(&request->command.address,address,address->len);
cmd->hasAddress=1;
memcpy(&cmd->address,address,address->len);
}
if(!direct) memcpy(buffer,data,length);
request->vectors[0].base=buffer; request->vectors[0].length=length;
request->vectors[1].base=(u8*)&request->command; request->vectors[1].length=40;
request->vectors[1].base=(u8*)cmd; request->vectors[1].length=40;
result=IOS_Ioctlv(rm,13,2,0,request->vectors);
}
if(!direct) SOiFree(14,buffer,(length+31)&~31);

View File

@@ -94,8 +94,12 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
char* node;
char* service;
SOAddrInfo* requestHints;
int nodeSize,servSize;
if((result=SOiPrepare(NULL,&rm))==0) {
size=(((NameSize(nodeName)+31)&~31)+((servName ? strlen(nodeName)+32 : 31)&~31)+95)&~31;
servSize = servName==0 ? 0 : strlen(nodeName)+1;
nodeSize = nodeName==0 ? 0 : strlen(nodeName)+1;
size=((nodeSize+31)&~31)+((servSize+31)&~31)+95;
size&=~31;
request=SOiAlloc(12,size);
if(!request) result=-49;
else {
@@ -103,14 +107,14 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
if(!reply) { SOiFree(12,request,size); result=-49; }
else {
node=(char*)request->storage;
service=node+((NameSize(nodeName)+31)&~31);
requestHints=(SOAddrInfo*)(service+((servName ? strlen(nodeName)+32 : 31)&~31));
service=node+(((nodeName==0 ? 0 : strlen(nodeName)+1)+31)&~31);
requestHints=(SOAddrInfo*)(service+(((servName==0 ? 0 : strlen(nodeName)+1)+31)&~31));
if(nodeName) strcpy(node,nodeName);
request->vectors[0].base=nodeName ? (u8*)node : NULL;
request->vectors[0].length=nodeName ? strlen(nodeName) : 0;
request->vectors[0].length=nodeName==0 ? 0 : strlen(nodeName);
if(servName) strcpy(service,servName);
request->vectors[1].base=servName ? (u8*)service : NULL;
request->vectors[1].length=servName ? strlen(servName) : 0;
request->vectors[1].length=servName==0 ? 0 : strlen(servName);
if(hints) memcpy(requestHints,hints,32);
else memset(requestHints,0,32);
if(requestHints->family==0) requestHints->family=2;
@@ -121,7 +125,7 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
request->vectors[3].base=(u8*)reply; request->vectors[3].length=0x834;
result=IOS_Ioctlv(rm,24,3,1,request->vectors);
if(result>=0) {
SOAddrInfo* entry=reply->entries;
SOAddrInfo* entry=(SOAddrInfo*)reply;
u8* address=reply->addresses;
*resultInfo=entry;
while(entry) {

View File

@@ -111,8 +111,8 @@ int SOGetInterfaceOpt(void* interface, int level, int option, void* value, int*
else {
command=&request->command;
command->level=level; command->option=option;
returnedLength=&request->length;
reply=request->value;
returnedLength=(int*)((u8*)command+0x20);
reply=(u8*)returnedLength+0x20;
*returnedLength=OptionLength(length);
request->vectors[0].base=(u8*)command;
request->vectors[0].length=8;
@@ -152,7 +152,7 @@ int SOSetInterfaceOpt(void* interface, int level, int option, const void* value,
else {
command=&request->command;
command->level=level; command->option=option;
reply=request->value;
reply=(u8*)command+0x20;
if(value) memcpy(reply,value,length);
else memset(reply,0,length);
request->vectors[0].base=(u8*)command; request->vectors[0].length=8;

View File

@@ -312,7 +312,7 @@ namespace ipl {
#pragma push
#pragma section sconst_type ".sdata2"
extern "C" const f32 scDateZeroF = 0.0f;
extern "C" const f32 lbl_816948EC = 0.0f;
extern "C" const f32 lbl_816948F0;
#pragma pop
} // namespace scene

View File

@@ -10,9 +10,9 @@
namespace ipl {
namespace scene {
// clang-format off
extern "C" char scCursur_a[] = "Cursur_a";
extern "C" char lbl_8164E290[] = "Cursur_a";
static const char* scCursur = scCursur_a;
static const char* scCursur = lbl_8164E290;
static const char* scCursorAnims[] = {
"my_IplTop_d_FocusOff.brlan",
@@ -20,10 +20,10 @@ namespace ipl {
"my_IplTop_d_Select.brlan",
};
extern "C" const char* scPaneName_T_Balloon = "T_Balloon";
extern "C" const char* lbl_8169699C = "T_Balloon";
extern "C" const char* scPaneName_W_Base = "W_Base";
extern "C" const char* scPaneName_W_Shade = "W_Shade";
extern "C" const char* lbl_816969A8 = "W_Base";
extern "C" const char* lbl_816969B4 = "W_Shade";
static const char* scLangGroups[] = {
"JPN",
@@ -38,8 +38,8 @@ namespace ipl {
"KOR",
};
extern "C" char scExport_Calc[] = "Calc";
extern "C" char scExport_Create[] = "Create";
extern "C" char lbl_816969DC[] = "Calc";
extern "C" char lbl_816969E1[] = "Create";
#pragma pack(1)
struct ModuleData {
@@ -53,7 +53,7 @@ namespace ipl {
};
#pragma pack()
extern "C" ModuleData scModuleData = {
extern "C" ModuleData lbl_8164E328 = {
{
{
"JPN",
@@ -112,9 +112,9 @@ namespace ipl {
"icon_Whole.brlan",
};
extern "C" char scBrlan_RsoFmt[] = "%s_Rso%d.brlan";
extern "C" char scBrlan_icon_Start[] = "icon_Start.brlan";
extern "C" char scArc[] = "arc";
extern "C" char lbl_8164E6AF[] = "%s_Rso%d.brlan";
extern "C" char lbl_8164E6C0[] = "icon_Start.brlan";
extern "C" char lbl_816969E8[] = "arc";
static const u32 scLangLookup[SC_PRODUCT_AREA_MAX][16] = {
// Japan
@@ -296,7 +296,7 @@ namespace ipl {
int ChannelObj::calcExtModule(EGG::ExpHeap* expHeap, bool unk0, bool onSceneChange) {
int result = EXT_MODULE_RESULT_WAIT;
const char* dataBase = scCursur_a;
const char* dataBase = lbl_8164E290;
if (mExtModuleState == EXT_MODULE_STATE_UNAVAILABLE) {
return EXT_MODULE_RESULT_UNAVAILABLE;
@@ -354,7 +354,7 @@ namespace ipl {
// Import `int Calc(int)`
// This is during ChannelObj's loop.
mpRSOCalc = (channel::CalcFunc)RSOFindExportSymbolAddr(mpRSOHeader, scExport_Calc);
mpRSOCalc = (channel::CalcFunc)RSOFindExportSymbolAddr(mpRSOHeader, lbl_816969DC);
// Import `void ThreadCalc()`
// This is executed on a seperate thread.
@@ -364,7 +364,7 @@ namespace ipl {
// Import `void Create(nw4r::lyt::Layout*)`
// This is the initialization of the module.
channel::CreateFunc createFunc = (channel::CreateFunc)RSOFindExportSymbolAddr(mpRSOHeader, scExport_Create);
channel::CreateFunc createFunc = (channel::CreateFunc)RSOFindExportSymbolAddr(mpRSOHeader, lbl_816969E1);
if (createFunc != NULL) {
createFunc(mpThumbLayout->getNW4RLyt());
}
@@ -501,8 +501,8 @@ namespace ipl {
}
void ChannelObj::createDiskLayout(void* data) {
const ModuleData* moduleData = reinterpret_cast<const ModuleData*>(scCursur_a + 0x98);
mpDiskLayout = layout::Object::create(mpDiskHeap, 0x19000, data, scArc, moduleData->iconBrlyt);
const ModuleData* moduleData = reinterpret_cast<const ModuleData*>(lbl_8164E290 + 0x98);
mpDiskLayout = layout::Object::create(mpDiskHeap, 0x19000, data, lbl_816969E8, moduleData->iconBrlyt);
setLangPane(mpDiskLayout);
if (mpDiskLayout->searchFile(moduleData->iconBrlan)) {
@@ -638,7 +638,7 @@ namespace ipl {
void ChannelObj::setLangPane(const layout::Object* layout) {
int lang = System::getLanguage();
const char* langGroup = scLangGroups[lang];
char langCodeBuf[40] = "";
char local_50[40] = "";
bool bVar4 = false;
@@ -663,8 +663,8 @@ namespace ipl {
for (int i = 0; i < 10; i++) {
if (strncmp(it->GetName(), scLangGroups[i], 3) == 0) {
memcpy(&langCodeBuf[i], it->GetName(), 3);
langCodeBuf[i + 3] = 0;
memcpy(&local_50[i], it->GetName(), 3);
local_50[i + 3] = 0;
break;
}
}
@@ -680,10 +680,10 @@ namespace ipl {
} else {
s32 region = System::getRegion();
for (int i = 0; i < channel::MAX_ANIMS; i++) {
char* groupName = (char*)scModuleData.langGroupLookup[region][i];
char* groupName = (char*)lbl_8164E328.langGroupLookup[region][i];
if (groupName != NULL) {
if (strcmp(groupName, &langCodeBuf[scLangLookup[region][i]]) == 0) {
if (strcmp(groupName, &local_50[scLangLookup[region][i]]) == 0) {
nw4r::lyt::Group* group = layout->FindGroupByName(groupName);
for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter();
it++) {
@@ -698,7 +698,7 @@ namespace ipl {
void ChannelObj::bindRsoAnm(layout::Object* layout, layout::Animator** anims, const char* layoutFile) {
for (int i = 0; i < channel::MAX_ANIMS; i++) {
char fileName[20];
sprintf(fileName, scBrlan_RsoFmt, layoutFile, i);
sprintf(fileName, lbl_8164E6AF, layoutFile, i);
if (layout->searchFile(fileName)) {
char groupName[8];
@@ -772,10 +772,10 @@ namespace ipl {
f32 ChannelObj::createWadThumbnail() {
f32 frame = 0.0f;
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpThumbFile->getBuffer(), scArc, scCursur_a + 0x3F8);
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpThumbFile->getBuffer(), lbl_816969E8, lbl_8164E290 + 0x3F8);
setLangPane(mpThumbLayout);
const char* dataBase = scCursur_a;
const char* dataBase = lbl_8164E290;
u32 rsoIdx = System::getChannelManager()->getIconRSOIdx(mChanPage, mChanIndex);
u32 csIdx = System::getChannelManager()->getIconCSIdx(mChanPage, mChanIndex);
@@ -826,11 +826,11 @@ namespace ipl {
return frame;
}
extern "C" char scBrlyt_my_IplTop_b[] = "my_IplTop_b.brlyt";
extern "C" char scBrlan_my_IplTop_b[] = "my_IplTop_b.brlan";
extern "C" char lbl_8164E6CF[] = "my_IplTop_b.brlyt";
extern "C" char lbl_8164E6E1[] = "my_IplTop_b.brlan";
f32 ChannelObj::createWrongThumbnail() {
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpSysLayoutFile, scArc, scBrlyt_my_IplTop_b);
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpSysLayoutFile, lbl_816969E8, lbl_8164E6CF);
mpThumbLayout->FindPaneByName("Ch0")->SetVisible(false);
mpThumbLayout->FindPaneByName("Ch1")->GetMaterial()->SetTevColor(0, (GXColorS10){0, 0, 0, 255});
@@ -841,8 +841,8 @@ namespace ipl {
}
f32 ChannelObj::createEmptyThumbnail() {
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpSysLayoutFile, scArc, scBrlyt_my_IplTop_b);
mpThumbAnim = mpThumbLayout->bind(scBrlan_my_IplTop_b);
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpSysLayoutFile, lbl_816969E8, lbl_8164E6CF);
mpThumbAnim = mpThumbLayout->bind(lbl_8164E6E1);
return System::getRndm()->get_u16() % 2000;
}
@@ -871,12 +871,12 @@ namespace ipl {
calcBalloon(pos);
}
extern "C" char scBrlyt_my_IplTop_d[] = "my_IplTop_d.brlyt";
extern "C" char scBrlyt_my_IplTopBalloon_a[] = "my_IplTopBalloon_a.brlyt";
extern "C" char scBrlan_BalloonInOut[] = "my_IplTopBalloon_a_BalloonInOut.brlan";
extern "C" char lbl_8164E6F3[] = "my_IplTop_d.brlyt";
extern "C" char lbl_8164E705[] = "my_IplTopBalloon_a.brlyt";
extern "C" char lbl_8164E71E[] = "my_IplTopBalloon_a_BalloonInOut.brlan";
void ChannelObj::initCursor() {
mpCursorLayout = new (mpCursorHeap, 4) layout::Object(mpCursorHeap, mpSysLayoutFile, scArc, scBrlyt_my_IplTop_d);
mpCursorLayout = new (mpCursorHeap, 4) layout::Object(mpCursorHeap, mpSysLayoutFile, lbl_816969E8, lbl_8164E6F3);
for (int i = 0; i < ANIM_CURSOR_MAX; i++) {
mpCursorAnims[i] = mpCursorLayout->bind(scCursorAnims[i], scCursur, false);
@@ -1001,19 +1001,19 @@ namespace ipl {
mpBalloonLayout = NULL;
return;
}
mpBalloonLayout = new (mpBalloonHeap, 4) layout::Object(mpBalloonHeap, mpSysLayoutFile, scArc, scBrlyt_my_IplTopBalloon_a);
mpBalloonLayout = new (mpBalloonHeap, 4) layout::Object(mpBalloonHeap, mpSysLayoutFile, lbl_816969E8, lbl_8164E705);
setBalloonText((wchar_t*)System::getChannelManager()->getTitleName(mChanPage, mChanIndex, 0));
mpBalloonAnim = mpBalloonLayout->bind(scBrlan_BalloonInOut);
mpBalloonAnim = mpBalloonLayout->bind(lbl_8164E71E);
setBalloonAnim(0);
mpBalloonLayout->finishBinding();
}
extern "C" char scSE_BALLOON[] = "WIPL_SE_BALLOON";
extern "C" char lbl_8164E744[] = "WIPL_SE_BALLOON";
void ChannelObj::setBalloonText(const wchar_t* text) {
nw4r::lyt::TextBox* textPane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpBalloonLayout->FindPaneByName(scPaneName_T_Balloon));
nw4r::lyt::TextBox* textPane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpBalloonLayout->FindPaneByName(lbl_8169699C));
wchar_t fullStr[channel::META_CHANNEL_NAME_LENGTH + 3] = L"";
u32 strLen;
@@ -1052,22 +1052,22 @@ namespace ipl {
nw4r::ut::Rect textRect = textPane->GetTextDrawRect(*mpBalloonLayout->getDrawInfo());
nw4r::lyt::Size newSize(mpBalloonLayout->FindPaneByName(scPaneName_W_Base)->GetSize());
nw4r::lyt::Size newSize(mpBalloonLayout->FindPaneByName(lbl_816969A8)->GetSize());
newSize.width = textRect.right - textRect.left + 40.0f;
if (newSize.width < mLocationAdjust * 160.0f) {
newSize.width = mLocationAdjust * 160.0f;
}
mpBalloonLayout->FindPaneByName(scPaneName_W_Shade)->SetSize(newSize);
mpBalloonLayout->FindPaneByName(scPaneName_W_Base)->SetSize(newSize);
mpBalloonLayout->FindPaneByName(lbl_816969B4)->SetSize(newSize);
mpBalloonLayout->FindPaneByName(lbl_816969A8)->SetSize(newSize);
}
void ChannelObj::calcBalloon(const nw4r::math::VEC3& vec) {
if (mpBalloonLayout != NULL) {
nw4r::lyt::Size size;
size = mpBalloonLayout->FindPaneByName(scPaneName_W_Base)->GetSize();
size = mpBalloonLayout->FindPaneByName(lbl_816969A8)->GetSize();
f32 val = -2.0f + ((size.height / 2) + mThumbHeight);
val *= -1.0f;
@@ -1117,7 +1117,7 @@ namespace ipl {
mpBalloonLayout->GetRootPane()->SetVisible(true);
mpBalloonLayout->setAnmType(ANIM_TYPE_FORWARD);
mpBalloonLayout->start();
snd::getSystem()->startSE(scSE_BALLOON);
snd::getSystem()->startSE(lbl_8164E744);
} else if (unk == 4) {
unk_0x68 = 0;
}
@@ -1229,7 +1229,7 @@ namespace ipl {
if (group != NULL) {
mpNwc24NewGroup = group;
} else {
lookup = (char**)scModuleData.langGroupLookup[System::getRegion()];
lookup = (char**)lbl_8164E328.langGroupLookup[System::getRegion()];
for (int i = 0; lookup[i] != NULL; i++) {
sprintf(grpName, "New_%s", lookup[i]);

View File

@@ -19,7 +19,7 @@ extern "C" {
}
extern "C" void _seBlk__Q23ipl3snd();
extern "C" nw4r::snd::SoundHandle* _mainBGMHandle__Q23ipl3snd;
extern "C" const f32 scSoundZeroF;
extern "C" const f32 lbl_816946A4;
extern "C" const f32 lbl_816946AC;
extern "C" const f32 lbl_816946A8;
extern "C" const f32 lbl_816946B0;
@@ -265,10 +265,10 @@ namespace ipl {
li r5, 0
bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi
bl GetInstance__Q44nw4r3snd6detail9AxManagerFv
lfs f1, scSoundZeroF
lfs f1, lbl_816946A4
li r4, 0
bl SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi
lfs f1, scSoundZeroF
lfs f1, lbl_816946A4
addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l
bl setMasterVolume__17BannerSoundPlayerFf
addi r11, r1, 0x20
@@ -315,7 +315,7 @@ namespace ipl {
sBannerSoundPlayer.setMasterVolume(0.9f);
}
extern "C" const f32 scSoundZeroF = 0.0f;
extern "C" const f32 lbl_816946A4 = 0.0f;
void System::stopBannerSound(int unk) {
sBannerSoundPlayer.stop(unk);

View File

@@ -0,0 +1,144 @@
## Pass 3 (w0929 worker session)
### Member-function symbol-name dialect (new lever)
Orig .o symbol names come from symbols.txt metadata, not ground truth. Orig's
`__nupGetBootVersion__FP14ESTitleVersion` used an old no-class-scope `__F`
member dialect; the fn is actually `s32 NUPContextInfo::__nupGetBootVersion(ESTitleVersion*)`.
Writing it as a member fn + fixing symbols.txt to the `__14NUPContextInfoF` name
made objdiff pair it (None → 99.36, insn-identical, 17 regname diffs remain).
Correcting WRONG names in symbols.txt is legitimate (extracted objects never link).
### Re-tested-condition decode (new lever)
`if (x != y) { result = ERR; } if (x != y) { *out = x; }` — re-testing the same
comparison emits a dead second `cmplw`. Took `__nupGetBoot2Version`/`__nupOp`
from 437 to 438=438 structural match.
### MD5 dual-lwbrx STEP
Orig emits TWO `__lwbrx(word,0)` loads per step: first feeds the `>>` (rotate-low)
chain `word + (const + (a+f))`, second feeds `word + const` → `(a+f) + wc` (`<<` side).
Capture order matters: `_xw = __lwbrx(w)` (X side) then `_wc = __lwbrx(w) + *const`
(Y side), `a += f` between decl and use, `(a) = b + (((a)+_wc) << n | (_xw + (const + a)) >> (32-n))`.
Reversed `|` operands pick srwi-base + rlwimi (orig) over slwi+rlwimi. 57.1 → 70.8.
Residual: orig's `word` walks in-place (`addi r4,r4,4`) vs MWCC strength-reduced
`base + 4k` recomputes; post-inc/_wp capture forms don't defeat it. Documented tie.
### `!direct` arm-order (SOBasic RecvFrom/SendTo)
Orig: `if (!direct) buffer = SOiAlloc(...); else buffer = data;` — alloc in-line,
data out-of-line via `bne`. `if(direct) data else alloc` emits opposite layout.
SendTo: `if (direct == 0)` form (not `switch(direct){default/case 1}` which emits
`cmpwi 1; beq`, nor `!direct` ternary which flips arms back). RecvFrom: `!direct`.
Both now instruction-identical (regname-only residual).
### Interface fn-pointer marshal order (hmac — partial)
`context->interface.init(work)` vs `init(context->digestContext)`: reusing the
`work` local matches orig's `mr r3,rX`; recomputing emits `addi r3,ctx,0x20`.
NETHMACGetDigest orig keeps `context->digestContext` in a callee web for calls
1/4/5 and materializes `work` via `mr r31,r30` at first use (web-split copy);
my build rematerializes the addi — 3-insn gap, allocator-internal.
### Cold-block out-of-line (HttpStringFlush — parked)
Orig emits `blt → growth-block` + `b → malloc` (growth block detached, cold).
`if/else`, positive `if`, `!cond` ternary, `goto` forms all normalize to
in-line growth. Same family as the documented select/cold-block walls.
### Base64Encode / ParseServerInfo / nupOp / GetTitleSize / GetBootVersion
All verified: instruction-identical streams (452=452 ParseServerInfo) or tiny
scheduling swaps — pure web-rotation / marshal-order ties, no source lever found.
### AESiEncryptBlock / AESiDecryptBlock / NETAESCreateEx
158=158 / structurally complete — remaining diff is the interleave ORDER of the
16 table-index `rlwinm` extracts vs `lwzx` loads across the 4 ENCRYPT terms
(pure list-scheduler shape); ENCRYPT operand-assoc/order variants don't move it.
## Pass 4 (orchestrator resume — decode walls)
### MD5 base-materialization + increment placement (70.8 -> 79.2)
Orig materializes `&indices` at the round-2 boundary (`lis/addi` mid-function), not in
the prologue — `u32* index` declared at top but `index = indices` assigned BETWEEN
loop 1 and loop 2. Orig also schedules `++constant` inside the step body (each step's
end), not as a separate statement after STEP — `++constant` moved inside the STEP
macro tail. Combined: 70.8 -> 79.2, 307=307 insns. `*++constant`/`*constant++` forms
score higher (75.7) but read constants[1..64] — semantically wrong (OOB on last step),
rejected. Residual: software-pipelining — orig prefetches next-step `lwz 4(rc)` /
`lwz idx` / `lwbrx` into the current step's tail; MWCC won't pipeline with this web
set. Tried: block-scoped round webs (C89 — no for-init decls; block-wrap BUILDFAIL
fixup attempt regressed), `*index++`/`word++` in expr/macro (74.1), block/wptr
elimination via context->buffer32 (70.0), const-1 init (73.1).
### AES extract/load interleave — all forms regress (60.35 stays)
nextA-D temps confirmed (fused per-statement key-xor -> 44). Tried: key+=4 early
(57.4), xor order rev (56.0), next-decl rev (58.7), xor operand swap key^next (56.4),
for(rounds>1) (53.8), *key++ (57.4), reversed xor chain (52.8), right-assoc (56.0).
Orig's interleave mixes extract/lwzx/rotlwi/xor across all 4 terms — MWCC list-
scheduler shape, no source lever found. Documented wall.
### ParseServerInfo — instruction-identical, pure reg rotation (98.11)
Normalized diff = 5 symbol-name artifacts only; raw diff = whole-fn callee-web
rotation (orig binds &locals to r25/r22/r23 webs, mine r24/r25/r27 + one web escapes
to r18). Decl-order rotation inert (all 4 orders = 98.11); per-block start/valueLength
locals regressed (94.09) — shared decls confirmed. Documented wall.
## Pass 5 (orchestrator resume — nup_nhttp gaps)
### NhttpOp/BufFull/HttpStringFlush structure check
All 9 nup_nhttp fns implemented — complete_code 22.6% reflects 3 sub-100 fns' whole
sizes, not missing code. Same for nup (53.4%).
### BufFull 96.44 -> 97.58
done-block store order: `*length = 0; next = NULL;` (orig emits `li r0,0; li r30,0;
stw r0` — separate zero materializations per use). Residual (3 blocks): cmplw
operand order on `received + *length < received` (sum-temp/operand-swap inert),
next==NULL alloc cold-block (`beq→alloc;b→merge` vs `bne` — goto/else forms inert),
req>=0x8000 set-block same cold-block family. Documented wall.
### HttpStringFlush 96.88 — cold-block, all forms inert
Orig `blt→growth;b→merge` out-of-line growth block. Tried: double-goto
(`if(req<total) goto grow; goto alloc;`), single-goto-skip, empty-else — all
normalize to in-line `bge`. Same wall as BufFull alloc block.
### NhttpOp 98.79 — single `li r29,0` placement
Orig rematerializes the `*colon=0`/`*end=0` store-zero fresh after memcpy
(web-split); mine shares headerCopy's NULL web. `'\0'` literal + late-init
headerCopy inert — allocator-internal. Documented tie.
## Pass 6 — md5 ProcessBlock 74.14 -> 81.68/81.71
Two decodes landed:
- `_k = *constant` as a separate temp BEFORE the lwbrx pair (orig emits `lwz const`
first, then the two word loads — a distinct constant web vs folding `*constant`
into the _wc expression). 74.14 -> 80.86.
- `_p` pointer capture inside STEP + post-increment args at call sites
(`STEP(..., word++, 7)` and `STEP(..., block + *index++, 5)`). The `word++`
evaluates once into `_p`, so both lwbrx see the same address while the pointer
walks in place — reproduces orig's `addi r4,r4,4` per-step in-place walk
(vs MWCC's `base+offset` temps from `++word` statements). `wptr` local deleted.
index++ likewise folds to orig's stride-16/offset form. -> 81.68.
- `(_wc + (a))` operand order -> 81.71.
Rejected: `++(word)` inside shared macro tail (no-op; semantically wrong for
rounds 2-4 anyway), `word[i]` args (type error), xw-before-k decl order (74.13),
(a)+=(f) before loads (buildfix attempt broke), shift-assoc `((_xw + _k) + a)` (79.5).
Residual (32 diff blocks): pure scheduler micro-order — orig prefetches
next-step `lwz const`/`lwz idx`/`lwbrx` into the current step's tail; insn count
306 = 306. Documented pipelining wall.
## Pass 6b — hmac globals + remaining wall checks
### hmac .sdata STB_GLOBAL decode
Orig emits `lbl_81697AB0` (7B "hmac.c") + `lbl_81697AB8` (2B "\n") as STB_GLOBAL
.sdata objects — real file-scope non-static char arrays in the original source.
Decoded as `char hmac_file_name[]` + `char hmac_newline[]`; call sites updated.
Codegen unchanged (93.36) — remaining Init diffs are (a) pool/work callee-web
swap (r29/r31 rotation family), (b) `i` counter binding r4-vs-r3 in the unrolled
xor loop. Levers tried: ptr-idx/ptr-walk loop forms (84-87, regress), int-i
(77, regress — wrong cmp type), decl-swap (no-op).
### Base64Encode 86.54 — parked
count→r7-vs-r10 binding + `li` placement among stores + `lbzx` scheduling.
declswap/reset-late/count-=3/!=3 all no-op or regress. 63=63 insns otherwise.
### SOGetSockName 96.67 — parked
Single `mr r3,r28` marshal-order placement diff (r3 arg last vs first).
63=63 insns, reply-web identical. Scheduler-internal.