/* * Copyright (C) 2010-2013 JPEXS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package com.jpexs.decompiler.flash.action.swf5; import com.jpexs.decompiler.flash.ReReadableInputStream; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; import com.jpexs.decompiler.flash.action.parser.pcode.Label; import com.jpexs.decompiler.flash.action.treemodel.FunctionTreeItem; import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer; import com.jpexs.decompiler.flash.graph.GraphTargetItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Stack; public class ActionDefineFunction extends Action implements GraphSourceItemContainer { public String functionName; public String replacedFunctionName; public List paramNames = new ArrayList(); public List replacedParamNames; //public List code; public int codeSize; private int version; public List constantPool; private long hdrSize; public ActionDefineFunction(int actionLength, SWFInputStream sis, ReReadableInputStream rri, int version) throws IOException { super(0x9B, actionLength); this.version = version; //byte data[]=sis.readBytes(actionLength); //sis=new SWFInputStream(new ByteArrayInputStream(data),version); long startPos = sis.getPos(); functionName = sis.readString(); int numParams = sis.readUI16(); for (int i = 0; i < numParams; i++) { paramNames.add(sis.readString()); } codeSize = sis.readUI16(); long endPos = sis.getPos(); //code = new ArrayList(); hdrSize = endPos - startPos; int posBef2 = rri.getPos(); //code = sis.readActionList(rri.getPos(), getFileAddress() + hdrSize, rri, codeSize); //rri.setPos(posBef2 + codeSize); } public ActionDefineFunction(long containerSWFPos, boolean ignoreNops, List