From d12d1fba90d58232a653aab06641716c51d6aead Mon Sep 17 00:00:00 2001 From: Ordinary205 <125112932+Ordinary205@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:52:18 +0400 Subject: [PATCH] SceCompanionUtil library + SceVoiceQoSCreateLocalEndpoint + SceVoiceQoSGetLocalEndpointAttribute + SceAudiodecTermLibrary (#194) * libSceCompanionUtil * sceVoiceQoSCreateLocalEndpoint + sceVoiceQoSGetLocalEndpointAttribute * SceAudiodecTermLibrary * + * + --------- Co-authored-by: red-prig --- fpPS4.lpr | 1 + src/audiodec/ps4_libsceaudiodec.pas | 11 ++++- src/ps4_libscecompanionhttpd.pas | 3 -- src/ps4_libscecompanionutil.pas | 76 +++++++++++++++++++++++++++++ src/ps4_libscenet.pas | 30 +++++++++--- src/ps4_libscevoice.pas | 35 +++++++++++++ 6 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 src/ps4_libscecompanionutil.pas diff --git a/fpPS4.lpr b/fpPS4.lpr index a7cbc5b2..ac9b2e9c 100644 --- a/fpPS4.lpr +++ b/fpPS4.lpr @@ -70,6 +70,7 @@ ps4_libSceWebBrowserDialog, ps4_libSceInvitationDialog, ps4_libSceCompanionHttpd, + ps4_libSceCompanionUtil, ps4_libSceContentExport, ps4_libSceConvertKeycode, ps4_libSceUsbd, diff --git a/src/audiodec/ps4_libsceaudiodec.pas b/src/audiodec/ps4_libsceaudiodec.pas index c89408f3..244e7182 100644 --- a/src/audiodec/ps4_libsceaudiodec.pas +++ b/src/audiodec/ps4_libsceaudiodec.pas @@ -253,6 +253,15 @@ function ps4_sceAudiodecClearContext(handle:Integer):Integer; SysV_ABI_CDecl; Result:=0; end; +function ps4_sceAudiodecTermLibrary(uiCodecType:DWORD):Integer; SysV_ABI_CDecl; +begin + Writeln('sceAudiodecTermLibrary,uiCodecType=',uiCodecType); + if not (uiCodecType in [SCE_AUDIODEC_TYPE_AT9..SCE_AUDIODEC_TYPE_M4AAC]) then + Result:=SCE_AUDIODEC_ERROR_INVALID_TYPE + else + Result:=0; +end; + function Load_libSceAudiodec(Const name:RawByteString):TElf_node; var lib:PLIBRARY; @@ -261,12 +270,12 @@ function Load_libSceAudiodec(Const name:RawByteString):TElf_node; Result.pFileName:=name; lib:=Result._add_lib('libSceAudiodec'); - lib^.set_proc($56386C9B1A5C7B32,@ps4_sceAudiodecInitLibrary); lib^.set_proc($3B77F5B0B31646FB,@ps4_sceAudiodecCreateDecoder); lib^.set_proc($2875C73032E420BC,@ps4_sceAudiodecDecode); lib^.set_proc($4E9F99132EBD98B9,@ps4_sceAudiodecDeleteDecoder); lib^.set_proc($E957FD5932C3A2CB,@ps4_sceAudiodecClearContext); + lib^.set_proc($8798D20764080D5D,@ps4_sceAudiodecTermLibrary); end; initialization diff --git a/src/ps4_libscecompanionhttpd.pas b/src/ps4_libscecompanionhttpd.pas index dacc8c58..3524461f 100644 --- a/src/ps4_libscecompanionhttpd.pas +++ b/src/ps4_libscecompanionhttpd.pas @@ -15,9 +15,6 @@ interface SCE_COMPANION_HTTPD_ERROR_INVALID_PARAM =-2132541436; //0x80E40004 type - pSceNetInPort_t=^SceNetInPort_t; - SceNetInPort_t=word; - pSceCompanionHttpdOptParam2=^SceCompanionHttpdOptParam2; SceCompanionHttpdOptParam2=packed record thisSize :QWORD; diff --git a/src/ps4_libscecompanionutil.pas b/src/ps4_libscecompanionutil.pas new file mode 100644 index 00000000..4bd0450e --- /dev/null +++ b/src/ps4_libscecompanionutil.pas @@ -0,0 +1,76 @@ +unit ps4_libSceCompanionUtil; + +{$mode ObjFPC}{$H+} + +interface + +uses + ps4_program, + ps4_libSceNet, + Classes, + SysUtils; + +const + SCE_COMPANION_UTIL_ERROR_NO_EVENT=-2136145912; //0x80AD0008 + +type + pSceCompanionUtilOptParam=^SceCompanionUtilOptParam; + SceCompanionUtilOptParam=packed record + thisSize :QWORD; + workMemory :Pointer; + workMemorySize:QWORD; + end; + + pSceCompanionUtilDeviceInfo=^SceCompanionUtilDeviceInfo; + SceCompanionUtilDeviceInfo=packed record + userId :Integer; + addr :SceNetSockaddrIn; + reserved:array[0..235] of char; + end; + + pSceCompanionUtilEvent=^SceCompanionUtilEvent; + SceCompanionUtilEvent=packed record + event:Integer; + union:packed record + case Byte of + 0:(deviceInfo:SceCompanionUtilDeviceInfo); + 1:(userId :Integer); + 2:(reserved :array[0..255] of char); + end; + end; + +implementation + +function ps4_sceCompanionUtilOptParamInitialize(pOptParam:SceCompanionUtilOptParam):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceCompanionUtilInitialize(const option:pSceCompanionUtilOptParam):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceCompanionUtilGetEvent(pEvent:pSceCompanionUtilEvent):Integer; SysV_ABI_CDecl; +begin + Result:=SCE_COMPANION_UTIL_ERROR_NO_EVENT; +end; + +function Load_libSceCompanionUtil(Const name:RawByteString):TElf_node; +var + lib:PLIBRARY; +begin + Result:=TElf_node.Create; + Result.pFileName:=name; + + lib:=Result._add_lib('libSceCompanionUtil'); + lib^.set_proc($20F37F1514AB69F9,@ps4_sceCompanionUtilOptParamInitialize); + lib^.set_proc($C5BD7194885FD106,@ps4_sceCompanionUtilInitialize); + lib^.set_proc($704E4CB32D755A15,@ps4_sceCompanionUtilGetEvent); +end; + +initialization + ps4_app.RegistredPreLoad('libSceCompanionUtil.prx',@Load_libSceCompanionUtil); + +end. + diff --git a/src/ps4_libscenet.pas b/src/ps4_libscenet.pas index 070914b9..033d2b18 100644 --- a/src/ps4_libscenet.pas +++ b/src/ps4_libscenet.pas @@ -43,29 +43,43 @@ interface pSceNetSocklen_t=^SceNetSocklen_t; SceNetSocklen_t=DWORD; - SceNetSaFamily=Byte; + pSceNetSaFamily_t=^SceNetSaFamily_t; + SceNetSaFamily_t=Byte; + + pSceNetInPort_t=^SceNetInPort_t; + SceNetInPort_t=word; + + pSceNetSockaddrIn=^SceNetSockaddrIn; + SceNetSockaddrIn=packed record + sin_len :Byte; + sin_family:SceNetSaFamily_t; + sin_port :SceNetInPort_t; + sin_addr :SceNetInAddr; + sin_vport :SceNetInPort_t; + sin_zero :array[0..5] of char; + end; SceNetEpollData=packed record Case Byte of //union 0:(ptr:Pointer); 1:(u32:DWORD); - 2:(fd:Integer); + 2:(fd :Integer); 3:(u64:QWORD); end; pSceNetSockaddr=^SceNetSockaddr; SceNetSockaddr = packed record - sa_len:Byte; - sa_family:SceNetSaFamily; - sa_data:array[0..13] of Byte; + sa_len :Byte; + sa_family:SceNetSaFamily_t; + sa_data :array[0..13] of Byte; end; pSceNetEpollEvent=^SceNetEpollEvent; SceNetEpollEvent = packed record - events:DWORD; + events :DWORD; reserved:DWORD; - ident:QWORD; - data:SceNetEpollData; + ident :QWORD; + data :SceNetEpollData; end; const diff --git a/src/ps4_libscevoice.pas b/src/ps4_libscevoice.pas index 3d774f6d..8055e012 100644 --- a/src/ps4_libscevoice.pas +++ b/src/ps4_libscevoice.pas @@ -13,6 +13,17 @@ interface const SCE_VOICE_ERROR_ARGUMENT_INVALID=-2142369787; + //SceVoiceQoSAttributeId + SCE_VOICE_QOS_ATTR_MIC_VOLUME =0; + SCE_VOICE_QOS_ATTR_MIC_MUTE =true; + SCE_VOICE_QOS_ATTR_SPEAKER_VOLUME =0; + SCE_VOICE_QOS_ATTR_SPEAKER_MUTE =true; + SCE_VOICE_QOS_ATTR_DESIRED_OUT_BIT_RATE=3851; + SCE_VOICE_QOS_ATTR_MIC_USABLE =false; + SCE_VOICE_QOS_ATTR_SILENT_STATE =6; + SCE_VOICE_QOS_ATTR_REMOTE_MUTE =true; + SCE_VOICE_QOS_ATTR_SPEAKER_DESTINATION =0; + //SceVoicePortType SCE_VOICE_PORTTYPE_NULL =-1; SCE_VOICE_PORTTYPE_IN_DEVICE =0; @@ -23,6 +34,12 @@ interface SCE_VOICE_PORTTYPE_OUT_DEVICE =5; type + pSceVoiceQoSLocalId=^SceVoiceQoSLocalId; + SceVoiceQoSLocalId=Integer; + + pSceVoiceQoSAttributeId=^SceVoiceQoSAttributeId; + SceVoiceQoSAttributeId=Integer; + pSceVoiceInitParam=^SceVoiceInitParam; SceVoiceInitParam=packed record appType :Integer; @@ -77,6 +94,22 @@ function ps4_sceVoiceQoSInit(pMemBlock:Pointer;memSize:DWORD;appType:Integer):In Result:=0; end; +function ps4_sceVoiceQoSCreateLocalEndpoint(pLocalId :pSceVoiceQoSLocalId; + userId :Integer; + deviceInId :Integer; + deviceOutId:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + +function ps4_sceVoiceQoSGetLocalEndpointAttribute(LocalId :SceVoiceQoSLocalId; + attributeId :SceVoiceQoSAttributeId; + pAttributeValue:Pointer; + attributeSize :Integer):Integer; SysV_ABI_CDecl; +begin + Result:=0; +end; + function ps4_sceVoiceStart(pArg:pSceVoiceStartParam):Integer; SysV_ABI_CDecl; begin Result:=0; @@ -171,6 +204,8 @@ function Load_libSceVoiceQoS(Const name:RawByteString):TElf_node; Result.pFileName:=name; lib:=Result._add_lib('libSceVoiceQoS'); lib^.set_proc($53C21F365EBF0ACB,@ps4_sceVoiceQoSInit); + lib^.set_proc($96F342961347CF12,@ps4_sceVoiceQoSCreateLocalEndpoint); + lib^.set_proc($799BB644FD0C6B7C,@ps4_sceVoiceQoSGetLocalEndpointAttribute); end; initialization