 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
JumpR
Joined: 10 Feb 2008 Posts: 25
|
Posted: Thu Nov 06, 2008 4:42 am Post subject: 'Ejection' of Memory Stick |
|
|
EDIT: Problem solved.
Hey,
I've been trying to get the game menu to recache for a while, and I've got it to work at random intervals. Below is the code I use to simulate an ejection and insertion of the memory stick.
| Code: | SceUID cbid = -1;
// Hook function (it's called from vshmain so syscall will do fine)
sctrlHENPatchSyscall(FindProc("sceThreadManager", "ThreadManForUser", 0xE81CAF8F), sceKernelCreateCallbackPatched);
// Patched function which stores callback id
int sceKernelCreateCallbackPatched(const char *name, SceKernelCallbackFunction func, void *arg)
{
int res = sceKernelCreateCallback(name, func, arg);
u32 k1 = pspSdkSetK1(0);
if (strcmp(name, "SceVshMediaDetectMS") == 0)
cbid = res;
pspSdkSetK1(k1);
return res;
}
// Simulate an ejection and insertion event
if (sceKernelFindModuleByName("game_plugin_module"))
{
sceKernelNotifyCallback(cbid, 2);
sceKernelNotifyCallback(cbid, 1);
} |
If you want me to be more exact, it only works if I execute the code right after I entered the game menu, and when it's still reading a file. This is a fraction of a second at which it works, which confuses me. Does anybody have any idea what's going on? I've also tried only ejecting it, but that doesn't work either, only on that fraction of a second.
I saw this post from Adrahil, which suggests me that it is possible. A different method to recache the game directory would also be greatly appreciated. I can't do a normal stop and unload module on game_plugin_module either, as that causes a crash.
Thanks in advance,
Bubbletune (JumpR)
Last edited by JumpR on Sun Nov 09, 2008 8:07 am; edited 1 time in total |
|
| Back to top |
|
 |
blu_eye4
Joined: 26 Oct 2008 Posts: 37
|
Posted: Thu Nov 06, 2008 5:48 am Post subject: |
|
|
| could you post all code? maybe memory card function is include only inside the function who declare your menu, i don't know i'am a noob ;) excuse me for my language, i'm italian :) |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Fri Nov 07, 2008 1:10 am Post subject: |
|
|
im not at home to test this, but i believe it can be done like boosters syscon hook sample. you can change the state of wlan, memory stick, buttons, even tamper the battery info at the lowest level before it reaches any other function call. it might be overkill for this purpose though.
also when registering the hook, i think you should also check for a previous hook and call that in your function so that it doesnt destroy a previous one (similar to sctrlHENSetStartModuleHandler)
Last edited by Torch on Wed Jun 17, 2009 3:32 pm; edited 1 time in total |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Fri Nov 07, 2008 1:22 am Post subject: |
|
|
| i think memory stick is detected as a button press, so thats basically the root cause. might be overridable by hooking the scectrl_driver functions. if thats not possible then guess youll have to try the syscon hook. ex the hold button press can only be overridden before the ctrl function, or by patching the ctrl function to not ignore the other buttons. im noob at mips so i couldnt patch. |
|
| 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
|