diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2006-08-30 23:47:09 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2006-08-30 23:47:09 +0000 |
commit | ae8d47574d01e1aae45b905d17c912e235230f9b (patch) | |
tree | a674afd45830563aa84f897a684d1dfed3c77640 | |
parent | 530f31dbe9fe404d41fd21867c8ed9cec1addd96 (diff) | |
download | rockbox-ae8d47574d01e1aae45b905d17c912e235230f9b.tar.gz rockbox-ae8d47574d01e1aae45b905d17c912e235230f9b.zip |
add Gigabeat support to the scramble tools
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10817 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | tools/Makefile | 11 | ||||
-rwxr-xr-x | tools/configure | 5 | ||||
-rw-r--r-- | tools/descramble.c | 8 | ||||
-rw-r--r-- | tools/gigabeat.c | 76 | ||||
-rw-r--r-- | tools/gigabeat.h | 20 | ||||
-rw-r--r-- | tools/scramble.c | 9 |
6 files changed, 122 insertions, 7 deletions
diff --git a/tools/Makefile b/tools/Makefile index 53b1200fce..26cdcab230 100644 --- a/tools/Makefile +++ b/tools/Makefile | |||
@@ -10,17 +10,18 @@ CFLAGS := -O -ansi -g | |||
10 | LDFLAGS := -g | 10 | LDFLAGS := -g |
11 | 11 | ||
12 | CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \ | 12 | CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \ |
13 | generate_rocklatin mkboot ipod_fw codepages uclpack mi4 | 13 | generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat |
14 | 14 | ||
15 | all: | 15 | all: |
16 | @echo "Run make in your build directory!" | 16 | @echo "Run make in your build directory!" |
17 | 17 | ||
18 | scramble: scramble.o iriver.o mi4.o | 18 | scramble: scramble.o iriver.o mi4.o gigabeat.o |
19 | descramble: descramble.o iriver.o | 19 | descramble: descramble.o iriver.o gigabeat.o |
20 | 20 | ||
21 | scramble.o: scramble.c iriver.h | 21 | scramble.o: scramble.c iriver.h mi4.h gigabeat.h |
22 | descramble.o: descramble.c iriver.h | 22 | descramble.o: descramble.c iriver.h gigabeat.h |
23 | iriver.o: iriver.c iriver.h | 23 | iriver.o: iriver.c iriver.h |
24 | gigabeat.o: gigabeat.c gigabeat.h | ||
24 | mi4.o: mi4.c mi4.h | 25 | mi4.o: mi4.c mi4.h |
25 | 26 | ||
26 | sh2d: sh2d.c | 27 | sh2d: sh2d.c |
diff --git a/tools/configure b/tools/configure index 2f766d80e4..2c7443b59d 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -454,7 +454,8 @@ EOF | |||
454 | iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" | 454 | iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" |
455 | iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" | 455 | iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" |
456 | ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages" | 456 | ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages" |
457 | # generic is used by Gigabeat, IFP, H10, Sansa-e200 | 457 | gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages" |
458 | # generic is used by IFP, H10, Sansa-e200 | ||
458 | genericbitmaptools="$toolset bmp2rb codepages" | 459 | genericbitmaptools="$toolset bmp2rb codepages" |
459 | 460 | ||
460 | 461 | ||
@@ -892,7 +893,7 @@ EOF | |||
892 | flash="" | 893 | flash="" |
893 | plugins="yes" | 894 | plugins="yes" |
894 | codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" | 895 | codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" |
895 | toolset=$genericbitmaptools | 896 | toolset=$gigabeatbitmaptools |
896 | # architecture, manufacturer and model for the target-tree build | 897 | # architecture, manufacturer and model for the target-tree build |
897 | t_cpu="arm" | 898 | t_cpu="arm" |
898 | t_manufacturer="gigabeat" | 899 | t_manufacturer="gigabeat" |
diff --git a/tools/descramble.c b/tools/descramble.c index 9b76eaa0d9..bfcf7062f7 100644 --- a/tools/descramble.c +++ b/tools/descramble.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <string.h> | 22 | #include <string.h> |
23 | 23 | ||
24 | #include "iriver.h" | 24 | #include "iriver.h" |
25 | #include "gigabeat.h" | ||
25 | 26 | ||
26 | int iaudio_decode(char *iname, char *oname); | 27 | int iaudio_decode(char *iname, char *oname); |
27 | 28 | ||
@@ -33,6 +34,7 @@ void usage(void) | |||
33 | "\t-v2 Archos V2 recorder format\n" | 34 | "\t-v2 Archos V2 recorder format\n" |
34 | "\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n" | 35 | "\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n" |
35 | "\t-iriver iRiver format\n" | 36 | "\t-iriver iRiver format\n" |
37 | "\t-gigabeat Toshiba Gigabeat format\n" | ||
36 | "\t-iaudio iAudio format\n" | 38 | "\t-iaudio iAudio format\n" |
37 | "\nNo option assumes Archos standard player/recorder format.\n"); | 39 | "\nNo option assumes Archos standard player/recorder format.\n"); |
38 | exit(1); | 40 | exit(1); |
@@ -73,6 +75,12 @@ int main (int argc, char** argv) | |||
73 | iriver_decode(iname, oname, FALSE, STRIP_NONE); | 75 | iriver_decode(iname, oname, FALSE, STRIP_NONE); |
74 | return 0; | 76 | return 0; |
75 | } | 77 | } |
78 | if(!strcmp(argv[1], "-gigabeat")) { | ||
79 | iname = argv[2]; | ||
80 | oname = argv[3]; | ||
81 | gigabeat_code(iname, oname); | ||
82 | return 0; | ||
83 | } | ||
76 | 84 | ||
77 | if(!strcmp(argv[1], "-iaudio")) { | 85 | if(!strcmp(argv[1], "-iaudio")) { |
78 | iname = argv[2]; | 86 | iname = argv[2]; |
diff --git a/tools/gigabeat.c b/tools/gigabeat.c new file mode 100644 index 0000000000..863d0741f2 --- /dev/null +++ b/tools/gigabeat.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Christian Hack | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | |||
23 | static FILE * openinfile( const char * filename ) | ||
24 | { | ||
25 | FILE * F = fopen( filename, "rb" ); | ||
26 | if( F == NULL ) | ||
27 | { | ||
28 | fprintf( stderr, "Couldn't open input file %s\n", filename ); | ||
29 | perror( "Error was " ); | ||
30 | exit( -1 ); | ||
31 | }; | ||
32 | return F; | ||
33 | }; | ||
34 | |||
35 | static FILE * openoutfile( const char * filename ) | ||
36 | { | ||
37 | FILE * F = fopen( filename, "wb" ); | ||
38 | if( F == NULL ) | ||
39 | { | ||
40 | fprintf( stderr, "Couldn't open output file %s\n", filename ); | ||
41 | perror( "Error was " ); | ||
42 | exit( -1 ); | ||
43 | }; | ||
44 | return F; | ||
45 | }; | ||
46 | |||
47 | int gigabeat_code(char *infile, char *outfile) | ||
48 | { | ||
49 | FILE *in, *out; | ||
50 | unsigned long size = 0; | ||
51 | unsigned long bytes_read; | ||
52 | unsigned long data; | ||
53 | unsigned long key = 0x19751217; | ||
54 | |||
55 | in = openinfile(infile); | ||
56 | out = openoutfile(outfile); | ||
57 | |||
58 | while (!feof(in)) { | ||
59 | bytes_read = fread(&data, 1, 4, in); | ||
60 | |||
61 | data = data ^ key; | ||
62 | |||
63 | key = key + (key << 1); | ||
64 | key = key + 0x19751217; | ||
65 | |||
66 | size += bytes_read; | ||
67 | |||
68 | fwrite(&data, 1, bytes_read, out); | ||
69 | } | ||
70 | |||
71 | fprintf(stderr, "File processed successfully\n" ); | ||
72 | |||
73 | fclose(in); | ||
74 | fclose(out); | ||
75 | return(0); | ||
76 | } | ||
diff --git a/tools/gigabeat.h b/tools/gigabeat.h new file mode 100644 index 0000000000..c292014f5f --- /dev/null +++ b/tools/gigabeat.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Marcoen Hirschberg | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | int gigabeat_code(char *infile, char *outfile); | ||
diff --git a/tools/scramble.c b/tools/scramble.c index d1e3d1d341..7d7465a932 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <string.h> | 23 | #include <string.h> |
24 | #include "iriver.h" | 24 | #include "iriver.h" |
25 | #include "gigabeat.h" | ||
25 | #include "mi4.h" | 26 | #include "mi4.h" |
26 | 27 | ||
27 | int iaudio_encode(char *iname, char *oname, char *idstring); | 28 | int iaudio_encode(char *iname, char *oname, char *idstring); |
@@ -83,6 +84,7 @@ void usage(void) | |||
83 | "\t-ipod3g ipod firmware partition format (3rd Gen)\n" | 84 | "\t-ipod3g ipod firmware partition format (3rd Gen)\n" |
84 | "\t-ipod4g ipod firmware partition format (4th Gen, Mini, Nano, Photo/Color)\n" | 85 | "\t-ipod4g ipod firmware partition format (4th Gen, Mini, Nano, Photo/Color)\n" |
85 | "\t-ipod5g ipod firmware partition format (5th Gen - aka Video)\n" | 86 | "\t-ipod5g ipod firmware partition format (5th Gen - aka Video)\n" |
87 | "\t-gigabeat Toshiba Gigabeat format\n" | ||
86 | "\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n" | 88 | "\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n" |
87 | "\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n" | 89 | "\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n" |
88 | "\t-add=X Rockbox generic \"add-up\" checksum format\n" | 90 | "\t-add=X Rockbox generic \"add-up\" checksum format\n" |
@@ -219,6 +221,13 @@ int main (int argc, char** argv) | |||
219 | iriver_encode(iname, oname, FALSE); | 221 | iriver_encode(iname, oname, FALSE); |
220 | return 0; | 222 | return 0; |
221 | } | 223 | } |
224 | else if(!strcmp(argv[1], "-gigabeat")) { | ||
225 | /* iRiver code dealt with in the iriver.c code */ | ||
226 | iname = argv[2]; | ||
227 | oname = argv[3]; | ||
228 | gigabeat_code(iname, oname); | ||
229 | return 0; | ||
230 | } | ||
222 | else if(!strcmp(argv[1], "-iaudiox5")) { | 231 | else if(!strcmp(argv[1], "-iaudiox5")) { |
223 | iname = argv[2]; | 232 | iname = argv[2]; |
224 | oname = argv[3]; | 233 | oname = argv[3]; |