Skip to content

Commit

Permalink
explicit ue version
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Jun 13, 2023
1 parent 3435897 commit a184a25
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 65 deletions.
2 changes: 1 addition & 1 deletion FModel/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public float AudioPlayerVolume
set => SetProperty(ref _audioPlayerVolume, value);
}

private ELoadingMode _loadingMode = ELoadingMode.Multiple;
private ELoadingMode _loadingMode = ELoadingMode.All;
public ELoadingMode LoadingMode
{
get => _loadingMode;
Expand Down
1 change: 1 addition & 0 deletions FModel/ViewModels/ApplicationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void AvoidEmptyGameDirectoryAndSetEGame(bool bAlreadyLaunched)
if (!result.HasValue || !result.Value) return;

UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDetectedGame.GameDirectory;
// UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDetectedGame.OverridedGame;
if (!bAlreadyLaunched || gameDirectory == gameLauncherViewModel.SelectedDetectedGame.GameDirectory) return;

RestartWithWarning();
Expand Down
4 changes: 1 addition & 3 deletions FModel/ViewModels/CUE4ParseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,8 @@ public Task VerifyConsoleVariables()
FLogger.Text("Additive animations have their reference pose stripped, which will lead to inaccurate preview and export", Constants.WHITE, true));
continue;
case "r.StaticMesh.KeepMobileMinLODSettingOnDesktop":
Provider.Versions["StaticMesh.KeepMobileMinLODSettingOnDesktop"] = boolValue;
continue;
case "r.SkeletalMesh.KeepMobileMinLODSettingOnDesktop":
Provider.Versions["SkeletalMesh.KeepMobileMinLODSettingOnDesktop"] = boolValue;
Provider.Versions[it.Key[2..]] = boolValue;
continue;
}
}
Expand Down
80 changes: 40 additions & 40 deletions FModel/ViewModels/GameSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public class DetectedGame
{
public string GameName { get; set; }
public string GameDirectory { get; set; }
public EGame OverridedGame { get; set; }
public bool IsManual { get; set; }

// the followings are only used when game is manually added
public AesResponse AesKeys { get; set; }
public EGame OverridedGame { get; set; }
public List<FCustomVersion> OverridedCustomVersions { get; set; }
public Dictionary<string, bool> OverridedOptions { get; set; }
public Dictionary<string, KeyValuePair<string, string>> OverridedMapStructTypes { get; set; }
Expand All @@ -42,6 +42,7 @@ public DetectedGame SelectedDetectedGame

private readonly ObservableCollection<DetectedGame> _autoDetectedGames;
public ReadOnlyObservableCollection<DetectedGame> AutoDetectedGames { get; }
public ReadOnlyObservableCollection<EGame> UeGames { get; private set; }

public GameSelectorViewModel(string gameDirectory)
{
Expand All @@ -59,6 +60,8 @@ public GameSelectorViewModel(string gameDirectory)
AddUnknownGame(gameDirectory);
else
SelectedDetectedGame = AutoDetectedGames.FirstOrDefault();

UeGames = new ReadOnlyObservableCollection<EGame>(new ObservableCollection<EGame>(EnumerateUeGames()));
}

/// <summary>
Expand Down Expand Up @@ -97,39 +100,36 @@ public void DeleteSelectedGame()
SelectedDetectedGame = AutoDetectedGames.Last();
}

private IEnumerable<EGame> EnumerateUeGames() => Enum.GetValues<EGame>();

