write fontnames with default endcoding for swfs having version 5 or less

This commit is contained in:
honfika@gmail.com
2015-07-28 19:05:37 +02:00
parent 8774489049
commit 6346611060
5 changed files with 20 additions and 5 deletions

View File

@@ -2270,7 +2270,6 @@ public class AVM2Code implements Cloneable {
new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
//body.getCode().checkValidOffsets(body); // todo: only for debugging. checkValidOffsets can be made private later
return 1;
}
}

View File

@@ -211,7 +211,11 @@ public class DefineFont2Tag extends FontTag {
sos.writeUB(1, fontFlagsItalic ? 1 : 0);
sos.writeUB(1, fontFlagsBold ? 1 : 0);
sos.writeLANGCODE(languageCode);
sos.writeNetString(fontName, Utf8Helper.charset); // todo: check swf version and write non utf-8 for version < 6
if (swf.version >= 6) {
sos.writeNetString(fontName, Utf8Helper.charset);
} else {
sos.writeNetString(fontName);
}
int numGlyphs = glyphShapeTable.size();
sos.writeUI16(numGlyphs);

View File

@@ -219,7 +219,11 @@ public class DefineFont3Tag extends FontTag {
sos.writeUB(1, fontFlagsItalic ? 1 : 0);
sos.writeUB(1, fontFlagsBold ? 1 : 0);
sos.writeLANGCODE(languageCode);
sos.writeNetString(fontName, Utf8Helper.charset); // todo: check swf version and write non utf-8 for version < 6
if (swf.version >= 6) {
sos.writeNetString(fontName, Utf8Helper.charset);
} else {
sos.writeNetString(fontName);
}
sos.writeUI16(numGlyphs);
for (long offset : offsetTable) {

View File

@@ -122,7 +122,11 @@ public class DefineFontInfo2Tag extends Tag implements CharacterIdTag {
@Override
public void getData(SWFOutputStream sos) throws IOException {
sos.writeUI16(fontID);
sos.writeNetString(fontName, Utf8Helper.charset); // todo: check swf version and write non utf-8 for version < 6
if (swf.version >= 6) {
sos.writeNetString(fontName, Utf8Helper.charset);
} else {
sos.writeNetString(fontName);
}
sos.writeUB(2, reserved);
sos.writeUB(1, fontFlagsSmallText ? 1 : 0);
sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0);

View File

@@ -120,7 +120,11 @@ public class DefineFontInfoTag extends Tag implements CharacterIdTag {
@Override
public void getData(SWFOutputStream sos) throws IOException {
sos.writeUI16(fontId);
sos.writeNetString(fontName, Utf8Helper.charset); // todo: check swf version and write non utf-8 for version < 6
if (swf.version >= 6) {
sos.writeNetString(fontName, Utf8Helper.charset);
} else {
sos.writeNetString(fontName);
}
sos.writeUB(2, reserved);
sos.writeUB(1, fontFlagsSmallText ? 1 : 0);
sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0);