diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-14 23:35:01 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-14 23:35:01 +0000 |
commit | e32f28b740c9bfef25a5ccbe961ea45e605f4d25 (patch) | |
tree | a0204b624efe9acaaefabc5b08dd1beb6694c3e4 | |
parent | 63f0b2b8e9f71537da61c63932ad37e6ff511997 (diff) | |
download | rockbox-e32f28b740c9bfef25a5ccbe961ea45e605f4d25.tar.gz rockbox-e32f28b740c9bfef25a5ccbe961ea45e605f4d25.zip |
amsinfo: do not assume library blocks always have the same size
otg_functio is now correctly extracted of Clip+ firmware
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25188 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/AMS/hacking/amsinfo.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/utils/AMS/hacking/amsinfo.c b/utils/AMS/hacking/amsinfo.c index d3f03bc18a..ff92175e64 100644 --- a/utils/AMS/hacking/amsinfo.c +++ b/utils/AMS/hacking/amsinfo.c | |||
@@ -44,24 +44,6 @@ char BLUE[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '4', 0x6d, '\0' }; | |||
44 | # define color(a) | 44 | # define color(a) |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define LIB_OFFSET 160 /* FIXME (see below) */ | ||
48 | /* The alignement of library blocks (in number of 0x200 bytes blocks) | ||
49 | * alignement - md5sum - filename - model | ||
50 | * 120 : fc9dd6116001b3e6a150b898f1b091f0 m200p-4.1.08A.bin M200 | ||
51 | * 128 : 82e3194310d1514e3bbcd06e84c4add3 m200p.bin Fuze | ||
52 | * 160 : c12711342169c66e209540cd1f27cd26 m300f.bin CLIP | ||
53 | * | ||
54 | * Note : the size of library blocks is variable: | ||
55 | * | ||
56 | * For m200p-4.1.08A.bin it's always 0x1e000 blocks = 240 * 0x200 | ||
57 | * | ||
58 | * For m200p.bin it can be 0x20000 (256*0x200) or 0x40000 (512*0x200) | ||
59 | * (for "acp_decoder" and "sd_reload__" blocks) | ||
60 | * | ||
61 | * For m300f.bin it can be 0x28000 (320*0x200) or 0x14000 (160 * 0x200) | ||
62 | * | ||
63 | */ | ||
64 | |||
65 | #define bug(...) do { fprintf(stderr,"ERROR: "__VA_ARGS__); exit(1); } while(0) | 47 | #define bug(...) do { fprintf(stderr,"ERROR: "__VA_ARGS__); exit(1); } while(0) |
66 | #define bugp(a) do { perror("ERROR: "a); exit(1); } while(0) | 48 | #define bugp(a) do { perror("ERROR: "a); exit(1); } while(0) |
67 | 49 | ||
@@ -331,9 +313,7 @@ static void print_block(size_t off, type t) | |||
331 | break; | 313 | break; |
332 | #endif | 314 | #endif |
333 | case LIB: | 315 | case LIB: |
334 | s = LIB_OFFSET * 0x200; | 316 | s = get32le(off+12); |
335 | while(s < get32le(off+12)) | ||
336 | s <<= 1; | ||
337 | color(RED); | 317 | color(RED); |
338 | printf("library block 0x%.6x\t->\t0x%.6x\t\"%s\"\n", | 318 | printf("library block 0x%.6x\t->\t0x%.6x\t\"%s\"\n", |
339 | (unsigned int)s, (unsigned int)(off+s), | 319 | (unsigned int)s, (unsigned int)(off+s), |
@@ -430,10 +410,7 @@ static size_t verify_block(size_t off) | |||
430 | if(ok) /* library block */ | 410 | if(ok) /* library block */ |
431 | { | 411 | { |
432 | t = LIB; | 412 | t = LIB; |
433 | s = LIB_OFFSET * 0x200; | 413 | s = get32le(off+12); |
434 | while(s < get32le(off+12)) /* of course the minimum is the size | ||
435 | * specified in the block header */ | ||
436 | s <<= 1; | ||
437 | } | 414 | } |
438 | else | 415 | else |
439 | t = UNKNOWN; | 416 | t = UNKNOWN; |