diff --git a/bin2fex.c b/bin2fex.c index 41f9406..5b27e16 100644 --- a/bin2fex.c +++ b/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 */ diff --git a/bin2fex.h b/bin2fex.h index bf8ff9c..0dedf95 100644 --- a/bin2fex.h +++ b/bin2fex.h @@ -19,17 +19,18 @@ #include -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;