Paeryn's Hw Sdl Libs, Where Do I Get Them From?


Alex.

Retired
Joined
Aug 24, 2005
Messages
4,616
I didn't manage to find anything in the main thread, and the file posted in the archive is incomplete. I'm in need of a boost of speed, anyone care to point me in the right direction? :)

- Alex
 
Alex,

By far the best way to get the libs is to build them from the latest SVN source yourself :).

Depending on your platform that is no where near as scary as it sounds, give us some more info on what you use to dev and I will knock up some instructions for you.
 
Thanks for the link Yaustar, got it!

DJWillis, while I know next to nothing about this hardcore side of coding, I'd love to learn about it. I use WinXP with DevKitGP2X and CodeBlocks, with a setup step by step from this Wiki article.

- Alex

Edit: I just gave those a try, and while the speed boost is bloody fantastic, the display flickers a lot. I read some more in that thread and it seems like that's a problem with the libs built for firmware 1.4. :(
 
That explains why my sprites like to 'shiver'. Hmm .. I need to to see if I can compile from the latest source.
 
yaustar posted on Aug 26 2006 at 11:11 AM said:
That explains why my sprites like to 'shiver'. Hmm .. I need to to see if I can compile from the latest source.
If you manage to compile it, be kind and upload it to the GP2X archive :)

- Alex
 
Last edited by a moderator:
I will do, as soon as I figure out which rule to build to ¬¬
Makefiles are not my area ...
 
I did these for somebody else but if you grab these files and overwrite (backup 1st) the files with the same name in your tool-chains lib dir on your PC (the GP2X tool-chain that is).

There quick builds from the latest SVN source but without headers, configs, linker helpers, sdl_gp2x.h etc. as I assume you will have them and they have not changed in a good while ;).
 
Cheers for that. I have to make a mental note to install the tool chain properly sometime ;).
 
Thanks DJ, unfortunately the flickering problem persists. The executable however is about 400kb smaller. ;)

- Alex
 
Alex. posted on Aug 26 2006 at 06:25 PM said:
Thanks DJ, unfortunately the flickering problem persists. The executable however is about 400kb smaller. ;)

Care to post a sample of your SDL code? How are you using the surfaces? Belive me the flicker can be stopped with some tweaks to how you use SDL ;).
 
Last edited by a moderator:
Of course, here's my static title screen (a tad simplified), which flickers the same as the rest of the game:

Code:
#define WIDTH 320
#define HEIGHT 240
#define BPP 16

int main(int argc, char **argv)
{
	SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_TIMER);

	SDL_Rect coords = {0, 83};
	SDL_Rect location = {0, 67, 320, 72};

	SDL_Surface* screen = NULL;
	SDL_Surface* loadedSprites = NULL;
	SDL_Surface* sprites = NULL;

	screen = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE);

	loadedSprites = IMG_Load("gfx.png");
	sprites = SDL_ConvertSurface(loadedSprites, screen->format, SDL_HWSURFACE);
	SDL_FreeSurface(loadedSprites);

	SDL_SetColorKey(sprites, SDL_SRCCOLORKEY, SDL_MapRGB(sprites->format, 255, 78, 207));

	SDL_Joystick* joystick = SDL_JoystickOpen(0);

	SDL_ShowCursor(SDL_DISABLE);

	while(!status.exit) {
		SDL_BlitSurface(sprites, &location, screen, &coords);
		SDL_Flip(screen);
	}

	SDL_FreeSurface(sprites);
	SDL_FreeSurface(screen);

	SDL_Quit();
	chdir("/usr/gp2x");
	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
	return 0;
}

- Alex
 
screen = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE|SDL_DOUBLEBUF);

That should solve your problem. If SDL_Flip is used on a software surface it will just update the current buffer, but on a hardware surface it will flip hardware buffers. Without SDL_DOUBLEBUF you are only using one buffer and so flip will be switching between your output and a black screen.
 
