PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Exception on VS2005 VGA Square Emulators only

Just noticed, I get an exception in the PHAL engine when trying to run code on any of the Visual Studio 2005 device emulators which are both VGA and SQUARE - for both WM5 and WM2003SE.

Here's a log file:

Code:
PocketHAL (Version 0.7.7)
Display::Create( hwnd = 00314060, W:480, H:480, O:0, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:480, H:480, D:16
GAPI: Detect()
GAPI: Loading GX.DLL
GAPI: Calling GXOpenDisplay( 00314060, GX_FULLSCREEN )
GAPI: Calling GXGetDisplayProperties()
GAPI: Detecting orientation
GAPI: Native orientation is 0
GAPI: Calling GXIsDisplayDRAMBuffer() @ 02821BDC
GAPI: GXIsDisplayDRAMBuffer() returned TRUE
GAPI: Detecting PocketPC model
OEM String: "Microsoft DeviceEmulator"
GAPI: framebuffer address unknown, calculating offset
GAPI: Offset is 0
GAPI: Calling GXBeginDraw() to retrieve framebuffer


Anyone see what's happening?

Code runs fine on all other emulators, including non-VGA SQUARE, VGA, non-VGA, landscape etc.

Cheers...
This does mean that PHAL programs don't seem to run on any real VGA Square devices at the moment...

Anyone have a game they know is running on VGA Square (only pocket pcs 2003SE or WM5 at the moment, Smartphones don't have this configuration) - if so would help to understand which version of the libraries you're running.

Thanks
PocketHAL does run properly on VGA square devices. There seem to be a problem with the GAPI implementation of the emulator. I have a hard time figuring it out.
Perhaps, but I'm not convinced, as customer complaints led me to investigate the square build again, and I found the error.

So with customer build, square is causing a fatal exception, which I can't trace other than the log file included above.

Anyway, why does the WM5 emulator use GAPI? It should use Direct Draw first? Then look to GDI to get screen dimensions, and GAPI last right? Why are we going straight to GAPI?

Got to admit, this is getting progressively harder to maintain.

You say you have a hard time figuring out - can I offer any assistance? I have full access to all MS VStudio tools and emulators.

Cheers for the contact (was worried the forum was dead there for a minute!),
ml
I've noticed a comment you made on the GapiDraw forum back in November:

PocketHAL 0.7.7 supports VGA devices. It also supports 240x240 devices.

Sounds like it doesn't support 480x480 = VGA Square.

Has this situation changed?

Judging by no response to my question about the latest version available (previous thread), looks like things are going quiet around here.

I know fixes have been made since 0.7.7, but still this is the only version new-comers can download - I can't see anywhere that PocketHAL is being actively promoted.
PsychoChris · 10 Jan 2007, 21:35 UTC
ml wrote:(was worried the forum was dead there for a minute!)

This is something i'm worried about too. Especially that one day PocketHAL will not be supported anymore.

@ Kzinti:
How are your future plans on PocketHAL and PocketFrog? I mean from earlier posts intentions to maintain and support were still present. But they always were followed by the statement of not having the necessary time to do it. So what can we realisticly expect from PocketHAL and PocketFrog in the near future? Would you provide this community with the source code in case you decide to stop working on it?
I mean from my point of view its ok like it is as long as bugs get fixed, and till now this always happened. Additional features we always can include by our self. But if one day support is stopped and new devices or bugs make changes to the core source necessary we easy get into big problems.
Please don't take this as critizism. I appreciate your work very much! But reading ml's posts reminded me of some of my thoughts.

Greetings & regards,
Chris
Yes the latest demo version (with banner) is 0.7.7. Current registered release is 0.7.7e. This does mean that the demo version won't run properly on all devices (ie: it doesn't have the latest fixes). When you say square VGA devices don't work, are you talking about 0.7.7 (demo) or 0.7.7e (registered)?

I plan on resuming development on PocketHAL in the next 2 weeks. I know I sound like a broken record. If I do ever give up on PocketHAL, I plan on releasing the source code and/or provide a solution to registered users.

I do not support PocketFrog anymore. It was given to the community, but no one stepped up to continue its development.
PsychoChris · 11 Jan 2007, 23:59 UTC
Kzinti wrote:I plan on resuming development on PocketHAL in the next 2 weeks. I know I sound like a broken record. If I do ever give up on PocketHAL, I plan on releasing the source code and/or provide a solution to registered users.

This are very good news! And i'm sure that i'm not the only one here having this opinion. You did a great job and i'm glad to hear that you want to continue it. I really apreciate that!

Many greetings & thanks,
Chris
I cannot explain what is going on, nor can I find any info on the Internet as to why GXBeginDraw() produces an access violation on square VGA devices. It doesn't do that on 240x240 or any other VGA resolution. This doesn't make any sense.

I implemented a workaround by using a __try/__except(1) block around the call to GXBeginDraw(). This means that GAPI will be disabled completely on these devices (and that is fine).

There are a few more things I want to try and then I can build another release.
Sounds good, glad to hear you're still active!

Let me know if I can help with anything here.
Hi - is there any update on this problem?

Thanks
By the way, found this MSDN article:

GAPI Legacy Support

Applications that use GAPI frequently make assumptions about the screen size based on earlier versions of Pocket PC and Smartphone hardware. To preserve backward compatibility with legacy applications, an emulation layer has been added to GAPI. By default, this layer will scale GAPI drawing to fit the screen; however, a high-resolution-aware application can choose to bypass the emulation layer to have complete access to the display hardware.

To bypass the emulation layer, an application should not call GXBeginDraw or GXEndDraw. Instead, it should call ExtEscape with the nEscape parameter equal to GETRAWFRAMEBUFFER and use the returned frame pointer for drawing.

#define GETRAWFRAMEBUFFER 0x00020001

#define FORMAT_565 1
#define FORMAT_555 2
#define FORMAT_OTHER 3

typedef struct _RawFrameBufferInfo
{
WORD wFormat;
WORD wBPP;
VOID *pFramePointer;
int cxStride;
int cyStride;
int cxPixels;
int cyPixels;
} RawFrameBufferInfo;

// ...

RawFrameBufferInfo rfbi;
HDC hdc = GetDC(NULL);
ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL,
sizeof(RawFrameBufferInfo), (char *) &rfbi;);
ReleaseDC(NULL, hdc);

Legacy applications that use GAPI also get the same backward compatibility support that non-GAPI applications receive. This means that stylus tap coordinates are scaled depending on the subsystem version of the application's executable — even if the GETRAWFRAMEBUFFER ExtEscape is used.


It sounds like GXBeginDraw is soon going to become a legacy method for getting the framebuffer.

I think I've posted about this before, but didn't see any replies.