diff --git a/kernel/ps4_libkernel.pas b/kernel/ps4_libkernel.pas index 7291d5ce..dc5e08ed 100644 --- a/kernel/ps4_libkernel.pas +++ b/kernel/ps4_libkernel.pas @@ -1264,6 +1264,8 @@ begin lib^.set_proc($8345530717C9CAED,@ps4_sceKernelGetCurrentCpu); lib^.set_proc($D6D2B21BB465309A,@ps4_scePthreadGetprio); + + lib^.set_proc($6B63FDC1819E66F7,@ps4_pthread_setprio); lib^.set_proc($5B41E99B65F4B8F1,@ps4_scePthreadSetprio); lib^.set_proc($3F8D644D6512DC42,@ps4_scePthreadGetschedparam); diff --git a/kernel/ps4_pthread.pas b/kernel/ps4_pthread.pas index 21c10acc..7b515694 100644 --- a/kernel/ps4_pthread.pas +++ b/kernel/ps4_pthread.pas @@ -73,6 +73,8 @@ function ps4_scePthreadGetaffinity(_pthread:pthread;mask:PQWORD):Integer; SysV_ function ps4_sceKernelGetCurrentCpu():Integer; SysV_ABI_CDecl; function ps4_scePthreadGetprio(_pthread:pthread;prio:PInteger):Integer; SysV_ABI_CDecl; + +function ps4_pthread_setprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl; function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl; function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl; @@ -862,16 +864,15 @@ begin Result:=0; end; -function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl; -Var +function ps4_pthread_setprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl; +var r:Integer; begin - if (_pthread=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); + if (_pthread=nil) then Exit(EINVAL); - if (prio>767) then prio:=767; - if (prio<256) then prio:=256; + if (prio>767) then Exit(EINVAL); + if (prio<256) then Exit(EINVAL); - //Writeln('scePthreadSetprio:',prio); r:=(((767-prio)*30) div 511); r:=PRIORITY_TABLE[r]; @@ -879,11 +880,16 @@ begin _sig_lock; if not System.ThreadSetPriority(_pthread^.handle,r) then begin - Result:=SCE_KERNEL_ERROR_ESRCH; + Result:=ESRCH; end; _sig_unlock; end; +function ps4_scePthreadSetprio(_pthread:pthread;prio:Integer):Integer; SysV_ABI_CDecl; +begin + Result:=px2sce(ps4_pthread_setprio(_pthread,prio)); +end; + //ThreadGetPriority = -15 and 15. :0..30 function ps4_scePthreadGetschedparam(_pthread:pthread;policy:PInteger;param:PSceKernelSchedParam):Integer; SysV_ABI_CDecl; Var