#49072 - Dwedit - Tue Jul 26, 2005 6:04 am
The scale for calibration is totally out of whack. Clicking on the edge instead clicks on a pixel around 16 pixels towards the center of the screen. So drawing a box in DS paint instead draws a box about 16 pixels away from the edge in all directions. It's also impossible to click on buttons at the top or bottom or sides of the screen.
Sounds like buggy touchscreen code in a common nds library.
Commercial games work perfectly, aside from the occasional problem where it spontaneously moves to the bottom of the screen for one frame.
Edit: Doing a re-calibrate fixed the problems, but why was it broken for non-commercial games in the first place?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
Last edited by Dwedit on Tue Jul 26, 2005 6:54 am; edited 1 time in total
#49075 - dovoto - Tue Jul 26, 2005 6:38 am
Seems dead-on to me. Did you forget to recalibrate after doing flashme?
_________________
www.drunkencoders.com
#49091 - Freakreation - Tue Jul 26, 2005 11:05 am
I think I have this problem, I updated my firmware before trying battleship DS and I assumed there was a problem with the code (since I hadn't previousely tried any demos before using FlashMe). I never read anything about having to re-calibrate the touch screen.
Looking again at the FlashMe instructions it doesn't mention it on there at all. I shall try it out now tho. =)
#49105 - dovoto - Tue Jul 26, 2005 3:59 pm
Flashme over-writes all those settings....hopefully this is the only issue. Let me know if it does not fix it and then we will look into the ndslib code and see if we cant find the cause.
_________________
www.drunkencoders.com
#49110 - MrAdults - Tue Jul 26, 2005 5:22 pm
Quote: |
Flashme over-writes all those settings....hopefully this is the only issue. Let me know if it does not fix it and then we will look into the ndslib code and see if we cant find the cause. |
I have this issue with my touchscreen as well. It's perfectly accurate in commercial games (such as Super Mario 64), but homebrew stuff seems to not scale to the edges properly so everything is more toward the center than it should be.
I haven't used FlashMe, and it's also worth noting that I've never manually calibrated my DS. I'm wondering if maybe the location in memory that calibration data is read from (as we do things now) is only valid if the system has been manually calibrated already. I've been meaning to do some testing on this myself but I haven't gotten around to it yet.
-Rich
#49112 - dovoto - Tue Jul 26, 2005 5:27 pm
I will look at me ds more closely tonight. Maybe i just have not noticed this error.
_________________
www.drunkencoders.com
#49117 - natrium42 - Tue Jul 26, 2005 5:59 pm
I think it's because of different calibration points. Precalibrated DS uses calibration points 16 pixels from the edge, but manual calibration has control points that are 32 pixels from the edge. Anyway, it can be fixed with a corrected calculation routine, AFAIK.
EDIT: I might be wrong with the numbers.
_________________
www.natrium42.com
#49119 - Sausage Boy - Tue Jul 26, 2005 6:16 pm
Yes! Finally other people have my problem!
I get the same thing exactly, perfect calibration in commercial games. In homebrew games, the touch is moved slightly towards the center, depending on how far away from it you touch. I've tried recalibrating, I've even tried calibrating it wrong so it would be right, but nothing works...
_________________
"no offense, but this is the gayest game ever"
#49123 - natrium42 - Tue Jul 26, 2005 6:34 pm
There are a few more registers besides TOUCH_CAL_xx that give the location of control points. Currenty, those registers are not used and it's assumed that the control points used for callibration were at one certain location.
Don't have the registers at hand right now, though...
_________________
www.natrium42.com
#49126 - Freakreation - Tue Jul 26, 2005 6:43 pm
yep I just re-calibrated and still have the same problem with Battleships mainly towards the bottom of the screen it seems to be distorted.
#49131 - natrium42 - Tue Jul 26, 2005 6:57 pm
Freakreation wrote: |
yep I just re-calibrated and still have the same problem with Battleships mainly towards the bottom of the screen it seems to be distorted. |
Battleship has a very poor touchscreen routine... I should really start working on it again :)
_________________
www.natrium42.com
#49284 - natrium42 - Thu Jul 28, 2005 5:05 am
Here is the correct way to read touchscreen. Should also work with factory calibrated DS.
Code: |
#define SCREEN_WIDTH 256
#define SCREEN_HEIGHT 192
// those are pixel positions of the two points you click when calibrating
#define TOUCH_CNTRL_X1 (*(vu8*)0x027FFCDC)
#define TOUCH_CNTRL_Y1 (*(vu8*)0x027FFCDD)
#define TOUCH_CNTRL_X2 (*(vu8*)0x027FFCE2)
#define TOUCH_CNTRL_Y2 (*(vu8*)0x027FFCE3)
// those are the corresponding touchscreen values:
#define TOUCH_CAL_X1 (*(vu16*)0x027FFCD8)
#define TOUCH_CAL_Y1 (*(vu16*)0x027FFCDA)
#define TOUCH_CAL_X2 (*(vu16*)0x027FFCDE)
#define TOUCH_CAL_Y2 (*(vu16*)0x027FFCE0)
// linear mapping can be used to go from touchscreen position to pixel position
// precalculate some values
static int16 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;
static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - TOUCH_CNTRL_X1;
static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - TOUCH_CNTRL_Y1;
// reading pixel position:
int16 x = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) TOUCH_CNTRL_X1;
int16 y = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) TOUCH_CNTRL_Y1;
|
_________________
www.natrium42.com