From ae7e8038ec77c3c07ea2086e982639477c7a5f7b Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Sun, 4 Feb 2024 19:57:25 +0400 Subject: [PATCH] SceNpLookupCreateTitleCtxA + SceNpAuth functions + SceInvitationDialog library + accept + sendto (#185) * SceNpLookupCreateTitleCtxA * SceNpAuth functions * SceInvitationDialog library * accept * + * sendto * + * + --------- Co-authored-by: red-prig --- fpPS4.lpr | 1 + kernel/ps4_libkernel.pas | 2 + kernel/ps4_scesocket.pas | 28 ++++++++++++++ src/np/ps4_libscenpauth.pas | 62 +++++++++++++++++++++++++++++- src/np/ps4_libscenputility.pas | 13 ++++--- src/ps4_libsceinvitationdialog.pas | 34 ++++++++++++++++ 6 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 src/ps4_libsceinvitationdialog.pas diff --git a/fpPS4.lpr b/fpPS4.lpr index 6f44096..c7cc8a4 100644 --- a/fpPS4.lpr +++ b/fpPS4.lpr @@ -68,6 +68,7 @@ uses ps4_libSceSocialScreen, ps4_libSceVideoRecording, ps4_libSceWebBrowserDialog, + ps4_libSceInvitationDialog, ps4_libSceContentExport, ps4_libSceConvertKeycode, ps4_libSceUsbd, diff --git a/kernel/ps4_libkernel.pas b/kernel/ps4_libkernel.pas index cd45e27..8eac553 100644 --- a/kernel/ps4_libkernel.pas +++ b/kernel/ps4_libkernel.pas @@ -1983,6 +1983,8 @@ begin lib^.set_proc($95493AC2B197C8CC,@ps4_recvfrom); lib^.set_proc($A719C299A82BB5AA,@ps4_listen); lib^.set_proc($4D4BA2612DA413CB,@ps4_shutdown); + lib^.set_proc($DDEFB822FEC827C5,@ps4_accept); + lib^.set_proc($A01AF7D773E9A4D1,@ps4_sendto); //socket diff --git a/kernel/ps4_scesocket.pas b/kernel/ps4_scesocket.pas index 5ef6fa7..b932897 100644 --- a/kernel/ps4_scesocket.pas +++ b/kernel/ps4_scesocket.pas @@ -39,6 +39,17 @@ function ps4_listen(s:SceNetId;backlog:Integer):Integer; SysV_ABI_CDecl; function ps4_shutdown(s:SceNetId;how:Integer):Integer; SysV_ABI_CDecl; +function ps4_accept(s:SceNetId; + addr:pSceNetSockaddr; + paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl; + +function ps4_sendto(s:SceNetId; + const buf:Pointer; + len:QWORD; + flags:Integer; + const addr:pSceNetSockaddr; + paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl; + implementation function ps4_socket(const name:PChar; @@ -87,5 +98,22 @@ begin Result:=0; end; +function ps4_accept(s:SceNetId; + addr:pSceNetSockaddr; + paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sendto(s:SceNetId; + const buf:Pointer; + len:QWORD; + flags:Integer; + const addr:pSceNetSockaddr; + paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + end. diff --git a/src/np/ps4_libscenpauth.pas b/src/np/ps4_libscenpauth.pas index d36544b..fec4bf7 100644 --- a/src/np/ps4_libscenpauth.pas +++ b/src/np/ps4_libscenpauth.pas @@ -7,8 +7,42 @@ interface uses ps4_program, np_error, + ps4_libSceNpCommon, sys_kernel; +const + SCE_NP_CLIENT_ID_MAX_LEN=128; + SCE_NP_AUTHORIZATION_CODE_MAX_LEN=128; + +type + pSceNpClientId=^SceNpClientId; + SceNpClientId=packed record + id:array[0..SCE_NP_CLIENT_ID_MAX_LEN] of char; + padding:array[0..6] of Byte; + end; + + pSceNpAuthCreateAsyncRequestParameter=^SceNpAuthCreateAsyncRequestParameter; + SceNpAuthCreateAsyncRequestParameter=packed record + size:QWORD; + cpuAffinityMask:QWORD; + threadPriority:Integer; + padding:array[0..3] of Byte; + end; + + pSceNpAuthGetAuthorizationCodeParameter=^SceNpAuthGetAuthorizationCodeParameter; + SceNpAuthGetAuthorizationCodeParameter=packed record + size:QWORD; + pOnlineId:pSceNpOnlineId; + pClientId:pSceNpClientId; + scope:PChar; + end; + + pSceNpAuthorizationCode=^SceNpAuthorizationCode; + SceNpAuthorizationCode=packed record + code:array[0..SCE_NP_AUTHORIZATION_CODE_MAX_LEN] of char; + padding:array[0..6] of Byte; + end; + implementation function ps4_sceNpAuthCreateRequest():Integer; SysV_ABI_CDecl; @@ -17,6 +51,29 @@ begin Result:=-1; end; +function ps4_sceNpAuthCreateAsyncRequest(const pParam:pSceNpAuthCreateAsyncRequestParameter):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceNpAuthGetAuthorizationCode(reqId:Integer; + const param:pSceNpAuthGetAuthorizationCodeParameter; + authCode:pSceNpAuthorizationCode; + issuerId:PInteger):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceNpAuthPollAsync(reqId:Integer;pResult:PInteger):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceNpAuthDeleteRequest(reqId:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function Load_libSceNpAuth(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -26,7 +83,10 @@ begin lib:=Result._add_lib('libSceNpAuth'); lib^.set_proc($E9BC05928B184508,@ps4_sceNpAuthCreateRequest); - // + lib^.set_proc($37E9ABEC68D3BEBF,@ps4_sceNpAuthCreateAsyncRequest); + lib^.set_proc($2B11A43AB4094EA6,@ps4_sceNpAuthGetAuthorizationCode); + lib^.set_proc($8234B27F34AC0DC1,@ps4_sceNpAuthPollAsync); + lib^.set_proc($1FCC06F4193F9CF7,@ps4_sceNpAuthDeleteRequest); end; initialization diff --git a/src/np/ps4_libscenputility.pas b/src/np/ps4_libscenputility.pas index b5a3526..efef319 100644 --- a/src/np/ps4_libscenputility.pas +++ b/src/np/ps4_libscenputility.pas @@ -8,19 +8,21 @@ uses ps4_program, ps4_libSceNpCommon; +const + SCE_NP_LOOKUP_MAX_CTX_NUM=32; implementation -const - - SCE_NP_LOOKUP_MAX_CTX_NUM=32; - - function ps4_sceNpLookupCreateTitleCtx(selfNpId:PSceNpId):Integer; SysV_ABI_CDecl; begin Result:=1; end; +function ps4_sceNpLookupCreateTitleCtxA(selfNpId:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=1; +end; + function Load_libSceNpUtility(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -30,6 +32,7 @@ begin lib:=Result._add_lib('libSceNpUtility'); lib^.set_proc($F39DF743E2D4EC44,@ps4_sceNpLookupCreateTitleCtx); + lib^.set_proc($BD3F7186A3CEEBED,@ps4_sceNpLookupCreateTitleCtxA); ///lib^.set_proc($E7262311D778B7C6,@ps4_sceNpSignalingCreateContext); end; diff --git a/src/ps4_libsceinvitationdialog.pas b/src/ps4_libsceinvitationdialog.pas new file mode 100644 index 0000000..8deb96a --- /dev/null +++ b/src/ps4_libsceinvitationdialog.pas @@ -0,0 +1,34 @@ +unit ps4_libSceInvitationDialog; + +{$mode ObjFPC}{$H+} + +interface + +uses + ps4_program, + Classes, + SysUtils; + +implementation + +function ps4_sceInvitationDialogUpdateStatus():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function Load_libSceInvitationDialog(Const name:RawByteString):TElf_node; +var + lib:PLIBRARY; +begin + Result:=TElf_node.Create; + Result.pFileName:=name; + + lib:=Result._add_lib('libSceInvitationDialog'); + lib^.set_proc($F7E83D88EABEEE48,@ps4_sceInvitationDialogUpdateStatus); +end; + +initialization + ps4_app.RegistredPreLoad('libSceInvitationDialog.prx',@Load_libSceInvitationDialog); + +end. +