mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
f6492af678
commit
b6dd272289
|
@ -26,7 +26,8 @@ uses
|
|||
vm_pager,
|
||||
kern_event,
|
||||
kern_mtx,
|
||||
md_time;
|
||||
md_time,
|
||||
md_proc;
|
||||
|
||||
type
|
||||
p_flip_control_args=^t_flip_control_args;
|
||||
|
@ -101,6 +102,138 @@ type
|
|||
var
|
||||
flipArg:QWORD=0;
|
||||
|
||||
type
|
||||
p_cursor_enable=^t_cursor_enable;
|
||||
t_cursor_enable=packed record
|
||||
rtype :DWORD; //0
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //3 = enable; 1 = disable
|
||||
enable :DWORD; //1 = enable; 0 = disable
|
||||
addr_hi:DWORD;
|
||||
addr_lo:DWORD;
|
||||
padding:array[0..13] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_img_addr=^t_cursor_img_addr;
|
||||
t_cursor_img_addr=packed record
|
||||
rtype :DWORD; //1
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //2
|
||||
addr_hi:DWORD;
|
||||
addr_lo:DWORD;
|
||||
padding:array[0..14] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_pos=^t_cursor_pos;
|
||||
t_cursor_pos=packed record
|
||||
rtype :DWORD; //2
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //2
|
||||
posX :DWORD;
|
||||
posY :DWORD;
|
||||
padding:array[0..14] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_pos_stereo=^t_cursor_pos_stereo;
|
||||
t_cursor_pos_stereo=packed record
|
||||
rtype :DWORD; //3
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //3
|
||||
posX :DWORD;
|
||||
posY :DWORD;
|
||||
offset :DWORD;
|
||||
padding:array[0..13] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_hot_spot=^t_cursor_hot_spot;
|
||||
t_cursor_hot_spot=packed record
|
||||
rtype :DWORD; //4
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //2
|
||||
hotX :DWORD;
|
||||
hotY :DWORD;
|
||||
padding:array[0..14] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_magnify=^t_cursor_magnify;
|
||||
t_cursor_magnify=packed record
|
||||
rtype :DWORD; //5
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //1
|
||||
enable :DWORD;
|
||||
padding:array[0..15] of DWORD;
|
||||
end;
|
||||
|
||||
p_cursor_update_pending=^t_cursor_update_pending;
|
||||
t_cursor_update_pending=packed record
|
||||
rtype :DWORD; //6
|
||||
index :DWORD; //Cursor index (0-1)
|
||||
args :DWORD; //1
|
||||
ptype :DWORD;
|
||||
padding:array[0..14] of DWORD;
|
||||
result :DWORD; //0,1
|
||||
end;
|
||||
|
||||
Function dce_set_cursor_info(dev:p_cdev;canary:QWORD;arg5:DWORD;data:Pointer):Integer;
|
||||
var
|
||||
info:t_cursor_enable;
|
||||
addr:qword;
|
||||
begin
|
||||
info:=Default(t_cursor_enable);
|
||||
Result:=copyin(data,@info,80);
|
||||
if (Result<>0) then Exit;
|
||||
|
||||
case info.rtype of
|
||||
0: //enable/disable
|
||||
begin
|
||||
case info.enable of
|
||||
1:
|
||||
begin
|
||||
addr:=info.addr_lo or (QWORD(info.addr_hi) shl 32);
|
||||
|
||||
Writeln('dce_set_cursor_enable:',canary,' ',
|
||||
info.index,' ',
|
||||
HexStr(addr,16));
|
||||
end;
|
||||
0:
|
||||
begin
|
||||
Writeln('dce_set_cursor_disable:',canary,' ',
|
||||
info.index);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
1:; //SetImageAddress
|
||||
|
||||
2: //SetPosition
|
||||
begin
|
||||
Writeln('dce_set_cursor_pos:',canary,' ',
|
||||
p_cursor_pos(@info)^.index,' ',
|
||||
p_cursor_pos(@info)^.posX,' ',
|
||||
p_cursor_pos(@info)^.posY);
|
||||
end;
|
||||
|
||||
3:; //SetPositionStereo
|
||||
4:; //SetHotSpot
|
||||
5:; //Set2xMagnify
|
||||
|
||||
6: //IsUpdatePending
|
||||
begin
|
||||
Writeln('dce_is_update_pending:',canary,' ',
|
||||
p_cursor_update_pending(@info)^.index,' ',
|
||||
p_cursor_update_pending(@info)^.ptype);
|
||||
|
||||
p_cursor_update_pending(@info)^.result:=0;
|
||||
|
||||
Result:=copyout(@p_cursor_update_pending(@info)^.result,@p_cursor_update_pending(data)^.result,8);
|
||||
end;
|
||||
|
||||
else
|
||||
Exit(EINVAL);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
Function dce_flip_control(dev:p_cdev;data:p_flip_control_args):Integer;
|
||||
var
|
||||
ptr :Pointer;
|
||||
|
@ -120,6 +253,8 @@ begin
|
|||
if (data^.arg6=0) and (data^.arg2=0) then
|
||||
begin
|
||||
|
||||
Writeln('dce_video_open');
|
||||
|
||||
ptr:=Pointer(data^.arg5);
|
||||
len:=111; //canary
|
||||
copyout(@len,ptr,SizeOf(QWORD));
|
||||
|
@ -129,6 +264,20 @@ begin
|
|||
Exit(EINVAL);
|
||||
end;
|
||||
|
||||
1: //video close
|
||||
begin
|
||||
if (data^.arg3=0) and (data^.arg4=0) and
|
||||
(data^.arg5=0) and (data^.arg6=0) then
|
||||
begin
|
||||
//arg2 -> canary
|
||||
|
||||
Writeln('dce_video_close:',data^.arg2);
|
||||
|
||||
Exit(0);
|
||||
end;
|
||||
Exit(EINVAL);
|
||||
end;
|
||||
|
||||
5: //UnregisterBufferAttribute
|
||||
begin
|
||||
if (data^.arg4=0) and (data^.arg5=0) and (data^.arg6=0) then
|
||||
|
@ -257,6 +406,18 @@ begin
|
|||
Exit(EINVAL);
|
||||
end;
|
||||
|
||||
24: //sceVideoOutCursor*
|
||||
begin
|
||||
if (data^.arg6=0) and (data^.arg4=80) then
|
||||
begin
|
||||
//arg2 -> canary
|
||||
//arg4 = 80;
|
||||
Result:=dce_set_cursor_info(dev,data^.arg2,data^.arg5,Pointer(data^.arg3));
|
||||
Exit;
|
||||
end;
|
||||
Exit(EINVAL);
|
||||
end;
|
||||
|
||||
31: //set vaddr
|
||||
begin
|
||||
//arg2 -> canary
|
||||
|
@ -357,14 +518,15 @@ var
|
|||
begin
|
||||
Result:=0;
|
||||
|
||||
Writeln(sizeof(t_submit_flip));
|
||||
|
||||
Writeln('submit_flip:',data^.bufferIndex,' ',
|
||||
data^.flipMode,' ',
|
||||
'0x',HexStr(data^.flipArg,16),' ',
|
||||
data^.eop_val);
|
||||
|
||||
knote(@g_video_out_event_flip, $0006 or (data^.flipArg shl 16), 0);
|
||||
knote(@g_video_out_event_flip, $0006 or (data^.flipArg shl 16), 0); //SCE_VIDEO_OUT_EVENT_FLIP
|
||||
|
||||
knote(@g_video_out_event_flip, $0007 or (data^.flipArg shl 16), 0); //SCE_VIDEO_OUT_EVENT_VBLANK
|
||||
|
||||
flipArg:=data^.flipArg;
|
||||
|
||||
if (data^.rout<>nil) then
|
||||
|
@ -375,6 +537,15 @@ begin
|
|||
|
||||
end;
|
||||
|
||||
Function dce_deregister_ident(dev:p_cdev;data:PQWORD):Integer;
|
||||
begin
|
||||
writeln('dce_deregister_ident:',HexStr(data^,16));
|
||||
|
||||
kqueue_deregister(EVFILT_DISPLAY,g_pid,data^);
|
||||
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
Function dce_ioctl(dev:p_cdev;cmd:QWORD;data:Pointer;fflag:Integer):Integer;
|
||||
begin
|
||||
Result:=0;
|
||||
|
@ -386,6 +557,7 @@ begin
|
|||
$C0308207:Result:=dce_register_buffer_attr(dev,data); //SCE_SYS_DCE_IOCTL_REGISTER_BUFFER_ATTRIBUTE
|
||||
$C0308206:Result:=dce_register_buffer_ptrs(dev,data);
|
||||
$C0488204:Result:=dce_submit_flip (dev,data);
|
||||
$80088209:Result:=dce_deregister_ident (dev,data);
|
||||
|
||||
else
|
||||
begin
|
||||
|
@ -493,7 +665,7 @@ begin
|
|||
//_display_attach(&kn->kn_kevent);
|
||||
end;
|
||||
|
||||
//kn^.kn_hook = (long)p_pid;
|
||||
kn^.kn_hook:=Pointer(g_pid);
|
||||
|
||||
event_id:=kn^.kn_kevent.ident shr 48;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ uses
|
|||
function kevent_copyout (arg:Pointer;kevp:p_kevent;count:Integer):Integer;
|
||||
function kevent_copyin (arg:Pointer;kevp:p_kevent;count:Integer):Integer;
|
||||
function kqueue_register (kq:p_kqueue;kev:p_kevent):Integer;
|
||||
procedure kqueue_deregister(filter:SmallInt;pid,ident:PtrUint);
|
||||
function kqueue_acquire (fp:p_file;kqp:pp_kqueue):Integer;
|
||||
procedure kqueue_release (kq:p_kqueue;locked:Integer);
|
||||
function kqueue_expand (kq:p_kqueue;fops:p_filterops;ident:ptruint):Integer;
|
||||
|
@ -1438,6 +1439,72 @@ done:
|
|||
Exit(error);
|
||||
end;
|
||||
|
||||
procedure kqueue_deregister(filter:SmallInt;pid,ident:PtrUint);
|
||||
label
|
||||
_lock,
|
||||
_again;
|
||||
var
|
||||
kq:p_kqueue;
|
||||
kn:p_knote;
|
||||
i:QWORD;
|
||||
begin
|
||||
FILEDESC_XLOCK(@fd_table);
|
||||
|
||||
kq:=TAILQ_FIRST(@fd_table.fd_kqlist);
|
||||
while (kq<>nil) do
|
||||
begin
|
||||
_lock:
|
||||
|
||||
KQ_LOCK(kq);
|
||||
|
||||
_again:
|
||||
if (kq^.kq_knhashmask<>0) then
|
||||
begin
|
||||
For i:=0 to kq^.kq_knhashmask do
|
||||
begin
|
||||
kn:=kq^.kq_knhash[i].slh_first;
|
||||
|
||||
while (kn<>nil) do
|
||||
begin
|
||||
if (kn^.kn_kevent.filter=filter) and
|
||||
((pid=0) or (PtrUint(kn^.kn_hook)=pid)) and
|
||||
((ident=0) or (kn^.kn_kevent.ident=ident)) then
|
||||
begin
|
||||
if ((kn^.kn_status and KN_INFLUX)<>0) then
|
||||
begin
|
||||
kq^.kq_state:=kq^.kq_state or KQ_FLUXWAIT;
|
||||
msleep(kq,@kq^.kq_lock,PSOCK,'kqflxwt2',0);
|
||||
goto _again;
|
||||
end;
|
||||
|
||||
kn^.kn_status:=kn^.kn_status or KN_INFLUX;
|
||||
|
||||
KQ_UNLOCK(kq);
|
||||
|
||||
if ((kn^.kn_status and KN_DETACHED)=0) then
|
||||
begin
|
||||
kn^.kn_fop^.f_detach(kn);
|
||||
end;
|
||||
|
||||
knote_drop(kn);
|
||||
goto _lock;
|
||||
end;
|
||||
|
||||
kn:=kn^.kn_link.sle_next;
|
||||
end; //while (kn<>nil) do
|
||||
|
||||
end; //for
|
||||
|
||||
end; //if (kq^.kq_knhashmask<>0)
|
||||
|
||||
KQ_UNLOCK(kq);
|
||||
//
|
||||
kq:=TAILQ_NEXT(kq,@kq^.kq_list);
|
||||
end; //while (kq<>nil) do
|
||||
|
||||
FILEDESC_XUNLOCK(@fd_table);
|
||||
end;
|
||||
|
||||
function kqueue_acquire(fp:p_file;kqp:pp_kqueue):Integer;
|
||||
var
|
||||
error:Integer;
|
||||
|
|
|
@ -709,7 +709,9 @@ begin
|
|||
* Return EINVAL when the new descriptor is out of bounds.
|
||||
}
|
||||
if (old < 0) then
|
||||
begin
|
||||
Exit(EBADF);
|
||||
end;
|
||||
|
||||
if (new < 0) then
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue