diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index 7df52321c..9fb9b70fc 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -41,6 +41,9 @@ #include "Campaign Types.h" #endif +#include "VFS/vfs.h" +#include "VFS/vfs_file_raii.h" + extern BOOLEAN gfOverheadMapDirty; #define MAP_SIZE 208 @@ -1883,14 +1886,16 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent ) void CreateGlobalSummary() { +#ifndef USE_VFS FILE *fp; STRING512 Dir; STRING512 ExecDir; - +#endif OutputDebugString( "Generating GlobalSummary Information...\n" ); gfGlobalSummaryExists = FALSE; //Set current directory to JA2\DevInfo which contains all of the summary data +#ifndef USE_VFS GetExecutableDirectory( ExecDir ); sprintf( Dir, "%s\\DevInfo", ExecDir ); @@ -1902,12 +1907,20 @@ void CreateGlobalSummary() AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." ); if( !SetFileManCurrentDirectory( Dir ) ) AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." ); + //Generate a simple readme file. fp = fopen( "readme.txt", "w" ); Assert( fp ); fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.", "This directory or it's contents shouldn't be included with final release." ); fclose( fp ); +#else + vfs::COpenWriteFile wfile(L"DevInfo\\readme.txt",true,true); + std::string str = "This information is used in conjunction with the editor.\n"; + str += "This directory or it's contents shouldn't be included with final release.\n"; + vfs::UInt32 io; + wfile.file().Write(str.c_str(), str.length(), io); +#endif // Snap: Restore the data directory once we are finished. //SetFileManCurrentDirectory( DataDir ); @@ -2225,10 +2238,12 @@ void CalculateOverrideStatus() void LoadGlobalSummary() { HWFILE hfile; +#ifndef USE_VFS STRING512 DataDir; STRING512 ExecDir; STRING512 DevInfoDir; STRING512 MapsDir; +#endif UINT32 uiNumBytesRead; FLOAT dMajorVersion; INT32 x,y; @@ -2236,28 +2251,35 @@ void LoadGlobalSummary() CHAR8 szSector[6]; OutputDebugString( "Executing LoadGlobalSummary()...\n" ); - // Snap: save current directory +#ifndef USE_VFS GetFileManCurrentDirectory( DataDir ); - +#endif gfMustForceUpdateAllMaps = FALSE; gusNumberOfMapsToBeForceUpdated = 0; gfGlobalSummaryExists = FALSE; + //Set current directory to JA2\DevInfo which contains all of the summary data +#ifndef USE_VFS GetExecutableDirectory( ExecDir ); sprintf( DevInfoDir, "%s\\DevInfo", ExecDir ); sprintf( MapsDir, "%s\\Maps", DataDir ); - //Check to make sure we have a DevInfo directory. If we don't create one! if( !SetFileManCurrentDirectory( DevInfoDir ) ) { OutputDebugString( "LoadGlobalSummary() aborted -- doesn't exist on this local computer.\n"); return; } - +#endif //TEMP +#ifndef USE_VFS FileDelete( "_global.sum" ); - +#else + if(FileExists("DevInfo\\_global.sum")) + { + FileDelete( "DevInfo\\_global.sum" ); + } +#endif gfGlobalSummaryExists = TRUE; //Analyse all sectors to see if matching maps exist. For any maps found, the information @@ -2272,10 +2294,15 @@ void LoadGlobalSummary() sprintf( szSector, "%c%d", 'A' + y, x + 1 ); //main ground level +#ifndef USE_VFS sprintf( szFilename, "%c%d.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= GROUND_LEVEL_MASK; @@ -2285,14 +2312,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s.sum", szSector ); +#endif FileDelete( szFilename ); } //main B1 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b1.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b1.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK; @@ -2302,14 +2338,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b1.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b1.sum", szSector ); +#endif FileDelete( szFilename ); } //main B2 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b2.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b2.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK; @@ -2319,14 +2364,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b2.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b2.sum", szSector ); +#endif FileDelete( szFilename ); } //main B3 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b3.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b3.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK; @@ -2336,14 +2390,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b3.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b3.sum", szSector ); +#endif FileDelete( szFilename ); } //alternate ground level +#ifndef USE_VFS sprintf( szFilename, "%c%d_a.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_a.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK; @@ -2353,14 +2416,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_a.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_a.sum", szSector ); +#endif FileDelete( szFilename ); } //alternate B1 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b1_a.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b1_a.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= ALTERNATE_B1_MASK; @@ -2370,14 +2442,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b1_a.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b1_a.sum", szSector ); +#endif FileDelete( szFilename ); } //alternate B2 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b2_a.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b2_a.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= ALTERNATE_B2_MASK; @@ -2387,14 +2468,23 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b2_a.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b2_a.sum", szSector ); +#endif FileDelete( szFilename ); } //alternate B3 level +#ifndef USE_VFS sprintf( szFilename, "%c%d_b3_a.dat", 'A' + y, x + 1 ); SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); SetFileManCurrentDirectory( DevInfoDir ); +#else + sprintf( szFilename, "Maps\\%c%d_b3_a.dat", 'A' + y, x + 1 ); + hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;; @@ -2404,16 +2494,20 @@ void LoadGlobalSummary() } else { +#ifndef USE_VFS sprintf( szFilename, "%s_b3_a.sum", szSector ); +#else + sprintf( szFilename, "DevInfo\\%s_b3_a.sum", szSector ); +#endif FileDelete( szFilename ); } } OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') ); } - +#ifndef USE_VFS // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); - +#endif //sprintf( MapsDir, "%s\\Data", ExecDir ); //SetFileManCurrentDirectory( MapsDir ); @@ -2430,6 +2524,7 @@ void LoadGlobalSummary() void GenerateSummaryList() { +#ifndef USE_VFS FILE *fp; STRING512 DataDir; STRING512 ExecDir; @@ -2455,24 +2550,39 @@ void GenerateSummaryList() "This directory or it's contents shouldn't be included with final release." ); fclose( fp ); } - // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); //Set current directory back to data directory! //sprintf( Dir, "%s\\Data", ExecDir ); //SetFileManCurrentDirectory( Dir ); +#else + try + { + vfs::COpenWriteFile wfile(L"DevInfo/readme.txt",true,true); + std::string str = "This information is used in conjunction with the editor.\n"; + str += "This directory or it's contents shouldn't be included with final release.\n"; + vfs::UInt32 io; + wfile.file().Write(str.c_str(), str.length(),io); + } + catch(CBasicException &ex) + { + RETHROWEXCEPTION(L"Could not create readme.txt",&ex); + } +#endif } void WriteSectorSummaryUpdate( STR8 puiFilename, UINT8 ubLevel, SUMMARYFILE *pSummaryFileInfo ) { +#ifndef USE_VFS FILE *fp; STRING512 DataDir; STRING512 ExecDir; STRING512 Dir; CHAR8 *ptr; +#endif INT8 x, y; - +#ifndef USE_VFS // Snap: save current directory GetFileManCurrentDirectory( DataDir ); @@ -2498,6 +2608,14 @@ void WriteSectorSummaryUpdate( STR8 puiFilename, UINT8 ubLevel, SUMMARYFILE *pSu Assert( fp ); fwrite( pSummaryFileInfo, 1, sizeof( SUMMARYFILE ), fp ); fclose( fp ); +#else + vfs::Path fname(puiFilename); + THROWIFFALSE(MatchPattern(L"*.dat", fname()), L"Illegal sector summary filename"); + vfs::COpenWriteFile wfile(vfs::Path(L"DevInfo")+vfs::Path(puiFilename),true,true); + vfs::UInt32 io; + wfile.file().Write((vfs::Byte*)pSummaryFileInfo,sizeof(SUMMARYFILE), io); + wfile.file().Close(); +#endif //CHRISL: if(gusNumEntriesWithOutdatedOrNoSummaryInfo > 0) @@ -2520,12 +2638,13 @@ void WriteSectorSummaryUpdate( STR8 puiFilename, UINT8 ubLevel, SUMMARYFILE *pSu gpSectorSummary[x][y][ubLevel] = NULL; } gpSectorSummary[x][y][ubLevel] = pSummaryFileInfo; - +#ifndef USE_VFS // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); //Set current directory back to data directory! //sprintf( Dir, "%s\\Data", ExecDir ); //SetFileManCurrentDirectory( Dir ); +#endif } void SummaryNewGroundLevelCallback( GUI_BUTTON *btn, INT32 reason ) @@ -2566,8 +2685,12 @@ void LoadSummary( STR8 pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ) CHAR8 filename[40]; SUMMARYFILE temp; INT32 x, y; +#ifndef USE_VFS FILE *fp; sprintf( filename, pSector ); +#else + sprintf( filename, "DevInfo\\%s", pSector ); +#endif if( ubLevel % 4 ) { CHAR8 str[4]; @@ -2579,7 +2702,7 @@ void LoadSummary( STR8 pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ) strcat( filename, "_a" ); } strcat( filename, ".sum" ); - +#ifndef USE_VFS fp = fopen( filename, "rb" ); if( !fp ) { @@ -2598,6 +2721,15 @@ void LoadSummary( STR8 pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ) return; } fread( &temp, 1, sizeof( SUMMARYFILE ), fp ); +#else + if(!GetVFS()->FileExists(filename)) + { + return; + } + vfs::COpenReadFile rfile(filename); + vfs::UInt32 io; + rfile.file().Read((vfs::Byte*)&temp,sizeof(SUMMARYFILE),io); +#endif //CHRISL: Again, this basically forces the maps to be updated whether we actually access the map or not. Why don't we just // update the map when the map actually needs to be loaded? /* if( temp.ubSummaryVersion < MINIMUMVERSION || dMajorMapVersion < gdMajorMapVersion ) @@ -2624,8 +2756,9 @@ void LoadSummary( STR8 pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ) memcpy( gpSectorSummary[x][y][ubLevel], &temp, sizeof( SUMMARYFILE ) ); if( gpSectorSummary[x][y][ubLevel]->ubSummaryVersion < GLOBAL_SUMMARY_VERSION ) gusNumEntriesWithOutdatedOrNoSummaryInfo++; - +#ifndef USE_VFS fclose( fp ); +#endif } @@ -2800,7 +2933,9 @@ void ExtractTempFilename() BOOLEAN ReEvaluateWorld( const STR8 puiFilename ) { +#ifndef USE_VFS STRING512 DataDir; +#endif STRING512 MapsDir; FLOAT dMajorVersion; UINT8 dMinorVersion; @@ -2808,9 +2943,10 @@ BOOLEAN ReEvaluateWorld( const STR8 puiFilename ) CHAR8 name[50]; HWFILE hfile; UINT32 uiNumBytesRead; - +#ifndef USE_VFS GetFileManCurrentDirectory( DataDir ); sprintf( MapsDir, "%s\\Maps", DataDir ); +#endif if( gbSectorLevels[gsSelSectorX-1][gsSelSectorY-1] & GROUND_LEVEL_MASK ) ubLevel = 0; @@ -2828,16 +2964,22 @@ BOOLEAN ReEvaluateWorld( const STR8 puiFilename ) ubLevel = 6; else if( gbSectorLevels[gsSelSectorX-1][gsSelSectorY-1] & ALTERNATE_B3_MASK ) ubLevel = 7; - +#ifndef USE_VFS SetFileManCurrentDirectory( MapsDir ); hfile = FileOpen( puiFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#else + sprintf( MapsDir, "Maps\\%s", puiFilename ); + hfile = FileOpen( MapsDir, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); +#endif if( hfile ) { FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); FileRead( hfile, &dMinorVersion, sizeof( UINT8 ), &uiNumBytesRead ); FileClose( hfile ); } +#ifndef USE_VFS SetFileManCurrentDirectory( DataDir ); +#endif if(dMajorVersion < gdMajorMapVersion || dMinorVersion < gubMinorMapVersion) gfMajorUpdate = TRUE; diff --git a/GameVersion.cpp b/GameVersion.cpp index 4edc067be..c34b572e1 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,12 +13,12 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2975" }; +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2993" }; #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.2975" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.2993" }; #elif defined CRIPPLED_VERSION @@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.2975" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.2963" }; #endif -CHAR8 czVersionNumber[16] = { "Build 09.06.06" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 09.06.09" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 84a53abcd..542ae352b 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -32,6 +32,8 @@ #include "LaptopSave.h" #endif +#include "VFS/Tools/ParserTools.h" + #define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 #define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 #define MALE_BOX_X 2 + 192 + LAPTOP_SCREEN_UL_X @@ -455,39 +457,38 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void ) // handle input events while( DequeueEvent(&InputEvent) ) { - /* +/* // HOOK INTO MOUSE HOOKS - switch(InputEvent.usEvent) + switch(InputEvent.usEvent) { - case LEFT_BUTTON_DOWN: MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; + break; case LEFT_BUTTON_UP: MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); - break; + break; case RIGHT_BUTTON_DOWN: MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; + break; case RIGHT_BUTTON_UP: MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); - break; + break; } - */ - if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) +*/ + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) { - switch( InputEvent.usParam ) + switch( InputEvent.usParam ) { case (( ENTER )): - // check to see if gender was highlighted..if so, select it - if( FEMALE_GENDER_SELECT == ubTextEnterMode ) - { + // check to see if gender was highlighted..if so, select it + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + { bGenderFlag = IMP_FEMALE; - } + } else if( MALE_GENDER_SELECT == ubTextEnterMode ) - { + { bGenderFlag = IMP_MALE; - } + } // increment to next selection box IncrementTextEnterMode( ); @@ -497,12 +498,12 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void ) // handle space bar if( FEMALE_GENDER_SELECT == ubTextEnterMode ) { - bGenderFlag = IMP_FEMALE; + bGenderFlag = IMP_FEMALE; DecrementTextEnterMode( ); } - else if( MALE_GENDER_SELECT == ubTextEnterMode ) + else if( MALE_GENDER_SELECT == ubTextEnterMode ) { - bGenderFlag = IMP_MALE; + bGenderFlag = IMP_MALE; IncrementTextEnterMode( ); } else @@ -511,22 +512,22 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void ) } fNewCharInString = TRUE; break; - case (( ESC )): - HandleLapTopESCKey(); // WANNE: Fix for proper closing of the IMP laptop page - LeaveLapTopScreen( ); + case (( ESC )): + HandleLapTopESCKey(); // WANNE: Fix for proper closing of the IMP laptop page + LeaveLapTopScreen( ); break; - case (( TAB )): - // tab hit, increment to next selection box - IncrementTextEnterMode( ); - fNewCharInString = TRUE; + case (( TAB )): + // tab hit, increment to next selection box + IncrementTextEnterMode( ); + fNewCharInString = TRUE; break; - case ( 265 ): + case ( 265 ): // tab and shift - DecrementTextEnterMode( ); - fNewCharInString = TRUE; + DecrementTextEnterMode( ); + fNewCharInString = TRUE; break; - default: - HandleBeginScreenTextEvent( InputEvent.usParam ); + default: + HandleBeginScreenTextEvent( InputEvent.usParam ); break; } } @@ -544,59 +545,48 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) { case ( BACKSPACE ): - switch( ubTextEnterMode ) + switch( ubTextEnterMode ) + { + case( FULL_NAME_MODE ): + if( uiFullNameCharacterPosition >= 0 ) { - case( FULL_NAME_MODE ): - if( uiFullNameCharacterPosition >= 0 ) - { - - - // decrement StringPosition - if( uiFullNameCharacterPosition > 0) - { - uiFullNameCharacterPosition-=1; - } - - - - - // null out char - pFullNameString[uiFullNameCharacterPosition] = 0; + // decrement StringPosition + if( uiFullNameCharacterPosition > 0) + { + uiFullNameCharacterPosition-=1; + } + // null out char + pFullNameString[uiFullNameCharacterPosition] = 0; // move cursor back by sizeof char - uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - // string has been altered, redisplay - fNewCharInString = TRUE; - } - break; - case ( NICK_NAME_MODE ): - if( uiNickNameCharacterPosition >= 0 ) - { - - - // decrement StringPosition - if( uiNickNameCharacterPosition > 0 ) + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= 0 ) + { + // decrement StringPosition + if( uiNickNameCharacterPosition > 0 ) uiNickNameCharacterPosition-=1; - // null out char - pNickNameString[uiNickNameCharacterPosition] = 0; + // null out char + pNickNameString[uiNickNameCharacterPosition] = 0; // move cursor back by sizeof char - uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); - // string has been altered, redisplay - fNewCharInString = TRUE; - } - - break; + // string has been altered, redisplay + fNewCharInString = TRUE; } + break; + } break; - default: - -//Heinz (18.01.2009): Russian layout -// + //Heinz (18.01.2009): Russian layout + // #if defined(RUSSIAN) if( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x419) { @@ -609,91 +599,88 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) uiKey == '_' || uiKey == '.' || uiKey == ' ') ) uiKey = '#'; if(uiKey != '#') #else + #ifndef USE_CODE_PAGE if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' ) + #else + if( charSet::IsFromSet( uiKey, charSet::CS_SPACE|charSet::CS_ALPHA_NUM|charSet::CS_SPECIAL_ALPHA ) ) + #endif #endif - - { - // if the current string position is at max or great, do nothing + { + // if the current string position is at max or great, do nothing switch( ubTextEnterMode ) - { - case( FULL_NAME_MODE ): - if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) - { - break; - } - else - { - - if(uiFullNameCharacterPosition < 1 ) - { - uiFullNameCharacterPosition = 0; - } - // make sure we haven't moved too far - if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) - { - // do nothing for now, when pop up is in place, display - break; - } - // valid char, capture and convert to CHAR16 - pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; - - - // null out next char position - pFullNameString[uiFullNameCharacterPosition + 1] = 0; - - // move cursor position ahead - uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); - - // increment string position - uiFullNameCharacterPosition +=1; - - // string has been altered, redisplay - fNewCharInString = TRUE; - } + { + case( FULL_NAME_MODE ): + if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) + { break; - case ( NICK_NAME_MODE ): - if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) - { - break; - } - else - { - - if(uiNickNameCharacterPosition == -1) - { - uiNickNameCharacterPosition = 0; - } - - // make sure we haven't moved too far - if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) - { - // do nothing for now, when pop up is in place, display - break; - } - - // valid char, capture and convert to CHAR16 - pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; - - // null out next char position - pNickNameString[uiNickNameCharacterPosition + 1] = 0; - - // move cursor position ahead - uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); - - // increment string position - uiNickNameCharacterPosition +=1; - - // string has been altered, redisplay - fNewCharInString = TRUE; - } - - break; + } + else + { + if(uiFullNameCharacterPosition < 1 ) + { + uiFullNameCharacterPosition = 0; } + // make sure we haven't moved too far + if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) + { + // do nothing for now, when pop up is in place, display + break; + } + // valid char, capture and convert to CHAR16 + pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; + + // null out next char position + pFullNameString[uiFullNameCharacterPosition + 1] = 0; + + // move cursor position ahead + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + + // increment string position + uiFullNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) + { + break; + } + else + { + if(uiNickNameCharacterPosition == -1) + { + uiNickNameCharacterPosition = 0; + } + // make sure we haven't moved too far + if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) + { + // do nothing for now, when pop up is in place, display + break; + } + // valid char, capture and convert to CHAR16 + pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; + + // null out next char position + pNickNameString[uiNickNameCharacterPosition + 1] = 0; + + // move cursor position ahead + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + + // increment string position + uiNickNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; } + } break; } return; diff --git a/MPHostScreen.cpp b/MPHostScreen.cpp index 077e4735d..1b23c1f72 100644 --- a/MPHostScreen.cpp +++ b/MPHostScreen.cpp @@ -660,7 +660,7 @@ UINT32 MPHostScreenInit( void ) GetPrivateProfileStringW( L"Ja2_mp Settings",L"DAMAGE_MULTIPLIER", L"0.7", gzDmgMultiplierField, 5 , L"..\\Ja2_mp.ini" ); GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIMED_TURN_SECS_PER_TICK", L"25", gzTimerField, 5 , L"..\\Ja2_mp.ini" ); GetPrivateProfileStringW( L"Ja2_mp Settings",L"FILE_TRANSFER_DIRECTORY", L"MULTIPLAYER/Servers/My Server", gzFileTransferDirectory, 100, L"..\\Ja2_mp.ini" ); - GetStringProperty( L"Ja2_mp Settings", L"KIT_BAG", L"[201,214,243]", kbag, 100, L"..\\Ja2_mp.ini" ); + GetPrivateProfileStringW( L"Ja2_mp Settings",L"KIT_BAG", L"[201,214,243]", gzKitBag, 100, L"..\\Ja2_mp.ini" ); GetPrivateProfileStringW( L"Ja2_mp Settings",L"TIME", L"13.50", &szTime[0], 5 , L"..\\Ja2_mp.ini" ); giMPHOverrideMaxAI = GetPrivateProfileIntW( L"Ja2_mp Settings",L"OVERRIDE_MAX_AI", 0, L"..\\Ja2_mp.ini" ); @@ -673,7 +673,7 @@ UINT32 MPHostScreenInit( void ) giMPHUseNIV = GetPrivateProfileIntW( L"Ja2_mp Settings",L"ALLOW_CUSTOM_NIV", 0, L"..\\Ja2_mp.ini" ); giMPHSendFiles = GetPrivateProfileIntW( L"Ja2_mp Settings",L"SYNC_CLIENTS_MP_DIR", 1, L"..\\Ja2_mp.ini" ); guiMPHGameType = GetPrivateProfileIntW( L"Ja2_mp Settings",L"GAME_MODE", MP_TYPE_DEATHMATCH, L"..\\Ja2_mp.ini" ); - giMPHDifficultLevel = GetPrivateProfileIntW( L"Ja2_mp Settings",L"DIFFICULT_LEVEL", 2, L"..\\Ja2_mp.ini" ); + guiMPHDifficultLevel = GetPrivateProfileIntW( L"Ja2_mp Settings",L"DIFFICULT_LEVEL", 2, L"..\\Ja2_mp.ini" ); #else // read settings from JA2_mp.ini CPropertyContainer props; diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 39cfd55bf..52c447162 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -108,6 +108,7 @@ #include "VFS/vfs_file_raii.h" #include "VFS/iteratedir.h" #include "VFS/File/vfs_file.h" +#include "VFS/Tools/ParserTools.h" #include "keys.h" diff --git a/Multiplayer/server.cpp b/Multiplayer/server.cpp index add38ec27..844f8ddff 100644 --- a/Multiplayer/server.cpp +++ b/Multiplayer/server.cpp @@ -33,6 +33,7 @@ #include "IniReader.h" #include "VFS/vfs.h" +#include "VFS/Tools/ParserTools.h" #include "MPJoinScreen.h" #include "game init.h" diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index fe4669078..8f1857be4 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -1822,8 +1822,11 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct ) size = std::min(size,260-1); sprintf( pGFStruct->zFileName, s.c_str()); pGFStruct->zFileName[size] = 0; + + pGFStruct->iFindHandle = 0; + pGFStruct->uiFileSize = file_iter.value()->GetFileSize(); + pGFStruct->uiFileAttribs = ( file_iter.value()->IsWriteable() ? FILE_IS_NORMAL : FILE_IS_READONLY ); - // don't care for the rest of variables in pGFStruct return TRUE; } return FALSE; @@ -1878,7 +1881,10 @@ BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct ) sprintf( pGFStruct->zFileName, s.c_str()); pGFStruct->zFileName[size] = 0; - // don't care for the rest of variables in pGFStruct + pGFStruct->iFindHandle = 0; + pGFStruct->uiFileSize = file_iter.value()->GetFileSize(); + pGFStruct->uiFileAttribs = ( file_iter.value()->IsWriteable() ? FILE_IS_NORMAL : FILE_IS_READONLY ); + return TRUE; } return FALSE; diff --git a/Standard Gaming Platform/Font.cpp b/Standard Gaming Platform/Font.cpp index 3accaeb14..a39e02b59 100644 --- a/Standard Gaming Platform/Font.cpp +++ b/Standard Gaming Platform/Font.cpp @@ -610,7 +610,7 @@ INT16 SubstringPixLength(STR16 string, UINT32 iStart, UINT32 iEnd, INT32 UseFont { Assert (string != NULL); Assert(iStart >= 0 && iStart <= iEnd); - Assert(iEnd < wcslen(string)); + Assert(iEnd <= wcslen(string)); INT16 cnt = 0; diff --git a/Standard Gaming Platform/MemMan.cpp b/Standard Gaming Platform/MemMan.cpp index befbc39fa..84caec111 100644 --- a/Standard Gaming Platform/MemMan.cpp +++ b/Standard Gaming Platform/MemMan.cpp @@ -36,8 +36,8 @@ #endif //#endif -#include "vfs.h" -#include "PropertyContainer.h" +#include "VFS/vfs.h" +#include "VFS/Tools/Log.h" #ifdef _DEBUG //#define DEBUG_MEM_LEAKS // turns on tracking of every MemAlloc and MemFree! diff --git a/Standard Gaming Platform/input.cpp b/Standard Gaming Platform/input.cpp index 5ff7efda9..568484cae 100644 --- a/Standard Gaming Platform/input.cpp +++ b/Standard Gaming Platform/input.cpp @@ -152,73 +152,85 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) switch (wParam) { - case WM_LBUTTONDOWN - : // Update the current mouse position + case WM_LBUTTONDOWN : + // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); + ScreenToClient( ghWindow, &mpos); gusMouseXPos = (INT16)mpos.x; gusMouseYPos = (INT16)mpos.y; uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state - gfLeftButtonState = TRUE; - //Set that we have input - gfSGPInputReceived = TRUE; + gfLeftButtonState = TRUE; + + //Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); - break; - case WM_LBUTTONUP - : // Update the current mouse position + break; + case WM_LBUTTONUP : + // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); + ScreenToClient( ghWindow, &mpos); gusMouseXPos = (INT16)mpos.x; gusMouseYPos = (INT16)mpos.y; uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state gfLeftButtonState = FALSE; - //Set that we have input - gfSGPInputReceived = TRUE; + + // Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(LEFT_BUTTON_UP, 0, uiParam); break; - case WM_RBUTTONDOWN - : // Update the current mouse position + case WM_RBUTTONDOWN : + // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); + ScreenToClient( ghWindow, &mpos); gusMouseXPos = (INT16)mpos.x; gusMouseYPos = (INT16)mpos.y; uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state gfRightButtonState = TRUE; - //Set that we have input - gfSGPInputReceived = TRUE; + + // Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam); break; - case WM_RBUTTONUP - : // Update the current mouse position + case WM_RBUTTONUP : + // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); + ScreenToClient( ghWindow, &mpos); gusMouseXPos = (INT16)mpos.x; gusMouseYPos = (INT16)mpos.y; uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state gfRightButtonState = FALSE; - //Set that we have input - gfSGPInputReceived = TRUE; + + //Set that we have input + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(RIGHT_BUTTON_UP, 0, uiParam); break; -//dnl begin part for additional mouse events - case WM_MBUTTONDOWN: + //dnl begin part for additional mouse events + case WM_MBUTTONDOWN : // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; ScreenToClient(ghWindow, &mpos); @@ -227,14 +239,17 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state gfMiddleButtonState = TRUE; + //Set that we have input - gfSGPInputReceived = TRUE; + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(MIDDLE_BUTTON_DOWN, 0, uiParam); break; - case WM_MBUTTONUP: + case WM_MBUTTONUP : // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; ScreenToClient(ghWindow, &mpos); @@ -243,16 +258,19 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update the button state gfMiddleButtonState = FALSE; + //Set that we have input - gfSGPInputReceived = TRUE; + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(MIDDLE_BUTTON_UP, 0, uiParam); break; //case WM_MBUTTONDBLCLK: // break; - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL : // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; ScreenToClient(ghWindow, &mpos); @@ -261,33 +279,37 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Update mouse wheel delta value gsMouseWheelDeltaValue = GetMouseWheelDeltaValue(((MOUSEHOOKSTRUCTEX *)lParam)->mouseData); + //Set that we have input - gfSGPInputReceived = TRUE; + gfSGPInputReceived = TRUE; + // Trigger an input event QueueEvent(MOUSE_WHEEL, 0, uiParam); break; -//dnl end part for additional mouse events - case WM_MOUSEMOVE - : // Update the current mouse position + //dnl end part for additional mouse events + case WM_MOUSEMOVE : + // Update the current mouse position mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt; - ScreenToClient( ghWindow, &mpos); + ScreenToClient( ghWindow, &mpos); gusMouseXPos = (INT16)mpos.x; gusMouseYPos = (INT16)mpos.y; uiParam = gusMouseYPos; uiParam = uiParam << 16; uiParam = uiParam | gusMouseXPos; + // Trigger an input event if (gfTrackMousePos == TRUE) { - QueueEvent(MOUSE_POS, 0, uiParam); + QueueEvent(MOUSE_POS, 0, uiParam); } - //Set that we have input - gfSGPInputReceived = TRUE; + //Set that we have input + gfSGPInputReceived = TRUE; break; - default: + default : return CallNextHookEx(ghMouseHook, Code, wParam, lParam); } @@ -306,34 +328,38 @@ LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam) { -UINT32 uiParam; -UINT32 uiXPos, uiYPos; -RECT rcClient; -BOOLEAN fOutsideClient=FALSE; -static BOOLEAN fResizing=FALSE; -LRESULT Result; + UINT32 uiParam; + UINT32 uiXPos, uiYPos; + RECT rcClient; + BOOLEAN fOutsideClient=FALSE; + static BOOLEAN fResizing=FALSE; + LRESULT Result; uiXPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).x; - uiYPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).y; - + uiYPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).y; if(!VideoIsFullScreen()) { if(wParam==WM_NCLBUTTONDOWN) - fResizing=TRUE; - + { + fResizing=TRUE; + } VideoGetClientRect(&rcClient); if((uiXPos < (UINT32)rcClient.left) || (uiXPos > (UINT32)rcClient.right) || (uiYPos < (UINT32)rcClient.top) || (uiYPos > (UINT32)rcClient.bottom)) + { fOutsideClient=TRUE; + } } if((Code < 0) || (!gfApplicationActive) || fOutsideClient || fResizing) - { // Do not handle this message, pass it on to another window - Result = CallNextHookEx(ghMouseHook, Code, wParam, lParam); + { + // Do not handle this message, pass it on to another window + Result = CallNextHookEx(ghMouseHook, Code, wParam, lParam); if((wParam==WM_LBUTTONUP) || (wParam==WM_NCLBUTTONUP)) + { fResizing=FALSE; - + } return(Result); } @@ -344,20 +370,21 @@ LRESULT Result; case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MOUSEMOVE: - if(VideoIsFullScreen()) - { - gusMouseXPos = (UINT16)(uiXPos); - gusMouseYPos = (UINT16)(uiYPos); - } - else - { - gusMouseXPos = (UINT16)(uiXPos-rcClient.left); - gusMouseYPos = (UINT16)(uiYPos-rcClient.top); - } + if(VideoIsFullScreen()) + { + gusMouseXPos = (UINT16)(uiXPos); + gusMouseYPos = (UINT16)(uiYPos); + } + else + { + gusMouseXPos = (UINT16)(uiXPos-rcClient.left); + gusMouseYPos = (UINT16)(uiYPos-rcClient.top); + } uiParam = (UINT32)gusMouseYPos<<16 | (UINT32)gusMouseXPos; - //Set that we have input + + //Set that we have input gfSGPInputReceived = TRUE; - break; + break; } if ( wParam == WM_MOUSEWHEEL ) @@ -368,11 +395,11 @@ LRESULT Result; switch (wParam) { case WM_LBUTTONDOWN: - gfLeftButtonState = TRUE; + gfLeftButtonState = TRUE; QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam); - break; + break; case WM_LBUTTONUP: - gfLeftButtonState = FALSE; + gfLeftButtonState = FALSE; QueueEvent(LEFT_BUTTON_UP, 0, uiParam); break; case WM_RBUTTONDOWN: @@ -401,32 +428,32 @@ BOOLEAN InitializeInputManager(void) // Initialize the gfKeyState table to FALSE everywhere memset(gfKeyState, FALSE, 256); // Initialize the Event Queue - gusQueueCount = 0; - gusHeadIndex = 0; - gusTailIndex = 0; + gusQueueCount = 0; + gusHeadIndex = 0; + gusTailIndex = 0; // By default, we will not queue mousemove events - gfTrackMousePos = FALSE; + gfTrackMousePos = FALSE; // Initialize other variables - gfShiftState = FALSE; - gfAltState = FALSE; - gfCtrlState = FALSE; + gfShiftState = FALSE; + gfAltState = FALSE; + gfCtrlState = FALSE; // Initialize variables pertaining to DOUBLE CLIK stuff - gfTrackDblClick = TRUE; - guiDoubleClkDelay = DBL_CLK_TIME; - guiSingleClickTimer = 0; - gfRecordedLeftButtonUp = FALSE; + gfTrackDblClick = TRUE; + guiDoubleClkDelay = DBL_CLK_TIME; + guiSingleClickTimer = 0; + gfRecordedLeftButtonUp = FALSE; // Initialize variables pertaining to the button states - gfLeftButtonState = FALSE; - gfRightButtonState = FALSE; + gfLeftButtonState = FALSE; + gfRightButtonState = FALSE; // Initialize variables pertaining to the repeat mechanism - guiLeftButtonRepeatTimer = 0; - guiRightButtonRepeatTimer = 0; + guiLeftButtonRepeatTimer = 0; + guiRightButtonRepeatTimer = 0; // Set the mouse to the center of the screen - gusMouseXPos = 320; - gusMouseYPos = 240; + gusMouseXPos = 320; + gusMouseYPos = 240; // Initialize the string input mechanism - gfCurrentStringInputState = FALSE; - gpCurrentStringDescriptor = NULL; + gfCurrentStringInputState = FALSE; + gpCurrentStringDescriptor = NULL; // Activate the hook functions for both keyboard and Mouse // ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId()); // DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook)); @@ -455,8 +482,9 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Can we queue up one more event, if not, the event is lost forever if (gusQueueCount == 256) - { // No more queue space - return; + { + // No more queue space + return; } // Okey Dokey, we can queue up the event, so we do it @@ -471,12 +499,14 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Increment the gusTailIndex pointer if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; + { + // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; } else - { // We simply increment the gusTailIndex - gusTailIndex++; + { + // We simply increment the gusTailIndex + gusTailIndex++; } } @@ -490,28 +520,29 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Can we queue up one more event, if not, the event is lost forever if (gusQueueCount == 256) - { // No more queue space - return; + { + // No more queue space + return; } if (ubInputEvent == LEFT_BUTTON_DOWN) { - guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; + guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; } if (ubInputEvent == RIGHT_BUTTON_DOWN) { - guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; + guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT; } if (ubInputEvent == LEFT_BUTTON_UP) { - guiLeftButtonRepeatTimer = 0; + guiLeftButtonRepeatTimer = 0; } if (ubInputEvent == RIGHT_BUTTON_UP) { - guiRightButtonRepeatTimer = 0; + guiRightButtonRepeatTimer = 0; } if ( (ubInputEvent == LEFT_BUTTON_UP) ) @@ -519,50 +550,52 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Do we have a double click if ( ( uiTimer - guiSingleClickTimer ) < DBL_CLK_TIME ) { - guiSingleClickTimer = 0; + guiSingleClickTimer = 0; - // Add a button up first... - gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; - gEventQueue[gusTailIndex].usKeyState = gusRecordedKeyState; - gEventQueue[gusTailIndex].usEvent = LEFT_BUTTON_UP; - gEventQueue[gusTailIndex].usParam = usParam; - gEventQueue[gusTailIndex].uiParam = uiParam; + // Add a button up first... + gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; + gEventQueue[gusTailIndex].usKeyState = gusRecordedKeyState; + gEventQueue[gusTailIndex].usEvent = LEFT_BUTTON_UP; + gEventQueue[gusTailIndex].usParam = usParam; + gEventQueue[gusTailIndex].uiParam = uiParam; - // Increment the number of items on the input queue - gusQueueCount++; + // Increment the number of items on the input queue + gusQueueCount++; - // Increment the gusTailIndex pointer - if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; - } - else - { // We simply increment the gusTailIndex - gusTailIndex++; - } + // Increment the gusTailIndex pointer + if (gusTailIndex == 255) + { + // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; + } + else + { + // We simply increment the gusTailIndex + gusTailIndex++; + } + // Now do double click + gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; + gEventQueue[gusTailIndex].usKeyState = gusRecordedKeyState ; + gEventQueue[gusTailIndex].usEvent = LEFT_BUTTON_DBL_CLK; + gEventQueue[gusTailIndex].usParam = usParam; + gEventQueue[gusTailIndex].uiParam = uiParam; - // Now do double click - gEventQueue[gusTailIndex].uiTimeStamp = uiTimer; - gEventQueue[gusTailIndex].usKeyState = gusRecordedKeyState ; - gEventQueue[gusTailIndex].usEvent = LEFT_BUTTON_DBL_CLK; - gEventQueue[gusTailIndex].usParam = usParam; - gEventQueue[gusTailIndex].uiParam = uiParam; + // Increment the number of items on the input queue + gusQueueCount++; - // Increment the number of items on the input queue - gusQueueCount++; - - // Increment the gusTailIndex pointer - if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; - } - else - { // We simply increment the gusTailIndex - gusTailIndex++; - } - - return; + // Increment the gusTailIndex pointer + if (gusTailIndex == 255) + { + // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; + } + else + { + // We simply increment the gusTailIndex + gusTailIndex++; + } + return; } else { @@ -583,12 +616,14 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) // Increment the gusTailIndex pointer if (gusTailIndex == 255) - { // The gusTailIndex is about to wrap around the queue ring - gusTailIndex = 0; + { + // The gusTailIndex is about to wrap around the queue ring + gusTailIndex = 0; } else - { // We simply increment the gusTailIndex - gusTailIndex++; + { + // We simply increment the gusTailIndex + gusTailIndex++; } } @@ -649,325 +684,384 @@ void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState) UINT32 uiTmpLParam; if ((usParam >= 96)&&(usParam <= 110)) - { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we - // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was - // pressed but NUM_7 was pressed, the we translate the key into NUM_7 - switch(usParam) - { case 96 // NUM_0 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) - { // Well its the NUM_9 key and not actually the PGUP key - ubKey = 223; - } - else - { // NOP, its the PGUP key all right - ubKey = usParam; - } - break; - case 110 // NUM_PERIOD - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) - { // Well its the NUM_3 key and not actually the PGDN key - ubKey = 224; - } - else - { // NOP, its the PGDN key all right - ubKey = usParam; - } - break; - case 97 // NUM_1 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) - { // Well its the NUM_1 key and not actually the END key - ubKey = 225; - } - else - { // NOP, its the END key all right - ubKey = usParam; - } - break; - case 98 // NUM_2 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) - { // Well its the NUM_7 key and not actually the HOME key - ubKey = 226; - } - else - { // NOP, its the HOME key all right - ubKey = usParam; - } - break; - case 99 // NUM_3 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) - { // Well its the NUM_4 key and not actually the LARROW key - ubKey = 227; - } - else - { // NOP, it's the LARROW key all right - ubKey = usParam; - } - break; - case 100 // NUM_4 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) - { // Well its the NUM_8 key and not actually the UPARROW key - ubKey = 228; - } - else - { // NOP, it's the UPARROW key all right - ubKey = usParam; - } - break; - case 101 // NUM_5 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 76) - { // Well its the NUM_6 key and not actually the RARROW key - ubKey = 229; - } - else - { // NOP, it's the RARROW key all right - ubKey = usParam; - } - break; - case 102 // NUM_6 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) - { // Well its the NUM_2 key and not actually the DNARROW key - ubKey = 230; - } - else - { // NOP, it's the DNARROW key all right - ubKey = usParam; - } - break; - case 103 // NUM_7 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) - { // Well its the NUM_0 key and not actually the INSERT key - ubKey = 231; - } - else - { // NOP, it's the INSERT key all right - ubKey = usParam; - } - break; - case 104 // NUM_8 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) - { // Well its the NUM_PERIOD key and not actually the DELETE key - ubKey = 232; - } - else - { // NOP, it's the DELETE key all right - ubKey = usParam; - } - break; - case 105 // NUM_9 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) - { // Well its the NUM_PERIOD key and not actually the DELETE key - ubKey = 233; - } - else - { // NOP, it's the DELETE key all right - ubKey = usParam; - } - break; - default - : ubKey = usParam; - break; - } - } - else { - if ((usParam >= 33)&&(usParam <= 46)) - { // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we + // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was // pressed but NUM_7 was pressed, the we translate the key into NUM_7 switch(usParam) - { case 45 // NUM_0 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) - { // Is it the NUM_0 key or the INSERT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the INSERT key - ubKey = 245; - } - else - { // Is the NUM_0 key with NUM lock off - ubKey = 234; - } + { + case 96 : // NUM_0 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) + { + // Well its the NUM_9 key and not actually the PGUP key + ubKey = 223; } else { - ubKey = usParam; + // NOP, its the PGUP key all right + ubKey = usParam; } break; - case 46 // NUM_PERIOD - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) - { // Is it the NUM_PERIOD key or the DEL key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the DELETE key - ubKey = 246; - } - else - { // Is the NUM_PERIOD key with NUM lock off - ubKey = 235; - } + case 110 : // NUM_PERIOD + if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) + { + // Well its the NUM_3 key and not actually the PGDN key + ubKey = 224; } else { - ubKey = usParam; + // NOP, its the PGDN key all right + ubKey = usParam; } break; - case 35 // NUM_1 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) - { // Is it the NUM_1 key or the END key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the END key - ubKey = 247; - } - else - { // Is the NUM_1 key with NUM lock off - ubKey = 236; - } + case 97 : // NUM_1 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) + { + // Well its the NUM_1 key and not actually the END key + ubKey = 225; } else { - ubKey = usParam; + // NOP, its the END key all right + ubKey = usParam; } break; - case 40 // NUM_2 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) - { // Is it the NUM_2 key or the DOWN key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the DOWN key - ubKey = 248; - } - else - { // Is the NUM_2 key with NUM lock off - ubKey = 237; - } + case 98 : // NUM_2 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) + { + // Well its the NUM_7 key and not actually the HOME key + ubKey = 226; } else { - ubKey = usParam; + // NOP, its the HOME key all right + ubKey = usParam; } break; - case 34 // NUM_3 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) - { // Is it the NUM_3 key or the PGDN key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the PGDN key - ubKey = 249; - } - else - { // Is the NUM_3 key with NUM lock off - ubKey = 238; - } + case 99 : // NUM_3 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) + { + // Well its the NUM_4 key and not actually the LARROW key + ubKey = 227; } else { - ubKey = usParam; + // NOP, it's the LARROW key all right + ubKey = usParam; } break; - case 37 // NUM_4 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) - { // Is it the NUM_4 key or the LEFT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the LEFT key - ubKey = 250; - } - else - { // Is the NUM_4 key with NUM lock off - ubKey = 239; - } + case 100 : // NUM_4 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) + { + // Well its the NUM_8 key and not actually the UPARROW key + ubKey = 228; } else { - ubKey = usParam; + // NOP, it's the UPARROW key all right + ubKey = usParam; } break; - case 39 // NUM_6 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) - { // Is it the NUM_6 key or the RIGHT key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the RIGHT key - ubKey = 251; - } - else - { // Is the NUM_6 key with NUM lock off - ubKey = 241; - } + case 101 : // NUM_5 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 76) + { + // Well its the NUM_6 key and not actually the RARROW key + ubKey = 229; } else { - ubKey = usParam; + // NOP, it's the RARROW key all right + ubKey = usParam; } break; - case 36 // NUM_7 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) - { // Is it the NUM_7 key or the HOME key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the HOME key - ubKey = 252; - } - else - { // Is the NUM_7 key with NUM lock off - ubKey = 242; - } + case 102 : // NUM_6 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) + { + // Well its the NUM_2 key and not actually the DNARROW key + ubKey = 230; } else { - ubKey = usParam; + // NOP, it's the DNARROW key all right + ubKey = usParam; } break; - case 38 // NUM_8 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) - { // Is it the NUM_8 key or the UP key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the UP key - ubKey = 253; - } - else - { // Is the NUM_8 key with NUM lock off - ubKey = 243; - } + case 103 : // NUM_7 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) + { + // Well its the NUM_0 key and not actually the INSERT key + ubKey = 231; } else { - ubKey = usParam; + // NOP, it's the INSERT key all right + ubKey = usParam; } break; - case 33 // NUM_9 - : if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) - { // Is it the NUM_9 key or the PGUP key - if (((uiParam & EXT_CODE_MASK) >> 17) != 0) - { // It's the PGUP key - ubKey = 254; - } - else - { // Is the NUM_9 key with NUM lock off - ubKey = 244; - } + case 104 : // NUM_8 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) + { + // Well its the NUM_PERIOD key and not actually the DELETE key + ubKey = 232; } else { - ubKey = usParam; + // NOP, it's the DELETE key all right + ubKey = usParam; } break; - default - : ubKey = usParam; + case 105 : // NUM_9 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) + { + // Well its the NUM_PERIOD key and not actually the DELETE key + ubKey = 233; + } + else + { + // NOP, it's the DELETE key all right + ubKey = usParam; + } + break; + default : + ubKey = usParam; break; } } else { - if (usParam == 12) - { // NUM_5 with NUM_LOCK off - ubKey = 240; + if ((usParam >= 33)&&(usParam <= 46)) + { + // Well this could be a NUMPAD character imitating the center console characters (when NUMLOCK is OFF). Well we + // gotta find out what was pressed and translate it to the actual physical key (i.e. if we think that HOME was + // pressed but NUM_7 was pressed, the we translate the key into NUM_7 + switch(usParam) + { + case 45 : // NUM_0 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 82) + { + // Is it the NUM_0 key or the INSERT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the INSERT key + ubKey = 245; + } + else + { + // Is the NUM_0 key with NUM lock off + ubKey = 234; + } + } + else + { + ubKey = usParam; + } + break; + case 46 : // NUM_PERIOD + if (((uiParam & SCAN_CODE_MASK) >> 16) == 83) + { + // Is it the NUM_PERIOD key or the DEL key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the DELETE key + ubKey = 246; + } + else + { + // Is the NUM_PERIOD key with NUM lock off + ubKey = 235; + } + } + else + { + ubKey = usParam; + } + break; + case 35 : // NUM_1 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 79) + { + // Is it the NUM_1 key or the END key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the END key + ubKey = 247; + } + else + { + // Is the NUM_1 key with NUM lock off + ubKey = 236; + } + } + else + { + ubKey = usParam; + } + break; + case 40 : // NUM_2 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 80) + { + // Is it the NUM_2 key or the DOWN key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the DOWN key + ubKey = 248; + } + else + { + // Is the NUM_2 key with NUM lock off + ubKey = 237; + } + } + else + { + ubKey = usParam; + } + break; + case 34 : // NUM_3 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 81) + { + // Is it the NUM_3 key or the PGDN key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the PGDN key + ubKey = 249; + } + else + { + // Is the NUM_3 key with NUM lock off + ubKey = 238; + } + } + else + { + ubKey = usParam; + } + break; + case 37 : // NUM_4 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 75) + { + // Is it the NUM_4 key or the LEFT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the LEFT key + ubKey = 250; + } + else + { + // Is the NUM_4 key with NUM lock off + ubKey = 239; + } + } + else + { + ubKey = usParam; + } + break; + case 39 : // NUM_6 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 77) + { + // Is it the NUM_6 key or the RIGHT key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the RIGHT key + ubKey = 251; + } + else + { + // Is the NUM_6 key with NUM lock off + ubKey = 241; + } + } + else + { + ubKey = usParam; + } + break; + case 36 : // NUM_7 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 71) + { + // Is it the NUM_7 key or the HOME key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the HOME key + ubKey = 252; + } + else + { + // Is the NUM_7 key with NUM lock off + ubKey = 242; + } + } + else + { + ubKey = usParam; + } + break; + case 38 : // NUM_8 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 72) + { + // Is it the NUM_8 key or the UP key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the UP key + ubKey = 253; + } + else + { + // Is the NUM_8 key with NUM lock off + ubKey = 243; + } + } + else + { + ubKey = usParam; + } + break; + case 33 : // NUM_9 + if (((uiParam & SCAN_CODE_MASK) >> 16) == 73) + { + // Is it the NUM_9 key or the PGUP key + if (((uiParam & EXT_CODE_MASK) >> 17) != 0) + { + // It's the PGUP key + ubKey = 254; + } + else + { + // Is the NUM_9 key with NUM lock off + ubKey = 244; + } + } + else + { + ubKey = usParam; + } + break; + default : + ubKey = usParam; + break; + } } else - { // Normal key - ubKey = usParam; + { + if (usParam == 12) + { + // NUM_5 with NUM_LOCK off + ubKey = 240; + } + else + { + // Normal key + ubKey = usParam; + } } } - } // Find ucChar by translating ubKey using the gsKeyTranslationTable. If the SHIFT, ALT or CTRL key are down, then // the index into the translation table us changed from ubKey to ubKey+256, ubKey+512 and ubKey+768 respectively - if (gfShiftState == TRUE) - { // SHIFT is pressed, hence we add 256 to ubKey before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+256]; + if (gfShiftState == TRUE) + { + // SHIFT is pressed, hence we add 256 to ubKey before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+256]; } else { @@ -978,22 +1072,25 @@ void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState) // Just something i found, and thought u should know about. DF. // - if( gfAltState == TRUE ) - { // ALT is pressed, hence ubKey is multiplied by 3 before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+512]; - } - else - { - if (gfCtrlState == TRUE) - { // CTRL is pressed, hence ubKey is multiplied by 4 before translation to ubChar - ubChar = gsKeyTranslationTable[ubKey+768]; + if( gfAltState == TRUE ) + { + // ALT is pressed, hence ubKey is multiplied by 3 before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+512]; } else - { // None of the SHIFT, ALT or CTRL are pressed hence we have a default translation of ubKey - ubChar = gsKeyTranslationTable[ubKey]; + { + if (gfCtrlState == TRUE) + { + // CTRL is pressed, hence ubKey is multiplied by 4 before translation to ubChar + ubChar = gsKeyTranslationTable[ubKey+768]; + } + else + { + // None of the SHIFT, ALT or CTRL are pressed hence we have a default translation of ubKey + ubChar = gsKeyTranslationTable[ubKey]; + } } } - } GetCursorPos(&MousePos); ScreenToClient(ghWindow, &MousePos); // In window coords! @@ -1001,48 +1098,56 @@ void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState) uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); if (ufKeyState == TRUE) - { // Key has been PRESSED - // Find out if the key is already pressed and if not, queue an event and update the gfKeyState array - if (gfKeyState[ubKey] == FALSE) - { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState - if (gfCurrentStringInputState == FALSE) + { + // Key has been PRESSED + // Find out if the key is already pressed and if not, queue an event and update the gfKeyState array + if (gfKeyState[ubKey] == FALSE) { - // There is no string input going on right now, so we queue up the event - gfKeyState[ubKey] = TRUE; - QueueEvent(KEY_DOWN, ubChar, uiTmpLParam); + // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState + if (gfCurrentStringInputState == FALSE) + { + // There is no string input going on right now, so we queue up the event + gfKeyState[ubKey] = TRUE; + QueueEvent(KEY_DOWN, ubChar, uiTmpLParam); } + else + { + // There is a current input string which will capture this event + RedirectToString(ubChar); + DbgMessage(TOPIC_INPUT, DBG_LEVEL_0, String("Pressed character %d (%d)", ubChar, ubKey)); + } + } else - { // There is a current input string which will capture this event - RedirectToString(ubChar); - DbgMessage(TOPIC_INPUT, DBG_LEVEL_0, String("Pressed character %d (%d)", ubChar, ubKey)); + { + // Well the key gets repeated + if (gfCurrentStringInputState == FALSE) + { + // There is no string input going on right now, so we queue up the event + QueueEvent(KEY_REPEAT, ubChar, uiTmpLParam); + } + else + { + // There is a current input string which will capture this event + RedirectToString(ubChar); + } } } else - { // Well the key gets repeated - if (gfCurrentStringInputState == FALSE) - { // There is no string input going on right now, so we queue up the event - QueueEvent(KEY_REPEAT, ubChar, uiTmpLParam); + { + // Key has been RELEASED + // Find out if the key is already pressed and if so, queue an event and update the gfKeyState array + if (gfKeyState[ubKey] == TRUE) + { + // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState + gfKeyState[ubKey] = FALSE; + QueueEvent(KEY_UP, ubChar, uiTmpLParam); } - else - { // There is a current input string which will capture this event - RedirectToString(ubChar); - } - } - } - else - { // Key has been RELEASED - // Find out if the key is already pressed and if so, queue an event and update the gfKeyState array - if (gfKeyState[ubKey] == TRUE) - { // Well the key has just been pressed, therefore we queue up and event and update the gsKeyState - gfKeyState[ubKey] = FALSE; - QueueEvent(KEY_UP, ubChar, uiTmpLParam); - } //else if the alt tab key was pressed else if( ubChar == TAB && gfAltState ) { // therefore minimize the application ShowWindow( ghWindow, SW_MINIMIZE ); - gfKeyState[ ALT ] = FALSE; + gfKeyState[ ALT ] = FALSE; gfAltState = FALSE; } } @@ -1052,41 +1157,44 @@ void KeyDown(UINT32 usParam, UINT32 uiParam) { // Are we PRESSING down one of SHIFT, ALT or CTRL ??? if (usParam == SHIFT) - { // SHIFT key is PRESSED - gfShiftState = SHIFT_DOWN; - gfKeyState[SHIFT] = TRUE; + { + // SHIFT key is PRESSED + gfShiftState = SHIFT_DOWN; + gfKeyState[SHIFT] = TRUE; } else { - if (usParam == CTRL) - { // CTRL key is PRESSED - gfCtrlState = CTRL_DOWN; - gfKeyState[CTRL] = TRUE; - } - else - { - if (usParam == ALT) - { // ALT key is pressed - gfAltState = ALT_DOWN; - gfKeyState[ALT] = TRUE; + if (usParam == CTRL) + { + // CTRL key is PRESSED + gfCtrlState = CTRL_DOWN; + gfKeyState[CTRL] = TRUE; } else { - if (usParam == SNAPSHOT) - { - //PrintScreen(); + if (usParam == ALT) + { + // ALT key is pressed + gfAltState = ALT_DOWN; + gfKeyState[ALT] = TRUE; + } + else + { + if (usParam == SNAPSHOT) + { + //PrintScreen(); // DB Done in the KeyUp function // this used to be keyed to SCRL_LOCK // which I believe Luis gave the wrong value + } + else + { + // No special keys have been pressed + // Call KeyChange() and pass TRUE to indicate key has been PRESSED and not RELEASED + KeyChange(usParam, uiParam, TRUE); + } + } } - else - { - // No special keys have been pressed - // Call KeyChange() and pass TRUE to indicate key has been PRESSED and not RELEASED - KeyChange(usParam, uiParam, TRUE); - } - } - } } } @@ -1094,45 +1202,48 @@ void KeyUp(UINT32 usParam, UINT32 uiParam) { // Are we RELEASING one of SHIFT, ALT or CTRL ??? if (usParam == SHIFT) - { // SHIFT key is RELEASED - gfShiftState = FALSE; - gfKeyState[SHIFT] = FALSE; - } - else { - if (usParam == CTRL) - { // CTRL key is RELEASED - gfCtrlState = FALSE; - gfKeyState[CTRL] = FALSE; + // SHIFT key is RELEASED + gfShiftState = FALSE; + gfKeyState[SHIFT] = FALSE; } - else - { - if (usParam == ALT) - { // ALT key is RELEASED - gfAltState = FALSE; - gfKeyState[ALT] = FALSE; + else + { + if (usParam == CTRL) + { + // CTRL key is RELEASED + gfCtrlState = FALSE; + gfKeyState[CTRL] = FALSE; } else { - if (usParam == SNAPSHOT) - { + if (usParam == ALT) + { + // ALT key is RELEASED + gfAltState = FALSE; + gfKeyState[ALT] = FALSE; + } + else + { + if (usParam == SNAPSHOT) + { // DB this used to be keyed to SCRL_LOCK // which I believe Luis gave the wrong value - //#ifndef JA2 +//#ifndef JA2 if (_KeyDown(CTRL)) VideoCaptureToggle(); else - //#endif +//#endif PrintScreen(); - } - else - { + } + else + { // No special keys have been pressed // Call KeyChange() and pass FALSE to indicate key has been PRESSED and not RELEASED KeyChange(usParam, uiParam, FALSE); + } + } } - } - } } } @@ -1177,31 +1288,362 @@ StringInput *InitStringInput(UINT16 *pInputString, UINT16 usLength, UINT16 *pFil if ((pStringDescriptor = (StringInput *) MemAlloc(sizeof(StringInput))) == NULL) { - // - // Hum we failed to allocate memory for the string descriptor - // + // + // Hum we failed to allocate memory for the string descriptor + // - DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string descriptor"); - return NULL; + DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string descriptor"); + return NULL; } else { - if ((pStringDescriptor->pOriginalString = (UINT16 *) MemAlloc(usLength * 2)) == NULL) - { - // - // free up structure before aborting - // + if ((pStringDescriptor->pOriginalString = (UINT16 *) MemAlloc(usLength * 2)) == NULL) + { + // + // free up structure before aborting + // - MemFree(pStringDescriptor); - DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string duplicate"); - return NULL; + MemFree(pStringDescriptor); + DbgMessage(TOPIC_INPUT, DBG_LEVEL_1, "Failed to allocate memory for string duplicate"); + return NULL; + } + + memcpy(pStringDescriptor->pOriginalString, pInputString, usLength * 2); + + pStringDescriptor->pString = pInputString; + pStringDescriptor->pFilter = pFilter; + pStringDescriptor->usMaxStringLength = usLength; + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) + { + // + // Find the last character in the string + // + + pStringDescriptor->usStringOffset++; + pStringDescriptor->usCurrentStringLength++; + } + + if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) + { + // + // Hum the current string has no null terminator. Invalidate the string and + // start from scratch + // + + memset(pStringDescriptor->pString, 0, usLength * 2); + pStringDescriptor->usStringOffset = 0; + pStringDescriptor->usCurrentStringLength = 0; + } + + pStringDescriptor->fInsertMode = FALSE; + pStringDescriptor->fFocus = FALSE; + pStringDescriptor->pPreviousString = NULL; + pStringDescriptor->pNextString = NULL; + + return pStringDescriptor; } +} - memcpy(pStringDescriptor->pOriginalString, pInputString, usLength * 2); +void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString) +{ + if (pCurrentString != NULL) + { + if (pCurrentString->pPreviousString != NULL) + { + pCurrentString->pPreviousString->pNextString = NULL; + } + + pCurrentString->pPreviousString = pPreviousString; + + if (pPreviousString != NULL) + { + pPreviousString->pNextString = pCurrentString; + } + } +} + +void LinkNextString(StringInput *pCurrentString, StringInput *pNextString) +{ + if (pCurrentString != NULL) + { + if (pCurrentString->pNextString != NULL) + { + pCurrentString->pNextString->pPreviousString = NULL; + } + + pCurrentString->pNextString = pNextString; + + if (pNextString != NULL) + { + pNextString->pPreviousString = pCurrentString; + } + } +} + +BOOLEAN CharacterIsValid(UINT16 usCharacter, UINT16 *pFilter) +{ + UINT32 uiIndex, uiEndIndex; + + if (pFilter != NULL) + { + uiEndIndex = *pFilter; + for (uiIndex = 1; uiIndex <= *pFilter; uiIndex++) + { + if (usCharacter == *(pFilter + uiIndex)) + { + return TRUE; + } + } + return FALSE; + } + return TRUE; +} + +void RedirectToString(UINT16 usInputCharacter) +{ + UINT16 usIndex; + + if (gpCurrentStringDescriptor != NULL) + { + // Handle the new character input + switch (usInputCharacter) + { + case ENTER : // ENTER is pressed, the last character field should be set to ENTER + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + else + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + gfCurrentStringInputState = FALSE; + } + break; + case ESC : // ESC was pressed, the last character field should be set to ESC + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + gfCurrentStringInputState = FALSE; + break; + case SHIFT_TAB : // TAB was pressed, the last character field should be set to TAB + if (gpCurrentStringDescriptor->pPreviousString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case TAB : // TAB was pressed, the last character field should be set to TAB + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case UPARROW : // The UPARROW was pressed, the last character field should be set to UPARROW + if (gpCurrentStringDescriptor->pPreviousString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case DNARROW : // The DNARROW was pressed, the last character field should be set to DNARROW + if (gpCurrentStringDescriptor->pNextString != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + } + break; + case LEFTARROW : // The LEFTARROW was pressed, move one character to the left + if (gpCurrentStringDescriptor->usStringOffset > 0) + { + // Decrement the offset + gpCurrentStringDescriptor->usStringOffset--; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case RIGHTARROW : // The RIGHTARROW was pressed, move one character to the right + if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) + { + // Ok we can move the cursor one up without going past the end of string + gpCurrentStringDescriptor->usStringOffset++; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case BACKSPACE : // Delete the character preceding the cursor + if (gpCurrentStringDescriptor->usStringOffset > 0) + { + // Ok, we are not at the beginning of the string, so we may proceed + for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex <= gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) + { // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex - 1) = *(gpCurrentStringDescriptor->pString + usIndex); + } + gpCurrentStringDescriptor->usStringOffset--; + gpCurrentStringDescriptor->usCurrentStringLength--; + } + break; + case DEL : // Delete the character which follows the cursor + if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) + { + // Ok we are not at the end of the string, so we may proceed + for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex < gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) + { + // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex + 1); + } + gpCurrentStringDescriptor->usCurrentStringLength--; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case INSERT : // Toggle insert mode + if (gpCurrentStringDescriptor->fInsertMode == TRUE) + { + gpCurrentStringDescriptor->fInsertMode = FALSE; + } + else + { + gpCurrentStringDescriptor->fInsertMode = TRUE; + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + case HOME : // Go to the beginning of the input string + gpCurrentStringDescriptor->usStringOffset = 0 ; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; +#ifndef JA2 + // Stupid definition causes problems with headers that use the keyword END -- DB + case KEY_END +#else + case END +#endif + : // Go to the end of the input string + gpCurrentStringDescriptor->usStringOffset = gpCurrentStringDescriptor->usCurrentStringLength; + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + break; + default : // + // normal input + // + if (CharacterIsValid(usInputCharacter, gpCurrentStringDescriptor->pFilter) == TRUE) + { + if (gpCurrentStringDescriptor->fInsertMode == TRUE) + { + // Before we can shift characters for the insert, we must make sure we have the space + if (gpCurrentStringDescriptor->usCurrentStringLength < (gpCurrentStringDescriptor->usMaxStringLength - 1)) + { + // Before we can add a new character we must shift existing ones to for the insert + for (usIndex = gpCurrentStringDescriptor->usCurrentStringLength; usIndex > gpCurrentStringDescriptor->usStringOffset; usIndex--) + { + // Shift the characters one at a time + *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex - 1); + } + // Ok now we introduce the new character + *(gpCurrentStringDescriptor->pString + usIndex) = usInputCharacter; + gpCurrentStringDescriptor->usStringOffset++; + gpCurrentStringDescriptor->usCurrentStringLength++; + } + } + else + { + // Ok, add character to string (by overwriting) + if (gpCurrentStringDescriptor->usStringOffset < (gpCurrentStringDescriptor->usMaxStringLength - 1)) + { + // Ok, we have not exceeded the maximum number of characters yet + *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = usInputCharacter; + gpCurrentStringDescriptor->usStringOffset++; + } + // Did we push back the current string length (i.e. add character to end of string) + if (gpCurrentStringDescriptor->usStringOffset > gpCurrentStringDescriptor->usCurrentStringLength) + { + // Add a NULL character + *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = 0; + gpCurrentStringDescriptor->usCurrentStringLength++; + } + } + gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; + } + break; + } + } +} + +UINT16 GetStringInputState(void) +{ + if (gpCurrentStringDescriptor != NULL) + { + return gpCurrentStringDescriptor->usLastCharacter; + } + else + { + return 0; + } +} + +BOOLEAN StringInputHasFocus(void) +{ + return gfCurrentStringInputState; +} + +BOOLEAN SetStringFocus(StringInput *pStringDescriptor) +{ + if (pStringDescriptor != NULL) + { + if (gpCurrentStringDescriptor != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + } + // Ok overide current entry + gfCurrentStringInputState = TRUE; + gpCurrentStringDescriptor = pStringDescriptor; + gpCurrentStringDescriptor->fFocus = TRUE; + gpCurrentStringDescriptor->usLastCharacter = 0; + return TRUE; + } + else + { + if (gpCurrentStringDescriptor != NULL) + { + gpCurrentStringDescriptor->fFocus = FALSE; + } + // Ok overide current entry + gfCurrentStringInputState = FALSE; + gpCurrentStringDescriptor = NULL; + return TRUE; + } +} + +UINT16 GetCursorPositionInString(StringInput *pStringDescriptor) +{ + return pStringDescriptor->usStringOffset; +} + +BOOLEAN StringHasFocus(StringInput *pStringDescriptor) +{ + if (pStringDescriptor != NULL) + { + return pStringDescriptor->fFocus; + } + else + { + return FALSE; + } +} + +void RestoreString(StringInput *pStringDescriptor) +{ + memcpy(pStringDescriptor->pString, pStringDescriptor->pOriginalString, pStringDescriptor->usMaxStringLength * 2); - pStringDescriptor->pString = pInputString; - pStringDescriptor->pFilter = pFilter; - pStringDescriptor->usMaxStringLength = usLength; pStringDescriptor->usStringOffset = 0; pStringDescriptor->usCurrentStringLength = 0; while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) @@ -1220,347 +1662,11 @@ StringInput *InitStringInput(UINT16 *pInputString, UINT16 usLength, UINT16 *pFil // Hum the current string has no null terminator. Invalidate the string and // start from scratch // - - memset(pStringDescriptor->pString, 0, usLength * 2); + memset(pStringDescriptor->pString, 0, pStringDescriptor->usMaxStringLength * 2); pStringDescriptor->usStringOffset = 0; pStringDescriptor->usCurrentStringLength = 0; } - pStringDescriptor->fInsertMode = FALSE; - pStringDescriptor->fFocus = FALSE; - pStringDescriptor->pPreviousString = NULL; - pStringDescriptor->pNextString = NULL; - - return pStringDescriptor; - } -} - -void LinkPreviousString(StringInput *pCurrentString, StringInput *pPreviousString) -{ - if (pCurrentString != NULL) - { - if (pCurrentString->pPreviousString != NULL) - { - pCurrentString->pPreviousString->pNextString = NULL; - } - - pCurrentString->pPreviousString = pPreviousString; - - if (pPreviousString != NULL) - { - pPreviousString->pNextString = pCurrentString; - } - } -} - -void LinkNextString(StringInput *pCurrentString, StringInput *pNextString) -{ - if (pCurrentString != NULL) - { - if (pCurrentString->pNextString != NULL) - { - pCurrentString->pNextString->pPreviousString = NULL; - } - - pCurrentString->pNextString = pNextString; - - if (pNextString != NULL) - { - pNextString->pPreviousString = pCurrentString; - } - } -} - -BOOLEAN CharacterIsValid(UINT16 usCharacter, UINT16 *pFilter) -{ - UINT32 uiIndex, uiEndIndex; - - if (pFilter != NULL) - { - uiEndIndex = *pFilter; - for (uiIndex = 1; uiIndex <= *pFilter; uiIndex++) - { - if (usCharacter == *(pFilter + uiIndex)) - { - return TRUE; - } - } - return FALSE; - } - - return TRUE; -} - -void RedirectToString(UINT16 usInputCharacter) -{ - UINT16 usIndex; - - if (gpCurrentStringDescriptor != NULL) - { - // Handle the new character input - switch (usInputCharacter) - { - case ENTER - : // ENTER is pressed, the last character field should be set to ENTER - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - else - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - gfCurrentStringInputState = FALSE; - } - break; - case ESC - : // ESC was pressed, the last character field should be set to ESC - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - gfCurrentStringInputState = FALSE; - break; - case SHIFT_TAB - : // TAB was pressed, the last character field should be set to TAB - if (gpCurrentStringDescriptor->pPreviousString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case TAB - : // TAB was pressed, the last character field should be set to TAB - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case UPARROW - : // The UPARROW was pressed, the last character field should be set to UPARROW - if (gpCurrentStringDescriptor->pPreviousString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pPreviousString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case DNARROW - : // The DNARROW was pressed, the last character field should be set to DNARROW - if (gpCurrentStringDescriptor->pNextString != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - gpCurrentStringDescriptor = gpCurrentStringDescriptor->pNextString; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - } - break; - case LEFTARROW - : // The LEFTARROW was pressed, move one character to the left - if (gpCurrentStringDescriptor->usStringOffset > 0) - { // Decrement the offset - gpCurrentStringDescriptor->usStringOffset--; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case RIGHTARROW - : // The RIGHTARROW was pressed, move one character to the right - if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) - { // Ok we can move the cursor one up without going past the end of string - gpCurrentStringDescriptor->usStringOffset++; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case BACKSPACE - : // Delete the character preceding the cursor - if (gpCurrentStringDescriptor->usStringOffset > 0) - { // Ok, we are not at the beginning of the string, so we may proceed - for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex <= gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex - 1) = *(gpCurrentStringDescriptor->pString + usIndex); - } - gpCurrentStringDescriptor->usStringOffset--; - gpCurrentStringDescriptor->usCurrentStringLength--; - } - - break; - case DEL - : // Delete the character which follows the cursor - if (gpCurrentStringDescriptor->usStringOffset < gpCurrentStringDescriptor->usCurrentStringLength) - { // Ok we are not at the end of the string, so we may proceed - for (usIndex = gpCurrentStringDescriptor->usStringOffset; usIndex < gpCurrentStringDescriptor->usCurrentStringLength; usIndex++) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex + 1); - } - gpCurrentStringDescriptor->usCurrentStringLength--; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case INSERT - : // Toggle insert mode - if (gpCurrentStringDescriptor->fInsertMode == TRUE) - { - gpCurrentStringDescriptor->fInsertMode = FALSE; - } - else - { - gpCurrentStringDescriptor->fInsertMode = TRUE; - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - case HOME - : // Go to the beginning of the input string - gpCurrentStringDescriptor->usStringOffset = 0 ; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; -#ifndef JA2 -// Stupid definition causes problems with headers that use the keyword END -- DB - case KEY_END -#else - case END -#endif - : // Go to the end of the input string - gpCurrentStringDescriptor->usStringOffset = gpCurrentStringDescriptor->usCurrentStringLength; - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - break; - default - : // - // normal input - // - if (CharacterIsValid(usInputCharacter, gpCurrentStringDescriptor->pFilter) == TRUE) - { - if (gpCurrentStringDescriptor->fInsertMode == TRUE) - { // Before we can shift characters for the insert, we must make sure we have the space - if (gpCurrentStringDescriptor->usCurrentStringLength < (gpCurrentStringDescriptor->usMaxStringLength - 1)) - { // Before we can add a new character we must shift existing ones to for the insert - for (usIndex = gpCurrentStringDescriptor->usCurrentStringLength; usIndex > gpCurrentStringDescriptor->usStringOffset; usIndex--) - { // Shift the characters one at a time - *(gpCurrentStringDescriptor->pString + usIndex) = *(gpCurrentStringDescriptor->pString + usIndex - 1); - } - // Ok now we introduce the new character - *(gpCurrentStringDescriptor->pString + usIndex) = usInputCharacter; - gpCurrentStringDescriptor->usStringOffset++; - gpCurrentStringDescriptor->usCurrentStringLength++; - } - } - else - { - // Ok, add character to string (by overwriting) - if (gpCurrentStringDescriptor->usStringOffset < (gpCurrentStringDescriptor->usMaxStringLength - 1)) - { // Ok, we have not exceeded the maximum number of characters yet - *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = usInputCharacter; - gpCurrentStringDescriptor->usStringOffset++; - } - // Did we push back the current string length (i.e. add character to end of string) - if (gpCurrentStringDescriptor->usStringOffset > gpCurrentStringDescriptor->usCurrentStringLength) - { // Add a NULL character - *(gpCurrentStringDescriptor->pString + gpCurrentStringDescriptor->usStringOffset) = 0; - gpCurrentStringDescriptor->usCurrentStringLength++; - } - } - gpCurrentStringDescriptor->usLastCharacter = usInputCharacter; - } - break; - } - } -} - -UINT16 GetStringInputState(void) -{ - if (gpCurrentStringDescriptor != NULL) - { - return gpCurrentStringDescriptor->usLastCharacter; - } - else - { - return 0; - } -} - -BOOLEAN StringInputHasFocus(void) -{ - return gfCurrentStringInputState; -} - -BOOLEAN SetStringFocus(StringInput *pStringDescriptor) -{ - if (pStringDescriptor != NULL) - { - if (gpCurrentStringDescriptor != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - } - // Ok overide current entry - gfCurrentStringInputState = TRUE; - gpCurrentStringDescriptor = pStringDescriptor; - gpCurrentStringDescriptor->fFocus = TRUE; - gpCurrentStringDescriptor->usLastCharacter = 0; - return TRUE; - } - else - { - if (gpCurrentStringDescriptor != NULL) - { - gpCurrentStringDescriptor->fFocus = FALSE; - } - // Ok overide current entry - gfCurrentStringInputState = FALSE; - gpCurrentStringDescriptor = NULL; - return TRUE; - } -} - -UINT16 GetCursorPositionInString(StringInput *pStringDescriptor) -{ - return pStringDescriptor->usStringOffset; -} - -BOOLEAN StringHasFocus(StringInput *pStringDescriptor) -{ - if (pStringDescriptor != NULL) - { - return pStringDescriptor->fFocus; - } - else - { - return FALSE; - } -} - -void RestoreString(StringInput *pStringDescriptor) -{ - memcpy(pStringDescriptor->pString, pStringDescriptor->pOriginalString, pStringDescriptor->usMaxStringLength * 2); - - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - while ((pStringDescriptor->usStringOffset < pStringDescriptor->usMaxStringLength)&&(*(pStringDescriptor->pString + pStringDescriptor->usStringOffset) != 0)) - { - // - // Find the last character in the string - // - - pStringDescriptor->usStringOffset++; - pStringDescriptor->usCurrentStringLength++; - } - - if (pStringDescriptor->usStringOffset == pStringDescriptor->usMaxStringLength) - { - // - // Hum the current string has no null terminator. Invalidate the string and - // start from scratch - // - memset(pStringDescriptor->pString, 0, pStringDescriptor->usMaxStringLength * 2); - pStringDescriptor->usStringOffset = 0; - pStringDescriptor->usCurrentStringLength = 0; - } - pStringDescriptor->fInsertMode = FALSE; } @@ -1569,18 +1675,19 @@ void EndStringInput(StringInput *pStringDescriptor) // Make sure we have a valid pStringDescriptor if (pStringDescriptor != NULL) { // make sure the gpCurrentStringDescriptor is NULL if necessary - if (pStringDescriptor == gpCurrentStringDescriptor) - { - gpCurrentStringDescriptor = NULL; - gfCurrentStringInputState = FALSE; - } - // Make sure we have a valid string within the string descriptor - if (pStringDescriptor->pOriginalString != NULL) - { // free up the string - MemFree(pStringDescriptor->pOriginalString); - } - // free up the descriptor - MemFree(pStringDescriptor); + if (pStringDescriptor == gpCurrentStringDescriptor) + { + gpCurrentStringDescriptor = NULL; + gfCurrentStringInputState = FALSE; + } + // Make sure we have a valid string within the string descriptor + if (pStringDescriptor->pOriginalString != NULL) + { + // free up the string + MemFree(pStringDescriptor->pOriginalString); + } + // free up the descriptor + MemFree(pStringDescriptor); } } @@ -1622,7 +1729,7 @@ void RestoreCursorClipRect( void ) { if ( fCursorWasClipped ) { - ClipCursor( &gCursorClipRect ); + ClipCursor( &gCursorClipRect ); } } @@ -1685,7 +1792,7 @@ BOOLEAN InputEventInside(InputAtom *Event, UINT32 uiX1, UINT32 uiY1, UINT32 uiX2 void DequeueAllKeyBoardEvents() { InputAtom InputEvent; - MSG KeyMessage; + MSG KeyMessage; //dequeue all the events waiting in the windows queue @@ -1710,48 +1817,47 @@ void HandleSingleClicksAndButtonRepeats( void ) { UINT32 uiTimer; - uiTimer = GetTickCount(); // Is there a LEFT mouse button repeat if (gfLeftButtonState) { - if ((guiLeftButtonRepeatTimer > 0)&&(guiLeftButtonRepeatTimer <= uiTimer)) - { - UINT32 uiTmpLParam; - POINT MousePos; + if ((guiLeftButtonRepeatTimer > 0)&&(guiLeftButtonRepeatTimer <= uiTimer)) + { + UINT32 uiTmpLParam; + POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); - QueueEvent(LEFT_BUTTON_REPEAT, 0, uiTmpLParam); - guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; - } + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); + QueueEvent(LEFT_BUTTON_REPEAT, 0, uiTmpLParam); + guiLeftButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; + } } else { - guiLeftButtonRepeatTimer = 0; + guiLeftButtonRepeatTimer = 0; } // Is there a RIGHT mouse button repeat if (gfRightButtonState) { - if ((guiRightButtonRepeatTimer > 0)&&(guiRightButtonRepeatTimer <= uiTimer)) - { - UINT32 uiTmpLParam; - POINT MousePos; + if ((guiRightButtonRepeatTimer > 0)&&(guiRightButtonRepeatTimer <= uiTimer)) + { + UINT32 uiTmpLParam; + POINT MousePos; - GetCursorPos(&MousePos); - ScreenToClient(ghWindow, &MousePos); // In window coords! - uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); - QueueEvent(RIGHT_BUTTON_REPEAT, 0, uiTmpLParam); - guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; - } + GetCursorPos(&MousePos); + ScreenToClient(ghWindow, &MousePos); // In window coords! + uiTmpLParam = ((MousePos.y << 16) & 0xffff0000) | (MousePos.x & 0x0000ffff); + QueueEvent(RIGHT_BUTTON_REPEAT, 0, uiTmpLParam); + guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIME; + } } else { - guiRightButtonRepeatTimer = 0; + guiRightButtonRepeatTimer = 0; } } @@ -1762,3 +1868,4 @@ INT16 GetMouseWheelDeltaValue( UINT32 wParam ) return( sDelta / WHEEL_DELTA ); } + diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index f09ca3330..6ff38bb5f 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -34,16 +34,18 @@ #include "utilities.h" #endif - #include "input.h" - #include "zmouse.h" +#include "input.h" +#include "zmouse.h" #include "VFS/vfs.h" #include "VFS/vfs_init.h" #include "VFS/File/vfs_file.h" #include "VFS/Location/vfs_slf_library.h" +#include "VFS/Tools/Log.h" +#include "VFS/Tools/ParserTools.h" #include "Text.h" -#define USE_CONSOLE 1 +#define USE_CONSOLE 0 #include @@ -69,9 +71,11 @@ static void MAGIC(std::string const& aarrrrgggh = "") {} -static bool s_VfsIsInitialized = false; +static bool s_VfsIsInitialized = false; static std::list vfs_config_ini; +static bool s_DebugKeyboardInput = false; +static vfs::Path s_CodePage; void SHOWEXCEPTION(CBasicException& ex) { @@ -81,25 +85,25 @@ void SHOWEXCEPTION(CBasicException& ex) catch(CBasicException &ex2) { LogException(ex2); exit(0); - } + } } -extern UINT32 MemDebugCounter; +extern UINT32 MemDebugCounter; #ifdef JA2 -extern BOOLEAN gfPauseDueToPlayerGamePause; -extern int iScreenMode; -extern BOOL bScreenModeCmdLine; + extern BOOLEAN gfPauseDueToPlayerGamePause; + extern int iScreenMode; + extern BOOL bScreenModeCmdLine; #endif -extern BOOLEAN CheckIfGameCdromIsInCDromDrive(); -extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); +extern BOOLEAN CheckIfGameCdromIsInCDromDrive(); +extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); // Prototype Declarations -INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam); -BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow); -void ShutdownStandardGamingPlatform(void); -void GetRuntimeSettings( ); +INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam); +BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow); +void ShutdownStandardGamingPlatform(void); +void GetRuntimeSettings( ); int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow); @@ -108,18 +112,18 @@ Console g_Console("", "", "Lua Console", "no"); #endif #if !defined(JA2) && !defined(UTILS) -void ProcessCommandLine(CHAR8 *pCommandLine); -BOOLEAN RunSetup(void); +void ProcessCommandLine(CHAR8 *pCommandLine); +BOOLEAN RunSetup(void); // Should the game immediately load the quick save at startup? -BOOLEAN gfLoadAtStartup=FALSE; -BOOLEAN gfUsingBoundsChecker=FALSE; -CHAR8 *gzStringDataOverride=NULL; -BOOLEAN gfCapturingVideo = FALSE; +BOOLEAN gfLoadAtStartup=FALSE; +BOOLEAN gfUsingBoundsChecker=FALSE; +CHAR8 *gzStringDataOverride=NULL; +BOOLEAN gfCapturingVideo = FALSE; #endif -HINSTANCE ghInstance; +HINSTANCE ghInstance; #ifdef JA2 @@ -131,27 +135,27 @@ RECT rcWindow; POINT ptWindowSize; // moved from header file: 24mar98:HJH -UINT32 giStartMem; -//UINT8 gbPixelDepth; // redefintion... look down a few lines (jonathanl) +UINT32 giStartMem; +//UINT8 gbPixelDepth; // redefintion... look down a few lines (jonathanl) // GLOBAL RUN-TIME SETTINGS -UINT32 guiMouseWheelMsg; // For mouse wheel messages +UINT32 guiMouseWheelMsg; // For mouse wheel messages -BOOLEAN gfApplicationActive; -BOOLEAN gfProgramIsRunning; -BOOLEAN gfGameInitialized = FALSE; -//UINT32 giStartMem; // redefintion... look up a few lines (jonathanl) -BOOLEAN gfDontUseDDBlits = FALSE; +BOOLEAN gfApplicationActive; +BOOLEAN gfProgramIsRunning; +BOOLEAN gfGameInitialized = FALSE; +//UINT32 giStartMem; // redefintion... look up a few lines (jonathanl) +BOOLEAN gfDontUseDDBlits = FALSE; // There were TWO of them??!?! -- DB -//CHAR8 gzCommandLine[ 100 ]; -CHAR8 gzCommandLine[100]; // Command line given +//CHAR8 gzCommandLine[ 100 ]; +CHAR8 gzCommandLine[100]; // Command line given -CHAR8 gzErrorMsg[2048]=""; -BOOLEAN gfIgnoreMessages=FALSE; +CHAR8 gzErrorMsg[2048]=""; +BOOLEAN gfIgnoreMessages=FALSE; // GLOBAL VARIBLE, SET TO DEFAULT BUT CAN BE CHANGED BY THE GAME IF INIT FILE READ -UINT8 gbPixelDepth = PIXEL_DEPTH; +UINT8 gbPixelDepth = PIXEL_DEPTH; INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam) { @@ -171,7 +175,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP if ( Message == guiMouseWheelMsg ) { QueueEvent(MOUSE_WHEEL, wParam, lParam); - return( 0L ); + return( 0L ); } switch(Message) @@ -188,8 +192,8 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP */ #ifdef JA2 case WM_MOVE: -// if( 1==iScreenMode ) - { + // if( 1==iScreenMode ) + { GetClientRect(hWindow, &rcWindow); // Go ahead and clamp the client width and height rcWindow.right = SCREEN_WIDTH; @@ -214,7 +218,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP SetWindowPos( hWindow, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); } - } + } break; case WM_GETMINMAXINFO: { @@ -226,21 +230,21 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP break; } #else - case WM_MOUSEMOVE: - break; + case WM_MOUSEMOVE: + break; - case WM_SIZING: + case WM_SIZING: { - LPRECT lpWindow; + LPRECT lpWindow; INT32 iWidth, iHeight, iX, iY; - BOOLEAN fWidthByHeight=FALSE, fHoldRight=FALSE; + BOOLEAN fWidthByHeight=FALSE, fHoldRight=FALSE; - lpWindow = (LPRECT) lParam; + lpWindow = (LPRECT) lParam; - iWidth=lpWindow->right-lpWindow->left; - iHeight=lpWindow->bottom-lpWindow->top; - iX = (lpWindow->left + lpWindow->right)/2; - iY = (lpWindow->top + lpWindow->bottom)/2; + iWidth = lpWindow->right-lpWindow->left; + iHeight = lpWindow->bottom-lpWindow->top; + iX = (lpWindow->left + lpWindow->right)/2; + iY = (lpWindow->top + lpWindow->bottom)/2; switch(wParam) { @@ -303,7 +307,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP lpWindow->bottom = lpWindow->top + iHeight; } - /* switch(wParam) { @@ -311,7 +314,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WMSZ_BOTTOMLEFT: case WMSZ_BOTTOMRIGHT: if(iHeight < SCREEN_HEIGHT) + { lpWindow->bottom=lpWindow->top+SCREEN_HEIGHT; + } } switch(wParam) @@ -320,7 +325,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WMSZ_TOPLEFT: case WMSZ_TOPRIGHT: if(iHeight < SCREEN_HEIGHT) + { lpWindow->top=lpWindow->bottom-SCREEN_HEIGHT; + } } switch(wParam) @@ -329,7 +336,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WMSZ_LEFT: case WMSZ_TOPLEFT: if(iWidth < SCREEN_WIDTH) + { lpWindow->left=lpWindow->right-SCREEN_WIDTH; + } } switch(wParam) @@ -338,7 +347,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WMSZ_RIGHT: case WMSZ_TOPRIGHT: if(iWidth < SCREEN_WIDTH) + { lpWindow->right=lpWindow->left+SCREEN_WIDTH; + } } */ } @@ -367,8 +378,8 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WM_MOVE: { - INT32 xPos = (INT32)LOWORD(lParam); // horizontal position - INT32 yPos = (INT32)HIWORD(lParam); // vertical position + INT32 xPos = (INT32)LOWORD(lParam); // horizontal position + INT32 yPos = (INT32)HIWORD(lParam); // vertical position } break; #endif @@ -380,12 +391,11 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP #ifdef LUACONSOLE PollConsole( ); #endif - if (gfApplicationActive) { - GameLoop(); + GameLoop(); } - break; + break; case WM_ACTIVATEAPP: switch(wParam) @@ -394,122 +404,132 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP if (fRestore == TRUE) { #ifdef JA2 - RestoreVideoManager(); - RestoreVideoSurfaces(); // Restore any video surfaces - - // unpause the JA2 Global clock - if ( !gfPauseDueToPlayerGamePause ) - { - PauseTime( FALSE ); - } -#else - if(!VideoInspectorIsEnabled()) - { - RestoreVideoManager(); + RestoreVideoManager(); RestoreVideoSurfaces(); // Restore any video surfaces - } - MoveTimer(TIMER_RESUME); + // unpause the JA2 Global clock + if ( !gfPauseDueToPlayerGamePause ) + { + PauseTime( FALSE ); + } +#else + if(!VideoInspectorIsEnabled()) + { + RestoreVideoManager(); + RestoreVideoSurfaces(); // Restore any video surfaces + } + + MoveTimer(TIMER_RESUME); #endif - gfApplicationActive = TRUE; + gfApplicationActive = TRUE; } break; case FALSE: // We are suspending direct draw - if (iScreenMode == 0) { #ifdef JA2 - // pause the JA2 Global clock - //PauseTime( TRUE ); - SuspendVideoManager(); + // pause the JA2 Global clock + //PauseTime( TRUE ); + SuspendVideoManager(); #else #ifndef UTIL - if(!VideoInspectorIsEnabled()) - SuspendVideoManager(); + if(!VideoInspectorIsEnabled()) + { + SuspendVideoManager(); + } #endif #endif - // suspend movement timer, to prevent timer crash if delay becomes long - // * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized - // * restore is automatic, no need to do anything on reactivation + // suspend movement timer, to prevent timer crash if delay becomes long + // * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized + // * restore is automatic, no need to do anything on reactivation #if !defined( JA2 ) && !defined( UTIL ) - MoveTimer(TIMER_SUSPEND); + MoveTimer(TIMER_SUSPEND); #endif - - // gfApplicationActive = FALSE; - fRestore = TRUE; + // gfApplicationActive = FALSE; + fRestore = TRUE; } break; } break; - case WM_CREATE: + case WM_CREATE: break; case WM_DESTROY: - ShutdownStandardGamingPlatform(); + ShutdownStandardGamingPlatform(); // ShowCursor(TRUE); PostQuitMessage(0); break; - case WM_SETFOCUS: - //if (iScreenMode == 0) - { + case WM_SETFOCUS: + //if (iScreenMode == 0) + { #if !defined( JA2 ) && !defined( UTIL ) if(!VideoInspectorIsEnabled()) + { RestoreVideoManager(); + } gfApplicationActive=TRUE; // RestrictMouseToXYXY(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); #else - RestoreCursorClipRect( ); + RestoreCursorClipRect( ); #endif - } - break; + } + break; - case WM_KILLFOCUS: - if (iScreenMode == 0) - { + case WM_KILLFOCUS: + if (iScreenMode == 0) + { #if !defined( JA2 ) && !defined( UTIL ) if(!VideoInspectorIsEnabled()) + { SuspendVideoManager(); - + } gfApplicationActive=FALSE; FreeMouseCursor(); #endif // Set a flag to restore surfaces once a WM_ACTIVEATEAPP is received fRestore = TRUE; - } - break; - + } + break; #if defined( JA2 ) - case WM_DEVICECHANGE: - { - //DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam; + case WM_DEVICECHANGE: + { + //DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam; - ////if a device has been removed - //if( wParam == DBT_DEVICEREMOVECOMPLETE ) - //{ - // //if its a disk - // if( pHeader->dbch_devicetype == DBT_DEVTYP_VOLUME ) - // { - // //check to see if the play cd is still in the cdrom - // if( !CheckIfGameCdromIsInCDromDrive() ) - // { - // } - // } - //} - } - break; + ////if a device has been removed + //if( wParam == DBT_DEVICEREMOVECOMPLETE ) + //{ + // //if its a disk + // if( pHeader->dbch_devicetype == DBT_DEVTYP_VOLUME ) + // { + // //check to see if the play cd is still in the cdrom + // if( !CheckIfGameCdromIsInCDromDrive() ) + // { + // } + // } + //} + } + break; #endif - case WM_SYSKEYUP: - case WM_KEYUP: - KeyUp(wParam, lParam); - break; + case WM_SYSKEYUP: + case WM_KEYUP: + KeyUp(wParam, lParam); + break; - case WM_SYSKEYDOWN: - case WM_KEYDOWN: - KeyDown(wParam, lParam); + case WM_SYSKEYDOWN: + case WM_KEYDOWN: +#ifdef USE_CODE_PAGE + if(s_DebugKeyboardInput) + { + static CLog& debugKeys = *CLog::Create(L"DebugKeys.txt"); + static int input_counter = 1; + debugKeys << (input_counter++) << " : " << (int)wParam << CLog::endl; + } +#endif // USE_CODE_PAGE + KeyDown(wParam, lParam); gfSGPInputReceived = TRUE; break; @@ -528,7 +548,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP #endif } } - // Reset the pressed keys gfKeyState[ ALT ] = FALSE; gfKeyState[ CTRL ] = FALSE; @@ -551,8 +570,8 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP cout << "> "; } break; - default - : return DefWindowProc(hWindow, Message, wParam, lParam); + default : + return DefWindowProc(hWindow, Message, wParam, lParam); } return 0L; } @@ -609,7 +628,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing Memory Manager"); // Initialize the Memory Manager if (InitializeMemoryManager() == FALSE) - { // We were unable to initialize the memory manager + { + // We were unable to initialize the memory manager FastDebugMsg("FAILED : Initializing Memory Manager"); return FALSE; } @@ -618,7 +638,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing Mutex Manager"); // Initialize the Dirty Rectangle Manager if (InitializeMutexManager() == FALSE) - { // We were unable to initialize the game + { + // We were unable to initialize the game FastDebugMsg("FAILED : Initializing Mutex Manager"); return FALSE; } @@ -627,7 +648,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing File Manager"); // Initialize the File Manager if (InitializeFileManager(NULL) == FALSE) - { // We were unable to initialize the file manager + { + // We were unable to initialize the file manager FastDebugMsg("FAILED : Initializing File Manager"); return FALSE; } @@ -638,7 +660,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing Input Manager"); // Initialize the Input Manager if (InitializeInputManager() == FALSE) - { // We were unable to initialize the input manager + { + // We were unable to initialize the input manager FastDebugMsg("FAILED : Initializing Input Manager"); return FALSE; } @@ -646,7 +669,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing Video Manager"); // Initialize DirectDraw (DirectX 2) if (InitializeVideoManager(hInstance, (UINT16) sCommandShow, (void *) WindowProcedure) == FALSE) - { // We were unable to initialize the video manager + { + // We were unable to initialize the video manager FastDebugMsg("FAILED : Initializing Video Manager"); return FALSE; } @@ -654,7 +678,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) // Initialize Video Object Manager FastDebugMsg("Initializing Video Object Manager"); if ( !InitializeVideoObjectManager( ) ) - { + { FastDebugMsg("FAILED : Initializing Video Object Manager"); return FALSE; } @@ -674,17 +698,9 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) STRING512 sExecutableDir; GetExecutableDirectory( sExecutableDir ); - //vfs::Path fullpath = vfs::Path(sExecutableDir) + vfs::Path("vfs_config.ini"); - // set current directory to exe's directory SetCurrentDirectory(sExecutableDir); - //if(!InitVirtualFileSystem( fullpath )) - //{ - // FastDebugMsg("FAILED : Initializing Virtual File System"); - // return FALSE; - //} - //THROWIFFALSE( InitVirtualFileSystem( fullpath ), L"Initializing Virtual File System failed"); THROWIFFALSE( InitVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed"); s_VfsIsInitialized = true; @@ -693,6 +709,25 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) GetVFS()->GetVirtualLocation(vfs::Path("ShadeTables"),true)->SetIsExclusive(true); GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_SAVEDIRECTORY]+3),true)->SetIsExclusive(true); GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_MPSAVEDIRECTORY]+3),true)->SetIsExclusive(true); + +#ifdef USE_CODE_PAGE + charSet::InitializeCharSets(); + + if(!s_CodePage.empty()) + { + try + { + CodePageReader cpr; + cpr.ReadCodePage(s_CodePage); + } + catch(CBasicException& ex) + { + std::wstringstream wss; + wss << L"Could not process codepage file \"" << s_CodePage() << L"\""; + RETHROWEXCEPTION(wss.str().c_str(), &ex); + } + } +#endif // USE_CODE_PAGE #else // Snap: moved the following from InitJA2SplashScreen for clarity STRING512 CurrentDir; @@ -719,13 +754,14 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) // Snap: Get the custom Data directory location from ja2.ini (if any) // and initialize the custom catalogue char customDataPath[MAX_PATH]; - if ( GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, "..\\Ja2.ini" ) ) { + if ( GetPrivateProfileString( "Ja2 Settings","CUSTOM_DATA_LOCATION", "", customDataPath, MAX_PATH, "..\\Ja2.ini" ) ) + { gCustomDataCat.NewCat(std::string(CurrentDir) + '\\' + customDataPath); } #endif - //#ifdef JA2 - InitJA2SplashScreen(); - //#endif +//#ifdef JA2 + InitJA2SplashScreen(); +//#endif // Make sure we start up our local clock (in milliseconds) // We don't need to check for a return value here since so far its always TRUE @@ -742,7 +778,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing the Font Manager"); // Init the manager and copy the TransTable stuff into it. if ( !InitializeFontManager( 8, pFontTable ) ) - { + { FastDebugMsg("FAILED : Initializing Font Manager"); return FALSE; } @@ -753,10 +789,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) // Initialize the Sound Manager (DirectSound) #ifndef UTIL if (InitializeSoundManager() == FALSE) - { // We were unable to initialize the sound manager + { + // We were unable to initialize the sound manager FastDebugMsg("FAILED : Initializing Sound Manager"); return FALSE; - } + } #endif FastDebugMsg("Initializing Random"); @@ -766,7 +803,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) FastDebugMsg("Initializing Game Manager"); // Initialize the Game if (InitializeGame() == FALSE) - { // We were unable to initialize the game + { + // We were unable to initialize the game FastDebugMsg("FAILED : Initializing Game Manager"); return FALSE; } @@ -779,7 +817,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) if(!exlist.empty()) { RETHROWEXCEPTION(L"Error during reading runtime settings", &exlist.front()); - } + } return TRUE; } @@ -812,7 +850,7 @@ void ShutdownStandardGamingPlatform(void) if (gfGameInitialized) { - ShutdownGame(); + ShutdownGame(); } @@ -925,19 +963,19 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC //_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF); /****************************************************************************************************/ - /* */ - /* DEBUG MEMORY ALLOCATION ON THE HEAP : uncomment when required */ - /* ------------------------------------------------------------------------ */ - /* */ - /* _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_1024_DF); */ - /* */ - /****************************************************************************************************/ + /* */ + /* DEBUG MEMORY ALLOCATION ON THE HEAP : uncomment when required */ + /* ------------------------------------------------------------------------ */ + /* */ + /*.._CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_EVERY_1024_DF); */ + /* */ + /****************************************************************************************************/ #endif ghInstance = hInstance; - // Copy commandline! + // Copy commandline! #ifdef JA2 strncpy( gzCommandLine, pCommandLine, 100); gzCommandLine[99]='\0'; @@ -961,8 +999,9 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC #else if(!RunSetup()) + { return(0); - + } #endif // ShowCursor(FALSE); @@ -1002,7 +1041,7 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC FastDebugMsg("Initializing the Font Manager"); // Init the manager and copy the TransTable stuff into it. if ( !InitializeFontManager( 8, pFontTable ) ) - { + { FastDebugMsg("FAILED : Initializing Font Manager"); return FALSE; } @@ -1044,7 +1083,7 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC #ifdef LUACONSOLE if (1==iScreenMode) { - CreateConsole(); + CreateConsole(); } #endif @@ -1107,21 +1146,24 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC #if 0 else - { // Windows hasn't processed any messages, therefore we handle the rest + { + // Windows hasn't processed any messages, therefore we handle the rest #ifdef LUACONSOLE PollConsole( ); #endif if (gfApplicationActive == FALSE) - { // Well we got nothing to do but to wait for a message to activate - WaitMessage(); - } + { + // Well we got nothing to do but to wait for a message to activate + WaitMessage(); + } else - { // Well, the game is active, so we handle the game stuff - GameLoop(); + { + // Well, the game is active, so we handle the game stuff + GameLoop(); - // After this frame, reset input given flag - gfSGPInputReceived = FALSE; + // After this frame, reset input given flag + gfSGPInputReceived = FALSE; } } } @@ -1158,7 +1200,7 @@ void SGPExit(void) #if !defined( JA2 ) && !defined( UTIL ) if (gfGameInitialized) { -// ARM: if in DEBUG mode & we've ShutdownWithErrorBox, don't unload screens and release data structs to permit easier debugging + // ARM: if in DEBUG mode & we've ShutdownWithErrorBox, don't unload screens and release data structs to permit easier debugging #ifdef _DEBUG if (gfIgnoreMessages) { @@ -1289,6 +1331,11 @@ void GetRuntimeSettings( ) // WANNE: Should we play the intro? iPlayIntro = oProps.GetIntProperty("Ja2 Settings","PLAY_INTRO", iPlayIntro); + +#ifdef USE_CODE_PAGE + s_DebugKeyboardInput = oProps.GetBoolProperty(L"Ja2 Settings", L"DEBUG_KEYS", false); + s_CodePage = oProps.GetStringProperty(L"Ja2 Settings", L"CODE_PAGE"); +#endif // USE_CODE_PAGE #endif } @@ -1305,19 +1352,20 @@ void ShutdownWithErrorBox(CHAR8 *pcMessage) void ProcessCommandLine(CHAR8 *pCommandLine) { -CHAR8 cSeparators[]="\t ="; -CHAR8 *pCopy=NULL, *pToken; + CHAR8 cSeparators[] = "\t ="; + CHAR8 *pCopy=NULL, *pToken; - pCopy=(CHAR8 *)MemAlloc(strlen(pCommandLine) + 1); + pCopy = (CHAR8 *)MemAlloc(strlen(pCommandLine) + 1); Assert(pCopy); if(!pCopy) + { return; - + } memcpy(pCopy, pCommandLine, strlen(pCommandLine)+1); pToken=strtok(pCopy, cSeparators); - while(pToken) + while(pToken) { if(!_strnicmp(pToken, "/NOSOUND", 8)) { @@ -1368,8 +1416,9 @@ CHAR8 *pCopy=NULL, *pToken; BOOLEAN RunSetup(void) { if(!FileExists(VideoGetConfigFile())) + { _spawnl(_P_WAIT, "3DSetup.EXE", "3DSetup.EXE", VideoGetConfigFile(), NULL); - + } return(FileExists(VideoGetConfigFile())); } @@ -1391,7 +1440,7 @@ void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine) memcpy(pCopy, pCommandLine, strlen(pCommandLine)+1); pToken=strtok(pCopy, cSeparators); - while(pToken) + while(pToken) { //if its the NO SOUND option if(!_strnicmp(pToken, "/NOSOUND", 8)) @@ -1403,20 +1452,20 @@ void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine) { //overwrite Graphic setting from JA2_settings.ini iScreenMode=0; /* 1 for Windowed, 0 for Fullscreen */ - bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ - /* no resolution read from Args. Still from INI, but could be added here, too...*/ + bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ + /* no resolution read from Args. Still from INI, but could be added here, too...*/ } else if(!_strnicmp(pToken, "/WINDOW", 7)) { //overwrite Graphic setting from JA2_settings.ini iScreenMode=1; /* 1 for Windowed, 0 for Fullscreen */ - bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ - /* no resolution read from Args. Still from INI, but could be added here, too...*/ + bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */ + /* no resolution read from Args. Still from INI, but could be added here, too...*/ } - //get the next token + //get the next token pToken=strtok(NULL, cSeparators); } MemFree(pCopy); -} \ No newline at end of file +} diff --git a/Standard Gaming Platform/soundman.cpp b/Standard Gaming Platform/soundman.cpp index eb7d65aab..735b4a616 100644 --- a/Standard Gaming Platform/soundman.cpp +++ b/Standard Gaming Platform/soundman.cpp @@ -1801,8 +1801,8 @@ UINT32 uiCount; return(FALSE); } -#include "vfs.h" -#include "PropertyContainer.h" +#include "VFS/vfs.h" +#include "VFS/Tools/Log.h" // Lesh modifications // Sound debug diff --git a/Standard Gaming Platform/video.cpp b/Standard Gaming Platform/video.cpp index 6e8969ab9..44fd386e2 100644 --- a/Standard Gaming Platform/video.cpp +++ b/Standard Gaming Platform/video.cpp @@ -21,6 +21,8 @@ #endif #include "resource.h" +#include "VFS/vfs.h" +#include "VFS/vfs_file_raii.h" #ifndef _MT #define _MT @@ -1907,7 +1909,9 @@ void RefreshScreen(void *DummyVariable) LPDIRECTDRAWSURFACE _pTmpBuffer; LPDIRECTDRAWSURFACE2 pTmpBuffer; DDSURFACEDESC SurfaceDescription; +#ifndef USE_VFS FILE *OutputFile; +#endif CHAR8 FileName[64]; INT32 iIndex; STRING512 DataDir; @@ -1915,10 +1919,11 @@ void RefreshScreen(void *DummyVariable) UINT16 *p16BPPData; // Snap: save current directory +#ifndef USE_VFS GetFileManCurrentDirectory( DataDir ); GetExecutableDirectory( ExecDir ); SetFileManCurrentDirectory( ExecDir ); - +#endif // // Create temporary system memory surface. This is used to correct problems with the backbuffer // surface which can be interlaced or have a funky pitch @@ -1968,12 +1973,24 @@ void RefreshScreen(void *DummyVariable) { sprintf( FileName, "SCREEN%03d.TGA", guiPrintFrameBufferIndex++); } +#ifndef USE_VFS while( (_access( FileName, 0 )) != -1 ); +#else + while(FileExists(FileName)); +#endif +#ifndef USE_VFS if ((OutputFile = fopen( FileName, "wb")) != NULL) { fprintf(OutputFile, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, LOBYTE(SCREEN_WIDTH), HIBYTE(SCREEN_WIDTH), LOBYTE(SCREEN_HEIGHT), HIBYTE(SCREEN_HEIGHT), 0x10, 0); - +#else + try + { + vfs::COpenWriteFile wfile(FileName,true,true); + char head[] = {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, LOBYTE(SCREEN_WIDTH), HIBYTE(SCREEN_WIDTH), LOBYTE(SCREEN_HEIGHT), HIBYTE(SCREEN_HEIGHT), 0x10, 0}; + vfs::UInt32 io; + wfile.file().Write(head,18,io); +#endif // // Lock temp surface @@ -2010,11 +2027,19 @@ void RefreshScreen(void *DummyVariable) ConvertRGBDistribution565To555( p16BPPData, SCREEN_WIDTH ); // Write +#ifndef USE_VFS fwrite( p16BPPData, SCREEN_WIDTH * 2, 1, OutputFile); +#else + wfile.file().Write((vfs::Byte*)p16BPPData, SCREEN_WIDTH * 2, io); +#endif } else { +#ifndef USE_VFS fwrite((void *)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2, 1, OutputFile); +#else + wfile.file().Write((vfs::Byte*)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2, io); +#endif } } @@ -2023,9 +2048,9 @@ void RefreshScreen(void *DummyVariable) { MemFree( p16BPPData ); } - +#ifndef USE_VFS fclose(OutputFile); - +#endif // // Unlock temp surface // @@ -2038,6 +2063,10 @@ void RefreshScreen(void *DummyVariable) DirectXAttempt ( ReturnCode, __LINE__, __FILE__ ); } } + catch(CBasicException& ex) + { + RETHROWEXCEPTION(L"",&ex); + } // // Release temp surface @@ -2045,11 +2074,12 @@ void RefreshScreen(void *DummyVariable) gfPrintFrameBuffer = FALSE; IDirectDrawSurface2_Release(pTmpBuffer); - +#ifndef USE_VFS // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); //strcat( ExecDir, "\\Data" ); //SetFileManCurrentDirectory( ExecDir ); +#endif } // @@ -3306,58 +3336,81 @@ void RefreshMovieCache( ) { TARGA_HEADER Header; INT32 iCountX, iCountY; +#ifndef USE_VFS FILE *disk; +#endif CHAR8 cFilename[_MAX_PATH]; static UINT32 uiPicNum=0; UINT16 *pDest; INT32 cnt; +#ifndef USE_VFS STRING512 DataDir; STRING512 ExecDir; - +#endif PauseTime( TRUE ); - +#ifndef USE_VFS // Snap: save current directory GetFileManCurrentDirectory( DataDir ); GetExecutableDirectory( ExecDir ); SetFileManCurrentDirectory( ExecDir ); - +#else + try + { +#endif for ( cnt = 0; cnt < giNumFrames; cnt++ ) { sprintf( cFilename, "JA%5.5d.TGA", uiPicNum++ ); - +#ifndef USE_VFS if( ( disk = fopen(cFilename, "wb"))==NULL ) return; - +#else + vfs::COpenWriteFile wfile(cFilename, true, true); +#endif memset(&Header, 0, sizeof(TARGA_HEADER)); Header.ubTargaType=2; // Uncompressed 16/24/32 bit Header.usImageWidth=SCREEN_WIDTH; Header.usImageHeight=SCREEN_HEIGHT; Header.ubBitsPerPixel=16; - +#ifndef USE_VFS fwrite(&Header, sizeof(TARGA_HEADER), 1, disk); - +#else + vfs::UInt32 io; + wfile.file().Write((vfs::Byte*)&Header, sizeof(TARGA_HEADER), io); +#endif pDest = gpFrameData[ cnt ]; for(iCountY=SCREEN_HEIGHT-1; iCountY >=0 ; iCountY-=1) { for(iCountX=0; iCountX < SCREEN_WIDTH; iCountX ++ ) { +#ifndef USE_VFS fwrite( ( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16), 1, disk); +#else + wfile.file().Write( (vfs::Byte*)( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16), io); +#endif } } - +#ifndef USE_VFS fclose(disk); +#endif } PauseTime( FALSE ); giNumFrames = 0; - +#ifndef USE_VFS // Snap: Restore the data directory once we are finished. SetFileManCurrentDirectory( DataDir ); //strcat( ExecDir, "\\Data" ); //SetFileManCurrentDirectory( ExecDir ); +#else + } + catch(CBasicException& ex) + { + LogException(ex); + } +#endif } diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index 4f8346f78..1d9750439 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -4562,8 +4562,8 @@ void HourlyCheckStrategicAI() #ifdef JA2BETAVERSION -#include "vfs.h" -#include "PropertyContainer.h" +#include "VFS/vfs.h" +#include "VFS/Tools/Log.h" static CLog& s_stratD = *CLog::Create(L"Strategic Decisions.txt", true); diff --git a/Utils/Debug Control.cpp b/Utils/Debug Control.cpp index 7e4a7566e..a444d3e87 100644 --- a/Utils/Debug Control.cpp +++ b/Utils/Debug Control.cpp @@ -6,8 +6,8 @@ #include "stdio.h" #endif -#include "vfs.h" -#include "PropertyContainer.h" +#include "VFS/vfs.h" +#include "VFS/Tools/Log.h" #ifdef _ANIMSUBSYSTEM_DEBUG diff --git a/Utils/Multi Language Graphic Utils.cpp b/Utils/Multi Language Graphic Utils.cpp index e2847f8c4..5d8688448 100644 --- a/Utils/Multi Language Graphic Utils.cpp +++ b/Utils/Multi Language Graphic Utils.cpp @@ -406,7 +406,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) break; case MLG_MP_GOLDPIECEBUTTONS: sprintf( filename, "%s\\MPGOLDPIECEBUTTONS_%s.sti", zLanguage, zLanguage ); - break; + break default: return FALSE; } diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 9ccc3c736..23180e247 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -21,6 +21,8 @@ #include "Sound Control.h" #endif +#include "VFS/Tools/ParserTools.h" + STR16 szClipboard; BOOLEAN gfNoScroll = FALSE; @@ -943,7 +945,11 @@ BOOLEAN HandleTextInput( InputAtom *Event ) UINT32 key = Event->usParam; UINT16 type = gpActive->usInputType; //Handle space key +#ifndef USE_CODE_PAGE if( key == SPACE && type & INPUTTYPE_SPACES ) +#else + if( charSet::IsFromSet(key, charSet::CS_SPACE) && type & INPUTTYPE_SPACES ) +#endif { AddChar( key ); return TRUE; @@ -955,7 +961,11 @@ BOOLEAN HandleTextInput( InputAtom *Event ) return TRUE; } //Handle numerics +#ifndef USE_CODE_PAGE if( key >= '0' && key <= '9' && type & INPUTTYPE_NUMERICSTRICT ) +#else + if( charSet::IsFromSet(key, charSet::CS_NUMERIC) && type & INPUTTYPE_NUMERICSTRICT ) +#endif { AddChar( key ); return TRUE; @@ -963,17 +973,25 @@ BOOLEAN HandleTextInput( InputAtom *Event ) //Handle alphas if( type & INPUTTYPE_ALPHA ) { +#ifndef USE_CODE_PAGE if( key >= 'A' && key <= 'Z' ) +#else + if( charSet::IsFromSet(key, charSet::CS_ALPHA_UC) ) +#endif { if( type & INPUTTYPE_LOWERCASE ) - key -= 32; + key -= 32; // won't work for non-ascii alpha characters AddChar( key ); return TRUE; } +#ifndef USE_CODE_PAGE if( key >= 'a' && key <= 'z' ) +#else + if( charSet::IsFromSet(key, charSet::CS_ALPHA_LC) ) +#endif { if( type & INPUTTYPE_UPPERCASE ) - key += 32; + key += 32; // won't work for non-ascii alpha characters AddChar( key ); return TRUE; } @@ -982,10 +1000,14 @@ BOOLEAN HandleTextInput( InputAtom *Event ) if( type & INPUTTYPE_SPECIAL ) { //More can be added, but not all of the fonts support these +#ifndef USE_CODE_PAGE if( key >= 0x21 && key <= 0x2f || // ! " # $ % & ' ( ) * + , - . / key >= 0x3a && key <= 0x40 || // : ; < = > ? @ key >= 0x5b && key <= 0x5f || // [ \ ] ^ _ key >= 0x7b && key <= 0x7d ) // { | } +#else + if( charSet::IsFromSet(key, charSet::CS_SPECIAL_ALPHA|charSet::CS_SPECIAL_NON_CHAR) ) +#endif { AddChar( key ); return TRUE; diff --git a/Utils/message.cpp b/Utils/message.cpp index 50abfd261..921dab7ff 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -27,7 +27,7 @@ #endif #include "VFS/vfs.h" -#include "PropertyContainer.h" +#include "VFS/Tools/Log.h" typedef struct { diff --git a/VFS/PropertyContainer.cpp b/VFS/PropertyContainer.cpp index 63dc702b2..b0e24b987 100644 --- a/VFS/PropertyContainer.cpp +++ b/VFS/PropertyContainer.cpp @@ -6,211 +6,12 @@ #include "vfs_file_raii.h" #include "iteratedir.h" +#include "Tools/Tools.h" +#include "Tools/ParserTools.h" + #include #include -static const vfs::UInt32 BUFFER_SIZE = 1024; - -class CReadLine -{ -public: - CReadLine(vfs::tReadableFile& rFile) : _file(rFile), _buffer_pos(0), _eof(false) - { - memset(_buffer,0,sizeof(_buffer)); - FillBuffer(); - vfs::UByte utf8bom[3] = {0xef,0xbb,0xbf}; - if(memcmp(utf8bom, &_buffer[0],3) == 0) - { - _buffer_pos += 3; - } - }; - bool FillBuffer() - { - if(!_eof) - { - // reading can be done byte-wise or line-wise. - // we have no control over this here, so we have to account for both cases. - - vfs::UInt32 read = 0; - // fill the buffer from the start, BUFFER_SIZE charactes at max (_buffer has BUFFER_SIZE+1 elements) - _eof = !_file.Read(&_buffer[0],BUFFER_SIZE,read); - // if read() fails, it means that we are at the end of the file, - // but we probably have read a couple of valid bytes, so we need to do one last 'correct' run - - // bite-wise read files usually terminate a line with \n (or \r\n on WIN32) - // line-wise read files just returns 0-terminated string - - // always terminate the string with 0 - _buffer[read] = 0; - - _buffer_pos = 0; - _buffer_last = read; - return true; - } - return false; - } - bool FromBuffer(std::string& line) - { - bool done = false; - while(!done) - { - if(_buffer_pos < _buffer_last) - { - // start where we left last time - vfs::Byte *temp = &_buffer[_buffer_pos]; - vfs::UInt32 start_pos = _buffer_pos; - // go until we hit 0. since our buffer is always 0 terminated, the second test should be redundant. - while(*temp && (_buffer_pos < _buffer_last)) - { - // stop when we find a line terminator - if(*temp == '\n' || *temp == '\r' /* || *temp == '\0' */) - { - break; - } - temp++; - _buffer_pos++; - } - // need to append substring, as we might have refilles the buffer (because there was no \n or \r\n terminator) - line.append( (char*)&_buffer[start_pos], _buffer_pos - start_pos ); - - // if we reach the (real) end of the buffer (that always terminate with 0), this means - // that there was no line terminator and that we have to refill the buffer. - if( _buffer_pos < BUFFER_SIZE && (*temp == '\n' || *temp == '\r' || *temp == 0) ) - { - // found the line terminator - if(*temp == '\r') - { - // the \r is most probably followed by \n. 'swallow' both characters - *temp++; - _buffer_pos++; - if( (_buffer_pos < BUFFER_SIZE) && (*temp == '\n' || *temp == 0) ) - { - // increase buffer position, so that we can start with a valid character in the next run - _buffer_pos++; - return true; - } - else - { - done = !FillBuffer(); - } - } - else if(*temp == '\n' || *temp == 0) - { - // increase buffer position, so that we can start with a valid character in the next run - _buffer_pos++; - return true; - } - } - else - { - done = !FillBuffer(); - } - } - else - { - done = !FillBuffer(); - } - } - return false; - } - bool GetLine(std::string& line) - { - line.clear(); - return FromBuffer(line); - } -private: - vfs::Byte _buffer[BUFFER_SIZE+1]; - vfs::tReadableFile& _file; - vfs::UInt32 _buffer_pos; - vfs::UInt32 _buffer_last; - bool _eof; -}; - -template -bool ConvertTo(utf8string const& sStr, T_ &rVal) -{ - std::wstringstream ss; - ss.str(sStr.c_wcs()); - if(!(ss >> rVal)) - { - return false; - } - return true; -} - -template -utf8string ToStringList(std::list const& rValList) -{ - std::wstringstream ss; - typename std::list::const_iterator cit = rValList.begin(); - if(cit != rValList.end()) - { - ss << *cit; - cit++; - for(;cit != rValList.end(); ++cit) - { - ss << L" , " << *cit; - } - } - if(!ss) - { - return L""; - } - return ss.str(); -} -template<> -utf8string ToStringList(std::list const& rValList) -{ - std::wstringstream ss; - std::list::const_iterator cit = rValList.begin(); - if(cit != rValList.end()) - { - ss << (*cit); - cit++; - for(;cit != rValList.end(); ++cit) - { - ss << L" , " << (*cit); - } - } - if(!ss) - { - return L""; - } - return ss.str(); -} - -class CSplitStringList -{ -public: - CSplitStringList(utf8string const& sList) - : m_sList(sList), iCurrent(0),iNext(0) - {}; - ~CSplitStringList() {}; - - bool NextListEntry(utf8string &sEntry) - { - if(iNext >= 0) - { - iNext = m_sList.c_wcs().find_first_of(L",",iCurrent+1); - if(iNext > iCurrent) - { - sEntry.r_wcs().assign(vfs::TrimString(m_sList,iCurrent,iNext-1).c_wcs()); - iCurrent = iNext+1; - } - else - { - // last or only entry - sEntry.r_wcs().assign(vfs::TrimString(m_sList,iCurrent,m_sList.length()).c_wcs()); - } - return true; - } - return false; - } -private: - const utf8string m_sList; - int iCurrent,iNext; -}; - /*************************************************************************************/ /*************************************************************************************/ @@ -962,334 +763,3 @@ void CPropertyContainer::SetBoolListProperty(utf8string const& sSection, utf8str /**************************************************************************************************/ /**************************************************************************************************/ -bool CTransferRules::InitFromTxtFile(vfs::Path const& sPath) -{ - // try to open via VirtualFileSystem - if(GetVFS()->FileExists(sPath)) - { - return InitFromTxtFile(GetVFS()->GetRFile(sPath)); - } - else - { - // file doesn't exist or VFS not initialized yet - vfs::IBaseFile* pFile = new vfs::CTextFile(sPath); - if(pFile) - { - bool success = InitFromTxtFile(vfs::tReadableFile::Cast(pFile)); - delete pFile; - return success; - } - } - return false; -} - -bool CTransferRules::InitFromTxtFile(vfs::tReadableFile* pFile) -{ - if(pFile && pFile->OpenRead()) - { - vfs::COpenReadFile rfile(pFile); - std::string sBuffer; - vfs::UInt32 line_counter = 0; - CReadLine rl(*pFile); - while(rl.GetLine(sBuffer)) - { - line_counter++; - // very simple parsing : key = value - if(!sBuffer.empty()) - { - // remove leading white spaces - int iStart = sBuffer.find_first_not_of(" \t",0); - char first = sBuffer.at(iStart); - switch(first) - { - case '!': - case ';': - case '#': - // comment -> do nothing - break; - default: - int iEnd = sBuffer.find_first_of(" \t", iStart); - if(iEnd != std::string::npos) - { - SRule rule; - std::string action = sBuffer.substr(iStart, iEnd - iStart); - if( StrCmp::Equal(action, "deny") ) - { - rule.action = CTransferRules::DENY; - } - else if( StrCmp::Equal(action, "accept") ) - { - rule.action = CTransferRules::ACCEPT; - } - else - { - std::wstring trybuffer = L"Invalid UTF-8 character in string"; - IGNOREEXCEPTION( trybuffer = utf8string(sBuffer).c_wcs() ); /* just make sure we don't break off when string conversion fails */ - std::wstringstream wss; - wss << L"Unknown action in file \"" << pFile->GetFullPath()().c_wcs() - << L", line " << line_counter << " : " << utf8string(sBuffer).c_wcs(); - THROWEXCEPTION(wss.str().c_str()); - } - try - { - rule.pattern = vfs::Path(vfs::TrimString(sBuffer, iEnd, sBuffer.length())); - } - catch(CBasicException& ex) - { - std::wstringstream wss; - wss << L"Could not convert string, invalid utf8 encoding in file \"" << pFile->GetFullPath()().c_wcs() - << L"\", line " << line_counter; - RETHROWEXCEPTION(wss.str().c_str(),&ex); - } - m_listRules.push_back(rule); - } - break; - }; // end switch - } // end if (empty) - } // end while(!eof) - return true; - } - return false; -} - -void CTransferRules::SetDefaultAction(CTransferRules::EAction act) -{ - m_eDefaultAction = act; -} - -CTransferRules::EAction CTransferRules::GetDefaultAction() -{ - return m_eDefaultAction; -} - -CTransferRules::EAction CTransferRules::ApplyRule(utf8string const& sStr) -{ - tPatternList::iterator sit = m_listRules.begin(); - for(; sit != m_listRules.end(); ++sit) - { - if(MatchPattern(sit->pattern(), sStr)) - { - return sit->action; - } - } - return m_eDefaultAction; -} - -/********************************************************************/ -/********************************************************************/ -#ifdef WIN32 -const char CLog::endl[] = "\r\n"; -#else -const char CLog::endl[] = "\n"; -#endif - -std::list& CLog::_logs() -{ - static std::list logs; - return logs; -} - -CLog* CLog::Create(vfs::Path fileName, bool append, EFlushMode flushMode) -{ - _logs().push_back(new CLog(fileName, append, flushMode)); - return _logs().back(); -} -void CLog::FlushFinally() -{ - std::list::iterator it = _logs().begin(); - for(; it != _logs().end(); ++it) - { - delete *it; - } - _logs().clear(); -} - -void CLog::FlushAll() -{ - std::list::iterator it = _logs().begin(); - for(; it != _logs().end(); ++it) - { - (*it)->Flush(); - (*it)->_file = NULL; - } -} - - -CLog::CLog(vfs::Path fileName, bool append, EFlushMode flushMode) -: _filename(fileName), _file(NULL), _own_file(false), - _first_write(true), _flush_mode(flushMode), _append(append), - _buffer_size(0), _buffer_test_size(512) -{}; - -CLog::~CLog() -{ - _test_flush(true); - if(_file && _own_file) - { - delete _file; - } -} - -CLog& CLog::operator<<(unsigned int const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(unsigned short const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(unsigned char const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(int const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(short const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(char const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(float const& t) -{ - return PushNumber(t); -} -CLog& CLog::operator<<(double const& t) -{ - return PushNumber(t); -} - -CLog& CLog::operator<<(const char* t) -{ - _buffer << t; - _buffer_size += strlen(t); - _test_flush(); - return *this; -} -CLog& CLog::operator<<(const wchar_t* t) -{ - std::string s = utf8string::as_utf8(t); - _buffer << s; - _buffer_size += s.length(); - _test_flush(); - return *this; -} -CLog& CLog::operator<<(std::string const& t) -{ - _buffer << t; - _buffer_size += t.length(); - _test_flush(); - return *this; -} -CLog& CLog::operator<<(std::wstring const& t) -{ - std::string s = utf8string::as_utf8(t); - _buffer << s; - _buffer_size += s.length(); - _test_flush(); - return *this; -} -CLog& CLog::operator<<(utf8string const& t) -{ - std::string s = t.utf8(); - _buffer << s; - _buffer_size += s.length(); - _test_flush(); - return *this; -} - -CLog& CLog::Endl() -{ - _buffer << CLog::endl; - _buffer_size += sizeof(CLog::endl)-1; - _test_flush(); - return *this; -} - -void CLog::SetAppend(bool append) -{ - _append = append; -} - -void CLog::SetBufferSize(vfs::UInt32 bufferSize) -{ - _buffer_test_size = bufferSize; -} - -void CLog::_test_flush(bool force) -{ - if( (_flush_mode == FLUSH_IMMEDIATELY) || - (_flush_mode == FLUSH_BUFFER && _buffer_size > _buffer_test_size) || - (/*_flush_mode == FLUSH_ON_DELETE &&*/ force == true) ) - { - Flush(); - } -} - -#include -void CLog::Flush() -{ - vfs::UInt32 buflen = _buffer.str().length(); - if(buflen == 0) - { - return; - } - - if(!_file) - { - try - { - vfs::COpenWriteFile file_raii(_filename,true,!_append); - _file = &file_raii.file(); - file_raii.release(); - } - catch(CBasicException& ex) - { - LogException(ex); - // write file anyway - _file = vfs::tWriteableFile::Cast(new vfs::CFile(_filename)); - _file->OpenWrite(true,!_append); - _own_file = true; - } - } - - vfs::COpenWriteFile wfile(_file); - if(_append) - { - wfile.file().SetWriteLocation(0,vfs::IBaseFile::SD_END); - } - - vfs::UInt32 io; - if(_first_write) - { - time_t rawtime; - time ( &rawtime ); - std::string datetime(ctime(&rawtime)); - std::string s_out; - - vfs::UInt32 wloc = wfile.file().GetWriteLocation(); - if(wloc > 0) - { - s_out = CLog::endl; - } - s_out += " *** "; - s_out += datetime.substr(0,datetime.length()-1); - s_out += " *** "; - s_out += CLog::endl; - s_out += CLog::endl; - wfile.file().Write(s_out.c_str(), s_out.length(), io); - _first_write = false; - } - - wfile.file().Write(_buffer.str().c_str(), buflen, io); - _buffer.str(""); - _buffer.clear(); - _buffer_size = 0; - - _append = true; -} - diff --git a/VFS/PropertyContainer.h b/VFS/PropertyContainer.h index b2f9984c4..af355e8c2 100644 --- a/VFS/PropertyContainer.h +++ b/VFS/PropertyContainer.h @@ -104,115 +104,4 @@ private: tSections m_mapProps; }; -/*************************************************************/ -/*************************************************************/ - -class CTransferRules -{ -public: - enum EAction - { - DENY, - ACCEPT, - }; -public: - CTransferRules() : m_eDefaultAction(ACCEPT) {}; - - bool InitFromTxtFile(vfs::Path const& sPath); - bool InitFromTxtFile(vfs::tReadableFile* pFile); - - void SetDefaultAction(EAction act); - EAction GetDefaultAction(); - - EAction ApplyRule(utf8string const& sStr); -private: - struct SRule - { - EAction action; - vfs::Path pattern; - }; - typedef std::list tPatternList; - tPatternList m_listRules; - EAction m_eDefaultAction; -}; - -/*************************************************************/ -/*************************************************************/ - -template -std::basic_string ToString(ValueType const& rVal) -{ - std::basic_stringstream tss; - if( !(tss << rVal)) - { - return std::basic_string(); - } - return tss.str(); -} - -class CMemoryFile; -class CLog -{ -public: - enum EFlushMode - { - FLUSH_ON_DELETE, - FLUSH_BUFFER, - FLUSH_IMMEDIATELY, - }; -public: - - CLog(vfs::Path fileName, bool append = false, EFlushMode flushMode = FLUSH_ON_DELETE); - ~CLog(); - - static CLog* Create(vfs::Path fileName, bool append = false, EFlushMode flushMode = FLUSH_ON_DELETE); - static void FlushAll(); - static void FlushFinally(); - - CLog& operator<<(unsigned int const& t); - CLog& operator<<(unsigned short const& t); - CLog& operator<<(unsigned char const& t); - CLog& operator<<(int const& t); - CLog& operator<<(short const& t); - CLog& operator<<(char const& t); - CLog& operator<<(float const& t); - CLog& operator<<(double const& t); - - CLog& operator<<(const char* t); - CLog& operator<<(const wchar_t* t); - CLog& operator<<(std::string const& t); - CLog& operator<<(std::wstring const& t); - CLog& operator<<(utf8string const& t); - - CLog& Endl(); - static const char endl[]; - - void SetAppend(bool append = true); - void SetBufferSize(vfs::UInt32 bufferSize); - - void Flush(); -private: - void _test_flush(bool force=false); - - template - CLog& PushNumber(T_ const& t) - { - _buffer << ToString(t); - _buffer_size += sizeof(T_); - _test_flush(); - return *this; - } -private: - vfs::Path _filename; - vfs::tWriteableFile* _file; - bool _own_file; - bool _first_write; - EFlushMode _flush_mode; - bool _append; - vfs::UInt32 _buffer_size, _buffer_test_size; - std::stringstream _buffer; -private: - static std::list& _logs(); -}; - #endif // _PROPERTY_CONTAINER_H_ diff --git a/VFS/VFS_2005Express.vcproj b/VFS/VFS_2005Express.vcproj index b93d8f269..94ee72336 100644 --- a/VFS/VFS_2005Express.vcproj +++ b/VFS/VFS_2005Express.vcproj @@ -405,6 +405,34 @@ > + + + + + + + + + + + + + + diff --git a/VFS/VFS_VS2008.vcproj b/VFS/VFS_VS2008.vcproj index b3ab37b3c..0fbed49c2 100644 --- a/VFS/VFS_VS2008.vcproj +++ b/VFS/VFS_VS2008.vcproj @@ -406,6 +406,34 @@ > + + + + + + + + + + + + + + diff --git a/VFS/vfs_debug.cpp b/VFS/vfs_debug.cpp index cab25f4a9..c39e05067 100644 --- a/VFS/vfs_debug.cpp +++ b/VFS/vfs_debug.cpp @@ -1,10 +1,11 @@ #include "vfs_debug.h" #include "utf8string.h" -#include "PropertyContainer.h" #include "vfs_file_raii.h" #include "FILE/vfs_file.h" +#include "Tools/Log.h" + #include #include diff --git a/VFS/vfs_init.cpp b/VFS/vfs_init.cpp index c7114a735..224ed037f 100644 --- a/VFS/vfs_init.cpp +++ b/VFS/vfs_init.cpp @@ -1,6 +1,5 @@ #include "vfs_init.h" #include "vfs.h" -#include "PropertyContainer.h" #include "File/vfs_file.h" #include "File/vfs_memory_file.h" #include "Location/vfs_directory_tree.h" @@ -8,6 +7,9 @@ #include "Location/vfs_7z_library.h" #include "Location/vfs_create_7z_library.h" +#include "PropertyContainer.h" +#include "Tools/Log.h" + /********************************************************************/ /********************************************************************/ diff --git a/VFS/vfs_profile.cpp b/VFS/vfs_profile.cpp index 70e4c921d..b148926f9 100644 --- a/VFS/vfs_profile.cpp +++ b/VFS/vfs_profile.cpp @@ -3,7 +3,7 @@ #include "Location/vfs_lib_dir.h" #include "Location/vfs_directory_tree.h" -#include "PropertyContainer.h" +#include "Tools/Log.h" #include diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index 36bc47f55..977171f00 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -183,7 +183,7 @@