Play-/js/psfplayer_node/index.ts

25 lines
826 B
TypeScript
Raw Permalink Normal View History

function convertStringVectorToArray(strVector : any) {
let strArray : string[] = [];
for(let i = 0; i < strVector.size(); i++) {
let str = strVector.get(i);
strArray.push(str);
}
strVector.delete();
return strArray;
}
2021-09-02 14:02:13 -04:00
var main = async function() {
2023-05-17 20:16:28 -04:00
let factory = require("../../../build_cmake/build_wasm/tools/PsfPlayer/Source/ui_js/PsfPlayer.js");
let module = await factory();
2021-09-02 14:02:13 -04:00
module.FS.mkdir("/work");
module.FS.mount(module.NODEFS, { root: "."}, "/work");
2021-11-01 09:38:37 -04:00
let psfArchivePath = "work/psf/Valkyrie Profile (EMU).zophar.zip";
let psfArchiveFileList = convertStringVectorToArray(module.getPsfArchiveFileList(psfArchivePath));
2021-11-01 09:38:37 -04:00
module.ccall("initVm");
module.loadPsf(psfArchivePath, psfArchiveFileList[0]);
console.log("Finished initialization.");
2021-09-02 14:02:13 -04:00
}();