From 12dfbe6e83294fd302f07deeaadef7ba6db22cc6 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Tue, 6 Oct 2026 18:26:35 +0000 Subject: [PATCH] decomp(so): match SOGetSockName and link SOBasic (grok-so) (worker 4a959046) --- config/43U/config.yml | 3 +++ configure.py | 2 +- libs/RevoEX/src/so/SOBasic.c | 4 ++-- tools/decomp-assist/grok-so.attempts.md | 31 +++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tools/decomp-assist/grok-so.attempts.md diff --git a/config/43U/config.yml b/config/43U/config.yml index 561ae134..2933b13d 100644 --- a/config/43U/config.yml +++ b/config/43U/config.yml @@ -11,6 +11,9 @@ splits: 'config/43U/splits.txt' ldscript_template: 'config/ldscript_ipl2.lcf' force_active: + - SORead + - SOFcntl + - SOInetPtoN - SOGetSockOpt - SOSetInterfaceOpt - fprintf diff --git a/configure.py b/configure.py index 701ee65a..ad04ff2a 100644 --- a/configure.py +++ b/configure.py @@ -1096,7 +1096,7 @@ config.libs = [ ), RevoEXLib("so", [ Object(Matching, "so/SOCommon.c"), - Object(NonMatching, "so/SOBasic.c"), + Object(Matching, "so/SOBasic.c"), Object(Matching, "so/SOInformation.c"), Object(Matching, "so/SOOption.c"), ] diff --git a/libs/RevoEX/src/so/SOBasic.c b/libs/RevoEX/src/so/SOBasic.c index 528c2550..688485b5 100644 --- a/libs/RevoEX/src/so/SOBasic.c +++ b/libs/RevoEX/src/so/SOBasic.c @@ -150,8 +150,8 @@ int SOGetSockName(int socket, void* address) { if(!request) result=-49; else { request->socket=socket; - reply=&request->address; - memcpy(reply,addr,addr->len); + reply=(SOSockAddr*)(((u8*)request)+32); + memcpy(((u8*)request)+32,addr,addr->len); result=IOS_Ioctl(rm,7,request,4,reply,addr->len); if(result>=0) memcpy(addr,reply,reply->len); SOiFree(12,request,size); diff --git a/tools/decomp-assist/grok-so.attempts.md b/tools/decomp-assist/grok-so.attempts.md new file mode 100644 index 00000000..8b1ad3c2 --- /dev/null +++ b/tools/decomp-assist/grok-so.attempts.md @@ -0,0 +1,31 @@ +# grok-so SOGetSockName + +baseline differing: 3 / 63 +only first memcpy arg order: ours mr r3,r28 / mr r4,r27 / lbz r5; target mr r4 / lbz r5 / mr r3 + +len local after reply: 3 / 63 +source local then len local: 3 / 63 +len local then source local: 3 / 63 +memcpy source is the void* parameter: 5 / 63 (also swaps the entry saves) +source and length both from the void* parameter: 5 / 63 +reply assigned before socket store: 3 / 63 +memcpy dest &request->address, reply assigned after: 6 / 63 +memcpy dest &request->address, reply assigned before: 3 / 63 +reply assigned inside the dest argument: 3 / 63 +length ((u8*)addr)[0]: 3 / 63 +length *(u8*)addr: 3 / 63 +dest cast to void*: 3 / 63 +length cast to unsigned long: 3 / 63 +const source local: 3 / 63 +u8* dest local: 14 / 63 +reply = (SOSockAddr*)((u8*)request+32), memcpy from reply: 3 / 63 +reply and memcpy dest both (u8*)request+32: 0 / 63 +len local before reply: 3 / 63 +len local before socket store: 3 / 63, register shift +socketBlock+32, sizeof, and [32]: 3 / 63 +u8* raw local plus 32: 3 / 63 +reply and memcpy dest both ((u8*)request)+32: 0 / 63, style check clean, all 22 functions 0 + +kept ((u8*)request)+32. Field address schedules the destination move first; the byte offset schedules it last. + +Linking stripped SORead, SOFcntl and SOInetPtoN (nothing live calls them) and shifted the DOL by 660 code bytes. config/43U/config.yml force_active keeps them, same as SOGetSockOpt. DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d. -- 2.49.1