Skip to content

Commit 5c63332

Browse files
authored
Add files via upload
0 parents  commit 5c63332

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>GTA 3 IMG Tool</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<style>
7+
body { background: #1a1a1a; color: white; font-family: sans-serif; padding: 20px; }
8+
.card { background: #333; padding: 15px; border-radius: 10px; margin-bottom: 10px; }
9+
input { margin: 10px 0; display: block; }
10+
button { background: #007bff; color: white; border: none; padding: 10px; border-radius: 5px; width: 100%; }
11+
#fileList { margin-top: 20px; border-top: 1px solid #555; }
12+
.file-item { padding: 10px; border-bottom: 1px solid #444; font-size: 14px; }
13+
</style>
14+
</head>
15+
<body>
16+
<h2>GTA III IMG Tool</h2>
17+
<div class="card">
18+
<label>Select .DIR file:</label>
19+
<input type="file" id="dirFile" accept=".dir">
20+
<label>Select .IMG file:</label>
21+
<input type="file" id="imgFile" accept=".img">
22+
<button onclick="readArchive()">Extract File List</button>
23+
</div>
24+
<div id="fileList"></div>
25+
26+
<script>
27+
async function readArchive() {
28+
const dirInput = document.getElementById('dirFile').files[0];
29+
if (!dirInput) return alert("Select the .dir file first!");
30+
31+
const buffer = await dirInput.arrayBuffer();
32+
const view = new DataView(buffer);
33+
const list = document.getElementById('fileList');
34+
list.innerHTML = "Loading...";
35+
36+
let html = "";
37+
for (let i = 0; i < buffer.byteLength; i += 32) {
38+
const offset = view.getUint32(i, false) * 2048;
39+
const size = view.getUint32(i + 4, false) * 2048;
40+
let name = "";
41+
for (let j = 0; j < 24; j++) {
42+
const char = view.getUint8(i + 8 + j);
43+
if (char === 0) break;
44+
name += String.fromCharCode(char);
45+
}
46+
if (name) html += `<div class="file-item"><b>${name}</b><br>Offset: ${offset} | Size: ${size} bytes</div>`;
47+
}
48+
list.innerHTML = html;
49+
}
50+
</script>
51+
</body>
52+
</html>

0 commit comments

Comments
 (0)