Code:
unsigned int menuNo = 0;
unsigned int menuSelected = 0;
int main(void)
{
//Setup Menu: function
int menuDraw(void)
{
do
{
switch(menuSelected)
{
case 0: pspDebugScreenPuts("Tab 1\n");
break;
case 1: pspDebugScreenPuts("Tab 2\n");
break;
case 2: pspDebugScreenPuts("Tab 3\n");
break;
}
menuNo++;
}while(menuNo < 3);
return 0;
}
//menuSwitch: function
int menuSwitch(void)
{
while(1)
{
sceCtrlPeekBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_RTRIGGER)
{
if(menuSelected > 0) menuSelected--;
else if(menuSelected == 0) menuSelected = 2;
menuDraw();
sceKernelDelayThread(1500000);
}
else if(pad.Buttons & PSP_CTRL_LTRIGGER)
{
if(menuSelected < 2) menuSelected++;
else if(menuSelected == 2) menuSelected = 0;
menuDraw();
sceKernelDelayThread(1500000);
}
}
}
menuDraw();
menuSwitch();
return 0;
}
Code:
#include <pspctrl.h>
#include <pspumd.h>
#include <psppower.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <pspstdio.h>
#include <pspdebug.h>
#include <pspkernel.h>
PSP_MODULE_INFO("MHFUc", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(0); //0 for kernel mode too
#define printf pspDebugScreenPrintf
//GLOBALS
SceCtrlData pad;
unsigned int lines = 0;
unsigned int lineSelected = 0;
unsigned int menuNo = 0;
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
Code:
TARGET = xxsamuraixx
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
#PRX_EXPORTS = exports.exp
LIBS = -lpsppower
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = MHFUc v0.04 (Beta)
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Last edited: