Skip to content

Commit

Permalink
adjust combobox panels to be virtualized, add common NJS structures f…
Browse files Browse the repository at this point in the history
…older
  • Loading branch information
krogenth committed Sep 7, 2023
1 parent 8f26572 commit 7ea92c8
Show file tree
Hide file tree
Showing 26 changed files with 779 additions and 62 deletions.
9 changes: 9 additions & 0 deletions src/G2DataGUI.Common/Data/Models/Common/NJSARGB.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace G2DataGUI.Common.Data.Models.Common;

public struct NJSARGB
{
public float A { get; set; }
public float R { get; set; }
public float G { get; set; }
public float B { get; set; }
}
9 changes: 9 additions & 0 deletions src/G2DataGUI.Common/Data/Models/Common/NJSBGRA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace G2DataGUI.Common.Data.Models.Common;

public struct NJSBGRA
{
public byte Blue { get; set; }
public byte Green { get; set; }
public byte Red { get; set; }
public byte Alpha { get; set; }
}
11 changes: 11 additions & 0 deletions src/G2DataGUI.Common/Data/Models/Common/NJSColor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Runtime.InteropServices;

namespace G2DataGUI.Common.Data.Models.Common;

[StructLayout(LayoutKind.Explicit)]
public struct NJSColor
{
[FieldOffset(0)] public uint Color;
[FieldOffset(0)] public NJSTexture Texture;
[FieldOffset(0)] public NJSBGRA ARGB;
}
7 changes: 7 additions & 0 deletions src/G2DataGUI.Common/Data/Models/Common/NJSTexture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace G2DataGUI.Common.Data.Models.Common;

public struct NJSTexture
{
public short U { get; set; }
public short V { get; set; }
}
5 changes: 5 additions & 0 deletions src/G2DataGUI.Common/Data/Models/Model.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
namespace G2DataGUI.Common.Data.Models;

