(function() { 'use strict'; window._wasmRuntimeReady = false; var canvasElement = document.getElementById('canvas'); window.spinnerElement = { style: { display: 'none' } }; window.statusElement = { innerText: '' }; window.progressElement = { hidden: false, value: 0 }; window.canvas = window.canvasElement = canvasElement; window._pendingGLB = null; window._pendingCharacterId = null; window._pendingAdminFlag = undefined; window._pendingGameMode = []; window._confirmedModelId = 0; window._nativeCharPreviewReady = false; window._dangerLastMap = 'Backrooms'; window.Module = { noInitialRun: true, arguments: [], canvas: canvasElement, locateFile: function(path) { return path; }, onRuntimeInitialized: function() { window._wasmRuntimeReady = true; window._nativeCharPreviewReady = true; window.spinnerElement = document.getElementById('spinner') || window.spinnerElement; window.statusElement = document.getElementById('loader-detail') || window.statusElement; window.progressElement = document.getElementById('loader-progress-fill') || window.progressElement; if (typeof Module !== 'undefined' && Module.FS && typeof Module.FS.writeFile === 'function') { if (window._pendingGLB) { try { Module.FS.writeFile(`/drengine/models/player/${window._pendingGLB.name}.glb`, window._pendingGLB.bytes); } catch (fsErr) { console.warn('[DREngine] Flushing pending GLB failed:', fsErr.message); } window._pendingGLB = null; } if (window._pendingCharacterId !== null && typeof Module._onCharacterModelSelected === 'function') { Module._onCharacterModelSelected(window._pendingCharacterId); window._pendingCharacterId = null; } } if (typeof Module._native_inject_game_menus === 'function') { Module._native_inject_game_menus(); } if (window._pendingAdminFlag !== undefined && typeof Module._native_inject_admin_panel === 'function') { Module._native_inject_admin_panel(window._pendingAdminFlag); window._pendingAdminFlag = undefined; } if (window._pendingGameMode && typeof Module._setGameModeNative === 'function') { while (window._pendingGameMode.length > 0) { var mode = window._pendingGameMode.shift(); try { Module._setGameModeNative(mode); } catch(e) { console.warn('Pending game mode start failed:', e.message); } } } // Expose admin pin verification and marketplace coin sync wrappers window.native_verify_admin_pin = function(pinHash) { if (typeof Module._native_verify_admin_pin === 'function') { return Module._native_verify_admin_pin(pinHash); } return 0; }; window.native_sync_market_coins = function(playerId, coinBalance) { if (typeof Module._native_sync_market_coins === 'function') { return Module._native_sync_market_coins(playerId, coinBalance); } return 0; }; }, print: function(text) { console.log("[DREngine]: " + text); }, printErr: function(text) { console.error("[DREngine Error]: " + text); }, noInitialRun: true }; })();