summaryrefslogtreecommitdiff
path: root/tools/scramble.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/scramble.c')
-rw-r--r--tools/scramble.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/tools/scramble.c b/tools/scramble.c
index 4e3addfc26..df6c5ac084 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -20,6 +20,8 @@
20#include <stdio.h> 20#include <stdio.h>
21#include <stdlib.h> 21#include <stdlib.h>
22 22
23#include "iriver.h"
24
23void int2le(unsigned int val, unsigned char* addr) 25void int2le(unsigned int val, unsigned char* addr)
24{ 26{
25 addr[0] = val & 0xFF; 27 addr[0] = val & 0xFF;
@@ -36,6 +38,22 @@ void int2be(unsigned int val, unsigned char* addr)
36 addr[3] = val & 0xFF; 38 addr[3] = val & 0xFF;
37} 39}
38 40
41void usage(void)
42{
43 printf("usage: scramble [options] <input file> <output file> [xor string]\n");
44 printf("options:\n"
45 "\t-fm Archos FM recorder format\n"
46 "\t-v2 Archos V2 recorder format\n"
47 "\t-ofm Archos Ondio FM recorder format\n"
48 "\t-osp Archos Ondio SP format\n"
49 "\t-neo SSI Neo format\n"
50 "\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
51 "\t-iriver iRiver format\n"
52 "\nNo option results in Archos standard player/recorder format.\n");
53
54 exit(1);
55}
56
39int main (int argc, char** argv) 57int main (int argc, char** argv)
40{ 58{
41 unsigned long length,i,slen; 59 unsigned long length,i,slen;
@@ -51,16 +69,7 @@ int main (int argc, char** argv)
51 enum { none, scramble, xor } method = scramble; 69 enum { none, scramble, xor } method = scramble;
52 70
53 if (argc < 3) { 71 if (argc < 3) {
54 printf("usage: %s [options] <input file> <output file> [xor string]\n",argv[0]); 72 usage();
55 printf("options:\n");
56 printf("\t-fm Archos FM recorder format\n");
57 printf("\t-v2 Archos V2 recorder format\n");
58 printf("\t-ofm Archos Ondio FM recorder format\n");
59 printf("\t-osp Archos Ondio SP format\n");
60 printf("\t-neo SSI Neo format\n");
61 printf("\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n");
62 printf("\nNo option results in Archos standard player/recorder format.\n");
63 return -1;
64 } 73 }
65 74
66 if(!strcmp(argv[1], "-fm")) { 75 if(!strcmp(argv[1], "-fm")) {
@@ -111,6 +120,14 @@ int main (int argc, char** argv)
111 } 120 }
112 } 121 }
113 122
123 else if(!strcmp(argv[1], "-iriver")) {
124 /* iRiver code dealt with in the iriver.c code */
125 iname = argv[2];
126 oname = argv[3];
127 iriver_encode(iname, oname, FALSE);
128 return 0;
129 }
130
114 /* open file */ 131 /* open file */
115 file = fopen(iname,"rb"); 132 file = fopen(iname,"rb");
116 if (!file) { 133 if (!file) {