[RESOLVED] PRX Causing 2.71 SE-C Homebrew to Crash

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ADePSP
Posts: 58
Joined: Thu Jul 13, 2006 9:07 pm

[RESOLVED] PRX Causing 2.71 SE-C Homebrew to Crash

Post by ADePSP »

I've got a problem with PRXs on 2.71 SE-C and wondered if anyone knew of a way around it...?

I have tried with numerious PRXs and it seems to happen for all of them...

If I enable my PRX (or any PRX) in the VSH via the Recovery menu they work fine in the XMB but if I try to launch any homebrew (DevHook for example) then the system hangs at the white PSP animation that you get when things start...

I even created a PRX that does nothing except loop to check it wasn't something code wise that was causing the problem and get the same problem with that (see code below),

Code: Select all

#include <pspctrl.h>
#include <pspkernel.h>
#include <stdio.h>

PSP_MODULE_INFO&#40;"PRX Test", 0x1000, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

int MainThread &#40;SceSize args, void *argp&#41; &#123;

  while &#40;1&#41; &#123;

     sceKernelDelayThread&#40;10000&#41;;

  &#125;

  return 0;

&#125;

int module_start&#40;SceSize args, void *argp&#41; &#123;

  SceUID thid;

  thid = sceKernelCreateThread&#40;"PRX_Test", MainThread, 0x18, 0x1000, 0, NULL&#41;;
  if &#40;thid >= 0&#41; sceKernelStartThread&#40;thid, args, argp&#41;;

  return 0;

&#125;

int module_stop&#40;void&#41; &#123;

  return 0;

&#125;
ADePSP
Posts: 58
Joined: Thu Jul 13, 2006 9:07 pm

Post by ADePSP »

I finally found the solution so thought I'd post for others who may have the same issue...

You need to add the following function that checks for SceKernelLoadExecThread and safely terminates the module,

Code: Select all

void CheckCleanExit&#40;void&#41; &#123;

   SceUID thids&#91;50&#93;;
   int thid_count = 0;
   int i;
   SceUID fd;
   SceUID memid;
   SceKernelThreadInfo thinfo;

   //if sceKernelExitGame was called, exit before the system crashes
   sceKernelGetThreadmanIdList&#40;SCE_KERNEL_TMID_Thread,thids,50,&thid_count&#41;;
   for&#40;i=0;i<thid_count;i++&#41;
   &#123;
      memset&#40;&thinfo,0,sizeof&#40;SceKernelThreadInfo&#41;&#41;;
      thinfo.size = sizeof&#40;SceKernelThreadInfo&#41;;
            
      sceKernelReferThreadStatus&#40;thids&#91;i&#93;,&thinfo&#41;;

      if&#40;strcmp&#40;&thinfo.name&#91;0&#93;,"SceKernelLoadExecThread"&#41;==0&#41;
      &#123;
         sceKernelSelfStopUnloadModule&#40;0, 0, NULL&#41;; 
      &#125;
   &#125;

&#125;
Now simple call this function at the top of the main thread's while loop and the module will now not prevent loading homebrew when enabled in the XMB on 2.71 SE-C...

Code: Select all

#include <pspctrl.h> 
#include <pspkernel.h> 
#include <stdio.h> 

PSP_MODULE_INFO&#40;"PRX Test", 0x1000, 1, 0&#41;; 
PSP_MAIN_THREAD_ATTR&#40;0&#41;; 

int MainThread &#40;SceSize args, void *argp&#41; &#123; 

  while &#40;1&#41; &#123; 

     CheckCleanExit&#40;&#41;;

     sceKernelDelayThread&#40;10000&#41;; 

  &#125; 

  return 0; 

&#125; 

int module_start&#40;SceSize args, void *argp&#41; &#123; 

  SceUID thid; 

  thid = sceKernelCreateThread&#40;"PRX_Test", MainThread, 0x18, 0x1000, 0, NULL&#41;; 
  if &#40;thid >= 0&#41; sceKernelStartThread&#40;thid, args, argp&#41;; 

  return 0; 

&#125; 

int module_stop&#40;void&#41; &#123; 

  return 0; 

&#125;
ADePSP
Posts: 58
Joined: Thu Jul 13, 2006 9:07 pm

Post by ADePSP »

I've discovered this method stops my module working when the Homebrew is loaded (works fine for games)... Anybody got any ideas how to get around this...?
reefbarman
Posts: 87
Joined: Mon Jan 08, 2007 12:16 pm
Location: Australia

Post by reefbarman »

did you come up with a fix for this to have it running during homebrew??
Post Reply