mirror of
https://github.com/jakcron/nstool
synced 2024-11-22 13:39:28 +00:00
[fnd] Fix/Enhance fnd::SimpleTextOutput::hxdStyleDump().
This commit is contained in:
parent
7e81d04fac
commit
167a343937
1 changed files with 27 additions and 0 deletions
|
@ -6,6 +6,7 @@ void fnd::SimpleTextOutput::hxdStyleDump(const byte_t* data, size_t len, size_t
|
|||
// iterate over blocks
|
||||
for (size_t i = 0; i < (len / row_len); i++)
|
||||
{
|
||||
printf("%08" PRIx64 " | ", i*row_len);
|
||||
// for block i print each byte
|
||||
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");
|
||||
}
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue