Pausing game when home button is pressed?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
maddogjt1
Posts: 13
Joined: Mon Jun 27, 2005 3:06 pm

Pausing game when home button is pressed?

Post by maddogjt1 »

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?
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

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

sceKernelCreateCallback() creates the callback, not sceKernelRegisterExitCallback().
squiggle
Posts: 9
Joined: Sun Jun 26, 2005 8:33 pm

Post by squiggle »

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..
maddogjt1
Posts: 13
Joined: Mon Jun 27, 2005 3:06 pm

Post by maddogjt1 »

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.
Post Reply