spacemeowx2 / flash-emu

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

2.0版flashemu调用某鱼swf出错 #4

Closed ir193 closed 6 years ago

ir193 commented 6 years ago

不知是不是使用姿势错了


const fs = require('fs')
const util = require('util')
const readFile = util.promisify(fs.readFile)
const FlashEmu = require('./flashemu2')
FlashEmu.PLAYERGLOBAL = './playerglobal.abc'
FlashEmu.BUILTIN = './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('./douyu.swf', false).then(() => {
  let roomId = '24422'
  let time = Math.round(new Date().getTime() / 60 / 1000)
  let did = "202CB962AC59075B964B07152D234B70"

  const CModule = vm.getProxy(emu.getProperty('sample.mp', 'CModule'))
  const xx = vm.getProxy(emu.getPublicClass('mp'))

  console.log('getProxy')
  CModule.callProperty('startAsync') // <= 这里会报错,TypeError: Cannot read property 'call' of undefined

  console.log('after')

  let StreamSignDataPtr = CModule.callProperty('malloc', 4)
  let outptr1 = CModule.callProperty('malloc', 4)

  let datalen = xx.callProperty('sub_2', parseInt(roomId), parseInt(time), did.toString(), outptr1, StreamSignDataPtr)

/*
omit
*/
spacemeowx2 commented 6 years ago

能把你的这些文件发我一份吗? 包括abc和swf

ir193 commented 6 years ago

我使用的就是DouyuHTML5Player里的abc和swf文件,node v10.4.1 dist.zip

spacemeowx2 commented 6 years ago

旧的abc应该不能在新版用, 试着用2.0编译abc

spacemeowx2 commented 6 years ago

顺便一提 npm 里安装的话应该是自带 abc 的

ir193 commented 6 years ago

明白了,是我理解错了。 我以为abc是要自己提供的。使用 npm 里安装的没有问题