Changeset - be9989c2c66e
[Not reviewed]
default
0 2 0
Jason Maltzen - 6 years ago 2018-04-22 09:30:28
jason@hiddenachievement.com
Reduce the amount of debug output. Fix a crash when a potential window candidate is detected on the top row of the screen (which isn't possible). Break out of screen region tests early when the frame isn't detected to reduce how long a scan takes.
2 files changed with 42 insertions and 9 deletions:
0 comments (0 inline, 0 general)
MainWindow.cs
Show inline comments
...
 
@@ -108,5 +108,7 @@ public partial class MainWindow : Gtk.Wi
 
		// get its width and height
 
        int screenWidth;
 
        int screenHeight;
 
		rootWindow.GetSize(out screenWidth, out screenHeight);
 
        int detectedScreenWidth;
 
        int detectedScreenHeight;
 
		rootWindow.GetSize(out detectedScreenWidth, out detectedScreenHeight);
 
        int screenWidth = detectedScreenWidth;
 
        int screenHeight = detectedScreenHeight;
 
        int pixelMultiplier = 1;
...
 
@@ -125,2 +127,4 @@ public partial class MainWindow : Gtk.Wi
 
		ScreenCheckDialog screenCheckDialog = new ScreenCheckDialog();
 
        // TODO: screenCheckDialog.DetectedWidth = detectedScreenWidth;
 
        // TODO: screenCheckDialog.DetectedHeight = detectedScreenHeight;
 
		screenCheckDialog.ScreenWidth = screenWidth;
ReactionRecorder.cs
Show inline comments
...
 
@@ -192,4 +192,9 @@ namespace DesertPaintLab
 
        {
 
            int testPixelStart = (y * stride) + (x * 3);
 

	
 
            int testPixelStart = (y * stride) + (x * 3);
 

 
            if (testPixelStart < stride)
 
            {
 
                return false;
 
            }
 

 
            bool result = true;
...
 
@@ -202,4 +207,11 @@ namespace DesertPaintLab
 
            }
 
            if (!result)
 
            {
 
                // No dark border on the left side
 
                // WriteLog("Failed to find left border for swatch at {0}, {1}", x, y);
 
                return false;
 
            }
 

	
 
            // test the dark top border and for papyrus above and below the swatch
 
            bool borderError = false;
 
            int papyErrorCount = 0;
...
 
@@ -208,5 +220,19 @@ namespace DesertPaintLab
 
                int otherPixelStart = testPixelStart + (3 * i);
 
                result &= IsDarkPixel(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]);
 
                otherPixelStart = otherPixelStart - stride;
 
                papyErrorCount += (IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]) ? 0 : 1);
 
                bool isBorder = IsDarkPixel(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]);
 
                result &= isBorder;
 
                if (!isBorder)
 
                {
 
                    borderError = true;
 
                }
 
                if (otherPixelStart >= stride)
 
                {
 
                    otherPixelStart = otherPixelStart - stride;
 
                    papyErrorCount += (IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart + 1], pixBytes[otherPixelStart + 2]) ? 0 : 1);
 
                }
 
                else
 
                {
 
                    papyErrorCount++;
 
                }
 

	
 
                // Checking along the bottom of the swatch - 
 
                otherPixelStart = testPixelStart + (stride * swatchHeight) + (3 * i);
...
 
@@ -218,3 +244,6 @@ namespace DesertPaintLab
 
            {
 
                WriteLog("Found a potential swatch candidate of width {0} at {1},{2} that had {3} failures matching papyrus texture", i, x, y, papyErrorCount);
 
                if (!borderError && (papyErrorCount < swatchWidth))
 
                {
 
                    WriteLog("Found a potential swatch candidate of width {0} at {1},{2} that had {3} failures matching papyrus texture", i, x, y, papyErrorCount);
 
                }
 
            }
0 comments (0 inline, 0 general)