unit ps4_libSceUserService; {$mode objfpc}{$H+} {$CALLING SysV_ABI_CDecl} interface uses subr_dynlib, atomic, Classes, SysUtils; const SCE_USER_SERVICE_MAX_LOGIN_USERS=4; SCE_USER_SERVICE_USER_ID_INVALID=Integer($FFFFFFFF); type PUserServiceInitializeParams=^TUserServiceInitializeParams; TUserServiceInitializeParams=packed record priority:DWORD; end; PUserServiceLoginUserIdList=^TUserServiceLoginUserIdList; TUserServiceLoginUserIdList=packed record userId:array[0..SCE_USER_SERVICE_MAX_LOGIN_USERS-1] of Integer; end; const //SceUserServiceEventType SCE_USER_SERVICE_EVENT_TYPE_LOGIN =0; SCE_USER_SERVICE_EVENT_TYPE_LOGOUT =1; type pSceUserServiceEvent=^SceUserServiceEvent; SceUserServiceEvent=packed record eventType:Integer; //SceUserServiceEventType userId:Integer; //SceUserServiceUserId end; TUserServiceEventCallback=procedure(event:pSceUserServiceEvent;arg:Pointer); implementation const SCE_USER_SERVICE_ERROR_NOT_INITIALIZED =-2137653246; //0x80960002 SCE_USER_SERVICE_ERROR_INVALID_ARGUMENT=-2137653243; //0x80960005 SCE_USER_SERVICE_ERROR_NO_EVENT =-2137653241; //0x80960007 SCE_USER_SERVICE_ERROR_BUFFER_TOO_SHORT=-2137653238; //0x8096000A function ps4_sceUserServiceInitialize(params:PUserServiceInitializeParams):Integer; begin Result:=0; end; function ps4_sceUserServiceInitialize2(threadPriority:Integer;cpuAffinityMask:qword):Integer; begin Result:=0; end; function ps4_sceUserServiceTerminate:Integer; begin Result:=0; end; function ps4_sceUserServiceGetLoginUserIdList(List:PUserServiceLoginUserIdList):Integer; var i:Integer; begin Result:=-1; if (List=nil) then Exit; List^.userId[0]:=$167a1a93; For i:=1 to SCE_USER_SERVICE_MAX_LOGIN_USERS-1 do List^.userId[i]:=SCE_USER_SERVICE_USER_ID_INVALID; Result:=0; end; function ps4_sceUserServiceGetInitialUser(pUserId:PInteger):Integer; begin if (pUserId=nil) then Exit(SCE_USER_SERVICE_ERROR_INVALID_ARGUMENT); pUserId^:=$167a1a93; Result:=0; end; function ps4_sceUserServiceGetUserName(userId:Integer;userName:PChar;size:size_t):Integer; Const cuser:PChar='user'#0; begin if (userName=nil) then Exit(SCE_USER_SERVICE_ERROR_INVALID_ARGUMENT); if (size