From: notaz Date: Wed, 6 Sep 2023 20:47:23 +0000 (+0300) Subject: some lightgun selection mechanism X-Git-Tag: r24l~193 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b591888c4aec568da64ea2897e9ad8bbf33cea1;p=pcsx_rearmed.git some lightgun selection mechanism --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 32d27f5d..b64c3cae 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -518,6 +518,10 @@ void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in) { } +void pl_gun_byte2(int port, unsigned char byte) +{ +} + /* sound calls */ static void snd_feed(void *buf, int bytes) { diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index bdf09c71..2a417a4d 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -634,6 +634,10 @@ void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in) *yres = psx_h; } +void pl_gun_byte2(int port, unsigned char byte) +{ +} + #define MAX_LAG_FRAMES 3 #define tvdiff(tv, tv_old) \ diff --git a/include/psemu_plugin_defs.h b/include/psemu_plugin_defs.h index b855eacc..8645eab7 100644 --- a/include/psemu_plugin_defs.h +++ b/include/psemu_plugin_defs.h @@ -222,7 +222,9 @@ typedef struct //configuration mode Request 0x43 int configMode; - unsigned char reserved[87]; + + unsigned char txData[32]; + unsigned char reserved[56]; //Lightgun values int absoluteX,absoluteY; diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 6886a6a0..4516b5ce 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -745,10 +745,18 @@ unsigned char _PADpoll(int port, unsigned char value) { } } + if (reqPos < sizeof(pad[port].txData)) + pad[port].txData[reqPos] = value; + //if no new request the pad return 0xff, for signaling connected if (reqPos >= respSize) return 0xff; + if (in_type[port] == PSE_PAD_TYPE_GUN) { + if (reqPos == 2) + pl_gun_byte2(port, value); + } + else switch(reqPos){ case 2: reqIndex2Treatment(port, value); diff --git a/plugins/dfinput/externals.h b/plugins/dfinput/externals.h index 2e216fdc..822fa2c5 100644 --- a/plugins/dfinput/externals.h +++ b/plugins/dfinput/externals.h @@ -10,6 +10,7 @@ void dfinput_activate(void); #define GUNIN_BTNB (1<<2) #define GUNIN_TRIGGER2 (1<<3) /* offscreen trigger */ extern void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in); +extern void pl_gun_byte2(int port, unsigned char byte); /* vibration trigger to frontend */ extern int in_enable_vibration;