Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.
/ KingdomSaveEditor Public archive
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions KHSave.Lib1/ISaveKh1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public interface ISaveKh1
WorldType World { get; set; }
uint Room { get; set; }
uint SpawnLocation { get; set; }
Gummiship[] Gummiships { get; set; }

void Write(Stream stream);
}
Expand Down
2 changes: 1 addition & 1 deletion KHSave.Lib1/Models/Gummiship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class Gummiship
[Data(Count = 10)] public byte[] ShipName { get; set; }
[Data(Count = 22)] public byte[] Unk02 { get; set; }
[Data(Count = 200)] public GummiBlock[] GummiBlocks { get; set; }
[Data(Count = 1466)] public byte[] Unk03 { get; set; }
[Data(Count = 1444)] public byte[] Unk03 { get; set; }
}
}
3 changes: 3 additions & 0 deletions KHSave.Lib1/SaveKh1.FinalMix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class SaveFinalMix : ISaveKh1
[Data(0x2044)] public uint Room { get; set; }
[Data(0x2048)] public uint SpawnLocation { get; set; }

//Gummiships
[Data(0x241C, Count = 10)] public Gummiship[] Gummiships { get; set; }

[Data(0x16400)] public int AutoLock { get; set; }
[Data(0x16404)] public int TargetLock { get; set; }
[Data(0x16408)] public int Camera { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions KHSave.SaveEditor.Kh1/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<TabItem Header="Players">
<views:PlayersView DataContext="{Binding Players}"/>
</TabItem>
<TabItem Header="Gummi Ship">
<views:GummiShipsView DataContext="{Binding GummiShips}"/>
</TabItem>
</TabControl>
</UserControl>
36 changes: 36 additions & 0 deletions KHSave.SaveEditor.Kh1/ViewModels/GummiBlockViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using KHSave.Lib1.Models;
using KHSave.Lib1.Types;
using KHSave.SaveEditor.Common.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xe.Tools;

namespace KHSave.SaveEditor.Kh1.ViewModels
{
public class GummiBlockViewModel : BaseNotifyPropertyChanged
{
private readonly GummiBlock gummiblock;
public GummiBlockViewModel(GummiBlock gummiBlock)
{
this.gummiblock = gummiBlock;
GummiBlockTypes = new KhEnumListModel<GummiBlocksType>();
}
public KhEnumListModel<GummiBlocksType> GummiBlockTypes { get; set; }

public byte BlockPositionYX { get => gummiblock.BlockPositionYX; set => gummiblock.BlockPositionYX = value; }
public byte BlockPositionZ { get => gummiblock.BlockPositionZ; set => gummiblock.BlockPositionZ = value; }
public byte Unknown2 { get => gummiblock.Unknown2; set => gummiblock.Unknown2 = value; }
public byte Unknown3 { get => gummiblock.Unknown3; set => gummiblock.Unknown3 = value; }
public GummiBlocksType BlockID { get => gummiblock.BlockID; set => gummiblock.BlockID = value; }
public byte Unknown4 { get => gummiblock.Unknown4; set => gummiblock.Unknown4 = value; }
public byte Unknown5 { get => gummiblock.Unknown5; set => gummiblock.Unknown5 = value; }
public byte Unknown6 { get => gummiblock.Unknown6; set => gummiblock.Unknown6 = value; }
public byte ColorID { get => gummiblock.ColorID; set => gummiblock.ColorID = value; }
public byte Unknown7 { get => gummiblock.Unknown7; set => gummiblock.Unknown7 = value; }
public byte Unknown8 { get => gummiblock.Unknown8; set => gummiblock.Unknown8 = value; }
public byte Unknown9 { get => gummiblock.Unknown9; set => gummiblock.Unknown9 = value; }
}
}
19 changes: 19 additions & 0 deletions KHSave.SaveEditor.Kh1/ViewModels/GummiBlocksViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using KHSave.Lib1.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xe.Tools.Wpf.Models;

namespace KHSave.SaveEditor.Kh1.ViewModels
{
public class GummiBlocksViewModel : GenericListModel<GummiBlockViewModel>
{
public GummiBlocksViewModel(GummiBlock[] gummiBlocks) :
base(gummiBlocks.Select(x => new GummiBlockViewModel(x)))
{

}
}
}
28 changes: 28 additions & 0 deletions KHSave.SaveEditor.Kh1/ViewModels/GummiShipViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using KHSave.Lib1;
using KHSave.Lib1.Models;
using KHSave.Lib1.Types;
using KHSave.SaveEditor.Common.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xe.Tools;

namespace KHSave.SaveEditor.Kh1.ViewModels
{
public class GummiShipViewModel : BaseNotifyPropertyChanged
{
private readonly Gummiship gummiship;

public GummiShipViewModel(Gummiship gummiship)
{
this.gummiship = gummiship;
new GummiBlocksViewModel(gummiship.GummiBlocks);
}

public byte[] Name { get => gummiship.ShipName; set => gummiship.ShipName = value; }
public byte BlocksUsed { get => gummiship.BlocksUsed; set => gummiship.BlocksUsed = value; }

}
}
18 changes: 18 additions & 0 deletions KHSave.SaveEditor.Kh1/ViewModels/GummiShipsViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using KHSave.Lib1;
using KHSave.Lib1.Models;
using System.Collections.Generic;
using System.Linq;
using Xe.Tools.Wpf.Commands;
using Xe.Tools.Wpf.Models;

namespace KHSave.SaveEditor.Kh1.ViewModels
{
public class GummiShipsViewModel : GenericListModel<GummiShipViewModel>
{
public GummiShipsViewModel(Gummiship[] gummiships) :
base(gummiships.Select(x => new GummiShipViewModel(x)))
{

}
}
}
3 changes: 3 additions & 0 deletions KHSave.SaveEditor.Kh1/ViewModels/Kh1ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ public Kh1ViewModel()
public InventoryViewModel Inventory { get; private set; }
public PlayersViewModel Players { get; private set; }
public KhEnumListModel<AbilityType> Abilities { get; }
public GummiShipsViewModel GummiShips { get; private set; }

public void RefreshUi()
{
System = new SystemViewModel(Save, this);
Inventory = new InventoryViewModel(Save);
Players = new PlayersViewModel(Save, this);
GummiShips = new GummiShipsViewModel(Save.Gummiships);

OnPropertyChanged(nameof(System));
OnPropertyChanged(nameof(Inventory));
OnPropertyChanged(nameof(Players));
OnPropertyChanged(nameof(GummiShips));
}

public void OpenStream(Stream stream)
Expand Down
43 changes: 43 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiBlockView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<UserControl x:Class="KHSave.SaveEditor.Kh1.Views.GummiBlockView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:KHSave.SaveEditor.Kh1.Views" xmlns:common="clr-namespace:KHSave.SaveEditor.Common.Controls;assembly=KHSave.SaveEditor.Common"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ScrollViewer>
<StackPanel>
<common:TwoEqualColumnsStackPanel>
<TextBlock Text="BlockPositionYX"/>
<TextBox Text="{Binding BlockPositionYX, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="BlockPositionZ"/>
<TextBox Text="{Binding BlockPositionZ, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown2"/>
<TextBox Text="{Binding Unknown2, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Gummi Block Type"/>
<ComboBox ItemsSource="{Binding GummiBlockTypes}"
SelectedValue="{Binding BlockID}"
DisplayMemberPath="Name"
SelectedValuePath="Value"/>
<TextBlock Text="Unknown3"/>
<TextBox Text="{Binding Unknown3, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown4"/>
<TextBox Text="{Binding Unknown4, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown5"/>
<TextBox Text="{Binding Unknown5, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown6"/>
<TextBox Text="{Binding Unknown6, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Color ID"/>
<TextBox Text="{Binding ColorID, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown7"/>
<TextBox Text="{Binding Unknown7, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown8"/>
<TextBox Text="{Binding Unknown8, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Unknown9"/>
<TextBox Text="{Binding Unknown9, UpdateSourceTrigger=PropertyChanged}"/>

</common:TwoEqualColumnsStackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>
28 changes: 28 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiBlockView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace KHSave.SaveEditor.Kh1.Views
{
/// <summary>
/// Interaction logic for GummiBlockView.xaml
/// </summary>
public partial class GummiBlockView : UserControl
{
public GummiBlockView()
{
InitializeComponent();
}
}
}
27 changes: 27 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiBlocksView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<UserControl x:Class="KHSave.SaveEditor.Kh1.Views.GummiBlocksView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:KHSave.SaveEditor.Kh1.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>

<ListBox
Grid.Column="0"
ItemsSource="{Binding Items}"
SelectedIndex="{Binding SelectedIndex}"
SelectedItem="{Binding SelectedItem}"
DisplayMemberPath="BlockID"
/>
<Grid Grid.Column="2">
<local:GummiBlockView/>
</Grid>
</Grid>
</UserControl>
28 changes: 28 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiBlocksView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace KHSave.SaveEditor.Kh1.Views
{
/// <summary>
/// Interaction logic for GummiBlocksView.xaml
/// </summary>
public partial class GummiBlocksView : UserControl
{
public GummiBlocksView()
{
InitializeComponent();
}
}
}
22 changes: 22 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiShipView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<UserControl x:Class="KHSave.SaveEditor.Kh1.Views.GummiShipView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:KHSave.SaveEditor.Kh1.Views"
xmlns:common="clr-namespace:KHSave.SaveEditor.Common.Controls;assembly=KHSave.SaveEditor.Common"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ScrollViewer>
<StackPanel>
<common:TwoEqualColumnsStackPanel>
<TextBlock Text="Ship name"/>
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Blocks Used"/>
<TextBox Text="{Binding BlocksUsed}" IsEnabled="False"/>

</common:TwoEqualColumnsStackPanel>
<local:GummiBlocksView Margin="0 10 0 0"/>
</StackPanel>
</ScrollViewer>
</UserControl>
28 changes: 28 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiShipView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace KHSave.SaveEditor.Kh1.Views
{
/// <summary>
/// Interaction logic for GummiShipView.xaml
/// </summary>
public partial class GummiShipView : UserControl
{
public GummiShipView()
{
InitializeComponent();
}
}
}
35 changes: 35 additions & 0 deletions KHSave.SaveEditor.Kh1/Views/GummiShipsView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<UserControl x:Class="KHSave.SaveEditor.Kh1.Views.GummiShipsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:KHSave.SaveEditor.Kh1.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<!--<RowDefinition Height="auto"/>
<RowDefinition Height="5*"/>-->
</Grid.RowDefinitions>
<ListBox
Grid.Column="0"
Grid.Row="0"
ItemsSource="{Binding Items}"
SelectedIndex="{Binding SelectedIndex}"
SelectedItem="{Binding SelectedItem}"
DisplayMemberPath="Name"/>

<local:GummiShipView Grid.Column="2" Grid.Row="0" DataContext="{Binding SelectedItem}"/>

<!--<Grid Grid.Row="2">
<Button Content="Import" HorizontalAlignment="Left" Height="32" Margin="65,51,-40,-32" VerticalAlignment="Top" Width="75"/>
<Button Content="Export" HorizontalAlignment="Left" Height="32" Margin="155,51,-127,-32" VerticalAlignment="Top" Width="75"/>
</Grid>-->

</Grid>
</UserControl>
Loading