static function string($clipactionrecord, $opts = array()) { $text = ''; $text .= IO_SWF_Type_CLIPEVENTFLAGS::string($clipactionrecord['EventFlags'], $opts); $text .= "\n"; $text .= "\tActions:\n"; foreach ($clipactionrecord['Actions'] as $action) { $text .= "\t"; $text .= IO_SWF_Type_Action::string($action, $opts); $text .= "\n"; } return $text; }
static function string($condAction, $opts = array()) { $text = "\tBUTTONCONDACTION (CondActionSize:{$condAction['CondActionSize']})\n"; $text .= "\t\tCondAction: "; foreach (self::$buttoncond_list as $key) { $text .= " {$key}:" . $condAction['Cond' . $key]; } $text .= "\n"; $text .= "\t\tCondKeyPress:" . $condAction['CondKeyPress'] . " CondOverDownToIdle:" . $condAction['CondOverDownToIdle'] . "\n"; $text .= "\t\tActions:\n"; foreach ($condAction['Actions'] as $action) { $text .= "\t\t\t" . IO_SWF_Type_Action::string($action, $opts) . "\n"; } return $text; }
function replaceActionStrings($trans_table) { $replaced = false; foreach ($this->_actions as &$action) { if (IO_SWF_Type_Action::replaceActionString($action, $trans_table)) { $replaced = true; } } unset($action); return $replaced; }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->_buttonId); $opts['tagCode'] = $tagCode; if ($tagCode == 34) { // DefineButton2 $writer->putUIBits($this->_reservedFlags, 7); $writer->putUIBit($this->_trackAsMenu); list($offset_actionOffset, $dummy) = $writer->getOffset(); $writer->putUI16LE(0); // dummy; } foreach ($this->_characters as $character) { IO_SWF_Type_BUTTONRECORD::build($writer, $character, $opts); } $writer->putUI8(0); // terminater of button record if ($tagCode == 34) { // DefineButton2 $actions = array(); if (is_null($this->_actions) === false) { list($offset_buttonCondition, $dummy) = $writer->getOffset(); $writer->setUI16LE($offset_buttonCondition - $offset_actionOffset, $offset_actionOffset); foreach ($this->_actions as $idx => $action) { if (isset($this->_actions[$idx + 1]) === false) { $opts['lastAction'] = true; } else { $opts['lastAction'] = false; } IO_SWF_Type_BUTTONCONDACTION::build($writer, $action, $opts); } } } else { foreach ($this->_actions as $action) { IO_SWF_Type_Action::build($writer, $action); } $writer->putUI8(0); // terminator of actions } return $writer->output(); }
static function dumpActionTag($tag, $frame, $opts) { echo " Actions: (in frame {$frame})"; if ($tag->code == 59) { // DoInitAction echo " SpriteID=" . $tag->tag->_spriteId; } echo "\n"; $basic_block = array(); // self::decomposePush($tag); for ($i = 0; $i < count($tag->tag->_actions); $i++) { $action = $tag->tag->_actions[$i]; if (isset($tag->tag->_labels[$i])) { self::dumpBasicBlock($basic_block, $i, $opts); $basic_block = array(); echo " (LABEL" . $tag->tag->_labels[$i] . "):\n"; } $action_str = IO_SWF_Type_Action::getCodeName($action['Code']); if (isset($tag->tag->_branches[$i])) { self::dumpBasicBlock($basic_block, $i, $opts); $basic_block = array(); echo "\t{$action_str}"; echo " (LABEL" . $tag->tag->_branches[$i] . ")\n"; } else { $basic_block[] = $action; } } if (count($basic_block) != 0) { self::dumpBasicBlock($basic_block, $i, $opts); } if (isset($tag->tag->_labels[$i])) { echo " (LABEL" . $tag->tag->_labels[$i] . "):\n"; } }
} echo "SWF Version:{$version} Check Version:{$check_version}\n"; foreach ($swf->_tags as $tag) { $code = $tag->code; $tag_name = $tag->getTagInfo($code, "name"); $tag_ver = $tag->getTagInfo($code, "version"); if (is_null($tag_ver)) { continue; } if ($check_version < $tag_ver) { echo "{$tag_name}({$code}):{$tag_ver}\n"; } if ($code === 12 || $code === 59) { // DoAction or DoInitAction if ($tag->parseTagContent()) { $actions = $tag->tag->_actions; foreach ($actions as $action) { $actionCode = $action['Code']; $actionVersion = IO_SWF_Type_Action::getCodeVersion($actionCode); if ($check_version < $actionVersion) { $actionName = IO_SWF_Type_Action::getCodeName($actionCode); $hexCode = strtoupper(dechex($actionCode)); echo " {$actionName}(0x{$hexCode}):{$actionVersion}\n"; } } } else { echo "Illegal Action Contents\n"; } } } exit(0);