The Forum is up for sale: XeNTaX Forum looking for new owner

Reflections CHUNK File Format

The Original Forum. Game archives, full of resources. How to open them? Get help here.
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

Image

Well now I know how to reads vertices. Too bad faces aren't as easy...

Image

Since this is the file research topic, I will post a snippet of code that may or may not serve a purpose to anyone who sees it.

Code: Select all

UPVH > MDPC Offset: 543000

-Offset-|-- MDPC PART DEF --|-- HEXADECIMAL ----|-- WORD ---|
0x56F00C| UNK_LIST_OFFSET	| 80 00 00 00 		| 80		|
0x56F014| UNK_LIST2_OFFSET	| 80 28 00 00 		| 2880		|
0x56F028| DDS_TEX_START		| 00 60 08 00 		| 86000		|
0x56F02C| PCMP_OFFSET 		| 00 50 08 00 		| 85000		|
0x56F034| FACES_LENGTH 		| F8 6B 00 00 		| 6BF8 		|
0x56F038| FACES_OFFSET 		| 9C 53 00 00 		| 539C 		|
0x56F040| UNK_HEADER01 		| 80 53 00 00 		| 5380 		|

Vertex List begin: 	57AF94
Vertex list end: 	5F35D7
Vertex list length: 78644	(44 86 07 00)

Faces List begin:	57439C 	(9C 43 57 00)
Faces List end:		57AF93 	(93 AF 57 00)
Faces List length:	6BF8	(F8 6B 00 00)

INTERIOR
Vertices Offset:	57AF94 	(94 AF 57 00)
Vertices End:		58C453 	(53 C4 58 00)
Vertices Length:	114C0	(C0 14 01 00)
Faces Offset:		???
Faces End:			???

BF94


Minimum Start: 57B000
Maximum Start: 5DCAD0

Minimum End: 57C67F
Maximum End: 5E1683

-- INTERIOR ---------------|--MAX.--|
57B000 - 585ED7 (MESH_0640)| 57C67F |
57B564 - 585DE7 (MESH_0646)| 57FCDF |
57BEC4 - 57FCDF (MESH_0634)| 584AEB |
57C2C0 - 57C67F (MESH_0657)| 5852E3 |
57C771 - 585E9B (MESH_0662)| 585DE7 |
57E0FC - 584AEB (MESH_2970)| 585E9B |
581DEC - 5852E3 (MESH_0669)| 585ED7 |
------------------------------------|
Real length: 57B000 - 58C453 (11454)
------------------------------------|
-- LOD MODEL --------------|--------|
58C454 - 59152F (MESH_0678)| 5914F3 |
58C9B8 - 592CDB (MESH_0668)| 59152F |
58D9A8 - 5914F3 (MESH_2972)| 59242F |
58E86C - 592B37 (MESH_0639)| 59273B |
58FA00 - 59273B (MESH_0645)| 592B37 |
58FAB4 - 59336B (MESH_0650)| 592CDB |
591698 - 59242F (MESH_0683)| 59336B |
-- REAR CLIP --------------|--------|
595FF4 - 5A0CAF (MESH_0638)| 59C0BF |
596FA8 - 59F17F (MESH_0666)| 59F17F |
598A60 - 5A1597 (MESH_0675)| 5A0CAF |
5994EC - 59C0BF (MESH_0643)| 5A10AB |
5A0CEC - 5A10AB (MESH_2971)| 5A1597 |
-- TRUNK ------------------|--------|
5A92FC - 5A9DC3 (MESH_0667)| 5A9DC3 |
5A9680 - 5A9EB3 (MESH_0677)| 5A9EB3 |
5A9EF0 - 5AA4CB (MESH_0644)| 5AA4CB |
-- BUMPER -----------------|--------|
5AAB20 - 5ABFFB (MESH_0676)| 5ABFFB |
-- RIGHT DOOR -------------|--------|
5AEE64 - 5B1B9F (MESH_0674)| 5B082B |
5AEF90 - 5B082B (MESH_0665)| 5B0E07 |
5B0868 - 5B0E07 (MESH_0637)| 5B1203 |
5B0E44 - 5B1203 (MESH_0649)| 5B1B9F |
-- LEFT DOOR --------------|--------|
5B4198 - 5B6FFF (MESH_0673)| 5B62DF |
5B42C4 - 5B62DF (MESH_0664)| 5B6717 |
5B613C - 5B6717 (MESH_0636)| 5B6AD7 |
5B6754 - 5B6AD7 (MESH_0648)| 5B6FFF |
-- ENGINE BAY -------------|--------|
5B9670 - 5BF4E3 (MESH_0635)| 5BC54F |
5BC118 - 5BC54F (MESH_0641)| 5BF4E3 |
-- FRONT CLIP -------------|--------|
5C55B0 - 5C758F (MESH_0672)| 5C758F |
5C9354 - 5CB3AB (MESH_0671)| 5CB3AB |
5CCFCC - 5D22C3 (MESH_0670)| 5D22C3 |
-- HOOD -------------------|--------|
5D521C - 5D7A6B (MESH_0663)| 5D7A6B |
5D7A6C - 5D946F (MESH_0642)| 5D946F |
-- STEERING WHEEL ---------|--------|
5DB270 - 5DC1E7 (MESH_0647)| 5DC1E7 |
-- WHEEL MODEL ------------|--------|
5DC788 - 5E1683 (3D WHEEL) | 5DD33F |
5DCAD0 - 5DD33F (WHL TREAD)| 5E1683 |
---------------------------|--------|
Here is the heavily-WIP MaxScript I made to accomplish the pictures seen above. The code is provided as-is and will not be updated unless something significant happens.

