diff --git a/src/ps4_libscegnmdriver.pas b/src/ps4_libscegnmdriver.pas index 3f51389..d6f1a47 100644 --- a/src/ps4_libscegnmdriver.pas +++ b/src/ps4_libscegnmdriver.pas @@ -15,6 +15,7 @@ implementation uses hamt, + atomic, ps4_program, sys_signal, sys_kernel, @@ -2128,12 +2129,24 @@ begin _sig_unlock; end; +var + libGnm_init:Integer=0; + function Load_libSceGnmDriver(Const name:RawByteString):TElf_node; var lib:PLIBRARY; begin Result:=TElf_node.Create; - Result.pFileName:='libSceGnmDriver.prx'; + Result.pFileName:=name; + + if CAS(libGnm_init,0,1) then + begin + //start load + end else + begin + //never add same lib name + Exit; + end; lib:=Result._add_lib('libSceGnmDriver'); @@ -2222,6 +2235,7 @@ begin //nop nid:libSceGnmDriver:DBDA0ABCA5F3119A:sceGnmMapComputeQueue + libGnm_init:=2; //end load end; initialization @@ -2238,7 +2252,7 @@ initialization ComputeEvents[5].Init; ComputeEvents[6].Init; - ps4_app.RegistredPreLoad('libSceGnmDriver.prx',@Load_libSceGnmDriver); + ps4_app.RegistredPreLoad('libSceGnmDriver.prx' ,@Load_libSceGnmDriver); ps4_app.RegistredPreLoad('libSceGnmDriver_padebug.prx',@Load_libSceGnmDriver); diff --git a/sys/sys_file.pas b/sys/sys_file.pas index aad4e5b..97a0a17 100644 --- a/sys/sys_file.pas +++ b/sys/sys_file.pas @@ -60,17 +60,21 @@ begin end; Function get_CreationDisposition(flags:Integer):DWORD; -const - CREAT_EXCL=O_CREAT or O_EXCL; begin Result:=0; - if (flags and CREAT_EXCL)=CREAT_EXCL then - begin - Result:=CREATE_NEW; - end else if (flags and O_CREAT)<>0 then begin - Result:=CREATE_ALWAYS; + if (flags and O_EXCL)<>0 then + begin + Result:=CREATE_NEW; + end else + if (flags and O_TRUNC)<>0 then + begin + Result:=CREATE_ALWAYS; + end else + begin + Result:=OPEN_ALWAYS; + end; end else if (flags and O_TRUNC)<>0 then begin @@ -95,6 +99,11 @@ begin wp:=UTF8Decode(path); + if ((flags and O_NONBLOCK)<>0) then + begin + Writeln(StdErr,'__sys_file_open:O_NONBLOCK:TODO'); + end; + dwDesiredAccess:=get_DesiredAccess(flags); dwCreationDisposition:=get_CreationDisposition(flags); diff --git a/sys/sys_kernel.pas b/sys/sys_kernel.pas index 1f1c429..0135046 100644 --- a/sys/sys_kernel.pas +++ b/sys/sys_kernel.pas @@ -184,6 +184,27 @@ begin if (t<>nil) then Result:=@t^.errno; end; +function ntf2px(n:DWORD):Integer; +begin + case n of + STATUS_SUCCESS :Result:=0; + STATUS_ABANDONED :Result:=EPERM; + STATUS_USER_APC :Result:=EINTR; + STATUS_KERNEL_APC :Result:=EINTR; + STATUS_ALERTED :Result:=EINTR; + STATUS_TIMEOUT :Result:=ETIMEDOUT; + STATUS_PENDING :Result:=EAGAIN; + STATUS_ACCESS_VIOLATION :Result:=EFAULT; + STATUS_INVALID_HANDLE :Result:=EBADF; + STATUS_INVALID_PARAMETER :Result:=EINVAL; + STATUS_END_OF_FILE :Result:=0; + STATUS_ACCESS_DENIED :Result:=EBADF; + STATUS_DISK_FULL :Result:=ENOSPC; + else + Result:=EIO; + end; +end; + function SwFreeMem(p:pointer):ptruint; begin _sig_lock;