mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Add trashbyte copy for OT import on gen1/2
Closes #1849 NAME_LENGTH is 11 for both gens and the offsets don't vary between languages, so it's a simple fetch.
This commit is contained in:
parent
016b75fe83
commit
f9002c6cc9
5 changed files with 9 additions and 2 deletions
|
@ -241,6 +241,7 @@ namespace PKHeX.Core
|
|||
get => GetString(0x2598, OTLength);
|
||||
set => SetString(value, OTLength).CopyTo(Data, 0x2598);
|
||||
}
|
||||
public byte[] OT_Trash { get => GetData(0x2598, 11); set { if (value?.Length == 11) SetData(value, 0x2598); } }
|
||||
public override int Gender
|
||||
{
|
||||
get => 0;
|
||||
|
|
|
@ -268,6 +268,7 @@ namespace PKHeX.Core
|
|||
get => GetString(Offsets.Trainer1 + 2, (Korean ? 2 : 1) * OTLength);
|
||||
set => SetString(value, (Korean ? 2 : 1) * OTLength).CopyTo(Data, Offsets.Trainer1 + 2);
|
||||
}
|
||||
public byte[] OT_Trash { get => GetData(Offsets.Trainer1 + 2, 11); set { if (value?.Length == 11) SetData(value, Offsets.Trainer1 + 2); } }
|
||||
public override int Gender
|
||||
{
|
||||
get => Version == GameVersion.C ? Data[Offsets.Gender] : 0;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
private static readonly int[] mainSizes = { SIZE_G6XY, SIZE_G6ORAS, SIZE_G7SM, SIZE_G7USUM };
|
||||
|
||||
private static readonly byte[] FOOTER_DSV = Encoding.ASCII.GetBytes("|-DESMUME SAVE-|");
|
||||
private static readonly byte[] FOOTER_DSV = Encoding.ASCII.GetBytes("|-DESMUME SAVE-|");
|
||||
internal static readonly string[] HEADER_COLO = { "GC6J","GC6E","GC6P" }; // NTSC-J, NTSC-U, PAL
|
||||
internal static readonly string[] HEADER_XD = { "GXXJ","GXXE","GXXP" }; // NTSC-J, NTSC-U, PAL
|
||||
internal static readonly string[] HEADER_RSBOX = { "GPXJ","GPXE","GPXP" }; // NTSC-J, NTSC-U, PAL
|
||||
|
|
|
@ -316,6 +316,11 @@ namespace PKHeX.WinForms.Controls
|
|||
CB_Country.SelectedValue = SAV.Country;
|
||||
CB_SubRegion.SelectedValue = SAV.SubRegion;
|
||||
}
|
||||
|
||||
// Copy OT trash bytes for sensitive games (Gen1/2)
|
||||
if (SAV is SAV1 s1 && pkm is PK1 p1) p1.OT_Trash = s1.OT_Trash;
|
||||
else if (SAV is SAV2 s2 && pkm is PK2 p2) p2.OT_Trash = s2.OT_Trash;
|
||||
|
||||
UpdateNickname(null, null);
|
||||
}
|
||||
private void SetDetailsHT(SaveFile SAV)
|
||||
|
|
|
@ -300,7 +300,7 @@ namespace PKHeX.WinForms
|
|||
SaveFileDialog sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = $"Decrypted PKM File|*.{pkx}" +
|
||||
(allowEncrypted ? $"|Encrypted PKM File|*.e{pkx.Substring(1, pkx.Length - 1)}" : "") +
|
||||
(allowEncrypted ? $"|Encrypted PKM File|*.e{pkx.Substring(1)}" : "") +
|
||||
"|Binary File|*.bin" +
|
||||
"|All Files|*.*",
|
||||
DefaultExt = pkx,
|
||||
|
|
Loading…
Reference in a new issue