This commit is contained in:
Pavel 2022-07-01 11:11:45 +03:00
parent 038340efe0
commit 4223872ce3
5 changed files with 161 additions and 13 deletions

View File

@ -845,7 +845,8 @@ begin
Assert(Body^.CONTROL.wrOneAddr=0);
Case Body^.CONTROL.dstSel of
WRITE_DATA_DST_SEL_MEMORY_SYNC,
WRITE_DATA_DST_SEL_MEMORY_SYNC, //writeDataInline
WRITE_DATA_DST_SEL_TCL2, //writeDataInlineThroughL2
WRITE_DATA_DST_SEL_MEMORY_ASYNC:
begin
count:=pm4Hdr.count;

View File

@ -13,6 +13,7 @@ uses
sys_pthread,
ps4libdoc,
ps4_libSceAjm,
ps4_libSceMouse,
ps4_libSceIme,
ps4_libScePlayGo,
ps4_libSceDiscMap,
@ -484,6 +485,15 @@ begin
//ps4_app.app_path:='C:\Users\User\Desktop\Games\ps4-homebrew\SPELUNKYCLASSIC\';
//ps4_app.app_file:='C:\Users\User\Desktop\Games\ps4-homebrew\SPELUNKYCLASSIC\eboot.bin';
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Cursed Castilla v1.00 (ASIA)\CUSA07773\';
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Cursed Castilla v1.00 (ASIA)\CUSA07773\eboot.bin';
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Undertale\CUSA09415\';
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Undertale\CUSA09415\eboot.bin';
//ps4_app.app_path:='C:\Users\User\Desktop\Games\Cladun Returns This Is Sengoku v1.00\CUSA06770\';
//ps4_app.app_file:='C:\Users\User\Desktop\Games\Cladun Returns This Is Sengoku v1.00\CUSA06770\eboot.bin';
//elf:=Telf_file(LoadPs4ElfFromFile('libSceLibcInternal.sprx'));
//elf.Prepare;
//elf.SavePs4ElfToFile('libSceLibcInternal.prx');

View File

