SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SHIII Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=195)
-   -   [REQ] Help needed to convert SH5 files to SH3 (https://www.subsim.com/radioroom/showthread.php?t=251044)

Mister_M 11-12-21 03:41 AM

[REQ] Help needed to convert SH5 files to SH3
 
Hello,

I'm currently converting a ship from SH5. I'm running into a major problem : some controllers (even if used by SH3) are not readable in S3D.

I've already encountered this kind of problem in the past, and someone (Tycho) helped me : the file had actually been "locked" by its creator who had changed some bytes with a program (probably a hex editor) in order S3D can't read it. It's reversible. I think it can be solved the same way in order to read SH5 files by S3D, but it is just a supposition by me... :hmmm:

I would be very grateful to anyone able to help me.

https://nsm09.casimages.com/img/2021...9017664206.png

https://nsm09.casimages.com/img/2021...9017664205.png

Jeff-Groves 11-12-21 03:50 PM

Your not going to be able to use the files from SH5 in SH3 or SH4.
Now there is stuff so S3D can read the SH5 files but that's not going to convert them!

Mister_M 11-12-21 04:15 PM

Quote:

Originally Posted by Jeff-Groves (Post 2778383)
Your not going to be able to use the files from SH5 in SH3 or SH4.
Now there is stuff so S3D can read the SH5 files but that's not going to convert them!

Do you mean that even the controllers that I can actually read in S3D won't work in SH3 while in game ?

Jeff-Groves 11-12-21 04:34 PM

IF S3D can read them without the SH5 adaption files?
Then they can be used.
Now. IF S3D can not read them without the adaption files?
You can NOT use them and there is a lot of work ahead!

There were a couple of us that did files for S3D so it can read SH5 files back in the early days of SH5.
:03:

If a smart programmer wants a project? A simple converter program could be done to convert from SH5 to SH3 and the other way around.
I'm just not interested in doing it although I know how.


How are you converting the 3D models?

Mister_M 11-12-21 05:16 PM

OK, thank you for your explanations. :up:

Quote:

Originally Posted by Jeff-Groves (Post 2778390)
If a smart programmer wants a project? A simple converter program could be done to convert from SH5 to SH3 and the other way around.

It's probably not worth it... :/\\!!

Jeff-Groves 11-12-21 05:19 PM

If you dig deep enough? I'm pretty sure ALL units from SH5 Have been converted to SH3!
Hell! I wrote the program that was used to grab the 3D models!

Mister_M 11-13-21 04:42 PM

Quote:

Originally Posted by Jeff-Groves (Post 2778399)
If you dig deep enough? I'm pretty sure ALL units from SH5 Have been converted to SH3!
Hell! I wrote the program that was used to grab the 3D models!

You seem to have superpowers. Would you be able to remove all the water of the SH3 oceans and make my sub fly over the ground (no joke, I'm serious) ? :D This should be easy in fact, just remove underwater fog and the sea waves screen...

Else, I'm interested in any way to allow me to read SH5 files with S3D. :)

Jeff-Groves 11-14-21 11:38 AM

https://www.subsim.com/radioroom/sho...79#post2438679
:up:

And No on Superpowers! :haha:
Just WAY to many years looking at the files in ways many can't.
I started working them in Hex long before things like S3D were around!
I had great teachers like Anvart, ref, DivingDuck, and SO many others!

Mister_M 11-14-21 02:33 PM

Thank you for the link ! I will have a look into it ! :yep:

And yes, learning how to use a hex editor is probably very hard for someone who knows nothing in coding, computer langages, etc. :hmmm:

Jeff-Groves 11-14-21 02:46 PM

The install is funky being in a language I can't read but it is pretty straight forward from any other install.

Works really well from my tests.

Jeff-Groves 11-14-21 03:51 PM

A long time ago, this basic structure was posted at SubSim.

 
SH III DAT FILE FORMAT

Skip the first 20 bytes they seem to be always the same.
Next 4 bytes are a long with the header string lenght.
Next is the author name and the "using Kashmir" stuff, total lenght as read above.

Next, file is made of "chunks". All chunks are like this:
ChunkType 4 bytes
Chunk Subtype/Version 4 bytes
chunk_size long (4 bytes)
Data (chunk_size bytes)


Chunk types and internal structure of each one:

type 0: EMPTY chunk
it's just 12 "00" bytes, so type, subtype and size are 0

type 1: 3D chunk
after the Chunk type, subtype/ver and size, format of the data part is like follows:
chunk_id: 8 bytes //this is used to reference this part inside the file. References usually found inside NODE (type 4) chunks
???????: 1 byte //don't know about this one
nverts: 4 byte long //number of vertices
vertex data: nverts * 3 floats(X,Y,Z)// these are vertices, 3 floats per vertex
ntri: 4 byte long //number of triangles;
triangle data: there are ntri triangles and their texture mapping, each one is as follows
vertex1: unsigned 2-byte int
vertex2: unsigned 2-byte int
vertex3: unsigned 2-byte int
texture coord1: unsigned 2-byte int
texture coord2: unsigned 2-byte int
texture coord3: unsigned 2-byte int
????????????: one byte
ntxcoords: 4 byte long //number of texture coordinates
texture coords data: ntxcoords * 2 floats // texture coordinates are 2D

some objects end here, but some have "TMAP" and a bunch of floats after this, dunno what is that yet so I skip it

type 2: TEXTURE REFERENCE?
after the Chunk type, subtype/ver and size, format of the data part is like follows:
chunk_id: 8 bytes //this is used to reference this part inside the file. References usually found inside NODE (type 4) chunks
then a bunch of bytes that I haven't figured yet, usually ending with a texture filename.

type 3: TGA FILE
these are the TGA files, just packed after the type, subtype and chunk size.

type 4: NODE (these tell us how parts are related to each other, in a tree-like hierarchy)
after the Chunk type, subtype/ver and size, format of the data part is like follows:
chunk_id: 8 bytes //this is used to reference this node inside the file. References usually found inside NODE (type 4) chunks
parent_id: 8 bytes //reference to the "parent" node. root nodes have 00 00 00 00 00 00 00 00 as parent
3dpart_id: 8 bytes //reference to the 3d part managed by this node, 00 00 00 00 00 00 00 00 if this is a "dummy" node with no visible 3d part
????????: 1 byte, seems to be always 00.
????????: 1 byte, seems to be related to the number of different type 2 nodes referenced from this one.
x offset: 4 bytes float //x offset from parent node
y offset: 4 bytes float //y offset from parent node
z offset: 4 bytes float //z offset from parent node

then comes the type 2 chunk references and some stuff I don't yet understand

type 6: DATA?
these are children of type 10 chunks, they seem to hold effects, commands, interactions, etc...
first 8 bytes are the reference to the type 10 parent. rest is strings and numerical values.

type 8: LABEL
these are used to label other nodes
format is:
8 byte parent chunk reference
string with label

type 10: DATA?
these seem to group type 6 chunks and attach them to type 4 nodes
first 8 bytes: id of this chunk
second 8 bytes: id of parent node
then comes some data, usually strings and numbers.

type 102: SCALE?
these come usually near the end of the files, they are a bunch of floats, probably some global scaling, have to test it

type 1001: INDEX
this one seems to be an index, there are chunk ID's and the corresponding file postition, might have to update this if some chunk has its size altered, but some tries suggest this doesnñr affect loading.



There are more chunk types, haven't had time to check them


I'll invite anyone to update that information. Me?
I already know. :haha:
Now if one knows a basic structure from SH3? One can follow the structure from SH5 and adapt!

astvitaliy1982 11-18-21 06:10 AM

1
 
Может вы подскажете? Океаны в игре имеют 47 значений глубин. Каждая глубина соответствует своему цвету. Можно ли их найти в . SH3.exe файле?

Jeff-Groves 11-20-21 01:49 PM

// Underwater
0 - 0xc4bb8000 = -1500.0
1 - 0xc3e00000 = -448.0
2 - 0xc3d00000 = -416.0
3 - 0xc3c00000 = -384.0
4 - 0xc3b00000 = -352.0
5 - 0xc3a00000 = -320.0
6 - 0xc3900000 = -288.0
7 - 0xc3800000 = -256.0
8 - 0xc36a0000 = -234.0
9 - 0xc35c0000 = -220.0
10 - 0xc3530000 = -211.0
11 - 0xc34a0000 = -202.0
12 - 0xc3410000 = -193.0
13 - 0xc3380000 = -184.0
14 - 0xc32f0000 = -175.0
15 - 0xc3260000 = -166.0
16 - 0xc31d0000 = -157.0
17 - 0xc3140000 = -148.0
18 - 0xc3090000 = -137.0
19 - 0xc3000000 = -128.0
20 - 0xc2f00000 = -120.0
21 - 0xc2de0000 = -111.0
22 - 0xc2d00000 = -104.0
23 - 0xc2c20000 = -97.0
24 - 0xc2b40000 = -90.0
25 - 0xc2aa0000 = -85.0
26 - 0xc2a00000 = -80.0
27 - 0xc2980000 = -76.0
28 - 0xc2900000 = -72.0
29 - 0xc2880000 = -68.0
30 - 0xc2800000 = -64.0
31 - 0xc2700000 = -60.0
32 - 0xc2600000 = -56.0
33 - 0xc2500000 = -52.0
34 - 0xc2400000 = -48.0
35 - 0xc2300000 = -44.0
36 - 0xc2200000 = -40.0
37 - 0xc2140000 = -37.0
38 - 0xc2080000 = -34.0
39 - 0xc1f80000 = -31.0
40 - 0xc1e00000 = -28.0
41 - 0xc1d00000 = -26.0
42 - 0xc1c00000 = -24.0
43 - 0xc1b00000 = -22.0
44 - 0xc1a00000 = -20.0
45 - 0xc1900000 = -18.0
46 - 0xc1880000 = -17.0
47 - 0xc1800000 = -16.0

astvitaliy1982 11-21-21 01:01 PM

10
 
Quote:

Originally Posted by astvitaliy1982 (Post 2779177)
Может вы подскажете? Океаны в игре имеют 47 значений глубин. Каждая глубина соответствует своему цвету. Можно ли их найти в . SH3.exe файле?

[QUOTE=Jeff-Groves;2779495]// Underwater
0 - 0xc4bb8000 = -1500.0
1 - 0xc3e00000 = -448.0
2 - 0xc3d00000 = -416.0
3 - 0xc3c00000 = -384.0
4 - 0xc3b00000 = -352.0
5 - 0xc3a00000 = -320.0


Огромное вам спасибо!!!)
1)Не хочу показаться наглым. Хочу попросить дать такую же информацию по высотам в игре. ( 48-256 )
2) Я вижу кодировку цвета каждой глубины. Реально ли заменить её на другую кодировку?)

