This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.8.0 <0.9.0; | |
interface INFTVaultFactory { | |
struct CreationInfo { | |
bool createdHere; | |
uint16 version; | |
} | |
function creationInfo(address) external view returns (CreationInfo memory); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pathOrBuffer === pck) { | |
return Promise.resolve(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.preloadedFiles = [ { path: pck, buffer:pckBuffer, } ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pck = "Platformer 2D.pck"; | |
this.preloadedFiles = [ { path: pck, buffer:pckBuffer, } ]; | |
this.preload = function (pathOrBuffer, destPath, fileSize) { | |
let buffer = null; | |
if (typeof pathOrBuffer === 'string') { | |
if (pathOrBuffer === pck) { | |
return Promise.resolve(); | |
} | |
const me = this; | |
return this.loadPromise(pathOrBuffer, fileSize).then(function (buf) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
// Use a lookup table to find the index. | |
const lookup = new Uint8Array(256); | |
for (let i = 0; i < chars.length; i++) { | |
lookup[chars.charCodeAt(i)] = i; | |
} | |
function decode(base64) { | |
var bufferLength = base64.length * 0.75, | |
len = base64.length, | |
i, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
// Replace as necessary | |
const NAME = "Platformer 2D"; | |
let code = fs.readFileSync(`./${NAME}.wasm`); | |
fs.writeFileSync("base64.wasm", code.toString("base64")); | |
code = fs.readFileSync(`./${NAME}.pck`); | |
fs.writeFileSync("base64.pck", code.toString("base64")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wasmCode = "<copy contents of base64.wasm>"; | |
const wasmBuffer = decode(wasmCode); | |
const pckCode = "<copy contents of base64.pck>"; | |
const pckBuffer = decode(pckCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Engine.load = function (basePath, size) { | |
... | |
return loadPromise; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Engine.load = function (basePath, size) { | |
if (loadPromise == null) { | |
loadPath = basePath; | |
loadPromise = Promise.resolve({ | |
clone: () => ({ | |
body: wasmBuffer | |
}), | |
}); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.preloadedFiles = []; | |
this.preload = function (pathOrBuffer, destPath, fileSize) { | |
let buffer = null; | |
… | |
return Promise.reject(new Error('Invalid object for preloading')); | |
}; |
NewerOlder