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,
|
const self = this,
|
||||||
{ arg, cli } = context
|
{ arg, cli } = context
|
||||||
|
|
||||||
console.log(context)
|
|
||||||
|
|
||||||
if(arg.arguments.length > 0) {
|
if(arg.arguments.length > 0) {
|
||||||
let path = $fs.utils.resolvePath(arg.arguments[0])
|
let path = $fs.utils.resolvePath(arg.arguments[0])
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const localBasePath = '.config/xash/saves',
|
const constants = require('./util/constants.json')
|
||||||
localExt = '.jso'
|
|
||||||
|
|
||||||
const callIfPresent = (func, args, fallback = false) => {
|
const callIfPresent = (func, args, fallback = false) => {
|
||||||
if(typeof func === 'function') {
|
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 {
|
class EmulatedIDB {
|
||||||
constructor() {
|
constructor() {
|
||||||
const self = this
|
const self = this
|
||||||
|
@ -22,8 +22,7 @@ const textDecoder = new TextDecoder('utf-8')
|
|||||||
class ModPackage {
|
class ModPackage {
|
||||||
static async unpack(buffer, direct = false) {
|
static async unpack(buffer, direct = false) {
|
||||||
let asar = new Asar(buffer),
|
let asar = new Asar(buffer),
|
||||||
manifestString = textDecoder.decode( asar.get('manifest.json') ),
|
manifestString = textDecoder.decode( asar.get('manifest.json') )
|
||||||
files = [ ...asar.contents ]
|
|
||||||
|
|
||||||
const decompress = path => new Promise((resolve, reject) => {
|
const decompress = path => new Promise((resolve, reject) => {
|
||||||
// gzip(asar.get(path), (error, data) => {
|
// gzip(asar.get(path), (error, data) => {
|
||||||
@ -35,13 +34,17 @@ class ModPackage {
|
|||||||
// resolve([ path, toArrayBuffer(data) ])
|
// resolve([ path, toArrayBuffer(data) ])
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
console.log(path)
|
||||||
resolve([ path, asar.get(path) ])
|
resolve([ path, asar.get(path) ])
|
||||||
})
|
})
|
||||||
|
|
||||||
files.splice(files.indexOf('manifest.json'), 1)
|
let files = asar.contents
|
||||||
files = files.map(decompress)
|
.toSpliced(asar.contents.indexOf('manifest.json'), 1)
|
||||||
|
.map(decompress)
|
||||||
|
|
||||||
files = await Promise.all(files)
|
files = await Promise.all(files)
|
||||||
|
|
||||||
|
console.log(asar, files, manifestString)
|
||||||
return direct ? { files, manifestString } : new this(new Map(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('loader1', false);
|
||||||
// showElement('optionsTitle', false);
|
// showElement('optionsTitle', false);
|
||||||
// showElement('fSettings', 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.arguments = instance.arguments;
|
||||||
Module.run = run = savedRun;
|
Module.run = run = savedRun;
|
||||||
// if( radioChecked('Zip') )
|
// if( radioChecked('Zip') )
|
||||||
@ -243,12 +250,6 @@ function startXash()
|
|||||||
// script.src = pkgMods.length>1?document.getElementById('selectPkg').value:pkgMods[0][0];
|
// 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);
|
showElement('canvas', true);
|
||||||
|
|
||||||
|
@ -38,30 +38,6 @@
|
|||||||
<canvas style="display:none" class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
<canvas style="display:none" class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
||||||
<code id="status"></code>
|
<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 type='text/javascript' lsrc='../init.js'></script>
|
||||||
<script>
|
<script>
|
||||||
// Causes the app to freeze. Maybe make async?
|
// Causes the app to freeze. Maybe make async?
|
||||||
@ -86,6 +62,5 @@
|
|||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user