Code: Select all

clearlistener()

if (heapSize < 200000) do (
	heapSize = 2000000
)

--vF = GetOpenFileName caption:"Choose VVS File:" \
--types:"DRIV3R Vehicles (*.VVS)|*.VVS|"

vF = "C:\Program Files (x86)\Atari\DRIV3R\Vehicles\miami.vvs"

f = fopen vF "rb"

readFaces = true
readVerts = true

face_array = #()

if readFaces == true do (
	fseek f 5718940 #seek_set
	
	format "Faces begin: 0x%\n" ((bit.intAsHex(ftell f)) as string)
	--format "%\n" "---------------------------------"
	
	for k = 1 to 304 do (
		--format "%\n" ("Indice Idx: "+k as string)
		
		i0 = ReadShort f #unsigned+1
		i1 = ReadShort f #unsigned+1
		i2 = ReadShort f #unsigned+1
		
		append Face_array[i0,i1,i2]
			
		--format "indicies: [%,%,%]\n"\
			--((i0+1) as string)\
			--((i1+1) as string)\
			--((i2+1) as string)
		
		--format "%\n" ("---------------------------------")
		windows.processPostedMessages()
	)
	format "Faces end: 0x%\n" ((bit.intAsHex(ftell f)) as string)
)

if readVerts == true do (
	fseek f 5750468 #seek_set

	vx = 0.0
	vy = 0.0
	vz = 0.0
	nx = 0.0
	ny = 0.0
	nz = 0.0
	tu = 0.0
	tv = 0.0

	
	vert_array = #()
	norm_array = #()
	uv_array = #()

	debugStuff = 0
	format "Vertices Begin: 0x%\n" ((bit.intAsHex(ftell f)) as string)
	
	for i = 1 to 6910 do (
		if debugStuff == 1 do format "Current Position: 0x%\n" ((bit.intAsHex(ftell f)) as string)
		
		vx = ReadFloat f
		vy = ReadFloat f
		vz = ReadFloat f
		
		nx = ReadFloat f
		ny = ReadFloat f
		nz = ReadFloat f
		
		tu = ReadFloat f
		tv = ReadFloat f
		
		junk1 = ReadLong f #unsigned
		junk2 = ReadLong f #unsigned
		junk3 = ReadLong f #unsigned
		junk4 = ReadLong f #unsigned
		junk5 = ReadLong f #unsigned
		junk6 = ReadLong f #unsigned
		junk7 = ReadLong f #unsigned
		
		--The format is vx, vy, vz, nx, ny, nz, tu, tv, junk1, junk2, junk3, junk4, junk5, junk6, junk7...
		
		append vert_array[vx*100,-vz*100,vy*100]
		append norm_array[nx,ny,nz]
		append uv_array[tu,tv,0]
		
		if debugStuff == 1 do (
			format "\nvx: %\nvy:\t%\nvz:\t%\nnx:\t%\nny:\t%\nnz:\t%\ntu:\t%\ntv:\t%"\
				(vx as string)\
				(vy as string)\
				(vz as string)\
				(nx as string)\
				(ny as string)\
				(nz as string)\
				(tu as string)\
				(tu as string)
			format "\n----------------------------------------------------------------------\n"
		)

	windows.processPostedMessages()
	)
	format "Vertices End: 0x%\n" ((bit.intAsHex(ftell f)) as string)

	msh = mesh vertices:vert_array faces:face_array
		setNumTVerts msh uv_array.count
			
		for i = 1 to uv_array.count do (setTVert msh i uv_array[i]) 
		buildTVFaces msh false
		for i = 1 to face_array.count do (setTVFace msh i face_array[i])
			
		select msh
)

