Saturday, February 5, 2011

Beginner's Guide to Face-fixing

Many of the steps in this tutorial are no longer necessary in SSF4AE. You can just copy over the donor's *.fce.ema file and overwrite the recipient's.

UPDATE (11/26/11): you can now use sloth86's MonkeyFix tool in conjunction with the replaced *.fce.ema to get fixed faces all the time, even through the cinematics.

If you've experimented with moveswapping across characters, you've certainly seen the horrible deformation that occurs to their faces, commonly known as "monkeyface."
This tutorial is going to show you how to swap movesets (we're actually swapping models, but it comes out to the same thing) without the monkeyface problem (except in cinematics, such as intro/outro and during ultras).

Background
Animations and movesets in Street Fighter 4 are stored in the ***.cmn.emz file. Specifically, facial animations are stored in the ***.fce.ema file, which is itself a component of the cmn.emz file. To transplant these face animations from one character alongside the moveset of another character, we're going to have to collect a few tools: piecemontee's Asset Explorer, Kensou's Tool and your favorite hex editor (I use the free and open source Frhed).

Getting Started
First, identify which characters we're going to mess with and backup their chara directories. I'll be using Chun Li's model (I'll refer to her as the 'donor') on Sagat's moveset (I'll refer to him as the 'receiver'), so I made copies of those files.
Next, run the donor's cos and col files through the Asset Explorer, along with both characters' cmn.emz files (in my case, CNL.cmn.emz and SGT.cmn.emz). This will decompress them and get them ready for modding.

Now, open the donor's cos and col files in a hex editor, scroll all the way down to the bottoms of the files and change the 3-letter character name references to match the receivers'. In my case, I changed the CNL instances to SGT (there will be 4 instances to change in the cos file and 2 in the col file). Then, rename the files to match (e.g., CNL_01.cos.emz to SGT_01.cos.emz and CNL_01_01.col.emz to SGT_01_01.col.emz).

At this point, you should copy those new donor model files over to the receiver's chara folder (in my case, the SGT directory) and make sure the game loads without crashing. If it loads ok, you should see some monkeyface. Good job, we're halfway there.

Extracting the CMN components
Now, open the receiver's cmn.emz file in the Asset Explorer. Click the 'plus' signs to expand the base file and the overall #EMB file, like this:
Then, left-click on the first section (#EMO (SGT.skl.emo)) to select it and then right-click on it and choose 'Raw dump...' Repeat this process for each section in the cmn.emz file except for the *.cam.ema file, which will crash the Asset Explorer if you select it. Unfortunately, we need that section, so we'll have to get it the hard way--via hex editor.

Isolating the cam.ema Component

Open the receiver's cmn.emz file in a hex editor and make your way down to the third section labeled '#EMA' (I find it easiest to search sequentially through the document for #EMA 3 times). It will be the last one in the file.
Now, write down where it starts, in my case x760e40.
Next, we need to find the end of that section, which is most easily accomplished by searching again, but this time for '#BAC.'
Now, select everything between that last #EMA (at the location we wrote down) and the beginning of #BAC
Copy it and paste it into a new file and save it with the appropriate name (in my case, SGT.cam.ema):
Ok, now that we have all of our receiver's cmn components extracted and isolated, we're ready to get our donor's face animation ready for transplantation.

Open the donor's cmn.emz file in the Asset Explorer and expand it just like we did with the receiver's cmn file earlier on. Left-click on the section labeled #EMA (***.fce.ema) and then right-click and select 'Raw dump...' just like before.

Now, we want to rename that file--in my case, CNL.fce.ema--to match the receiver's other files (you'll have to overwrite the receiver's original fce.ema file in the process, but we don't need it anyway, so no big deal). Alright, we're almost there. Time to rebuild the receiver's cmn file with the new face data using Kensou's Tool.

Repacking A New File
Open up the directory for Kensou's Tool, then navigate to 'sf4' and then the 'emz' directory (you might have to create this directory if it doesn't already exist). Take your receiver's 6 original cmn component files that we raw-dumped, along with the renamed fac.ema file from our donor, and place them all in the aforementioned 'emz' directory:
Go back into the sf4 directory and launch sf4tool.exe:
In the big pane to the right with all of the directory structure, double-click on the folder labeled 'emz,' then click on the left-hand button below that pane. It should then populate the smaller, lower-left pane with a bunch of paths referencing our cmn component files:
These files need to be in exactly the same order as the ones in the original cmn.emz file (skl.emo, skl.emm, obj.ema, fce.ema, cam.ema, bac and bcm) but they won't be by default, so we'll need to click into that pane and do a little manual reordering. Everything should be in order except for the last two, so just copy/paste their paths into the right spots.
Once that's done, click the right-hand button to combine everything. It should pop up this window:
and you should have a shiny new file named 'newpack.emz' alongside your original cmn component files in the 'emz' directory. Now we're really in the home stretch.

Testing it Out
Rename your newpack.emz file to match the receiver's cmn file--in my case, SGT.cmn.emz.

Copy that file into your receiver's chara directory and overwrite the old one (you made sure to make a backup, right? Right??) and go test it out.

If you did everything correctly, you should have a perfectly normal face:
Congratulations!

26 comments:

  1. i still have problems. i follow the guide but i still get a monkey face when trying to use ryu as akuma and gouken.

    ReplyDelete
  2. To use Ryu's model with Akuma's moves, you would need to take RYU.fce.ema and inject it into Akuma's cmn file using the procedure in the post. Is that what you did?

    ReplyDelete
  3. yes that is correct unless im doing something wrong.

    ReplyDelete
  4. Thanks, I try this out. But it seems complicated. Prehpas you could write a simple program that do this faster?

    ReplyDelete
  5. If I could program worth a damn, I'd be happy to :)

    Really, it's a lot of steps, but the process itself isn't particularly difficult. Let me know if you run into problems and I'll try to help.

    ReplyDelete
  6. First, is it possible to have the alt skin for an otehr character?
    I guess I first need to make so the alt replace the original, but how?

    ReplyDelete
  7. yeah, you can totally do that. Just like in the instructions from the post where I changed CNL to SGT, you can change the numbers from ***_02 to ***_01. You'll need to do it for the cos file and the corresponding col files.

    ReplyDelete
  8. Without any HEX editing? I did without HEX edit, and the game crashed.

    ReplyDelete
  9. No, you have to change the numbers at the end of the file in hex, as per the instructions in the post. Sorry for the confusion.

    ReplyDelete
  10. man i wish i could get this to work with ryu and akuma i would love to make a evil ryu.

    ReplyDelete
  11. Alright guys, I don't normally do this sort of thing ('teach a man to fish' and all that), but here's Akuma's cmn with Ryu's fixed face:
    http://www.mediafire.com/download.php?wooujwbd7d99f8w
    or, Ryu with Akuma's moves (causes some vfx stupidity):
    http://www.mediafire.com/download.php?qfyr7oh39yt2bgq

    Be sure to post your results on the SRK thread :D

    ReplyDelete
  12. In the end of both CNL_02.cos.emz and CNL_02_01.col.emz, there is no number to change. Let me get this right, you are talking about these files:
    CNL_02.cos.emz
    CNL_02_XX.col.emz
    ??
    Becuse in these, there are nothing.
    Please help.

    ReplyDelete
  13. Yep. If you're not seeing any numbers at the end (and the rest of the file is gibberish with NO human-readable text) then you probably haven't decompressed them yet, so open them once in the Asset Explorer and you should be all set.

    ReplyDelete
  14. "Now, select everything between that last #EMA (at the location we wrote down) and the beginning of #BAC"
    I am confused, does that mean INCLUDING copy #BAC, or do I stop when I am in front of the "#" character?

    ReplyDelete
  15. never mind my post above(it was including). I got it to working.
    it still get monkey face when ultra is preformed. Which makes this not so useful :(

    ReplyDelete
  16. First and foremost Hunter K thank you for the guide. Gameplay is monkeyface free. However, during "Cinematics" (character intro and win pose) I still get monkeyface. is there anyway to fix this?

    ReplyDelete
  17. Hey StickyJ,
    Yeah, that's normal. This only fixes the face during normal play and not during the cinematics (I just updated the guide to reflect that fact, as this question has come up before). It's possible to fix it the rest of the way, but you have to trial-and-error your way through it, which sucks: open the fce.ema in your hex editor and delete (replace with 00s) anything referring to parts that are messed up. For example, say your character's bottom lip is floating around somewhere crazy, you just go in and zero out all of the references to, for example, Face_LMouthBottom1. Rinse/repeat for each funky feature. However, I suspect that this will create some problems with facial features other times (such as during regular parts of the fight) being "stuck" in the default positions, even when they shouldn't be, since you're essentially breaking the link between any movements and that facial feature.

    ReplyDelete
  18. Hmmm. Well I was using the method you pointed out prior to employing this new mod. I pretty much had to delete all of a character's face properties to prevent distortion. My last question to you is do you think it's possible to dig farther into the cmz files and find the values for the specific cinematic scenes? If you think so, I certainly wouldn't mind digging myself. If worse comes to worse I'm pleased to cut my losses here. Thanks again.

    ReplyDelete
  19. Hunter, YOU ARE MY HERO!

    Seriously - thank you - for sharing ALL this stuff !

    greetings from Austria :)

    ReplyDelete
  20. Thanks fipsfoxy! Glad I could help.

    ReplyDelete
  21. It cant find #BAC , is this because im using Super street fighter 4 ?

    ReplyDelete
  22. @Tiger Bengalski
    Yep, that's right. They're stored elsewhere now. Really, all you need to do in SSF4AE is copy/rename a character's model, textures and face animations and overwrite the ones in the character folder whose moveset you want to use.

    ReplyDelete
  23. Hey Hunk...
    I get a file with compressed extension every time I drag a cmn.emz file into the extractor window. I'm using the piecemonteeSF4explorerV0.37b. Is this the right version ? How can I decompress .emz files.

    ReplyDelete
  24. Hey Hunk...
    I just figured it out but I did it my way and never got any monkey face during the game.

    I dunno what u meant by decompressing and all. got me confused for hours. I did it my way and it's working like a charm.

    All I did was replace the .bac (change the name inside to doner's with hex editor) _ .bcm_ .cam.ema _and obj.ema of receiver with doner's and pack em all with Kensous (don't forget reordering like you exlained)and there u go. As simple as that. As delicious as that...

    ReplyDelete
  25. by the way you don't even need to go all the hard way to extract the .cam.ema using hex editor ... I mean it's not a must. this file belongs to the the correct camera change for your special moves. If you don't have it you can't have the correct camera for ur special moves (and it might flicker) but u won't get any error...

    ReplyDelete
  26. Hi Saman,
    Just opening the files in the Asset Explorer decompresses them. The *.compressed file is a backup that it creates automatically.

    I'm glad you got it all going :)

    ReplyDelete