Available for a limited time only - £10 off a £20 spend at eXpansys! For more details visit this topic!

Please Log In or Register - it's FREE!

7 Pages V   1 2 3 > »   
Reply to this topicStart new topic
 GAPI to GDI wrapper for 8390
picard_beta
post Jun 22 2004, 22:26
Post #1


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



mystery solved. together with schriss we finally found out why the original GAPI doesn't work. there is a miss configuration in mio8390's security system and to use direct video memory access (kernel mode) not only the GAPI dll have to be privileged signed but the application itself too. schriss wrote a small tutorial how can you do that for all your games and video applications. check this post. this is developer signing so your phone has to be unlocked (see other topics about unlocking )

never the less i updated the wrapper if someone doesn't want to bother with signing applications. but this solution is slower and doesn't work for all applications.

just install. no need for manual dll copying. (if you installed the old wrapper please uninstall it before upgrading and remove all manually copied gx.dll)

http://picard.exceed.hu/mio8390/gapi2gdi.exe with installer
http://picard.exceed.hu/mio8390/gapi2gdi.cab only cab
http://picard.exceed.hu/mio8390/gapi2gdi.zip source

ps: word definitions:
GDI http://msdn.microsoft.com/library/default....e_interface.asp
GAPI http://msdn.microsoft.com/library/default....htm/gx_bvrh.asp


This post has been edited by picard_beta: Jan 3 2005, 19:14
Go to the top of the page
 
+Quote Post
the bishop
post Jun 22 2004, 23:15
Post #2


Enthusiast
Group Icon

Group: Posters
Posts: 171
Joined: 20th May 2004
From: San Antonio, TX
Member No.: 43,855

Device(s): Moto Q9h



i would try it but indeed my phone has bought the farm. :/


--------------------
I'm a phone-holic, please donate to support my habit! :)
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 22 2004, 23:42
Post #3


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



sorry man sad.gif

i had no luck either. i just broke one of my pda's lcd screen
tonight :cry: fortunatelly it's only for development and still usable
at an acceptable level.

ps: i had to lookup the 'bought the farm' expression smile.gif
Go to the top of the page
 
+Quote Post
schriss
post Jun 23 2004, 06:58
Post #4


Addict
Group Icon

Group: Posters
Posts: 542
Joined: 28th June 2003
From: Poland, Warsaw
Member No.: 9,037

Device(s): Qtek 8310 (I-Mate SP5)



HOLY s***, THIS WRAPPER WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Picard is a genius biggrin.gif

Games/apps that work with wrapper:
Eclipse First Wave - WORKS! It's fast without SmartPhone Turbo activated tongue.gif
6th Gear - WORKS fast biggrin.gif
SPVQuake - runs!! I hear sounds but the screen is completely white :cry:
BetaPlayer - works in GAPI mode, see benchmark results below
PocketClive (ZX Spectrum) - WORKS

BetaPlayer WORKS in GAPI mode - here are benchmark results in both: GDI and GAPI mode, tested with the same movie (crystal clear quality, link to file at the bottom) tongue.gif
Results for GAPI wrapper (WITHOUT SmartPhoneTurbo):
Average Speed: 102.55%
Original Data Rate: 401 kbit/s
Bench. Data Rate: 411 kbit/s

Results for GDI:
Average Speed: 121.60%
Original Data Rate: 401 kbit/s
Bench. Data Rate: 487 kbit/s

Results WITH SmartPhoneTurbo activated biggrin.gif
Results for GAPI wrapper:
Average Speed: 112.76%
Original Data Rate: 401 kbit/s
Bench. Data Rate: 452 kbit/s

Results for GDI:
Average Speed: 130.83%
Original Data Rate: 401 kbit/s
Bench. Data Rate: 524 kbit/s

--== AND NOW RESULTS WITH ORIGINAL GAPI (BetaPlayer signed) AND TURBO ==--
Average Speed: 147.09%
Original Data Rate: 401 kbit/s
Bench. Data Rate: 589 kbit/s

The test TopGun video is here: http://www.certihost.net/smartphone/


