From 9d6a3c3ef52a35e5f28fb69a8f1f7d1d7b59e9f7 Mon Sep 17 00:00:00 2001
From: unknown <1492471+dataway@users.noreply.github.com>
Date: Tue, 11 Sep 2018 12:15:36 +0200
Subject: [PATCH 1/3] Fix a bug which made it impossible to export road
 segments properly.

Also correctly export normal maps with inverted red channel,
as per https://forum.paradoxplaza.com/forum/index.php?threads/an-important-reminder-about-normal-maps.876972/
---
 Debugger/MeshViewer.cs     |  2 +-
 Debugger/Utils/DumpUtil.cs | 27 ++++++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Debugger/MeshViewer.cs b/Debugger/MeshViewer.cs
index 2296433..1a0ad8f 100644
--- a/Debugger/MeshViewer.cs
+++ b/Debugger/MeshViewer.cs
@@ -145,7 +145,7 @@ void DrawWindow()
                     {
                         if (GUILayout.Button("Dump mesh+textures", GUILayout.Width(160)))
                         {
-                            DumpUtil.DumpMeshAndTextures(assetName, previewMesh, material);
+                            DumpUtil.DumpMeshAndTextures(assetName ?? previewMesh.name, previewMesh, material);
                         }
                     }
                     else
diff --git a/Debugger/Utils/DumpUtil.cs b/Debugger/Utils/DumpUtil.cs
index c5c4a81..04e1de0 100644
--- a/Debugger/Utils/DumpUtil.cs
+++ b/Debugger/Utils/DumpUtil.cs
@@ -44,6 +44,7 @@ public static void DumpTextures(string assetName, Material material)
             DumpACI(assetName, (Texture2D) material.GetTexture("_ACIMap"));
             DumpXYS(assetName, (Texture2D) material.GetTexture("_XYSMap"));
             DumpXYCA(assetName, (Texture2D) material.GetTexture("_XYCAMap"));
+            DumpAPR(assetName, (Texture2D)material.GetTexture("_APRMap"));
         }
 
         private static void DumpMainTex(string assetName, Texture2D mainTex, bool extract = true)
@@ -122,7 +123,7 @@ private static void DumpXYCA(string assetName, Texture2D xycaMap, bool extract =
                 var r1 = new Color32[length].Invert();
                 var b1 = new Color32[length].Invert();
                 var a1 = new Color32[length].Invert();
-                xycaMap.ExtractChannels(r1, r1, b1, a1, false, false, true, false, false, true, true);
+                xycaMap.ExtractChannels(r1, r1, b1, a1, false, false, true, false, true, true, true);
                 TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(xycaMap.width, xycaMap.height), $"{assetName}_n");
                 TextureUtil.DumpTextureToPNG(b1.ColorsToTexture(xycaMap.width, xycaMap.height), $"{assetName}_c");
                 TextureUtil.DumpTextureToPNG(a1.ColorsToTexture(xycaMap.width, xycaMap.height), $"{assetName}_a");
@@ -132,5 +133,29 @@ private static void DumpXYCA(string assetName, Texture2D xycaMap, bool extract =
                 TextureUtil.DumpTextureToPNG(xycaMap, $"{assetName}_XYCA");
             }
         }
+
+        private static void DumpAPR(string assetName, Texture2D aprMap, bool extract = true)
+        {
+            if (aprMap == null)
+            {
+                return;
+            }
+            if (extract)
+            {
+                var length = aprMap.width * aprMap.height;
+                var a1 = new Color32[length].Invert();
+                var p1 = new Color32[length].Invert();
+                var r1 = new Color32[length].Invert();
+                aprMap.ExtractChannels(a1, p1, r1, null, true, true, true, true, true, false, false);
+                TextureUtil.DumpTextureToPNG(a1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_a");
+                TextureUtil.DumpTextureToPNG(p1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_p");
+                TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_r");
+            }
+            else
+            {
+                TextureUtil.DumpTextureToPNG(aprMap, $"{assetName}_APR");
+            }
+        }
+
     }
 }
\ No newline at end of file

From 5689573e53bac06798ba93b03a503e8440f176c0 Mon Sep 17 00:00:00 2001
From: Roy Curtis <RoyCurtis@users.noreply.github.com>
Date: Sun, 19 Nov 2017 17:40:06 +0000
Subject: [PATCH 2/3] Change notification message color to cyan

Fixes unreadable notification text
---
 Debugger/Console.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Debugger/Console.cs b/Debugger/Console.cs
index cab9539..e42f44d 100644
--- a/Debugger/Console.cs
+++ b/Debugger/Console.cs
@@ -387,7 +387,7 @@ void DrawConsole()
             {
                 GUILayout.BeginHorizontal(skin.box);
 
-                GUI.contentColor = Color.blue;
+                GUI.contentColor = Color.cyan;
                 GUILayout.Label(item.Value);
                 GUI.contentColor = Color.white;
 

From 266af3251f6281c881f4f0e5a75608de3056c918 Mon Sep 17 00:00:00 2001
From: RileyBaird <rileybaird@gmail.com>
Date: Tue, 10 Jul 2018 18:10:20 -0500
Subject: [PATCH 3/3] Update ModTools.cs

Changes Script Editor keybind from backquote to ctrl+backquote in line 222 to be consistent with the keybind described in line 349.
---
 Debugger/ModTools.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Debugger/ModTools.cs b/Debugger/ModTools.cs
index c0ab251..f92e118 100644
--- a/Debugger/ModTools.cs
+++ b/Debugger/ModTools.cs
@@ -219,7 +219,7 @@ void Update()
                 console.visible = !console.visible;
             }
 
-            if (Input.GetKeyDown(KeyCode.BackQuote))
+            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.BackQuote))
             {
                 scriptEditor.visible = !scriptEditor.visible;
             }