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 

Weird crash

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



Joined: 30 Mar 2008
Posts: 261

PostPosted: Sun Feb 14, 2010 6:14 am    Post subject: Weird crash Reply with quote

Sorry for the unclear title but i couldn't think of something better.

I am trying to create a load from MS function but it seems to crash here:

Code:

         unsigned char count=0;
         unsigned char cursor=0;
         SceCtrlData pad;
         msg.ShowMessage("testpoint -1",0);
         bool go=1;
         while(go)
         {
            GraphicsObject::endFrame();
            GraphicsObject::startFrame();

            pspDebugScreenSetXY(0,0);
            pspDebugScreenPrintf("Files:\n");
            count=0;
            for(std::vector<SceIoDirent>::size_type i=0;i<filelist.size() && count <= 32;i++)
            {
               if(i==cursor)
                  pspDebugScreenPrintf("->%s\n",filelist[i].d_name);
               else
                  pspDebugScreenPrintf("  %s\n",filelist[i].d_name);
               count++;
            }
            if(cursor>count)
               cursor=count-2;

            sceCtrlReadBufferPositive(&pad,1);
            if(pad.Buttons & PSP_CTRL_UP && cursor>0)
               cursor--;
            if(pad.Buttons & PSP_CTRL_DOWN && cursor<32)
               cursor++;

            if(pad.Buttons & PSP_CTRL_CROSS){
               msg.ShowMessage("testpoint 0",0);
               go=0;
            }
         }
         msg.ShowMessage("testpoint 1",0);

I see the "testpoint -1" message. i can use the Up and DOWN button. But when i press CROSS it does nothing anymore. I don't see a crash report in PSPLink but i don't see the next message. Also without the message it stops responding.

I'm looking for some hour to this problem but i can't find a problem.

Can someone find the cause of that rpoblem?
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
justin



Joined: 17 Oct 2007
Posts: 16

PostPosted: Mon Feb 15, 2010 9:44 pm    Post subject: Reply with quote

From what I can see, once you press cross, you exit the while(go) loop and never render another frame... unless there is some code below that you haven't posted.
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Tue Feb 16, 2010 5:16 am    Post subject: Reply with quote

Well....
It's just a small part of a function. I see the first message "testpoint -1" but after i press CROSS it does nothing anymore.

This is the whole function:
Code:
void CellManager::loadFile()
{
   EasyMessage msg;
   SceUID dir;
   dir = sceIoDopen(".");
   if(dir)
   {
      std::vector<SceIoDirent> filelist;
      SceIoDirent entry;

      while(sceIoDread(dir,&entry))
      {
         if(strcmp(entry.d_name,"EBOOT.PBP")==0 || strcmp(entry.d_name,".")==0 || strcmp(entry.d_name,"..")==0)
         {            
         }
         else
         {
            filelist.push_back(entry);
         }
      }
      sceIoDclose(dir);
      if(filelist.size()>0)
      {
         unsigned char count=0;
         unsigned char cursor=0;
         SceCtrlData pad;
         msg.ShowMessage("testpoint -1",0);
         bool go=1;
         while(go)
         {
            GraphicsObject::endFrame();
            GraphicsObject::startFrame();

            pspDebugScreenSetXY(0,0);
            pspDebugScreenPrintf("Files:\n");
            count=0;
            for(std::vector<SceIoDirent>::size_type i=0;i<filelist.size() && count <= 32;i++)
            {
               if(i==cursor)
                  pspDebugScreenPrintf("->%s\n",filelist[i].d_name);
               else
                  pspDebugScreenPrintf("  %s\n",filelist[i].d_name);
               count++;
            }
            if(cursor>count)
               cursor=count-2;

            sceCtrlReadBufferPositive(&pad,1);
            if(pad.Buttons & PSP_CTRL_UP && cursor>0)
               cursor--;
            if(pad.Buttons & PSP_CTRL_DOWN && cursor<32)
               cursor++;

            if(pad.Buttons & PSP_CTRL_CROSS){
               msg.ShowMessage("testpoint 0",0);
               go=0;
            }
         }
         msg.ShowMessage("testpoint 1",0);
         SceUID fd = sceIoOpen(filelist[cursor].d_name,PSP_O_RDONLY,0777);
         if(fd)
         {
            unsigned char tSize[2];
            sceIoRead(fd,tSize,2);
            msg.ShowMessage("testpoint 2",0);
            if(tSize[0]>=20 && tSize[0]<=240 && tSize[1]>=20 && tSize[1]<=136)
            {
               msg.ShowMessage("testpoint 3",0);
               char tGrid[tSize[0]*tSize[1]];
               int tBytes=sceIoRead(fd,tGrid,tSize[0]*tSize[1]);
               if(tBytes==tSize[0]*tSize[1])
               {
                  initalise(tSize[0],tSize[1]);
                  clear();
                  for(int x=0;x<mWidth;x++)
                  {
                     for(int y=0;y<mHeight;y++)
                     {
                        if(tGrid[y*mWidth+x]=='1')
                           setAlive(x,y);
                        else
                           setDeath(x,y);
                     }
                  }
                  msg.ShowMessage("testpoint 4",0);
               }
               else
               {
                  msg.ShowMessage("File corrupted",0);
               }
            }
            else
            {
               msg.ShowMessage("File corrupted",0);
            }
            sceIoClose(fd);
         }
         else
         {
            msg.ShowMessage("Error opening file",0);
         }
      }
      else
      {
         msg.ShowMessage("No files found",0);
      }
   }
   else
   {
      msg.ShowMessage("Error while searching for files.",0);
   }
}


_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
unsigned int



Joined: 13 Aug 2009
Posts: 22

PostPosted: Tue Feb 16, 2010 5:38 am    Post subject: Reply with quote

This looks suspicious:

Quote:

GraphicsObject::endFrame();
GraphicsObject::startFrame();


If you press X and you break out of the loop, it looks like there is still a pending startFrame() that might clash with the message drawing function? Just a guess.
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Tue Feb 16, 2010 7:47 am    Post subject: Reply with quote

It's just a sub-drawloop

I previous frame is started so i end that one at the beginning of the loop and start a new one.
When the loops ends the the rendering should continiue with the new frame.
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
justin



Joined: 17 Oct 2007
Posts: 16

PostPosted: Tue Feb 16, 2010 10:18 pm    Post subject: Reply with quote

I'd put a
Code:
GraphicsObject::endFrame();
GraphicsObject::startFrame();

after every
Code:
msg.ShowMessage();

At least then you know more about where you're getting up to. Failing that, are you running through psplink? Does it show the details of the crash?
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Wed Feb 17, 2010 2:20 am    Post subject: Reply with quote

PSPLink doesn't show a crashlog

I will try to initalise the GU again after the loop
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
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