/// <summary>
/// Defines everything regarding an in-game model.
/// This includes the model itself(NJCM),
/// as well as any motions(NMDM) files.
/// </summary>
public class Model
{

Expand Down
1 change: 1 addition & 0 deletions src/G2DataGUI.Common/Data/Models/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ namespace G2DataGUI.Common.Data.Models;

public class Models : BaseContainer
{

}
5 changes: 5 additions & 0 deletions src/G2DataGUI.Common/Data/Models/NJCM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace G2DataGUI.Common.Data.Models;

/// <summary>
/// Defines the NJCM file strcture based
/// on the in-game files.
/// </summary>
public class NJCM
{
public uint ByteLength { get; private set; }
Expand All @@ -24,6 +28,7 @@ public static NJCM ReadNJCM(Stream reader, long instanceOffset)
var identifier = reader.ReadRawByteArray((uint)Identifier.Length);
if (!Identifier.SequenceEqual(identifier))
{
reader.Seek(-Identifier.Length, SeekOrigin.Current);
return null;
}

Expand Down
4 changes: 4 additions & 0 deletions src/G2DataGUI.Common/Data/Models/NJSBone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace G2DataGUI.Common.Data.Models;

/// <summary>
/// Defines the njcm_object_t structure from the
/// Dreamcast Katana SDK's Ninja library specifies.
/// </summary>
public class NJSBone
{
public uint Flags { get; set; }
Expand Down
10 changes: 3 additions & 7 deletions src/G2DataGUI.Common/Data/Models/NMDM.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace G2DataGUI.Common.Data.Models;

namespace G2DataGUI.Common.Data.Models;
internal class NMDM
public class NMDM
{

}
32 changes: 28 additions & 4 deletions src/G2DataGUI/UI/Views/Content/BossMovesets.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@
<TextBlock Text="Target Effect:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossMoveItem.Stats.TargetEffect}"
Items="{locale:Locale TargetEffects}" />
Items="{locale:Locale TargetEffects}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
<TextBlock Text="Range:" />
Expand All @@ -103,7 +109,13 @@
<TextBlock Text="Target Type:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossMoveItem.Stats.TargetType}"
Items="{locale:Locale TargetTypes}" />
Items="{locale:Locale TargetTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
<TextBlock Text="Accuracy:" />
Expand Down Expand Up @@ -158,7 +170,13 @@
<TextBlock Text="Animation:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossMoveItem.Stats.Animation}"
Items="{locale:Locale Animations}" />
Items="{locale:Locale Animations}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
</StackPanel>
Expand Down Expand Up @@ -328,7 +346,13 @@
<TextBlock Text="Element:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossMoveItem.Stats.Element}"
Items="{locale:Locale Elements}" />
Items="{locale:Locale Elements}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4"
Grid.Column="1">
Expand Down
26 changes: 24 additions & 2 deletions src/G2DataGUI/UI/Views/Content/BossStats.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@
Margin="4">
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossStats.Type1}"
Items="{locale:Locale EnemyTypes}" />
Items="{locale:Locale EnemyTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Grid.Column="1"
Margin="4">
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedBossStats.Type2}"
Items="{locale:Locale EnemyTypes}" />
Items="{locale:Locale EnemyTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
</StackPanel>
Expand All @@ -76,6 +88,11 @@
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
Expand All @@ -98,6 +115,11 @@
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
Expand Down
32 changes: 28 additions & 4 deletions src/G2DataGUI/UI/Views/Content/EnemyMoveset.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@
<TextBlock Text="Target Effect:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyMoveItem.Stats.TargetEffect}"
Items="{locale:Locale TargetEffects}" />
Items="{locale:Locale TargetEffects}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
<TextBlock Text="Range:" />
Expand All @@ -103,7 +109,13 @@
<TextBlock Text="Target Type:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyMoveItem.Stats.TargetType}"
Items="{locale:Locale TargetTypes}" />
Items="{locale:Locale TargetTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
<TextBlock Text="Accuracy:" />
Expand Down Expand Up @@ -158,7 +170,13 @@
<TextBlock Text="Animation:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyMoveItem.Stats.Animation}"
Items="{locale:Locale Animations}" />
Items="{locale:Locale Animations}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
</StackPanel>
Expand Down Expand Up @@ -328,7 +346,13 @@
<TextBlock Text="Element:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyMoveItem.Stats.Element}"
Items="{locale:Locale Elements}" />
Items="{locale:Locale Elements}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4"
Grid.Column="1">
Expand Down
26 changes: 24 additions & 2 deletions src/G2DataGUI/UI/Views/Content/EnemyStats.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@
Margin="4">
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyStats.Type1}"
Items="{locale:Locale EnemyTypes}" />
Items="{locale:Locale EnemyTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Grid.Column="1"
Margin="4">
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedEnemyStats.Type2}"
Items="{locale:Locale EnemyTypes}" />
Items="{locale:Locale EnemyTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
</StackPanel>
Expand All @@ -76,6 +88,11 @@
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
Expand All @@ -98,6 +115,11 @@
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4">
Expand Down
8 changes: 7 additions & 1 deletion src/G2DataGUI/UI/Views/Content/ItemEquipment.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,13 @@
<TextBlock Text="Effective On:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedItemEquipment.EffectiveOn}"
Items="{locale:Locale EffectiveOn}" />
Items="{locale:Locale EffectiveOn}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4"
Grid.Column="1">
Expand Down
32 changes: 28 additions & 4 deletions src/G2DataGUI/UI/Views/Content/ItemUsable.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@
<TextBlock Text="Target Effect:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedItemUsable.TargetEffect}"
Items="{locale:Locale TargetEffects}" />
Items="{locale:Locale TargetEffects}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4"
Grid.Column="1">
<TextBlock Text="Target Type:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedItemUsable.TargetType}"
Items="{locale:Locale TargetTypes}" />
Items="{locale:Locale TargetTypes}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
<Grid>
Expand Down Expand Up @@ -97,7 +109,13 @@
<TextBlock Text="Animation:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedItemUsable.Animation}"
Items="{locale:Locale Animations}" />
Items="{locale:Locale Animations}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
</Grid>
</StackPanel>
Expand Down Expand Up @@ -266,7 +284,13 @@
<TextBlock Text="Element:" />
<ComboBox HorizontalAlignment="Stretch"
SelectedIndex="{Binding SelectedItemUsable.Element}"
Items="{locale:Locale Elements}" />
Items="{locale:Locale Elements}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
</StackPanel>
<StackPanel Margin="4"
Grid.Column="1">
Expand Down
Loading

0 comments on commit 7ea92c8

Please sign in to comment.