From adebe792c1cff3f60d6434e10a816b61caa10097 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:50:23 +0400 Subject: [PATCH 01/30] sceAjmBatchJobInlineBuffer --- src/ajm/ps4_libsceajm.pas | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ajm/ps4_libsceajm.pas b/src/ajm/ps4_libsceajm.pas index f963e423..2b1044b2 100644 --- a/src/ajm/ps4_libsceajm.pas +++ b/src/ajm/ps4_libsceajm.pas @@ -391,6 +391,36 @@ function ps4_sceAjmBatchJobControlBufferRa( end; +procedure FixDataInput(pBatchPosition:Pointer;pDataInput:Pointer;szDataInputSize:QWORD); +begin + if PQWORD(pBatchPosition)^ and (SCE_AJM_FLAG_SIDEBAND_STREAM)<>0 then + begin + pSceAjmSidebandStreamResult(pDataInput)^.sStream.iSizeConsumed:=1; + pSceAjmSidebandStreamResult(pDataInput)^.sStream.iSizeProduced:=1; + pSceAjmSidebandStreamResult(pDataInput)^.sStream.uiTotalDecodedSamples:=1; //loop or div to zero + end; +end; + +function ps4_sceAjmBatchJobInlineBuffer( + const pBatchPosition:Pointer; + const pDataInput: Pointer; + const szDataInputSize:QWORD; + const pBatchAddress:PPointer):Pointer; SysV_ABI_CDecl; +begin + Result:=nil; + if (pDataInput<>nil) then + begin + FillChar(pDataInput^,szDataInputSize,0); + FixDataInput(pBatchPosition,pDataInput,szDataInputSize); + end; + begin + PQWORD(pBatchPosition)^ := PQWORD(pBatchPosition)^ and $ffffffe0 or 7; + PQWORD(pBatchPosition + 1)^ := (szDataInputSize + 7) and $fffffff8; + Move(pDataInput^, Pointer(PQWORD(pBatchPosition) + SizeOf(Pointer) * 2)^, szDataInputSize); + pBatchAddress^:=pBatchPosition + 2; + end; +end; + function ps4_sceAjmBatchJobRunBufferRa( pBatchPosition:Pointer; uiInstance:SceAjmInstanceId; @@ -480,6 +510,7 @@ function Load_libSceAjm(Const name:RawByteString):TElf_node; lib^.set_proc($031A03AC8369E09F,@ps4_sceAjmInstanceCreate); lib^.set_proc($45B2DBB8ABFCCE1A,@ps4_sceAjmInstanceDestroy); lib^.set_proc($7660F26CDFFF167F,@ps4_sceAjmBatchJobControlBufferRa); + lib^.set_proc($B2D96086789CDC97,@ps4_sceAjmBatchJobInlineBuffer); lib^.set_proc($125B25382A4E227B,@ps4_sceAjmBatchJobRunBufferRa); lib^.set_proc($EE37405CAFB67CCA,@ps4_sceAjmBatchJobRunSplitBufferRa); lib^.set_proc($7C5164934C5F196B,@ps4_sceAjmBatchStartBuffer); From 43e7f382a0c6f6142f13dcc06c24210f317bbc6f Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:52:17 +0400 Subject: [PATCH 02/30] sceAjmInstanceCodecType --- src/ajm/ps4_libsceajm.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ajm/ps4_libsceajm.pas b/src/ajm/ps4_libsceajm.pas index 2b1044b2..7b1ae11f 100644 --- a/src/ajm/ps4_libsceajm.pas +++ b/src/ajm/ps4_libsceajm.pas @@ -305,6 +305,11 @@ function ps4_sceAjmFinalize(uiContext:SceAjmContextId):Integer; SysV_ABI_CDecl; if not FAjmMap.Delete(uiContext) then Result:=SCE_AJM_ERROR_INVALID_CONTEXT; end; +function ps4_sceAjmInstanceCodecType(uiCodec:SceAjmCodecType):Integer; SysV_ABI_CDecl; +begin + Result:=uiCodec>>$E; +end; + function ps4_sceAjmInstanceCreate(uiContext:SceAjmContextId; uiCodec:SceAjmCodecType; uiFlags:QWORD; @@ -507,6 +512,7 @@ function Load_libSceAjm(Const name:RawByteString):TElf_node; lib^.set_proc($43777216EC069FAE,@ps4_sceAjmModuleRegister); lib^.set_proc($5A2EC3B652D5F8A2,@ps4_sceAjmModuleUnregister); lib^.set_proc($307BABEAA0AC52EB,@ps4_sceAjmFinalize); + lib^.set_proc($7625E340D88CBBFB,@ps4_sceAjmInstanceCodecType); lib^.set_proc($031A03AC8369E09F,@ps4_sceAjmInstanceCreate); lib^.set_proc($45B2DBB8ABFCCE1A,@ps4_sceAjmInstanceDestroy); lib^.set_proc($7660F26CDFFF167F,@ps4_sceAjmBatchJobControlBufferRa); From 67f17083c4974a4650d6629e245b58a6fe6a4a63 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:57:04 +0400 Subject: [PATCH 03/30] sceGnmDebugHardwareStatus --- src/ps4_libscegnmdriver.pas | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index a2e1cf72..733a0f61 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -2105,6 +2105,57 @@ function ps4_sceGnmGetGpuCoreClockFrequency:QWORD; SysV_ABI_CDecl; ComputeEvents:array[0..6] of Thamt64locked; +type + //HardwareStatus + pHardwareStatus=^HardwareStatus; + HardwareStatus=Integer; + +const + kHardwareStatusDump = $01; + +Var + DebugHardwareStatus:array[0..1] of Thamt64locked; + +function _sceGnmDebugHardwareStatus(flag:HardwareStatus; + reserved:QWORD; + udata:Pointer):Integer; SysV_ABI_CDecl; +var + H:HardwareStatus; + R:QWORD; + P:PPointer; + pStatus:Phamt64locked; +begin + Case reserved of + kHardwareStatusDump:pStatus:=@DebugHardwareStatus[reserved]; + else + Exit(SCE_KERNEL_ERROR_EINVAL); + end; + + pStatus^.LockWr; + P:=HAMT_search64(@pStatus^.hamt,QWORD(flag)); + if (P<>nil) then + R:=reserved; + P:=udata; + H:=ps4_ioctl(flag,$C0088111,R); + begin + Exit(SCE_KERNEL_ERROR_ENOMEM); + end; + pStatus^.Unlock; + HAMT_insert64(@pStatus^.hamt,QWORD(flag),udata); + + Result:=0; +end; + +function ps4_sceGnmDebugHardwareStatus(flag:HardwareStatus; + reserved:QWORD; + udata:Pointer):Integer; SysV_ABI_CDecl; +begin + if (flag<>0) then + Exit; + _sceGnmDebugHardwareStatus(flag,reserved,udata); + Result:=0; +end; + function _sceGnmAddEqEvent(eq:SceKernelEqueue;id:Integer;udata:Pointer):Integer; var pEvents:Phamt64locked; @@ -2269,6 +2320,8 @@ function Load_libSceGnmDriver(Const name:RawByteString):TElf_node; lib^.set_proc($4CB5789ACC226780,@ps4_sceGnmDriverCaptureInProgress); + lib^.set_proc($AA91884F33C4F997,@ps4_sceGnmDebugHardwareStatus); + lib^.set_proc($6F4C729659D563F2,@ps4_sceGnmAddEqEvent); lib^.set_proc($6F4F0082D3E51CF8,@ps4_sceGnmAreSubmitsAllowed); From bee918aa7120bfc9bbbf0f8a63b588d98ebe6d1f Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:58:19 +0400 Subject: [PATCH 04/30] sceGnmDeleteEqEvent --- src/ps4_libscegnmdriver.pas | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index 733a0f61..2a61de13 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -2210,6 +2210,58 @@ function ps4_sceGnmAddEqEvent(eq:SceKernelEqueue;id:Integer;udata:Pointer):Integ _sig_unlock; end; +function _sceGnmDeleteEqEvent(eq:SceKernelEqueue;id:Integer):Integer; +var + pEvents:Phamt64locked; + P:PPointer; + node:PKEventNode; +begin + Writeln('sceGnmDeleteEqEvent:',id); + + Case id of + kEqEventCompute0RelMem..kEqEventCompute6RelMem + + :pEvents:=@ComputeEvents[id]; + kEqEventGfxEop :pEvents:=@EopEvents; + else + Exit(SCE_KERNEL_ERROR_EINVAL); + end; + + pEvents^.LockWr; + P:=HAMT_search64(@pEvents^.hamt,QWORD(eq)); + if (P<>nil) then + begin + node:=P^; + end else + begin + node:=_alloc_kevent_node(eq,SizeOf(TKEventNode)); + if (node=Pointer(1)) then + begin + pEvents^.Unlock; + Exit(SCE_KERNEL_ERROR_EBADF); + end; + if (node=nil) then + begin + pEvents^.Unlock; + Exit(SCE_KERNEL_ERROR_ENOMEM); + end; + node^.ev.filter:=SCE_KERNEL_EVFILT_GNM; + node^.ev.flags :=EV_CLEAR; + node^.ev.data :=id; + HAMT_insert64(@pEvents^.hamt,QWORD(eq),node); + end; + pEvents^.Unlock; + + Result:=0; +end; + +function ps4_sceGnmDeleteEqEvent(eq:SceKernelEqueue;id:Integer):Integer; SysV_ABI_CDecl; +begin + _sig_lock; + Result:=_sceGnmDeleteEqEvent(eq,id); + _sig_unlock; +end; + procedure _on_trigger_eop(data,userdata:Pointer); var node:PKEventNode; @@ -2323,6 +2375,7 @@ function Load_libSceGnmDriver(Const name:RawByteString):TElf_node; lib^.set_proc($AA91884F33C4F997,@ps4_sceGnmDebugHardwareStatus); lib^.set_proc($6F4C729659D563F2,@ps4_sceGnmAddEqEvent); + lib^.set_proc($3D54FE7EEA12F605,@ps4_sceGnmDeleteEqEvent); lib^.set_proc($6F4F0082D3E51CF8,@ps4_sceGnmAreSubmitsAllowed); From e20bdd3ef01baed6f56fb1520ada1b6175978df4 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:01:56 +0400 Subject: [PATCH 05/30] sceImeDialogInit --- src/ps4_libscedialogs.pas | 52 +++++++++++++++++++++++++++++++++++---- src/ps4_libsceime.pas | 37 ++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 469f7d85..a327966c 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -8,6 +8,7 @@ interface ps4_program, Classes, SysUtils, + ps4_libSceIme, ps4_libSceSaveData; implementation @@ -508,14 +509,54 @@ function ps4_scePlayerInvitationDialogTerminate():Integer; SysV_ABI_CDecl; SCE_IME_DIALOG_STATUS_RUNNING =1; SCE_IME_DIALOG_STATUS_FINISHED=2; +type + pSceImeDialogParam=^SceImeDialogParam; + SceImeDialogParam=packed record + userId,_type :SceImeType; + supportedLanguages :QWORD; + enterLabel :SceImeEnterLabel; + inputMethod :SceImeInputMethod; + filter :SceImeTextFilter; + option :DWORD; + maxTextLength :DWORD; + inputTextBuffer :PWideChar; + posx :Single; + posy :Single; + horizontalAlignment:SceImeHorizontalAlignment; + verticalAlignment :SceImeVerticalAlignment; + placeholder :PWideChar; + title :PWideChar; + reserved :array[0..15] of ShortInt; + end; + + pSceImeParamExtended=^SceImeParamExtended; + SceImeParamExtended=packed record + option :DWORD; + colorBase :SceImeColor; + colorLine :SceImeColor; + colorTextField :SceImeColor; + colorPreedit :SceImeColor; + colorButtonDefault :SceImeColor; + colorButtonFunction :SceImeColor; + colorButtonSymbol :SceImeColor; + colorText :SceImeColor; + colorSpecial :SceImeColor; + priority :SceImePanelPriority; + additionalDictionaryPath:PChar; + extKeyboardFilter :SceImeExtKeyboardFilter; + disableDevice :DWORD; + extKeyboardMode :DWORD; + reserved :array[0..59] of ShortInt; + end; + var status_ime_dialog:Integer=SCE_IME_DIALOG_STATUS_NONE; -//function ps4_sceImeDialogInit(param:pSceImeDialogParam; -// extended:pSceImeParamExtended -// ):Integer; SysV_ABI_CDecl; -// -//nop nid:libSceImeDialog:354781ACDEE1CDFD:sceImeDialogInit +function ps4_sceImeDialogInit(const param:pSceImeDialogParam; + const extended:pSceImeParamExtended):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; function ps4_sceImeDialogGetStatus:Integer; SysV_ABI_CDecl; begin @@ -696,6 +737,7 @@ function Load_libSceImeDialog(Const name:RawByteString):TElf_node; Result:=TElf_node.Create; Result.pFileName:=name; lib:=Result._add_lib('libSceImeDialog'); + lib^.set_proc($354781ACDEE1CDFD,@ps4_sceImeDialogInit); lib^.set_proc($2000E60F8B527016,@ps4_sceImeDialogGetStatus); end; diff --git a/src/ps4_libsceime.pas b/src/ps4_libsceime.pas index a81a7542..a2e9db7e 100644 --- a/src/ps4_libsceime.pas +++ b/src/ps4_libsceime.pas @@ -680,6 +680,43 @@ interface param:SceImeEventParam; end; + pSceImeType=^SceImeType; + SceImeType=Integer; + + pSceImeEnterLabel=^SceImeEnterLabel; + SceImeEnterLabel=Integer; + + pSceImeInputMethod=^SceImeInputMethod; + SceImeInputMethod=Integer; + + pSceImeTextFilter=^SceImeTextFilter; + SceImeTextFilter=packed record + outText:PWideChar; + outTextLength:PDWORD; + srcText:PWideChar; + srcTextLength:DWORD; + end; + + pSceImeHorizontalAlignment=^SceImeHorizontalAlignment; + SceImeHorizontalAlignment=Integer; + + pSceImeVerticalAlignment=^SceImeVerticalAlignment; + SceImeVerticalAlignment=Integer; + + pSceImePanelPriority=^SceImePanelPriority; + SceImePanelPriority=Integer; + + pSceImeKeyboardType=^SceImeKeyboardType; + SceImeKeyboardType=Integer; + + pSceImeExtKeyboardFilter=^SceImeExtKeyboardFilter; + SceImeExtKeyboardFilter=packed record + srcKeycode:SceImeKeycode; + outKeycode:Word; + outStatus:PDWORD; + reserved:Pointer; + end; + SceImeEventHandler=procedure(arg:Pointer;e:pSceImeEvent); SysV_ABI_CDecl; pSceImeKeyboardParam=^SceImeKeyboardParam; From 159890b48d44c5376c17febcef2728d58cb23c55 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:06:04 +0400 Subject: [PATCH 06/30] sceLoginDialogUpdateStatus --- src/ps4_libscedialogs.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index a327966c..182c0b05 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -570,6 +570,11 @@ function ps4_sceLoginDialogInitialize():Integer; SysV_ABI_CDecl; Result:=0; end; +function ps4_sceLoginDialogUpdateStatus():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + // function ps4_sceHmdSetupDialogInitialize():Integer; SysV_ABI_CDecl; @@ -749,6 +754,7 @@ function Load_libSceLoginDialog(Const name:RawByteString):TElf_node; Result.pFileName:=name; lib:=Result._add_lib('libSceLoginDialog'); lib^.set_proc($A8FFC4BD0465D877,@ps4_sceLoginDialogInitialize); + lib^.set_proc($DAB73E7A049F6F90,@ps4_sceLoginDialogUpdateStatus); end; function Load_libSceHmdSetupDialog(Const name:RawByteString):TElf_node; From c85834b0589e3eed99c68d47f1cb5f0922f6cb4a Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:07:50 +0400 Subject: [PATCH 07/30] sceNetBandwidthControlSetDefaultParam --- src/ps4_libscenet.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ps4_libscenet.pas b/src/ps4_libscenet.pas index b7f37f0a..793fe81f 100644 --- a/src/ps4_libscenet.pas +++ b/src/ps4_libscenet.pas @@ -467,6 +467,20 @@ function ps4_sceNetEpollDestroy(eid:Integer):Integer; SysV_ABI_CDecl; Result:=0; end; +type + pSceNetBandwidthControlParam=^SceNetBandwidthControlParam; + SceNetBandwidthControlParam=packed record + cbFuncArg:Pointer; + timeout:DWORD; + appReqId:Word; + padding:array[0..1] of char; + end; + +function ps4_sceNetBandwidthControlSetDefaultParam(s:Integer;param:SceNetBandwidthControlParam):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function ps4_sceNetCtlInit:Integer; SysV_ABI_CDecl; begin Result:=0; @@ -779,6 +793,7 @@ function Load_libSceNet(Const name:RawByteString):TElf_node; lib^.set_proc($3975D7E26524DEE9,@ps4_sceNetConnect); lib^.set_proc($76B8C86C36C0ED44,@ps4_sceNetEpollWait); lib^.set_proc($227A7595F2FE25DC,@ps4_sceNetEpollDestroy); + lib^.set_proc($3F8CD95C4EDBA6C0,@ps4_sceNetBandwidthControlSetDefaultParam); end; function Load_libSceNetCtl(Const name:RawByteString):TElf_node; From 3005b7ade644a3470543f070ab0a08105c049359 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:09:23 +0400 Subject: [PATCH 08/30] sceNpSignalingSetContextOption --- src/np/ps4_libscenpsignaling.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/np/ps4_libscenpsignaling.pas b/src/np/ps4_libscenpsignaling.pas index e4da3b8d..e79d9f8f 100644 --- a/src/np/ps4_libscenpsignaling.pas +++ b/src/np/ps4_libscenpsignaling.pas @@ -61,6 +61,13 @@ function ps4_sceNpSignalingGetLocalNetInfo(ctxId:DWORD; Result:=0; end; +function ps4_sceNpSignalingSetContextOption(ctxId:DWORD; + optname:Integer; + optval:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function Load_libSceNpSignaling(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -73,6 +80,7 @@ function Load_libSceNpSignaling(Const name:RawByteString):TElf_node; lib^.set_proc($E7262311D778B7C6,@ps4_sceNpSignalingCreateContext); lib^.set_proc($7432CD15D63C770B,@ps4_sceNpSignalingCreateContextA); lib^.set_proc($53C01032538505CF,@ps4_sceNpSignalingGetLocalNetInfo); + lib^.set_proc($207443BD9A1D3D86,@ps4_sceNpSignalingSetContextOption); end; initialization From 302b6afc16d3f691ba1cac2c6148334102cebd56 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:12:45 +0400 Subject: [PATCH 09/30] sceNpWebApi2PushEventCreateFilter --- src/np/ps4_libscenpwebapi.pas | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/np/ps4_libscenpwebapi.pas b/src/np/ps4_libscenpwebapi.pas index 16d3e409..35aa82f1 100644 --- a/src/np/ps4_libscenpwebapi.pas +++ b/src/np/ps4_libscenpwebapi.pas @@ -272,6 +272,18 @@ function ps4_sceNpWebApiDeleteContext(userCtxId:Integer):Integer; SysV_ABI_CDecl responseDataSize:QWORD; end; + pSceNpWebApi2ExtdPushEventExtdDataKey=^SceNpWebApi2ExtdPushEventExtdDataKey; + SceNpWebApi2ExtdPushEventExtdDataKey=packed record + val:array[0..SCE_NP_WEBAPI_EXTD_PUSH_EVENT_EXTD_DATA_KEY_LEN_MAX] of AnsiChar; + end; + + pSceNpWebApi2PushEventFilterParameter=^SceNpWebApi2PushEventFilterParameter; + SceNpWebApi2PushEventFilterParameter=packed record + dataType:pSceNpWebApi2ExtdPushEventExtdDataKey; + pExtdDataKey:Pointer; + extdDataKeyNum:QWORD; + end; + const SCE_NP_WEBAPI2_PUSH_EVENT_UUID_LENGTH=36; @@ -325,6 +337,16 @@ function ps4_sceNpWebApi2AddHttpRequestHeader(requestId:Integer; Result:=0; end; +function ps4_sceNpWebApi2PushEventCreateFilter(libCtxId:Integer; + handleId:Integer; + pNpServiceName:PChar; + npServiceLabel:DWORD; + pFilterParam:pSceNpWebApi2PushEventFilterParameter; + filterParamNum:QWORD):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + //NpWebApi2 function Load_libSceNpWebApi(Const name:RawByteString):TElf_node; @@ -374,7 +396,8 @@ function Load_libSceNpWebApi2(Const name:RawByteString):TElf_node; lib^.set_proc($95038217CE25BF3C,@ps4_sceNpWebApi2SendRequest); lib^.set_proc($B24E786E2E85B583,@ps4_sceNpWebApi2CreateUserContext); lib^.set_proc($41A7F179933758AE,@ps4_sceNpWebApi2PushEventDeletePushContext); - lib^.set_proc($7A038EBEB9C5EA62,@ps4_sceNpWebApi2AddHttpRequestHeader); + lib^.set_proc($7A038EBEB9C5EA62,@ps4_sceNpWebApi2AddHttpRequestHeader); + lib^.set_proc($32C685851FA53C4E,@ps4_sceNpWebApi2PushEventCreateFilter); end; initialization From a4049cbd9fa34091a10f688fc1b99a6732021170 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:13:33 +0400 Subject: [PATCH 10/30] sceNpWebApi2PushEventCreateHandle --- src/np/ps4_libscenpwebapi.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/np/ps4_libscenpwebapi.pas b/src/np/ps4_libscenpwebapi.pas index 35aa82f1..c2534598 100644 --- a/src/np/ps4_libscenpwebapi.pas +++ b/src/np/ps4_libscenpwebapi.pas @@ -337,6 +337,11 @@ function ps4_sceNpWebApi2AddHttpRequestHeader(requestId:Integer; Result:=0; end; +function ps4_sceNpWebApi2PushEventCreateHandle(libCtxId:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function ps4_sceNpWebApi2PushEventCreateFilter(libCtxId:Integer; handleId:Integer; pNpServiceName:PChar; @@ -397,6 +402,7 @@ function Load_libSceNpWebApi2(Const name:RawByteString):TElf_node; lib^.set_proc($B24E786E2E85B583,@ps4_sceNpWebApi2CreateUserContext); lib^.set_proc($41A7F179933758AE,@ps4_sceNpWebApi2PushEventDeletePushContext); lib^.set_proc($7A038EBEB9C5EA62,@ps4_sceNpWebApi2AddHttpRequestHeader); + lib^.set_proc($595D46C0CDF63606,@ps4_sceNpWebApi2PushEventCreateHandle); lib^.set_proc($32C685851FA53C4E,@ps4_sceNpWebApi2PushEventCreateFilter); end; From 078a87c2192e1f60778da7889cfedbfbc38642e7 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:14:45 +0400 Subject: [PATCH 11/30] sceNpWebApi2PushEventRegisterCallback --- src/np/ps4_libscenpwebapi.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/np/ps4_libscenpwebapi.pas b/src/np/ps4_libscenpwebapi.pas index c2534598..39f341d1 100644 --- a/src/np/ps4_libscenpwebapi.pas +++ b/src/np/ps4_libscenpwebapi.pas @@ -352,6 +352,13 @@ function ps4_sceNpWebApi2PushEventCreateFilter(libCtxId:Integer; Result:=0; end; +function ps4_sceNpWebApi2PushEventRegisterCallback(libCtxId:Integer; + cbFunc:Pointer; + pUserArg:Pointer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + //NpWebApi2 function Load_libSceNpWebApi(Const name:RawByteString):TElf_node; @@ -403,7 +410,8 @@ function Load_libSceNpWebApi2(Const name:RawByteString):TElf_node; lib^.set_proc($41A7F179933758AE,@ps4_sceNpWebApi2PushEventDeletePushContext); lib^.set_proc($7A038EBEB9C5EA62,@ps4_sceNpWebApi2AddHttpRequestHeader); lib^.set_proc($595D46C0CDF63606,@ps4_sceNpWebApi2PushEventCreateHandle); - lib^.set_proc($32C685851FA53C4E,@ps4_sceNpWebApi2PushEventCreateFilter); + lib^.set_proc($32C685851FA53C4E,@ps4_sceNpWebApi2PushEventCreateFilter); + lib^.set_proc($7D8DD0A9E36417C9,@ps4_sceNpWebApi2PushEventRegisterCallback); end; initialization From e9aae49ce83cb3c947c4ba9496cba9c8b05c002f Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:18:36 +0400 Subject: [PATCH 12/30] sceSigninDialogGetResult --- src/ps4_libscedialogs.pas | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 182c0b05..815c27dc 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -459,6 +459,20 @@ function ps4_sceNpCommerceHidePsStoreIcon():Integer; SysV_ABI_CDecl; SCE_SIGNIN_DIALOG_STATUS_RUNNING =2; SCE_SIGNIN_DIALOG_STATUS_FINISHED =3; + //SceSigninDialogResultType + SCE_SIGNIN_DIALOG_RESULT_OK =0; + SCE_SIGNIN_DIALOG_RESULT_USER_CANCELED=1; + +type + pSceSigninDialogResultType=^SceSigninDialogResultType; + SceSigninDialogResultType=Integer; + + pSceSigninDialogResult=^SceSigninDialogResult; + SceSigninDialogResult=packed record + result:SceSigninDialogResultType; + reserved:array[0..2] of Integer; + end; + var status_signin_dialog:Integer=SCE_SIGNIN_DIALOG_STATUS_NONE; @@ -469,6 +483,11 @@ function ps4_sceSigninDialogInitialize():Integer; SysV_ABI_CDecl; Result:=0; end; +function ps4_sceSigninDialogGetResult(_result:pSceSigninDialogResult):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function ps4_sceSigninDialogTerminate():Integer; SysV_ABI_CDecl; begin Writeln('sceSigninDialogTerminate'); @@ -722,6 +741,7 @@ function Load_libSceSigninDialog(Const name:RawByteString):TElf_node; lib^.set_proc($9A56067E6A84DDF4,@ps4_sceSigninDialogInitialize); lib^.set_proc($265A49568456BFB5,@ps4_sceSigninDialogOpen); lib^.set_proc($070DF59624C54F70,@ps4_sceSigninDialogUpdateStatus); + lib^.set_proc($9EA1BBAEA9D8C355,@ps4_sceSigninDialogGetResult); lib^.set_proc($2D79664BA3EF25D5,@ps4_sceSigninDialogTerminate); end; From 62b609285def8f215e5a0807fb14f6aea6e2fe17 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:21:15 +0400 Subject: [PATCH 13/30] sceSslFreeCaCerts --- src/ps4_libSceSsl.pas | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ps4_libSceSsl.pas b/src/ps4_libSceSsl.pas index c6d275c6..c2468e29 100644 --- a/src/ps4_libSceSsl.pas +++ b/src/ps4_libSceSsl.pas @@ -7,6 +7,20 @@ interface uses ps4_program; +type + pSceSslData=^SceSslData; + SceSslData=packed record + ptr :PChar; + size:QWORD; + end; + + pSceSslCaCerts=^SceSslCaCerts; + SceSslCaCerts=packed record + certData :pSceSslData; + certDataNum:QWORD; + pool :Pointer; + end; + implementation function ps4_sceSslInit(poolSize:size_t):Integer; SysV_ABI_CDecl; @@ -21,6 +35,13 @@ function ps4_sceSslTerm(ctxId:Integer):Integer; SysV_ABI_CDecl; Result:=0; end; +function ps4_sceSslFreeCaCerts(libsslCtxId:Integer; + caCerts:SceSslCaCerts):Integer; SysV_ABI_CDecl; +begin + Writeln('sceSslFreeCaCerts:',libsslCtxId); + Result:=0; +end; + function Load_libSceSsl(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -32,6 +53,7 @@ function Load_libSceSsl(Const name:RawByteString):TElf_node; lib^.set_proc($85DA551140C55B7B,@ps4_sceSslInit); lib^.set_proc($D0AD7243A2EFFD87,@ps4_sceSslTerm); + lib^.set_proc($A88BCBB34818C62D,@ps4_sceSslFreeCaCerts); end; initialization From be06829b30f4cd04ffa001d33c6d16775cb72cae Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:21:56 +0400 Subject: [PATCH 14/30] sceSslGetCaCerts --- src/ps4_libSceSsl.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ps4_libSceSsl.pas b/src/ps4_libSceSsl.pas index c2468e29..3d83e53c 100644 --- a/src/ps4_libSceSsl.pas +++ b/src/ps4_libSceSsl.pas @@ -35,6 +35,13 @@ function ps4_sceSslTerm(ctxId:Integer):Integer; SysV_ABI_CDecl; Result:=0; end; +function ps4_sceSslGetCaCerts(libsslCtxId:Integer; + caCerts:SceSslCaCerts):Integer; SysV_ABI_CDecl; +begin + Writeln('sceSslGetCaCerts:',libsslCtxId); + Result:=0; +end; + function ps4_sceSslFreeCaCerts(libsslCtxId:Integer; caCerts:SceSslCaCerts):Integer; SysV_ABI_CDecl; begin @@ -53,6 +60,7 @@ function Load_libSceSsl(Const name:RawByteString):TElf_node; lib^.set_proc($85DA551140C55B7B,@ps4_sceSslInit); lib^.set_proc($D0AD7243A2EFFD87,@ps4_sceSslTerm); + lib^.set_proc($4C37D0A8EFE031B6,@ps4_sceSslGetCaCerts); lib^.set_proc($A88BCBB34818C62D,@ps4_sceSslFreeCaCerts); end; From f4eb964ec316551d2ef42f1e53add216ad59629c Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:24:03 +0400 Subject: [PATCH 15/30] sceUsbStorageInit --- fpPS4.lpr | 1 + src/ps4_libsceusbstorage.pas | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/ps4_libsceusbstorage.pas diff --git a/fpPS4.lpr b/fpPS4.lpr index 7b3252a4..cd801930 100644 --- a/fpPS4.lpr +++ b/fpPS4.lpr @@ -75,6 +75,7 @@ ps4_libSceContentExport, ps4_libSceConvertKeycode, ps4_libSceUsbd, + ps4_libSceUsbStorage, ps4_libSceAudiodecCpu, ps4_libSceDepth, ps4_libSceNpTus, diff --git a/src/ps4_libsceusbstorage.pas b/src/ps4_libsceusbstorage.pas new file mode 100644 index 00000000..bc84ec2b --- /dev/null +++ b/src/ps4_libsceusbstorage.pas @@ -0,0 +1,34 @@ +unit ps4_libSceUsbStorage; + +{$mode ObjFPC}{$H+} + +interface + +uses + ps4_program, + Classes, + SysUtils; + +implementation + +function ps4_sceUsbStorageInit():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function Load_libSceUsbStorage(Const name:RawByteString):TElf_node; +var + lib:PLIBRARY; +begin + Result:=TElf_node.Create; + Result.pFileName:=name; + + lib:=Result._add_lib('libSceUsbStorage'); + lib^.set_proc($0430D9C05E64B937,@ps4_sceUsbStorageInit); +end; + +initialization + ps4_app.RegistredPreLoad('libSceUsbStorage.prx' ,@Load_libSceUsbStorage); + +end. + From 3407359b06340833536533d2e4dc4ff70a200973 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:27:07 +0400 Subject: [PATCH 16/30] sceVideoOutAddDriver --- src/ps4_libscevideoout.pas | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/ps4_libscevideoout.pas b/src/ps4_libscevideoout.pas index 23bed09e..cd00764e 100644 --- a/src/ps4_libscevideoout.pas +++ b/src/ps4_libscevideoout.pas @@ -757,6 +757,65 @@ function ps4_sceVideoOutGetEventId(ev:PSceKernelEvent):Integer; SysV_ABI_CDecl; end; +function _sceVideoOutAddDriver(hVideo:Integer; + driverConfig:PDWORD; + index:PInteger; + driverCallback:Pointer):Integer; SysV_ABI_CDecl; +var + H:PInteger; +begin + if (((((((driverConfig <> nil) and (driverCallback = nil)) and (driverConfig^ <> 0)) and + ((driverConfig[1] <> 0) and (driverConfig[2] <> 0)))) and + ((driverConfig[3] <> 0) and ((driverConfig[4] <> 0) and (driverConfig[5] <> 0))))) and + ((driverConfig[7] <> 0) and (driverConfig[8] <> 0)) then + H:=nil; + begin + if (H=nil) then + Move(driverConfig^, (H + $E)^, $108); + if (index <> nil) then + begin + H[2] :=index[0]; + H[3] :=index[1]; + H[4] :=index[2]; + H[5] :=index[3]; + H[6] :=index[4]; + H[7] :=index[5]; + H[8] :=index[6]; + H[9] :=index[7]; + H[10]:=index[8]; + H[$B]:=index[9]; + H[$C]:=index[$A]; + H[$D]:=index[$B]; + end; + end; + begin + if (((((driverConfig[$18] = 0) and (driverConfig[$19] = 0)) and (driverConfig[$1A] = 0)) and + (((driverConfig[$1B] = 0) and (driverConfig[$1C] = 0)) and + ((driverConfig[$1D] = 0) and ((driverConfig[$1E] = 0) and (driverConfig[$1F] = 0)))))) then + begin + if (driverConfig[$20] <> 0) then + Result:=Integer(0); + end; + Result:=Integer(0); + end; +end; + +function ps4_sceVideoOutAddDriver(hVideo:Integer; + driverConfig:PDWORD; + index:PInteger; + driverCallback:Pointer):Integer; SysV_ABI_CDecl; +var + H:Integer; +begin + if (hVideo<>0) then + begin + _sig_lock; + H:=_sceVideoOutAddDriver(hVideo,driverConfig,index,driverCallback); + _sig_unlock; + Result:=Integer(H); + end; +end; + function ps4_sceVideoOutAddFlipEvent(eq:SceKernelEqueue;hVideo:Integer;udata:Pointer):Integer; SysV_ABI_CDecl; var H:TVideoOut; @@ -2038,6 +2097,7 @@ function Load_libSceVideoOut(Const name:RawByteString):TElf_node; lib^.set_proc($32DE101C793190E7,@ps4_sceVideoOutGetEventCount); lib^.set_proc($AD651370A7645334,@ps4_sceVideoOutGetEventData); lib^.set_proc($536249B52A8D2992,@ps4_sceVideoOutGetEventId); + lib^.set_proc($1EDC127781F64F0B,@ps4_sceVideoOutAddDriver); lib^.set_proc($1D7CE32BDC88DF49,@ps4_sceVideoOutAddFlipEvent); lib^.set_proc($5EBBBDDB01C94668,@ps4_sceVideoOutAddVblankEvent); lib^.set_proc($8BAFEC47DD56B7FE,@ps4_sceVideoOutSetBufferAttribute); From e881fd0f743b430bd6c38229d1aff580b75d0ab0 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:28:13 +0400 Subject: [PATCH 17/30] sceVoiceResumePortAll --- src/ps4_libscevoice.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ps4_libscevoice.pas b/src/ps4_libscevoice.pas index 8055e012..36496dd3 100644 --- a/src/ps4_libscevoice.pas +++ b/src/ps4_libscevoice.pas @@ -176,6 +176,11 @@ function ps4_sceVoiceSetMuteFlag(portId:DWORD;bMuted:Boolean):Integer; SysV_ABI_ Result:=0; end; +function ps4_sceVoiceResumePortAll():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function Load_libSceVoice(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -194,6 +199,7 @@ function Load_libSceVoice(Const name:RawByteString):TElf_node; lib^.set_proc($710E831AC4048D5E,@ps4_sceVoiceReadFromOPort); lib^.set_proc($4011680088C9A174,@ps4_sceVoiceSetVolume); lib^.set_proc($8305329E41203456,@ps4_sceVoiceSetMuteFlag); + lib^.set_proc($8DB909166399F54D,@ps4_sceVoiceResumePortAll); end; function Load_libSceVoiceQoS(Const name:RawByteString):TElf_node; From 7a752586b922d0a3ce4cb6256b9529ab1c5fa82e Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:36:54 +0400 Subject: [PATCH 18/30] Fixes --- src/ajm/ps4_libsceajm.pas | 4 ++- src/ps4_libscedialogs.pas | 33 ++++++++++++++++++- src/ps4_libscewebbrowserdialog.pas | 53 ------------------------------ 3 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 src/ps4_libscewebbrowserdialog.pas diff --git a/src/ajm/ps4_libsceajm.pas b/src/ajm/ps4_libsceajm.pas index 7b1ae11f..cac1beb1 100644 --- a/src/ajm/ps4_libsceajm.pas +++ b/src/ajm/ps4_libsceajm.pas @@ -396,7 +396,9 @@ function ps4_sceAjmBatchJobControlBufferRa( end; -procedure FixDataInput(pBatchPosition:Pointer;pDataInput:Pointer;szDataInputSize:QWORD); +procedure FixDataInput(const pBatchPosition:Pointer; + const pDataInput:Pointer; + const szDataInputSize:QWORD); begin if PQWORD(pBatchPosition)^ and (SCE_AJM_FLAG_SIDEBAND_STREAM)<>0 then begin diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 815c27dc..88684f4d 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -637,6 +637,23 @@ function ps4_sceInvitationDialogUpdateStatus():Integer; SysV_ABI_CDecl; // +function ps4_sceWebBrowserDialogUpdateStatus():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceWebBrowserDialogGetStatus():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceWebBrowserDialogTerminate():Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +// + function Load_libSceCommonDialog(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -812,6 +829,19 @@ function Load_libSceInvitationDialog(Const name:RawByteString):TElf_node; lib^.set_proc($F7E83D88EABEEE48,@ps4_sceInvitationDialogUpdateStatus); end; +function Load_libSceWebBrowserDialog(Const name:RawByteString):TElf_node; +var + lib:PLIBRARY; +begin + Result:=TElf_node.Create; + Result.pFileName:=name; + + lib:=Result._add_lib('libSceWebBrowserDialog'); + lib^.set_proc($875751FEDE484A08,@ps4_sceWebBrowserDialogUpdateStatus); + lib^.set_proc($0854C6E9AF138CE5,@ps4_sceWebBrowserDialogGetStatus); + lib^.set_proc($A1C1EDC81C077F2B,@ps4_sceWebBrowserDialogTerminate); +end; + initialization ps4_app.RegistredPreLoad('libSceCommonDialog.prx' ,@Load_libSceCommonDialog); ps4_app.RegistredPreLoad('libSceErrorDialog.prx' ,@Load_libSceErrorDialog); @@ -825,7 +855,8 @@ initialization ps4_app.RegistredPreLoad('libSceLoginDialog.prx' ,@Load_libSceLoginDialog); ps4_app.RegistredPreLoad('libSceHmdSetupDialog.prx' ,@Load_libSceHmdSetupDialog); ps4_app.RegistredPreLoad('libSceNpFriendListDialog.prx' ,@Load_libSceNpFriendListDialog); - ps4_app.RegistredPreLoad('libSceInvitationDialog.prx' ,@Load_libSceInvitationDialog); + ps4_app.RegistredPreLoad('libSceInvitationDialog.prx' ,@Load_libSceInvitationDialog); + ps4_app.RegistredPreLoad('libSceWebBrowserDialog.prx' ,@Load_libSceWebBrowserDialog); end. diff --git a/src/ps4_libscewebbrowserdialog.pas b/src/ps4_libscewebbrowserdialog.pas deleted file mode 100644 index 273ed96d..00000000 --- a/src/ps4_libscewebbrowserdialog.pas +++ /dev/null @@ -1,53 +0,0 @@ -unit ps4_libSceWebBrowserDialog; - -{$mode ObjFPC}{$H+} - -interface - -uses - ps4_program, - Classes, - SysUtils; - -const - //SceCommonDialogStatus - SCE_COMMON_DIALOG_STATUS_NONE =0; - SCE_COMMON_DIALOG_STATUS_INITIALIZED=1; - SCE_COMMON_DIALOG_STATUS_RUNNING =2; - SCE_COMMON_DIALOG_STATUS_FINISHED =3; - -implementation - -function ps4_sceWebBrowserDialogUpdateStatus():Integer; SysV_ABI_CDecl; -begin - Result:=0; -end; - -function ps4_sceWebBrowserDialogGetStatus():Integer; SysV_ABI_CDecl; -begin - Result:=0; -end; - -function ps4_sceWebBrowserDialogTerminate():Integer; SysV_ABI_CDecl; -begin - Result:=0; -end; - -function Load_libSceWebBrowserDialog(Const name:RawByteString):TElf_node; -var - lib:PLIBRARY; -begin - Result:=TElf_node.Create; - Result.pFileName:=name; - - lib:=Result._add_lib('libSceWebBrowserDialog'); - lib^.set_proc($875751FEDE484A08,@ps4_sceWebBrowserDialogUpdateStatus); - lib^.set_proc($0854C6E9AF138CE5,@ps4_sceWebBrowserDialogGetStatus); - lib^.set_proc($A1C1EDC81C077F2B,@ps4_sceWebBrowserDialogTerminate); -end; - -initialization - ps4_app.RegistredPreLoad('libSceWebBrowserDialog.prx',@Load_libSceWebBrowserDialog); - -end. - From 40bb04cdc0e04915373c032993b2647b113050ec Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:45:44 +0400 Subject: [PATCH 19/30] + --- fpPS4.lpr | 1 - 1 file changed, 1 deletion(-) diff --git a/fpPS4.lpr b/fpPS4.lpr index cd801930..d2c59b9b 100644 --- a/fpPS4.lpr +++ b/fpPS4.lpr @@ -69,7 +69,6 @@ ps4_libSceShareUtility, ps4_libSceSocialScreen, ps4_libSceVideoRecording, - ps4_libSceWebBrowserDialog, ps4_libSceCompanionHttpd, ps4_libSceCompanionUtil, ps4_libSceContentExport, From f82a631b9ef9088ef6de24e79c48bd3e514e3f62 Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:05:05 +0400 Subject: [PATCH 20/30] Fix build --- src/ps4_libscegnmdriver.pas | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index 2a61de13..4a6d4c3e 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -23,6 +23,7 @@ implementation sys_kernel, ps4_queue, ps4_libkernel, + ps4_kernel_file, ps4_libSceVideoOut{, ps4_pssl}; const From 86a99d690dd6cb65ae5bb950f65813b2680a8c9f Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Tue, 2 Apr 2024 17:59:21 +0400 Subject: [PATCH 21/30] + --- src/ps4_libscegnmdriver.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index 4a6d4c3e..f8001ed2 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -2106,8 +2106,8 @@ function ps4_sceGnmGetGpuCoreClockFrequency:QWORD; SysV_ABI_CDecl; ComputeEvents:array[0..6] of Thamt64locked; +//HardwareStatus type - //HardwareStatus pHardwareStatus=^HardwareStatus; HardwareStatus=Integer; From 73404246a1f80a990adb6be3cf354d411cf5a45a Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 20:31:10 +0300 Subject: [PATCH 22/30] + --- src/ajm/ps4_libsceajm.pas | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/ajm/ps4_libsceajm.pas b/src/ajm/ps4_libsceajm.pas index cac1beb1..965371e6 100644 --- a/src/ajm/ps4_libsceajm.pas +++ b/src/ajm/ps4_libsceajm.pas @@ -307,7 +307,7 @@ function ps4_sceAjmFinalize(uiContext:SceAjmContextId):Integer; SysV_ABI_CDecl; function ps4_sceAjmInstanceCodecType(uiCodec:SceAjmCodecType):Integer; SysV_ABI_CDecl; begin - Result:=uiCodec>>$E; + Result:=uiCodec shr $E; end; function ps4_sceAjmInstanceCreate(uiContext:SceAjmContextId; @@ -396,36 +396,17 @@ function ps4_sceAjmBatchJobControlBufferRa( end; -procedure FixDataInput(const pBatchPosition:Pointer; - const pDataInput:Pointer; - const szDataInputSize:QWORD); -begin - if PQWORD(pBatchPosition)^ and (SCE_AJM_FLAG_SIDEBAND_STREAM)<>0 then - begin - pSceAjmSidebandStreamResult(pDataInput)^.sStream.iSizeConsumed:=1; - pSceAjmSidebandStreamResult(pDataInput)^.sStream.iSizeProduced:=1; - pSceAjmSidebandStreamResult(pDataInput)^.sStream.uiTotalDecodedSamples:=1; //loop or div to zero - end; -end; - function ps4_sceAjmBatchJobInlineBuffer( - const pBatchPosition:Pointer; - const pDataInput: Pointer; + const pBatchPosition :Pointer; + const pDataInput :Pointer; const szDataInputSize:QWORD; - const pBatchAddress:PPointer):Pointer; SysV_ABI_CDecl; + const pBatchAddress :PPointer):Pointer; SysV_ABI_CDecl; begin - Result:=nil; - if (pDataInput<>nil) then - begin - FillChar(pDataInput^,szDataInputSize,0); - FixDataInput(pBatchPosition,pDataInput,szDataInputSize); - end; - begin - PQWORD(pBatchPosition)^ := PQWORD(pBatchPosition)^ and $ffffffe0 or 7; - PQWORD(pBatchPosition + 1)^ := (szDataInputSize + 7) and $fffffff8; - Move(pDataInput^, Pointer(PQWORD(pBatchPosition) + SizeOf(Pointer) * 2)^, szDataInputSize); - pBatchAddress^:=pBatchPosition + 2; - end; + PDWORD(pBatchPosition)^ :=PDWORD(pBatchPosition)^ and $ffffffe0 or 7; + PDWORD(pBatchPosition + 4)^:=(szDataInputSize + 7) and $fffffff8; + Move(pDataInput^, Pointer(pBatchPosition + 8)^, szDataInputSize); + pBatchAddress^:=(pBatchPosition + 8); + Result:=pBatchPosition + 8 + ((szDataInputSize + 7) and $fffffffffffffff8); end; function ps4_sceAjmBatchJobRunBufferRa( From c41811e4bf3857846e90d6d4cd305087f9e09902 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 20:38:22 +0300 Subject: [PATCH 23/30] + --- src/ps4_libscegnmdriver.pas | 51 +++---------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index f8001ed2..0bd9c92a 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -2106,55 +2106,10 @@ function ps4_sceGnmGetGpuCoreClockFrequency:QWORD; SysV_ABI_CDecl; ComputeEvents:array[0..6] of Thamt64locked; -//HardwareStatus -type - pHardwareStatus=^HardwareStatus; - HardwareStatus=Integer; - -const - kHardwareStatusDump = $01; - -Var - DebugHardwareStatus:array[0..1] of Thamt64locked; - -function _sceGnmDebugHardwareStatus(flag:HardwareStatus; - reserved:QWORD; - udata:Pointer):Integer; SysV_ABI_CDecl; -var - H:HardwareStatus; - R:QWORD; - P:PPointer; - pStatus:Phamt64locked; +procedure ps4_sceGnmDebugHardwareStatus(flag:DWORD); SysV_ABI_CDecl; begin - Case reserved of - kHardwareStatusDump:pStatus:=@DebugHardwareStatus[reserved]; - else - Exit(SCE_KERNEL_ERROR_EINVAL); - end; - - pStatus^.LockWr; - P:=HAMT_search64(@pStatus^.hamt,QWORD(flag)); - if (P<>nil) then - R:=reserved; - P:=udata; - H:=ps4_ioctl(flag,$C0088111,R); - begin - Exit(SCE_KERNEL_ERROR_ENOMEM); - end; - pStatus^.Unlock; - HAMT_insert64(@pStatus^.hamt,QWORD(flag),udata); - - Result:=0; -end; - -function ps4_sceGnmDebugHardwareStatus(flag:HardwareStatus; - reserved:QWORD; - udata:Pointer):Integer; SysV_ABI_CDecl; -begin - if (flag<>0) then - Exit; - _sceGnmDebugHardwareStatus(flag,reserved,udata); - Result:=0; + if (flag<>0) then Exit; + //kmd_dump_status(g_gcHandle,0,0); end; function _sceGnmAddEqEvent(eq:SceKernelEqueue;id:Integer;udata:Pointer):Integer; From a16191c5c4a61a5c36ddcc108221cc798b76d61c Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 20:42:34 +0300 Subject: [PATCH 24/30] + --- src/ps4_libscegnmdriver.pas | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index 0bd9c92a..639eb121 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -2188,23 +2188,11 @@ function _sceGnmDeleteEqEvent(eq:SceKernelEqueue;id:Integer):Integer; if (P<>nil) then begin node:=P^; + _free_kevent_node(node); end else begin - node:=_alloc_kevent_node(eq,SizeOf(TKEventNode)); - if (node=Pointer(1)) then - begin - pEvents^.Unlock; - Exit(SCE_KERNEL_ERROR_EBADF); - end; - if (node=nil) then - begin - pEvents^.Unlock; - Exit(SCE_KERNEL_ERROR_ENOMEM); - end; - node^.ev.filter:=SCE_KERNEL_EVFILT_GNM; - node^.ev.flags :=EV_CLEAR; - node^.ev.data :=id; - HAMT_insert64(@pEvents^.hamt,QWORD(eq),node); + pEvents^.Unlock; + Exit(SCE_KERNEL_ERROR_ENOENT); end; pEvents^.Unlock; From dd0804c3aa01f3f5cc62e70a5156fd93b8087efa Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 20:53:15 +0300 Subject: [PATCH 25/30] + --- src/ps4_libscedialogs.pas | 3 ++- src/ps4_libsceime.pas | 46 +++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 88684f4d..1718deca 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -531,7 +531,8 @@ function ps4_scePlayerInvitationDialogTerminate():Integer; SysV_ABI_CDecl; type pSceImeDialogParam=^SceImeDialogParam; SceImeDialogParam=packed record - userId,_type :SceImeType; + userId :Integer; + _type :SceImeType; supportedLanguages :QWORD; enterLabel :SceImeEnterLabel; inputMethod :SceImeInputMethod; diff --git a/src/ps4_libsceime.pas b/src/ps4_libsceime.pas index a2e9db7e..d793a22c 100644 --- a/src/ps4_libsceime.pas +++ b/src/ps4_libsceime.pas @@ -595,10 +595,10 @@ interface end; SceImeEditText=packed record - str:pWideChar; + str :pWideChar; caretIndex:DWORD; - areaNum:DWORD; - textArea:array[0..SCE_IME_MAX_TEXT_AREA-1] of SceImeTextAreaProperty; + areaNum :DWORD; + textArea :array[0..SCE_IME_MAX_TEXT_AREA-1] of SceImeTextAreaProperty; end; SceImePositionAndForm=packed record @@ -631,30 +631,30 @@ interface pSceImeKeyboardInfo=^SceImeKeyboardInfo; SceImeKeyboardInfo=packed record - userId:Integer; - device:Integer; //SceImeKeyboardDeviceType - _type:Integer; //SceImeKeyboardType + userId :Integer; + device :Integer; //SceImeKeyboardDeviceType + _type :Integer; //SceImeKeyboardType repeatDelay:DWORD; repeatRate :DWORD; - status:Integer; //SceImeKeyboardStatus - reserved:array[0..11] of Byte; + status :Integer; //SceImeKeyboardStatus + reserved :array[0..11] of Byte; end; pSceImeKeyboardResourceIdArray=^SceImeKeyboardResourceIdArray; SceImeKeyboardResourceIdArray=packed record - userId:Integer; + userId :Integer; resourceId:array[0..SCE_IME_KEYBOARD_MAX_NUMBER-1] of DWORD; end; SceImeKeycode=packed record - keycode:Word; - character:WideChar; - status:DWORD; - _type:Integer; //SceImeKeyboardType - userId:Integer; + keycode :Word; + character :WideChar; + status :DWORD; + _type :Integer; //SceImeKeyboardType + userId :Integer; resourceId:DWORD; - _align:Integer; - timestamp:QWORD; //SceRtcTick + _align :Integer; + timestamp :QWORD; //SceRtcTick end; pSceImeEventParam=^SceImeEventParam; @@ -691,9 +691,9 @@ interface pSceImeTextFilter=^SceImeTextFilter; SceImeTextFilter=packed record - outText:PWideChar; + outText :PWideChar; outTextLength:PDWORD; - srcText:PWideChar; + srcText :PWideChar; srcTextLength:DWORD; end; @@ -713,18 +713,18 @@ interface SceImeExtKeyboardFilter=packed record srcKeycode:SceImeKeycode; outKeycode:Word; - outStatus:PDWORD; - reserved:Pointer; + outStatus :PDWORD; + reserved :Pointer; end; SceImeEventHandler=procedure(arg:Pointer;e:pSceImeEvent); SysV_ABI_CDecl; pSceImeKeyboardParam=^SceImeKeyboardParam; SceImeKeyboardParam=packed record - option:DWORD; + option :DWORD; reserved1:DWORD; - arg:Pointer; - handler:SceImeEventHandler; + arg :Pointer; + handler :SceImeEventHandler; reserved2:QWORD; end; From 0fd10e4e496ed8b74de38bae66e5e7ecd86b39b2 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 21:18:31 +0300 Subject: [PATCH 26/30] + --- src/ps4_libscenet.pas | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/ps4_libscenet.pas b/src/ps4_libscenet.pas index 793fe81f..99709c87 100644 --- a/src/ps4_libscenet.pas +++ b/src/ps4_libscenet.pas @@ -467,16 +467,7 @@ function ps4_sceNetEpollDestroy(eid:Integer):Integer; SysV_ABI_CDecl; Result:=0; end; -type - pSceNetBandwidthControlParam=^SceNetBandwidthControlParam; - SceNetBandwidthControlParam=packed record - cbFuncArg:Pointer; - timeout:DWORD; - appReqId:Word; - padding:array[0..1] of char; - end; - -function ps4_sceNetBandwidthControlSetDefaultParam(s:Integer;param:SceNetBandwidthControlParam):Integer; SysV_ABI_CDecl; +function ps4_sceNetBandwidthControlSetDefaultParam(param1:Pointer;param2:Integer):Integer; SysV_ABI_CDecl; begin Result:=0; end; From 380990ed78e5041c1297867cc8e3c35d04f98b36 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 21:25:28 +0300 Subject: [PATCH 27/30] + --- src/np/ps4_libscenpwebapi.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/np/ps4_libscenpwebapi.pas b/src/np/ps4_libscenpwebapi.pas index 39f341d1..b83ca797 100644 --- a/src/np/ps4_libscenpwebapi.pas +++ b/src/np/ps4_libscenpwebapi.pas @@ -279,8 +279,8 @@ function ps4_sceNpWebApiDeleteContext(userCtxId:Integer):Integer; SysV_ABI_CDecl pSceNpWebApi2PushEventFilterParameter=^SceNpWebApi2PushEventFilterParameter; SceNpWebApi2PushEventFilterParameter=packed record - dataType:pSceNpWebApi2ExtdPushEventExtdDataKey; - pExtdDataKey:Pointer; + dataType :SceNpWebApi2ExtdPushEventExtdDataKey; + pExtdDataKey :Pointer; extdDataKeyNum:QWORD; end; @@ -350,7 +350,7 @@ function ps4_sceNpWebApi2PushEventCreateFilter(libCtxId:Integer; filterParamNum:QWORD):Integer; SysV_ABI_CDecl; begin Result:=0; -end; +end; function ps4_sceNpWebApi2PushEventRegisterCallback(libCtxId:Integer; cbFunc:Pointer; From 2fe93780c35a7c9b65564ee2f5f0e913fb774e63 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 21:29:33 +0300 Subject: [PATCH 28/30] + --- src/ps4_libSceSsl.pas | 4 ++-- src/ps4_libscedialogs.pas | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ps4_libSceSsl.pas b/src/ps4_libSceSsl.pas index 3d83e53c..144dac39 100644 --- a/src/ps4_libSceSsl.pas +++ b/src/ps4_libSceSsl.pas @@ -36,14 +36,14 @@ function ps4_sceSslTerm(ctxId:Integer):Integer; SysV_ABI_CDecl; end; function ps4_sceSslGetCaCerts(libsslCtxId:Integer; - caCerts:SceSslCaCerts):Integer; SysV_ABI_CDecl; + caCerts:pSceSslCaCerts):Integer; SysV_ABI_CDecl; begin Writeln('sceSslGetCaCerts:',libsslCtxId); Result:=0; end; function ps4_sceSslFreeCaCerts(libsslCtxId:Integer; - caCerts:SceSslCaCerts):Integer; SysV_ABI_CDecl; + caCerts:pSceSslCaCerts):Integer; SysV_ABI_CDecl; begin Writeln('sceSslFreeCaCerts:',libsslCtxId); Result:=0; diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 1718deca..a1c6473c 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -469,7 +469,7 @@ function ps4_sceNpCommerceHidePsStoreIcon():Integer; SysV_ABI_CDecl; pSceSigninDialogResult=^SceSigninDialogResult; SceSigninDialogResult=packed record - result:SceSigninDialogResultType; + _result :SceSigninDialogResultType; reserved:array[0..2] of Integer; end; From f5073bb984419c6feffc32baec22fd0d07308316 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 21:34:14 +0300 Subject: [PATCH 29/30] + --- src/ps4_libsceusbstorage.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ps4_libsceusbstorage.pas b/src/ps4_libsceusbstorage.pas index bc84ec2b..65ab9fa4 100644 --- a/src/ps4_libsceusbstorage.pas +++ b/src/ps4_libsceusbstorage.pas @@ -7,11 +7,12 @@ interface uses ps4_program, Classes, - SysUtils; + SysUtils, + sys_pthread; implementation -function ps4_sceUsbStorageInit():Integer; SysV_ABI_CDecl; +function ps4_sceUsbStorageInit(pAttr:p_pthread_attr_t):Integer; SysV_ABI_CDecl; begin Result:=0; end; From 1e35790687b4dc7824587362ac772537ca175ee9 Mon Sep 17 00:00:00 2001 From: red-prig Date: Tue, 2 Apr 2024 21:47:30 +0300 Subject: [PATCH 30/30] + --- src/ps4_libscevideoout.pas | 62 ++++---------------------------------- 1 file changed, 6 insertions(+), 56 deletions(-) diff --git a/src/ps4_libscevideoout.pas b/src/ps4_libscevideoout.pas index cd00764e..749ca667 100644 --- a/src/ps4_libscevideoout.pas +++ b/src/ps4_libscevideoout.pas @@ -757,63 +757,13 @@ function ps4_sceVideoOutGetEventId(ev:PSceKernelEvent):Integer; SysV_ABI_CDecl; end; -function _sceVideoOutAddDriver(hVideo:Integer; - driverConfig:PDWORD; - index:PInteger; - driverCallback:Pointer):Integer; SysV_ABI_CDecl; -var - H:PInteger; +function ps4_sceVideoOutAddDriver(driver_id:Integer; //driver id + cbs :Pointer; //cbs table + param_3 :PDWORD; + param_4 :QWORD):Pointer; SysV_ABI_CDecl; begin - if (((((((driverConfig <> nil) and (driverCallback = nil)) and (driverConfig^ <> 0)) and - ((driverConfig[1] <> 0) and (driverConfig[2] <> 0)))) and - ((driverConfig[3] <> 0) and ((driverConfig[4] <> 0) and (driverConfig[5] <> 0))))) and - ((driverConfig[7] <> 0) and (driverConfig[8] <> 0)) then - H:=nil; - begin - if (H=nil) then - Move(driverConfig^, (H + $E)^, $108); - if (index <> nil) then - begin - H[2] :=index[0]; - H[3] :=index[1]; - H[4] :=index[2]; - H[5] :=index[3]; - H[6] :=index[4]; - H[7] :=index[5]; - H[8] :=index[6]; - H[9] :=index[7]; - H[10]:=index[8]; - H[$B]:=index[9]; - H[$C]:=index[$A]; - H[$D]:=index[$B]; - end; - end; - begin - if (((((driverConfig[$18] = 0) and (driverConfig[$19] = 0)) and (driverConfig[$1A] = 0)) and - (((driverConfig[$1B] = 0) and (driverConfig[$1C] = 0)) and - ((driverConfig[$1D] = 0) and ((driverConfig[$1E] = 0) and (driverConfig[$1F] = 0)))))) then - begin - if (driverConfig[$20] <> 0) then - Result:=Integer(0); - end; - Result:=Integer(0); - end; -end; - -function ps4_sceVideoOutAddDriver(hVideo:Integer; - driverConfig:PDWORD; - index:PInteger; - driverCallback:Pointer):Integer; SysV_ABI_CDecl; -var - H:Integer; -begin - if (hVideo<>0) then - begin - _sig_lock; - H:=_sceVideoOutAddDriver(hVideo,driverConfig,index,driverCallback); - _sig_unlock; - Result:=Integer(H); - end; + Assert(false,'TODO:abstract driver structure'); + Result:=nil; //need link to *t_driver structure end; function ps4_sceVideoOutAddFlipEvent(eq:SceKernelEqueue;hVideo:Integer;udata:Pointer):Integer; SysV_ABI_CDecl;