fclose f
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

I'm back, and this time, I've got significant progress:

Image

Expect to see a fully imported vehicle in 3DS Max sometime in April, if not May (but why would it take another month? :P)
Antares666
ultra-n00b
Posts: 4
Joined: Fri Apr 02, 2010 5:10 pm

Re: Reflections CHUNK File Format

Post by Antares666 »

Awesome.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1822
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1056 times

Re: Reflections CHUNK File Format

Post by Ekey »

"Mr. RoadBuilder" released? Google don't know this tool :)
Antares666
ultra-n00b
Posts: 4
Joined: Fri Apr 02, 2010 5:10 pm

Re: Reflections CHUNK File Format

Post by Antares666 »

It's an internal tool from Reflections Interactive.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1822
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1056 times

Re: Reflections CHUNK File Format

Post by Ekey »

Oh lol okay
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

It's a shame Mr. RoadBuilder is an internal tool...it looks so advanced for 2002/2003...they probably could've made a lot of money selling that tool!
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

And on the second day...

Image
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 136 times

Re: Reflections CHUNK File Format

Post by WRS »

Any progress here? Did you find the texture normals?
Useful tool links:
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

Yeah, there's progress alright. ;)

Working on the final version of MDPCEdit, needs a lot of cleaning up and proper PCMP/DDS loading. As for normals, 3DS Max won't handle them properly, so that's out of the question. Exporting meshes shouldn't affect normals too bad...

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

Image
What the hell is that? :twisted:
User avatar
Chipicao
ultra-veteran
ultra-veteran
Posts: 476
Joined: Thu Feb 03, 2011 11:18 am
Has thanked: 42 times
Been thanked: 305 times
Contact:

Re: Reflections CHUNK File Format

Post by Chipicao »

I have just finished the maxscript I've been working on with vagos21 for DriverSF. Well actually it's been ready for a very long time, but we had some trouble decoding normals from the game files.
If anyone's interested it can be downloaded here (click).

It supports only vehicles for now and will load all UV coordinates, vertex normals and materials. It also extracts and assigns textures.
Image Image
Please post any requests or issues with my tools in the appropriate topics.
I'm sorry if I don't reply or if I ignore PMs. My time is very limited.
Antares666
ultra-n00b
Posts: 4
Joined: Fri Apr 02, 2010 5:10 pm

Re: Reflections CHUNK File Format

Post by Antares666 »

Downloaded, tested, awesome.
User avatar
CarLuver69
advanced
Posts: 50
Joined: Thu Mar 08, 2012 6:17 pm
Location: California, USA
Has thanked: 7 times
Been thanked: 20 times
Contact:

Re: Reflections CHUNK File Format

Post by CarLuver69 »

Lots of progress has been made since my last post here. There's so much progress, in fact, that all of it cannot be listed. So instead, I leave these pictures here:

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

There's also some significant progress on mission scripts as well:

Image
Image

Other news:

- Chunk loading routines completed
- Chunk exporter complete
- Ability to read/write data to chunks (including nested chunks and regular block data)
- Antilli can export models to .obj format

Just thought I'd update this since I got my start here. :D
Post Reply