Code: Select all
void DrawScreenQuad(struct Vertex Vert[2],unsigned char texture, int xpos, int ypos, int width, int height, int texWid, int texHei, int texBufWid);
void DrawScreenQuad(struct Vertex Vert[2],unsigned char texture, int xpos, int ypos, int width, int height, int texWid, int texHei, int texBufWid){
if(texture){
Vert[0].x = xpos;
Vert[0].y = ypos;
Vert[0].z = 0;
Vert[0].u = 0;
Vert[0].v = 0;
Vert[1].x = xpos+width;
Vert[1].y = ypos+height;
Vert[1].z = 0;
Vert[1].u = texWid;
Vert[1].v = texHei;
sceGuTexMode(GU_PSM_8888,0,0,0);
sceGuTexImage(0,texWid,texHei,texBufWid,texture);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA);
sceGuTexFilter(GU_LINEAR_MIPMAP_LINEAR,GU_LINEAR_MIPMAP_LINEAR);
sceGumDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,Vert);
}
}
This function is never referenced, it is completely arbitrary, yet causes a crash.
The PSP loads all the data, but crashes during the first loop, similar to an out-of-bounds array, but I can't work out why this arbitrary code could cause it.
This function isn't the only perpetraitor, another example is:
Working code:
Code: Select all
char* filePath;
build_path(filePath,skinDirectory,"MenuBar.png",0);
loadPNGvramfromfileoverwrite(filePath,512,64,(int)testMenuBar_temp);
Code: Select all
char* filePath;
filePath = NULL;
build_path(filePath,skinDirectory,"MenuBar.png",0);
loadPNGvramfromfileoverwrite(filePath,512,64,(int)testMenuBar_temp);
I'm not sure where to look for the problem, because there doesn't seem to be a problem. I'll include my makefile at the end of the post if that helps.
This problem is similar in nature to another one that I worked around on several projects using the GU - where the screen data is split in two, one shaded green and the other purple. To fix it, I would add an arbitrary bit of code. If anyone has come across this problem, it may help in solving my current situation.
I'm really hoping that someone knows why my code is crashing, because i'm finding it very hard to debug.
Thanks.
My Makefile:
Code: Select all
TARGET = browser
OBJS = main.o
INCDIR = "/home/Paul/pspgames/libungif/lib" "/home/Paul/pspgames/freetype/include"
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS= -lstdc++ -lpspgum -lpspgu -lpng -ljpeg -lungif -lz -lm -lfreetype -lpsppower -lpspsdk
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = WebBrowserTest
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code based on cube.c sample
Uses main .cpp file with several large .h files
C++ code
Uses GU code
Runs in user mode