diff options
-rw-r--r-- | tools/mi4.c | 4 | ||||
-rw-r--r-- | tools/mi4.h | 5 | ||||
-rw-r--r-- | tools/scramble.c | 12 |
3 files changed, 15 insertions, 6 deletions
diff --git a/tools/mi4.c b/tools/mi4.c index b0fff98e1c..f466ad779f 100644 --- a/tools/mi4.c +++ b/tools/mi4.c | |||
@@ -102,7 +102,7 @@ static void int2le(unsigned int val, unsigned char* addr) | |||
102 | addr[3] = (val >> 24) & 0xff; | 102 | addr[3] = (val >> 24) & 0xff; |
103 | } | 103 | } |
104 | 104 | ||
105 | int mi4_encode(char *iname, char *oname, int version) | 105 | int mi4_encode(char *iname, char *oname, int version, int magic) |
106 | { | 106 | { |
107 | size_t len; | 107 | size_t len; |
108 | int length; | 108 | int length; |
@@ -146,7 +146,7 @@ int mi4_encode(char *iname, char *oname, int version) | |||
146 | /* We need to write some data into the actual image - before calculating | 146 | /* We need to write some data into the actual image - before calculating |
147 | the CRC. */ | 147 | the CRC. */ |
148 | int2le(0x00000100, &outbuf[0x2e0]); /* magic */ | 148 | int2le(0x00000100, &outbuf[0x2e0]); /* magic */ |
149 | int2le(0x000000ec, &outbuf[0x2e4]); /* magic */ | 149 | int2le(magic, &outbuf[0x2e4]); /* magic */ |
150 | int2le(length+4, &outbuf[0x2e8]); /* length plus 0xaa55aa55 */ | 150 | int2le(length+4, &outbuf[0x2e8]); /* length plus 0xaa55aa55 */ |
151 | 151 | ||
152 | int2le(0xaa55aa55, &outbuf[0x200+length]); /* More Magic */ | 152 | int2le(0xaa55aa55, &outbuf[0x200+length]); /* More Magic */ |
diff --git a/tools/mi4.h b/tools/mi4.h index ec3a7342d0..ac55f59579 100644 --- a/tools/mi4.h +++ b/tools/mi4.h | |||
@@ -20,6 +20,9 @@ | |||
20 | #ifndef _MI4_H | 20 | #ifndef _MI4_H |
21 | #define _MI4_H | 21 | #define _MI4_H |
22 | 22 | ||
23 | int mi4_encode(char *iname, char *oname, int version); | 23 | #define MI4_MAGIC_DEFAULT 0xec |
24 | #define MI4_MAGIC_R 0xfc | ||
25 | |||
26 | int mi4_encode(char *iname, char *oname, int version, int magic); | ||
24 | 27 | ||
25 | #endif | 28 | #endif |
diff --git a/tools/scramble.c b/tools/scramble.c index 07b11930e1..ea91b9b034 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Björn Stenberg | 10 | * Copyright (C) 2002 - 2007 by Björn Stenberg |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -87,6 +87,7 @@ void usage(void) | |||
87 | "\t-gigabeat Toshiba Gigabeat format\n" | 87 | "\t-gigabeat Toshiba Gigabeat format\n" |
88 | "\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n" | 88 | "\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n" |
89 | "\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n" | 89 | "\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n" |
90 | "\t-mi4r Sandisk Rhapsody .mi4 format\n" | ||
90 | "\t-add=X Rockbox generic \"add-up\" checksum format\n" | 91 | "\t-add=X Rockbox generic \"add-up\" checksum format\n" |
91 | "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n" | 92 | "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n" |
92 | "\t ip3g, ip4g, mini, iax5, h10, h10_5gb, tpj2, e200)\n" | 93 | "\t ip3g, ip4g, mini, iax5, h10, h10_5gb, tpj2, e200)\n" |
@@ -260,12 +261,17 @@ int main (int argc, char** argv) | |||
260 | else if(!strcmp(argv[1], "-mi4v2")) { | 261 | else if(!strcmp(argv[1], "-mi4v2")) { |
261 | iname = argv[2]; | 262 | iname = argv[2]; |
262 | oname = argv[3]; | 263 | oname = argv[3]; |
263 | return mi4_encode(iname, oname, 0x00010201); | 264 | return mi4_encode(iname, oname, 0x00010201, MI4_MAGIC_DEFAULT); |
264 | } | 265 | } |
265 | else if(!strcmp(argv[1], "-mi4v3")) { | 266 | else if(!strcmp(argv[1], "-mi4v3")) { |
266 | iname = argv[2]; | 267 | iname = argv[2]; |
267 | oname = argv[3]; | 268 | oname = argv[3]; |
268 | return mi4_encode(iname, oname, 0x00010301); | 269 | return mi4_encode(iname, oname, 0x00010301, MI4_MAGIC_DEFAULT); |
270 | } | ||
271 | else if(!strcmp(argv[1], "-mi4r")) { | ||
272 | iname = argv[2]; | ||
273 | oname = argv[3]; | ||
274 | return mi4_encode(iname, oname, 0x00010301, MI4_MAGIC_R); | ||
269 | } | 275 | } |
270 | 276 | ||
271 | /* open file */ | 277 | /* open file */ |