bin2fex: refactored script_bin_head including the array of sections
This commit is contained in:
parent
315a590a89
commit
85d240fa43
15
bin2fex.c
15
bin2fex.c
@ -194,19 +194,16 @@ static int decompile_section(void *bin, size_t UNUSED(bin_size),
|
||||
static int decompile(void *bin, size_t bin_size, FILE *out)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
struct script_bin_head head;
|
||||
struct script_bin_section sections[];
|
||||
} *script = bin;
|
||||
struct script_bin_head *script = bin;
|
||||
|
||||
pr_info("version: %d.%d.%d\n", script->head.version[0],
|
||||
script->head.version[1], script->head.version[2]);
|
||||
pr_info("version: %d.%d.%d\n", script->version[0],
|
||||
script->version[1], script->version[2]);
|
||||
pr_info("size: %zu (%d sections)\n", bin_size,
|
||||
script->head.sections);
|
||||
script->sections);
|
||||
|
||||
/* TODO: SANITY: compare head.sections with bin_size */
|
||||
for (i=0; i < script->head.sections; i++) {
|
||||
struct script_bin_section *section = &script->sections[i];
|
||||
for (i=0; i < script->sections; i++) {
|
||||
struct script_bin_section *section = &script->section[i];
|
||||
|
||||
if (!decompile_section(bin, bin_size, section, out))
|
||||
return 1; /* failure */
|
||||
|
||||
11
bin2fex.h
11
bin2fex.h
@ -19,17 +19,18 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct script_bin_head {
|
||||
int32_t sections;
|
||||
int32_t version[3];
|
||||
};
|
||||
|
||||
struct script_bin_section {
|
||||
char name[32];
|
||||
int32_t length;
|
||||
int32_t offset;
|
||||
};
|
||||
|
||||
struct script_bin_head {
|
||||
int32_t sections;
|
||||
int32_t version[3];
|
||||
struct script_bin_section section[];
|
||||
};
|
||||
|
||||
struct script_bin_entry {
|
||||
char name[32];
|
||||
int32_t offset;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user