Skip to content

Commit

Permalink
SceNpUtility library and some SceNpWebApi's functions (#166)
Browse files Browse the repository at this point in the history
Created new SceNpUtility library and stubbed functions for WebApi
  • Loading branch information
kr1spy2115 authored Jan 11, 2024
1 parent cbd359e commit 004ad25
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
1 change: 1 addition & 0 deletions fpPS4.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
ps4_libSceNpScore,
ps4_libSceNpTrophy,
ps4_libSceSystemService,
ps4_libSceNpUtility,
ps4_libSceNpCommon,
ps4_libSceNpManager,
ps4_libSceNpGameIntent,
Expand Down
41 changes: 41 additions & 0 deletions src/np/ps4_libscenputility.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
unit ps4_libSceNpUtility;

{$mode ObjFPC}{$H+}

interface

uses
ps4_program,
ps4_libSceNpCommon;


implementation

const

SCE_NP_LOOKUP_MAX_CTX_NUM=32;


function ps4_sceNpLookupCreateTitleCtx(selfNpId:PSceNpId):Integer; SysV_ABI_CDecl;
begin
Result:=1;
end;

function Load_libSceNpUtility(Const name:RawByteString):TElf_node;
var
lib:PLIBRARY;
begin
Result:=TElf_node.Create;
Result.pFileName:=name;

lib:=Result._add_lib('libSceNpUtility');
lib^.set_proc($F39DF743E2D4EC44,@ps4_sceNpLookupCreateTitleCtx);
///lib^.set_proc($E7262311D778B7C6,@ps4_sceNpSignalingCreateContext);
end;

initialization
ps4_app.RegistredPreLoad('libSceNpUtility.prx',@Load_libSceNpUtility);

end.


32 changes: 31 additions & 1 deletion src/np/ps4_libscenpwebapi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,33 @@ function ps4_sceNpWebApiReadData(requestId:Int64;

const
SCE_NP_WEBAPI_PUSH_EVENT_DATA_TYPE_LEN_MAX=64;
SCE_NP_WEBAPI_EXTD_PUSH_EVENT_EXTD_DATA_KEY_LEN_MAX=32;

type
pSceNpWebApiPushEventDataType=^SceNpWebApiPushEventDataType;
SceNpWebApiPushEventDataType=packed record
val:array[0..SCE_NP_WEBAPI_PUSH_EVENT_DATA_TYPE_LEN_MAX] of AnsiChar;
end;

pSceNpWebApiExtdPushEventExtdDataKey=^SceNpWebApiExtdPushEventExtdDataKey;
SceNpWebApiExtdPushEventExtdDataKey=packed record
val:array[0..SCE_NP_WEBAPI_EXTD_PUSH_EVENT_EXTD_DATA_KEY_LEN_MAX] of AnsiChar;
end;

pSceNpWebApiExtdPushEventFilterParameter=^SceNpWebApiExtdPushEventFilterParameter;
SceNpWebApiExtdPushEventFilterParameter=packed record
dataType:pSceNpWebApiExtdPushEventExtdDataKey;
pExtdDataKey:Pointer;
extdDataKeyNum:size_t;
end;

function ps4_sceNpWebApiCreatePushEventFilter(libCtxId:Integer;
pDataType:pSceNpWebApiPushEventDataType;
dataTypeNum:size_t):Integer; SysV_ABI_CDecl;
begin
Result:=7;
end;


function ps4_sceNpWebApiCreateServicePushEventFilter(libCtxId:Integer;
handleId:Integer;
pNpServiceName:PChar;
Expand All @@ -182,6 +194,15 @@ function ps4_sceNpWebApiCreateServicePushEventFilter(libCtxId:Integer;
Result:=8;
end;

function ps4_sceNpWebApiCreateExtdPushEventFilter(libCtxId,handleId:Integer;
pNpServiceName:PChar;
npServiceLabel:DWORD;
pFilterParam:pSceNpWebApiExtdPushEventFilterParameter;
filterParamNum:size_t):Integer; SysV_ABI_CDecl;
begin
Result:=9;
end;


function ps4_sceNpWebApiRegisterPushEventCallback(userCtxId:Integer;
filterId:Integer;
Expand All @@ -199,6 +220,13 @@ function ps4_sceNpWebApiRegisterServicePushEventCallback(userCtxId:Integer;
Result:=2;
end;

function ps4_sceNpWebApiRegisterExtdPushEventCallback(userCtxId,filterId:Integer;
cbFunc:Pointer; //SceNpWebApiServicePushEventCallback
pUserArg:Pointer):Integer; SysV_ABI_CDecl;
begin
Result:=3;
end;


function Load_libSceNpWebApi(Const name:RawByteString):TElf_node;
var
Expand Down Expand Up @@ -226,6 +254,8 @@ function Load_libSceNpWebApi(Const name:RawByteString):TElf_node;
lib^.set_proc($B08171EF7E3EC72B,@ps4_sceNpWebApiCreateServicePushEventFilter);
lib^.set_proc($3DF4930C280D3207,@ps4_sceNpWebApiRegisterPushEventCallback);
lib^.set_proc($909409134B8A9B9C,@ps4_sceNpWebApiRegisterServicePushEventCallback);
lib^.set_proc($33605407E0CD1061,@ps4_sceNpWebApiCreateExtdPushEventFilter);
lib^.set_proc($BEB334D80E46CB53,@ps4_sceNpWebApiRegisterExtdPushEventCallback);
end;

function Load_libSceNpWebApi2(Const name:RawByteString):TElf_node;
Expand Down

0 comments on commit 004ad25

Please sign in to comment.