I have been checking the alignement of all objects, of allocated arrays and structs (so that it is consistently used across the allocated data), I checked that the _init function is indeed called (I'll post here the section in which I call it inside main ()), checked the copy constructors, the overloaded operators, I am trying to catch all possible issues adding -Wall -Wextra -Wundef -Wshadow to the CFLAGS in the Makefile and making sure to eliminate all warnings but the "unused variable" ones (which are not dynamically allocated variables anyways) and I think I have isolated the crashing point around a certain point in the code (it used to crash before that section, but fixing stuff along the way I was able to get the application farther before it would crash)... the problem is that where it crashes... it makes no sense really (matrix multiply code that has been working since the PS2Linux days... dear old SPS2 ;)).
Downgrading back to FW 1.50 is not an option as I would like to keep the features introduced with FW 2.00 (like AVC and I will probably keep upgrading as the eLoader grows and keeps supporting ScummVM even with future Firmware Updates ;))... the problem is that this bars me from using PSPLINK too... As far as I can read here, if you want to develop for FW > 1.50 you just have to say bye-bye to debugging using gdb or PSPLINK or any other useful tool... I am kinda iffy about using stdout to write to the Memory Stick and keep a log that way as I do not want to brick the PSP if it shuts off while writing to Flash.
main.cpp:
Code: Select all
[...]
static int init_was_called = 0;
__attribute__ ((constructor))
void loaderInit()
{
int kmode_is_available = (sceKernelDevkitVersion() < 0x02000010);
if (kmode_is_available) {
/* Do nefarious kernel stuff here */
}
init_was_called = 1;
}
#ifdef __cplusplus
extern "C" {
#endif
extern void _init(void);
#ifdef __cplusplus
}
#endif
int SetupCallbacks();
int main(int argc, char *argv[])
{
/* Fanjita's EBOOT loader can be configured to skip the call to _init().
Since we need _init() for C++, we check to see if _init() has been
called. If it hasn't we call it manually, after determining whether or
not we can access the kernel. */
if (!init_was_called) {
_init();
}
SetupCallbacks();
[...]
I can provide the whole source code of all files of this application including of course the source code of the two libraries that I have used to buld my application (geommath and intmdloader developed by Sparky and slightly modified in the Makefile really so that they compile against PSPSDK [then you would put the compiled .a libraries and the .h include files inside the PSPSDK appropriate directories so that they are found by the application]) if needed.
I have tried to understand what the problem could be for days, even trying the #fanjita chat and begged for help...
It crashes inside the appropriately commented section in this code section (which would indicate that somewhere before this point the memory got dirtied up a bit...):
camera3d.cpp:
Code: Select all
void camera3d::lookDir (point &up) {
//point z;
//
////z = w * -1; //we store eye - target so we do not need to flip the sign
//w.normalize();
//cameraMatrix.SetRowVector (2, z);
//
//point x ;
//
//x = up ^ z;
//
//x.normalize ();
//cameraMatrix.SetRowVector (0, x);
//point y;
//
//y = z ^ x;
//cameraMatrix.SetRowVector (1, y);
// x y z <--> u v w
w.normalize();
cameraMatrix.SetRowVector (2, w);
u = up ^ w;
u.normalize ();
cameraMatrix.SetRowVector (0, u);
////
v = w ^ u;
cameraMatrix.SetRowVector (1, v);
point temp_eye;
temp_eye = eye;
point temp;
temp_eye.w = 0;
//u.print_vector ( "\nX (u) for Sparky: ");
//v.print_vector ( "\nY (v) for Sparky: ");
//w.print_vector ( "\nZ (w) for Sparky: ");
temp.x = (u * temp_eye) * (-1); //(u * eye) * (-1); //(x * eye) * (-1);
temp.y = (v * temp_eye) * (-1); //(v * eye) * (-1); //(y * eye) * (-1);
temp.z = (w * temp_eye) * (-1); //(w * eye) * (-1); //(z * eye) * (-1);
temp.w = 0;
return;
///////////////////////////////////////////
//If it enters the following function all goes to heck!!!!
cameraMatrix = (cameraMatrix.translateXYZ ( temp.x, temp.y, temp.z));
///////////////////////////////////////////
return;
}
pmatrix.cpp:
Code: Select all
pmatrix pmatrix::translateXYZ (float x = 0, float y = 0, float z = 0) {
pmatrix p;
pmatrix p1;
p.IdentityMatrix ();
p1.IdentityMatrix ();
p1 = (*this);
p.SetValue (0,3,x);
p.SetValue (1,3,y);
p.SetValue (2,3,z);
p1.MultMatrix ( &p);
return p1;
}
Code: Select all
$ make
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/main.o src/main.cpp
src/main.cpp:98: warning: unused parameter 'argc'
src/main.cpp:98: warning: unused parameter 'argv'
src/main.cpp:271: warning: unused parameter 'arg1'
src/main.cpp:271: warning: unused parameter 'arg2'
src/main.cpp:271: warning: unused parameter 'common'
src/main.cpp:278: warning: unused parameter 'args'
src/main.cpp:278: warning: unused parameter 'argp'
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -c -o src/disablefpu.o src/disablef
pu.S
bin2o -i ../gu/cube/logo.raw logo.o logo
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/point.o src/point.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/pmatrix.o src/pmatrix.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
$
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/camera3d.o src/camera3d.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/Matrix_stack.o src/Matrix_stack.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/3dsloader.o src/3dsloader.cpp
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/ctextureP2.o src/ctextureP2.cpp
src/ctextureP2.cpp:88: warning: unused parameter 'tbuffer_id'
ccache psp-g++ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G
0 -Wall -Wextra -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -
fsingle-precision-constant -fno-exceptions -fno-exceptions -fno-rtti -c -o src
/clipper3d.o src/clipper3d.cpp
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -c -o src/valloc.o src/valloc.c
ccache psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -Wextr
a -Wundef -Wshadow -Os -msingle-float -funroll-loops -ffast-math -fsingle-precis
ion-constant -fno-exceptions -L. -LC:/cygwin/usr/local/pspdev/psp/sdk/lib src
/main.o src/disablefpu.o logo.o src/point.o src/pmatrix.o src/PSP_Utils.o src/ca
mera3d.o src/Matrix_stack.o src/3dsloader.o src/ctextureP2.o src/clipper3d.o src
/valloc.o -lpng -lz -lintmdloader -lgeommath -lpspgu -lstdc++ -lm -lc -lpspdebu
g -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_ap
ctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o krondor.elf
psp-fixup-imports krondor.elf
mksfo 'IGGS_PSP Neverland Engine' PARAM.SFO
psp-strip krondor.elf -o krondor_strip.elf
pack-pbp EBOOT.PBP PARAM.SFO NULL \
NULL NULL NULL \
NULL krondor_strip.elf NULL
rm -f krondor_strip.elf
Help would be REALLY appreciated.