First off, I know you guys must be getting sick of me... thank you for not saying so... yet 
Anyway, I've been fighting with getting my graphics library working on devices other than my Casio E-125, and I actually made some progress today. However, it still doesn't work on the iPaq 38xx series and, having looked through my code 10 more times, I just can't figure out why.
Can you help?
Here's my initialization code called at program start (including the globals it accesses up top)...
(Remember that this is NOT final code, so any comments you might have about style or efficiency aren't my concern at this point, only the functionality)
Then, at the start of every frame, I call the following:
Then, at the end of every frame:
Anyone spot the stupid mistake that I'm sure it will turn out to be? Thank you!
Anyway, I've been fighting with getting my graphics library working on devices other than my Casio E-125, and I actually made some progress today. However, it still doesn't work on the iPaq 38xx series and, having looked through my code 10 more times, I just can't figure out why.
Can you help?
Here's my initialization code called at program start (including the globals it accesses up top)...
- Code:
HINSTANCE GX_hInst = NULL;
unsigned long int GX_bufferSize = 0;
BOOL GX_isBuffered = FALSE;
BOOL GX_BBBypass = FALSE;
unsigned short int* GX_pScreenBuffer = NULL;
unsigned short int* GX_pVidMem = NULL;
BOOL GX_Initialize(const HINSTANCE GXI_hInst, const HWND GXI_hWnd) {
GX_hInst = GXI_hInst;
GXOpenDisplay(GXI_hWnd, GX_FULLSCREEN);
GX_isBuffered = GXIsDisplayDRAMBuffer();
GX_g_gxdp = GXGetDisplayProperties();
GX_xPitch = GX_g_gxdp.cbxPitch >> 1;
GX_yPitch = GX_g_gxdp.cbyPitch >> 1;
TCHAR OEMModelInfo[64];
SystemParametersInfo(SPI_GETOEMINFO, 64, OEMModelInfo, 0);
if (wcscmp(OEMModelInfo, L"Compaq iPAQ H3800") == 0) {
if (!(GX_g_gxdp.cbxPitch < 0 && GX_g_gxdp.cbyPitch > 0)) {
GX_pVidMem = (unsigned short int*)0xAC0755A0;
GX_g_gxdp.cxWidth = 240;
GX_g_gxdp.cyHeight = 320;
GX_g_gxdp.cbxPitch = -640;
GX_g_gxdp.cbyPitch = 2;
GX_xPitch = GX_g_gxdp.cbxPitch >> 1;
GX_yPitch = GX_g_gxdp.cbyPitch >> 1;
GX_g_gxdp.cBPP = 16;
GX_g_gxdp.ffFormat = 0xA8;
GX_isBuffered = false;
GX_BBBypass = true;
}
}
GX_bufferSize = 320 * max(GX_xPitch, GX_yPitch) * (GX_g_gxdp.cBPP / 8);
if (!GX_isBuffered) {
GX_pScreenBuffer = (unsigned short int*)malloc(GX_bufferSize);
}
GXOpenInput();
GX_g_gxkl = GXGetDefaultKeys(GX_NORMALKEYS);
return true;
}
(Remember that this is NOT final code, so any comments you might have about style or efficiency aren't my concern at this point, only the functionality)
Then, at the start of every frame, I call the following:
- Code:
void GX_beginDraw() {
if (GX_isBuffered) {
GX_pScreenBuffer = (unsigned short int*)GXBeginDraw();
}
}
Then, at the end of every frame:
- Code:
void GX_endDraw() {
if (GX_isBuffered) {
GXEndDraw();
}
if (!GX_isBuffered) {
if (GX_BBBypass) { // Must be a 38xx series
memcpy(GX_pVidMem, GX_pScreenBuffer, GX_bufferSize);
} else { // Not a 38xx series
memcpy(GXBeginDraw(), GX_pScreenBuffer, GX_bufferSize);
GXEndDraw();
}
}
}
Anyone spot the stupid mistake that I'm sure it will turn out to be? Thank you!