Skip to content

Commit

Permalink
Support for per platform extraction option (LaunchBox 12.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraganator committed Feb 19, 2022
1 parent 5762fa8 commit eb987be
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ArchiveCacheManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.9.0")]
[assembly: AssemblyFileVersion("2.0.9.0")]
[assembly: AssemblyVersion("2.0.10.0")]
[assembly: AssemblyFileVersion("2.0.10.0")]
2 changes: 1 addition & 1 deletion src/Core/CacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static string Version
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;

return string.Format("v{0}.{1}.{2}", version.Major, version.Minor, version.Build);
return string.Format("v{0}.{1}.{2} beta", version.Major, version.Minor, version.Build);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.9.0")]
[assembly: AssemblyFileVersion("2.0.9.0")]
[assembly: AssemblyVersion("2.0.10.0")]
[assembly: AssemblyFileVersion("2.0.10.0")]
2 changes: 1 addition & 1 deletion src/Plugin/GameLaunching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulato

public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator)
{
if (emulator.AutoExtract)
if (PluginUtils.GetEmulatorPlatformAutoExtract(game.EmulatorId, game.Platform))
{
Logger.Log(string.Format("-------- {0} --------", game.Title.ToUpper()));
Logger.Log(string.Format("Preparing cache for {0} ({1}) running with {2}.", game.Title, game.Platform, emulator.Title));
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/GameMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GameMenuItem : IGameMenuItemPlugin
public bool ShowInLaunchBox => true;
public bool ShowInBigBox => true;

public bool GetIsValidForGame(IGame selectedGame) => PluginHelper.DataManager.GetEmulatorById(selectedGame.EmulatorId).AutoExtract;
public bool GetIsValidForGame(IGame selectedGame) => PluginUtils.GetEmulatorPlatformAutoExtract(selectedGame.EmulatorId, selectedGame.Platform);
public bool GetIsValidForGames(IGame[] selectedGames) => false;

public void OnSelected(IGame selectedGame)
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<Reference Include="UIAutomationProvider" />
<Reference Include="Unbroken.LaunchBox.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=558191e84f56affc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\thirdparty\Unbroken.LaunchBox.Plugins\10.14\Unbroken.LaunchBox.Plugins.dll</HintPath>
<HintPath>..\..\thirdparty\Unbroken.LaunchBox.Plugins\12.8\Unbroken.LaunchBox.Plugins.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
Expand Down Expand Up @@ -96,6 +96,7 @@
<Compile Include="MessageBoxBigBox.Designer.cs">
<DependentUpon>MessageBoxBigBox.cs</DependentUpon>
</Compile>
<Compile Include="PluginUtils.cs" />
<Compile Include="PriorityEditWindow.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
39 changes: 39 additions & 0 deletions src/Plugin/PluginUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unbroken.LaunchBox.Plugins;
using Unbroken.LaunchBox.Plugins.Data;

namespace ArchiveCacheManager
{
static class PluginUtils
{
public static bool GetEmulatorPlatformAutoExtract(string emulatorId, string platformName)
{
var emulator = PluginHelper.DataManager.GetEmulatorById(emulatorId);
var emulatorPlatform = Array.Find(emulator.GetAllEmulatorPlatforms(), p => p.Platform.Equals(platformName));

// emulatorPlatform.AutoExtract will be null if the Emulator settings haven't been changed since updating to LaunchBox 12.8
// So perform two checks to determine if AutoExtract is true, one at the emulator level, and one at the emulatorPlatform level
return (emulator.AutoExtract && emulatorPlatform.AutoExtract == null) || (emulatorPlatform.AutoExtract == true);
}

public static bool GetEmulatorPlatformM3uDiscLoadEnabled(string emulatorId, string platformName)
{
var emulator = PluginHelper.DataManager.GetEmulatorById(emulatorId);
var emulatorPlatform = Array.Find(emulator.GetAllEmulatorPlatforms(), p => p.Platform.Equals(platformName));

return emulatorPlatform.M3uDiscLoadEnabled;
}

public static void SetEmulatorPlatformM3uDiscLoadEnabled(string emulatorId, string platformName, bool enabled)
{
var emulator = PluginHelper.DataManager.GetEmulatorById(emulatorId);
var emulatorPlatform = Array.Find(emulator.GetAllEmulatorPlatforms(), p => p.Platform.Equals(platformName));

emulatorPlatform.M3uDiscLoadEnabled = enabled;
}
}
}
4 changes: 2 additions & 2 deletions src/Plugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.9.0")]
[assembly: AssemblyFileVersion("2.0.9.0")]
[assembly: AssemblyVersion("2.0.10.0")]
[assembly: AssemblyFileVersion("2.0.10.0")]

0 comments on commit eb987be

Please sign in to comment.