mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 08:47:14 +00:00
Merge branch 'master' of https://github.com/kwsch/PKHeX
This commit is contained in:
commit
f033bc903c
1 changed files with 19 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -18,13 +18,14 @@ namespace PKHeX
|
|||
uint[] skips = new uint[] { };
|
||||
uint[] instances = new uint[] { };
|
||||
uint val = BitConverter.ToUInt32(ramsav, 0);
|
||||
uint spos = 0;
|
||||
if (ramsav.Length == 0x80000) // ORAS
|
||||
{
|
||||
offsets = new uint[] { 0x00005400, 0x00005800, 0x00006400, 0x00006600, 0x00006800, 0x00006A00, 0x00006C00, 0x00006E00, 0x00007000, 0x00007200, 0x00007400, 0x00009600, 0x00009800, 0x00009E00, 0x0000A400, 0x0000F400, 0x00014400, 0x00019400, 0x00019600, 0x00019E00, 0x0001A400, 0x0001B600, 0x0001BE00, 0x0001C000, 0x0001C200, 0x0001C800, 0x0001CA00, 0x0001CE00, 0x0001D600, 0x0001D800, 0x0001DA00, 0x0001DC00, 0x0001DE00, 0x0001E000, 0x0001E800, 0x0001EE00, 0x0001F200, 0x00020E00, 0x00021000, 0x00021400, 0x00021800, 0x00022000, 0x00023C00, 0x00024000, 0x00024800, 0x00024C00, 0x00025600, 0x00025A00, 0x00026200, 0x00027000, 0x00027200, 0x00027400, 0x00028200, 0x00028A00, 0x00028E00, 0x00030A00, 0x00038400, 0x0006D000, 0x0007B200 };
|
||||
lens = new uint[] { 0x000002C8, 0x00000B90, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000130, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000011CC, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000003E0, 0x00000216, 0x00000640, 0x00001A90, 0x00000400, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00000400, 0x00007AD0, 0x000078B0, 0x00034AD0, 0x0000E058, 0x00000200 };
|
||||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x005E0BB8, 0x005E09C4, 0x005E0904, 0x005E0AA4, 0x005E0BF8, 0x005E05CC, 0x005E0B04, 0x005E0A44, 0x005E0AC4, 0x005E05AC, 0x005E064C, 0x005E0944, 0x005E0924, 0x005E0B78, 0x005E0884, 0x005E0884, 0x005E0884, 0x005E0AE4, 0x005E068C, 0x005DF40C, 0x005E0C18, 0x005E072C, 0x005E05EC, 0x005E0964, 0x005E06AC, 0x005E06EC, 0x005E062C, 0x005E0BD8, 0x005E0A64, 0x005E0B98, 0x005E07CC, 0x005E0A24, 0x005E058C, 0x005E04EC, 0x005E056C, 0x005E082C, 0x005E0984, 0x005E070C, 0x005E0B58, 0x005E054C, 0x005E050C, 0x005E080C, 0x005E076C, 0x005E07AC, 0x005E09E4, 0x005E08A4, 0x005E078C, 0x005E074C, 0x005E060C, 0x005E06CC, UNKNOWNVAL, 0x005E0864, 0x005E07EC, 0x005E0A04, 0x005E052C, 0x005E08C4, 0x005E04CC, 0x005E066C, 0x005E09A4 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,7 +33,7 @@ namespace PKHeX
|
|||
lens = new uint[] { 0x000002C8, 0x00000B88, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000140, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000006A0, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000001F0, 0x00000216, 0x00000390, 0x00001A90, 0x00000308, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00034AD0, 0x0000E058, 0x00000200 };
|
||||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x0059AE94, 0x0059ACC0, 0x0059AC00, 0x0059AD80, 0x0059AED4, 0x0059A8E8, 0x0059ADE0, 0x0059AD20, 0x0059ADA0, 0x0059A8C8, 0x0059A968, 0x0059AC40, 0x0059AC20, 0x0059AE54, 0x0059ABA0, 0x0059ABA0, 0x0059ABA0, 0x0059ADC0, 0x0059A9A8, 0x00599734, 0x0059AEF4, 0x0059AA48, 0x0059A908, 0x0059AC60, 0x0059A9C8, 0x0059AA08, 0x0059A948, 0x0059AEB4, 0x0059AD40, 0x0059AE74, 0x0059AAE8, 0x0059AD00, 0x0059A8A8, 0x0059A800, 0x0059A888, 0x0059AB70, 0x0059AC80, 0x0059AA28, 0x0059AE34, 0x0059A868, 0x0059A820, 0x0059AB28, 0x0059AA88, 0x0059AAC8, 0x0059ACE0, 0x0059ABC0, 0x0059AAA8, 0x0059AA68, 0x0059A928, 0x0059A9E8, 0x0059AD60, 0x0059AB80, 0x0059AB08, 0x0059A7E0, 0x0059A988, 0x0059ACA0 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
if (val == 0x0059E418)
|
||||
{
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
|
@ -46,10 +47,14 @@ namespace PKHeX
|
|||
{
|
||||
for (int i = 0; i < lens.Length; i++)
|
||||
{
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i]);
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i], spos);
|
||||
ms.Seek((long)(offsets[i] - 0x5400), SeekOrigin.Begin);
|
||||
spos += lens[i];
|
||||
if (ofs > 0)
|
||||
{
|
||||
new MemoryStream(ramsav.Skip(ofs + (int)skips[i]).Take((int)lens[i]).ToArray()).CopyTo(ms);
|
||||
spos += 4;
|
||||
}
|
||||
else
|
||||
new MemoryStream(new byte[(int)lens[i]]).CopyTo(ms);
|
||||
}
|
||||
|
@ -71,13 +76,14 @@ namespace PKHeX
|
|||
uint[] skips = new uint[] { };
|
||||
uint[] instances = new uint[] { };
|
||||
uint val = BitConverter.ToUInt32(ramsav, 0);
|
||||
uint spos = 0;
|
||||
if (oras) // ORAS
|
||||
{
|
||||
offsets = new uint[] { 0x00005400, 0x00005800, 0x00006400, 0x00006600, 0x00006800, 0x00006A00, 0x00006C00, 0x00006E00, 0x00007000, 0x00007200, 0x00007400, 0x00009600, 0x00009800, 0x00009E00, 0x0000A400, 0x0000F400, 0x00014400, 0x00019400, 0x00019600, 0x00019E00, 0x0001A400, 0x0001B600, 0x0001BE00, 0x0001C000, 0x0001C200, 0x0001C800, 0x0001CA00, 0x0001CE00, 0x0001D600, 0x0001D800, 0x0001DA00, 0x0001DC00, 0x0001DE00, 0x0001E000, 0x0001E800, 0x0001EE00, 0x0001F200, 0x00020E00, 0x00021000, 0x00021400, 0x00021800, 0x00022000, 0x00023C00, 0x00024000, 0x00024800, 0x00024C00, 0x00025600, 0x00025A00, 0x00026200, 0x00027000, 0x00027200, 0x00027400, 0x00028200, 0x00028A00, 0x00028E00, 0x00030A00, 0x00038400, 0x0006D000, 0x0007B200 };
|
||||
lens = new uint[] { 0x000002C8, 0x00000B90, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000130, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000011CC, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000003E0, 0x00000216, 0x00000640, 0x00001A90, 0x00000400, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00000400, 0x00007AD0, 0x000078B0, 0x00034AD0, 0x0000E058, 0x00000200 };
|
||||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x005E0BB8, 0x005E09C4, 0x005E0904, 0x005E0AA4, 0x005E0BF8, 0x005E05CC, 0x005E0B04, 0x005E0A44, 0x005E0AC4, 0x005E05AC, 0x005E064C, 0x005E0944, 0x005E0924, 0x005E0B78, 0x005E0884, 0x005E0884, 0x005E0884, 0x005E0AE4, 0x005E068C, 0x005DF40C, 0x005E0C18, 0x005E072C, 0x005E05EC, 0x005E0964, 0x005E06AC, 0x005E06EC, 0x005E062C, 0x005E0BD8, 0x005E0A64, 0x005E0B98, 0x005E07CC, 0x005E0A24, 0x005E058C, 0x005E04EC, 0x005E056C, 0x005E082C, 0x005E0984, 0x005E070C, 0x005E0B58, 0x005E054C, 0x005E050C, 0x005E080C, 0x005E076C, 0x005E07AC, 0x005E09E4, 0x005E08A4, 0x005E078C, 0x005E074C, 0x005E060C, 0x005E06CC, UNKNOWNVAL, 0x005E0864, 0x005E07EC, 0x005E0A04, 0x005E052C, 0x005E08C4, 0x005E04CC, 0x005E066C, 0x005E09A4 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -85,7 +91,7 @@ namespace PKHeX
|
|||
lens = new uint[] { 0x000002C8, 0x00000B88, 0x0000002C, 0x00000038, 0x00000150, 0x00000004, 0x00000008, 0x000001C0, 0x000000BE, 0x00000024, 0x00002100, 0x00000140, 0x00000440, 0x00000574, 0x00004E28, 0x00004E28, 0x00004E28, 0x00000170, 0x0000061C, 0x00000504, 0x000006A0, 0x00000644, 0x00000104, 0x00000004, 0x00000420, 0x00000064, 0x000003F0, 0x0000070C, 0x00000180, 0x00000004, 0x0000000C, 0x00000048, 0x00000054, 0x00000644, 0x000005C8, 0x000002F8, 0x00001B40, 0x000001F4, 0x000001F0, 0x00000216, 0x00000390, 0x00001A90, 0x00000308, 0x00000618, 0x0000025C, 0x00000834, 0x00000318, 0x000007D0, 0x00000C48, 0x00000078, 0x00000200, 0x00000C84, 0x00000628, 0x00034AD0, 0x0000E058, 0x00000200 };
|
||||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x0059AE94, 0x0059ACC0, 0x0059AC00, 0x0059AD80, 0x0059AED4, 0x0059A8E8, 0x0059ADE0, 0x0059AD20, 0x0059ADA0, 0x0059A8C8, 0x0059A968, 0x0059AC40, 0x0059AC20, 0x0059AE54, 0x0059ABA0, 0x0059ABA0, 0x0059ABA0, 0x0059ADC0, 0x0059A9A8, 0x00599734, 0x0059AEF4, 0x0059AA48, 0x0059A908, 0x0059AC60, 0x0059A9C8, 0x0059AA08, 0x0059A948, 0x0059AEB4, 0x0059AD40, 0x0059AE74, 0x0059AAE8, 0x0059AD00, 0x0059A8A8, 0x0059A800, 0x0059A888, 0x0059AB70, 0x0059AC80, 0x0059AA28, 0x0059AE34, 0x0059A868, 0x0059A820, 0x0059AB28, 0x0059AA88, 0x0059AAC8, 0x0059ACE0, 0x0059ABC0, 0x0059AAA8, 0x0059AA68, 0x0059A928, 0x0059A9E8, 0x0059AD60, 0x0059AB80, 0x0059AB08, 0x0059A7E0, 0x0059A988, 0x0059ACA0 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
if (val == 0x0059E418)
|
||||
{
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
|
@ -97,21 +103,25 @@ namespace PKHeX
|
|||
}
|
||||
for (int i = 0; i < lens.Length; i++)
|
||||
{
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i]);
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i], spos);
|
||||
spos += lens[i];
|
||||
if (ofs > 0)
|
||||
{
|
||||
Array.Copy(main, (int)offsets[i] - 0x5400, newram, ofs + (int)skips[i], lens[i]);
|
||||
spos += 4;
|
||||
}
|
||||
else { }
|
||||
//Do nothing. Don't Copy blocks we can't find lol
|
||||
}
|
||||
return newram;
|
||||
}
|
||||
|
||||
internal static int FindIndex(byte[] data, uint val, uint instances)
|
||||
internal static int FindIndex(byte[] data, uint val, uint instances, uint start)
|
||||
{
|
||||
if (val == UNKNOWNVAL)
|
||||
return -1;
|
||||
|
||||
int ofs = 0;
|
||||
int ofs = (int)start;
|
||||
int times = 0;
|
||||
uint v = (BitConverter.ToUInt32(data, ofs));
|
||||
while ((v != val || times != instances) && ofs + 4 < data.Length)
|
||||
|
|
Loading…
Reference in a new issue