fix SPS/XPS crash, example icon
fix sps/xps parser crash: apparently those 4 bytes were for a third part of metadata for those files. HTML client now shows this information if available. example icon: id2_example_001 (12 vertices, 4 triangles) I've saved and included this icon in the .PSU and .SPS formats. .PSV is a bit more complicated for a valid export. Example icon shows vertex colours with no animation nor includes a texture (texture type 3). was considering adding new formats, but its not one of the big five (translation: not MAX/PWS or CBS), and I can barely find any examples to test with. Oh well. adding them to gitignore already. If the demand comes up, I've made the related hexpat's for them anyway. .xpo and .spo (assuming they're like .xpo files) files are out of scope for this project, if anyone asks. Reason being is that they usually exclude icon data, and even icon.sys. This makes it rather useless to me.
This commit is contained in:
parent
837dffc4dc
commit
5738fbb09c
|
@ -16,7 +16,7 @@ jobs:
|
||||||
- name: Compile documentation with JSDoc
|
- name: Compile documentation with JSDoc
|
||||||
run: npx jsdoc ./icon.js -d ./documentation -R ./README.md
|
run: npx jsdoc ./icon.js -d ./documentation -R ./README.md
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: 'actions/upload-artifact@main'
|
uses: actions/upload-artifact@main
|
||||||
with:
|
with:
|
||||||
name: JSDoc-compiled Documentation
|
name: JSDoc-compiled Documentation
|
||||||
path: './documentation/*'
|
path: './documentation/*'
|
||||||
|
|
|
@ -9,6 +9,9 @@ icon.sys
|
||||||
*.psv
|
*.psv
|
||||||
*.xps
|
*.xps
|
||||||
*.sps
|
*.sps
|
||||||
|
*.npo
|
||||||
|
*.p2m
|
||||||
|
*.md
|
||||||
|
|
||||||
# Unused data
|
# Unused data
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,19 @@
|
||||||
|
# A test 12-vertice icon for testing icondumper2 clients.
|
||||||
|
# Original Wavefront OBJ file:
|
||||||
|
o DefaultObject001
|
||||||
|
v 1.250000 1.000000 0.000000
|
||||||
|
v -0.750000 1.000000 -1.000000
|
||||||
|
v -0.750000 1.000000 1.000000
|
||||||
|
v 0.000000 0.000000 0.000000
|
||||||
|
vn -0.0000 1.0000 -0.0000
|
||||||
|
vn -0.8000 -0.6000 -0.0000
|
||||||
|
vn 0.3904 -0.4880 0.7807
|
||||||
|
vn 0.3904 -0.4880 -0.7807
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 0.875000 0.750000
|
||||||
|
s 0
|
||||||
|
f 1/1/1 2/2/1 3/3/1
|
||||||
|
f 4/1/2 3/3/2 2/2/2
|
||||||
|
f 3/3/3 4/1/3 1/1/3
|
||||||
|
f 4/1/4 2/2/4 1/1/4
|
Binary file not shown.
After Width: | Height: | Size: 344 B |
Binary file not shown.
15
icon.js
15
icon.js
|
@ -8,7 +8,7 @@ ICONJS_STRICT = true;
|
||||||
* @constant {string}
|
* @constant {string}
|
||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
const ICONJS_VERSION = "0.6.0";
|
const ICONJS_VERSION = "0.6.1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of DataView to add shortcuts for datatypes that I use often.
|
* Extension of DataView to add shortcuts for datatypes that I use often.
|
||||||
|
@ -576,11 +576,22 @@ function readSharkXPortSxpsFile(input) {
|
||||||
offset += (titleLength + 4);
|
offset += (titleLength + 4);
|
||||||
const descriptionLength = u32le(offset);
|
const descriptionLength = u32le(offset);
|
||||||
const description = input.slice(offset + 4, (offset + 4) + descriptionLength);
|
const description = input.slice(offset + 4, (offset + 4) + descriptionLength);
|
||||||
offset += (descriptionLength + 8);
|
offset += (descriptionLength + 4);
|
||||||
|
const description2Length = u32le(offset);
|
||||||
|
let description2;
|
||||||
|
if(description2Length !== 0) {
|
||||||
|
description2 = input.slice(offset + 4, (offset + 4) + description2Length);
|
||||||
|
offset += (description2Length + 4);
|
||||||
|
} else {
|
||||||
|
offset += 4;
|
||||||
|
}
|
||||||
const comments = {
|
const comments = {
|
||||||
"game": stringScrubber((new TextDecoder("utf-8")).decode(title)),
|
"game": stringScrubber((new TextDecoder("utf-8")).decode(title)),
|
||||||
"name": stringScrubber((new TextDecoder("utf-8")).decode(description))
|
"name": stringScrubber((new TextDecoder("utf-8")).decode(description))
|
||||||
}
|
}
|
||||||
|
if(description2Length !== 0) {
|
||||||
|
comments.desc = stringScrubber((new TextDecoder("utf-8")).decode(description2));
|
||||||
|
}
|
||||||
const totalSize = u32le(offset);
|
const totalSize = u32le(offset);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
const header = readSxpsDescriptor(input.slice(offset, offset + 250));
|
const header = readSxpsDescriptor(input.slice(offset, offset + 250));
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
<span>Date modified: </span><span id="dateModified">--:--:-- --/--/----</span><span> UTC+09:00</span>
|
<span>Date modified: </span><span id="dateModified">--:--:-- --/--/----</span><span> UTC+09:00</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span>File comments: </span><span id="fileCommentGame">(no title)</span></span><span> - </span><span id="fileCommentName">(no description)</span>
|
<span>File comments: </span><span id="fileCommentGame">(no title)</span><span> - </span><span id="fileCommentName">(no description)</span><span> - </span><span id="fileCommentDesc">(no other text)</span>
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
// I usually don't do in-body <script>'s, but I didn't want to do an await onload() again
|
// I usually don't do in-body <script>'s, but I didn't want to do an await onload() again
|
||||||
|
@ -271,6 +271,7 @@
|
||||||
document.getElementById("dateModified").textContent = "--:--:-- --/--/----";
|
document.getElementById("dateModified").textContent = "--:--:-- --/--/----";
|
||||||
document.getElementById("fileCommentGame").textContent = "(no title)";
|
document.getElementById("fileCommentGame").textContent = "(no title)";
|
||||||
document.getElementById("fileCommentName").textContent = "(no description)";
|
document.getElementById("fileCommentName").textContent = "(no description)";
|
||||||
|
document.getElementById("fileCommentDesc").textContent = "(no other text)";
|
||||||
//reset globalstate parameters
|
//reset globalstate parameters
|
||||||
GlobalState.iconState.cachedIconSys = null;
|
GlobalState.iconState.cachedIconSys = null;
|
||||||
GlobalState.iconState.currentIcon = null;
|
GlobalState.iconState.currentIcon = null;
|
||||||
|
@ -547,6 +548,9 @@
|
||||||
document.getElementById("dateModified").textContent = `${mTime.hours.toString().padStart("2","0")}:${mTime.minutes.toString().padStart("2","0")}:${mTime.seconds.toString().padStart("2","0")} ${mTime.day.toString().padStart("2","0")}/${mTime.month.toString().padStart("2","0")}/${mTime.year}`;
|
document.getElementById("dateModified").textContent = `${mTime.hours.toString().padStart("2","0")}:${mTime.minutes.toString().padStart("2","0")}:${mTime.seconds.toString().padStart("2","0")} ${mTime.day.toString().padStart("2","0")}/${mTime.month.toString().padStart("2","0")}/${mTime.year}`;
|
||||||
document.getElementById("fileCommentGame").textContent = vFilesystem.comments.game;
|
document.getElementById("fileCommentGame").textContent = vFilesystem.comments.game;
|
||||||
document.getElementById("fileCommentName").textContent = vFilesystem.comments.name;
|
document.getElementById("fileCommentName").textContent = vFilesystem.comments.name;
|
||||||
|
if(vFilesystem.comments.hasOwnProperty("desc")) {
|
||||||
|
document.getElementById("fileCommentDesc").textContent = vFilesystem.comments.desc;
|
||||||
|
}
|
||||||
console.info("model files (*ps)", output2);
|
console.info("model files (*ps)", output2);
|
||||||
console.info("icon.sys (*ps)", output);
|
console.info("icon.sys (*ps)", output);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
@ -635,7 +639,7 @@
|
||||||
<span id="version">icondumper2 <a href="./documentation" id="iconjsVersion">(unknown icon.js version)</a> [C: <span id="clientVersion">Loading...</span>] — © <span id="currentYear">2023</span> yellows111</span>
|
<span id="version">icondumper2 <a href="./documentation" id="iconjsVersion">(unknown icon.js version)</a> [C: <span id="clientVersion">Loading...</span>] — © <span id="currentYear">2023</span> yellows111</span>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("iconjsVersion").textContent = exports.version;
|
document.getElementById("iconjsVersion").textContent = exports.version;
|
||||||
document.getElementById("clientVersion").textContent = "0.6.5";
|
document.getElementById("clientVersion").textContent = "0.6.6";
|
||||||
document.getElementById("currentYear").textContent = (new Date()).getFullYear().toString();
|
document.getElementById("currentYear").textContent = (new Date()).getFullYear().toString();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue