GP32 Weird 16bit Mode


TheMrCul

Still Fresh
Joined
Apr 18, 2003
Messages
52
Hello everyone.
Recently tried to get 16bit mode working, and having a little trouble!
The code loads and compiles of course, but what is displayed on screen is another matter. All the colours are fine, and I don't have 4 screens or anything like that, but the image is kinda stretched towards the top left corner. I don't know how to post pictures from my hard drive, so that's all I can explain!
I'm using the official SDK with DevKitArm_r8 with gcc 3.4.1.

My code looks like this:
Code:
#include "gpdef.h"
#include "gpstdlib.h"
#include "gpgraphic.h"
#include "gpgraphic16.h"
#include "gpmain.h"
#include "gpstdio.h"
#include "gpfont.h"
#include "gpmm.h"
//#include "gpstream.h"


//----------------------------------------------------------------------------------//

//CREATE ALL OF THE GLOBAL VARIABLES HERE

int  	nflip,                  //Screen flipping index
  	ExKey;

//----------------------------------------------------------------------------------//


F_HANDLE  fh;
ERR_CODE  err;
unsigned long n_size,n_read;
char *  	app_path;
GPDRAWSURFACE gpDraw[2];

//----------------------------------------------------------------------------------//

#include "house.h"

//Load all misc functions
#include "Misc.h"

//----------------------------------------------------------------------------------//

void GpMain(void *arg)
{
	int i, j;

	//Set up screen surface
  	nflip = 1;
  	GpGraphicModeSet(16, NULL);
	GpLcdSurfaceGet(&gpDraw[0], 0);
	GpLcdSurfaceGet(&gpDraw[1], 1);
	GpSurfaceSet(&gpDraw[0]);

	//Now we enter the main game engine
	GameEngine();
}


void GameEngine(void)
{
	for(;;)
	{
  GpBitBlt16(NULL,
  	&gpDraw[nflip],
  	0, 0,
  	160, 161,
  	(unsigned char*)House,
  	0, 0,
  	160, 161);

  //Flip the screen
  FlipScreen();
	}
}

The picture was converted with Edorul's great GP32Converter (which works fine for 8bit pictures) so I don't know what's wrong with it! If someone could explain what I should do to get it working, I would be very appreciative! Even if someone could point me in the direction to posing my images about the problem would be great! Thanks everyone
-TheMrCul
 
Wow! I resized the image to 160 x 168 and there is no distortion! That is so weird! how do I work out 8-byte boundries? Just divide the number by 8 and if it's a whole number, it's okay? Thanks for your help!
 
Wow! I resized the image to 160 x 168 and there is no distortion! That is so weird! how do I work out 8-byte boundries? Just divide the number by 8 and if it's a whole number, it's okay? Thanks for your help!

INT((size + 7) / 8) * 8

or with your calculator:

result = size / 8
if result has no decimals, size is ok
else take the integer part of the result, add 1
multiply the new result by 8
that's all
 
Last edited by a moderator:
Back
Top