Expose gen2 RTC resetkey

#1487

also expose gen1 event flags (well, the crappy ones at least)
constants/event_constants.asm
This commit is contained in:
Kurt 2017-09-23 22:13:48 -07:00
parent 16341b4d91
commit 12187a5128
3 changed files with 20 additions and 4 deletions

View file

@ -101,7 +101,9 @@ namespace PKHeX.Core
Array.Copy(rawDC, 1 + 2 * StringLength, TempDaycare, 2 + 1, PKX.SIZE_1STORED);
PokemonList1 daycareList = new PokemonList1(TempDaycare, PokemonList1.CapacityType.Single, Japanese);
daycareList.GetBytes().CopyTo(Data, GetPartyOffset(7));
Daycare = GetPartyOffset(7);
Daycare = GetPartyOffset(7);
EventFlag = Japanese ? 0x9E9 : 0x29F3;
// Enable Pokedex editing
PokeDex = 0;
@ -110,6 +112,10 @@ namespace PKHeX.Core
ClearBoxes();
}
// Event Flags
protected override int EventFlagMax => EventFlag > 0 ? 0xA00 : int.MinValue; // 320 * 8
protected override int EventConstMax => 0;
private const int SIZE_RESERVED = 0x8000; // unpacked box data
protected override byte[] Write(bool DSV)

View file

@ -615,6 +615,8 @@ namespace PKHeX.WinForms.Controls
{
switch (SAV.Generation)
{
case 2:
WinFormsUtil.Alert($"Reset key: {((SAV2)SAV).ResetKey:00000}"); break;
case 3:
new SAV_RTC3(SAV).ShowDialog(); break;
}
@ -1002,7 +1004,7 @@ namespace PKHeX.WinForms.Controls
B_OpenMiscEditor.Enabled = sav is SAV3 || sav is SAV4 || sav is SAV5;
B_OpenHoneyTreeEditor.Enabled = sav.DP || sav.Pt;
B_OpenRTCEditor.Enabled = sav.RS || sav.E;
B_OpenRTCEditor.Enabled = sav.RS || sav.E || sav.Generation == 2;
B_OpenUGSEditor.Enabled = sav.DP || sav.Pt;
}
GB_SAVtools.Visible = sav.Exportable && FLP_SAVtools.Controls.Cast<Control>().Any(c => c.Enabled);

View file

@ -44,10 +44,16 @@ namespace PKHeX.WinForms
Text = $"Event Flag Editor ({gamePrefix.ToUpper()})";
CB_Stats.SelectedIndex = 0;
if (CB_Stats.Items.Count > 0)
CB_Stats.SelectedIndex = 0;
else
{
L_Stats.Visible = CB_Stats.Visible = MT_Stat.Visible = false;
tabControl1.TabPages.Remove(GB_Constants);
}
NUD_Flag.Maximum = flags.Length - 1;
NUD_Flag.Text = "0";
c_CustomFlag.Checked = flags[0];
}
private readonly bool[] flags;
@ -366,6 +372,8 @@ namespace PKHeX.WinForms
}
private void ChangeConstantIndex(object sender, EventArgs e)
{
if (Constants.Length == 0)
return;
if (constEntry > -1) // Set Entry
Constants[constEntry] = (ushort)Math.Min(Util.ToUInt32(MT_Stat.Text), 0xFFFF);