GP32 Porting With Sdl


Blah

Wanna Be Programmer
Joined
Dec 18, 2003
Messages
3,253
Age
35
Location
Oregon, USA
Website
Visit site
Well, I downloaded SDL for GP32 and I liked it. I decided to start porting something. Looking through the games availiable for one that closest matches the GP32's performance and my coding experience, I came across Shippy 1984. Not only did it fit that criteria, but I also liked it as a game coincidentally.

As it turns out, even with SDL (which is a big help, thanks Chui and libsdl.org!) porting is tough, even on simple apps. I was able to get it to compile (with hundreds of warnings!), but not able to get it to work.

So I'd like to know what are the first things to look for that need change, generally.

Sorry if I'm sounding a bit noobish or asking too much of you all. Just looking for a bit of advice :)
 
Some things to look out for are:

Structure padding. Sometimes compilers insert invisible fields to ensure alignment. Different compilers can insert different alignments, so structures read from a file can return garbage.

Enums. Some compiler allocate only the space needed (eg. enum {fred = 1} allocates a char) whereas some compilers allocate int's always. Again, it's normally when they are read from a file that it causes problems.

Typical example: Quake. Expects enums to be always of size 'int'.
 
The only thing I've come across about SDL on the gp32 thats a bit different is input - the controls actually emulate a few keys rather than a joystick. Other than that as long as you're setting the screen size to 320x240 you should be ok. I use a hw surface in duke, but I'm not sure if that is necessary though. If it's still not working then it's probably not an SDL issue.
 
Well, its starting to come together. I've just got to make a random number function and a Qsort function, and figure out the best way to init the sound and gfx in this situation. Everything else seems to work together. No working executable yet though.

Would setting the resolution to 240x160 cause any problems? Thats the native res of the game and it seems to work because I think SDL stretches it up for you.

Also, I can't find anywhere that tells which button emulates which key.
 
woogal posted on Oct 16 2005 at 04:11 AM said:
The only thing I've come across about SDL on the gp32 thats a bit different is input - the controls actually emulate a few keys rather than a joystick.
Does the joystick emulate 8 or 12 keys? (ie do we have access to the full resolution of the hardware?)
 
Last edited by a moderator:
Well its getting closer. I finally have a working, playable FXE with sound :D . But the game outputs its graphics at 480x320 resolution. I know its just scaling it up, because the graphics files are half that size (for example, the two splash images), at 240x160, which is a resolution supported by the gp32 port. I'll just have to find whats doing that in the code and rip it out.

I didn't have to make a Qsort or random function because those are available in SDL, I just didn't include the right .H's.
 
Yes, you have access to the full resolution of the hardware - all 8 directions (must admit, it would be pretty silly to allow give access to 4...)
 
Blah posted on Oct 17 2005 at 10:25 PM said:
Well its getting closer. I finally have a working, playable FXE with sound :D . But the game outputs its graphics at 480x320 resolution. I know its just scaling it up, because the graphics files are half that size (for example, the two splash images), at 240x160, which is a resolution supported by the gp32 port. I'll just have to find whats doing that in the code and rip it out.

I didn't have to make a Qsort or random function because those are available in SDL, I just didn't include the right .H's.


Should be simple as it is a basic pixel doubler that is doing that. It is no fancy odd pixel scaler or anything. It is an exact 2:1.
 
Last edited by a moderator:
@DaveC:
Well DUH! :p

@Codesmith:
The way it does it is by telling your code that two buttons are being pressed. For example if you pressed the left-up diagonal, it would show as left and up being pressed on a keyboard at the same time. Which is actually pretty handy, because that means that in most cases you don't even have to program anything to get your program to support diagonals.
 
Back
Top