PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
rpc_client.c
1#include <stdio.h>
2#include <thbase.h>
3#include <thsemap.h>
4#include <loadcore.h>
5#include <sysmem.h>
6#include <intrman.h>
7#include <sifcmd.h>
8#include <libsd.h>
9#include <sysclib.h>
10
11#include <audsrv.h>
12#include "audsrv_internal.h"
13#include "rpc_client.h"
14
15static SifRpcClientData_t client;
16static int rpc_sema;
17
18void initialize_rpc_client(void)
19{
20 rpc_sema = CreateMutex(IOP_MUTEX_UNLOCKED);
21
22 client.server = NULL;
23 while(sceSifBindRpc(&client, AUDSRV_IRX, 0) < 0 || client.server == NULL) DelayThread(500);
24}
25
26void deinitialize_rpc_client(void)
27{
28 memset(&client, 0, sizeof(client));
29 DeleteSema(rpc_sema);
30}
31
32static void call_end_callback(void *end_param)
33{
34 (void)end_param;
35
36 iSignalSema(rpc_sema);
37}
38
39void call_client_callback(int id)
40{
41 WaitSema(rpc_sema);
42 sceSifCallRpc(&client, id, SIF_RPC_M_NOWAIT, NULL, 0, NULL, 0, &call_end_callback, NULL);
43}
#define SIF_RPC_M_NOWAIT
Definition sifrpc.h:24