mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-05 06:14:26 +00:00
Merge origin/master
This commit is contained in:
@@ -49,6 +49,7 @@ public class ActionNextFrame extends Action {
|
||||
if (f < ((DisplayObject) lda.target).getTotalFrames()) {
|
||||
((DisplayObject) lda.target).gotoFrame(f + 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionPrevFrame extends Action {
|
||||
if (f > 1) {
|
||||
((DisplayObject) lda.target).gotoFrame(f - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public class ActionSetTarget extends Action {
|
||||
lda.target = lda.stage;
|
||||
return true;
|
||||
}
|
||||
|
||||
lda.target = lda.stage.getMember(targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionAsciiToChar extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class ActionCall extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stage.callFrame(EcmaScript.toInt32(lda.stack.pop()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionCharToAscii extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionCloneSprite extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int depth = EcmaScript.toInt32(lda.stack.pop());
|
||||
String source = EcmaScript.toString(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionEndDrag extends Action {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).stopDrag();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ActionGetProperty extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int index = EcmaScript.toInt32(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
Object movieClip = lda.stage.getMember(target);
|
||||
|
||||
@@ -116,6 +116,7 @@ public class ActionGetURL2 extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
String urlString = EcmaScript.toString(lda.stack.pop());
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ActionGetVariable extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,10 @@ public class ActionGotoFrame2 extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String frame = EcmaScript.toString(lda.stack.pop());
|
||||
String target = "/";
|
||||
if (frame.contains(":")) {
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ActionIf extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBAsciiToChar extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBCharToAscii extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBStringLength extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionNot extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ActionPop extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stack.pop();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,10 @@ public class ActionRandomNumber extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stack.push(RandomNumberActionItem.getResult(lda.pop()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionRemoveSprite extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
lda.stage.removeMember(target);
|
||||
return true;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ActionSetProperty extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object value = lda.pop();
|
||||
int index = (int) (double) lda.popAsNumber();
|
||||
String target = lda.popAsString();
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionSetTarget2 extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = lda.popAsString();
|
||||
lda.target = lda.stage.getMember(target);
|
||||
return true;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionStartDrag extends Action {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).startDrag();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionStringLength extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToInteger extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionTrace extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stage.trace(lda.pop());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,19 +49,20 @@ public class ActionCallFunction extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
|
||||
String functionName = lda.popAsString();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
|
||||
for (ActionScriptFunction f : lda.functions) {
|
||||
if (functionName.equals(f.getFunctionName())) {
|
||||
lda.stack.push(lda.stage.callFunction(f.getFunctionOffset(), f.getFunctionLength(), args, f.getFuncRegNames(), Undefined.INSTANCE /*?*/));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,19 @@ public class ActionCallMethod extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String methodName = lda.popAsString();
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
Object obj0 = lda.pop();
|
||||
if (!(obj0 instanceof ActionScriptObject)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = (ActionScriptObject) obj0;
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionDecrement extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,16 @@ public class ActionDelete2 extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String memberName = lda.popAsString();
|
||||
Object o = lda.target; //should be current scope
|
||||
if (o instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) o).setMember(memberName, Undefined.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionEnumerate extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String objectName = lda.popAsString();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionGetMember extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String membername = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
@@ -57,6 +58,7 @@ public class ActionGetMember extends Action {
|
||||
} else {
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionIncrement extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,17 @@ public class ActionInitArray extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptArray arr = new ActionScriptArray();
|
||||
for (int i = 0; i < num; i++) {
|
||||
arr.setValueAtIndex(i, lda.stack.pop());
|
||||
}
|
||||
|
||||
lda.stack.push(arr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -50,16 +50,19 @@ public class ActionInitObject extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < 2 * num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
for (int i = 0; i < num; i++) {
|
||||
Object val = lda.pop();
|
||||
String name = lda.popAsString();
|
||||
obj.setMember(name, val);
|
||||
}
|
||||
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,16 +51,19 @@ public class ActionNewMethod extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String methodName = lda.popAsString();
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
|
||||
ActionScriptObject nobj = new ActionScriptObject();
|
||||
ActionScriptFunction f = (ActionScriptFunction) obj.getMember(methodName);
|
||||
lda.stage.callFunction(f.getFunctionOffset(), f.getFunctionLength(), args, f.getFuncRegNames(), nobj);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.NewObjectActionItem;
|
||||
@@ -51,19 +50,22 @@ public class ActionNewObject extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String objectName = lda.popAsString();
|
||||
int numArgs = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.stack.pop());
|
||||
}
|
||||
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
//TODO:check type
|
||||
//TODO:check type
|
||||
/*ActionScriptFunction constructor = (ActionScriptFunction) lda.stage.getMember(objectName);
|
||||
lda.stage.callFunction(constructor.getFunctionOffset(), constructor.getFunctionLength(), args, constructor.getFuncRegNames(), obj);
|
||||
lda.stage.callFunction(constructor.getFunctionOffset(), constructor.getFunctionLength(), args, constructor.getFuncRegNames(), obj);
|
||||
*/
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ActionPushDuplicate extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionReturn extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
//lda.returnValue = Undefined.INSTANCE;
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -58,12 +58,14 @@ public class ActionSetMember extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object value = lda.pop();
|
||||
String memberName = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) obj).setMember(memberName, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionTargetPath extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj = lda.pop();
|
||||
|
||||
String path = lda.stage.getMemberPath(obj);
|
||||
@@ -57,6 +58,7 @@ public class ActionTargetPath extends Action {
|
||||
} else {
|
||||
lda.stack.push(path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToNumber extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToString extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionTypeOf extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptWith w = new ActionScriptWith(obj, fileOffset, codeSize);
|
||||
lda.withs.add(w);
|
||||
|
||||
@@ -61,6 +61,7 @@ public class ActionEnumerate2 extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object o = lda.pop();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
@@ -70,6 +71,7 @@ public class ActionEnumerate2 extends Action {
|
||||
lda.stack.push(m);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ActionInstanceOf extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object type = lda.stack.pop();
|
||||
Object obj = lda.stack.pop();
|
||||
if (getInstanceOfResult(obj, type)) {
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ActionCastOp extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject constr = (ActionScriptObject) lda.pop();
|
||||
if (ActionInstanceOf.getInstanceOfResult(obj, constr)) {
|
||||
@@ -58,6 +59,7 @@ public class ActionCastOp extends Action {
|
||||
} else {
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionExtends extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: check if its really ActionScriptObject ?
|
||||
ActionScriptObject superClass = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject subClass = (ActionScriptObject) lda.pop();
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionImplementsOp extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: check if its really scriptobject?
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
@@ -57,9 +58,11 @@ public class ActionImplementsOp extends Action {
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
interfaces.add(lda.stack.pop());
|
||||
}
|
||||
|
||||
obj.setImplementsObjs(interfaces);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ decompilationError.timeout.description = Non d\u00e9compil\u00e9 car le d\u00e9l
|
||||
decompilationError.obfuscated = Le code est probablement obsfusqu\u00e9
|
||||
decompilationError.errorType = Type d'erreur
|
||||
decompilationError.error.description = Non d\u00e9compil\u00e9 car il y a des erreurs
|
||||
decompilationError.actionCount = Nb d'actions :
|
||||
decompilationError.instructionCount = Nb d'instructions :
|
||||
|
||||
decompilation.skipped = D\u00e9compilation abandonn\u00e9
|
||||
decompilation.unsupported = Non support\u00e9 par le d\u00e9compileur
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.xfl;
|
||||
|
||||
@@ -104,6 +104,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.decompiler.flash.types.sound.MP3FRAME;
|
||||
import com.jpexs.decompiler.flash.types.sound.MP3SOUNDDATA;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Path;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
@@ -210,15 +211,32 @@ public class XFLConverter {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getScaleMode(LINESTYLE lineStyle) {
|
||||
if (lineStyle instanceof LINESTYLE2) {
|
||||
LINESTYLE2 ls2 = (LINESTYLE2) lineStyle;
|
||||
if (ls2.noHScaleFlag && ls2.noVScaleFlag) {
|
||||
return "none";
|
||||
} else if (ls2.noHScaleFlag) {
|
||||
return "vertical";
|
||||
} else if (ls2.noVScaleFlag) {
|
||||
return "horizontal";
|
||||
} else {
|
||||
return "normal";
|
||||
}
|
||||
}
|
||||
|
||||
return "normal";
|
||||
}
|
||||
|
||||
private static void convertLineStyle(LINESTYLE ls, int shapeNum, StringBuilder ret) {
|
||||
ret.append("<SolidStroke weight=\"").append(((float) ls.width) / SWF.unitDivisor)
|
||||
ret.append("<SolidStroke scaleMode=\"").append(getScaleMode(ls)).append("\" weight=\"").append(((float) ls.width) / SWF.unitDivisor)
|
||||
.append("\">"
|
||||
+ "<fill>"
|
||||
+ "<SolidColor color=\"")
|
||||
.append(ls.color.toHexRGB()).append("\"")
|
||||
.append(shapeNum == 3 ? " alpha=\"" + ((RGBA) ls.color).getAlphaFloat() + "\"" : "").append(" />"
|
||||
+ "</fill>"
|
||||
+ "</SolidStroke>");
|
||||
+ "</fill>"
|
||||
+ "</SolidStroke>");
|
||||
}
|
||||
|
||||
private static void convertLineStyle(HashMap<Integer, CharacterTag> characters, LINESTYLE2 ls, int shapeNum, StringBuilder ret) {
|
||||
@@ -258,7 +276,7 @@ public class XFLConverter {
|
||||
break;
|
||||
}
|
||||
|
||||
ret.append("<SolidStroke weight=\"").append(((float) ls.width) / SWF.unitDivisor).append("\"");
|
||||
ret.append("<SolidStroke scaleMode=\"").append(getScaleMode(ls)).append("\" weight=\"").append(((float) ls.width) / SWF.unitDivisor).append("\"");
|
||||
ret.append(params);
|
||||
ret.append(">");
|
||||
ret.append("<fill>");
|
||||
@@ -1051,7 +1069,7 @@ public class XFLConverter {
|
||||
|
||||
ret.append("<DOMSymbolInstance libraryItemName=\"" + "Symbol ").append(tag.getCharacterId()).append("\"");
|
||||
if (name != null) {
|
||||
ret.append(" name=\"").append(xmlString(name)).append("\"");
|
||||
ret.append(" name=\"").append(Helper.escapeHTML(name)).append("\"");
|
||||
}
|
||||
String blendModeStr = null;
|
||||
if (blendMode < BLENDMODES.length) {
|
||||
@@ -1196,11 +1214,11 @@ public class XFLConverter {
|
||||
boolean linkageExportForAS = false;
|
||||
if (characterClasses.containsKey(symbol.getCharacterId())) {
|
||||
linkageExportForAS = true;
|
||||
symbolStr.append(" linkageClassName=\"").append(xmlString(characterClasses.get(symbol.getCharacterId()))).append("\"");
|
||||
symbolStr.append(" linkageClassName=\"").append(Helper.escapeHTML(characterClasses.get(symbol.getCharacterId()))).append("\"");
|
||||
}
|
||||
if (characterVariables.containsKey(symbol.getCharacterId())) {
|
||||
linkageExportForAS = true;
|
||||
symbolStr.append(" linkageIdentifier=\"").append(xmlString(characterVariables.get(symbol.getCharacterId()))).append("\"");
|
||||
symbolStr.append(" linkageIdentifier=\"").append(Helper.escapeHTML(characterVariables.get(symbol.getCharacterId()))).append("\"");
|
||||
}
|
||||
if (linkageExportForAS) {
|
||||
symbolStr.append(" linkageExportForAS=\"true\"");
|
||||
@@ -1517,7 +1535,7 @@ public class XFLConverter {
|
||||
|
||||
if (characterVariables.containsKey(symbol.getCharacterId())) {
|
||||
linkageExportForAS = true;
|
||||
mediaLinkStr += " linkageIdentifier=\"" + xmlString(characterVariables.get(symbol.getCharacterId())) + "\"";
|
||||
mediaLinkStr += " linkageIdentifier=\"" + Helper.escapeHTML(characterVariables.get(symbol.getCharacterId())) + "\"";
|
||||
}
|
||||
if (linkageExportForAS) {
|
||||
mediaLinkStr += " linkageExportForAS=\"true\"";
|
||||
@@ -1589,7 +1607,7 @@ public class XFLConverter {
|
||||
}
|
||||
if (characterVariables.containsKey(symbol.getCharacterId())) {
|
||||
linkageExportForAS = true;
|
||||
mediaLinkStr += " linkageIdentifier=\"" + xmlString(characterVariables.get(symbol.getCharacterId())) + "\"";
|
||||
mediaLinkStr += " linkageIdentifier=\"" + Helper.escapeHTML(characterVariables.get(symbol.getCharacterId())) + "\"";
|
||||
}
|
||||
if (linkageExportForAS) {
|
||||
mediaLinkStr += " linkageExportForAS=\"true\"";
|
||||
@@ -1749,7 +1767,7 @@ public class XFLConverter {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("<DOMVideoInstance libraryItemName=\"movie").append(video.characterID).append(".flv\" frameRight=\"").append(20 * video.width).append("\" frameBottom=\"").append(20 * video.height).append("\"");
|
||||
if (instanceName != null) {
|
||||
ret.append(" name=\"").append(xmlString(instanceName)).append("\"");
|
||||
ret.append(" name=\"").append(Helper.escapeHTML(instanceName)).append("\"");
|
||||
}
|
||||
ret.append(">");
|
||||
ret.append("<matrix>");
|
||||
@@ -2004,7 +2022,7 @@ public class XFLConverter {
|
||||
if (hasAllRanges) {
|
||||
embedRanges = "9999";
|
||||
}
|
||||
ret2.append("<DOMFontItem name=\"Font ").append(fontId).append("\" font=\"").append(xmlString(fontName)).append("\" size=\"0\" id=\"").append(fontId).append("\" embedRanges=\"").append(embedRanges).append("\"").append(!"".equals(embeddedCharacters) ? " embeddedCharacters=\"" + xmlString(embeddedCharacters) + "\"" : "").append(" />");
|
||||
ret2.append("<DOMFontItem name=\"Font ").append(fontId).append("\" font=\"").append(Helper.escapeHTML(fontName)).append("\" size=\"0\" id=\"").append(fontId).append("\" embedRanges=\"").append(embedRanges).append("\"").append(!"".equals(embeddedCharacters) ? " embeddedCharacters=\"" + Helper.escapeHTML(embeddedCharacters) + "\"" : "").append(" />");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2190,7 +2208,7 @@ public class XFLConverter {
|
||||
if (ret2.length() > 0) {
|
||||
ret.append("<DOMLayer name=\"Layer ").append(layerIndex).append("\" color=\"").append(randomOutlineColor()).append("\">"
|
||||
+ "<frames>").append(ret2).append("</frames>"
|
||||
+ "</DOMLayer>");
|
||||
+ "</DOMLayer>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2402,7 +2420,7 @@ public class XFLConverter {
|
||||
ret.append(" fontRenderingMode=\"").append(fontRenderingMode).append("\"");
|
||||
}
|
||||
if (instanceName != null) {
|
||||
ret.append(" instanceName=\"").append(xmlString(instanceName)).append("\"");
|
||||
ret.append(" instanceName=\"").append(Helper.escapeHTML(instanceName)).append("\"");
|
||||
}
|
||||
ret.append(antiAlias);
|
||||
Map<String, Object> attrs = TextTag.getTextRecordsAttributes(textRecords, swf);
|
||||
@@ -2469,7 +2487,7 @@ public class XFLConverter {
|
||||
firstRun = false;
|
||||
if (font != null) {
|
||||
ret.append("<DOMTextRun>");
|
||||
ret.append("<characters>").append(xmlString((newline ? "\r" : "") + rec.getText(font))).append("</characters>");
|
||||
ret.append("<characters>").append(Helper.escapeHTML((newline ? "\r" : "") + rec.getText(font))).append("</characters>");
|
||||
ret.append("<textAttrs>");
|
||||
|
||||
ret.append("<DOMTextAttrs aliasText=\"false\" rotation=\"true\" size=\"").append(twipToPixel(textHeight)).append("\" bitmapSize=\"").append(textHeight).append("\"");
|
||||
@@ -2516,7 +2534,7 @@ public class XFLConverter {
|
||||
ret.append(" fontRenderingMode=\"").append(fontRenderingMode).append("\"");
|
||||
}
|
||||
if (instanceName != null) {
|
||||
ret.append(" name=\"").append(xmlString(instanceName)).append("\"");
|
||||
ret.append(" name=\"").append(Helper.escapeHTML(instanceName)).append("\"");
|
||||
}
|
||||
ret.append(antiAlias);
|
||||
double width = twipToPixel(bounds.getWidth());
|
||||
@@ -2566,7 +2584,7 @@ public class XFLConverter {
|
||||
ret.append(convertHTMLText(swf.getTags(), det, txt));
|
||||
} else {
|
||||
ret.append("<DOMTextRun>");
|
||||
ret.append("<characters>").append(xmlString(txt)).append("</characters>");
|
||||
ret.append("<characters>").append(Helper.escapeHTML(txt)).append("</characters>");
|
||||
int leftMargin = -1;
|
||||
int rightMargin = -1;
|
||||
int indent = -1;
|
||||
@@ -2844,7 +2862,7 @@ public class XFLConverter {
|
||||
publishSettings.append(" <StreamUse8kSampleRate>0</StreamUse8kSampleRate>\n");
|
||||
publishSettings.append(" <EventUse8kSampleRate>0</EventUse8kSampleRate>\n");
|
||||
publishSettings.append(" <UseNetwork>").append(useNetwork ? 1 : 0).append("</UseNetwork>\n");
|
||||
publishSettings.append(" <DocumentClass>").append(xmlString(characterClasses.containsKey(0) ? characterClasses.get(0) : "")).append("</DocumentClass>\n");
|
||||
publishSettings.append(" <DocumentClass>").append(Helper.escapeHTML(characterClasses.containsKey(0) ? characterClasses.get(0) : "")).append("</DocumentClass>\n");
|
||||
publishSettings.append(" <AS3Strict>2</AS3Strict>\n");
|
||||
publishSettings.append(" <AS3Coach>4</AS3Coach>\n");
|
||||
publishSettings.append(" <AS3AutoDeclare>4096</AS3AutoDeclare>\n");
|
||||
@@ -3171,10 +3189,6 @@ public class XFLConverter {
|
||||
return tparser.result;
|
||||
}
|
||||
|
||||
private static String xmlString(String s) {
|
||||
return s.replace("<", "<").replace(">", ">").replace("\"", """).replace("&", "&").replace("\r\n", "
").replace("\r", "
").replace("\n", "
");
|
||||
}
|
||||
|
||||
private static double twipToPixel(double tw) {
|
||||
return tw / SWF.unitDivisor;
|
||||
}
|
||||
@@ -3383,7 +3397,7 @@ public class XFLConverter {
|
||||
private void putText(String txt) {
|
||||
|
||||
result += "<DOMTextRun>";
|
||||
result += "<characters>" + xmlString(txt) + "</characters>";
|
||||
result += "<characters>" + Helper.escapeHTML(txt) + "</characters>";
|
||||
result += "<textAttrs>";
|
||||
result += "<DOMTextAttrs";
|
||||
if (alignment != null) {
|
||||
|
||||
@@ -1109,8 +1109,8 @@ public class Helper {
|
||||
}
|
||||
|
||||
public static String escapeHTML(String text) {
|
||||
String[] from = new String[]{"&", "<", ">", "\"", "'", "/"};
|
||||
String[] to = new String[]{"&", "<", ">", """, "'", "/"};
|
||||
String[] from = new String[]{"&", "<", ">", "\"", "'", "/", "\r\n", "\r", "\n"};
|
||||
String[] to = new String[]{"&", "<", ">", """, "'", "/", "
", "
", "
"};
|
||||
for (int i = 0; i < from.length; i++) {
|
||||
text = text.replace(from[i], to[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user