Skip to content

Commit

Permalink
SceCompanionUtil library + SceVoiceQoSCreateLocalEndpoint + SceVoiceQ…
Browse files Browse the repository at this point in the history
…oSGetLocalEndpointAttribute + SceAudiodecTermLibrary (#194)

* libSceCompanionUtil

* sceVoiceQoSCreateLocalEndpoint + sceVoiceQoSGetLocalEndpointAttribute

* SceAudiodecTermLibrary

* +

* +

---------

Co-authored-by: red-prig <[email protected]>
  • Loading branch information
Ordinary205 and red-prig authored Feb 19, 2024
1 parent 091deb5 commit d12d1fb
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 12 deletions.
1 change: 1 addition & 0 deletions fpPS4.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
ps4_libSceWebBrowserDialog,
ps4_libSceInvitationDialog,
ps4_libSceCompanionHttpd,
ps4_libSceCompanionUtil,
ps4_libSceContentExport,
ps4_libSceConvertKeycode,
ps4_libSceUsbd,
Expand Down
11 changes: 10 additions & 1 deletion src/audiodec/ps4_libsceaudiodec.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/ps4_libscecompanionhttpd.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
76 changes: 76 additions & 0 deletions src/ps4_libscecompanionutil.pas
Original file line number Diff line number Diff line change
@@ -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.

30 changes: 22 additions & 8 deletions src/ps4_libscenet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions src/ps4_libscevoice.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d12d1fb

Please sign in to comment.