Index: src/uk/me/parabola/mkgmap/combiners/FileInfo.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/FileInfo.java	(revision 1443)
+++ src/uk/me/parabola/mkgmap/combiners/FileInfo.java	Sat Jan 02 16:31:25 GMT 2010
@@ -139,8 +139,10 @@
 
 		if (ext.equals("IMG")) {
 			info = imgInfo(inputName);
+		} else if ("TYP".equals(ext)) {
+			info = fileInfo(inputName, TYP_KIND);
 		} else if (KNOWN_FILE_TYPE_EXT.contains(ext)) {
-			info = fileInfo(inputName);
+			info = fileInfo(inputName, APP_KIND);
 		} else {
 			info = new FileInfo(inputName, UNKNOWN_KIND);
 		}
@@ -154,9 +156,10 @@
 	 * but you can do.
 	 * 
 	 * @param inputName The input file name.
+	 * @param kind The kind of file being added.
 	 */
-	private static FileInfo fileInfo(String inputName) {
-		FileInfo info = new FileInfo(inputName, FILE_KIND);
+	private static FileInfo fileInfo(String inputName, FileKind kind) {
+		FileInfo info = new FileInfo(inputName, kind);
 
 		// Get the size of the file.
 		File f = new File(inputName);
Index: src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	(revision 1443)
+++ src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	Sat Jan 02 16:31:25 GMT 2010
@@ -162,7 +162,8 @@
 				addImg(outfs, filename);
 				addMpsFile(info);
 				break;
-			case FILE_KIND:
+			case APP_KIND:
+			case TYP_KIND:
 				addFile(outfs, filename);
 				break;
 			case MDR_KIND:
Index: src/uk/me/parabola/mkgmap/main/Main.java
===================================================================
--- src/uk/me/parabola/mkgmap/main/Main.java	(revision 1363)
+++ src/uk/me/parabola/mkgmap/main/Main.java	Sat Jan 02 17:47:03 GMT 2010
@@ -154,6 +154,7 @@
 	public void startOptions() {
 		MapProcessor saver = new NameSaver();
 		processMap.put("img", saver);
+		processMap.put("mdx", saver);
 
 		// Todo: instead of the direct saver, modify the file with the correct
 		// family-id etc.
Index: src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java	(revision 1365)
+++ src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java	Sat Jan 02 18:34:01 GMT 2010
@@ -33,14 +33,19 @@
 	private String seriesName;
 	private String id;
 	private int productId;
-	private Boolean hasIndex = true;
+
+	private boolean hasIndex;
+	private boolean hasTyp;
+
 	private final List<String> mapList = new ArrayList<String>();
+	private static final String HKLM_FAMILIES = "HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}";
+	private String typName;
 
 	public void init(CommandArgs args) {
 		int familyId = args.get("family-id", 0);
 		productId = args.get("product-id", 1);
 
-		baseFilename = args.get("overview-mapname", "osm");
+		baseFilename = args.get("overview-mapname", "osmmap");
 		seriesName = args.get("series-name", "OSM map");
 
 		String tmpId = Integer.toHexString(0x10000 | familyId);
@@ -54,20 +59,29 @@
 	}
 
 	public void onMapEnd(FileInfo finfo) {
-		if (!finfo.isImg())
-			return;
-
+		switch (finfo.getKind()) {
+		case IMG_KIND:
-		mapList.add(finfo.getMapname());
+			mapList.add(finfo.getMapname());
+			break;
+		case TYP_KIND:
+			hasTyp = true;
+			typName = finfo.getFilename();
+			break;
+		case MDR_KIND:
+			hasIndex = true;
+			break;
+		case GMAPSUPP_KIND:
+			break;
-	}
+		}
+	}
 
 	public void onFinish() {
-		writeNSISFile();
+		writeNsisFile();
+		writeLicenceFile();
 	}
 
-
-	public void writeNSISFile() {
+	private void writeNsisFile() {
 		Writer w = null;
-
 		try {
 			w = new FileWriter(nsisFilename);
 			PrintWriter pw = new PrintWriter(w);
@@ -114,19 +128,28 @@
 				pw.format(Locale.ROOT, "  File \"${MAPNAME}_mdr.img\"\n");
 				pw.format(Locale.ROOT, "  File \"${MAPNAME}.mdx\"\n");
 			}
+			if (hasTyp)
+				pw.format(Locale.ROOT, "  File \"%s\"\n", typName);
+
 			pw.format(Locale.ROOT, "  File \"${MAPNAME}.tdb\"\n");
 			for (String file : mapList) {
 				pw.format(Locale.ROOT, "  File \"%s.img\"\n", file);
 			}
+
+			// Registry values
 			pw.println();
-			pw.format(Locale.ROOT, "  WriteRegBin HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"ID\" %s\n", id);
+			pw.format(Locale.ROOT, "  WriteRegBin " + HKLM_FAMILIES + "\" \"ID\" %s\n", id);
 			if (hasIndex) {
-				pw.format(Locale.ROOT, "  WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"IDX\" \"$INSTDIR\\${MAPNAME}.mdx\"\n");
-				pw.format(Locale.ROOT, "  WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"MDR\" \"$INSTDIR\\${MAPNAME}_mdr.img\"\n");
+				pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\" \"IDX\" \"$INSTDIR\\${MAPNAME}.mdx\"\n");
+				pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\" \"MDR\" \"$INSTDIR\\${MAPNAME}_mdr.img\"\n");
 			}
-			pw.format(Locale.ROOT, "  WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"BMAP\" \"$INSTDIR\\${MAPNAME}.img\"\n");
-			pw.format(Locale.ROOT, "  WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"LOC\" \"$INSTDIR\"\n");
-			pw.format(Locale.ROOT, "  WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"TDB\" \"$INSTDIR\\${MAPNAME}.tdb\"\n");
+			if (hasTyp)
+				pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\" \"TYP\" \"$INSTDIR\\%s\"\n", typName);
+
+			pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"BMAP\" \"$INSTDIR\\${MAPNAME}.img\"\n");
+			pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"LOC\" \"$INSTDIR\"\n");
+			pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"TDB\" \"$INSTDIR\\${MAPNAME}.tdb\"\n");
+
 			pw.println();
 			pw.format(Locale.ROOT, "  WriteUninstaller \"$INSTDIR\\Uninstall.exe\"\n");
 			pw.println();
