import { gear } from '@Z64Online/mm/models/zobjs/gear' ; import { object_link_deity } from '@Z64Online/mm/models/zobjs/object_link_deity' ; import { object_link_goron } from '@Z64Online/mm/models/zobjs/object_link_goron' ; import { object_link_human } from '@Z64Online/mm/models/zobjs/object_link_human' ; import { object_link_nuts } from '@Z64Online/mm/models/zobjs/object_link_nuts' ; import { object_link_zora } from '@Z64Online/mm/models/zobjs/object_link_zora' ; import { object_link_boy } from '@Z64Online/oot/models/zobjs/object_link_boy' ; import { object_link_child } from '@Z64Online/oot/models/zobjs/object_link_child' ; import fs from 'fs' ; import path from 'path' ; import { Z64LibSupportedGames } from 'Z64Lib/API/Utilities/Z64LibSupportedGames' ; import { Z64_GAME } from 'Z64Lib/src/Common/types/GameAliases' ; import { decodeAsset } from './decoder' ; import { proxy_universal } from './proxy_universal' ; export default class AssetBootstrap { constructor ( ) { this . extract ( ) ; } extract ( ) { try { fs . mkdirSync ( "./cache" ) ; } catch ( err ) { } let extractIfMissing = ( p , buf ) => { if ( fs . existsSync ( p ) ) return ; fs . writeFileSync ( p , decodeAsset ( buf ) ) ; } ; if ( Z64_GAME === Z64LibSupportedGames . MAJORAS_MASK ) { extractIfMissing ( path . join ( "./cache" , "human.zobj" ) , object_link_human ) ; extractIfMissing ( path . join ( "./cache" , "zora.zobj" ) , object_link_zora ) ; extractIfMissing ( path . join ( "./cache" , "nuts.zobj" ) , object_link_nuts ) ; extractIfMissing ( path . join ( "./cache" , "fd.zobj" ) , object_link_deity ) ; extractIfMissing ( path . join ( "./cache" , "goron.zobj" ) , object_link_goron ) ; extractIfMissing ( path . join ( "./cache" , "gear.zobj" ) , gear ) ; } else if ( Z64_GAME === Z64LibSupportedGames . OCARINA_OF_TIME ) { extractIfMissing ( path . join ( "./cache" , "adult.zobj" ) , object_link_boy ) ; extractIfMissing ( path . join ( "./cache" , "child.zobj" ) , object_link_child ) ; } extractIfMissing ( path . join ( "./cache" , "proxy_universal.zobj" ) , proxy_universal ) ; } }