This commit is contained in:
Pavel 2022-10-20 14:34:55 +03:00
parent ca03d0a67e
commit 8ac5b8743a
5 changed files with 48 additions and 14 deletions

View File

@ -1098,6 +1098,7 @@ begin
lib^.set_proc($4FBDA1CFA7DFAB4F,@ps4_scePthreadYield);
lib^.set_proc($0791A65432B0A67D,@ps4_pthread_yield);
lib^.set_proc($E971B8077DCDD3D8,@ps4_sched_yield);
lib^.set_proc($E1979959C32C015D,@ps4_pthread_cleanup_push);
lib^.set_proc($455C5BD12B1AE6DD,@ps4_pthread_cleanup_pop);

View File

@ -76,8 +76,9 @@ function ps4_scePthreadSetschedparam(_pthread:pthread;policy:Integer;param:PSce
function ps4_sched_get_priority_max(policy:Integer):Integer; SysV_ABI_CDecl;
function ps4_sched_get_priority_min(policy:Integer):Integer; SysV_ABI_CDecl;
procedure ps4_scePthreadYield(); SysV_ABI_CDecl;
procedure ps4_pthread_yield(); SysV_ABI_CDecl;
procedure ps4_scePthreadYield; SysV_ABI_CDecl;
function ps4_pthread_yield:Integer; SysV_ABI_CDecl;
function ps4_sched_yield:Integer; SysV_ABI_CDecl;
procedure ps4_pthread_cleanup_push(routine:t_cb_proc;arg:Pointer); SysV_ABI_CDecl;
procedure ps4_pthread_cleanup_pop(execute:Integer); SysV_ABI_CDecl;
@ -910,14 +911,21 @@ begin
Result:=0;
end;
procedure ps4_scePthreadYield(); SysV_ABI_CDecl;
procedure ps4_scePthreadYield; SysV_ABI_CDecl;
begin
SwYieldExecution;
end;
procedure ps4_pthread_yield(); SysV_ABI_CDecl;
function ps4_pthread_yield:Integer; SysV_ABI_CDecl;
begin
SwYieldExecution;
Result:=0;
end;
function ps4_sched_yield:Integer; SysV_ABI_CDecl;
begin
SwYieldExecution;
Result:=0;
end;
procedure ps4_pthread_cleanup_push(routine:t_cb_proc;arg:Pointer); SysV_ABI_CDecl;

View File

@ -7,6 +7,7 @@ interface
uses
windows,
sys_types,
sys_signal,
ps4_time,
ps4_program,
atomic,
@ -487,25 +488,31 @@ var
Procedure push_keyboard_open(userId:Integer);
var
event:SceImeEvent;
event,tmp:SceImeEvent;
begin
event:=Default(SceImeEvent);
event.id:=SCE_IME_KEYBOARD_EVENT_OPEN;
event.param.resourceIdArray.userId:=userId;
event.param.resourceIdArray.resourceId[0]:=1;
g_ime_event_queue.enqueue(event);
while not g_ime_event_queue.enqueue(event) do
begin
g_ime_event_queue.dequeue(tmp); //drop first
end;
end;
Procedure push_keyboard_code(id:Integer;var keycode:SceImeKeycode);
var
event:SceImeEvent;
event,tmp:SceImeEvent;
begin
event:=Default(SceImeEvent);
event.id:=id;
event.param.keycode:=keycode;
g_ime_event_queue.enqueue(event);
while not g_ime_event_queue.enqueue(event) do
begin
g_ime_event_queue.dequeue(tmp); //drop first
end;
end;
function ToUnicodeEx(wVirtKey,wScanCode:UINT;lpKeyState:PByte;pwszBuff:PWideChar;cchBuff:Integer;
@ -736,17 +743,17 @@ begin
status:=status or SCE_IME_KEYCODE_STATE_MODIFIER_R_GUI;
end;
if ((GetKeyState(VK_NUMLOCK) and 1)<>0) then
if ((KeyBoardState[VK_NUMLOCK] and 1)<>0) then
begin
status:=status or SCE_IME_KEYCODE_STATE_LED_NUM_LOCK;
end;
if ((GetKeyState(VK_CAPITAL) and 1)<>0) then
if ((KeyBoardState[VK_CAPITAL] and 1)<>0) then
begin
status:=status or SCE_IME_KEYCODE_STATE_LED_CAPS_LOCK;
end;
if ((GetKeyState(VK_SCROLL) and 1)<>0) then
if ((KeyBoardState[VK_SCROLL] and 1)<>0) then
begin
status:=status or SCE_IME_KEYCODE_STATE_LED_SCROLL_LOCK;
end;
@ -786,8 +793,12 @@ begin
if not CAS(keyboard_init,0,1) then Exit(SCE_IME_ERROR_BUSY);
_sig_lock;
g_hook:=SetWindowsHookExW(WH_KEYBOARD,@KeyboardHookCallback,GetModuleHandle(nil),MainThreadID);
_sig_unlock;
if (g_hook=0) then
begin
store_release(keyboard_init,0);

View File

@ -63,6 +63,13 @@ const
SCE_SYSTEM_PARAM_LANG_SPANISH_LA =20; //LANG_SPANISH else
SCE_SYSTEM_PARAM_LANG_ARABIC =21; //LANG_ARABIC
SCE_SYSTEM_PARAM_LANG_FRENCH_CA =22; //LANG_FRENCH SUBLANG_FRENCH_CANADIAN
SCE_SYSTEM_PARAM_LANG_CZECH =23; //LANG_CZECH
SCE_SYSTEM_PARAM_LANG_HUNGARIAN =24; //LANG_HUNGARIAN
SCE_SYSTEM_PARAM_LANG_GREEK =25; //LANG_GREEK
SCE_SYSTEM_PARAM_LANG_ROMANIAN =26; //LANG_ROMANIAN
SCE_SYSTEM_PARAM_LANG_THAI =27; //LANG_THAI
SCE_SYSTEM_PARAM_LANG_VIETNAMESE =28; //LANG_VIETNAMESE
SCE_SYSTEM_PARAM_LANG_INDONESIAN =29; //LANG_INDONESIAN
// Date
SCE_SYSTEM_PARAM_DATE_FORMAT_YYYYMMDD=0;
@ -171,6 +178,13 @@ begin
LANG_POLISH :value^:=SCE_SYSTEM_PARAM_LANG_POLISH;
LANG_TURKISH :value^:=SCE_SYSTEM_PARAM_LANG_TURKISH;
LANG_ARABIC :value^:=SCE_SYSTEM_PARAM_LANG_ARABIC;
LANG_CZECH :value^:=SCE_SYSTEM_PARAM_LANG_CZECH;
LANG_HUNGARIAN :value^:=SCE_SYSTEM_PARAM_LANG_HUNGARIAN;
LANG_GREEK :value^:=SCE_SYSTEM_PARAM_LANG_GREEK;
LANG_ROMANIAN :value^:=SCE_SYSTEM_PARAM_LANG_ROMANIAN;
LANG_THAI :value^:=SCE_SYSTEM_PARAM_LANG_THAI;
LANG_VIETNAMESE:value^:=SCE_SYSTEM_PARAM_LANG_VIETNAMESE;
LANG_INDONESIAN:value^:=SCE_SYSTEM_PARAM_LANG_INDONESIAN;
else
value^:=SCE_SYSTEM_PARAM_LANG_ENGLISH_US;

View File

@ -6,6 +6,7 @@ interface
uses
ps4_program,
atomic,
Classes,
SysUtils;
@ -95,18 +96,17 @@ const
SCE_USER_SERVICE_ERROR_NO_EVENT =-2137653241; //0x80960007
var
login_event:Boolean=False;
login_event:Integer=0;
function ps4_sceUserServiceGetEvent(event:pSceUserServiceEvent):Integer; SysV_ABI_CDecl;
begin
if (event=nil) then Exit(SCE_USER_SERVICE_ERROR_INVALID_ARGUMENT);
if login_event then
if not CAS(login_event,0,1) then
begin
Result:=SCE_USER_SERVICE_ERROR_NO_EVENT;
end else
begin
login_event:=True;
event^:=Default(SceUserServiceEvent);
event^.eventType:=SCE_USER_SERVICE_EVENT_TYPE_LOGIN;