61 lines
1.5 KiB
HTML
61 lines
1.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<title>GCT Generator</title>
|
|
|
|
<script language="javascript">
|
|
|
|
function downloadGCT(data, filename) {
|
|
var rawData = new Uint8Array(data.length/2);
|
|
|
|
for (var x = 0; x < rawData.length; x++) {
|
|
rawData[x] = parseInt(data.substr(x*2, 2), 16);
|
|
}
|
|
|
|
var file = new Blob([rawData], {type: "application/octet-stream"});
|
|
|
|
if (window.navigator.msSaveOrOpenBlob)
|
|
window.navigator.msSaveOrOpenBlob(file, filename);
|
|
else {
|
|
var a = document.createElement("a"),
|
|
url = window.URL.createObjectURL(file);
|
|
a.href = url;
|
|
a.download = filename;
|
|
a.click();
|
|
window.URL.revokeObjectURL(url);
|
|
}
|
|
}
|
|
|
|
|
|
function generateGCT() {
|
|
var data = "00D0C0DE00D0C0DE";
|
|
data += document.getElementById("gctData").value.replace(/[\s\n\r\t]+/gm,"");
|
|
if (!/^[a-fA-F0-9]+$/.test(data) || (data.length % 16 != 0)) {
|
|
alert("Not a valid code");
|
|
return;
|
|
};
|
|
data += "FF00000000000000";
|
|
|
|
var fileName = document.getElementById("gameID").value;
|
|
fileName += ".gct";
|
|
|
|
downloadGCT(data, fileName);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
Game ID:<br />
|
|
<textarea id="gameID" rows="1" cols="50"></textarea><br />
|
|
Code:<br />
|
|
<textarea id="gctData" rows="20" cols="50"></textarea><br />
|
|
<button onclick="generateGCT()">Download</button>
|
|
</div>
|
|
</body>
|
|
|
|
|
|
</html>
|
|
|
|
|