From 5738fbb09c7ece91dcde905b42a030a425a5bcd2 Mon Sep 17 00:00:00 2001
From: yellows111
Date: Sun, 3 Dec 2023 17:32:26 +0000
Subject: [PATCH] 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.
---
.github/workflows/build.yml | 2 +-
.gitignore | 3 +++
examples/example_001/id2_example_001.psu | Bin 0 -> 6144 bytes
examples/example_001/id2_example_001.sps | Bin 0 -> 2874 bytes
examples/example_001/raw/description.obj | 19 +++++++++++++++++++
examples/example_001/raw/example_001.icn | Bin 0 -> 344 bytes
examples/example_001/raw/icon.sys | Bin 0 -> 964 bytes
icon.js | 15 +++++++++++++--
index.htm | 8 ++++++--
9 files changed, 42 insertions(+), 5 deletions(-)
create mode 100644 examples/example_001/id2_example_001.psu
create mode 100644 examples/example_001/id2_example_001.sps
create mode 100644 examples/example_001/raw/description.obj
create mode 100644 examples/example_001/raw/example_001.icn
create mode 100644 examples/example_001/raw/icon.sys
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4b1b82f..66ce543 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -16,7 +16,7 @@ jobs:
- name: Compile documentation with JSDoc
run: npx jsdoc ./icon.js -d ./documentation -R ./README.md
- name: Upload Artifacts
- uses: 'actions/upload-artifact@main'
+ uses: actions/upload-artifact@main
with:
name: JSDoc-compiled Documentation
path: './documentation/*'
diff --git a/.gitignore b/.gitignore
index 0d4e9b3..3bd233a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,9 @@ icon.sys
*.psv
*.xps
*.sps
+*.npo
+*.p2m
+*.md
# Unused data
diff --git a/examples/example_001/id2_example_001.psu b/examples/example_001/id2_example_001.psu
new file mode 100644
index 0000000000000000000000000000000000000000..79fe4db5fe8ba9456752de56da5bc8d889bd0977
GIT binary patch
literal 6144
zcmeHLOK;Oa5O&m}g4;Ab!U1WeNc2J+$2KHz;h~2r5uoW
ziC2aA0sIQ!!m%KJ0=Lo|y>Y_Kti4te*|eyKq>|U#-I?#38INb}jhzo$l5|3XcD`7c
zn%kY3kx_vb>7kN7+AVFF-fOOR+jLn~E9r(AGm#Zog!SibbiGIQl}Uh+K{SV2IQ|PmPIO6P@7N>u1diuyo4sNUJo*+$
zkJ&@Op0O?VhCO93!0IKt*}vL<&FXM82G2I|{-W5XGe{ju9=HFYlFW><3M5nj_y0RN
zAkJ0!`@byq|42`88G?>_?+*pblrdBwC*ktrD**1Rb1?o~oc#{d^q&F?aE87B!sgyC
z;6$2!|NCw3%sk-p(nClUxDZ|M&66EuUS$|9|pg|Bv*8a&J-3
zbnUKh!)HKeW$hsIjGwRy6v;K>Q_m+At<`$#S>-@$W4%jVjhJnl
zI=-jm0HV%6u;6ytF&o5!hm#AB)ZVVb^-}3e5eykf;zxf(!?$>*M|y#&+FpHWud>OwZt1P1A|@HO<%#vm3^=d960T;F!~q
zgPc9L{b25c^g-5MqC1)$?H}G8Xlp?I5H;?sEUqe|?$yLoaZ}vJb5E>`hoVZ)ss-zo
zxB=|0SQC%M9dRG52jcwd>D5P~f~VS@6D!A_h=X=L(%~rV
z_rl1hgt0$y0y<87&aO8*3+c)J+wnaW`JeR9?!XR9dIB%vYC3@Zq5E6jUPnsdy{$BG
zd3#0Ur1K?>|M@EWWL@%`f?I*UcAv+GK0>9wkBSy)$QX>3txe#ZrJjF#(syVC_y`-s
zbr<5FLVR;u;)rRjY_*2IQ2d8hYgFZtIOU1s$K|IyF??B1On$<5tv`m}u0Lj7ae0VO
z?@_)>Xllw~>4!?lE
zFUxbA0k51r$1U42PiE3CpERx7q7zhR=FED4|Eo-TiR(Gzn1%*}6bvmg$UC9sN?q;=
zMcl>T=~k)QIok$;o0MJ77>1~!a+RqVP>x5MsM4q93MaH8xr*g7)mtiSr8o~&AG(6}
z#BBosgqG#{V8~_C1izr+>N9Dd!)0+jkB1w11AQT1$YTpFUIb{!p&?xcf#fYnS3yP<
S6tgHfMF|!&=@-vZ?|uM?i;C?4
literal 0
HcmV?d00001
diff --git a/examples/example_001/raw/description.obj b/examples/example_001/raw/description.obj
new file mode 100644
index 0000000..20a4d46
--- /dev/null
+++ b/examples/example_001/raw/description.obj
@@ -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
diff --git a/examples/example_001/raw/example_001.icn b/examples/example_001/raw/example_001.icn
new file mode 100644
index 0000000000000000000000000000000000000000..d825c149fa88acd7ea8214e6648fd5bf00bed473
GIT binary patch
literal 344
zcmZQzU<5)224)~;U}&)C0g^A&xi0`ImVf+B|3Nem3ji7QFP{U&6&P4%|Cq)o$p;kY
zW8h%;4;6m^5r6&>EDqH3zy9Ta?hhdS=l=iahnWKw2bqISJvQ?}=3r3|b`KWwLE<>w
bk3~J){aE~k%^Z+=PKyF;p~|+`+#^an8U!ZA4r2R
zNDUA)KxqgMLgEtx$-yuKL(|Nr)}|gH>~EUhG`T4N1RK+Utj?xppjcm1OViY*-lhpa
xRg;$$7|9M6m~2KT(bxRWxiv001{9LL~qI
literal 0
HcmV?d00001
diff --git a/icon.js b/icon.js
index cc85bc2..a7f5882 100644
--- a/icon.js
+++ b/icon.js
@@ -8,7 +8,7 @@ ICONJS_STRICT = true;
* @constant {string}
* @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.
@@ -576,11 +576,22 @@ function readSharkXPortSxpsFile(input) {
offset += (titleLength + 4);
const descriptionLength = u32le(offset);
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 = {
"game": stringScrubber((new TextDecoder("utf-8")).decode(title)),
"name": stringScrubber((new TextDecoder("utf-8")).decode(description))
}
+ if(description2Length !== 0) {
+ comments.desc = stringScrubber((new TextDecoder("utf-8")).decode(description2));
+ }
const totalSize = u32le(offset);
offset += 4;
const header = readSxpsDescriptor(input.slice(offset, offset + 250));
diff --git a/index.htm b/index.htm
index 985f7a5..e128d94 100644
--- a/index.htm
+++ b/index.htm
@@ -148,7 +148,7 @@
Date modified: --:--:-- --/--/---- UTC+09:00
- File comments: -
+ File comments: - -