diff --git a/Classes/Save.cs b/Classes/Save.cs index 20ca3de..a6249ba 100644 --- a/Classes/Save.cs +++ b/Classes/Save.cs @@ -347,7 +347,7 @@ public static SaveType GetSaveType(byte[] Save_Data) else if (Save_Data.Length == 0x72040 || Save_Data.Length == 0x72150) { string Game_ID = Encoding.ASCII.GetString(Save_Data, Save_Data.Length == 0x72150 ? 0x110 : 0, 4); - if (Game_ID == "GAFE") + if (Game_ID == "GAFE" || Game_ID == "GAFP") // GAFP is PAL. return SaveType.Animal_Crossing; else if (Game_ID == "GAFJ") return SaveType.Doubutsu_no_Mori_Plus; diff --git a/Classes/Utility.cs b/Classes/Utility.cs index 0c173ff..012995d 100644 --- a/Classes/Utility.cs +++ b/Classes/Utility.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; +using System.IO; using System.Linq; using System.Text; @@ -13,12 +14,14 @@ public static void Scan_For_NL_Int32() { if (NewMainForm.Save_File != null && (NewMainForm.Save_File.Save_Type == SaveType.New_Leaf || NewMainForm.Save_File.Save_Type == SaveType.Welcome_Amiibo)) { - for (int i = 0; i < NewMainForm.Save_File.Working_Save_Data.Length; i += 4) - { - NL_Int32 Possible_NL_Int32 = new NL_Int32(NewMainForm.Save_File.ReadUInt32(i), NewMainForm.Save_File.ReadUInt32(i + 4)); - if (Possible_NL_Int32.Valid) - System.Windows.Forms.MessageBox.Show(string.Format("Found Valid NL_Int32 at offset 0x{0} | Value: {1}", i.ToString("X"), Possible_NL_Int32.Value)); - } + using (StreamWriter Int32_Stream = File.CreateText(NewMainForm.Assembly_Location + "\\" + + (NewMainForm.Save_File.Save_Type == SaveType.Welcome_Amiibo ? "WA_" : "") + "NL_Int32_Database.txt")) + for (int i = 0; i < NewMainForm.Save_File.Working_Save_Data.Length - 4; i += 4) + { + NL_Int32 Possible_NL_Int32 = new NL_Int32(NewMainForm.Save_File.ReadUInt32(i), NewMainForm.Save_File.ReadUInt32(i + 4)); + if (Possible_NL_Int32.Valid) + Int32_Stream.WriteLine(string.Format("Found Valid NL_Int32 at offset 0x{0} | Value: {1}", i.ToString("X"), Possible_NL_Int32.Value)); + } } } diff --git a/Forms/NewMainForm.cs b/Forms/NewMainForm.cs index 502f9cd..ba458a5 100644 --- a/Forms/NewMainForm.cs +++ b/Forms/NewMainForm.cs @@ -439,16 +439,18 @@ public void SetupEditor(Save save) Acres[i] = new Normal_Acre(Acre_Data[i], i); } } + townNameBox.Text = new ACString(save.ReadByteArray(save.Save_Data_Start_Offset + Current_Save_Info.Save_Offsets.Town_Name, Save_File.Save_Type == SaveType.City_Folk ? 16 : ((Save_File.Save_Type == SaveType.New_Leaf || Save_File.Save_Type == SaveType.Welcome_Amiibo) ? 0x12 : 8)), save.Save_Type).Trim(); SetupAcreEditorTreeView(); SetupMapPictureBoxes(); + if (Buildings != null) SetupBuildingList(); - //Fix_Buried_Empty_Spots(); //Temp - //Temp - //Utility.Scan_For_NL_Int32(); + + if (Properties.Settings.Default.OutputInt32s) + Utility.Scan_For_NL_Int32(); } public void SetPlayersEnabled() diff --git a/Forms/SettingsMenuForm.Designer.cs b/Forms/SettingsMenuForm.Designer.cs index 1a6416a..ae2f90b 100644 --- a/Forms/SettingsMenuForm.Designer.cs +++ b/Forms/SettingsMenuForm.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.label2 = new System.Windows.Forms.Label(); this.debugLevelComboBox = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); + this.scanForInt32Checkbox = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // imageSizeModeComboBox @@ -94,12 +95,26 @@ private void InitializeComponent() this.label3.TabIndex = 5; this.label3.Text = "Debug Message Level:"; // + // scanForInt32Checkbox + // + this.scanForInt32Checkbox.AutoSize = true; + this.scanForInt32Checkbox.Cursor = System.Windows.Forms.Cursors.Default; + this.scanForInt32Checkbox.Location = new System.Drawing.Point(5, 60); + this.scanForInt32Checkbox.Name = "scanForInt32Checkbox"; + this.scanForInt32Checkbox.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.scanForInt32Checkbox.Size = new System.Drawing.Size(190, 17); + this.scanForInt32Checkbox.TabIndex = 7; + this.scanForInt32Checkbox.Text = ":Scan and Output NL Int32 Offsets"; + this.scanForInt32Checkbox.UseVisualStyleBackColor = true; + this.scanForInt32Checkbox.CheckedChanged += new System.EventHandler(this.scanForInt32Checkbox_CheckedChanged); + // // SettingsMenuForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(404, 167); this.ControlBox = false; + this.Controls.Add(this.scanForInt32Checkbox); this.Controls.Add(this.label3); this.Controls.Add(this.debugLevelComboBox); this.Controls.Add(this.label2); @@ -121,5 +136,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox debugLevelComboBox; private System.Windows.Forms.Label label3; + private System.Windows.Forms.CheckBox scanForInt32Checkbox; } } \ No newline at end of file diff --git a/Forms/SettingsMenuForm.cs b/Forms/SettingsMenuForm.cs index b53d4bf..a3e75ac 100644 --- a/Forms/SettingsMenuForm.cs +++ b/Forms/SettingsMenuForm.cs @@ -22,6 +22,7 @@ public SettingsMenuForm() imageSizeModeComboBox.SelectedIndexChanged += new EventHandler((object o, EventArgs e) => ImageResizeMode_Changed()); debugLevelComboBox.SelectedIndex = (int)Properties.Settings.Default.DebugLevel; debugLevelComboBox.SelectedIndexChanged += new EventHandler((object o, EventArgs e) => DebugLevel_Changed()); + scanForInt32Checkbox.Checked = Properties.Settings.Default.OutputInt32s; } private void ImageResizeMode_Changed() @@ -35,6 +36,11 @@ private void DebugLevel_Changed() Properties.Settings.Default.DebugLevel = (DebugLevel)Math.Max(0, debugLevelComboBox.SelectedIndex); } + private void scanForInt32Checkbox_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.OutputInt32s = scanForInt32Checkbox.Checked; + } + private void doneButton_Click(object sender, EventArgs e) { Properties.Settings.Default.Save(); diff --git a/Properties/Settings.settings b/Properties/Settings.settings index b50c31f..35a12bc 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -11,5 +11,8 @@ Info + + False + \ No newline at end of file diff --git a/Properties/Settings1.Designer.cs b/Properties/Settings1.Designer.cs index 38ea484..f039ca2 100644 --- a/Properties/Settings1.Designer.cs +++ b/Properties/Settings1.Designer.cs @@ -12,7 +12,7 @@ namespace ACSE.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -58,5 +58,17 @@ public int ImageResizeMode { this["DebugLevel"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool OutputInt32s { + get { + return ((bool)(this["OutputInt32s"])); + } + set { + this["OutputInt32s"] = value; + } + } } }