Permalink
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Open a pull request
- 4 commits
- 7 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
72 additions
and 7 deletions.
- +2 −2 IodineGBA/core/memory/DMA3.js
- +2 −2 index.html
- +5 −0 rom.json
- +5 −0 user_css/main.css
- +20 −0 user_scripts/CoreGlueCode.js
- +10 −1 user_scripts/GUIGlueCode.js
- +28 −2 user_scripts/ROMLoadGlueCode.js
View
4
IodineGBA/core/memory/DMA3.js
| @@ -41,9 +41,9 @@ GameBoyAdvanceDMA3.prototype.initialize = function () { | ||
| } | ||
| GameBoyAdvanceDMA3.prototype.validateDMASource = function (address) { | ||
| address = address | 0; | ||
| - if ((address | 0) >= 0x2000000) { | ||
| + //if ((address | 0) >= 0x2000000) { | ||
| this.source = address | 0; | ||
| - } | ||
| + //} | ||
| } | ||
| GameBoyAdvanceDMA3.prototype.writeDMASource8_0 = function (data) { | ||
| data = data | 0; | ||
View
4
index.html
| @@ -75,8 +75,8 @@ | ||
| <li> | ||
| File | ||
| <ul> | ||
| - <li><span>BIOS: </span> <input type="file" id="bios_load" class="files"></li> | ||
| - <li><span>Game: </span> <input type="file" id="rom_load" class="files"></li> | ||
| + <li><span>BIOS: </span> <span id="bios_status"></span> <input type="file" id="bios_load" class="files"></li> | ||
| + <li><span>Game: </span> <span id="rom_status"></span> <input type="file" id="rom_load" class="files"></li> | ||
| </ul> | ||
| </li> | ||
| <li id="play" class="show">Play</li> | ||
View
5
rom.json
| @@ -0,0 +1,5 @@ | ||
| +{ | ||
| + "rom":{ | ||
| + "path" : "sample.gba" | ||
| + } | ||
| +} |
View
5
user_css/main.css
| @@ -170,6 +170,11 @@ li.hide { | ||
| opacity: 1; | ||
| } | ||
| +#bios_status, #rom_status{ | ||
| + color:red; | ||
| +} | ||
| + | ||
| + | ||
| /* | ||
| |----------------------------------------- | ||
| | Touch Controls | ||
View
20
user_scripts/CoreGlueCode.js
| @@ -89,6 +89,12 @@ window.onload = function () { | ||
| registerGUIEvents(); | ||
| //Register GUI settings. | ||
| registerGUISettings(); | ||
| + | ||
| + //Register Web Storage | ||
| + registerWebStorage(); | ||
| + | ||
| + //Register onload ROM | ||
| + registerOnLoadROM(); | ||
| } | ||
| function registerIodineHandler() { | ||
| try { | ||
| @@ -141,3 +147,17 @@ function registerAudioHandler() { | ||
| IodineGUI.mixerInput = new GlueCodeMixerInput(Mixer); | ||
| IodineGUI.Iodine.attachAudioHandler(IodineGUI.mixerInput); | ||
| } | ||
| + | ||
| +function registerWebStorage() { | ||
| + var b64 = localStorage.getItem('GBA_BIOS'); | ||
| + if(b64 != null) { | ||
| + document.getElementById("bios_status").innerHTML = "Loaded"; | ||
| + var b = base64ToArray(b64); | ||
| + IodineGUI.Iodine.attachBIOS(b); | ||
| + } | ||
| +} | ||
| + | ||
| +function registerOnLoadROM(){ | ||
| + loadRegisteredROM(); | ||
| + console.log("registerOnLoadROM()"); | ||
| +} | ||
View
11
user_scripts/GUIGlueCode.js
| @@ -23,7 +23,16 @@ function registerGUIEvents() { | ||
| IodineGUI.Iodine.pause(); | ||
| }); | ||
| addEvent("click", document.getElementById("restart"), function (e) { | ||
| - IodineGUI.Iodine.restart(); | ||
| + IodineGUI.Iodine.stop(); | ||
| + IodineGUI.Iodine.ROM = null; | ||
| + loadRegisteredROM(); | ||
| + | ||
| + setTimeout( function() { | ||
| + if(IodineGUI.Iodine.ROM != null){ | ||
| + IodineGUI.Iodine.play(); | ||
| + } | ||
| + }, 1000 ); | ||
| + | ||
| }); | ||
| addEvent("click", document.getElementById("sound"), function () { | ||
| setValue("sound", !!this.checked); | ||
View
30
user_scripts/ROMLoadGlueCode.js
| @@ -9,11 +9,21 @@ | ||
| 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 attachBIOS(BIOS) { | ||
| + var b; | ||
| try { | ||
| - IodineGUI.Iodine.attachBIOS(new Uint8Array(BIOS)); | ||
| + b = new Uint8Array(BIOS) | ||
| } | ||
| catch (error) { | ||
| - IodineGUI.Iodine.attachBIOS(BIOS); | ||
| + b = BIOS; | ||
| + } | ||
| + | ||
| + IodineGUI.Iodine.attachBIOS(b); | ||
| + | ||
| + // cache bios in browser local storage | ||
| + try { | ||
| + localStorage.setItem('GBA_BIOS', arrayToBase64(b)); | ||
| + } | ||
| + catch(e) { | ||
| } | ||
| } | ||
| function attachROM(ROM) { | ||
| @@ -23,6 +33,8 @@ function attachROM(ROM) { | ||
| catch (error) { | ||
| IodineGUI.Iodine.attachROM(ROM); | ||
| } | ||
| + | ||
| + document.getElementById("rom_status").innerHTML = "Loaded"; | ||
| } | ||
| function fileLoadShimCode(files, ROMHandler) { | ||
| if (typeof files != "undefined") { | ||
| @@ -79,3 +91,17 @@ function processDownload(parentObj, attachHandler) { | ||
| attachHandler(dataArray); | ||
| } | ||
| } | ||
| + | ||
| +function loadRegisteredROM(){ | ||
| + var ajax = new XMLHttpRequest(); | ||
| + ajax.onload = function (e) { | ||
| + if (this.status === 200) { | ||
| + var rom_json = JSON.parse(this.responseText); | ||
| + var path = rom_json["rom"]["path"]; | ||
| + downloadFile(path, function(){ processDownload(this, attachROM); }); | ||
| + } | ||
| + }; | ||
| + ajax.overrideMimeType("application/json"); | ||
| + ajax.open("GET", "rom.json", true); | ||
| + ajax.send(null); | ||
| +} | ||