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).

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,
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:

Tuesday, February 1, 2011

Mudlord's HLSL Shaders for BSNES

I came across a set of HLSL pixel shaders from mudlord that were intended for use with snes9x, so I formatted them for use with bsnes and everything seems to work just fine. You can download the whole pack here.

Here are some screenshots from a couple of them:

1. Emboss
Looks pretty cool but gets old quickly.

2. Blur 2
There are 4 different blur settings. The first one actually looks pretty decent, but the rest are too intense for me.

3. Pixelator
Hmmm. Can't really see shit... Kinda like if your favorite SNES game came out on Atari first.

4. Toon
This one actually looks really cool. It makes everything look like Yoshi's Island :D

There are a number of others in the pack, including all of the blurs, another take on bloom, a toon shader without the black outlines and a couple that cover everything with a wave mask.

This pack gives D3D users a bit more freedom beyond the lone Sepia filter that comes with bsnes, and I hope to add more of these in the future. I'll post them here if/when I come across them.

UPDATE (2/2/11):
I fiddled around with some and came up with a couple more. They're essentially functioning just like mudlord's 'emboss' shader, but they maintain color:

1. color emboss bright
2. color emboss mild (this one requires that 'smooth video' be enabled to work properly; similar results to smooth video+mudlord's 'sharpen' shader)

Analytics Tracking Footer