{"id":726,"date":"2010-08-17T13:49:49","date_gmt":"2010-08-17T04:49:49","guid":{"rendered":"http:\/\/labs.gree.jp\/blog\/?p=726"},"modified":"2021-04-27T15:03:19","modified_gmt":"2021-04-27T06:03:19","slug":"post726","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2010\/08\/726\/","title":{"rendered":"SWF\u30d0\u30a4\u30ca\u30ea\u7de8\u96c6\u306e\u30b9\u30b9\u30e1\u7b2c\u4e8c\u56de"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30e1\u30c7\u30a3\u30a2\u958b\u767a\u90e8\u306e\u3088\u3084\u3067\u3059\u3002<\/p>\n<p>\u30d0\u30a4\u30ca\u30ea\u7de8\u96c6\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u524d\u56de\u306f\u30d0\u30a4\u30ca\u30ea\u306e\u8aad\u307f\u65b9\u3067\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<br \/>\n\u3059\u307f\u307e\u305b\u3093\u3002\u4eca\u56de\u306f\u7de8\u96c6\u307e\u3067\u8a71\u3057\u3092\u9032\u3081\u307e\u3059\u3002<\/p>\n<h3 id=\"hs_0ca9eb7d6623589c76a45b65fa8c661f_header_0\"> \u30d0\u30a4\u30ca\u30ea\u7de8\u96c6\u306e\u624b\u59cb\u3081<\/h3>\n<p>\u307e\u305a\u3001\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u5207\u308a\u51fa\u3057\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u9069\u5207\u306b\u6c7a\u3081\u305f\u5185\u90e8\u5f62\u5f0f\u306b\u4fdd\u5b58\u3057\u3066\u3001<br \/>\n\u305d\u308c\u3092\u4f55\u3082\u52a0\u5de5\u305b\u305a\u51fa\u529b\u3057\u3001\u5143\u3068\u4e00\u81f4\u3059\u308b\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u304c\u751f\u6210\u3055\u308c\u308b\u306e\u3092\u78ba\u8a8d\u3059\u308b\u6240\u304b\u3089\u59cb\u3081\u307e\u3059\u3002<\/p>\n<p>\u524d\u56de\u3001BitReader \u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u30d0\u30a4\u30ca\u30ea\u306e\u30c7\u30fc\u30bf\u3092\u5207\u308a\u51fa\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306f\u3001<br \/>\n\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u7d44\u307f\u7acb\u3066\u308b BitWriter \u6a5f\u80fd\u304c\u52a0\u308f\u3063\u305f IO_Bit \u30af\u30e9\u30b9\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n <a href=\"http:\/\/svn.openpear.org\/IO_Bit\/branches\/1.0\/IO\/Bit.php\">http:\/\/svn.openpear.org\/IO_Bit\/branches\/1.0\/IO\/Bit.php<\/a><\/p>\n<ul>\n<li>  IO_Bit \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"superpre \">\n pear channel-discover openpear.org\n pear install openpear\/IO_Bit<\/pre>\n<h3 id=\"hs_0ca9eb7d6623589c76a45b65fa8c661f_header_1\"> swfcopy<\/h3>\n<p>\u524d\u56de\u306e swfdump \u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u6539\u9020\u3059\u308b\u6d41\u308c\u3067\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>swfdump \u3067\u884c\u3063\u3066\u3044\u305f<\/p>\n<ul>\n<li> \u30d0\u30a4\u30ca\u30ea\u304b\u3089\u5207\u308a\u51fa\u3057\u305f\u30c7\u30fc\u30bf\u3092\u305d\u306e\u307e\u307e echo \u3067\u8868\u793a<\/li>\n<\/ul>\n<p>\u306e\u51e6\u7406\u3092\u30af\u30e9\u30b9\u306b\u5305\u307f\u3001swfdump \u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u30ed\u30b8\u30c3\u30af(a)\u3068\u8868\u793a\u30ed\u30b8\u30c3\u30af(b)\u306b\u5206\u3051\u3066\u3001\u304b\u3064(a)\u3092\u5143\u306b\u51fa\u529b\u30ed\u30b8\u30c3\u30af(c)\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li> (a) \u30d0\u30a4\u30ca\u30ea\u304b\u3089\u5207\u308a\u51fa\u3057\u305f\u30c7\u30fc\u30bf\u3092\u30af\u30e9\u30b9\u5909\u6570\u306b\u4fdd\u5b58 (parse)<\/li>\n<li> (b) \u30af\u30e9\u30b9\u5909\u6570\u3092 echo \u3067\u8868\u793a (dump)<\/li>\n<li> (c) \u30af\u30e9\u30b9\u5909\u6570\u3092\u5143\u306b\u30d0\u30a4\u30ca\u30ea\u3068\u3057\u3066\u7d44\u307f\u7acb\u3066 (build)<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2010\/08\/UI_SWF.png\" alt=\"UI_SWF\" \/><\/p>\n<p>\u5177\u4f53\u7684\u306a\u30b3\u30fc\u30c9\u3068\u3057\u3066\u306f\u3001swfdump \u3067\u306f\u3001<\/p>\n<pre class=\"superpre php\">\n$reader = new BitReader();\n$reader->input($swfdata);\necho 'Signature: '.$reader->getData(3).PHP_EOL;\necho 'Version: '.$reader->getUI8().PHP_EOL;<\/pre>\n<p>\u3068\u3057\u3066\u3044\u305f\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"superpre php\">\nrequire_once 'IO\/Bit.php';\nclass IO_SWF {\n    var $_headers = array();\n    function parse($swfdata) {\n        $reader = new IO_Bit();\n        $reader->input($swfdata);\n        $this->_headers['Signature'} = $reader->getData(3);\n        $this->_headers['Version'] = $reader->getUI8();\n    }\n    function dump() {\n        echo 'Signature: '.$this->_headers['Signature'].PHP_EOL;\n        echo 'Version: '.$this->_headers['Version'].PHP_EOL;\n    }\n    function build() {]\n        $writer = new IO_Bit();\n        $writer->putData($this->_headers['Signature']);\n        $writer->putUI8($this->_headers['Version']);\n    }<\/pre>\n<p>\u3042\u3068\u306f\u5358\u7d14\u4f5c\u696d\u3067\u3001\u6b8b\u308a\u5168\u3066\u306e\u30c7\u30fc\u30bf\u306b\u3064\u3044\u3066\u4e0a\u8a18\u306e\u5bfe\u5fdc\u3092\u884c\u3046\u3068\u4ee5\u4e0b\u306e\u30af\u30e9\u30b9\u304c\u51fa\u6765\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li> <a href=\"http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF.php\">http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF.php<\/a><\/li>\n<li> <a href=\"http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF\/Dumper.php\">http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF\/Dumper.php<\/a> (dump function \u306f\u3053\u3061\u3089\u306b\u5206\u96e2)<\/li>\n<li> IO_SWF \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5<\/li>\n<\/ul>\n<pre class=\"superpre \">\n pear channel-discover openpear.org\n pear install openpear\/IO_SWF<\/pre>\n<p>\u3055\u3066\u3001IO_SWF \u3092\u7528\u3044\u3066 SWF\u306e\u30d0\u30a4\u30ca\u30ea\u3092\u53d6\u308a\u8fbc\u307f\u3001\u52a0\u5de5\u305b\u305a\u306b\u305d\u308c\u3092\u7d44\u307f\u7acb\u3066\u76f4\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<ul>\n<li> <a href=\"http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/sample\/swfcopy.php\">http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/sample\/swfcopy.php<\/a><\/li>\n<\/ul>\n<pre class=\"superpre php\">\nrequire 'IO\/SWF.php';\n$swfdata = file_get_contents($argv[1]);\n$swf = new IO_SWF();\n$swf->parse($swfdata);\necho $swf->build();<\/pre>\n<p>\u5b9f\u884c<\/p>\n<pre class=\"superpre \">\n% php swfcopy.php orz.swf  > t.swf\n% md5sum  orz.swf t.swf\n337a4edee9590382133f8f66ff67259b  orz.swf\n337a4edee9590382133f8f66ff67259b  t.swf<\/pre>\n<p>\u5b8c\u74a7\u306b\u4e00\u81f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u5f8c\u306f\u3001\u30af\u30e9\u30b9\u5909\u6570\u3092\u66f8\u304d\u63db\u3048\u3066\u304b\u3089\u30d0\u30a4\u30ca\u30ea\u3092\u7d44\u307f\u7acb\u3066\u308b\u4e8b\u3067\u3001\u597d\u304d\u306a\u3088\u3046\u306b\u30d0\u30a4\u30ca\u30ea\u3092\u3044\u3058\u308b\u4e8b\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<h3 id=\"hs_0ca9eb7d6623589c76a45b65fa8c661f_header_2\"> \u80cc\u666f\u8272\u5909\u66f4<\/h3>\n<p>\u8a66\u3057\u306b\u3001IO_SWF \u3092\u5229\u7528\u3057\u3066\u80cc\u666f\u8272\u3092\u5909\u66f4\u3059\u308b\u3060\u3051\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u80cc\u666f\u8272\u3092\u8868\u3059\u30bf\u30b0\u306f SetBackgroundColor (Tag Code=9) \u3067\u3059\u3002<br \/>\n8bit depth RGB \u3067 3Byte \u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u306e\u3067\u3001\u305d\u3053\u3092\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2010\/08\/swf_setbgcolor_replace.png\" alt=\"SetBackgroundColor\u5165\u308c\u66ff\u3048\" \/><\/p>\n<p>\u30bf\u30b0\u756a\u53f7\u3092\u6307\u5b9a\u3057\u3066\u4fdd\u6301\u3059\u308b\u30c7\u30fc\u30bf\u3092\u5165\u308c\u66ff\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<br \/>\nIO_SWF \u306e parse \u3067\u30bf\u30b0\u306e\u30ea\u30b9\u30c8\u304c\u30af\u30e9\u30b9\u5909\u6570\u306e $this->_tags \u306b\u5165\u308b\u306e\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li> <a href=\"http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF\/Editor.php\">http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/IO\/SWF\/Editor.php<\/a><\/li>\n<\/ul>\n<pre class=\"superpre php\">\nclass IO_SWF_Editor extends IO_SWF {\n    \/\/ var $_tags; \/\/ protected\n    function replaceTagContent($tagCode, $content) {\n        foreach ($this->_tags as &$tag) {\n            if ($tag['Code'] == $tagCode) {\n                $tag['Length'] = strlen($content);\n                $tag['Content'] = $content;\n                 break;\n            }\n        }\n    }\n}<\/pre>\n<p>\u4e0a\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u3001\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u8272\u306e\u5024\u3067\u5165\u308c\u66ff\u3048\u307e\u3059\u3002<\/p>\n<ul>\n<li> <a href=\"http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/sample\/swfsetbgcolor.php\">http:\/\/svn.openpear.org\/IO_SWF\/branches\/1.0\/sample\/swfsetbgcolor.php<\/a><\/li>\n<\/ul>\n<pre class=\"superpre php\">\n$swfdata = file_get_contents($argv[1]);\n$swf = new IO_SWF_Editor();\n$swf->parse($swfdata);\n$color = pack('CCC', $argv[2], $argv[3], $argv[4]);\n$swf->replaceTagContent(9, $color);\necho $swf->build();<\/pre>\n<ul>\n<li> \u5b9f\u884c<\/li>\n<\/ul>\n<pre class=\"superpre \">\n% php swfsetbgcolor.php  orz.swf  0 0 255 > blueorz.swf\n% php swfsetbgcolor.php  orz.swf  0 255 0 > greenorz.swf<\/pre>\n<ul>\n<li> \u5b9f\u884c\u524d SWF (orz.swf)<\/li>\n<\/ul>\n<ul>\n<li> \u5b9f\u884c\u5f8c SWF (blueorz.swf)<\/li>\n<\/ul>\n<ul>\n<li> \u5b9f\u884c\u5f8c SWF (greenorz.swf)<\/li>\n<\/ul>\n<p>\u80cc\u666f\u8272\u304c\u5909\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u66f8\u304d\u63db\u3048\u308b\u969b\u306e\u6ce8\u610f\u3067\u3059\u304c\u3001\u30b5\u30a4\u30ba\u304c\u5909\u308f\u308b\u66f8\u304d\u63db\u3048\u3092\u884c\u3046\u5834\u5408(\u4f8b\u3048\u3070\u753b\u50cf\u3084\u97f3\u58f0\u306e\u30c7\u30fc\u30bf\u3092\u5165\u308c\u66ff\u3048\u308b\u7b49)\u306f\u3001<br \/>\ntag \u306e length \u3068 header \u306e FileLength \u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3082\u3042\u308f\u305b\u3066\u66f8\u304d\u63db\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u30b5\u30a4\u30ba\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u66f8\u304d\u63db\u3048\u306b\u3064\u3044\u3066\u306f\u3001\u6b21\u56de\u306e\u30d6\u30ed\u30b0\u3067\u53d6\u308a\u4e0a\u3052\u307e\u3059\u3002<\/p>\n<h3 id=\"hs_0ca9eb7d6623589c76a45b65fa8c661f_header_3\"> \u6b21\u56de\u4e88\u544a<\/h3>\n<p>\u6b21\u56de\u306f\u5185\u90e8ID\u5165\u308c\u66ff\u3048\u3068\u3001\u753b\u50cf\u306e\u5165\u308c\u66ff\u3048\u51e6\u7406\u306b\u3064\u3044\u3066\u304a\u8a71\u3057\u307e\u3059\u3002<br \/>\n\u305d\u308c\u3067\u306f\u5931\u793c\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30e1\u30c7\u30a3\u30a2\u958b\u767a\u90e8\u306e\u3088\u3084\u3067\u3059\u3002 \u30d0\u30a4\u30ca\u30ea\u7de8\u96c6\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u524d\u56de\u306f\u30d0\u30a4\u30ca\u30ea\u306e\u8aad\u307f\u65b9\u3067\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 \u3059\u307f\u307e\u305b\u3093\u3002\u4eca\u56de\u306f\u7de8\u96c6\u307e\u3067\u8a71\u3057\u3092\u9032\u3081\u307e\u3059\u3002 \u30d0\u30a4\u30ca\u30ea\u7de8\u96c6\u306e\u624b\u59cb\u3081 \u307e\u305a\u3001\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u5207\u308a\u51fa\u3057 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[18,8],"class_list":["post-726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-info","tag-flash","tag-php"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=726"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":21136,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions\/21136"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}