gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Trying to avoid Stylus Jumping!! The scene needs you!!

#99911 - PadrinatoR - Thu Aug 24, 2006 7:07 pm

As it seems that no one is reading the other thread (http://forum.gbadev.org/viewtopic.php?t=7980&start=120&postdays=0&postorder=asc) I have decided to open this new one hoping that it will be read even by the most lazy ones :D :P

As you may know, there is a very annoying problem with the touchscreen that produces jumps when you touch the touchscreen gently. Last few days I've been modifying libnds code in order to achieve a good reading of the touchscreen.

I ask you to test the last method and tell me your results, please. It will help us to fix this annoying ?bug?

Well, here is the link: http://www.ftp.nu/files/5434/

You must test 2 things:

1) Can you draw in the whole screen?? (In some zones you may need to touch harder)

2) If you touch gently the screen... do jumping lines appear??

Thank you in advance.

#99927 - laurens - Thu Aug 24, 2006 7:37 pm

As i told, theres no problems for me, at all!

#99929 - PadrinatoR - Thu Aug 24, 2006 7:44 pm

laurens wrote:
As i told, theres no problems for me, at all!


This is a new version... have you tested it?

#99934 - HyperHacker - Thu Aug 24, 2006 8:07 pm

It doesn't jump, but light touches are ignored often. If I'm not pressing hard on the screen as I draw, it just ignores the touch altogether. The pressure often goes negative and shows something like 00-25. I also can't reach the top right or bottom left. As I draw along the top the line actually slants downward. This doesn't happen with any other app.
My DS was V1 originally, so it's old.
_________________
I'm a PSP hacker now, but I still <3 DS.

#99936 - PadrinatoR - Thu Aug 24, 2006 8:17 pm

HyperHacker wrote:
It doesn't jump, but light touches are ignored often. If I'm not pressing hard on the screen as I draw, it just ignores the touch altogether.


Yes, light touches produce incorrect values, so they're ignored. If I didn't ignore them, there would be jumping lines.

HyperHacker wrote:
The pressure often goes negative and shows something like 00-25.


OK, that values are ignored, don't worry :)

HyperHacker wrote:
I also can't reach the top right or bottom left. As I draw along the top the line actually slants downward. This doesn't happen with any other app.


How many pixels does it slant downward? A "normal" (in this test) behaviour is that the border lines appear 0, 1 or 2 pixels displaced from its correct position. Is that what you have noticed? Or it's more displaced?

Thank you for answering ;)

#99938 - Goosey - Thu Aug 24, 2006 8:19 pm

A little birdy told me to try polling the screen every 4 ms and keeping a running value in memory. Maybe some fancy averaging stuff.

#99942 - tepples - Thu Aug 24, 2006 9:10 pm

Works for me. (DS classic, originally fw2)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#99946 - PadrinatoR - Thu Aug 24, 2006 9:34 pm

Goosey wrote:
A little birdy told me to try polling the screen every 4 ms and keeping a running value in memory. Maybe some fancy averaging stuff.


I'll try it but... I think that's not the solution because you can get an invalid value in every moment :S

#100015 - Thomas - Fri Aug 25, 2006 12:27 pm

Works fine on my old DS Phat, you only need to apply some more pressure than usual to make it register your touch. But it doesn't jump at all, the touch position is very stable.

#100058 - PadrinatoR - Fri Aug 25, 2006 9:00 pm

Hi!

As I say here: http://forum.gbadev.org/viewtopic.php?t=7980&start=135

I'm disassembling a commercial game. I started with Polarium but now I'm disassembling Brain Training.

I've got the algorithm which reads the touchscreen in Brain Training, but it doesn't seem to be enough to avoid stylus jumping.

This is the algorithm:

Code:
SORRY, I'M CORRECTING IT


It's only a semi-literal translation from assembler to C (a lot of lines can be combined), and it works and gives good results, but doesn't eliminate jumping problem.

I've seen some curious things:

- It doesn't read Z1 and Z2 values (used to calculate stylus pressure).
- It reads only TEMP1 sensor, but not TEMP2.
- It reads the AUX sensor in two ways: 8bit transfer (0xEC) and 12bit transfer (0xE4).

