From 1123c24b0cf0ebc33c43552328281dcf06fbeee3 Mon Sep 17 00:00:00 2001 From: Archit Date Date: Fri, 8 Sep 2017 03:25:45 +0800 Subject: [PATCH] Fix Gen4 Misc options when no Poketch is obtained. (#1448) * Fix Gen4 Misc options when no Poketch is obtained. closes #1447 --- PKHeX.Core/Saves/SAV4.cs | 2 +- PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 0ed35d06b..52de91072 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -515,7 +515,7 @@ public int Y } public override int SecondsToStart { get => BitConverter.ToInt32(Data, AdventureInfo + 0x34); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } public override int SecondsToFame { get => BitConverter.ToInt32(Data, AdventureInfo + 0x3C); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } - public int CurrentPoketchApp { get => Data[_currentPoketchApp]; set => Data[_currentPoketchApp] = (byte)Math.Min(24, value); /* Alarm Clock */ } + public int CurrentPoketchApp { get => (sbyte)Data[_currentPoketchApp]; set => Data[_currentPoketchApp] = (byte)Math.Min(24, value); /* Alarm Clock */ } private int _currentPoketchApp; // Storage diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs index b2b6ea671..e34cd71bd 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs @@ -182,17 +182,17 @@ private void B_AllFlyDest_Click(object sender, EventArgs e) private void ReadPoketch() { string[] PoketchTitle = new[] { - "01 - Digital Watch", "02 - Calculator", "03 - Memo Pad", "04 - Pedometer", "05 - Pokémon List", + "Unavailable", "01 - Digital Watch", "02 - Calculator", "03 - Memo Pad", "04 - Pedometer", "05 - Pokémon List", "06 - Friendship Checker", "07 - Dowsing Machine", "08 - Berry Searcher", "09 - Day Care Checker", "10 - Pokémon History", "11 - Counter", "12 - Analog Watch", "13 - Marking Map", "14 - Link Searcher", "15 - Coin Toss", "16 - Move Tester", "17 - Calendar", "18 - Dot Artist", "19 - Roulette", "20 - Trainer Counter", "21 - Kitchen Timer", "22 - Color Changer", "23 - Matchup Checker", "24 - Stopwatch", "25 - Alarm Clock" }; CB_CurrentApp.Items.AddRange(PoketchTitle); - CB_CurrentApp.SelectedIndex = SAV.CurrentPoketchApp; + CB_CurrentApp.SelectedIndex = SAV.CurrentPoketchApp + 1; oldPoketchVal = new bool[PoketchTitle.Length]; CLB_Poketch.Items.Clear(); - for (int i = 0; i < PoketchTitle.Length; i++) + for (int i = 1; i < PoketchTitle.Length; i++) { oldPoketchVal[i] = SAV.Data[ofsPoketch + i] != 0; CLB_Poketch.Items.Add(PoketchTitle[i], oldPoketchVal[i]); @@ -229,7 +229,7 @@ private void SavePoketch() SAV.Data[ofsPoketch - 1] = 0; DotArtistByte.CopyTo(SAV.Data, ofsPoketch + 0x27); SAV.Data[ofsPoketch - 3] |= 0x04; // "Touch!" - SAV.CurrentPoketchApp = CB_CurrentApp.SelectedIndex; + SAV.CurrentPoketchApp = CB_CurrentApp.SelectedIndex - 1; } private void SetPictureBoxFromFlags(byte[] inp) @@ -732,4 +732,4 @@ private void B_UnlockCourses_Click(object sender, EventArgs e) SAV.PokewalkerCoursesUnlockAll(); } } -} \ No newline at end of file +}