Developing For The Gp2x When You Don't Have One?


MikeC

Still Fresh
Joined
May 25, 2006
Messages
9
Hi all

I want a gp2x so badly it hurts but I am saving for my wedding at the moment and it would be more than my life is worth if I were to go and buy one. All is not lost though because my wife to be has noted the fact that I talk about it all the time, have left magazine adverts lying around the house and that gp32x.de is now the homepage on her web-browser and seems to think that the best way to shut me up is to promise me one as a christmas present.

The thing is though - I would like to start developing for it as soon as possible. Is it possible to write and test code for the gp2x without actually owning the thing?

I am no guru coder and most of my experience is in coding large scientific codes that crunch numbers or model obscure physical systems but I love the idea of being able to code with the 2x. But you never know - I might end up porting something gaming-related which would be of general interest.

Cheers,
Mike
 
Last edited by a moderator:
Yes, it is VERY possible!

What you should do is use SDL (google it) for the graphics and sound. Then you just have to compile it with the gp2x files rather than the PC files and it should work.
However, to get input correct, you should just setup two different versions, one for PC and one for the gp2x.
Checkout this page for a guide to SDL joystick mapping for the gp2x.

good luck,
-ben
 
Wasn't there a header file that could allow almost the exact same code for a GP2x and a PC SDL application.
 
Wasn't there a header file that could allow almost the exact same code for a GP2x and a PC SDL application.
I'm sure the guys will help you. I just wanted to welcome you to the club! I've got a lovely Latin wife and have 3 daughters and a baby boy (he sure was a surprise, here I thought I was so good at making baby girls).

Happy coding!
 
Last edited by a moderator:
Wasn't there a header file that could allow almost the exact same code for a GP2x and a PC SDL application.
I think what you are referring to is a header file that can be easily adjusted to acommodate both gp2x and PC control inputs. I have not used this myself but it seems like a great development tool if you don't have a gp2x yet or wish to test your games on the PC.
 
Last edited by a moderator:
If you're coding for SDL just use 2 projects, 1 GP2X and one Win32, Linux, or what have you; or a unified makefile. Just make sure that GP2X specific code only compiles into the GP2X target like the calls to restart the menu, or if you use Minilib functionality..
 
Hello there,

Well like the other mention before me you best route is to use SDL and then compile a Win32 version (or Linux, MacOSX or any other platform supported by SDL). So you will then be able to get an idea on how it would look like on the GP2X, you wont have the actual speed of the device though. Just need to make sure the resolution is 320x240 ;-) and dont do too much heavy calculation (no 3d, no floating point, etc...) since you might get something that run nicely on the PC but then crawl on the poor GP2X.

Hopefully also soon we will get an emulator from Squidge.

Ohh and I am in a similar situation as you, couldnt get a GP2X yet, since need to pay alot of other bills first for the family ;-) (yah I am already married since fall 2002). And I know a wedding will be costing alot of $$$, just be patient and you should be able to get your hand on it eventually ;-).
 
Yeah, sold my PSP and a load of other stuff to get my GP2X :) I'd just like to add to what Intruder said based on my own experiences.

I mentioned the official DevKit above, and while it does an admirable job of allowing you to test code in windows and if you get people to test your code every now and then you can get away with it for a while :)

I started re(re)developing Jurl while I was waiting for my GP2X to arrive, when it did I had a few issues:

1) Black screen and then dump to GP menu, turns out the official libs don't let you use SDL_HWSURFACE.
2) Speed was abysmal - although changing to Paeryn's (is that spelt right?) SDL libs fixed that.
3) Sound was buggered. Music didn't play at all and FX were delayed. Turns out that a buffer size bigger than 512 mucks up the sound on the GP, but works perfectly on the PC :) That and the fact that my sdl_mixer lib didn't have support for Mods, mp3's or ogg stopped music.

Other than that I managed to get the code running quite quickly, and the last time I did any 'proper' C coding was, let's say the machines I was developing on had only a little more memory as the GP - but were a hell of a lot bigger :)

Oh, I downloaded the latest official devkit and the speed problems seem to be sorted, dunno if they've fixed something or if my original libs were mucked up though.

The one key point is to make sure you check every initialisation and creation step and write out SDL_GetError() to the stderr device. This is invaluable if your going to get other people to check your code. I'd still be on the black screen step if I hadn't found a comment with a script to redirect stderr/stdout to a file :)
 
Yes it is possible, I use the method of
#ifdef GP2X
// GP2X specific code
#endif
and
#ifdef PC
// PC specific code
#endif

When I compile to my different targets, my IDE is set to do either:
#define GP2X
or
#define PC
at compiler time
 
Thanks for all the info guys - but why no floating point? How bad is floating point performance on the gp2x?

For my first Gp2x project I was going to try and rewrite some simple numerical code that I did as part of my studies and put a gui on the top of it. Completely pointless and more than a little geeky but you never know - someone might NEED to calculate 1d photonic crystal reflectivity curves on their games console. Well they might....;)
 
FPU is more the case when you need precision than speed
most time you can exchange your floating point calculations to fixed point calculations and earn some time to do other things..
This by no way means that you can't have any floating point variable on your code, just avoid it when possible, speacilly when you're inside a loop (which the delay for fpu calculation will be powered by loop's iterations) but calculating a FP shot pathway 60 times a second is not going to halve all your processing power if you really need it, just don't try to draw a circle using p(x) = sin(x), cos(x)

developing a game on sdl will not assure that it will run on gp2x, but actually it's the closer your can get to develop something without having to buy a gp2x
 
Back
Top