This commit is contained in:
red-prig 2022-07-01 00:31:33 +03:00
parent 824c0acb08
commit 038340efe0
6 changed files with 103 additions and 3 deletions

View File

@ -2435,7 +2435,7 @@ begin
begin
R:=VirtualProtect(ModuleInfo.segmentInfo[i].address,
ModuleInfo.segmentInfo[i].Size,
__map_segment_prot(ModuleInfo.segmentInfo[i].prot),
{__map_segment_prot(ModuleInfo.segmentInfo[i].prot)} PAGE_EXECUTE_READWRITE,
@dummy);
FlushInstructionCache(GetCurrentProcess,

View File

@ -983,6 +983,7 @@ begin
lib^.set_proc($688F8E782CFCC6B4,@ps4_scePthreadSelf);
lib^.set_proc($1E82D558D6A70417,@ps4_getpid);
lib^.set_proc($108FF9FE396AD9D1,@ps4_scePthreadGetthreadid);
lib^.set_proc($1E8C3B07C39EB7A9,@ps4_scePthreadGetname);
lib^.set_proc($181518EF2C1D50B1,@ps4_scePthreadRename);

View File

@ -52,6 +52,7 @@ function ps4_pthread_self():pthread; SysV_ABI_CDecl;
function ps4_scePthreadSelf():pthread; SysV_ABI_CDecl;
function ps4_getpid():Integer; SysV_ABI_CDecl;
function ps4_scePthreadGetthreadid():Integer; SysV_ABI_CDecl;
function ps4_scePthreadGetname(_pthread:pthread;name:Pchar):Integer; SysV_ABI_CDecl;
function ps4_scePthreadRename(_pthread:pthread;name:Pchar):Integer; SysV_ABI_CDecl;
@ -636,6 +637,11 @@ begin
Result:=tcb_thread^.ThreadId;
end;
function ps4_scePthreadGetthreadid():Integer; SysV_ABI_CDecl;
begin
Result:=tcb_thread^.ThreadId;
end;
function ps4_scePthreadGetname(_pthread:pthread;name:Pchar):Integer; SysV_ABI_CDecl;
begin
if (_pthread=nil) or (name=nil) then Exit(SCE_KERNEL_ERROR_EINVAL);

View File

@ -229,7 +229,25 @@ begin
if GetAsyncKeyState(VK_NUMPAD5)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_SQUARE;
//data^.buttons:=not data^.buttons;
if GetAsyncKeyState(VK_Q)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_L1;
if GetAsyncKeyState(VK_E)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_L2;
if GetAsyncKeyState(VK_NUMPAD6)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_L3;
if GetAsyncKeyState(VK_U)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_R1;
if GetAsyncKeyState(VK_O)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_R2;
if GetAsyncKeyState(VK_NUMPAD3)<>0 then
data^.buttons:=data^.buttons or SCE_PAD_BUTTON_R3;
_sig_unlock;
Result:=0;

View File

@ -126,6 +126,11 @@ begin
Result:=0;
end;
function ps4_sceSaveDataInitialize2(params:Pointer):Integer; SysV_ABI_CDecl;
begin
Result:=0;
end;
function ps4_sceSaveDataInitialize3(params:Pointer):Integer; SysV_ABI_CDecl;
begin
Result:=0;
@ -226,6 +231,7 @@ begin
lib:=Result._add_lib('libSceSaveData');
lib^.set_proc($664661B2408F5C5C,@ps4_sceSaveDataInitialize);
lib^.set_proc($9753660DE0E93465,@ps4_sceSaveDataInitialize2);
lib^.set_proc($4F2C2B14A0A82C66,@ps4_sceSaveDataInitialize3);
lib^.set_proc($C8A0F2F12E722C0D,@ps4_sceSaveDataTerminate);
lib^.set_proc($BFB00000CA342F3E,@ps4_sceSaveDataSetupSaveDataMemory);

View File

@ -8,6 +8,7 @@ implementation
uses
Windows,
ntapi,
SysConst,
SysUtils,
hamt,
@ -365,7 +366,73 @@ end;
const
FPC_EXCEPTION_CODE=$E0465043;
function ProcessException(p: PExceptionPointers): longint; stdcall;
{
INSERTQ xmm1, xmm2, imm8,
imm8 F2 0F 78 /r ib ib
Insert field starting at bit 0 of xmm2 with the length
specified by [5:0] of the first immediate byte. This
field is inserted into xmm1 starting at the bit position
specified by [5:0] of the second immediate byte.
INSERTQ xmm1, xmm2 F2 0F 79 /r
Insert field starting at bit 0 of xmm2 with the length
specified by xmm2[69:64]. This field is inserted into
xmm1 starting at the bit position specified by
xmm2[77:72].
}
function Test_SIGILL(const rec:TExceptionRecord;ctx:PCONTEXT):longint;
begin
case rec.ExceptionCode of
STATUS_ILLEGAL_INSTRUCTION:
begin
Case PDWORD(rec.ExceptionAddress)[0] of //4 byte
//00 11 22 33 44 55 66
$780f41f2: //f2 41 0f 78 e8 30 00 insertq $0x0,$0x30,%xmm8,%xmm5
begin
PBYTE(rec.ExceptionAddress)[0]:=$90;
PBYTE(rec.ExceptionAddress)[1]:=$90;
PBYTE(rec.ExceptionAddress)[2]:=$90;
PBYTE(rec.ExceptionAddress)[3]:=$90;
PBYTE(rec.ExceptionAddress)[4]:=$90;
PBYTE(rec.ExceptionAddress)[5]:=$90;
PBYTE(rec.ExceptionAddress)[6]:=$90;
ctx^.Rip:=ctx^.Rip+7;
NtContinue(ctx,False);
end;
else;
end;
Case (PDWORD(rec.ExceptionAddress)[0] and $FFFFFF) of //3 byte
//00 11 22 33 44 55
$780FF2: //f2 0f 78 c1 30 00 insertq $0x0,$0x30,%xmm1,%xmm0
begin
PBYTE(rec.ExceptionAddress)[0]:=$90;
PBYTE(rec.ExceptionAddress)[1]:=$90;
PBYTE(rec.ExceptionAddress)[2]:=$90;
PBYTE(rec.ExceptionAddress)[3]:=$90;
PBYTE(rec.ExceptionAddress)[4]:=$90;
PBYTE(rec.ExceptionAddress)[5]:=$90;
ctx^.Rip:=ctx^.Rip+6;
NtContinue(ctx,False);
end;
else;
end;
Writeln(HexStr(PDWORD(rec.ExceptionAddress)[0],8)); //C1780FF2
Exit(EXCEPTION_EXECUTE_HANDLER); //Unknow
end;
else
Exit(EXCEPTION_CONTINUE_SEARCH); //Next
end;
end;
function ProcessException(p: PExceptionPointers):longint; stdcall;
var
code: Longint;
node:TElf_node;
@ -374,6 +441,8 @@ begin
if (p^.ExceptionRecord^.ExceptionCode=FPC_EXCEPTION_CODE) then Exit(EXCEPTION_CONTINUE_SEARCH);
if (Test_SIGILL(p^.ExceptionRecord^,p^.ContextRecord)=EXCEPTION_CONTINUE_EXECUTION) then Exit(EXCEPTION_CONTINUE_EXECUTION);
//DumpException(nil,0,p^.ExceptionRecord^.ExceptionAddress,P^.ContextRecord);
node:=ps4_app.AcqureFileByCodeAdr(p^.ExceptionRecord^.ExceptionAddress);