Skip to content

Commit cd865d0

Browse files
committed
Dump everything, not just the expected bytes
1 parent 8752b73 commit cd865d0

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/lcf/reader_lcf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ class LcfReader {
198198
/**
199199
* Like Skip but only dumps the content of the skipped chunk on stderr.
200200
*
201-
* @chunk_Info chunk that will be skipped and dumped.
201+
* @param length how many bytes to dump
202202
*/
203-
void Dump(const struct LcfReader::Chunk& chunk_info);
203+
void Dump(uint32_t length);
204204

205205
/**
206206
* Encodes a string to UTF-8 using the set encoding

src/reader_lcf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,14 @@ void LcfReader::Skip(const struct LcfReader::Chunk& chunk_info, const char* wher
282282
Log::Debug("Skipped Chunk %02X (%" PRIu32 " byte) in lcf at %" PRIX32 " (%s)",
283283
chunk_info.ID, chunk_info.length, Tell(), where);
284284

285-
Dump(chunk_info);
285+
Dump(chunk_info.length);
286286
}
287287

288-
void LcfReader::Dump(const struct LcfReader::Chunk& chunk_info) {
288+
void LcfReader::Dump(uint32_t length) {
289289
std::stringstream ss;
290290
ss << std::hex;
291291

292-
for (uint32_t i = 0; i < chunk_info.length; ++i) {
292+
for (uint32_t i = 0; i < length; ++i) {
293293
uint8_t byte;
294294
LcfReader::Read(byte);
295295
ss << std::setfill('0') << std::setw(2) << (int)byte << " ";

src/reader_struct_impl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "lcf/lmt/reader.h"
1616
#include "lcf/lmu/reader.h"
1717
#include "lcf/lsd/reader.h"
18+
#include "lcf/reader_lcf.h"
1819
#include "reader_struct.h"
1920
#include "lcf/rpg/save.h"
2021
#include "log.h"
@@ -82,7 +83,9 @@ void Struct<S>::ReadLcf(S& obj, LcfReader& stream) {
8283
Log::Warning("%s: Corrupted Chunk 0x%02" PRIx32 " (size: %" PRIu32 ", pos: 0x%" PRIx32 "): %s : Read %" PRIu32 " bytes!",
8384
Struct<S>::name, chunk_info.ID, chunk_info.length, off, it->second->name, bytes_read);
8485
stream.Seek(off);
85-
stream.Dump(chunk_info);
86+
stream.Dump(bytes_read);
87+
88+
stream.Seek(off + chunk_info.length);
8689
}
8790
}
8891
else {

0 commit comments

Comments
 (0)