Initialize all current project files
25
BOTWToolset.sln
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BOTWToolset", "botw-toolset\BOTWToolset.csproj", "{9FE4680A-CD27-4835-844D-50543BEFF2D9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9FE4680A-CD27-4835-844D-50543BEFF2D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9FE4680A-CD27-4835-844D-50543BEFF2D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9FE4680A-CD27-4835-844D-50543BEFF2D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9FE4680A-CD27-4835-844D-50543BEFF2D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6F11E363-7B2E-44BA-94A6-ABEF9C9C1837}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
6
botw-toolset/App.config
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
88
botw-toolset/App.xaml
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<Application x:Class="BOTWToolset.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:BOTWToolset"
|
||||
StartupUri="Dashboard.xaml">
|
||||
<Application.Resources>
|
||||
<!--<Style TargetType="{x:Type Grid}">
|
||||
<Setter Property="Background" Value="#262C35"></Setter>
|
||||
</Style>-->
|
||||
|
||||
<SolidColorBrush x:Key="BGTone0" Color="#262C35"/>
|
||||
<SolidColorBrush x:Key="BGTone1" Color="#2C343E"/>
|
||||
<SolidColorBrush x:Key="BGTone2" Color="#37424E"/>
|
||||
<SolidColorBrush x:Key="BGTone3" Color="#3E4B59"/>
|
||||
<SolidColorBrush x:Key="TabSelected" Color="#455463"/>
|
||||
<SolidColorBrush x:Key="BorderGray" Color="#506071"/>
|
||||
|
||||
<Style TargetType="{x:Type Label}">
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="Transparent"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter> <!-- Text color -->
|
||||
<Setter Property="BorderBrush" Value="White"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TabControl}">
|
||||
<Setter Property="Background" Value="{StaticResource BGTone1}"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
<Setter Property="BorderBrush" Value="Transparent"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="Background" Value="{StaticResource BGTone2}"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
<Setter Property="BorderBrush" Value="Transparent"></Setter>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Grid>
|
||||
<Border
|
||||
Name="Border"
|
||||
Margin="0,0,-4,0"
|
||||
Background="{StaticResource BGTone2}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="1,1,1,0"
|
||||
CornerRadius="3,3,0,0" >
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
Margin="12,2,12,2"
|
||||
RecognizesAccessKey="True">
|
||||
</ContentPresenter>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="100"/>
|
||||
<Setter TargetName="Border" Property="Background" Value="{StaticResource TabSelected}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="#EEE"/>
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#AAA"/>
|
||||
<Setter Property="Foreground" Value="#888"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Menu}">
|
||||
<Setter Property="Background" Value="{StaticResource BGTone2}"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="Foreground" Value="#FF212121"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Background" Value="Transparent"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderGray}"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderGray}"></Setter>
|
||||
<Setter Property="BorderThickness" Value="1"></Setter>
|
||||
</Style>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
11
botw-toolset/App.xaml.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System.Windows;
|
||||
|
||||
namespace BOTWToolset
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
119
botw-toolset/BOTWToolset.csproj
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9FE4680A-CD27-4835-844D-50543BEFF2D9}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>BOTWToolset</RootNamespace>
|
||||
<AssemblyName>botw-toolset</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Control\TabTSCB.xaml.cs">
|
||||
<DependentUpon>TabTSCB.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Dashboard.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Debugging\BOTWConsole.cs" />
|
||||
<Compile Include="IO\EXTM\Grass.cs" />
|
||||
<Compile Include="IO\EXTM\GrassColor.cs" />
|
||||
<Compile Include="IO\EXTM\Water.cs" />
|
||||
<Compile Include="IO\EXTM\WaterColor.cs" />
|
||||
<Compile Include="IO\TSCB\AreaInfo.cs" />
|
||||
<Compile Include="IO\TSCB\TSCB.cs" />
|
||||
<Compile Include="IO\TSCB\TSCBInfo.cs" />
|
||||
<Compile Include="IO\TSCB\MaterialInfo.cs" />
|
||||
<Compile Include="MathExt.cs" />
|
||||
<Compile Include="Color.cs" />
|
||||
<Compile Include="Dashboard.xaml.cs">
|
||||
<DependentUpon>Dashboard.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Control\TabTSCB.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\*.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
22
botw-toolset/Color.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BOTWToolset
|
||||
{
|
||||
struct Color
|
||||
{
|
||||
public byte R;
|
||||
public byte G;
|
||||
public byte B;
|
||||
|
||||
public Color(byte r, byte g, byte b)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
B = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
botw-toolset/Control/TabTSCB.xaml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<UserControl x:Class="BOTWToolset.TabTSCB"
|
||||
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:BOTWToolset"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="597" d:DesignWidth="1246 " Width="Auto" Height="Auto">
|
||||
<Grid>
|
||||
<Label Content="TSCB Editor" Margin="10,10,10,0" VerticalAlignment="Top" Height="48" FontSize="28" VerticalContentAlignment="Center" FontFamily="Segoe UI Light"/>
|
||||
|
||||
<Menu Margin="10,58,10,0" VerticalAlignment="Top">
|
||||
<MenuItem Header="_File" Foreground="White">
|
||||
<MenuItem x:Name="MenuFileOpen" Header="_Open" InputGestureText="Ctrl+O" Click="Menu_OpenFile"/>
|
||||
<MenuItem x:Name="MenuFileClose" Header="_Close" Click="Menu_CloseFile"/>
|
||||
<MenuItem x:Name="MenuFileSave" Header="_Save" InputGestureText="Ctrl+S" Click="Menu_SaveFile" IsEnabled="False"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Border BorderThickness="1" Margin="10,81,293,145"/>
|
||||
<Border BorderThickness="1" Margin="0,81,10,10" HorizontalAlignment="Right" Width="278">
|
||||
<Grid>
|
||||
<Label Content="Signature" HorizontalAlignment="Left" Margin="10,0,0,195" Width="120" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="Signature" x:FieldModifier="public" Margin="10,0,146,172" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Version" HorizontalAlignment="Left" Margin="146,0,0,195" Width="120" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="Version" x:FieldModifier="public" Margin="146,0,10,172" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="File Base Offset" HorizontalAlignment="Left" Margin="10,0,0,141" Width="120" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="FileBaseOffset" x:FieldModifier="public" Margin="10,0,146,118" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="World Scale" HorizontalAlignment="Left" Margin="146,0,0,141" Width="120" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="WorldScale" x:FieldModifier="public" Margin="146,0,10,118" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Terrain Max Height" HorizontalAlignment="Left" Margin="10,0,0,87" Width="120" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="TerrainMaxHeight" x:FieldModifier="public" Margin="10,0,146,64" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Material Info Length" HorizontalAlignment="Left" Margin="146,0,0,87" Width="120" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="MaterialInfoLength" x:FieldModifier="public" Margin="146,0,10,64" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Area Array Length" HorizontalAlignment="Left" Margin="10,0,0,33" Width="120" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="AreaArrayLength" x:FieldModifier="public" Margin="10,0,146,10" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Label Content="Tile Size" HorizontalAlignment="Left" Margin="146,0,0,33" Width="120" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="TileSize" x:FieldModifier="public" Margin="146,0,10,10" TextWrapping="Wrap" Text="" VerticalContentAlignment="Center" IsReadOnly="True" Height="23" VerticalAlignment="Bottom"/>
|
||||
<Border BorderThickness="1" HorizontalAlignment="Left" Margin="10,10,0,226" Width="256">
|
||||
<StackPanel x:Name="TSCBAreaViewer" x:FieldModifier="public"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
<TextBox x:Name="TSCBConsole" x:FieldModifier="public" TextWrapping="Wrap" Text="" Margin="10,0,293,10" Height="130" VerticalAlignment="Bottom" UndoLimit="1" AllowDrop="False" FontFamily="Consolas" VerticalScrollBarVisibility="Auto" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
102
botw-toolset/Control/TabTSCB.xaml.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using BOTWToolset.IO.TSCB;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Controls;
|
||||
using BOTWToolset.Debugging;
|
||||
|
||||
namespace BOTWToolset
|
||||
{
|
||||
/// <summary>
|
||||
/// Control tab for TSCB management
|
||||
/// </summary>
|
||||
public partial class TabTSCB : UserControl
|
||||
{
|
||||
public static string fileLocation;
|
||||
public static TSCBInfo currentTSCBInfo;
|
||||
|
||||
public TabTSCB()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetSidebarHeaderInfo(TSCBInfo t)
|
||||
{
|
||||
Signature.Text = t.Signature;
|
||||
Version.Text = t.Version.ToString() + ".0.0.0"; // TODO: An actual version based off bytes should be done later
|
||||
FileBaseOffset.Text = t.FileBaseOffset.ToString();
|
||||
WorldScale.Text = t.WorldScale.ToString();
|
||||
TerrainMaxHeight.Text = t.TerrainMaxHeight.ToString();
|
||||
MaterialInfoLength.Text = t.MaterialInfoLength.ToString();
|
||||
AreaArrayLength.Text = t.AreaArrayLength.ToString();
|
||||
TileSize.Text = t.TileSize.ToString();
|
||||
}
|
||||
|
||||
public void ClearAllTabInfo()
|
||||
{
|
||||
// Clear sidebar header info
|
||||
Signature.Clear();
|
||||
Version.Clear();
|
||||
FileBaseOffset.Clear();
|
||||
WorldScale.Clear();
|
||||
TerrainMaxHeight.Clear();
|
||||
MaterialInfoLength.Clear();
|
||||
AreaArrayLength.Clear();
|
||||
TileSize.Clear();
|
||||
|
||||
// Clear area display stack panel
|
||||
TSCBAreaViewer.Children.Clear();
|
||||
}
|
||||
|
||||
private void Menu_OpenFile(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
BOTWConsole.Log("Clicked File -> Open button");
|
||||
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
InitialDirectory = @"C:\",
|
||||
RestoreDirectory = true,
|
||||
Title = "Select TSCB file",
|
||||
DefaultExt = "tscb",
|
||||
Filter = "TSCB files (*.tscb)|*.tscb",
|
||||
CheckFileExists = true
|
||||
};
|
||||
|
||||
if ((bool)openFileDialog.ShowDialog())
|
||||
{
|
||||
BOTWConsole.Log("Opening file");
|
||||
|
||||
TSCBInfo t = TSCB.ReadFile(openFileDialog.FileName);
|
||||
|
||||
// Set the current file location to the chosen file's location
|
||||
fileLocation = openFileDialog.FileName;
|
||||
|
||||
// Set the current TCSBInfo to the new TSCBInfo
|
||||
currentTSCBInfo = t;
|
||||
|
||||
// Set UI sidebar to have header info
|
||||
SetSidebarHeaderInfo(t);
|
||||
|
||||
// Allow the file to be saved
|
||||
MenuFileSave.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_CloseFile(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
BOTWConsole.Log("Clicked File -> Close button");
|
||||
|
||||
// Set the current TSCB info to nothing
|
||||
currentTSCBInfo = null;
|
||||
|
||||
// Clear sidebar header info
|
||||
ClearAllTabInfo();
|
||||
|
||||
// Since there's no file open, don't allow saving
|
||||
MenuFileSave.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void Menu_SaveFile(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
BOTWConsole.Log("Clicked File -> Save button");
|
||||
}
|
||||
}
|
||||
}
|
||||
55
botw-toolset/Dashboard.xaml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<Window x:Class="BOTWToolset.Dashboard"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:BOTWToolset"
|
||||
mc:Ignorable="d"
|
||||
Title="Breath of the Wild Toolset" Height="720" Width="1280" Icon="Resources/Icons/triforce.png" MinWidth="645" MinHeight="645">
|
||||
<Grid Background="#262C35">
|
||||
<TabControl Margin="10,10,10,41">
|
||||
<TabItem Header="Dashboard">
|
||||
<Grid Background="#2C343E">
|
||||
<Label Content="Dashboard" Margin="10,10,10,0" VerticalAlignment="Top" Height="48" FontSize="28" VerticalContentAlignment="Center" FontFamily="Segoe UI Light"/>
|
||||
|
||||
<Border x:Name="DashboardButtonTSCB" BorderBrush="White" HorizontalAlignment="Left" Margin="10,63,0,0" VerticalAlignment="Top" Width="250" Height="165">
|
||||
<Grid>
|
||||
<Image Source="Resources/Icons/mountain.png" Margin="10,10,190,0" Width="48" Height="48" VerticalAlignment="Top"/>
|
||||
<Label Margin="63,10,10,0" VerticalContentAlignment="Center" FontSize="24" Height="48" VerticalAlignment="Top">TSCB</Label>
|
||||
<TextBlock Text="Edits terrain scene binary files." Margin="10,63,10,10" TextWrapping="Wrap"></TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border x:Name="DashboardButtonYaz0" BorderBrush="White" HorizontalAlignment="Left" Margin="265,63,0,0" VerticalAlignment="Top" Width="250" Height="165">
|
||||
<Grid>
|
||||
<Image Source="Resources/Icons/letter-z.png" Margin="10,10,190,0" Width="48" Height="48" VerticalAlignment="Top"/>
|
||||
<Label Margin="63,10,10,0" VerticalContentAlignment="Center" FontSize="24" Height="48" VerticalAlignment="Top">Yaz0</Label>
|
||||
<TextBlock Text="Allows compression/decompression using Yaz0 encoding." Margin="10,63,10,10" TextWrapping="Wrap"></TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border x:Name="DashboardButtonSARC" BorderBrush="White" HorizontalAlignment="Left" Margin="520,63,0,0" VerticalAlignment="Top" Width="250" Height="165">
|
||||
<Grid>
|
||||
<Image Source="Resources/Icons/package.png" Margin="10,10,190,0" Width="48" Height="48" VerticalAlignment="Top"/>
|
||||
<Label Margin="63,10,10,0" VerticalContentAlignment="Center" FontSize="24" Height="48" VerticalAlignment="Top">SARC</Label>
|
||||
<TextBlock Text="Tools to unpack and pack SARC files." Margin="10,63,10,10" TextWrapping="Wrap"></TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border x:Name="DashboardButtonRSTB" BorderBrush="White" HorizontalAlignment="Left" Margin="775,63,0,0" VerticalAlignment="Top" Width="250" Height="165">
|
||||
<Grid>
|
||||
<Image Source="Resources/Icons/text-file.png" Margin="10,10,190,0" Width="48" Height="48" VerticalAlignment="Top"/>
|
||||
<Label Margin="63,10,10,0" VerticalContentAlignment="Center" FontSize="24" Height="48" VerticalAlignment="Top">RSTB</Label>
|
||||
<TextBlock Text="Allows edits to the resource table." Margin="10,63,10,10" TextWrapping="Wrap"></TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="TSCB">
|
||||
<local:TabTSCB x:Name="tabTSCB" x:FieldModifier="public"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Yaz0"></TabItem>
|
||||
<TabItem Header="SARC"></TabItem>
|
||||
<TabItem Header="RSTB"></TabItem>
|
||||
</TabControl>
|
||||
<Label x:Name="LabelVersion" Content="" Margin="0,0,10,10" HorizontalAlignment="Right" Width="1252" Height="26" VerticalAlignment="Bottom" HorizontalContentAlignment="Right"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
23
botw-toolset/Dashboard.xaml.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using BOTWToolset.IO.TSCB;
|
||||
using System.Windows;
|
||||
using BOTWToolset.Debugging;
|
||||
|
||||
namespace BOTWToolset
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Dashboard.xaml
|
||||
/// </summary>
|
||||
public partial class Dashboard : Window
|
||||
{
|
||||
public const string VERSION = "1.0.0-pre-alpha";
|
||||
|
||||
public Dashboard()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BOTWConsole.Log($"Breath of the Wild Toolkit - Version {VERSION}");
|
||||
|
||||
LabelVersion.Content = $"Version v{VERSION}";
|
||||
}
|
||||
}
|
||||
}
|
||||
33
botw-toolset/Debugging/BOTWConsole.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace BOTWToolset.Debugging
|
||||
{
|
||||
static class BOTWConsole
|
||||
{
|
||||
private readonly static TextBox _console;
|
||||
static BOTWConsole()
|
||||
{
|
||||
var dashboard = Application.Current.Windows.OfType<Dashboard>().ToArray()[0];
|
||||
var tabControl = dashboard.tabTSCB;
|
||||
_console = tabControl.TSCBConsole;
|
||||
}
|
||||
|
||||
public static void Log(object text)
|
||||
{
|
||||
_console.Text += text.ToString() + "\n";
|
||||
_console.ScrollToEnd(); // After adding the new text, scroll to the end
|
||||
}
|
||||
|
||||
public static void LogWarning(object text)
|
||||
{
|
||||
Log("[Warning]" + text);
|
||||
}
|
||||
|
||||
public static void LogError(object text)
|
||||
{
|
||||
Log("[ERROR]" + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
botw-toolset/IO/EXTM/Grass.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BOTWToolset.IO.EXTM
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores info on grass data in an .extm file
|
||||
/// </summary>
|
||||
class Grass
|
||||
{
|
||||
public byte Height { get => _height; set => _height = value; }
|
||||
private byte _height;
|
||||
|
||||
public byte R { get => _r; set => _r = value; }
|
||||
private byte _r;
|
||||
|
||||
public byte G { get => _g; set => _g = value; }
|
||||
private byte _g;
|
||||
|
||||
public byte B { get => _b; set => _b = value; }
|
||||
private byte _b;
|
||||
}
|
||||
}
|
||||
23
botw-toolset/IO/EXTM/GrassColor.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BOTWToolset.IO.EXTM
|
||||
{
|
||||
class GrassColor
|
||||
{
|
||||
public static readonly Color[] Colors = new Color[]
|
||||
{
|
||||
new Color(95, 142, 74), // Green grass
|
||||
new Color(170, 193, 75), // Yellow grass
|
||||
new Color(206, 122, 66), // Wood chips 00
|
||||
new Color(181, 107, 57), // Wood chips 01
|
||||
new Color(160, 95, 51), // Wood chips 02
|
||||
new Color(137, 81, 44), // Wood chips 03
|
||||
new Color(137, 106, 72), // Wood chips 04 reeds
|
||||
new Color(79, 112, 68) // Wood chips 05 leaves
|
||||
};
|
||||
}
|
||||
}
|
||||
34
botw-toolset/IO/EXTM/Water.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BOTWToolset.IO.EXTM
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores info on water data in an .extm file
|
||||
/// </summary>
|
||||
class Water
|
||||
{
|
||||
public ushort Height { get => _height; set => _height = value; }
|
||||
private ushort _height;
|
||||
|
||||
public ushort XAxisFlowRate { get => _xAxisFlowRate; set => _xAxisFlowRate = value; }
|
||||
private ushort _xAxisFlowRate;
|
||||
|
||||
public ushort ZAxisFlowRate { get => _zAxisFlowRate; set => _zAxisFlowRate = value; }
|
||||
private ushort _zAxisFlowRate;
|
||||
|
||||
public byte MaterialIndex { get => _matIndex; set => _matIndex = value; }
|
||||
private byte _matIndex;
|
||||
|
||||
public byte MaterialIndexChecksum {
|
||||
get {
|
||||
if (_matIndex != 0)
|
||||
return (byte)(_matIndex + 3);
|
||||
return _matIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
botw-toolset/IO/EXTM/WaterColor.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BOTWToolset.IO.EXTM
|
||||
{
|
||||
class WaterColor
|
||||
{
|
||||
public static readonly Color[] Colors = new Color[]
|
||||
{
|
||||
new Color(73, 137, 255), // Water
|
||||
new Color(114, 255, 210), // Hot water
|
||||
new Color(173, 73, 255), // Poison water
|
||||
new Color(255, 97, 0), // Lava
|
||||
new Color(142, 211, 255), // Cold water
|
||||
new Color(86, 44, 0), // Bog (mud)
|
||||
new Color(102, 158, 255), // Clear water 01
|
||||
new Color(52, 99, 181) // Ocean
|
||||
};
|
||||
}
|
||||
}
|
||||
69
botw-toolset/IO/TSCB/AreaInfo.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
namespace BOTWToolset.IO.TSCB
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores area info for area data declared in a .tscb file.
|
||||
/// </summary>
|
||||
public class AreaInfo
|
||||
{
|
||||
public float PositionX { get => _positionX; set => _positionX = value; }
|
||||
private float _positionX;
|
||||
|
||||
public float PositionZ { get => _positionZ; set => _positionZ = value; }
|
||||
private float _positionZ;
|
||||
|
||||
public float AreaSize { get => _areaSize; set => _areaSize = value; }
|
||||
private float _areaSize;
|
||||
|
||||
public float MinTerrainHeight { get => _minTerrainHeight; set => _minTerrainHeight = value; }
|
||||
private float _minTerrainHeight;
|
||||
|
||||
public float MaxTerrainHeight { get => _maxTerrainHeight; set => _maxTerrainHeight = value; }
|
||||
private float _maxTerrainHeight;
|
||||
|
||||
public float MinWaterHeight { get => _minWaterHeight; set => _minWaterHeight = value; }
|
||||
private float _minWaterHeight;
|
||||
|
||||
public float MaxWaterHeight { get => _maxWaterHeight; set => _maxWaterHeight = value; }
|
||||
private float _maxWaterHeight;
|
||||
|
||||
public uint Unknown1 { get => _unknown1; set => _unknown1 = value; }
|
||||
private uint _unknown1;
|
||||
|
||||
public uint FileBase { get => _fileBase; set => _fileBase = value; }
|
||||
private uint _fileBase;
|
||||
|
||||
public uint Unknown2 { get => _unknown2; set => _unknown2 = value; }
|
||||
private uint _unknown2;
|
||||
|
||||
public uint Unknown3 { get => _unknown3; set => _unknown3 = value; }
|
||||
private uint _unknown3;
|
||||
|
||||
public uint ReferenceExtra { get => _refExtra; set => _refExtra = value; }
|
||||
private uint _refExtra;
|
||||
|
||||
public bool HasWater { get => _hasWater; set => _hasWater = value; }
|
||||
private bool _hasWater = false;
|
||||
|
||||
public bool HasGrass { get => _hasGrass; set => _hasGrass = value; }
|
||||
private bool _hasGrass = false;
|
||||
|
||||
public uint Offset;
|
||||
|
||||
public AreaInfo(float x_pos, float z_pos, float area_size, float min_terrain_height, float max_terrain_height,
|
||||
float min_water_height, float max_water_height, uint unknown_1, uint file_base, uint unknown_2, uint unknown_3, uint ref_extra)
|
||||
{
|
||||
PositionX = x_pos;
|
||||
PositionZ = z_pos;
|
||||
AreaSize = area_size;
|
||||
MinTerrainHeight = min_terrain_height;
|
||||
MaxTerrainHeight = max_terrain_height;
|
||||
MinWaterHeight = min_water_height;
|
||||
MaxWaterHeight = max_water_height;
|
||||
Unknown1 = unknown_1;
|
||||
FileBase = file_base;
|
||||
Unknown2 = unknown_2;
|
||||
Unknown3 = unknown_3;
|
||||
ReferenceExtra = ref_extra;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
botw-toolset/IO/TSCB/MaterialInfo.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
namespace BOTWToolset.IO.TSCB
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores material info for a material declared in a .tscb file.
|
||||
/// </summary>
|
||||
public class MaterialInfo
|
||||
{
|
||||
public uint MaterialIndex { get => _materialIndex; set => _materialIndex = value; }
|
||||
private uint _materialIndex;
|
||||
|
||||
public float TextureU { get => _textureU; set => _textureU = value; }
|
||||
private float _textureU;
|
||||
|
||||
public float TextureV { get => _textureV; set => _textureV = value; }
|
||||
private float _textureV;
|
||||
|
||||
public float Unknown1 { get => _unknown1; set => _unknown1 = value; }
|
||||
private float _unknown1;
|
||||
|
||||
public float Unknown2 { get => _unknown2; set => _unknown2 = value; }
|
||||
private float _unknown2;
|
||||
|
||||
public MaterialInfo(uint mat_index, float tex_u, float tex_v, float unk_1, float unk_2)
|
||||
{
|
||||
MaterialIndex = mat_index;
|
||||
TextureU = tex_u;
|
||||
TextureV = tex_v;
|
||||
Unknown1 = unk_1;
|
||||
Unknown2 = unk_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
144
botw-toolset/IO/TSCB/TSCB.cs
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
using BOTWToolset.Debugging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace BOTWToolset.IO.TSCB
|
||||
{
|
||||
/// <summary>
|
||||
/// Interacts with .tcsb files.
|
||||
/// </summary>
|
||||
static class TSCB
|
||||
{
|
||||
public static TSCBInfo ReadFile(string file)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
TSCBInfo t = new TSCBInfo();
|
||||
|
||||
using (var r = new BinaryReader(File.Open(file, FileMode.Open)))
|
||||
{
|
||||
// Set header info from file on the new TSCBInfo
|
||||
t.SetHeaderInfo(r);
|
||||
|
||||
// Skip over mat info offsets
|
||||
r.BaseStream.Seek((t.MaterialInfoLength * 4) + 4, SeekOrigin.Current);
|
||||
|
||||
BOTWConsole.Log($"Offset before material iteration: {r.BaseStream.Position}");
|
||||
|
||||
// Initialize mat info array with provided length
|
||||
t.MaterialInfo = new MaterialInfo[t.MaterialInfoLength];
|
||||
|
||||
// Initialize every mat info, then add to the array
|
||||
for (int i = 0; i < t.MaterialInfoLength; i++)
|
||||
{
|
||||
uint index = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0); // Reverse byte order - use big endian
|
||||
float tex_u = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float tex_v = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float unk_1 = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float unk_2 = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
MaterialInfo matInfo = new MaterialInfo(index, tex_u, tex_v, unk_1, unk_2);
|
||||
|
||||
t.MaterialInfo[i] = matInfo;
|
||||
}
|
||||
|
||||
BOTWConsole.Log($"Offset before area offset iteration: {r.BaseStream.Position}");
|
||||
|
||||
// Skip over area offsets (current position plus area array bytes)
|
||||
r.BaseStream.Seek(t.AreaArrayLength * 4, SeekOrigin.Current);
|
||||
|
||||
BOTWConsole.Log($"Offset before area iteration: {r.BaseStream.Position}");
|
||||
|
||||
t.AreaInfo = new AreaInfo[t.AreaArrayLength];
|
||||
|
||||
for (int i = 0; i < t.AreaArrayLength; i++)
|
||||
{
|
||||
uint offset = (uint)r.BaseStream.Position;
|
||||
|
||||
float xpos = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0); // Reverse byte order - use big endian
|
||||
float zpos = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float area_size = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float min_terrain_height = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float max_terrain_height = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float min_water_height = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
float max_water_height = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
uint unk_1 = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
if (unk_1 == 0)
|
||||
{ // If this unknown isn't equal to 2, skip the extra byte coming after it
|
||||
uint next_val = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
if (next_val == 1) //if the next value is extra unneeded info
|
||||
{
|
||||
|
||||
} else //else, if the value is valid
|
||||
{
|
||||
r.BaseStream.Seek(-4, SeekOrigin.Current);
|
||||
}
|
||||
}
|
||||
|
||||
uint file_base = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
uint unk_2 = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
uint unk_3 = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
uint ref_extra = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
AreaInfo areaInfo = new AreaInfo(xpos, zpos, area_size, min_terrain_height, max_terrain_height, min_water_height,
|
||||
max_water_height, unk_1, file_base, unk_2, unk_3, ref_extra);
|
||||
|
||||
areaInfo.Offset = offset;
|
||||
|
||||
uint extra_info_len = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0); //Usually 0, 4, or 8
|
||||
|
||||
if (ref_extra == 4) {
|
||||
if (extra_info_len == 8)
|
||||
{ //Skip the extra "20" after the 8, as well as the extra info
|
||||
areaInfo.HasGrass = true;
|
||||
areaInfo.HasWater = true;
|
||||
r.BaseStream.Seek(36, SeekOrigin.Current);
|
||||
}
|
||||
else //If the length is 4
|
||||
{
|
||||
var bytes = r.ReadBytes(16).Reverse().ToArray();
|
||||
if (bytes[1] == 0) //If the 2nd byte is 0
|
||||
areaInfo.HasGrass = true;
|
||||
else //Else if the 2nd byte should be anything else (should always be 1)
|
||||
areaInfo.HasWater = true;
|
||||
}
|
||||
} else //If the extra info flags aren't set, go back 4
|
||||
{
|
||||
r.BaseStream.Seek(-4, SeekOrigin.Current);
|
||||
}
|
||||
|
||||
t.AreaInfo[i] = areaInfo;
|
||||
}
|
||||
|
||||
BOTWConsole.Log($"Offset after area iteration: {r.BaseStream.Position} (should be {t.FileBaseOffset + 16})");
|
||||
|
||||
//Get the number of filenames by getting how many bytes they take up out of the entire file size
|
||||
var filenames_count = (r.BaseStream.Length - (t.FileBaseOffset + 16)) / 12;
|
||||
|
||||
BOTWConsole.Log($"Filename count: {filenames_count} (should be {t.AreaArrayLength})");
|
||||
|
||||
t.FileNames = new string[filenames_count];
|
||||
|
||||
r.BaseStream.Seek(t.FileBaseOffset + 16, SeekOrigin.Begin); // TODO: change this to 'current' later, or maybe even remove
|
||||
|
||||
for (int i = 0; i < filenames_count; i++)
|
||||
{
|
||||
string filename = new string(r.ReadChars(12));
|
||||
|
||||
t.FileNames[i] = filename;
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FileNotFoundException("Cannot find .tscb file to read.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
botw-toolset/IO/TSCB/TSCBInfo.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace BOTWToolset.IO.TSCB
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for a TCSB file.
|
||||
/// </summary>
|
||||
public class TSCBInfo
|
||||
{
|
||||
public const byte HeaderLength = 48; // Length of the header, in bytes
|
||||
|
||||
public string Signature { get => _signature; set => _signature = value; }
|
||||
private string _signature;
|
||||
|
||||
public uint Version { get => _version; set => _version = value; }
|
||||
private uint _version;
|
||||
|
||||
public uint FileBaseOffset { get => _fileBaseOffset; set => _fileBaseOffset = value; }
|
||||
private uint _fileBaseOffset;
|
||||
|
||||
public float WorldScale { get => _worldScale; set => _worldScale = value.Clamp(0f, 800.0f); }
|
||||
private float _worldScale;
|
||||
|
||||
public float TerrainMaxHeight { get => _terrainMaxHeight; set => _terrainMaxHeight = value.Clamp(0f, 800.0f); }
|
||||
private float _terrainMaxHeight;
|
||||
|
||||
public uint MaterialInfoLength { get => _materialInfoLength; set => _materialInfoLength = value; }
|
||||
private uint _materialInfoLength;
|
||||
|
||||
public MaterialInfo[] MaterialInfo;
|
||||
|
||||
public uint AreaArrayLength { get => _areaArrayLength; set => _areaArrayLength = value; }
|
||||
private uint _areaArrayLength;
|
||||
|
||||
public AreaInfo[] AreaInfo;
|
||||
|
||||
public float TileSize;
|
||||
|
||||
public string[] FileNames;
|
||||
|
||||
public void SetHeaderInfo(BinaryReader r)
|
||||
{
|
||||
Signature = new string(r.ReadChars(4));
|
||||
Version = r.ReadUInt32();
|
||||
|
||||
r.BaseStream.Seek(4, SeekOrigin.Current); // Skip 4 bytes of "00 00 00 01"
|
||||
|
||||
FileBaseOffset = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0); // Reverse byte order - use big endian
|
||||
WorldScale = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
TerrainMaxHeight = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
MaterialInfoLength = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
AreaArrayLength = BitConverter.ToUInt32(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
r.BaseStream.Seek(8, SeekOrigin.Current);// Skip 8 bytes of padding
|
||||
|
||||
TileSize = BitConverter.ToSingle(r.ReadBytes(4).Reverse().ToArray(), 0);
|
||||
|
||||
r.BaseStream.Seek(4, SeekOrigin.Current); // Skip 4 bytes of "00 00 00 08"
|
||||
}
|
||||
}
|
||||
}
|
||||
25
botw-toolset/MathExt.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
|
||||
namespace BOTWToolset
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for Math.
|
||||
/// </summary>
|
||||
static class MathExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Clamps a value into a minimum and maximum range.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="val">Value to clamp.</param>
|
||||
/// <param name="min">The minimum value to use.</param>
|
||||
/// <param name="max">The maximum value to use.</param>
|
||||
/// <returns></returns>
|
||||
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
|
||||
{
|
||||
if (val.CompareTo(min) < 0) return min;
|
||||
else if (val.CompareTo(max) > 0) return max;
|
||||
else return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
botw-toolset/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("botw-toolset")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("botw-toolset")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
botw-toolset/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BOTWToolset.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BOTWToolset.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
botw-toolset/Properties/Resources.resx
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
botw-toolset/Properties/Settings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BOTWToolset.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
botw-toolset/Properties/Settings.settings
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
botw-toolset/Resources/Icons/document.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
botw-toolset/Resources/Icons/letter-z.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
botw-toolset/Resources/Icons/mountain.png
Normal file
|
After Width: | Height: | Size: 5 KiB |
BIN
botw-toolset/Resources/Icons/package.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
botw-toolset/Resources/Icons/speaker.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
botw-toolset/Resources/Icons/text-file-2.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
botw-toolset/Resources/Icons/text-file.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
botw-toolset/Resources/Icons/triforce.png
Normal file
|
After Width: | Height: | Size: 11 KiB |