Skip to content

Commit

Permalink
Multiple Functions (#196)
Browse files Browse the repository at this point in the history
* SceUltWaitingQueueResourcePoolDestroy + SceUltMutexDestroy

* SceNpProfileDialog library

* SceNpTusGetData

* SceGameLiveStreamingSetPresetSocialFeedbackCommands + SceGameLiveStreamingGetSocialFeedbackMessagesCount

* SceNpPartyRegisterHandlerA

* SceNpGetAccountDateOfBirthA

* connect

* +

---------

Co-authored-by: red-prig <[email protected]>
  • Loading branch information
Ordinary205 and red-prig authored Mar 1, 2024
1 parent 79c2fef commit 34a6f77
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 13 deletions.
1 change: 1 addition & 0 deletions fpPS4.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ps4_libSceNpGameIntent,
ps4_libSceNpAuth,
ps4_libSceNpParty,
ps4_libSceNpProfileDialog,
ps4_libSceSaveData,
ps4_libSceDialogs,
ps4_libSceUserService,
Expand Down
1 change: 1 addition & 0 deletions kernel/ps4_libkernel.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,7 @@ function Load_libkernel(Const name:RawByteString):TElf_node;
lib^.set_proc($DDEFB822FEC827C5,@ps4_accept);
lib^.set_proc($A01AF7D773E9A4D1,@ps4_sendto);
lib^.set_proc($45E9C8D652F55859,@ps4_getsockname);
lib^.set_proc($5D52FC4A8DD02549,@ps4_connect);

//socket

Expand Down
14 changes: 13 additions & 1 deletion kernel/ps4_scesocket.pas
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ function ps4_sendto(s:SceNetId;

function ps4_getsockname(s:SceNetId;
addr:pSceNetSockaddr;
paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl;
paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl;

function ps4_connect(s:SceNetId;
const addr:pSceNetSockaddr;
addrlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;

implementation

Expand Down Expand Up @@ -153,5 +157,13 @@ function ps4_getsockname(s:SceNetId;
end;
end;

function ps4_connect(s:SceNetId;
const addr:pSceNetSockaddr;
addrlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
begin
sleep(200);
Result:=_set_errno(ECONNREFUSED);
end;

end.

14 changes: 13 additions & 1 deletion src/np/ps4_libscenpmanager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ function ps4_sceNpCheckCallbackForLib():Integer; SysV_ABI_CDecl;
Result:=0;
end;

function ps4_sceNpGetAccountDateOfBirth(userId:SceUserServiceUserId;
function ps4_sceNpGetAccountDateOfBirth(pOnlineId:pSceNpOnlineId;
pDateOfBirth:PSceNpDate):Integer; SysV_ABI_CDecl;
begin
if pDateOfBirth=nil then
Expand All @@ -557,6 +557,17 @@ function ps4_sceNpGetAccountDateOfBirth(userId:SceUserServiceUserId;
Result:=0;
end;

function ps4_sceNpGetAccountDateOfBirthA(userId:SceUserServiceUserId;
pDateOfBirth:PSceNpDate):Integer; SysV_ABI_CDecl;
begin
if pDateOfBirth=nil then
Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
pDateOfBirth^.year :=1990;
pDateOfBirth^.month:=1;
pDateOfBirth^.day :=1;
Result:=0;
end;

function Load_libSceNpManager(Const name:RawByteString):TElf_node;
var
lib:PLIBRARY;
Expand Down Expand Up @@ -602,6 +613,7 @@ function Load_libSceNpManager(Const name:RawByteString):TElf_node;
lib^.set_proc($BAA70F24B58BD3C3,@ps4_sceNpPollAsync);
lib^.set_proc($337C055DB610B400,@ps4_sceNpUnregisterStateCallbackA);
lib^.set_proc($F150537917F56702,@ps4_sceNpGetAccountDateOfBirth);
lib^.set_proc($AB733B5F304A0B7B,@ps4_sceNpGetAccountDateOfBirthA);
lib^.set_proc($4CF31B808C6FA20D,@ps4_sceNpGetAccountLanguageA);

lib^.set_proc($1858555294666C71,@ps4_sceNpInGameMessageInitialize);
Expand Down
6 changes: 6 additions & 0 deletions src/np/ps4_libscenpparty.pas
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ function ps4_sceNpPartyRegisterHandler(const handlers:pSceNpPartyEventHandlers;u
Result:=0;
end;

function ps4_sceNpPartyRegisterHandlerA(const handlers:pSceNpPartyEventHandlers;userdata:Pointer):Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;

function ps4_sceNpPartyGetState(const state:pSceNpPartyState):Integer; SysV_ABI_CDecl;
begin
Result:=0;
Expand Down Expand Up @@ -129,6 +134,7 @@ function Load_libSceNpParty(Const name:RawByteString):TElf_node;
lib:=Result._add_lib('libSceNpParty');
lib^.set_proc($9616024D098191DB,@ps4_sceNpPartyInitialize);
lib^.set_proc($900F3C81BBFBD5AA,@ps4_sceNpPartyRegisterHandler);
lib^.set_proc($FAFE1F5473301567,@ps4_sceNpPartyRegisterHandlerA);
lib^.set_proc($684CCA749CC04D9D,@ps4_sceNpPartyGetState);
lib^.set_proc($4F650E29FD3464DD,@ps4_sceNpPartyGetMembers);
lib^.set_proc($1753FEFF0A71428C,@ps4_sceNpPartyGetMemberInfo);
Expand Down
34 changes: 34 additions & 0 deletions src/np/ps4_libscenpprofiledialog.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
unit ps4_libSceNpProfileDialog;

{$mode ObjFPC}{$H+}

interface

uses
ps4_program,
Classes,
SysUtils;

implementation

function ps4_sceNpProfileDialogTerminate():Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;

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

lib:=Result._add_lib('libSceNpProfileDialog');
lib^.set_proc($D12A7DBC9701D7FC,@ps4_sceNpProfileDialogTerminate);
end;

initialization
ps4_app.RegistredPreLoad('libSceNpProfileDialog.prx',@Load_libSceNpProfileDialog);

end.

25 changes: 25 additions & 0 deletions src/np/ps4_libscenptus.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ interface
data :array[0..SCE_NP_TUS_DATA_INFO_MAX_SIZE-1] of Byte;
end;

pSceNpTusDataStatus=^SceNpTusDataStatus;
SceNpTusDataStatus=packed record
ownerId :SceNpId;
hasData :Integer;
lastChangedDate :QWORD; //SceRtcTick
lastChangedAuthorId:SceNpId;
pad :array[0..3] of Byte;
data :Pointer;
dataSize :QWORD;
info :SceNpTusDataInfo;
end;

pSceNpTusDataStatusA=^SceNpTusDataStatusA;
SceNpTusDataStatusA=packed record
ownerId :SceNpOnlineId;
Expand Down Expand Up @@ -67,6 +79,18 @@ function ps4_sceNpTusCreateNpTitleCtxA(serviceLabel:DWord;selfId:Integer):Intege
Result:=-1;
end;

function ps4_sceNpTusGetData(reqId:Integer;
targetNpId:pSceNpId;
slotId:DWORD;
dataStatus:pSceNpTusDataStatus;
dataStatusSize:QWORD;
data:Pointer;
recvSize:QWORD;
option:Pointer):Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;

function ps4_sceNpTusGetDataA(reqId:Integer;
targetAccountId:SceNpAccountId;
slotId:DWORD;
Expand Down Expand Up @@ -108,6 +132,7 @@ function Load_libSceNpTus(Const name:RawByteString):TElf_node;
lib^.set_proc($941B6B93EEE5935E,@ps4_sceNpTssCreateNpTitleCtxA);
lib^.set_proc($04890C9947CD2963,@ps4_sceNpTusCreateNpTitleCtx);
lib^.set_proc($D67FDD1AE9018276,@ps4_sceNpTusCreateNpTitleCtxA);
lib^.set_proc($5CECECCCEE0E3565,@ps4_sceNpTusGetData);
lib^.set_proc($C96107505918D6A2,@ps4_sceNpTusGetDataA);
lib^.set_proc($573C4DDED3A8BA3F,@ps4_sceNpTusSetDataA);
end;
Expand Down
35 changes: 35 additions & 0 deletions src/ps4_libscegamelivestreaming.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ interface
ps4_program;

const
SCE_GAME_LIVE_STREAMING_MAX_SOCIAL_FEEDBACK_PRESET_TEXT_LENGTH=32;
MB_LEN_MAX=2;

SCE_GAME_LIVE_STREAMING_ERROR_UNKNOWN =-2136997887; //0x80A00001
SCE_GAME_LIVE_STREAMING_ERROR_INVALID_PARAM =-2136997886; //0x80A00002
SCE_GAME_LIVE_STREAMING_ERROR_INVALID_STATUS =-2136997885; //0x80A00003
Expand All @@ -33,6 +36,11 @@ interface
SCE_GAME_LIVE_STREAMING_CAMERA_FRAME_POSITION_BOTTOM_LEFT =$03;
SCE_GAME_LIVE_STREAMING_CAMERA_FRAME_POSITION_BOTTOM_RIGHT=$04;

//SceGameLiveStreamingSocialFeedbackMessageType
SCE_GAME_LIVE_STREAMING_SOCIAL_FEEDBACK_MESSAGE_TYPE_MESSAGE=$01;
SCE_GAME_LIVE_STREAMING_SOCIAL_FEEDBACK_MESSAGE_TYPE_COMMAND=$02;
SCE_GAME_LIVE_STREAMING_SOCIAL_FEEDBACK_MESSAGE_TYPE_TEXT =$03;

type
pSceGameLiveStreamingStatus=^SceGameLiveStreamingStatus;
SceGameLiveStreamingStatus=packed record
Expand Down Expand Up @@ -63,6 +71,19 @@ interface
reserved:array[0..30] of Byte;
end;

pSceGameLiveStreamingPresetSocialFeedback=^SceGameLiveStreamingPresetSocialFeedback;
SceGameLiveStreamingPresetSocialFeedback=packed record
commandId :DWORD;
commandText:array[0..
(SCE_GAME_LIVE_STREAMING_MAX_SOCIAL_FEEDBACK_PRESET_TEXT_LENGTH*
MB_LEN_MAX+1)
-1] of char;
reserved :array[0..30] of Byte;
end;

pSceGameLiveStreamingSocialFeedbackMessageType=^SceGameLiveStreamingSocialFeedbackMessageType;
SceGameLiveStreamingSocialFeedbackMessageType=Integer;

implementation

function ps4_sceGameLiveStreamingInitialize(heapSize:qword):Integer; SysV_ABI_CDecl;
Expand Down Expand Up @@ -134,6 +155,18 @@ function ps4_sceGameLiveStreamingSetStandbyScreenResource(resource:PChar):Intege
Result:=0;
end;

function ps4_sceGameLiveStreamingSetPresetSocialFeedbackCommands(const presetCounts:QWORD;
preset:pSceGameLiveStreamingPresetSocialFeedback):Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;

function ps4_sceGameLiveStreamingGetSocialFeedbackMessagesCount(const _type:SceGameLiveStreamingSocialFeedbackMessageType;
count:PInteger):Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;

function Load_libSceGameLiveStreaming(Const name:RawByteString):TElf_node;
var
lib:PLIBRARY;
Expand All @@ -153,6 +186,8 @@ function Load_libSceGameLiveStreaming(Const name:RawByteString):TElf_node;
lib^.set_proc($DCF4A2C00CC52121,@ps4_sceGameLiveStreamingSetCameraFrameSetting);
lib^.set_proc($ABF931B9A17B5115,@ps4_sceGameLiveStreamingSetMaxBitrate);
lib^.set_proc($30BBD823CE85140A,@ps4_sceGameLiveStreamingSetStandbyScreenResource);
lib^.set_proc($C9CA1D88FD88D31A,@ps4_sceGameLiveStreamingSetPresetSocialFeedbackCommands);
lib^.set_proc($C9E40A8C71138B8D,@ps4_sceGameLiveStreamingGetSocialFeedbackMessagesCount);
end;

initialization
Expand Down
5 changes: 3 additions & 2 deletions src/ps4_libscenet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface
SCE_NET_ENOSPC =28;
SCE_NET_EWOULDBLOCK =35;
SCE_NET_EAFNOSUPPORT=47;

SCE_NET_ECONNREFUSED=61;
SCE_NET_EHOSTUNREACH=65;

//
Expand Down Expand Up @@ -452,7 +452,8 @@ function ps4_sceNetResolverDestroy(rid:Integer):Integer; SysV_ABI_CDecl;

function ps4_sceNetConnect(s:Integer; const addr:pSceNetSockaddr; addrlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
begin
Result:=0;
sleep(200);
Result:=_set_net_errno(SCE_NET_ECONNREFUSED);
end;

function ps4_sceNetEpollWait(s:Integer; events:pSceNetEpollEvent; maxevents:Integer; timeout:Integer):Integer; SysV_ABI_CDecl;
Expand Down
39 changes: 30 additions & 9 deletions src/ps4_libsceult.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ implementation
{$I sce_errno.inc}

const
SCE_ULT_ERROR_NULL =$80810001;
SCE_ULT_ERROR_ALIGNMENT =$80810002;
SCE_ULT_ERROR_RANGE =$80810003;
SCE_ULT_ERROR_INVALID =$80810004;
SCE_ULT_ERROR_PERMISSION =$80810005;
SCE_ULT_ERROR_STATE =$80810006;
SCE_ULT_ERROR_BUSY =$80810007;
SCE_ULT_ERROR_AGAIN =$80810008;
SCE_ULT_ERROR_NOT_INITIALIZE=$8081000A;
SCE_ULT_ERROR_NULL =Integer($80810001);
SCE_ULT_ERROR_ALIGNMENT =Integer($80810002);
SCE_ULT_ERROR_RANGE =Integer($80810003);
SCE_ULT_ERROR_INVALID =Integer($80810004);
SCE_ULT_ERROR_PERMISSION =Integer($80810005);
SCE_ULT_ERROR_STATE =Integer($80810006);
SCE_ULT_ERROR_BUSY =Integer($80810007);
SCE_ULT_ERROR_AGAIN =Integer($80810008);
SCE_ULT_ERROR_NOT_INITIALIZE=Integer($8081000A);

SCE_ULT_MAX_NAME_LENGTH =31;

ULT_STATE_INIT =0;
Expand Down Expand Up @@ -543,6 +544,14 @@ function ps4_sceUltWaitingQueueResourcePoolCreate(pool :PSceUltWaitingQ
Result:=0; // TODO: Not used by current implementation of this lib.
end;

function ps4_sceUltWaitingQueueResourcePoolDestroy(pool:PSceUltWaitingQueueResourcePool):QWord; SysV_ABI_CDecl;
begin
if (pool=nil) then
Exit(SCE_ULT_ERROR_NULL);
Writeln(SysLogPrefix,'sceUltWaitingQueueResourcePoolDestroy');
Result:=0; // TODO: There is no actual destructor
end;

//

function ps4_sceUltQueueDataResourcePoolGetWorkAreaSize(numData:DWord;dataSize:QWord;numQueueObjects:DWord):Integer; SysV_ABI_CDecl;
Expand Down Expand Up @@ -663,6 +672,16 @@ function ps4_sceUltMutexOptParamInitialize(param:PSceUltMutexOptParam):Integer;
Result:=0;
end;

function ps4_sceUltMutexDestroy(mutex:PSceUltMutex):Integer; SysV_ABI_CDecl;
begin
if (mutex=nil) then
Exit(SCE_ULT_ERROR_NULL);
ps4_pthread_mutex_destroy(mutex^.handle);
mutex^.handle:=nil;
//Writeln(SysLogPrefix,'sceUltMutexDestroy,mutex=',mutex^.name);
Result:=0;
end;

//

function ps4_sceUltSemaphoreCreate(semaphore :PSceUltSemaphore;
Expand Down Expand Up @@ -753,6 +772,7 @@ function Load_libSceUlt(Const name:RawByteString):TElf_node;

lib^.set_proc($588595D5077B3C55,@ps4_sceUltWaitingQueueResourcePoolGetWorkAreaSize);
lib^.set_proc($6221EE8CE1BDBD76,@ps4_sceUltWaitingQueueResourcePoolCreate);
lib^.set_proc($A2BE79E35EF07039,@ps4_sceUltWaitingQueueResourcePoolDestroy);

lib^.set_proc($7AF8FD60F912F2CE,@ps4_sceUltQueueDataResourcePoolGetWorkAreaSize);
lib^.set_proc($4C51E6EBF37ABE4B,@ps4_sceUltQueueDataResourcePoolCreate);
Expand All @@ -765,6 +785,7 @@ function Load_libSceUlt(Const name:RawByteString):TElf_node;
lib^.set_proc($F21106911D697EBF,@ps4_sceUltMutexLock);
lib^.set_proc($8745DE6CA88C06D9,@ps4_sceUltMutexUnlock);
lib^.set_proc($D7EF2DF5A1CB8B3F,@ps4_sceUltMutexOptParamInitialize);
lib^.set_proc($8D6F879DA7DE4B76,@ps4_sceUltMutexDestroy);

lib^.set_proc($8794252188FE468F,@ps4_sceUltSemaphoreCreate);
lib^.set_proc($1C0D4B75B8B794F6,@ps4_sceUltSemaphoreTryAcquire);
Expand Down

0 comments on commit 34a6f77

Please sign in to comment.