From c07f3f460bf4f8d6b55d89ddd65926262fb04818 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Oct 2023 13:59:28 +0300 Subject: [PATCH] Remove unused autosave and filetime functions --- SaveLoadGame.cpp | 63 --------------------- SaveLoadGame.h | 1 - Standard Gaming Platform/FileMan.cpp | 82 ---------------------------- Standard Gaming Platform/FileMan.h | 15 ----- 4 files changed, 161 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index a013b455..dffa7337 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -9961,69 +9961,6 @@ void UpdateMercMercContractInfo() } } -INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ) -{ - CHAR zFileName1[MAX_PATH]; - CHAR zFileName2[MAX_PATH]; - HWFILE hFile; - BOOLEAN fFile1Exist, fFile2Exist; - SGP_FILETIME CreationTime1, LastAccessedTime1, LastWriteTime1; - SGP_FILETIME CreationTime2, LastAccessedTime2, LastWriteTime2; - - fFile1Exist = FALSE; - fFile2Exist = FALSE; - - - //The name of the file - sprintf( zFileName1, "%s\\Auto%02d.%S", gSaveDir, 0, pMessageStrings[ MSG_SAVEEXTENSION ] ); - sprintf( zFileName2, "%s\\Auto%02d.%S", gSaveDir, 1, pMessageStrings[ MSG_SAVEEXTENSION ] ); - - if( FileExists( zFileName1 ) ) - { - hFile = FileOpen( zFileName1, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); - - GetFileManFileTime( hFile, &CreationTime1, &LastAccessedTime1, &LastWriteTime1 ); - - FileClose( hFile ); - - fFile1Exist = TRUE; - } - - if( FileExists( zFileName2 ) ) - { - hFile = FileOpen( zFileName2, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); - - GetFileManFileTime( hFile, &CreationTime2, &LastAccessedTime2, &LastWriteTime2 ); - - FileClose( hFile ); - - fFile2Exist = TRUE; - } - - if( !fFile1Exist && !fFile2Exist ) - return( -1 ); - else if( fFile1Exist && !fFile2Exist ) - { - if( fLatestAutoSave ) - return( 0 ); - else - return( -1 ); - } - else if( !fFile1Exist && fFile2Exist ) - { - if( fLatestAutoSave ) - return( 1 ); - else - return( -1 ); - } - else - { - if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 ) - return( 0 ); - else - return( 1 ); - } -} void HandleOldBobbyRMailOrders() { diff --git a/SaveLoadGame.h b/SaveLoadGame.h index a1f9664a..b1a36271 100644 --- a/SaveLoadGame.h +++ b/SaveLoadGame.h @@ -99,7 +99,6 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav) -INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ); /*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory, but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index 1c43fc2a..cd631004 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -911,76 +911,6 @@ void GetFileClose( GETFILESTRUCT *pGFStruct ) } -//Additions by Kris Morness -BOOLEAN FileSetAttributes( STR strFilename, UINT32 uiNewAttribs ) -{ - UINT32 uiFileAttrib = 0; - - if( uiNewAttribs & FILE_ATTRIBUTES_ARCHIVE ) - uiFileAttrib |= FILE_ATTRIBUTE_ARCHIVE; - - if( uiNewAttribs & FILE_ATTRIBUTES_HIDDEN ) - uiFileAttrib |= FILE_ATTRIBUTE_HIDDEN; - - if( uiNewAttribs & FILE_ATTRIBUTES_NORMAL ) - uiFileAttrib |= FILE_ATTRIBUTE_NORMAL; - - if( uiNewAttribs & FILE_ATTRIBUTES_OFFLINE ) - uiFileAttrib |= FILE_ATTRIBUTE_OFFLINE; - - if( uiNewAttribs & FILE_ATTRIBUTES_READONLY ) - uiFileAttrib |= FILE_ATTRIBUTE_READONLY; - - if( uiNewAttribs & FILE_ATTRIBUTES_SYSTEM ) - uiFileAttrib |= FILE_ATTRIBUTE_SYSTEM; - - if( uiNewAttribs & FILE_ATTRIBUTES_TEMPORARY ) - uiFileAttrib |= FILE_ATTRIBUTE_TEMPORARY; - - return SetFileAttributes( strFilename, uiFileAttrib ); -} - - -UINT32 FileGetAttributes( STR strFilename ) -{ - UINT32 uiAttribs = 0; - UINT32 uiFileAttrib = 0; - - uiAttribs = GetFileAttributes( strFilename ); - - if( uiAttribs == 0xFFFFFFFF ) - return( uiAttribs ); - - if( uiAttribs & FILE_ATTRIBUTE_ARCHIVE ) - uiFileAttrib |= FILE_ATTRIBUTES_ARCHIVE; - - if( uiAttribs & FILE_ATTRIBUTE_HIDDEN ) - uiFileAttrib |= FILE_ATTRIBUTES_HIDDEN; - - if( uiAttribs & FILE_ATTRIBUTE_NORMAL ) - uiFileAttrib |= FILE_ATTRIBUTES_NORMAL; - - if( uiAttribs & FILE_ATTRIBUTE_OFFLINE ) - uiFileAttrib |= FILE_ATTRIBUTES_OFFLINE; - - if( uiAttribs & FILE_ATTRIBUTE_READONLY ) - uiFileAttrib |= FILE_ATTRIBUTES_READONLY; - - if( uiAttribs & FILE_ATTRIBUTE_SYSTEM ) - uiFileAttrib |= FILE_ATTRIBUTES_SYSTEM; - - if( uiAttribs & FILE_ATTRIBUTE_TEMPORARY ) - uiFileAttrib |= FILE_ATTRIBUTES_TEMPORARY; - - if( uiAttribs & FILE_ATTRIBUTE_DIRECTORY ) - uiFileAttrib |= FILE_ATTRIBUTES_DIRECTORY; - - - - return( uiFileAttrib ); -} - - //returns true if at end of file, else false BOOLEAN FileCheckEndOfFile( HWFILE hFile ) { @@ -1011,18 +941,6 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile ) } - -BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime ) -{ - return( FALSE ); -} - - -INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFileTime ) -{ - return( CompareFileTime( pFirstFileTime, pSecondFileTime ) ); -} - UINT32 FileSize(STR strFilename) { vfs::IBaseFile *pFile = getVFS()->getFile(vfs::Path(strFilename)); diff --git a/Standard Gaming Platform/FileMan.h b/Standard Gaming Platform/FileMan.h index e84f872f..1b21e8bc 100644 --- a/Standard Gaming Platform/FileMan.h +++ b/Standard Gaming Platform/FileMan.h @@ -145,24 +145,9 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct ); BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct ); void GetFileClose( GETFILESTRUCT *pGFStruct ); -//Added by Kris Morness -BOOLEAN FileSetAttributes( STR filename, UINT32 uiNewAttribs ); -UINT32 FileGetAttributes( STR filename ); - //returns true if at end of file, else false BOOLEAN FileCheckEndOfFile( HWFILE hFile ); - - -BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime ); - - -// CompareSGPFileTimes() returns... -// -1 if the First file time is less than second file time. ( first file is older ) -// 0 First file time is equal to second file time. -// +1 First file time is greater than second file time ( first file is newer ). -INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFileTime ); - // One call comparison of file times, allowing for a certain leeway in cases where // files times may be slightly different due to SourceSafe of copying BOOLEAN FileIsOlderThanFile(CHAR8 *pcFileName1, CHAR8 *pcFileName2, UINT32 ulNumSeconds);