I'm new to console programming (but with experience in UnityScript, real Javascript and Python). So far I'm happily following along the dev-scene tutorial, but I noticed something odd: Keys L, R, X, Y and TOUCH don't seem to register. I searched quite a bit for a solution, but all I was able to find were a few people experiencing the same issue.
I'm developing on OSX, so I couldn't try it out on any other emulator than DeSmuME. However, the buttons work fine on a ROM I downloaded (just for this occasion, mind you), so I suspect devkitARM/ libnds to be the culprit. Also, though I'm pretty sure it's not the code (as A, B, UP, DOWN, etc. work fine), here's my ARM9 main.c:
Code: Select all
#include <nds.h>
#include <stdio.h>
int main(void){
consoleDemoInit(); //enable printf
while(1){
scanKeys();
int held = keysHeld();
if(held & KEY_A){
printf("Key A is pressed!\n");
}
else{
printf("Key A is released!\n");
}
if(held & KEY_B){
printf("Key B is pressed!\n");
}
else{
printf("Key B is released!\n");
}
if(held & KEY_X){
printf("Key X is pressed!\n");
}
else{
printf("Key X is released!\n");
}
if(held & KEY_Y){
printf("Key Y is pressed!\n");
}
else{
printf("Key Y is released!\n");
}
if(held & KEY_TOUCH){
printf("Touchpad is touched!\n");
}
else{
printf("Touchpad is not touched!\n");
}
swiWaitForVBlank();
consoleClear();
}
return 0;
}
Patrick