private IEnumerable<DetectedGame> EnumerateDetectedGames()
{
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks");
yield return new DetectedGame { GameName = "Fortnite [LIVE]", GameDirectory = Constants._FN_LIVE_TRIGGER };
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks");
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks");
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks");
yield return GetUnrealEngineGame("AzaleaAlpha", "\\Prospect\\Content\\Paks");
yield return GetUnrealEngineGame("WorldExplorersLive", "\\WorldExplorers\\Content\\Paks");
yield return GetUnrealEngineGame("Newt", "\\g3\\Content\\Paks");
yield return GetUnrealEngineGame("shoebill", "\\SwGame\\Content\\Paks");
yield return GetUnrealEngineGame("Snoek", "\\StateOfDecay2\\Content\\Paks");
yield return GetUnrealEngineGame("a99769d95d8f400baad1f67ab5dfe508", "\\Core\\Platform\\Content\\Paks");
yield return GetUnrealEngineGame("Nebula", "\\BendGame\\Content");
yield return GetUnrealEngineGame("711c5e95dc094ca58e5f16bd48e751d6", "\\MultiVersus\\Content\\Paks");
yield return GetUnrealEngineGame("9361c8c6d2f34b42b5f2f61093eedf48", "\\TslGame\\Content\\Paks");
yield return GetRiotGame("VALORANT", "ShooterGame\\Content\\Paks");
yield return new DetectedGame { GameName = "Valorant [LIVE]", GameDirectory = Constants._VAL_LIVE_TRIGGER };
yield return GetMojangGame("MinecraftDungeons", "\\dungeons\\dungeons\\Dungeons\\Content\\Paks");
yield return GetSteamGame(381210, "\\DeadByDaylight\\Content\\Paks"); // Dead By Daylight
yield return GetSteamGame(578080, "\\TslGame\\Content\\Paks"); // PUBG
yield return GetSteamGame(1172380, "\\SwGame\\Content\\Paks"); // STAR WARS Jedi: Fallen Order™
yield return GetSteamGame(677620, "\\PortalWars\\Content\\Paks"); // Splitgate
yield return GetSteamGame(1172620, "\\Athena\\Content\\Paks"); // Sea of Thieves
yield return GetSteamGame(1665460, "\\pak"); // eFootball 2023
yield return GetRockstarGamesGame("GTA III - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetRockstarGamesGame("GTA San Andreas - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetRockstarGamesGame("GTA Vice City - Definitive Edition", "\\Gameface\\Content\\Paks");
yield return GetLevelInfiniteGame("tof_launcher", "\\Hotta\\Content\\Paks");
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_2);
yield return new DetectedGame { GameName = "Fortnite [LIVE]", GameDirectory = Constants._FN_LIVE_TRIGGER, OverridedGame = EGame.GAME_UE5_2 };
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany);
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21);
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3);
yield return GetUnrealEngineGame("AzaleaAlpha", "\\Prospect\\Content\\Paks", EGame.GAME_UE4_27);
yield return GetUnrealEngineGame("shoebill", "\\SwGame\\Content\\Paks", EGame.GAME_StarWarsJediFallenOrder);
yield return GetUnrealEngineGame("Snoek", "\\StateOfDecay2\\Content\\Paks", EGame.GAME_StateOfDecay2);
yield return GetUnrealEngineGame("711c5e95dc094ca58e5f16bd48e751d6", "\\MultiVersus\\Content\\Paks", EGame.GAME_UE4_26);
yield return GetUnrealEngineGame("9361c8c6d2f34b42b5f2f61093eedf48", "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds);
yield return GetRiotGame("VALORANT", "ShooterGame\\Content\\Paks", EGame.GAME_Valorant);
yield return new DetectedGame { GameName = "Valorant [LIVE]", GameDirectory = Constants._VAL_LIVE_TRIGGER, OverridedGame = EGame.GAME_Valorant };
yield return GetSteamGame(381210, "\\DeadByDaylight\\Content\\Paks", EGame.GAME_UE4_27); // Dead By Daylight
yield return GetSteamGame(578080, "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds); // PUBG
yield return GetSteamGame(1172380, "\\SwGame\\Content\\Paks", EGame.GAME_StarWarsJediFallenOrder); // STAR WARS Jedi: Fallen Order™
yield return GetSteamGame(677620, "\\PortalWars\\Content\\Paks", EGame.GAME_Splitgate); // Splitgate
yield return GetSteamGame(1172620, "\\Athena\\Content\\Paks", EGame.GAME_SeaOfThieves); // Sea of Thieves
yield return GetSteamGame(1665460, "\\pak", EGame.GAME_UE4_26); // eFootball 2023
yield return GetRockstarGamesGame("GTA III - Definitive Edition", "\\Gameface\\Content\\Paks", EGame.GAME_GTATheTrilogyDefinitiveEdition);
yield return GetRockstarGamesGame("GTA San Andreas - Definitive Edition", "\\Gameface\\Content\\Paks", EGame.GAME_GTATheTrilogyDefinitiveEdition);
yield return GetRockstarGamesGame("GTA Vice City - Definitive Edition", "\\Gameface\\Content\\Paks", EGame.GAME_GTATheTrilogyDefinitiveEdition);
yield return GetLevelInfiniteGame("tof_launcher", "\\Hotta\\Content\\Paks", EGame.GAME_TowerOfFantasy);
}

private LauncherInstalled _launcherInstalled;
private DetectedGame GetUnrealEngineGame(string gameName, string pakDirectory)
private DetectedGame GetUnrealEngineGame(string gameName, string pakDirectory, EGame version)
{
_launcherInstalled ??= GetDriveLauncherInstalls<LauncherInstalled>("ProgramData\\Epic\\UnrealEngineLauncher\\LauncherInstalled.dat");
if (_launcherInstalled?.InstallationList != null)
Expand All @@ -140,7 +140,7 @@ private DetectedGame GetUnrealEngineGame(string gameName, string pakDirectory)
if (installationList.AppName.Equals(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in LauncherInstalled.dat", gameName);
return new DetectedGame { GameName = installationList.AppName, GameDirectory = gameDir };
return new DetectedGame { GameName = installationList.AppName, GameDirectory = gameDir, OverridedGame = version };
}
}
}
Expand All @@ -149,7 +149,7 @@ private DetectedGame GetUnrealEngineGame(string gameName, string pakDirectory)
}

