Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update 2022.1.0Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
tylearymf committed May 3, 2022
1 parent d6577ea commit 9e0a6e7
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 10 deletions.
1 change: 1 addition & 0 deletions Patcher/Misc/PatchStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ internal enum PatchStatus
Support,
NotSupport,
Patched,
Special,
}
}
55 changes: 47 additions & 8 deletions Patcher/Unity/UnityPatchInfos.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;

namespace UniHacker
{
internal class UnityPatchInfos
{
static byte[] ToArray(params byte[] bytes)
public static byte[] ToArray(params byte[] bytes)
{
return bytes;
}

static List<byte[]> ToBytes(params byte[] bytes)
public static byte[] ToArray(string byteStr)
{
if (string.IsNullOrEmpty(byteStr))
return new byte[0];

return byteStr.Split(' ').ToList().ConvertAll(x => Convert.ToByte(x, 16)).ToArray();
}

public static List<byte[]> ToBytes(params byte[] bytes)
{
return new List<byte[]>() { bytes };
}

static List<byte[]> ToBytes(byte[] bytes1, byte[] bytes2)
public static List<byte[]> ToBytes(byte[] bytes1, byte[] bytes2)
{
return new List<byte[]>() { bytes1, bytes2 };
}
Expand Down Expand Up @@ -157,12 +166,13 @@ static List<byte[]> ToBytes(byte[] bytes1, byte[] bytes2)
},
new UnityPatchInfo
{
Version = "2022.1.0b7",
LightPattern = ToBytes(ToArray(0x33, 0xFF, 0x40, 0x84, 0xF6, 0x0F, 0x84, 0xA4), ToArray(0xF0, 0x99, 0x3B, 0xFE, 0x90, 0x0F, 0xB6, 0xC3)),
DarkPattern = ToBytes(ToArray(0x33, 0xFF, 0x40, 0x84, 0xF6, 0x0F, 0x85, 0xA4), ToArray(0xF0, 0x99, 0x3B, 0xFE, 0x90, 0xB0, 0x01, 0x90)),
},
Version = "2022.1.0b",
LightPattern = ToBytes(ToArray("75 14 B8 02 00 00 00 E9 66 04 00"), ToArray("0F 84 A4 00 00 00 C7 44 24 20 25 00")),
DarkPattern = ToBytes(ToArray("74 14 B8 02 00 00 00 E9 66 04 00"), ToArray("E9 A5 00 00 00 00 C7 44 24 20 25 00")),
}
};


public static UnityPatchInfo FindPatchInfo(string version, ArchitectureType architectureType)
{
var pathInfos = GetPatchInfos();
Expand Down Expand Up @@ -192,4 +202,33 @@ public bool IsValid()
return Architecture != ArchitectureType.UnKnown && DarkPattern != null && LightPattern != null;
}
}

internal class MultiVersionPatchInfo
{
public List<string> Versions { set; get; }

public ArchitectureType Architecture { get; set; } = ArchitectureType.AMD64;

public List<byte[]> DarkPattern { get; set; }

public List<byte[]> LightPattern { get; set; }


public List<UnityPatchInfo> ToArray()
{
var infos = new List<UnityPatchInfo>(Versions.Count);
foreach (var ver in Versions)
{
infos.Add(new UnityPatchInfo()
{
Version = ver,
Architecture = Architecture,
LightPattern = LightPattern,
DarkPattern = DarkPattern,
});
}

return infos;
}
}
}
7 changes: 7 additions & 0 deletions Patcher/Unity/UnityPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace UniHacker
Expand Down Expand Up @@ -34,6 +35,12 @@ public UnityPatcher(string filePath) : base(filePath)
patchIndexes = lightIndexes;
PatchStatus = PatchStatus.Support;
}

if (PatchStatus == PatchStatus.NotSupport)
{
if (Regex.IsMatch(FileVersion, @"\d+\.\d+.\d+f\d+c\d+(.*)?"))
PatchStatus = PatchStatus.Special;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyVersion("1.1")]
9 changes: 9 additions & 0 deletions Properties/Language_Chinese.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Properties/Language_Chinese.resx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
<data name="process_occupy" xml:space="preserve">
<value>{0} 正在运行中,可能会破解失败!</value>
</data>
<data name="Special" xml:space="preserve">
<value>国内特供版不支持破解</value>
</data>
<data name="status" xml:space="preserve">
<value>文件状态:</value>
</data>
Expand Down
9 changes: 9 additions & 0 deletions Properties/Language_English.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Properties/Language_English.resx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ If patch fails, please submit unity.exe binary file or Unity Hub version number
<data name="process_occupy" xml:space="preserve">
<value>{0} is running and the patch may fail!</value>
</data>
<data name="Special" xml:space="preserve">
<value>NotSupport Patch</value>
</data>
<data name="status" xml:space="preserve">
<value>Status:</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Patch all versions of Unity3D and UnityHub. **ONLY SUPPORT WINDOWS.**

## Supported Unity Versions

| 2022.1.0b7 | 2021.x | 2020.x | 2019.x | 2018.x | 2017.x |
| 2022.1.0Beta | 2021.x | 2020.x | 2019.x | 2018.x | 2017.x |
| :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
| :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |

Expand Down

0 comments on commit 9e0a6e7

Please sign in to comment.