diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-06-08 18:04:10 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-06-08 18:04:10 +0000 |
commit | eebde2a3676f7dd11011fabd7c4d74f0cb6532d5 (patch) | |
tree | c8568e4f398f5a1e2fcfc1c937dbbbc18d0f1aeb /utils/MTP/beastpatcher/beastpatcher.c | |
parent | 5575f425d64b555ad2399ef6e4ae3d1efcb6627d (diff) | |
download | rockbox-eebde2a3676f7dd11011fabd7c4d74f0cb6532d5.tar.gz rockbox-eebde2a3676f7dd11011fabd7c4d74f0cb6532d5.zip |
Major W32 beastpatcher rework (FS#10220).
Update beastpatcher to scan for the device separately, rework MTP_DLL and modify to allow building with VS2005.
- include pstdint.h when building with VS2005 as VS doesn't have inttypes.h
- don't use bool in the DLL as VS doesn't support type bool in C.
- rearrange DLL files to avoid filename ambiguities with sendfirm.
- include MTP_DLL.h instead of duplicating prototypes. Adjust header for easy inclusion.
- make MTP_DLL project file also copy the resulting dll to MTP folder for convenience.
- extend MTP_DLL API for separate device scanning. Note that this (intentionally) breaks compatibility of the dll.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21221 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/MTP/beastpatcher/beastpatcher.c')
-rw-r--r-- | utils/MTP/beastpatcher/beastpatcher.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/utils/MTP/beastpatcher/beastpatcher.c b/utils/MTP/beastpatcher/beastpatcher.c index 0ba324883a..783b11f202 100644 --- a/utils/MTP/beastpatcher/beastpatcher.c +++ b/utils/MTP/beastpatcher/beastpatcher.c | |||
@@ -38,11 +38,17 @@ | |||
38 | ****************************************************************************/ | 38 | ****************************************************************************/ |
39 | 39 | ||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | #if !defined(_MSC_VER) | ||
41 | #include <unistd.h> | 42 | #include <unistd.h> |
42 | #include <fcntl.h> | 43 | #include <fcntl.h> |
44 | #endif | ||
43 | #include <string.h> | 45 | #include <string.h> |
44 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #if !defined(_MSC_VER) | ||
45 | #include <inttypes.h> | 48 | #include <inttypes.h> |
49 | #else | ||
50 | #include "pstdint.h" | ||
51 | #endif | ||
46 | #include <sys/types.h> | 52 | #include <sys/types.h> |
47 | #include <sys/stat.h> | 53 | #include <sys/stat.h> |
48 | 54 | ||
@@ -70,10 +76,10 @@ void print_usage(void) | |||
70 | 76 | ||
71 | static void put_uint32le(uint32_t x, unsigned char* p) | 77 | static void put_uint32le(uint32_t x, unsigned char* p) |
72 | { | 78 | { |
73 | p[0] = x & 0xff; | 79 | p[0] = (unsigned char)(x & 0xff); |
74 | p[1] = (x >> 8) & 0xff; | 80 | p[1] = (unsigned char)((x >> 8) & 0xff); |
75 | p[2] = (x >> 16) & 0xff; | 81 | p[2] = (unsigned char)((x >> 16) & 0xff); |
76 | p[3] = (x >> 24) & 0xff; | 82 | p[3] = (unsigned char)((x >> 24) & 0xff); |
77 | } | 83 | } |
78 | 84 | ||
79 | static uint32_t calc_csum(const unsigned char* pb, int cb) | 85 | static uint32_t calc_csum(const unsigned char* pb, int cb) |
@@ -94,7 +100,7 @@ static void create_single_boot(unsigned char* boot, int bootlen, | |||
94 | *fwsize = 15 + 16 + 12 + bootlen + 12; | 100 | *fwsize = 15 + 16 + 12 + bootlen + 12; |
95 | *fwbuf = malloc(*fwsize); | 101 | *fwbuf = malloc(*fwsize); |
96 | 102 | ||
97 | if(buf == NULL) { | 103 | if(fwbuf == NULL) { |
98 | fprintf(stderr, "[ERR] Cannot allocate memory.\n" ); | 104 | fprintf(stderr, "[ERR] Cannot allocate memory.\n" ); |
99 | *fwbuf = NULL; | 105 | *fwbuf = NULL; |
100 | *fwsize = 0; | 106 | *fwsize = 0; |