Update README.md

Minor updates to versioning, and added raw icon file support to both node clients.

And that's it from me. Other than using GLB instead of .glTF triplets, I don't know what to do with the exporter. Would update the HTML client, yet I'm not sure on the implementation details yet.
This commit is contained in:
yellows111 2023-11-05 16:26:06 +00:00
parent ff80a0effc
commit ca6945d522
4 changed files with 27 additions and 9 deletions

View File

@ -10,12 +10,13 @@ A JavaScript library (sorta) to read PS2 icons, and their related formats.
* PS2D format (icon.sys) * PS2D format (icon.sys)
## What can it do ## What can it do
* Allow any file in a PSU's virtual filesystem to be dumped. * Allow any file in a PSU's or SPS/XPS's virtual filesystem to be dumped.
* Warn of invalid icon.sys titles. * Warn of invalid icon.sys display names.
* Read and parse an EMS MA export file. * Read and parse an EMS MA export file.
* Export the icon model, with all seperate shapes included to a JavaScript Object. * Export the icon model, with all seperate shapes included to a JavaScript Object.
* Node.js compatible (CommonJS) exporting while still being compatible with other JavaScript implementations. * Node.js compatible (CommonJS) exporting while still being compatible with other JavaScript implementations.
* Convert a 128x128x16 BGR5A1 bitmap to a RGB5A1 format. * Convert a 128x128x16 BGR5A1 bitmap to a RGB5A1 format.
* Convert an icon or a set of icons to glTF, with textures.
## What it doesn't do ## What it doesn't do
* (Re)build save files. * (Re)build save files.

View File

@ -139,8 +139,8 @@ function imf2gltf(icon = null, filename = "untitled") {
"componentType": gltfConstants.FLOAT, "componentType": gltfConstants.FLOAT,
"count": icon.vertices.length, "count": icon.vertices.length,
"type": "VEC3", "type": "VEC3",
"max": [ 4.0, 4.0, 4.0], "max": [ 5.0, 5.0, 5.0],
"min": [-4.0, -4.0, -4.0], "min": [-5.0, -5.0, -5.0],
"name": "Vertex Position Accessor" "name": "Vertex Position Accessor"
}, },
{ {
@ -263,7 +263,7 @@ function loadAndConvertIcon(inputData, attemptedFilename = "-") {
} }
// can anything de-dupe this code somehow? (index.js) // can anything de-dupe this code somehow? (index.js)
console.info(`icon.js version ${icondumper2.version}, 2023 (c) yellows111`); console.info(`icon.js version ${icondumper2.version}, ${(new Date()).getFullYear().toString()} (c) yellows111`);
switch(processObj.argv[2]) { switch(processObj.argv[2]) {
case "psu": { case "psu": {
let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu"); let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu");
@ -321,6 +321,12 @@ switch(processObj.argv[2]) {
} }
break; break;
} }
case "ico":
case "icn": {
let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "input.icn");
loadAndConvertIcon(iconjs.readIconFile(inputFile.buffer.slice(inputFile.byteOffset, inputFile.byteOffset + inputFile.byteLength)), require("path").basename(processObj.argv[3]));
break;
}
default: { default: {
//Template literal goes here. //Template literal goes here.
console.info( console.info(
@ -332,6 +338,7 @@ xps: Read a X-Port export file.
sys: Read a icon.sys (964 bytes) file, and attempt sys: Read a icon.sys (964 bytes) file, and attempt
to read icon files from the current directory. to read icon files from the current directory.
icn: Read an icon file directly. (Also as: ico)
` ); // end of template ` ); // end of template
processObj.exit(1); processObj.exit(1);
} }

View File

@ -12,7 +12,7 @@ require("util").inspect.defaultOptions.depth = 2;
icondumper2.options.setDebug(false); icondumper2.options.setDebug(false);
// node.js client // node.js client
console.log(`icon.js version ${icondumper2.version}, 2023 (c) yellows111`); console.log(`icon.js version ${icondumper2.version}, ${(new Date()).getFullYear().toString()} (c) yellows111`);
switch(processObj.argv[2]) { switch(processObj.argv[2]) {
case "psu": { case "psu": {
let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu"); let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu");
@ -61,6 +61,12 @@ switch(processObj.argv[2]) {
} }
break; break;
} }
case "ico":
case "icn": {
let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "input.icn");
console.log(`contents of ${require("path").basename(processObj.argv[3])}:`, iconjs.readIconFile(inputFile.buffer.slice(inputFile.byteOffset, inputFile.byteOffset + inputFile.byteLength)));
break;
}
default: { default: {
//Template literal goes here. //Template literal goes here.
console.log( console.log(
@ -73,6 +79,7 @@ xps: Read a X-Port export file.
sys: Read a icon.sys (964 bytes) file, and attempt sys: Read a icon.sys (964 bytes) file, and attempt
to read icon files from the current directory. to read icon files from the current directory.
(suppress behaviour with --no-read-models) (suppress behaviour with --no-read-models)
icn: Read an icon file directly. (Also as: ico)
` ); // end of template ` ); // end of template
} }
processObj.exit(1); processObj.exit(1);

View File

@ -569,8 +569,11 @@
} }
//todo: More than one model shape rendering, other 2 icons, Animation parsing, animation tweening //todo: More than one model shape rendering, other 2 icons, Animation parsing, animation tweening
</script> </script>
<span id="version">icondumper2 <span id="iconjsVersion">(unknown icon.js version)</span> [C: <span id="clientVersion">Loading...</span>] &mdash; &copy; 2023 yellows111</span> <span id="version">icondumper2 <span id="iconjsVersion">(unknown icon.js version)</span> [C: <span id="clientVersion">Loading...</span>] &mdash; &copy; <span id="currentYear">2023</span> yellows111</span>
<script>document.getElementById("iconjsVersion").textContent = ICONJS_VERSION;</script> <script>
<script>document.getElementById("clientVersion").textContent = "0.6.4";</script> document.getElementById("iconjsVersion").textContent = ICONJS_VERSION;
document.getElementById("clientVersion").textContent = "0.6.4";
document.getElementById("currentYear").textContent = (new Date()).getFullYear().toString();
</script>
</body> </body>
</html> </html>