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 

Pausing game when home button is pressed?

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



Joined: 27 Jun 2005
Posts: 13

PostPosted: Mon Jun 27, 2005 3:16 pm    Post subject: Pausing game when home button is pressed? Reply with quote

I have seen many titles that keep running in the background when the home button is pressed. The actual callback created by sceKernelRegisterExitCallback is only called when the exit is selected from the home button but I assume that there is another callback to the main thread that tells it to pause itself.

I was looking through the list of kernel exports and sceKernelCreateCallback looks like a possibility but I don't know the necessary parameters or what the callback function should look like.

Has anybody else looked into this yet?
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon Jun 27, 2005 5:26 pm    Post subject: Reply with quote

This is stickied: http://forums.ps2dev.org/viewtopic.php?t=1723

sceKernelCreateCallback() creates the callback, not sceKernelRegisterExitCallback().
Back to top
View user's profile Send private message
squiggle



Joined: 26 Jun 2005
Posts: 9

PostPosted: Mon Jun 27, 2005 7:05 pm    Post subject: Reply with quote

Although maddogjt1 may have been incorrect with the process for creating the callback, he is correct that the callback for exit never triggers its function (ie exit_callback) unless they really do exit, which I assume is used in retail games for some sort of cleaning up. I would also like to know if anyone has figured out how to trap the fact that the button was pushed at all - which I think was his main question. Whenever the screen saver comes on or the home button is pressed I seem to get phantom keypresses in my app(which may be my fault - still trying to debug it) but being able to tell home was pressed would at least allow me to pause the game so that the timers stop, etc..


This all may have been addressed in skippy911's controller.c (http://forums.ps2dev.org/viewtopic.php?t=1708&) but controller_home.rar doesn't seem to be hosted at the link he posted anymore.

- Update:

I solved my problem of catching the home key, when home is pressed the key value returned is '65536'. Hope that is what you were looking for maddogjt1..
Back to top
View user's profile Send private message
maddogjt1



Joined: 27 Jun 2005
Posts: 13

PostPosted: Mon Jun 27, 2005 11:42 pm    Post subject: Reply with quote

squiggle wrote:

I solved my problem of catching the home key, when home is pressed the key value returned is '65536'. Hope that is what you were looking for maddogjt1..


That partially solves the problem. The problem is that when you bring up the "exit to home" screen, keyboard inupt is suspended to your main thread, so if the user returns to the game, the best you would currently be able to do would be to leave the game paused until another key is received. I guess this isn't a huge problem, but it's not the ideal behavior.

I'm still under the assumption that the PSP sends some callback to the main thread telling it that it should pause/unpause itself. The only reason that it does not pause the game itself is probably because multiplayer titles need to keep running in the background even if the home key is pressed.
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