Wince improvments

Hi,

I am developper on windows ce platform and I have tried to compile it on
windows mobile 5 platform.
Here is my feedback :

When compiling here are the errors I get :

------ Build started: Project: SDL, Configuration: Release Windows
Mobile 5.0 Pocket PC SDK (ARMV4I) ------
Compiling…
SDL_dibevents.c
A - …\src\video\windib\SDL_dibevents.c(279) : warning C4133:
‘function’ : incompatible types - from ‘char [256]’ to 'LPWSTR’
B - …\src\video\windib\SDL_dibevents.c(282) : warning C4133:
‘function’ : incompatible types - from ‘char [9]’ to 'LPCWSTR’
C - …\src\video\windib\SDL_dibevents.c(282) : error C2065:
‘KLF_NOTELLSHELL’ : undeclared identifier
D - …\src\video\windib\SDL_dibevents.c(287) : warning C4133:
‘function’ : incompatible types - from ‘char [256]’ to 'LPCWSTR’
E - …\src\video\windib\SDL_dibevents.c(421) : warning C4013:
‘MapVirtualKeyEx’ undefined; assuming extern returning int
Build log was saved at
"file://d:\Smartdev\SDL-1.2.11\VisualCE\SDL\Windows Mobile 5.0 Pocket PC
SDK (ARMV4I)\Release\BuildLog.htm"
SDL - 1 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

About incompatible types I don’t know how you handle encoding type in SDL.
You have two solutions :

1)First you can declare a macro _T("") and a TCHAR type.

  1. You can do ANSI->UNICODE / UNICODE->ANSI conversion using
    mbcstowcs/wcstombs.

The first solution would be the best solution as it would allow SDL to
be compiled on platform
using UNICODE natively without any loss in performance but it will force
you to make too many changes for now.
If some maintainer could give me his opinion about this topic.

So I will use the second solution for now :

void DIB_InitOSKeymap(_THIS)
{
int i;
char current_layout[256];

#if defined(_WIN32_WCE)
TCHAR wszCurLayout[256];
GetKeyboardLayoutName(wszCurLayout);
::wcstombs( current_layout, wszCurLayout, 256);
//LoadKeyboardLayout is not directly supported
#else
GetKeyboardLayoutName(current_layout);
//printf(“Initial Keyboard Layout Name: ‘%s’\n”, current_layout);

hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL);
if (!hLayoutUS) {
    //printf("Failed to load US keyboard layout. Using current.\n");
    hLayoutUS = GetKeyboardLayout(0);
}
LoadKeyboardLayout(current_layout, KLF_ACTIVATE);

#endif

}

static int SDL_MapVirtualKey(int scancode, int vkey)
{
#if defined(_WIN32_WCE)
int mvke = MapVirtualKey(scancode & 0xFF, 1);
#else
int mvke = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS);
#endif

}

After these modifications I had a linker error :

Creating library Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)\Release/SDL.lib and object Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)\Release/SDL.exp
SDL_dibvideo.obj : error LNK2001: unresolved external symbol GetMenu
Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Release/SDL.dll : fatal error
LNK1120: 1 unresolved externals

GetMenu doesn’t exist on windows ce platforms to my knowledge. You could
use HMENU CommandBar_GetMenu() but
menu on wince are specific. Don’t know if it helps.

I have found someone who has already worked on this subject, don’t know
if you have integrated his work.

Please look here : http://arisme.free.fr/ports/SDL.php

1)First you can declare a macro _T("") and a TCHAR type.

All strings coming into and going out of SDL are UTF-8 encoded…on
PocketPC, we convert to what they call “UNICODE” internally as needed.

The UTF-8 stuff is fairly new, and I think Dmitry is the only person
that works with our PocketPC stuff, so it’s entirely possible that we
broke it recently and he hasn’t had a chance to clean up our messes.

The URL you linked to is actually superseded by new code in SDL:

/* Pocket PC GAPI SDL video driver implementation;
Implemented by Dmitry Yakimov - support at activekitten.com
Inspired by http://arisme.free.fr/ports/SDL.php
*/

I’m not sure if the “windib” support should be compiled at all on
PocketPC (as the GAPI driver is what should be used for video), but I
really don’t know much about SDL/pocketpc. Is it possible you used the
Windows project files in VisualC.zip, but should have used VisualCE.zip
instead?

–ryan.

Ryan C. Gordon a ?crit :

1)First you can declare a macro _T("") and a TCHAR type.

All strings coming into and going out of SDL are UTF-8 encoded…on
PocketPC, we convert to what they call “UNICODE” internally as needed.

The UTF-8 stuff is fairly new, and I think Dmitry is the only person
that works with our PocketPC stuff, so it’s entirely possible that we
broke it recently and he hasn’t had a chance to clean up our messes.

The URL you linked to is actually superseded by new code in SDL:

/* Pocket PC GAPI SDL video driver implementation;
Implemented by Dmitry Yakimov - support at activekitten.com
Inspired by http://arisme.free.fr/ports/SDL.php
*/

I’m not sure if the “windib” support should be compiled at all on
PocketPC (as the GAPI driver is what should be used for video), but I
really don’t know much about SDL/pocketpc. Is it possible you used the
Windows project files in VisualC.zip, but should have used VisualCE.zip
instead?

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I am sure to have used the right project and I cannot make a mistake
because in the IDE I have chosen
Windows mobile 5 as a target.
I couldn’t do that if I was using the normal project.

So I confirm something is broken. What version should I use to test SDL
on PPC ?