| View previous topic :: View next topic |
| Author |
Message |
justin
Joined: 17 Oct 2007 Posts: 16
|
Posted: Wed Feb 04, 2009 9:29 am Post subject: [SOLVED] Home button troubles on 5.xx m33 |
|
|
I've been struggling to get the exit game screen callbacks working in a game I'm working on. I've got the callbacks in there, and it works in psplink (using the 1.5 kernel). But when I copy the game to the memory stick and run it through the xmb (using the 5.xx kernel), the home button doesn't do anything - but the same build works on my friends psp, he's running 3.52-MM3-4 or something.
I moved the callbacks to an external kernel mode prx, and it worked through both psplink and the xmb. But I'm figuring I shouldn't have to do this, there must be something I'm missing and its driving me insane.
code for sanity check.
| Code: |
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspmoduleinfo.h>
#include <pspthreadman.h>
#include <pspfpu.h>
#include <psppower.h>
PSP_MODULE_INFO("Test", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_MAX();
// Exit callback
int ExitCallback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
// Callback thread
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", ExitCallback, 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(int argc, char** args)
{
SetupCallbacks();
// etc
}
|
Last edited by justin on Fri Feb 06, 2009 6:19 pm; edited 1 time in total |
|
| Back to top |
|
 |
ctszy
Joined: 12 Apr 2008 Posts: 18
|
Posted: Thu Feb 05, 2009 7:56 pm Post subject: |
|
|
seems your homebrew is still based on 1.50 firmware, and thus you need to do some porting work.
check this:http://forums.ps2dev.org/viewtopic.php?t=9130 |
|
| Back to top |
|
 |
justin
Joined: 17 Oct 2007 Posts: 16
|
Posted: Fri Feb 06, 2009 2:03 pm Post subject: |
|
|
Thnx for your reply.
I've followed all of the steps in the thread you've linked before - the app runs perfectly using the 5.xx kernel - no errors or anything the only thing that doesn't work is pushing the home button. Setting the callbacks up shouldn't need to use kernal mode should it? prxtool shows no kernal mode libraries used. But when I move the callbacks into a kernel mode external prx, it works. I'm assuming I'm doing something stupid in my callback setup that is making it require kernel mode, I just can't figure out what. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Fri Feb 06, 2009 2:21 pm Post subject: |
|
|
Is the update thread actually being created? You are using PSP_HEAP_SIZE_MAX which in the past has caused in certain situations to totally drain all of user memory which then makes it impossible to create a new thread because you don't have any free stack. It might work in kernel mode because it will allocate the stack in kernel memory but any heap allocations will be in user mode.
Try adding PSP_HEAP_SIZE_KB(-1024) instead of PSP_HEAP_MAX() (yes -1024) which will use all memory minus 1MB which should give you space for a thread stack. |
|
| Back to top |
|
 |
justin
Joined: 17 Oct 2007 Posts: 16
|
Posted: Fri Feb 06, 2009 5:06 pm Post subject: |
|
|
| Thnx, I'll give it a go when I get home and report back. Probably should have thought of that... |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Fri Feb 06, 2009 6:06 pm Post subject: |
|
|
| Another thought - is this a C++ app? If so, you have to wrap the callbacks in extern C {} thingys or they won't work. |
|
| Back to top |
|
 |
justin
Joined: 17 Oct 2007 Posts: 16
|
Posted: Fri Feb 06, 2009 6:17 pm Post subject: |
|
|
| PSP_HEAP_SIZE_KB(-1024) did it. The callbacks work now, and I feel sane again. Thanks everyone :) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Fri Feb 06, 2009 9:18 pm Post subject: |
|
|
| You might play with the value a bit. I rarely leave more free than 256K. Of course, if your app doesn't need much memory, you could always leave more free. :) |
|
| Back to top |
|
 |
justin
Joined: 17 Oct 2007 Posts: 16
|
Posted: Sat Feb 07, 2009 8:40 am Post subject: |
|
|
| It's a pretty greedy app, memory wise :) I'll give it a whirl at -256. |
|
| Back to top |
|
 |
|