Skip to content

Commit

Permalink
SceNetCtlUnregisterCallback +
Browse files Browse the repository at this point in the history
SceNetCtlGetIfStat
  • Loading branch information
Ordinary205 committed Mar 13, 2024
1 parent 0f531ca commit 76dd345
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/ps4_libscenet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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');

Expand Down

0 comments on commit 76dd345

Please sign in to comment.