X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Fgp2x.c;h=0276038b5ad96b54f7f699f1b540dabb497781bf;hb=16b0afd0294a8acde173e2973f9a35eafe0bd185;hp=78e8561f857034c6a6bf16d7876238bfd3e4d2d9;hpb=85a4b5a4a26f22389c4dbe3f95a2f31452ff7579;p=picodrive.git diff --git a/platform/gp2x/gp2x.c b/platform/gp2x/gp2x.c index 78e8561..0276038 100644 --- a/platform/gp2x/gp2x.c +++ b/platform/gp2x/gp2x.c @@ -36,6 +36,7 @@ #include "gp2x.h" #include "usbjoy.h" #include "../common/arm_utils.h" +#include "../common/arm_linux.h" volatile unsigned short *gp2x_memregs; //static @@ -162,9 +163,7 @@ void gp2x_video_wait_vsync(void) void gp2x_video_flush_cache(void) { // since we are using the mmu hack, we must flush the cache first - // (the params are most likely wrong, but they seem to work somehow) - //flushcache(addr, addr + 320*240*2, 0); - flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0); + cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2); } @@ -231,21 +230,24 @@ typedef struct ucb1x00_ts_event int gp2x_touchpad_read(int *x, int *y) { UCB1X00_TS_EVENT event; + static int zero_seen = 0; int retval; if (touchdev < 0) return -1; retval = read(touchdev, &event, sizeof(event)); - if (retval < 0) { + if (retval <= 0) { printf("touch read failed %i %i\n", retval, errno); return -1; } + // this is to ignore the messed-up 4.1.x driver + if (event.pressure == 0) zero_seen = 1; if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16; if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16; // printf("read %i %i %i\n", event.pressure, *x, *y); - return event.pressure; + return zero_seen ? event.pressure : 0; }