10 #define DEBUG_BGCOLOR(col) *((u64 *) 0x120000e0) = (u64) (col)
12 static char*
padTypeStr[] = {
"Unsupported controller",
"Mouse",
"Nejicon",
13 "Konami Gun",
"Digital",
"Analog",
"Namco Gun",
21 static u8 actDirect[2][6] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}};
26 *
GS_REG_CSR |=
GS_SET_CSR(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0);
29 while (!(*
GS_REG_CSR & (
GS_SET_CSR(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)))) { }
32 *
GS_REG_CSR &= ~
GS_SET_CSR(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0);
43 printf(
"Failed to load sio2man.irx module (%d)\n", ret);
49 printf(
"Failed to load padman.irx module (%d)\n", ret);
57 printf(
"Failed to load XSIO2MAN module (%d)\n", ret);
63 printf(
"Failed to load XPADMAN module (%d)\n", ret);
96 int main(
int argc,
char **argv)
105 printf(
"libpadx sample");
107 if((argc == 2) && (strncmp(argv[1],
"free", 4) == 0))
109 printf(
" - Using PS2SDK sio2man.irx and padman.irx modules.\n");
114 printf(
" - Using ROM XSIO2MAN and XPADMAN modules.\n");
115 printf(
"Start this sample with 'free' as an argument to load sio2man.irx and padman.irx\n");
116 printf(
"Example: ps2client execee host:padx_sample.elf free\n");
125 padBuf[0] = memalign(64, 256);
126 padBuf[1] = memalign(64, 256);
158 printf(
"Controller (%i) connected\n",
port);
161 for(i = 0; i < ModeTableNum; i++)
165 if((mTable[0] == 4) && (mTable[1] == 7) && (ModeTableNum == 2))
169 if(dualshock[
port] == 1)
181 printf(
" ModeCurId : %i (%s)\n", (
int)ModeCurId,
padTypeStr[ModeCurId]);
182 printf(
" ModeCurExId : %i\n", (
int)ModeCurExId);
183 printf(
" ModeTable : ");
185 for(i = 0; i < ModeTableNum; i++)
188 printf(
"%i ", (
int)mTable[i]);
192 printf(
" ModeTableNum : %i\n", (
int)ModeTableNum);
193 printf(
" ModeCurOffs : %i\n", (
int)ModeCurOffs);
194 printf(
" NumOfAct : %i\n", (
int)acts[
port]);
200 u8 actAlign[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
204 for(i=0; i < acts[
port]; i++)
221 printf(
"Controller (%i) disconnected\n",
port);
237 if((buttons.
ljoy_h <= 50) || (buttons.
ljoy_h >= 200)) printf(
"Left Analog X: %i\n", (
int)buttons.
ljoy_h);
238 if((buttons.
ljoy_v <= 50) || (buttons.
ljoy_v >= 200)) printf(
"Left Analog Y: %i\n", (
int)buttons.
ljoy_v);
239 if((buttons.
rjoy_h <= 50) || (buttons.
rjoy_h >= 200)) printf(
"Right Analog X: %i\n", (
int)buttons.
rjoy_h);
240 if((buttons.
rjoy_v <= 50) || (buttons.
rjoy_v >= 200)) printf(
"Right Analog Y: %i\n", (
int)buttons.
rjoy_v);
243 if(
new_pad[
port]) printf(
"Controller (%i) button(s) pressed: ", (
int)
port);
256 printf(
"L1 (Start Little Motor) ");
261 printf(
"L2 (Stop Little Motor) ");
267 printf(
"R1 (Start Big Motor) ");
272 printf(
"R2 (Stop Big Motor) ");
int SifLoadModule(const char *path, int arg_len, const char *args)
#define GS_SET_CSR(signal_evnt, finish_evnt, hsync_intrupt, vsync_intrupt, write_terminate, flush, reset, nfield, current_field, fifo_status, gs_rev_number, gs_id)
int padPortOpen(int port, int slot, void *padArea)
unsigned char padRead(int port, int slot, struct padButtonStatus *data)
int padInfoMode(int port, int slot, int infoMode, int index)
#define PAD_MMODE_DUALSHOCK
int padSetActAlign(int port, int slot, char act_align[6])
int padSetActDirect(int port, int slot, char act_align[6])
int padGetState(int port, int slot)
unsigned char padInfoAct(int port, int slot, int word, int byte)
unsigned char padGetReqState(int port, int slot)
int padInfoPressMode(int port, int slot)
#define PAD_RSTAT_COMPLETE
#define PAD_STATE_DISCONN
int padSetMainMode(int port, int slot, int mode, int lock)
int padEnterPressMode(int port, int slot)
static void padStopAct(int port, int act)
static char * padTypeStr[]
static void padWait(int port)
int main(int argc, char **argv)
static u32 portConnected[2]
static u8 actDirect[2][6]
static void padStartAct(int port, int act, int speed)
static void loadmodules(int free)
void SifInitRpc(int mode)