Skip to content

Commit

Permalink
Clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeeynamo committed May 31, 2020
1 parent eb396e7 commit 4da0952
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions OpenKh.Game/Infrastructure/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ public static bool IsReMixFileExists(IDataContent dataContent, string region)
public static bool IsReMixFileHasHdAssetHeader(IDataContent dataContent, string region)
{
var testFileName = $"menu/{region}/titlejf.2ld";
using var stream = dataContent.FileOpen(testFileName);
return HdAsset.IsValid(stream);
var stream = dataContent.FileOpen(testFileName);
if (stream == null)
return false;

using (stream)
return HdAsset.IsValid(stream);
}
}
}
3 changes: 1 addition & 2 deletions OpenKh.Game/OpenKhGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using OpenKh.Game.States;
using System;
using System.IO;
using System.Runtime.Serialization;

namespace OpenKh.Game
{
Expand Down Expand Up @@ -48,7 +47,7 @@ public int State
public OpenKhGame()
{
_dataContent = CreateDataContent(".", "KH2.IDX", "KH2.IMG");
if (Kernel.IsReMixFileExists(_dataContent, "fm") && Kernel.IsReMixFileHasHdAssetHeader(_dataContent, "fm"))
if (Kernel.IsReMixFileHasHdAssetHeader(_dataContent, "fm"))
_dataContent = new HdAssetContent(_dataContent);
_dataContent = new SafeDataContent(_dataContent);

Expand Down

0 comments on commit 4da0952

Please sign in to comment.