| View previous topic :: View next topic |
| Author |
Message |
fuzzzzy
Joined: 26 Apr 2007 Posts: 9
|
Posted: Wed May 23, 2007 8:45 am Post subject: sceKernelLoadExec --> vshmain.prx |
|
|
I am trying to intercept the execution of the vshmain.prx (currently only for experimental purposes). Here is my code so far. I only want it to load when L is pressed.
| Code: |
/* vsh loadup module // By fuzzzzy */
//includes//
//psp sdk//
#include <pspkernel.h>
#include <pspsdk.h>
#include <pspctrl.h>
//from local file
#include <psploadexec_kernel.h>
#include <pspvshbridge.h>
PSP_MODULE_INFO("vshLoad", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
#define PATH "flash0:/vsh/nodule/vshmain_real.prx"
//init from flash//
int main_thread(SceSize args, void *argp)
{
SceCtrlData pad;
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_LTIRGGER)
{
struct SceKernelLoadExecParam param;
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.argp = PATH;
param.args = strlen(PATH) + 1;
param.key = "vsh";
sceKernelLoadExec(PATH, ¶m);
}
}
return 0;
}
|
Im not quite sure if I should use sceKernelLoadExec() or pspSdkLoadStartModule() to start the vshmain.prx.
I have already posted this on lan.st but none seemed to really know. So im hoping that someone here can help since all the greats are here.
Thank you to all who help <-------------------
Last edited by fuzzzzy on Wed May 23, 2007 9:58 am; edited 1 time in total |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Wed May 23, 2007 8:55 am Post subject: |
|
|
Hi, i think that your first problem is that there is no main loop in your code, so your binary is just finnished as soon as it is launched. You should begin by adding a loop. Also note that your are not intercepting anything right now. You should test your code with psplinkusb.
Exemple :
| Code: |
/* vsh loadup module // By fuzzzzy */
//includes//
//psp sdk//
#include <pspkernel.h>
#include <pspsdk.h>
#include <psppower.h>
#include <math.h>
#include <string.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
//standard C//
#include <stdio.h>
#include <stdlib.h>
//from local file
#include <psploadexec_kernel.h>
#include <pspvshbridge.h>
PSP_MODULE_INFO("vshLoad", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
#define PATH "flash0:/vsh/nodule/vshmain.prx"
//init from flash//
int main_thread(SceSize args, void *argp)
{
SceCtrlData pad;
while(0)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_LTIRGGER)
{
struct SceKernelLoadExecParam param;
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.argp = PATH;
param.args = strlen(PATH) + 1;
param.key = "vsh";
sceKernelLoadExec(PATH, ¶m);
}
}
return 0;
}
|
|
|
| Back to top |
|
 |
fuzzzzy
Joined: 26 Apr 2007 Posts: 9
|
Posted: Wed May 23, 2007 9:56 am Post subject: |
|
|
| thnk you for pointing that out. I totally forgot that lol. Even though i added the loop it still doesnt work. And yes I am intercepting it. I want to name my module to vshmain.prx. So basically my module is taking the place of vshmain and only booting the vsh if L i pressed. Then it will load the vshmain_real.prx to start the xmb. |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Wed May 23, 2007 10:21 am Post subject: |
|
|
| Are you using the code pasted without changes ? Because right now you are launching "vshmain.prx" when L is pressed that wont work for sure if the vsh isn't stopped before. Like i said you should use psplinkusb to test your code (add some printf to debug) and/or look at psplink source to see how modules are loaded. |
|
| Back to top |
|
 |
fuzzzzy
Joined: 26 Apr 2007 Posts: 9
|
Posted: Wed May 23, 2007 2:02 pm Post subject: thnx |
|
|
| thnx for te heads up. Il try it out. |
|
| Back to top |
|
 |
Gh0sT
Joined: 06 Jun 2006 Posts: 5
|
Posted: Thu May 24, 2007 8:28 am Post subject: |
|
|
Sorry, to point this out, but I hope you're not just c&p-ing:
if(pad.Buttons & PSP_CTRL_LTIRGGER)?
Greets |
|
| Back to top |
|
 |
fuzzzzy
Joined: 26 Apr 2007 Posts: 9
|
Posted: Thu May 24, 2007 11:08 am Post subject: thnx |
|
|
| thnx for pointing out that typo lol |
|
| Back to top |
|
 |
fuzzzzy
Joined: 26 Apr 2007 Posts: 9
|
Posted: Thu May 24, 2007 1:50 pm Post subject: notin works |
|
|
| well nothing seems to work. Neither sceKernelLoadExec() or sceKernelLoadModule(). Wtf none of them seem to execute vshmain.prx. I must be doing somthing wrong. Someone must know the answer lol. |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Thu May 24, 2007 11:39 pm Post subject: Re: notin works |
|
|
| fuzzzzy wrote: | | well nothing seems to work. Neither sceKernelLoadExec() or sceKernelLoadModule(). Wtf none of them seem to execute vshmain.prx. I must be doing somthing wrong. Someone must know the answer lol. |
You must load and start other modules required before to load and start vshmain.prx
| Code: |
/kd/chkreg.prx
/kd/msaudio.prx
/kd/vshbridge.prx
/vsh/module/heaparea1.prx
/vsh/module/paf.prx
/vsh/module/common_gui.prx
/vsh/module/common_util.prx
/vsh/module/vshmain.prx
|
For 1.50 kernel, maybe other modules are necessary in greater firmware, use kprintf handler to know which modules are necessary.
EDIT :
Oups, i didn't see your second post, forget what i said, if you rename your module for it starts instead of real vshmain.prx, you don't need to load other modules, the firmware will do it for you. |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Wed May 30, 2007 8:23 am Post subject: |
|
|
How is this different from loading any other module :P
i think the problem is that you are not loading and starting
your module to use VSH_MODE(0x800) instead of USER_MODE(0x0)
(if you pick KERNEL_MODE(0x1000) it doesnt matter really, which you do)
but you DEFINITELY ! do not want to use any LoadExec** calls to load a
module on top of any other modules ...as loadExec will simply restart
the system and then load your module in whatever mode you choose
so it is preferred to use the pspSDK** loading/starting of modules
just make sure you know which memory area/partition you are loading into
as this is very important in the module properly working ...ie .. if you use a
kernel function in a kernel module you obviously want to load into a kernel
memory partition, second do not use the stdlib C lib, using newlib in a kernel
area always gives problems so it is best to use the PSP's own kernel libc
which you can easily use by setting your makefile to include USE_KERNEL_LIBC = 1, course this all works great on a 1.5 firmware PSP :P
as for further firmware revisions there is a bug in the kernel for loading
modules, you can try to edit the loadmodule sample that is in the PSPSDK
but remember that if your not on 1.5 then that warning right at the top of
the sample could very well mean that the bug also exists in your firmware
lastly, it is always better to load a kernel EBOOT first that can handle your
module and conduct its actions ...usually we use psplinkusb as it works magic
but you are always welcome to use your own EBOOT, as long as you set
that EBOOT to be in KERNEL_MODE, and then have this kmode eboot handle
the loading and starting and possibly setting where in memory to load your
custom module for whatever you are doing, apart from these things i do not
know what else could cause you this problem, as i can load any number of
modules as memory space allows me to load
if anything else, taking a look at the psplink source is always a great way
to start seeing how to properly load your modules, so it might help you to do that _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|