summaryrefslogtreecommitdiffstats
path: root/utils/imxtools/sbtools
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-12-06 12:16:37 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-12-06 12:17:50 +0100
commit8666e83aaadfa7f334431da697b82963d649acc6 (patch)
treeb9ec41d9c1247d3de3af1bbf08817c49530ba86e /utils/imxtools/sbtools
parent708bf1aca31761f1012e3c48fd89749ad7d8d227 (diff)
downloadrockbox-8666e83aaadfa7f334431da697b82963d649acc6.tar.gz
rockbox-8666e83aaadfa7f334431da697b82963d649acc6.tar.bz2
rockbox-8666e83aaadfa7f334431da697b82963d649acc6.zip
rsrctool: improve debug output
Change-Id: I3a4fc048466b9e4d7290237efc1cefb07fd0a118
Diffstat (limited to 'utils/imxtools/sbtools')
-rw-r--r--utils/imxtools/sbtools/rsrc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/utils/imxtools/sbtools/rsrc.c b/utils/imxtools/sbtools/rsrc.c
index 1d20c5fce8..49d2158483 100644
--- a/utils/imxtools/sbtools/rsrc.c
+++ b/utils/imxtools/sbtools/rsrc.c
@@ -26,6 +26,10 @@
#include "crypto.h"
#include "rsrc.h"
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
const char crypto_key[16] = "SanDiskSlotRadi";
static void rsrc_crypt(void *buf, int size)
@@ -144,9 +148,19 @@ static bool read_entries(struct rsrc_file_t *f, void *u,
augment_array_ex((void **)&f->entries, sizeof(ent), &f->nr_entries, &f->capacity, &ent, 1);
- printf(OFF, "%s+-%s%#08x %s[%s]%s[size=%#x]\n", prefix, YELLOW, index, BLUE,
+ printf(OFF, "%s+-%s%#08x %s[%s]%s[size=%#x]", prefix, YELLOW, index, BLUE,
rsrc_table_entry_type_str(RSRC_TABLE_ENTRY_TYPE(te)),
GREEN, sz);
+
+ if(RSRC_TABLE_ENTRY_TYPE(te) != RSRC_TYPE_VALUE &&
+ RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED)
+ {
+ uint8_t *p = f->data + ent.offset;
+ printf(OFF, " ");
+ for(int i = 0; i < MIN(sz, 16); i++)
+ printf(RED, "%c", isprint(p[i]) ? p[i] : '.');
+ }
+ printf(OFF, "\n");
if(RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED)
{