mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-10-06 19:23:21 +00:00
ScePosix library + ScePad functions + Remove log spams (#183)
* Socket library * ScePad functions * Remove log spams * Fix sceUsbdOpenDeviceWithVidPid * + * ps4_libScePosix -> ps4_scesocket * + --------- Co-authored-by: red-prig <vdpasha@mail.ru>
This commit is contained in:
parent
4a540f2a02
commit
97a133933a
@ -23,6 +23,7 @@ uses
|
||||
ps4_kernel_file,
|
||||
ps4_queue,
|
||||
ps4_event_flag,
|
||||
ps4_scesocket,
|
||||
ps4_elf,
|
||||
ps4_program,
|
||||
|
||||
@ -1973,15 +1974,27 @@ begin
|
||||
|
||||
//file
|
||||
|
||||
//socket
|
||||
|
||||
lib^.set_proc($4D4FDDF4F7C81CF3,@ps4_socket);
|
||||
lib^.set_proc($2AE3A680AA2A09D6,@ps4_bind);
|
||||
lib^.set_proc($7C5C469311766D5A,@ps4_setsockopt);
|
||||
lib^.set_proc($4FC7C447EB481A09,@ps4_select);
|
||||
lib^.set_proc($95493AC2B197C8CC,@ps4_recvfrom);
|
||||
|
||||
//socket
|
||||
|
||||
lib^.set_proc($BA5E7B86F9BA9817,@ps4_sceKernelGetOpenPsIdForSystem);
|
||||
|
||||
lib^.set_proc($E63442B366B1B6BE,@ps4_inet_ntop);
|
||||
|
||||
//
|
||||
|
||||
//mirror of libkernel
|
||||
px:=Result._add_lib('libScePosix');
|
||||
px^.MapSymbol:=lib^.MapSymbol;
|
||||
|
||||
//mirror of libkernel
|
||||
px:=Result._add_lib('libkernel_cpumode_platform');
|
||||
px^.MapSymbol:=lib^.MapSymbol;
|
||||
|
||||
@ -1993,6 +2006,7 @@ begin
|
||||
lib^.set_proc($421BF90110283847,@ps4_sceKernelRemoveExceptionHandler);
|
||||
lib^.set_proc($8A5D379E5B8A7CC9,@ps4_sceKernelRaiseException);
|
||||
|
||||
//mirror of libkernel
|
||||
px:=Result._add_lib('libkernel_exception');
|
||||
px^.MapSymbol:=lib^.MapSymbol;
|
||||
|
||||
|
78
kernel/ps4_scesocket.pas
Normal file
78
kernel/ps4_scesocket.pas
Normal file
@ -0,0 +1,78 @@
|
||||
unit ps4_scesocket;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
ps4_libSceNet,
|
||||
ps4_program,
|
||||
Classes,
|
||||
SysUtils;
|
||||
|
||||
type
|
||||
pSceNetId=^SceNetId;
|
||||
SceNetId=Integer;
|
||||
|
||||
function ps4_socket(const name:PChar;
|
||||
family,_type,protocol:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_bind(s:SceNetId;
|
||||
const addr:pSceNetSockaddr;
|
||||
addrlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_setsockopt(s:SceNetId;
|
||||
level,optname:Integer;
|
||||
const optval:Pointer;
|
||||
optlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_select():Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_recvfrom(s:SceNetId;
|
||||
buf:Pointer;
|
||||
len:QWORD;
|
||||
flags:Integer;
|
||||
addr:pSceNetSockaddr;
|
||||
paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
function ps4_socket(const name:PChar;
|
||||
family,_type,protocol:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_bind(s:SceNetId;
|
||||
const addr:pSceNetSockaddr;
|
||||
addrlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_setsockopt(s:SceNetId;
|
||||
level,optname:Integer;
|
||||
const optval:Pointer;
|
||||
optlen:SceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_select():Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_recvfrom(s:SceNetId;
|
||||
buf:Pointer;
|
||||
len:QWORD;
|
||||
flags:Integer;
|
||||
addr:pSceNetSockaddr;
|
||||
paddrlen:pSceNetSocklen_t):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -175,6 +175,18 @@ type
|
||||
reserve:array[0..7] of Byte;
|
||||
end;
|
||||
|
||||
pScePadExtControllerInformation=^ScePadExtControllerInformation;
|
||||
ScePadExtControllerInformation=packed record
|
||||
base:ScePadControllerInformation;
|
||||
pad_type1:Word;
|
||||
pad_type2:Word;
|
||||
capability:Byte;
|
||||
case byte of
|
||||
0:(quantityOfSelectorSwitch:Byte);
|
||||
1:(maxPhysicalWheelAngle:Integer);
|
||||
2:(data:array[0..7] of Byte);
|
||||
end;
|
||||
|
||||
pScePadDeviceClassExtendedInformation=^ScePadDeviceClassExtendedInformation;
|
||||
ScePadDeviceClassExtendedInformation=packed record
|
||||
deviceClass:DWORD; //ScePadDeviceClass
|
||||
|
@ -10,11 +10,6 @@ uses
|
||||
Classes,
|
||||
SysUtils;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
ps4_time;
|
||||
|
||||
const
|
||||
SCE_NET_EINVAL =22;
|
||||
SCE_NET_ENOSPC =28;
|
||||
@ -22,9 +17,12 @@ const
|
||||
|
||||
SCE_NET_EHOSTUNREACH=65;
|
||||
|
||||
//
|
||||
|
||||
threadvar
|
||||
sce_net_errno:Integer;
|
||||
SCE_NET_INET_ADDRSTRLEN=16;
|
||||
|
||||
SCE_NET_ETHER_ADDR_LEN =6;
|
||||
SCE_NET_ETHER_ADDRSTRLEN=18;
|
||||
|
||||
type
|
||||
SceNetInAddr_t=DWORD;
|
||||
@ -34,35 +32,24 @@ type
|
||||
s_addr:SceNetInAddr_t;
|
||||
end;
|
||||
|
||||
const
|
||||
SCE_NET_INET_ADDRSTRLEN=16;
|
||||
|
||||
SCE_NET_ETHER_ADDR_LEN =6;
|
||||
SCE_NET_ETHER_ADDRSTRLEN=18;
|
||||
|
||||
type
|
||||
pSceNetEtherAddr=^SceNetEtherAddr;
|
||||
SceNetEtherAddr=packed record
|
||||
data:array[0..SCE_NET_ETHER_ADDR_LEN-1] of Byte;
|
||||
end;
|
||||
|
||||
type
|
||||
pSceNetSocklen_t=^SceNetSocklen_t;
|
||||
SceNetSocklen_t=DWORD;
|
||||
|
||||
type
|
||||
SceNetSaFamily=Byte;
|
||||
|
||||
type
|
||||
SceNetEpollData= packed record
|
||||
SceNetEpollData=packed record
|
||||
Case Byte of //union
|
||||
0:(ptr:Pointer);
|
||||
1:(u32:DWORD);
|
||||
2:(fd:Integer);
|
||||
3:(u64:QWORD);
|
||||
end;
|
||||
end;
|
||||
|
||||
type
|
||||
pSceNetSockaddr=^SceNetSockaddr;
|
||||
SceNetSockaddr = packed record
|
||||
sa_len:Byte;
|
||||
@ -70,7 +57,6 @@ type
|
||||
sa_data:array[0..13] of Byte;
|
||||
end;
|
||||
|
||||
type
|
||||
pSceNetEpollEvent=^SceNetEpollEvent;
|
||||
SceNetEpollEvent = packed record
|
||||
events:DWORD;
|
||||
@ -79,6 +65,14 @@ type
|
||||
data:SceNetEpollData;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
ps4_time;
|
||||
|
||||
threadvar
|
||||
sce_net_errno:Integer;
|
||||
|
||||
function libnet_tls_get_errno():PInteger;
|
||||
begin
|
||||
Result:=@sce_net_errno;
|
||||
|
@ -361,6 +361,30 @@ begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
type
|
||||
p_pad_ext_param=^t_pad_ext_param;
|
||||
t_pad_ext_param=packed record
|
||||
param_0:Word;
|
||||
param_1:Word;
|
||||
param_2:Word;
|
||||
param_3:Byte;
|
||||
end;
|
||||
|
||||
function ps4_scePadOpenExt(userID,_type,index:Integer;param:p_pad_ext_param):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=ps4_scePadOpen(userID,_type,index,param);
|
||||
end;
|
||||
|
||||
function ps4_scePadGetExtControllerInformation(handle:Integer;
|
||||
pInfo:pScePadExtControllerInformation):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (ScePadInterface=nil) then Exit(SCE_PAD_ERROR_NOT_INITIALIZED);
|
||||
|
||||
pInfo^:=Default(ScePadExtControllerInformation);
|
||||
|
||||
Result:=ps4_scePadGetControllerInformation(handle,@pInfo^.base);
|
||||
end;
|
||||
|
||||
function Load_libScePad(Const name:RawByteString):TElf_node;
|
||||
var
|
||||
lib:PLIBRARY;
|
||||
@ -386,6 +410,8 @@ begin
|
||||
lib^.set_proc($AC866747A792A6F9,@ps4_scePadResetOrientation);
|
||||
lib^.set_proc($BC32CCA092DD7BC2,@ps4_scePadSetTiltCorrectionState);
|
||||
lib^.set_proc($AF8E260317521BE5,@ps4_scePadSetAngularVelocityDeadbandState);
|
||||
lib^.set_proc($58522249F5C652AF,@ps4_scePadOpenExt);
|
||||
lib^.set_proc($8466DFD904C19AA7,@ps4_scePadGetExtControllerInformation);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -18,6 +18,10 @@ type
|
||||
SceUsbdDevice=Pointer;
|
||||
PSceUsbdDevice=^SceUsbdDevice;
|
||||
|
||||
pSceUsbdDeviceHandle=^SceUsbdDeviceHandle;
|
||||
SceUsbdDeviceHandle=packed record
|
||||
end;
|
||||
|
||||
function ps4_sceUsbdInit:Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Writeln('sceUsbdInit');
|
||||
@ -26,25 +30,23 @@ end;
|
||||
|
||||
function ps4_sceUsbdGetDeviceList(list:PSceUsbdDevice):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Writeln('sceUsbdGetDeviceList');
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
procedure ps4_sceUsbdFreeDeviceList(list:PSceUsbdDevice;unrefDevices:Integer); SysV_ABI_CDecl;
|
||||
begin
|
||||
Writeln('sceUsbdFreeDeviceList');
|
||||
end;
|
||||
|
||||
function ps4_sceUsbdHandleEventsTimeout(tv:Ptimeval):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Writeln('sceUsbdHandleEventsTimeout');
|
||||
if tv<>nil then
|
||||
begin
|
||||
Writeln('sec=',tv^.tv_sec,',usec=',tv^.tv_usec);
|
||||
end;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_sceUsbdOpenDeviceWithVidPid(vendorId:Word;productId:Word):pSceUsbdDeviceHandle; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function Load_libSceUsbd(Const name:RawByteString):TElf_node;
|
||||
var
|
||||
lib:PLIBRARY;
|
||||
@ -58,6 +60,7 @@ begin
|
||||
lib^.set_proc($F2A07D02BE0FE677,@ps4_sceUsbdGetDeviceList);
|
||||
lib^.set_proc($110E9208B32ACE43,@ps4_sceUsbdFreeDeviceList);
|
||||
lib^.set_proc($FB053A086B997169,@ps4_sceUsbdHandleEventsTimeout);
|
||||
lib^.set_proc($BEB417611A351B09,@ps4_sceUsbdOpenDeviceWithVidPid);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user