#106338 - dak - Wed Oct 18, 2006 12:38 am
Hi, whenever I try to retrieve the screen coordinates via touchReadXY(), the app simply locks up completely. Has anyone come upon this weirdness at all?
-dak
#106369 - smsisko - Wed Oct 18, 2006 12:36 pm
I'm not sure if it applies, but when my code locks-up the ds, it is usually a stack problem, try to use the heap more.
#106378 - Lick - Wed Oct 18, 2006 2:49 pm
Show us the code!
_________________
http://licklick.wordpress.com
#106416 - dak - Wed Oct 18, 2006 8:41 pm
Code: |
int main(void) {
//---------------------------------------------------------------------------------
//Set initial DS states
powerON(POWER_ALL);
//set irqs
irqInit();
irqEnable(IRQ_VBLANK);
//set bottom screen for console
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);
SUB_BG0_CR = BG_MAP_BASE(31);
BG_PALETTE_SUB[255] = RGB15(31,31,31);
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
//set GL
//init_OGL();
//--- Init FAT system ---
//FAT_InitFiles();
//swiWaitForVBlank();
//swiWaitForVBlank();
//-----------------------
//Create and initialize game engine
//iamEngine *gEngine = new iamEngine();
//Swap screens
//lcdSwap();
touchPosition a;
while(1) {
printf("\x1b[10;0H");
printf("IAM3ds Game Engine\nBy Barry LaVergne\n");
//printf("\nCamera Position:\n[%3f, %3f, %3f]", f32tofloat(cam->pos.x), f32tofloat(cam->pos.y), f32tofloat(cam->pos.z));
//gEngine->GameCycle();
scanKeys();
if (keysHeld() & KEY_TOUCH) {
printf("snort1 \n");
a = touchReadXY();
printf("snort2 \n");
}
printf("\x1b[5;0H");
printf("(%d, %d) \n", a.px, a.py);
}
return 0;
}
|
This is my code with all game specific lines commented out to be a barebones app. The second I try to run touchReadXY();, the whole DS just freezes. Is there any more initialization that I'm missing?
-dak
#106423 - Lick - Wed Oct 18, 2006 9:36 pm
You should put a swiWaitForVBlank(); at the end of the mainloop. Probably won't fix it though.
_________________
http://licklick.wordpress.com
#106429 - dak - Wed Oct 18, 2006 10:11 pm
I actually call it within the game engine, but this particular problem doesnt seem to be associated with the call either way. :$
#106464 - josath - Thu Oct 19, 2006 10:16 am
are you using IPC->mailBusy in any way? in my copy of libnds, touchReadXY has this code:
Code: |
while (IPC->mailBusy); |
So, if you have set mailBusy to a non-zero value, it will wait there forever until you unset it (which in this case would have to be on the arm7).
#106490 - wintermute - Thu Oct 19, 2006 5:58 pm
That would seem to indicate a problem with the arm7 code, either due to your modifications or the method you're using to run the nds.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog
#106599 - dak - Sat Oct 21, 2006 6:28 am
Got it; it was indeed a modified arm7 file from when I was toying with wireless XD
Thanks for all the help!