From 5ced3945423cda0010597b27b7da6bce77b12baa Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 15 Oct 2022 23:08:09 +0300 Subject: [PATCH] adjust multitap code to interact with standalone better --- libpcsxcore/plugins.c | 30 +++++++++++++----------------- plugins/dfinput/main.c | 2 +- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index c806b672..b143923b 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -371,8 +371,8 @@ extern int in_type[8]; void *hPAD1Driver = NULL; void *hPAD2Driver = NULL; -static int multitap1 = -1; -static int multitap2 = -1; +static int multitap1; +static int multitap2; //Pad information, keystate, mode, config mode, vibration static PadDataS pad[8]; @@ -650,7 +650,7 @@ void _PADstartPoll(PadDataS *pad) { memcpy(buf, stdpar, 8); respSize = 8; break; - case PSE_PAD_TYPE_GUNCON: // GUNCON - gun controller SLPH-00034 from Namco + case PSE_PAD_TYPE_GUNCON: // GUNCON - gun controller SLPH-00034 from Namco stdpar[0] = 0x63; stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; @@ -816,12 +816,6 @@ unsigned char _PADpollMultitap(int port, unsigned char value) { 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; @@ -872,6 +866,7 @@ long CALLBACK PAD1__keypressed() { return 0; } if (PAD1_##dest == NULL) PAD1_##dest = (PAD##dest) PAD1__##dest; static int LoadPAD1plugin(const char *PAD1dll) { + PadDataS padd; void *drv; hPAD1Driver = SysLoadLibrary(PAD1dll); @@ -894,6 +889,10 @@ static int LoadPAD1plugin(const char *PAD1dll) { LoadPad1Sym0(poll, "PADpoll"); LoadPad1SymN(setSensitive, "PADsetSensitive"); + padd.requestPadIndex = 0; + PAD1_readPort1(&padd); + multitap1 = padd.portMultitap; + return 0; } @@ -909,14 +908,6 @@ unsigned char CALLBACK PAD2__startPoll(int pad) { pad_index = 0; } - //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; @@ -965,6 +956,7 @@ long CALLBACK PAD2__keypressed() { return 0; } LoadSym(PAD2_##dest, PAD##dest, name, FALSE); static int LoadPAD2plugin(const char *PAD2dll) { + PadDataS padd; void *drv; hPAD2Driver = SysLoadLibrary(PAD2dll); @@ -987,6 +979,10 @@ static int LoadPAD2plugin(const char *PAD2dll) { LoadPad2Sym0(poll, "PADpoll"); LoadPad2SymN(setSensitive, "PADsetSensitive"); + padd.requestPadIndex = 0; + PAD2_readPort2(&padd); + multitap2 = padd.portMultitap; + return 0; } diff --git a/plugins/dfinput/main.c b/plugins/dfinput/main.c index 4f1d03f6..5d676c47 100644 --- a/plugins/dfinput/main.c +++ b/plugins/dfinput/main.c @@ -20,7 +20,7 @@ extern unsigned char CALLBACK PAD2__startPoll(int pad); extern unsigned char CALLBACK PAD1__poll(unsigned char value); extern unsigned char CALLBACK PAD2__poll(unsigned char value); -#ifndef HAVE_LIBRETRO +#if 0 //ndef HAVE_LIBRETRO static int old_controller_type1 = -1, old_controller_type2 = -1; -- 2.39.2