diff --git a/kernel/ps4_kernel_file.pas b/kernel/ps4_kernel_file.pas index 1a5ccaa..455ad8f 100644 --- a/kernel/ps4_kernel_file.pas +++ b/kernel/ps4_kernel_file.pas @@ -288,20 +288,28 @@ var begin if (path=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); + Writeln('sceKernelOpen:',path,' ',flags,' ',mode); + Assert((flags and SCE_KERNEL_O_DIRECTORY)=0,'folder open TODO'); if (flags and WR_RDWR)=WR_RDWR then begin - Exit(SCE_KERNEL_ERROR_EINVAL); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); end; - if (path[0]=#0) then Exit(SCE_KERNEL_ERROR_ENOENT); + if (path[0]=#0) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); + end; _sig_lock; rp:=_parse_filename(path); _sig_unlock; - if (rp='') then Exit(SCE_KERNEL_ERROR_EACCES); + if (rp='') then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); + end; _sig_lock; wp:=UTF8Decode(rp); @@ -330,14 +338,15 @@ begin Case err of ERROR_INVALID_DRIVE, ERROR_PATH_NOT_FOUND, - ERROR_FILE_NOT_FOUND :Exit(SCE_KERNEL_ERROR_ENOENT); - ERROR_ACCESS_DENIED :Exit(SCE_KERNEL_ERROR_EACCES); - ERROR_BUFFER_OVERFLOW :Exit(SCE_KERNEL_ERROR_ENAMETOOLONG); - ERROR_NOT_ENOUGH_MEMORY:Exit(SCE_KERNEL_ERROR_ENOMEM); - ERROR_FILE_EXISTS :Exit(SCE_KERNEL_ERROR_EEXIST); - ERROR_DISK_FULL: Exit(SCE_KERNEL_ERROR_ENOSPC); + ERROR_FILE_NOT_FOUND :Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); + ERROR_ACCESS_DENIED :Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); + ERROR_BUFFER_OVERFLOW :Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENAMETOOLONG)); + ERROR_NOT_ENOUGH_MEMORY:Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOMEM)); + ERROR_ALREADY_EXISTS :Exit(_set_sce_errno(SCE_KERNEL_ERROR_EEXIST)); + ERROR_FILE_EXISTS :Exit(_set_sce_errno(SCE_KERNEL_ERROR_EEXIST)); + ERROR_DISK_FULL: Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOSPC)); else - Exit(SCE_KERNEL_ERROR_EIO); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EIO)); end; end; @@ -347,7 +356,7 @@ begin if (Result=-1) then begin - Exit(SCE_KERNEL_ERROR_EMFILE); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EMFILE)); end; end; @@ -360,7 +369,10 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(SCE_KERNEL_ERROR_EBADF); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); + end; _sig_lock; case whence of @@ -368,11 +380,11 @@ begin SCE_KERNEL_SEEK_CUR:Result:=FileSeek(h,offset,fsFromCurrent); SCE_KERNEL_SEEK_END:Result:=FileSeek(h,offset,fsFromEnd); else - Result:=SCE_KERNEL_ERROR_EINVAL; + Result:=_set_sce_errno(SCE_KERNEL_ERROR_EINVAL); end; _sig_unlock; - if (Result=-1) then Result:=SCE_KERNEL_ERROR_EOVERFLOW; + if (Result=-1) then Result:=_set_sce_errno(SCE_KERNEL_ERROR_EOVERFLOW); end; function ps4_sceKernelWrite(fd:Integer;buf:Pointer;nbytes:Int64):Int64; SysV_ABI_CDecl; @@ -384,10 +396,13 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(SCE_KERNEL_ERROR_EBADF); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); + end; - if (buf=nil) then Exit(SCE_KERNEL_ERROR_EFAULT); - if (nbytes<0) or (nbytes>High(Integer)) then Exit(SCE_KERNEL_ERROR_EINVAL); + if (buf=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EFAULT)); + if (nbytes<0) or (nbytes>High(Integer)) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); N:=0; _sig_lock; @@ -396,7 +411,7 @@ begin Result:=N; end else begin - Result:=SCE_KERNEL_ERROR_EIO; + Result:=_set_sce_errno(SCE_KERNEL_ERROR_EIO); end; _sig_unlock; end; @@ -410,10 +425,13 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(SCE_KERNEL_ERROR_EBADF); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); + end; - if (buf=nil) then Exit(SCE_KERNEL_ERROR_EFAULT); - if (nbytes<0) or (nbytes>High(Integer)) then Exit(SCE_KERNEL_ERROR_EINVAL); + if (buf=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EFAULT)); + if (nbytes<0) or (nbytes>High(Integer)) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); N:=0; _sig_lock; @@ -422,7 +440,7 @@ begin Result:=N; end else begin - Result:=SCE_KERNEL_ERROR_EIO; + Result:=_set_sce_errno(SCE_KERNEL_ERROR_EIO); end; _sig_unlock; end; @@ -433,14 +451,17 @@ var N:DWORD; O:TOVERLAPPED; begin - if (buf=nil) then Exit(SCE_KERNEL_ERROR_EFAULT); - if (nbytes<0) or (nbytes>High(Integer)) or (offset<0) then Exit(SCE_KERNEL_ERROR_EINVAL); + if (buf=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EFAULT)); + if (nbytes<0) or (nbytes>High(Integer)) or (offset<0) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); _sig_lock; h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(SCE_KERNEL_ERROR_EBADF); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); + end; O:=Default(TOVERLAPPED); PInt64(@O.Offset)^:=offset; @@ -452,7 +473,7 @@ begin Result:=N; end else begin - Result:=SCE_KERNEL_ERROR_EIO; + Result:=_set_sce_errno(SCE_KERNEL_ERROR_EIO); end; _sig_unlock; end; @@ -462,7 +483,10 @@ begin _sig_lock; Result:=_close(fd); _sig_unlock; - if (Result<>0) then Result:=_set_errno(EBADF); + if (Result<>0) then + begin + Result:=_set_errno(EBADF); + end; end; function ps4_sceKernelClose(fd:Integer):Integer; SysV_ABI_CDecl; @@ -470,7 +494,10 @@ begin _sig_lock; Result:=_close(fd); _sig_unlock; - if (Result<>0) then Result:=SCE_KERNEL_ERROR_EBADF; + if (Result<>0) then + begin + Result:=_set_sce_errno(SCE_KERNEL_ERROR_EBADF); + end; end; function file_attr_to_st_mode(attr:DWORD):Word; @@ -510,8 +537,11 @@ var hfi:WIN32_FILE_ATTRIBUTE_DATA; err:DWORD; begin - if (path=nil) or (stat=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); - if (path[0]=#0) then Exit(SCE_KERNEL_ERROR_ENOENT); + if (path=nil) or (stat=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); + if (path[0]=#0) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); + end; stat^:=Default(SceKernelStat); @@ -519,7 +549,7 @@ begin rp:=_parse_filename(path); _sig_unlock; - if (rp='') then Exit(SCE_KERNEL_ERROR_EACCES); + if (rp='') then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); hfi:=Default(WIN32_FILE_ATTRIBUTE_DATA); err:=SwGetFileAttributes(rp,@hfi); @@ -531,16 +561,16 @@ begin ERROR_SHARING_VIOLATION, ERROR_LOCK_VIOLATION, ERROR_SHARING_BUFFER_EXCEEDED: - Exit(SCE_KERNEL_ERROR_EACCES); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); ERROR_BUFFER_OVERFLOW: - Exit(SCE_KERNEL_ERROR_ENAMETOOLONG); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENAMETOOLONG)); ERROR_NOT_ENOUGH_MEMORY: - Exit(SCE_KERNEL_ERROR_ENOMEM); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOMEM)); else - Exit(SCE_KERNEL_ERROR_ENOENT); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); end; end; @@ -584,7 +614,7 @@ var hfi:TByHandleFileInformation; err:DWORD; begin - if (stat=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); + if (stat=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); stat^:=Default(SceKernelStat); @@ -592,7 +622,10 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(SCE_KERNEL_ERROR_EBADF); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); + end; Case SwGetFileType(h) of FILE_TYPE_PIPE: @@ -620,16 +653,16 @@ begin ERROR_SHARING_VIOLATION, ERROR_LOCK_VIOLATION, ERROR_SHARING_BUFFER_EXCEEDED: - Exit(SCE_KERNEL_ERROR_EACCES); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); ERROR_BUFFER_OVERFLOW: - Exit(SCE_KERNEL_ERROR_ENAMETOOLONG); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENAMETOOLONG)); ERROR_NOT_ENOUGH_MEMORY: - Exit(SCE_KERNEL_ERROR_ENOMEM); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOMEM)); else - Exit(SCE_KERNEL_ERROR_ENOENT); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); end; end; @@ -645,7 +678,7 @@ begin end; else - Exit(SCE_KERNEL_ERROR_EBADF); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EBADF)); end; Result:=0; @@ -668,7 +701,10 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(_set_errno(EBADF)); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_errno(EBADF)); + end; N:=0; _sig_lock; @@ -694,7 +730,10 @@ begin h:=_get_osfhandle(fd); _sig_unlock; - if (h=INVALID_HANDLE_VALUE) then Exit(_set_errno(EBADF)); + if (h=INVALID_HANDLE_VALUE) then + begin + Exit(_set_errno(EBADF)); + end; N:=0; _sig_lock; @@ -708,25 +747,29 @@ begin _sig_unlock; end; -Function SwCreateDir(Const NewDir:RawByteString):Boolean; -var - err:DWORD; +Function SwCreateDir(Const NewDir:RawByteString):DWORD; begin + Result:=0; _sig_lock; - Result:=CreateDir(NewDir); - err:=GetLastError; + if not CreateDir(NewDir) then + begin + Result:=GetLastError; + end; _sig_unlock; - SetLastError(err); end; function ps4_sceKernelMkdir(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl; var fn:RawByteString; + err:DWORD; begin Result:=0; if (path=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); - if (path[0]=#0) then Exit(SCE_KERNEL_ERROR_ENOENT); + if (path[0]=#0) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); + end; Writeln('sceKernelMkdir:',path,'(',OctStr(mode,3),')'); @@ -734,36 +777,39 @@ begin fn:=_parse_filename(path); _sig_unlock; - if (fn='') then Exit(SCE_KERNEL_ERROR_EACCES); + if (fn='') then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); - if not SwCreateDir(fn) then + err:=SwCreateDir(fn); + + if (err<>0) then begin - Case GetLastError() of + Case err of ERROR_INVALID_DRIVE, ERROR_PATH_NOT_FOUND, ERROR_FILE_NOT_FOUND: - Exit(SCE_KERNEL_ERROR_ENOENT); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); ERROR_ACCESS_DENIED, ERROR_SHARING_VIOLATION, ERROR_LOCK_VIOLATION, ERROR_SHARING_BUFFER_EXCEEDED: - Exit(SCE_KERNEL_ERROR_EACCES); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); ERROR_BUFFER_OVERFLOW: - Exit(SCE_KERNEL_ERROR_ENAMETOOLONG); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENAMETOOLONG)); ERROR_NOT_ENOUGH_MEMORY: - Exit(SCE_KERNEL_ERROR_ENOMEM); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOMEM)); + ERROR_ALREADY_EXISTS, ERROR_FILE_EXISTS: - Exit(SCE_KERNEL_ERROR_EEXIST); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EEXIST)); ERROR_DISK_FULL: - Exit(SCE_KERNEL_ERROR_ENOSPC); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOSPC)); else - Exit(SCE_KERNEL_ERROR_EIO); + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EIO)); end; end; @@ -772,11 +818,15 @@ end; function ps4_mkdir(path:PChar):Integer; SysV_ABI_CDecl; var fn:RawByteString; + err:DWORD; begin Result:=0; if (path=nil) then Exit(_set_errno(EINVAL)); - if (path[0]=#0) then Exit(_set_errno(ENOENT)); + if (path[0]=#0) then + begin + Exit(_set_errno(ENOENT)); + end; Writeln('mkdir:',path); @@ -786,9 +836,11 @@ begin if (fn='') then Exit(_set_errno(EACCES)); - if not SwCreateDir(fn) then + err:=SwCreateDir(fn); + + if (err<>0) then begin - Case GetLastError() of + Case err of ERROR_INVALID_DRIVE, ERROR_PATH_NOT_FOUND, ERROR_FILE_NOT_FOUND: @@ -806,6 +858,7 @@ begin ERROR_NOT_ENOUGH_MEMORY: Exit(_set_errno(ENOMEM)); + ERROR_ALREADY_EXISTS, ERROR_FILE_EXISTS: Exit(_set_errno(EEXIST)); @@ -825,8 +878,11 @@ var begin Result:=0; - if (path=nil) then Exit(SCE_KERNEL_ERROR_EINVAL); - if (path[0]=#0) then Exit(SCE_KERNEL_ERROR_ENOENT); + if (path=nil) then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EINVAL)); + if (path[0]=#0) then + begin + Exit(_set_sce_errno(SCE_KERNEL_ERROR_ENOENT)); + end; Writeln('sceKernelCheckReachability:',path); @@ -834,14 +890,14 @@ begin fn:=_parse_filename(path); _sig_unlock; - if (fn='') then Exit(SCE_KERNEL_ERROR_EACCES); + if (fn='') then Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); if FileExists(fn) or DirectoryExists(fn) then begin Result:=0; end else begin - Result:=SCE_KERNEL_ERROR_ENOENT; + Result:=_set_sce_errno(SCE_KERNEL_ERROR_ENOENT); end; end; diff --git a/src/ps4_libscedialogs.pas b/src/ps4_libscedialogs.pas index 4a2b5c0..bb7f3e1 100644 --- a/src/ps4_libscedialogs.pas +++ b/src/ps4_libscedialogs.pas @@ -63,9 +63,13 @@ end; // +var + status_err_dialog:Integer=0; //SCE_ERROR_DIALOG_STATUS_NONE + function ps4_sceErrorDialogInitialize():Integer; SysV_ABI_CDecl; begin Writeln('sceErrorDialogInitialize'); + status_err_dialog:=1; //SCE_ERROR_DIALOG_STATUS_INITIALIZED Result:=0; end; @@ -81,9 +85,6 @@ type const SCE_ERROR_DIALOG_ERROR_PARAM_INVALID=Integer($80ED0003); -var - status_err_dialog:Integer=0; //SCE_ERROR_DIALOG_STATUS_NONE - function ps4_sceErrorDialogOpen(param:pSceErrorDialogParam):Integer; SysV_ABI_CDecl; begin if (param=nil) then Exit(SCE_ERROR_DIALOG_ERROR_PARAM_INVALID); @@ -114,20 +115,24 @@ end; // +var + status_save_dialog:Integer=SCE_COMMON_DIALOG_STATUS_NONE; + function ps4_sceSaveDataDialogInitialize():Integer; SysV_ABI_CDecl; begin Writeln('sceSaveDataDialogInitialize'); + status_save_dialog:=SCE_COMMON_DIALOG_STATUS_INITIALIZED; Result:=0; end; function ps4_sceSaveDataDialogUpdateStatus():Integer; SysV_ABI_CDecl; begin - Result:=SCE_COMMON_DIALOG_STATUS_NONE; + Result:=status_save_dialog; end; function ps4_sceSaveDataDialogGetStatus():Integer; SysV_ABI_CDecl; begin - Result:=SCE_COMMON_DIALOG_STATUS_NONE; + Result:=status_save_dialog; end; type @@ -153,6 +158,7 @@ end; function ps4_sceSaveDataDialogTerminate():Integer; SysV_ABI_CDecl; begin Writeln('sceSaveDataDialogTerminate'); + status_save_dialog:=SCE_COMMON_DIALOG_STATUS_NONE; Result:=0; end; @@ -162,7 +168,7 @@ const function ps4_sceSaveDataDialogGetResult(_result:pSceSaveDataDialogResult):Integer; SysV_ABI_CDecl; begin Writeln('sceSaveDataDialogGetResult'); - Result:=SCE_COMMON_DIALOG_ERROR_NOT_FINISHED; + Result:=0; end; type @@ -180,9 +186,13 @@ end; // +var + status_msg_dialog:Integer=SCE_COMMON_DIALOG_STATUS_NONE; + function ps4_sceMsgDialogInitialize():Integer; SysV_ABI_CDecl; begin Writeln('sceMsgDialogInitialize'); + status_msg_dialog:=SCE_COMMON_DIALOG_STATUS_INITIALIZED; Result:=0; end; @@ -241,9 +251,6 @@ const SCE_COMMON_DIALOG_ERROR_PARAM_INVALID=-2135425014; // 0x80B8000A SCE_COMMON_DIALOG_ERROR_ARG_NULL =-2135425011; // 0x80B8000D -var - status_msg_dialog:Integer=SCE_COMMON_DIALOG_STATUS_NONE; - function ps4_sceMsgDialogOpen(param:pSceMsgDialogParam):Integer; SysV_ABI_CDecl; begin if (param=nil) then Exit(SCE_COMMON_DIALOG_ERROR_ARG_NULL); @@ -314,15 +321,16 @@ end; // +var + status_commerce_dialog:Integer=SCE_COMMON_DIALOG_STATUS_NONE; + function ps4_sceNpCommerceDialogInitialize():Integer; SysV_ABI_CDecl; begin Writeln('sceNpCommerceDialogInitialize'); + status_commerce_dialog:=SCE_COMMON_DIALOG_STATUS_INITIALIZED; Result:=0; end; -var - status_commerce_dialog:Integer=SCE_COMMON_DIALOG_STATUS_NONE; - type pSceNpCommerceDialogParam=^SceNpCommerceDialogParam; SceNpCommerceDialogParam=packed record @@ -400,15 +408,26 @@ end; // +const + SCE_SIGNIN_DIALOG_STATUS_NONE =0; + SCE_SIGNIN_DIALOG_STATUS_INITIALIZED=1; + SCE_SIGNIN_DIALOG_STATUS_RUNNING =2; + SCE_SIGNIN_DIALOG_STATUS_FINISHED =3; + +var + status_signin_dialog:Integer=SCE_SIGNIN_DIALOG_STATUS_NONE; + function ps4_sceSigninDialogInitialize():Integer; SysV_ABI_CDecl; begin Writeln('sceSigninDialogInitialize'); + status_signin_dialog:=SCE_SIGNIN_DIALOG_STATUS_INITIALIZED; Result:=0; end; function ps4_sceSigninDialogTerminate():Integer; SysV_ABI_CDecl; begin Writeln('sceSigninDialogTerminate'); + status_signin_dialog:=SCE_SIGNIN_DIALOG_STATUS_NONE; Result:=0; end; @@ -420,21 +439,16 @@ type reserved:array[0..1] of Integer; end; -const - SCE_SIGNIN_DIALOG_STATUS_NONE =0; - SCE_SIGNIN_DIALOG_STATUS_INITIALIZED=1; - SCE_SIGNIN_DIALOG_STATUS_RUNNING =2; - SCE_SIGNIN_DIALOG_STATUS_FINISHED =3; - function ps4_sceSigninDialogOpen(param:pSceSigninDialogParam):Integer; SysV_ABI_CDecl; begin Writeln('sceSigninDialogOpen'); + status_signin_dialog:=SCE_SIGNIN_DIALOG_STATUS_FINISHED; Result:=0; end; function ps4_sceSigninDialogUpdateStatus:Integer; SysV_ABI_CDecl; begin - Result:=SCE_SIGNIN_DIALOG_STATUS_FINISHED; + Result:=status_signin_dialog; end; function ps4_scePlayerInvitationDialogTerminate():Integer; SysV_ABI_CDecl; diff --git a/src/ps4_libscehttp.pas b/src/ps4_libscehttp.pas index 0679dbf..bf45310 100644 --- a/src/ps4_libscehttp.pas +++ b/src/ps4_libscehttp.pas @@ -70,6 +70,27 @@ begin Result:=0; end; +type + PSceHttpNBEvent=^SceHttpNBEvent; + SceHttpNBEvent=packed record + events:DWORD; + eventDetail:DWORD; + id:Integer; + userArg:Pointer; + end; + +function ps4_sceHttpWaitRequest(eh:SceHttpEpollHandle; + nbev:PSceHttpNBEvent; + maxevents:Integer; + timeout_us:Integer):Integer; SysV_ABI_CDecl; +begin + Writeln('sceHttpWaitReques'); + nbev^.events:=8; //SCE_HTTP_NB_EVENT_SOCK_ERR + nbev^.id:=3; + + Result:=1; +end; + function ps4_sceHttpAddRequestHeader(id:Integer;name:PChar;value:PChar;mode:Integer):Integer; SysV_ABI_CDecl; begin Result:=0; @@ -133,6 +154,7 @@ begin statusCode^:=404; end; Result:=0; + Result:=Integer($80431082); end; const @@ -179,6 +201,7 @@ begin lib^.set_proc($C1885755F4B612DE,@ps4_sceHttpDestroyEpoll); lib^.set_proc($FF19BB91940DA472,@ps4_sceHttpSetEpoll); lib^.set_proc($E7DB4BD404016FC5,@ps4_sceHttpUnsetEpoll); + lib^.set_proc($A884A30C7AF138D7,@ps4_sceHttpWaitRequest); lib^.set_proc($118DBC4F66E437B9,@ps4_sceHttpAddRequestHeader); lib^.set_proc($86DC813A859E4B9F,@ps4_sceHttpsSetSslCallback); lib^.set_proc($AA0C43063A2B531B,@ps4_sceHttpCreateConnectionWithURL); diff --git a/sys/sys_kernel.pas b/sys/sys_kernel.pas index 994219d..400f8a9 100644 --- a/sys/sys_kernel.pas +++ b/sys/sys_kernel.pas @@ -26,6 +26,7 @@ function px2sce(e:Integer):Integer; function sce2px(e:Integer):Integer; function _set_errno(r:Integer):Integer; +function _set_sce_errno(r:Integer):Integer; function _error:Pointer; function SwFreeMem(p:pointer):ptruint; @@ -74,7 +75,7 @@ function _set_errno(r:Integer):Integer; var t:pthread; begin - if (r<>0) then + //if (r<>0) then begin t:=tcb_thread; if (t<>nil) then t^.errno:=r; @@ -83,6 +84,20 @@ begin Result:=r; end; +function _set_sce_errno(r:Integer):Integer; +var + t:pthread; +begin + Result:=r; + //if (r<>0) then + begin + t:=tcb_thread; + if (t<>nil) then t^.errno:=sce2px(r); + Exit(-1); + end; + Result:=r; +end; + function _error:Pointer; var t:pthread;