GP2X Hw Accelerated Sdl


Something is messed up with the controlls in this release they do not respond correctly for me?
They worked perfect in the last release all I did was drop the new sdl lib in my folder and compiled it and the buttons are all different.

Didn't help the vsync flickering problem with tv out it flickers faster now. :(
 
Something is messed up with the controlls in this release they do not respond correctly for me?
They worked perfect in the last release all I did was drop the new sdl lib in my folder and compiled it and the buttons are all different.

Didn't help the vsync flickering problem with tv out it flickers faster now. :(
Oops, I forgot that I'd been messing with the joystick code as well.
It'll have to wait now until I get back- Ta for the propmt feedback!
 
Last edited by a moderator:
I forgot to mention that the upper memory must not be freeing or changing back to the original sync after tv mode because after you close the program I get the horrible flicker on my lcd screen. Here is what happens I can play my program fine with no flicker on my lcd screen then when I connect to my tv run my program I get all kinds of screen flicker so I close my program and switch back to lcd mode then if I run my program again on my lcd screen it has the same flicker that it did on the tv screen I have to turn off my gp2x and turn it back on before it will reset itself :(

I will try to put up a video of what it does as soon as I can.

I dont know if this will help or not but when I ues theoddbots software sdl I get about 82 fps on my lcd screen then if I switch to tv mode it stays the about same I get 82-84 fps so the refresh rate stays the same.
But if I use your HW Sdl I get a rock solid 64 fps on my lcd screen then if I switch to tv mode I get 590 -620 fps I think this is what is causing the horrible flicker. Its like its not setting the refresh rate correctly or the sync is total off I really don't know but I hope you fix this bug because tv out is one of the most important features for me it was one of the major factors for me in buying the gp2x.

Anyway thanks for the awesome work look for another donation soon.
 
How do I use the precompiled lib/headers you are hosting? Do i download the original SDL Source and compile it, then replace it with these headers/lib ?

Sorry for the silly question... I can't seem to get it off SVN, connection keeps dropping ("Connection Truncated")... I guess its cause I am on dial-up or something like that.
 
How do I use the precompiled lib/headers you are hosting? Do i download the original SDL Source and compile it, then replace it with these headers/lib ?

Sorry for the silly question... I can't seem to get it off SVN, connection keeps dropping ("Connection Truncated")... I guess its cause I am on dial-up or something like that.
The pre-compiled download is really designed for people who have already downloaded & compiled a previous version (either mine, gph's, oddbot's or anyone else's) to save them having to get everything and re-compile it every time I do another version (the source was originally only available as a tarball.)
So hopefully, yes you can download any copy of the source of SDL (1.2.9), configure and compile it for the gp2x and copy my lib & headers over.
I'll possibly put my source tarball back up for people experiencing problems with SVN, although it'll probably never be as up-to-date as SVN. It causes me too much headache to keep multiple copies of the source, I have 3 seperate versions to keep track of as it is!
 
Last edited by a moderator:
Totally understand the headache of managing 3 versions of the code, so it is understandable if you do not keep an up-to-date version of the source tar'd for ppl to get.

I might just try and find oopo's source and compile that then overwrite it with your updated lib/header combo.

Thanks again.
 
I actually used that to build my toolchain... unfortunately it died when making the libs... so I didn't get SDL... thus my current situation. I will re-download the makefile version of oopo's toolchain and use the SDL code included in that.
 
I've put up the header files here
That, along with the pre-compiled libs here should be all you need if you don't want to compile from source. The only thing you won't get is the gp2x-specific sdl-config program which only returns the command-line flags for compiling/linking anyway. Below are what it returns for me, you may just need to alter the directorys according to how your toolchain is set up.
Code:
Compiling:
		-I/usr/local/gp2xdev/include/SDL -D_REENTRANT
Linking:
		-L/usr/local/gp2xdev/lib -Wl,-rpath,/usr/local/gp2xdev/lib -lSDL -lpthread -lm -ldl
 
Tried it out the controls work perfectly now but for some reason my game runs really really slow about 45fps I have to turn the refresh rate all the way to the left to get it to play as fast as the software version does. :( I tried your graphic program it just locks up my gp2x. I still get flicker even on the lcd screen :( :( oh well heres to the next version :)
 
Here you go yaustar I really don't think its has anything to do with my code because it works perfect using software surfaces :(

Code:
// THIS IS INSIDE MY MAIN GAME LOOP IT IS CALLED EVERYFRAME

	// Update the position and animation of the sprite
	Background.Update();
	Sprite.Update();
	 
	// Clear the screen so we can draw to a clean surface 
	SDL_FillRect( screen, NULL, SDL_MapRGB( screen->format, 0, 0, 0 ) ); 

	// Draw all sprites here   
	Background.Draw();
	Sprite.Draw();

	// Flip the surface to the main display screen
	SDL_Flip( screen );



// THIS IS THE CODE INSIDE OF MY SDLSPRITE CLASS FOR UPDATE
//-----------------------------------------------------------------------------
// Name: void Update()
// Desc: Updates the Position and Animation of the SDLSPRITE
//-----------------------------------------------------------------------------
void SDLSPRITE::Update( bool ManuallyUpdateFrame, int ManualSetFrameNumber )
{
   // Set the translation values
	if( !g_bPause )
	{
		m_MoveTime -= SDelay;		 // we only subtract by the amount of time passed
		if( m_MoveTime <= 0 )		 // if the time is less than zero keep going
		{
			m_MoveTime += m_DelayTime;	// Add to time so we keep the movement constant
			XP += XV;						// Increase the offset of the SDLSPRITE
			YP += YV;						// Increase the offset of the SDLSPRITE
		}
		
	}

	// Set the image and animation
	if( m_TotalImages > 1 ) // If there are more than one image for this animaiton continue
	{
		if( !ManuallyUpdateFrame )
		{
			if( !g_bPause ) 
				m_NextFrameTime -= SDelay; // count down until it is time to set the next frame
			else
				m_NextFrameTime = -1; // set to -1 so when upaused it will automatically update the animation

		}else
		{
			 if( ManualSetFrameNumber < Animation[ m_AnimationIndex ].TotalFramesInAnimation )
				 m_CurrentFrame = ManualSetFrameNumber;
		}

		// Now animate and draw the sprite on the screen
		if( !ManuallyUpdateFrame)
		{
			if( m_NextFrameTime < 0 )
				{
					if( !g_bPause )
					{
						if( !Animation[ m_AnimationIndex ].PlayAnimationOnce ) // If the animation loops
						{
							// Make sure that the frames stay in the range of the array
							if( m_CurrentFrame < Animation[ m_AnimationIndex ].TotalFramesInAnimation -1 )
								m_CurrentFrame++; // advance the frame count
							else
								m_CurrentFrame = 0;

								// Increase the Display time for the nextframe
								m_NextFrameTime += Animation[ m_AnimationIndex ].FrameOfAnimation[m_CurrentFrame ].DisplayTime;
						}else
						{
							// Make sure that the frames stay in the range of the array and then stop
							if(m_CurrentFrame < Animation[ m_AnimationIndex ].TotalFramesInAnimation -1)
						{	
							// Increase the to the next frame in the list
							m_CurrentFrame++; 
							
							// Now add the time for the currentframe to be displayed on the screen
							m_NextFrameTime += Animation[ m_AnimationIndex ].FrameOfAnimation[ m_CurrentFrame ].DisplayTime;

						}else
							m_CurrentFrame = Animation[ m_AnimationIndex ].TotalFramesInAnimation -1; // stop at the last frame and stay there
					}
				}
			}
		}

	// Now set the current frame index
	CurrentSurface = ImageSurface[ Animation[ m_AnimationIndex ].FrameOfAnimation[ m_CurrentFrame ].FrameIndex ];

	}else
		CurrentSurface = ImageSurface[ 0 ]; // Draw only a single image
}

// THIS IS THE CODE INSIDE OF MY SDLSPRITE CLASS FOR DRAW
//--------------------------------------------------------------------------------------------
//	Name: void Draw() 
//	Desc: Draws the SDLSPRITE on the Screen
//--------------------------------------------------------------------------------------------
void SDLSPRITE::Draw()
{	
	// Set the destination rectangle to draw on screen
	Destination.x = XP; 
	Destination.y = YP;
	
	// Set the source rectangle to draw on screen
	if( !UpdateSource )
		Source.x = 0; Source.y = 0; Source.w = CurrentSurface->w; Source.h = CurrentSurface->h;
	
	// Now blit the image that is referenced by the frame index		
	SDL_BlitSurface( CurrentSurface, &Source, screen, &Destination );
};
 
Are your surfaces all converted to Hardware?

Yep. Here is my function if you want to see it.

Code:
//-----------------------------------------------------------------------------
// Name: void LoadImage()
// Desc: Loads Image onto a SDL Surface
//-----------------------------------------------------------------------------
void SDLSPRITE::LoadImage( const char *ImageFilePath, bool ColorKey, int Red, int Green, int Blue )
{
	// Create a temporary surface to load in image
	SDL_Surface	*TempSurface = NULL;
	
	// Load in the image to a sdl software surface
	if( ( TempSurface = IMG_Load( ImageFilePath ) ) == NULL)
	{
		programlog( "\nCouldn't Load Image: %s ", ImageFilePath );
		EndProgram();
	}
		
	// Set the color key for the transparent color if there is one
	if(ColorKey)
		SDL_SetColorKey( TempSurface, SDL_SRCCOLORKEY, SDL_MapRGB( TempSurface->format, Red, Green, Blue ) );
	
	// Now create a hardware surface to use with the image
	ImageSurface[ m_ImageCount ] = SDL_DisplayFormat( TempSurface );
	
	// Finished with the temporary sprite so release it
	SDL_FreeSurface( TempSurface );

	// Null the surface
	TempSurface = NULL;
	
	// Increment the text count everytime through the loop to keep a total of the images loaded
	m_ImageCount++; 
}
 
Last edited by a moderator:
I've put up the header files here
That, along with the pre-compiled libs here should be all you need if you don't want to compile from source. The only thing you won't get is the gp2x-specific sdl-config program which only returns the command-line flags for compiling/linking anyway. Below are what it returns for me, you may just need to alter the directorys according to how your toolchain is set up.
Hi paeryn,

Thanks for your continued great work with this!

I have a question about the pre-compiled libs that you provided a link to above. I download them yesterday, and was trying to use them with squidge's speed hack. What I wanted to check was whether this binary release uses the 16MB upper memory area or not. I'd be grateful if you could let me know.
 
Last edited by a moderator:
I have a question about the pre-compiled libs that you provided a link to above. I download them yesterday, and was trying to use them with squidge's speed hack. What I wanted to check was whether this binary release uses the 16MB upper memory area or not. I'd be grateful if you could let me know.
No, that version is the 5MB one. The 16MB version is seperate as it uses the different memory region, the main lib download will be updated only when I get time to re-enable the framebuffer memory and make the 16MB memory area something that has to be asked for.
If you have any problems using either version then don't hesitate to notify me and I'll look into it as soon as I can. Unfortunately at the moment I've got things happening in RealLife(tm) that are taking up all my free time. I need to find out what mysterious higher power programmed us, and what computer we're running on so that I can hack it and give myself an extra 10 hours a day purely for coding sessions :D
 
Last edited by a moderator:
If you have any problems using either version then don't hesitate to notify me and I'll look into it as soon as I can. Unfortunately at the moment I've got things happening in RealLife(tm) that are taking up all my free time. I need to find out what mysterious higher power programmed us, and what computer we're running on so that I can hack it and give myself an extra 10 hours a day purely for coding sessions :D

LOL :D
 
Last edited by a moderator:
I am a bit confused, I have read pages and pages, but I am still a bit confused :(. May I use Double Buffer with this SDL version (Thanks a lot for the hardware support by the way). Is it better to use the minimal lib or another lib ? (I mean in tearms of speed).

Thanks a lot in advance,
HexDump.
 
Back
Top