private RiotClientInstalls _riotClientInstalls;
private DetectedGame GetRiotGame(string gameName, string pakDirectory)
private DetectedGame GetRiotGame(string gameName, string pakDirectory, EGame version)
{
_riotClientInstalls ??= GetDriveLauncherInstalls<RiotClientInstalls>("ProgramData\\Riot Games\\RiotClientInstalls.json");
if (_riotClientInstalls is { AssociatedClient: { } })
Expand All @@ -160,7 +160,7 @@ private DetectedGame GetRiotGame(string gameName, string pakDirectory)
if (key.Contains(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in RiotClientInstalls.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = gameDir };
return new DetectedGame { GameName = gameName, GameDirectory = gameDir, OverridedGame = version };
}
}
}
Expand All @@ -169,7 +169,7 @@ private DetectedGame GetRiotGame(string gameName, string pakDirectory)
}

private LauncherSettings _launcherSettings;
private DetectedGame GetMojangGame(string gameName, string pakDirectory)
private DetectedGame GetMojangGame(string gameName, string pakDirectory, EGame version)
{
_launcherSettings ??= GetDataLauncherInstalls<LauncherSettings>("\\.minecraft\\launcher_settings.json");
if (_launcherSettings is { ProductLibraryDir: { } })
Expand All @@ -178,26 +178,26 @@ private DetectedGame GetMojangGame(string gameName, string pakDirectory)
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in launcher_settings.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = gameDir };
return new DetectedGame { GameName = gameName, GameDirectory = gameDir, OverridedGame = version };
}
}

return null;
}

private DetectedGame GetSteamGame(int id, string pakDirectory)
private DetectedGame GetSteamGame(int id, string pakDirectory, EGame version)
{
var steamInfo = SteamDetection.GetSteamGameById(id);
if (steamInfo is not null)
{
Log.Debug("Found {GameName} in steam manifests", steamInfo.Name);
return new DetectedGame { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}" };
return new DetectedGame { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}", OverridedGame = version };
}

return null;
}

