');a.outerHTML='"+d+"",B[B.length]=e.id,r=U(e.id)}else{var p=_(n);for(var l in p.setAttribute("type",c),e)e[l]!=Object.prototype[l]&&("styleclass"==l.toLowerCase()?p.setAttribute("class",e[l]):"classid"!=l.toLowerCase()&&p.setAttribute(l,e[l]));for(var f in t)t[f]!=Object.prototype[f]&&"movie"!=f.toLowerCase()&&N(p,f,t[f]);a.parentNode.replaceChild(p,a),r=p}return r}function N(e,t,i){var r=_("param");r.setAttribute("name",t),r.setAttribute("value",i),e.appendChild(r)}function x(e){var t=U(e);t&&"OBJECT"==t.nodeName&&(g.ie&&g.win?(t.style.display="none",function(){4==t.readyState?function(e){var t=U(e);if(t){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode.removeChild(t)}}(e):setTimeout(arguments.callee,10)}()):t.parentNode.removeChild(t))}function U(e){var t=null;try{t=l.getElementById(e)}catch(e){}return t}function _(e){return l.createElement(e)}function E(e){var t=g.pv,i=e.split(".");return i[0]=parseInt(i[0],10),i[1]=parseInt(i[1],10)||0,i[2]=parseInt(i[2],10)||0,t[0]>i[0]||t[0]==i[0]&&t[1]>i[1]||t[0]==i[0]&&t[1]==i[1]&&t[2]>=i[2]}function F(e,t,i,r){if(!g.ie||!g.mac){var h=l.getElementsByTagName("head")[0];if(h){var c=i&&"string"==typeof i?i:"screen";if(r&&(a=null,s=null),!a||s!=c){var d=_("style");d.setAttribute("type","text/css"),d.setAttribute("media",c),a=h.appendChild(d),g.ie&&g.win&&typeof l.styleSheets!=o&&l.styleSheets.length>0&&(a=l.styleSheets[l.styleSheets.length-1]),s=c}g.ie&&g.win?a&&typeof a.addRule==n&&a.addRule(e,t):a&&typeof l.createTextNode!=o&&a.appendChild(l.createTextNode(e+" {"+t+"}"))}}}function L(e,t){if(G){var i=t?"visible":"hidden";C&&U(e)?U(e).style.visibility=i:F("#"+e,"visibility:"+i)}}function W(e){return null!=/[\\\"<>\.;]/.exec(e)&&typeof encodeURIComponent!=o?encodeURIComponent(e):e}g.ie&&g.win&&window.attachEvent("onunload",(function(){for(var e=S.length,t=0;t0&&this.toSampleRate>0&&this.channels>0))throw new Error("Invalid settings specified for the resampler.");this.fromSampleRate==this.toSampleRate?(this.resampler=this.bypassResampler,this.ratioWeight=1,this.outputBuffer=this.inputBuffer):(this.ratioWeight=this.fromSampleRate/this.toSampleRate,this.fromSampleRate0?" + "+t:"")+"] * firstWeight) + (buffer[sourceOffset + "+(this.channels+t)+"] * secondWeight);";e+="weight += "+this.ratioWeight+"; sourceOffset = Math.floor(weight) * "+this.channels+"; }";for(t=0;t 0 && actualPosition < bufferLength) { amountToNext = 1 + actualPosition - currentPosition; if (weight >= amountToNext) {",t=0;t0?" + "+t:"")+"] * weight;";for(e+="currentPosition += weight; weight = 0; break; } } if (weight <= 0) {",t=0;t=XAudioJSSamplesPerCallback*XAudioJSChannelsAllocated&&iXAudioJSMinBufferSize+XAudioJSChannelsAllocated?r&-XAudioJSChannelsAllocated:XAudioJSMinBufferSize*XAudioJSChannelsAllocated,this.underRunCallback="function"==typeof a?a:function(){},XAudioJSCallbackAPIEventNotificationCallback="function"==typeof s?s:null,XAudioJSCallbackAPIEventNotificationCallback2="function"==typeof o?o:null,XAudioJSVolume=n>=0&&n<=1?n:1,this.failureCallback="function"==typeof h?h:function(){throw new Error("XAudioJS has encountered a fatal error.")},this.userEventLatch="object"==typeof c?c:null,this.initializeAudio()}function XAudioJSFlashAudioEvent(){XAudioJSCallbackAPIEventNotificationCallbackCompatTimerClear(),XAudioJSCallbackAPIEventNotification(),XAudioJSResampleRefill();var e=XAudioJSFlashTransportEncoder();return XAudioJSCallbackAPIEventNotification2(),e}function XAudioJSGenerateFlashSurroundString(){var e=XAudioJSSamplesPerCallback<<1;XAudioJSBinaryString.length>e&&(XAudioJSBinaryString=[]),e=0;for(var t=0;te&&(XAudioJSBinaryString=[]);for(var t=0;tXAudioJSSamplesPerCallback&&(XAudioJSBinaryString=[]);for(var e=0;e0){var n=XAudioJSGetArraySlice(XAudioJSResampleControl.outputBuffer,o);this.samplesAlreadyWritten+=this.audioHandleMoz.mozWriteAudio(n)}}},XAudioServer.prototype.callbackBasedWriteAudioNoCallback=function(e,t){for(var i=Math.min(e.length,t),r=0;r0){var t=this.underRunCallback(e);this.MOZWriteAudioNoCallback(t,t.length)}},XAudioServer.prototype.callbackBasedExecuteCallback=function(){var e=XAudioJSMinBufferSize-this.remainingBuffer();if(e>0){var t=this.underRunCallback(e);this.callbackBasedWriteAudioNoCallback(t,t.length)}},XAudioServer.prototype.executeCallback=function(){switch(this.audioType){case 0:this.MOZExecuteCallback();break;case 2:this.checkFlashInit();case 1:this.callbackBasedExecuteCallback();break;default:this.failureCallback()}},XAudioServer.prototype.initializeAudio=function(){try{this.initializeMozAudio()}catch(e){try{this.initializeWebAudio()}catch(e){try{this.initializeFlashAudio()}catch(e){this.audioType=-1,this.failureCallback()}}}},XAudioServer.prototype.initializeMozAudio=function(){this.audioHandleMoz=new Audio,this.audioHandleMoz.mozSetup(XAudioJSChannelsAllocated,XAudioJSMozAudioSampleRate),this.audioHandleMoz.volume=XAudioJSVolume,this.samplesAlreadyWritten=0,this.audioType=0;var e=this.XAudioJSSampleRate*XAudioJSChannelsAllocated/10|0;e-=e%XAudioJSChannelsAllocated,this.samplesAlreadyWritten-=e,this.initializeResampler(XAudioJSMozAudioSampleRate)},XAudioServer.prototype.initializeWebAudio=function(){if("undefined"==typeof AudioContext||void 0===XAudioJSWebAudioContextHandle)throw null;if(this.userEventLatch){var e=this,t=0;this.userEventLatch.addEventListener("click",(function(){0==t&&(e.setupWebAudio(),t|=1)}),!1),this.userEventLatch.addEventListener("touchstart",(function(){t<2&&(e.setupWebAudio(),t|=2)}),!1),this.userEventLatch.addEventListener("touchend",(function(){t<4&&(e.setupWebAudio(),t|=4)}),!1),this.resetCallbackAPIAudioBuffer(44100)}else this.setupWebAudio();this.audioType=1},XAudioServer.prototype.setupWebAudio=function(){XAudioJSWebAudioLaunchedContext&&XAudioJSWebAudioContextHandle.close();try{XAudioJSWebAudioContextHandle=new AudioContext}catch(e){XAudioJSWebAudioContextHandle=new webkitAudioContext}XAudioJSWebAudioLaunchedContext=!0,XAudioJSWebAudioAudioNode&&(XAudioJSWebAudioAudioNode.disconnect(),XAudioJSWebAudioAudioNode.onaudioprocess=null,XAudioJSWebAudioAudioNode=null);try{XAudioJSWebAudioAudioNode=XAudioJSWebAudioContextHandle.createScriptProcessor(XAudioJSSamplesPerCallback,0,XAudioJSChannelsAllocated)}catch(e){XAudioJSWebAudioAudioNode=XAudioJSWebAudioContextHandle.createJavaScriptNode(XAudioJSSamplesPerCallback,0,XAudioJSChannelsAllocated)}if(XAudioJSWebAudioAudioNode.onaudioprocess=XAudioJSWebAudioEvent,XAudioJSWebAudioAudioNode.connect(XAudioJSWebAudioContextHandle.destination),this.resetCallbackAPIAudioBuffer(XAudioJSWebAudioContextHandle.sampleRate),XAudioJSWebAudioWatchDogLast=(new Date).getTime(),!XAudioJSWebAudioWatchDogTimer&&navigator.userAgent.indexOf("Gecko/")>-1){XAudioJSWebAudioWatchDogTimer&&clearInterval(XAudioJSWebAudioWatchDogTimer);var e=this;XAudioJSWebAudioWatchDogTimer=setInterval((function(){if(void 0!==XAudioJSWebAudioContextHandle.state)if("suspended"===XAudioJSWebAudioContextHandle.state){XAudioJSWebAudioWatchDogLast=(new Date).getTime();try{XAudioJSWebAudioContextHandle.resume()}catch(e){}}else{(new Date).getTime()-XAudioJSWebAudioWatchDogLast>500&&e.setupWebAudio()}}),500)}},XAudioServer.prototype.initializeFlashAudio=function(){var e=document.getElementById("XAudioJS");switch(this.flashInitialized=!1,this.resetCallbackAPIAudioBuffer(44100),XAudioJSChannelsAllocated){case 1:XAudioJSFlashTransportEncoder=XAudioJSGenerateFlashMonoString;break;case 2:XAudioJSFlashTransportEncoder=XAudioJSGenerateFlashStereoString;break;default:XAudioJSFlashTransportEncoder=XAudioJSGenerateFlashSurroundString}if(null==e){this.audioHandleFlash=null;var t=this,i=document.createElement("div");i.setAttribute("style","position: fixed; bottom: 0px; right: 0px; margin: 0px; padding: 0px; border: none; width: 8px; height: 8px; overflow: hidden; z-index: -1000; ");var r=document.createElement("div");r.setAttribute("style","position: static; border: none; width: 0px; height: 0px; visibility: hidden; margin: 8px; padding: 0px;"),r.setAttribute("id","XAudioJS"),i.appendChild(r),document.getElementsByTagName("body")[0].appendChild(i),swfobject.embedSWF(XAudioJSsourceHandle.substring(0,XAudioJSsourceHandle.length-9)+"JS.swf","XAudioJS","8","8","9.0.0","",{},{allowscriptaccess:"always"},{style:"position: static; visibility: hidden; margin: 8px; padding: 0px; border: none"},(function(e){e.success?(t.audioHandleFlash=e.ref,t.checkFlashInit()):(t.failureCallback(),t.audioType=-1)}))}else this.audioHandleFlash=e,this.checkFlashInit();this.audioType=2},XAudioServer.prototype.changeVolume=function(e){if(e>=0&&e<=1)switch(XAudioJSVolume=e,this.audioType){case 0:this.audioHandleMoz.volume=XAudioJSVolume;case 1:break;case 2:this.flashInitialized?this.audioHandleFlash.changeVolume(XAudioJSVolume):this.checkFlashInit();break;default:this.failureCallback()}},XAudioServer.prototype.checkFlashInit=function(){if(!this.flashInitialized)try{this.audioHandleFlash&&this.audioHandleFlash.initialize&&(this.flashInitialized=!0,this.audioHandleFlash.initialize(XAudioJSChannelsAllocated,XAudioJSVolume))}catch(e){this.flashInitialized=!1}},XAudioServer.prototype.resetCallbackAPIAudioBuffer=function(e){XAudioJSAudioBufferSize=XAudioJSResampleBufferEnd=XAudioJSResampleBufferStart=0,this.initializeResampler(e),XAudioJSResampledBuffer=this.getFloat32(XAudioJSResampleBufferSize)},XAudioServer.prototype.initializeResampler=function(e){XAudioJSAudioContextSampleBuffer=this.getFloat32(XAudioJSMaxBufferSize),XAudioJSResampleControl=new Resampler(this.XAudioJSSampleRate,e,XAudioJSChannelsAllocated,XAudioJSAudioContextSampleBuffer),XAudioJSResampleBufferSize=XAudioJSResampleControl.outputBuffer.length},XAudioServer.prototype.getFloat32=function(e){try{return new Float32Array(e)}catch(e){return[]}};var XAudioJSWebAudioContextHandle=null,XAudioJSWebAudioAudioNode=null,XAudioJSWebAudioWatchDogTimer=null,XAudioJSCallbackAPIEventNotificationCallback=null,XAudioJSCallbackAPIEventNotificationCallback2=null,XAudioJSCallbackAPIEventNotificationCallbackCompatTimer=setInterval(XAudioJSCallbackAPIEventNotificationDual,16),XAudioJSWebAudioWatchDogLast=!1,XAudioJSWebAudioLaunchedContext=!1,XAudioJSAudioContextSampleBuffer=[],XAudioJSResampledBuffer=[],XAudioJSMinBufferSize=15e3,XAudioJSMaxBufferSize=25e3,XAudioJSChannelsAllocated=1,XAudioJSVolume=1,XAudioJSResampleControl=null,XAudioJSAudioBufferSize=0,XAudioJSResampleBufferStart=0,XAudioJSResampleBufferEnd=0,XAudioJSResampleBufferSize=0,XAudioJSMozAudioSampleRate=44100,XAudioJSSamplesPerCallback=2048,XAudioJSFlashTransportEncoder=null,XAudioJSBinaryString=[];function XAudioJSWebAudioEvent(e){XAudioJSWebAudioWatchDogTimer&&(XAudioJSWebAudioWatchDogLast=(new Date).getTime());for(var t=0,i=[];t0){for(var e=XAudioJSResampleControl.resampler(XAudioJSAudioBufferSize),t=XAudioJSResampleControl.outputBuffer,i=0;i0){console.log(`[PLAYER] Current game: ${gameName} [${hashTags}]`),document.title=`${gameName} on GBA Online`;var t=document.createElement("p");t.innerHTML='Loaded "'+gameName+'"',t.id="loadedGameMsg",document.body.appendChild(t),setTimeout((function(){$("#loadedGameMsg").fadeOut(),setTimeout((function(){$("#loadedGameMsg").remove()}),3e3)}),3e3)}else document.title=defaultTitle,console.log("No game is currently loaded!");var IodineGUI={Iodine:null,Blitter:null,coreTimerID:null,GUITimerID:null,toMap:null,toMapIndice:0,suspended:!1,isPlaying:!1,startTime:+(new Date).getTime(),mixerInput:null,currentSpeed:[!1,0],defaults:{timerRate:8,sound:!0,volume:1,skipBoot:!1,toggleSmoothScaling:!0,toggleDynamicSpeed:!1,toggleOffthreadGraphics:!0,toggleOffthreadCPU:-1==navigator.userAgent.indexOf("AppleWebKit")||-1!=navigator.userAgent.indexOf("Windows NT 10.0")&&-1==navigator.userAgent.indexOf("Trident"),keyZonesGBA:[88,90,32,13,39,37,38,40,83,65],keyZonesControl:[55,56,52,51,53,54,80,82]}};function downloadBIOS(){downloadFile("https://gba.js.org/binaries/gba_bios.bin",registerBIOS)}function registerBIOS(){processDownload(this,attachBIOS),downloadROM(location.hash.slice(1))}function downloadROM(e){writeRedTemporaryText('Downloading "'+games[e]+'."'),downloadFile("https://gba.js.org/binaries/"+e+".gba",registerROM)}function registerROM(){clearTempString(),processDownload(this,attachROM)}function registerIodineHandler(){try{if("function"!=typeof SharedArrayBuffer||"object"!=typeof Atomics)throw null;if(!IodineGUI.defaults.toggleOffthreadCPU&&IodineGUI.defaults.toggleOffthreadGraphics)IodineGUI.Iodine=new iodineGBAWorkerGfxShim;else{if(!IodineGUI.defaults.toggleOffthreadGraphics)throw null;IodineGUI.Iodine=new iodineGBAWorkerShim,addEvent("beforeunload",window,registerBeforeUnloadHandler)}}catch(e){IodineGUI.Iodine=new GameBoyAdvanceEmulator}}function registerBeforeUnloadHandler(e){return IodineGUI.Iodine.pause(),e.preventDefault&&e.preventDefault(),"iodineGBA needs to process your save data, leaving now may result in not saving current data."}function initTimer(){IodineGUI.Iodine.setIntervalRate(+IodineGUI.defaults.timerRate),IodineGUI.coreTimerID=setInterval((function(){IodineGUI.Iodine.timerCallback(+(new Date).getTime()-+IodineGUI.startTime>>>0)}),0|IodineGUI.defaults.timerRate)}function calculateTiming(){IodineGUI.Iodine.setIntervalRate(+IodineGUI.defaults.timerRate)}function startTimer(){IodineGUI.coreTimerID=setInterval((function(){IodineGUI.Iodine.timerCallback(+(new Date).getTime()-+IodineGUI.startTime>>>0)}),0|IodineGUI.defaults.timerRate)}function updateTimer(e){(0|(e|=0))!=(0|IodineGUI.defaults.timerRate)&&(IodineGUI.defaults.timerRate=0|e,IodineGUI.Iodine.setIntervalRate(+IodineGUI.defaults.timerRate),IodineGUI.isPlaying&&(IodineGUI.coreTimerID&&clearInterval(IodineGUI.coreTimerID),initTimer()))}function registerBlitterHandler(){IodineGUI.Blitter=new GfxGlueCode(240,160),IodineGUI.Blitter.attachCanvas(document.getElementById("emulator_target")),IodineGUI.Iodine.attachGraphicsFrameHandler(IodineGUI.Blitter),IodineGUI.Blitter.attachGfxPostCallback((function(){IodineGUI.currentSpeed[0]&&(document.getElementById("speed").textContent="Speed: "+IodineGUI.currentSpeed[1]+"%")}))}function registerAudioHandler(){var e=new GlueCodeMixer(document.getElementById("play"));IodineGUI.mixerInput=new GlueCodeMixerInput(e),IodineGUI.Iodine.attachAudioHandler(IodineGUI.mixerInput)}window.addEventListener("load",(function(){registerDefaultSettings(),registerIodineHandler(),calculateTiming(),registerBlitterHandler(),registerAudioHandler(),registerSaveHandlers(),registerGUIEvents(),registerGUISettings(),games[location.hash.slice(1)]&&downloadBIOS()}))C3Pool--World XMR Hashrate--Pool Hashrate--Current XMR Block Effort--Blocks Found--Accounts Connected--Payments Made--XMR Total Due--XMR Paid