Page 3 of 7

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 4:58 am
by Sectus
Surveyor wrote:Bonjour!!
Now here's a list of all the extensions used by the game, these are the known ones

Code: Select all

#define ARCEXT_SHADER		0x50F9DB3E		// bfx
#define ARCEXT_TEXTURE			0x241F5DEB		// tex
#define ARCEXT_MOTION			0x76820D81		// lmt
#define ARCEXT_MODEL			0x58A15856		// mod
#define ARCEXT_VIBRATION			0x358012E8		// vib
#define ARCEXT_MESSAGE			0x10C460E6		// msg
#define ARCEXT_LSP			0x60DD1B16		// lsp
#define ARCEXT_SDL			0x4C0DB839		// sdl
#define ARCEXT_STP			0x671F21DA		// stp
#define ARCEXT_IDM			0x2447D742		// idm
#define ARCEXT_MTG			0x4E2FEF36		// mtg
#define ARCEXT_LCM			0x39C52040		// lcm
#define ARCEXT_JEX			0x2282360D		// jex
#define ARCEXT_CHN			0x3E363245		// chn
#define ARCEXT_AHC			0x5802B3FF		// ahc
#define ARCEXT_HIT			0x0253f147		// hit
#define ARCEXT_RTEXTURE			0x7808EA10		// rtex, not used, all textures empty
#define ARCEXT_CUBEMAP			0x4D894D5D		// for all the stages, header: XFS, loads without

// effects
#define ARCEXT_EFFECT_EAN		0x4E397417		// ean
#define ARCEXT_EFFECT_EFL		0x6D5AE854		// efl
#define ARCEXT_EFFECT_EFS		0x02833703		// efs
#define ARCEXT_EFFECT_RTT		0x276DE8B7		// rtt
#define ARCEXT_EFFECT_AEF		0x557ECC08		// for all the stages, header: XFS, loads without
#define ARCEXT_EFFECT_ADH		0x1EFB1B67		// adh
#define ARCEXT_EFFECT_CEF		0x758B2EB7		// cef

// sounds
#define ARCEXT_SOUND_SPC		0x7E33A16C		// spc
#define ARCEXT_SOUND_SRD		0x2D12E086		// srd
#define ARCEXT_SOUND_SRQ		0x1BCC4966		// srq
#define ARCEXT_SOUND_STQ		0x167DBBFF		// stq
#define ARCEXT_SOUND_REVWIN		0x232E228C		// rev_win
#define ARCEXT_SOUND_EQU		0x2B40AE8F		// equ
#define ARCEXT_SOUND_SCS		0x0ECD7DF4		// scs
#define ARCEXT_SOUND_SDS		0x0315E81F		// sds
#define ARCEXT_SOUND_MSE		0x4CA26828		// mse
#define ARCEXT_SOUND_ASE		0x07437CCE		// ase
#define ARCEXT_SOUND_SNGW		0x7D1530C2		// sngw, ogg
The fellowing are untested files but extensions are given according to their header
Missing extensions are: at3, xma, bgm, pth, ptl, lom, los, way, nav,

Code: Select all

#define ARCEXT_UNK08		0x30ED4060		// XFS
#define ARCEXT_UNK09		0x430B4FF4		// XFS
#define ARCEXT_UNK12		0x5898749C		// XFS
#define ARCEXT_UNK14		0x38F66FC3		// XFS
#define ARCEXT_UNK15		0x039D71F2		// XFS
#define ARCEXT_UNK17		0x176C3F95		// XFS
#define ARCEXT_UNK18		0x2C4666D1		// XFS
#define ARCEXT_UNK19		0x266E8A91		// XFS
#define ARCEXT_UNK20		0x15302EF4		// XFS
#define ARCEXT_UNK21		0x19A59A91		// XFS
#define ARCEXT_UNK24		0x1ED12F1B		// XFS
#define ARCEXT_UNK26		0x65B275E5		// XFS
#define ARCEXT_UNK29		0x754B82B4		// XFS
#define ARCEXT_UNK30		0x017A550D		// XFS
#define ARCEXT_UNK34		0x1BA81D3C		// XFS
#define ARCEXT_UNK35		0x4F16B7AB		// XFS
#define ARCEXT_UNK36		0x585831AA		// XFS

