The app should compile with the given makefile
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <psprtc.h>
#include <math.h>
#include <stdio.h>
#include <SDL/SDL.h>
int done = 1;
int thid;
PSP_MODULE_INFO("test", 0, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
int exit_cb(int arg1, int arg2, void *common) {
//done is probably useless, altough it seems ideal to set it regardless
done = 0;
//let's call sceKernelExitGame on main since we are using the done var
//sceKernelExitGame();
sceKernelExitGame();
return 0;
}
int callbackThread(SceSize args, void *argp) {
sceKernelRegisterExitCallback( sceKernelCreateCallback("exit_cb", exit_cb, NULL) );
sceKernelSleepThreadCB();
//the PSP can cause painful crashes , let's use it here and also after the loop
//sceKernelExitGame();
sceKernelExitDeleteThread(0);
return 0;
}
int main(int argc, char* argv[]) {
//pspDebugScreenInit();
int threadID = sceKernelCreateThread("Callback Update Thread", \
callbackThread,\
0x11, \
0xFA0, \
THREAD_ATTR_USER, \
0);
if (threadID >= 0 ) {
sceKernelStartThread(threadID,0,0);
}
thid = threadID;
SDL_Surface* imgSurface = NULL;
SDL_Surface* screen = NULL;
SDL_Init( SDL_INIT_EVERYTHING );
screen = SDL_SetVideoMode(420, 270, 32, SDL_SWSURFACE);
imgSurface = SDL_LoadBMP("test.bmp");
SDL_BlitSurface(imgSurface, NULL, screen, NULL);
SDL_Flip(screen);
SDL_Delay(6000);
SDL_FreeSurface(imgSurface);
SDL_FreeSurface(screen);
exit_cb(0,0,NULL);
return 0;
}
Here is the makefile
Code: Select all
TARGET = alsample
OBJS = main.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -ggdb
ASFLAGS = $(CFLAGS)
LIBDIR =
##LDFLAGS = -mno-crt0
LDFLAGS =
LIBS = -lSDL -lpspirkeyb -lpsppower -lpsphprm -lpsprtc -lpsppower -lm -lpspaudio -lpspgu -lpspgu
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Audiolib Wave Generator
PSP_FW_VERSION = 150
##PSP_LARGE_MEMORY = 1
##USE_KERNEL_LIBC = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Advertising