libnds: Early read of X Key input and memset issue.
Posted: Tue Jan 06, 2009 4:41 pm
Running this quick program displays the text shown without the key held. Tested in no$gba (text shows twice) and on hardware (text shows once). Same occurs with KEY_Y and KEY_TOUCH.
EDIT - I also ran across something else, usage of memset on lines 161 and 188 of background.c are:
Should be:
Code: Select all
#include <nds.h>
#include <stdio.h>
int main(void) {
consoleDemoInit();
while(1){
scanKeys();
if(keysHeld() & KEY_X)
iprintf("This shouldn't show up");
swiWaitForVBlank();
}
return 0;
}
Code: Select all
memset(&bgState[layer], sizeof(BgState), 0); //line 161
//and
memset(&bgState[layer + 4], sizeof(BgState), 0); //line 188
Code: Select all
memset(&bgState[layer], 0, sizeof(BgState)); //line 161
//and
memset(&bgState[layer + 4], 0, sizeof(BgState)); //line 188