| View previous topic :: View next topic |
| Author |
Message |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Fri Oct 17, 2008 4:57 am Post subject: trying to do an xmb in-game |
|
|
hi, I'm trying to do an xmb in-game. I'm using rdriver from the dark-alex bootload example to replace the sceKernelRegisterExitCallback function, with that code:
| Code: | int ExitPatched3(int cbid)
{
int k1 = pspSdkSetK1(0);
SceCtrlData pad;
while(!done){
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_HOME){
done = 1;
}
}
}
sceKernelExitGame();
pspSdkSetK1(k1);
return 0;
} |
and that:
| Code: | orig_funcs[2] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x4AC57943);
sctrlHENPatchSyscall(orig_funcs[2], ExitPatched3); // sceKernelRegisterExitCallback |
When I enter to a game using rdriver, it patches the Register exit callback function, because If I press home I can't see the exit menu, but the psp doesn't return to my shell... any ideas of how to do it?
Last edited by krosk on Fri Oct 17, 2008 6:30 am; edited 1 time in total |
|
| Back to top |
|
 |
angelo
Joined: 29 Aug 2007 Posts: 168
|
Posted: Fri Oct 17, 2008 5:25 am Post subject: |
|
|
| It's called a callback. It been discussed before... ;) |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Fri Oct 17, 2008 6:02 am Post subject: |
|
|
| angelo wrote: | | It's called a callback. It been discussed before... ;) |
can you help me a little bit? I can't find anything... |
|
| Back to top |
|
 |
angelo
Joined: 29 Aug 2007 Posts: 168
|
Posted: Fri Oct 17, 2008 9:01 am Post subject: |
|
|
Sorry not a callback... a bootstrap!
I had the wrongpiece of jargon in my head! Sorry!
Angelo |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Sat Oct 18, 2008 12:24 am Post subject: |
|
|
| angelo wrote: | Sorry not a callback... a bootstrap!
I had the wrongpiece of jargon in my head! Sorry!
Angelo |
The prx that I'm using is a bootstrap... If you readed my information, isn't a problem that the prx isn't being loaded, it's a problem with the code to patch the function sceKernelRegisterExitCallback |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat Oct 18, 2008 11:20 pm Post subject: |
|
|
The sceKernelRegisterExitCallback isn't the function that blit the Exit screen, it is only a function that go to register the callback to wakeup when you press X in the Exit Screen!
The default callback is something like this:
| Code: |
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
|
This will exit the game!
So if you want you can doesn't call the "SetupCallbacks" function and rewrite it by youself with a personal one!
If you want the sce style you can use the vlf library... _________________ Get Xplora! |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Mon Oct 20, 2008 3:01 am Post subject: |
|
|
| ne0h wrote: | The sceKernelRegisterExitCallback isn't the function that blit the Exit screen, it is only a function that go to register the callback to wakeup when you press X in the Exit Screen!
The default callback is something like this:
| Code: |
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
|
This will exit the game!
So if you want you can doesn't call the "SetupCallbacks" function and rewrite it by youself with a personal one!
If you want the sce style you can use the vlf library... |
How can I say that I wasn't talking about that? all people responses are the same... anyway, I have recently fixed the hooking and it works fully...
If someones is interested, here is a bootload that has a custom exit function(when you press home directly you get out of the game):
| Code: | #include <pspsdk.h>
#include <pspkernel.h>
#include <pspsysmem_kernel.h>
#include <psploadexec_kernel.h>
#include <pspreg.h>
#include <pspctrl.h>
#include <psprtc.h>
#include <pspusb.h>
#include <pspusbstor.h>
#include <psppower.h>
#include <systemctrl.h>
#include <systemctrl_se.h>
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("rdriver", 0x1007, 1, 0);
u32 orig_funcs[3];
int done = 0;
int ExitPatched()
{
int k1 = pspSdkSetK1(0);
// Using fixed path. See remarks in module_start of what you could do to avoid this
char *program = "ms0:/PSP/GAME/krosk/EBOOT.PBP";
struct SceKernelLoadExecVSHParam param;
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.args = strlen(program)+1;
param.argp = program;
param.key = "game";
int res = sctrlKernelLoadExecVSHMs2(program, ¶m);
pspSdkSetK1(k1);
return res;
}
int ExitPatched2()
{
return ExitPatched();
}
int ExitPatched3(int cbid)
{
int k1 = pspSdkSetK1(0);
SceCtrlData pad;
while(!done){
sceCtrlPeekBufferPositive(&pad, 1);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_HOME){
done = 1;
}
}
sceKernelDelayThread(200);
}
if(done==1){
ExitPatched();
}
pspSdkSetK1(k1);
return 0;
}
int RestoreExitGame()
{
int k1 = pspSdkSetK1(0);
sctrlHENPatchSyscall((u32)ExitPatched, (void *)orig_funcs[0]);
sctrlHENPatchSyscall((u32)ExitPatched2, (void *)orig_funcs[1]);
sctrlHENPatchSyscall((u32)ExitPatched3, (void *)orig_funcs[2]);
done = 2;
pspSdkSetK1(k1);
return 0;
}
void SetConfFile(int n)
{
int k1 = pspSdkSetK1(0);
sctrlSESetBootConfFileIndex(n);
pspSdkSetK1(k1);
}
void SetUmdFile(char *umdfile)
{
int k1 = pspSdkSetK1(0);
sctrlSESetUmdFile(umdfile);
pspSdkSetK1(k1);
}
int module_start(SceSize args, void *argp)
{
// As in reboot we are executed with no params and we don't know our path,
// we need to use a fixed path.
// This could be solved if the program stores in a known location (for example seplugins)
// the path of the program first time is run in the vsh
SceUID fd = sceIoOpen("ms0:/PSP/GAME/krosk/rdriver.prx", PSP_O_RDONLY, 0);
if (fd < 0)
{
return 0;
}
int size = sceIoLseek(fd, 0, PSP_SEEK_END);
sceIoLseek(fd, 0, PSP_SEEK_SET);
SceUID pid = sceKernelAllocPartitionMemory(PSP_MEMORY_PARTITION_KERNEL, "", PSP_SMEM_Low, size, NULL);
if (pid < 0)
return 0;
sceIoRead(fd, sceKernelGetBlockHeadAddr(pid), size);
sctrlHENLoadModuleOnReboot("/kd/usersystemlib.prx", sceKernelGetBlockHeadAddr(pid), size, BOOTLOAD_GAME | BOOTLOAD_POPS | BOOTLOAD_UMDEMU);
orig_funcs[0] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x05572A5F);
orig_funcs[1] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x2AC9954B);
orig_funcs[2] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x4AC57943);
sctrlHENPatchSyscall(orig_funcs[0], ExitPatched); // sceKernelExitGame
sctrlHENPatchSyscall(orig_funcs[1], ExitPatched2); // sceKernelExitGameWithStatus
sctrlHENPatchSyscall(orig_funcs[2], ExitPatched3); // sceKernelRegisterExitCallback
// Alternativelly you would patch kernel functions here too
// to avoid errors returning to xmb, or to avoid kernel homebrew exiting to xmb
sceKernelDcacheWritebackAll();
sceKernelIcacheClearAll();
return 0;
} |
|
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Mon Oct 20, 2008 7:02 am Post subject: |
|
|
so what does that exactly do?
I know it patches 3 functions (sceKernelExitGame, sceKernelExitGameWithStatus, sceKernelRegisterExitCallback) but I don't see why patching the 3 instead of patching only the first one and the second. _________________
Upgrade your PSP |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Mon Oct 20, 2008 7:14 am Post subject: |
|
|
| coz with the third you can do a custom exit menu, not the default one... and I'm trying to do a XMB-ingame, so when I press home I need that the default exit screen doesn't come on the screen. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Mon Oct 20, 2008 7:25 am Post subject: |
|
|
And that worked? _________________
Upgrade your PSP |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Tue Oct 21, 2008 6:50 am Post subject: |
|
|
| Pirata Nervo wrote: | | And that worked? |
yes, atm when you press home, it will not show you the exit screen and will exit directly... I'm looking now for libraries that can work on plugins. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Tue Oct 21, 2008 7:57 am Post subject: |
|
|
Alright thanks _________________
Upgrade your PSP |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Thu Oct 23, 2008 1:15 am Post subject: |
|
|
| Pirata Nervo wrote: | | Alright thanks |
hope that this code will help you in nervOS |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Thu Oct 23, 2008 2:38 am Post subject: |
|
|
I have been thinking about how to do that for a long time but never tried it but now that I know it works I may use it :)
thank you once more _________________
Upgrade your PSP |
|
| Back to top |
|
 |