// I'm not too sure about these either
#define ARCEXT_CCL		0x0026E7FF		// CCL
#define ARCEXT_HAVOK		0x36E29465		// havok HVK
#define ARCEXT_FSM		0x66B45610		// FSM
#define ARCEXT_SBC		0x51FC779F		// SBC
#define ARCEXT_NAV		0x4EF19843		// NAV
#define ARCEXT_WAY		0x5F36B659		// WAY
#define ARCEXT_OBJ		0x0DADAB62		// OBJ
#define ARCEXT_SHP		0x5204D557		// SHP
#define ARCEXT_SHW		0x60524FBB		// SHW
#define ARCEXT_CDG		0x2DC54131		// CDF, present only for pl02 model

#define ARCEXT_SOUND_SND12	0x46810940		// XFS
#define ARCEXT_SOUND_SND13	0x538120DE		// XFS
Anyways, below is the patcher that will work only for the extensions that didn't crash the game. There is also the UnPatcher: this will revert to original ARC status when you mess things up with the Patcher (happens sometimes)

As usual, just put the program in the naticePc directory and it will recursively scan the subfolders.

And since I don't think I'll continue the work on the patcher as I don't have any computer that can run the game properly, I'll post the source code here so people can make their own patchers.
One small correction to that list. I was messing around with the files in the character arcs with your arc extraction tool, and I learned that .obj should be .oba and .unk34 should be .nck

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 6:33 am
by Cryptonia
hm any method to covert the dds back to tex?

bth is it posible to delet the arc files for save the hdd on my portable pc?

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 2:43 pm
by echelon
I'm working on DDS to TEX and it works for a lot of textures. But there are still some that don't work. Also it's not a direct conversion. I basically just hash filenames to headers. That's not really a good way to do it. But I just don't understand most of the TEX header. If anyone knows more about the header other than width height and midmap count then please tell me :)

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 8:30 pm
by ResiHax
echelon wrote:I'm working on DDS to TEX and it works for a lot of textures. But there are still some that don't work. Also it's not a direct conversion. I basically just hash filenames to headers. That's not really a good way to do it. But I just don't understand most of the TEX header. If anyone knows more about the header other than width height and midmap count then please tell me :)
Mip Map goes to 1x1 and Copy/pasting the header and changing the extension supposedly works.

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 9:04 pm
by echelon
The length of the tex header isn't fixed. So I wouldn't know what to paste.
Hashing the original headers to filenames, width and height works quite well now. Just needs some more tweaking I think.
Still it would be much nicer if we'd know the structure of the tex header. Especially that variable length thing confuses me, since I can't find any bytes that would indicate the ending of the header.

Re: [PC] Resident Evil 5

Posted: Thu Oct 01, 2009 9:05 pm
by ResiHax
I see. Well, the header for each type of texture should be the same. DxT1, Dxt5 etc.

I DO really wish someone could enlighten me (us) on Converting models BACK to .mod.

Re: [PC] Resident Evil 5

Posted: Fri Oct 02, 2009 12:00 am
by echelon
ResiHax wrote:I see. Well, the header for each type of texture should be the same. DxT1, Dxt5 etc.
It is not. That's part of the problem.
Updated Version of ArcTool available at http://z6.invisionfree.com/Resident_Evi ... opic=10046.
Featuring DDS to Tex converter. However textures of stage files are not supported, yet.
Direct download here