private DetectedGame GetRockstarGamesGame(string key, string pakDirectory)
private DetectedGame GetRockstarGamesGame(string key, string pakDirectory, EGame version)
{
var installLocation = string.Empty;
try
Expand All @@ -213,13 +213,13 @@ private DetectedGame GetRockstarGamesGame(string key, string pakDirectory)
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = key, GameDirectory = gameDir };
return new DetectedGame { GameName = key, GameDirectory = gameDir, OverridedGame = version };
}

return null;
}

private DetectedGame GetLevelInfiniteGame(string key, string pakDirectory)
private DetectedGame GetLevelInfiniteGame(string key, string pakDirectory, EGame version)
{
var installLocation = string.Empty;
var displayName = string.Empty;
Expand All @@ -238,7 +238,7 @@ private DetectedGame GetLevelInfiniteGame(string key, string pakDirectory)
if (Directory.Exists(gameDir))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = displayName, GameDirectory = gameDir };
return new DetectedGame { GameName = displayName, GameDirectory = gameDir, OverridedGame = version };
}

return null;
Expand Down
41 changes: 25 additions & 16 deletions FModel/Views/DirectorySelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,45 @@
Padding="{adonisUi:Space 0}" Background="Transparent">
<StackPanel>
<Grid Margin="0 5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" Text="Detected Game" VerticalAlignment="Center" />
<ComboBox Grid.Column="2" ItemsSource="{Binding AutoDetectedGames}"
<TextBlock Grid.Row="0" Grid.Column="0" Text="Detected Game" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding AutoDetectedGames}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDetectedGame, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding GameName, Converter={x:Static converters:StringToGameConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<Grid x:Name="Hello" Margin="0 0 0 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBox Grid.Column="0" Text="{Binding SelectedDetectedGame.GameDirectory, Mode=TwoWay}" />
<Button Grid.Column="2" Content="..." HorizontalAlignment="Right" Click="OnBrowseDirectories" />
<Button Grid.Column="3" Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}" Padding="0"
Click="OnDeleteDirectory" Width="{Binding ActualWidth, ElementName=OkGuysButWhoFuckingAsked}"
Visibility="{Binding SelectedDetectedGame.IsManual, Converter={StaticResource BoolToVisibilityConverter}}"
ToolTip="Delete Game" Margin="5 0 0 0">
<TextBlock Grid.Row="1" Grid.Column="0" Text="UE Versions" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding UeGames}" Margin="0 0 0 5"
VerticalAlignment="Center" SelectedItem="{Binding SelectedDetectedGame.OverridedGame, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={x:Static converters:EnumToStringConverter.Instance}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

<TextBlock Grid.Row="2" Grid.Column="0" Text="Directory" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="2" Text="{Binding SelectedDetectedGame.GameDirectory, Mode=TwoWay}" />
<Button Grid.Row="2" Grid.Column="4" Content="..." HorizontalAlignment="Right" Click="OnBrowseDirectories" />
<Button Grid.Row="2" Grid.Column="4" Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}" Padding="0"
Click="OnDeleteDirectory" Width="{Binding ActualWidth, ElementName=OkGuysButWhoFuckingAsked}" ToolTip="Delete Game"
Visibility="{Binding SelectedDetectedGame.IsManual, Converter={StaticResource BoolToVisibilityConverter}}">
<Viewbox Width="16" Height="16" HorizontalAlignment="Center">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource RemoveIcon}" />
Expand Down
4 changes: 2 additions & 2 deletions FModel/Views/DirectorySelector.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void OnBrowseManualDirectories(object sender, RoutedEventArgs e)

private void OnAddDirectory(object sender, RoutedEventArgs e)
{
if (DataContext is not GameSelectorViewModel gameLauncherViewModel||
if (DataContext is not GameSelectorViewModel gameLauncherViewModel ||
string.IsNullOrEmpty(HelloMyNameIsGame.Text) ||
string.IsNullOrEmpty(HelloGameMyNameIsDirectory.Text))
return;
Expand All @@ -61,4 +61,4 @@ private void OnDeleteDirectory(object sender, RoutedEventArgs e)

gameLauncherViewModel.DeleteSelectedGame();
}
}
}
Loading

0 comments on commit a184a25

Please sign in to comment.