Woopsi2x abandoned (GP2x misc)

ant512 was about to port Woopsi to the GP2x, but then abadoned it. Woopsi is a Nintendo DS GUI library for rapidly creating user interfaces for homebrew software. Modelled after the AmigaOS windowing system.

Read on:

Woopsi2x Abandoned
January 25th, 2008
Tinkering with and researching the GP2xรขโ‚ฌโ„ขs touch screen reveals some answers to the questions posed last time around.

First off, my GP2x isnรขโ‚ฌโ„ขt duff. Thereรขโ‚ฌโ„ขs another guy here who has discovered the same problem I have – the only readily-available example of using the touch screen on the GP2x jitters like crazy.

Iรขโ‚ฌโ„ขve tried swapping batteries, which often causes problems with the console, to no effect.

Testing the read() function reveals that the touchscreen will produce new values every time it is interrogated. Thereรขโ‚ฌโ„ขs no need to wait for a VBL before it will produce new values. This means that my initial jitter-removal routine based on mean averages was actually doing something. Iรขโ‚ฌโ„ขve increased the sample count from 5 to 40, which has improved things a lot, but itรขโ‚ฌโ„ขs still nowhere near perfect.

I realised that Iรขโ‚ฌโ„ขve got no idea what the รขโ‚ฌล“open(รขโ‚ฌยdev/touchscreen/wm97xxรขโ‚ฌย)รขโ‚ฌย command does. Does it access the raw hardware, or does it just open a driver? Not having done any Linux kernel hacking I couldnรขโ‚ฌโ„ขt say. Iรขโ‚ฌโ„ขve looked through the driver sourcecode and it appears to have some jitter correction built-in. It definitely compensates for some of the quirks of the hardware. If the open() command works with the driver, thereรขโ‚ฌโ„ขs something seriously wrong if Iรขโ‚ฌโ„ขm still getting wildly different values back each time I poll the screen. If Iรขโ‚ฌโ„ขm working with the hardware, Iรขโ‚ฌโ„ขll have to re-implement the driver for the 2x in order to get any decent values from the it.

Some digging around in the code for the 2xรขโ‚ฌโ„ขs port of ScummVM suggests that the author built a time delay into its touch screen routines to cater for the jitter. At least that way youรขโ‚ฌโ„ขre guaranteed to get steady values for the duration of the delay. Works fine for Scumm, as it doesnรขโ‚ฌโ„ขt really require fine control. No good for Woopsi – any jitter is immediately obvious. One clever idea the author had was to use the SDL_WarpMouse() command to move SDLรขโ‚ฌโ„ขs cursor to match the GP2xรขโ‚ฌโ„ขs stylus position. This triggers an SDL_MOUSEMOVE event, which can then be interpreted in a standard SDL event parser block without any custom code. Neat.

The official SDK has no documentation. Nothing. There doesnรขโ‚ฌโ„ขt seem to be any way to get the sourcecode, either (which is rapidly becoming my favourite way to understand a program – donรขโ‚ฌโ„ขt tell me how it works, just show me the code).

Coupled with the fact that the GP2x has been abandoned by the majority of coders in favour of the forthcoming รขโ‚ฌล“Pandoraรขโ‚ฌย system (which looks like a weird cross between a 48K Spectrum, a dual-shock PS1 pad, a DS and an N-Gage), I think creating a GP2x port would be a painful waste of time. Shame, because the new d-pad does actually make it quite a good system.

Hereรขโ‚ฌโ„ขs the touchscreen class I came up with (credit to the author of the original รขโ‚ฌล“touchscreen_sample.zipรขโ‚ฌย file, who neglected to include his details in the zip):

GP2xTouchScreen

Iรขโ‚ฌโ„ขve switched it from using Woopsi-style รขโ‚ฌล“u8?, รขโ‚ฌล“u16?, etc types to using SDL-style รขโ‚ฌล“uint8_tรขโ‚ฌย types. I havenรขโ‚ฌโ„ขt compiled it since then, but it should be OK. Consider the archive public domain.

EDIT:

Increasing the number of samples to 100 further increases the accuracy, but has a noticeable impact on speed. It doesnรขโ‚ฌโ„ขt solve the problem of the touch screen occasionally producing totally incorrect values. Having noticed that the amount of pressure needed to trigger a response isnรขโ‚ฌโ„ขt even vaguely uniform across the surface of the touch screen, Iรขโ‚ฌโ„ขm growing more and more certain that GamePark skimped on the touch screen and used components that fell off the back of a lorry.

http://ant.simianzombie.com/blog/

This article is over 2 years old — the linked page may have changed, moved, or been taken over since then.

No Comments

You must be logged in to post a comment.