ps: I think Surveyor is working on obj to mod. Don`t know the progress status, though.

Re: [PC] Resident Evil 5

Posted: Fri Oct 02, 2009 8:47 am
by Evin
The size of DDS header is always 128byte. The TEX header is 44, I think. So cut out the DDS header, paste the first 44bytes of TEX, rename to TEX and done.
This works for DMC4.

Just try out.

Re: [PC] Resident Evil 5

Posted: Fri Oct 02, 2009 3:36 pm
by shadowmoy
ok some news from my reaschearch on MOD mesh format :

first the objects groups C:

must be in reality :

the game rendering is performed by using :

HRESULT DrawIndexedPrimitiveUP(
D3DPRIMITIVETYPE PrimitiveType, ==>D3DPT_TRIANGLESTRIP ==5
UINT MinVertexIndex, could be 0 or maybe it use cobject::usFlag[6]
UINT NumVertices, cobject::usFlag[4]
UINT PrimitiveCount, cobject::uiCount
CONST void * pIndexData, ==>pointer to index array data
D3DFORMAT IndexDataFormat, == >D3DFMT_INDEX16
CONST void* pVertexStreamZeroData, ==>pointer to vertex array data
UINT VertexStreamZeroStride ==>sizeof(vertex) or 0 (zero)
);
index array set by IDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9 * pIndexData)
)
or maybe better choice :


IDirect3DDevice9::SetFVF(...)
IDirect3DDevice9::SetIndices(...)
IDirect3DDevice9::SetStreamSource(...)
IDirect3DDevice9::DrawPrimitiveUP(...)
so their are parts of the params stored in the model for rendering quickly different streams and fvf formats


i think it also use this method :
http://msdn.microsoft.com/en-us/library ... px#seealso


struct cObject //lot of infos are based on IDirect3DDevice9::DrawIndexedPrimitiveUP
{
unsigned short usId; // id from the indes table
unsigned short usMatId; // material Id
unsigned short usFlag[8]; // 0xFF01, 0, the 3rd flag determines what vertex declaration to use
unsigned int uiBase1; // base multiple of 32
unsigned int uiZero;
unsigned int uiStart; // start index
unsigned int uiCount; // faces (indices - 2) ->DrawIndexedPrimitiveUP ::PrimitiveCount
unsigned int uiBase;
unsigned short uiInconnu[6];
};


usFlag[1] : ???
usFlag[2] : ???
usFlag[3] : determines what vertex declaration to use
usFlag[4] : vertexcount => == (usFlag[6]-usFlag[5]+1) ->DrawIndexedPrimitiveUP :: NumVertices
usFlag[5] : last vertex offset in vertex array to draw ->
usFlag[6] : first vertex offset in vertex array to draw ->DrawIndexedPrimitiveUP
usFlag[7] : ???
usFlag[8] : ???

so :
uiInconnu[1] == ????
uiInconnu[2] == first vertexid used by the group in the vertex array (not in vertex index array)
uiInconnu[1] == ????
uiInconnu[1] == ????
uiInconnu[5] == offset to the next cObject to draw based on the adress of cObject data in file :
something like m_uiObjectOffset-uiInconnu[5] give an adress to another cobject (it is related to witch lodmesh you draw i think)
uiInconnu[6] == ????


so groups must also contain a flag to choose the lod to draw or an incremant to the cobject offset using uiInconnu[5] to select
the mesh lod level to draw if it is near or far from the screen

primitive type is D3DPT_TRIANGLESTRIP ==5 and use a stripped indexed multires mesh
-> based on IDirect3DDevice9::DrawPrimitiveUP params or else to draw the mesh the only way to select a multires mesh is to offset the groups data then
each group say what group to draw next and the last group drawn must have a specific flag to say "end"

so i don't now yet if this assumption is correct but i want to be able to export only lodmesh0 to any 3dfileformat that support bones,
actually i fixed some issues in my opengl rendering, also if using this offset method their will no more be need to set the backfacing on export...

Re: [PC] Resident Evil 5

Posted: Sat Oct 03, 2009 6:47 am
by echelon
Wow, impressive research shadowmoy. I guess this is good news on cracking down on the .mod format.

I also massivley updated the arctool. Conversion not based on hashing anymore and much more stable.
Supports ARC extraction, ARC repack (with auto conversion), DDS to TEX, TEX to DDS
http://rapidshare.com/files/288017237/ArcTool095.zip
Mirror
Instructions

Re: [PC] Resident Evil 5

Posted: Sat Oct 03, 2009 1:16 pm
by zeeh
I have noticed that not all TEX files are DDS. File font00_j.TEX is a 32-bit BMP (alpha channel).

Re: [PC] Resident Evil 5

Posted: Sun Oct 04, 2009 2:52 pm
by Surveyor
Any possible way of making an OBJtoMOD converter?
Surveyor, would you be willing to work on a OBJ to MOD converter for DMC4 & RE5, or release the source code for your MOD2OBJ, it should be easy enough, just kinda reverse the process... I think...
I don't think so, a lot of the MOD data is still ignored when converting to OBJ, maybe once we have a complete understanding of the MOD format.
Hey Surveyor could you give me some insight on the structure of the TEX header?
Sure, here's what I use for my tex converter:
struct cTexHeader
{
unsigned int uiTag; // TEX
unsigned short usVersion; // 0x70
unsigned short usType; // 0x02, 0x22, 0x32, ...
unsigned int uiMipmaps; // 0x000001XX, XX is mipmap count
unsigned short usWidth;
unsigned short usHeight;
unsigned int uiZero; // rarely somthing else
unsigned int uiFormat; // DXT1, DXT5, ARGB8, P8 (not supported here)
float fScale[4]; // some floating points
};
offsetting is quite easy
I wasn't speaking about this, the bone offseting is the way bones influence vertices, it seems that MOD files have some table that indexes another table that indexes a 3rd table and we didn't figure out the relationship yet.
One small correction to that list. I was messing around with the files in the character arcs with your arc extraction tool, and I learned that .obj should be .oba and .unk34 should be .nck
well thanks for the update Sectus, as promissed here is the source code for the patcher since I'm no longer able to run the game (with or without the patch).
bth is it posible to delet the arc files for save the hdd on my portable pc?
No, the game crashes.
ps: I think Surveyor is working on obj to mod. Don`t know the progress status, though.
Who said that ??? I'm not working on anything, I'm on VACATION!!!!
ok some news from my reaschearch on MOD mesh format
very nice shadowmoy, it's good to see some progress coming from somebody other than me :) keep it up!!

Re: [PC] Resident Evil 5

Posted: Sun Oct 04, 2009 7:19 pm
by echelon
Sure, here's what I use for my tex converter:
struct cTexHeader
{
unsigned int uiTag; // TEX
unsigned short usVersion; // 0x70
unsigned short usType; // 0x02, 0x22, 0x32, ...
unsigned int uiMipmaps; // 0x000001XX, XX is mipmap count
unsigned short usWidth;
unsigned short usHeight;
unsigned int uiZero; // rarely somthing else
unsigned int uiFormat; // DXT1, DXT5, ARGB8, P8 (not supported here)
float fScale[4]; // some floating points
};
I figured out most of this myself by now, but thanks anyway!
Who said that ??? I'm not working on anything, I'm on VACATION!!!!
haha..., I was just guessing that would be the logical next step :)
But hey have fun on your Vacation!
since I'm no longer able to run the game (with or without the patch).
That's too bad, I hope you'll continue working on it anyway. No more research from your side would be a great loss for this game.

Re: [PC] Resident Evil 5

Posted: Sun Oct 04, 2009 7:22 pm
by shadowmoy
Surveyor>do you found any way to load some infos from SDL files , i figured out that some models are based on muliple *.mod files, their bbox are not good to rebuild the mesh width,height and depth to rebuild the vertex arrays to fit the bones , so , i figured hex editing files that each mesh can have a fig_model.SDl file associated that gives the mesh hierarchy : mesh1.mdl, mesh2.mdl,mesh3.mdl etc... starting form that it also contain some others infos related to global mesh scaling, positioning, parent hierarchy etc...

also , loading a multiple mesh based mesh , include one more processing :
each mesh contain hierarchical bones, that is to say a body can have multiple head, merging the bones onto one global skeleton, so it involve also that each mdl contain each sub-skeleton animation frames, this way you can animate each sub model using it's hown skeletal animation (facial animation, body animation etc...

MT framework 2.0 is a fucking engine based on simplifying skeleton to sub parts to be able to change body parts form the skeletal based object this way it reduce the time dev and cost by reusing base ressources and also avoid to rerig a complete mesh every time you want to change the model...

this is one part of the magic of capcom MT framework hehe


another problem if you want to use your own models : you need to found out the stripification algorythm they use for stripping vertex indices, witch is far far far away to be easy ..., because it is multires mesh in the same stripped indices array.

i am working on the relation ship between multipart models, to be able to rescale then correctly according to their sub-skeleton

Re: [PC] Resident Evil 5

Posted: Sun Oct 04, 2009 7:53 pm
by shadowmoy
re: found out the bbox problem ,so i will try to build a MOD2SMD exporter to verify bones assignements, i think each vertex.bone[0] is the assignated bone and the others are used for vertex weight like ms3d format, so if it work as expected, i will try to wrote a MOD2MS3D exporter, but first of all i need to found out where the lodmesh id adress is stored or how it is calculated to avoid exporting the lodmesh, to only export the lod0 mesh.