source: ps2launchargs/source/uLaunchELF/chkesr_rpc.c@ 1185

Last change on this file since 1185 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: 2.7 KB
Line 
1/*
2 _____ ___ ____
3 ____| | ____| PS2 Open Source Project
4 | ___| |____
5
6---------------------------------------------------------------------------
7
8 Copyright (C) 2008 - Neme & jimmikaelkael (www.psx-scene.com)
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the Free McBoot License.
12
13 This program and any related documentation is provided "as is"
14 WITHOUT ANY WARRANTIES, either express or implied, including, but not
15 limited to, implied warranties of fitness for a particular purpose. The
16 entire risk arising out of use or performance of the software remains
17 with you.
18 In no event shall the author be liable for any damages whatsoever
19 (including, without limitation, damages to your hardware or equipment,
20 environmental damage, loss of health, or any kind of pecuniary loss)
21 arising out of the use of or inability to use this software or
22 documentation, even if the author has been advised of the possibility of
23 such damages.
24
25 You should have received a copy of the Free McBoot License along with
26 this program; if not, please report at psx-scene :
27 http://psx-scene.com/forums/freevast/
28
29---------------------------------------------------------------------------
30*/
31
32#include <tamtypes.h>
33#include <kernel.h>
34#include <sifrpc.h>
35
36// External functions
37int chkesr_rpc_Init(void);
38int Check_ESR_Disc(void);
39
40#define CHKESR_IRX 0x0E0E0E0
41
42static SifRpcClientData_t chkesr __attribute__((aligned(64)));
43static int Rpc_Buffer[1024] __attribute__((aligned(64)));
44
45typedef struct {
46 u32 ret;
47} Rpc_Packet_Send_Check_ESR_Disc;
48
49int chkesr_Inited = 0;
50
51//--------------------------------------------------------------
52int chkesrBindRpc(void) {
53 int ret;
54 int retryCount = 0x1000;
55
56 while(retryCount--) {
57 ret = SifBindRpc( &chkesr, CHKESR_IRX, 0);
58 if ( ret < 0) return -1;
59 if (chkesr.server != 0) break;
60 // short delay
61 ret = 0x10000;
62 while(ret--) asm("nop\nnop\nnop\nnop");
63 }
64 chkesr_Inited = 1;
65 return retryCount;
66}
67//--------------------------------------------------------------
68int chkesr_rpc_Init(void)
69{
70 chkesrBindRpc();
71 if(!chkesr_Inited) return -1;
72 return 1;
73}
74//--------------------------------------------------------------
75int Check_ESR_Disc(void)
76{
77 Rpc_Packet_Send_Check_ESR_Disc *Packet = (Rpc_Packet_Send_Check_ESR_Disc *)Rpc_Buffer;
78
79 if(!chkesr_Inited) chkesr_rpc_Init();
80 if ((SifCallRpc(&chkesr, 1, 0, (void*)Rpc_Buffer, sizeof(Rpc_Packet_Send_Check_ESR_Disc), (void*)Rpc_Buffer, sizeof(int),0,0)) < 0) return -1;
81 return Packet->ret;
82}
83//--------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.