function registerHostFunctions(t,u){const l=8;const m=28;const p=.04;globalThis.addEventListener(`gamepadconnected`,()=>{});t.env.getGamepads=n=>{const t=navigator.getGamepads();const e=u?u.memory:wasm_memory;const a=new Float32Array(e.buffer);const o=new Uint32Array(e.buffer);const s=new Uint8Array(e.buffer);for(const[r,i]of t.slice(0,l).entries()){let t=n+m*r+1;if(!i||!i.connected||i.mapping!=="standard"){s[t]=0;continue}s[t]=1;t+=3;let e=0;for(const[c,f]of i.buttons.entries()){if(c<17&&f.pressed)e|=1<{const s=navigator.getGamepads().find(t=>t?.index===e);s?.vibrationActuator?.playEffect("dual-rumble",{duration:t,startDelay:n,strongMagnitude:a,weakMagnitude:o})}}