Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: launch UB from the config tool #772

Merged
merged 1 commit into from
Mar 15, 2023
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
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
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
});
}
}