--------------------
Current: HTC TyTN + Qtek 8310 (QVGA Wi-Fi EDGE) | Prev: Nokia 7650, Qtek7070 then Mio8390 | Next: Device with foldable 640x480 screen and Virtual Laser Keyboard builtin.
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 07:51
Post #5


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



are you sure there was no old gx.dll in the application folder when the program crashed? when worked did you copied my gx.dll from windows directory to the application folder? i don't understand why you have to copy gx.dll from windows directory if there was no old gx.dll in the application folder. maybe the OS gx.dll could not be "overwritten". on pocketpc any OS dll can be patched with just simple copying a file with the same name on it. if you delete the file the original OS file will reappear.

about BetaPlaye speed: this is a GDI wrapper so using directly GDI has the same or even better speed because only the actual video area is drawn.
Go to the top of the page
 
+Quote Post
mikevirgil
post Jun 23 2004, 08:12
Post #6


Newbie
Group Icon

Group: Posters
Posts: 16
Joined: 16th June 2004
Member No.: 46,759



Installed GAPI2GDI wrapper:

- XRAlly Alpha doesn't work (freezes the phone)
- SPVMan doesn't work (back to Start Menu)
- Xtris doesn't work
- Picodrive doesn't work... sad.gif
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:22
Post #7


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



ok so it seems overwriting the original gx.dll doesn't work sad.gif

@mikevirgil: you should try copy the new gx.dll and gxorig.dll to each application folders as schriss suggested
(you can download them with the .zip file)
Go to the top of the page
 
+Quote Post
schriss
post Jun 23 2004, 08:28
Post #8


Addict
Group Icon

Group: Posters
Posts: 542
Joined: 28th June 2003
From: Poland, Warsaw
Member No.: 9,037

Device(s): Qtek 8310 (I-Mate SP5)



Yes, I deleted original gx.dll from BetaPlayer's directory, but still didn't work. I had to copy your gx.dll to app folder. I think this is because there is a gx.dll in Windows folder (the gx.dll that does not work). Your gx.dll has been installed into Storage/Windows
Probably system first tries the gx.dll found in the original, protected Windows directory, not the one from Storage/Windows.

There are following directories:
Storage (this one contains windows folder)
Storage Card
Temp
Windows (this one is protected)


--------------------
Current: HTC TyTN + Qtek 8310 (QVGA Wi-Fi EDGE) | Prev: Nokia 7650, Qtek7070 then Mio8390 | Next: Device with foldable 640x480 screen and Virtual Laser Keyboard builtin.
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:34
Post #9


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



ops. yes this is the problem

what does it mean windows is protected? i know you can't copy ROM files, but patching them should be possible at least on pocketpc. could you try to copy the new gx.dll over the one in windows?
Go to the top of the page
 
+Quote Post
stohn
post Jun 23 2004, 08:37
Post #10


Regular
Group Icon

Group: Posters
Posts: 52
Joined: 10th July 2003
Member No.: 9,695



Hi,

the idea looks great and it should be possible to get this to work!

Here are some findings and bug fixes (which cause this not to work):

CODE
DC = GetDC(NULL);

requires a ReleaseDC... otherwise the complete GDI will lock up until you call GXCloseDisplay()

:arrow: add the following line to GXOpenDisplay() and remove it from GXCloseDisplay()

CODE
GXDLL_API int GXOpenDisplay(HWND hWnd, DWORD dwFlags)

{

 ...

 Width = GetDeviceCaps(DC,HORZRES);

 Height = GetDeviceCaps(DC,VERTRES);

 

 ReleaseDC( NULL, DC ); //<== ADD THIS LINE

 ...

}



GXDLL_API int GXCloseDisplay()

{

 DeleteDC(DC2);

 DeleteObject(Bitmap);

 //ReleaseDC(NULL,DC);  //<== REMOVE THIS LINE

 ...

}


Of course you have to put GetDC() and ReleaseDC () now to each DC operation...

CODE
GXDLL_API void* GXBeginDraw()

