mirror of https://github.com/mgba-emu/mgba.git
Core: Improve PNG deserialization logging
This commit is contained in:
parent
4007e19736
commit
6b5638efda
|
@ -249,9 +249,16 @@ static int _loadPNGChunkHandler(png_structp png, png_unknown_chunkp chunk) {
|
|||
}
|
||||
const uint8_t* data = chunk->data;
|
||||
data += sizeof(uint32_t) * 2;
|
||||
uncompress((Bytef*) item.data, &len, data, chunk->size);
|
||||
if (uncompress((Bytef*) item.data, &len, data, chunk->size) == Z_OK) {
|
||||
if (item.size != len) {
|
||||
mLOG(SAVESTATE, WARN, "Mismatched decompressed extdata %i size (%"PRIz"u vs %"PRIz"u)", tag, item.size, (size_t) len);
|
||||
item.size = len;
|
||||
}
|
||||
mStateExtdataPut(extdata, tag, &item);
|
||||
} else {
|
||||
mLOG(SAVESTATE, WARN, "Failed to decompress extdata chunk");
|
||||
free(item.data);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -320,7 +327,7 @@ static void* _loadPNGState(struct mCore* core, struct VFile* vf, struct mStateEx
|
|||
return state;
|
||||
}
|
||||
|
||||
static bool _loadPNGExtadata(struct VFile* vf, struct mStateExtdata* extdata) {
|
||||
static bool _loadPNGExtdata(struct VFile* vf, struct mStateExtdata* extdata) {
|
||||
png_structp png = PNGReadOpen(vf, PNG_HEADER_BYTES);
|
||||
png_infop info = png_create_info_struct(png);
|
||||
png_infop end = png_create_info_struct(png);
|
||||
|
@ -511,7 +518,7 @@ void* mCoreExtractState(struct mCore* core, struct VFile* vf, struct mStateExtda
|
|||
bool mCoreExtractExtdata(struct mCore* core, struct VFile* vf, struct mStateExtdata* extdata) {
|
||||
#ifdef USE_PNG
|
||||
if (isPNG(vf)) {
|
||||
return _loadPNGExtadata(vf, extdata);
|
||||
return _loadPNGExtdata(vf, extdata);
|
||||
}
|
||||
#endif
|
||||
if (!core) {
|
||||
|
|
Loading…
Reference in New Issue