spacemeowx2 / flash-emu

Run flascc in js
MIT License
20 stars 1 forks source link

能获取到类,调方法时出错 TypeError: Cannot read property 'call' of null #6

Open ghost opened 5 years ago

ghost commented 5 years ago

test.js:

const fs = require('fs')
const util = require('util')
const readFile = util.promisify(fs.readFile)
const FlashEmu = require('flash-emu')
FlashEmu.PLAYERGLOBAL = 'node_modules/flash-emu/lib/playerglobal.abc'
FlashEmu.BUILTIN = 'node_modules/flash-emu/lib/builtin.abc'
const emu = new FlashEmu({
  async readFile (filename) {
    const buf = await readFile(filename)
    return new Uint8Array(buf).buffer
  }
})
const vm = emu.getVM()
emu.runSWF('test.swf', false).then(() => {
  const DYFUtil = emu.getPublicClass('DYFUtil')
  console.log(DYFUtil)
  const proxy = vm.getProxy(DYFUtil)
  proxy.callProperty('GetObjectBase64', '{"content":"testContent","type":114514}')
}).catch(e => console.error(e))

建个空文件夹,然后 npm install flash-emu 安装的 按照demo来写 javascript,可以通过 getPublicClass 来获取到类,但是调用方法的时候报错了

TypeError: Cannot read property 'call' of null
    at pe.callProperty (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:31868)
    at gt.79 (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:64216)
    at gt.70 (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:63885)
    at gt.interpret (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:75175)
    at Ee.a (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:50985)
    at pe.callProperty (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:31868)
    at Object.callProperty (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\node_modules\flash-emu\dist\flashemu.js:6:32832)
    at emu.runSWF.then (C:\Python27\Lib\site-packages\streamlink\plugins\zz\flash-emu-demo\test.js:18:9)
    at 

QQ截图20190331193707 反编译swf看到的类 不知道是不是姿势不对,大佬能看下吗? 链接: https://pan.baidu.com/s/1fHsG0_-wpN3HwVIY7gerCA 提取码: 3y9w

spacemeowx2 commented 5 years ago

如果是自解压/密的swf建议运行解压后的swf

ghost commented 5 years ago

是zlib解压缩吗? https://github.com/OpenGG/swfzip 我用这个解压了swf,文件从8k涨到了14k,但是还是同样的报错。 更新了网盘链接,包含了解压前和解压后的swf

ghost commented 5 years ago

大佬能指点一下吗? 唯一的希望就在你这里了 (>﹏<) ~>_<~