@@ -146,17 +169,22 @@
 			}
 			pw.println();
 			pw.format(Locale.ROOT, "  RmDir \"$INSTDIR\"\n");
+
+			// Remove registry entries
 			pw.println();
-			pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"ID\"\n");
+			pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\" \"ID\"\n");
 			if (hasIndex) {
-				pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"IDX\"\n");
-				pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"MDR\"\n");
+				pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\" \"IDX\"\n");
+				pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\" \"MDR\"\n");
 			}
-			pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"BMAP\"\n");
-			pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"LOC\"\n");
-			pw.format(Locale.ROOT, "  DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"TDB\"\n");
-			pw.format(Locale.ROOT, "  DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\"\n");
-			pw.format(Locale.ROOT, "  DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\"\n");
+			if (hasTyp)
+				pw.format(Locale.ROOT, "  WriteRegStr " + HKLM_FAMILIES + "\" \"TYP\" \"$INSTDIR\\%s\"\n", typName);
+			pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"BMAP\"\n");
+			pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"LOC\"\n");
+			pw.format(Locale.ROOT, "  DeleteRegValue " + HKLM_FAMILIES + "\\${PRODUCT_ID}\" \"TDB\"\n");
+			pw.format(Locale.ROOT, "  DeleteRegKey /IfEmpty " + HKLM_FAMILIES + "\\${PRODUCT_ID}\"\n");
+			pw.format(Locale.ROOT, "  DeleteRegKey /IfEmpty " + HKLM_FAMILIES + "\"\n");
+
 			pw.println();
 			pw.format(Locale.ROOT, "SectionEnd\n");
 
@@ -165,7 +193,14 @@
 		} finally {
 			Utils.closeFile(w);
 		}
+	}
-		
+
+	/**
+	 * We write out a licence file that is included in the installer.
+	 * TODO get a file from the resource directory of something similar.
+	 */
+	private void writeLicenceFile() {
+		Writer w = null;
 		try {
 			w = new FileWriter(licenseFilename);
 			PrintWriter pw = new PrintWriter(w);
@@ -174,7 +209,7 @@
 			pw.format(Locale.ROOT, "http://www.openstreetmap.org/\n");
 			pw.println();
 			pw.format(Locale.ROOT, "Map data licenced under Creative Commons Attribution ShareAlike 2.0\n");
-			pw.format(Locale.ROOT, "http://creativecommons.org/licenses/by-sa/2.0/\n");      
+			pw.format(Locale.ROOT, "http://creativecommons.org/licenses/by-sa/2.0/\n");
 			pw.println();
 			pw.format(Locale.ROOT, "Map created with mkgmap-r" + Version.VERSION +"\n");
 		} catch (IOException e) {
@@ -182,6 +217,5 @@
 		} finally {
 			Utils.closeFile(w);
 		}
-		
 	}
 }
Index: src/uk/me/parabola/mkgmap/combiners/FileKind.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/FileKind.java	(revision 1443)
+++ src/uk/me/parabola/mkgmap/combiners/FileKind.java	Sat Jan 02 16:31:25 GMT 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009.
+ * Copyright (C) 2010.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3 or
@@ -20,9 +20,13 @@
 	// The file is an img file ie. it contains several sub-files.
 	IMG_KIND,
 
-	// The file is a plain file and it doesn't need to be extracted from a .img
-	FILE_KIND,
+	// The file is a separate TRE, RGN, ... file and it doesn't need to be
+	// extracted from a .img
+	APP_KIND,
 
+	// A TYP file
+	TYP_KIND,
+
 	// The file is an img containing an MDR file
 	MDR_KIND,
 
Index: src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java	(revision 1363)
+++ src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java	Sat Jan 02 18:11:17 GMT 2010
@@ -60,7 +60,7 @@
 	 * In otherwords if the same argument appears more than once, then it will
 	 */
 	public void init(CommandArgs args) {
-		overviewMapname = args.get("overview-mapname", "OSM_map");
+		overviewMapname = args.get("overview-mapname", "osmmap");
 		overviewMapnumber = args.get("overview-mapnumber", "63240000");
 		try {
 			parent = Integer.parseInt(overviewMapnumber);
