aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/cdriso.c6
-rw-r--r--libpcsxcore/new_dynarec/emu_if.c2
-rw-r--r--libpcsxcore/new_dynarec/emu_if.h2
-rw-r--r--libpcsxcore/plugins.c519
-rw-r--r--libpcsxcore/psxbios.c11
-rw-r--r--libpcsxcore/sio.c14
-rw-r--r--libpcsxcore/socket.c17
7 files changed, 491 insertions, 80 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index 515370f..d2c904c 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -30,7 +30,7 @@
#include <process.h>
#include <windows.h>
#define strcasecmp _stricmp
-#define usleep(x) Sleep((x) / 1000)
+#define usleep(x) (Sleep((x) / 1000))
#else
#include <pthread.h>
#include <sys/time.h>
@@ -225,7 +225,9 @@ static void *playthread(void *param)
do {
ret = SPU_playCDDAchannel((short *)sndbuffer, s);
if (ret == 0x7761)
+ {
usleep(6 * 1000);
+ }
} while (ret == 0x7761 && playing); // rearmed_wait
}
@@ -236,7 +238,9 @@ static void *playthread(void *param)
// HACK: stop feeding data while emu is paused
extern int stop;
while (stop && playing)
+ {
usleep(10000);
+ }
now = GetTickCount();
osleep = t - now;
diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c
index 22db5d1..8aebd64 100644
--- a/libpcsxcore/new_dynarec/emu_if.c
+++ b/libpcsxcore/new_dynarec/emu_if.c
@@ -431,7 +431,7 @@ void do_insn_cmp() {}
#ifdef DRC_DISABLE
unsigned int address;
int pending_exception, stop;
-unsigned int next_interupt;
+u32 next_interupt;
int new_dynarec_did_compile;
int cycle_multiplier;
int new_dynarec_hacks;
diff --git a/libpcsxcore/new_dynarec/emu_if.h b/libpcsxcore/new_dynarec/emu_if.h
index 3980490..73f842b 100644
--- a/libpcsxcore/new_dynarec/emu_if.h
+++ b/libpcsxcore/new_dynarec/emu_if.h
@@ -89,7 +89,7 @@ extern void *scratch_buf_ptr;
extern u32 inv_code_start, inv_code_end;
/* cycles/irqs */
-extern unsigned int next_interupt;
+extern u32 next_interupt;
extern int pending_exception;
/* called by drc */
diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c
index e6d8a11..007b61e 100644
--- a/libpcsxcore/plugins.c
+++ b/libpcsxcore/plugins.c
@@ -205,7 +205,7 @@ void CALLBACK GPU__vBlank(int val) {}
#define LoadGpuSym1(dest, name) \
LoadSym(GPU_##dest, GPU##dest, name, TRUE);
-
+
#define LoadGpuSym0(dest, name) \
LoadSym(GPU_##dest, GPU##dest, name, FALSE); \
if (GPU_##dest == NULL) GPU_##dest = (GPU##dest) GPU__##dest;
@@ -368,93 +368,419 @@ static int LoadSPUplugin(const char *SPUdll) {
void *hPAD1Driver = NULL;
void *hPAD2Driver = NULL;
-static unsigned char buf[256];
-unsigned char stdpar[10] = { 0x00, 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-unsigned char mousepar[8] = { 0x00, 0x12, 0x5a, 0xff, 0xff, 0xff, 0xff };
-unsigned char analogpar[9] = { 0x00, 0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-static int bufcount, bufc;
-
-PadDataS padd1, padd2;
-
-unsigned char _PADstartPoll(PadDataS *pad) {
- bufc = 0;
-
+static int multitap1 = -1;
+static int multitap2 = -1;
+//Pad information, keystate, mode, config mode, vibration
+static PadDataS pad[8];
+
+static int reqPos, respSize, req;
+static int ledStateReq44[8];
+
+static unsigned char buf[256];
+static unsigned char bufMulti[34] = { 0x80, 0x5a,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+unsigned char stdpar[8] = { 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+unsigned char multitappar[34] = { 0x80, 0x5a,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+//response for request 44, 45, 46, 47, 4C, 4D
+static unsigned char resp45[8] = {0xF3, 0x5A, 0x01, 0x02, 0x00, 0x02, 0x01, 0x00};
+static unsigned char resp46_00[8] = {0xF3, 0x5A, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0A};
+static unsigned char resp46_01[8] = {0xF3, 0x5A, 0x00, 0x00, 0x01, 0x01, 0x01, 0x14};
+static unsigned char resp47[8] = {0xF3, 0x5A, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00};
+static unsigned char resp4C_00[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
+static unsigned char resp4C_01[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00};
+static unsigned char resp4D[8] = {0xF3, 0x5A, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF};
+
+//fixed reponse of request number 41, 48, 49, 4A, 4B, 4E, 4F
+static unsigned char resp40[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp41[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp43[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp44[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp49[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp4A[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp4B[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp4E[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static unsigned char resp4F[8] = {0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+// Resquest of psx core
+enum {
+ // REQUEST
+ // first call of this request for the pad, the pad is configured as an digital pad.
+ // 0x0X, 0x42, 0x0Y, 0xZZ, 0xAA, 0x00, 0x00, 0x00, 0x00
+ // X pad number (used for the multitap, first request response 0x00, 0x80, 0x5A, (8 bytes pad A), (8 bytes pad B), (8 bytes pad C), (8 bytes pad D)
+ // Y if 1 : psx request the full length response for the multitap, 3 bytes header and 4 block of 8 bytes per pad
+ // Y if 0 : psx request a pad key state
+ // ZZ rumble small motor 00-> OFF, 01 -> ON
+ // AA rumble large motor speed 0x00 -> 0xFF
+ // RESPONSE
+ // header 3 Bytes
+ // 0x00
+ // PadId -> 0x41 for digital pas, 0x73 for analog pad
+ // 0x5A mode has not change (no press on analog button on the center of pad), 0x00 the analog button have been pressed and the mode switch
+ // 6 Bytes for keystates
+ CMD_READ_DATA_AND_VIBRATE = 0x42,
+
+ // REQUEST
+ // Header
+ // 0x0N, 0x43, 0x00, XX, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ // XX = 00 -> Normal mode : Seconde bytes of response = padId
+ // XX = 01 -> Configuration mode : Seconde bytes of response = 0xF3
+ // RESPONSE
+ // enter in config mode example :
+ // req : 01 43 00 01 00 00 00 00 00 00
+ // res : 00 41 5A buttons state, analog states
+ // exit config mode :
+ // req : 01 43 00 00 00 00 00 00 00 00
+ // res : 00 F3 5A buttons state, analog states
+ CMD_CONFIG_MODE = 0x43,
+
+ // Set led State
+ // REQUEST
+ // 0x0N, 0x44, 0x00, VAL, SEL, 0x00, 0x00, 0x00, 0x00
+ // If sel = 2 then
+ // VAL = 00 -> OFF
+ // VAL = 01 -> ON
+ // RESPONSE
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ CMD_SET_MODE_AND_LOCK = 0x44,
+
+ // Get Analog Led state
+ // REQUEST
+ // 0x0N, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ // RESPONSE
+ // 0x00, 0xF3, 0x5A, 0x01, 0x02, VAL, 0x02, 0x01, 0x00
+ // VAL = 00 Led OFF
+ // VAL = 01 Led ON
+ CMD_QUERY_MODEL_AND_MODE = 0x45,
+
+ //Get Variable A
+ // REQUEST
+ // 0x0N, 0x46, 0x00, 0xXX, 0x00, 0x00, 0x00, 0x00, 0x00
+ // RESPONSE
+ // XX=00
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x01, 0x02, 0x00, 0x0A
+ // XX=01
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x01, 0x01, 0x01, 0x14
+ CMD_QUERY_ACT = 0x46,
+
+ // REQUEST
+ // 0x0N, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ // RESPONSE
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00
+ CMD_QUERY_COMB = 0x47,
+
+ // REQUEST
+ // 0x0N, 0x4C, 0x00, 0xXX, 0x00, 0x00, 0x00, 0x00, 0x00
+ // RESPONSE
+ // XX = 0
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00
+ // XX = 1
+ // 0x00, 0xF3, 0x5A, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00
+ CMD_QUERY_MODE = 0x4C,
+
+ // REQUEST
+ // 0x0N, 0x4D, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
+ // RESPONSE
+ // 0x00, 0xF3, 0x5A, old value or
+ // AA = 01 unlock large motor (and swap VAL1 and VAL2)
+ // BB = 01 unlock large motor (default)
+ // CC, DD, EE, FF = all FF -> unlock small motor
+ //
+ // default repsonse for analog pad with 2 motor : 0x00 0xF3 0x5A 0x00 0x01 0xFF 0xFF 0xFF 0xFF
+ //
+ CMD_VIBRATION_TOGGLE = 0x4D,
+ REQ40 = 0x40,
+ REQ41 = 0x41,
+ REQ49 = 0x49,
+ REQ4A = 0x4A,
+ REQ4B = 0x4B,
+ REQ4E = 0x4E,
+ REQ4F = 0x4F
+};
+
+
+
+
+//NO MULTITAP
+
+void initBufForRequest(int padIndex, char value){
+ switch (value){
+ //Pad keystate already in buffer
+ //case CMD_READ_DATA_AND_VIBRATE :
+ // break;
+ case CMD_CONFIG_MODE :
+ if(pad[padIndex].configMode == 1){
+ memcpy(buf, resp43, 8);
+ break;
+ }
+ //else, not in config mode, pad keystate return (already in the buffer)
+ break;
+ case CMD_SET_MODE_AND_LOCK :
+ memcpy(buf, resp44, 8);
+ break;
+ case CMD_QUERY_MODEL_AND_MODE :
+ memcpy(buf, resp45, 8);
+ break;
+ case CMD_QUERY_ACT :
+ memcpy(buf, resp46_00, 8);
+ break;
+ case CMD_QUERY_COMB :
+ memcpy(buf, resp47, 8);
+ break;
+ case CMD_QUERY_MODE :
+ memcpy(buf, resp4C_00, 8);
+ break;
+ case CMD_VIBRATION_TOGGLE :
+ memcpy(buf, resp4D, 8);
+ break;
+ case REQ40 :
+ memcpy(buf, resp40, 8);
+ break;
+ case REQ41 :
+ memcpy(buf, resp41, 8);
+ break;
+ case REQ49 :
+ memcpy(buf, resp49, 8);
+ break;
+ case REQ4A :
+ memcpy(buf, resp4A, 8);
+ break;
+ case REQ4B :
+ memcpy(buf, resp4B, 8);
+ break;
+ case REQ4E :
+ memcpy(buf, resp4E, 8);
+ break;
+ case REQ4F :
+ memcpy(buf, resp4F, 8);
+ break;
+ }
+}
+
+
+
+
+void reqIndex2Treatment(int padIndex, char value){
+ switch (req){
+ case CMD_CONFIG_MODE :
+ //0x43
+ if(value == 0){
+ pad[padIndex].configMode = 0;
+ }else{
+ pad[padIndex].configMode = 1;
+ }
+ break;
+ case CMD_SET_MODE_AND_LOCK :
+ //0x44 store the led state for change mode if the next value = 0x02
+ //0x01 analog ON
+ //0x00 analog OFF
+ ledStateReq44[padIndex] = value;
+ break;
+ case CMD_QUERY_ACT :
+ //0x46
+ if(value==1){
+ memcpy(buf, resp46_01, 8);
+ }
+ break;
+
+ case CMD_QUERY_MODE :
+ if(value==1){
+ memcpy(buf, resp4C_01, 8);
+ }
+ break;
+ case CMD_VIBRATION_TOGGLE :
+ //0x4D
+ memcpy(buf, resp4D, 8);
+ break;
+ case CMD_READ_DATA_AND_VIBRATE:
+ //mem the vibration value for small motor;
+ pad[padIndex].Vib[0] = value;
+ }
+}
+
+void vibrate(int padIndex){
+ if(pad[padIndex].Vib[0] != pad[padIndex].VibF[0] || pad[padIndex].Vib[1] != pad[padIndex].VibF[1]){
+ //value is different update Value and call libretro for vibration
+ pad[padIndex].VibF[0] = pad[padIndex].Vib[0];
+ pad[padIndex].VibF[1] = pad[padIndex].Vib[1];
+ plat_trigger_vibrate(padIndex, pad[padIndex].VibF[0], pad[padIndex].VibF[1]);
+ //printf("vibration pad %i", padIndex);
+ }
+}
+
+
+
+
+//Build response for 0x42 request Pad in port
+void _PADstartPoll(PadDataS *pad) {
switch (pad->controllerType) {
case PSE_PAD_TYPE_MOUSE:
- mousepar[3] = pad->buttonStatus & 0xff;
- mousepar[4] = pad->buttonStatus >> 8;
- mousepar[5] = pad->moveX;
- mousepar[6] = pad->moveY;
-
- memcpy(buf, mousepar, 7);
- bufcount = 6;
+ stdpar[0] = 0x12;
+ stdpar[2] = pad->buttonStatus & 0xff;
+ stdpar[3] = pad->buttonStatus >> 8;
+ stdpar[4] = pad->moveX;
+ stdpar[5] = pad->moveY;
+ memcpy(buf, stdpar, 6);
+ respSize = 6;
break;
case PSE_PAD_TYPE_NEGCON: // npc101/npc104(slph00001/slph00069)
- analogpar[1] = 0x23;
- analogpar[3] = pad->buttonStatus & 0xff;
- analogpar[4] = pad->buttonStatus >> 8;
- analogpar[5] = pad->rightJoyX;
- analogpar[6] = pad->rightJoyY;
- analogpar[7] = pad->leftJoyX;
- analogpar[8] = pad->leftJoyY;
-
- memcpy(buf, analogpar, 9);
- bufcount = 8;
+ stdpar[0] = 0x23;
+ stdpar[2] = pad->buttonStatus & 0xff;
+ stdpar[3] = pad->buttonStatus >> 8;
+ stdpar[4] = pad->rightJoyX;
+ stdpar[5] = pad->rightJoyY;
+ stdpar[6] = pad->leftJoyX;
+ stdpar[7] = pad->leftJoyY;
+ memcpy(buf, stdpar, 8);
+ respSize = 8;
break;
case PSE_PAD_TYPE_ANALOGPAD: // scph1150
- analogpar[1] = 0x73;
- analogpar[3] = pad->buttonStatus & 0xff;
- analogpar[4] = pad->buttonStatus >> 8;
- analogpar[5] = pad->rightJoyX;
- analogpar[6] = pad->rightJoyY;
- analogpar[7] = pad->leftJoyX;
- analogpar[8] = pad->leftJoyY;
-
- memcpy(buf, analogpar, 9);
- bufcount = 8;
+ stdpar[0] = 0x73;
+ stdpar[2] = pad->buttonStatus & 0xff;
+ stdpar[3] = pad->buttonStatus >> 8;
+ stdpar[4] = pad->rightJoyX;
+ stdpar[5] = pad->rightJoyY;
+ stdpar[6] = pad->leftJoyX;
+ stdpar[7] = pad->leftJoyY;
+ memcpy(buf, stdpar, 8);
+ respSize = 8;
break;
case PSE_PAD_TYPE_ANALOGJOY: // scph1110
- analogpar[1] = 0x53;
- analogpar[3] = pad->buttonStatus & 0xff;
- analogpar[4] = pad->buttonStatus >> 8;
- analogpar[5] = pad->rightJoyX;
- analogpar[6] = pad->rightJoyY;
- analogpar[7] = pad->leftJoyX;
- analogpar[8] = pad->leftJoyY;
-
- memcpy(buf, analogpar, 9);
- bufcount = 8;
+ stdpar[0] = 0x53;
+ stdpar[2] = pad->buttonStatus & 0xff;
+ stdpar[3] = pad->buttonStatus >> 8;
+ stdpar[4] = pad->rightJoyX;
+ stdpar[5] = pad->rightJoyY;
+ stdpar[6] = pad->leftJoyX;
+ stdpar[7] = pad->leftJoyY;
+ memcpy(buf, stdpar, 8);
+ respSize = 8;
break;
case PSE_PAD_TYPE_STANDARD:
- default:
- stdpar[3] = pad->buttonStatus & 0xff;
- stdpar[4] = pad->buttonStatus >> 8;
-
- memcpy(buf, stdpar, 5);
- bufcount = 4;
+ default:
+ stdpar[0] = 0x41;
+ stdpar[2] = pad->buttonStatus & 0xff;
+ stdpar[3] = pad->buttonStatus >> 8;
+ //avoid analog value in multitap mode if change pad type in game.
+ stdpar[4] = 0xff;
+ stdpar[5] = 0xff;
+ stdpar[6] = 0xff;
+ stdpar[7] = 0xff;
+ memcpy(buf, stdpar, 8);
+ respSize = 8;
}
-
- return buf[bufc++];
}
-unsigned char _PADpoll(unsigned char value) {
- if (bufc > bufcount) return 0;
- return buf[bufc++];
-}
-
-unsigned char CALLBACK PAD1__startPoll(int pad) {
- PadDataS padd;
+
+//Build response for 0x42 request Multitap in port
+//Response header for multitap : 0x80, 0x5A, (Pad information port 1-2A), (Pad information port 1-2B), (Pad information port 1-2C), (Pad information port 1-2D)
+void _PADstartPollMultitap(PadDataS padd[4]) {
+ int i = 0;
+ int offset = 2;
+ PadDataS pad;
+ for(i = 0; i < 4; i++) {
+ offset = 2 + (i * 8);
+ pad = padd[i];
+ _PADstartPoll(&pad);
+ memcpy(multitappar+offset, stdpar, 8);
+ }
+ memcpy(bufMulti, multitappar, 34);
+ respSize = 34;
+}
- PAD1_readPort1(&padd);
- return _PADstartPoll(&padd);
+unsigned char _PADpoll(int port, unsigned char value) {
+ if(reqPos==0){
+ //mem the request number
+ req = value;
+ //copy the default value of request response in buffer instead of the keystate
+ initBufForRequest(port,value);
+ }
+
+ //if no new request the pad return 0xff, for signaling connected
+ if ( reqPos >= respSize) return 0xff;
+
+ switch(reqPos){
+ case 2:
+ reqIndex2Treatment(port, value);
+ break;
+ case 3:
+ switch(req) {
+ case CMD_SET_MODE_AND_LOCK :
+ //change mode on pad
+ break;
+ case CMD_READ_DATA_AND_VIBRATE:
+ //mem the vibration value for Large motor;
+ pad[port].Vib[1] = value;
+ //vibration
+ vibrate(port);
+ break;
+
+ break;
+ }
+ }
+ return buf[reqPos++];
+}
+
+
+unsigned char _PADpollMultitap(int port, unsigned char value) {
+ if ( reqPos >= respSize) return 0xff;
+ return bufMulti[reqPos++];
+}
+
+
+// refresh the button state on port 1.
+// int pad is not needed.
+unsigned char CALLBACK PAD1__startPoll(int pad) {
+ reqPos = 0;
+ // first call the pad provide if a multitap is connected between the psx and himself
+ if(multitap1 == -1){
+ PadDataS padd;
+ padd.requestPadIndex = 0;
+ PAD1_readPort1(&padd);
+ multitap1 = padd.portMultitap;
+ }
+ // just one pad is on port 1 : NO MULTITAP
+ if (multitap1 == 0){
+ PadDataS padd;
+ padd.requestPadIndex = 0;
+ PAD1_readPort1(&padd);
+ _PADstartPoll(&padd);
+ } else {
+ // a multitap is plugged : refresh all pad.
+ int i=0;
+ PadDataS padd[4];
+ for(i = 0; i < 4; i++) {
+ padd[i].requestPadIndex = i;
+ PAD1_readPort1(&padd[i]);
+ }
+ _PADstartPollMultitap(padd);
+ }
+ //printf("\npad 1 : ");
+ return 0x00;
}
-unsigned char CALLBACK PAD1__poll(unsigned char value) {
- return _PADpoll(value);
+unsigned char CALLBACK PAD1__poll(unsigned char value) {
+ char tmp;
+ if(multitap1 == 1){
+ tmp = _PADpollMultitap(0, value);
+ }else{
+ tmp = _PADpoll(0, value);
+ }
+ //printf("%2x:%2x, ",value,tmp);
+ return tmp;
+
}
+
long CALLBACK PAD1__configure(void) { return 0; }
void CALLBACK PAD1__about(void) {}
long CALLBACK PAD1__test(void) { return 0; }
@@ -497,16 +823,57 @@ static int LoadPAD1plugin(const char *PAD1dll) {
return 0;
}
-unsigned char CALLBACK PAD2__startPoll(int pad) {
- PadDataS padd;
-
- PAD2_readPort2(&padd);
-
- return _PADstartPoll(&padd);
+unsigned char CALLBACK PAD2__startPoll(int pad) {
+ reqPos = 0;
+ int pad_index = 0;
+ if(multitap1 == 0 && multitap2 == 0){
+ pad_index += 1;
+ }else if(multitap1 == 1 && multitap2 == 0){
+ pad_index += 4;
+ }else if(multitap1 == 0 && multitap2 == 2){
+ pad_index += 1;
+ }else if(multitap1 == 1 && multitap2 == 2){
+ pad_index += 4;
+ }
+
+ //first call the pad provide if a multitap is connected between the psx and himself
+ if(multitap2 == -1){
+ PadDataS padd;
+ padd.requestPadIndex = pad_index;
+ PAD2_readPort2(&padd);
+ multitap2 = padd.portMultitap;
+ }
+
+ // just one pad is on port 1 : NO MULTITAP
+ if (multitap2 == 0){
+ PadDataS padd;
+ padd.requestPadIndex = pad_index;
+ PAD2_readPort2(&padd);
+ _PADstartPoll(&padd);
+ } else {
+ // a multitap is plugged : refresh all pad.
+ //a multitap is plugged : refresh all pad.
+ int i=0;
+ PadDataS padd[4];
+ for(i=0;i<4;i++){
+ padd[i].requestPadIndex = i+pad_index;
+ PAD2_readPort2(&padd[i]);
+ }
+ _PADstartPollMultitap(padd);
+ }
+ //printf("\npad 2 : ");
+ return 0x00;
}
unsigned char CALLBACK PAD2__poll(unsigned char value) {
- return _PADpoll(value);
+ char tmp;
+ if(multitap2 == 2){
+ tmp = _PADpollMultitap(1, value);
+ }else{
+ tmp = _PADpoll(1, value);
+ }
+ //printf("%2x:%2x, ",value,tmp);
+ return tmp;
}
long CALLBACK PAD2__configure(void) { return 0; }
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c
index 292d80d..d5ed725 100644
--- a/libpcsxcore/psxbios.c
+++ b/libpcsxcore/psxbios.c
@@ -2216,6 +2216,15 @@ void psxBios_ChangeClearPad() { // 5b
pc0 = ra;
}
+void psxBios__card_status() { // 5c
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x5c], a0);
+#endif
+
+ v0 = 1;
+ pc0 = ra;
+}
+
/* System calls C0 */
/*
@@ -2569,7 +2578,7 @@ void psxBiosInit() {
//biosB0[0x59] = psxBios_sys_b0_59;
//biosB0[0x5a] = psxBios_sys_b0_5a;
biosB0[0x5b] = psxBios_ChangeClearPad;
- //biosB0[0x5c] = psxBios__card_status;
+ biosB0[0x5c] = psxBios__card_status;
//biosB0[0x5d] = psxBios__card_wait;
//*******************C0 CALLS****************************
//biosC0[0x00] = psxBios_InitRCnt;
diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c
index b3732d2..d251fa7 100644
--- a/libpcsxcore/sio.c
+++ b/libpcsxcore/sio.c
@@ -117,6 +117,20 @@ void sioWrite8(unsigned char value) {
break;
}
}
+ // NegCon - Wipeout 3
+ if( buf[parp] == 0x23 ) {
+ switch (value) {
+ // enter config mode
+ case 0x43:
+ buf[1] = 0x79;
+ break;
+
+ // get status
+ case 0x45:
+ buf[1] = 0xf3;
+ break;
+ }
+ }
}
else padst = 0;
return;
diff --git a/libpcsxcore/socket.c b/libpcsxcore/socket.c
index 31f82e2..c408bc3 100644
--- a/libpcsxcore/socket.c
+++ b/libpcsxcore/socket.c
@@ -15,6 +15,22 @@
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
+#ifdef NO_SOCKET
+
+int StartServer() { return 0;}
+void StopServer() {}
+void GetClient() {}
+void CloseClient() {}
+int HasClient() { return 0;}
+int ReadSocket(char * buffer, int len) { return 0;}
+int RawReadSocket(char * buffer, int len) { return 0;}
+void WriteSocket(char * buffer, int len) {}
+
+void SetsBlock() {}
+void SetsNonblock() {}
+
+#else // NO_SOCKET
+
#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -252,3 +268,4 @@ void SetsNonblock() {
fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
#endif
}
+#endif // NO_SOCKET