2022-10-10 12:50:21 +00:00
|
|
|
import { SysCallMapping, System } from "../system.ts";
|
2022-10-12 09:47:13 +00:00
|
|
|
import { AssetBundle } from "../asset_bundle/bundle.ts";
|
2022-10-10 12:50:21 +00:00
|
|
|
|
|
|
|
export default function assetSyscalls(system: System<any>): SysCallMapping {
|
|
|
|
return {
|
|
|
|
"asset.readAsset": (
|
|
|
|
ctx,
|
|
|
|
name: string,
|
2022-10-12 09:47:13 +00:00
|
|
|
): string => {
|
2022-10-10 12:50:21 +00:00
|
|
|
return (system.loadedPlugs.get(ctx.plug.name)!.manifest!
|
2022-10-12 09:47:13 +00:00
|
|
|
.assets as AssetBundle).readFileAsDataUrl(name);
|
2022-10-10 12:50:21 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|