pass the right param to WinMain. This makes it work on ce!

This commit is contained in:
ehouse 2006-01-31 06:41:16 +00:00
parent 6266de224e
commit 3ef2bf9c8e

View file

@ -139,7 +139,7 @@ static XP_Bool ceMsgFromStream( CEAppGlobals* globals, XWStreamCtxt* stream,
wchar_t* title, XP_Bool isQuery, wchar_t* title, XP_Bool isQuery,
XP_Bool destroy ); XP_Bool destroy );
static void RECTtoXPR( XP_Rect* dest, RECT* src ); static void RECTtoXPR( XP_Rect* dest, RECT* src );
static XP_Bool doNewGame( CEAppGlobals* globals, XP_Bool silent ); static XP_Bool ceDoNewGame( CEAppGlobals* globals, XP_Bool silent );
static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave ); static XP_Bool ceSaveCurGame( CEAppGlobals* globals, XP_Bool autoSave );
static void updateForColors( CEAppGlobals* globals ); static void updateForColors( CEAppGlobals* globals );
static XWStreamCtxt* make_generic_stream( CEAppGlobals* globals ); static XWStreamCtxt* make_generic_stream( CEAppGlobals* globals );
@ -189,7 +189,8 @@ WinMain( HINSTANCE hInstance,
int int
main() main()
{ {
XP_LOGF( "main called" ); XP_LOGF( "" );
LOG_FUNC();
return WinMain( GetModuleHandle(NULL), 0, return WinMain( GetModuleHandle(NULL), 0,
#if defined TARGET_OS_WINCE #if defined TARGET_OS_WINCE
@ -197,7 +198,7 @@ main()
#elif defined TARGET_OS_WIN32 #elif defined TARGET_OS_WIN32
GetCommandLineA(), GetCommandLineA(),
#endif #endif
0 ); SW_SHOWDEFAULT );
} }
#endif #endif
@ -617,7 +618,7 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp,
#ifdef DEBUG #ifdef DEBUG
void void
logLastError( XP_UCHAR* comment ) logLastError( const char* comment )
{ {
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
DWORD lastErr = GetLastError(); DWORD lastErr = GetLastError();
@ -743,8 +744,6 @@ fileToStream( CEAppGlobals* globals, XP_UCHAR* path )
wchar_t widebuf[257]; wchar_t widebuf[257];
XP_U16 len; XP_U16 len;
XP_DEBUGF( "fileToStream" );
len = (XP_U16)XP_STRLEN( path ); len = (XP_U16)XP_STRLEN( path );
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, path, len + 1, MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, path, len + 1,
widebuf, len + 1 ); widebuf, len + 1 );
@ -995,7 +994,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
&globals->appPrefs.cp, &globals->appPrefs.cp,
CE_SEND_PROC, globals ); CE_SEND_PROC, globals );
newDone = doNewGame( globals, XP_TRUE ); /* calls ceInitAndStartBoard */ newDone = ceDoNewGame( globals, XP_TRUE ); /* calls ceInitAndStartBoard */
if ( !newDone ) { if ( !newDone ) {
result = FALSE; result = FALSE;
} }
@ -1108,7 +1107,7 @@ drawInsidePaint( HWND hWnd, CEAppGlobals* globals )
hdc = GetDC( hWnd ); hdc = GetDC( hWnd );
if ( !hdc ) { if ( !hdc ) {
logLastError( "drawInsidePaint" ); logLastError( __FUNCTION__ );
} else { } else {
HDC prevHDC = globals->hdc; HDC prevHDC = globals->hdc;
globals->hdc = hdc; globals->hdc = hdc;
@ -1133,7 +1132,7 @@ ceDisplayFinalScores( CEAppGlobals* globals )
} /* ceDisplayFinalScores */ } /* ceDisplayFinalScores */
static XP_Bool static XP_Bool
doNewGame( CEAppGlobals* globals, XP_Bool silent ) ceDoNewGame( CEAppGlobals* globals, XP_Bool silent )
{ {
GameInfoState giState; GameInfoState giState;
CommsAddrRec* addr = NULL; CommsAddrRec* addr = NULL;
@ -1177,7 +1176,7 @@ doNewGame( CEAppGlobals* globals, XP_Bool silent )
} }
return changed; return changed;
} /* doNewGame */ } /* ceDoNewGame */
static void static void
ceChooseAndOpen( CEAppGlobals* globals ) ceChooseAndOpen( CEAppGlobals* globals )
@ -1620,7 +1619,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (wmId) { switch (wmId) {
case ID_FILE_ABOUT: case ID_FILE_ABOUT:
DH(DialogBoxParam)(globals->hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, DH(DialogBoxParam)(globals->hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd,
(DLGPROC)About, NULL ); (DLGPROC)About, 0L );
break; break;
case ID_GAME_GAMEINFO: { case ID_GAME_GAMEINFO: {
GameInfoState state; GameInfoState state;
@ -1646,7 +1645,7 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if ( ceSaveCurGame( globals, XP_FALSE ) if ( ceSaveCurGame( globals, XP_FALSE )
|| queryBoxChar( globals, "Do you really want to " || queryBoxChar( globals, "Do you really want to "
"overwrite the current game?" ) ) { "overwrite the current game?" ) ) {
draw = doNewGame( globals, XP_FALSE ); draw = ceDoNewGame( globals, XP_FALSE );
} }
break; break;
@ -2040,10 +2039,10 @@ wince_debugf(XP_UCHAR* format, ...)
strcat( buf, XP_CR ); strcat( buf, XP_CR );
#endif #endif
SetFilePointer( fileH, 0, 0, FILE_END ); SetFilePointer( fileH, 0, 0, FILE_END );
#ifdef DEBUG_TS
nBytes = strlen( timeStamp ); nBytes = strlen( timeStamp );
WriteFile( fileH, timeStamp, nBytes, &nWritten, NULL ); WriteFile( fileH, timeStamp, nBytes, &nWritten, NULL );
#endif
nBytes = strlen( buf ); nBytes = strlen( buf );
WriteFile( fileH, buf, nBytes, &nWritten, NULL ); WriteFile( fileH, buf, nBytes, &nWritten, NULL );
CloseHandle( fileH ); CloseHandle( fileH );