Skip to content

Commit

Permalink
tools: launch UB from the config tool
Browse files Browse the repository at this point in the history
  • Loading branch information
lahm86 committed Mar 15, 2023
1 parent c95e2a8 commit e7a6bb7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased](https://github.com/rr-/Tomb1Main/compare/stable...develop)
- added Spanish localization to the config tool
- added an option to launch Unfinished Business from the config tool (#739)
- fixed Larson's gun textures in Tomb of Qualopec to match the cutscene and Sanctuary of the Scion (#737)
- fixed texture issues in the Cowboy, Kold and Skateboard Kid models (#744)
- fixed the savegame requestor arrow's position with a large number of savegames and long level titles (#756)
Expand Down
8 changes: 8 additions & 0 deletions tools/config/Tomb1Main_ConfigTool/Controls/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="SSG"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="SSG"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="SSG"/>
</Grid.ColumnDefinitions>

Expand All @@ -193,6 +194,13 @@
<Button
Grid.Column="2"
Margin="7,0,0,0"
Command="{Binding LaunchUBCommand}"
Content="{Binding ViewText[command_launch_ub]}"
Style="{StaticResource ButtonStyle}"/>

<Button
Grid.Column="3"
Margin="7,0,0,0"
Command="{Binding ExitCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="{Binding ViewText[command_exit]}"
Expand Down
12 changes: 9 additions & 3 deletions tools/config/Tomb1Main_ConfigTool/Models/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,16 @@ private bool CanSaveAs()
private RelayCommand _launchGameCommand;
public ICommand LaunchGameCommand
{
get => _launchGameCommand ??= new RelayCommand(LaunchGame);
get => _launchGameCommand ??= new RelayCommand(() => LaunchGame());
}

private void LaunchGame()
private RelayCommand _launchUBCommand;
public ICommand LaunchUBCommand
{
get => _launchUBCommand ??= new RelayCommand(() => LaunchGame(Tomb1MainConstants.GoldArgs));
}

private void LaunchGame(string arguments = null)
{
if (!ConfirmEditorSaveState())
{
Expand All @@ -235,7 +241,7 @@ private void LaunchGame()

try
{
ProcessUtils.Start(Tomb1MainConstants.ExecutableName);
ProcessUtils.Start(Path.GetFullPath(Tomb1MainConstants.ExecutableName), arguments);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public static class Tomb1MainConstants
public const string ConfigFilterExtension = "|*.json5";
public const string ConfigPath = @"cfg\Tomb1Main.json5";
public const string ExecutableName = "Tomb1Main.exe";
public const string GoldArgs = "-gold";
public const string GitHubURL = "https://github.com/rr-/Tomb1Main";
}
1 change: 1 addition & 0 deletions tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"command_save": "_Save",
"command_save_as": "Save _As...",
"command_launch_game": "_Launch Game",
"command_launch_ub": "Launch _Unfinished Business",
"command_exit": "E_xit",
"menu_tools": "_Tools",
"command_restore": "_Restore Defaults",
Expand Down
1 change: 1 addition & 0 deletions tools/config/Tomb1Main_ConfigTool/Resources/Lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"command_exit": "Salir",
"command_github": "_GitHub",
"command_launch_game": "_Abrir juego",
"command_launch_ub": "Abrir Asuntos _Pendientes",
"command_open": "_Abierto",
"command_reload": "_Recargar",
"command_restore": "_Restaurar los valores predeterminados",
Expand Down
1 change: 1 addition & 0 deletions tools/config/Tomb1Main_ConfigTool/Resources/Lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"command_save": "_Sauvegarder",
"command_save_as": "Enregistrer sous...",
"command_launch_game": "_Lancer le jeu",
"command_launch_ub": "Lancer _Unfinished Business",
"command_exit": "_Quitter",
"menu_tools": "_Outils",
"command_restore": "_Restaurer par défaut",
Expand Down
12 changes: 9 additions & 3 deletions tools/config/Tomb1Main_ConfigTool/Utils/ProcessUtils.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;

namespace Tomb1Main_ConfigTool.Utils;

public static class ProcessUtils
{
public static void Start(string fileName)
public static void Start(string fileName, string arguments = null)
{
Process.Start(new ProcessStartInfo
{
FileName = fileName,
UseShellExecute = true
Arguments = arguments,
UseShellExecute = true,
WorkingDirectory = new Uri(fileName).IsFile
? Path.GetDirectoryName(fileName)
: null
});
}
}

0 comments on commit e7a6bb7

Please sign in to comment.