diff --git a/MethodInjector/.vs/MethodInjector/v14/.suo b/MethodInjector/.vs/MethodInjector/v14/.suo index 4b60fc7..ca5bc52 100644 Binary files a/MethodInjector/.vs/MethodInjector/v14/.suo and b/MethodInjector/.vs/MethodInjector/v14/.suo differ diff --git a/MethodInjector/Program.cs b/MethodInjector/Program.cs index 51cd920..a2427fc 100644 --- a/MethodInjector/Program.cs +++ b/MethodInjector/Program.cs @@ -49,6 +49,7 @@ static void Main(string[] args) bool enableDevTools = true; bool enableInstantBuild = true; bool allowFreeBuildings = true; + bool enableCheats = true; try { @@ -92,6 +93,10 @@ static void Main(string[] args) allowFreeBuildings = isEnabled; break; + case "allowcheats": + enableCheats = isEnabled; + break; + default: Console.WriteLine("Unknown config: " + lineConfig[0]); break; @@ -107,6 +112,12 @@ static void Main(string[] args) Perform patching */ + // Allow cheats + if(enableCheats) + { + ReplaceMethod("ZX.ZXGame", "get_CheatsEnabled", BindingFlags.Static | BindingFlags.Public); + } + // Allow hacked save games to be loaded if(allowModifiedSaveGames) { @@ -119,7 +130,7 @@ Perform patching ReplaceMethod("ZX.ZXGame", "get_IsDevelopmentVersion", BindingFlags.Static | BindingFlags.Public); ReplaceMethod("ZX.ZXGame", "get_IsBetaPrivateVersion", BindingFlags.Static | BindingFlags.Public); } - ReplaceMethod("ZX.ZXGame", "get_IsSteam", BindingFlags.Static | BindingFlags.Public); + ReplaceMethod("ZX.ZXSteam", "ValidateSteamLicense", BindingFlags.Static | BindingFlags.Public); // Instant Build if (enableInstantBuild) @@ -269,6 +280,12 @@ public static void ReplaceMethod(string className, string methodName, BindingFla LogMessage("Successfully replaced: " + className + " :: " + methodName); } + // Enable cheats + public static bool get_CheatsEnabled() + { + return true; + } + // Replacement for can pay resources public bool CanPayResources(object ignoreThis) { @@ -295,9 +312,9 @@ public static bool get_IsDevelopmentVersion() } // Returns if this is a steam build - public static bool get_IsSteam() + public static bool ValidateSteamLicense(object ignoreMe) { - return false; + return true; } // Returns that this is a private build diff --git a/MethodInjector/config.txt b/MethodInjector/config.txt index 7ea98bf..b48de0a 100644 --- a/MethodInjector/config.txt +++ b/MethodInjector/config.txt @@ -1,4 +1,5 @@ allowModifiedSaveGames=true enableDevTools=true enableInstantBuild=true -allowFreeBuildings=true \ No newline at end of file +allowFreeBuildings=true +allowCheats=true \ No newline at end of file