mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-15 02:56:50 +00:00
Don't report unsupported file types as 'corrupted' captures
* This adds a specific error message if even the magic number doesn't look like a supported file type.
This commit is contained in:
@@ -63,6 +63,7 @@ rdcstr DoStringise(const ResultCode &el)
|
||||
FileIncompatibleVersion,
|
||||
"Capture file incompatible due to being made on an different major version of RenderDoc");
|
||||
STRINGISE_ENUM_CLASS_NAMED(FileCorrupted, "File is corrupted");
|
||||
STRINGISE_ENUM_CLASS_NAMED(FileUnrecognised, "File format is unrecognised");
|
||||
STRINGISE_ENUM_CLASS_NAMED(
|
||||
ImageUnsupported, "The image file or format is unrecognised or not supported in this form");
|
||||
STRINGISE_ENUM_CLASS_NAMED(APIUnsupported, "API used in this capture is unsupported");
|
||||
|
||||
@@ -3803,6 +3803,10 @@ a remote server.
|
||||
|
||||
The capture file is corrupted or otherwise unrecognisable.
|
||||
|
||||
.. data:: FileUnrecognised
|
||||
|
||||
The file was not recognised as any supported file type.
|
||||
|
||||
.. data:: ImageUnsupported
|
||||
|
||||
The image file or format is unrecognised or not supported in this form.
|
||||
@@ -3895,6 +3899,7 @@ enum class ResultCode : uint32_t
|
||||
FileIOFailed,
|
||||
FileIncompatibleVersion,
|
||||
FileCorrupted,
|
||||
FileUnrecognised,
|
||||
ImageUnsupported,
|
||||
APIUnsupported,
|
||||
APIInitFailed,
|
||||
|
||||
@@ -329,9 +329,8 @@ void RDCFile::Init(StreamReader &reader)
|
||||
|
||||
if(header.magic != MAGIC_HEADER)
|
||||
{
|
||||
SET_ERROR_RESULT(m_Error, ResultCode::FileCorrupted,
|
||||
"Invalid capture file. Expected magic %08x, got %08x.", MAGIC_HEADER,
|
||||
(uint32_t)header.magic);
|
||||
SET_ERROR_RESULT(m_Error, ResultCode::FileUnrecognised,
|
||||
"Unrecognised file type. File magic number is %08x.", (uint32_t)header.magic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user