Welcome to Hackers Alliance!

C on psp - Menu's Tabs

  • Archived

    The forum is archived and used for testing. It is currently read-only to visitors.
    It has been upgraded from vBulletin 3.8.x to XenForo for security purposes and future-proofing. Proprietary code and modifications (such as code database and HA bot) are broken with XenForo and will stay only with vBulletin.

Emu

Coder
Coder
Sep 29, 2010
19
0
0
earth
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;
}
This is an example of a menu. If you want to compile this include these at the top of this code:
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;
}
EBOOT is a quick way of testing it. For the make file add this:
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
my eboot so far: http://fs11u.sendspace.com/processupload.html
 
Last edited:

Double_0_negative

Hackers Alliance Veteran
Administrator
Sep 18, 2010
444
8
0
sweetness! ill try this out, but what do u use as a compiler and editor?
 

Emu

Coder
Coder
Sep 29, 2010
19
0
0
earth
CodeBlocks and pspsdk
 

Emu

Coder
Coder
Sep 29, 2010
19
0
0
earth
It won't look all that good for now... Needs extra work
 
This site has been archived and is no longer accepting new content.

About us

  • Hackers Alliance is a small community forum about gaming and console hacking. Join our humble community to share ideas, game cheats, mods, and be part of an amazing growing community!

Quick Navigation

User Menu