Discuss the development of new homebrew software, tools and libraries.
Moderators: cheriff , TyRaNiD
jojojoris
Posts: 255 Joined: Sun Mar 30, 2008 4:06 am
Post
by jojojoris » Sun Feb 14, 2010 6:14 am
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(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: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
justin
Posts: 15 Joined: Wed Oct 17, 2007 7:34 pm
Post
by justin » Mon Feb 15, 2010 9:44 pm
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 » Tue Feb 16, 2010 5:16 am
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::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: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
unsigned int
Posts: 18 Joined: Thu Aug 13, 2009 11:42 pm
Post
by unsigned int » Tue Feb 16, 2010 5:38 am
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 » Tue Feb 16, 2010 7:47 am
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(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
justin
Posts: 15 Joined: Wed Oct 17, 2007 7:34 pm
Post
by justin » Tue Feb 16, 2010 10:18 pm
I'd put a
Code: Select all
GraphicsObject::endFrame();
GraphicsObject::startFrame();
after every
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 » Wed Feb 17, 2010 2:20 am
PSPLink doesn't show a crashlog
I will try to initalise the GU again after the loop
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}