aboutsummaryrefslogtreecommitdiff
path: root/frontend/pl_gun_ts.c
diff options
context:
space:
mode:
authornotaz2011-10-30 21:18:18 +0200
committernotaz2011-10-30 23:57:12 +0200
commit50306d8d6e20ede70c2dea274ae1099082aea88f (patch)
tree1c05fe2602cc521b16eccb8413c4ca861de71032 /frontend/pl_gun_ts.c
parent90f1c767f07b95fe39a344eaa96f629cd7efe1ba (diff)
downloadpcsx_rearmed-50306d8d6e20ede70c2dea274ae1099082aea88f.tar.gz
pcsx_rearmed-50306d8d6e20ede70c2dea274ae1099082aea88f.tar.bz2
pcsx_rearmed-50306d8d6e20ede70c2dea274ae1099082aea88f.zip
frontend: input: make in_ts use ts_gun
..to stop them stealing each other's events
Diffstat (limited to 'frontend/pl_gun_ts.c')
-rw-r--r--frontend/pl_gun_ts.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/frontend/pl_gun_ts.c b/frontend/pl_gun_ts.c
index 2c02251..de7fe11 100644
--- a/frontend/pl_gun_ts.c
+++ b/frontend/pl_gun_ts.c
@@ -19,14 +19,14 @@
static int gun_x, gun_y, gun_in;
static int ts_multiplier_x, ts_multiplier_y, ts_offs_x, ts_offs_y;
-int (*pts_read)(struct tsdev *dev, struct ts_sample *sample, int nr);
-int (*pts_fd)(struct tsdev *dev);
+static int (*pts_read)(struct tsdev *dev, struct ts_sample *sample, int nr);
+static int (*pts_fd)(struct tsdev *dev);
#define limit(v, min, max) \
if (v < min) v = min; \
else if (v > max) v = max
-void pl_gun_ts_update(struct tsdev *ts, int *x, int *y, int *in)
+int pl_gun_ts_update_raw(struct tsdev *ts, int *x, int *y, int *p)
{
struct ts_sample sample;
int sx = 0, sy = 0, sp = 0, updated = 0;
@@ -51,6 +51,20 @@ void pl_gun_ts_update(struct tsdev *ts, int *x, int *y, int *in)
}
}
+ if (updated) {
+ if (x) *x = sx;
+ if (y) *y = sy;
+ if (p) *p = sp;
+ return 1;
+ }
+
+ return 0;
+}
+
+void pl_gun_ts_update(struct tsdev *ts, int *x, int *y, int *in)
+{
+ pl_gun_ts_update_raw(ts, NULL, NULL, NULL);
+
*x = gun_x;
*y = gun_y;
*in = gun_in | in_state_gun;
@@ -64,6 +78,14 @@ void pl_set_gun_rect(int x, int y, int w, int h)
ts_multiplier_y = (1<<20) / h;
}
+int pl_gun_ts_get_fd(struct tsdev *ts)
+{
+ if (ts != NULL && pts_fd != NULL)
+ return pts_fd(ts);
+
+ return -1;
+}
+
struct tsdev *pl_gun_ts_init(void)
{
struct tsdev *(*pts_open)(const char *dev_name, int nonblock) = NULL;
@@ -81,6 +103,8 @@ struct tsdev *pl_gun_ts_init(void)
ltsh = dlopen("/usr/lib/libts-1.0.so.0", RTLD_NOW|RTLD_GLOBAL);
if (ltsh == NULL)
ltsh = dlopen("/usr/lib/libts-0.0.so.0", RTLD_NOW|RTLD_GLOBAL);
+ if (ltsh == NULL)
+ ltsh = dlopen("/lib/libts-0.0.so.0", RTLD_NOW|RTLD_GLOBAL);
if (ltsh == NULL) {
fprintf(stderr, "%s\n", dlerror());
goto fail;