forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't use HOME button to quit when using sceDisplayDisable

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Thu Jul 26, 2007 12:40 pm    Post subject: Can't use HOME button to quit when using sceDisplayDisable Reply with quote

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
View user's profile Send private message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Thu Jul 26, 2007 12:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Jul 26, 2007 12:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Thu Jul 26, 2007 1:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Jul 26, 2007 2:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Thu Jul 26, 2007 3:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Jul 26, 2007 10:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Wed Aug 01, 2007 9:47 pm    Post subject: Re: Can't use HOME button to quit when using sceDisplayDisab Reply with quote

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:
Code:
while(runningFlag)


P.S: I also updated the post with the sample code. ;)

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Tue Aug 14, 2007 4:47 pm    Post subject: Re: Can't use HOME button to quit when using sceDisplayDisab Reply with quote

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:
Code:
while(runningFlag)


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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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