 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Tue Nov 25, 2008 8:36 am Post subject: My plugin crashes |
|
|
Hi,
Im trying to make a vsh plugin,
but it crashes the PSP when I load a game from XMB (its not unloaded correctly?)
the code:
| Code: | int module_stop(void)
{
sceKernelTerminateDeleteThread(mainthread);
sceKernelSelfStopUnloadModule(1, 0, NULL);
return 0;
}
int module_start(SceSize args, void *argp)
{
mainthread = sceKernelCreateThread("My__Plugin", pluginMain, 6, 0x4000, 0, NULL);
if (mainthread >= 0)
{
sceKernelStartThread(mainthread, args, argp);
}
return 0;
}
|
Exports:
| Code: | PSP_BEGIN_EXPORTS
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC(module_start)
PSP_EXPORT_FUNC(module_stop)
PSP_EXPORT_VAR(module_info)
PSP_EXPORT_END
PSP_END_EXPORTS |
Thanks for any help! _________________ ...sorry for my english... |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Tue Nov 25, 2008 9:07 am Post subject: |
|
|
You shouldn't use sceKernelSelfStopUnloadModule(1, 0, NULL); in module_stop.
That would return an error, since your module is already being stoped. Anyways, I don't know if this is reason enough for the crash, there maybe other reason. |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Tue Nov 25, 2008 9:50 am Post subject: |
|
|
Ok, I removed that, but still crashes (in fact crashes even with module_stop just returning 0)
Here is the pluginMain function:
| Code: | int pluginMain(SceSize args, void *argp)
{
SceCtrlData pad;
sceKernelDelayThread(10*100000);
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while (1)
{
sceCtrlPeekBufferPositive(&pad, 1);
if ((pad.Buttons & PSP_CTRL_SQUARE) && (pad.Buttons & PSP_CTRL_LTRIGGER))
{
blit_string(30, 27, "HELLO WORLD!", 0xffffffff, 0x0);
};
if(sceKernelFindModuleByName("msvideo_plugin_module"))
{
blit_string(30, 30, "Video player loaded.", 0xffffffff, 0x0);
}
sceDisplayWaitVblankStart();
}
return 0;
}
|
_________________ ...sorry for my english... |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Wed Nov 26, 2008 1:16 am Post subject: |
|
|
No idea?
Maybe someone could tell me about some open source plugin (besides piKey) which I could look into source of ......?
I dont have any experience making vsh plugins and I cant find any open source ones... =( _________________ ...sorry for my english... |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Wed Nov 26, 2008 3:42 am Post subject: |
|
|
Add a short delay in the while cycle, sceKernelDelayThread(1000) is enough...
Last edited by ne0h on Wed Nov 26, 2008 5:12 am; edited 1 time in total |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Wed Nov 26, 2008 4:32 am Post subject: |
|
|
wow thanks ne0h that did help.
So I guess the loop was too tight...
I though sceDisplayWaitVblankStart(); would be enough but apparently not...
thanks. _________________ ...sorry for my english... |
|
| Back to top |
|
 |
|
|
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
|