diff --git a/PKHeX.Core/Properties/Resources.Designer.cs b/PKHeX.Core/Properties/Resources.Designer.cs index 2e70ed8b8..b6619eafb 100644 --- a/PKHeX.Core/Properties/Resources.Designer.cs +++ b/PKHeX.Core/Properties/Resources.Designer.cs @@ -61,6 +61,17 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to 0182 Ns Castle 0:Event,1:Event,2:Before Reshiram/Zekrom,3:Before N,4:Event,5:Before Ghetsis + ///0145 Victini 0:Event,1:Event,2:Battleable,3:Defeated,4:Captured,5:All event finished + ///0206 Landorus 0:Event,1:Event,2:Event,3:Battleable,4:Disappeared. + /// + internal static string const_bw { + get { + return ResourceManager.GetString("const_bw", resourceCulture); + } + } + /// /// Looks up a localized string similar to 0166 Dialga/Palkia 00:Event,01:Event,02:Event,03:Event,04:Disappeared,05:Battleable ///0172 Heatran 00:Not appeared,01:Battleable,02:Disappeared @@ -134,6 +145,24 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to 0669 Plasma guide(LeaguePokemart) disappeared + ///0661 Reshiram/Zekrom(NsCastle) disappeared + ///0766 Reshiram/Zekrom(DragonspiralTower) disappeared + ///0801 Kyurem disappeared + ///0812 Volcarona disappeared + ///0649 Cobalion disappeared + ///0650 Terrakion disappeared + ///0651 Virizion disappeared + ///0652 Obstacle(VictoryRoad) cleared + ///0653 Obstacle(PinwheelForest) cleared. + /// + internal static string flags_bw { + get { + return ResourceManager.GetString("flags_bw", resourceCulture); + } + } + /// /// Looks up a localized string similar to 0479 Uxie disappeared ///0477 Mesprit(Verity Cavern) disappeared diff --git a/PKHeX.Core/Properties/Resources.resx b/PKHeX.Core/Properties/Resources.resx index 4982d20b6..632f9595d 100644 --- a/PKHeX.Core/Properties/Resources.resx +++ b/PKHeX.Core/Properties/Resources.resx @@ -1445,4 +1445,10 @@ ..\Resources\text\other\flags_hgss.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;shift_jis + + ..\Resources\text\other\const_bw.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;shift_jis + + + ..\Resources\text\other\flags_bw.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;shift_jis + \ No newline at end of file diff --git a/PKHeX.Core/Resources/text/other/const_bw.txt b/PKHeX.Core/Resources/text/other/const_bw.txt new file mode 100644 index 000000000..381081c6d --- /dev/null +++ b/PKHeX.Core/Resources/text/other/const_bw.txt @@ -0,0 +1,3 @@ +0182 Ns Castle 0:Event,1:Event,2:Before Reshiram/Zekrom,3:Before N,4:Event,5:Before Ghetsis +0145 Victini 0:Event,1:Event,2:Battleable,3:Defeated,4:Captured,5:All event finished +0206 Landorus 0:Event,1:Event,2:Event,3:Battleable,4:Disappeared \ No newline at end of file diff --git a/PKHeX.Core/Resources/text/other/flags_bw.txt b/PKHeX.Core/Resources/text/other/flags_bw.txt new file mode 100644 index 000000000..ffac536bf --- /dev/null +++ b/PKHeX.Core/Resources/text/other/flags_bw.txt @@ -0,0 +1,10 @@ +0669 Plasma guide(LeaguePokemart) disappeared +0661 Reshiram/Zekrom(NsCastle) disappeared +0766 Reshiram/Zekrom(DragonspiralTower) disappeared +0801 Kyurem disappeared +0812 Volcarona disappeared +0649 Cobalion disappeared +0650 Terrakion disappeared +0651 Virizion disappeared +0652 Obstacle(VictoryRoad) cleared +0653 Obstacle(PinwheelForest) cleared \ No newline at end of file diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs index 2d95ad02f..9d3841076 100644 --- a/PKHeX.Core/Saves/SAV5.cs +++ b/PKHeX.Core/Saves/SAV5.cs @@ -39,6 +39,8 @@ public SAV5(byte[] data = null, GameVersion versionOverride = GameVersion.Any) case GameVersion.BW: BattleBox = 0x20A00; Trainer2 = 0x21200; + EventConst = 0x20100; + EventFlag = EventConst + 0x27C; Daycare = 0x20E00; PokeDex = 0x21600; PokeDexLanguageFlags = PokeDex + 0x320; @@ -105,7 +107,8 @@ public SAV5(byte[] data = null, GameVersion versionOverride = GameVersion.Any) public override int Generation => 5; public override int OTLength => 7; public override int NickLength => 10; - protected override int EventConstMax => 0x35E/2; + protected override int EventConstMax => (Version == GameVersion.BW ? 0x27C : 0x35E) >> 1; + protected override int EventFlagMax => (Version == GameVersion.BW ? 0x16C : 0x17F) << 3; protected override int GiftCountMax => 12; public override int MaxMoveID => Legal.MaxMoveID_5; diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 795181f79..f627fc60b 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -235,7 +235,7 @@ public bool[] EventFlags bool[] Flags = new bool[EventFlagMax]; for (int i = 0; i < Flags.Length; i++) - Flags[i] = (Data[EventFlag + i >> 3] >> (i & 7) & 0x1) == 1; + Flags[i] = (Data[EventFlag + (i >> 3)] >> (i & 7) & 0x1) == 1; return Flags; } set diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs index c57bb0623..46cd7d4f6 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs @@ -590,6 +590,8 @@ private void B_OpenMiscEditor_Click(object sender, EventArgs e) new SAV_Misc3(SAV).ShowDialog(); break; case 4: new SAV_Misc4(SAV).ShowDialog(); break; + case 5: + new SAV_Misc5(SAV).ShowDialog(); break; } } private void B_OpenRTCEditor_Click(object sender, EventArgs e) @@ -945,7 +947,7 @@ public bool ToggleInterface() B_CGearSkin.Enabled = SAV.Generation == 5; B_OpenTrainerInfo.Enabled = B_OpenItemPouch.Enabled = SAV.HasParty; // Box RS - B_OpenMiscEditor.Enabled = SAV is SAV3 || SAV.DP || SAV.HGSS; + B_OpenMiscEditor.Enabled = SAV.Generation <= 5 && SAV.Generation >= 3 && !SAV.Pt; B_OpenHoneyTreeEditor.Enabled = SAV.DP || SAV.Pt; B_OpenRTCEditor.Enabled = SAV.RS || SAV.E; diff --git a/PKHeX.WinForms/PKHeX.WinForms.csproj b/PKHeX.WinForms/PKHeX.WinForms.csproj index 61ae111a9..b5d081501 100644 --- a/PKHeX.WinForms/PKHeX.WinForms.csproj +++ b/PKHeX.WinForms/PKHeX.WinForms.csproj @@ -342,6 +342,12 @@ SAV_CGearSkin.cs + + Form + + + SAV_Misc5.cs + Form @@ -601,6 +607,9 @@ SAV_CGearSkin.cs + + SAV_Misc5.cs + SAV_Pokedex5.cs diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.Designer.cs new file mode 100644 index 000000000..505cbcb87 --- /dev/null +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.Designer.cs @@ -0,0 +1,261 @@ +namespace PKHeX.WinForms +{ + partial class SAV_Misc5 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_Misc5)); + this.B_Cancel = new System.Windows.Forms.Button(); + this.B_Save = new System.Windows.Forms.Button(); + this.TC_Misc = new System.Windows.Forms.TabControl(); + this.TAB_Main = new System.Windows.Forms.TabPage(); + this.CHK_LibertyPass = new System.Windows.Forms.CheckBox(); + this.GB_Roamer = new System.Windows.Forms.GroupBox(); + this.L_Roamer642 = new System.Windows.Forms.Label(); + this.L_Roamer641 = new System.Windows.Forms.Label(); + this.CB_Roamer642 = new System.Windows.Forms.ComboBox(); + this.CB_Roamer641 = new System.Windows.Forms.ComboBox(); + this.GB_FlyDest = new System.Windows.Forms.GroupBox(); + this.CLB_FlyDest = new System.Windows.Forms.CheckedListBox(); + this.B_AllFlyDest = new System.Windows.Forms.Button(); + this.GB_KeySystem = new System.Windows.Forms.GroupBox(); + this.CLB_KeySystem = new System.Windows.Forms.CheckedListBox(); + this.B_AllKeys = new System.Windows.Forms.Button(); + this.TC_Misc.SuspendLayout(); + this.TAB_Main.SuspendLayout(); + this.GB_Roamer.SuspendLayout(); + this.GB_FlyDest.SuspendLayout(); + this.GB_KeySystem.SuspendLayout(); + this.SuspendLayout(); + // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(52, 316); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.TabIndex = 0; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // + // B_Save + // + this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Save.Location = new System.Drawing.Point(133, 316); + this.B_Save.Name = "B_Save"; + this.B_Save.Size = new System.Drawing.Size(75, 23); + this.B_Save.TabIndex = 1; + this.B_Save.Text = "Save"; + this.B_Save.UseVisualStyleBackColor = true; + this.B_Save.Click += new System.EventHandler(this.B_Save_Click); + // + // TC_Misc + // + this.TC_Misc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TC_Misc.Controls.Add(this.TAB_Main); + this.TC_Misc.Location = new System.Drawing.Point(12, 12); + this.TC_Misc.Name = "TC_Misc"; + this.TC_Misc.SelectedIndex = 0; + this.TC_Misc.Size = new System.Drawing.Size(196, 298); + this.TC_Misc.TabIndex = 2; + // + // TAB_Main + // + this.TAB_Main.Controls.Add(this.GB_KeySystem); + this.TAB_Main.Controls.Add(this.CHK_LibertyPass); + this.TAB_Main.Controls.Add(this.GB_Roamer); + this.TAB_Main.Controls.Add(this.GB_FlyDest); + this.TAB_Main.Location = new System.Drawing.Point(4, 22); + this.TAB_Main.Name = "TAB_Main"; + this.TAB_Main.Padding = new System.Windows.Forms.Padding(3); + this.TAB_Main.Size = new System.Drawing.Size(188, 272); + this.TAB_Main.TabIndex = 0; + this.TAB_Main.Text = "Main"; + this.TAB_Main.UseVisualStyleBackColor = true; + // + // CHK_LibertyPass + // + this.CHK_LibertyPass.AutoSize = true; + this.CHK_LibertyPass.Location = new System.Drawing.Point(6, 215); + this.CHK_LibertyPass.Name = "CHK_LibertyPass"; + this.CHK_LibertyPass.Size = new System.Drawing.Size(131, 16); + this.CHK_LibertyPass.TabIndex = 2; + this.CHK_LibertyPass.Text = "Activate LibertyPass"; + this.CHK_LibertyPass.UseVisualStyleBackColor = true; + // + // GB_Roamer + // + this.GB_Roamer.Controls.Add(this.L_Roamer642); + this.GB_Roamer.Controls.Add(this.L_Roamer641); + this.GB_Roamer.Controls.Add(this.CB_Roamer642); + this.GB_Roamer.Controls.Add(this.CB_Roamer641); + this.GB_Roamer.Location = new System.Drawing.Point(6, 139); + this.GB_Roamer.Name = "GB_Roamer"; + this.GB_Roamer.Size = new System.Drawing.Size(176, 70); + this.GB_Roamer.TabIndex = 1; + this.GB_Roamer.TabStop = false; + this.GB_Roamer.Text = "Roamer"; + // + // L_Roamer642 + // + this.L_Roamer642.Location = new System.Drawing.Point(6, 42); + this.L_Roamer642.Name = "L_Roamer642"; + this.L_Roamer642.Size = new System.Drawing.Size(76, 23); + this.L_Roamer642.TabIndex = 3; + this.L_Roamer642.Text = "Thundurus"; + this.L_Roamer642.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_Roamer641 + // + this.L_Roamer641.Location = new System.Drawing.Point(6, 16); + this.L_Roamer641.Name = "L_Roamer641"; + this.L_Roamer641.Size = new System.Drawing.Size(76, 23); + this.L_Roamer641.TabIndex = 2; + this.L_Roamer641.Text = "Tornadus"; + this.L_Roamer641.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_Roamer642 + // + this.CB_Roamer642.FormattingEnabled = true; + this.CB_Roamer642.Location = new System.Drawing.Point(88, 44); + this.CB_Roamer642.Name = "CB_Roamer642"; + this.CB_Roamer642.Size = new System.Drawing.Size(82, 20); + this.CB_Roamer642.TabIndex = 1; + // + // CB_Roamer641 + // + this.CB_Roamer641.FormattingEnabled = true; + this.CB_Roamer641.Location = new System.Drawing.Point(88, 18); + this.CB_Roamer641.Name = "CB_Roamer641"; + this.CB_Roamer641.Size = new System.Drawing.Size(82, 20); + this.CB_Roamer641.TabIndex = 0; + // + // GB_FlyDest + // + this.GB_FlyDest.Controls.Add(this.CLB_FlyDest); + this.GB_FlyDest.Controls.Add(this.B_AllFlyDest); + this.GB_FlyDest.Location = new System.Drawing.Point(6, 6); + this.GB_FlyDest.Name = "GB_FlyDest"; + this.GB_FlyDest.Size = new System.Drawing.Size(140, 127); + this.GB_FlyDest.TabIndex = 0; + this.GB_FlyDest.TabStop = false; + this.GB_FlyDest.Text = "Fly Destination"; + // + // CLB_FlyDest + // + this.CLB_FlyDest.CheckOnClick = true; + this.CLB_FlyDest.FormattingEnabled = true; + this.CLB_FlyDest.Location = new System.Drawing.Point(6, 47); + this.CLB_FlyDest.Name = "CLB_FlyDest"; + this.CLB_FlyDest.Size = new System.Drawing.Size(128, 74); + this.CLB_FlyDest.TabIndex = 1; + // + // B_AllFlyDest + // + this.B_AllFlyDest.Location = new System.Drawing.Point(6, 18); + this.B_AllFlyDest.Name = "B_AllFlyDest"; + this.B_AllFlyDest.Size = new System.Drawing.Size(75, 23); + this.B_AllFlyDest.TabIndex = 0; + this.B_AllFlyDest.Text = "Check All"; + this.B_AllFlyDest.UseVisualStyleBackColor = true; + this.B_AllFlyDest.Click += new System.EventHandler(this.B_AllFlyDest_Click); + // + // GB_KeySystem + // + this.GB_KeySystem.Controls.Add(this.B_AllKeys); + this.GB_KeySystem.Controls.Add(this.CLB_KeySystem); + this.GB_KeySystem.Location = new System.Drawing.Point(6, 139); + this.GB_KeySystem.Name = "GB_KeySystem"; + this.GB_KeySystem.Size = new System.Drawing.Size(140, 127); + this.GB_KeySystem.TabIndex = 3; + this.GB_KeySystem.TabStop = false; + this.GB_KeySystem.Text = "Unlocked Keys"; + // + // CLB_KeySystem + // + this.CLB_KeySystem.CheckOnClick = true; + this.CLB_KeySystem.FormattingEnabled = true; + this.CLB_KeySystem.Location = new System.Drawing.Point(6, 47); + this.CLB_KeySystem.Name = "CLB_KeySystem"; + this.CLB_KeySystem.Size = new System.Drawing.Size(128, 74); + this.CLB_KeySystem.TabIndex = 0; + // + // B_AllKeys + // + this.B_AllKeys.Location = new System.Drawing.Point(6, 18); + this.B_AllKeys.Name = "B_AllKeys"; + this.B_AllKeys.Size = new System.Drawing.Size(75, 23); + this.B_AllKeys.TabIndex = 1; + this.B_AllKeys.Text = "Check All"; + this.B_AllKeys.UseVisualStyleBackColor = true; + this.B_AllKeys.Click += new System.EventHandler(this.B_AllKeys_Click); + // + // SAV_Misc5 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(220, 351); + this.Controls.Add(this.TC_Misc); + this.Controls.Add(this.B_Save); + this.Controls.Add(this.B_Cancel); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "SAV_Misc5"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Misc Editor"; + this.TC_Misc.ResumeLayout(false); + this.TAB_Main.ResumeLayout(false); + this.TAB_Main.PerformLayout(); + this.GB_Roamer.ResumeLayout(false); + this.GB_FlyDest.ResumeLayout(false); + this.GB_KeySystem.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.TabControl TC_Misc; + private System.Windows.Forms.TabPage TAB_Main; + private System.Windows.Forms.CheckBox CHK_LibertyPass; + private System.Windows.Forms.GroupBox GB_Roamer; + private System.Windows.Forms.Label L_Roamer642; + private System.Windows.Forms.Label L_Roamer641; + private System.Windows.Forms.ComboBox CB_Roamer642; + private System.Windows.Forms.ComboBox CB_Roamer641; + private System.Windows.Forms.GroupBox GB_FlyDest; + private System.Windows.Forms.CheckedListBox CLB_FlyDest; + private System.Windows.Forms.Button B_AllFlyDest; + private System.Windows.Forms.GroupBox GB_KeySystem; + private System.Windows.Forms.Button B_AllKeys; + private System.Windows.Forms.CheckedListBox CLB_KeySystem; + } +} \ No newline at end of file diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs new file mode 100644 index 000000000..85c7dd680 --- /dev/null +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs @@ -0,0 +1,212 @@ +using System; +using System.Linq; +using System.Windows.Forms; +using PKHeX.Core; + +namespace PKHeX.WinForms +{ + public partial class SAV_Misc5 : Form + { + private readonly SaveFile Origin; + private readonly SAV5 SAV; + public SAV_Misc5(SaveFile sav) + { + SAV = (SAV5)(Origin = sav).Clone(); + InitializeComponent(); + readMain(); + } + + private void B_Cancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void B_Save_Click(object sender, EventArgs e) + { + saveMain(); + Origin.setData(SAV.Data, 0); + Close(); + } + + private ComboBox[] cbr; + private int ofsFly; + private int[] FlyDestC; + protected int ofsRoamer = 0x21B00; + protected int ofsLibPass = 0x212BC; + protected uint keyLibPass = 0x0132B536; + private uint valLibPass; + private bool bLibPass; + protected int ofsKS = 0x25828; + protected uint[] keyKS = new uint[] { + // 0x34525, 0x11963, // Selected City + // 0x31239, 0x15657, 0x49589, // Selected Difficulty + // 0x94525, 0x81963, 0x38569, // Selected Mystery Door + 0x35691, 0x18256, 0x59389, 0x48292, 0x09892, // Obtained Keys(EasyMode, Challenge, City, Iron, Iceberg) + 0x93389, 0x22843, 0x34771, 0xAB031, 0xB3818, // Unlocked(EasyMode, Challenge, City, Iron, Iceberg) + }; + private uint[] valKS; + private bool[] bKS; + private void readMain() + { + string[] FlyDestA = null; + switch (SAV.Version) + { + case GameVersion.BW: + ofsFly = 0x204B2; + FlyDestA = new[] { + "Nuvema Town", "Accumula Town", "Striaton City", "Nacrene City", + "Castelia City", "Nimbasa City", "Driftveil City", "Mistralton City", + "Icirrus City", "Opelucid City", "Victory Road", "Pokemon League", + "Lacunosa Town", "Undella Town", "Black City/White Forest", "(Unity Tower)", + }; + FlyDestC = new[] { + 0, 1, 2, 3, + 4, 5, 6, 7, + 8, 9, 15, 11, + 10, 13, 12, 14, + }; + break; + case GameVersion.B2W2: + ofsFly = 0x20392; + FlyDestA = new[] { + "Aspertia City", "Floccesy Town", "Virbank City", + "Nuvema Town", "Accumula Town", "Striaton City", "Nacrene City", + "Castelia City", "Nimbasa City", "Driftveil City", "Mistralton City", + "Icirrus City", "Opelucid City", + "Lacunosa Town", "Undella Town", "Black City/White Forest", + "Lentimas Town", "Humilau City", "Victory Road", "Pokemon League", + "Pokestar Studios", "Join Avenue", "PWT", "(Unity Tower)", + }; + FlyDestC = new[] { + 24, 27, 25, + 8, 9, 10, 11, + 12, 13, 14, 15, + 16, 17, + 18, 21, 20, + 28, 26, 66, 19, + 5, 6, 7, 22, + }; + break; + } + uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly); + CLB_FlyDest.Items.Clear(); + CLB_FlyDest.Items.AddRange(FlyDestA); + for (int i = 0; i < CLB_FlyDest.Items.Count; i++) + { + if (FlyDestC[i] < 32) + CLB_FlyDest.SetItemChecked(i, (valFly & (uint)1 << FlyDestC[i]) != 0); + else + CLB_FlyDest.SetItemChecked(i, (SAV.Data[ofsFly + (FlyDestC[i] >> 3)] & 1 << (FlyDestC[i] & 7)) != 0); + } + + if (SAV.BW) + { + GB_KeySystem.Visible = false; + // Roamer + cbr = new ComboBox[] { CB_Roamer642, CB_Roamer641 }; + ComboItem[] states = new[] { + new ComboItem { Text = "Not roamed", Value = 0, }, + new ComboItem { Text = "Roaming", Value = 1, }, + new ComboItem { Text = "Defeated", Value = 2, }, + new ComboItem { Text = "Captured", Value = 3, }, + }; + // CurrentStat:ComboboxSource + // Not roamed: Not roamed/Defeated/Captured + // Roaming: Roaming/Defeated/Captured + // Defeated: Defeated/Captured + // Captured: Defeated/Captured + for (int i = 0, c; i < cbr.Length; i++) + { + c = SAV.Data[ofsRoamer + 0x2E + i]; + cbr[i].Items.Clear(); + cbr[i].DisplayMember = "Text"; + cbr[i].ValueMember = "Value"; + cbr[i].DataSource = new BindingSource(states.Where(v => v.Value >= 2 || v.Value == c).ToList(), null); + cbr[i].SelectedValue = c; + } + + // LibertyPass + valLibPass = keyLibPass ^ (uint)(SAV.SID << 16 | SAV.TID); + bLibPass = BitConverter.ToUInt32(SAV.Data, ofsLibPass) == valLibPass; + CHK_LibertyPass.Checked = bLibPass; + } + else if (SAV.B2W2) + { + GB_Roamer.Visible = CHK_LibertyPass.Visible = false; + // KeySystem + string[] KeySystemA = new[] { + "Obtain EasyKey", "Obtain ChallengeKey", "Obtain CityKey", "Obtain IronKey", "Obtain IcebergKey", + "Unlock EasyMode", "Unlock ChallengeMode", "Unlock City", "Unlock IronChamber", "Unlock IcebergChamber", + }; + uint KSID = BitConverter.ToUInt32(SAV.Data, ofsKS + 0x34); + valKS = new uint[keyKS.Length]; + bKS = new bool[keyKS.Length]; + CLB_KeySystem.Items.Clear(); + for (int i = 0; i < valKS.Length; i++) + { + valKS[i] = keyKS[i] ^ KSID; + bKS[i] = BitConverter.ToUInt32(SAV.Data, ofsKS + (i << 2)) == valKS[i]; + CLB_KeySystem.Items.Add(KeySystemA[i], bKS[i]); + } + } + else GB_KeySystem.Visible = GB_Roamer.Visible = CHK_LibertyPass.Visible = false; + } + private void saveMain() + { + uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly); + for (int i = 0; i < CLB_FlyDest.Items.Count; i++) + { + if (FlyDestC[i] < 32) + { + if (CLB_FlyDest.GetItemChecked(i)) + valFly |= (uint)1 << FlyDestC[i]; + else + valFly &= ~((uint)1 << FlyDestC[i]); + } + else SAV.Data[ofsFly + (FlyDestC[i] >> 3)] = (byte)(SAV.Data[ofsFly + (FlyDestC[i] >> 3)] & ~(1 << (FlyDestC[i] & 7)) | ((CLB_FlyDest.GetItemChecked(i) ? 1 : 0) << (FlyDestC[i] & 7))); + } + BitConverter.GetBytes(valFly).CopyTo(SAV.Data, ofsFly); + + if (SAV.BW) + { + // Roamer + for (int i = 0, c, d; i < cbr.Length; i++) + { + c = SAV.Data[ofsRoamer + 0x2E + i]; + d = (int)cbr[i].SelectedValue; + if (c != d) + { + SAV.Data[ofsRoamer + 0x2E + i] = (byte)d; + if (c == 1) + { + new byte[14].CopyTo(SAV.Data, ofsRoamer + 4 + i * 0x14); + SAV.Data[ofsRoamer + 0x2C + i] = 0; + } + } + } + + // LibertyPass + if (CHK_LibertyPass.Checked ^ bLibPass) + BitConverter.GetBytes(bLibPass ? (uint)0 : valLibPass).CopyTo(SAV.Data, ofsLibPass); + } + else if (SAV.B2W2) + { + // KeySystem + for (int i = 0; i < CLB_KeySystem.Items.Count; i++) + if (CLB_KeySystem.GetItemChecked(i) ^ bKS[i]) + BitConverter.GetBytes(bKS[i] ? (uint)0 : valKS[i]).CopyTo(SAV.Data, ofsKS + (i << 2)); + } + } + private void B_AllFlyDest_Click(object sender, EventArgs e) + { + for (int i = 0; i < CLB_FlyDest.Items.Count; i++) + CLB_FlyDest.SetItemChecked(i, true); + } + + private void B_AllKeys_Click(object sender, EventArgs e) + { + for (int i = 0; i < CLB_KeySystem.Items.Count; i++) + CLB_KeySystem.SetItemChecked(i, true); + } + } +} diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.resx b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.resx new file mode 100644 index 000000000..603f660be --- /dev/null +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAE + AAAAAAAAAAAAAAAAAAAAAAAAIyMjAQAAAAALCwsPJiYmJysrKycqKionKSkpJykpKScpKSknKioqJyoq + KicrKysnJycnJw0ODQ8AAAAAJiYmAQAAAABpaWlHq6ur17+/v+6+vr7svr6+7b6+vu2+vr7tvr6+7b6+ + vu2+vr7tvr6+7L+/v+6rq6vXampqSAAAAAAoKSgXvr++3eLi4v/g4OD94eHh/+Hh4f/i4uL/4uLi/+Li + 4v/i4uL/4eHh/+Dh4P/g4OD94uLi/7+/v90sLCwXfn5+PNna2frg4OD/39/f/uHh4f7h4eH+39/f/uDg + 4P7g4OD+39/f/uHh4f7h4OH+39/f/t/g3//a2tr6g4ODPoOCgz7X19f64+Pj/+Li4v7k5OT/4+Tj//Ly + 8v/19fX/9PT0//T09P/k5OT/5OTk/+Pj4/7j4+P/19jX+4qLikCDhIM+2tra++Xl5f/k5eT+5OTk//Lz + 8v+urq7/RUVF/z4+Pv+Zmpn/8fHx/+Xm5f/k5eT+5eXl/9ra2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AAAAAAAAAAAAAAHBx7Ay0tdkg3N5emMTGpxSwsp8gsLKfILCynyCwsp8gsLKfILCynyCws + p8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyDExqcU2NpenLi54Shsb + ewMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAAD4AAAB/gAAB////// + + + \ No newline at end of file diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_EventFlags.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_EventFlags.cs index b498393eb..4084967f5 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_EventFlags.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_EventFlags.cs @@ -114,6 +114,9 @@ private string[] getStringList(string type) case GameVersion.HGSS: gamePrefix = "hgss"; break; + case GameVersion.BW: + gamePrefix = "bw"; + break; default: return null; }