mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
5839b5c282
commit
0299473a7b
40
fpPS4.lpr
40
fpPS4.lpr
|
@ -191,6 +191,29 @@ begin
|
|||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_sceVoiceQoSInit(
|
||||
pMemBlock:Pointer;
|
||||
memSize:DWORD;
|
||||
appType:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_scePlayGoInitialize(
|
||||
initParam:Pointer //ScePlayGoInitParams
|
||||
):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_scePlayGoOpen(
|
||||
outHandle:PInteger;
|
||||
param:Pointer
|
||||
):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=Integer($80B2000E);
|
||||
end;
|
||||
|
||||
function ResolveImport(elf:Telf_file;Info:PResolveImportInfo;data:Pointer):Pointer;
|
||||
var
|
||||
lib:PLIBRARY;
|
||||
|
@ -253,6 +276,20 @@ begin
|
|||
QWORD($EF7590E098F49C92):Result:=@ps4_sceScreenShotSetOverlayImageWithOrigin;
|
||||
end;
|
||||
|
||||
'libSceVoiceQoS':
|
||||
Case Info^.nid of
|
||||
QWORD($53C21F365EBF0ACB):Result:=@ps4_sceVoiceQoSInit;
|
||||
end;
|
||||
|
||||
'libScePlayGo':
|
||||
Case Info^.nid of
|
||||
QWORD($B6CE8695938A46B1):Result:=@ps4_scePlayGoInitialize;
|
||||
QWORD($3351A66B5A1CAC61):Result:=@ps4_scePlayGoOpen;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -406,6 +443,9 @@ begin
|
|||
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Sonic Mania\CUSA07023\';
|
||||
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Sonic Mania\CUSA07023\eboot.bin';
|
||||
|
||||
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Worms\CUSA04047\';
|
||||
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Worms\CUSA04047\eboot.bin';
|
||||
|
||||
//elf:=Telf_file(LoadPs4ElfFromFile('libSceLibcInternal.sprx'));
|
||||
//elf.Prepare;
|
||||
//elf.SavePs4ElfToFile('libSceLibcInternal.prx');
|
||||
|
|
|
@ -811,6 +811,7 @@ begin
|
|||
lib^.set_proc($DEAC603387B31130,@ps4_scePthreadAttrSetaffinity);
|
||||
lib^.set_proc($F3EB39073663C528,@ps4_scePthreadAttrGetaffinity);
|
||||
lib^.set_proc($7976D44A911A4EC0,@ps4_scePthreadAttrSetinheritsched);
|
||||
lib^.set_proc($B711ED9E027E7B27,@ps4_scePthreadAttrGetguardsize);
|
||||
lib^.set_proc($46EDFA7E24ED2730,@ps4_scePthreadAttrGetstackaddr);
|
||||
lib^.set_proc($FDF03EED99460D0B,@ps4_scePthreadAttrGetstacksize);
|
||||
lib^.set_proc($FEAB8F6B8484254C,@ps4_scePthreadAttrGetstack);
|
||||
|
@ -871,7 +872,10 @@ begin
|
|||
|
||||
lib^.set_proc($5AC95C2B51507062,@ps4_sceKernelIsNeoMode);
|
||||
|
||||
//mmap
|
||||
|
||||
lib^.set_proc($A4EF7A4F0CCE9B91,@ps4_sceKernelGetDirectMemorySize);
|
||||
lib^.set_proc($047A2E2D0CE1D17D,@ps4_sceKernelDirectMemoryQuery);
|
||||
lib^.set_proc($AD35F0EB9C662C80,@ps4_sceKernelAllocateDirectMemory);
|
||||
lib^.set_proc($2FF4372C48C86E00,@ps4_sceKernelMapDirectMemory);
|
||||
lib^.set_proc($98BF0D0C7F3A8902,@ps4_sceKernelMapNamedFlexibleMemory);
|
||||
|
@ -879,6 +883,8 @@ begin
|
|||
lib^.set_proc($71091EF54B8140E9,@ps4_sceKernelMunmap);
|
||||
lib^.set_proc($58571F2F697389DA,@ps4_sceKernelQueryMemoryProtection);
|
||||
|
||||
//mmap
|
||||
|
||||
//queue
|
||||
|
||||
lib^.set_proc($0F439D14C8E9E3A2,@ps4_sceKernelCreateEqueue);
|
||||
|
|
|
@ -52,8 +52,24 @@ Const
|
|||
|
||||
MAP_FAILED =Pointer(-1);
|
||||
|
||||
type
|
||||
pSceKernelDirectMemoryQueryInfo=^SceKernelDirectMemoryQueryInfo;
|
||||
SceKernelDirectMemoryQueryInfo=packed record
|
||||
start:QWORD;
|
||||
__end:QWORD;
|
||||
memoryType:Integer;
|
||||
__align:Integer;
|
||||
end;
|
||||
|
||||
function ps4_sceKernelGetDirectMemorySize:Int64; SysV_ABI_CDecl;
|
||||
function ps4_getpagesize:Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelDirectMemoryQuery(
|
||||
offset:QWORD;
|
||||
flags:Integer;
|
||||
info:pSceKernelDirectMemoryQueryInfo;
|
||||
infoSize:QWORD):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelAllocateDirectMemory(
|
||||
searchStart:QWORD;
|
||||
searchEnd:QWORD;
|
||||
|
@ -61,6 +77,7 @@ function ps4_sceKernelAllocateDirectMemory(
|
|||
alignment:QWORD;
|
||||
memoryType:Integer;
|
||||
physicalAddrDest:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelMapDirectMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:QWORD;
|
||||
|
@ -68,17 +85,20 @@ function ps4_sceKernelMapDirectMemory(
|
|||
flags:Integer;
|
||||
physicalAddr:QWORD;
|
||||
alignment:QWORD):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelMapNamedFlexibleMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:QWORD;
|
||||
protections:Integer;
|
||||
flags:Integer;
|
||||
name:PChar):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelMapFlexibleMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:Int64;
|
||||
protections:Integer;
|
||||
flags:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelMunmap(addr:Pointer;len:size_t):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelQueryMemoryProtection(addr:Pointer;pStart,pEnd:PPointer;pProt:PInteger):Integer; SysV_ABI_CDecl;
|
||||
function ps4_mmap(addr:Pointer;len:size_t;prot,flags:Integer;fd:Integer;offset:size_t):Pointer; SysV_ABI_CDecl;
|
||||
|
@ -1247,6 +1267,58 @@ SCE_KERNEL_MAP_NO_COALESCE
|
|||
|
||||
}
|
||||
|
||||
const
|
||||
SCE_KERNEL_DMQ_FIND_NEXT=1;
|
||||
|
||||
function ps4_sceKernelDirectMemoryQuery(
|
||||
offset:QWORD;
|
||||
flags:Integer;
|
||||
info:pSceKernelDirectMemoryQueryInfo;
|
||||
infoSize:QWORD):Integer; SysV_ABI_CDecl;
|
||||
var
|
||||
It:TDirectAdrSet.Iterator;
|
||||
Tmp:TBlock;
|
||||
begin
|
||||
if (info=nil) or (infoSize<>SizeOf(SceKernelDirectMemoryQueryInfo)) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
if not IsAlign(offset,LOGICAL_PAGE_SIZE) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
|
||||
info^:=Default(SceKernelDirectMemoryQueryInfo);
|
||||
|
||||
Tmp:=Default(TBlock);
|
||||
Tmp.pAddr:=Pointer(offset);
|
||||
|
||||
Result:=0;
|
||||
|
||||
_sig_lock;
|
||||
rwlock_wrlock(PageMM.FLock);
|
||||
|
||||
if (flags=SCE_KERNEL_DMQ_FIND_NEXT) then
|
||||
begin
|
||||
It:=PageMM.FDirectAdrSet.find_be(Tmp);
|
||||
end else
|
||||
begin
|
||||
It:=PageMM.FDirectAdrSet.find(Tmp);
|
||||
end;
|
||||
|
||||
if (It.Item=nil) then
|
||||
begin
|
||||
Result:=SCE_KERNEL_ERROR_EACCES;
|
||||
end else
|
||||
begin
|
||||
Tmp:=It.Item^;
|
||||
|
||||
info^.start:=QWORD(Tmp.pAddr);
|
||||
info^.__end:=QWORD(Tmp.pAddr)+Tmp.nSize;
|
||||
info^.memoryType:=Integer(Tmp.bType);
|
||||
|
||||
end;
|
||||
|
||||
rwlock_unlock(PageMM.FLock);
|
||||
_sig_unlock;
|
||||
|
||||
end;
|
||||
|
||||
function ps4_sceKernelMapDirectMemory(
|
||||
virtualAddrDest:PPointer;
|
||||
length:QWORD;
|
||||
|
|
|
@ -24,6 +24,7 @@ function ps4_scePthreadAttrSetschedparam(pAttr:p_pthread_attr_t;param:PInteger)
|
|||
function ps4_scePthreadAttrSetaffinity(pAttr:p_pthread_attr_t;mask:QWORD):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrGetaffinity(pAttr:p_pthread_attr_t;mask:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrSetinheritsched(pAttr:p_pthread_attr_t;inheritSched:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrGetguardsize(pAttr:p_pthread_attr_t;guardSize:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrGetstackaddr(pAttr:p_pthread_attr_t;stackAddr:PPointer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrGetstacksize(pAttr:p_pthread_attr_t;stackSize:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
function ps4_scePthreadAttrGetstack(pAttr:p_pthread_attr_t;stackAddr:PPointer;stackSize:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
|
@ -197,7 +198,7 @@ begin
|
|||
Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
end;
|
||||
|
||||
pAttr^^.detachstate:=detachstate;
|
||||
pAttr^^.flags:=detachstate;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -206,7 +207,7 @@ begin
|
|||
Result:=SCE_KERNEL_ERROR_EINVAL;
|
||||
if (pAttr=nil) then Exit;
|
||||
if (pAttr^=nil) then Exit;
|
||||
pAttr^^.policy:=policy;
|
||||
pAttr^^.sched_policy:=policy;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -215,7 +216,7 @@ begin
|
|||
Result:=SCE_KERNEL_ERROR_EINVAL;
|
||||
if (pAttr=nil) or (param=nil) then Exit;
|
||||
if (pAttr^=nil) then Exit;
|
||||
pAttr^^.sched_priority:=param^;
|
||||
pAttr^^.prio:=param^;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -239,6 +240,18 @@ end;
|
|||
|
||||
function ps4_scePthreadAttrSetinheritsched(pAttr:p_pthread_attr_t;inheritSched:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=SCE_KERNEL_ERROR_EINVAL;
|
||||
if (pAttr=nil) then Exit;
|
||||
if (pAttr^=nil) then Exit;
|
||||
pAttr^^.sched_inherit:=inheritSched;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function ps4_scePthreadAttrGetguardsize(pAttr:p_pthread_attr_t;guardSize:PQWORD):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (pAttr=nil) or (guardSize=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if (pAttr^=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
guardSize^:=pAttr^^.guardsize_attr;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -271,7 +284,7 @@ function ps4_scePthreadAttrGetdetachstate(pAttr:p_pthread_attr_t;detachstate:Pin
|
|||
begin
|
||||
if (pAttr=nil) or (detachstate=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if (pAttr^=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
detachstate^:=pAttr^^.detachstate;
|
||||
detachstate^:=pAttr^^.flags;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -279,7 +292,7 @@ function ps4_pthread_attr_getdetachstate(pAttr:p_pthread_attr_t;detachstate:Pint
|
|||
begin
|
||||
if (pAttr=nil) or (detachstate=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
if (pAttr^=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);
|
||||
detachstate^:=pAttr^^.detachstate;
|
||||
detachstate^:=pAttr^^.flags;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
@ -415,7 +428,7 @@ begin
|
|||
if (pAttr<>nil) and (pAttr^<>nil) then
|
||||
begin
|
||||
data^.Attr:=pAttr^^;
|
||||
data^.detachstate:=pAttr^^.detachstate;
|
||||
data^.detachstate:=pAttr^^.flags;
|
||||
ReadWriteBarrier;
|
||||
|
||||
creationFlags:=0;
|
||||
|
@ -485,7 +498,7 @@ begin
|
|||
Writeln('scePthreadDetach:',_pthread^.name);
|
||||
if CAS(_pthread^.detachstate,PTHREAD_CREATE_JOINABLE,PTHREAD_CREATE_DETACHED) then
|
||||
begin
|
||||
_pthread^.Attr.detachstate:=PTHREAD_CREATE_DETACHED;
|
||||
_pthread^.Attr.flags:=PTHREAD_CREATE_DETACHED;
|
||||
Result:=0
|
||||
end else
|
||||
if CAS(_pthread^.detachstate,_PREPARE_JOIN,_PREPARE_FREE) then
|
||||
|
|
|
@ -47,6 +47,19 @@ begin
|
|||
Writeln(name,': ',value);
|
||||
end;
|
||||
|
||||
type
|
||||
SceHttpsCallback=function(
|
||||
libsslCtxId:Integer;
|
||||
verifyErr:Integer;
|
||||
sslCert:Pointer; //SceSslCert
|
||||
certNum:Integer;
|
||||
userArg:Pointer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceHttpsSetSslCallback(id:Integer;cbfunc:SceHttpsCallback;userArg:Pointer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function Load_libSceHttp(Const name:RawByteString):TElf_node;
|
||||
var
|
||||
lib:PLIBRARY;
|
||||
|
@ -59,6 +72,7 @@ begin
|
|||
lib^.set_proc($B36FCD3C8BF3FA20,@ps4_sceHttpSetNonblock);
|
||||
lib^.set_proc($EB7F3575617EC6C4,@ps4_sceHttpCreateEpoll);
|
||||
lib^.set_proc($118DBC4F66E437B9,@ps4_sceHttpAddRequestHeader);
|
||||
lib^.set_proc($86DC813A859E4B9F,@ps4_sceHttpsSetSslCallback);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
@ -30,7 +30,8 @@ begin
|
|||
end;
|
||||
|
||||
const
|
||||
SCE_NET_CTL_ERROR_INVALID_ADDR=$80412107;
|
||||
SCE_NET_CTL_ERROR_INVALID_ADDR=-2143215353; //0x80412107;
|
||||
SCE_NET_CTL_ERROR_INVALID_SIZE=-2143215343; //0x80412111;
|
||||
|
||||
SCE_NET_CTL_STATE_DISCONNECTED=0;
|
||||
SCE_NET_CTL_STATE_CONNECTING =1;
|
||||
|
@ -43,7 +44,7 @@ const
|
|||
|
||||
function ps4_sceNetCtlGetState(state:PInteger):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (state=nil) then Exit(Integer(SCE_NET_CTL_ERROR_INVALID_ADDR));
|
||||
if (state=nil) then Exit(SCE_NET_CTL_ERROR_INVALID_ADDR);
|
||||
state^:=SCE_NET_CTL_STATE_DISCONNECTED;
|
||||
Result:=0;
|
||||
end;
|
||||
|
@ -79,11 +80,47 @@ Const
|
|||
|
||||
function ps4_sceNetCtlGetResult(eventType:Integer;errorCode:PInteger):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (errorCode=nil) then Exit(Integer(SCE_NET_CTL_ERROR_INVALID_ADDR));
|
||||
if (errorCode=nil) then Exit(SCE_NET_CTL_ERROR_INVALID_ADDR);
|
||||
errorCode^:=Integer(SCE_NET_CTL_ERROR_ETHERNET_PLUGOUT);
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
type
|
||||
SceNetInAddr_t=DWORD;
|
||||
SceNetInAddr=packed record
|
||||
s_addr:SceNetInAddr_t;
|
||||
end;
|
||||
|
||||
pSceNetCtlNatInfo=^SceNetCtlNatInfo;
|
||||
SceNetCtlNatInfo=packed record
|
||||
size:Integer;
|
||||
stunStatus:Integer;
|
||||
natType:Integer;
|
||||
mappedAddr:SceNetInAddr;
|
||||
end;
|
||||
|
||||
const
|
||||
SCE_NET_CTL_NATINFO_STUN_UNCHECKED=0;
|
||||
SCE_NET_CTL_NATINFO_STUN_FAILED =1;
|
||||
SCE_NET_CTL_NATINFO_STUN_OK =2;
|
||||
|
||||
SCE_NET_CTL_NATINFO_NAT_TYPE_1 =1;
|
||||
SCE_NET_CTL_NATINFO_NAT_TYPE_2 =2;
|
||||
SCE_NET_CTL_NATINFO_NAT_TYPE_3 =3;
|
||||
|
||||
|
||||
function ps4_sceNetCtlGetNatInfo(natInfo:pSceNetCtlNatInfo):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
if (natInfo=nil) then Exit(SCE_NET_CTL_ERROR_INVALID_ADDR);
|
||||
if (natInfo^.size<>SizeOf(SceNetCtlNatInfo)) then Exit(SCE_NET_CTL_ERROR_INVALID_SIZE);
|
||||
|
||||
natInfo^.stunStatus:=SCE_NET_CTL_NATINFO_STUN_FAILED;
|
||||
natInfo^.natType:=SCE_NET_CTL_NATINFO_NAT_TYPE_1;
|
||||
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
|
||||
function ps4_sceNetCtlRegisterCallbackForNpToolkit(func:SceNetCtlCallback;arg:Pointer;cid:PInteger):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
NetCtlCb.func:=func;
|
||||
|
@ -124,6 +161,7 @@ begin
|
|||
lib^.set_proc($509F99ED0FB8724D,@ps4_sceNetCtlRegisterCallback);
|
||||
lib^.set_proc($890C378903E1BD44,@ps4_sceNetCtlCheckCallback);
|
||||
lib^.set_proc($D1C06076E3D147E3,@ps4_sceNetCtlGetResult);
|
||||
lib^.set_proc($24EE32B93B8CA0A2,@ps4_sceNetCtlGetNatInfo);
|
||||
|
||||
lib:=Result._add_lib('libSceNetCtlForNpToolkit');
|
||||
|
||||
|
|
|
@ -64,18 +64,17 @@ type
|
|||
p_pthread_attr_t=^pthread_attr_t;
|
||||
pthread_attr_t=^tthread_attr_t;
|
||||
tthread_attr_t=packed record
|
||||
policy:Integer;
|
||||
sched_priority:Integer;
|
||||
//prio :Integer;
|
||||
suspend :Integer;
|
||||
flags :Integer;
|
||||
sched_policy :Integer;
|
||||
sched_inherit:Integer;
|
||||
prio :Integer;
|
||||
suspend :Integer;
|
||||
flags :Integer; //((*attr)->flags & PTHREAD_DETACHED)
|
||||
stackaddr_attr:Pointer;
|
||||
stacksize_attr:size_t;
|
||||
cpuset:QWORD;
|
||||
//guardsize_attr:size_t;
|
||||
//cpuset :Pointer;//cpuset_t
|
||||
//cpusetsize :size_t;
|
||||
detachstate:Integer;
|
||||
stacksize_attr:QWORD;
|
||||
guardsize_attr:QWORD;
|
||||
cpuset:DWORD;
|
||||
//cpuset_t *cpuset;
|
||||
//size_t cpusetsize;
|
||||
end;
|
||||
|
||||
//struct pthread_attr {
|
||||
|
|
Loading…
Reference in New Issue