From 8d0d299792a28af5121ac8ec031ae958b07dd944 Mon Sep 17 00:00:00 2001
From: mageven <62494521+mageven@users.noreply.github.com>
Date: Fri, 13 Nov 2020 07:05:49 +0530
Subject: [PATCH] IPSwitch: Quick fix to patch sets toggling (#1668)

* IPSwitch: Quick fix to patch sets toggling

* fmt fix: newlines before continue and return
---
 Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs b/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs
index 5a248d039..abe59dded 100644
--- a/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs
+++ b/Ryujinx.HLE/Loaders/Mods/IPSwitchPatcher.cs
@@ -18,6 +18,7 @@ namespace Ryujinx.HLE.Loaders.Mods
             if (header == null || !header.StartsWith(BidHeader))
             {
                 Logger.Error?.Print(LogClass.ModLoader, "IPSwitch:    Malformed PCHTXT file. Skipping...");
+
                 return;
             }
 
@@ -147,7 +148,7 @@ namespace Ryujinx.HLE.Loaders.Mods
 
             MemPatch patches = new MemPatch();
 
-            bool enabled = true;
+            bool enabled = false;
             bool printValues = false;
             int offset_shift = 0;
 
@@ -160,6 +161,13 @@ namespace Ryujinx.HLE.Loaders.Mods
 
             while ((line = _reader.ReadLine()) != null)
             {
+                if (string.IsNullOrWhiteSpace(line))
+                {
+                    enabled = false;
+
+                    continue;
+                }
+
                 line = PreprocessLine(line);
                 lineNum += 1;
 
@@ -190,6 +198,7 @@ namespace Ryujinx.HLE.Loaders.Mods
                     if (tokens.Length < 2)
                     {
                         ParseWarn();
+
                         continue;
                     }
 
@@ -198,6 +207,7 @@ namespace Ryujinx.HLE.Loaders.Mods
                         if (tokens.Length != 3 || !ParseInt(tokens[2], out offset_shift))
                         {
                             ParseWarn();
+
                             continue;
                         }
                     }
@@ -222,12 +232,14 @@ namespace Ryujinx.HLE.Loaders.Mods
                     if (tokens.Length < 2)
                     {
                         ParseWarn();
+
                         continue;
                     }
 
                     if (!Int32.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
                     {
                         ParseWarn();
+
                         continue;
                     }