From 76dd345d3007b46a099409071875b1e23f4fdb7d Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Wed, 13 Mar 2024 07:53:49 +0400 Subject: [PATCH] SceNetCtlUnregisterCallback + SceNetCtlGetIfStat --- src/ps4_libscenet.pas | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/ps4_libscenet.pas b/src/ps4_libscenet.pas index 43067805..d4f82709 100644 --- a/src/ps4_libscenet.pas +++ b/src/ps4_libscenet.pas @@ -554,6 +554,11 @@ function ps4_sceNetCtlRegisterCallback(func:SceNetCtlCallback;arg:Pointer;cid:PI Result:=0; end; +function ps4_sceNetCtlUnregisterCallback(cid:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function ps4_sceNetCtlCheckCallback():Integer; SysV_ABI_CDecl; begin if (NetCtlCb.func<>nil) then @@ -579,7 +584,16 @@ function ps4_sceNetCtlGetResult(eventType:Integer;errorCode:PInteger):Integer; S mappedAddr:SceNetInAddr; end; + pSceNetCtlIfStat=^SceNetCtlIfStat; + SceNetCtlIfStat=packed record + device:DWORD; + txBytes:QWORD; + rxBytes:QWORD; + reserved:array[0..7] of DWORD; + end; + const + //SceNetCtlGetNatInfo SCE_NET_CTL_NATINFO_STUN_UNCHECKED=0; SCE_NET_CTL_NATINFO_STUN_FAILED =1; SCE_NET_CTL_NATINFO_STUN_OK =2; @@ -588,6 +602,9 @@ function ps4_sceNetCtlGetResult(eventType:Integer;errorCode:PInteger):Integer; S SCE_NET_CTL_NATINFO_NAT_TYPE_2 =2; SCE_NET_CTL_NATINFO_NAT_TYPE_3 =3; + //SceNetCtlGetIfStat + SCE_NET_CTL_DEVICE_WIRED =0; + SCE_NET_CTL_DEVICE_WIRELESS =1; function ps4_sceNetCtlGetNatInfo(natInfo:pSceNetCtlNatInfo):Integer; SysV_ABI_CDecl; begin @@ -600,6 +617,16 @@ function ps4_sceNetCtlGetNatInfo(natInfo:pSceNetCtlNatInfo):Integer; SysV_ABI_CD Result:=0; end; +function ps4_sceNetCtlGetIfStat(ifStat:pSceNetCtlIfStat):Integer; SysV_ABI_CDecl; +begin + if (ifStat=nil) then Exit(SCE_NET_CTL_ERROR_INVALID_ADDR); + + ifStat^.txBytes:=SCE_NET_CTL_DEVICE_WIRED; + ifStat^.rxBytes:=SCE_NET_CTL_DEVICE_WIRELESS; + + Result:=0; +end; + const SCE_NET_CTL_SSID_LEN =(32 + 1); SCE_NET_CTL_HOSTNAME_LEN =(255 + 1); @@ -765,10 +792,12 @@ function Load_libSceNetCtl(Const name:RawByteString):TElf_node; lib^.set_proc($678C3008588110B4,@ps4_sceNetCtlTerm); lib^.set_proc($B813E5AF495BBA22,@ps4_sceNetCtlGetState); lib^.set_proc($509F99ED0FB8724D,@ps4_sceNetCtlRegisterCallback); + lib^.set_proc($46A9B63A764C0B3D,@ps4_sceNetCtlUnregisterCallback); lib^.set_proc($890C378903E1BD44,@ps4_sceNetCtlCheckCallback); lib^.set_proc($D1C06076E3D147E3,@ps4_sceNetCtlGetResult); lib^.set_proc($24EE32B93B8CA0A2,@ps4_sceNetCtlGetNatInfo); lib^.set_proc($A1BBB17538B0905F,@ps4_sceNetCtlGetInfo); + lib^.set_proc($B5EB8AE109C94C68,@ps4_sceNetCtlGetIfStat); lib:=Result._add_lib('libSceNetCtlForNpToolkit');