Skip to content

Commit

Permalink
Merge pull request #54 from Pepper-Man/master
Browse files Browse the repository at this point in the history
Add support for custom FMOD banks for H3, ODST and Reach
  • Loading branch information
num0005 authored May 9, 2024
2 parents 480e9fa + f13e0ce commit 50ec885
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 11 deletions.
9 changes: 6 additions & 3 deletions Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="{Binding SelectedIndex, Converter={StaticResource ToolkitToSpaceConverter}, ConverterParameter=7, ElementName=toolkit_selection}"/>
<ColumnDefinition Width="{Binding SelectedIndex, Converter={StaticResource ToolkitToSpaceConverter}, ConverterParameter=9, ElementName=toolkit_selection}"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="0" x:Name="class_type" Header="Class" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding SelectedIndex, Converter={StaticResource ProfiletoVisibility}, ConverterParameter=12, ElementName=toolkit_selection}">
<ComboBox x:Name="class_dropdown" ItemsSource="{Binding SelectedIndex, Converter={StaticResource ProfiletoContent}, ConverterParameter=15, ElementName=toolkit_selection}" SelectedIndex="0" VerticalAlignment="Center" ToolTip="Select the class to set for the sound on first import."/>
Expand All @@ -812,13 +812,16 @@
<ComboBoxItem Content="Multi Layer"/>
</ComboBox>
</GroupBox>
<GroupBox Grid.Column="4" x:Name="compression_box" Header="Compression Type" VerticalAlignment="Stretch" Visibility="{Binding SelectedIndex, Converter={StaticResource ProfiletoVisibility}, ConverterParameter=6, ElementName=toolkit_selection}">
<GroupBox Grid.Column="4" x:Name="compression_box" Header="Compression Type" VerticalAlignment="Stretch" Visibility="{Binding SelectedIndex, Converter={StaticResource ProfiletoVisibility}, ConverterParameter=6, ElementName=toolkit_selection}">
<ComboBox x:Name="sound_compression_type" VerticalAlignment="Center" SelectedIndex="2" ToolTip="Select the compression type to use for the sound.">
<ComboBoxItem Content="Uncompressed"/>
<ComboBoxItem Content="ADPCM"/>
<ComboBoxItem Content="Opus"/>
</ComboBox>
</GroupBox>
<GroupBox Grid.Column="4" x:Name="custom_bank_box" Header="Custom Bank Extension" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding SelectedIndex, Converter={StaticResource ProfiletoVisibility}, ConverterParameter=26, ElementName=toolkit_selection}">
<TextBox x:Name="bank_extension" VerticalAlignment="Center" ToolTip="Enter a custom FMOD bank extension. Will be created if it does not exist. Leave blank to use default SFX/Language FMODs." BorderBrush="{StaticResource brushWatermarkBorder}" Foreground="{DynamicResource TextColor}" Background="{DynamicResource brushTextboxBackground}" CaretBrush="{DynamicResource TextColor}" MinHeight="22" MaxHeight="22"></TextBox>
</GroupBox>
</Grid>
<Grid Grid.Row="6">
<Button x:Name="import_sound" Content="Import Sound" VerticalAlignment="Bottom" Click="import_sound_Click" IsEnabled="{Binding Text.Length, ElementName=import_sound_path, Mode=OneWay}" ToolTip="Import the sound!"/>
Expand Down
3 changes: 2 additions & 1 deletion Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,12 +1220,13 @@ private async void import_sound_Click(object sender, RoutedEventArgs e)
sound_command_type sound_command = (sound_command_type)sound_import_type.SelectedIndex;
codec_type platform = (codec_type)platform_type.SelectedIndex;
string class_name = class_dropdown.SelectedItem.ToString();
string custom_extension = bank_extension.Text.ToString();

string sound_path = import_sound_path.Text;
string bitrate_value = bitrate_slider.Value.ToString();
string ltf_path = "data\\" + import_ltf_path.Text;

