Hello everybody!
I recently started psp programming and reached a point where I need the help of this forum.
I simply want to write a little program, which let’s you play around with the brightness of the PSP Screen. So for starters I wanted to read the current brightness level and display it’s value, but the sceDisplayGetBrightness() won’t work no matter what and it's driving me nuts. I have seen the two topics
http://www.psp-programming.com/forums/index.php/topic,2766.0.html and
http://www.psp-programming.com/forums/index.php/topic,2431.0.html about this function, but both couldn’t solve my problem.
I am using the current version of Code::Blocks and Minimalist PSP SDK “pspsdk 0.9.6”.
If I make the code below into an EBOOT with the shown makefile, everything works fine. If I uncomment the line with sceDisplayGetBrightness(), the program still compiles without any errors. But on the PSP it won’t even display “Test01” anymore, it crashes right away and says „The game could not be started. (8002013C)“.
Could somebody please tell me where I went wrong? Many thanks in advance.
Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay_kernel.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("Test01", 0, 1, 1);
//Kernel Mode
PSP_MAIN_THREAD_ATTR(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;
}
int main(void)
{
int level, unkl;
//Setups
SetupCallbacks();
pspDebugScreenInit();
//Just a little screen test
printf("Test01\n");
sceKernelDelayThread(1000000);
printf("Test01");
sceKernelDelayThread(1000000);
//Get Display Brightness
//sceDisplayGetBrightness(&level, &unkl);
//Thread sleep
sceKernelSleepThread();
return 0;
}
Makefile:
TARGET = test01
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspdisplay_driver
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test01
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak