summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile7
-rw-r--r--tools/iaudio_bl_flash.bmpbin0 -> 5240 bytes
-rw-r--r--tools/scramble.c12
3 files changed, 17 insertions, 2 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 17887b2d48..6351e5bec4 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -18,16 +18,19 @@ CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
18all: 18all:
19 @echo "Run make in your build directory!" 19 @echo "Run make in your build directory!"
20 20
21scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o 21scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o iaudio_bl_flash.o
22descramble: descramble.o iriver.o gigabeat.o 22descramble: descramble.o iriver.o gigabeat.o
23 23
24scramble.o: scramble.c iriver.h mi4.h gigabeat.h telechips.h 24scramble.o: scramble.c iriver.h mi4.h gigabeat.h telechips.h iaudio_bl_flash.h
25descramble.o: descramble.c iriver.h gigabeat.h 25descramble.o: descramble.c iriver.h gigabeat.h
26iriver.o: iriver.c iriver.h 26iriver.o: iriver.c iriver.h
27gigabeat.o: gigabeat.c gigabeat.h 27gigabeat.o: gigabeat.c gigabeat.h
28gigabeats.o: gigabeats.c gigabeats.h 28gigabeats.o: gigabeats.c gigabeats.h
29mi4.o: mi4.c mi4.h 29mi4.o: mi4.c mi4.h
30telechips.o: telechips.c telechips.h 30telechips.o: telechips.c telechips.h
31iaudio_bl_flash.o: iaudio_bl_flash.c iaudio_bl_flash.h
32iaudio_bl_flash.c iaudio_bl_flash.h: iaudio_bl_flash.bmp bmp2rb
33 $(SILENT)./bmp2rb -f 7 -h . $< >iaudio_bl_flash.c
31 34
32sh2d: sh2d.c 35sh2d: sh2d.c
33 36
diff --git a/tools/iaudio_bl_flash.bmp b/tools/iaudio_bl_flash.bmp
new file mode 100644
index 0000000000..093fe1481d
--- /dev/null
+++ b/tools/iaudio_bl_flash.bmp
Binary files differ
diff --git a/tools/scramble.c b/tools/scramble.c
index 0a5230068c..b49bde10a2 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -26,6 +26,7 @@
26#include "gigabeats.h" 26#include "gigabeats.h"
27#include "mi4.h" 27#include "mi4.h"
28#include "telechips.h" 28#include "telechips.h"
29#include "iaudio_bl_flash.h"
29 30
30int iaudio_encode(char *iname, char *oname, char *idstring); 31int iaudio_encode(char *iname, char *oname, char *idstring);
31int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc); 32int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
@@ -77,6 +78,12 @@ void int2be(unsigned int val, unsigned char* addr)
77 addr[3] = val & 0xFF; 78 addr[3] = val & 0xFF;
78} 79}
79 80
81void short2be(unsigned short val, unsigned char* addr)
82{
83 addr[0] = (val >> 8) & 0xff;
84 addr[1] = val & 0xFF;
85}
86
80void usage(void) 87void usage(void)
81{ 88{
82 printf("usage: scramble [options] <input file> <output file> [xor string]\n"); 89 printf("usage: scramble [options] <input file> <output file> [xor string]\n");
@@ -586,6 +593,11 @@ int iaudio_encode(char *iname, char *oname, char *idstring)
586 593
587 memset(outbuf, 0, 0x1030); 594 memset(outbuf, 0, 0x1030);
588 strcpy((char *)outbuf, idstring); 595 strcpy((char *)outbuf, idstring);
596 memcpy(outbuf+0x20, iaudio_bl_flash,
597 BMPWIDTH_iaudio_bl_flash * (BMPHEIGHT_iaudio_bl_flash/8) * 2);
598 short2be(BMPWIDTH_iaudio_bl_flash, &outbuf[0x10]);
599 short2be((BMPHEIGHT_iaudio_bl_flash/8), &outbuf[0x12]);
600 outbuf[0x19] = 2;
589 601
590 for(i = 0; i < length;i++) 602 for(i = 0; i < length;i++)
591 sum += outbuf[0x1030 + i]; 603 sum += outbuf[0x1030 + i];