-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
271 additions
and
256 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<html> | ||
<head> | ||
<title>cntc chunk analysis</title> | ||
<meta content="" /> | ||
<style></style> | ||
</head> | ||
|
||
<body> | ||
<label> | ||
<input id="filePicker" type="file" /> | ||
</label> | ||
<script src="./static/jquery.js"></script> | ||
<script src="./static/DataStream.js"></script> | ||
<script src="./static/T3D.js"></script> | ||
<script> | ||
var _lr; | ||
$("#filePicker").change(function (evt) { | ||
var file = evt.target.files[0]; | ||
T3D.getLocalReader( | ||
file, | ||
async function (lr) { | ||
_lr = lr; | ||
res = await lr.readFileList(); | ||
console.log("Sorting the files"); | ||
|
||
//Get the cntc files | ||
let myFiles = res.filter((i) => { | ||
return i.fileType == "PF_cntc" && i.baseIdList[0] < 1000000; | ||
}); | ||
|
||
let cntcTypes = {}; | ||
|
||
console.log("Work:"); | ||
let fileWork = 0; | ||
for (let elt of myFiles) { | ||
console.log((fileWork += 1)); | ||
let r = await lr.readFile(elt.mftId); | ||
let file = new T3D.GW2File(new DataStream(r.buffer), 0); | ||
let mainChunk = file.getChunk("Main").data; | ||
|
||
for (let entry of mainChunk.indexEntries) { | ||
if (!cntcTypes[entry.type]) { | ||
cntcTypes[entry.type] = { | ||
amount: 0, | ||
flagged: {}, | ||
}; | ||
} | ||
|
||
cntcTypes[entry.type].amount += 1; | ||
cntcTypes[entry.type].flagged[elt.baseIdList[0]] | ||
? (cntcTypes[entry.type].flagged[elt.baseIdList[0]] += 1) | ||
: (cntcTypes[entry.type].flagged[elt.baseIdList[0]] = 1); | ||
} | ||
} | ||
|
||
console.log(cntcTypes); | ||
}, | ||
"./static/t3dworker.js" | ||
); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<html> | ||
<head> | ||
<title>cntc chunk analysis</title> | ||
<meta content="" /> | ||
<style></style> | ||
</head> | ||
|
||
<body> | ||
<label> | ||
<input id="filePicker" type="file" /> | ||
</label> | ||
<script src="./static/jquery.js"></script> | ||
<script src="./static/DataStream.js"></script> | ||
<script src="./static/T3D.js"></script> | ||
<script> | ||
var lr; | ||
$("#filePicker").change(function (evt) { | ||
var file = evt.target.files[0]; | ||
T3D.getLocalReader( | ||
file, | ||
async function (lr) { | ||
//We target a specific file: | ||
const cntcFile = 473992; | ||
|
||
let archiveFile = await lr.readFile(cntcFile, false, false, undefined, undefined, true); | ||
let file = new T3D.GW2File(new DataStream(archiveFile.buffer), 0); | ||
let mainChunk = file.getChunk("Main").data; | ||
|
||
console.log("File loaded"); | ||
|
||
let entryArray = []; | ||
|
||
const entriesAmount = mainChunk.indexEntries.length; | ||
for (let i = 0; i < entriesAmount; i++) { | ||
let begin = mainChunk.indexEntries[i].offset; | ||
let end = mainChunk.indexEntries[i + 1] ? mainChunk.indexEntries[i + 1].offset : mainChunk.content.length; | ||
let contentSlice = mainChunk.content.slice(begin, end); | ||
let entry = { | ||
type: mainChunk.indexEntries[i].type, | ||
rootIndex: mainChunk.indexEntries[i].rootIndex, | ||
namespaceIndex: mainChunk.indexEntries[i].namespaceIndex, | ||
contentSlice: contentSlice, | ||
}; | ||
entryArray.push(entry); | ||
} | ||
|
||
console.log(entryArray); | ||
}, | ||
"./static/t3dworker.js" | ||
); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.