I'm experiencing very wierd behaviour in my C++ psp app. (Raptor)
For example if I do this,
Code: Select all
ParticleEngine * pe = new ParticleEngine( NULL,1000 );
But if I change it to this,
Code: Select all
Texture *ftex = new Texture("flare.jpg",JPEG);
ParticleEngine * pe = new ParticleEngine( ftex,1000 );
But , and this is where it gets really wierd.. If I add two calls to my log system within the particleengine constructor, one at the top, and one at the bottom, trying to pinpoint where it crashes.
It no longer crashes. But now my framerate(A counter at the top of the screen) firmly stays at ZERO, and the screen is blank.
This is the second time this has happened. I added a terrain engine to raptor recently, and if I call it before loading a b3d, the b3d call fails and crashes. but when I added logger calls to the b3d load, it no longer crashes.
The result of this is an impossible to trace crash point.
Here's the full code to the demo as it crashes, it's very simple with very little logic.
Code: Select all
int main(int argc, char **argv)
{
pspDebugScreenInit();
InitRaptor();
Joypad *joy = new Joypad;
SetDefaultStyle( new GradientStyle );
Display *sys = new Display(argc,argv);
Pen *pen = new Pen;
Camera *vcam = Factory->ProduceCamera();
vcam->Position(0,40,-20);
Renderer->_ActiveCam = vcam;
vcam->PointAt(0,0,0);
float bx,by;
bx=0;
by=0;
glDisable( GL_CULL_FACE );
Font *fnt = new Font("fnt1.bmp",32,32);
FontRenderer->SetActive( fnt );
FontRenderer->SetColor(1,1,1);
char * yawtxt = NULL;
char * angtxt = NULL;
int mode;
mode = m_play;
float cx,cy;
cx=0;
cy=0;
float ex=0;
u64 fp_lms;
int fp_frms;
int fp_fps;
int fp_first = true;
int lm = sceRamLeft();
float frame=1;
Logger->Log("Entering Main Loop.\n");
Texture *ftex = new Texture("flare.jpg",JPEG);
Logger->Log("Creating PE\n");
ParticleEngine * pe = new ParticleEngine( ftex,1000 );
Particle * ep = pe->Emit( 5,0,0,0,0,0 );
pe->Emit( 3,-2,0,0,0,0 );
pe->Emit( 7,-1,0,0,0,0 );
vcam->Position( 0,20,0 );
vcam->PointAt( 0,0,0 );
Logger->Log("Entering Main Loop.\n");
while(1)
{
for(int i=0;i<10;i++)
{
pe->Emit( 0,0,0,( -5+rand()%10 ) ,0,(-5+rand()%10) );
};
pe->Update();
frame++;
if(frame>199) frame=1;
u64 ms = GetTick();
if( (ms<fp_lms) || (fp_first == true) )
{
fp_fps = fp_frms;
fp_frms=0;
fp_lms=ms-1000;
fp_first = false;
}
fp_frms++;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
j
oy->Update();
float xi,yi;
xi = joy->_x;
yi = joy->_y;
if(fabs(xi)>0.4)
{
cx+=xi;
}
if(fabs(yi)>0.4)
{
cy+=yi;
}
if(cy>360) cy=0;
Renderer->RenderScene();
Blend_Mask();
sys->Draw2D();
if( !(yawtxt == NULL ) )
{
free( (void *)yawtxt );
}
yawtxt = StringUtil->Num( fp_fps );
FontRenderer->RenderText(0,0,yawtxt);
Blend_Solid();
if(joy->_select==1)
{
CloseRaptor();
sceKernelExitGame();
}
if( joy->_rtrigger )
{
screenshot("mplay");
}
glutSwapBuffers();
}
return (0);
}
Code: Select all
TARGET = lesson2
OBJS = main.o
CFLAGS = -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions
ASFLAGS = $(CFLAGS)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += -I$(PSPSDK)/../include -fsingle-precision-constant -g
LIBS += -llua -lz -lpspgu -ljpeg -lpng -lz -losl -lpspgu -lmikmod -lpspaudio -lGLU -lglut -lGLU -lGL -llualib -llua -lm -lc -lpsputility -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpspvfpu -lpsplibc -lpspuser -lpspkernel -lpsprtc -lpsppower -lstdc++ -llua
LDFLAGS += -DMODULE_NAME="Raptor Alpha" psp-setup.c
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Raptor Test
# PSP_EBOOT_ICON = hero.png
# PSP_EBOOT_PIC1 = bg.png
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Any help would be appreciated as this is just something I've never seen before. I've coded a million apps on the pc and never run into this before.