Skip to content
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
23 changes: 23 additions & 0 deletions FASTER/Models/ServerCfg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;

namespace FASTER.Models
Expand Down Expand Up @@ -93,6 +94,8 @@ public class ServerCfg : INotifyPropertyChanged
private uint maxMem = 1024;
private bool cpuCountOverride;
private ushort cpuCount;
private bool bePathOverride;
private string bePath;
private string commandLineParams;

private string serverCfgContent;
Expand Down Expand Up @@ -770,6 +773,16 @@ public bool CpuCountOverride
}
}

public bool EnableCustomBePath
{
get => bePathOverride;
set
{
bePathOverride = value;
RaisePropertyChanged("EnableCustomBePath");
}
}

public uint MaxMem
{
get => maxMem;
Expand All @@ -779,6 +792,16 @@ public uint MaxMem
RaisePropertyChanged("MaxMem");
}
}

public string CustomBePath
{
get => bePath;
set
{
bePath = value;
RaisePropertyChanged("CustomBePath");
}
}

public ushort CpuCount
{
Expand Down
86 changes: 86 additions & 0 deletions FASTER/Models/ServerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class ServerProfile : INotifyPropertyChanged
private bool _efDlcChecked;
private bool _enableHT = true;
private bool _enableRanking;
private bool _enableHugePages;
private bool _loadMissionToMemory;

private List<ProfileMod> _profileMods = new List<ProfileMod>();
private string _profileModsFilter = "";
Expand All @@ -75,6 +77,12 @@ public class ServerProfile : INotifyPropertyChanged
private Arma3Profile _armaProfile;
private BasicCfg _basicCfg;

private bool _enableExThreads;
private bool _exThreadGeometry;
private bool _exThreadTextures;
private bool _exThreadFiles;
private byte _exThreads = 0;

//PUBLIC VAR DECLARATIONS
public string Id
{
Expand Down Expand Up @@ -234,6 +242,75 @@ public bool EnableHyperThreading
RaisePropertyChanged("EnableHyperThreading");
}
}

public bool EnableHugePages
{
get => _enableHugePages;
set
{
_enableHugePages = value;
RaisePropertyChanged("EnableHugePages");
}
}

public bool EnableLoadMissionToMemory
{
get => _loadMissionToMemory;
set
{
_loadMissionToMemory = value;
RaisePropertyChanged("EnableLoadMissionToMemory");
}
}

public bool EnableExtraThreads
{
get => _enableExThreads;
set
{
_enableExThreads = value;
RaisePropertyChanged("EnableExtraThreads");
}
}

public bool ExThreadGeometry
{
get => _exThreadGeometry;
set
{
_exThreadGeometry = value;
RaisePropertyChanged("ExThreadGeometry");
}
}

public bool ExThreadTextures
{
get => _exThreadTextures;
set
{
_exThreadTextures = value;
RaisePropertyChanged("ExThreadTextures");
}
}

public bool ExThreadFiles
{
get => _exThreadFiles;
set
{
_exThreadFiles = value;
RaisePropertyChanged("ExThreadFiles");
}
}

public void ProcessExThreads()
{
_exThreads = (byte)(
(_exThreadFiles ? 1 : 0) |
(_exThreadTextures ? 2 : 0) |
(_exThreadGeometry ? 4 : 0)
);
}

public bool RankingChecked
{
Expand Down Expand Up @@ -547,6 +624,10 @@ private string GetCommandLine()
$"{(ServerCfg.AutoInit ? " -autoInit" : "")}",
$"{(ServerCfg.MaxMemOverride ? $" -maxMem={ServerCfg.MaxMem}" : "")}",
$"{(ServerCfg.CpuCountOverride ? $" -cpuCount={ServerCfg.CpuCount}" : "")}",
$"{(EnableHugePages ? " -hugePages" : "")}",
$"{(EnableExtraThreads ? $" -exThreads={_exThreads}" : "")}",
$"{(EnableLoadMissionToMemory ? $" -loadMissionToMemory" : "")}",
$"{(ServerCfg.EnableCustomBePath && !string.IsNullOrWhiteSpace(ServerCfg.CustomBePath) && Path.Exists(ServerCfg.CustomBePath) ? $" -bePath=\"{ServerCfg.CustomBePath}\"" : "")}",
$"{(!string.IsNullOrWhiteSpace(ServerCfg.CommandLineParameters) ? $" {ServerCfg.CommandLineParameters}" : "")}"
};

