1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/platform/wince/wince-sdl.h"
#include "common/config-manager.h"
#include "common/debug.h"
#include "common/events.h"
#include "common/util.h"
#include "common/textconsole.h"
#include "common/timer.h"
#include "common/translation.h"
#include "engines/engine.h"
#include "base/main.h"
#include "base/plugins.h"
#include "audio/mixer_intern.h"
#include "audio/fmopl.h"
#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/timer/sdl/sdl-timer.h"
#include "gui/Actions.h"
#include "gui/KeysDialog.h"
#include "gui/message.h"
#include "backends/platform/wince/CEActionsPocket.h"
#include "backends/platform/wince/CEActionsSmartphone.h"
#include "backends/platform/wince/CEgui/ItemAction.h"
#include "graphics/scaler/downscaler.h"
#include "graphics/scaler/aspect.h"
#include "backends/platform/wince/CEException.h"
#include "backends/platform/wince/CEScaler.h"
#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#include "backends/events/wincesdl/wincesdl-events.h"
#include "backends/mixer/wincesdl/wincesdl-mixer.h"
#ifdef DYNAMIC_MODULES
#include <malloc.h>
#include "backends/plugins/win32/win32-provider.h"
#endif
#ifdef __GNUC__
extern "C" _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
#endif
#ifdef WRAP_MALLOC
extern "C" void *__real_malloc(size_t size);
extern "C" void __real_free(void *ptr);
extern "C" void *__wrap_malloc(size_t size) {
/*
void *ptr = __real_malloc(size);
printf("malloc(%d) = %p\n", size, ptr);
return ptr;
*/
if (size < 64 * 1024) {
void *ptr = __real_malloc(size+4);
// printf("malloc(%d) = %p\n", size, ptr);
if (ptr != NULL) {
*((HANDLE *)ptr) = 0;
return 4+(char *)ptr;
}
return NULL;
}
HANDLE H = CreateFileMapping((HANDLE)INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size+4, 0);
void *ptr = MapViewOfFile(H, FILE_MAP_ALL_ACCESS, 0, 0, 0);
*((HANDLE *)ptr) = H;
return 4+(char *)ptr;
}
extern "C" void __wrap_free(void *ptr) {
/*
__real_free(ptr);
printf("free(%p)\n", ptr);
*/
if (ptr != NULL) {
HANDLE H = *(HANDLE *)((char *)ptr-4);
if (H == 0) {
__real_free((char *)ptr-4);
return;
}
UnmapViewOfFile((char *)ptr-4);
CloseHandle(H);
}
}
#endif
using namespace CEGUI;
// ********************************************************************************************
// stdin/err redirection
#define STDOUT_FNAME "\\scummvm_stdout.txt"
#define STDERR_FNAME "\\scummvm_stderr.txt"
static FILE *stdout_file = NULL, *stderr_file = NULL;
static char stdout_fname[MAX_PATH], stderr_fname[MAX_PATH];
// Static member inits
typedef void (*SoundProc)(void *param, byte *buf, int len);
bool OSystem_WINCE3::_soundMaster = true;
bool _isSmartphone = false;
bool _hasSmartphoneResolution = false;
#define DEFAULT_CONFIG_FILE "scummvm.ini"
// ********************************************************************************************
bool isSmartphone() {
//return _isSmartphone;
return _hasSmartphoneResolution;
}
const TCHAR *ASCIItoUnicode(const char *str) {
static TCHAR ustr[MAX_PATH]; // size good enough
MultiByteToWideChar(CP_ACP, 0, str, strlen(str) + 1, ustr, sizeof(ustr) / sizeof(TCHAR));
return ustr;
}
// MAIN
#ifndef __GNUC__
int handleException(EXCEPTION_POINTERS *exceptionPointers) {
CEException::writeException(TEXT("\\scummvmCrash"), exceptionPointers);
drawError("Unrecoverable exception occurred - see crash dump in latest \\scummvmCrash file");
fclose(stdout_file);
fclose(stderr_file);
CEDevice::end();
SDL_Quit();
exit(0);
return EXCEPTION_EXECUTE_HANDLER;
}
#endif
extern "C" char *getcwd(char *buf, int size);
int SDL_main(int argc, char **argv) {
FILE *newfp = NULL;
#ifdef __GNUC__
// Due to incomplete crt0.o implementation, we go through the constructor function
// list provided by the linker and init all of them
// thanks to joostp and DJWillis
extern void (*__CTOR_LIST__)();
void (**constructor)() = &__CTOR_LIST__;
constructor++; // First item in list of constructors has special meaning (platform dependent), ignore it.
while (*constructor) {
(*constructor)();
constructor++;
}
#endif
CEDevice::init();
/* Redirect standard input and standard output */
strcpy(stdout_fname, getcwd(NULL, MAX_PATH));
strcpy(stderr_fname, getcwd(NULL, MAX_PATH));
strcat(stdout_fname, STDOUT_FNAME);
strcat(stderr_fname, STDERR_FNAME);
#ifndef __GNUC__
stdout_file = fopen(stdout_fname, "w");
stderr_file = fopen(stderr_fname, "w");
#else
stdout_file = newfp = _wfreopen(ASCIItoUnicode(stdout_fname), TEXT("w"), stdout);
if (newfp == NULL) {
#if !defined(stdout)
stdout = fopen(stdout_fname, "w");
stdout_file = stdout;
#else
newfp = fopen(stdout_fname, "w");
if (newfp) {
//*stdout = *newfp;
stdout_file = stdout;
}
#endif
}
stderr_file = newfp = _wfreopen(ASCIItoUnicode(stderr_fname), TEXT("w"), stderr);
if (newfp == NULL) {
#if !defined(stderr)
stderr = fopen(stderr_fname, "w");
stderr_file = stderr;
#else
newfp = fopen(stderr_fname, "w");
if (newfp) {
//*stderr = *newfp;
stderr_file = stderr;
}
#endif
}
#endif
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new Win32PluginProvider());
#endif
int res = 0;
#if !defined(DEBUG) && !defined(__GNUC__)
__try {
#endif
g_system = new OSystem_WINCE3();
assert(g_system);
// Pre initialize the backend
((OSystem_WINCE3 *)g_system)->init();
// Invoke the actual ScummVM main entry point:
res = scummvm_main(argc, argv);
// Free OSystem
delete(OSystem_WINCE3 *)g_system;
#if !defined(DEBUG) && !defined(__GNUC__)
}
__except(handleException(GetExceptionInformation())) {
}
#endif
return res;
}
#ifdef DYNAMIC_MODULES
/* This is the OS startup code in the case of a plugin-enabled build.
* It contains copied and slightly modified parts of SDL's win32/ce startup functions.
* We copy these here because the calling stub already has a WinMain procedure
* which overrides SDL's one and hence we essentially re-implement the startup procedure.
* Note also that this has to be here and not in the stub because SDL is statically
* linked in the scummvm.dll archive.
* Take a look at the comments in stub.cpp as well.
*/
int console_main(int argc, char *argv[]) {
int n;
char *bufp, *appname;
appname = argv[0];
if ((bufp = strrchr(argv[0], '\\')) != NULL)
appname = bufp + 1;
else if ((bufp = strrchr(argv[0], '/')) != NULL)
appname = bufp + 1;
if ((bufp = strrchr(appname, '.')) == NULL)
n = strlen(appname);
else
n = (bufp - appname);
bufp = (char *) alloca(n + 1);
strncpy(bufp, appname, n);
bufp[n] = '\0';
appname = bufp;
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
error("WinMain() error: %d", SDL_GetError());
return(FALSE);
}
SDL_SetModuleHandle(GetModuleHandle(NULL));
// Run the application main() code
SDL_main(argc, argv);
return(0);
}
static int ParseCommandLine(char *cmdline, char **argv) {
char *bufp;
int argc;
argc = 0;
for (bufp = cmdline; *bufp;) {
// Skip leading whitespace
while (isspace(*bufp))
++bufp;
// Skip over argument
if (*bufp == '"') {
++bufp;
if (*bufp) {
if (argv)
argv[argc] = bufp;
++argc;
}
// Skip over word
while (*bufp && (*bufp != '"'))
++bufp;
} else {
if (*bufp) {
if (argv)
argv[argc] = bufp;
++argc;
}
// Skip over word
while (*bufp && ! isspace(*bufp))
++bufp;
}
if (*bufp) {
if (argv)
*bufp = '\0';
++bufp;
}
}
if (argv)
argv[argc] = NULL;
return(argc);
}
int dynamic_modules_main(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw) {
HINSTANCE handle;
char **argv;
int argc;
char *cmdline;
wchar_t *bufp;
int nLen;
if (wcsncmp(szCmdLine, TEXT("\\"), 1)) {
nLen = wcslen(szCmdLine) + 128 + 1;
bufp = (wchar_t *) alloca(nLen * 2);
wcscpy(bufp, TEXT("\""));
GetModuleFileName(NULL, bufp + 1, 128 - 3);
wcscpy(bufp + wcslen(bufp), TEXT("\" "));
wcsncpy(bufp + wcslen(bufp), szCmdLine, nLen - wcslen(bufp));
} else
bufp = szCmdLine;
nLen = wcslen(bufp) + 1;
cmdline = (char *) alloca(nLen);
WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
// Parse command line into argv and argc
argc = ParseCommandLine(cmdline, NULL);
argv = (char **) alloca((argc + 1) * (sizeof * argv));
ParseCommandLine(cmdline, argv);
// fix gdb-emulator combo
while (argc > 1 && !strstr(argv[0], ".exe")) {
OutputDebugString(TEXT("SDL: gdb argv[0] fixup\n"));
*(argv[1] - 1) = ' ';
int i;
for (i = 1; i < argc; i++)
argv[i] = argv[i + 1];
argc--;
}
// Run the main program (after a little SDL initialization)
return(console_main(argc, argv));
}
#endif
// ********************************************************************************************
// ********************************************************************************************
void pumpMessages() {
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
void drawError(char *error) {
TCHAR errorUnicode[200];
MultiByteToWideChar(CP_ACP, 0, error, strlen(error) + 1, errorUnicode, sizeof(errorUnicode));
pumpMessages();
MessageBox(GetActiveWindow(), errorUnicode, TEXT("ScummVM error"), MB_OK | MB_ICONERROR);
pumpMessages();
}
// ********************************************************************************************
static Uint32 timer_handler_wrapper(Uint32 interval) {
DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
tm->handler();
return interval;
}
void OSystem_WINCE3::initBackend() {
assert(!_inited);
// Create the backend custom managers
if (_eventSource == 0)
_eventSource = new WINCESdlEventSource();
if (_mixerManager == 0) {
_mixerManager = new WINCESdlMixerManager();
// Setup and start mixer
_mixerManager->init();
}
if (_graphicsManager == 0)
_graphicsManager = new WINCESdlGraphicsManager(_eventSource, _window);
((WINCESdlEventSource *)_eventSource)->init(dynamic_cast<WINCESdlGraphicsManager *>(_graphicsManager));
// Call parent implementation of this method
OSystem_SDL::initBackend();
// Initialize global key mapping
GUI::Actions::init();
GUI_Actions::Instance()->initInstanceMain(this);
if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version
warning("Setting default action mappings");
GUI_Actions::Instance()->saveMapping(); // write defaults
}
_inited = true;
}
int OSystem_WINCE3::getScreenWidth() {
return _platformScreenWidth;
}
void OSystem_WINCE3::initScreenInfos() {
// sdl port ensures that we use correctly full screen
_isOzone = 0;
SDL_Rect **r;
r = SDL_ListModes(NULL, 0);
_platformScreenWidth = r[0]->w;
_platformScreenHeight = r[0]->h;
}
int OSystem_WINCE3::getScreenHeight() {
return _platformScreenHeight;
}
bool OSystem_WINCE3::isOzone() {
return _isOzone;
}
Common::String OSystem_WINCE3::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
strcpy(configFile, getcwd(NULL, MAX_PATH));
strcat(configFile, "\\");
strcat(configFile, DEFAULT_CONFIG_FILE);
return configFile;
}
// ********************************************************************************************
OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
_forcePanelInvisible(false) {
// Initialze File System Factory
_fsFactory = new WindowsFilesystemFactory();
_mixer = 0;
}
OSystem_WINCE3::~OSystem_WINCE3() {
delete _mixer;
}
void OSystem_WINCE3::swap_sound_master() {
_soundMaster = !_soundMaster;
//WINCESdlGraphicsManager _graphicsManager
WINCESdlGraphicsManager *graphicsManager = dynamic_cast<WINCESdlGraphicsManager *>(_graphicsManager);
if (graphicsManager->_toolbarHandler.activeName() == NAME_MAIN_PANEL)
graphicsManager->_toolbarHandler.forceRedraw(); // redraw sound icon
}
void OSystem_WINCE3::engineInit() {
check_mappings(); // called here to initialize virtual keys handling
dynamic_cast<WINCESdlGraphicsManager *>(_graphicsManager)->update_game_settings();
// finalize mixer init
_mixerManager->init();
}
void OSystem_WINCE3::check_mappings() {
CEActionsPocket *instance;
Common::String gameid(ConfMan.get("gameid"));
if (gameid.empty() || GUI_Actions::Instance()->initialized())
return;
GUI_Actions::Instance()->initInstanceGame();
instance = (CEActionsPocket *)GUI_Actions::Instance();
// Some games need to map the right click button, signal it here if it wasn't done
if (instance->needsRightClickMapping()) {
GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map right click action"));
while (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
GUI::MessageDialog alert(_("You must map a key to the 'Right Click' action to play this game"));
alert.runModal();
}
}
delete keysDialog;
}
// Map the "hide toolbar" action if needed
if (instance->needsHideToolbarMapping()) {
GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map hide toolbar action"));
while (!instance->getMapping(POCKET_ACTION_HIDE)) {
keysDialog->runModal();
if (!instance->getMapping(POCKET_ACTION_HIDE)) {
GUI::MessageDialog alert(_("You must map a key to the 'Hide toolbar' action to play this game"));
alert.runModal();
}
}
delete keysDialog;
}
// Map the "zoom" actions if needed
if (instance->needsZoomMapping()) {
GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map Zoom Up action (optional)"));
keysDialog->runModal();
delete keysDialog;
keysDialog = new GUI::KeysDialog(_("Map Zoom Down action (optional)"));
keysDialog->runModal();
delete keysDialog;
}
// Extra warning for Zak Mc Kracken
if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
!GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
GUI::MessageDialog alert(_("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"));
alert.runModal();
}
}
void OSystem_WINCE3::setGraphicsModeIntern() {
// Scalers have been pre-selected for the desired mode.
// No further tuning required.
}
void OSystem_WINCE3::initSDL() {
// Check if SDL has not been initialized
if (!_initedSDL) {
uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO;
if (ConfMan.hasKey("disable_sdl_parachute"))
sdlFlags |= SDL_INIT_NOPARACHUTE;
if (ConfMan.hasKey("use_GDI") && ConfMan.getBool("use_GDI")) {
SDL_VideoInit("windib", 0);
sdlFlags ^= SDL_INIT_VIDEO;
}
// Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
if (SDL_Init(sdlFlags) == -1)
error("Could not initialize SDL: %s", SDL_GetError());
_initedSDL = true;
}
}
void OSystem_WINCE3::init() {
// Create SdlMutexManager instance as the TimerManager relies on the
// MutexManager being already initialized
if (_mutexManager == 0)
_mutexManager = new SdlMutexManager();
// Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
// We work around this by using the SetTimer function, since we only use
// one timer in scummvm (for the time being)
if (_timerManager == 0) {
_timerManager = new DefaultTimerManager();
SDL_SetTimer(10, &timer_handler_wrapper);
}
// Call parent implementation of this method
OSystem_SDL::init();
}
void OSystem_WINCE3::quit() {
fclose(stdout_file);
fclose(stderr_file);
if (gDebugLevel <= 0) {
DeleteFile(ASCIItoUnicode(stdout_fname));
DeleteFile(ASCIItoUnicode(stderr_fname));
}
CEDevice::end();
OSystem_SDL::quit();
}
void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
SYSTEMTIME systime;
GetLocalTime(&systime);
t.tm_year = systime.wYear - 1900;
t.tm_mon = systime.wMonth - 1;
t.tm_mday = systime.wDay;
t.tm_hour = systime.wHour;
t.tm_min = systime.wMinute;
t.tm_sec = systime.wSecond;
t.tm_wday = systime.wDayOfWeek;
}
Common::String OSystem_WINCE3::getSystemLanguage() const {
#ifdef USE_DETECTLANG
// We can not use "setlocale" (at least not for MSVC builds), since it
// will return locales like: "English_USA.1252", thus we need a special
// way to determine the locale string for Win32.
char langName[9];
char ctryName[9];
TCHAR langNameW[32];
TCHAR ctryNameW[32];
int i = 0;
bool localeFound = false;
Common::String localeName;
// Really not nice, but the only way to map Windows CE language/country codes to posix NLS names,
// because Windows CE doesn't support LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME,
// according to this: http://msdn.microsoft.com/en-us/library/aa912934.aspx
//
// See http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx for a translation table
// This table has to be updated manually when new translations are added
const char *posixMappingTable[][3] = {
{"CAT", "ESP", "ca_ES"},
{"CSY", "CZE", "cs_CZ"},
{"DAN", "DNK", "da_DK"},
{"DEU", "DEU", "de_DE"},
{"ESN", "ESP", "es_ES"},
{"ESP", "ESP", "es_ES"},
{"FRA", "FRA", "fr_FR"},
{"HUN", "HUN", "hu_HU"},
{"ITA", "ITA", "it_IT"},
{"NOR", "NOR", "nb_NO"},
{"NON", "NOR", "nn_NO"},
{"PLK", "POL", "pl_PL"},
{"PTB", "BRA", "pt_BR"},
{"RUS", "RUS", "ru_RU"},
{"SVE", "SWE", "sv_SE"},
{"UKR", "UKR", "uk_UA"},
{NULL, NULL, NULL}
};
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, langNameW, sizeof(langNameW)) != 0 &&
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) {
WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL);
debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName);
while (posixMappingTable[i][0] && !localeFound) {
if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) &&
(!strcmp(posixMappingTable[i][1], ctryName) || !strcmp(posixMappingTable[i][0], "*")) ) {
localeFound = true;
localeName = posixMappingTable[i][2];
}
i++;
}
if (!localeFound) warning("No posix locale name found for %s_%s", langName, ctryName);
}
if (localeFound) {
debug(1, "Found posix locale name: %s", localeName.c_str());
return localeName;
} else {
return ModularBackend::getSystemLanguage();
}
#else // USE_DETECTLANG
return ModularBackend::getSystemLanguage();
#endif // USE_DETECTLANG
}
int OSystem_WINCE3::_platformScreenWidth;
int OSystem_WINCE3::_platformScreenHeight;
bool OSystem_WINCE3::_isOzone;
|