Skip to content

Commit

Permalink
SceNetCtlUnregisterCallback + SceNetCtlGetIfStat (#204)
Browse files Browse the repository at this point in the history
* SceNetCtlUnregisterCallback +
SceNetCtlGetIfStat

* +

---------

Co-authored-by: red-prig <vdpasha@mail.ru>
  • Loading branch information
Ordinary205 and red-prig authored Mar 13, 2024
1 parent 0f531ca commit 791f68e
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/ps4_libscenet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,16 @@ function ps4_sceNetCtlGetState(state:PInteger):Integer; SysV_ABI_CDecl;
function ps4_sceNetCtlRegisterCallback(func:SceNetCtlCallback;arg:Pointer;cid:PInteger):Integer; SysV_ABI_CDecl;
begin
NetCtlCb.func:=func;
NetCtlCb.arg:=arg;
NetCtlCb.arg :=arg;
if (cid<>nil) then cid^:=0;
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,17 @@ function ps4_sceNetCtlGetResult(eventType:Integer;errorCode:PInteger):Integer; S
mappedAddr:SceNetInAddr;
end;

pSceNetCtlIfStat=^SceNetCtlIfStat;
SceNetCtlIfStat=packed record
device :DWORD; //SCE_NET_CTL_DEVICE
_align :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 +603,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 +618,15 @@ 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^:=Default(SceNetCtlIfStat);

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 791f68e

Please sign in to comment.