PSP Coding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

PSP Coding


 
HomeLatest imagesSearchRegisterLog in

 

 C on psp - Menu's Tabs [My Program so far]

Go down 
3 posters
AuthorMessage
Emu




Posts : 21
Points : 29
Reputation : 0
Join date : 2010-10-04

C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitimeSat Oct 16, 2010 2:07 pm

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);
}
}
}

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://www.sendspace.com/file/edkjty
Back to top Go down
Jellyforme




Posts : 38
Points : 63
Reputation : 1
Join date : 2010-09-30

C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: Re: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitimeSat Oct 16, 2010 8:49 pm

Nice program Emu! I tested it and its works well(except for the options tab which you know about). It's also very sexy. Very Happy
Back to top Go down
Emu




Posts : 21
Points : 29
Reputation : 0
Join date : 2010-10-04

C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: Re: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitimeSun Oct 17, 2010 11:18 am

Thank you I have another one with the TABS working now just gotta start adding to the menus Very Happy
Back to top Go down
Jellyforme




Posts : 38
Points : 63
Reputation : 1
Join date : 2010-09-30

C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: Re: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitimeTue Oct 19, 2010 3:22 pm

Nice! Very Happy By the way, where did you find the different libraries, what they contain, and what they do(Ex:<pspctrl.h>)? I can't find them anywhere. Sad


Last edited by Jellyforme on Tue Oct 19, 2010 5:25 pm; edited 1 time in total
Back to top Go down
-LeetGamer-
Admin



Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 30

C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: Re: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitimeTue Oct 19, 2010 3:25 pm

Jellyforme wrote:
Nice! :DBy the way, where did you find the different libraries, what they contain, and what they do(Ex:<pspctrl.h>)? I can't find them anywhere. Sad

C:\pspsdk\psp\sdk\include\pspctrl.h
Back to top Go down
Sponsored content





C on psp - Menu's Tabs [My Program so far] Empty
PostSubject: Re: C on psp - Menu's Tabs [My Program so far]   C on psp - Menu's Tabs [My Program so far] I_icon_minitime

Back to top Go down
 
C on psp - Menu's Tabs [My Program so far]
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
PSP Coding :: PSP Section :: PSP Chat :: Teasers-
Jump to: