Page 1 of 2

No touch input on homebrew

Posted: Tue May 26, 2015 1:28 pm
by Wolfgange
I am developing an open source homebrew game for the DS and was hoping I could test it using drastic. For some reason, I am not able to get touch input to work using the emulator. I'm positive the emulator has not crashed. When outputing the touch data, I consistently see "0". Touch input works fine on actual DS roms, and I'm positive there is no X across the stylus in drastic's menu.

More information:
-I am using libnds (touchRead()) for handling touch input
-Here is the source code (I had to remove NiFi initialization to prevent drastic from crashing)
-I've attached my test nds file. I have it printing random numbers, to ensure the game hasn't crashed, and beneath I have it printing the touch input X.

Since the file is too large to attach (2MB), I've uploaded it to Google Drive:
https://drive.google.com/file/d/0B7VRus ... sp=sharing

Re: No touch input on homebrew

Posted: Tue May 26, 2015 1:36 pm
by Exophase
I'll check it out. There's a good chance it's triggering something that isn't working properly that normal games wouldn't due to all using the same Nitro ARM7 code. Homebrew sometimes uncovers this sort of thing. I do have other homebrew that touch works for, but I don't know if it's using libnds.

Re: No touch input on homebrew

Posted: Tue May 26, 2015 1:39 pm
by ericbazinga
Just wondering... What's the game about?

Re: No touch input on homebrew

Posted: Tue May 26, 2015 1:46 pm
by Wolfgange
I've attached a simpler example pulled from the devkitPro examples. It has the source and compiled binary. I could not get this to work either.
In the case it is related to my setup, I'm running the Drastic Demo (Latest version), on a Samsung Galaxy Avant (Quad core, 1200 MHz, ARM Cortex-A7).
ericbazinga wrote:Just wondering... What's the game about?
It's essentially Minecraft for the DS, but in 2D.

Note: I realize now, I posted this in the wrong forum. I believe it should be in the help and compatibility section.

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:04 pm
by Lordus
The touch input works fine for me on both, your game and the devkitPro sample.
Which version of DraStic are you using?

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:07 pm
by Wolfgange
Lordus wrote:The touch input works fine for me on both, your game and the devkitPro sample.
Which version of DraStic are you using?
Drastic "r2.3.0.2a Demo build 29"

Edit: BTW, I have confirmed, pressing buttons work fine, but the bitwise libnds function for touch input ("if (keysHeld() & KEY_A)") does not work.

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:24 pm
by Lordus
You're right, it doesn't work in the current demo release.
It works in the latest beta version, though.

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:27 pm
by Exophase
Well that's weird.

The only fix I can think of that could be related to this was the one that fixed the Syoban Action homebrew. It was relying on a BIOS call to not modify one of the caller save registers. Had to update the custom BIOS to use a different register.

You could try using a Nintendo BIOS with the demo to see if that fixes the problem.

I'm also going to have to look into this issue of the NiFi initialization crashing the emulator. Could you upload an NDS that does that?

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:50 pm
by Wolfgange
Exophase wrote:Well that's weird.

The only fix I can think of that could be related to this was the one that fixed the Syoban Action homebrew. It was relying on a BIOS call to not modify one of the caller save registers. Had to update the custom BIOS to use a different register.

You could try using a Nintendo BIOS with the demo to see if that fixes the problem.

I'm also going to have to look into this issue of the NiFi initialization crashing the emulator. Could you upload an NDS that does that?
Here's the nds file that crashes:
https://docs.google.com/file/d/0B8XNIxT ... cslist_api

I have it printing out an increasing number (before 5, the graphics hadn't initialized). As you should see, it crashes after printing 5, which runs the NiFi initialization.

Re: No touch input on homebrew

Posted: Tue May 26, 2015 2:51 pm
by Lordus
Yes, both work on the current demo release, when using the original BIOS or the current (post-demo) drastic_bios.