Project-Path-of-Exile-Wiki / PyPoE

Collection of Python Tools for Path of Exile
GNU General Public License v3.0
24 stars 21 forks source link

Fix macOS Standalone GGPK (version 4) reading #85

Closed zao closed 1 year ago

zao commented 2 years ago

Abstract

GGPK files have a version field that was previously thought to be an element count in the GGPK chunk in the legacy version 2. Steam releases and post-bundle PC Standalone has version 3 which have the same format and signifies that the file contains bundles instead of all loose files. The Standalone GGPK on macOS has version 4 which again contains bundles but with the difference that File and Directory entries use UTF-32LE strings instead of UTF-16LE.

Action Taken

This fix detects the version and decodes strings according to version, enabling the use of Standalone GGPK files on macOS.

Caveats

As GGPK writing seems broken already no attempt was made to also make that aware of versions, the work that needs to be done there is to ensure that the base chunk length changes if the name or version changes as well as actually writing file data.