From db0787b5a37116b7b686d9b0071690369f51da89 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:06:02 +0300 Subject: [PATCH] Remove unused functions GetFreeSpaceOnHardDriveWhereGameIsRunningFrom() GetFreeSpaceOnHardDrive() FileReadLine() <- non VFS version DoesUserHaveEnoughHardDriveSpace() --- SaveLoadGame.cpp | 15 ------- SaveLoadGame.h | 2 - Standard Gaming Platform/FileMan.cpp | 65 ---------------------------- Standard Gaming Platform/FileMan.h | 7 --- 4 files changed, 89 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index dffa73373..7d8cc0157 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -9683,21 +9683,6 @@ BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile ) return( TRUE ); } -BOOLEAN DoesUserHaveEnoughHardDriveSpace() -{ - UINT32 uiBytesFree=0; - - uiBytesFree = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); - - //check to see if there is enough hard drive space - if( uiBytesFree < REQUIRED_FREE_SPACE ) - { - return( FALSE ); - } - - return( TRUE ); -} - #ifdef JA2BETAVERSION void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ) diff --git a/SaveLoadGame.h b/SaveLoadGame.h index b1a362711..3cc011f6f 100644 --- a/SaveLoadGame.h +++ b/SaveLoadGame.h @@ -93,8 +93,6 @@ BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERT BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile ); BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ); -BOOLEAN DoesUserHaveEnoughHardDriveSpace(); - void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index a127ee773..6ab2b70e5 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -470,22 +470,6 @@ BOOLEAN FileReadLine( HWFILE hFile, std::string* pDest ) return FALSE; } -BOOLEAN FileReadLine( HWFILE hFile, STR8 pDest, UINT32 uiDestSize, UINT32 *puiBytesRead ) -{ - std::string sBuffer; - BOOLEAN result = (pDest != NULL) && FileReadLine( hFile, &sBuffer ); - if ( result ) - { - if ( puiBytesRead ) - *puiBytesRead = sBuffer.length(); - - UINT32 uiCountToCopy = min( sBuffer.length(), uiDestSize - 1 ); - sBuffer.copy( pDest, uiCountToCopy ); - pDest[uiCountToCopy] = '\0'; // method copy() does not put a null-terminator - } - return result; -} - //************************************************************************** // // FileWrite @@ -952,55 +936,6 @@ UINT32 FileSize(STR strFilename) } -UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ) -{ - STRING512 zExecDir; - STRING512 zDrive; - STRING512 zDir; - STRING512 zFileName; - STRING512 zExt; - - UINT32 uiFreeSpace = 0; - - GetExecutableDirectory( zExecDir ); - - //get the drive letter from the exec dir - _splitpath( zExecDir, zDrive, zDir, zFileName, zExt); - - sprintf( zDrive, "%s\\", zDrive ); - - uiFreeSpace = GetFreeSpaceOnHardDrive( zDrive ); - - return( uiFreeSpace ); -} - - - - -UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter ) -{ - UINT32 uiBytesFree=0; - - UINT32 uiSectorsPerCluster=0; - UINT32 uiBytesPerSector=0; - UINT32 uiNumberOfFreeClusters=0; - UINT32 uiTotalNumberOfClusters=0; - - if( !GetDiskFreeSpace( pzDriveLetter, (LPDWORD) &uiSectorsPerCluster, (LPDWORD) &uiBytesPerSector, - (LPDWORD) &uiNumberOfFreeClusters, (LPDWORD) &uiTotalNumberOfClusters ) ) - { - UINT32 uiLastError = GetLastError(); - char zString[1024]; - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, uiLastError, 0, zString, 1024, NULL); - - return( TRUE ); - } - - uiBytesFree = uiBytesPerSector * uiNumberOfFreeClusters * uiSectorsPerCluster; - - return( uiBytesFree ); -} - // Flugente: simple wrapper to check whether an audio file in mp3/ogg/wav format exists BOOLEAN SoundFileExists( STR strFilename, STR zFoundFilename ) { diff --git a/Standard Gaming Platform/FileMan.h b/Standard Gaming Platform/FileMan.h index 428b213b1..ef77be56a 100644 --- a/Standard Gaming Platform/FileMan.h +++ b/Standard Gaming Platform/FileMan.h @@ -113,7 +113,6 @@ extern void FileClose( HWFILE ); extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); extern BOOLEAN FileReadLine( HWFILE hFile, std::string* pDest ); -extern BOOLEAN FileReadLine( HWFILE hFile, STR8 pDest, UINT32 uiDestSize, UINT32 *puiBytesRead ); extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten ); extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); @@ -148,12 +147,6 @@ void GetFileClose( GETFILESTRUCT *pGFStruct ); //returns true if at end of file, else false BOOLEAN FileCheckEndOfFile( HWFILE hFile ); -//Gets the amount of free space on the hard drive that the main executeablt is runnning from -UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); - -//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ ) -UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter ); - // Flugente: simple wrapper to check whether an audio file in mp3/ogg/wav format exists BOOLEAN SoundFileExists( STR strFilename, STR zFoundFilename );