await toolkit.ImportSound(sound_path, platform.ToString(), bitrate_value, ltf_path, sound_command.ToString(), class_name, ((ComboBoxItem)sound_compression_type.SelectedItem).Content.ToString().ToLower());
await toolkit.ImportSound(sound_path, platform.ToString(), bitrate_value, ltf_path, sound_command.ToString(), class_name, ((ComboBoxItem)sound_compression_type.SelectedItem).Content.ToString().ToLower(), custom_extension);
}

private void spaces_PreviewKeyDown(object sender, KeyEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion Launcher/ToolkitInterface/H1Toolkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public override async Task ImportModel(string path, ModelCompile importType, boo
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type)
public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type, string custom_extension)
{
await RunTool(ToolType.Tool, new List<string>() { "sounds", path, platform, bitrate });
}
Expand Down
2 changes: 1 addition & 1 deletion Launcher/ToolkitInterface/H2AToolkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public override async Task ImportModel(string path, ModelCompile importType, boo
await RunTool(ToolType.Tool, args, true);
}

public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type)
public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type, string custom_extension)
{
await RunTool(ToolType.Tool, new List<string>() { sound_command.Replace("_", "-"), path, class_type, compression_type });
}
Expand Down
2 changes: 1 addition & 1 deletion Launcher/ToolkitInterface/H2Toolkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public override async Task ImportModel(string path, ModelCompile importType, boo
await RunTool(ToolType.Tool, new List<string>() { "append-animations", path });
}

public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type)
public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type, string custom_extension)
{
await RunTool(ToolType.Tool, new List<string>() { "import-lipsync", path, ltf_path });
}
Expand Down
11 changes: 9 additions & 2 deletions Launcher/ToolkitInterface/H3Toolkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,16 @@ public static List<string> ImportAnimations(bool FPAnim, bool verboseAnim, bool
return args;
}

public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type)
public override async Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type, string custom_extension)
{
await RunTool(ToolType.Tool, new List<string>() { sound_command.Replace("_", "-"), path, class_type });
if (string.IsNullOrWhiteSpace(custom_extension))
{
await RunTool(ToolType.Tool, new List<string>() { sound_command.Replace("_", "-"), path, class_type });
}
else
{
await RunTool(ToolType.Tool, new List<string>() { sound_command.Replace("_", "-"), path, class_type, "-bank:" + custom_extension.ToLower() });
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Launcher/ToolkitInterface/ToolkitBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public enum ResourceMapUsage
/// <param name="class_type"></param>
/// <param name="compression_type"></param>
/// <returns></returns>
public abstract Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type);
public abstract Task ImportSound(string path, string platform, string bitrate, string ltf_path, string sound_command, string class_type, string compression_type, string custom_extension);

/// <summary>
/// Check whatever there is mutex preventing another instance of a tool from starting
Expand Down
13 changes: 12 additions & 1 deletion Launcher/UIHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ public override object Convert(object value, Type targetType, object parameter,
else
grid = new GridLength(1, (double)GridUnitType.Auto);
}
else if (parameter is string && Int32.Parse(parameter as string) == 23)
{
if (MainWindow.halo_3 || MainWindow.halo_3_odst || MainWindow.halo_reach)
grid = new GridLength(8);
}
}
else
{
Expand All @@ -294,7 +299,8 @@ public override object Convert(object value, Type targetType, object parameter,
|| parameter is string && Int32.Parse(parameter as string) == 19
|| parameter is string && Int32.Parse(parameter as string) == 20
|| parameter is string && Int32.Parse(parameter as string) == 21
|| parameter is string && Int32.Parse(parameter as string) == 22)
|| parameter is string && Int32.Parse(parameter as string) == 22
|| parameter is string && Int32.Parse(parameter as string) == 23)
{
grid = new GridLength(1, GridUnitType.Star);
}
Expand Down Expand Up @@ -468,6 +474,11 @@ public override object Convert(object value, Type targetType, object parameter,
if (MainWindow.halo_3 || MainWindow.halo_3_odst)
vis = Visibility.Visible;
}
else if (parameter is string && Int32.Parse(parameter as string) == 26)
{
if (MainWindow.halo_3 || MainWindow.halo_3_odst || MainWindow.halo_reach)
vis = Visibility.Visible;
}
}
else
{
Expand Down

0 comments on commit 50ec885

Please sign in to comment.