forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ADePSP



Joined: 13 Jul 2006
Posts: 58

PostPosted: Wed Dec 06, 2006 12:34 am    Post subject: [RESOLVED] PRX Causing 2.71 SE-C Homebrew to Crash Reply with quote

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:
#include <pspctrl.h>
#include <pspkernel.h>
#include <stdio.h>

PSP_MODULE_INFO("PRX Test", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);

int MainThread (SceSize args, void *argp) {

  while (1) {

     sceKernelDelayThread(10000);

  }

  return 0;

}

int module_start(SceSize args, void *argp) {

  SceUID thid;

  thid = sceKernelCreateThread("PRX_Test", MainThread, 0x18, 0x1000, 0, NULL);
  if (thid >= 0) sceKernelStartThread(thid, args, argp);

  return 0;

}

int module_stop(void) {

  return 0;

}
Back to top
View user's profile Send private message
ADePSP



Joined: 13 Jul 2006
Posts: 58

PostPosted: Fri Dec 08, 2006 6:15 am    Post subject: Reply with quote

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:
void CheckCleanExit(void) {

   SceUID thids[50];
   int thid_count = 0;
   int i;
   SceUID fd;
   SceUID memid;
   SceKernelThreadInfo thinfo;

   //if sceKernelExitGame was called, exit before the system crashes
   sceKernelGetThreadmanIdList(SCE_KERNEL_TMID_Thread,thids,50,&thid_count);
   for(i=0;i<thid_count;i++)
   {
      memset(&thinfo,0,sizeof(SceKernelThreadInfo));
      thinfo.size = sizeof(SceKernelThreadInfo);
           
      sceKernelReferThreadStatus(thids[i],&thinfo);

      if(strcmp(&thinfo.name[0],"SceKernelLoadExecThread")==0)
      {
         sceKernelSelfStopUnloadModule(0, 0, NULL);
      }
   }

}


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:
#include <pspctrl.h>
#include <pspkernel.h>
#include <stdio.h>

PSP_MODULE_INFO("PRX Test", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);

int MainThread (SceSize args, void *argp) {

  while (1) {

     CheckCleanExit();

     sceKernelDelayThread(10000);

  }

  return 0;

}

int module_start(SceSize args, void *argp) {

  SceUID thid;

  thid = sceKernelCreateThread("PRX_Test", MainThread, 0x18, 0x1000, 0, NULL);
  if (thid >= 0) sceKernelStartThread(thid, args, argp);

  return 0;

}

int module_stop(void) {

  return 0;

}
Back to top
View user's profile Send private message
ADePSP



Joined: 13 Jul 2006
Posts: 58

PostPosted: Sat Dec 09, 2006 5:08 am    Post subject: Reply with quote

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...?
Back to top
View user's profile Send private message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Thu Feb 15, 2007 4:52 pm    Post subject: Reply with quote

did you come up with a fix for this to have it running during homebrew??
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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