Code: Select all
#include <pspsdk.h>   
#include <pspkernel.h>
#include <psppower.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <pspdebug.h> 
#define printf pspDebugScreenPrintf 
PSP_MODULE_INFO("Sample Menu", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); 
SceCtrlData currentPad, lastPad;
int option = 1;
int down = 1;
int up = 1;
void Menu_A()
{
    option = 1;
    down = 1;
    up = 1;
   
    pspDebugScreenClear();      
    pspDebugScreenSetTextColor(0xFF0000);
    printf("\n Sample Menu\n\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" Select an option:\n\n");
    pspDebugScreenSetTextColor(0x0000FF);
    printf(" -> Option 1\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Option 2\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Exit\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
	printf(" -> Test selected\n");
    pspDebugScreenSetTextColor(0x00FF00);
    printf(" Press X to select the option.");
}
void Menu_B()
{
    option = 2;
    down = 2;
    up = 2;
   
    pspDebugScreenClear(); 
    pspDebugScreenSetTextColor(0xFF0000);
    printf("\n Sample Menu\n\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" Select an option:\n\n");
    printf(" -> Option 1\n");
    pspDebugScreenSetTextColor(0x0000FF);
    printf(" -> Option 2\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Exit\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
	printf(" -> Test selected\n");
    pspDebugScreenSetTextColor(0x00FF00);
    printf(" Press X to select the option.");
}
void Menu_C()
{
    option = 3;
    down = 3;
    up = 3;
   
    pspDebugScreenClear(); 
    pspDebugScreenSetTextColor(0xFF0000);
    printf("\n Sample Menu\n\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" Select an option:\n\n");
    printf(" -> Option 1\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Option 2\n");
    pspDebugScreenSetTextColor(0x0000FF);
    printf(" -> Exit\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
	printf(" -> Test selected\n");
    pspDebugScreenSetTextColor(0x00FF00);
    printf(" Press X to select the option.");
}
void Menu_D()
{
    option = 4;
    down = 4;
    up = 4;
   
    pspDebugScreenClear(); 
    pspDebugScreenSetTextColor(0xFF0000);
    printf("\n Sample Menu\n\n\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" Select an option:\n\n");
    printf(" -> Option 1\n");
    pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Option 2\n");
    pspDebugScreenSetTextColor(0x0000FF);
    printf(" -> Exit\n\n");
	pspDebugScreenSetTextColor(0xFFFFFF);
    printf(" -> Test selected\n");
    pspDebugScreenSetTextColor(0x00FF00);
    printf(" Press X to select the option.");
}
void Option_A()
{
    pspDebugScreenClear(); 
    pspDebugScreenSetTextColor(0x00FF00);
    printf("\n Welcome to option A");
    sceKernelDelayThread(2*1000*1000);
    Menu_A();
}
void Option_B()
{
    pspDebugScreenClear(); 
    pspDebugScreenSetTextColor(0x00FF00);
    printf("\n Welcome to Option B");
    sceKernelDelayThread(2*1000*1000);
    Menu_A();
}
void Option_C()
{
    pspDebugScreenSetTextColor(0x00FF00);
    printf("\n\n Bye Bye\n\n Now exiting...");
    sceKernelDelayThread(2*1000*1000);
    sceKernelExitGame();
}
void Option_D()
{
	pspDebugScreenSetTextColor(0x00FF00);
	pspDebugScreenClear(); 
    printf("Test Selected");
    sceKernelDelayThread(2*1000*1000);
    Menu_A();
}
int main()
{
   sceCtrlReadBufferPositive(&lastPad, 1);
   pspDebugScreenInit();
   Menu_A();   
   while(1)
   {
   
     sceCtrlReadBufferPositive(¤tPad, 1);
      
     if( currentPad.Buttons != lastPad.Buttons )
     {
       lastPad = currentPad;
     if(currentPad.Buttons & PSP_CTRL_DOWN)
     {
       switch(down)
       {
           case 1: Menu_B();
               break;
           case 2: Menu_C();
               break;
      
           case 3: Menu_D();
               break;
			
			case 4: Menu_A();
				break;
       }
    }
    if(currentPad.Buttons & PSP_CTRL_UP)
    {
       switch(up)
       {
          case 1: Menu_D();
             break;
          case 2: Menu_A();
             break;
          case 3: Menu_B();
             break;
			 
		  case 4: Menu_C();
			 break;
       }   
    }
}
    if(currentPad.Buttons & PSP_CTRL_CROSS)
    {
         switch(option)
       {
           case 1: Option_A();
             break;
           case 2: Option_B();
             break;
       
           case 3: Option_C();
             break;
			 
		   case 4: Option_D();
			 break;
      }    	  
    }       
  }               
}
how do i correct this?