@ -160,8 +160,8 @@ begin
Result:=0;
if (numDwords>$FF) then
begin
Result:=$100;
Move(InitDefault175_stub,cmdBuffer^,SizeOf(InitDefault175_stub));
Result:=$100;
end;
end;
@ -478,9 +478,44 @@ const
function ps4_sceGnmDrawInitDefaultHardwareState350(cmdBuffer:PDWORD;numDwords:DWORD):DWORD; SysV_ABI_CDecl;
begin
assert(numDwords>$100);
Move(InitDefault350_stub,cmdBuffer^,SizeOf(InitDefault350_stub));
Result:=$100;
Result:=0;
if (numDwords>$FF) then
begin
Move(InitDefault350_stub,cmdBuffer^,SizeOf(InitDefault350_stub));
Result:=$100;
end;
end;
const
DispatchInitDefaultState_stub:array[0..17] of DWORD=(
$C0017602,
$216,
$FFFFFFFF,
$C0017602,
$217,
$FFFFFFFF,
$C0017602,
$215,
$170,
$c0055800,
$28000000,
0,
0,
0,
0,
$0000000a,
$c0ee1000,
0
);
function ps4_sceGnmDispatchInitDefaultHardwareState(cmdBuffer:PDWORD;numDwords:DWORD):DWORD; SysV_ABI_CDecl;
begin
Result:=0;
if (numDwords>$FF) then
begin
Move(DispatchInitDefaultState_stub,cmdBuffer^,SizeOf(DispatchInitDefaultState_stub));
Result:=$100;
end;
end;
function ps4_sceGnmInsertPushMarker(cmdBuffer:PDWORD;numDwords:DWORD;param:PChar):Integer; SysV_ABI_CDecl;
@ -1295,7 +1330,7 @@ const
function ps4_sceGnmValidateCommandBuffers:Integer; SysV_ABI_CDecl;
begin
Result:=SCE_GNM_ERROR_VALIDATION_NOT_ENABLED;
Result:=Integer(SCE_GNM_ERROR_VALIDATION_NOT_ENABLED);
end;
//A value of true is returned if submit/dingdong is allowed; otherwise false is returned.
@ -1304,6 +1339,28 @@ begin
Result:=true;
end;
const
SCE_GNM_ERROR_FAILURE=$8eee00ff;
function ps4_sceGnmRegisterOwner(pOwnerHandle:PInteger;ownerName:Pchar):Integer; SysV_ABI_CDecl;
begin
Writeln('sceGnmRegisterOwner:',ownerName);
Result:=Integer(SCE_GNM_ERROR_FAILURE);
end;
function ps4_sceGnmRegisterResource(pResourceHandle:PInteger; //ResourceHandle
ownerHandle:Integer; //OwnerHandle
pMemory:Pointer;
sizeInBytes:QWORD;
resourceName:Pchar;
resourceType:Integer; //ResourceType
userData:Pointer
):Integer; SysV_ABI_CDecl;
begin
Writeln('sceGnmRegisterResource:',resourceName);
Result:=Integer(SCE_GNM_ERROR_FAILURE);
end;
const
//EqEventType
kEqEventCompute0RelMem = $00; ///< ReleaseMem event from the compute pipe 0.
@ -1318,16 +1375,27 @@ const
var
EopEvents:Thamt64locked;
ComputeEvents:array[0..6] of Thamt64locked;
function _sceGnmAddEqEvent(eq:SceKernelEqueue;id:Integer;udata:Pointer):Integer;
var
pEvents:Phamt64locked;
P:PPointer;
node:PKEventNode;
begin
Writeln('sceGnmAddEqEvent:',id);
if (id<>kEqEventGfxEop) then Assert(false);
EopEvents.LockWr;
P:=HAMT_search64(@EopEvents.hamt,QWORD(eq));
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^;
@ -1337,20 +1405,20 @@ begin
node:=_alloc_kevent_node(eq,SizeOf(TKEventNode));
if (node=Pointer(1)) then
begin
EopEvents.Unlock;
pEvents^.Unlock;
Exit(SCE_KERNEL_ERROR_EBADF);
end;
if (node=nil) then
begin
EopEvents.Unlock;
pEvents^.Unlock;
Exit(SCE_KERNEL_ERROR_ENOMEM);
end;
node^.ev.filter:=SCE_KERNEL_EVFILT_GNM;
node^.ev.data :=id;
node^.ev.udata :=udata;
HAMT_insert64(@EopEvents.hamt,QWORD(eq),node);
HAMT_insert64(@pEvents^.hamt,QWORD(eq),node);
end;
EopEvents.Unlock;
pEvents^.Unlock;
Result:=0;
end;
@ -1393,6 +1461,7 @@ begin
lib^.set_proc($4219F245EB5E2753,@ps4_sceGnmDrawInitDefaultHardwareState175);
lib^.set_proc($D07DAF0586D32C72,@ps4_sceGnmDrawInitDefaultHardwareState200);
lib^.set_proc($C9BD9C4616A00F52,@ps4_sceGnmDrawInitDefaultHardwareState350);
lib^.set_proc($9C5E9B1515014405,@ps4_sceGnmDispatchInitDefaultHardwareState);
lib^.set_proc($5B512D8FF8E55BB6,@ps4_sceGnmInsertPushMarker);
lib^.set_proc($EEA65536012EF926,@ps4_sceGnmInsertPopMarker);
@ -1434,13 +1503,25 @@ begin
lib^.set_proc($6F4F0082D3E51CF8,@ps4_sceGnmAreSubmitsAllowed);
lib^.set_proc($645A8A165DB768C7,@ps4_sceGnmRegisterOwner);
lib^.set_proc($9EF1307D8008993B,@ps4_sceGnmRegisterResource);
//nop nid:libSceGnmDriver:DBDA0ABCA5F3119A:sceGnmMapComputeQueue
end;
initialization
GnmInitEmbedded;
EopEvents.Init;
ComputeEvents[0].Init;
ComputeEvents[1].Init;
ComputeEvents[2].Init;
ComputeEvents[3].Init;
ComputeEvents[4].Init;
ComputeEvents[5].Init;
ComputeEvents[6].Init;
ps4_app.RegistredPreLoad('libSceGnmDriver.prx',@Load_libSceGnmDriver);
ps4_app.RegistredPreLoad('libSceGnmDriver_padebug.prx',@Load_libSceGnmDriver);

55
ps4_libscemouse.pas Normal file
View File

@ -0,0 +1,55 @@
unit ps4_libSceMouse;
{$mode ObjFPC}{$H+}
interface
uses
ps4_program,
Classes,
SysUtils;
implementation
function ps4_sceMouseInit:Integer; SysV_ABI_CDecl;
begin
Writeln('sceMouseInit');
Result:=0;
end;
type
pSceMouseOpenParam=^SceMouseOpenParam;
SceMouseOpenParam=packed record
behaviorFlag:Byte;
reserved:array[0..6] of Byte;
end;
const
SCE_MOUSE_ERROR_INVALID_HANDLE=$80DF0003;
function ps4_sceMouseOpen(userId:Integer;
_type:Integer;
index:Integer;
pParam:pSceMouseOpenParam):Integer; SysV_ABI_CDecl;
begin
Writeln('sceMouseOpen');
Result:=Integer(SCE_MOUSE_ERROR_INVALID_HANDLE);
end;
function Load_libSceMouse(Const name:RawByteString):TElf_node;
var
lib:PLIBRARY;
begin
Result:=TElf_node.Create;
Result.pFileName:=name;
lib:=Result._add_lib('libSceMouse');
lib^.set_proc($42CD305AE96097B5,@ps4_sceMouseInit);
lib^.set_proc($45AAB16487FA0EF1,@ps4_sceMouseOpen);;
end;
initialization
ps4_app.RegistredPreLoad('libSceMouse.prx',@Load_libSceMouse);
end.

View File

@ -94,6 +94,7 @@ type
TOnElfLoadCb=function(Const name:RawByteString):TElf_node;
Phamt64locked=^Thamt64locked;
Thamt64locked=object
lock:TRWLock;
hamt:TSTUB_HAMT64;