diff --git a/LibW4M/Data/Highscores/HighscoreCollective.cs b/LibW4M/Data/Highscores/HighscoreCollective.cs index 4403585..27116fc 100644 --- a/LibW4M/Data/Highscores/HighscoreCollective.cs +++ b/LibW4M/Data/Highscores/HighscoreCollective.cs @@ -15,7 +15,8 @@ namespace LibW4M.Data.Highscores public override void Create() { - throw new NotImplementedException(); + HighscoreData highscore = new HighscoreData(this.fileBelongs, this.fileBelongs.CreateContainer("HighScoreData"), false); + this.collectiveEntries.Add(highscore); } public override void Load() diff --git a/LibW4M/Data/Highscores/HighscoreData.cs b/LibW4M/Data/Highscores/HighscoreData.cs index 116ffd4..b511e53 100644 --- a/LibW4M/Data/Highscores/HighscoreData.cs +++ b/LibW4M/Data/Highscores/HighscoreData.cs @@ -23,10 +23,14 @@ namespace LibW4M.Data.Highscores public XomString WinnerName; public int WinnerTime; - public HighscoreData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public HighscoreData(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } - + internal override void loadDefaults() + { + this.WinnerName = fileBelongs.LookupString("Untitled Highscore"); + this.WinnerTime = 0; + } public override void Load() { using (XomStreamReader reader = new XomStreamReader(new MemoryStream(mainContainer.GetData()))) diff --git a/LibW4M/Data/InputMapping/InputEventMappingData.cs b/LibW4M/Data/InputMapping/InputEventMappingData.cs index 6335c38..f7654cc 100644 --- a/LibW4M/Data/InputMapping/InputEventMappingData.cs +++ b/LibW4M/Data/InputMapping/InputEventMappingData.cs @@ -29,7 +29,16 @@ namespace LibW4M.Data.InputMapping } } - public InputEventMappingData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + internal override void loadDefaults() + { + this.Message = fileBelongs.LookupString("Untitled Mapping"); + this.FEResourceID = fileBelongs.LookupString(""); + this.AllowedDuplacates = new byte[0x0]; + this.InputMappings = new InputMappingData[0x0]; + this.Group = 0; + } + + public InputEventMappingData(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } public override void DeleteEntries() diff --git a/LibW4M/Data/InputMapping/InputMappingCollective.cs b/LibW4M/Data/InputMapping/InputMappingCollective.cs index 443ea81..9bfc0c6 100644 --- a/LibW4M/Data/InputMapping/InputMappingCollective.cs +++ b/LibW4M/Data/InputMapping/InputMappingCollective.cs @@ -17,7 +17,8 @@ namespace LibW4M.Data.InputMapping public override void Create() { - throw new NotImplementedException(); + InputEventMappingData eventMapping = new InputEventMappingData(this.fileBelongs, this.fileBelongs.CreateContainer("InputEventMappingContainer"), false); + this.collectiveEntries.Add(eventMapping); } public override void Load() diff --git a/LibW4M/Data/InputMapping/InputMappingData.cs b/LibW4M/Data/InputMapping/InputMappingData.cs index 65fb10f..76af223 100644 --- a/LibW4M/Data/InputMapping/InputMappingData.cs +++ b/LibW4M/Data/InputMapping/InputMappingData.cs @@ -10,7 +10,7 @@ namespace LibW4M.Data.InputMapping { public class InputMappingData : SaveDataEntry { - public InputMappingData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public InputMappingData(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } @@ -39,6 +39,13 @@ namespace LibW4M.Data.InputMapping } } + internal override void loadDefaults() + { + this.Type = 0; + this.Key = 0; + this.JoystickAxis = 0; + } + public override void Save() { using (MemoryStream ms = new MemoryStream()) diff --git a/LibW4M/Data/Stats/StatsCollective.cs b/LibW4M/Data/Stats/StatsCollective.cs index 8a8db83..ea9eb33 100644 --- a/LibW4M/Data/Stats/StatsCollective.cs +++ b/LibW4M/Data/Stats/StatsCollective.cs @@ -18,7 +18,8 @@ namespace LibW4M.Data.Stats public override void Create() { - throw new NotImplementedException(); + StatsContainerData stat = new StatsContainerData(this.fileBelongs, this.fileBelongs.CreateContainer("StatsContainer"), false); + this.collectiveEntries.Add(stat); } public override void Load() diff --git a/LibW4M/Data/Stats/StatsContainerData.cs b/LibW4M/Data/Stats/StatsContainerData.cs index 9b63525..a7f7275 100644 --- a/LibW4M/Data/Stats/StatsContainerData.cs +++ b/LibW4M/Data/Stats/StatsContainerData.cs @@ -12,7 +12,7 @@ namespace LibW4M.Data.Stats { public int[] Values; internal XomString? teamName; - public StatsContainerData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public StatsContainerData(W4SaveFile fileBelongs, XomContainer mainContainer, bool load=true) : base(fileBelongs, mainContainer, load) { } @@ -64,6 +64,10 @@ namespace LibW4M.Data.Stats Values = reader.ReadInt32Array(); } } + internal override void loadDefaults() + { + this.Values = new int[24]; + } public override void Save() { diff --git a/LibW4M/Data/Stats/TeamStatsCollective.cs b/LibW4M/Data/Stats/TeamStatsCollective.cs index 45f8ba9..eddc8b5 100644 --- a/LibW4M/Data/Stats/TeamStatsCollective.cs +++ b/LibW4M/Data/Stats/TeamStatsCollective.cs @@ -108,7 +108,13 @@ namespace LibW4M.Data.Stats public override void Create() { - throw new NotImplementedException(); + // create stat container data + StatsContainerData stat = new StatsContainerData(this.fileBelongs, this.fileBelongs.CreateContainer("StatsContainer"), false); + // set team name + stat.teamName = this.fileBelongs.LookupString("Untitled Statistics"); + this.TeamNames.Add(stat.teamName); + // add to collective + this.collectiveEntries.Add(stat); } } } diff --git a/LibW4M/Data/X/DataBank.cs b/LibW4M/Data/X/DataBank.cs index a519ba2..56b394c 100644 --- a/LibW4M/Data/X/DataBank.cs +++ b/LibW4M/Data/X/DataBank.cs @@ -67,6 +67,29 @@ namespace LibW4M.Data.X } } + public void CreateInt() + { + intResourceDetails.Add(new IntResourceDetail(this.fileBelongs, this.fileBelongs.CreateContainer("XIntResourceDetails"), false)); + } + + public void CreateUInt() + { + uintResourceDetails.Add(new UIntResourceDetail(this.fileBelongs, this.fileBelongs.CreateContainer("XUintResourceDetails"), false)); + } + + public void CreateString() + { + stringResourceDetails.Add(new StringResourceDetail(this.fileBelongs, this.fileBelongs.CreateContainer("XStringResourceDetails"), false)); + } + + public void CreateFloat() + { + floatResourceDetails.Add(new FloatResourceDetail(this.fileBelongs, this.fileBelongs.CreateContainer("XFloatResourceDetails"), false)); + } + public void CreateVector() + { + vectorResourceDetails.Add(new VectorResourceDetail(this.fileBelongs, this.fileBelongs.CreateContainer("XVectorResourceDetails"), false)); + } public void Delete(IntResourceDetail detail) { diff --git a/LibW4M/Data/X/FloatResourceDetail.cs b/LibW4M/Data/X/FloatResourceDetail.cs index 76cee7f..d1a11cb 100644 --- a/LibW4M/Data/X/FloatResourceDetail.cs +++ b/LibW4M/Data/X/FloatResourceDetail.cs @@ -11,7 +11,7 @@ namespace LibW4M.Data.X public class FloatResourceDetail : ResourceDetail { - public FloatResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public FloatResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } diff --git a/LibW4M/Data/X/IntResourceDetail.cs b/LibW4M/Data/X/IntResourceDetail.cs index 27cb074..8ba48f6 100644 --- a/LibW4M/Data/X/IntResourceDetail.cs +++ b/LibW4M/Data/X/IntResourceDetail.cs @@ -10,7 +10,7 @@ namespace LibW4M.Data.X { public class IntResourceDetail : ResourceDetail { - public IntResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public IntResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load=true) : base(fileBelongs, mainContainer, load) { } @@ -25,6 +25,7 @@ namespace LibW4M.Data.X } } + public override void Save() { using (MemoryStream ms = new MemoryStream()) diff --git a/LibW4M/Data/X/ResourceDetail.cs b/LibW4M/Data/X/ResourceDetail.cs index c0a5d59..33c39f6 100644 --- a/LibW4M/Data/X/ResourceDetail.cs +++ b/LibW4M/Data/X/ResourceDetail.cs @@ -20,9 +20,17 @@ namespace LibW4M.Data.X } } - public ResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public ResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load=true) : base(fileBelongs, mainContainer, load) { } + + + internal override void loadDefaults() + { + this.Name = this.fileBelongs.LookupString("Untitled Variable"); + this.Flags = 96; + } + public abstract override void Load(); public abstract override void Save(); diff --git a/LibW4M/Data/X/StringResourceDetail.cs b/LibW4M/Data/X/StringResourceDetail.cs index 36618b6..7af8f2d 100644 --- a/LibW4M/Data/X/StringResourceDetail.cs +++ b/LibW4M/Data/X/StringResourceDetail.cs @@ -11,7 +11,7 @@ namespace LibW4M.Data.X public class StringResourceDetail : ResourceDetail { - public StringResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public StringResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } @@ -26,6 +26,11 @@ namespace LibW4M.Data.X } } + internal override void loadDefaults() + { + base.loadDefaults(); + this.Value = this.fileBelongs.LookupString(""); + } public override void Save() { using (MemoryStream ms = new MemoryStream()) diff --git a/LibW4M/Data/X/UIntResourceDetail.cs b/LibW4M/Data/X/UIntResourceDetail.cs index f290df0..e91082c 100644 --- a/LibW4M/Data/X/UIntResourceDetail.cs +++ b/LibW4M/Data/X/UIntResourceDetail.cs @@ -11,7 +11,7 @@ namespace LibW4M.Data.X public class UIntResourceDetail : ResourceDetail { - public UIntResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public UIntResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } diff --git a/LibW4M/Data/X/VectorResourceDetail.cs b/LibW4M/Data/X/VectorResourceDetail.cs index f5cccf7..3673bce 100644 --- a/LibW4M/Data/X/VectorResourceDetail.cs +++ b/LibW4M/Data/X/VectorResourceDetail.cs @@ -10,7 +10,7 @@ namespace LibW4M.Data.X { public class VectorResourceDetail : ResourceDetail { - public VectorResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public VectorResourceDetail(W4SaveFile fileBelongs, XomContainer mainContainer, bool load = true) : base(fileBelongs, mainContainer, load) { } @@ -25,6 +25,11 @@ namespace LibW4M.Data.X } } + internal override void loadDefaults() + { + base.loadDefaults(); + this.Value = new XomVector(0.0f, 0.0f, 0.0f); + } public override void Save() { using (MemoryStream ms = new MemoryStream()) diff --git a/LibW4M/W4SaveFile.cs b/LibW4M/W4SaveFile.cs index fbb07b2..768d995 100644 --- a/LibW4M/W4SaveFile.cs +++ b/LibW4M/W4SaveFile.cs @@ -262,6 +262,8 @@ namespace LibW4M return new byte[0x10] { 0x72, 0x58, 0xDC, 0x7C, 0xA3, 0x2C, 0xCC, 0x4F, 0xAE, 0x66, 0x43, 0x10, 0x71, 0xE5, 0xCE, 0x67 }; case "XFloatResourceDetails": return new byte[0x10] { 0x5F, 0x9D, 0x88, 0x08, 0x39, 0x80, 0xEA, 0x4C, 0xBA, 0x5B, 0x9C, 0x05, 0x9A, 0xC0, 0x57, 0x0E }; + case "XVectorResourceDetails": + return new byte[0x10] { 0x63, 0x45, 0x1F, 0x07, 0xB3, 0x8C, 0x96, 0x49, 0xB7, 0x9F, 0xB0, 0xF5, 0xCA, 0xEC, 0x9D, 0x99 }; case "XContainerResourceDetails": return new byte[0x10] { 0x20, 0xBF, 0xB6, 0xE0, 0x0B, 0xF8, 0x29, 0x43, 0xB6, 0xEB, 0x19, 0x98, 0xED, 0x8A, 0xEC, 0x1F }; case "XDataBank": @@ -273,7 +275,7 @@ namespace LibW4M } } - private int findInStringArray(string str, string[] arr) + private static int findInStringArray(string str, string[] arr) { for(int i = 0; i < arr.Length; i++) { @@ -306,6 +308,7 @@ namespace LibW4M "XUintResourceDetails", "XStringResourceDetails", "XFloatResourceDetails", + "XVectorResourceDetails", "XContainerResourceDetails", "XDataBank", "XContainer" diff --git a/LibXom/Streams/XomStreamWriter.cs b/LibXom/Streams/XomStreamWriter.cs index abc7a8a..9ed7908 100644 --- a/LibXom/Streams/XomStreamWriter.cs +++ b/LibXom/Streams/XomStreamWriter.cs @@ -139,7 +139,7 @@ namespace LibXom.Streams int padLen = len - str.Length; if (padLen > 0) - Skip(padLen); + WritePadding(0x00, padLen); } public void WriteStr(string str) diff --git a/W4Gui/Components/CollectiveListAddDelete.cs b/W4Gui/Components/CollectiveListAddDelete.cs index 43e40a7..9b6a6ff 100644 --- a/W4Gui/Components/CollectiveListAddDelete.cs +++ b/W4Gui/Components/CollectiveListAddDelete.cs @@ -45,6 +45,9 @@ namespace W4Gui.Components if (handler != null) { handler(this, e); + + if (this.List.Items.Count <= 0) + this.btnDel.Enabled = false; } } diff --git a/W4Gui/Components/CollectiveListBox.cs b/W4Gui/Components/CollectiveListBox.cs index fe27763..a05235c 100644 --- a/W4Gui/Components/CollectiveListBox.cs +++ b/W4Gui/Components/CollectiveListBox.cs @@ -15,6 +15,7 @@ namespace W4Gui.Components { this.SelectedIndexChanged += selectedIndexChanged; } + private bool blockEventTriggers = false; private int totalUntitled = 0; private int lastSelected = -1; public int LastSelected @@ -42,19 +43,24 @@ namespace W4Gui.Components private void unselectWithoutSaveTrigger() { + toggleEvents(); this.lastSelected = -1; this.SelectedIndex = -1; + toggleEvents(); } public event EventHandler Unselected; public event EventHandler Selected; - + private void toggleEvents() + { + this.blockEventTriggers = !this.blockEventTriggers; + } protected virtual void OnUnselected(EventArgs e) { EventHandler handler = Unselected; - if (handler != null) + if (handler != null && !blockEventTriggers) { handler(this, e); } @@ -62,7 +68,7 @@ namespace W4Gui.Components protected virtual void OnSelected(EventArgs e) { EventHandler handler = Selected; - if (handler != null) + if (handler != null && !blockEventTriggers) { handler(this, e); } @@ -86,11 +92,15 @@ namespace W4Gui.Components public void Delete(int idx) { + toggleEvents(); + int selIndx = this.SelectedIndex; unselectWithoutSaveTrigger(); this.Items.RemoveAt(idx); + toggleEvents(); + if (selIndx == idx) { if((selIndx - 1) < 0 && this.Items.Count > 0) @@ -122,12 +132,20 @@ namespace W4Gui.Components public void UpdateName(int idx, string name) { + if (idx >= this.Items.Count) return; + if (idx < 0) return; + if(name != "") + { + toggleEvents(); this.Items[idx] = name; + toggleEvents(); + } } public void LoadArray(SaveDataEntry[] arr) { + toggleEvents(); unselectWithoutSaveTrigger(); this.Items.Clear(); for (int i = 0; i < arr.Length; i++) @@ -135,10 +153,12 @@ namespace W4Gui.Components string name = arr[i].FriendlyName; this.Items.Add(processName(name)); } + toggleEvents(); } public void LoadCollective(SaveDataCollective collective) { + toggleEvents(); unselectWithoutSaveTrigger(); this.Items.Clear(); for (int i = 0; i < collective.Length; i++) @@ -146,6 +166,7 @@ namespace W4Gui.Components string name = collective[i].FriendlyName; this.Items.Add(processName(name)); } + toggleEvents(); } } diff --git a/W4Gui/Components/InputEventMappingPanel.Designer.cs b/W4Gui/Components/InputEventMappingPanel.Designer.cs index 1d29c61..d9b5e7e 100644 --- a/W4Gui/Components/InputEventMappingPanel.Designer.cs +++ b/W4Gui/Components/InputEventMappingPanel.Designer.cs @@ -198,13 +198,13 @@ this.selInputMappings.Size = new System.Drawing.Size(689, 381); this.selInputMappings.TabIndex = 0; // - // InputSettingsPanel + // InputEventMappingPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.LightGray; this.Controls.Add(this.inputSettingTabControl); - this.Name = "InputSettingsPanel"; + this.Name = "InputEventMappingPanel"; this.Size = new System.Drawing.Size(707, 419); this.inputSettingTabControl.ResumeLayout(false); this.generalTab.ResumeLayout(false); diff --git a/W4Gui/Tabs/HighscoresTab.cs b/W4Gui/Tabs/HighscoresTab.cs index e003600..84b371f 100644 --- a/W4Gui/Tabs/HighscoresTab.cs +++ b/W4Gui/Tabs/HighscoresTab.cs @@ -50,7 +50,9 @@ namespace W4Gui.Tabs private void highscoresList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new highscores from here not implemented yet ;)"); + DataManager.SaveFile.HighscoreCollective.Create(); + highscoresList.List.Add(DataManager.SaveFile.HighscoreCollective.Last().FriendlyName); + highscoresList.List.SelectedIndex = (highscoresList.List.Items.Count - 1); } private void highscoresList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/InputEventMappingsTab.cs b/W4Gui/Tabs/InputEventMappingsTab.cs index 4924718..b939f41 100644 --- a/W4Gui/Tabs/InputEventMappingsTab.cs +++ b/W4Gui/Tabs/InputEventMappingsTab.cs @@ -50,7 +50,9 @@ namespace W4Gui.Tabs private void inputEventMappingList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new inputEventMapping from here not implemented yet ;)"); + DataManager.SaveFile.InputMappingCollective.Create(); + inputEventMappingList.List.Add(DataManager.SaveFile.InputMappingCollective.Last().FriendlyName); + inputEventMappingList.List.SelectedIndex = (inputEventMappingList.List.Items.Count - 1); } private void inputEventMappingList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/OtherTabs/InputMappingsTab.cs b/W4Gui/Tabs/OtherTabs/InputMappingsTab.cs index 757c164..a56a173 100644 --- a/W4Gui/Tabs/OtherTabs/InputMappingsTab.cs +++ b/W4Gui/Tabs/OtherTabs/InputMappingsTab.cs @@ -42,6 +42,8 @@ namespace W4Gui.Tabs.OtherTabs public void LoadData(ref InputMappingData[] data) { this.inputMappingsList.List.LoadArray(data); + this.mappingData.Clear(); + inputMappingsPanel.Enabled = false; mappingData.AddRange(data); } @@ -62,16 +64,21 @@ namespace W4Gui.Tabs.OtherTabs private void inputMappingsList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new inputMappings from here not implemented yet ;)"); + InputMappingData mapping = new InputMappingData(DataManager.SaveFile, DataManager.SaveFile.CreateContainer("InputDetailsContainer"), false); + this.mappingData.Add(mapping); + this.inputMappingsList.List.Add(mapping.FriendlyName); } private void inputMappingsList_DelButton(object sender, EventArgs e) { int sel = inputMappingsList.List.CurrentlySelected; - InputMappingData inputMappingsData = mappingData[inputMappingsList.List.CurrentlySelected] as InputMappingData; - inputMappingsData.DeleteEntries(); - mappingData.RemoveAt(inputMappingsList.List.CurrentlySelected); + InputMappingData inputMappingsData = mappingData[sel] as InputMappingData; + + mappingData.RemoveAt(sel); inputMappingsList.List.Delete(sel); + + inputMappingsData.DeleteEntries(); + } } diff --git a/W4Gui/Tabs/StatsTab/StatisticsTab.cs b/W4Gui/Tabs/StatsTab/StatisticsTab.cs index 91256ec..637e53b 100644 --- a/W4Gui/Tabs/StatsTab/StatisticsTab.cs +++ b/W4Gui/Tabs/StatsTab/StatisticsTab.cs @@ -50,7 +50,9 @@ namespace W4Gui.Tabs.StatsTab private void statisticsList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new statistics from here not implemented yet ;)"); + DataManager.SaveFile.StatsCollective.Create(); + statisticsList.List.Add(DataManager.SaveFile.StatsCollective.Last().FriendlyName); + statisticsList.List.SelectedIndex = (statisticsList.List.Items.Count - 1); } private void statisticsList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/StatsTab/TeamStatisticsTab.cs b/W4Gui/Tabs/StatsTab/TeamStatisticsTab.cs index ee85a07..2133f26 100644 --- a/W4Gui/Tabs/StatsTab/TeamStatisticsTab.cs +++ b/W4Gui/Tabs/StatsTab/TeamStatisticsTab.cs @@ -50,7 +50,9 @@ namespace W4Gui.Tabs.StatsTab private void teamStatisticsList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new team statistics from here not implemented yet ;)"); + DataManager.SaveFile.TeamStatsCollective.Create(); + teamStatisticsList.List.Add(DataManager.SaveFile.TeamStatsCollective.Last().FriendlyName); + teamStatisticsList.List.SelectedIndex = (teamStatisticsList.List.Items.Count - 1); } private void teamStatisticsList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/VariablesTab/FloatVariablesTab.cs b/W4Gui/Tabs/VariablesTab/FloatVariablesTab.cs index 148a1f8..0d80b5f 100644 --- a/W4Gui/Tabs/VariablesTab/FloatVariablesTab.cs +++ b/W4Gui/Tabs/VariablesTab/FloatVariablesTab.cs @@ -53,7 +53,9 @@ namespace W4Gui.Tabs.VariablesTab private void variablesList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new variables from here not implemented yet ;)"); + DataManager.SaveFile.XDataBank.CreateFloat(); + variablesList.List.Add(DataManager.SaveFile.XDataBank.FloatResourceDetails.Last().FriendlyName); + variablesList.List.SelectedIndex = (variablesList.List.Items.Count - 1); } private void variablesList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/VariablesTab/IntVariablesTab.cs b/W4Gui/Tabs/VariablesTab/IntVariablesTab.cs index 27e3e2f..e6138cf 100644 --- a/W4Gui/Tabs/VariablesTab/IntVariablesTab.cs +++ b/W4Gui/Tabs/VariablesTab/IntVariablesTab.cs @@ -51,7 +51,9 @@ namespace W4Gui.Tabs.VariablesTab private void variablesList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new variables from here not implemented yet ;)"); + DataManager.SaveFile.XDataBank.CreateInt(); + variablesList.List.Add(DataManager.SaveFile.XDataBank.IntResourceDetails.Last().FriendlyName); + variablesList.List.SelectedIndex = (variablesList.List.Items.Count - 1); } private void variablesList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/VariablesTab/StringVariablesTab.cs b/W4Gui/Tabs/VariablesTab/StringVariablesTab.cs index 9a883ad..6858921 100644 --- a/W4Gui/Tabs/VariablesTab/StringVariablesTab.cs +++ b/W4Gui/Tabs/VariablesTab/StringVariablesTab.cs @@ -52,7 +52,9 @@ namespace W4Gui.Tabs.VariablesTab private void variablesList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new variables from here not implemented yet ;)"); + DataManager.SaveFile.XDataBank.CreateString(); + variablesList.List.Add(DataManager.SaveFile.XDataBank.StringResourceDetails.Last().FriendlyName); + variablesList.List.SelectedIndex = (variablesList.List.Items.Count - 1); } private void variablesList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/VariablesTab/UIntVariablesTab.cs b/W4Gui/Tabs/VariablesTab/UIntVariablesTab.cs index 0ff1f2c..67b8db9 100644 --- a/W4Gui/Tabs/VariablesTab/UIntVariablesTab.cs +++ b/W4Gui/Tabs/VariablesTab/UIntVariablesTab.cs @@ -52,7 +52,9 @@ namespace W4Gui.Tabs.VariablesTab private void variablesList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new variables from here not implemented yet ;)"); + DataManager.SaveFile.XDataBank.CreateUInt(); + variablesList.List.Add(DataManager.SaveFile.XDataBank.UIntResourceDetails.Last().FriendlyName); + variablesList.List.SelectedIndex = (variablesList.List.Items.Count - 1); } private void variablesList_DelButton(object sender, EventArgs e) diff --git a/W4Gui/Tabs/VariablesTab/VectorVariablesTab.cs b/W4Gui/Tabs/VariablesTab/VectorVariablesTab.cs index 6afa3f1..c3b66ea 100644 --- a/W4Gui/Tabs/VariablesTab/VectorVariablesTab.cs +++ b/W4Gui/Tabs/VariablesTab/VectorVariablesTab.cs @@ -52,7 +52,9 @@ namespace W4Gui.Tabs.VariablesTab private void variablesList_NewButton(object sender, EventArgs e) { - throw new NotImplementedException("Adding new variables from here not implemented yet ;)"); + DataManager.SaveFile.XDataBank.CreateVector(); + variablesList.List.Add(DataManager.SaveFile.XDataBank.VectorResourceDetails.Last().FriendlyName); + variablesList.List.SelectedIndex = (variablesList.List.Items.Count - 1); } private void variablesList_DelButton(object sender, EventArgs e)