[Scummvm-cvs-logs] CVS: scummvm/backends/wince pocketpc.cpp,1.12,1.13

Nicolas Bacca arisme at users.sourceforge.net
Tue Nov 19 00:25:05 CET 2002


Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1:/tmp/cvs-serv29428

Modified Files:
	pocketpc.cpp 
Log Message:
Fix GDI dialog, set sampling rate to 22 kHz for Full Throttle & The Dig (Smush issue), fix save game key for Zak, The Dig & Full Throttle

Index: pocketpc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/pocketpc.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pocketpc.cpp	7 Nov 2002 00:30:52 -0000	1.12
+++ pocketpc.cpp	19 Nov 2002 08:24:35 -0000	1.13
@@ -94,6 +94,8 @@
 
 #include "dynamic_imports.h"
 
+#include "backends/fs/fs.h"
+
 #if defined(MIPS) || defined(SH3)
 // Comment this out if you don't want to support GameX
 #define GAMEX
@@ -103,12 +105,9 @@
 #include "GameX.h"
 #endif
 
-#define POCKETSCUMM_BUILD "101902"
-#define CURRENT_GAMES_VERSION 1
+#define CURRENT_GAMES_VERSION 3
 #define CURRENT_KEYS_VERSION 3
 
-#define VERSION "Build " POCKETSCUMM_BUILD " (VM " SCUMMVM_CVS ")"
-
 typedef int (*tTimeCallback)(int);
 typedef void SoundProc(void *param, byte *buf, int len);
 
@@ -189,6 +188,8 @@
 
 int _pseudoGAPI_device;
 
+extern char noGAPI;
+
 /* Default SDLAUDIO */
 
 /*
@@ -311,7 +312,7 @@
 int gameXGXOpenDisplay(HWND hWnd, DWORD dwFlags) {
 	gameX = new GameX();
 	if (!gameX->OpenGraphics()) {
-		MessageBox(NULL, TEXT("Couldn't initialize GameX. Reverting to GDI graphics"), TEXT("PocketScumm rendering"), MB_OK);
+		//MessageBox(NULL, TEXT("Couldn't initialize GameX. Reverting to GDI graphics"), TEXT("PocketScumm rendering"), MB_OK);
 		noGAPI = 1;
 	}
 	return 0;
@@ -419,8 +420,6 @@
 
 void keypad_init();
 
-extern char noGAPI;
-
 class OSystem_WINCE3 : public OSystem {
 public:
 	// Set colors of the palette
@@ -648,6 +647,8 @@
 /* Monkey2 keyboard stuff */
 bool monkey2_keyboard;
 
+bool new_audio_rate;
+
 bool closing = false;
 
 void close_GAPI() {
@@ -698,6 +699,7 @@
 
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
 {
+
 	TCHAR directory[MAX_PATH];
 	char game_name[100];
 	bool sound;
@@ -709,27 +711,6 @@
 	//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;
 
@@ -784,13 +765,16 @@
 			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();
+			FILE *test;
+
+			test = fopen("NoDirectVideo", "r");
+			if (test) {
+				noGAPI = 1;
+				fclose(test);
 			}
+			else
+			if (g_config->getBool("NoDirectVideo", false, "wince")) 
+				noGAPI = 1;
 		}
 
 		dynamicGXOpenInput = defaultGXOpenInput;
@@ -834,6 +818,26 @@
 
 	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();
@@ -851,6 +855,9 @@
 		g_config->flush();
 	}
 
+	if (result < 0)
+		return 0;
+
 	getSelectedGame(result, game_name, directory);
 	WideCharToMultiByte(CP_ACP, 0, directory, wcslen(directory) + 1, _directory, sizeof(_directory), NULL, NULL);
 	strcat(_directory, "\\");
@@ -888,6 +895,9 @@
 		monkey2_keyboard = true;
 	}		
 
+	//new_audio_rate = (strcmp(game_name, "dig") == 0 || strcmp(game_name, "monkey") == 0);
+	new_audio_rate = (strcmp(game_name, "dig") == 0 || strcmp(game_name, "ft") == 0);
+
 	detector.parseCommandLine(argc, argv);
 
 	if (detector.detectMain())
@@ -953,6 +963,7 @@
 
 	case WM_ERASEBKGND:
 		{
+			/*
 			
 			RECT rc;
 			HDC hDC;
@@ -965,7 +976,8 @@
 				if(rc.top < rc.bottom)
 					FillRect(hDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
 				ReleaseDC(hWnd, hDC);			
-			}			
+			}
+			*/
 		}
 		return 1;
 