Jeff-Groves 11-21-21 01:50 PM

// Above-water
48 - 0x40800000 = 4.0
49 - 0x40a00000 = 5.0
50 - 0x40c00000 = 6.0
51 - 0x41000000 = 8.0
52 - 0x41200000 = 10.0
53 - 0x41400000 = 12.0
54 - 0x41600000 = 14.0
55 - 0x41700000 = 15.0
56 - 0x41800000 = 16.0
57 - 0x41900000 = 18.0
58 - 0x41a00000 = 20.0
59 - 0x41b00000 = 22.0
60 - 0x41c00000 = 24.0
61 - 0x41d00000 = 26.0
62 - 0x41e00000 = 28.0
63 - 0x41f00000 = 30.0
64 - 0x42000000 = 32.0
65 - 0x42080000 = 34.0
66 - 0x42100000 = 36.0
67 - 0x42180000 = 38.0
68 - 0x42200000 = 40.0
69 - 0x42280000 = 42.0
70 - 0x42300000 = 44.0
71 - 0x42380000 = 46.0
72 - 0x42400000 = 48.0
73 - 0x42480000 = 50.0
74 - 0x42500000 = 52.0
75 - 0x42580000 = 54.0
76 - 0x42600000 = 56.0
77 - 0x42680000 = 58.0
78 - 0x42700000 = 60.0
79 - 0x42780000 = 62.0
80 - 0x42800000 = 64.0
81 - 0x42880000 = 68.0
82 - 0x42900000 = 72.0
83 - 0x42980000 = 76.0
84 - 0x42a00000 = 80.0
85 - 0x42a80000 = 84.0
86 - 0x42b00000 = 88.0
87 - 0x42b80000 = 92.0
88 - 0x42c00000 = 96.0
89 - 0x42c80000 = 100.0
90 - 0x42d00000 = 104.0
91 - 0x42d80000 = 108.0
92 - 0x42e00000 = 112.0
93 - 0x42e80000 = 116.0
94 - 0x42f00000 = 120.0
95 - 0x42f80000 = 124.0
96 - 0x43000000 = 128.0
97 - 0x43040000 = 132.0
98 - 0x43080000 = 136.0
99 - 0x430c0000 = 140.0
100 - 0x43100000 = 144.0
101 - 0x43140000 = 148.0
102 - 0x43180000 = 152.0
103 - 0x431c0000 = 156.0
104 - 0x43200000 = 160.0
105 - 0x43240000 = 164.0
106 - 0x43280000 = 168.0
107 - 0x432c0000 = 172.0
108 - 0x43300000 = 176.0
109 - 0x43340000 = 180.0
110 - 0x43380000 = 184.0
111 - 0x433c0000 = 188.0
112 - 0x43400000 = 192.0
113 - 0x43480000 = 200.0
114 - 0x43500000 = 208.0
115 - 0x43580000 = 216.0
116 - 0x43600000 = 224.0
117 - 0x43680000 = 232.0
118 - 0x43700000 = 240.0
119 - 0x43780000 = 248.0
120 - 0x43800000 = 256.0
121 - 0x43840000 = 264.0
122 - 0x43880000 = 272.0
123 - 0x438c0000 = 280.0
124 - 0x43900000 = 288.0
125 - 0x43940000 = 296.0
126 - 0x43980000 = 304.0
127 - 0x439c0000 = 312.0
128 - 0x43a00000 = 320.0
129 - 0x43a40000 = 328.0
130 - 0x43a80000 = 336.0
131 - 0x43ac0000 = 344.0
132 - 0x43b00000 = 352.0
133 - 0x43b40000 = 360.0
134 - 0x43b80000 = 368.0
135 - 0x43bc0000 = 376.0
136 - 0x43c00000 = 384.0
137 - 0x43c40000 = 392.0
138 - 0x43c80000 = 400.0
139 - 0x43cc0000 = 408.0
140 - 0x43d00000 = 416.0
141 - 0x43d40000 = 424.0
142 - 0x43d80000 = 432.0
143 - 0x43dc0000 = 440.0
144 - 0x43e00000 = 448.0
145 - 0x43e80000 = 464.0
146 - 0x43f00000 = 480.0
147 - 0x43f80000 = 496.0
148 - 0x44000000 = 512.0
149 - 0x44040000 = 528.0
150 - 0x44080000 = 544.0
151 - 0x440c0000 = 560.0
152 - 0x44100000 = 576.0
153 - 0x44140000 = 592.0
154 - 0x44180000 = 608.0
155 - 0x441c0000 = 624.0
156 - 0x44200000 = 640.0
157 - 0x44240000 = 656.0
158 - 0x44280000 = 672.0
159 - 0x442c0000 = 688.0
160 - 0x44300000 = 704.0
161 - 0x44340000 = 720.0
162 - 0x44380000 = 736.0
163 - 0x443c0000 = 752.0
164 - 0x44400000 = 768.0
165 - 0x44440000 = 784.0
166 - 0x44480000 = 800.0
167 - 0x444c0000 = 816.0
168 - 0x44500000 = 832.0
169 - 0x44540000 = 848.0
170 - 0x44580000 = 864.0
171 - 0x445c0000 = 880.0
172 - 0x44600000 = 896.0
173 - 0x44640000 = 912.0
174 - 0x44680000 = 928.0
175 - 0x446c0000 = 944.0
176 - 0x44700000 = 960.0
177 - 0x44780000 = 992.0
178 - 0x44800000 = 1024.0
179 - 0x44840000 = 1056.0
180 - 0x44880000 = 1088.0
181 - 0x448c0000 = 1120.0
182 - 0x44900000 = 1152.0
183 - 0x44940000 = 1184.0
184 - 0x44980000 = 1216.0
185 - 0x449c0000 = 1248.0
186 - 0x44a00000 = 1280.0
187 - 0x44a40000 = 1312.0
188 - 0x44a80000 = 1344.0
189 - 0x44ac0000 = 1376.0
190 - 0x44b00000 = 1408.0
191 - 0x44b40000 = 1440.0
192 - 0x44b80000 = 1472.0
193 - 0x44bc0000 = 1504.0
194 - 0x44c00000 = 1536.0
195 - 0x44c40000 = 1568.0
196 - 0x44c80000 = 1600.0
197 - 0x44cc0000 = 1632.0
198 - 0x44d00000 = 1664.0
199 - 0x44d40000 = 1696.0
200 - 0x44d80000 = 1728.0
201 - 0x44dc0000 = 1760.0
202 - 0x44e00000 = 1792.0
203 - 0x44e40000 = 1824.0
204 - 0x44e80000 = 1856.0
205 - 0x44ec0000 = 1888.0
206 - 0x44f00000 = 1920.0
207 - 0x44f40000 = 1952.0
208 - 0x44f80000 = 1984.0
209 - 0x45000000 = 2048.0
210 - 0x45040000 = 2112.0
211 - 0x45080000 = 2176.0
212 - 0x450c0000 = 2240.0
213 - 0x45100000 = 2304.0
214 - 0x45140000 = 2368.0
215 - 0x45180000 = 2432.0
216 - 0x451c0000 = 2496.0
217 - 0x45200000 = 2560.0
218 - 0x45240000 = 2624.0
219 - 0x45280000 = 2688.0
220 - 0x452c0000 = 2752.0
221 - 0x45300000 = 2816.0
222 - 0x45340000 = 2880.0
223 - 0x45380000 = 2944.0
224 - 0x453c0000 = 3008.0
225 - 0x45400000 = 3072.0
226 - 0x45440000 = 3136.0
227 - 0x45480000 = 3200.0
228 - 0x454c0000 = 3264.0
229 - 0x45540000 = 3392.0
230 - 0x45600000 = 3584.0
231 - 0x45680000 = 3712.0
232 - 0x45700000 = 3840.0
233 - 0x45780000 = 3968.0
234 - 0x457c0000 = 4032.0
235 - 0x45820000 = 4160.0
236 - 0x45860000 = 4288.0
237 - 0x458a0000 = 4416.0
238 - 0x458e0000 = 4544.0
239 - 0x4594d000 = 4762.0
240 - 0x45960000 = 4800.0
241 - 0x45a20000 = 5184.0
242 - 0x45a92000 = 5412.0
243 - 0x45b12000 = 5668.0
244 - 0x45b6b000 = 5846.0
245 - 0x45be0000 = 6080.0
246 - 0x45c20000 = 6208.0
247 - 0x45c92000 = 6436.0
248 - 0x45d04000 = 6664.0
249 - 0x45d76000 = 6892.0
250 - 0x45db6000 = 7020.0
251 - 0x45e36000 = 7276.0
252 - 0x45e76000 = 7404.0
253 - 0x45ee8000 = 7632.0
254 - 0x45f68000 = 7888.0
255 - 0x45fa0000 = 8000.0

Используйте редактор местности ref - это лучшее, что я могу предложить.


All times are GMT -5. The time now is 09:37 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.