mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-23 03:05:27 +00:00
[fnd] Fix/Enhance fnd::SimpleTextOutput::hxdStyleDump().
This commit is contained in:
parent
7e81d04fac
commit
167a343937
|
@ -6,6 +6,7 @@ void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len, size_t
|
||||||
// iterate over blocks
|
// iterate over blocks
|
||||||
for (size_t i = 0; i < (len / row_len); i++)
|
for (size_t i = 0; i < (len / row_len); i++)
|
||||||
{
|
{
|
||||||
|
printf("%08" PRIx64 " | ", i*row_len);
|
||||||
// for block i print each byte
|
// for block i print each byte
|
||||||
for (size_t j = 0; j < row_len; j++)
|
for (size_t j = 0; j < row_len; j++)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +23,32 @@ void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len, size_t
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
if ((len % row_len) > 0)
|
||||||
|
{
|
||||||
|
size_t i = (len / row_len);
|
||||||
|
printf("%08" PRIx64 " | ", i * row_len);
|
||||||
|
// for block i print each byte
|
||||||
|
for (size_t j = 0; j < row_len; j++)
|
||||||
|
{
|
||||||
|
if (j < (len % row_len))
|
||||||
|
printf("%02X", data[(i * row_len) + j]);
|
||||||
|
else
|
||||||
|
printf(" ");
|
||||||
|
if (((j+1) % byte_grouping_size) == 0)
|
||||||
|
{
|
||||||
|
putchar(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf(" ");
|
||||||
|
for (size_t j = 0; j < row_len; j++)
|
||||||
|
{
|
||||||
|
if (j < (len % row_len))
|
||||||
|
printf("%c", isalnum(data[(i * row_len) + j]) ? data[(i * row_len) + j] : '.');
|
||||||
|
else
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len)
|
void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len)
|
||||||
|
|
Loading…
Reference in a new issue