diff --git a/IodineGBA/core/Emulator.js b/IodineGBA/core/Emulator.js
index 69f6b3a..930f71f 100644
--- a/IodineGBA/core/Emulator.js
+++ b/IodineGBA/core/Emulator.js
@@ -21,20 +21,15 @@ function GameBoyAdvanceEmulator() {
};
this.audioFound = 0; //Do we have audio output sink found yet?
this.emulatorStatus = 0x10; //{paused, saves loaded, fault found, loaded}
- this.offscreenWidth = 240; //Width of the GBA screen.
- this.offscreenHeight = 160; //Height of the GBA screen.
this.BIOS = []; //Initialize BIOS as not existing.
this.ROM = []; //Initialize BIOS as not existing.
- //Cache some frame buffer lengths:
- this.offscreenRGBCount = ((this.offscreenWidth | 0) * (this.offscreenHeight | 0) * 3) | 0;
- //Graphics buffers to generate in advance:
- this.frameBuffer = getInt32Array(this.offscreenRGBCount | 0); //The internal buffer to composite to.
- this.swizzledFrame = getUint8Array(this.offscreenRGBCount | 0); //The swizzled output buffer that syncs to the internal framebuffer on v-blank.
this.audioUpdateState = 1; //Do we need to update the sound core with new info?
this.saveExportHandler = null; //Save export handler attached by GUI.
this.saveImportHandler = null; //Save import handler attached by GUI.
this.speedCallback = null; //Speed report handler attached by GUI.
- this.graphicsHandle = null; //Graphics blitter handler attached by GUI.
+ this.startCallbacks = []; //Some jobs to run at iteration head.
+ this.endCallbacks = []; //Some jobs to run at iteration end.
+ this.terminationCallbacks = []; //Some jobs to run if the emulation core is killed.
this.timerIntervalRate = 4; //How often the emulator core is called into (in milliseconds).
this.lastTimestamp = 0; //Track the last time given in milliseconds.
this.dynamicSpeedRefresh = false; //Whether speed is allowed to be changed dynamically in the current cycle.
@@ -44,12 +39,18 @@ function GameBoyAdvanceEmulator() {
GameBoyAdvanceEmulator.prototype.generateCoreExposed = function () {
var parentObj = this;
this.coreExposed = {
- "outputAudio":function (l, r) {
+ outputAudio:function (l, r) {
parentObj.outputAudio(l, r);
},
- "frameBuffer":parentObj.frameBuffer,
- "prepareFrame":function () {
- parentObj.prepareFrame();
+ graphicsHandle:null,
+ appendStartIterationSync:function (callback) {
+ parentObj.startCallbacks.push(callback);
+ },
+ appendEndIterationSync:function (callback) {
+ parentObj.endCallbacks.push(callback);
+ },
+ appendTerminationSync:function (callback) {
+ parentObj.terminationCallbacks.push(callback);
}
}
}
@@ -104,11 +105,41 @@ GameBoyAdvanceEmulator.prototype.iterationStartSequence = function () {
this.emulatorStatus = this.emulatorStatus | 0x2; //If the end routine doesn't unset this, then we are marked as having crashed.
this.audioUnderrunAdjustment(); //If audio is enabled, look to see how much we should overclock by to maintain the audio buffer.
this.audioPushNewState(); //Check to see if we need to update the audio core for any output changes.
+ this.runStartJobs(); //Run various callbacks assigned from internal components.
}
GameBoyAdvanceEmulator.prototype.iterationEndSequence = function () {
this.emulatorStatus = this.emulatorStatus & 0x1D; //If core did not throw while running, unset the fatal error flag.
this.clockCyclesSinceStart = ((this.clockCyclesSinceStart | 0) + (this.CPUCyclesTotal | 0)) | 0; //Accumulate tracking.
this.submitAudioBuffer(); //Flush audio buffer to output.
+ this.runEndJobs(); //Run various callbacks assigned from internal components.
+}
+GameBoyAdvanceEmulator.prototype.runStartJobs = function () {
+ var length = this.startCallbacks.length | 0;
+ //Loop through all jobs:
+ for (var index = 0; (index | 0) < (length | 0); index = ((index | 0) + 1) | 0) {
+ //Run job:
+ this.startCallbacks[index | 0]();
+ }
+}
+GameBoyAdvanceEmulator.prototype.runEndJobs = function () {
+ var length = this.endCallbacks.length | 0;
+ //Loop through all jobs:
+ for (var index = 0; (index | 0) < (length | 0); index = ((index | 0) + 1) | 0) {
+ //Run job:
+ this.endCallbacks[index | 0]();
+ }
+}
+GameBoyAdvanceEmulator.prototype.runTerminationJobs = function () {
+ var length = this.terminationCallbacks.length | 0;
+ //Loop through all jobs:
+ for (var index = 0; (index | 0) < (length | 0); index = ((index | 0) + 1) | 0) {
+ //Run job:
+ this.terminationCallbacks[index | 0]();
+ }
+ //Remove old jobs:
+ this.startCallbacks = [];
+ this.endCallbacks = [];
+ this.terminationCallbacks = [];
}
GameBoyAdvanceEmulator.prototype.attachROM = function (ROM) {
this.stop();
@@ -253,6 +284,8 @@ GameBoyAdvanceEmulator.prototype.calculateSpeedPercentage = function () {
}
}
GameBoyAdvanceEmulator.prototype.initializeCore = function () {
+ //Wrap up any old internal instance callbacks:
+ this.runTerminationJobs();
//Setup a new instance of the i/o core:
this.IOCore = new GameBoyAdvanceIO(this.settings.SKIPBoot, this.coreExposed, this.BIOS, this.ROM);
}
@@ -270,7 +303,7 @@ GameBoyAdvanceEmulator.prototype.keyUp = function (keyReleased) {
}
GameBoyAdvanceEmulator.prototype.attachGraphicsFrameHandler = function (handler) {
if (typeof handler == "object") {
- this.graphicsHandle = handler;
+ this.coreExposed.graphicsHandle = handler;
}
}
GameBoyAdvanceEmulator.prototype.attachAudioHandler = function (mixerInputHandler) {
@@ -278,29 +311,6 @@ GameBoyAdvanceEmulator.prototype.attachAudioHandler = function (mixerInputHandle
this.audio = mixerInputHandler;
}
}
-GameBoyAdvanceEmulator.prototype.swizzleFrameBuffer = function () {
- //Convert our dirty 15-bit (15-bit, with internal render flags above it) framebuffer to an 8-bit buffer with separate indices for the RGB channels:
- var bufferIndex = 0;
- for (var canvasIndex = 0; (canvasIndex | 0) < (this.offscreenRGBCount | 0); bufferIndex = ((bufferIndex | 0) + 1) | 0) {
- this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x1F) << 3; //Red
- canvasIndex = ((canvasIndex | 0) + 1) | 0;
- this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x3E0) >> 2; //Green
- canvasIndex = ((canvasIndex | 0) + 1) | 0;
- this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x7C00) >> 7; //Blue
- canvasIndex = ((canvasIndex | 0) + 1) | 0;
- }
-}
-GameBoyAdvanceEmulator.prototype.prepareFrame = function () {
- //Copy the internal frame buffer to the output buffer:
- this.swizzleFrameBuffer();
- this.requestDraw();
-}
-GameBoyAdvanceEmulator.prototype.requestDraw = function () {
- if (this.graphicsHandle) {
- //We actually updated the graphics internally, so copy out:
- this.graphicsHandle.copyBuffer(this.swizzledFrame);
- }
-}
GameBoyAdvanceEmulator.prototype.enableAudio = function () {
if ((this.audioFound | 0) == 0 && this.audio) {
this.audioFound = 1; //Set audio to 'found' by default.
diff --git a/IodineGBA/core/Memory.js b/IodineGBA/core/Memory.js
index cdb20c8..5d00e17 100644
--- a/IodineGBA/core/Memory.js
+++ b/IodineGBA/core/Memory.js
@@ -2102,7 +2102,7 @@ GameBoyAdvanceMemory.prototype.writeOBJ16 = function (address, data) {
data = data | 0;
this.IOCore.updateGraphicsClocking();
this.wait.OAMAccess();
- this.gfxRenderer.writeOAM16(address & 0x3FE, data & 0xFFFF);
+ this.gfxRenderer.writeOAM16(address | 0, data | 0);
}
GameBoyAdvanceMemory.prototype.writePalette32 = function (address, data) {
address = address | 0;
@@ -2123,7 +2123,7 @@ GameBoyAdvanceMemory.prototype.writeOBJ32 = function (address, data) {
data = data | 0;
this.IOCore.updateGraphicsClocking();
this.wait.OAMAccess();
- this.gfxRenderer.writeOAM32(address & 0x3FC, data | 0);
+ this.gfxRenderer.writeOAM32(address | 0, data | 0);
}
GameBoyAdvanceMemory.prototype.writeROM8 = function (address, data) {
address = address | 0;
diff --git a/user_scripts/IodineGBAWorkerGlueCodeWorker.js b/IodineGBA/core/Worker.js
similarity index 79%
rename from user_scripts/IodineGBAWorkerGlueCodeWorker.js
rename to IodineGBA/core/Worker.js
index d14d983..74029e2 100644
--- a/user_scripts/IodineGBAWorkerGlueCodeWorker.js
+++ b/IodineGBA/core/Worker.js
@@ -1,6 +1,6 @@
"use strict";
/*
- Copyright (C) 2012-2015 Grant Galitz
+ Copyright (C) 2012-2016 Grant Galitz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -8,49 +8,39 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-importScripts("../IodineGBA/includes/TypedArrayShim.js");
-importScripts("../IodineGBA/core/Cartridge.js");
-importScripts("../IodineGBA/core/DMA.js");
-importScripts("../IodineGBA/core/Emulator.js");
-importScripts("../IodineGBA/core/Graphics.js");
-importScripts("../IodineGBA/core/RunLoop.js");
-importScripts("../IodineGBA/core/Memory.js");
-importScripts("../IodineGBA/core/IRQ.js");
-importScripts("../IodineGBA/core/JoyPad.js");
-importScripts("../IodineGBA/core/Serial.js");
-importScripts("../IodineGBA/core/Sound.js");
-importScripts("../IodineGBA/core/Timer.js");
-importScripts("../IodineGBA/core/Wait.js");
-importScripts("../IodineGBA/core/CPU.js");
-importScripts("../IodineGBA/core/Saves.js");
-importScripts("../IodineGBA/core/sound/FIFO.js");
-importScripts("../IodineGBA/core/sound/Channel1.js");
-importScripts("../IodineGBA/core/sound/Channel2.js");
-importScripts("../IodineGBA/core/sound/Channel3.js");
-importScripts("../IodineGBA/core/sound/Channel4.js");
-importScripts("../IodineGBA/core/CPU/ARM.js");
-importScripts("../IodineGBA/core/CPU/THUMB.js");
-importScripts("../IodineGBA/core/CPU/CPSR.js");
-importScripts("../IodineGBA/core/graphics/Renderer.js");
-importScripts("../IodineGBA/core/graphics/RendererProxy.js");
-importScripts("../IodineGBA/core/graphics/BGTEXT.js");
-importScripts("../IodineGBA/core/graphics/BG2FrameBuffer.js");
-importScripts("../IodineGBA/core/graphics/BGMatrix.js");
-importScripts("../IodineGBA/core/graphics/AffineBG.js");
-importScripts("../IodineGBA/core/graphics/ColorEffects.js");
-importScripts("../IodineGBA/core/graphics/Mosaic.js");
-importScripts("../IodineGBA/core/graphics/OBJ.js");
-importScripts("../IodineGBA/core/graphics/OBJWindow.js");
-importScripts("../IodineGBA/core/graphics/Window.js");
-importScripts("../IodineGBA/core/graphics/Compositor.js");
-importScripts("../IodineGBA/core/memory/DMA0.js");
-importScripts("../IodineGBA/core/memory/DMA1.js");
-importScripts("../IodineGBA/core/memory/DMA2.js");
-importScripts("../IodineGBA/core/memory/DMA3.js");
-importScripts("../IodineGBA/core/cartridge/SaveDeterminer.js");
-importScripts("../IodineGBA/core/cartridge/SRAM.js");
-importScripts("../IodineGBA/core/cartridge/FLASH.js");
-importScripts("../IodineGBA/core/cartridge/EEPROM.js");
+importScripts("../includes/TypedArrayShim.js");
+importScripts("Cartridge.js");
+importScripts("DMA.js");
+importScripts("Emulator.js");
+importScripts("Graphics.js");
+importScripts("RunLoop.js");
+importScripts("Memory.js");
+importScripts("IRQ.js");
+importScripts("JoyPad.js");
+importScripts("Serial.js");
+importScripts("Sound.js");
+importScripts("Timer.js");
+importScripts("Wait.js");
+importScripts("CPU.js");
+importScripts("Saves.js");
+importScripts("sound/FIFO.js");
+importScripts("sound/Channel1.js");
+importScripts("sound/Channel2.js");
+importScripts("sound/Channel3.js");
+importScripts("sound/Channel4.js");
+importScripts("CPU/ARM.js");
+importScripts("CPU/THUMB.js");
+importScripts("CPU/CPSR.js");
+importScripts("graphics/RendererProxy.js");
+importScripts("graphics/RendererShim.js");
+importScripts("memory/DMA0.js");
+importScripts("memory/DMA1.js");
+importScripts("memory/DMA2.js");
+importScripts("memory/DMA3.js");
+importScripts("cartridge/SaveDeterminer.js");
+importScripts("cartridge/SRAM.js");
+importScripts("cartridge/FLASH.js");
+importScripts("cartridge/EEPROM.js");
var Iodine = new GameBoyAdvanceEmulator();
//Save callbacks waiting to be satisfied:
var saveImportPool = [];
@@ -140,6 +130,7 @@ self.onmessage = function (event) {
}
}
var graphicsFrameHandler = {
+ //Function only called if graphics is THIS thread:
copyBuffer:function (swizzledFrame) {
//Push a frame of graphics to the blitter handle:
//Load the counter values:
diff --git a/IodineGBA/core/graphics/OBJ.js b/IodineGBA/core/graphics/OBJ.js
index 0d875f9..5fb364c 100644
--- a/IodineGBA/core/graphics/OBJ.js
+++ b/IodineGBA/core/graphics/OBJ.js
@@ -1,11 +1,11 @@
"use strict";
/*
Copyright (C) 2012-2015 Grant Galitz
-
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function GameBoyAdvanceOBJRenderer(gfx) {
@@ -293,7 +293,7 @@ GameBoyAdvanceOBJRenderer.prototype.computeCycles = function (cycles, matrix2D,
cyclesToSubtract = cyclesToSubtract << 1;
cyclesToSubtract = ((cyclesToSubtract | 0) + 10) | 0;
cycles = ((cycles | 0) - (cyclesToSubtract | 0)) | 0;
-
+
}
else {
//Regular Scrolling:
@@ -896,7 +896,7 @@ if (__LITTLE_ENDIAN__) {
default:
this.OBJMatrixParameters[address >> 2] = (data << 16) >> 16;
}
- this.OAMRAM16[address | 0] = data | 0;
+ this.OAMRAM16[address | 0] = data & 0xFFFF;
}
GameBoyAdvanceOBJRenderer.prototype.writeOAM32 = function (address, data) {
address = address | 0;
@@ -930,17 +930,18 @@ if (__LITTLE_ENDIAN__) {
}
GameBoyAdvanceOBJRenderer.prototype.readOAM16 = function (address) {
address = address | 0;
- return this.OAMRAM16[(address >> 1) & 0x1FF] | 0;
+ return this.OAMRAM16[address & 0x1FF] | 0;
}
GameBoyAdvanceOBJRenderer.prototype.readOAM32 = function (address) {
address = address | 0;
- return this.OAMRAM32[(address >> 2) & 0xFF] | 0;
+ return this.OAMRAM32[address & 0xFF] | 0;
}
}
else {
GameBoyAdvanceOBJRenderer.prototype.writeOAM16 = function (address, data) {
address = address | 0;
data = data | 0;
+ address = address & 0x1FF;
var OAMTable = this.OAMTable[address >> 2];
switch (address & 0x3) {
//Attrib 0:
@@ -978,6 +979,7 @@ else {
GameBoyAdvanceOBJRenderer.prototype.writeOAM32 = function (address, data) {
address = address | 0;
data = data | 0;
+ address = address & 0xFF;
var OAMTable = this.OAMTable[address >> 1];
if ((address & 0x1) == 0) {
//Attrib 0:
@@ -1010,11 +1012,13 @@ else {
this.OAMRAM[address | 3] = data >>> 24;
}
GameBoyAdvanceOBJRenderer.prototype.readOAM16 = function (address) {
- address &= 0x3FE;
+ address &= 0x1FF;
+ address <<= 1;
return this.OAMRAM[address] | (this.OAMRAM[address | 1] << 8);
}
GameBoyAdvanceOBJRenderer.prototype.readOAM32 = function (address) {
- address &= 0x3FC;
+ address &= 0xFF;
+ address <<= 2;
return this.OAMRAM[address] | (this.OAMRAM[address | 1] << 8) | (this.OAMRAM[address | 2] << 16) | (this.OAMRAM[address | 3] << 24);
}
-}
\ No newline at end of file
+}
diff --git a/IodineGBA/core/graphics/Renderer.js b/IodineGBA/core/graphics/Renderer.js
index 6cf7991..aaf34e1 100644
--- a/IodineGBA/core/graphics/Renderer.js
+++ b/IodineGBA/core/graphics/Renderer.js
@@ -1,11 +1,11 @@
"use strict";
/*
- Copyright (C) 2012-2015 Grant Galitz
-
+ Copyright (C) 2012-2016 Grant Galitz
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function GameBoyAdvanceGraphicsRenderer(coreExposed, skippingBIOS) {
@@ -30,7 +30,8 @@ if (__VIEWS_SUPPORTED__) {
this.paletteRAM32 = getInt32View(this.paletteRAM);
this.buffer = getInt32Array(0x680);
this.lineBuffer = getInt32ViewCustom(this.buffer, 0, 240);
- this.frameBuffer = this.coreExposed.frameBuffer;
+ this.frameBuffer = getInt32Array(38400); //The internal buffer to composite to.
+ this.swizzledFrame = getUint8Array(115200); //The swizzled output buffer that syncs to the internal framebuffer on v-blank.
this.totalLinesPassed = 0;
this.queuedScanLines = 0;
this.lastUnrenderedLine = 0;
@@ -55,7 +56,8 @@ else {
this.paletteRAM16 = getUint16View(this.paletteRAM);
this.paletteRAM32 = getInt32View(this.paletteRAM);
this.buffer = getInt32Array(0x680);
- this.frameBuffer = this.coreExposed.frameBuffer;
+ this.frameBuffer = getInt32Array(38400); //The internal buffer to composite to.
+ this.swizzledFrame = getUint8Array(115200); //The swizzled output buffer that syncs to the internal framebuffer on v-blank.
this.totalLinesPassed = 0;
this.queuedScanLines = 0;
this.lastUnrenderedLine = 0;
@@ -120,7 +122,30 @@ GameBoyAdvanceGraphicsRenderer.prototype.ensureFraming = function () {
//Make sure our gfx are up-to-date:
this.graphicsJITVBlank();
//Draw the frame:
- this.coreExposed.prepareFrame();
+ this.prepareFrame();
+ }
+}
+GameBoyAdvanceGraphicsRenderer.prototype.swizzleFrameBuffer = function () {
+ //Convert our dirty 15-bit (15-bit, with internal render flags above it) framebuffer to an 8-bit buffer with separate indices for the RGB channels:
+ var bufferIndex = 0;
+ for (var canvasIndex = 0; (canvasIndex | 0) < 115200; bufferIndex = ((bufferIndex | 0) + 1) | 0) {
+ this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x1F) << 3; //Red
+ canvasIndex = ((canvasIndex | 0) + 1) | 0;
+ this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x3E0) >> 2; //Green
+ canvasIndex = ((canvasIndex | 0) + 1) | 0;
+ this.swizzledFrame[canvasIndex | 0] = (this.frameBuffer[bufferIndex | 0] & 0x7C00) >> 7; //Blue
+ canvasIndex = ((canvasIndex | 0) + 1) | 0;
+ }
+}
+GameBoyAdvanceGraphicsRenderer.prototype.prepareFrame = function () {
+ //Copy the internal frame buffer to the output buffer:
+ this.swizzleFrameBuffer();
+ this.requestDraw();
+}
+GameBoyAdvanceGraphicsRenderer.prototype.requestDraw = function () {
+ if (this.coreExposed.graphicsHandle) {
+ //We actually updated the graphics internally, so copy out:
+ this.coreExposed.graphicsHandle.copyBuffer(this.swizzledFrame);
}
}
GameBoyAdvanceGraphicsRenderer.prototype.graphicsJIT = function () {
@@ -1184,68 +1209,42 @@ GameBoyAdvanceGraphicsRenderer.prototype.writeBLDY8 = function (data) {
this.colorEffectsRenderer.writeBLDY8(data | 0);
}
if (__LITTLE_ENDIAN__) {
- if (typeof Math.imul == "function") {
- //Math.imul found, insert the optimized path in:
- GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM8 = function (address, data) {
- address = address | 0;
- data = data | 0;
- if ((address & 0x10000) == 0 || ((address & 0x17FFF) < 0x14000 && (this.displayControl & 0x7) >= 3)) {
- this.graphicsJIT();
- address = address & (((address & 0x10000) >> 1) ^ address);
- this.VRAM16[(address >> 1) & 0xFFFF] = Math.imul(data & 0xFF, 0x101) | 0;
- }
- }
- }
- else {
- //Math.imul not found, use the compatibility method:
- GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM8 = function (address, data) {
- address = address | 0;
- data = data | 0;
- if ((address & 0x10000) == 0 || ((address & 0x17FFF) < 0x14000 && (this.displayControl & 0x7) >= 3)) {
- this.graphicsJIT();
- address = address & (((address & 0x10000) >> 1) ^ address);
- this.VRAM16[(address >> 1) & 0xFFFF] = (data & 0xFF) * 0x101;
- }
- }
- }
+ GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM8 =
GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM16 = function (address, data) {
address = address | 0;
data = data | 0;
this.graphicsJIT();
- address = address & (((address & 0x10000) >> 1) ^ address);
- this.VRAM16[(address >> 1) & 0xFFFF] = data & 0xFFFF;
+ this.VRAM16[address & 0xFFFF] = data & 0xFFFF;
}
GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM32 = function (address, data) {
address = address | 0;
data = data | 0;
this.graphicsJIT();
- address = address & (((address & 0x10000) >> 1) ^ address);
- this.VRAM32[(address >> 2) & 0x7FFF] = data | 0;
+ this.VRAM32[address & 0x7FFF] = data | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.readVRAM16 = function (address) {
address = address | 0;
- address = address & (((address & 0x10000) >> 1) ^ address);
- return this.VRAM16[(address >> 1) & 0xFFFF] | 0;
+ return this.VRAM16[address & 0xFFFF] | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.readVRAM32 = function (address) {
address = address | 0;
- address = address & (((address & 0x10000) >> 1) ^ address);
- return this.VRAM32[(address >> 2) & 0x7FFF] | 0;
+ return this.VRAM32[address & 0x7FFF] | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.writePalette16 = function (address, data) {
data = data | 0;
- address = address >> 1;
+ address = address | 0;
this.graphicsJIT();
- this.paletteRAM16[address & 0x1FF] = data | 0;
+ this.paletteRAM16[address & 0x1FF] = data & 0xFFFF;
data = data & 0x7FFF;
this.writePalette256Color(address | 0, data | 0);
this.writePalette16Color(address | 0, data | 0);
}
GameBoyAdvanceGraphicsRenderer.prototype.writePalette32 = function (address, data) {
data = data | 0;
- address = address >> 1;
+ address = address | 0;
this.graphicsJIT();
- this.paletteRAM32[(address >> 1) & 0xFF] = data | 0;
+ this.paletteRAM32[address & 0xFF] = data | 0;
+ address = address << 1;
var palette = data & 0x7FFF;
this.writePalette256Color(address | 0, palette | 0);
this.writePalette16Color(address | 0, palette | 0);
@@ -1255,30 +1254,25 @@ if (__LITTLE_ENDIAN__) {
}
GameBoyAdvanceGraphicsRenderer.prototype.readPalette16 = function (address) {
address = address | 0;
- return this.paletteRAM16[(address >> 1) & 0x1FF] | 0;
+ return this.paletteRAM16[address & 0x1FF] | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.readPalette32 = function (address) {
address = address | 0;
- return this.paletteRAM32[(address >> 2) & 0xFF] | 0;
+ return this.paletteRAM32[address & 0xFF] | 0;
}
}
else {
- GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM8 = function (address, data) {
- address &= 0x1FFFE & (((address & 0x10000) >> 1) ^ address);
- if (address < 0x10000 || ((address & 0x17FFF) < 0x14000 && (this.displayControl & 0x7) >= 3)) {
- this.graphicsJIT();
- this.VRAM[address++] = data & 0xFF;
- this.VRAM[address] = data & 0xFF;
- }
- }
+ GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM8 =
GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM16 = function (address, data) {
- address &= 0x1FFFE & (((address & 0x10000) >> 1) ^ address);
+ address <<= 1;
+ address &= 0x1FFFE;
this.graphicsJIT();
this.VRAM[address++] = data & 0xFF;
this.VRAM[address] = (data >> 8) & 0xFF;
}
GameBoyAdvanceGraphicsRenderer.prototype.writeVRAM32 = function (address, data) {
- address &= 0x1FFFC & (((address & 0x10000) >> 1) ^ address);
+ address <<= 2;
+ address &= 0x1FFFC;
this.graphicsJIT();
this.VRAM[address++] = data & 0xFF;
this.VRAM[address++] = (data >> 8) & 0xFF;
@@ -1286,15 +1280,18 @@ else {
this.VRAM[address] = data >>> 24;
}
GameBoyAdvanceGraphicsRenderer.prototype.readVRAM16 = function (address) {
- address &= 0x1FFFE & (((address & 0x10000) >> 1) ^ address);
+ address <<= 1;
+ address &= 0x1FFFE;
return this.VRAM[address] | (this.VRAM[address + 1] << 8);
}
GameBoyAdvanceGraphicsRenderer.prototype.readVRAM32 = function (address) {
- address &= 0x1FFFC & (((address & 0x10000) >> 1) ^ address);
+ address <<= 2;
+ address &= 0x1FFFC;
return this.VRAM[address] | (this.VRAM[address + 1] << 8) | (this.VRAM[address + 2] << 16) | (this.VRAM[address + 3] << 24);
}
GameBoyAdvanceGraphicsRenderer.prototype.writePalette16 = function (address, data) {
this.graphicsJIT();
+ address <<= 1;
this.paletteRAM[address] = data & 0xFF;
this.paletteRAM[address | 1] = data >> 8;
data &= 0x7FFF;
@@ -1304,6 +1301,7 @@ else {
}
GameBoyAdvanceGraphicsRenderer.prototype.writePalette32 = function (address, data) {
this.graphicsJIT();
+ address <<= 2;
this.paletteRAM[address] = data & 0xFF;
this.paletteRAM[address | 1] = (data >> 8) & 0xFF;
this.paletteRAM[address | 2] = (data >> 16) & 0xFF;
@@ -1318,38 +1316,42 @@ else {
this.writePalette16Color(address, palette);
}
GameBoyAdvanceGraphicsRenderer.prototype.readPalette16 = function (address) {
+ address <<= 1;
address &= 0x3FE;
return this.paletteRAM[address] | (this.paletteRAM[address | 1] << 8);
}
GameBoyAdvanceGraphicsRenderer.prototype.readPalette32 = function (address) {
+ address <<= 2;
address &= 0x3FC;
return this.paletteRAM[address] | (this.paletteRAM[address | 1] << 8) | (this.paletteRAM[address | 2] << 16) | (this.paletteRAM[address | 3] << 24);
}
}
GameBoyAdvanceGraphicsRenderer.prototype.readVRAM8 = function (address) {
address = address | 0;
- address = address & (((address & 0x10000) >> 1) ^ address);
return this.VRAM[address & 0x1FFFF] | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.writeOAM16 = function (address, data) {
address = address | 0;
data = data | 0;
this.graphicsJIT();
- this.objRenderer.writeOAM16(address >> 1, data | 0);
+ this.objRenderer.writeOAM16(address & 0x1FF, data & 0xFFFF);
}
GameBoyAdvanceGraphicsRenderer.prototype.writeOAM32 = function (address, data) {
address = address | 0;
data = data | 0;
this.graphicsJIT();
- this.objRenderer.writeOAM32(address >> 2, data | 0);
+ this.objRenderer.writeOAM32(address & 0xFF, data | 0);
}
GameBoyAdvanceGraphicsRenderer.prototype.readOAM = function (address) {
+ address = address | 0;
return this.objRenderer.readOAM(address | 0) | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.readOAM16 = function (address) {
+ address = address | 0;
return this.objRenderer.readOAM16(address | 0) | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.readOAM32 = function (address) {
+ address = address | 0;
return this.objRenderer.readOAM32(address | 0) | 0;
}
GameBoyAdvanceGraphicsRenderer.prototype.writePalette256Color = function (address, palette) {
@@ -1384,5 +1386,6 @@ GameBoyAdvanceGraphicsRenderer.prototype.writePalette16Color = function (address
}
}
GameBoyAdvanceGraphicsRenderer.prototype.readPalette8 = function (address) {
+ address = address | 0;
return this.paletteRAM[address & 0x3FF] | 0;
-}
\ No newline at end of file
+}
diff --git a/IodineGBA/core/graphics/RendererProxy.js b/IodineGBA/core/graphics/RendererProxy.js
index 8ab9083..e8e3b21 100644
--- a/IodineGBA/core/graphics/RendererProxy.js
+++ b/IodineGBA/core/graphics/RendererProxy.js
@@ -1,11 +1,11 @@
"use strict";
/*
- Copyright (C) 2012-2015 Grant Galitz
-
+ Copyright (C) 2012-2016 Grant Galitz
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function GameBoyAdvanceRendererProxy(IOCore) {
@@ -17,7 +17,7 @@ GameBoyAdvanceRendererProxy.prototype.initialize = function () {
this.IOData16 = getUint16View(this.IOData8);
this.IOData32 = getInt32View(this.IOData8);
this.gfxState = this.IOCore.gfxState;
- this.renderer = new GameBoyAdvanceGraphicsRenderer(this.IOCore.coreExposed, !!this.IOCore.SKIPBoot);
+ this.renderer = getGameBoyAdvanceGraphicsRenderer(this.IOCore.coreExposed, !!this.IOCore.SKIPBoot);
}
GameBoyAdvanceRendererProxy.prototype.incrementScanLineQueue = function () {
this.renderer.incrementScanLineQueue();
@@ -1145,65 +1145,91 @@ GameBoyAdvanceRendererProxy.prototype.writeBLDY8 = function (data) {
this.IOCore.updateGraphicsClocking();
this.renderer.writeBLDY8(data | 0);
}
-GameBoyAdvanceRendererProxy.prototype.writeVRAM8 = function (address, data) {
- address = address | 0;
- data = data | 0;
- this.renderer.writeVRAM8(address | 0, data | 0);
+if (typeof Math.imul == "function") {
+ //Math.imul found, insert the optimized path in:
+ GameBoyAdvanceRendererProxy.prototype.writeVRAM8 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ if ((address & 0x10000) == 0 || ((address & 0x17FFF) < 0x14000 && (this.IOData8[0] & 0x7) >= 3)) {
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ address = address >> 1;
+ data = Math.imul(data & 0xFF, 0x101) | 0;
+ this.renderer.writeVRAM8(address | 0, data | 0);
+ }
+ }
+}
+else {
+ //Math.imul not found, use the compatibility method:
+ GameBoyAdvanceRendererProxy.prototype.writeVRAM8 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ if ((address & 0x10000) == 0 || ((address & 0x17FFF) < 0x14000 && (this.IOData8[0] & 0x7) >= 3)) {
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ address = address >> 1;
+ data = (data & 0xFF) * 0x101;
+ this.renderer.writeVRAM8(address | 0, data | 0);
+ }
+ }
}
GameBoyAdvanceRendererProxy.prototype.writeVRAM16 = function (address, data) {
address = address | 0;
data = data | 0;
- this.renderer.writeVRAM16(address | 0, data | 0);
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ this.renderer.writeVRAM16(address >> 1, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.writeVRAM32 = function (address, data) {
address = address | 0;
data = data | 0;
- this.renderer.writeVRAM32(address | 0, data | 0);
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ this.renderer.writeVRAM32(address >> 2, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.readVRAM16 = function (address) {
address = address | 0;
- var data = this.renderer.readVRAM16(address | 0) | 0;
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ var data = this.renderer.readVRAM16(address >> 1) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.readVRAM32 = function (address) {
address = address | 0;
- var data = this.renderer.readVRAM32(address | 0) | 0;
+ address = address & (((address & 0x10000) >> 1) ^ address);
+ var data = this.renderer.readVRAM32(address >> 2) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.writePalette16 = function (address, data) {
data = data | 0;
address = address | 0;
- this.renderer.writePalette16(address | 0, data | 0);
+ this.renderer.writePalette16(address >> 1, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.writePalette32 = function (address, data) {
data = data | 0;
address = address | 0;
- this.renderer.writePalette32(address | 0, data | 0);
+ this.renderer.writePalette32(address >> 2, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.readPalette16 = function (address) {
address = address | 0;
- var data = this.renderer.readPalette16(address | 0) | 0;
+ var data = this.renderer.readPalette16(address >> 1) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.readPalette32 = function (address) {
address = address | 0;
- var data = this.renderer.readPalette32(address | 0) | 0;
+ var data = this.renderer.readPalette32(address >> 2) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.readVRAM8 = function (address) {
address = address | 0;
+ address = address & (((address & 0x10000) >> 1) ^ address);
var data = this.renderer.readVRAM8(address | 0) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.writeOAM16 = function (address, data) {
address = address | 0;
data = data | 0;
- this.renderer.writeOAM16(address | 0, data | 0);
+ this.renderer.writeOAM16(address >> 1, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.writeOAM32 = function (address, data) {
address = address | 0;
data = data | 0;
- this.renderer.writeOAM32(address | 0, data | 0);
+ this.renderer.writeOAM32(address >> 2, data | 0);
}
GameBoyAdvanceRendererProxy.prototype.readOAM = function (address) {
address = address | 0;
@@ -1212,16 +1238,16 @@ GameBoyAdvanceRendererProxy.prototype.readOAM = function (address) {
}
GameBoyAdvanceRendererProxy.prototype.readOAM16 = function (address) {
address = address | 0;
- var data = this.renderer.readOAM16(address | 0) | 0;
+ var data = this.renderer.readOAM16(address >> 1) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.readOAM32 = function (address) {
address = address | 0;
- var data = this.renderer.readOAM32(address | 0) | 0;
+ var data = this.renderer.readOAM32(address >> 2) | 0;
return data | 0;
}
GameBoyAdvanceRendererProxy.prototype.readPalette8 = function (address) {
address = address | 0;
var data = this.renderer.readPalette8(address | 0) | 0;
return data | 0;
-}
\ No newline at end of file
+}
diff --git a/IodineGBA/core/graphics/RendererShim.js b/IodineGBA/core/graphics/RendererShim.js
new file mode 100644
index 0000000..e3b4fc7
--- /dev/null
+++ b/IodineGBA/core/graphics/RendererShim.js
@@ -0,0 +1,852 @@
+"use strict";
+/*
+ Copyright (C) 2012-2016 Grant Galitz
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ function getGameBoyAdvanceGraphicsRenderer(coreExposed, skippingBIOS) {
+ if (typeof SharedArrayBuffer != "function" || typeof Atomics != "object") {
+ return new GameBoyAdvanceGraphicsRenderer(coreExposed, skippingBIOS);
+ }
+ else {
+ return new GameBoyAdvanceGraphicsRendererShim(coreExposed, skippingBIOS);
+ }
+ }
+ function GameBoyAdvanceGraphicsRendererShim(coreExposed, skippingBIOS) {
+ this.coreExposed = coreExposed;
+ this.initializeWorker(skippingBIOS);
+ this.appendAtomicSync();
+ this.initializeBuffers();
+ this.shareBuffers();
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.initializeWorker = function (skippingBIOS) {
+ skippingBIOS = !!skippingBIOS;
+ var loc = location.href;
+ loc = loc.split("/");
+ loc = loc.slice(0, loc.length - 1).join("/");
+ loc += "/graphics/Worker.js";
+ this.worker = new Worker(loc);
+ this.worker.postMessage({
+ messageID:2,
+ skippingBIOS:!!skippingBIOS
+ });
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.initializeBuffers = function () {
+ //Graphics Buffers:
+ this.gfxCommandBuffer = getSharedInt32Array(0x80000);
+ this.gfxCommandCounters = getSharedInt32Array(2);
+ this.start = 0;
+ this.end = 0;
+ this.OAMRAM = getUint8Array(0x400);
+ this.OAMRAM16 = getUint16View(this.OAMRAM);
+ this.OAMRAM32 = getInt32View(this.OAMRAM);
+ this.paletteRAM = getUint8Array(0x400);
+ this.VRAM = getUint8Array(0x18000);
+ this.VRAM16 = getUint16View(this.VRAM);
+ this.VRAM32 = getInt32View(this.VRAM);
+ this.paletteRAM16 = getUint16View(this.paletteRAM);
+ this.paletteRAM32 = getInt32View(this.paletteRAM);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.appendAtomicSync = function () {
+ //Command buffer counters get synchronized with emulator runtime head/end for efficiency:
+ var parentObj = this;
+ this.coreExposed.appendStartIterationSync(function () {
+ parentObj.synchronizeReader();
+ });
+ this.coreExposed.appendEndIterationSync(function () {
+ parentObj.synchronizeWriter();
+ });
+ this.coreExposed.appendTerminationSync(function () {
+ //Core instance being replaced, kill the worker thread:
+ parentObj.worker.terminate();
+ });
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.shareBuffers = function () {
+ this.worker.postMessage({
+ messageID:1,
+ gfxBuffers:gfxBuffers,
+ gfxCounters:gfxCounters,
+ gfxCommandBuffer:this.gfxCommandBuffer,
+ gfxCommandCounters:this.gfxCommandCounters
+ }, [
+ gfxBuffers[0].buffer,
+ gfxBuffers[1].buffer,
+ gfxCounters.buffer,
+ this.gfxCommandBuffer.buffer,
+ this.gfxCommandCounters.buffer
+ ]);
+ }
+GameBoyAdvanceGraphicsRendererShim.prototype.pushCommand = function (command, data) {
+ command = command | 0;
+ data = data | 0;
+ //Block while full:
+ this.blockIfCommandBufferFull();
+ //Get the write offset into the ring buffer:
+ var endCorrected = this.end & 0x7FFFF;
+ //Push command into buffer:
+ this.gfxCommandBuffer[endCorrected | 0] = command | 0;
+ //Push data into buffer:
+ this.gfxCommandBuffer[endCorrected | 1] = data | 0;
+ //Update the cross thread buffering count:
+ this.end = ((this.end | 0) + 2) | 0;
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.blockIfCommandBufferFull = function () {
+ if ((this.start | 0) == (((this.end | 0) - 0x80000) | 0)) {
+ //Give the reader our updated counter and tell it to run:
+ this.synchronizeWriter();
+ //Wait for consumer thread:
+ Atomics.futexWait(this.gfxCommandCounters, 0, ((this.end | 0) - 0x80000) | 0);
+ //Reload reader counter value:
+ this.synchronizeReader();
+ }
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.synchronizeWriter = function () {
+ //Store command buffer writer counter value:
+ Atomics.store(this.gfxCommandCounters, 1, this.end | 0);
+ //Tell consumer thread to check command buffer:
+ this.worker.postMessage({messageID:0});
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.synchronizeReader = function () {
+ //Load command buffer reader counter value:
+ this.start = Atomics.load(this.gfxCommandCounters, 0) | 0;
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushVRAM16 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0xFFFF;
+ this.pushCommand(0x10000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushVRAM32 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0x7FFF;
+ this.pushCommand(0x20000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushPAL16 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0x1FF;
+ this.pushCommand(0x30000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushPAL32 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0xFF;
+ this.pushCommand(0x40000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushOAM16 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0x1FF;
+ this.pushCommand(0x50000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.pushOAM32 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ address = address & 0xFF;
+ this.pushCommand(0x60000 | address, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.incrementScanLineQueue = function () {
+ //Increment scan line command:
+ this.pushCommand(0, 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.ensureFraming = function () {
+ //Vertical blank synchronization command:
+ this.pushCommand(0, 1);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeDISPCNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(1, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeDISPCNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(2, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeDISPCNT8_2 = function (data) {
+ data = data | 0;
+ this.pushCommand(3, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeDISPCNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(4, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeDISPCNT32 = function (data) {
+ data = data | 0;
+ this.pushCommand(5, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0CNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(6, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0CNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(7, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0CNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(8, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1CNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(9, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1CNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(10, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1CNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(11, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0BG1CNT32 = function (data) {
+ data = data | 0;
+ this.pushCommand(12, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2CNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(13, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2CNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(14, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2CNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(15, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3CNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(16, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3CNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(17, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3CNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(18, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2BG3CNT32 = function (data) {
+ data = data | 0;
+ this.pushCommand(19, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0HOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(20, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0HOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(21, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0HOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(22, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0VOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(23, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0VOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(24, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0VOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(25, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG0OFS32 = function (data) {
+ data = data | 0;
+ this.pushCommand(26, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1HOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(27, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1HOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(28, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1HOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(29, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1VOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(30, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1VOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(31, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1VOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(32, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG1OFS32 = function (data) {
+ data = data | 0;
+ this.pushCommand(33, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2HOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(34, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2HOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(35, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2HOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(36, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2VOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(37, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2VOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(38, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2VOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(39, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2OFS32 = function (data) {
+ data = data | 0;
+ this.pushCommand(40, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3HOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(41, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3HOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(42, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3HOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(43, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3VOFS8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(44, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3VOFS8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(45, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3VOFS16 = function (data) {
+ data = data | 0;
+ this.pushCommand(46, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3OFS32 = function (data) {
+ data = data | 0;
+ this.pushCommand(47, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PA8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(48, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PA8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(49, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PA16 = function (data) {
+ data = data | 0;
+ this.pushCommand(50, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PB8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(51, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PB8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(52, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PB16 = function (data) {
+ data = data | 0;
+ this.pushCommand(53, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PAB32 = function (data) {
+ data = data | 0;
+ this.pushCommand(54, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PC8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(55, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PC8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(56, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PC16 = function (data) {
+ data = data | 0;
+ this.pushCommand(57, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PD8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(58, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PD8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(59, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(60, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2PCD32 = function (data) {
+ data = data | 0;
+ this.pushCommand(61, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PA8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(62, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PA8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(63, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PA16 = function (data) {
+ data = data | 0;
+ this.pushCommand(64, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PB8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(65, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PB8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(66, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PB16 = function (data) {
+ data = data | 0;
+ this.pushCommand(67, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PAB32 = function (data) {
+ data = data | 0;
+ this.pushCommand(68, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PC8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(69, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PC8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(70, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PC16 = function (data) {
+ data = data | 0;
+ this.pushCommand(71, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PD8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(72, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PD8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(73, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(74, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3PCD32 = function (data) {
+ data = data | 0;
+ this.pushCommand(75, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(76, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(77, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X8_2 = function (data) {
+ data = data | 0;
+ this.pushCommand(78, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X8_3 = function (data) {
+ data = data | 0;
+ this.pushCommand(79, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X16_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(80, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X16_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(81, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2X32 = function (data) {
+ data = data | 0;
+ this.pushCommand(82, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(83, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(84, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y8_2 = function (data) {
+ data = data | 0;
+ this.pushCommand(85, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y8_3 = function (data) {
+ data = data | 0;
+ this.pushCommand(86, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y16_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(87, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y16_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(88, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG2Y32 = function (data) {
+ data = data | 0;
+ this.pushCommand(89, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(90, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(91, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X8_2 = function (data) {
+ data = data | 0;
+ this.pushCommand(92, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X8_3 = function (data) {
+ data = data | 0;
+ this.pushCommand(93, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X16_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(94, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X16_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(95, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3X32 = function (data) {
+ data = data | 0;
+ this.pushCommand(96, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(97, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(98, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y8_2 = function (data) {
+ data = data | 0;
+ this.pushCommand(99, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y8_3 = function (data) {
+ data = data | 0;
+ this.pushCommand(100, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y16_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(101, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y16_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(102, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBG3Y32 = function (data) {
+ data = data | 0;
+ this.pushCommand(103, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0XCOORDRight8 = function (data) {
+ data = data | 0;
+ this.pushCommand(104, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0XCOORDLeft8 = function (data) {
+ data = data | 0;
+ this.pushCommand(105, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0XCOORD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(106, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1XCOORDRight8 = function (data) {
+ data = data | 0;
+ this.pushCommand(107, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1XCOORDLeft8 = function (data) {
+ data = data | 0;
+ this.pushCommand(108, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1XCOORD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(109, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINXCOORD32 = function (data) {
+ data = data | 0;
+ this.pushCommand(110, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0YCOORDBottom8 = function (data) {
+ data = data | 0;
+ this.pushCommand(111, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0YCOORDTop8 = function (data) {
+ data = data | 0;
+ this.pushCommand(112, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0YCOORD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(113, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1YCOORDBottom8 = function (data) {
+ data = data | 0;
+ this.pushCommand(114, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1YCOORDTop8 = function (data) {
+ data = data | 0;
+ this.pushCommand(115, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1YCOORD16 = function (data) {
+ data = data | 0;
+ this.pushCommand(116, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINYCOORD32 = function (data) {
+ data = data | 0;
+ this.pushCommand(117, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN0IN8 = function (data) {
+ data = data | 0;
+ this.pushCommand(118, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWIN1IN8 = function (data) {
+ data = data | 0;
+ this.pushCommand(119, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWININ16 = function (data) {
+ data = data | 0;
+ this.pushCommand(120, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINOUT8 = function (data) {
+ data = data | 0;
+ this.pushCommand(121, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINOBJIN8 = function (data) {
+ data = data | 0;
+ this.pushCommand(122, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINOUT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(123, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeWINCONTROL32 = function (data) {
+ data = data | 0;
+ this.pushCommand(124, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeMOSAIC8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(125, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeMOSAIC8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(126, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeMOSAIC16 = function (data) {
+ data = data | 0;
+ this.pushCommand(127, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDCNT8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(128, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDCNT8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(129, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDCNT16 = function (data) {
+ data = data | 0;
+ this.pushCommand(130, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDALPHA8_0 = function (data) {
+ data = data | 0;
+ this.pushCommand(131, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDALPHA8_1 = function (data) {
+ data = data | 0;
+ this.pushCommand(132, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDALPHA16 = function (data) {
+ data = data | 0;
+ this.pushCommand(133, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDCNT32 = function (data) {
+ data = data | 0;
+ this.pushCommand(134, data | 0);
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.writeBLDY8 = function (data) {
+ data = data | 0;
+ this.pushCommand(135, data | 0);
+}
+if (__LITTLE_ENDIAN__) {
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM8 =
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM16 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ this.VRAM16[address & 0xFFFF] = data & 0xFFFF;
+ this.pushVRAM16(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM32 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ this.VRAM32[address & 0x7FFF] = data | 0;
+ this.pushVRAM32(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readVRAM16 = function (address) {
+ address = address | 0;
+ return this.VRAM16[address & 0xFFFF] | 0;
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readVRAM32 = function (address) {
+ address = address | 0;
+ return this.VRAM32[address & 0x7FFF] | 0;
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writePalette16 = function (address, data) {
+ data = data | 0;
+ address = address | 0;
+ this.paletteRAM16[address & 0x1FF] = data & 0xFFFF;
+ this.pushPAL16(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writePalette32 = function (address, data) {
+ data = data | 0;
+ address = address | 0;
+ this.paletteRAM32[address & 0xFF] = data | 0;
+ this.pushPAL32(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readPalette16 = function (address) {
+ address = address | 0;
+ return this.paletteRAM16[address & 0x1FF] | 0;
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readPalette32 = function (address) {
+ address = address | 0;
+ return this.paletteRAM32[address & 0xFF] | 0;
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeOAM16 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ this.OAMRAM16[address & 0x1FF] = data & 0xFFFF;
+ this.pushOAM16(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeOAM32 = function (address, data) {
+ address = address | 0;
+ data = data | 0;
+ this.OAMRAM32[address & 0xFF] = data | 0;
+ this.pushOAM32(address | 0, data | 0);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readOAM16 = function (address) {
+ address = address | 0;
+ return this.OAMRAM16[address & 0x1FF] | 0;
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readOAM32 = function (address) {
+ address = address | 0;
+ return this.OAMRAM32[address & 0xFF] | 0;
+ }
+}
+else {
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM8 =
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM16 = function (address, data) {
+ address <<= 1;
+ address &= 0x1FFFE;
+ this.VRAM[address] = data & 0xFF;
+ this.VRAM[address + 1] = (data >> 8) & 0xFF;
+ this.pushVRAM16(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeVRAM32 = function (address, data) {
+ address <<= 2;
+ address &= 0x1FFFC;
+ this.VRAM[address] = data & 0xFF;
+ this.VRAM[address + 1] = (data >> 8) & 0xFF;
+ this.VRAM[address + 2] = (data >> 16) & 0xFF;
+ this.VRAM[address + 3] = data >>> 24;
+ this.pushVRAM32(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readVRAM16 = function (address) {
+ address <<= 1;
+ address &= 0x1FFFE;
+ return this.VRAM[address] | (this.VRAM[address + 1] << 8);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readVRAM32 = function (address) {
+ address <<= 2;
+ address &= 0x1FFFC;
+ return this.VRAM[address] | (this.VRAM[address + 1] << 8) | (this.VRAM[address + 2] << 16) | (this.VRAM[address + 3] << 24);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writePalette16 = function (address, data) {
+ this.paletteRAM[address << 1] = data & 0xFF;
+ this.paletteRAM[(address << 1) + 1] = data >> 8;
+ this.pushPAL16(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writePalette32 = function (address, data) {
+ address <<= 2;
+ this.paletteRAM[address] = data & 0xFF;
+ this.paletteRAM[address | 1] = (data >> 8) & 0xFF;
+ this.paletteRAM[address | 2] = (data >> 16) & 0xFF;
+ this.paletteRAM[address | 3] = data >>> 24;
+ address >>= 2;
+ this.pushPAL32(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readPalette16 = function (address) {
+ address &= 0x3FE;
+ return this.paletteRAM[address] | (this.paletteRAM[address | 1] << 8);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readPalette32 = function (address) {
+ address &= 0x3FC;
+ return this.paletteRAM[address] | (this.paletteRAM[address | 1] << 8) | (this.paletteRAM[address | 2] << 16) | (this.paletteRAM[address | 3] << 24);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeOAM16 = function (address, data) {
+ address &= 0x1FF;
+ this.OAMRAM[address << 1] = data & 0xFF;
+ this.OAMRAM[(address << 1) | 1] = data >> 8;
+ this.pushOAM16(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.writeOAM32 = function (address, data) {
+ address &= 0xFF;
+ address <<= 2;
+ this.OAMRAM[address] = data & 0xFF;
+ this.OAMRAM[address + 1] = (data >> 8) & 0xFF;
+ this.OAMRAM[address + 2] = (data >> 16) & 0xFF;
+ this.OAMRAM[address + 3] = data >>> 24;
+ address >>= 2;
+ this.pushOAM32(address, data);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readOAM16 = function (address) {
+ address &= 0x1FF;
+ address <<= 1;
+ return this.OAMRAM[address] | (this.OAMRAM[address | 1] << 8);
+ }
+ GameBoyAdvanceGraphicsRendererShim.prototype.readOAM32 = function (address) {
+ address &= 0xFF;
+ address <<= 2;
+ return this.OAMRAM[address] | (this.OAMRAM[address | 1] << 8) | (this.OAMRAM[address | 2] << 16) | (this.OAMRAM[address | 3] << 24);
+ }
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.readVRAM8 = function (address) {
+ address = address | 0;
+ return this.VRAM[address & 0x1FFFF] | 0;
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.readOAM = function (address) {
+ address = address | 0;
+ return this.OAMRAM[address & 0x3FF] | 0;
+}
+GameBoyAdvanceGraphicsRendererShim.prototype.readPalette8 = function (address) {
+ address = address | 0;
+ return this.paletteRAM[address & 0x3FF] | 0;
+}
diff --git a/IodineGBA/core/graphics/Worker.js b/IodineGBA/core/graphics/Worker.js
new file mode 100644
index 0000000..6e4d1c0
--- /dev/null
+++ b/IodineGBA/core/graphics/Worker.js
@@ -0,0 +1,547 @@
+"use strict";
+/*
+ Copyright (C) 2012-2016 Grant Galitz
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+importScripts("../../includes/TypedArrayShim.js");
+importScripts("Renderer.js");
+importScripts("BGTEXT.js");
+importScripts("BG2FrameBuffer.js");
+importScripts("BGMatrix.js");
+importScripts("AffineBG.js");
+importScripts("ColorEffects.js");
+importScripts("Mosaic.js");
+importScripts("OBJ.js");
+importScripts("OBJWindow.js");
+importScripts("Window.js");
+importScripts("Compositor.js");
+var renderer = null;
+var gfxBuffers = null;
+var gfxCounters = null;
+var gfxCommandBuffer = null;
+var gfxCommandCounters = null;
+self.onmessage = function (event) {
+ var data = event.data;
+ switch (data.messageID) {
+ case 0:
+ processCommands();
+ break;
+ case 1:
+ assignBuffers(data.gfxBuffers, data.gfxCounters, data.gfxCommandBuffer, data.gfxCommandCounters);
+ break;
+ default:
+ initializeRenderer(!!data.skippingBIOS);
+ }
+}
+var coreExposed = {
+ graphicsHandle:{
+ copyBuffer:function (swizzledFrame) {
+ //Push a frame of graphics to the blitter handle:
+ //Load the counter values:
+ var start = gfxCounters[0] | 0; //Written by the other thread.
+ var end = gfxCounters[1] | 0; //Written by this thread.
+ //Check if buffer is full:
+ if ((end | 0) == (((start | 0) + 2) | 0)) {
+ //Skip copying a frame out:
+ return;
+ }
+ //Copy samples into the ring buffer:
+ //Hardcoded for 2 buffers for a triple buffer effect:
+ gfxBuffers[end & 0x1].set(swizzledFrame);
+ //Increment the ending position counter by 1:
+ //Atomic to commit the counter to memory:
+ Atomics.store(gfxCounters, 1, ((end | 0) + 1) | 0);
+ }
+ }
+}
+function initializeRenderer(skippingBIOS) {
+ skippingBIOS = !!skippingBIOS;
+ renderer = new GameBoyAdvanceGraphicsRenderer(coreExposed, !!skippingBIOS);
+}
+function assignBuffers(gfxb, gfxc, cmdb, cmdc) {
+ gfxBuffers = gfxb;
+ gfxCounters = gfxc;
+ gfxCommandBuffer = cmdb;
+ gfxCommandCounters = cmdc;
+}
+function processCommands() {
+ //Load the counter values:
+ var start = gfxCommandCounters[0] | 0; //Written by this thread.
+ var end = Atomics.load(gfxCommandCounters, 1) | 0; //Written by the other thread.
+ //Don't process if nothing to process:
+ if ((end | 0) == (start | 0)) {
+ //Buffer is empty:
+ return;
+ }
+ //Dispatch commands:
+ var startCorrected = start & 0x7FFFF;
+ var endCorrected = end & 0x7FFFF;
+ do {
+ dispatchCommand(gfxCommandBuffer[startCorrected | 0] | 0, gfxCommandBuffer[startCorrected | 1] | 0);
+ startCorrected = ((startCorrected | 0) + 2) & 0x7FFFF;
+ } while ((startCorrected | 0) != (endCorrected | 0));
+ //Update the starting position counter to match the end position:
+ Atomics.store(gfxCommandCounters, 0, end | 0);
+ Atomics.futexWake(gfxCommandCounters, 1, end | 0);
+}
+function dispatchCommand(command, data) {
+ command = command | 0;
+ data = data | 0;
+ switch (command >> 16) {
+ //IO:
+ case 0:
+ dispatchIOCommand(command | 0, data | 0);
+ break;
+ //VRAM 16-BIT:
+ case 1:
+ renderer.writeVRAM16(command & 0xFFFF, data | 0);
+ break;
+ //VRAM 32-BIT:
+ case 2:
+ renderer.writeVRAM32(command & 0x7FFF, data | 0);
+ break;
+ //Palette 16-BIT:
+ case 3:
+ renderer.writePalette16(command & 0x1FF, data | 0);
+ break;
+ //Palette 32-BIT:
+ case 4:
+ renderer.writePalette32(command & 0xFF, data | 0);
+ break;
+ //OAM 16-BIT:
+ case 5:
+ renderer.writeOAM16(command & 0x1FF, data | 0);
+ break;
+ //OAM 32-BIT:
+ default:
+ renderer.writeOAM32(command & 0xFF, data | 0);
+ }
+}
+function dispatchIOCommand(command, data) {
+ command = command | 0;
+ data = data | 0;
+ switch (command | 0) {
+ case 0:
+ decodeInternalCommand(data | 0);
+ break;
+ case 1:
+ renderer.writeDISPCNT8_0(data | 0);
+ break;
+ case 2:
+ renderer.writeDISPCNT8_1(data | 0);
+ break;
+ case 3:
+ renderer.writeDISPCNT8_2(data | 0);
+ break;
+ case 4:
+ renderer.writeDISPCNT16(data | 0);
+ break;
+ case 5:
+ renderer.writeDISPCNT32(data | 0);
+ break;
+ case 6:
+ renderer.writeBG0CNT8_0(data | 0);
+ break;
+ case 7:
+ renderer.writeBG0CNT8_1(data | 0);
+ break;
+ case 8:
+ renderer.writeBG0CNT16(data | 0);
+ break;
+ case 9:
+ renderer.writeBG1CNT8_0(data | 0);
+ break;
+ case 10:
+ renderer.writeBG1CNT8_1(data | 0);
+ break;
+ case 11:
+ renderer.writeBG1CNT16(data | 0);
+ break;
+ case 12:
+ renderer.writeBG0BG1CNT32(data | 0);
+ break;
+ case 13:
+ renderer.writeBG2CNT8_0(data | 0);
+ break;
+ case 14:
+ renderer.writeBG2CNT8_1(data | 0);
+ break;
+ case 15:
+ renderer.writeBG2CNT16(data | 0);
+ break;
+ case 16:
+ renderer.writeBG3CNT8_0(data | 0);
+ break;
+ case 17:
+ renderer.writeBG3CNT8_1(data | 0);
+ break;
+ case 18:
+ renderer.writeBG3CNT16(data | 0);
+ break;
+ case 19:
+ renderer.writeBG2BG3CNT32(data | 0);
+ break;
+ case 20:
+ renderer.writeBG0HOFS8_0(data | 0);
+ break;
+ case 21:
+ renderer.writeBG0HOFS8_1(data | 0);
+ break;
+ case 22:
+ renderer.writeBG0HOFS16(data | 0);
+ break;
+ case 23:
+ renderer.writeBG0VOFS8_0(data | 0);
+ break;
+ case 24:
+ renderer.writeBG0VOFS8_1(data | 0);
+ break;
+ case 25:
+ renderer.writeBG0VOFS16(data | 0);
+ break;
+ case 26:
+ renderer.writeBG0OFS32(data | 0);
+ break;
+ case 27:
+ renderer.writeBG1HOFS8_0(data | 0);
+ break;
+ case 28:
+ renderer.writeBG1HOFS8_1(data | 0);
+ break;
+ case 29:
+ renderer.writeBG1HOFS16(data | 0);
+ break;
+ case 30:
+ renderer.writeBG1VOFS8_0(data | 0);
+ break;
+ case 31:
+ renderer.writeBG1VOFS8_1(data | 0);
+ break;
+ case 32:
+ renderer.writeBG1VOFS16(data | 0);
+ break;
+ case 33:
+ renderer.writeBG1OFS32(data | 0);
+ break;
+ case 34:
+ renderer.writeBG2HOFS8_0(data | 0);
+ break;
+ case 35:
+ renderer.writeBG2HOFS8_1(data | 0);
+ break;
+ case 36:
+ renderer.writeBG2HOFS16(data | 0);
+ break;
+ case 37:
+ renderer.writeBG2VOFS8_0(data | 0);
+ break;
+ case 38:
+ renderer.writeBG2VOFS8_1(data | 0);
+ break;
+ case 39:
+ renderer.writeBG2VOFS16(data | 0);
+ break;
+ case 40:
+ renderer.writeBG2OFS32(data | 0);
+ break;
+ case 41:
+ renderer.writeBG3HOFS8_0(data | 0);
+ break;
+ case 42:
+ renderer.writeBG3HOFS8_1(data | 0);
+ break;
+ case 43:
+ renderer.writeBG3HOFS16(data | 0);
+ break;
+ case 44:
+ renderer.writeBG3VOFS8_0(data | 0);
+ break;
+ case 45:
+ renderer.writeBG3VOFS8_1(data | 0);
+ break;
+ case 46:
+ renderer.writeBG3VOFS16(data | 0);
+ break;
+ case 47:
+ renderer.writeBG3OFS32(data | 0);
+ break;
+ case 48:
+ renderer.writeBG2PA8_0(data | 0);
+ break;
+ case 49:
+ renderer.writeBG2PA8_1(data | 0);
+ break;
+ case 50:
+ renderer.writeBG2PA16(data | 0);
+ break;
+ case 51:
+ renderer.writeBG2PB8_0(data | 0);
+ break;
+ case 52:
+ renderer.writeBG2PB8_1(data | 0);
+ break;
+ case 53:
+ renderer.writeBG2PB16(data | 0);
+ break;
+ case 54:
+ renderer.writeBG2PAB32(data | 0);
+ break;
+ case 55:
+ renderer.writeBG2PC8_0(data | 0);
+ break;
+ case 56:
+ renderer.writeBG2PC8_1(data | 0);
+ break;
+ case 57:
+ renderer.writeBG2PC16(data | 0);
+ break;
+ case 58:
+ renderer.writeBG2PD8_0(data | 0);
+ break;
+ case 59:
+ renderer.writeBG2PD8_1(data | 0);
+ break;
+ case 60:
+ renderer.writeBG2PD16(data | 0);
+ break;
+ case 61:
+ renderer.writeBG2PCD32(data | 0);
+ break;
+ case 62:
+ renderer.writeBG3PA8_0(data | 0);
+ break;
+ case 63:
+ renderer.writeBG3PA8_1(data | 0);
+ break;
+ case 64:
+ renderer.writeBG3PA16(data | 0);
+ break;
+ case 65:
+ renderer.writeBG3PB8_0(data | 0);
+ break;
+ case 66:
+ renderer.writeBG3PB8_1(data | 0);
+ break;
+ case 67:
+ renderer.writeBG3PB16(data | 0);
+ break;
+ case 68:
+ renderer.writeBG3PAB32(data | 0);
+ break;
+ case 69:
+ renderer.writeBG3PC8_0(data | 0);
+ break;
+ case 70:
+ renderer.writeBG3PC8_1(data | 0);
+ break;
+ case 71:
+ renderer.writeBG3PC16(data | 0);
+ break;
+ case 72:
+ renderer.writeBG3PD8_0(data | 0);
+ break;
+ case 73:
+ renderer.writeBG3PD8_1(data | 0);
+ break;
+ case 74:
+ renderer.writeBG3PD16(data | 0);
+ break;
+ case 75:
+ renderer.writeBG3PCD32(data | 0);
+ break;
+ case 76:
+ renderer.writeBG2X8_0(data | 0);
+ break;
+ case 77:
+ renderer.writeBG2X8_1(data | 0);
+ break;
+ case 78:
+ renderer.writeBG2X8_2(data | 0);
+ break;
+ case 79:
+ renderer.writeBG2X8_3(data | 0);
+ break;
+ case 80:
+ renderer.writeBG2X16_0(data | 0);
+ break;
+ case 81:
+ renderer.writeBG2X16_1(data | 0);
+ break;
+ case 82:
+ renderer.writeBG2X32(data | 0);
+ break;
+ case 83:
+ renderer.writeBG2Y8_0(data | 0);
+ break;
+ case 84:
+ renderer.writeBG2Y8_1(data | 0);
+ break;
+ case 85:
+ renderer.writeBG2Y8_2(data | 0);
+ break;
+ case 86:
+ renderer.writeBG2Y8_3(data | 0);
+ break;
+ case 87:
+ renderer.writeBG2Y16_0(data | 0);
+ break;
+ case 88:
+ renderer.writeBG2Y16_1(data | 0);
+ break;
+ case 89:
+ renderer.writeBG2Y32(data | 0);
+ break;
+ case 90:
+ renderer.writeBG3X8_0(data | 0);
+ break;
+ case 91:
+ renderer.writeBG3X8_1(data | 0);
+ break;
+ case 92:
+ renderer.writeBG3X8_2(data | 0);
+ break;
+ case 93:
+ renderer.writeBG3X8_3(data | 0);
+ break;
+ case 94:
+ renderer.writeBG3X16_0(data | 0);
+ break;
+ case 95:
+ renderer.writeBG3X16_1(data | 0);
+ break;
+ case 96:
+ renderer.writeBG3X32(data | 0);
+ break;
+ case 97:
+ renderer.writeBG3Y8_0(data | 0);
+ break;
+ case 98:
+ renderer.writeBG3Y8_1(data | 0);
+ break;
+ case 99:
+ renderer.writeBG3Y8_2(data | 0);
+ break;
+ case 100:
+ renderer.writeBG3Y8_3(data | 0);
+ break;
+ case 101:
+ renderer.writeBG3Y16_0(data | 0);
+ break;
+ case 102:
+ renderer.writeBG3Y16_1(data | 0);
+ break;
+ case 103:
+ renderer.writeBG3Y32(data | 0);
+ break;
+ case 104:
+ renderer.writeWIN0XCOORDRight8(data | 0);
+ break;
+ case 105:
+ renderer.writeWIN0XCOORDLeft8(data | 0);
+ break;
+ case 106:
+ renderer.writeWIN0XCOORD16(data | 0);
+ break;
+ case 107:
+ renderer.writeWIN1XCOORDRight8(data | 0);
+ break;
+ case 108:
+ renderer.writeWIN1XCOORDLeft8(data | 0);
+ break;
+ case 109:
+ renderer.writeWIN1XCOORD16(data | 0);
+ break;
+ case 110:
+ renderer.writeWINXCOORD32(data | 0);
+ break;
+ case 111:
+ renderer.writeWIN0YCOORDBottom8(data | 0);
+ break;
+ case 112:
+ renderer.writeWIN0YCOORDTop8(data | 0);
+ break;
+ case 113:
+ renderer.writeWIN0YCOORD16(data | 0);
+ break;
+ case 114:
+ renderer.writeWIN1YCOORDBottom8(data | 0);
+ break;
+ case 115:
+ renderer.writeWIN1YCOORDTop8(data | 0);
+ break;
+ case 116:
+ renderer.writeWIN1YCOORD16(data | 0);
+ break;
+ case 117:
+ renderer.writeWINYCOORD32(data | 0);
+ break;
+ case 118:
+ renderer.writeWIN0IN8(data | 0);
+ break;
+ case 119:
+ renderer.writeWIN1IN8(data | 0);
+ break;
+ case 120:
+ renderer.writeWININ16(data | 0);
+ break;
+ case 121:
+ renderer.writeWINOUT8(data | 0);
+ break;
+ case 122:
+ renderer.writeWINOBJIN8(data | 0);
+ break;
+ case 123:
+ renderer.writeWINOUT16(data | 0);
+ break;
+ case 124:
+ renderer.writeWINCONTROL32(data | 0);
+ break;
+ case 125:
+ renderer.writeMOSAIC8_0(data | 0);
+ break;
+ case 126:
+ renderer.writeMOSAIC8_1(data | 0);
+ break;
+ case 127:
+ renderer.writeMOSAIC16(data | 0);
+ break;
+ case 128:
+ renderer.writeBLDCNT8_0(data | 0);
+ break;
+ case 129:
+ renderer.writeBLDCNT8_1(data | 0);
+ break;
+ case 130:
+ renderer.writeBLDCNT16(data | 0);
+ break;
+ case 131:
+ renderer.writeBLDALPHA8_0(data | 0);
+ break;
+ case 132:
+ renderer.writeBLDALPHA8_1(data | 0);
+ break;
+ case 133:
+ renderer.writeBLDALPHA16(data | 0);
+ break;
+ case 134:
+ renderer.writeBLDCNT32(data | 0);
+ break;
+ default:
+ renderer.writeBLDY8(data | 0);
+ }
+}
+function decodeInternalCommand(data) {
+ data = data | 0;
+ switch (data | 0) {
+ case 0:
+ renderer.incrementScanLineQueue();
+ break;
+ default:
+ renderer.ensureFraming();
+ }
+}
diff --git a/IodineGBA/includes/TypedArrayShim.js b/IodineGBA/includes/TypedArrayShim.js
index bc29659..4a7d07e 100644
--- a/IodineGBA/includes/TypedArrayShim.js
+++ b/IodineGBA/includes/TypedArrayShim.js
@@ -1,11 +1,11 @@
"use strict";
/*
Copyright (C) 2012-2015 Grant Galitz
-
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function getInt8Array(size_t) {
diff --git a/README.md b/README.md
index c2899a3..18e26b7 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
JavaScript GameBoy Advance Emulator
=================================
-**Copyright (C) 2010 - 2015 Grant Galitz**
+**Copyright (C) 2010 - 2016 Grant Galitz**
A GameBoy Advance emulator that utilizes HTML5 canvas and JavaScript audio APIs to provide a full emulation of the console.
@@ -20,39 +20,39 @@ Screenshots
* **Pokemon Ruby:**

-
+
* **Super Mario Advance:**
-
+

* **Mario & Luigi Superstar Saga:**
-
+

-
+
* **Mario Kart Advance:**
-
+

-
+
* **Earthworm Jim:**
-
+

-
+
* **Advance Wars:**
-
+

-
+
* **Wario Land 4:**
-
+

-
+
* **Golden Sun:**
-
+

* **Game & Watch Gallery 4:**
-
+

-
+
* **GBA BIOS:**
- 
\ No newline at end of file
+ 
diff --git a/index.html b/index.html
index ead1bbd..83933be 100644
--- a/index.html
+++ b/index.html
@@ -28,6 +28,7 @@
+
@@ -114,4 +115,4 @@