 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
picobsd
Joined: 19 Apr 2007 Posts: 18
|
Posted: Thu Jul 26, 2007 12:40 pm Post subject: Can't use HOME button to quit when using sceDisplayDisable |
|
|
hi,all
I have a strange question,
if I want call sceDisplay**able function, i must set my app run on kernel mode , 0x1000, PSP_MAIN_THREAD_ATTR(0), these are must, if I don't do these, then app will crush when it begin to run. (I don't know why, I copy from Mr.sakya's sample code)
but if I did this,when I push HOME key, and then push X key, psp didn't not response me, but if I push O key, it can response me and resume the excution of current apps. why?
Last edited by picobsd on Thu Jul 26, 2007 1:53 pm; edited 1 time in total |
|
| Back to top |
|
 |
picobsd
Joined: 19 Apr 2007 Posts: 18
|
Posted: Thu Jul 26, 2007 12:51 pm Post subject: |
|
|
by the way, my firmware version is 3.03oeb
and I have noticed that Mr. sakya 's sample code ("sceDisplaySetBrightness and sceDisplayDisable sample") also have this problem, in his sample, he use Triangle button to quit.
Last edited by picobsd on Thu Jul 26, 2007 1:06 pm; edited 1 time in total |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Jul 26, 2007 12:59 pm Post subject: |
|
|
I think I have encountered this also, but didn't really know the cause,
you might have narrowed it down because I also use those functions.
Have you tried taking control of the HOME button and exiting the app
in the program if the HOME button is pressed?
Exit callback isn't the only way to quit a program.
You might want to try crashing the PSP unit by causing an exception, or two.
| Code: |
_sw(0, 0); // cause exception to crash PSP unit (1)
asm("break\n"); // cause exception to crash PSP unit (2)
// by moonlight
|
The only problem is these will cause the PSP to standby rather than quit to XMB. |
|
| Back to top |
|
 |
picobsd
Joined: 19 Apr 2007 Posts: 18
|
Posted: Thu Jul 26, 2007 1:15 pm Post subject: |
|
|
| Art wrote: | I think I have encountered this also, but didn't really know the cause,
you might have narrowed it down because I also use those functions.
Have you tried taking control of the HOME button and exiting the app
in the program if the HOME button is pressed?
Exit callback isn't the only way to quit a program.
You might want to try crashing the PSP unit by causing an exception, or two.
| Code: |
_sw(0, 0); // cause exception to crash PSP unit (1)
asm("break\n"); // cause exception to crash PSP unit (2)
// by moonlight
|
The only problem is these will cause the PSP to standby rather than quit to XMB. |
oh, thank you for your time and consideration. I think I can hanle HOME key myself in program, but I am very curious with this problem, Why X button doesn't work in that circumstance. I wondered. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Jul 26, 2007 2:58 pm Post subject: |
|
|
Well I can't be specific sorry, but you're no the only one.
MapThis! GPS application has the same issue, not sure if for the same reason,
one of my own released programs Time Baby.
I don't think it's to do with the X button being ignored, but more that the exit callback doesn't work, or scekernalexitgame doesn't work. |
|
| Back to top |
|
 |
picobsd
Joined: 19 Apr 2007 Posts: 18
|
Posted: Thu Jul 26, 2007 3:04 pm Post subject: |
|
|
| Art wrote: | Well I can't be specific sorry, but you're no the only one.
MapThis! GPS application has the same issue, not sure if for the same reason,
one of my own released programs Time Baby.
I don't think it's to do with the X button being ignored, but more that the exit callback doesn't work, or scekernalexitgame doesn't work. |
do you mean that sceKernealExitGame doesn't work in Callback routine when mode is 0x1000, may be you are right, that is not key processing's problem. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Jul 26, 2007 10:29 pm Post subject: |
|
|
Not for every kernal mode program, that's why I said I think you might have narrowed it down to the brightness/LCD routines.
I will test that, as I'd trade off use of those functions for the Home button to
work if that's the problem. |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Wed Aug 01, 2007 9:47 pm Post subject: Re: Can't use HOME button to quit when using sceDisplayDisab |
|
|
Hi! :)
To solve your problem declare a static variable
| Code: | | static int runningFlag = 1; |
Then change the exit_callback and SetupCallbacks like this:
| Code: | /* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
runningFlag = 0;
sceKernelExitGame();
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, PSP_THREAD_ATTR_USER, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
} |
Change the while(1) loops to:
P.S: I also updated the post with the sample code. ;)
Ciaooo
Sakya |
|
| Back to top |
|
 |
picobsd
Joined: 19 Apr 2007 Posts: 18
|
Posted: Tue Aug 14, 2007 4:47 pm Post subject: Re: Can't use HOME button to quit when using sceDisplayDisab |
|
|
| sakya wrote: | Hi! :)
To solve your problem declare a static variable
| Code: | | static int runningFlag = 1; |
Then change the exit_callback and SetupCallbacks like this:
| Code: | /* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
runningFlag = 0;
sceKernelExitGame();
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, PSP_THREAD_ATTR_USER, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
} |
Change the while(1) loops to:
P.S: I also updated the post with the sample code. ;)
Ciaooo
Sakya |
hi, long time no see, thank you for your code, I'll try it tonignt, hope it works, I merely gave up on this, thank you. |
|
| 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
|