Getting MapleStory version from exe IMO is not a good idea.
- Finding the version from the exe on disk is probably slower than doing a few hundred in-memory loop iterations. When parsing a WZ file, whether brute-forcing or reading from the exe, the cost of figuring out the client version is negligible either way.
- This can lead to incorrect version detection. For example, if I have a client with two data folders (e.g., Data_250 contains older client files for backup), it’ll detect the version as 251 and won't be able to open the files in Data_250.
MapleStory.exe
Data
+---String
| String.ini
| String.wz
| String_000.wz
|
\---UI
| UI.ini
| UI.wz
| UI_000.wz
|
\---_Canvas
_Canvas.ini
_Canvas.wz
_Canvas_000.wz
Data_250
+---String
| String.ini
| String.wz
| String_000.wz
|
\---UI
| UI.ini
| UI.wz
| UI_000.wz
|
\---_Canvas
_Canvas.ini
_Canvas.wz
_Canvas_000.wz
|
// Attempt to get version from MapleStory.exe first |
|
short maplestoryVerDetectedFromClient = GetMapleStoryVerFromExe(this.path, out this.mapleLocaleVersion); |
|
|
|
// this step is actually not needed if we know the maplestory patch version (the client .exe), but since we dont.. |
|
// we'll need a bruteforce way around it. |
|
const short MAX_PATCH_VERSION = 2000; // wont be reached for the forseeable future. |
|
|
|
for (int j = maplestoryVerDetectedFromClient; j < MAX_PATCH_VERSION; j++) |
|
{ |
|
//Debug.WriteLine("Try decode 1 with maplestory ver: " + j); |
|
|
|
if (TryDecodeWithWZVersionNumber(reader, wzVersionHeader, j, lazyParse)) |
|
{ |
|
return WzFileParseStatus.Success; |
|
} |
|
} |
Getting MapleStory version from exe IMO is not a good idea.
MapleLib/MapleLib/WzLib/WzFile.cs
Lines 268 to 283 in bc8b456