Files

28 lines
880 B
JavaScript
Raw Permalink Normal View History

2022-07-28 18:14:21 +03:00
//app part not related to ESOP JS implementation
function main() {
var devCfg = {
2022-07-28 22:55:10 +03:00
audio: null,
2022-07-28 18:14:21 +03:00
canvas: document.getElementById('C') //JS-specific implementation canvas DOM reference
2022-07-31 10:25:53 +03:00
}, vm = UxnCore(), ext = ESOPExtensions()
2022-07-28 18:14:21 +03:00
document.getElementById('apprun').addEventListener('click', function() {
var fileObj = document.getElementById('appselect').files[0]
if(fileObj.name.endsWith('.eso')) {
var rdr = new FileReader()
rdr.onload = function() {
2022-07-28 22:55:10 +03:00
devCfg.audio = new (window.AudioContext || window.webkitAudioContext)
2022-07-28 18:14:21 +03:00
vm.boot()
ext.setup(vm, devCfg)
vm.load(new Uint8Array(rdr.result))
console.log('VM started')
vm.start(0x100)
}
rdr.readAsArrayBuffer(fileObj)
}
else window.alert('Please select an .eso file to run on ESOP')
})
}
addEventListener('DOMContentLoaded', main)