Difficulties moving my homebrew to 3.52 from 1.5

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
GlennNZ
Posts: 25
Joined: Sat Jan 13, 2007 1:13 pm

Difficulties moving my homebrew to 3.52 from 1.5

Post by GlennNZ »

Trying to make my pspgl + SDL game to work on my 3.52 MM3-4 has proven more difficult than I'd expected/intended. I haven't played around with this stuff for about a year.

About this time last year I compiled an app using 'make kxploit' and it worked fine on my 1.5 kernel. Now that I've upgraded to 3.52, it still works fine.

However, because I'm struggling to build a new project of mine, I've gone back to that original app to try and build and run it. Unfortunately it crashes the PSP (turns it off). The only thing that it different is that the PSP toolchain is a year newer.

There was an error that I haven't seen in a while though.
Error, could not fixup imports, stubs out of order.
Ensure the SDK libraries are linked in last to correct this error
but it compiles fine when I just use make kxploit again. Is this the problem?

In case my makefile throws any hints, here it is.

Code: Select all

TARGET = heli
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
OBJS =	helicoptergame.o Cursor.o Geometry.o MainApp.o Trackball2.o Display.o

DEFAULT_CFLAGS = 

MORE_CFLAGS = -G0 -O2

CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions -fno-rtti

LIBS = $(shell $(SDL_CONFIG) --libs) -lSDL -lglut -lGLU -lGL -lm -lc -lpsputility -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpspvfpu -lpsplibc -lpspuser -lpspkernel -lpsprtc -lpsppower -lstdc++ -lSDLmain -lSDL_ttf

EXTRA_TARGETS = EBOOT.PBP

BUILD_PRX = 1
PSP_FW_VERSION = 352
include $(PSPSDK)/lib/build.mak

I'd rather build for the 3.xx kernels now. I've read http://www.ghoti.nl/PSPtutorialm0.php and made the recommended tweaks to my code and makefile. I've assumed there are no kernel calls though

Basically I
- build my app using 'make'
- copy the EBOOT.PBP into psp/game352/HeliGame


I'm pretty miffed at this point. So some help would be great.

Cheers
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

Try linking your libs differently, you're linking something early on that should be at the end (order matters) is what the error is telling you.

Try these and let the build.mak that you're including tap the others you need on the end.

Code: Select all

LIBS = $(shell $(SDL_CONFIG) --libs) -lSDL -lglut -lGLU -lGL -lm -lpspctrl -lpspvfpu -lpsprtc -lpsppower -lSDLmain -lSDL_ttf -lstdc++
GlennNZ
Posts: 25
Joined: Sat Jan 13, 2007 1:13 pm

Post by GlennNZ »

I still get the same error (for compiling for 1.5 which should run on my PSP). The whole thing looks like:
make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -O2 -D_PSP_FW_VERSION=150 -L. -L/usr/local/pspdev/psp/sdk/lib helicoptergame.o Cursor.o Geometry.o MainApp.o Trackball2.o Display.o -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lSDL -lGLU -lGL -lm -lpspctrl -lpspvfpu -lpsprtc -lpsppower -lstdc++ -lSDLmain -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o Helicopter_psp.elf
psp-fixup-imports Helicopter_psp.elf
Error, could not fixup imports, stubs out of order.
Ensure the SDK libraries are linked in last to correct this error
make: *** [Helicopter_psp.elf] Error 1
The libs now look like the following. I took out some unnecessary ones.

Code: Select all

LIBS = $(shell $(SDL_CONFIG) --libs) -lSDL -lGLU -lGL -lm -lpspctrl -lpspvfpu -lpsprtc -lpsppower -lstdc++ -lSDLmain 
Note that if I run 'make kxploit' again, then everything 'seems' fine.
make kxploit
mksfo 'Helicopter_psp' PARAM.SFO
mkdir -p "Helicopter_psp"
psp-strip Helicopter_psp.elf -o Helicopter_psp/EBOOT.PBP
mkdir -p "Helicopter_psp%"
pack-pbp "Helicopter_psp%/EBOOT.PBP" PARAM.SFO NULL \
NULL NULL NULL \
NULL NULL NULL
[0] 408 bytes | PARAM.SFO
[1] 0 bytes | NULL
[2] 0 bytes | NULL
[3] 0 bytes | NULL
[4] 0 bytes | NULL
[5] 0 bytes | NULL
[6] 0 bytes | NULL
[7] 0 bytes | NULL
But it will crash the PSP.
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Maybe a "make clean" would do the trick.
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

From the looks of the output of your compile, the "$(shell $(SDL_CONFIG) --libs)" is causing the problems. ;)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

The SDLmain library uses kernel mode for historical reasons.
It needs to be fixed...
For now you can just remove -Dmain=SDL_Main and -lSDLmain and do the psp startup stuff yourself.
GlennNZ
Posts: 25
Joined: Sat Jan 13, 2007 1:13 pm

Post by GlennNZ »

Well, part of the problem has gone away. I went into sdl-config, commented out -Dmain=SDL_main, recompiled and installed and now I don't get make complaining about stubs being out of order. The odd part though is that because I configured SDL using whats in the README.PSP, it just restored the sdl-config back to what it was so maybe it was all coincidence.

Honestly, I don't know what I'm doing and am just stabbing in the dark. Is there an updated SDL for PSP tutorial around anymore? The ones I think I used are dead links now.

I did a little better than before. When running my SDL app on the PSP, I now get a black screen with an oversized cursor arrow at the top left of the screen that is constructed out of dots. After about 10s the PSP shuts off.

I'm clueless so here's a link to my code to anyone whose keen. Its of my 3D helicopter that I spent ages making out of arrays. You can download it here. It should just need pspgl and sdl. http://www.mediafire.com/?texvzzk0unc

How's this. If someone can help me get this to work, I'll write an SDL tutorial and give it to the guy at http://www.ghoti.nl/PSPtutorialm0.php to put on his website (if he wants it). That way all the poor mugs like me who only know a bit of opengl and sdl, may have a better chance of getting things going.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

SDL displays a cursor when you have a shadow surface. Use SDL_ShowCursor (SDL_DISABLE); to turn it off.

As for the crash, try using psplink to debug it...

edit: I bet you divide by zero in the first iteration through the loop in main().
GlennNZ
Posts: 25
Joined: Sat Jan 13, 2007 1:13 pm

Post by GlennNZ »

jimparis wrote:SDL displays a cursor when you have a shadow surface. Use SDL_ShowCursor (SDL_DISABLE); to turn it off.
I've done this and it is still there. It doesn't really look like an SDL arrow. Unless it's just a very zoomed in one. It never appear on my linux version anyway.
jimparis wrote: As for the crash, try using psplink to debug it...
Yes, I might have to look into what psplink is all about. Normally I just get the app to work in linux, then I just use the makefile to get it onto the PSP.
jimparis wrote: edit: I bet you divide by zero in the first iteration through the loop in main().
I'm assuming you're talking about my game loop. I can't see how that is possible looking at my code. Sure, if SDL_GetTicks() kept returning the same value then I would have problems, but that is unlikely.

All this compiles and runs fine as a standalone app using OpenGL and SDL on my linux box. For those who are curious, download the files from http://www.mediafire.com/?uw4otxy1za1 (it's a different link than above)
You can just compile it with the command line.

Code: Select all

g++ helicoptergame.cpp Cursor.cpp Geometry.cpp MainApp.cpp Trackball2.cpp Display.cpp -o helicoptergame -lX11 -lXmu -lXi -lm -lglut -lGL -lGLU -lSDL -lSDLmain
Post Reply