diff --git a/src/farchive.cpp b/src/farchive.cpp index 1b41faef7..a589df50a 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -575,6 +575,20 @@ bool FCompressedMemFile::IsOpen () const return !!m_Buffer; } +void FCompressedMemFile::GetSizes(unsigned int &compressed, unsigned int &uncompressed) const +{ + if (m_ImplodedBuffer != NULL) + { + compressed = BigLong(*(unsigned int *)m_ImplodedBuffer); + uncompressed = BigLong(*(unsigned int *)(m_ImplodedBuffer + 4)); + } + else + { + compressed = 0; + uncompressed = m_BufferSize; + } +} + FPNGChunkFile::FPNGChunkFile (FILE *file, DWORD id) : FCompressedFile (file, EWriting, true, false), m_ChunkID (id) { diff --git a/src/farchive.h b/src/farchive.h index 5062b7ba7..329b448db 100644 --- a/src/farchive.h +++ b/src/farchive.h @@ -124,6 +124,7 @@ public: bool Reopen (); // Re-opens imploded file for reading only void Close (); bool IsOpen () const; + void GetSizes(unsigned int &one, unsigned int &two) const; void Serialize (FArchive &arc); diff --git a/src/g_level.cpp b/src/g_level.cpp index 903a9a6c5..c51b58a66 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1757,6 +1757,21 @@ void G_ReadSnapshots (PNGHandle *png) png->File->ResetFilePtr(); } +//========================================================================== + +CCMD(listsnapshots) +{ + for (unsigned i = 0; i < wadlevelinfos.Size(); ++i) + { + FCompressedMemFile *snapshot = wadlevelinfos[i].snapshot; + if (snapshot != NULL) + { + unsigned int comp, uncomp; + snapshot->GetSizes(comp, uncomp); + Printf("%s (%u -> %u bytes)\n", wadlevelinfos[i].mapname, comp, uncomp); + } + } +} //========================================================================== //