I have the usbhostfs up and running, it connects to psp telling me "connected to device" and I've got the pspsh up and running too. So basically I have the PSPLink, drivers and the two external tools installed. But when I'm actually trying to debug, all hell breaks loose.
My main.cpp
Code: Select all
#include <SDL/SDL.h>
#include <pspdebug.h>
#include <pspkernel.h>
#define printf pspDebugScreenPrintf
#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 272
PSP_MODULE_INFO ( "SDL", 0, 1, 1 );
PSP_HEAP_SIZE_KB( 20480 );
PSP_MAIN_THREAD_ATTR( PSP_THREAD_ATTR_USER|PSP_THREAD_ATTR_VFPU );
int exit_callback( int arg1, int arg2, void *common )
{
sceKernelExitGame( );
return 0;
}
int CallbackThread( SceSize args, void *argp )
{
int cbid = sceKernelCreateCallback( "Exit Callback", exit_callback, NULL );
sceKernelRegisterExitCallback( cbid );
sceKernelSleepThreadCB( );
return 0;
}
int SetupCallbacks( void )
{
int thid = 0;
thid = sceKernelCreateThread( "update_thread", CallbackThread, 0x11, 0xFA0, 0, 0 );
if(thid >= 0)
sceKernelStartThread( thid, 0, 0 );
return 0;
}
int InitVideo( )
{
if (SDL_Init( SDL_INIT_VIDEO ) != 0)
{
printf( "SDL_Init(): %s\n", SDL_GetError() );
SDL_Quit( );
return 1;
}
else
return 0;
}
int main( int argc, char **argv )
{
pspDebugScreenInit( );
SetupCallbacks( );
SDL_Surface *screen;
InitVideo();
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_FULLSCREEN | SDL_DOUBLEBUF | SDL_HWSURFACE );
SDL_Surface *image;
SDL_Surface *temp;
temp = SDL_LoadBMP( "cat.bmp" );
if( temp == NULL )
printf( "SDL_LoadBMP(): %s\n", SDL_GetError( ) );
image = SDL_DisplayFormat( temp );
if( image == NULL )
printf( "SDL_DisplayFormat( ): %s\n", SDL_GetError( ) );
SDL_FreeSurface( temp );
SDL_Rect src;
src.x = 0;
src.y = 0;
src.w = image->w;
src.h = image->h;
SDL_BlitSurface( image, NULL, screen, &src);
SDL_Flip( screen );
SDL_Delay( 2500 );
SDL_FreeSurface( image );
return 0;
}
Code: Select all
TARGET = hello
OBJS = main.o
CFLAGS = -O2 -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
EXTRA_TARGETS = EBOOT.PBP
LIBS = -lSDL -lGL -lz -lpng -lm -ljpeg -lpsppower_driver -lpspvfpu -lpsphprm -lpsprtc -lpspaudio -lpspgu -lpspirkeyb -lpsppower
PSP_EBOOT_TITLE = Test SDL
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Nothing too hardcore there, just setting up SDL, callbacks and stuff. It works BUT it freezes my PSP after it has displayed the image. So I'm guessing something dodgy is going on with my callbacks, but not to start analysing that too deeply, I would like to debug the problem. That would give me a lot better feel on what is going on. I would like the program just to display the simple image and then exit back to psp menu.
So after I've compiled my program, started PSPLink on PSP, started the two external tools and press the "debug"-button in Eclipse (the bug icon) all hell breaks loose, it just hangs for a while and Eclipse tells me this:
Any ideas what is causing the problem?
I think I got the tools setup correctly, atleast I followed the tutorial and they seem to "respond" when I start them but that's about it then...
If more information is required, I'm happy to provide it, just shoot away.
Any ideas anyone?
Thanks.