{

 _GXBeginDraw();

 if (!FullScreen && ViewHeight > 0)

 {

   DC = GetDC(NULL);

   BitBlt(DC2,0,ViewTop,Width,ViewHeight,DC,0,ViewTop,SRCCOPY);

   ReleaseDC(NULL,DC);

 }

 return Buffer;

}



GXDLL_API int GXEndDraw()

{

 if (ViewHeight > 0)

 {

   DC = GetDC(NULL);

   BitBlt(DC,0,ViewTop,Width,ViewHeight,DC2,0,ViewTop,SRCCOPY);

   ReleaseDC(NULL,DC);

 }

 return _GXEndDraw();

}


Next thing:

It's not a good idea NOT to take the original device gx.dll!!!!

You better should rename the original and copy yours to Windows. To do this I suggest to write a little tool which will do it on each device startup since Windows folder is not persistent on smartphone.

Last but not least:
you can detect operations to your memory block (bitmap copy of the screen) by setting up an hardware breakpoint on memory write operations. So you will not need a timer for redraws... Unfortunately you will need priv. access to do this. But unlocked MIO's could use it.

Maik
Go to the top of the page
 
+Quote Post
mikevirgil
post Jun 23 2004, 08:43
Post #11


Newbie
Group Icon

Group: Posters
Posts: 16
Joined: 16th June 2004
Member No.: 46,759



now using the source gx.gll and gxold.dll:

- SPVMan starts but black screen (sound ok)
- Picodrive works (but some glitches when switching between screen orientations) (no sound)
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:47
Post #12


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



@stohn: thanks for the feedback

QUOTE
requires a ReleaseDC... otherwise the complete GDI will lock up until you call GXCloseDisplay()
are you sure? i never had this problem on any windows platform yet. you can even create more DC's. example in BetaPlayer it work's perfectly even on the mio8390 for sure. btw you will need that DC for blitting so if you release it in opendisplay you have to requery/release it in begindraw/enddraw.

QUOTE
Why do you call BitBlt in GXBeginDraw() ? There should be no need for this.

in non fullscreen mode this is the correct operation for GAPI. you have to save the current displat state so the program using GAPI can draw only partially on the screen. ofcoz most of the games will use fullscreen mode so this won't slow them down.

QUOTE
you can detect operations to your memory block (bitmap copy of the screen) by setting up an hardware breakpoint on memory write operations. So you will not need a timer for redraws... Unfortunately you will need priv. access to do this. But unlocked MIO's could use it.

could you give me some hints how to do that? i'am really interested. but i'am not sure it can be done on an unlocked phone either. example even on unlocked phone i can't change to kernel mode with a non signed program.
Go to the top of the page
 
+Quote Post
schriss
post Jun 23 2004, 08:48
Post #13


Addict
Group Icon

Group: Posters
Posts: 542
Joined: 28th June 2003
From: Poland, Warsaw
Member No.: 9,037

Device(s): Qtek 8310 (I-Mate SP5)



Picard:
I can't even read or copy the gx.dll that is in windows so overwriting it should be possible... yes, got "File is in ROM, are you sure..." and then "Access denied".

Stohn:
this wrapper already works biggrin.gif maybe with your suggestions it will be even better! Thanks for those great suggestions biggrin.gif (I'm not a programmer, for me it's like Chinese laugh.gif )


--------------------
Current: HTC TyTN + Qtek 8310 (QVGA Wi-Fi EDGE) | Prev: Nokia 7650, Qtek7070 then Mio8390 | Next: Device with foldable 640x480 screen and Virtual Laser Keyboard builtin.
Go to the top of the page
 
+Quote Post
stohn
post Jun 23 2004, 08:52
Post #14


Regular
Group Icon

Group: Posters
Posts: 52
Joined: 10th July 2003
Member No.: 9,695



I'm really sure about the GetDC(NULL). This will acquire the main device context and no other application or GDI operation can work then (even offscreen things are not possible... and windows sometimes use it e.g. for updating an invisible clock ;-) )

For priv. access there is a simple trick. You have to put your own certificate to trusted store (this is possible on unlocked devices). Then you have to sign your application with your own certificate. Voila... SetKMode() and stuff working well then :-D


Maik
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:54
Post #15


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