These three things occurs in Wario Ware Touched, Brain Training and Polarium (the only three games I've disassembled).

Also, the three games read first TEMP1 sensor and then PENIRQ, so I'm thinking it may be a stabilizer or something like that, which lets Nintendo take correct data from the touchscreen. At the moment, I don't know when AUX1 is read.

More things... I've not found in ARM7 code any calibration algorithm and I'm not able to find it in ARM9 code (I don't know if IDA Pro disassembles it right, but something tells me it doesn't, because I'm not able to find any stylus code :S). If someone could say me how to detect User Settings reading, I'll thank him a lot :D

That's all! I'll continue studying asm code haha

#100064 - HyperHacker - Fri Aug 25, 2006 10:00 pm

PadrinatoR wrote:
HyperHacker wrote:
It doesn't jump, but light touches are ignored often. If I'm not pressing hard on the screen as I draw, it just ignores the touch altogether.


Yes, light touches produce incorrect values, so they're ignored. If I didn't ignore them, there would be jumping lines.

Well that's just the problem... making it too sensitive creates jumps, but making it not sensitive enough makes it ignore valid light touches. In Pictochat I can drag my stylus lightly across the screen and draw a line no problem, but in this app I'd only get the occasional dot. If a happy medium can't be found that stops the jumping while allowing light touches, maybe we'll have to start storing some pressure sensitivity value in an unused firmware region. (Or maybe there already is one.)

Quote:
HyperHacker wrote:
The pressure often goes negative and shows something like 00-25.


OK, that values are ignored, don't worry :)

OK, but just to clarify, I meant it actually says "00-25", not zero to 25.

Quote:
HyperHacker wrote:
I also can't reach the top right or bottom left. As I draw along the top the line actually slants downward. This doesn't happen with any other app.


How many pixels does it slant downward? A "normal" (in this test) behaviour is that the border lines appear 0, 1 or 2 pixels displaced from its correct position. Is that what you have noticed? Or it's more displaced?

It's fine at the top left and bottom right but about 6 pixels out of place at the top right and bottom left.
_________________
I'm a PSP hacker now, but I still <3 DS.

#100414 - PadrinatoR - Sun Aug 27, 2006 7:53 pm

Thanks HyperHacker. I continue studying source from commercial games. As I said in my previous post, Nintendo doesn't measure Z1 and Z2, so there is no pressure limitation or something like that.

I've found in Tetris DS ARM9 source the place where calibration points are used and I've got the algorithm used to convert from ADC coordinates to SCR coordinates. Now I can confirm that there is no more calibration data, Tetris DS only uses the two known points.

Now I'm looking for the code that ensures that read data from touchscreen is not erroneous, and what's the meaning of some memory zones.

#100418 - Lick - Sun Aug 27, 2006 8:17 pm

Go Go Go Padrinator!

Really, I'm behind all your investigation. I believe that it will help the scene, perhaps unnoticed, but still it helps awfully much. You're a great guy!
_________________
http://licklick.wordpress.com

#100427 - PadrinatoR - Sun Aug 27, 2006 8:54 pm

hahaha thank you very much, Lick!!

I think this is the most important feature of Nintendo DS: the touchscreen, and it's important to get it working fine.



Mmm I've noticed an interesting thing... stylus jumping is present in Another Code: Two Memories :S I touched gently the borders of the screen and the cursor (used to investigate something) jumped a little.

#100517 - PadrinatoR - Mon Aug 28, 2006 12:10 pm

More data:

- As I said before, TEMP1 sensor is read but information is not stored anywhere.

- It seems that Nintendo modifies 'range' variable automatically. The range is a value from 20 to 35 and it is adjusted depending on last read data. The code is something like this (remember that it's ported from asm to C++):

Code:

static uint8 counter_1 = 0;
static uint8 counter_2 = 0;
static uint8 range = 20;
static uint8 min_range = 20;

void UpdateRange(uint8 *range, uint16 dist_max_in_last_reading){
   if(touchscreen_touched){
      if(!error_reading_data){
         counter_2 = 0;
         if(dist_max_in_last_reading >= ((*range) >> 1)){
            counter_1 = 0;
         }else{
            counter_1++;
            if(counter_1 >= 4){
               counter_1 = 0;
               if((*range) > min_range){
                  (*range)--;
                  counter_2 = 3;
               }
            }
         }
      }else{
         counter_1 = 0;
         counter_2++;
         if(counter_2 >= 4){
            counter_2 = 0;
            if((*range) < 35){
               (*range)++;
            }
         }
      }
   }else{
      counter_2 = 0;
      counter_1 = 0;
   }
}


dist_max_in_last_reading is a variable which stores the max. distance between values in the last reading (because when Nintendo reads the touchscreen, they take 5 values and compare all with all and get the highest distance. And it's the highest between the maximum distance when reading X and the maximum distance when reading Y.


Last edited by PadrinatoR on Tue Aug 29, 2006 9:47 pm; edited 1 time in total

#100527 - PadrinatoR - Mon Aug 28, 2006 1:25 pm

I've ported the function that checks if stylus was pressed. It's called before and after measure X and Y coordiantes... why?? I don't know... In addition, as I said in a previous post, Nintendo measures the TEMP1 sensor first (but not stores information about it anywhere) and then checks REG_KEYXY ( called EXTKEYIN in: http://nocash.emubase.de/gbatek.htm#dskeypad ).

Well, here you have the mentioned code:

Code:
u8 CheckStylus(void){
   SerialWaitBusy();

   REG_SPICNT = 0x8A01;
   REG_SPIDATA = 0x84;

   SerialWaitBusy();

   REG_SPIDATA = 0;

   SerialWaitBusy();

   REG_SPICNT = 0x8201;
   REG_SPIDATA = 0;

   SerialWaitBusy();

   if(last_time_touched){
      if( !(REG_KEYXY & 0x40) )
         return 1;
      else{
         REG_SPICNT = 0x8A01;
         REG_SPIDATA = 0x84;

         SerialWaitBusy();

         REG_SPIDATA = 0;

         SerialWaitBusy();

         REG_SPICNT = 0x8201;
         REG_SPIDATA = 0;

         SerialWaitBusy();

         return !(REG_KEYXY & 0x40) ? 2 : 0;
      }
   }else{
      return !(REG_KEYXY & 0x40) ? 1 : 0;
   }
}


In the first call, before measuring X and Y, it doesn't matter if the function returns 1 or 2, because both values are interpreted as a pen touch, but in the second call, after measuring X and Y, these values are taken into account and it has different consequences. It's "more valid" a 1 than a 2. Zero will always mean that stylus wasn't touching the screen.


Last edited by PadrinatoR on Tue Aug 29, 2006 10:28 pm; edited 1 time in total

#100669 - PadrinatoR - Tue Aug 29, 2006 1:33 pm

More algorithms. This is the algorithm used by Nintendo to convert from ADC values to SCR values:

Code:
static int32 a, b, c, d;

void PrecalculateCalibrationData(void){   
   c = ((PersonalData->calX1 - PersonalData->calX2) << 8)/(PersonalData->calX1px - PersonalData->calX2px);
   d = ((PersonalData->calY1 - PersonalData->calY2) << 8)/(PersonalData->calY1px - PersonalData->calY2px);
   
   a = ((((PersonalData->calX1 + PersonalData->calX2) << 8) - (c * (PersonalData->calX1px + PersonalData->calX2px))) << 9) >> 16;
   b = ((((PersonalData->calY1 + PersonalData->calY2) << 8) - (d * (PersonalData->calY1px + PersonalData->calY2px))) << 9) >> 16;

   c = 0x10000000 / c;
   d = 0x10000000 / d;
}

void ADC_to_SCR(uint16 adc_x, uint16 adc_y, u8 *scr_x, u8 *scr_y){
   s64 aux4;
   uint32 aux1, aux2, aux3, aux5, aux6, aux7, aux8;

   aux1 = adc_x << 2;
   aux2 = aux1 >> 31;
   aux1 -= a;
   aux3 = aux2 - (a >> 31);
   aux4 = (c * aux1);
   aux5 = (c * aux3) + (aux4 >> 32);
   aux6 = c >> 31;
   aux7 = (aux6 * aux1) + aux5;
   aux8 = ((aux4 << 32) >> 32) >> 22;
   aux8 = aux8 | (aux7 << 10);
   *scr_x = aux8;

   aux1 = adc_y << 2;
   aux2 = aux1 >> 31;
   aux1 -= b;
   aux3 = aux2 - (b >> 31);
   aux4 = (d * aux1);
   aux5 = (d * aux3) + (aux4 >> 32);
   aux6 = d >> 31;
   aux7 = (aux6 * aux1) + aux5;
   aux8 = ((aux4 << 32) >> 32) >> 22;
   aux8 = aux8 | (aux7 << 10);
   *scr_y = aux8;
}


Yes, I know that this code is very... "ugly", it is ported instruction by instruction from asm code. If someone wants to reduce it... it works perfectly as I've posted it. My main target is to avoid stylus jumping.

Both functions are executed in ARM9 using these division "commands":
http://nocash.emubase.de/gbatek.htm#dsmaths

As I could see, there are only 2 calibration points, so we can discard any hidden calibration point which doesn't let us get the right coordinates of the screen.

#101117 - PadrinatoR - Sat Sep 02, 2006 8:03 pm

OK!! I think I've got all the algorithms used by Nintendo to get the stylus working right in Tetris DS Downloadable Demo but... it doesn't seem to be enough, so I've modified the code a little and it seems to be very very accurate.

The only ugly thing is that with the Nintendo algorithm, it seems that the first touch is not interpreted correctly but... I'm tired and fed up with assembler code haha

I think that Tetris is not the best game to disassemble, but I haven't got Pictochat's binary and Brain Training is not disassembled correctly (only ARM7 is well disassembled, but the important part is on ARM9, because ARM7 code is almost the same in all games).

If anyone knows how to get Pictochat's binary from firmware, please, send me an email or a PM.

The new test is here:

http://www.ftp.nu/files/5567/

I've run it in 2 DS's, in both I can draw in the whole screen and one have more jumps than the other one, but they're veeeeery small jumps.

Tell me your results, please :)

#101129 - yal - Sat Sep 02, 2006 10:18 pm

It work just well on my Ds (very old model), I have no stylus jumping at all :)

Regarding the corner, I'm about at 6 or 7 pixels from the top, 3 from the left, 4 or 5 from the right, and 0 from the bottom.

#101130 - PadrinatoR - Sat Sep 02, 2006 10:21 pm

Have you tried to re-calibrate it?

#101131 - yal - Sat Sep 02, 2006 10:25 pm

I just did, and I got almost the same result. I am maybe 1 pixel closer from the top now

#101179 - spinal_cord - Sun Sep 03, 2006 5:59 pm

I've got a 2 pixel gap bottom and right, 1 pixel left and 0 pixels top.
As for the accuracy, its the most accurate I've ever seen, and i didn't notice any jumping even with light presses.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#101188 - Mrshlee - Sun Sep 03, 2006 7:13 pm

This was almost perfect.. I didn't have a single jumps or light touches lines..
The lines I did have were pretty much drawn perfect.

Very impressive. hope this is included in Devkitpro :D
_________________
MrShlee.com
Projects
Dev-Scene
MyTechpedia

#101193 - tepples - Sun Sep 03, 2006 7:58 pm

Gaps between the side of the screen and the side of the touchable area are caused by the tip of the stylus, whose radius is larger than 1 pixel.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#101271 - HyperHacker - Mon Sep 04, 2006 3:03 am

Hm, if someone knew how to grab Pictochat's binary from firmware, it might be possible to make a program that makes a .nds from it out of a firmware dump. That'd be a nice legal way to provide Pictochat for people who use homebrew firmware; just have them dump their current FW first, then they can run the .nds whenever.
Heck, maybe the entire firmware could be made a .nds. :p
_________________
I'm a PSP hacker now, but I still <3 DS.

#101302 - PadrinatoR - Mon Sep 04, 2006 9:16 am

Thank you for answering :D

PadrinatoR wrote:
The only ugly thing is that with the Nintendo algorithm, it seems that the first touch is not interpreted correctly but... I'm tired and fed up with assembler code haha


I was wrong, that 'ugly thing' was my fault, because I modified PAlib in order to fix a bug... and I created a new bug hahaha

I have Pictochat's binary (at least I have a BIOS dump of NDS) but I'm not able to disassemble it because I don't know where is the entry point of the program.

Then, at this point, I'm very pleased with the results because they're near to Nintendo ones (they are not able to avoid stylus jumping completely), so I've finished my investigation. If someone is not convinced enough and wants to continue studying stylus jumping, you can send me a PM and I will inform you of everything I did to disassemble comercial games and find stylus code.

You may be wondering why I said 'they are near to Nintendo results' if I've disassembled Nintendo's games. The answer is: disassembling and interpreting code from a binary requires to suppose a lot of things and my ports are not exactly the same code that Nintendo wrote. The only algorithms perfectly ported from commercial games have been posted in this thread. The rest of them may not be exactly the same, but as you have seen they seem to work pretty well :)

Well, I'm gonna add this new method to the last libnds and PAlib and upload it to let you to download and use it :) Obviously the source code is included in the package ^^


Last edited by PadrinatoR on Mon Sep 04, 2006 11:53 am; edited 1 time in total

#101304 - MelGibson - Mon Sep 04, 2006 9:28 am

Thanks PadrinatoR for all the effort you have put in :)

