Skip to content

Commit

Permalink
[WzLib] Some unknown wzimage header from KMS
Browse files Browse the repository at this point in the history
  • Loading branch information
LastBattle committed Dec 18, 2020
1 parent 397490e commit f7f4ee5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions MapleLib/WzLib/WzFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
using MapleLib.MapleCryptoLib;
using System.Linq;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace MapleLib.WzLib
{
Expand Down Expand Up @@ -259,9 +260,12 @@ internal WzFileParseStatus ParseMainWzDirectory(bool lazyParse = false)
this.wzDir = directory;
return WzFileParseStatus.Success;
}
case 0x30:
case 0x6C: // idk
default:
{
Helpers.ErrorLogger.Log(Helpers.ErrorLevel.MissingFeature, "New Wz image header found. checkByte = " + checkByte);
Helpers.ErrorLogger.Log(Helpers.ErrorLevel.MissingFeature,
string.Format("[WzFile.cs] New Wz image header found. checkByte = {0}. File Name = {1}", checkByte, Name));
// log or something
break;
}
Expand Down Expand Up @@ -325,6 +329,7 @@ private static uint CheckAndGetVersionHash(int wzVersionHeader, int maplestoryPa
/// <summary>
/// Version hash
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void CreateWZVersionHash()
{
versionHash = 0;
Expand Down Expand Up @@ -455,11 +460,11 @@ public List<WzObject> GetObjectsFromWildcardPath(string path)
List<WzObject> objList = new List<WzObject>();
foreach (WzImage img in WzDirectory.WzImages)
foreach (string spath in GetPathsFromImage(img, name + "/" + img.Name))
if (strMatch(path, spath))
if (StringMatch(path, spath))
objList.Add(GetObjectFromPath(spath));
foreach (WzDirectory dir in wzDir.WzDirectories)
foreach (string spath in GetPathsFromDirectory(dir, name + "/" + dir.Name))
if (strMatch(path, spath))
if (StringMatch(path, spath))
objList.Add(GetObjectFromPath(spath));
GC.Collect();
GC.WaitForPendingFinalizers();
Expand Down Expand Up @@ -681,20 +686,20 @@ public static WzObject GetObjectFromMultipleWzFilePath(string path, IReadOnlyCol
return null;
}

internal bool strMatch(string strWildCard, string strCompare)
internal bool StringMatch(string strWildCard, string strCompare)
{
if (strWildCard.Length == 0) return strCompare.Length == 0;
if (strCompare.Length == 0) return false;
if (strWildCard[0] == '*' && strWildCard.Length > 1)
for (int index = 0; index < strCompare.Length; index++)
{
if (strMatch(strWildCard.Substring(1), strCompare.Substring(index)))
if (StringMatch(strWildCard.Substring(1), strCompare.Substring(index)))
return true;
}
else if (strWildCard[0] == '*')
return true;
else if (strWildCard[0] == strCompare[0])
return strMatch(strWildCard.Substring(1), strCompare.Substring(1));
return StringMatch(strWildCard.Substring(1), strCompare.Substring(1));
return false;
}

Expand Down

0 comments on commit f7f4ee5

Please sign in to comment.