Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyongzheng committed Aug 14, 2012
1 parent 434b87e commit 61c9528
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ gimgtools is a set of command-line tools to examine and manipulate Garmin IMG

* gimgunlock: Unlock a locked map so that it can be used on ALL devices. There
is no need to specify your device ID or map keys. It works by decrypting
the TRE section. The decrypting key is the same for all maps. If you like
Garmin, please buy their map!
the TRE sections, since the encryption key is also stored in the maps!
Usage: gimgunlock map.img
If you like Garmin, please buy their map!
* gimgxor: Some maps have been scrambled by a trival XOR algorithm. They do
not work with other gimg* tools. You can use gimgxor to unscramble them.
Usage: gimgxor map.img
Expand Down
10 changes: 5 additions & 5 deletions gimgunlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ int read_byte_at (FILE *fp, unsigned long offset)
return getc(fp);
}

unsigned int read_2byte_at (FILE *fp, unsigned long offset)
int read_2byte_at (FILE *fp, unsigned long offset)
{
unsigned int n = 0;
unsigned char buff[2];
if (fseek(fp, offset, SEEK_SET)) {
perror(NULL);
exit(1);
}
if (fread(&n, 2, 1, fp) != 1) {
if (fread(&buff, 2, 1, fp) != 1) {
perror(NULL);
exit(1);
}
return n;
return (buff[1] << 8) | buff[0];
}

unsigned int read_4byte_at (FILE *fp, unsigned long offset)
unsigned int read_4byte_at (FILE *fp, unsigned long offset) //FIXME: doesn't work on bigendian
{
unsigned int n = 0;
if (fseek(fp, offset, SEEK_SET)) {
Expand Down

0 comments on commit 61c9528

Please sign in to comment.