Skip to content

Commit

Permalink
Merge pull request #3 from Mega-Mew/master
Browse files Browse the repository at this point in the history
Add Support for Sun/Moon v1.2
  • Loading branch information
SciresM authored May 17, 2017
2 parents f8cfb5a + 8ac9a7d commit 38f237b
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 20 deletions.
37 changes: 36 additions & 1 deletion SMPatcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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");
Expand All @@ -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.");
Expand Down
58 changes: 39 additions & 19 deletions SMPatcher/Properties/Resources.Designer.cs

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

6 changes: 6 additions & 0 deletions SMPatcher/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
<data name="moon_hash_1_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\moon_hash_1_1;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="moon_hash_1_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\moon_hash_1_2;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="qr_is_registered" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\byte\qr_is_registered;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
Expand All @@ -139,4 +142,7 @@
<data name="sun_hash_1_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\sun_hash_1_1;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="sun_hash_1_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\sun_hash_1_2;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
1 change: 1 addition & 0 deletions SMPatcher/Resources/byte/moon_hash_1_2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�T���w�{E$�9Joߠ�u@JЗ�^UF�g,
Binary file added SMPatcher/Resources/byte/sun_hash_1_2
Binary file not shown.
2 changes: 2 additions & 0 deletions SMPatcher/SMPatcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@
<None Include="Resources\byte\debug_stub.bin" />
<None Include="Resources\byte\moon_hash_1_0" />
<None Include="Resources\byte\moon_hash_1_1" />
<None Include="Resources\byte\moon_hash_1_2" />
<None Include="Resources\byte\qr_is_registered" />
<None Include="Resources\byte\sun_hash_1_0" />
<None Include="Resources\byte\sun_hash_1_1" />
<None Include="Resources\byte\sun_hash_1_2" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
Expand Down

0 comments on commit 38f237b

Please sign in to comment.