Added: Basic support for PlaceImagePrivate tag

Changed: CSMTextSettings tag renamed to CSMSettings
This commit is contained in:
Jindra Petřík
2025-08-24 18:55:19 +02:00
parent de2b174165
commit 9983c682ef
18 changed files with 131 additions and 29 deletions

View File

@@ -127,7 +127,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
import com.jpexs.decompiler.flash.dumpview.DumpInfoSpecial;
import com.jpexs.decompiler.flash.dumpview.DumpInfoSpecialType;
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
import com.jpexs.decompiler.flash.tags.CSMSettingsTag;
import com.jpexs.decompiler.flash.tags.DebugIDTag;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
@@ -181,6 +181,7 @@ import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
import com.jpexs.decompiler.flash.tags.MetadataTag;
import com.jpexs.decompiler.flash.tags.NameCharacterTag;
import com.jpexs.decompiler.flash.tags.PathsArePostScriptTag;
import com.jpexs.decompiler.flash.tags.PlaceImagePrivateTag;
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
import com.jpexs.decompiler.flash.tags.PlaceObject4Tag;
@@ -1632,7 +1633,7 @@ public class SWFInputStream implements AutoCloseable {
case 37:
ret = new DefineEditTextTag(sis, data);
break;
//case 38: DefineMouseTarget
//case 38: DefineVideo / DefineMouseTarget
case 39:
ret = new DefineSpriteTag(sis, level, data, parallel, skipUnusualTags);
break;
@@ -1715,7 +1716,7 @@ public class SWFInputStream implements AutoCloseable {
ret = new DefineFontAlignZonesTag(sis, data);
break;
case 74:
ret = new CSMTextSettingsTag(sis, data);
ret = new CSMSettingsTag(sis, data);
break;
case 75:
ret = new DefineFont3Tag(sis, data);
@@ -1740,7 +1741,9 @@ public class SWFInputStream implements AutoCloseable {
case 84:
ret = new DefineMorphShape2Tag(sis, data);
break;
//case 85: PlaceImagePrivate
case 85:
ret = new PlaceImagePrivateTag(sis, data);
break;
case 86:
ret = new DefineSceneAndFrameLabelDataTag(sis, data);
break;

View File

@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.amf.amf3.Amf3Value;
import com.jpexs.decompiler.flash.tags.CSMSettingsTag;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.TagTypeInfo;
@@ -486,6 +487,10 @@ public class SwfXmlImporter {
if ("UnknownTag".equals(type)) {
return new UnknownTag(swf, tagTypeId);
}
if ("CSMTextSettings".equals(type)) {
type = CSMSettingsTag.NAME;
}
Class cls = swfTags.get(type);
if (cls != null) {

View File

@@ -35,11 +35,11 @@ import java.util.Set;
* @author JPEXS
*/
@SWFVersion(from = 8)
public class CSMTextSettingsTag extends Tag implements CharacterIdTag {
public class CSMSettingsTag extends Tag implements CharacterIdTag {
public static final int ID = 74;
public static final String NAME = "CSMTextSettings";
public static final String NAME = "CSMSettings";
@SWFType(BasicType.UI16)
public int textID;
@@ -69,7 +69,7 @@ public class CSMTextSettingsTag extends Tag implements CharacterIdTag {
*
* @param swf SWF
*/
public CSMTextSettingsTag(SWF swf) {
public CSMSettingsTag(SWF swf) {
super(swf, ID, NAME, null);
}
@@ -80,7 +80,7 @@ public class CSMTextSettingsTag extends Tag implements CharacterIdTag {
* @param data Data
* @throws IOException On I/O error
*/
public CSMTextSettingsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
public CSMSettingsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, NAME, data);
readData(sis, data, 0, false, false, false);
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2010-2025 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.BasicType;
import com.jpexs.decompiler.flash.types.RECT;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
import com.jpexs.helpers.ByteArrayRange;
import java.io.IOException;
/**
*
* @author JPEXS
*/
@SWFVersion(from = 9)
public class PlaceImagePrivateTag extends Tag {
public static final int ID = 85;
public static final String NAME = "PlaceImagePrivate";
@SWFType(BasicType.UI16)
public int imageId = 0;
@SWFType(BasicType.UI16)
public int depth = 0;
public RECT bounds = new RECT();
public PlaceImagePrivateTag(SWF swf) {
super(swf, ID, NAME, null);
}
public PlaceImagePrivateTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
super(sis.getSwf(), ID, NAME, data);
readData(sis, data, 0, false, false, false);
}
@Override
public void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
imageId = sis.readUI16("imageId");
if (sis.available() > 0) {
depth = sis.readUI16("depth");
}
if (sis.available() > 0) {
bounds = sis.readRECT("bounds");
}
}
@Override
public void getData(SWFOutputStream sos) throws IOException {
sos.writeUI16(imageId);
sos.writeUI16(depth);
sos.writeRECT(bounds);
}
}

View File

@@ -43,6 +43,7 @@ public class ShowFrameTag extends Tag {
add(PlaceObject2Tag.ID);
add(PlaceObject3Tag.ID);
add(PlaceObject4Tag.ID);
add(PlaceImagePrivateTag.ID);
add(RemoveObjectTag.ID);
add(RemoveObject2Tag.ID);
add(FrameLabelTag.ID);

View File

@@ -325,7 +325,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
if (knownTagInfosById == null) {
Map<Integer, TagTypeInfo> map = new HashMap<>();
Map<String, TagTypeInfo> map2 = new HashMap<>();
addTagInfo(map, map2, CSMTextSettingsTag.ID, CSMTextSettingsTag.class, CSMTextSettingsTag.NAME);
addTagInfo(map, map2, CSMSettingsTag.ID, CSMSettingsTag.class, CSMSettingsTag.NAME);
addTagInfo(map, map2, DebugIDTag.ID, DebugIDTag.class, DebugIDTag.NAME);
addTagInfo(map, map2, DefineBinaryDataTag.ID, DefineBinaryDataTag.class, DefineBinaryDataTag.NAME);
addTagInfo(map, map2, DefineBitsJPEG2Tag.ID, DefineBitsJPEG2Tag.class, DefineBitsJPEG2Tag.NAME);
@@ -379,6 +379,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
addTagInfo(map, map2, PlaceObject3Tag.ID, PlaceObject3Tag.class, PlaceObject3Tag.NAME);
addTagInfo(map, map2, PlaceObject4Tag.ID, PlaceObject4Tag.class, PlaceObject4Tag.NAME);
addTagInfo(map, map2, PlaceObjectTag.ID, PlaceObjectTag.class, PlaceObjectTag.NAME);
addTagInfo(map, map2, PlaceImagePrivateTag.ID, PlaceImagePrivateTag.class, PlaceImagePrivateTag.NAME);
addTagInfo(map, map2, ProductInfoTag.ID, ProductInfoTag.class, ProductInfoTag.NAME);
addTagInfo(map, map2, ProtectTag.ID, ProtectTag.class, ProtectTag.NAME);
addTagInfo(map, map2, RemoveObject2Tag.ID, RemoveObject2Tag.class, RemoveObject2Tag.NAME);

View File

@@ -67,7 +67,7 @@ import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.helpers.StringBuilderTextWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
import com.jpexs.decompiler.flash.tags.CSMSettingsTag;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.DefineButtonCxformTag;
import com.jpexs.decompiler.flash.tags.DefineButtonSoundTag;
@@ -4966,7 +4966,7 @@ public class XFLConverter {
private static void convertText(int frame, AccessibilityBag accessibility, String instanceName, TextTag tag, MATRIX m, List<FILTER> filters, XFLXmlWriter writer, Map<CharacterTag, String> characterImportLinkageURL, Reference<Integer> lastImportedId, Map<CharacterTag, String> characterNameMap, Set<CharacterTag> characters) throws XMLStreamException {
MATRIX matrix = new MATRIX(m);
CSMTextSettingsTag csmts = null;
CSMSettingsTag csmts = null;
XFLXmlWriter filterStr = new XFLXmlWriter();
if (filters != null) {
filterStr.writeStartElement("filters");
@@ -4978,8 +4978,8 @@ public class XFLConverter {
SWF swf = tag.getSwf();
for (Tag t : swf.getTags()) {
if (t instanceof CSMTextSettingsTag) {
CSMTextSettingsTag c = (CSMTextSettingsTag) t;
if (t instanceof CSMSettingsTag) {
CSMSettingsTag c = (CSMSettingsTag) t;
if (c.textID == tag.getCharacterId()) {
csmts = c;
break;