Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff , TyRaNiD
kralyk
Posts: 114 Joined: Sun Apr 06, 2008 8:18 pm
Location: Czech Republic, central EU
Post
by kralyk » Tue Nov 25, 2008 8:36 am
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: Select all
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: Select all
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...
moonlight
Posts: 567 Joined: Wed Oct 26, 2005 7:46 pm
Post
by moonlight » Tue Nov 25, 2008 9:07 am
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.
kralyk
Posts: 114 Joined: Sun Apr 06, 2008 8:18 pm
Location: Czech Republic, central EU
Post
by kralyk » Tue Nov 25, 2008 9:50 am
Ok, I removed that, but still crashes (in fact crashes even with module_stop just returning 0)
Here is the pluginMain function:
Code: Select all
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...
kralyk
Posts: 114 Joined: Sun Apr 06, 2008 8:18 pm
Location: Czech Republic, central EU
Post
by kralyk » Wed Nov 26, 2008 1:16 am
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...
ne0h
Posts: 386 Joined: Thu Feb 21, 2008 2:15 am
Post
by ne0h » Wed Nov 26, 2008 3:42 am
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.
kralyk
Posts: 114 Joined: Sun Apr 06, 2008 8:18 pm
Location: Czech Republic, central EU
Post
by kralyk » Wed Nov 26, 2008 4:32 am
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...