mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-11 06:05:04 -05:00
parent
c67b774e1e
commit
2bb0ea0b38
|
|
@ -15,6 +15,7 @@ public TrashEditor(TextBoxBase TB_NN, byte[] raw, SaveFile sav)
|
|||
InitializeComponent();
|
||||
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
||||
SAV = sav;
|
||||
BytesPerChar = sav.Generation > 3 || sav.GameCube ? 2 : 1;
|
||||
|
||||
FinalString = TB_NN.Text;
|
||||
Raw = FinalBytes = raw;
|
||||
|
|
@ -43,6 +44,8 @@ public TrashEditor(TextBoxBase TB_NN, byte[] raw, SaveFile sav)
|
|||
CenterToParent();
|
||||
}
|
||||
|
||||
private readonly int BytesPerChar;
|
||||
|
||||
private readonly List<NumericUpDown> Bytes = new List<NumericUpDown>();
|
||||
private readonly Font pkxFont = FontUtil.GetPKXFont(12F);
|
||||
public string FinalString;
|
||||
|
|
@ -161,7 +164,7 @@ private void B_ApplyTrash_Click(object sender, EventArgs e)
|
|||
WinFormsUtil.Alert("Trash byte layer is too long to apply.");
|
||||
return;
|
||||
}
|
||||
for (int i = current.Length; i < data.Length; i++)
|
||||
for (int i = current.Length + BytesPerChar; i < data.Length; i++)
|
||||
Bytes[i].Value = data[i];
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +175,7 @@ private void B_ClearTrash_Click(object sender, EventArgs e)
|
|||
Bytes[i].Value = 0;
|
||||
}
|
||||
|
||||
private byte[] SetString(string text) => SAV.SetString(text, Raw.Length);
|
||||
private byte[] SetString(string text) => SAV.SetString(text, text.Length);
|
||||
private string GetString() => SAV.GetString(Raw, 0, Raw.Length);
|
||||
|
||||
// Helpers
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user