Hmm.. the updated libs didn't seem to fix my 'shivering' effect on my sprites... Not quite sure but it looks like they are shearing which seems odd. :/
 
Woogal that fixes the flickering (thanks :)), but it adds some weird effects, ie: sometimes when I blit a graphic over a background, flip, and then blit another graphic over everything else, flip, it gives a sort of incomplete blit (horizontally) and some weird opacity effect, sort of see-through. I'll take a better look at those areas when I get home later today.

Also, the max FPS is no longer 250+ but 111, but it's still much better than 80 :)

- Alex

Edit: nevermind, all problems solved. Thank you all!
 
Alex. posted on Aug 26 2006 at 02:27 PM said:
Thanks for the link Yaustar, got it!

DJWillis, while I know next to nothing about this hardcore side of coding, I'd love to learn about it. I use WinXP with DevKitGP2X and CodeBlocks, with a setup step by step from this Wiki article.

- Alex

Edit: I just gave those a try, and while the speed boost is bloody fantastic, the display flickers a lot. I read some more in that thread and it seems like that's a problem with the libs built for firmware 1.4. :(


I use CodeBlocks with DevKitGP2X as well, and I wouldn't mind knowing how to compile the SDL libs. I did try to download from the SVN, but I was a bit overwhealmed with the SVN process and how to actually find and download the damn source. (It was late)
 
Last edited by a moderator:
Alex. posted on Aug 26 2006 at 02:23 PM said:
sometimes when I blit a graphic over a background, flip, and then blit another graphic over everything else, flip, it gives a sort of incomplete blit (horizontally) and some weird opacity effect
Never mind that, it was caused by my effects not tailored for double buffering. Everything works ace, with a 30+ FPS boost over GPH's SDL. :)

- Alex
 
Last edited by a moderator:
Alex. posted on Aug 27 2006 at 01:19 AM said:
Alex. posted on Aug 26 2006 at 02:23 PM said:
sometimes when I blit a graphic over a background, flip, and then blit another graphic over everything else, flip, it gives a sort of incomplete blit (horizontally) and some weird opacity effect
Never mind that, it was caused by my effects not tailored for double buffering. Everything works ace, with a 30+ FPS boost over GPH's SDL. :)

- Alex

Would you mind explaining further? I wonder if I am doing the same thing?? :blink:

EDIT: Oh, and I don't know if anyone can explain how to get rid of that cursor? I am using SDL_ShowCursor(SDL_DISABLE); but that no longer appears to have any affect in the HW libs.
 
Last edited by a moderator:
Here's what I did:

1. Download this, unzip, move files to respective folder in DevKitGP2X, overwriting existing files.
2. Do the same with this.
3. Do the same with this.

As for the cursor problem, I always had a bit of a problem with it as well, even before using the HW libs. Unless I call SDL_ShowCursor(SDL_DISABLE) just before the game loop starts, the cursor will remain turned on. I never undertood why that was so, but I learned to live with it. ;)

- Alex

Edit: Nevermind, it seems like I talked about the wrong thing. Basically because of double buffering there are two screens. Say you draw something on the screen, then flip it, the graphic appears on the LCD. Now if you flip the screen yet again, the graphic will no longer be displayed on the LCD, as you only drew it once, on one of the screens. There's a big chance I got it wrong though, so you'd better ask someone else as well :)
 
Thanks! Tried all of that to no avail :blink:

Can I confirm that someone here has FW 2.0 and the HW libs working? As in, working with HW surfaces actually on?

I have double buffering enabled, do my blits, then SDL_GP2X_WaitForBlitter, then the SDL_Flip(screen).

Do I need more than one surface?? Presumably my backbuffer (screen) is 640 x 240 in size even though I set it to 320 x 240, and the flipping chain is all handled automatically? There is nothing special I need to do after blit, wait for blit, flip?
 
Back
Top