Weird crash

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

Moderators: cheriff, TyRaNiD

Post Reply
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Weird crash

Post by jojojoris »

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: Select all

			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&#40;std&#58;&#58;vector<SceIoDirent>&#58;&#58;size_type i=0;i<filelist.size&#40;&#41; && count <= 32;i++&#41;
				&#123;
					if&#40;i==cursor&#41;
						pspDebugScreenPrintf&#40;"->%s\n",filelist&#91;i&#93;.d_name&#41;;
					else
						pspDebugScreenPrintf&#40;"  %s\n",filelist&#91;i&#93;.d_name&#41;;
					count++;
				&#125;
				if&#40;cursor>count&#41;
					cursor=count-2;

				sceCtrlReadBufferPositive&#40;&pad,1&#41;;
				if&#40;pad.Buttons & PSP_CTRL_UP && cursor>0&#41;
					cursor--;
				if&#40;pad.Buttons & PSP_CTRL_DOWN && cursor<32&#41;
					cursor++;

				if&#40;pad.Buttons & PSP_CTRL_CROSS&#41;&#123;
					msg.ShowMessage&#40;"testpoint 0",0&#41;;
					go=0;
				&#125;
			&#125;
			msg.ShowMessage&#40;"testpoint 1",0&#41;;
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: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
justin
Posts: 15
Joined: Wed Oct 17, 2007 7:34 pm

Post by justin »

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.
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

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: Select all

void CellManager&#58;&#58;loadFile&#40;&#41;
&#123;
	EasyMessage msg;
	SceUID dir;
	dir = sceIoDopen&#40;"."&#41;;
	if&#40;dir&#41;
	&#123;
		std&#58;&#58;vector<SceIoDirent> filelist;
		SceIoDirent entry;

		while&#40;sceIoDread&#40;dir,&entry&#41;&#41;
		&#123;
			if&#40;strcmp&#40;entry.d_name,"EBOOT.PBP"&#41;==0 || strcmp&#40;entry.d_name,"."&#41;==0 || strcmp&#40;entry.d_name,".."&#41;==0&#41;
			&#123;				
			&#125;
			else
			&#123;
				filelist.push_back&#40;entry&#41;;
			&#125;
		&#125;
		sceIoDclose&#40;dir&#41;;
		if&#40;filelist.size&#40;&#41;>0&#41;
		&#123;
			unsigned char count=0;
			unsigned char cursor=0;
			SceCtrlData pad;
			msg.ShowMessage&#40;"testpoint -1",0&#41;;
			bool go=1;
			while&#40;go&#41;
			&#123;
				GraphicsObject&#58;&#58;endFrame&#40;&#41;;
				GraphicsObject&#58;&#58;startFrame&#40;&#41;;

				pspDebugScreenSetXY&#40;0,0&#41;;
				pspDebugScreenPrintf&#40;"Files&#58;\n"&#41;;
				count=0;
				for&#40;std&#58;&#58;vector<SceIoDirent>&#58;&#58;size_type i=0;i<filelist.size&#40;&#41; && count <= 32;i++&#41;
				&#123;
					if&#40;i==cursor&#41;
						pspDebugScreenPrintf&#40;"->%s\n",filelist&#91;i&#93;.d_name&#41;;
					else
						pspDebugScreenPrintf&#40;"  %s\n",filelist&#91;i&#93;.d_name&#41;;
					count++;
				&#125;
				if&#40;cursor>count&#41;
					cursor=count-2;

				sceCtrlReadBufferPositive&#40;&pad,1&#41;;
				if&#40;pad.Buttons & PSP_CTRL_UP && cursor>0&#41;
					cursor--;
				if&#40;pad.Buttons & PSP_CTRL_DOWN && cursor<32&#41;
					cursor++;

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

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
unsigned int
Posts: 18
Joined: Thu Aug 13, 2009 11:42 pm

Post by unsigned int »

This looks suspicious:
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.
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

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: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
justin
Posts: 15
Joined: Wed Oct 17, 2007 7:34 pm

Post by justin »

I'd put a

Code: Select all

GraphicsObject&#58;&#58;endFrame&#40;&#41;;
GraphicsObject&#58;&#58;startFrame&#40;&#41;;
after every

Code: Select all

msg.ShowMessage&#40;&#41;;
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?
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

PSPLink doesn't show a crashlog

I will try to initalise the GU again after the loop

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
Post Reply