forked from len0rd/rockbox
rsrctool: improve debug output
Change-Id: I3a4fc048466b9e4d7290237efc1cefb07fd0a118
This commit is contained in:
parent
708bf1aca3
commit
8666e83aaa
1 changed files with 15 additions and 1 deletions
|
@ -26,6 +26,10 @@
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "rsrc.h"
|
#include "rsrc.h"
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
const char crypto_key[16] = "SanDiskSlotRadi";
|
const char crypto_key[16] = "SanDiskSlotRadi";
|
||||||
|
|
||||||
static void rsrc_crypt(void *buf, int size)
|
static void rsrc_crypt(void *buf, int size)
|
||||||
|
@ -144,10 +148,20 @@ 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);
|
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)),
|
rsrc_table_entry_type_str(RSRC_TABLE_ENTRY_TYPE(te)),
|
||||||
GREEN, sz);
|
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)
|
if(RSRC_TABLE_ENTRY_TYPE(te) == RSRC_TYPE_NESTED)
|
||||||
{
|
{
|
||||||
char *p = prefix + strlen(prefix);
|
char *p = prefix + strlen(prefix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue