Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: TyDoMaster on 2010-09-21 17:20:22

Title: Kingdom Hearts 358/2 days - model hacking.
Post by: TyDoMaster on 2010-09-21 17:20:22
Hey everybody, I'm looking do do a mod on kingdom hearts.

My first attempt will be simple: change Sora's look to his KHII look.

The only thing I don't get (and I have searched everywhere) is how to open those .P2 files and the KAPH files inside them.
Can anyone give me some help?

Thanks
Title: Re: Kingdom Hearts 358/2 days - model hacking.
Post by: BlitzNCS on 2010-09-21 18:23:35
I don't think we're supposed to support model formats here or something for whatever reason, I'm not sure really why.
Anyways, all I know is that the model files are in the DS standard model format (NDS?) but have custom bone opcodes. I'm sure if you research enough you'll find some images out there and maybe some other information.

Hope that's enough to make a start!
Title: Re: Kingdom Hearts 358/2 days - model hacking.
Post by: Tenko Kuugen on 2010-09-22 03:46:51
http://forums.qhimm.com/index.php?topic=8759.0

I might be wrong, but the linked thread applies to this, yes?
Title: Re: Kingdom Hearts 358/2 days - model hacking.
Post by: Chev on 2010-09-25 18:05:51
The only thing I don't get (and I have searched everywhere) is how to open those .P2 files and the KAPH files inside them.
Can anyone give me some help?

It's been a while, but what I remember:

KAPH's a simple archive format, ie several files glued together with a header. Dunno the whole of the header's contents, but then again, you don't need the whole of the header's contents, just the subfiles' offsets. so right after the "KAPH" in the file, jump 40 bytes, then read 4 bytes for a UINT32 offset to the beginning of the first file, then skip 8 bytes and read the second offset, and so on. If the offest you just read equals 0 you're at the end of the offset list. Offest are relative to the beginning of the archive file, ie the beginning of "KAPH". The files are identified by the first four bytes, the model's BMD0. From then on it looks like a normal DS model file, though there are oddities in the skeleton.

P2 files are irrelevant, the character models are in the /mi/ch folder, the .z files. Those are compressed KAPH files, you'll need DSDecmp or something similar to decompress the .z files into .kaph files.

Modding a model would be real tricky though, unless someone's written a program that can output DS models already, because of the way DS model geometry is stored as GPU opcodes rather than lists of vertices/faces.