forked from len0rd/rockbox
add Gigabeat support to the scramble tools
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10817 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
530f31dbe9
commit
ae8d47574d
6 changed files with 122 additions and 7 deletions
|
@ -10,17 +10,18 @@ CFLAGS := -O -ansi -g
|
||||||
LDFLAGS := -g
|
LDFLAGS := -g
|
||||||
|
|
||||||
CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
|
CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
|
||||||
generate_rocklatin mkboot ipod_fw codepages uclpack mi4
|
generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "Run make in your build directory!"
|
@echo "Run make in your build directory!"
|
||||||
|
|
||||||
scramble: scramble.o iriver.o mi4.o
|
scramble: scramble.o iriver.o mi4.o gigabeat.o
|
||||||
descramble: descramble.o iriver.o
|
descramble: descramble.o iriver.o gigabeat.o
|
||||||
|
|
||||||
scramble.o: scramble.c iriver.h
|
scramble.o: scramble.c iriver.h mi4.h gigabeat.h
|
||||||
descramble.o: descramble.c iriver.h
|
descramble.o: descramble.c iriver.h gigabeat.h
|
||||||
iriver.o: iriver.c iriver.h
|
iriver.o: iriver.c iriver.h
|
||||||
|
gigabeat.o: gigabeat.c gigabeat.h
|
||||||
mi4.o: mi4.c mi4.h
|
mi4.o: mi4.c mi4.h
|
||||||
|
|
||||||
sh2d: sh2d.c
|
sh2d: sh2d.c
|
||||||
|
|
5
tools/configure
vendored
5
tools/configure
vendored
|
@ -454,7 +454,8 @@ EOF
|
||||||
iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
|
iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
|
||||||
iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
|
iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages"
|
||||||
ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
|
ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
|
||||||
# generic is used by Gigabeat, IFP, H10, Sansa-e200
|
gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages"
|
||||||
|
# generic is used by IFP, H10, Sansa-e200
|
||||||
genericbitmaptools="$toolset bmp2rb codepages"
|
genericbitmaptools="$toolset bmp2rb codepages"
|
||||||
|
|
||||||
|
|
||||||
|
@ -892,7 +893,7 @@ EOF
|
||||||
flash=""
|
flash=""
|
||||||
plugins="yes"
|
plugins="yes"
|
||||||
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
|
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a"
|
||||||
toolset=$genericbitmaptools
|
toolset=$gigabeatbitmaptools
|
||||||
# architecture, manufacturer and model for the target-tree build
|
# architecture, manufacturer and model for the target-tree build
|
||||||
t_cpu="arm"
|
t_cpu="arm"
|
||||||
t_manufacturer="gigabeat"
|
t_manufacturer="gigabeat"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "iriver.h"
|
#include "iriver.h"
|
||||||
|
#include "gigabeat.h"
|
||||||
|
|
||||||
int iaudio_decode(char *iname, char *oname);
|
int iaudio_decode(char *iname, char *oname);
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ void usage(void)
|
||||||
"\t-v2 Archos V2 recorder format\n"
|
"\t-v2 Archos V2 recorder format\n"
|
||||||
"\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
|
"\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
|
||||||
"\t-iriver iRiver format\n"
|
"\t-iriver iRiver format\n"
|
||||||
|
"\t-gigabeat Toshiba Gigabeat format\n"
|
||||||
"\t-iaudio iAudio format\n"
|
"\t-iaudio iAudio format\n"
|
||||||
"\nNo option assumes Archos standard player/recorder format.\n");
|
"\nNo option assumes Archos standard player/recorder format.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -73,6 +75,12 @@ int main (int argc, char** argv)
|
||||||
iriver_decode(iname, oname, FALSE, STRIP_NONE);
|
iriver_decode(iname, oname, FALSE, STRIP_NONE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(!strcmp(argv[1], "-gigabeat")) {
|
||||||
|
iname = argv[2];
|
||||||
|
oname = argv[3];
|
||||||
|
gigabeat_code(iname, oname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(!strcmp(argv[1], "-iaudio")) {
|
if(!strcmp(argv[1], "-iaudio")) {
|
||||||
iname = argv[2];
|
iname = argv[2];
|
||||||
|
|
76
tools/gigabeat.c
Normal file
76
tools/gigabeat.c
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 by Christian Hack
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static FILE * openinfile( const char * filename )
|
||||||
|
{
|
||||||
|
FILE * F = fopen( filename, "rb" );
|
||||||
|
if( F == NULL )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Couldn't open input file %s\n", filename );
|
||||||
|
perror( "Error was " );
|
||||||
|
exit( -1 );
|
||||||
|
};
|
||||||
|
return F;
|
||||||
|
};
|
||||||
|
|
||||||
|
static FILE * openoutfile( const char * filename )
|
||||||
|
{
|
||||||
|
FILE * F = fopen( filename, "wb" );
|
||||||
|
if( F == NULL )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Couldn't open output file %s\n", filename );
|
||||||
|
perror( "Error was " );
|
||||||
|
exit( -1 );
|
||||||
|
};
|
||||||
|
return F;
|
||||||
|
};
|
||||||
|
|
||||||
|
int gigabeat_code(char *infile, char *outfile)
|
||||||
|
{
|
||||||
|
FILE *in, *out;
|
||||||
|
unsigned long size = 0;
|
||||||
|
unsigned long bytes_read;
|
||||||
|
unsigned long data;
|
||||||
|
unsigned long key = 0x19751217;
|
||||||
|
|
||||||
|
in = openinfile(infile);
|
||||||
|
out = openoutfile(outfile);
|
||||||
|
|
||||||
|
while (!feof(in)) {
|
||||||
|
bytes_read = fread(&data, 1, 4, in);
|
||||||
|
|
||||||
|
data = data ^ key;
|
||||||
|
|
||||||
|
key = key + (key << 1);
|
||||||
|
key = key + 0x19751217;
|
||||||
|
|
||||||
|
size += bytes_read;
|
||||||
|
|
||||||
|
fwrite(&data, 1, bytes_read, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "File processed successfully\n" );
|
||||||
|
|
||||||
|
fclose(in);
|
||||||
|
fclose(out);
|
||||||
|
return(0);
|
||||||
|
}
|
20
tools/gigabeat.h
Normal file
20
tools/gigabeat.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 by Marcoen Hirschberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int gigabeat_code(char *infile, char *outfile);
|
|
@ -22,6 +22,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "iriver.h"
|
#include "iriver.h"
|
||||||
|
#include "gigabeat.h"
|
||||||
#include "mi4.h"
|
#include "mi4.h"
|
||||||
|
|
||||||
int iaudio_encode(char *iname, char *oname, char *idstring);
|
int iaudio_encode(char *iname, char *oname, char *idstring);
|
||||||
|
@ -83,6 +84,7 @@ void usage(void)
|
||||||
"\t-ipod3g ipod firmware partition format (3rd Gen)\n"
|
"\t-ipod3g ipod firmware partition format (3rd Gen)\n"
|
||||||
"\t-ipod4g ipod firmware partition format (4th Gen, Mini, Nano, Photo/Color)\n"
|
"\t-ipod4g ipod firmware partition format (4th Gen, Mini, Nano, Photo/Color)\n"
|
||||||
"\t-ipod5g ipod firmware partition format (5th Gen - aka Video)\n"
|
"\t-ipod5g ipod firmware partition format (5th Gen - aka Video)\n"
|
||||||
|
"\t-gigabeat Toshiba Gigabeat format\n"
|
||||||
"\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n"
|
"\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n"
|
||||||
"\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n"
|
"\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n"
|
||||||
"\t-add=X Rockbox generic \"add-up\" checksum format\n"
|
"\t-add=X Rockbox generic \"add-up\" checksum format\n"
|
||||||
|
@ -219,6 +221,13 @@ int main (int argc, char** argv)
|
||||||
iriver_encode(iname, oname, FALSE);
|
iriver_encode(iname, oname, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if(!strcmp(argv[1], "-gigabeat")) {
|
||||||
|
/* iRiver code dealt with in the iriver.c code */
|
||||||
|
iname = argv[2];
|
||||||
|
oname = argv[3];
|
||||||
|
gigabeat_code(iname, oname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else if(!strcmp(argv[1], "-iaudiox5")) {
|
else if(!strcmp(argv[1], "-iaudiox5")) {
|
||||||
iname = argv[2];
|
iname = argv[2];
|
||||||
oname = argv[3];
|
oname = argv[3];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue