Beholder Posted January 8, 2008 Share Posted January 8, 2008 I've been searching all over the place and can't seem to find any info on the ifp file format. I would really appreciate it if somebody can point in the right direction. Thanks a bunch! -Beholder Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/ Share on other sites More sharing options...
REspawn Posted January 8, 2008 Share Posted January 8, 2008 yea, Hollower wrote up a txt doc before that I have reposted below, its old so dont know how much of it is true for SA. =================================================================IFP file format for Grand Theft Auto III and Vice City animation Written by Hollower ([email protected])=================================================================(updated Jan 2004)This file is intended for programmers only.First column is the number of bytes. V means that the length varies.Second column is the suggested data type (C/C++).Third column is a brief description of the data.Strings are padded to 4-byte alignment.This is how I broke up the file for reading in. The section markersindicate the more "correct" way, but I used this simpler grouping(ie. why worry about the parent section of "INFO" blocks when theyshould always be in this order anyway), and I used the section markersfor error checking. Using my grouping also makes it easier to outputan IFP file that is valid for GTA3/GTA:VC. This may change in futureGTA games.IFP FILE HEADER----------------4 (char[4]) "ANPK" --- section marker4 (int) Offset to end of file4 (char[4]) "INFO" --- section marker4 (int) Offset to end of header4 (int) Number of animsV (char[V]) Internal file name (null terminated string)ANIMATION INFO----------------4 (char[4]) "NAME" --- section marker4 (int) Length of anim name stringV (char[V]) Anim name (null terminated string)4 (char[4]) "DGAN" --- section marker4 (int) Offset to end of animation4 (char[4]) "INFO" --- section marker4 (int) Offset to first object (usually 8)4 (int) Number of objects4 (int) NULLOBJECT INFO----------------4 (char[4]) "CPAN" --- section marker4 (int) Offset to end of object4 (char[4]) "ANIM" --- section marker4 (int) Offset to frame info (usually 48)28 (char[28]) Object name (null terminated string, padded to 28 bytes)4 (int) Number of frames4 (int) NULL4 (int) Index of last frame (Number of frames - 1)4 (int) Index of next sibling (-1 if none)4 (int) Index of previous sibling (-1 if none)FRAME INFO----------------4 (char[4]) Frame type (see below)4 (int) Length of frame dataFRAME DATA----------------Frame data is all floats. Structure depends on frame type.Frame types:"KRT0" Root quaternion rotation (float x,y,z,w), vector translation (float x,y,z), time (float seconds)"KR00" Child rotation, time"KRTS" Scaled rotation, translation, scale (float x,y,z), timeRoot frames contain extra data for translating the model in theworld. Child frames are simply rotations, concatenated as theygo up the hierarchy.You can probably guess, the letters here stand for (K)eyframe, ®otation, (T)ranslation, (S)cale, (0)Noneso presumably there could also be other combinations like "K0T0" butthe above are the only ones found in all of the files I studied.Notes----------------Overall file structure looks like this:Header | +-Animation | | | +-Object | | | | | +-Frame | | +-Frame | | +-Frame | | +- ... | | | +-Object | | | | | +-Frame | | +-Frame | | +-Frame | | +- ... | | | +- ... | +-Animation | | | +-Object | | |...and so on.Object names are a reference to the DFF mesh or bonewhich will be rotated with the frame data. The stringis not case sensitive.An animation does not need to reference every part of amodel, only the ones that will move. They also do notrequire an equal number of frames or matching time index.There are sometimes anomalies like anims with 0 objectsor objects with 0 frames.For reference, the base pose can be viewed by creatinganimations with Rotation = {0.0f, 0.0f, 0.0f, 1.0f}.I hope this file has been helpful. Now let's see some editors!- Hollower Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057391240 Share on other sites More sharing options...
Beholder Posted January 8, 2008 Author Share Posted January 8, 2008 Wow, should be interesting. Thanks REspawn! Would it be possible to add it to the file formats sticky? It seems to have most everything else but this. Thanks again. -Beholder Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057391288 Share on other sites More sharing options...
REspawn Posted January 8, 2008 Share Posted January 8, 2008 No worries, yea must really get back to finishing that list Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057391529 Share on other sites More sharing options...
steve-m Posted January 9, 2008 Share Posted January 9, 2008 The file format for SA is different though (four character code is "ANP3"), but I don't think that's documented anywhere either. If you desperately need it, I could try to assemble a format doc from some old code I once wrote. But aren't there import/export scripts for 3dsmax that allow editing .ifp files? I guess their authors could help you out as well. Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057394081 Share on other sites More sharing options...
Beholder Posted January 10, 2008 Author Share Posted January 10, 2008 steve-m, I guess it would it depend on how different SA is from VC. At quick glance it looks as though the section markers aren't in SA's ped.ifp, as well as the frame types. Also, there is a reference to studio max in the first animation, abseil. I'm not usually much when it comes to cracking file formats, but I have a pretty decent base to work from and can take a crack at it (no pun intended). If I get stuck I'll try to seek one of those 3ds authors and if that doesn't go anywhere I'll just post back here and cry myself to sleep. For anybody else that plans to use the doc posted here, I would like to mention that as far as VC's ped.ifp file is concerned, in the object infp section, the NULL int following the number of frames should not be read/written if the offset to frame info is 44, as opposed to if the offset is 48. Thanks REspawn and steve-m, you guys rock! -Beholder Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057396365 Share on other sites More sharing options...
AK-73 Posted January 10, 2008 Share Posted January 10, 2008 If you're concerned with animations in Vice, I'd like you to refer you to two mods of mine: First my ifp suite which is open source and which enables exporting directly into the (VC) .ifp from gmax. It does contain a bug though which I can't fix because I can't upload files onto gtagarage. (Anybody knows when this is going to change?) But the exporter is open source, so depending on what you want to do, it might help. Secondly my GTA:MA mod which allows adding new animations as a side-benefit. I have even added new animations from SA into VC with it. Just ask ceedj. Anyway, I don't know the SA file format but I am fairly well-acquainted with the VC .ifps. If you need some help, feel free to pm me. Now if I could only convince steve-m or some of the other veterans to help me make sense of the rest of the ps2 lcs .mdl file format... Wäre richtig gut. Alex Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057397458 Share on other sites More sharing options...
Aschratt Posted January 12, 2008 Share Posted January 12, 2008 (edited) Well... I took a look to the ANP3-Format some moths ago... I haven't realy finished my work on this, cause I thought I can find something out about Cutscenes, and how they work, but then I found out that cutscenes are ANPK-Animations... I posted this stuff to the wiki: http://www.gtamodding.com/index.php?title=Cutscene There are not many differencies between ANPK and ANP3. Section Markers are removed and sections are more sorted and compressed now (Like the compression in the COL3 - collision-files). Yesterday I found time to create an txt like hollower did once: =================================================================IFP file format for Grand Theft Auto San Andreas animation Written by Aschratt ([email protected])=================================================================(updated Jan 2008)This file is based on the decodings of hollower from 2004.For more information search GTA Forums.Binary Structure:==== Header ============4b - CHAR[4] - 'ANP3' (Version Identifier String)4b - INT32 - Offset to end of file (Relative to stream position pointer, so usually you have to add 8 to get the file's content size)24b - CHAR[24] - File's Internal Name4b - INT32 - Number of Animations==== Animation Info ====24b - CHAR[24] - Animation Name (!!! String stops with first null-char ('\0'). Everything after this is ignored... R* Put some debug stuff there sometimes (Like 3dsm directorys))4b - INT32 - Number of Objects4b - INT32 - ?4b - INT32 - ?==== Object Info ========24b - CHAR[24] - Object Name4b - INT32 - ?4b - INT32 - Number of Frames4b - INT32 - ? (Frame DATA TYPE: KRT0 = 0, KR00 = 1, KRTS = 2)==== Frame Info =========2b - INT16 - ? (RX)2b - INT16 - ? (RY)2b - INT16 - ? (RZ)2b - INT16 - ? (RW)2b - INT16 - ? (TX)2b - INT16 - ? (TY)2b - INT16 - ? (TZ)2b - INT16 - ? (TIME)Like nearly all new coordinate formats in SA the Animation Packages are compressed.To get the real-world floating coordinates simply divide the short values with 128!================================Notes: I think that there is a constant value in the object-info section which defines the frame's data type. This means that there are still those data-types like in ANPK.But I am not sure about this and still have to search some examples and try a little bit around. Mostly the frame info data type is like the root structure.These decodings are done by scratch in an hour. I had not much time, but I hope it will help you for further decodings.Greetings... Aschratt!Homepage: http://www.aschratt.comE-Mail: [email protected] I hope this helps! To the cutscene animations: They are ANPK-Packages, but somehow they got an diffrent structure in some phrases... somehow the sibling numbers are mission sometimes or only one of them exists... sometimes the number of frames is too high and the last frame seems to be removed. Maybe in SA ANPK is Version 2 and ANP3 Version 3, so that VC-Animations are not longer compatible to SA Animations. But I have to test this (Maybe it is only an mistake of mine). Greetings... Aschratt! Edited January 12, 2008 by Aschratt Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057401874 Share on other sites More sharing options...
Beholder Posted January 13, 2008 Author Share Posted January 13, 2008 Thanks Aschratt! I haven't looked at the cut scenes stuff but for the SA ped.ifp, you're notes did the job. I think the object structure is a bit backwards though, I believe it should look something like this... ==== Object Info ========24b - CHAR[24] - Object Name4b - INT32 - ? (Frame DATA TYPE: KRT0 = 4, KR00 = 3, KRTS = 2(?))4b - INT32 - Number of Frames4b - INT32 - ? I didn't find any frames that use KRTS. Another thing I'm kinda curious about is that are objects with only 2 frames, and no change in the translation/rotation values. Other than that all is good. I'm moving on to dff files now. Thanks everybody! -Beholder Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057404902 Share on other sites More sharing options...
steve-m Posted January 14, 2008 Share Posted January 14, 2008 To convert the transformation data in Frame Info to floats, divide the signed INT16s by the following values: real part of the quaternion (RX, RY, RZ): -4096 imaginary part of the quaternion (RW): 4096 position vector: 1024 time key: 60 Haven't checked those, just looked them up in my old code. Especially the quaternion seems a bit weird, likely I got that wrong. The third INT32 in Object Info is the Bone ID, it (usually) matches those used in DFF files. Here is some code I used to map animations to dff frames, might be helpful: // Check, which of the animations can be applied to the loaded model// must do in reverse order, because VC models have 2x "root"!Animation[i1].AnimObject[i2].ObjFrame := -1;j := length(DFF.Frame)-1;while (Animation[i1].AnimObject[i2].ObjFrame = -1) and (j >= 0) do begin if (AssignByBoneID and (Animation[i1].AnimObject[i2].BoneID = DFF.Frame[j].BoneID)) or (not AssignByBoneID and (CompareText(Animation[i1].AnimObject[i2].Name, DFF.Frame[j].Name) = 0)) then Animation[i1].AnimObject[i2].ObjFrame := j; dec(j); // j--end; (AssignByBoneID is a Boolean for using BoneIDs rather than frame names for matching, preferably for SA models/anims) Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057406855 Share on other sites More sharing options...
derty Posted January 14, 2008 Share Posted January 14, 2008 Another thing I'm kinda curious about is that are objects with only 2 frames, and no change in the translation/rotation values. Maybe these are like the TVs/VCRs, ETC? 2 frames: the static state and the "lifted"/interacted state? Just a guess, watchin this topic, interesting. Greets Steve. Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057406864 Share on other sites More sharing options...
Aschratt Posted January 14, 2008 Share Posted January 14, 2008 Another thing I'm kinda curious about is that are objects with only 2 frames, and no change in the translation/rotation values. Maybe these are like the TVs/VCRs, ETC? 2 frames: the static state and the "lifted"/interacted state? Just a guess, watchin this topic, interesting. Greets Steve. I don't think so... I think that this is like in cutscene animations... they are only used as "spaceholders". Means: You got one frame at point 0 and one at point X. between those points the animation does nothing. So you can stop an animation for a certain time (e.g.). In cutscenes this is used very often. Imagine: the first Cutscene in SA. It has many animations (The suitcase, CJ, the Stuartess, the Taxi and the taxi Driver.) But how to combine those animations? (There is no info about the time they are loaded). Easy awnser: All Animations started at the same point. but thos who aren't used until they are in view are stopped for this time span. So for example in the first cutscene the Taxi starts to drive after the suitcase falls into the hole. But the taxi-animation is startet when CJ starts to walk. To make this more imaginable (if you haven't understand me ^^), simply import the cutscene into 3ds max (KAMs supports them). Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1057407474 Share on other sites More sharing options...
Gian_Yagami Posted August 19, 2013 Share Posted August 19, 2013 Nice, but is too elusive. Link to comment https://gtaforums.com/topic/306517-qp-ifp-file-format/?do=findComment&comment=1062994308 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now