Skip to content
Merged
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
8 changes: 7 additions & 1 deletion Knossos.NET/Classes/Knossos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ private static void AutoUpdateBuilds()
/// <param name="fsoExecType"></param>
/// <param name="standaloneServer"></param>
/// <param name="standalonePort"></param>
public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standaloneServer = false, int standalonePort = 0)
public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standaloneServer = false, int standalonePort = 0, bool vrMode = false)
{
if (TaskViewModel.Instance!.IsSafeState() == false)
{
Expand Down Expand Up @@ -801,6 +801,12 @@ public static async void PlayMod(Mod mod, FsoExecType fsoExecType, bool standalo
var modList = new List<Mod>();
FsoBuild? fsoBuild = null;

/* VR Mode Stuff */
if(vrMode)
{
cmdline += " -vr";
}

/* Resolve Dependencies should be all valid at this point */
var dependencyList = mod.GetModDependencyList(false,true);
bool hasBuildDependency = false;
Expand Down
29 changes: 29 additions & 0 deletions Knossos.NET/ViewModels/Templates/ModCardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading.Tasks;
using System.Linq;
using Avalonia.Threading;
using System.Diagnostics;

namespace Knossos.NET.ViewModels
{
Expand Down Expand Up @@ -222,14 +223,42 @@ internal void ButtonCommand(object command)
switch((string)command)
{
case "play" : Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.Release); break;
case "playvr": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.Release, false, 0, true); break;
case "fred2": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.Fred2); break;
case "fred2debug": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.Fred2Debug); break;
case "debug": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.Debug); break;
case "qtfred": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.QtFred); break;
case "qtfreddebug": Knossos.PlayMod(modVersions[activeVersionIndex], FsoExecType.QtFredDebug); break;
case "update": ButtonCommandUpdate(); break;
case "modify": ButtonCommandModify(); break;
case "delete": ButtonCommandDelete(); break;
case "details": ButtonCommandDetails(); break;
case "settings": ButtonCommandSettings(); break;
case "logfile": OpenFS2Log(); break;
}
}

private void OpenFS2Log()
{
if (File.Exists(KnUtils.GetFSODataFolderPath() + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "fs2_open.log"))
{
try
{
var cmd = new Process();
cmd.StartInfo.FileName = Path.Combine(KnUtils.GetFSODataFolderPath(), "data", "fs2_open.log");
cmd.StartInfo.UseShellExecute = true;
cmd.Start();
cmd.Dispose();
}
catch (Exception ex)
{
Log.Add(Log.LogSeverity.Error, "ModCardViewModel.OpenFS2Log", ex);
}
}
else
{
if (MainWindow.instance != null)
MessageBox.Show(MainWindow.instance, "Log File " + Path.Combine(KnUtils.GetFSODataFolderPath(), "data", "fs2_open.log") + " not found.", "File not found", MessageBox.MessageBoxButtons.OK);
}
}

Expand Down
19 changes: 15 additions & 4 deletions Knossos.NET/Views/Templates/ModCardView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Label Content="{Binding ModVersion}" FontWeight="Bold" FontSize="14" Width="150" VerticalContentAlignment="Top" HorizontalContentAlignment="Center" Foreground="White"/>
<!--Installed Overlay-->
<TabControl Margin="0,-12,0,0">
<TabItem>
<TabItem Margin="-3, 0, 0, 0">
<TabItem.Header>
<Label FontWeight="Bold" FontSize="11" Foreground="White">Main</Label>
</TabItem.Header>
Expand All @@ -51,17 +51,28 @@
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Margin="-5, 0, 0 0" >
<TabItem Margin="-14, 0, 0, 0" >
<TabItem.Header>
<Label FontWeight="Bold" FontSize="11" Foreground="White">Advanced</Label>
<Label FontWeight="Bold" FontSize="11" Foreground="White">Adv</Label>
</TabItem.Header>
<StackPanel Margin="5">
<Button Command="{Binding ButtonCommand}" CommandParameter="debug" Content="FSO Debug" Classes="Primary Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="100" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="playvr" Content="Play in VR" Classes="Accept Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="100" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="fred2" Content="Fred2" Classes="Secondary Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="100" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="qtfred" Content="QtFred" Classes="Settings Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="100" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="delete" Content="Delete" Classes="Cancel Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="100" ></Button>
</StackPanel>
</TabItem>
<TabItem Margin="-15, 0, 0, 0" >
<TabItem.Header>
<Label FontWeight="Bold" FontSize="11" Foreground="White">Debug</Label>
</TabItem.Header>
<StackPanel Margin="5">
<Button Command="{Binding ButtonCommand}" CommandParameter="debug" Content="FSO Debug" Classes="Primary Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="115" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="fred2debug" Content="Fred2 Debug" Classes="Secondary Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="115" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="qtfreddebug" Content="QtFred Debug" Classes="Settings Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="115" ></Button>
<Button Command="{Binding ButtonCommand}" CommandParameter="logfile" Content="Open Logfile" Classes="Quaternary Rounded" HorizontalAlignment="Center" Margin="0,2,0,0" Width="115" ></Button>
</StackPanel>
</TabItem>
</TabControl>
<!--Special Icons-->
<WrapPanel Margin="0,0,0,8" ZIndex="2" HorizontalAlignment="Center" VerticalAlignment="Center">
Expand Down