source: ps2launchargs/source/uLaunchELF/hdl_rpc.c@ 1155

Last change on this file since 1155 was 1101, checked in by iritscen, 7 years ago

Added following to ps2launchargs:\n-Source code.\n-DLL needed to run ps2client.\n-Instructions for building uLaunchELF.

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#include <tamtypes.h>
2#include <kernel.h>
3#include <sifrpc.h>
4#include <stdarg.h>
5#include <string.h>
6#include <stdio.h>
7
8#include "launchelf.h"
9
10static SifRpcClientData_t client __attribute__((aligned(64)));
11static int Rpc_Buffer[1024] __attribute__((aligned(64)));
12
13typedef struct {
14 char Partition_Name [32 + 1];
15} Rpc_Packet_Send_GetInfo;
16
17typedef struct {
18 char OldName[64];
19 char NewName[64];
20} Rpc_Packet_Send_Rename;
21
22int Hdl_Inited = 0;
23
24int Hdl_Info_BindRpc() {
25 int ret;
26 int retryCount = 0x1000;
27
28 while(retryCount--) {
29 ret = SifBindRpc( &client, HDL_IRX, 0);
30 if ( ret < 0) {
31 printf("Hdl Info: EE Bind RPC Error.\n");
32 return -1;
33 }
34 if (client.server != 0){
35 printf("Hdl Info: EE Bind RPC Set.\n");
36 break;
37 }
38
39 // short delay
40 ret = 0x10000;
41 while(ret--) asm("nop\nnop\nnop\nnop");
42 }
43
44 Hdl_Inited = 1;
45 return retryCount;
46}
47
48int HdlGetGameInfo(char *PartName, GameInfo *Game){
49
50 Rpc_Packet_Send_GetInfo *Packet = (Rpc_Packet_Send_GetInfo *)Rpc_Buffer;
51
52 if(!Hdl_Inited) return -1;
53
54 strcpy(Packet->Partition_Name, PartName);
55
56 SifCallRpc(&client, HDL_GETINFO, 0, (void*)Rpc_Buffer, sizeof(Rpc_Packet_Send_GetInfo), (void*)Rpc_Buffer, sizeof(GameInfo)+4,0,0);
57
58 memcpy(Game, ((void *)Rpc_Buffer)+4, sizeof(GameInfo));
59
60 return Rpc_Buffer[0];
61}
62
63int HdlRenameGame(char* OldName, char* NewName){
64
65 Rpc_Packet_Send_Rename *Packet = (Rpc_Packet_Send_Rename *)Rpc_Buffer;
66
67 if(!Hdl_Inited) return -1;
68
69 strcpy(Packet->OldName, OldName);
70 strcpy(Packet->NewName, NewName);
71
72 SifCallRpc(&client, HDL_RENAME, 0, (void*)(Rpc_Buffer), sizeof(Rpc_Packet_Send_Rename), (void*)Rpc_Buffer, 4,0,0);
73
74 return Rpc_Buffer[0];
75}
Note: See TracBrowser for help on using the repository browser.