Expand All @@ -571,6 +652,11 @@ private void Class_PropertyChanged(object sender, PropertyChangedEventArgs e)
public event PropertyChangedEventHandler PropertyChanged;
internal void RaisePropertyChanged(string property)
{
if (property == "ExThreadGeometry" || property == "ExThreadTextures" || property == "ExThreadFiles")
{
ProcessExThreads();
}

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
if(property != "CommandLine")
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CommandLine)));
Expand Down
10 changes: 10 additions & 0 deletions FASTER/ViewModel/ProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ internal void SelectServerFile()
{ MessageBox.Show("Please enter a valid arma3server executable location"); }
}

internal void SelectCustomBePath()
{
var path = MainWindow.Instance.SelectFolder(Properties.Settings.Default.serverPath);

if (path == null)
return;

Profile.ServerCfg.CustomBePath = path;
}

internal async Task CopyModKeys()
{
var mods = new List<string>();
Expand Down
57 changes: 55 additions & 2 deletions FASTER/Views/Profile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,11 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="20"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="20"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="20"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<mah:NumericUpDown Grid.Row="0" Grid.Column="0" Value="{Binding Profile.BasicCfg.MinBandwidth, UpdateSourceTrigger=PropertyChanged}" mah:TextBoxHelper.Watermark="MinBandwidth" mah:TextBoxHelper.UseFloatingWatermark="True" Minimum="0" Maximum="18446744073709551615" Interval="1" Margin="3"/>
<mah:NumericUpDown Grid.Row="0" Grid.Column="1" Value="{Binding Profile.BasicCfg.MaxPacketSize, UpdateSourceTrigger=PropertyChanged}" mah:TextBoxHelper.Watermark="MaxPacketSize" mah:TextBoxHelper.UseFloatingWatermark="True" Minimum="0" Maximum="4294967295" Interval="1" Margin="3"/>
Expand All @@ -883,11 +888,59 @@
<mah:NumericUpDown Grid.Row="6" Grid.Column="2" Value="{Binding Profile.BasicCfg.ViewDistance, UpdateSourceTrigger=PropertyChanged}" mah:TextBoxHelper.Watermark="Server View Distance" mah:TextBoxHelper.UseFloatingWatermark="True" Minimum="0" Maximum="50000" Interval="1" Margin="3,3,3,3"/>

<CheckBox Grid.Row="8" Grid.Column="0" Margin="3,5" IsChecked="{Binding Path=Profile.ServerCfg.MaxMemOverride, UpdateSourceTrigger=PropertyChanged}" Content="Force Maximum Memory"/>
<CheckBox Grid.Row="8" Grid.Column="1" Margin="3,5" IsChecked="{Binding Path=Profile.EnableHyperThreading, UpdateSourceTrigger=PropertyChanged}" Content="Enable Hyper Threading"/>
<CheckBox Grid.Row="8" Grid.Column="1" Margin="3,5" IsChecked="{Binding Path=Profile.ServerCfg.EnableCustomBePath, UpdateSourceTrigger=PropertyChanged}" Content="Enable Custom bePath"/>
<CheckBox Grid.Row="8" Grid.Column="2" Margin="3,5" IsChecked="{Binding Path=Profile.ServerCfg.CpuCountOverride, UpdateSourceTrigger=PropertyChanged}" Content="Force CPU Count"/>
<mah:NumericUpDown Grid.Row="9" Grid.Column="0" Value="{Binding Profile.ServerCfg.MaxMem, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding Path=Profile.ServerCfg.MaxMemOverride, Converter={StaticResource BoolToVis}}" mah:TextBoxHelper.Watermark="Maximum Memory (MB)" mah:TextBoxHelper.UseFloatingWatermark="True" Minimum="1024" Maximum="128000" Interval="1" Margin="3,3,3,-11"/>
<Grid Grid.Row="9" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
Visibility="{Binding Path=Profile.ServerCfg.EnableCustomBePath, Converter={StaticResource BoolToVis}}"
Text="{Binding Profile.ServerCfg.CustomBePath, UpdateSourceTrigger=PropertyChanged}"
mah:TextBoxHelper.Watermark="BattlEye Path"
mah:TextBoxHelper.UseFloatingWatermark="True"
Margin="3,3,3,-11"/>
<Button Grid.Column="1"
Visibility="{Binding Path=Profile.ServerCfg.EnableCustomBePath, Converter={StaticResource BoolToVis}}"
Content="{iconPacks:Modern Kind=Folder}"
Style="{StaticResource MahApps.Styles.Button.MetroSquare.Accent}"
BorderThickness="0"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Height="auto"
Margin="5,0"
Padding="2"
Click="SelectCustomBePath"/>

</Grid>
<mah:NumericUpDown Grid.Row="9" Grid.Column="2" Value="{Binding Profile.ServerCfg.CpuCount, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding Path=Profile.ServerCfg.CpuCountOverride, Converter={StaticResource BoolToVis}}" mah:TextBoxHelper.Watermark="CPU Core Count" mah:TextBoxHelper.UseFloatingWatermark="True" Minimum="1" Maximum="34" Interval="1" Margin="3,3,3,-11"/>
<TextBox Text="{Binding Profile.ServerCfg.CommandLineParameters, UpdateSourceTrigger=PropertyChanged}" Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="3" Margin="3,5" mah:TextBoxHelper.Watermark="Command Line Arguments" mah:TextBoxHelper.UseFloatingWatermark="True"/>
<CheckBox Grid.Row="11" Grid.Column="0" Margin="3,5" IsChecked="{Binding Path=Profile.EnableHyperThreading, UpdateSourceTrigger=PropertyChanged}" Content="Enable Hyper Threading"/>
<CheckBox Grid.Row="11" Grid.Column="1" Margin="3,5" IsChecked="{Binding Path=Profile.EnableExtraThreads, UpdateSourceTrigger=PropertyChanged}" Content="Enable Extra Threads"/>
<CheckBox Grid.Row="11" Grid.Column="2" Margin="3,5" IsChecked="{Binding Path=Profile.EnableHugePages, UpdateSourceTrigger=PropertyChanged}" Content="Enable Huge Pages"/>
<Grid Grid.Row="12" Grid.Column="1" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0"
Visibility="{Binding Path=Profile.EnableExtraThreads, Converter={StaticResource BoolToVis}}"
IsChecked="{Binding Path=Profile.ExThreadGeometry, UpdateSourceTrigger=PropertyChanged}"
Content="Geometry"/>
<CheckBox Grid.Column="1"
Visibility="{Binding Path=Profile.EnableExtraThreads, Converter={StaticResource BoolToVis}}"
IsChecked="{Binding Path=Profile.ExThreadTextures, UpdateSourceTrigger=PropertyChanged}"
Content="Textures"/>
<CheckBox Grid.Column="2"
Visibility="{Binding Path=Profile.EnableExtraThreads, Converter={StaticResource BoolToVis}}"
IsChecked="{Binding Path=Profile.ExThreadFiles, UpdateSourceTrigger=PropertyChanged}"
Content="Files"/>
</Grid>
<CheckBox Grid.Row="14" Grid.Column="0" Margin="3,5" IsChecked="{Binding Path=Profile.EnableLoadMissionToMemory, UpdateSourceTrigger=PropertyChanged}" Content="Load Mission To Memory"/>
<TextBox Text="{Binding Profile.ServerCfg.CommandLineParameters, UpdateSourceTrigger=PropertyChanged}" Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="3" Margin="3,5" mah:TextBoxHelper.Watermark="Command Line Arguments" mah:TextBoxHelper.UseFloatingWatermark="True"/>
</Grid>
</GroupBox>
<Grid Grid.Row="1">
Expand Down
5 changes: 5 additions & 0 deletions FASTER/Views/Profile.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ private void SelectServerFile(object sender, RoutedEventArgs e)
{
((ProfileViewModel) DataContext)?.SelectServerFile();
}

private void SelectCustomBePath(object sender, RoutedEventArgs e)
{
((ProfileViewModel) DataContext)?.SelectCustomBePath();
}

private void OpenProfileLocation(object sender, RoutedEventArgs e)
{
Expand Down
Loading