@@ -975,6 +987,7 @@
 			PAINTSTRUCT ps;
 			hDC = BeginPaint (hWnd, &ps);
 			EndPaint (hWnd, &ps);
+			
 			if (!hide_toolbar)
 				toolbar_drawn = false;
 
@@ -1199,7 +1212,10 @@
 						*/
 						/*}*/
 						wm->_event.event_code = EVENT_KEYDOWN;
-						wm->_event.kbd.ascii = mapKey(VK_F5);
+						if (g_scumm->_features & GF_OLD256)
+							wm->_event.kbd.ascii = 319;
+						else
+							wm->_event.kbd.ascii = g_scumm->_vars[g_scumm->VAR_SAVELOADDIALOG_KEY];
 						break;
 					case ToolbarMode:
 						SetScreenMode(!GetScreenMode());
@@ -1213,7 +1229,7 @@
 							break;
 						}
 						wm->_event.event_code = EVENT_KEYDOWN;
-						if (g_scumm->vm.cutScenePtr[g_scumm->vm.cutSceneStackPointer])
+						if (g_scumm->vm.cutScenePtr[g_scumm->vm.cutSceneStackPointer] || g_scumm->_insaneState)
 							wm->_event.kbd.ascii = g_scumm->_vars[g_scumm->VAR_CUTSCENEEXIT_KEY];
 						else
 							wm->_event.kbd.ascii = g_scumm->_vars[g_scumm->VAR_TALKSTOP_KEY];						
@@ -1388,8 +1404,10 @@
 			toolbar_drawn = false;
 	*/
 	/*}*/
-
-	system->addEventKeyPressed(mapKey(VK_F5));
+	if (g_scumm->_features & GF_OLD256)
+		system->addEventKeyPressed(319);
+	else
+		system->addEventKeyPressed(g_scumm->_vars[g_scumm->VAR_SAVELOADDIALOG_KEY]);						
 }
 
 void action_quit() {
@@ -1428,7 +1446,7 @@
 	OSystem_WINCE3* system;
 	system = (OSystem_WINCE3*)g_scumm->_system;
 
-	if (g_scumm->vm.cutScenePtr[g_scumm->vm.cutSceneStackPointer])
+	if (g_scumm->vm.cutScenePtr[g_scumm->vm.cutSceneStackPointer] || g_scumm->_insaneState)
 		system->addEventKeyPressed(g_scumm->_vars[g_scumm->VAR_CUTSCENEEXIT_KEY]);
 	else
 		system->addEventKeyPressed(g_scumm->_vars[g_scumm->VAR_TALKSTOP_KEY]);						
@@ -1441,6 +1459,7 @@
 	else
 		LimitScreenGeometry();
 	Cls();
+	num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES;
 	toolbar_drawn = hide_toolbar;
 	g_scumm->_system->update_screen();
 }
@@ -1627,7 +1646,7 @@
 		else {
 			int i;
 			for (i=0; i<num_of_dirty_square; i++) {
-				Blt_part(_gfx_buf + (320 * ds[i].y) + ds[i].x, (GetScreenMode() ? ds[i].x : ds[i].x * 3/4), ds[i].y, ds[i].w, ds[i].h, 320);
+				Blt_part(_gfx_buf + (320 * ds[i].y) + ds[i].x, (GetScreenMode() ? ds[i].x : ds[i].x * 3/4), ds[i].y, ds[i].w, ds[i].h, 320, true);
 			}
 			num_of_dirty_square = 0;
 		}
@@ -1832,7 +1851,7 @@
 	/* only one format supported at the moment */
 
 	real_soundproc = proc;
-	desired.freq = SAMPLES_PER_SEC;
+	desired.freq = (new_audio_rate ? SAMPLES_PER_SEC_NEW : SAMPLES_PER_SEC_OLD);
 	desired.format = AUDIO_S16SYS;
 	desired.channels = 2;
 	desired.samples = 128;
@@ -1867,7 +1886,7 @@
 		break;
 
 	case PROP_GET_SAMPLE_RATE:
-		return SAMPLES_PER_SEC;
+		return (new_audio_rate ? SAMPLES_PER_SEC_NEW : SAMPLES_PER_SEC_OLD);
 	}
 
 	return 0;





More information about the Scummvm-git-logs mailing list