[Scummvm-cvs-logs] CVS: scummvm/wince findgame.cpp,1.4,1.5 pocketpc.cpp,1.15,1.16
Nicolas Bacca
arisme at users.sourceforge.net
Wed May 1 15:25:49 CEST 2002
Update of /cvsroot/scummvm/scummvm/wince
In directory usw-pr-cvs1:/tmp/cvs-serv21968
Modified Files:
findgame.cpp pocketpc.cpp
Log Message:
Update to new configuration system, fixed right click, fixed landscape mode display bug
Index: findgame.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/wince/findgame.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** findgame.cpp 21 Apr 2002 21:55:48 -0000 1.4
--- findgame.cpp 1 May 2002 22:24:30 -0000 1.5
***************
*** 4,10 ****
--- 4,14 ----
#include "stdafx.h"
+ #include <assert.h>
#include <Winuser.h>
#include <Winnls.h>
#include "resource.h"
+ #include "scumm.h"
+
+ extern Config *scummcfg;
#define MAX_GAMES 20
***************
*** 42,46 ****
{
"Indiana Jones 3 (new)",
! "Buggy, unplayable",
"indy3", "", "",
"indy3",
--- 46,50 ----
{
"Indiana Jones 3 (new)",
! "Buggy, playable a bit",
"indy3", "", "",
"indy3",
***************
*** 49,53 ****
{
"Zak Mc Kracken (new)",
! "Buggy, unplayable",
"zak256", "", "",
"zak256",
--- 53,57 ----
{
"Zak Mc Kracken (new)",
! "Buggy, playable a bit",
"zak256", "", "",
"zak256",
***************
*** 70,74 ****
{
"Loom (VGA)",
! "Completable",
"loomcd", "", "",
"loomcd",
--- 74,78 ----
{
"Loom (VGA)",
! "Completable, MP3 audio",
"loomcd", "", "",
"loomcd",
***************
*** 77,81 ****
{
"Monkey Island 1 (VGA)",
! "Completable, no music",
"", "MONKEY.000", "MONKEY.001",
"monkey",
--- 81,85 ----
{
"Monkey Island 1 (VGA)",
! "Completable, MP3 music",
"", "MONKEY.000", "MONKEY.001",
"monkey",
***************
*** 173,232 ****
bool loadGameSettings() {
- HKEY hkey;
- DWORD disposition;
- DWORD keyType, keySize, dummy;
int index;
int i;
! unsigned char references[MAX_PATH];
prescanning = FALSE;
! if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\PocketSCUMM"),
! 0, NULL, 0, 0, NULL, &hkey, &disposition) == ERROR_SUCCESS) {
! keyType = REG_DWORD;
! keySize = sizeof(DWORD);
! if (RegQueryValueEx(hkey, TEXT("GamesInstalled"), NULL, &keyType,
! (unsigned char*)&dummy, &keySize) == ERROR_SUCCESS)
! index = dummy;
! else
! return FALSE;
! installedGamesNumber = index;
! keyType = REG_BINARY;
! keySize = index;
! if (RegQueryValueEx(hkey, TEXT("GamesReferences"), NULL, &keyType,
! references, &keySize) != ERROR_SUCCESS)
! return FALSE;
! for (i=0; i<index; i++)
! gamesFound[references[i]] = 1;
! keyType = REG_SZ;
! keySize = MAX_PATH;
! if (RegQueryValueEx(hkey, TEXT("BasePath"), NULL, &keyType, (unsigned char*)basePath, &keySize) != ERROR_SUCCESS) {
! basePath[0] = '\0';
! basePath[1] = '\0';
! }
! for (i=0; i<index; i++) {
! char work[100];
! TCHAR keyname[100];
! gamesInstalled[i].reference = references[i];
! keySize = MAX_PATH;
! sprintf(work, "GamesDirectory%d", i);
! MultiByteToWideChar(CP_ACP, 0, work, strlen(work) + 1, keyname, sizeof(keyname));
! if (RegQueryValueEx(hkey, keyname, NULL, &keyType, (unsigned char*)gamesInstalled[i].directory, &keySize) != ERROR_SUCCESS)
! return FALSE;
! }
!
! RegCloseKey(hkey);
! displayFoundGames();
! return TRUE;
! }
! else
! return FALSE;
}
--- 177,225 ----
bool loadGameSettings() {
int index;
int i;
! const char *current;
prescanning = FALSE;
! current = scummcfg->get("GamesInstalled", "wince");
! if (!current)
! return FALSE;
! index = atoi(current);
! installedGamesNumber = index;
! current = scummcfg->get("GamesReferences", "wince");
! if (!current)
! return FALSE;
! for (i=0; i<index; i++) {
! char x[6];
! int j;
! memset(x, 0, sizeof(x));
! memcpy(x, current + 3 * i, 2);
! sscanf(x, "%x", &j);
! gamesFound[j] = 1;
! gamesInstalled[i].reference = j;
! }
! current = scummcfg->get("BasePath", "wince");
! if (!current)
! return FALSE;
! MultiByteToWideChar(CP_ACP, 0, current, strlen(current) + 1, basePath, sizeof(basePath));
! for (i=0; i<index; i++) {
! char keyName[100];
! sprintf(keyName, "GamesDirectory%d", i);
! current = scummcfg->get(keyName, "wince");
! if (!current)
! return FALSE;
! MultiByteToWideChar(CP_ACP, 0, current, strlen(current) + 1, gamesInstalled[i].directory, sizeof(gamesInstalled[i].directory));
! }
! displayFoundGames();
!
! return TRUE;
}
***************
*** 368,374 ****
int i = 0;
int index = 0;
! HKEY hkey;
! DWORD disposition, keyType, keySize, dummy;
! unsigned char references[MAX_GAMES];
prescanning = FALSE;
--- 361,366 ----
int i = 0;
int index = 0;
! char tempo[1024];
! char workdir[MAX_PATH];
prescanning = FALSE;
***************
*** 396,430 ****
SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Saving the results"));
! for (i=0; i<index; i++)
! references[i] = gamesInstalled[i].reference;
! if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\PocketSCUMM"),
! 0, NULL, 0, 0, NULL, &hkey, &disposition) == ERROR_SUCCESS) {
! keyType = REG_DWORD;
! keySize = sizeof(DWORD);
! dummy = index;
! RegSetValueEx(hkey, TEXT("GamesInstalled"), 0, keyType, (unsigned char*)&dummy, keySize);
! keyType = REG_BINARY;
! keySize = index;
! RegSetValueEx(hkey, TEXT("GamesReferences"), 0, keyType, references,
! keySize);
! keyType = REG_SZ;
! keySize = (wcslen(basePath) + 1) * 2;
! RegSetValueEx(hkey, TEXT("BasePath"), 0, keyType, (unsigned char*)basePath, keySize);
! for (i=0; i<index; i++) {
! char work[100];
! TCHAR keyname[100];
! sprintf(work, "GamesDirectory%d", i);
! MultiByteToWideChar(CP_ACP, 0, work, strlen(work) + 1, keyname, sizeof(keyname));
! keySize = (wcslen(gamesInstalled[i].directory) + 1) * 2;
! RegSetValueEx(hkey, keyname, 0, keyType, (unsigned char*)gamesInstalled[i].directory, keySize);
! }
!
! RegCloseKey(hkey);
! }
! SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Scan finished"));
}
--- 388,417 ----
SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Saving the results"));
! scummcfg->set("GamesInstalled", index, "wince");
! tempo[0] = '\0';
! for (i=0; i<index; i++) {
! char x[3];
! sprintf(x, "%.2x ", gamesInstalled[i].reference);
! strcat(tempo, x);
! }
! scummcfg->set("GamesReferences", tempo, "wince");
! WideCharToMultiByte(CP_ACP, 0, basePath, wcslen(basePath) + 1, workdir, sizeof(workdir), NULL, NULL);
! scummcfg->set("BasePath", workdir, "wince");
!
! for (i=0; i<index; i++) {
! char keyName[100];
!
! sprintf(keyName, "GamesDirectory%d", i);
! WideCharToMultiByte(CP_ACP, 0, gamesInstalled[i].directory, wcslen(gamesInstalled[i].directory) + 1, workdir, sizeof(workdir), NULL, NULL);
! scummcfg->set(keyName, workdir, "wince");
! }
!
! scummcfg->flush();
!
! SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Scan finished"));
}
Index: pocketpc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/wince/pocketpc.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** pocketpc.cpp 1 May 2002 00:31:16 -0000 1.15
--- pocketpc.cpp 1 May 2002 22:24:30 -0000 1.16
***************
*** 28,32 ****
#define MAX(a,b) (((a)<(b)) ? (b) : (a))
#define MIN(a,b) (((a)>(b)) ? (b) : (a))
! #define POCKETSCUMM_BUILD "042102"
#define VERSION "Build " POCKETSCUMM_BUILD " (VM " SCUMMVM_CVS ")"
--- 28,32 ----
#define MAX(a,b) (((a)<(b)) ? (b) : (a))
#define MIN(a,b) (((a)>(b)) ? (b) : (a))
! #define POCKETSCUMM_BUILD "050102"
#define VERSION "Build " POCKETSCUMM_BUILD " (VM " SCUMMVM_CVS ")"
***************
*** 45,49 ****
extern void abortScanPath();
! void registry_init();
void keypad_init();
--- 45,49 ----
extern void abortScanPath();
! void load_key_mapping();
void keypad_init();
***************
*** 56,60 ****
extern void abortScanPath();
- void registry_init();
void keypad_init();
--- 56,59 ----
***************
*** 141,147 ****
HMODULE hInst;
HWND hWnd;
! bool _display_cursor;
! bool _simulate_right_up;
!
enum {
--- 140,144 ----
HMODULE hInst;
HWND hWnd;
! bool _display_cursor;
enum {
***************
*** 357,360 ****
--- 354,359 ----
hide_toolbar = false;
+ scummcfg = new Config("scummvm.ini", "scummvm");
+
argv[0] = NULL;
argv[1] = GameSelector();
***************
*** 365,370 ****
return 0;
- scummcfg = new Config("scummvm.ini", "scummvm");
-
if (detector.detectMain(argc, argv))
return (-1);
--- 364,367 ----
***************
*** 387,392 ****
g_scumm = scumm;
keypad_init();
! registry_init();
hide_cursor = TRUE;
--- 384,393 ----
g_scumm = scumm;
+ g_scumm->_sound_volume_master = 0;
+ g_scumm->_sound_volume_music = detector._music_volume;
+ g_scumm->_sound_volume_sfx = detector._sfx_volume;
+
keypad_init();
! load_key_mapping();
hide_cursor = TRUE;
***************
*** 428,439 ****
case WM_ERASEBKGND:
{
RECT rc;
HDC hDC;
! GetClientRect(hWnd, &rc);
! rc.top = 200;
! hDC = GetDC(hWnd);
! if(rc.top < rc.bottom)
! FillRect(hDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
! ReleaseDC(hWnd, hDC);
}
return 1;
--- 429,443 ----
case WM_ERASEBKGND:
{
+
RECT rc;
HDC hDC;
! if (!GetScreenMode()) {
! GetClientRect(hWnd, &rc);
! rc.top = 200;
! hDC = GetDC(hWnd);
! if(rc.top < rc.bottom)
! FillRect(hDC, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
! ReleaseDC(hWnd, hDC);
! }
}
return 1;
***************
*** 466,469 ****
--- 470,485 ----
toolbar_drawn = false;
// SHHandleWMActivate(hWnd, wParam, lParam, &sai, SHA_INPUTDIALOG);
+ if (LOWORD(wParam) == WA_ACTIVE) {
+ if (GetScreenMode()) {
+ SHSipPreference(hWnd, SIP_FORCEDOWN);
+ SHFullScreen(hWnd, SHFS_HIDETASKBAR);
+ MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
+ SetCapture(hWnd);
+ }
+ else {
+ SHFullScreen(hWnd, SHFS_SHOWTASKBAR);
+ MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN), TRUE);
+ }
+ }
return 0;
***************
*** 519,528 ****
case IDC_LANDSCAPE:
! SHFullScreen (hWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
! InvalidateRect(HWND_DESKTOP, NULL, TRUE);
SetScreenMode(!GetScreenMode());
//SHSipPreference(hWnd,SIP_FORCEDOWN);
MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
! SetCapture(hWnd); // to prevent input panel from getting taps
if (!hide_toolbar)
toolbar_drawn = false;
--- 535,548 ----
case IDC_LANDSCAPE:
! //SHFullScreen (hWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
! //InvalidateRect(HWND_DESKTOP, NULL, TRUE);
SetScreenMode(!GetScreenMode());
//SHSipPreference(hWnd,SIP_FORCEDOWN);
+ //MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
+ //SetCapture(hWnd); // to prevent input panel from getting taps
+ SHSipPreference(hWnd, SIP_FORCEDOWN);
+ SHFullScreen(hWnd, SHFS_HIDETASKBAR);
MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE);
! SetCapture(hWnd);
if (!hide_toolbar)
toolbar_drawn = false;
***************
*** 555,564 ****
case WM_KEYUP:
- if (wParam) {
- if (wm->_simulate_right_up) {
- wm->_event.event_code = EVENT_RBUTTONUP;
- wm->_simulate_right_up = false;
- }
- }
break;
--- 575,578 ----
***************
*** 634,641 ****
else
{
SetScreenMode(0); // restore normal tap logic
! SHSipPreference(hWnd,SIP_UP);
ReleaseCapture();
! InvalidateRect(HWND_DESKTOP, NULL, TRUE);
}
}
--- 648,664 ----
else
{
+ HDC hDC;
+ PAINTSTRUCT ps;
+
SetScreenMode(0); // restore normal tap logic
! //SHSipPreference(hWnd,SIP_UP);
ReleaseCapture();
! //InvalidateRect(HWND_DESKTOP, NULL, TRUE);
! SHFullScreen(hWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
! MoveWindow(hWnd, 0, 0, GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN), TRUE);
! SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
! SetForegroundWindow(hWnd);
! hDC = BeginPaint (hWnd, &ps);
! EndPaint (hWnd, &ps);
}
}
***************
*** 695,773 ****
}
! /*************** Registry support ***********/
! void registry_init() {
! HKEY hkey;
! DWORD disposition;
! DWORD keyType, keySize, dummy;
unsigned char actions[NUMBER_ACTIONS];
memset(actions, 0, NUMBER_ACTIONS);
! if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\PocketSCUMM"),
! 0, NULL, 0, 0, NULL, &hkey, &disposition) == ERROR_SUCCESS) {
! keyType = REG_DWORD;
! keySize = sizeof(DWORD);
! if (RegQueryValueEx(hkey, TEXT("VolumeMaster"), NULL, &keyType,
! (unsigned char*)&dummy, &keySize) == ERROR_SUCCESS)
! g_scumm->_sound_volume_master = (uint16)dummy;
! else
! g_scumm->_sound_volume_master = 100;
!
! if (RegQueryValueEx(hkey, TEXT("VolumeMusic"), NULL, &keyType,
! (unsigned char*)&dummy, &keySize) == ERROR_SUCCESS)
! g_scumm->_sound_volume_music = (uint16)dummy;
! else
! g_scumm->_sound_volume_music = 60;
! if (RegQueryValueEx(hkey, TEXT("VolumeSfx"), NULL, &keyType,
! (unsigned char*)&dummy, &keySize) == ERROR_SUCCESS)
! g_scumm->_sound_volume_sfx = (uint16)dummy;
! else
! g_scumm->_sound_volume_sfx = 100;
! keyType = REG_BINARY;
! keySize = NUMBER_ACTIONS;
! memset(actions, 0, sizeof(actions));
! RegQueryValueEx(hkey, TEXT("ActionsKeys"), NULL, &keyType,
! actions, &keySize);
! setActionKeys(actions);
! actions[0] = ACTION_PAUSE;
! actions[1] = ACTION_SAVE;
! actions[2] = ACTION_QUIT;
! actions[3] = ACTION_SKIP;
! actions[4] = ACTION_HIDE;
! RegQueryValueEx(hkey, TEXT("ActionsTypes"), NULL, &keyType,
! actions, &keySize);
! setActionTypes(actions);
! RegCloseKey(hkey);
}
}
! void registry_save() {
! HKEY hkey;
! DWORD disposition;
! DWORD keyType, keySize, dummy;
!
! if(RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\PocketSCUMM"),
! 0, NULL, 0, 0, NULL, &hkey, &disposition) == ERROR_SUCCESS) {
!
! keyType = REG_DWORD;
! keySize = sizeof(DWORD);
! dummy = g_scumm->_sound_volume_master;
! RegSetValueEx(hkey, TEXT("VolumeMaster"), 0, keyType, (unsigned char*)&dummy, keySize);
! dummy = g_scumm->_sound_volume_music;
! RegSetValueEx(hkey, TEXT("VolumeMusic"), 0, keyType, (unsigned char*)&dummy, keySize);
! dummy = g_scumm->_sound_volume_sfx;
! RegSetValueEx(hkey, TEXT("VolumeSfx"), 0, keyType, (unsigned char*)&dummy, keySize);
! keyType = REG_BINARY;
! keySize = NUMBER_ACTIONS;
! RegSetValueEx(hkey, TEXT("ActionsKeys"), 0, keyType, getActionKeys(),
! keySize);
! RegSetValueEx(hkey, TEXT("ActionsTypes"), 0, keyType, getActionTypes(),
! keySize);
! RegCloseKey(hkey);
}
}
--- 718,790 ----
}
! /*************** Specific config support ***********/
! void load_key_mapping() {
unsigned char actions[NUMBER_ACTIONS];
+ const char *current;
+ int i;
memset(actions, 0, NUMBER_ACTIONS);
! current = scummcfg->get("ActionKeys", "wince");
! if (current) {
! for (i=0; i<NUMBER_ACTIONS; i++) {
! char x[6];
! int j;
! memset(x, 0, sizeof(x));
! memcpy(x, current + 3 * i, 2);
! sscanf(x, "%x", &j);
! actions[i] = j;
! }
! }
! setActionKeys(actions);
! memset(actions, 0, NUMBER_ACTIONS);
!
! actions[0] = ACTION_PAUSE;
! actions[1] = ACTION_SAVE;
! actions[2] = ACTION_QUIT;
! actions[3] = ACTION_SKIP;
! actions[4] = ACTION_HIDE;
!
! current = scummcfg->get("ActionTypes", "wince");
! if (current) {
! for (i=0; i<NUMBER_ACTIONS; i++) {
! char x[6];
! int j;
!
! memset(x, 0, sizeof(x));
! memcpy(x, current + 3 * i, 2);
! sscanf(x, "%x", &j);
! actions[i] = j;
! }
}
+ setActionTypes(actions);
}
! void save_key_mapping() {
! char tempo[1024];
! const unsigned char *work;
! int i;
! tempo[0] = '\0';
! work = getActionKeys();
! for (i=0; i<NUMBER_ACTIONS; i++) {
! char x[4];
! sprintf(x, "%.2x ", work[i]);
! strcat(tempo, x);
}
+ scummcfg->set("ActionKeys", tempo, "wince");
+ tempo[0] = '\0';
+ work = getActionTypes();
+ for (i=0; i<NUMBER_ACTIONS; i++) {
+ char x[3];
+ sprintf(x, "%.2x ", work[i]);
+ strcat(tempo, x);
+ }
+ scummcfg->set("ActionTypes", tempo, "wince");
+
+ scummcfg->flush();
}
***************
*** 780,786 ****
void OSystem_WINCE3::addEventRightButtonClicked() {
! _last_mouse_event.event_code = EVENT_RBUTTONDOWN;
! _event = _last_mouse_event;
! _simulate_right_up = true;
}
--- 797,804 ----
void OSystem_WINCE3::addEventRightButtonClicked() {
! OSystem_WINCE3* system;
! system = (OSystem_WINCE3*)g_scumm->_system;
!
! system->addEventKeyPressed(9);
}
More information about the Scummvm-git-logs
mailing list