From 220c669bda1cb61eec5a473d2eb13568e8ae8fc0 Mon Sep 17 00:00:00 2001
From: DartPower <>
Date: Sat, 12 Dec 2020 22:14:43 +0300
Subject: [PATCH] Init
---
Cyberpunk2077_SMTPatcher.sln | 25 ++++++
.../Cyberpunk2077_SMTPatcher.csproj | 56 ++++++++++++
Cyberpunk2077_SMTPatcher/Program.cs | 90 +++++++++++++++++++
.../Properties/AssemblyInfo.cs | 16 ++++
Cyberpunk2077_SMTPatcher/app.config | 3 +
README.md | 19 +++-
6 files changed, 207 insertions(+), 2 deletions(-)
create mode 100644 Cyberpunk2077_SMTPatcher.sln
create mode 100644 Cyberpunk2077_SMTPatcher/Cyberpunk2077_SMTPatcher.csproj
create mode 100644 Cyberpunk2077_SMTPatcher/Program.cs
create mode 100644 Cyberpunk2077_SMTPatcher/Properties/AssemblyInfo.cs
create mode 100644 Cyberpunk2077_SMTPatcher/app.config
diff --git a/Cyberpunk2077_SMTPatcher.sln b/Cyberpunk2077_SMTPatcher.sln
new file mode 100644
index 0000000..e031131
--- /dev/null
+++ b/Cyberpunk2077_SMTPatcher.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30717.126
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cyberpunk2077_AVXPatcher", "Cyberpunk2077_AVXPatcher\Cyberpunk2077_AVXPatcher.csproj", "{547095D2-8DF3-434C-85BA-1529D5E7B613}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {547095D2-8DF3-434C-85BA-1529D5E7B613}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {547095D2-8DF3-434C-85BA-1529D5E7B613}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {547095D2-8DF3-434C-85BA-1529D5E7B613}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {547095D2-8DF3-434C-85BA-1529D5E7B613}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8DAAB0FA-1D25-4FD2-A784-3C4CD9A98D5C}
+ EndGlobalSection
+EndGlobal
diff --git a/Cyberpunk2077_SMTPatcher/Cyberpunk2077_SMTPatcher.csproj b/Cyberpunk2077_SMTPatcher/Cyberpunk2077_SMTPatcher.csproj
new file mode 100644
index 0000000..7bf87df
--- /dev/null
+++ b/Cyberpunk2077_SMTPatcher/Cyberpunk2077_SMTPatcher.csproj
@@ -0,0 +1,56 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {547095D2-8DF3-434C-85BA-1529D5E7B613}
+ Exe
+ Cyberpunk2077_SMTPatcher
+ Cyberpunk2077_SMTPatcher
+ v4.8
+ 512
+ true
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ Cyberpunk2077_SMTPatcher.Program
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cyberpunk2077_SMTPatcher/Program.cs b/Cyberpunk2077_SMTPatcher/Program.cs
new file mode 100644
index 0000000..8d92c4c
--- /dev/null
+++ b/Cyberpunk2077_SMTPatcher/Program.cs
@@ -0,0 +1,90 @@
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace Cyberpunk2077_SMTPatcher
+{
+ public static class Program
+ {
+ static void Main(string[] args)
+ {
+ string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ string cp77exe = "Cyberpunk2077.exe";
+ if (File.Exists(cp77exe + ".smt-patcher-bak"))
+ {
+ Console.WriteLine("Backup found. Already patched?");
+ Console.ReadKey();
+ }
+ File.Copy(assemblyPath + Path.DirectorySeparatorChar + cp77exe, assemblyPath + Path.DirectorySeparatorChar + cp77exe + ".smt-patcher-bak", false);
+ Console.WriteLine("Backup created");
+ byte[] sourceBytes = StringHexToByteArray("753033C9B8010000000FA28BC8C1F908");
+ byte[] targetBytes = StringHexToByteArray("743033C9B8010000000FA28BC8C1F908");
+ BinaryReplace(cp77exe + ".smt-patcher-bak", sourceBytes, cp77exe, targetBytes);
+ Console.WriteLine("SMT Pattern found and replaced. Cyberpunk 2077 patched successful.");
+ Console.ReadKey();
+ }
+
+ public static void BinaryReplace(string sourceFile, byte[] sourceSeq, string targetFile, byte[] targetSeq)
+ {
+ FileStream sourceStream = File.OpenRead(sourceFile);
+ FileStream targetStream = File.Create(targetFile);
+
+ try
+ {
+ int b;
+ long foundSeqOffset = -1;
+ int searchByteCursor = 0;
+
+ while ((b = sourceStream.ReadByte()) != -1)
+ {
+ if (sourceSeq[searchByteCursor] == b)
+ {
+ if (searchByteCursor == sourceSeq.Length - 1)
+ {
+ targetStream.Write(targetSeq, 0, targetSeq.Length);
+ searchByteCursor = 0;
+ foundSeqOffset = -1;
+ }
+ else
+ {
+ if (searchByteCursor == 0)
+ {
+ foundSeqOffset = sourceStream.Position - 1;
+ }
+
+ ++searchByteCursor;
+ }
+ }
+ else
+ {
+ if (searchByteCursor == 0)
+ {
+ targetStream.WriteByte((byte)b);
+ }
+ else
+ {
+ targetStream.WriteByte(sourceSeq[0]);
+ sourceStream.Position = foundSeqOffset + 1;
+ searchByteCursor = 0;
+ foundSeqOffset = -1;
+ }
+ }
+ }
+ }
+ finally
+ {
+ sourceStream.Dispose();
+ targetStream.Dispose();
+ }
+ }
+
+ public static byte[] StringHexToByteArray(String hex)
+ {
+ int NumberChars = hex.Length;
+ byte[] bytes = new byte[NumberChars / 2];
+ for (int i = 0; i < NumberChars; i += 2)
+ bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
+ return bytes;
+ }
+ }
+}
diff --git a/Cyberpunk2077_SMTPatcher/Properties/AssemblyInfo.cs b/Cyberpunk2077_SMTPatcher/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2cd7066
--- /dev/null
+++ b/Cyberpunk2077_SMTPatcher/Properties/AssemblyInfo.cs
@@ -0,0 +1,16 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("SMTPatcher")]
+[assembly: AssemblyDescription("SMT Patcher for Cyberpunk 2077")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SMTPatcher")]
+[assembly: AssemblyCopyright("DartPower Team LLC © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("2fcb228c-139f-40f3-b266-019aeae9d681")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Cyberpunk2077_SMTPatcher/app.config b/Cyberpunk2077_SMTPatcher/app.config
new file mode 100644
index 0000000..3e0e37c
--- /dev/null
+++ b/Cyberpunk2077_SMTPatcher/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/README.md b/README.md
index 7f2c499..d0fc301 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,17 @@
-# Cyberpunk2077_SMTPatcher
-SMT Instructions Fix Patcher for Cyberpunk 2077
+# Cyberpunk2077 SMT Patcher
+
+Simultaneous Multi-Threading Fix Patcher for Cyberpunk 2077
+
+Usage:
+
+1. Put "Cyberpunk2077_SMTPatcher.exe" in \bin\x64
+
+2. Run patcher
+
+3. If patching is successful, launch game.
+
+Uninstall patch:
+
+1. Remove Cyberpunk2077.exe
+
+2. Rename Cyberpunk2077.exe.bak to Cyberpunk2077.exe
\ No newline at end of file