Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for LUA extraction #24

Closed
mechpaul opened this issue Apr 26, 2020 · 5 comments
Closed

No support for LUA extraction #24

mechpaul opened this issue Apr 26, 2020 · 5 comments

Comments

@mechpaul
Copy link

I'm currently working on my own python unpacker and my program crashed when reading a certain file. I wanted to collaborate with you on my findings since I see your unpacker doesn't support it, really.

I would write this myself, but it would require an overhaul in some areas, so instead I'll just tell you how to do it.

GMS/Etc.wz/Script/BattleScene.lua

This entire file looks like:
01 80 6C 10 01 00

A few interesting things to notes:

  1. 99.99% of the time, you're extracting a 0x73 as the first byte to extract a Property. However, this time the first byte is 0x01. The 0x01 implies a reference to a previous string, but there are no previous strings (as it's the first byte). Finally, a 0x01 backreference should be followed by a signed 32 bit integer, but this one is followed by a PackedInt. These issues will cause a parser to fail.

  2. The is a string which must be decrypted using only the KMS AES stream (IV = [B9 7D 63 E9]). Do not use the ASCII traditional (0xAA + i) over the KMS stream. You use only the KMS AES stream to decrypt it. The decryption churns out a LUA file which has Latin and Japanese text. These LUA files break a lot of parsers because they assume that the same AESIV will be used everywhere in the file, and that is no longer the case.

I have some logic which you can use to work with such files that won't cause string errors:

  • If the filePath ends in .lua, extract this 0x01 file type specially in whatever dumpString function you have by checking for the .lua file extension there.
  • If there's a 0x01 back-reference but it's the first byte of the file, use the alternate logic for parsing a 0x01 byte. This works best if you have access to a binarystream.peek() function

Finally, you can see a thread at RageZone where they discuss these files. Code snippets are provided: https://forum.ragezone.com/f941/wzimage-nodes-1115819/

@lastbattle
Copy link
Owner

lastbattle commented Apr 27, 2020

staging branch, doing a bit more testing right now.
211a745
49c11bf

x

Fixed that, do test it for me! As I'm only working with v188 GMS (lots of issue doing a full dump on the latest version of GMS still)

Update: I think I broke the loading of some .wz in the midst of that, brb
fixed. 7a8de08

@gilmatok
Copy link

Since when does GMS have Lua files inside the WZ files?

@lastbattle
Copy link
Owner

lastbattle commented Apr 29, 2020

Since when does GMS have Lua files inside the WZ files?

No idea until this, it seems that the same .lua file found on GMS is missing in other localisations of MapleStory.

I am using v188 as a reference.

@mechpaul try pulling the latest commit at the staging branch, just tested and it dumps XMLs Etc.wz fine.

1

@mechpaul
Copy link
Author

Haven't tested the dumping, but I have tested the viewing. Working fine for me. Great work.

@lastbattle
Copy link
Owner

I will close this for now, feel free to ping me if you have any other issue 😉

fhrisbriner pushed a commit to fhrisbriner/Harepacker-resurrected that referenced this issue Apr 18, 2024


Otherwise double clicking to place the rope will cause errors
Also why InvokeReturnToSelectionState is called in this method, to cleanup the state since the code is expecting selection or foothold state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants