diff options
-rw-r--r-- | apps/Makefile | 2 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/app.lds | 8 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/crt0.S | 4 | ||||
-rwxr-xr-x | tools/configure | 5 | ||||
-rw-r--r-- | tools/creative.c | 144 | ||||
-rw-r--r-- | tools/creative.h | 5 |
6 files changed, 96 insertions, 72 deletions
diff --git a/apps/Makefile b/apps/Makefile index 2c7f59012a..7fb704634d 100644 --- a/apps/Makefile +++ b/apps/Makefile | |||
@@ -147,7 +147,7 @@ $(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(VOICE) $( | |||
147 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox $(LINKVOICE) $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map | 147 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox $(LINKVOICE) $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map |
148 | 148 | ||
149 | $(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf | 149 | $(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf |
150 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ | 150 | $(call PRINTS,OBJCOPY $(@F))$(if $(filter yes, $(USE_ELF)), cp $< $@, $(OC) -O binary $< $@) |
151 | 151 | ||
152 | $(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf | 152 | $(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf |
153 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ | 153 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ |
diff --git a/firmware/target/arm/tms320dm320/app.lds b/firmware/target/arm/tms320dm320/app.lds index 64610a3577..0a9aa85bc4 100644 --- a/firmware/target/arm/tms320dm320/app.lds +++ b/firmware/target/arm/tms320dm320/app.lds | |||
@@ -81,9 +81,13 @@ SECTIONS | |||
81 | _vectorsstart = .; | 81 | _vectorsstart = .; |
82 | *(.vectors); | 82 | *(.vectors); |
83 | _vectorsend = .; | 83 | _vectorsend = .; |
84 | #ifndef CREATIVE_ZVx | ||
84 | } > IRAM AT> DRAM | 85 | } > IRAM AT> DRAM |
85 | 86 | ||
86 | _vectorscopy = LOADADDR(.vectors); | 87 | _vectorscopy = LOADADDR(.vectors); |
88 | #else | ||
89 | } > IRAM | ||
90 | #endif | ||
87 | 91 | ||
88 | .iram : | 92 | .iram : |
89 | { | 93 | { |
@@ -93,9 +97,13 @@ SECTIONS | |||
93 | *(.idata) | 97 | *(.idata) |
94 | . = ALIGN(0x4); | 98 | . = ALIGN(0x4); |
95 | _iramend = .; | 99 | _iramend = .; |
100 | #ifndef CREATIVE_ZVx | ||
96 | } > IRAM AT> DRAM | 101 | } > IRAM AT> DRAM |
97 | 102 | ||
98 | _iramcopy = LOADADDR(.iram); | 103 | _iramcopy = LOADADDR(.iram); |
104 | #else | ||
105 | } > IRAM | ||
106 | #endif | ||
99 | 107 | ||
100 | .ibss (NOLOAD) : | 108 | .ibss (NOLOAD) : |
101 | { | 109 | { |
diff --git a/firmware/target/arm/tms320dm320/crt0.S b/firmware/target/arm/tms320dm320/crt0.S index a0b5a5abfb..ba5daa9117 100755 --- a/firmware/target/arm/tms320dm320/crt0.S +++ b/firmware/target/arm/tms320dm320/crt0.S | |||
@@ -44,6 +44,7 @@ start: | |||
44 | 44 | ||
45 | msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ | 45 | msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ |
46 | 46 | ||
47 | #ifndef CREATIVE_ZVx | ||
47 | /* Copy exception handler code to address 0 */ | 48 | /* Copy exception handler code to address 0 */ |
48 | ldr r2, =_vectorsstart | 49 | ldr r2, =_vectorsstart |
49 | ldr r3, =_vectorsend | 50 | ldr r3, =_vectorsend |
@@ -53,6 +54,7 @@ start: | |||
53 | ldrhi r5, [r4], #4 | 54 | ldrhi r5, [r4], #4 |
54 | strhi r5, [r2], #4 | 55 | strhi r5, [r2], #4 |
55 | bhi 1b | 56 | bhi 1b |
57 | #endif | ||
56 | 58 | ||
57 | /* Disable data and instruction cache, high vectors (at 0xffff0000 instead of 0x00000000) */ | 59 | /* Disable data and instruction cache, high vectors (at 0xffff0000 instead of 0x00000000) */ |
58 | mrc p15, 0, r0, c1, c0, 0 | 60 | mrc p15, 0, r0, c1, c0, 0 |
@@ -105,6 +107,7 @@ start: | |||
105 | strhi r4, [r2], #4 | 107 | strhi r4, [r2], #4 |
106 | bhi 1b | 108 | bhi 1b |
107 | 109 | ||
110 | #ifndef CREATIVE_ZVx | ||
108 | /* Copy the IRAM */ | 111 | /* Copy the IRAM */ |
109 | ldr r2, =_iramcopy | 112 | ldr r2, =_iramcopy |
110 | ldr r3, =_iramstart | 113 | ldr r3, =_iramstart |
@@ -114,6 +117,7 @@ start: | |||
114 | ldrhi r5, [r2], #4 | 117 | ldrhi r5, [r2], #4 |
115 | strhi r5, [r3], #4 | 118 | strhi r5, [r3], #4 |
116 | bhi 1b | 119 | bhi 1b |
120 | #endif | ||
117 | #endif /* !BOOTLOADER,!STUB */ | 121 | #endif /* !BOOTLOADER,!STUB */ |
118 | 122 | ||
119 | /* Initialise bss section to zero */ | 123 | /* Initialise bss section to zero */ |
diff --git a/tools/configure b/tools/configure index 27d6d43c4c..7fffcfdb6a 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -1464,6 +1464,7 @@ fi | |||
1464 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" | 1464 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" |
1465 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" | 1465 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" |
1466 | tool="$rootdir/tools/scramble -creative=zvm" | 1466 | tool="$rootdir/tools/scramble -creative=zvm" |
1467 | USE_ELF="yes" | ||
1467 | output="rockbox.zvm" | 1468 | output="rockbox.zvm" |
1468 | appextra="recorder:gui" | 1469 | appextra="recorder:gui" |
1469 | plugins="" | 1470 | plugins="" |
@@ -1488,6 +1489,7 @@ fi | |||
1488 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" | 1489 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" |
1489 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" | 1490 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" |
1490 | tool="$rootdir/tools/scramble -creative=zvm60" | 1491 | tool="$rootdir/tools/scramble -creative=zvm60" |
1492 | USE_ELF="yes" | ||
1491 | output="rockbox.zvm60" | 1493 | output="rockbox.zvm60" |
1492 | appextra="recorder:gui" | 1494 | appextra="recorder:gui" |
1493 | plugins="" | 1495 | plugins="" |
@@ -1512,6 +1514,7 @@ fi | |||
1512 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" | 1514 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" |
1513 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" | 1515 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" |
1514 | tool="$rootdir/tools/scramble -creative=zenvision" | 1516 | tool="$rootdir/tools/scramble -creative=zenvision" |
1517 | USE_ELF="yes" | ||
1515 | output="rockbox.zv" | 1518 | output="rockbox.zv" |
1516 | appextra="recorder:gui" | 1519 | appextra="recorder:gui" |
1517 | plugins="" | 1520 | plugins="" |
@@ -2072,6 +2075,7 @@ sed > Makefile \ | |||
2072 | -e "s,@TTS_OPTS@,${TTS_OPTS},g" \ | 2075 | -e "s,@TTS_OPTS@,${TTS_OPTS},g" \ |
2073 | -e "s,@VOICETOOLSET@,${voicetoolset},g" \ | 2076 | -e "s,@VOICETOOLSET@,${voicetoolset},g" \ |
2074 | -e "s,@LANGS@,${buildlangs},g" \ | 2077 | -e "s,@LANGS@,${buildlangs},g" \ |
2078 | -e "s,@USE_ELF@,${USE_ELF},g" \ | ||
2075 | <<EOF | 2079 | <<EOF |
2076 | ## Automatically generated. http://www.rockbox.org/ | 2080 | ## Automatically generated. http://www.rockbox.org/ |
2077 | 2081 | ||
@@ -2145,6 +2149,7 @@ export TTS_OPTS=@TTS_OPTS@ | |||
2145 | export TTS_ENGINE=@TTS_ENGINE@ | 2149 | export TTS_ENGINE=@TTS_ENGINE@ |
2146 | export ENC_OPTS=@ENC_OPTS@ | 2150 | export ENC_OPTS=@ENC_OPTS@ |
2147 | export ENCODER=@ENCODER@ | 2151 | export ENCODER=@ENCODER@ |
2152 | export USE_ELF=@USE_ELF@ | ||
2148 | 2153 | ||
2149 | # Do not print "Entering directory ..." | 2154 | # Do not print "Entering directory ..." |
2150 | MAKEFLAGS += --no-print-directory | 2155 | MAKEFLAGS += --no-print-directory |
diff --git a/tools/creative.c b/tools/creative.c index 287df03a7c..7748f56611 100644 --- a/tools/creative.c +++ b/tools/creative.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <string.h> | 23 | #include <string.h> |
24 | #include <elf.h> | ||
24 | 25 | ||
25 | #include "creative.h" | 26 | #include "creative.h" |
26 | #include "hmac-sha1.h" | 27 | #include "hmac-sha1.h" |
@@ -30,36 +31,19 @@ static const char null_key_v2[] = "CTL:N0MAD|PDE0.DPMP."; | |||
30 | static const char null_key_v3[] = "CTL:Z3N07|PDE0.DPMP."; | 31 | static const char null_key_v3[] = "CTL:Z3N07|PDE0.DPMP."; |
31 | static const char null_key_v4[] = "CTL:N0MAD|PDE0.DPFP."; | 32 | static const char null_key_v4[] = "CTL:N0MAD|PDE0.DPFP."; |
32 | 33 | ||
33 | static const unsigned char bootloader_v1[] = | ||
34 | { | ||
35 | 0xD3, 0xF0, 0x29, 0xE3, /* MSR CPSR_cf, #0xD3 */ | ||
36 | 0x09, 0xF6, 0xA0, 0xE3 /* MOV PC, #0x900000 */ | ||
37 | }; | ||
38 | |||
39 | static const unsigned char bootloader_v2[] = | ||
40 | { | ||
41 | 0xD3, 0xF0, 0x29, 0xE3, /* MSR CPSR_cf, #0xD3 */ | ||
42 | 0x09, 0xF6, 0xA0, 0xE3 /* MOV PC, #0x40000000 */ | ||
43 | }; | ||
44 | |||
45 | static const unsigned char bootloader_v3[] = | ||
46 | { | ||
47 | 0 /* Unknown */ | ||
48 | }; | ||
49 | |||
50 | static const struct device_info devices[] = | 34 | static const struct device_info devices[] = |
51 | { | 35 | { |
52 | /* Creative Zen Vision:M */ | 36 | /* Creative Zen Vision:M */ |
53 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0:\0M", 42, null_key_v2, bootloader_v1, sizeof(bootloader_v1), 0x00900000}, | 37 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0:\0M", 42, null_key_v2}, |
54 | /* Creative Zen Vision:M Go! */ | 38 | /* Creative Zen Vision:M Go! */ |
55 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0:\0M\0 \0G\0o\0!", 50, null_key_v2, bootloader_v1, sizeof(bootloader_v1), 0x00900000}, | 39 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0:\0M\0 \0G\0o\0!", 50, null_key_v2}, |
56 | /* Creative Zen Vision © TL */ | 40 | /* Creative Zen Vision © TL */ |
57 | /* The "©" should be ANSI encoded or the device won't accept the firmware package. */ | 41 | /* The "©" should be ANSI encoded or the device won't accept the firmware package. */ |
58 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0 \0©\0T\0L", 46, null_key_v2, bootloader_v1, sizeof(bootloader_v1), 0x00900000}, | 42 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0e\0n\0 \0V\0i\0s\0i\0o\0n\0 \0©\0T\0L", 46, null_key_v2}, |
59 | /* Creative ZEN V */ | 43 | /* Creative ZEN V */ |
60 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0E\0N\0 \0V", 42, null_key_v4, bootloader_v3, sizeof(bootloader_v3), 0x00000000}, | 44 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0E\0N\0 \0V", 42, null_key_v4}, |
61 | /* Creative ZEN */ | 45 | /* Creative ZEN */ |
62 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0E\0N", 48, null_key_v3, bootloader_v2, sizeof(bootloader_v2), 0x40000000} | 46 | {"C\0r\0e\0a\0t\0i\0v\0e\0 \0Z\0E\0N", 48, null_key_v3} |
63 | }; | 47 | }; |
64 | 48 | ||
65 | /* | 49 | /* |
@@ -69,7 +53,7 @@ extern void int2le(unsigned int val, unsigned char* addr); | |||
69 | extern unsigned int le2int(unsigned char* buf); | 53 | extern unsigned int le2int(unsigned char* buf); |
70 | 54 | ||
71 | 55 | ||
72 | static int make_ciff_file(unsigned char *inbuf, unsigned int length, | 56 | static int make_ciff_file(const unsigned char *inbuf, unsigned int length, |
73 | unsigned char *outbuf, int device) | 57 | unsigned char *outbuf, int device) |
74 | { | 58 | { |
75 | unsigned char key[20]; | 59 | unsigned char key[20]; |
@@ -83,7 +67,8 @@ static int make_ciff_file(unsigned char *inbuf, unsigned int length, | |||
83 | memcpy(&outbuf[0x70], "ATAD", 4); | 67 | memcpy(&outbuf[0x70], "ATAD", 4); |
84 | int2le(length+32, &outbuf[0x74]); | 68 | int2le(length+32, &outbuf[0x74]); |
85 | memcpy(&outbuf[0x78], "H\0j\0u\0k\0e\0b\0o\0x\0\x32\0.\0j\0r\0m", | 69 | memcpy(&outbuf[0x78], "H\0j\0u\0k\0e\0b\0o\0x\0\x32\0.\0j\0r\0m", |
86 | 32); /*Unicode encoded*/ | 70 | 25); /*Unicode encoded*/ |
71 | memset(&outbuf[0x78+25], 0, 32); | ||
87 | memcpy(&outbuf[0x98], inbuf, length); | 72 | memcpy(&outbuf[0x98], inbuf, length); |
88 | memcpy(&outbuf[0x98+length], "LLUN", 4); | 73 | memcpy(&outbuf[0x98+length], "LLUN", 4); |
89 | int2le(20, &outbuf[0x98+length+4]); | 74 | int2le(20, &outbuf[0x98+length+4]); |
@@ -94,57 +79,76 @@ static int make_ciff_file(unsigned char *inbuf, unsigned int length, | |||
94 | return length+0x90+0x1C+8; | 79 | return length+0x90+0x1C+8; |
95 | } | 80 | } |
96 | 81 | ||
97 | static int make_jrm_file(unsigned char *inbuf, unsigned int length, | 82 | static int elf_convert(const unsigned char *inbuf, unsigned char *outbuf) |
98 | unsigned char *outbuf, int device) | ||
99 | { | 83 | { |
100 | unsigned int i; | 84 | Elf32_Ehdr *main_header; |
101 | unsigned int sum = 0; | 85 | Elf32_Shdr *section_header; |
86 | unsigned int i, j, sum, startaddr; | ||
87 | |||
88 | main_header = (Elf32_Ehdr*)inbuf; | ||
89 | if( !( main_header->e_ident[0] == ELFMAG0 && main_header->e_ident[1] == ELFMAG1 | ||
90 | && main_header->e_ident[2] == ELFMAG2 && main_header->e_ident[3] == ELFMAG3 ) ) | ||
91 | { | ||
92 | printf("Invalid ELF header!\n"); | ||
93 | return -1; | ||
94 | } | ||
95 | |||
96 | startaddr = (unsigned int)outbuf; | ||
97 | |||
98 | for(i = 0; i < main_header->e_shnum; i++) | ||
99 | { | ||
100 | section_header = (Elf32_Shdr*)(inbuf+main_header->e_shoff+i*sizeof(Elf32_Shdr)); | ||
101 | |||
102 | if( (section_header->sh_flags & SHF_WRITE || section_header->sh_flags & SHF_ALLOC | ||
103 | || section_header->sh_flags & SHF_EXECINSTR) && section_header->sh_size > 0 | ||
104 | && section_header->sh_type != SHT_NOBITS ) | ||
105 | { | ||
106 | /* Address */ | ||
107 | int2le(section_header->sh_addr, outbuf); | ||
108 | outbuf += 4; | ||
109 | /* Size */ | ||
110 | int2le(section_header->sh_size, outbuf); | ||
111 | outbuf += 4; | ||
112 | /* Checksum */ | ||
113 | sum = 0; | ||
114 | for(j=0; j<section_header->sh_size; j+= 4) | ||
115 | sum += le2int((unsigned char*)(inbuf+section_header->sh_offset+j)) + (le2int((unsigned char*)(inbuf+section_header->sh_offset+j))>>16); | ||
116 | int2le(sum, outbuf); | ||
117 | outbuf += 2; | ||
118 | memset(outbuf, 0, 2); | ||
119 | outbuf += 2; | ||
120 | /* Data */ | ||
121 | memcpy(outbuf, inbuf+section_header->sh_offset, section_header->sh_size); | ||
122 | outbuf += section_header->sh_size; | ||
123 | } | ||
124 | } | ||
125 | return (unsigned int)(outbuf - startaddr); | ||
126 | } | ||
127 | |||
128 | static int make_jrm_file(const unsigned char *inbuf, unsigned char *outbuf) | ||
129 | { | ||
130 | int length; | ||
102 | 131 | ||
103 | /* Clear the header area to zero */ | 132 | /* Clear the header area to zero */ |
104 | memset(outbuf, 0, 0x18); | 133 | memset(outbuf, 0, 0x18); |
105 | 134 | ||
106 | /* Header (EDOC) */ | 135 | /* Header (EDOC) */ |
107 | memcpy(outbuf, "EDOC", 4); | 136 | memcpy(outbuf, "EDOC", 4); |
108 | /* Total Size */ | 137 | /* Total Size: temporarily set to 0 */ |
109 | #define SIZEOF_BOOTLOADER_CODE devices[device].bootloader_size | 138 | memset(&outbuf[0x4], 0, 4); |
110 | int2le(4+0xC+SIZEOF_BOOTLOADER_CODE+0xC+length, &outbuf[0x4]); | ||
111 | /* 4 bytes of zero */ | 139 | /* 4 bytes of zero */ |
112 | memset(&outbuf[0x8], 0, 0x4); | 140 | memset(&outbuf[0x8], 0, 4); |
113 | 141 | ||
114 | /* First block starts here ... */ | 142 | length = elf_convert(inbuf, &outbuf[0xC]); |
115 | /* Address = 0x0 */ | 143 | if(length < 0) |
116 | memset(&outbuf[0xC], 0, 0x4); | 144 | return -1; |
117 | /* Size */ | 145 | /* Now set the actual Total Size */ |
118 | int2le(SIZEOF_BOOTLOADER_CODE, &outbuf[0x10]); | 146 | int2le(4+length, &outbuf[0x4]); |
119 | /* Checksum */ | 147 | |
120 | for(i=0; i<SIZEOF_BOOTLOADER_CODE; i+= 4) | 148 | return 0xC+length; |
121 | sum += le2int((unsigned char*)&devices[device].bootloader[i]) + (le2int((unsigned char*)&devices[device].bootloader[i])>>16); | ||
122 | int2le(sum, &outbuf[0x14]); | ||
123 | outbuf[0x16] = 0; | ||
124 | outbuf[0x17] = 0; | ||
125 | /*Data */ | ||
126 | memcpy(&outbuf[0x18], devices[device].bootloader, SIZEOF_BOOTLOADER_CODE); | ||
127 | |||
128 | /* Second block starts here ... */ | ||
129 | /* Address = depends on target */ | ||
130 | #define SB_START (0x18+SIZEOF_BOOTLOADER_CODE) | ||
131 | int2le(devices[device].memory_address, &outbuf[SB_START]); | ||
132 | /* Size */ | ||
133 | int2le(length, &outbuf[SB_START+0x4]); | ||
134 | /* Checksum */ | ||
135 | sum = 0; | ||
136 | for(i=0; i<length; i+= 4) | ||
137 | sum += le2int(&inbuf[i]) + (le2int(&inbuf[i])>>16); | ||
138 | int2le(sum, &outbuf[SB_START+0x8]); | ||
139 | outbuf[SB_START+0xA] = 0; | ||
140 | outbuf[SB_START+0xB] = 0; | ||
141 | /* Data */ | ||
142 | memcpy(&outbuf[SB_START+0xC], inbuf, length); | ||
143 | |||
144 | return SB_START+0xC+length; | ||
145 | } | 149 | } |
146 | 150 | ||
147 | int zvm_encode(char *iname, char *oname, int device) | 151 | int zvm_encode(const char *iname, const char *oname, int device) |
148 | { | 152 | { |
149 | size_t len; | 153 | size_t len; |
150 | int length; | 154 | int length; |
@@ -164,7 +168,7 @@ int zvm_encode(char *iname, char *oname, int device) | |||
164 | 168 | ||
165 | buf = (unsigned char*)malloc(length); | 169 | buf = (unsigned char*)malloc(length); |
166 | if ( !buf ) { | 170 | if ( !buf ) { |
167 | printf("out of memory!\n"); | 171 | printf("Out of memory!\n"); |
168 | return -1; | 172 | return -1; |
169 | } | 173 | } |
170 | 174 | ||
@@ -178,11 +182,17 @@ int zvm_encode(char *iname, char *oname, int device) | |||
178 | outbuf = (unsigned char*)malloc(length+0x300); | 182 | outbuf = (unsigned char*)malloc(length+0x300); |
179 | if ( !outbuf ) { | 183 | if ( !outbuf ) { |
180 | free(buf); | 184 | free(buf); |
181 | printf("out of memory!\n"); | 185 | printf("Out of memory!\n"); |
182 | return -1; | 186 | return -1; |
183 | } | 187 | } |
184 | length = make_jrm_file(buf, len, outbuf, device); | 188 | length = make_jrm_file(buf, outbuf); |
185 | free(buf); | 189 | free(buf); |
190 | if(length < 0) | ||
191 | { | ||
192 | free(outbuf); | ||
193 | printf("Error in making JRM file!\n"); | ||
194 | return -1; | ||
195 | } | ||
186 | buf = (unsigned char*)malloc(length+0x200); | 196 | buf = (unsigned char*)malloc(length+0x200); |
187 | memset(buf, 0, length+0x200); | 197 | memset(buf, 0, length+0x200); |
188 | length = make_ciff_file(outbuf, length, buf, device); | 198 | length = make_ciff_file(outbuf, length, buf, device); |
diff --git a/tools/creative.h b/tools/creative.h index a4ca9ce2da..5d9aa20d7d 100644 --- a/tools/creative.h +++ b/tools/creative.h | |||
@@ -34,11 +34,8 @@ struct device_info | |||
34 | const char* cinf; /*Must be Unicode encoded*/ | 34 | const char* cinf; /*Must be Unicode encoded*/ |
35 | const unsigned int cinf_size; | 35 | const unsigned int cinf_size; |
36 | const char* null; | 36 | const char* null; |
37 | const unsigned char* bootloader; | ||
38 | const unsigned int bootloader_size; | ||
39 | const unsigned int memory_address; | ||
40 | }; | 37 | }; |
41 | 38 | ||
42 | int zvm_encode(char *iname, char *oname, int device); | 39 | int zvm_encode(const char *iname, const char *oname, int device); |
43 | 40 | ||
44 | #endif /*CREATIVE_H_*/ | 41 | #endif /*CREATIVE_H_*/ |