Posted: Thu Aug 09, 2012 4:52 pm
You aren't looking at the value of JOY_readJoypad() correctly... look at one thing you do
On a 6-button pad, that will ALWAYS be 0. Why? Because previousValue is (1<<12 | (buttons)). So no matter what the buttons are, it's always still got a value. If you want ONLY the buttons, you must use (val & BUTTON_ALL), which strips the controller type. Also, store the value in a local var rather than read it multiple times. It's faster and cleaner.
Code: Select all
&& !previousvalue
Code: Select all
while (1)
{
u16 buttons = JOY_readJoypad(JOY_1);
VDP_drawText("->", 3, choix);
if ((buttons & BUTTON_START) && choix==8 && !previousvalue) {conf_detect();}
if ((buttons & BUTTON_START) && choix==10 && !previousvalue) {joy_test();}
if ((buttons & BUTTON_START) && choix==12 && !previousvalue) {color_test();}
if ((buttons & BUTTON_UP) && choix==8 && !previousvalue) {VDP_drawText(" ", 3, choix); choix=12;}
else if ((buttons & BUTTON_UP) && !previousvalue) {VDP_drawText(" ", 3, choix); choix=choix-2;}
if ((buttons & BUTTON_DOWN) && choix==12 && !previousvalue) {VDP_drawText(" ", 3, choix); choix=8;}
else if ((buttons & BUTTON_DOWN) && !previousvalue) {VDP_drawText(" ", 3, choix); choix=choix+2;}
previousvalue = buttons & BUTTONS_ALL;
}