From ca6945d522b84b9c32949fe892772d3054f78ffd Mon Sep 17 00:00:00 2001 From: yellows111 Date: Sun, 5 Nov 2023 16:26:06 +0000 Subject: [PATCH] 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. --- README.md | 5 +++-- gltf-exporter.js | 13 ++++++++++--- index.js | 9 ++++++++- input.htm | 9 ++++++--- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5ba9968..4ad5aa1 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,13 @@ A JavaScript library (sorta) to read PS2 icons, and their related formats. * PS2D format (icon.sys) ## What can it do -* Allow any file in a PSU's virtual filesystem to be dumped. -* Warn of invalid icon.sys titles. +* Allow any file in a PSU's or SPS/XPS's virtual filesystem to be dumped. +* Warn of invalid icon.sys display names. * Read and parse an EMS MA export file. * 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. * 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 * (Re)build save files. diff --git a/gltf-exporter.js b/gltf-exporter.js index ec97293..f9f314c 100644 --- a/gltf-exporter.js +++ b/gltf-exporter.js @@ -139,8 +139,8 @@ function imf2gltf(icon = null, filename = "untitled") { "componentType": gltfConstants.FLOAT, "count": icon.vertices.length, "type": "VEC3", - "max": [ 4.0, 4.0, 4.0], - "min": [-4.0, -4.0, -4.0], + "max": [ 5.0, 5.0, 5.0], + "min": [-5.0, -5.0, -5.0], "name": "Vertex Position Accessor" }, { @@ -263,7 +263,7 @@ function loadAndConvertIcon(inputData, attemptedFilename = "-") { } // 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]) { case "psu": { let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu"); @@ -321,6 +321,12 @@ switch(processObj.argv[2]) { } 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: { //Template literal goes here. console.info( @@ -332,6 +338,7 @@ xps: Read a X-Port export file. sys: Read a icon.sys (964 bytes) file, and attempt to read icon files from the current directory. +icn: Read an icon file directly. (Also as: ico) ` ); // end of template processObj.exit(1); } diff --git a/index.js b/index.js index 6779644..f4103eb 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ require("util").inspect.defaultOptions.depth = 2; icondumper2.options.setDebug(false); // 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]) { case "psu": { let inputFile = filesystem.readFileSync(processObj.argv[3] ? processObj.argv[3] : "file.psu"); @@ -61,6 +61,12 @@ switch(processObj.argv[2]) { } 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: { //Template literal goes here. console.log( @@ -73,6 +79,7 @@ xps: Read a X-Port export file. sys: Read a icon.sys (964 bytes) file, and attempt to read icon files from the current directory. (suppress behaviour with --no-read-models) +icn: Read an icon file directly. (Also as: ico) ` ); // end of template } processObj.exit(1); diff --git a/input.htm b/input.htm index a8507ba..913d26c 100644 --- a/input.htm +++ b/input.htm @@ -569,8 +569,11 @@ } //todo: More than one model shape rendering, other 2 icons, Animation parsing, animation tweening - icondumper2 (unknown icon.js version) [C: Loading...] — © 2023 yellows111 - - + icondumper2 (unknown icon.js version) [C: Loading...] — © 2023 yellows111 + \ No newline at end of file