-
Notifications
You must be signed in to change notification settings - Fork 1
/
uleiso.html
49 lines (49 loc) · 2.94 KB
/
uleiso.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
<head>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14082/FileSaver.js"></script>
<script>
let isomime = "application/x-iso9660-image";
async function convert() {
let bootblob = await (await fetch("uncompressed BOOT.ELF")).blob();
let replacements = [
[0xA1190A50+0x570, bootblob.slice(0x1000,0x41000)],
[0xA11D0FC0+0x900, bootblob.slice(0x41000,0x81000)],
[0xA12118C0+0x680, bootblob.slice(0x81000,0xC1000)],
[0xA1251F40+0x1500, bootblob.slice(0xC1000,Math.min(0x101000, bootblob.size))],
[0xA111EDE0, new Blob([new Uint8Array([0xD0, 0xF5, 0x62, 0x08, 0x00, 0x00, 0x00, 0x00])])],
[0xA1294CC0, new Blob([new Uint8Array([
0x00, 0x00, 0x04, 0x24, 0x64, 0x00, 0x03, 0x24, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0x00, 0x04, 0x24, 0x01, 0x00, 0x03, 0x24, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7C, 0x01, 0x0E, 0x3C, 0x80, 0x01, 0x0F, 0x3C, 0x84, 0x01, 0x18, 0x3C, 0x88, 0x01, 0x19, 0x3C, 0x40, 0x9A, 0xCE, 0x25, 0x40, 0xA3, 0xEF, 0x25, 0xC0, 0xA9, 0x18, 0x27, 0xC0, 0xBE, 0x39, 0x27, 0x10, 0x00, 0x0A, 0x3C, 0x14, 0x00, 0x0B, 0x3C, 0x18, 0x00, 0x0C, 0x3C, 0x1C, 0x00, 0x0D, 0x3C, 0x14, 0x00, 0x09, 0x3C, 0x00, 0x00, 0xC4, 0x79, 0x00, 0x00, 0xE5, 0x79, 0x00, 0x00, 0x06, 0x7B, 0x00, 0x00, 0x27, 0x7B, 0x00, 0x00, 0x44, 0x7D, 0x00, 0x00, 0x65, 0x7D, 0x00, 0x00, 0x86, 0x7D, 0x00, 0x00, 0xA7, 0x7D, 0x10, 0x00, 0x4A, 0x25, 0x10, 0x00, 0x6B, 0x25, 0x10, 0x00, 0x8C, 0x25, 0x10, 0x00, 0xAD, 0x25, 0x10, 0x00, 0xCE, 0x25, 0x10, 0x00, 0xEF, 0x25, 0x10, 0x00, 0x18, 0x27, 0xF0, 0xFF, 0x49, 0x15, 0x10, 0x00, 0x39, 0x27,
0x00, 0x00, 0x04, 0x24, 0x64, 0x00, 0x03, 0x24, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x04, 0x24, 0x64, 0x00, 0x03, 0x24, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x03, 0x24, 0x10, 0x00, 0x04, 0x3C, 0xE0, 0x00, 0x84, 0x24, 0x0A, 0x00, 0x05, 0x3C, 0xF0, 0x9A, 0xA5, 0x24, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x07, 0x3C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])])]
];
replacements.sort((a,b) => {
return a[0] - b[0];
});
let infile = document.getElementById("fileinput").files[0];
console.log(replacements);
console.log(infile.size);
let parts = [];
parts.push(infile.slice(0, replacements[0][0]));
for(let i = 0; i < replacements.length-1; i++) {
parts.push(replacements[i][1]);
parts.push(infile.slice(replacements[i][0] + replacements[i][1].size, replacements[i+1][0]));
}
parts.push(replacements[replacements.length-1][1]);
parts.push(infile.slice(replacements[replacements.length-1][0] + replacements[replacements.length-1][1].size));
console.log(parts);
let outfile = new Blob(parts, {type:isomime});
console.log(outfile.size);
saveAs(outfile, "ntdf_ule.iso");
}
</script>
</head>
<body>
<div>Choose your Darkest Faerie .iso file and press the button on the right to save the patched .iso file</div>
<input type="file" id="fileinput">
<input type="button" onclick="convert()" value="Patch N:TDF with uLE">
<div id="savespot"></div>
</body>
</html>