Created
January 15, 2012 18:25
-
-
Save HoLyVieR/1616679 to your computer and use it in GitHub Desktop.
Gameboy-Online - Export SAV file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This will let you export SAV file from a ROM. | |
* NOTE : Just change the "filename" variable to name of the ROM. | |
*/ | |
// Getting the data // | |
var filename = "ROM_NAME"; | |
var rawData = JSON.parse(localStorage["SRAM_" + filename]) // Data is stored JSON format in localStorage // | |
.map(function (a) { return String.fromCharCode(a); }) // We convert each value in the array to the char value // | |
.join(""); // We make it into a big string which is the data of the save file // | |
// Creating the save file popup with the hidden iframe technique // | |
var tmpIframe = document.createElement("iframe"); | |
tmpIframe.src = "data:application/force-download," + escape(rawData); | |
tmpIframe.style.display = "none"; | |
document.body.appendChild(tmpIframe); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment