Skip to content

Commit

Permalink
Backdrop hook fix #85
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeG621 committed Aug 11, 2023
1 parent c030f1c commit 4bdfde5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions BackdropDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* Copyright (C) 2007-2023 Michael Gaisser (mjgaisser@gmail.com)
* Licensed under the MPL v2.0 or later
*
* VERSION: 1.14
* VERSION: 1.14+
*/

/* CHANGELOG
* [FIX #85] Now looks for hook INI or TXT at mission location
* v1.14, 230804
* [FIX] Color labels now only show in XWA
* [NEW #80] Extra Color label pointing out that the color is on clipboard
Expand Down Expand Up @@ -145,9 +146,9 @@ public BackdropDialog(int index, int shadow, Settings config)
/// <summary>Constructor for XWA, Backdrop hook enabled</summary>
/// <param name="index">Backdrop index, set to 0 if out of range</param>
/// <param name="shadow">Shadow or backdrop variant, set to 0 if out of range</param>
/// <param name="fileName">Name of mission for hook implementation</param>
/// <param name="filePath">Full path of mission for hook implementation</param>
/// <exception cref="ApplicationException">Platform installation not found.</exception>
public BackdropDialog(int index, int shadow, string fileName, Settings config)
public BackdropDialog(int index, int shadow, string filePath, Settings config)
{
_platform = MissionFile.Platform.XWA;
_hookInstalled = true;
Expand All @@ -157,9 +158,8 @@ public BackdropDialog(int index, int shadow, string fileName, Settings config)
if (_shadow < 0 || _shadow > 6) _shadow = 0;
InitializeComponent();
if (!platformInstalled(config)) throw new ApplicationException("Platform installation not found, feature unavailable.");
_fileName = Path.GetFileNameWithoutExtension(fileName);
if (File.Exists(_installDirectory + "\\Missions\\" + _fileName + "_Resdata.txt")) _fileName = _installDirectory + "\\Missions\\" + _fileName + "_Resdata.txt";
else _fileName = _installDirectory + "\\Missions\\" + _fileName + ".ini";
if (File.Exists(filePath.ToLower().Replace(".tie", "_Resdata.txt"))) _fileName = filePath.ToLower().Replace(".tie", "_Resdata.txt");
else _fileName = filePath.ToLower().Replace(".tie", ".ini");
createThumbnails();
vsbThumbs.Enabled = true;
numBackdrop.Maximum = _numBackdrops - 1;
Expand Down
1 change: 1 addition & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ your user settings.
==========
Version History

- (XWA) Backdrop hook now loads the Resdata.txt or INI based on mission location, not just "\Missions\" [Issue #85]
v1.14, 04 Aug 2023
- (XWA) Wav form now supports mission names that start with "8" to support the MP hook [Issue #84]
- (XWA) Moved around the Trigger Parameter fields to be more consistent between locations and so it's a bit more natural to
Expand Down
5 changes: 3 additions & 2 deletions XwaForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* Copyright (C) 2007-2023 Michael Gaisser (mjgaisser@gmail.com)
* Licensed under the MPL v2.0 or later
*
* VERSION: 1.14
* VERSION: 1.14+
*/

/* CHANGELOG
* [FIX #85] Call to Backdrops for hook now uses full path
* v1.14, 230804
* [UPD] Moved around the Para2 and Para1 trigger controls so Para1 is naturally closer to the Target control
* [UPD] Region names now appear in trigger text
Expand Down Expand Up @@ -3522,7 +3523,7 @@ void cmdBackdrop_Click(object sender, EventArgs e)
{
BackdropDialog dlg = null;
// HACK: backdrop index fix
if (_hookBackdropInstalled) dlg = new BackdropDialog(_mission.FlightGroups[_activeFG].Backdrop, _mission.FlightGroups[_activeFG].GlobalCargo - 1, _mission.MissionFileName, _config);
if (_hookBackdropInstalled) dlg = new BackdropDialog(_mission.FlightGroups[_activeFG].Backdrop, _mission.FlightGroups[_activeFG].GlobalCargo - 1, _mission.MissionPath, _config);
else dlg = new BackdropDialog(_mission.FlightGroups[_activeFG].Backdrop, _mission.FlightGroups[_activeFG].GlobalCargo - 1, _config);
if (dlg.ShowDialog() == DialogResult.OK)
{
Expand Down

0 comments on commit 4bdfde5

Please sign in to comment.