#101308 - melw - Mon Sep 04, 2006 9:51 am

So far the best homebrew touchscreen implementation for sure. Didn't get any jumping with light touches and the accurancy is ok as well. What comes to the padding - I have also some pixels of space on the left and top borders, but I believe it's the same what comes to commercial games - they just don't use the whole screen for drawing or input in most cases. +1 vote for getting this included in libnds & excellent work, Padrinator!

#101317 - masscat - Mon Sep 04, 2006 12:00 pm

Good work PadrinatoR (the joys of looking through assembler), your code works very well for me.

I think the original cause of the jumping maybe mechanical, a bit like boucing with switches. That is, there is a point where a touchscreen is just giving a reading (not 0). Any less presure and the reading is going to be invalid (would read as zero). If this change were to happen during conversion then the reading is going to be rubbish. Having never worked with touchscreens before I do not know if this sort of thing happens.

#101323 - PadrinatoR - Mon Sep 04, 2006 12:24 pm

As I promised, I've uploaded all the stuff.

libnds 19 July 2006 - Modified by PadrinatoR
PAlib 2 September 2006 - Modified by PadrinatoR
DrawIt NO JUMPING - FINAL TEST - By PadrinatoR

libnds and PAlib have a changes.txt to orient you if you wanna see what changes I've made in both libs.

That's all!! Enjoy it!!

EDIT: Thank you for your comments!! :D I only want a big NDS scene... so we'll need to use our stylus!! haha

#101363 - zzo38computer - Mon Sep 04, 2006 7:12 pm

This is good. With these codes, I can add calibration to FWNITRO.
_________________
Important: Please send messages about FWNITRO to the public forum, not privately to me.

#101375 - PadrinatoR - Mon Sep 04, 2006 7:56 pm

Feel free to use them ;)

I don't know if the third calibration point is important, I only know that it's not used to convert ADC values to pixels.
_________________
DSAmp: control Winamp with your Nintendo DS

#101403 - zzo38computer - Tue Sep 05, 2006 3:24 am

I don't have time now, but when I have time I will do it.
_________________
Important: Please send messages about FWNITRO to the public forum, not privately to me.

#101611 - yal - Wed Sep 06, 2006 9:29 pm

I tried your version of libnds and now the stylus doesn't work at all on my project :(

Is there any change to make in the stylus code to use your new version of the lib?

Here is the code I use to read the stylus

Code:
void CNdsApp::ProcessInput()
{
   // read the button states
   // read the touchscreen coordinates
   scanKeys();   
   touchPosition touch = touchReadXY();
   
   SScreenCoordinate TouchPos;
   TouchPos.bValid   = true;
   TouchPos.x      = touch.px;
   TouchPos.y      = touch.py;

   if (keysDown() & KEY_TOUCH)
   {
      OnTouch(TouchPos);
      m_bPreviouslyTouching = true;
   }
   else if (keysHeld() & KEY_TOUCH)
      OnMove(TouchPos);
   else if (m_bPreviouslyTouching)
   {
      m_bPreviouslyTouching = false;
      OnUnTouch(TouchPos);
   }
}