QUOTE
It's not a good idea NOT to take the original device gx.dll!!!!

You better should rename the original and copy yours to Windows. To do this I suggest to write a little tool which will do it on each device startup since Windows folder is not persistent on smartphone.


i thought you can't read nor rename the files in ROM. btw gx.dll is just a wrapper. it was designed this way. so games can install their own copy without compability issues. example if the device uses DMA transfer it's in a separate gxdma.dll, but gx.dll should do the same on all devices.
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:57
Post #16


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



QUOTE
I'm really sure about the GetDC(NULL). This will acquire the main device context and no other application or GDI operation can work then (even offscreen things are not possible... and windows sometimes use it e.g. for updating an invisible clock ;-) )
ok. i will change it.

QUOTE
For priv. access there is a simple trick. You have to put your own certificate to trusted store (this is possible on unlocked devices). Then you have to sign your application with your own certificate. Voila... SetKMode() and stuff working well then :-D


sorry. i'am really a novice smartphone programmer. how can i put my certificate to trusted store?

thanks for helping.

bye, Picard
Go to the top of the page
 
+Quote Post
schriss
post Jun 23 2004, 08:58
Post #17


Addict
Group Icon

Group: Posters
Posts: 542
Joined: 28th June 2003
From: Poland, Warsaw
Member No.: 9,037

Device(s): Qtek 8310 (I-Mate SP5)



Stohn: Does it mean that with GetDC(NULL) I won't be able to have anything running in the background? Or answer the phone call?

Picard: can we try again the memdump with that priv. access trick? (certificate)


--------------------
Current: HTC TyTN + Qtek 8310 (QVGA Wi-Fi EDGE) | Prev: Nokia 7650, Qtek7070 then Mio8390 | Next: Device with foldable 640x480 screen and Virtual Laser Keyboard builtin.
Go to the top of the page
 
+Quote Post
picard_beta
post Jun 23 2004, 08:59
Post #18


Regular
Group Icon

Group: Posters
Posts: 148
Joined: 3rd May 2004
Member No.: 42,152



QUOTE
Picard: can we try again the memdump with that priv. access trick? (certificate)


sure. if i get home and know how to add my certificate.
(i'am checking msdn...)
Go to the top of the page
 
+Quote Post
stohn
post Jun 23 2004, 09:07
Post #19


Regular
Group Icon

Group: Posters
Posts: 52
Joined: 10th July 2003
Member No.: 9,695



Basically you are right about gx.dll is always the same except one thing...

The gx.dll on Smartphone is in ROM ==> IMPLICIT UNLIMITED TRUST (same as privileged signed).

Your copy is not signed...

Maik

P.S.
QUOTE
Stohn: Does it mean that with GetDC(NULL) I won't be able to have anything running in the background? Or answer the phone call?  
EXACT

QUOTE
how can i put my certificate to trusted store?


Check SDK documentation... ;-)
Go to the top of the page
 
+Quote Post
schriss
post Jun 23 2004, 09:11
Post #20


Addict
Group Icon

Group: Posters
Posts: 542
Joined: 28th June 2003
From: Poland, Warsaw
Member No.: 9,037

Device(s): Qtek 8310 (I-Mate SP5)



QUOTE
QUOTE
Stohn: Does it mean that with GetDC(NULL) I won't be able to have anything running in the background? Or answer the phone call?  


EXACT


Is this a good idea? I mean until now, I was uble to answer a phone call while watching a video using BetaPlayer... It kept running in the background, but the system has lowered the volume automatically biggrin.gif


--------------------
Current: HTC TyTN + Qtek 8310 (QVGA Wi-Fi EDGE) | Prev: Nokia 7650, Qtek7070 then Mio8390 | Next: Device with foldable 640x480 screen and Virtual Laser Keyboard builtin.
Go to the top of the page
 
+Quote Post

7 Pages V   1 2 3 > » 
Reply to this topicStart new topic

Collapse

Similar Topics

  Topic Replies Topic Starter Views Last Action
No New Posts O2 Xda IIs Upgrade to AKU3?
1 thewitney 238 Today, 01:56
Last post by: khadimhussain
No new Topic has attachments