1b6cee71dSXin LI 2b6cee71dSXin LI#------------------------------------------------------------------------------ 3*ae316d1dSXin LI# $File: map,v 1.11 2024/06/10 23:09:52 christos Exp $ 4b6cee71dSXin LI# map: file(1) magic for Map data 5b6cee71dSXin LI# 6b6cee71dSXin LI 748c779cdSXin LI# Garmin .FIT files https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml 8b6cee71dSXin LI8 string .FIT FIT Map data 9b6cee71dSXin LI>15 byte 0 10b6cee71dSXin LI>>35 belong x \b, unit id %d 11b6cee71dSXin LI>>39 lelong x \b, serial %u 1248c779cdSXin LI# https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml 139fc5c47fSXin LI# 20 years after unix epoch 149fc5c47fSXin LI# TZ=GMT date -d '1989-12-31 0:00' +%s 159fc5c47fSXin LI>>43 leldate+631065600 x \b, %s 16b6cee71dSXin LI 17b6cee71dSXin LI>>47 leshort x \b, manufacturer %d 18b6cee71dSXin LI>>47 leshort 1 \b (garmin) 19b6cee71dSXin LI>>49 leshort x \b, product %d 20b6cee71dSXin LI>>53 byte x \b, type %d 21b6cee71dSXin LI>>53 byte 1 \b (Device) 22b6cee71dSXin LI>>53 byte 2 \b (Settings) 23b6cee71dSXin LI>>53 byte 3 \b (Sports/Cycling) 24b6cee71dSXin LI>>53 byte 4 \b (Activity) 25b6cee71dSXin LI>>53 byte 8 \b (Elevations) 26b6cee71dSXin LI>>53 byte 10 \b (Totals) 279ce06829SXin LI 2848c779cdSXin LI# Summary: Garmin map 2948c779cdSXin LI# From: Joerg Jenderek 3048c779cdSXin LI# URL: https://en.wikipedia.org/wiki/Garmin_.img 3148c779cdSXin LI# Reference: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format 3248c779cdSXin LI# sourceforge.net/projects/garmin-img/files/IMG%20File%20Format/1.0/imgformat-1.0.pdf 3348c779cdSXin LI# GRR: similar to MBR boot sector handled by ./filesystems 3448c779cdSXin LI0x1FE leshort =0xAA55 3548c779cdSXin LI# look for valid map signature 3648c779cdSXin LI>0x13 string =IMG\0 3748c779cdSXin LI>>0 use garmin-map 3848c779cdSXin LI0 name garmin-map 3948c779cdSXin LI>0 ubyte x Garmin 4048c779cdSXin LI!:mime application/x-garmin-map 4148c779cdSXin LI# If non-zero, every byte of the entire .img file is to be XORed with this value 4243a5ec4eSXin LI>0 ubyte !0 \b, %#x XORed 4348c779cdSXin LI# goto block before FAT 4448c779cdSXin LI>(0x40.b*512) ubyte x 4548c779cdSXin LI# 1st fat name "DLLINFO TXT" only found for vpm 4648c779cdSXin LI>>&512 string =DLLINFO\ TXT map (Voice Processing) 4748c779cdSXin LI# there exist 2 other Garmin VPM formats; see ./audio 4848c779cdSXin LI!:ext vpm 4948c779cdSXin LI# Deutsch__Yannick_D4481-00_0210.vpm 5048c779cdSXin LI#>>>512 search/0x0116da60/s RIFF \b; with 5148c779cdSXin LI# determine type voice type by ./riff 5248c779cdSXin LI#>>>>&0 indirect x \b 5348c779cdSXin LI>>&512 string !DLLINFO\ TXT map 5448c779cdSXin LI!:ext img 5548c779cdSXin LI# 9 zeros 5643a5ec4eSXin LI>1 ubelong !0 \b, zeroes %#x 5748c779cdSXin LI# Map's version major 5848c779cdSXin LI>8 ubyte x v%u 5948c779cdSXin LI# Map's version minor 6048c779cdSXin LI>9 ubyte x \b.%.2u 6148c779cdSXin LI# Map description[20], 0x20 padded 6248c779cdSXin LI>0x49 string x %.20s 6348c779cdSXin LI# Map name, continued (0x20 padded, \0 terminated) 6448c779cdSXin LI>0x65 string >\ \b%.31s 6548c779cdSXin LI# Update year (+1900 for val >= 0x63, +2000 for val <= 0x62) 6648c779cdSXin LI>0xB ubyte x \b, updated 6748c779cdSXin LI>>0xB ubyte >0x62 6848c779cdSXin LI>>>0xB ubyte-100 x 20%.2u 6948c779cdSXin LI>>0xB ubyte <0x63 7048c779cdSXin LI>>>0xB ubyte x 20%.2u 7148c779cdSXin LI# Update month (0-11) 7248c779cdSXin LI>0xA ubyte x \b-%.2u 7348c779cdSXin LI# All zeroes 7443a5ec4eSXin LI>0xc uleshort !0 \b, zeroes %#x 7548c779cdSXin LI# Mapsource flag, 1 - file created by Mapsource, 0 - Garmin map visible in Basecamp and Homeport 7643a5ec4eSXin LI#>0xE ubyte !0 \b, Mapsource flag %#x 7748c779cdSXin LI>0xE ubyte 1 \b, Mapsource 7848c779cdSXin LI# Checksum, sum of all bytes modulo 256 should be 0 7943a5ec4eSXin LI#>0xF ubyte x \b, Checksum %#x 8048c779cdSXin LI# Signature: DSKIMG 0x00 or DSDIMG 0x00 for demo map 8148c779cdSXin LI>0x10 string !DSKIMG \b, signature "%.7s" 8248c779cdSXin LI>0x39 use garmin-date 8348c779cdSXin LI# Map file identifier like GARMIN\0 8448c779cdSXin LI>0x41 string !GARMIN \b, id "%.7s" 8548c779cdSXin LI# Block size exponent, E1; appears to always be 0x09; minimum block size 512 bytes 8648c779cdSXin LI>0x61 ubyte !0x09 \b, E1=%u 8748c779cdSXin LI# Block size exponent, E2 ; file blocksize=2**(E1+E2) 8848c779cdSXin LI>>0x62 ubyte x \b, E2=%u 8948c779cdSXin LI>0x61 ubyte =0x09 \b, blocksize 9048c779cdSXin LI>>0x62 ubyte 0 512 9148c779cdSXin LI>>0x62 ubyte 1 1024 9248c779cdSXin LI>>0x62 ubyte 2 2048 9348c779cdSXin LI>>0x62 ubyte 3 4096 9448c779cdSXin LI>>0x62 ubyte 4 8192 9548c779cdSXin LI>>0x62 ubyte 5 16384 9648c779cdSXin LI>>0x62 default x 9748c779cdSXin LI>>>0x62 ubyte x E2=%u 9848c779cdSXin LI# MBR signature 9948c779cdSXin LI>0x1FE leshort !0xAA55 \b, invalid MBR 10048c779cdSXin LI# 512 zeros 10143a5ec4eSXin LI>0x200 uquad !0 \b, zeroes %#llx 10248c779cdSXin LI# First sub-file offset (absolute); sometimes NO/UNKNOWN sub file! 10343a5ec4eSXin LI>0x40C ulelong >0 \b, at %#x 10448c779cdSXin LI# sub-file Header length 10543a5ec4eSXin LI#>>(0x40C.l) uleshort x \b, header len %#x 10648c779cdSXin LI>>(0x40C.l) uleshort x %u bytes 10748c779cdSXin LI# sub-file Type[10] like "GARMIN RGN" "GARMIN TRE", "GARMIN TYP", etc. 10848c779cdSXin LI>>(0x40C.l+2) ubyte >0x1F 10948c779cdSXin LI>>>(0x40C.l+2) ubyte <0xFF 11048c779cdSXin LI>>>>(0x40C.l+2) string x "%.10s" 11148c779cdSXin LI# 0x00 for most maps, 0x80 for locked maps (City Nav, City Select, etc.) 11243a5ec4eSXin LI>>>>(0x40C.l+13) ubyte >0 \b, locked %#x 11348c779cdSXin LI# Block sequence numbers like 0000 0100 0200 ... FFFF 11443a5ec4eSXin LI# >0x420 ubequad >0 \b, seq. %#16.16llx 11548c779cdSXin LI# >>0x428 ubequad >0 \b%16.16llx 11648c779cdSXin LI# >>>0x430 ubequad >0 \b%16.16llx 11748c779cdSXin LI# >>>>0x438 ubequad >0 \b%16.16llx 11848c779cdSXin LI# >>>>>0x440 ubequad >0 \b%16.16llx 11948c779cdSXin LI# >>>>>>0x448 ubequad >0 \b%16.16llx 12048c779cdSXin LI# >>>>>>>0x450 ubequad >0 \b%16.16llx 12148c779cdSXin LI# >>>>>>>>0x458 ubequad >0 \b%16.16llx 12248c779cdSXin LI# >>>>>>>>>0x460 ubequad >0 \b%16.16llx 12348c779cdSXin LI# >>>>>>>>>>0x468 ubequad >0 \b%16.16llx 12448c779cdSXin LI# >>>>>>>>>>>0x470 ubequad >0 \b%16.16llx 12548c779cdSXin LI# >>>>>>>>>>>>0x478 ubequad >0 \b%16.16llx 12648c779cdSXin LI# >>>>>>>>>>>>>0x480 ubequad >0 \b%16.16llx 12748c779cdSXin LI# >>>>>>>>>>>>>>0x488 ubequad >0 \b%16.16llx 12848c779cdSXin LI# >>>>>>>>>>>>>>>0x490 ubequad >0 \b%16.16llx 12948c779cdSXin LI# >>>>>>>>>>>>>>>>0x498 ubequad >0 \b%16.16llx 13048c779cdSXin LI# >>>>>>>>>>>>>>>>>0x4A0 ubequad >0 \b%16.16llx 13148c779cdSXin LI# >>>>>>>>>>>>>>>>>>0x4A8 ubequad >0 \b%16.16llx 13248c779cdSXin LI# look for end of FAT 13348c779cdSXin LI#>>0x420 search/512/s \xff\xff FAT END 13448c779cdSXin LI# Physical block number of FAT header 13548c779cdSXin LI#>0x40 ubyte x \b, FAT at phy. block %u 13648c779cdSXin LI>0x40 ubyte x 13748c779cdSXin LI>>(0x40.b*512) ubyte x 13848c779cdSXin LI# 1st FAT block 13948c779cdSXin LI>>>&511 use garmin-fat 14048c779cdSXin LI# 2nd FAT block 14148c779cdSXin LI>>>&1023 use garmin-fat 14248c779cdSXin LI# 3th FAT block 14348c779cdSXin LI>>>&1535 use garmin-fat 14448c779cdSXin LI# 4th FAT block 14548c779cdSXin LI>>>&2047 use garmin-fat 14648c779cdSXin LI# ... xth FAT block 14748c779cdSXin LI# 14848c779cdSXin LI# 314 zeros but not in vpm and also gmaptz.img 14943a5ec4eSXin LI>0x84 uquad !0 \b, at 0x84 %#llx 15048c779cdSXin LI# display FileAllocationTable block entry in garmin map 15148c779cdSXin LI0 name garmin-fat 15248c779cdSXin LI>0 ubyte x \b; 15348c779cdSXin LI# sub file part; 0x0003 seems to be garbage 15443a5ec4eSXin LI>0x10 uleshort !0 next %#4.4x 15548c779cdSXin LI>0x10 uleshort =0 15648c779cdSXin LI# fat flag 0~dummy block 1~true sub file 15748c779cdSXin LI>>0 ubyte !1 flag %u 15848c779cdSXin LI>>0 ubyte =1 15948c779cdSXin LI# sub-file name like MAKEGMAP 12345678 16048c779cdSXin LI>>>0x1 string x %.8s 16148c779cdSXin LI# sub-file typ like RGN TRE MDR LBL 16248c779cdSXin LI>>>0x9 string x \b.%.3s 16348c779cdSXin LI# size of sub file 16448c779cdSXin LI>>>0xC ulelong x \b, %u bytes 16548c779cdSXin LI# 32-bit block sequence numbers 16643a5ec4eSXin LI#>>>0x20 ubequad x \b, seq. %#16.16llx 16748c779cdSXin LI 16848c779cdSXin LI# display date stored inside Garmin maps like yyyy-mm-dd h:mm:ss 16948c779cdSXin LI0 name garmin-date 17048c779cdSXin LI# year like 2018 17148c779cdSXin LI>0 uleshort x \b, created %u 17248c779cdSXin LI# month (0-11) 17348c779cdSXin LI>2 ubyte x \b-%.2u 17448c779cdSXin LI# day (1-31) 17548c779cdSXin LI>3 ubyte x \b-%.2u 17648c779cdSXin LI# hour (0-23) 17748c779cdSXin LI>4 ubyte x %u 17848c779cdSXin LI# minute (0-59) 17948c779cdSXin LI>5 ubyte x \b:%.2u 18048c779cdSXin LI# second (0-59) 18148c779cdSXin LI>6 ubyte x \b:%.2u 18248c779cdSXin LI 18348c779cdSXin LI# Summary: Garmin Map subfiles 18448c779cdSXin LI# From: Joerg Jenderek 18548c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format 18648c779cdSXin LI# Garmin Common Header 18748c779cdSXin LI2 string GARMIN\ 18848c779cdSXin LI# skip ASCII text by checking for low header length 18948c779cdSXin LI>0 uleshort <0x1000 Garmin map, 19048c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/GMP_Subfile_Format 19148c779cdSXin LI>>9 string GMP subtile 19248c779cdSXin LI!:mime application/x-garmin-gpm 19348c779cdSXin LI!:ext gmp 19448c779cdSXin LI# copyright message 19548c779cdSXin LI>>>(0.s) string x %s 19648c779cdSXin LI>>>0x0E use garmin-date 19748c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/MDR_Subfile_Format 19848c779cdSXin LI# This contains the searchable address table used for finding routing destinations 19948c779cdSXin LI>>9 string MDR address table 20048c779cdSXin LI!:mime application/x-garmin-mdr 20148c779cdSXin LI!:ext mdr 20248c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/NOD_Subfile_Format 20348c779cdSXin LI# http://svn.parabola.me.uk/display/trunk/doc/nod.txt 20448c779cdSXin LI# This contains the routing information 20548c779cdSXin LI>>9 string NOD routing 20648c779cdSXin LI!:mime application/x-garmin-nod 20748c779cdSXin LI!:ext nod 20848c779cdSXin LI>>>0x0E use garmin-date 20943a5ec4eSXin LI#>>>0x15 ulelong x \b, at %#x 21043a5ec4eSXin LI#>>>0x19 ulelong x %#x bytes NOD1 21143a5ec4eSXin LI#>>>0x25 ulelong x \b, at %#x 21243a5ec4eSXin LI#>>>0x29 ulelong x %#x bytes NOD2 21343a5ec4eSXin LI#>>>0x31 ulelong x \b, at %#x 21443a5ec4eSXin LI#>>>0x35 ulelong x %#x bytes NOD3 21548c779cdSXin LI# URL: http://www.pinns.co.uk/osm/net.html 21648c779cdSXin LI# routable highways (length, direction, allowed speed,house address information) 21748c779cdSXin LI>>9 string NET highways 21848c779cdSXin LI!:mime application/x-garmin-net 21948c779cdSXin LI!:ext net 22043a5ec4eSXin LI#>>>0x15 ulelong x \b, at %#x 22143a5ec4eSXin LI#>>>0x19 ulelong x %#x bytes NET1 22248c779cdSXin LI#>>>0x22 ulelong >0 22343a5ec4eSXin LI#>>>>0x1E ulelong x \b, at %#x 22443a5ec4eSXin LI#>>>>0x22 ulelong x %#x bytes NET2 22548c779cdSXin LI#>>>0x2B ulelong >0 22643a5ec4eSXin LI#>>>>0x27 ulelong x \b, at %#x 22743a5ec4eSXin LI#>>>>0x2B ulelong x %#x bytes NET3 22848c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/LBL_Subfile_Format 22948c779cdSXin LI>>9 string LBL labels 23048c779cdSXin LI!:mime application/x-garmin-lbl 23148c779cdSXin LI!:ext lbl 23248c779cdSXin LI>>>(0.s) string x %s 23348c779cdSXin LI# Label coding type 6h 9h and ah 23443a5ec4eSXin LI>>>0x1E ubyte x \b, coding type %#x 23543a5ec4eSXin LI#>>>0x15 ulelong x \b, at %#x 23643a5ec4eSXin LI#>>>0x19 ulelong x %#x bytes LBL1 23743a5ec4eSXin LI#>>>0x1F ulelong x \b, at %#x 23843a5ec4eSXin LI#>>>0x23 ulelong x %#x bytes LBL2 23943a5ec4eSXin LI#>>>0x2D ulelong x \b, at %#x 24043a5ec4eSXin LI#>>>0x31 ulelong x %#x bytes LBL3 24148c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/SRT_Subfile_Format 24248c779cdSXin LI# A lookup table of the chars in the map's codepage, and their collating sequence 24348c779cdSXin LI>>9 string SRT sort table 24448c779cdSXin LI!:mime application/x-garmin-srt 24548c779cdSXin LI!:ext srt 24648c779cdSXin LI>>>0x0E use garmin-date 24748c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/TRE_Subfile_Format 24848c779cdSXin LI>>9 string TRE tree 24948c779cdSXin LI!:mime application/x-garmin-tre 25048c779cdSXin LI!:ext tre 25148c779cdSXin LI# title like City Nav Europe NTU 2019.2 Basemap 25248c779cdSXin LI# or OSM Street map 25348c779cdSXin LI>>>(0.s) string x %s 25448c779cdSXin LI# 2nd title like Copyright 1995-2018 by GARMIN Corporation. 25548c779cdSXin LI# or http://www.openstreetmap.org/ 25648c779cdSXin LI>>>>&1 string x %s 25748c779cdSXin LI>>>0x0E use garmin-date 25843a5ec4eSXin LI#>>>0x21 ulelong x \b, at %#x 25943a5ec4eSXin LI#>>>0x25 ulelong x %#x bytes TRE1 26043a5ec4eSXin LI#>>>0x29 ulelong x \b, at %#x 26143a5ec4eSXin LI#>>>0x2D ulelong x %#x bytes TRE2 26243a5ec4eSXin LI#>>>0x31 ulelong x \b, at %#x 26343a5ec4eSXin LI#>>>0x35 ulelong x %#x bytes TRE3 26448c779cdSXin LI# Copyright record size 26548c779cdSXin LI#>>>0x39 uleshort x \b, copyright record size %u 26648c779cdSXin LI# Map ID 26743a5ec4eSXin LI>>>0x74 ulelong x \b, ID %#x 26848c779cdSXin LI# URL: https://www.gpspower.net/garmin-tutorials/353310-basecamp-installing-free-desktop-map.html 26948c779cdSXin LI# For road traffic information service (RDS/TMS/TMC). Commonly seen in City Navigator maps 27048c779cdSXin LI>>9 string TRF traffic, 27148c779cdSXin LI!:mime application/x-garmin-trf 27248c779cdSXin LI!:ext trf 27348c779cdSXin LI# city/region like Preitenegg 27448c779cdSXin LI>>>(0.s+1) string x 1st %s 27548c779cdSXin LI# highway part like L606/L148 27648c779cdSXin LI>>>>&1 string x %s 27748c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/Format 27848c779cdSXin LI# Reference: http://www.pinns.co.uk/osm/typformat.html 27948c779cdSXin LI# customize the appearance of objects. For GPS and MapSource/Qlandkarte better looking maps 28048c779cdSXin LI>>9 string TYP types 28148c779cdSXin LI!:mime application/x-garmin-typ 28248c779cdSXin LI!:ext typ 28348c779cdSXin LI>>>0x0E use garmin-date 28448c779cdSXin LI# character set 1252 65001~UTF8 28548c779cdSXin LI>>>0x15 uleshort x \b, code page %u 28648c779cdSXin LI# POIs 28743a5ec4eSXin LI#>>>0x17 ulelong x \b, at %#x 28843a5ec4eSXin LI#>>>0x1B ulelong x %#x bytes TYP1 28948c779cdSXin LI# extra pois 29043a5ec4eSXin LI#>>>0x5B ulelong x \b, at %#x 29143a5ec4eSXin LI#>>>0x5F ulelong x %#x bytes TYP8 29248c779cdSXin LI# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/RGN_Subfile_Format 29348c779cdSXin LI# http://www.pinns.co.uk/osm/RGN.html 29448c779cdSXin LI# region data used by the Garmin software 29548c779cdSXin LI>>9 string RGN region 29648c779cdSXin LI!:mime application/x-garmin-rgn 29748c779cdSXin LI!:ext rgn 29848c779cdSXin LI# POIs,Indexed POIs,Polylines or Polygons or first map level 29943a5ec4eSXin LI#>>>0x15 ulelong x \b, at %#x 30043a5ec4eSXin LI#>>>0x19 ulelong x %#x bytes RGN1 30148c779cdSXin LI# polygons with extended types 30248c779cdSXin LI#>>>0x21 ulelong >0 30343a5ec4eSXin LI#>>>>0x1D ulelong x \b, at %#x 30443a5ec4eSXin LI#>>>>0x21 ulelong x %#x bytes RGN2 30548c779cdSXin LI# polylines with extended types 30648c779cdSXin LI#>>>0x3D ulelong >0 30743a5ec4eSXin LI#>>>>0x39 ulelong x \b, at %#x 30843a5ec4eSXin LI#>>>>0x3D ulelong x %#x bytes RGN3 30948c779cdSXin LI# extended POIs 31048c779cdSXin LI#>>>0x59 ulelong >0 31143a5ec4eSXin LI#>>>>0x55 ulelong x \b, at %#x 31243a5ec4eSXin LI#>>>>0x59 ulelong x %#x bytes RGN3 31348c779cdSXin LI#>>9 default x unknown map type 31448c779cdSXin LI# Header length; GMP:31h 35h 3Dh,MDR:11Eh 238h 2C4h 310h,NOD:3Fh 7Fh,NET:64h, 31548c779cdSXin LI# LBL:2A9h,SRT:1Dh 25h 27h,TRE:CFh 135h,TRF:5Ah,TYP:5Bh 6Eh 7Ch AEh,RGN:7Dh 31643a5ec4eSXin LI>>0 uleshort x \b, header length %#x 31748c779cdSXin LI 318d38c30c0SXin LI# URL: https://www.memotech.franken.de/FileFormats/ 319d38c30c0SXin LI# Reference: https://www.memotech.franken.de/FileFormats/Garmin_RGN_Format.pdf 320d38c30c0SXin LI# From: Joerg Jenderek 321d38c30c0SXin LI0 string KpGr Garmin update 322d38c30c0SXin LI# format version like: 0064h~1.0 323d38c30c0SXin LI>0x4 uleshort !0x0064 324d38c30c0SXin LI>>4 uleshort/100 x \b, version %u 325d38c30c0SXin LI>>4 uleshort%100 x \b.%u 326d38c30c0SXin LI# 1st Garmin entry 327d38c30c0SXin LI>6 use garmin-entry 328d38c30c0SXin LI# 2nd Garmin entry 329d38c30c0SXin LI>(0x6.l+10) ubyte x 330d38c30c0SXin LI>>&0 use garmin-entry 331d38c30c0SXin LI# 3rd entry 332d38c30c0SXin LI>(0x6.l+10) ubyte x 333d38c30c0SXin LI>>&(&0.l+4) ubyte x 334d38c30c0SXin LI>>>&0 use garmin-entry 335d38c30c0SXin LI# look again at version to use default clause 336d38c30c0SXin LI>0x4 uleshort x 337d38c30c0SXin LI# test for region content by looking for 338d38c30c0SXin LI# Garmin *.srf by ./images with normal builder name "SQA" or longer "hales" 339d38c30c0SXin LI# 1 space after equal sign 340d38c30c0SXin LI>>0x3a search/5/s GARMIN\ BITMAP \b= 341d38c30c0SXin LI!:mime image/x-garmin-exe 342d38c30c0SXin LI!:ext exe 343d38c30c0SXin LI>>>&0 indirect x 344d38c30c0SXin LI# if not bitmap *.srf then region; 1 space after equal sign 345d38c30c0SXin LI>>0x3a default x \b= 346d38c30c0SXin LI!:mime application/x-garmin-rgn 347d38c30c0SXin LI!:ext rgn 348d38c30c0SXin LI# recursiv embedded 349d38c30c0SXin LI>>>0x3a search/5/s KpGrd 350d38c30c0SXin LI>>>>&0 indirect x 351d38c30c0SXin LI# look for ZIP or JAR archive by ./archive and ./zip 352d38c30c0SXin LI>>>0x3a search/5/s PK\003\004 353d38c30c0SXin LI>>>>&0 indirect x 354d38c30c0SXin LI# TODO: other garmin RGN record content like foo 355d38c30c0SXin LI#>>0x3a search/5/s bar BAR 356d38c30c0SXin LI# display information of Garmin RGN record 357d38c30c0SXin LI0 name garmin-entry 358d38c30c0SXin LI# record length: 2 for Data, for Application often 1Bh sometimes 1Dh, "big" for Region 35943a5ec4eSXin LI#>0 ulelong x \b, length %#x 360d38c30c0SXin LI# data record (ID='D') with version content like 0064h~1.0 361d38c30c0SXin LI>4 ubyte =0x44 362d38c30c0SXin LI>>5 uleshort !0x0064 \b; Data 363d38c30c0SXin LI>>>5 uleshort/100 x \b, version %u 364d38c30c0SXin LI>>>5 uleshort%100 x \b.%u 365d38c30c0SXin LI# Application Record (ID='A') 366d38c30c0SXin LI>4 ubyte =0x41 \b; App 367d38c30c0SXin LI# version content like 00c8h~2.0 368d38c30c0SXin LI>>5 uleshort !0x00C8 369d38c30c0SXin LI>>>5 uleshort/100 x \b, version %u 370d38c30c0SXin LI>>>5 uleshort%100 x \b.%u 371d38c30c0SXin LI# builder name like: SQA sqa build hales 372d38c30c0SXin LI>>7 string x \b, build by %s 373d38c30c0SXin LI# build date like: Oct 25 1999, Oct 1 2008, Feb 23 2009, Dec 15 2009 374d38c30c0SXin LI>>>&1 string x %s 375d38c30c0SXin LI# build time like: 11:26:12, 11:45:54, 14:16:13, 18:23:01 376d38c30c0SXin LI>>>>&1 string x %s 377d38c30c0SXin LI# region record (ID='R') 378d38c30c0SXin LI>4 ubyte =0x52 \b; Region 379d38c30c0SXin LI# region ID:14~fw_all.bin: 78~ZIP, RGN or SRF bitmap; 148~ZIP or JAR; 249~display firmware; 251~WiFi or GCD firmware; 255~ZIP 380d38c30c0SXin LI>>5 uleshort x ID=%u 381d38c30c0SXin LI# delay in ms: like 0, 500 382d38c30c0SXin LI>>7 ulelong !0 \b, %u ms 383d38c30c0SXin LI# region size (is record length - 10) 38443a5ec4eSXin LI#>>11 ulelong x \b, length %#x 385d38c30c0SXin LI# region content like: 386d38c30c0SXin LI# "KpGr"~recursiv embedded,"GARMIN BITMAP"~Garmin Bitmap *.srf, "PK"~ZIP archive 387d38c30c0SXin LI#>>15 string x \b, content "%s" 38843a5ec4eSXin LI>>15 ubequad x \b, content %#llx... 389d38c30c0SXin LI# This does NOT WORK! 390d38c30c0SXin LI#>>15 indirect x \b; contains 391d38c30c0SXin LI>4 default x \b; other 392d38c30c0SXin LI# garmin Record ID Identifies the record content like: D A R 393d38c30c0SXin LI>>4 ubyte x ID '%c' 394d38c30c0SXin LI 3959ce06829SXin LI# TOM TOM GPS watches ttbin files: 39648c779cdSXin LI# https://github.com/ryanbinns/ttwatch/tree/master/ttbin 3979ce06829SXin LI# From: Daniel Lenski 3989ce06829SXin LI0 byte 0x20 3999ce06829SXin LI>1 leshort 0x0007 4009ce06829SXin LI>>0x76 byte 0x20 4019ce06829SXin LI>>>0x77 leshort 0x0075 TomTom activity file, v7 4029ce06829SXin LI>>>>8 leldate x (%s, 4039ce06829SXin LI>>>>3 byte x device firmware %d. 4049ce06829SXin LI>>>>4 byte x \b%d. 4059ce06829SXin LI>>>>5 byte x \b%d, 4069ce06829SXin LI>>>>6 leshort x product ID %04d) 4079ce06829SXin LI 408898496eeSXin LI# Garmin firmware: 409898496eeSXin LI# https://www.memotech.franken.de/FileFormats/Garmin_GCD_Format.pdf 410898496eeSXin LI# https://www.gpsrchive.com/GPSMAP/GPSMAP%2066sr/Firmware.html 411898496eeSXin LI0 string GARMIN 412898496eeSXin LI>6 uleshort 100 GARMIN firmware (version 1.0) 413