echo off
echo -
echo -
echo -  This batch will install map for Mapsource
echo -
echo -  Map:  "US Airspace Monochrome"
echo -  FID:  801
echo -  PID:  1
echo -
echo -  Press Enter to continue or Ctrl-C to abort.
echo -
pause

if exist "%~dp0US Airspace Monochrome.img" goto :INSTREG
echo File missing: US Airspace Monochrome.img, aborting install.
pause
exit 1

:INSTREG
echo Adding registry keys.

set KEY=HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource
if %PROCESSOR_ARCHITECTURE% == AMD64 goto key_ok
set KEY=HKLM\SOFTWARE\Garmin\MapSource
:key_ok

reg ADD %KEY%\Families\FAMILY_801 /v ID /t REG_BINARY /d 2103 /f
if exist "%~dp0US Airspace Monochrome_mdr.img" (
	reg ADD %KEY%\Families\FAMILY_801 /v IDX /t REG_SZ /d "%~dp0US Airspace Monochrome.mdx" /f
	reg ADD %KEY%\Families\FAMILY_801 /v MDR /t REG_SZ /d "%~dp0US Airspace Monochrome_mdr.img" /f
)
if exist "%~dp0US Airspace Monochrome.typ" reg ADD %KEY%\Families\FAMILY_801 /v TYP /t REG_SZ /d "%~dp0US Airspace Monochrome.typ" /f
reg ADD %KEY%\Families\FAMILY_801\1 /v Loc /t REG_SZ /d "%~dp0\" /f
reg ADD %KEY%\Families\FAMILY_801\1 /v Bmap /t REG_SZ /d "%~dp0US Airspace Monochrome.img" /f
reg ADD %KEY%\Families\FAMILY_801\1 /v Tdb /t REG_SZ /d "%~dp0US Airspace Monochrome.tdb" /f
pause
exit 0