Cruiserx
Joined: 23 Oct 2008 Posts: 8
|
Posted: Thu Oct 23, 2008 11:09 am Post subject: |
|
|
| Thanks for this krosk but when i try to compile, with a makefile, i get errors. Could you help? |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Sun Oct 26, 2008 5:45 am Post subject: |
|
|
| Cruiserx wrote: | | Thanks for this krosk but when i try to compile, with a makefile, i get errors. Could you help? |
can you post your errors? |
|
| Back to top |
|
 |
Cruiserx
Joined: 23 Oct 2008 Posts: 8
|
|
| Back to top |
|
 |
Onii
Joined: 05 Oct 2008 Posts: 40
|
Posted: Mon Oct 27, 2008 5:33 am Post subject: |
|
|
| The implicit declaration warnings mean that you forgot to include the .h file that defines those functions. Double check your includes |
|
| Back to top |
|
 |
Cruiserx
Joined: 23 Oct 2008 Posts: 8
|
Posted: Mon Oct 27, 2008 6:02 am Post subject: |
|
|
| You were right Onii i checked and it worked without errors, thanks. But i cannot get it to work :s. |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Wed Oct 29, 2008 5:17 am Post subject: |
|
|
| The lastest M33 SDK comes with a bootload example... just replace the main.c of the example with my main.c and you are done ;) |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Thu Oct 30, 2008 2:01 am Post subject: |
|
|
Why don't use setHomePopup to delete the exit game screen?
And hook the ctrl functions to check if Home is pressed, maybe is simple that your! _________________ Get Xplora! |
|
| Back to top |
|
 |
krosk
Joined: 24 Aug 2008 Posts: 21
|
Posted: Thu Oct 30, 2008 5:55 am Post subject: |
|
|
| Didn't know about that function. I will try it later. |
|
| Back to top |
|
 |
Kreationz
Joined: 18 May 2008 Posts: 53
|
Posted: Thu Oct 30, 2008 2:17 pm Post subject: |
|
|
| I'll have to remember this little piece of info. It can allow custom options menus similar to POPS. |
|
| Back to top |
|
 |
|