From 7aab43a24be1238733e4663158ef61e2220917a5 Mon Sep 17 00:00:00 2001 From: Nicolas Bacca Date: Thu, 7 Nov 2002 00:25:40 +0000 Subject: Possibly more devices supported : fall back to a default GDI rendering if nothing else is available - add dialog to choose between hazardous direct rendering or GDI svn-id: r5451 --- backends/wince/findgame.cpp | 5 + backends/wince/pocketpc.cpp | 104 +++++++++++++------ backends/wince/screen.cpp | 237 +++++++++++++++++++++++++++++++++++++++++++- backends/wince/screen.h | 3 + 4 files changed, 314 insertions(+), 35 deletions(-) (limited to 'backends/wince') diff --git a/backends/wince/findgame.cpp b/backends/wince/findgame.cpp index e4aa7411f3..1cba8c139c 100644 --- a/backends/wince/findgame.cpp +++ b/backends/wince/findgame.cpp @@ -854,6 +854,11 @@ void handleSelectGame(int x, int y) { x -= _game_selection_X_offset; y -= _game_selection_Y_offset; + if (y < start - 10) { + drawVideoDevice(); + return; + } + /* See if it's a selection */ for (i=0; iOpenGraphics()) { - MessageBox(NULL, TEXT("Couldn't initialize GameX"), TEXT("Error"), MB_OK); - exit(1); + MessageBox(NULL, TEXT("Couldn't initialize GameX. Reverting to GDI graphics"), TEXT("PocketScumm rendering"), MB_OK); + noGAPI = 1; } return 0; } @@ -419,6 +419,8 @@ extern void abortScanPath(); void keypad_init(); +extern char noGAPI; + class OSystem_WINCE3 : public OSystem { public: // Set colors of the palette @@ -707,7 +709,32 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin //HMODULE SDLAudio_handle; HMODULE GAPI_handle; + /* Create the main window */ + WNDCLASS wcex; + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)OSystem_WINCE3::WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = GetModuleHandle(NULL); + wcex.hIcon = 0; + wcex.hCursor = NULL; + wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wcex.lpszMenuName = 0; + wcex.lpszClassName = TEXT("ScummVM"); + if (!RegisterClass(&wcex)) + Error(TEXT("Cannot register window class!")); + + hWnd_Window = CreateWindow(TEXT("ScummVM"), TEXT("ScummVM"), WS_VISIBLE, + 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, GetModuleHandle(NULL), NULL); + + ShowWindow(hWnd_Window, SW_SHOW); + UpdateWindow(hWnd_Window); + hide_toolbar = false; + noGAPI = 0; + + g_config = new Config("scummvm.ini", "scummvm"); + g_config->set_writing(true); // See if we're running on a Windows CE version supporting aygshell aygshell_handle = LoadLibrary(TEXT("aygshell.dll")); @@ -754,8 +781,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin } if (!availablePseudoGAPI[i].device) { - MessageBox(NULL, TEXT("Cannot find GX.dll and no workaround for this device ! better luck next time ..."), TEXT("GAPI not found"), MB_OK); - exit(1); + noGAPI = 1; + } + else { + if (!g_config->getBool("DirectVideoCheck", false, "wince")) { + if (MessageBox(NULL, TEXT("Direct video support is available for this device. Do you want to use it ?"), TEXT("PocketScumm Rendering"), MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1|MB_APPLMODAL) == IDNO) + noGAPI = 1; + MessageBox(NULL, TEXT("Delete scummvm.ini or remove the DirectVideoCheck key if you want to change this setting later"), TEXT("PocketScumm Rendering"), MB_OK|MB_APPLMODAL); + g_config->setBool("DirectVideoCheck", true, "wince"); + g_config->flush(); + } } dynamicGXOpenInput = defaultGXOpenInput; @@ -787,9 +822,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin gfx_mode_switch = false; } - g_config = new Config("scummvm.ini", "scummvm"); - g_config->set_writing(true); - sound = g_config->getBool("Sound", true, "wince"); if (sound) sound_activated = sound; @@ -802,26 +834,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLin select_game = true; - /* Create the main window */ - WNDCLASS wcex; - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)OSystem_WINCE3::WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = GetModuleHandle(NULL); - wcex.hIcon = 0; - wcex.hCursor = NULL; - wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wcex.lpszMenuName = 0; - wcex.lpszClassName = TEXT("ScummVM"); - if (!RegisterClass(&wcex)) - Error(TEXT("Cannot register window class!")); - - hWnd_Window = CreateWindow(TEXT("ScummVM"), TEXT("ScummVM"), WS_VISIBLE, - 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, GetModuleHandle(NULL), NULL); - ShowWindow(hWnd_Window, SW_SHOW); - UpdateWindow(hWnd_Window); GraphicsOn(hWnd_Window, gfx_mode_switch); // open GAPI in Portrait mode GAPIKeysInit(); Cls(); @@ -925,10 +938,11 @@ LRESULT CALLBACK OSystem_WINCE3::WndProc(HWND hWnd, UINT message, WPARAM wParam, switch (message) { case WM_CREATE: + memset(&sai, 0, sizeof(sai)); dynamicSHSipPreference(hWnd, SIP_FORCEDOWN); // SHSipPreference(hWnd, SIP_INPUTDIALOG); - + return 0; case WM_DESTROY: @@ -1520,12 +1534,16 @@ OSystem *OSystem_WINCE3::create(int gfx_mode, bool full_screen) { reducePortraitGeometry(); + if ((noGAPI || !gfx_mode_switch) && GetSystemMetrics(SM_CXSCREEN) < 320) + SetScreenMode(1); + Cls(); drawWait(); // Set mode, portrait or landscape display_mode = g_config->get("DisplayMode", "wince"); - if (display_mode) + + if (display_mode && !(noGAPI || !gfx_mode_switch)) SetScreenMode(atoi(display_mode)); return syst; @@ -1799,11 +1817,37 @@ bool OSystem_WINCE3::poll_event(Event *event) { return false; } + +//#define MAX_DEBUG_SOUND 10 void own_soundProc(void *buffer, byte *samples, int len) { +/* + static int debug_sound_counter = 0; + + static FILE *debug_sound = NULL; +*/ + (*real_soundproc)(buffer, samples, len); +/* + if (debug_sound_counter < MAX_DEBUG_SOUND) { + int i; + + for (i=0; i