#[non_exhaustive]pub enum DecodeError {
Show 13 variants
Hdr(HdrError),
Platform(PlatformError),
Unsupported {
format: Format,
width: i32,
},
Crunch(CrunchError),
NoImageData,
NegativeSize {
width: i32,
height: i32,
},
TooLarge {
pixels: u64,
max: u64,
},
PillowMemoryError {
width: u32,
max: u32,
},
NotEnoughData {
needed: u64,
got: u64,
},
DecompressionBomb {
pixels: u64,
max: u64,
},
PvrtcBlockCount,
Charge(ChargeError),
Panicked {
payload: Payload,
},
}Expand description
Why a texture did not decode, in the order of the module docs’ checks.
Every variant but Self::TooLarge, Self::Charge and
Self::Panicked is a case where UnityPy 1.25.2 raises too, but
for an ETC or EAC format with short data or a side padded below 0,
where texture2ddecoder reads past the data (module docs, steps 3 and
6). plan()
returns the checks’ variants only, never Charge or Panicked, which
decode() alone gives, after a plan that passed.
Not Clone, by design, unlike the core’s errors: Panicked owns the
panic’s payload, the box the unwinding carried (Payload), which
cannot be cloned, and a copy of its text would allocate on the panic
path.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Hdr(HdrError)
Reserved or illegal content in a specification-defined HDR block.
Platform(PlatformError)
An unsupported platform layout or a size that cannot be represented.
Unsupported
A Tier U layout: ARGBFloat, or YUY2 with an odd width.
Crunch(CrunchError)
A malformed legacy or Unity CRN stream or unsupported CRN feature.
NoImageData
The data is empty: UnityPy’s ValueError("Texture2D has no image data").
NegativeSize
A side is negative (and neither is 0): Pillow’s ValueError.
TooLarge
The texture passes MAX_PIXELS at its padded size, a bound
UnityPy does not have.
PillowMemoryError
A raw texture’s row, or an ETC, EAC or ASTC texture’s padded row,
wider than Pillow’s raw decoder takes: Pillow’s MemoryError
(module docs, step 5).
Fields
NotEnoughData
The data ends before mip 0 does: Pillow’s ValueError “not enough
image data”, for an ASTC format UnityPy’s ValueError “Invalid ASTC
data size”, or for an ETC or EAC format, where texture2ddecoder
reads on past the data’s end, unityrs’s own refusal (module docs,
step 6).
DecompressionBomb
UnityPy’s crop of a padded BCn image meets Pillow’s
decompression-bomb check: its DecompressionBombError, whose message
this one is (module docs, step 8).
PvrtcBlockCount
texture2ddecoder refuses a PVRTC grid with non-power-of-two block counts.
Charge(ChargeError)
The meter or its budget refused the output buffer, or the allocator did; nothing was allocated.
Panicked
The decoder panicked (crate::contain()): its payload, kept whole.
Fields
payload: PayloadThe payload; Payload::message is the manifest’s detail.
Trait Implementations§
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ChargeError> for DecodeError
impl From<ChargeError> for DecodeError
Source§fn from(source: ChargeError) -> Self
fn from(source: ChargeError) -> Self
Source§impl From<CrunchError> for DecodeError
impl From<CrunchError> for DecodeError
Source§fn from(error: CrunchError) -> Self
fn from(error: CrunchError) -> Self
Source§impl From<DecodeError> for ArrayError
impl From<DecodeError> for ArrayError
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Source§impl From<DecodeError> for SpriteError
impl From<DecodeError> for SpriteError
Source§fn from(e: DecodeError) -> Self
fn from(e: DecodeError) -> Self
crate::contain()’s errors: a panic, or a charge.