notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
provide DISABLE_MEM_LUTS default
[pcsx_rearmed.git]
/
frontend
/
pl_gun_ts.c
diff --git
a/frontend/pl_gun_ts.c
b/frontend/pl_gun_ts.c
index
de7fe11
..
6c05b7c
100644
(file)
--- a/
frontend/pl_gun_ts.c
+++ b/
frontend/pl_gun_ts.c
@@
-15,7
+15,13
@@
#include "plugin_lib.h"
#include "pl_gun_ts.h"
#include "menu.h"
#include "plugin_lib.h"
#include "pl_gun_ts.h"
#include "menu.h"
-#include "../plugins/dfinput/main.h"
+
+#ifdef MAEMO
+#define N900_TSMAX_X 4096
+#define N900_TSOFFSET_X 0
+#define N900_TSMAX_Y 4096
+#define N900_TSOFFSET_Y 0
+#endif
static int gun_x, gun_y, gun_in;
static int ts_multiplier_x, ts_multiplier_y, ts_offs_x, ts_offs_y;
static int gun_x, gun_y, gun_in;
static int ts_multiplier_x, ts_multiplier_y, ts_offs_x, ts_offs_y;
@@
-34,7
+40,11
@@
int pl_gun_ts_update_raw(struct tsdev *ts, int *x, int *y, int *p)
if (ts != NULL) {
while (pts_read(ts, &sample, 1) > 0) {
sx = sample.x;
if (ts != NULL) {
while (pts_read(ts, &sample, 1) > 0) {
sx = sample.x;
+#ifdef MAEMO
+ sy = N900_TSMAX_Y - sample.y;
+#else
sy = sample.y;
sy = sample.y;
+#endif
sp = sample.pressure;
updated = 1;
}
sp = sample.pressure;
updated = 1;
}
@@
-45,9
+55,9
@@
int pl_gun_ts_update_raw(struct tsdev *ts, int *x, int *y, int *p)
limit(gun_x, 0, 1023);
limit(gun_y, 0, 1023);
if (sp && !(g_opts & OPT_TSGUN_NOTRIGGER))
limit(gun_x, 0, 1023);
limit(gun_y, 0, 1023);
if (sp && !(g_opts & OPT_TSGUN_NOTRIGGER))
- gun_in |=
GUNIN_TRIGGER
;
+ gun_in |=
1
;
else
else
- gun_in &= ~
GUNIN_TRIGGER
;
+ gun_in &= ~
1
;
}
}
}
}
@@
-61,6
+71,7
@@
int pl_gun_ts_update_raw(struct tsdev *ts, int *x, int *y, int *p)
return 0;
}
return 0;
}
+/* returns x, y in range 0..1023 (normalized to visible layer) */
void pl_gun_ts_update(struct tsdev *ts, int *x, int *y, int *in)
{
pl_gun_ts_update_raw(ts, NULL, NULL, NULL);
void pl_gun_ts_update(struct tsdev *ts, int *x, int *y, int *in)
{
pl_gun_ts_update_raw(ts, NULL, NULL, NULL);
@@
-95,9
+106,13
@@
struct tsdev *pl_gun_ts_init(void)
struct tsdev *ts;
void *ltsh;
struct tsdev *ts;
void *ltsh;
+#ifdef MAEMO
+ tsdevname = "/dev/input/ts";
+#else
tsdevname = getenv("TSLIB_TSDEVICE");
if (tsdevname == NULL)
tsdevname = "/dev/input/touchscreen0";
tsdevname = getenv("TSLIB_TSDEVICE");
if (tsdevname == NULL)
tsdevname = "/dev/input/touchscreen0";
+#endif
// avoid hard dep on tslib
ltsh = dlopen("/usr/lib/libts-1.0.so.0", RTLD_NOW|RTLD_GLOBAL);
// avoid hard dep on tslib
ltsh = dlopen("/usr/lib/libts-1.0.so.0", RTLD_NOW|RTLD_GLOBAL);
@@
-122,18
+137,27
@@
struct tsdev *pl_gun_ts_init(void)
}
ts = pts_open(tsdevname, 1);
}
ts = pts_open(tsdevname, 1);
- if (ts == NULL)
+ if (ts == NULL){
+ printf("Failed pts_open, check permission on %s\n", tsdevname);
goto fail_open;
goto fail_open;
- if (pts_config(ts) != 0)
+ }
+ if (pts_config(ts) != 0){
+ printf("Failed pts_config\n");
goto fail_config;
goto fail_config;
+ }
// FIXME: we should be able to get this somewhere
// the problem is this doesn't always match resolution due to different display modes
// FIXME: we should be able to get this somewhere
// the problem is this doesn't always match resolution due to different display modes
+#ifdef MAEMO
+ pl_set_gun_rect(N900_TSOFFSET_X, N900_TSOFFSET_Y, N900_TSMAX_X, N900_TSMAX_Y);
+#else
#ifdef __ARM_ARCH_7A__
pl_set_gun_rect(0, 0, 800, 480);
#else
pl_set_gun_rect(0, 0, 320, 240);
#endif
#ifdef __ARM_ARCH_7A__
pl_set_gun_rect(0, 0, 800, 480);
#else
pl_set_gun_rect(0, 0, 320, 240);
#endif
+#endif
+ printf("Touchscreen configured, device=%s\n", tsdevname);
return ts;
fail_config:
return ts;
fail_config: