#define array_size(x) (sizeof(x) / sizeof(x[0]))
+/* this sucks, but EvilDragon wants it */
+#ifdef VALIDATION
+#define NUB_RANGE_REQ (256-8*3)
+#else
+#define NUB_RANGE_REQ 256
+#endif
+
typedef struct {
int x, y;
int code;
text_out16(fb + 200, 32*2 + x1/8, 32*2 + y1/8, 0x001f, "@");
text_out16(fb + 450, 32*2 + x2/8, 32*2 + y2/8, 0x001f, "@");
- if (x1 == -256) nub_range_hit |= 0x01;
- if (x1 == 256) nub_range_hit |= 0x02;
- if (y1 == -256) nub_range_hit |= 0x04;
- if (y1 == 256) nub_range_hit |= 0x08;
- if (x2 == -256) nub_range_hit |= 0x10;
- if (x2 == 256) nub_range_hit |= 0x20;
- if (y2 == -256) nub_range_hit |= 0x40;
- if (y2 == 256) nub_range_hit |= 0x80;
+ if (x1 <= -NUB_RANGE_REQ) nub_range_hit |= 0x01;
+ if (x1 >= NUB_RANGE_REQ) nub_range_hit |= 0x02;
+ if (y1 <= -NUB_RANGE_REQ) nub_range_hit |= 0x04;
+ if (y1 >= NUB_RANGE_REQ) nub_range_hit |= 0x08;
+ if (x2 <= -NUB_RANGE_REQ) nub_range_hit |= 0x10;
+ if (x2 >= NUB_RANGE_REQ) nub_range_hit |= 0x20;
+ if (y2 <= -NUB_RANGE_REQ) nub_range_hit |= 0x40;
+ if (y2 >= NUB_RANGE_REQ) nub_range_hit |= 0x80;
snprintf(buff, sizeof(buff), "%3i", x1/8);
text_out16_small(fb, 235, 130, (nub_range_hit & 0x03) == 0x03 ? 0xce6f : 0x7bef, buff);
int nubx[2] = {0,0}, nuby[2] = {0,0};
int pressed_l = 0, pressed_r = 0;
struct tsdev *ts = NULL;
+ int retval = 0;
fbdev = open("/dev/fb0", O_RDWR);
if (fbdev == -1)
#ifdef VALIDATION
int early_leave_attempt = 0;
text_out16_small(screen, 220, 3, 0x7bef,
- "press menu/pandora to shutdown, L+Start to exit");
+ "press menu/pandora to exit");
#else
text_out16_small(screen, 320, 3, 0x7bef, "Press L+R to exit");
#endif
fd_set fdset;
#ifdef VALIDATION
- if (early_leave_attempt) {
+ if (early_leave_attempt > 1) {
char buff[128];
snprintf(buff, sizeof(buff), "not everything tested (%s%s%s%s), L+R to override",
nub_range_hit == 0xff ? "" : "nubs", all_btns_tested ? "" : " buttons",
memset(screen, 0, 800*12*2);
if (nub_range_hit == 0xff && all_btns_tested && lid_tested && ts_tested)
text_out16_small(screen, 220, 3, 0x07c0,
- "press menu/pandora to shutdown, L+Start to exit");
+ "press menu/pandora to exit");
else
text_out16_small(screen, 4, 3, 0xf800, buff);
}
if (ev[i].code == KEY_RIGHTCTRL)
pressed_r = !!ev[i].value;
#ifdef VALIDATION
- if (ev[i].code == KEY_LEFTALT && !!ev[i].value && pressed_l) {
+ if (ev[i].code == KEY_MENU && !!ev[i].value) {
if (nub_range_hit == 0xff && all_btns_tested && lid_tested && ts_tested)
goto end;
- if (pressed_l && pressed_r)
- goto end;
- early_leave_attempt = 1;
- }
- if (ev[i].code == KEY_MENU && !!ev[i].value) {
- if ((nub_range_hit == 0xff && all_btns_tested && lid_tested && ts_tested) ||
- (pressed_l && pressed_r)) {
- sync();
- system("poweroff -f");
+ if (pressed_l && pressed_r) {
+ retval = 1;
goto end;
}
- early_leave_attempt = 1;
+ early_leave_attempt++;
}
#endif
if (ev[i].code == KEY_LEFT)
close(ifd[i]);
munmap(screen, 800*480*2);
close(fbdev);
- return 0;
+ return retval;
}