PocketMatrix forums

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

Gapidraw on Symbian question

The examples of the Gapidraw4Symbian all compile as a app. I'm working on a big port, and you can't use global data (statics) in a symbian app. If you compile as a exe, you can.
My question is, can i use the gapidraw lib in a symbian exe? Has anyone tried this?
t3ddY: We are not aware of any reason why it shouldn't be possible using the lib/dll when building an exe target. We haven't tried it, though.

If you try, feel free to post your results here!

/Jonas
I'm trying to do it... but i can't find a way to implement UIQ in a .exe... since GapiDraw depends on UIQ, i have to implement it...

How do other programmers make pocket pc ports here? I'm porting a ppc game to symbian. It's a massive game, and i can't get all the global data out, so it has to be a .exe wich supports global data (the same solution as the EMAME port).

Does someone here has a short code sample for UIQ in a EXE so i can try to init gapidraw in it?
Ok, let me see if I get you right. the gapidraw dll is not dependent on either UIQ or any Series60 libraries. The provided CGapiApplication.h/cpp and MyApplication.h/cpp is our way of using the gapidraw dll, but you could implement your own framework instead of using CGapiApplication, but then you have to do all Symbian specific code yourself, like connecting to the window server, handle incoming calls and stuff like that.

It could be possible that we change the CGapiApplication files to build for exe instead of app in the future though, but nothing is decided yet.

Hope it helps a little

/Erik
Another (maybe minor) issue with an exe is that you need a way to launch it, since it won't appear in the program menu. You could use a filemanger (not very user friendly) or create an app that starts the exe.
For this i use a normal app... ideal, cause the app can also detect level packs and display hiscores e.d. in a normal way...

I managed to get the gapidraw nag-screen visible from an exe :) it's really easy this is how i did it:

- just include the gapidraw headers
- make a E32Main() and make your backbuffer, inputs, e.d.
- i did a simple draw from within the main function and it worked!

Compile the whole thing as a app and start from a filemanager or from a app with RunAppInsideThread;


So now you can port all your other c++ games, without the $@%@ global data limit's a normal symbian .app has !!!!!
I keep finding this error with the creating of surfaces in a exe...

This goes well:
retVal = m_backgroundSurface.CreateSurface(0,100, 100);
m_backgroundSurface.FillRect(NULL, RGB(100,100,100), 0, NULL);
I see a nice white(grey) box...

This gives a error:
retVal = m_backgroundSurface.CreateSurface(0,TEXT("ipaq.png"));

The picture is present so that's not the issue... it's copyed directly from a app were's its running well, so it looks like the creation of surfaces within a .exe doens't work :(:(:(:(:(
Anonymous wrote:
This gives a error:
retVal = m_backgroundSurface.CreateSurface(0,TEXT("ipaq.png"));


What is the retVal? This will give you a very good indication of what the failure actually is.
If CreateSurface(0, 100, 100) works, but CreateSurface(0, TEXT("ipaq.png")) does not, the issue is with the image loader. As ppcstudios says, check the return value. If it is "GDERR_BITMAPNOTFOUND" GapiDraw simply cannot find the bitmap in the current path.
It doesn't come that far to actually see the retvalue, the exe just crashes with this message:

Program Main
Reason code E32USER-CBase
Reason number 69
Code:

#include <stdio.h>
#include <e32std.h>
#include <e32base.h>
#include <e32cons.h>
#include "gapidraw.h"

typedef struct _GDAPPCONFIG
{
DWORD dwDisplayFlags; // Flags sent to OpenDisplay [ optional ]
DWORD dwDisplayMode; // Flags sent to SetDisplayMode [ optional ]
BOOL bEnableDoubleClick; // Enable double click [ optional ]
} GDAPPCONFIG;


TInt E32Main() {
GDAPPCONFIG m_config;
CGapiDraw* m_gapidraw;
CGapiDisplay* m_display;
CGapiSurface* m_backbuffer;
//CGapiInput* m_input;

m_gapidraw = new CGapiDraw();
m_gapidraw->CreateGapiDraw();

HRESULT retVal;

m_display = new CGapiDisplay();
retVal = m_display->SetDisplayMode(GDDISPMODE_NORMAL||GDDISPLAY_FULLSCREEN);
retVal = m_display->OpenDisplay(m_config.dwDisplayFlags, 0,0,0,0,16,0);
m_backbuffer = new CGapiSurface();
m_display->GetBackBuffer(m_backbuffer);

retVal = m_backbuffer->CreateSurface(0,TEXT("ipaq.png"));

m_gapidraw->FreeGapiDraw();

return true;
}


This is the code... any idea?
The problem when building an exe rather than an app is that you get a lot less for free. E32USER-CBase error 69 occurs since there is no cleanup stack by default in an exe, and the image loader uses traps. In an app the cleanup stack is created for you by the system, in an exe you have to take care of that yourself.

For Symbian system panics, check out http://www.symbian.com/developer/techlib/v70docs/SDL_v7.0/doc_source/reference/SystemPanics/
Thanx for the exellent solution, i'm reading the cleanup stack object docs now... will post my solution when it's ready :)
jonas, can i contact you by mail about some symbian specific questions? i looks useless to me to spam this forum with them :)

mail: vincent<ADD>engine-software<DOT>nl