It worked fine on emulator and with the jumping probleme on DS, but now it doesn't work neither on DS nor on emu (I tried Ideas, dualis and no$gba). When I touch the screen, my cursor move in the left top corner and don't want to move anymore.

Could you post some code snippet of the good way to use the stylus with your modification?

#101613 - PadrinatoR - Wed Sep 06, 2006 9:34 pm

Is that code executed in ARM7 or ARM9?
_________________
DSAmp: control Winamp with your Nintendo DS

#101614 - yal - Wed Sep 06, 2006 9:37 pm

It's on Arm9, sorry, I forgot to mention it.
I used the Arm9 template of libnds for my project

#101617 - PadrinatoR - Wed Sep 06, 2006 9:42 pm

Ok! My modification of libnds adds a new field to touchPosition struct: 'touched'.

This field is updated in touchReadXY and tells you if stylus touching is considered as a valid touch, so you must use it to detect if the user is using the touchscreen.
_________________
DSAmp: control Winamp with your Nintendo DS

#101619 - yal - Wed Sep 06, 2006 9:46 pm

so I should replace my

if (keysDown() & KEY_TOUCH)

by

if (touch.touched)

or should I test both like that?

if ((keysDown() & KEY_TOUCH) && touch.touched)

EDIT:
I tried both, and none of them seam to work :(
actually I even tried
if (touch.touched)
ASSERT(false);

And my assert never happen (tested both on emu and hardware)


Last edited by yal on Wed Sep 06, 2006 9:58 pm; edited 1 time in total

#101622 - PadrinatoR - Wed Sep 06, 2006 9:56 pm

It should be enough using touch.touched. I haven't used libnds because I use PAlib. If you want you can see PAlib/lib/arm9/PA/PA_Keys.c and look for PA_UpdateStylus function. It has only this code:

Code:
void PA_UpdateStylus(void) {

   touchPosition touchPos = touchReadXY();

   Stylus.Newpress = touchPos.touched && !Stylus.Held;
   Stylus.Released = Stylus.Held && !touchPos.touched;
   Stylus.Held = touchPos.touched;
   Stylus.X = touchPos.px;
   Stylus.Y = touchPos.py;
   Stylus.Pressure = (((touchPos.x* touchPos.z2) >> 6) / touchPos.z1) - (touchPos.x >> 6);   
}


This is the only code used by PAlib to read the touchscreen. I hope it helps you ;)

I think Stylus struct fields of PAlib are self-explainatory but if you need more help, ask me what you want, I'll try to help you as much as I can :D
_________________
DSAmp: control Winamp with your Nintendo DS

#101626 - yal - Wed Sep 06, 2006 10:11 pm

This is pretty much what I do, exept for the pressure that I don't understand, what is it for?

The things is that I don't seem to have touchPos.touched == true ever. I put an assert there, and it never happen.

Is there something to initialize somewhere that I might have forget?

To install your lib, I just need to copy the file right? the source are here just for information, I wasn't suppose to compile anything myself?

#101628 - PadrinatoR - Wed Sep 06, 2006 10:16 pm

You only have to use "my" libnds replacing the official ones. Obviously you have to compile them.
_________________
DSAmp: control Winamp with your Nintendo DS

#101629 - yal - Wed Sep 06, 2006 10:30 pm

If by "compile them" you mean compile the source of the lib, it's not that obvious since your distrib of the lib came with libnds7.a and libnds9.a that seemed already compiled to me :)

Anyway, I used make.bat to compile the lib, it went fine, and it updated libnds7.a and libnds9.a but it didn't solved my problem at all :(

I'm done for tonight, time to have some sleep. I'll try to check pa_lib source code tomorow.

EDIT:
I just noticed that your version for libnds is from the 19 july and the one for pa_lib from the 2 september, is that normal?

#101630 - PadrinatoR - Wed Sep 06, 2006 10:33 pm

Sorry!! I think I did a 'make clean' before compress it :S

If you want, you can send me your project and I can try to find the problem.
_________________
DSAmp: control Winamp with your Nintendo DS

#101633 - yal - Wed Sep 06, 2006 10:46 pm

Quote:
Sorry!! I think I did a 'make clean' before compress it :S

What for? It's easier for people that use your lib to not have to compile it themselve, at least I prefer not to having to compile :)

That would be nice, I just hope the bug won't be to ambarassing for me ;)
I'll send you a PM right away.

#101672 - abszero - Thu Sep 07, 2006 9:42 am

For what it's worth, I'm experiencing the same problems yal describes.

As a simple test of the new routines, I've been fiddling with the two libnds input examples, touch_look and TouchTest. I've tried a number of things in both, but nothing seems to work properly when using the modified libnds.

It's especially clear in TouchTest since it reports the perceived stylus coordinates. Compiling TouchTest as it comes in a fresh install of devkitpro gives me a version that works well except for the usual glitches at low pen pressure. Compiling and linking the modified libnds on the other hand causes the coordinates to go nuts, changing in ways that aren't correlated with how you move the pen at all.

Now, I've only been dealing with DS development very seriously for about 24 hours now, so it's entirely possible I'm doing something stupid. But I don't see anything obvious. And just for the record, I'm using a DS Lite with one of the new M3 Lite MicroSDs, so that could have some effect too perhaps.

#101689 - PadrinatoR - Thu Sep 07, 2006 2:28 pm

Hi! I've been looking for a mistake in yal's source and it seems to be all correct but... I've noticed that touchPosition struct is messed up O_o

I mean that for example touch.x is touch.y and touch.y is touch.px... and the rest of fields doesn't correspond with any logical value.

I'll be away for 4 days, I'll return on Sunday, so I'll try to find the error before I go out this afternoon.

Thanks for your comments!
_________________
DSAmp: control Winamp with your Nintendo DS

#101690 - yal - Thu Sep 07, 2006 2:36 pm

I got two tests in mind that I'll do tonight, but if you want to try it before leaving, here they are :

change your struct from

Quote:

typedef struct touchPosition {
u8 error;
u8 touched;
int16 x;
int16 y;
int16 px;
int16 py;
int16 z1;
int16 z2;
} touchPosition;


to

Quote:

typedef struct touchPosition {
u8 error;
u8 touched;
int16 x;
int16 y;
int16 px;
int16 py;
int16 z1;
int16 z2;
u8 error;
u8 touched;
} touchPosition;


And see if the value are still messed up, and how.

The second test would be to move my ProcessInput() into a C file and call it from my CPP class. That would be very weird if it fix the problem, but since your best guess for now is that it work with C and not CPP, it might worth the try.

good luck :)

#101692 - PadrinatoR - Thu Sep 07, 2006 2:49 pm

Mmmm I don't know how are libnds projects organized... where is ARM7 code?
_________________
DSAmp: control Winamp with your Nintendo DS

#101693 - yal - Thu Sep 07, 2006 2:58 pm

Quote:
Mmmm I don't know how are libnds projects organized... where is ARM7 code?


