diff --git a/core/src/com/riiablo/mpq_bytebuf/MPQFileHandle.java b/core/src/com/riiablo/mpq_bytebuf/MPQFileHandle.java index e12c4762..06e3250b 100644 --- a/core/src/com/riiablo/mpq_bytebuf/MPQFileHandle.java +++ b/core/src/com/riiablo/mpq_bytebuf/MPQFileHandle.java @@ -7,10 +7,11 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.StringUtils; import com.badlogic.gdx.files.FileHandle; +import com.riiablo.mpq_bytebuf.util.Decryptor; + public final class MPQFileHandle extends FileHandle { public final MPQ mpq; public final String filename; @@ -34,9 +35,8 @@ public final class MPQFileHandle extends FileHandle { } MPQFileHandle(MPQ mpq, String filename, long key, int offset, short locale, MPQ.Entry entry) { - assert !StringUtils.contains(filename, '/'); this.mpq = mpq; - this.filename = filename; + this.filename = Decryptor.LookupTable.fix(filename); this.key = key; this.offset = offset; this.locale = locale; diff --git a/core/src/com/riiablo/mpq_bytebuf/util/Decryptor.java b/core/src/com/riiablo/mpq_bytebuf/util/Decryptor.java index a2b99fe6..63c7c0ad 100644 --- a/core/src/com/riiablo/mpq_bytebuf/util/Decryptor.java +++ b/core/src/com/riiablo/mpq_bytebuf/util/Decryptor.java @@ -310,5 +310,12 @@ public final class Decryptor { return seed1; } + + public static String fix(String str) { + final byte[] byteMap = LookupTable.byteMap; + final byte[] bytes = str.getBytes(StandardCharsets.US_ASCII); + for (int i = 0, s = bytes.length; i < s; i++) bytes[i] = byteMap[bytes[i]]; + return new String(bytes, StandardCharsets.US_ASCII); + } } }