Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 04, 2012, 10:08:42 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: Need help with sceDisplayGetBrightness()  (Read 715 times)
flashman
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5
411.44 points

View Inventory
Send Money to flashman

View Profile
« on: August 28, 2010, 04:28:12 AM »

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:
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:
Code:
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
Logged


mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #1 on: August 28, 2010, 09:59:17 AM »

sceDisplayGetBrightness is kernelmode
your app is in usermode
Logged

Check out my:
 Audio lib
 Pmf Viewer
flashman
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5
411.44 points

View Inventory
Send Money to flashman

View Profile
« Reply #2 on: August 29, 2010, 12:25:45 AM »

OK, so I changed

PSP_MODULE_INFO("Test01", 0, 1, 1);

to

PSP_MODULE_INFO("Test01", 0x1000, 1, 1);

for kernel mode, and now the homebrew crashes right away with sceDisplayGetBrightness() still beeing commented.

I tried all kinds of different stuff, change the PSP_FW_VERSION, including other libraries, etc., I'm still not able to start my program in kernel mode.
Oh btw I'm running 5.02 GEN-A, could that cause any problems? Please help, I'm really at a loss.
Logged
mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #3 on: August 29, 2010, 12:32:20 AM »

move sceDisplayGetBrightness into a kernel mode prx, put it in an exported function then load the prx from your (usermode)eboot and call the function, you might have to mess around with the k1 register also but i'm not sure on that one.

search for converting apps from 1.50 to 3.xx
Logged

Check out my:
 Audio lib
 Pmf Viewer
flashman
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5
411.44 points

View Inventory
Send Money to flashman

View Profile
« Reply #4 on: August 29, 2010, 12:46:55 AM »

move sceDisplayGetBrightness into a kernel mode prx, put it in an exported function then load the prx from your (usermode)eboot and call the function, you might have to mess around with the k1 register also but i'm not sure on that one.

search for converting apps from 1.50 to 3.xx

whew, seems to be more complicated than I thought ... anyway, thanks for your help, I will try your suggestion and report back with either failure or success.
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.494 seconds with 28 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com