If you are talking about my project, I don't know at all, but I was more than happy to not have to take care about it :)

I though it was all embeded into a lib with a minimal version of the code that threat input and others things for people that don't want to bother with 2 cpus

#101694 - PadrinatoR - Thu Sep 07, 2006 3:01 pm

Well I say it because in PAlib I had to modify ARM7 code, because there is where read data from touchscreen is sent by IPC to ARM9. I think you're using a precompiled ARM7 code that is obviously not updated and it produces this weird effects. I think that can be the reason :S
_________________
DSAmp: control Winamp with your Nintendo DS

#101695 - yal - Thu Sep 07, 2006 3:06 pm

That was I was thinking to :)

The things is why is this precompiled code not rebuild when you build the lib and how do I rebuild it with the new lib.

Maybe this is something that has more to deal with DevKitPro than only with libnds.

#101699 - PadrinatoR - Thu Sep 07, 2006 3:11 pm

Yes, may be the templates located in examples/nds??
_________________
DSAmp: control Winamp with your Nintendo DS

#101701 - yal - Thu Sep 07, 2006 3:17 pm

Yes, that's the one I used as a starting point,. If my memory is right (I don't have devkit pro here) there is two template, one for using the two processor, and one for using only the arm9 (that's the one I used).
But I don't remember having copying anything else than source file and makefile from there. I don't remember any lib in this directory.
Maybe the makefile have a reference to a lib placed somewhere else.

#101703 - PadrinatoR - Thu Sep 07, 2006 3:21 pm

I've not found anything... :S

But it's needed ARM7 code as it is the only processor which has access to the touchscreen O_o
_________________
DSAmp: control Winamp with your Nintendo DS

#101704 - yal - Thu Sep 07, 2006 3:27 pm

Sorry, I can't be of any further help from here right now :(

I'll take a look tonight, but since I'm not very familiar with makefile, I doubt I'll be able to found anything you missed.

I think we could use the help of some devkitpro "expert", I'm sure there is some people that should know that over here.

#102366 - PadrinatoR - Wed Sep 13, 2006 9:01 am

I've found the problem!

In only-arm9 projects, ndstool includes a default arm7 binary that, obviously, wasn't updated. I've been able to update and compile this binary but I'm not able to compile ndstool :'(

I hope someone can help me!
_________________
DSAmp: control Winamp with your Nintendo DS

#102369 - PadrinatoR - Wed Sep 13, 2006 9:39 am

Ok! I've compiled ndstools and now BlokusDS works fine :D

I must go out so when I came I'll upload the modified ndstools ;)
_________________
DSAmp: control Winamp with your Nintendo DS

#102381 - yal - Wed Sep 13, 2006 12:48 pm

It's great, I'll have to test that :)
Unfortunately I'm in the middle of a big code modification and I won't be able to test it before a little while :(

Do you plan to integrate that in DevKitPro ?

#102383 - PadrinatoR - Wed Sep 13, 2006 2:01 pm

ndstool - Modified by PadrinatoR

Here it is, there is a readme file which explains you what you must do.

:D
_________________
DSAmp: control Winamp with your Nintendo DS

#102388 - Lick - Wed Sep 13, 2006 3:23 pm

Thanks PadrinatoR!

I replaced the original tool (after backing up o/c) with yours [for arm9-only projects] and I will try out your arm7 vblank code [for combined projects]. However, I can't say that I have any trouble with the current implementation so I will not be able to give you feedback.

Why don't you release the code as a library, instead of a mod of an existing library? I can imagine that the arm9-only needs to be 'replaced' but if people manually code the arm7, then your algorithms can be called from their code. I think that's a lot better than having the users to replace the include and lib directories.
_________________
http://licklick.wordpress.com

#102396 - PypeBros - Wed Sep 13, 2006 4:31 pm

that seems to behave _way_ better than the original code from libnds. can't wait to have it integrated in my sprite editor :P
_________________
SEDS: Sprite Edition on DS :: modplayer

#102420 - PadrinatoR - Wed Sep 13, 2006 11:25 pm

Lick wrote:
Why don't you release the code as a library, instead of a mod of an existing library? I can imagine that the arm9-only needs to be 'replaced' but if people manually code the arm7, then your algorithms can be called from their code. I think that's a lot better than having the users to replace the include and lib directories.


Because it's only a modification based on a big and complete library :P

yal wrote:
Do you plan to integrate that in DevKitPro ?


I haven't got "rights" to do it haha But I hope it will be included.
_________________
DSAmp: control Winamp with your Nintendo DS

#102484 - PypeBros - Thu Sep 14, 2006 12:04 pm

weirdo. while the drawtest worked perfectly, i cannot have my app working.

I replaced the files mentionned in the changelog of http://www.ftp.nu/files/5586/ (libnds), modified the ndstool, recompiled everything, and still, whenever i touch the screen, touchReadXY() on ARM9 seems to report coordinates (0,0) everytime :P

the files i replaced:
./tools/nds/ndstool/DefaultArm7/source/main.c.org
./libnds/source/arm7/touch.c.org
./libnds/source/arm9/touch.c.org
./libnds/include/nds/arm7/touch.h.org
./libnds/include/nds/arm9/input.h.org
./libnds/include/nds/jtypes.h.org
./libnds/include/nds/ipc.h.org


--- edit:
hmm. obviously, touch.x and touch.y are still updated, but not touch.px and touch.py which my code relies on ...
--- edit again:
after crawling through touch.c code, it looks like nothing on the ARM9 invokes PrecalculateCalibrationData() in my copy of libnds ... just adding it in the application's initialization did the trick (having a,b,c,d scaling coefficient all equal to zero couldn't produce very interesting .px, .py)
_________________
SEDS: Sprite Edition on DS :: modplayer

#102488 - PadrinatoR - Thu Sep 14, 2006 2:25 pm

mmm the modified ndstool has a readme.txt which tells you what you have to do with ndstool.exe, the modified source is in the rar in order to make easy including it in the next devKitPro :P
_________________
DSAmp: control Winamp with your Nintendo DS

#102490 - PypeBros - Thu Sep 14, 2006 2:54 pm

PadrinatoR wrote:
mmm the modified ndstool has a readme.txt which tells you what you have to do with ndstool.exe, the modified source is in the rar in order to make easy including it in the next devKitPro :P


well, as i'm running only linux here, there's little chance i could use ndstool.exe, even if you give plenty of details in the readme.txt...

btw, i finally managed to rebuild the libnds and ndstool so that they use your patched source. There's one thing that intrigue me, though:
Code:

   if( dword_211A6B0 == 0 ){
        touchPos.px = aux3;
        touchPos.py = aux4;
   }


when i leave that code block, it seems that all the "single" clicks (i mean, pressed&KEY_TOUCH rather than held&KEY_TOUCH) are reported at the previous location ... that makes my "GUI" engine behave rather weirdly (e.g. the engine select the widget with 'press' and track 'moves' until you release the stylus. If the 'press' isn't right, all the moves are ignored until you return to the widget that is selected)

commenting the above block worked fine for me, though i don't have the time to check i have no stylus jumping with that version right now :P
_________________
SEDS: Sprite Edition on DS :: modplayer

#102515 - PadrinatoR - Thu Sep 14, 2006 9:24 pm

Arggh!! My Windows-mind didn't let me think in other OS xDD

Ok, can you post your stylus code? I think it shouldn't give you any problem.
_________________
DSAmp: control Winamp with your Nintendo DS

#102564 - PypeBros - Fri Sep 15, 2006 8:46 am

Code:

void Engine::handle(void) {
  Event evt=GUI_NOPE;
 
  // read the button states
  scanKeys();
 
  // read the touchscreen coordinates
  touchPosition touch;
  uint pressed = keysDown();   // buttons pressed this loop
  uint held = keysHeld();   // buttons currently held

  /* when the touchpad is released, touchReadXY returns (0,0).
   * we prefer working on the last coordinates in that case.
   */
  if (pressed&KEY_TOUCH) {
    touch=touchReadXY();
  } else if (held&KEY_TOUCH) {
    touch=touchReadXY();
  } else {
    touch=lastpos;
    touchReadXY();
  }

  uint16 mask;
  bool inside = current && current->test(touch);
  iprintf("%s %x",inside?"inside":"outside",current);

  if ((pressed&KEY_TOUCH)) {
    /* a new touch starts. If we're no longer in the previous
     * widget, let's just drop it to get something fresh ...
     */
    evt=(held & KEY_L)?GUI_ALT_TOUCHED:GUI_TOUCHED;
    if (!inside) current=0;
    lastpos=touch;
  } else {
    if ((held&KEY_TOUCH)) {
      /* we're drawing with the pencil. ignore movements that get out
       * until they're back in.
       */
      evt=(held&KEY_L)?GUI_ALT_TOUCHED:GUI_MOVED;
      lastpos=touch;
      if (!inside) {
   lastbuttons = held|pressed; return;
      }
    } else if (lastbuttons&KEY_TOUCH) {
      /* touching inside and releasing outside is not clicking */
      evt = inside?
                 ((held&KEY_L)?GUI_ALT_CLICKED:GUI_CLICKED):
                 GUI_RELEASED;
    }
  }

  /* now, if we have no longer a current object, let's check for one */
  if (!current) {
    current = interface->test(touch);
    inside=true;
    mask=GUI_NOPE;
  }


Rest of the code is checking D-pad and buttons, invoking current->handle() or interface->handle(), etc.
_________________
SEDS: Sprite Edition on DS :: modplayer

#102578 - PadrinatoR - Fri Sep 15, 2006 12:02 pm

Ok, that's enough :P

As I say to yal, now you have to use a new field in touchPosition called touched. That field will tell you if the stylus was touched:

Then you shouldn't use keysHeld and keysDown in order to detect stylus touching.
_________________
DSAmp: control Winamp with your Nintendo DS

#102667 - tepples - Fri Sep 15, 2006 11:44 pm

Either that, or you can dispense with the new field and poke the touched value directly into the appropriate bit of the keys* bitfields.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#102975 - PypeBros - Mon Sep 18, 2006 11:31 am

thanks, tepples, i think i'll do that. I'd prefer keep my sources compatible with both "regular" and "modified" versions of the library.
_________________
SEDS: Sprite Edition on DS :: modplayer

#103152 - Lick - Tue Sep 19, 2006 4:47 pm

Seriously, the reason why your modification isn't widely used yet, is because people don't want to replace the libnds installation. Please wrap the algorithms!!
Your work is greatly appreciated, but library-mods are generally not..
_________________
http://licklick.wordpress.com

#103154 - PadrinatoR - Tue Sep 19, 2006 4:51 pm

PypeBros problem was that he wasn't calling PrecalculateCalibrationData(); It's now fixed ^^

Lick wrote:
Seriously, the reason why your modification isn't widely used yet, is because people don't want to replace the libnds installation. Please wrap the algorithms!!
Your work is greatly appreciated, but library-mods are generally not..


Mmmm I wanna see my modifications in newer versions of libnds but I cannot include it, is someone of the libnds project reading this thread??
_________________
DSAmp: control Winamp with your Nintendo DS

#103157 - PypeBros - Tue Sep 19, 2006 5:07 pm

PypeBros wrote:

--- edit again:
after crawling through touch.c code, it looks like nothing on the ARM9 invokes PrecalculateCalibrationData() in my copy of libnds ... just adding it in the application's initialization did the trick (having a,b,c,d scaling coefficient all equal to zero couldn't produce very interesting .px, .py)


yep, i figured that already, that way, i can click on stuff, but it still had that "delay" between what i click and what i get. E.g. if i click on a color on the palette, then on some pixel of the grid, the pixel isn't toggled. Iirc, i first get the old position in the palette reported as a "touch" and then the new position ...

btw, what exactly does the code i reported to have commented out in the post above?
Code:

 if( dword_211A6B0 == 0 ){
        touchPos.px = aux3;
        touchPos.py = aux4;
   }


"dword_211A6B0" is a pretty obscure variable name for the one not enlightened :P
_________________
SEDS: Sprite Edition on DS :: modplayer

#103158 - PadrinatoR - Tue Sep 19, 2006 5:14 pm

PypeBros wrote:
yep, i figured that already, that way, i can click on stuff, but it still had that "delay" between what i click and what i get. E.g. if i click on a color on the palette, then on some pixel of the grid, the pixel isn't toggled. Iirc, i first get the old position in the palette reported as a "touch" and then the new position...



Yeah it's done in that way in commercial games too, but it shouldn't be a problem for you, I think O_o

PypeBros wrote:
btw, what exactly does the code i reported to have commented out in the post above?
Code:

 if( dword_211A6B0 == 0 ){
        touchPos.px = aux3;
        touchPos.py = aux4;
   }


"dword_211A6B0" is a pretty obscure variable name for the one not enlightened :P


Sorry! I forgot answering you! :S

I don't know hahaha There are two variables in that function whose meaning I'm not able to understand. I only know that it works and that's the way followed by Nintendo to read touchscreen data.
_________________
DSAmp: control Winamp with your Nintendo DS

#103171 - Mrshlee - Tue Sep 19, 2006 6:52 pm

Hunt down and talk to Wintermute on #DSDev
_________________
MrShlee.com
Projects
Dev-Scene
MyTechpedia

#103388 - dovoto - Thu Sep 21, 2006 2:57 pm

I will take a look at the modification and see if it should make it into the next official release...been out of town so trying to catch up on a few things.
_________________
www.drunkencoders.com

#103395 - PadrinatoR - Thu Sep 21, 2006 3:47 pm

dovoto wrote:
I will take a look at the modification and see if it should make it into the next official release...been out of town so trying to catch up on a few things.


Thank you very much. Here you have the complete code of touchReadXY (ARM9):

Code:
touchPosition touchReadXY() {
   // LEYENDA
   //---------
   // last_measures = dword_211A6AC
   // newpress = dword_211A68C
   // released = dword_211A690
   // ???? = dword_211A6B0
   // ???? = dword_211A6A0

   static touchPosition touchPos, touchPos_Old;
   static u8 dword_211A6A0; //,dword_211A68C, dword_211A690;
   static u8 dword_211A6B0;
   u8 unk_bool;
   int16 dist_x, dist_y, med_x, med_y, aux1, aux2, aux3, aux4;

//---------------------------------------------------------------------------------
   while (IPC->mailBusy);

   if(touchPos.error == 0){
      if(touchPos.touched == 0){
         touchPos.newpress = 1;
         touchPos.released = 0;
      }else{
         touchPos.newpress = 0;
         touchPos.released = 1;
      }
   }else{
      touchPos.newpress = 0;
      touchPos.released = 0;
   }

   med_x = touchPos.px;
   med_y = touchPos.py;

   touchPos.error = IPC->touchError;
   touchPos.touched = IPC->touched;

   touchPos.x = IPC->touchX;
   touchPos.y = IPC->touchY;

   touchPos.z1 = IPC->touchZ1;
   touchPos.z2 = IPC->touchZ2;

   ADC_to_SCR(touchPos.x, touchPos.y, &(touchPos.px), &(touchPos.py));

   if(touchPos.touched == 0){
      touchPos.touched = 0;
      touchPos_Old.px = -1;
      dword_211A6B0 = 0;
   }else{
      aux1 = touchPos.px;
      aux2 = touchPos.py;
      aux3 = touchPos_Old.px; //signed
      aux4 = touchPos_Old.py; //signed

      dist_x = aux1 - aux3;
      dist_y = aux2 - aux4;

      if(dword_211A6B0 != 0){
         touchPos.px = med_x;
         touchPos.py = med_y;
      }

      dist_x = dist_x << 16;
      dist_y = dist_y << 16;

      if(touchPos.error == 2 || touchPos.error == 0) touchPos_Old.px = aux1;
      if(touchPos.error == 1 || touchPos.error == 0) touchPos_Old.py = aux2;

      dist_x = dist_x >> 16;
      dist_y = dist_y >> 16;

      if( dword_211A6B0 == 0 ){
         touchPos.px = aux3;
         touchPos.py = aux4;
      }

      if(aux3 < 0){
         if( touchPos.error == 0){ //si no hubo "error"
            touchPos.touched = 0;
            dword_211A6B0 = 0;
            dword_211A6A0 = 1;
         }else{
            touchPos.touched = 0;
            touchPos_Old.px = -1;
            dword_211A6B0 = 0;
         }
      }else{
         if(dword_211A6B0 == 0){
            unk_bool = 1;

            if (touchPos.error == 0 && dist_x >= -12 && dist_x <= 12 && dist_y >= -12 && dist_y <= 12)
               unk_bool = 0;

            if(dword_211A6A0 == 0){ //Comprueba la direccion rara
               if(unk_bool == 0)
                  dword_211A6B0 = 0;
               else
                  dword_211A6B0 = 1;
            }else{
               touchPos.touched = 0;

               if(unk_bool == 0)
                  dword_211A6A0 = 0;
               else
                  dword_211A6A0 = 1;

               dword_211A6B0 = 0;
            }
         }else{
            if(touchPos.error == 0 && dist_x >= -12 && dist_x <= 12 && dist_y >= -12 && dist_y <= 12){
               touchPos.px = aux3;
               touchPos.py = aux4;
               dword_211A6B0 = 0;
            }else{
               dist_x = touchPos_Old.px - med_x;
               dist_y = touchPos_Old.py - med_y;

               if(dist_x >= -12 && dist_x <= 12 && dist_y >= -12 && dist_y <= 12){
                  dword_211A6B0 = 0;
               }else{
                  dword_211A6B0 = 1;
               }
            }
         }
      }
   }

   if(touchPos.touched == 0){
      touchPos.newpress = 0;
   }else{
      touchPos.released = 0;
   }

   return touchPos;

}


I deleted the code which sets 'newpress' and 'released' fields in the modification that I uploaded... but that is the complete code used in commercial games :)
_________________
DSAmp: control Winamp with your Nintendo DS

#107147 - wintermute - Fri Oct 27, 2006 4:52 am

Sorry, this isn't suitable for inclusion in libnds in it's current form.

Any error conditions can and should be indicated by not reporting the pendown flag. This is read by the arm7 and transferred via the IPC struct at present.

All the variables should have sensible names.

Comments should be in english.

It looks like you're translating touch screen co-ordinates on the arm9. Is there any significant difference between your translation and what we're using now?

As far as I know the only major issue with the current code is the "jumping".

I was attempting to compensate by reading the touchscreen several times over the course of the frame to weed out nonsensical values. It sounds like you've managed to do this without that approach.

I'd rather see the touchscreen reading and translation entirely on the arm7 with the arm9 merely reading the input without mangling the structure that's already there.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#107190 - HyperHacker - Fri Oct 27, 2006 3:31 pm

I noticed something quite interesting. In an app I'm workin on the touch screen rarely jumps, but when ARM9 CPU usage gets too high (~7ms for the main loop) and it starts missing frames, suddenly it loses accuracy and I often get two different buttons pressed when I touch one. I use a method many older games used, having a "keys pressed this frame" and "keys held >1 frame" variable (both set by ARM7), and I read the touch screen when Keys Pressed includes the Touch bit, so skipping frames seems like it should be making it less responsive (and indeed, it takes a few tries for keypresses to be noticed), not responsive to things that never even happened. O_o I almost wonder if the temperature change by the CPU heating up is enough to throw it off...
_________________
I'm a PSP hacker now, but I still <3 DS.

#107204 - PadrinatoR - Fri Oct 27, 2006 4:42 pm

wintermute wrote:
Sorry, this isn't suitable for inclusion in libnds in it's current form.

Any error conditions can and should be indicated by not reporting the pendown flag. This is read by the arm7 and transferred via the IPC struct at present.


I imagined that :P My intention was to get Nintendo's algorithm and try to adapt it as is in the current libnds. I only wanted to give you a way of reading the touchscreen which is used by Nintendo in order to avoid jumping.

Quote:
All the variables should have sensible names.


I think there is only 1 variable which hasn't a name (I don't understand its role in the algorithm :S :$).

Quote:
Comments should be in english.

You're right, I put some comments in Spanish, I think I had translated all of them to English :S Sorry.

Quote:
It looks like you're translating touch screen co-ordinates on the arm9. Is there any significant difference between your translation and what we're using now?

I did it in that way because Nintendo does it on the ARM9, I suppose that there is no difference if it's done on the ARM7, although in commercial games Nintendo uses these ARM9 functions to make the translations, I don't know if they are more accurate.

Quote:
As far as I know the only major issue with the current code is the "jumping".

Of course! That's the only problem, I only used all the algorithm that I've extracted from Nintendo's games in order to know how does it work.




In conclusion, my target was only to discover how Nintendo avoids this jumping problem and to show you it, I don't know what's the best way to implement it in libnds, so I think that someone in the libnds project would be more capable to do it. I only give you a fully functional code without jumping problems which included (adapted) in libnds will give us better homebrew applications and a better control of the touchscreen.

Anyway, if I can help you with something, just say me what I have to do ;)
_________________
DSAmp: control Winamp with your Nintendo DS

#107635 - ThomasS - Tue Oct 31, 2006 7:22 pm

@PadrinatoR:
I'm trying to use your stylus code, but the server "www.ftp.nu" on which your version of ndstool was seems to be down. Could you please upload it to another site?

