Legacy code cleanup - part 3 (#3903)
* Legacy cleanup - part 3 Not much is left that can be easily removed, so I think this will be last cleanup before the legacy functionality is replaced. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * fix windows build, remove a few more things, re-add one file Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove legacy RenderBus + more cleanups Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove MaterialOwnerBus.h Clean-up in Cry_Matrix34/33 Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : File wrapper.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_CRYFILE_H
|
||||
#define CRYINCLUDE_CRYCOMMON_CRYFILE_H
|
||||
#pragma once
|
||||
|
||||
#include <CryPath.h>
|
||||
@@ -20,86 +15,16 @@
|
||||
#include <IConsole.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Defines for CryEngine filetypes extensions.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define CRY_GEOMETRY_FILE_EXT "cgf"
|
||||
#define CRY_SKEL_FILE_EXT "chr" //will be a SKEL soon
|
||||
#define CRY_SKIN_FILE_EXT "skin"
|
||||
#define CRY_CHARACTER_ANIMATION_FILE_EXT "caf"
|
||||
#define CRY_CHARACTER_DEFINITION_FILE_EXT "cdf"
|
||||
#define CRY_CHARACTER_LIST_FILE_EXT "cid"
|
||||
#define CRY_ANIM_GEOMETRY_FILE_EXT "cga"
|
||||
#define CRY_ANIM_GEOMETRY_ANIMATION_FILE_EXT "anm"
|
||||
#define CRY_COMPILED_FILE_EXT "(c)"
|
||||
#define CRY_BINARY_XML_FILE_EXT "binxml"
|
||||
#define CRY_XML_FILE_EXT "xml"
|
||||
#define CRY_CHARACTER_PARAM_FILE_EXT "chrparams"
|
||||
#define CRY_GEOM_CACHE_FILE_EXT "cax"
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define CRYFILE_MAX_PATH 260
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline const char* CryGetExt(const char* filepath)
|
||||
{
|
||||
const char* str = filepath;
|
||||
size_t len = strlen(filepath);
|
||||
for (const char* p = str + len - 1; p >= str; --p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '/':
|
||||
case '\\':
|
||||
// we've reached a path separator - it means there's no extension in this name
|
||||
return "";
|
||||
case '.':
|
||||
// there's an extension in this file name
|
||||
return p + 1;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// Summary:
|
||||
// Checks if specified file name is a character file.
|
||||
// Summary:
|
||||
// Checks if specified file name is a character file.
|
||||
inline bool IsCharacterFile(const char* filename)
|
||||
{
|
||||
const char* ext = CryGetExt(filename);
|
||||
if (_stricmp(ext, CRY_SKEL_FILE_EXT) == 0 || _stricmp(ext, CRY_SKIN_FILE_EXT) == 0 || _stricmp(ext, CRY_CHARACTER_DEFINITION_FILE_EXT) == 0 || _stricmp(ext, CRY_ANIM_GEOMETRY_FILE_EXT) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Description:
|
||||
// Checks if specified file name is a static geometry file.
|
||||
inline bool IsStatObjFile(const char* filename)
|
||||
{
|
||||
const char* ext = CryGetExt(filename);
|
||||
if (_stricmp(ext, CRY_GEOMETRY_FILE_EXT) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Summary:
|
||||
// Wrapper on file system.
|
||||
class CCryFile
|
||||
{
|
||||
public:
|
||||
CCryFile();
|
||||
CCryFile(AZ::IO::IArchive* pIArchive); // allow an alternative IArchiveinterface
|
||||
CCryFile(const char* filename, const char* mode);
|
||||
~CCryFile();
|
||||
|
||||
@@ -112,13 +37,6 @@ public:
|
||||
// Summary:
|
||||
// Reads data from a file at the current file position.
|
||||
size_t ReadRaw(void* lpBuf, size_t nSize);
|
||||
// Summary:
|
||||
// Template version, for automatic size support.
|
||||
template<class T>
|
||||
inline size_t ReadTypeRaw(T* pDest, size_t nCount = 1)
|
||||
{
|
||||
return ReadRaw(pDest, sizeof(T) * nCount);
|
||||
}
|
||||
|
||||
// Summary:
|
||||
// Automatic endian-swapping version.
|
||||
@@ -137,27 +55,6 @@ public:
|
||||
// Summary:
|
||||
// Moves the current file pointer to the specified position.
|
||||
size_t Seek(size_t seek, int mode);
|
||||
// Summary:
|
||||
// Moves the current file pointer at the beginning of the file.
|
||||
void SeekToBegin();
|
||||
// Summary:
|
||||
// Moves the current file pointer at the end of the file.
|
||||
size_t SeekToEnd();
|
||||
// Summary:
|
||||
// Retrieves the current file pointer.
|
||||
size_t GetPosition();
|
||||
|
||||
// Summary:
|
||||
// Tests for end-of-file on a selected file.
|
||||
bool IsEof();
|
||||
|
||||
// Summary:
|
||||
// Flushes any data yet to be written.
|
||||
void Flush();
|
||||
|
||||
// Summary:
|
||||
// Gets a handle to a pack object.
|
||||
AZ::IO::HandleType GetHandle() const { return m_fileHandle; };
|
||||
|
||||
// Description:
|
||||
// Retrieves the filename of the selected file.
|
||||
@@ -193,12 +90,6 @@ inline CCryFile::CCryFile()
|
||||
m_pIArchive = gEnv ? gEnv->pCryPak : NULL;
|
||||
}
|
||||
|
||||
inline CCryFile::CCryFile(AZ::IO::IArchive* pIArchive)
|
||||
{
|
||||
m_fileHandle = AZ::IO::InvalidHandle;
|
||||
m_pIArchive = pIArchive;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline CCryFile::CCryFile(const char* filename, const char* mode)
|
||||
{
|
||||
@@ -336,58 +227,6 @@ inline size_t CCryFile::Seek(size_t seek, int mode)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline void CCryFile::SeekToBegin()
|
||||
{
|
||||
Seek(0, SEEK_SET);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline size_t CCryFile::SeekToEnd()
|
||||
{
|
||||
return Seek(0, SEEK_END);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline size_t CCryFile::GetPosition()
|
||||
{
|
||||
assert(m_fileHandle != AZ::IO::InvalidHandle);
|
||||
if (m_pIArchive)
|
||||
{
|
||||
return m_pIArchive->FTell(m_fileHandle);
|
||||
}
|
||||
|
||||
AZ::u64 tellOffset = 0;
|
||||
AZ::IO::FileIOBase::GetInstance()->Tell(m_fileHandle, tellOffset);
|
||||
|
||||
return static_cast<size_t>(tellOffset);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline bool CCryFile::IsEof()
|
||||
{
|
||||
assert(m_fileHandle != AZ::IO::InvalidHandle);
|
||||
if (m_pIArchive)
|
||||
{
|
||||
return m_pIArchive->FEof(m_fileHandle) != 0;
|
||||
}
|
||||
|
||||
return AZ::IO::FileIOBase::GetInstance()->Eof(m_fileHandle);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline void CCryFile::Flush()
|
||||
{
|
||||
assert(m_fileHandle != AZ::IO::InvalidHandle);
|
||||
|
||||
if (m_pIArchive)
|
||||
{
|
||||
m_pIArchive->FFlush(m_fileHandle);
|
||||
}
|
||||
|
||||
AZ::IO::FileIOBase::GetInstance()->Flush(m_fileHandle);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline bool CCryFile::IsInPak() const
|
||||
{
|
||||
@@ -433,5 +272,3 @@ inline const char* CCryFile::GetAdjustedFilename() const
|
||||
}
|
||||
return szAdjustedFile;
|
||||
}
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_CRYFILE_H
|
||||
|
||||
Reference in New Issue
Block a user