Fix everything up so it actually runs lol
This commit is contained in:
parent
33227ec881
commit
32c4c705f6
@ -43,8 +43,6 @@ class App {
|
||||
const self = this,
|
||||
{ arg, cli } = context
|
||||
|
||||
console.log(context)
|
||||
|
||||
if(arg.arguments.length > 0) {
|
||||
let path = $fs.utils.resolvePath(arg.arguments[0])
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
const localBasePath = '.config/xash/saves',
|
||||
localExt = '.jso'
|
||||
const constants = require('./util/constants.json')
|
||||
|
||||
const callIfPresent = (func, args, fallback = false) => {
|
||||
if(typeof func === 'function') {
|
||||
@ -9,6 +8,25 @@ const callIfPresent = (func, args, fallback = false) => {
|
||||
}
|
||||
}
|
||||
|
||||
// const pathToKey = (path) => {
|
||||
// let key = $fs.utils.resolvePath(path)
|
||||
|
||||
// if(key.startsWith('/a/')) {
|
||||
// key.slice(3)
|
||||
// }
|
||||
|
||||
// if(key.endsWith('/')) {
|
||||
// key = key.slice(0, -1)
|
||||
// }
|
||||
|
||||
// return key
|
||||
// }
|
||||
|
||||
const localBasePath = constants.storage.baseKey
|
||||
const localExt = constants.storage.objectsInFilesystem.ext
|
||||
|
||||
console.log('LOCAL BASE PATH', localBasePath)
|
||||
|
||||
class EmulatedIDB {
|
||||
constructor() {
|
||||
const self = this
|
||||
|
@ -22,8 +22,7 @@ const textDecoder = new TextDecoder('utf-8')
|
||||
class ModPackage {
|
||||
static async unpack(buffer, direct = false) {
|
||||
let asar = new Asar(buffer),
|
||||
manifestString = textDecoder.decode( asar.get('manifest.json') ),
|
||||
files = [ ...asar.contents ]
|
||||
manifestString = textDecoder.decode( asar.get('manifest.json') )
|
||||
|
||||
const decompress = path => new Promise((resolve, reject) => {
|
||||
// gzip(asar.get(path), (error, data) => {
|
||||
@ -35,13 +34,17 @@ class ModPackage {
|
||||
// resolve([ path, toArrayBuffer(data) ])
|
||||
// })
|
||||
|
||||
console.log(path)
|
||||
resolve([ path, asar.get(path) ])
|
||||
})
|
||||
|
||||
files.splice(files.indexOf('manifest.json'), 1)
|
||||
files = files.map(decompress)
|
||||
let files = asar.contents
|
||||
.toSpliced(asar.contents.indexOf('manifest.json'), 1)
|
||||
.map(decompress)
|
||||
|
||||
files = await Promise.all(files)
|
||||
|
||||
console.log(asar, files, manifestString)
|
||||
return direct ? { files, manifestString } : new this(new Map(files), manifestString)
|
||||
}
|
||||
|
||||
|
15
view/init.js
15
view/init.js
@ -220,7 +220,14 @@ function startXash()
|
||||
// showElement('loader1', false);
|
||||
// showElement('optionsTitle', false);
|
||||
// showElement('fSettings', false);
|
||||
setupFS();
|
||||
instance.package.then(data => {
|
||||
modPackage = data
|
||||
script.src = modPackage.getURL(modPackage.manifest.entry)
|
||||
console.log('PAYLOAD: ', script.src)
|
||||
|
||||
setupFS();
|
||||
})
|
||||
|
||||
Module.arguments = instance.arguments;
|
||||
Module.run = run = savedRun;
|
||||
// if( radioChecked('Zip') )
|
||||
@ -243,12 +250,6 @@ function startXash()
|
||||
// script.src = pkgMods.length>1?document.getElementById('selectPkg').value:pkgMods[0][0];
|
||||
// }
|
||||
|
||||
instance.package.then(data => {
|
||||
console.log('Loading package...')
|
||||
modPackage = data
|
||||
script.src = modPackage.getURL(modPackage.manifest.entry)
|
||||
console.log('PAYLOAD: ', script.src)
|
||||
})
|
||||
|
||||
showElement('canvas', true);
|
||||
|
||||
|
@ -38,30 +38,6 @@
|
||||
<canvas style="display:none" class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
||||
<code id="status"></code>
|
||||
|
||||
<script>
|
||||
{
|
||||
// const { indexedDb } = window
|
||||
|
||||
// window.indexedDB = new Proxy(indexedDb, {
|
||||
// get(target, prop) {
|
||||
// if(prop == 'open') {
|
||||
// return function(...args) {
|
||||
// if(args[0] == 'UPLINK') {
|
||||
// console.log('Preventing IDB cache')
|
||||
// return {}
|
||||
// } else {
|
||||
// return indexedDb.open.call(this, ...args)
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// return indexedDb[prop]
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
// indexedDB.open('UPLINK', 1)
|
||||
}
|
||||
</script>
|
||||
<script type='text/javascript' lsrc='../init.js'></script>
|
||||
<script>
|
||||
// Causes the app to freeze. Maybe make async?
|
||||
@ -86,6 +62,5 @@
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user