Skip to content

Commit

Permalink
Add all SceNpInGameMessage library functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kr1spy2115 committed Dec 26, 2023
1 parent 7820a6d commit cb89cba
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/np/ps4_libscenpcommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface
pSceNpAccountId=^SceNpAccountId;
SceNpAccountId=QWORD;

SceNpPlatformType=Integer;

pSceNpOnlineId=^SceNpOnlineId;
SceNpOnlineId=packed record
data:array[0..SCE_NP_ONLINEID_MAX_LENGTH-1] of AnsiChar;
Expand Down
43 changes: 41 additions & 2 deletions src/np/ps4_libscenpingamemessage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface
uses
windows,
ps4_libSceNpCommon,
ps4_libSceNpManager,
ps4_program,
np_error;

Expand All @@ -17,6 +18,10 @@ interface

SCE_NP_IN_GAME_MESSAGE_DATA_SIZE_MAX=512;

var

number:Integer=0;


type
pSceNpInGameMessageData=^SceNpInGameMessageData;
Expand All @@ -25,21 +30,55 @@ interface
dataSize:QWORD;
end;

///Callbacks place
SceUserServiceUserId=Integer;


SceNpInGameMessageEventCallbackA=procedure(libCtxId:Integer;pTo:Integer;pToOnlineId:pSceNpOnlineId;pFrom:Integer;pMessage:pSceNpInGameMessageData;pUserArg:Pointer) SysV_ABI_CDecl;



implementation

///Functions
function ps4_SceNpInGameMessageInitialize(poolSize:QWORD;pOption:Pointer):Integer; SysV_ABI_CDecl;
begin
if (poolSize=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
Inc(number);
if(number=1) then Writeln('-SceNpInGameMessageInitialize- succeed');
Result:=0;
end;


function ps4_SceNpInGameMessageTerminate(libCtxId:Integer):Integer; SysV_ABI_CDecl;
begin
if (libCtxId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
if(number=1) then Writeln('-SceNpInGameMessageTerminate- succeed');
Result:=0;
end;

function ps4_sceNpInGameMessageCreateHandle(libCtxId:Integer):Integer; SysV_ABI_CDecl;
begin
if (libCtxId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
Result:=0;
end;

function ps4_sceNpInGameMessageDeleteHandle(libCtxId:Integer;handleId:Integer):Integer; SysV_ABI_CDecl;
begin
if (handleId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
Result:=0;
end;

function ps4_sceNpInGameMessagePrepareA(libCtxId:Integer;handleId:Integer;pReserved:Pointer;cbFunc:pSceNpInGameMessageEventCallbackA;pUserArg:Pointer):Integer; SysV_ABI_CDecl;
begin
if (libCtxId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
if (handleId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
if (cbFunc=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
Result:=0;
end;

function ps4_sceNpInGameMessageSendDataA(libCtxId:Integer;pTo:pSceNpPeerAddressA;pFrom:pSceNpPeerAddressA;pMessage:pSceNpInGameMessageData):Integer; SysV_ABI_CDecl;
begin
if (libCtxId=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
if (pMessage=nil) then Exit(SCE_NP_ERROR_INVALID_ARGUMENT);
Result:=0;
end;

Expand Down
8 changes: 7 additions & 1 deletion src/np/ps4_libscenpmanager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface
windows,
ps4_program,
np_error,
ps4_libSceNpInGameMessage,
ps4_libSceNpCommon;


Expand Down Expand Up @@ -44,6 +43,13 @@ interface
padding:array[0..1] of AnsiChar;
end;

pSceNpPeerAddressA=^SceNpPeerAddressA;
SceNpPeerAddressA=packed record
accountId:SceNpAccountId;
platform:SceNpPlatformType;
padding:array[0..3] of AnsiChar;
end;

pSceNpLanguageCode=^SceNpLanguageCode;
SceNpLanguageCode=packed record
code:array[0..SCE_NP_LANGUAGE_CODE_MAX_LEN] of AnsiChar;
Expand Down

0 comments on commit cb89cba

Please sign in to comment.