 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Wed Jun 13, 2007 9:58 pm Post subject: Please, help for sceDisplaySetBrightness |
|
|
Hi! :)
Sorry to bother with maybe a stupid question, but I cannot get sceDisplaySetBrightness to work. :(
I updated my toolchain and now the display_kernel.h defines the two functions sceDisplaySetBrightness and sceDisplayGetBrightness.
What I understood:
1.Program must be kernel mode
2.sceDisplayGetBrightness(&curBrightness, NULL); reads current brightness
3.sceDisplaySetBrightness(brightness, 0); sets the display brightness.
4.In the makefile there must be LIBS += -lpspdisplay_driver
I wrote a little test program. It compiles with no warnings but it crashes.
I commented the lines (found here in onother thread)
| Code: | void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8 |
because in display_kernel.h now there are sceDisplayGetBrightness and sceDisplaySetBrightness.
Can someone please help me?
Here's my code:
| Code: |
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <psppower.h>
#include <pspdisplay_kernel.h>
PSP_MODULE_INFO("Brightness Test ", 0x1000, 1, 1);
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() {
scePowerSetClockFrequency(222, 222, 111);
pspDebugScreenInit();
SetupCallbacks();
pspDebugScreenSetTextColor(0xffffff);
pspDebugScreenSetBackColor(0x000000);
pspDebugScreenInit();
pspDebugScreenSetXY(0, 0);
pspDebugScreenPrintf("Brightness test");
int curBrightness = 0;
SceCtrlData pad;
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
sceDisplayGetBrightness(&curBrightness, NULL);
//curBrightness = 60;
pspDebugScreenSetXY(0, 23);
pspDebugScreenPrintf("Press L or R to change brightness");
pspDebugScreenSetXY(0, 24);
pspDebugScreenPrintf("Press TRIANGLE to exit");
while(1) {
pspDebugScreenSetXY(0, 15);
pspDebugScreenPrintf("Current brightness: %3.3i", curBrightness);
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_LTRIGGER) {
if (curBrightness > 0){
curBrightness--;
sceDisplaySetBrightness(curBrightness, 0);
sceKernelDelayThread(100000);
}
}else if(pad.Buttons & PSP_CTRL_RTRIGGER) {
if (curBrightness < 100){
curBrightness++;
sceDisplaySetBrightness(curBrightness, 0);
sceKernelDelayThread(100000);
}
}else if(pad.Buttons & PSP_CTRL_TRIANGLE) {
break;
}
}
sceKernelExitGame();
return(0);
}
|
What I'm doing wrong?
Many thanks
P.S. Sorry for my english. :)
Ciaooo
Sakya |
|
| Back to top |
|
 |
zhangaihe
Joined: 04 Jul 2007 Posts: 4
|
Posted: Thu Jul 05, 2007 12:57 am Post subject: Remove all pspsceDebug* function |
|
|
error is calling pspsceDebug* function,Remove all.
sorry my english,i am from china |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Thu Jul 05, 2007 1:04 am Post subject: Re: Remove all pspsceDebug* function |
|
|
Hi! :)
| zhangaihe wrote: | error is calling pspsceDebug* function,Remove all.
sorry my english,i am from china |
I'll try, many thanks for your reply. :)
You're saying I can use the brightness functions only in a graphic application, and not in a "plain debug" app?
Ciaoooo
Sakya |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Jul 06, 2007 12:02 am Post subject: |
|
|
| Code: | void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8 |
Do you have -lpspdisplay_driver in your makefile on the LIBS line?
It works for me in a debug screen app. |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Fri Jul 06, 2007 12:11 am Post subject: |
|
|
Hi! :)
| Art wrote: | | Code: | void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8 |
Do you have -lpspdisplay_driver in your makefile on the LIBS line?
It works for me in a debug screen app. |
Yes, I have this LIB:
| Code: | | LIBS = -lpsppower -lpspdisplay_driver |
I tried the lines above, but with the new sdk (I updated it some days ago) the program won't copile.
In pspdisplay_kernel.h there are defined directly sceDisplayGetBrightness and sceDisplaySetBrightness, I think before there were sceDisplay_driver_9E3C6DC6 and sceDisplay_driver_31C4BAA8.
So I included pspdisplay_kernel.h...
This way the program compiles, but crashes as soon as sceDisplayGetBrightness is executed.
I don't know what to check! ;)
Ciaooo
Sakya |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Fri Jul 06, 2007 9:46 pm Post subject: |
|
|
Hi! :)
Wow, many thanks.
This way I can undestand if the problem is my program or my toolchain. :)
Ciaooo
Sakya |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Fri Jul 06, 2007 9:52 pm Post subject: |
|
|
| possibly.... I haven't upgraded mine in over a year I've been doing this. |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Sun Jul 08, 2007 1:52 am Post subject: |
|
|
Hi! :)
| Art wrote: | | possibly.... I haven't upgraded mine in over a year I've been doing this. |
Tested: works! :)
I'll check my program and your code.
Many thanks for your help. :)
EDIT: Modified my makefile and just added -lpspgu
| Code: | | LIBS = -lpspgu -lpspdisplay_driver -lpsppower |
Now works! :)
Many thanks again.
Ciaooo
Sakya |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|