#107810 - Payk - Thu Nov 02, 2006 8:07 am

If realy hv to say that this algorithm is what we need. Maybe on some nds the touchscreen works more or less ok with homebrew, but for me not.
When using a keyboard for example in dsorganize it often becomes a pain to write a short filename. In nitrotracker, when trying to load a file, i often hit the wrong one...
But on Pictochat it works that perfect. Absolutly as it should be...any homebrew keyboard is a pain...i am thinking about a password input...how bad... but with Pictochat it would be ok


U made a great job, if libnds doesnt use that, well i will use it and recommand others to do same.
Thanx for effort. That helps many apps alot!

#107908 - diggla - Fri Nov 03, 2006 1:15 am

PadrinatoR, could you upload your mod to a mirror site? www.ftp.nu seems to be offline most of the time :O

#107969 - PadrinatoR - Fri Nov 03, 2006 3:54 pm

Sorry, I went away. Here you have the modified versions of libnds, ndstool and PAlib.

http://rapidshare.com/files/1816216/libnds__19_July_2006__Modified_By_PadrinatoR.rar
http://rapidshare.com/files/1817055/ndstool_-_Modified_by_PadrinatoR.rar
http://rapidshare.com/files/1817669/PAlib_2_Sept_2006_Modified_By_PadrinatoR.rar
_________________
DSAmp: control Winamp with your Nintendo DS

#107982 - Wonder Boy - Fri Nov 03, 2006 7:27 pm

Thanx PadrinatoR! Valuable Work! :-)

#108025 - ThomasS - Sat Nov 04, 2006 11:38 am

Unfortunately it doesn't work in Dualis - but works great with real harware.
Thank you very much, PadrinatoR!

#108280 - PypeBros - Tue Nov 07, 2006 1:58 pm

just ported tetattDS to padrinator's modified lib ... works fine :)
_________________
SEDS: Sprite Edition on DS :: modplayer

#109333 - pollier - Fri Nov 17, 2006 9:09 am

EDIT: Hooray, with the changes I didn't read the first time in this topic, I made the nds-examples TouchTest work with the patched libnds. Also putting back in some code that I had commented out for testing resolved the other issue. Excuse my nubletry!
_________________
(Works for me!)

#110872 - spinal_cord - Sat Dec 02, 2006 1:50 pm

I'm using palib, do I only need the palib patch or do I need the others to?
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#110873 - PadrinatoR - Sat Dec 02, 2006 1:53 pm

Thanks for your comments! I'm glad to see that it's being useful for you :D

spinal_cord wrote:
I'm using palib, do I only need the palib patch or do I need the others to?


You need all of them :)
_________________
DSAmp: control Winamp with your Nintendo DS

#110876 - spinal_cord - Sat Dec 02, 2006 3:03 pm

The palib seems to be a different version to mine, if i use it, i can compile my code, if i dont, the stylus jumps :(
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#110877 - PadrinatoR - Sat Dec 02, 2006 3:14 pm

I should create a patch for the last version but I haven't got time enough :S
_________________
DSAmp: control Winamp with your Nintendo DS

#110888 - Lick - Sat Dec 02, 2006 5:14 pm

PadrinatoR wrote:
I should create a patch for the last version but I haven't got time enough :S


You should really release it in a format that people can reuse when libnds or PAlib get updated. That's the better way of doing things, NOT patching/modding libraries.
_________________
http://licklick.wordpress.com

#110890 - PadrinatoR - Sat Dec 02, 2006 5:22 pm

What format of releasing do you suggest?
_________________
DSAmp: control Winamp with your Nintendo DS

#110891 - Hermes - Sat Dec 02, 2006 5:53 pm

PadrinatoR wrote:
What format of releasing do you suggest?


have you released the source code? yes?

i think the ball is in the tile roof of others coders XD

You don't worry by this question

[SPANISH ON]
Paisano, nunca es buena idea parchear una libreria: si les interesa meter esa modificacion, ya lo har?n pero si no lo hacen, eres libre de publicar los fuentes de la libreria con esa modificacion y distribuirlos, pues la licencia lo permite.
[SPANISH OFF]

#110893 - PadrinatoR - Sat Dec 02, 2006 6:12 pm

Hermes wrote:
[SPANISH ON]
Paisano, nunca es buena idea parchear una libreria: si les interesa meter esa modificacion, ya lo har?n pero si no lo hacen, eres libre de publicar los fuentes de la libreria con esa modificacion y distribuirlos, pues la licencia lo permite.
[SPANISH OFF]


Well, that's what I'm doing, I've uploaded a modified version of the library, not a patch (I said 'patch' before, sorry :S). As you say, the ball is in the tile roof of others coders.

I'll release modified version of them as fast as I can (now I've got a lot of work :( ) until they include it in their libraries (if they want).

Anyway, Lick, I accept suggestions about how to improve the release of these modified versions of PAlib and libnds.
_________________
DSAmp: control Winamp with your Nintendo DS

#110894 - spinal_cord - Sat Dec 02, 2006 6:14 pm

I cant wait. (Thankyou)
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#110898 - Mollusk - Sat Dec 02, 2006 7:00 pm

The problem with the current state is that it requires modifying libnds... Meaning that if people want to use it, they need to modify their libnds too, and it'll be removed with the next update...

The best solution would be to have a code fully working in the arm9, with a simple template showing how/when to call it. If that's not possible (as you modified arm7 code), have one of the libnds template modified, implimenting a arm7 and arm9 functions to show how to use it :)

As for PAlib, I didn't get much time to do any updates lately, but I think this should really make it in the next version. But as the current state requires to have a modified libnds, I can't just bundle libnds with PAlib, it wouldn't be a good solution... If you had a more plug-and-play version, it would be easier to put it in ;)
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#110899 - Lick - Sat Dec 02, 2006 7:02 pm

Yes, release the code in an example form; a project that uses both custom ARM7 and custom ARM9 code. Put the relevant code into functions, and call them in the example.
_________________
http://licklick.wordpress.com

#110911 - spinal_cord - Sat Dec 02, 2006 8:18 pm

That sounds best (and easyest) to me.
Does the code further up the tread work as it is (using palib)or does it require the modifications to work?
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage