Skip to content

Commit

Permalink
Remove --clonecompat flag in favor of loading first culture in the li…
Browse files Browse the repository at this point in the history
…st as a default when loading GFX
  • Loading branch information
ethanmoffat committed Sep 9, 2022
1 parent aa0f957 commit 84f6b94
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 27 deletions.
1 change: 0 additions & 1 deletion EOLib.Config/ConfigFileLoadActions.cs
Expand Up @@ -61,7 +61,6 @@ public void LoadConfigFile()
_configRepository.Interaction = !configFile.GetValue(ConfigStrings.Chat, ConfigStrings.Interaction, out tempBool) || tempBool;
_configRepository.LogChatToFile = configFile.GetValue(ConfigStrings.Chat, ConfigStrings.LogChat, out tempBool) && tempBool;

_configRepository.MainCloneCompat = configFile.GetValue(ConfigStrings.Custom, ConfigStrings.MainCloneCompat, out tempBool) && tempBool;
_configRepository.AccountCreateTimeout = TimeSpan.FromMilliseconds(
configFile.GetValue(ConfigStrings.Custom, ConfigStrings.AccountCreateTimeout, out tempInt)
? tempInt
Expand Down
6 changes: 0 additions & 6 deletions EOLib.Config/IConfigurationRepository.cs
Expand Up @@ -30,8 +30,6 @@ public interface IConfigurationRepository
bool Interaction { get; set; }
bool LogChatToFile { get; set; }

bool MainCloneCompat { get; set; }

TimeSpan AccountCreateTimeout { get; set; }

bool EnableLog { get; set; }
Expand Down Expand Up @@ -64,8 +62,6 @@ public interface IConfigurationProvider
bool Interaction { get; }
bool LogChatToFile { get; }

bool MainCloneCompat { get; }

TimeSpan AccountCreateTimeout { get; }

bool EnableLog { get; }
Expand Down Expand Up @@ -99,8 +95,6 @@ public class ConfigurationRepository : IConfigurationRepository, IConfigurationP
public bool Interaction { get; set; }
public bool LogChatToFile { get; set; }

public bool MainCloneCompat { get; set; }

public TimeSpan AccountCreateTimeout { get; set; }

public bool EnableLog { get; set; }
Expand Down
11 changes: 5 additions & 6 deletions EOLib.Graphics.Test/NativeGraphicsLoaderTest.cs
@@ -1,12 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Moq;
using NUnit.Framework;
using Moq;
using PELoaderLib;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Formats.Bmp;
using EOLib.Config;
using SixLabors.ImageSharp.PixelFormats;
using System.Diagnostics.CodeAnalysis;
using System.IO;

namespace EOLib.Graphics.Test
{
Expand All @@ -22,7 +21,7 @@ public class NativeGraphicsLoaderTest
public void SetUp()
{
_modules = Mock.Of<IPEFileCollection>();
_nativeGraphicsLoader = new NativeGraphicsLoader(_modules, Mock.Of<IConfigurationProvider>(x => x.MainCloneCompat == false));
_nativeGraphicsLoader = new NativeGraphicsLoader(_modules);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion EOLib.Graphics/EOLib.Graphics.csproj
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutomaticTypeMapper" Version="1.4.1" />
<PackageReference Include="PELoaderLib" Version="1.3.0" />
<PackageReference Include="PELoaderLib" Version="1.4.0" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.0.0" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
Expand Down
10 changes: 2 additions & 8 deletions EOLib.Graphics/NativeGraphicsLoader.cs
Expand Up @@ -8,22 +8,16 @@ namespace EOLib.Graphics
[MappedType(BaseType = typeof(INativeGraphicsLoader), IsSingleton = true)]
public class NativeGraphicsLoader : INativeGraphicsLoader
{
private const int CULTURE_EN_US = 1033;

private readonly IPEFileCollection _modules;
private readonly IConfigurationProvider _configurationProvider;

public NativeGraphicsLoader(IPEFileCollection modules,
IConfigurationProvider configurationProvider)
public NativeGraphicsLoader(IPEFileCollection modules)
{
_modules = modules;
_configurationProvider = configurationProvider;
}

public IImage LoadGFX(GFXTypes file, int resourceValue)
{
var culture = _configurationProvider.MainCloneCompat ? CULTURE_EN_US : 0;
var fileBytes = _modules[file].GetEmbeddedBitmapResourceByID(resourceValue + 100, culture);
var fileBytes = _modules[file].GetEmbeddedBitmapResourceByID(resourceValue + 100);

if (fileBytes.Length == 0)
throw new GFXLoadException(resourceValue, file);
Expand Down
5 changes: 0 additions & 5 deletions EndlessClient/GameExecution/GameRunnerBase.cs
Expand Up @@ -76,11 +76,6 @@ public virtual bool SetupDependencies()

i++;
}
else if(string.Equals(arg, "--clonecompat"))
{
_registry.Resolve<IConfigurationRepository>()
.MainCloneCompat = true;
}
else if (string.Equals(arg, "--version") && i < _args.Length - 1)
{
var versionStr = _args[i + 1];
Expand Down

0 comments on commit 84f6b94

Please sign in to comment.