From 8ac9a7d12759b51a95d325bef16ca9090c089b17 Mon Sep 17 00:00:00 2001 From: Mega-Mew Date: Wed, 17 May 2017 11:13:27 +0200 Subject: [PATCH] Add Support for Sun/Moon v1.2 --- SMPatcher/Program.cs | 37 ++++++++++++- SMPatcher/Properties/Resources.Designer.cs | 58 ++++++++++++++------- SMPatcher/Properties/Resources.resx | 6 +++ SMPatcher/Resources/byte/moon_hash_1_2 | 1 + SMPatcher/Resources/byte/sun_hash_1_2 | Bin 0 -> 32 bytes SMPatcher/SMPatcher.csproj | 2 + 6 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 SMPatcher/Resources/byte/moon_hash_1_2 create mode 100644 SMPatcher/Resources/byte/sun_hash_1_2 diff --git a/SMPatcher/Program.cs b/SMPatcher/Program.cs index c98fd76..b8a3d2a 100644 --- a/SMPatcher/Program.cs +++ b/SMPatcher/Program.cs @@ -91,6 +91,31 @@ class Program GetSingletonAccessorInstance = 0x48B4 }; + private static readonly Offsets Offsets_1_2 = new Offsets + { + CTRIsDebugMode = 0x4DE0, + + DecryptQRCodeStart = 0x2CEA3C, + DecryptQRCodeEnd = 0x2CEAD4, + + AnalyzeQRBinaryStart = 0x2CED90, + AnalyzeQRBinaryEnd = 0x2CF214, + QRReaderSaveDataBatteryQuery = 0x33F6B0, + + QRReaderSaveDataIsRegisteredData = 0x3A8DD0, + + ForbiddenQRs = 0x4A5FF0, + + NoOutlines = 0x31CFCC, + + CRC16 = 0x259D14, + DexDataAllocator = 0x3B6730, + aeabi_memcpy = 0x1FEBD8, + GenerateDexDisplayData = 0x2CE714, + + GetSingletonAccessorInstance = 0x48B4 + }; + static uint GetARMBranch(uint from, uint to) { // Fuck ARM Branches @@ -169,7 +194,7 @@ static void Main(string[] args) var dir = Path.GetDirectoryName(args[0]); var fn = Path.GetFileNameWithoutExtension(args[0]); - Console.WriteLine("Sun/Moon Patcher v1.1 - SciresM"); + Console.WriteLine("Sun/Moon Patcher v1.2 - SciresM"); var hash = (new SHA256CryptoServiceProvider()).ComputeHash(code); if (hash.SequenceEqual(Resources.moon_hash_1_0)) @@ -182,6 +207,11 @@ static void Main(string[] args) Console.WriteLine("Pokemon Moon v1.1 detected."); Offsets = Offsets_1_1; } + else if (hash.SequenceEqual(Resources.moon_hash_1_2)) + { + Console.WriteLine("Pokemon Moon v1.2 detected."); + Offsets = Offsets_1_2; + } else if (hash.SequenceEqual(Resources.sun_hash_1_0)) { Console.WriteLine("Pokemon Sun v1.0 detected"); @@ -192,6 +222,11 @@ static void Main(string[] args) Console.WriteLine("Pokemon Sun v1.1 detected"); Offsets = Offsets_1_1; } + else if (hash.SequenceEqual(Resources.sun_hash_1_2)) + { + Console.WriteLine("Pokemon Sun v1.2 detected"); + Offsets = Offsets_1_2; + } else { Console.WriteLine("Unknown code.bin! Contact SciresM to update the program."); diff --git a/SMPatcher/Properties/Resources.Designer.cs b/SMPatcher/Properties/Resources.Designer.cs index bfa67d3..bdb58f1 100644 --- a/SMPatcher/Properties/Resources.Designer.cs +++ b/SMPatcher/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Ce code a été généré par un outil. +// Version du runtime :4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si +// le code est régénéré. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace SMPatcher.Properties { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder + // à l'aide d'un outil, tel que ResGen ou Visual Studio. + // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen + // avec l'option /str ou régénérez votre projet VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal Resources() { } /// - /// Returns the cached ResourceManager instance used by this class. + /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Resources() { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Remplace la propriété CurrentUICulture du thread actuel pour toutes + /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] battery_save { get { @@ -71,7 +71,7 @@ internal static byte[] battery_save { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] debug_stub { get { @@ -81,7 +81,7 @@ internal static byte[] debug_stub { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] moon_hash_1_0 { get { @@ -91,7 +91,7 @@ internal static byte[] moon_hash_1_0 { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] moon_hash_1_1 { get { @@ -101,7 +101,17 @@ internal static byte[] moon_hash_1_1 { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. + /// + internal static byte[] moon_hash_1_2 { + get { + object obj = ResourceManager.GetObject("moon_hash_1_2", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] qr_is_registered { get { @@ -111,7 +121,7 @@ internal static byte[] qr_is_registered { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] sun_hash_1_0 { get { @@ -121,7 +131,7 @@ internal static byte[] sun_hash_1_0 { } /// - /// Looks up a localized resource of type System.Byte[]. + /// Recherche une ressource localisée de type System.Byte[]. /// internal static byte[] sun_hash_1_1 { get { @@ -129,5 +139,15 @@ internal static byte[] sun_hash_1_1 { return ((byte[])(obj)); } } + + /// + /// Recherche une ressource localisée de type System.Byte[]. + /// + internal static byte[] sun_hash_1_2 { + get { + object obj = ResourceManager.GetObject("sun_hash_1_2", resourceCulture); + return ((byte[])(obj)); + } + } } } diff --git a/SMPatcher/Properties/Resources.resx b/SMPatcher/Properties/Resources.resx index d459ecb..19f678b 100644 --- a/SMPatcher/Properties/Resources.resx +++ b/SMPatcher/Properties/Resources.resx @@ -130,6 +130,9 @@ ..\Resources\byte\moon_hash_1_1;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\byte\moon_hash_1_2;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\resources\byte\qr_is_registered;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -139,4 +142,7 @@ ..\Resources\byte\sun_hash_1_1;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\byte\sun_hash_1_2;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/SMPatcher/Resources/byte/moon_hash_1_2 b/SMPatcher/Resources/byte/moon_hash_1_2 new file mode 100644 index 0000000..6f064e9 --- /dev/null +++ b/SMPatcher/Resources/byte/moon_hash_1_2 @@ -0,0 +1 @@ +Tw{E$9Joߠu@JЗ^UFg, \ No newline at end of file diff --git a/SMPatcher/Resources/byte/sun_hash_1_2 b/SMPatcher/Resources/byte/sun_hash_1_2 new file mode 100644 index 0000000000000000000000000000000000000000..ccc0b23450b8c3e9eac88233a67e9b2ba9edf72a GIT binary patch literal 32 ocmZ?SYp>au!QuejZVC&MjxjgSw-0JLRv`!R!`fGYE0OGR_m;e9( literal 0 HcmV?d00001 diff --git a/SMPatcher/SMPatcher.csproj b/SMPatcher/SMPatcher.csproj index 95cf57d..e9809d5 100644 --- a/SMPatcher/SMPatcher.csproj +++ b/SMPatcher/SMPatcher.csproj @@ -67,9 +67,11 @@ + +