small fixes

master
Henry Jameson 2 months ago
parent 6f99d6c8b0
commit 397566c76b
  1. 14
      index.js
  2. 5
      yacardemu.js

@ -92,20 +92,28 @@ if (opts.remoteYace) {
yace.startPolling()
}, 1000)
})
yace.startPolling()
} else {
yace.on('error', () => {
yace.on('error', (e) => {
logger.error('Emulator error!')
setTimeout(() => {
yace.startPolling()
}, 1000)
})
yace.on('exit', () => {
logger.error('Emulator exited!')
process.exit(1)
})
yace.initTmp()
yace
.start()
.then(() => {
setTimeout(() => {
yace.startPolling()
}, 1000)
})
}
yace.startPolling()
const onInit = () => {
logger.info('Ready for new play.')

@ -105,14 +105,15 @@ apiport = ${port}
autoselectedcard = dummy.bin
`
emitter.initTmp = () => {
emitter.start = () => {
tmp.setGracefulCleanup();
let dir = null
let cleanupFunc = null
tmp.dir().then(({ path, cleanup }) => {
return tmp.dir().then(({ path, cleanup }) => {
dir = path,
cleanupFunc = cleanup
logger.debug('YACE config:\n' + yaceIniTemplate(saves, port, device, game))
return writeFile(path + '/config.ini', yaceIniTemplate(saves, port, device, game))
}).then(() => {
const yace = spawn('YACardEmu', [], { cwd: dir })

Loading…
Cancel
Save