/* what you need to change in Basilisk In the following routine you will have to call p-sprint's readkeyex. I mapped enter to the Start key by default just like you so you can leave that out of your own routine, and I recommend using the R button as mouse key instead so that all the face buttons are left to the keyboard. I use the select button for Escape, and the L button for the menu key in windows. That is a good key to maybe connect to what happens if you hold the mouse button in MacOS, but I don't know if that is possible. I see that the emulator works with key-up and key-down functions. There's currently no point in doing that with p-sprint I think, as it handles that itself, but I can expand on p-sprint to support that I think. Just let me know if that is useful. Currently modifiers (Apple, Shift, Control, Alt) are, for typing speed and convenience, linked to the first key pressed in conjunction with them. So if someone types CTRL-s, then you would get both returned from p_sprint at the same time; control in the myKey.modifiers and s in the myKey.keycode and myKey.keychar. Same for Apple-Shift-s, and so on. Required include: p_sprint.h (with p_sprint.c present obviously) */ int Psp60HzTimer(SceSize args, void *argp) { while (true) { // added for P-sprint, you can put this higher up of course struct p_sp_Key myKey; // Wait another 60Hz. sceKernelDelayThread(16625); // Read input sceCtrlReadBufferPositive(&pad, 1); // Setup analog dead zone and read "mouse" if (pad.Lx > 108 && pad.Lx < 148) pad.Lx = LastX = 128; else { if (pad.Lx > 127) ADBMouseMoved( 2, 0); if (pad.Lx < 127) ADBMouseMoved(-2, 0); } if (pad.Ly > 108 && pad.Ly < 148) pad.Ly = LastY = 128; else { if (pad.Ly > 127) ADBMouseMoved(0, 2); if (pad.Ly < 127) ADBMouseMoved(0, -2); } if (pad.Buttons != 0) { if (pad.Buttons & PSP_CTRL_RTRIGGER) { ADBMouseDown(0); MouseDown = true; } else if ((pad.Buttons & PSP_CTRL_RTRIGGER) && MouseDown) { ADBMouseUp(0); MouseDown = false; } } else { // Reset anything set. if (MouseDown) { ADBMouseUp(0); MouseDown = false; } } //p-sprint's reading from keyboard p_spReadKeyEx(&myKey, pad.Buttons); //and then probably something like this: if(myKey.keycode > 0) { ADBKeyUp(myKey.keycode); ADBKeyDown(myKey.keycode); } //and this: if(myKey.modifiers > 0) { // set state of shift, control, alt, apple key bits according to // this value, which is basically a bitwise state, 1 for control, 2 for shift, // 4 for alt, and 8 for OS/Apple key (16 is there if you need another one) // so 3 would be control-shift, etc. } // Trigger 60Hz interrupt. SetInterruptFlag(INTFLAG_60HZ); TriggerInterrupt(); } } /* What you need to change in p_sprint.c: The following routine contains the keycodes returned by p-sprint. They correspond to a windows keyboard's keycodes. For fastest performance and easiest use, you will want to translate those codes to the mac keycodes that the emulator can use. Ignore the minus-32, that was to correct an error I made (I used ASCII values instead of keycodes, and this was a quick fix) See here, bottom of page, for an overview of what keyid is currently mapped to which key combination and what keycode, so you can easily get the right values: http://www.niwra.nl/psp/p-sprint-c/doc/index.htm */ int p_spSetupKeyCodes(void) { /* links unique keys or key combinations that p-sprint recognises to PC compatible keycodes */ int i = 0; int j = 0; while(i<5) { while(j<65) { KeyCodes[j][i]=0; j++; } i++; } /* default group = 0 */ KeyCodes[1][0]=8; KeyCodes[2][0]=32; KeyCodes[3][0]=98-32; KeyCodes[4][0]=121-32; KeyCodes[5][0]=103-32; KeyCodes[6][0]=219; KeyCodes[7][0]=222; KeyCodes[8][0]=188; KeyCodes[9][0]=102-32; KeyCodes[10][0]=111-32; KeyCodes[11][0]=117-32; KeyCodes[12][0]=120-32; KeyCodes[13][0]=118-32; KeyCodes[14][0]=192; KeyCodes[15][0]=106-32; KeyCodes[16][0]=108-32; KeyCodes[17][0]=100-32; KeyCodes[18][0]=109-32; KeyCodes[19][0]=122-32; KeyCodes[20][0]=221; KeyCodes[21][0]=220; KeyCodes[22][0]=113-32; KeyCodes[23][0]=112-32; KeyCodes[24][0]=115-32; KeyCodes[25][0]=116-32; KeyCodes[26][0]=99-32; KeyCodes[27][0]=186; KeyCodes[28][0]=119-32; KeyCodes[29][0]=107-32; KeyCodes[30][0]=114-32; KeyCodes[31][0]=101-32; KeyCodes[32][0]=97-32; KeyCodes[33][0]=190; KeyCodes[34][0]=189; KeyCodes[35][0]=191; KeyCodes[36][0]=104-32; KeyCodes[37][0]=110-32; KeyCodes[38][0]=105-32; KeyCodes[39][0]=13; KeyCodes[40][0]=27; KeyCodes[41][0]=20; KeyCodes[42][0]=93; /* group = 1 */ KeyCodes[1][1]=8; KeyCodes[2][1]=32; KeyCodes[3][1]=112; KeyCodes[4][1]=113; KeyCodes[5][1]=119; KeyCodes[6][1]=219; KeyCodes[7][1]=186; KeyCodes[8][1]=188; KeyCodes[9][1]=114; KeyCodes[10][1]=115; KeyCodes[11][1]=116; KeyCodes[12][1]=111; KeyCodes[13][1]=123; KeyCodes[14][1]=192; KeyCodes[15][1]=120; KeyCodes[16][1]=117; KeyCodes[17][1]=118; KeyCodes[18][1]=121; KeyCodes[19][1]=122; KeyCodes[20][1]=221; //KeyCodes[21][1]=55; KeyCodes[22][1]=106; KeyCodes[23][1]=48; KeyCodes[24][1]=49; KeyCodes[25][1]=50; KeyCodes[26][1]=57; KeyCodes[27][1]=186; KeyCodes[28][1]=107; KeyCodes[29][1]=109; KeyCodes[30][1]=51; KeyCodes[31][1]=52; KeyCodes[32][1]=53; KeyCodes[33][1]=190; KeyCodes[34][1]=189; //KeyCodes[35][1]=55; KeyCodes[36][1]=56; KeyCodes[37][1]=54; KeyCodes[38][1]=55; KeyCodes[39][1]=13; KeyCodes[40][1]=27; /* shortcuts, psp only */ KeyCodes[41][1]=20; KeyCodes[42][1]=93; /* group = 2 */ KeyCodes[1][2]=40; KeyCodes[2][2]=13; KeyCodes[3][2]=37; KeyCodes[4][2]=36; KeyCodes[5][2]=45; //KeyCodes[6][2]=38; //KeyCodes[7][2]=222; //KeyCodes[8][2]=188; KeyCodes[9][2]=35; KeyCodes[10][2]=38; KeyCodes[11][2]=33; KeyCodes[12][2]=19; KeyCodes[13][2]=16; //KeyCodes[14][2]=192; KeyCodes[15][2]=46; KeyCodes[16][2]=34; KeyCodes[17][2]=39; KeyCodes[18][2]=107; KeyCodes[19][2]=106; //KeyCodes[20][2]=221; //KeyCodes[21][2]=55; KeyCodes[22][2]=145; KeyCodes[23][2]=109; KeyCodes[24][2]=27; KeyCodes[25][2]=91; KeyCodes[26][2]=93; //KeyCodes[27][2]=186; KeyCodes[28][2]=144; //KeyCodes[29][2]=82; KeyCodes[30][2]=17; KeyCodes[31][2]=16; KeyCodes[32][2]=18; //KeyCodes[33][2]=190; //KeyCodes[34][2]=189; //KeyCodes[35][2]=80; KeyCodes[36][2]=9; KeyCodes[37][2]=92; KeyCodes[38][2]=20; KeyCodes[39][2]=13; KeyCodes[40][2]=27; /* shortcuts, psp only */ KeyCodes[41][2]=20; KeyCodes[42][2]=8; return 0; } /* not too much work at all, I think! And gives you a very rich set of keys to press right away, great for testing applications also*/