ROM Hack Fire Emblem Fates: ROM Hacking General Thread

Omegablu

We shall not yield to the Kingdom of Nohr!
Member
Joined
Mar 10, 2016
Messages
1,140
Trophies
0
Location
Ice Tribe Village
XP
1,015
Country
United States
I did a bit of poking around inside the files, and it looks like everything is either a CTPK or CGFX file for the most part. I'm going to do some looking around, as I feel like there are a couple of things out there already for working with those file types. No idea if we can convert any of them to formats used by Fates though.


Well that's a start at least. What directory are the outfits located in? I wouldn't mind going through them and seeing what I can do.
Actually, the models are .m and the textures are .t. I have no idea how one would deal with those files.
 

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
Actually, the models are .m and the textures are .t. I have no idea how one would deal with those files.
Those are the extensions used, but the actual file format is CGFX. If you open up the decompressed files in a hex editor, you'll see CGFX mentioned within the header. It looks like Every File Explorer can open the files, but it's not perfect.
 

Grima

Well-Known Member
Member
Joined
Jul 2, 2016
Messages
118
Trophies
0
Age
24
XP
109
Country
United States
so i found lucinas hair color and im trying to find gunters now. i found where his aid label is (i think thats what you call it. it has all the text about his models) at 00 00 94 1F so i invert it and get 1F 94 00 00. subtract 20 from the first byte and get 05 94 00 00. so what do i do now to find gunters hair color?
Forgive me if I'm wrong, but if I did the math right, it should be 0B94 because 1F-20= 0B, no?
But after that, try going to that offset and looking for 3 bytes in a row and reverse them in a color wheel to see if it looks close to the color?
 

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
Alright, this is a stupid question but I'll go ahead and ask it. Are there any decent tools for actually replacing models in .bch files? As far as I can tell, Ohana only allows for texture replacing.
 

Grima

Well-Known Member
Member
Joined
Jul 2, 2016
Messages
118
Trophies
0
Age
24
XP
109
Country
United States
Hey DeathChaos. I'm compiling a list of the offsets and hex code for the characters AID files for ease of access, and I've done about half of the characters. My problem is I can't find the kids hair colors, minus Shigure. I know it's supposed to be the last 4 bytes of the AID is the hair, but I'm not seeing it. Do they even have hair colors in their AID?
 

DeathChaos

Unmei wo koeru!
OP
Member
Joined
Oct 21, 2015
Messages
1,364
Trophies
0
Age
28
XP
1,724
Country
Puerto Rico
Hey DeathChaos. I'm compiling a list of the offsets and hex code for the characters AID files for ease of access, and I've done about half of the characters. My problem is I can't find the kids hair colors, minus Shigure. I know it's supposed to be the last 4 bytes of the AID is the hair, but I'm not seeing it. Do they even have hair colors in their AID?
Some AIDs have FF FF FF 00 as their hair color, so chances are some AIDs don't have hair color and they just have FF FF FF 00 set.

AIDs are easy to find, just look for the AID label, and follow the pointer from there.
 

Grima

Well-Known Member
Member
Joined
Jul 2, 2016
Messages
118
Trophies
0
Age
24
XP
109
Country
United States
Some AIDs have FF FF FF 00 as their hair color, so chances are some AIDs don't have hair color and they just have FF FF FF 00 set.

AIDs are easy to find, just look for the AID label, and follow the pointer from there.
Nina doesn't have the FF FF FF 00 set, but she does have a hex code that looks like it could be Niles' hair color code. Is is possible they have their father's default hair color in their AID but it gets over written with their mother's?

[EDIT]: Actually, nevermind. I realized I don't need to find their hair color because you can easily change it with FEFTwiddler. Plus, the hair color in their AID is only used when you recruit them if their father isn't married, like Asugi having orange hair, or Rhajat having black. Anyway, I compiled a list of the hair colors/skin tones(if there was one) as well as the offsets you find them at. You can find the list here: http://pastebin.com/LBD7RsFB

I've tested a few around the list, but not every single one. The ones I have tested did work, though.
 
Last edited by Grima,

DeathChaos

Unmei wo koeru!
OP
Member
Joined
Oct 21, 2015
Messages
1,364
Trophies
0
Age
28
XP
1,724
Country
Puerto Rico
Actually, nevermind. I realized I don't need to find their hair color because you can easily change it with FEFTwiddler.

You seem to be misunderstanding something, so let me clear it up for you.

The hair color that shows up in the AID will ONLY AFFECT THE 3D MODEL'S HAIR COLOR, it has nothing to do with the hair color you find in FEFTwiddler or the Hair Color that passes down, not even the sprite's hair color.

The one that controls that is set on the character's FID.

FIDs are easier to understand, unlike AIDs, they're all 0x48 in size, and again, like the AIDs, the last 4 bytes are the hair color.

The Hair color listed here is the one that actually matters.

For people static hair colors, like parents, this hex value doesn't do much at all, it's just the color that their children will inherit.

However, for Children, this determines the Hair color in sprites, in the AID, map sprites, and My Room model (MyRoom doesn't even read the hair color from the Children units, it actually takes the pointer to their variable parent and reads the hair color hex from the parent).

FID blocks are 2 blocks per character, the first block should start with a pointer to a FSID_ST_ label and the following block should start with a pointer to FSID_BU_

I managed to make a new FID entry in this file (back when I was doing Awakening Trio), I had actually fully added Lissa, made a new AID in ROM3, made a new FID entry for her, and also made a new block for her in GameData, but couldn't get her voice to work since it was a standalone BCSAR file.

The amount of effort I had to go through is really not worth replicating though.
 

Grima

Well-Known Member
Member
Joined
Jul 2, 2016
Messages
118
Trophies
0
Age
24
XP
109
Country
United States
Changing the character hair color in FEFTwiddler has always changed the color of the 3D model, if the character doesn't have a static hair color. Like I changed Soleil to have her pink hair color with just FEFTwiddler and it changed her 3D model as well as her map sprites, and portraits.
 

DeathChaos

Unmei wo koeru!
OP
Member
Joined
Oct 21, 2015
Messages
1,364
Trophies
0
Age
28
XP
1,724
Country
Puerto Rico
Changing the character hair color in FEFTwiddler has always changed the color of the 3D model, if the character doesn't have a static hair color. Like I changed Soleil to have her pink hair color with just FEFTwiddler and it changed her 3D model as well as her map sprites, and portraits.

However, for Children, this determines the Hair color in sprites, in the AID, map sprites, and ...
 

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
Well, I'm done trying to port Awakening models over to Fates for now. I tried everything I could think of, but I could never get the results I was looking for. I'll go ahead and leave what I figured out here anyways in case someone else is interested in trying to figure this out.

So, converting the CGFX files from Awakening over to Fates' .bch format is actually possible - I converted one of the body models to .bch and actually got it to show in game. Unfortunately, heads do not quite work and texture mapping appears to get lost in the process. In its current form, we can port over models, we just can't get them in to a form worth using. I'll go through the process I used below, though you'll need the dev kit tools.
  1. Open up the Awakening file in Ohana, export the model to .obj
  2. Import the .obj into 3DS Max, use the plugin to export to .cmdl
  3. Use the command-line tools to convert the .cmdl to .bch
  4. Compress and replace an existing Fates model, view it in game.
The process is roughly the same for textures. Export with Ohana, convert from .png to .tga, use command-line tools to convert to .ctex and then .bch. I haven't tried animations yet personally, but they don't export to .obj so there might be extra steps. I haven't done a lot of work with models personally, so I have no idea how to get the models to a usable state from where things are currently at, but anyone else is free to give it a shot.

Additionally, I thought that I'd mention an interesting observation I made while working on this. As it turns out, Awakening animations seem to work perfectly with Fates models - I tested most of the class animations out on a Fates body model in Ohana, and everything seemed to play perfectly. I still need to test converting animations to .bch to be sure, but I think that we might be able to port over Awakening animations even if porting full models doesn't work.
 
  • Like
Reactions: Koko-Kun

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
I thought I'd go ahead and dump all of the information I've found regarding BCSAR files here, though I might just throw it all in its own thread at some point. I've been trying to find a method for adding new sounds to Fates since I started working on hacks for the game, but I've had next to no success so far. For the most part, I've simply gone through the BCSAR file using the notes on 3dbrew, though the documentation there is very barebones at the moment. I went through the source code behind a couple of different programs for unpacking BCSAR files, though unfortunately neither of the programs I examined had anything particularly useful regarding the file structure. Here's what I've figured out so far.
  • 3DS Audio Ripper doesn't actually mess with the file structure at all. It just scans through the file for the magic strings at the beginning of each file name, like "CWAV" or "CWAR", and uses those offsets for extraction. Because of this, the program has no way to connect a sound to its name. This program also does not appear to rip every file located inside the archive - there are over 10000 file names tied to the BCSAR file, but 3DS Audio Ripper only finds a little under 9000. I think part of this is due to the files located inside the stream folder, which only have location references inside the archive.
  • BCSAR Unpacker isn't 100% functional, but the code actually does seem to go through partition headers to determine file offsets. It looks like the INFO partition is separated out into a bunch of different sections, and those sections connect the file names to sound data. If I was to make a guess, I'd say that each section corresponds to a certain file type (BCSAR Unpacker's code based dumping off of some information from the sixth section of the INFO partition, and only identified the offsets of .cseq files in my experience). I might go through and map out partition headers based off of how this program handles them, though it still wouldn't solve all of the problems with unpacking.
  • The first half of the STRG partition is actually pretty easy to understand, but I've yet to figure anything out for the rest of it. The header is of size 0x1C, followed by entries for each file name. The first part of the entry indicates file type, the second points to the file name (offset by 0x58), and the third indicates the length of the file name. After all of the entries you have the file names, and then the unknown half of the STRG partition. I have no idea what that section actually does, though it's probably tied to some of the unknown values in the STRG header.
  • The INFO partition also seems to handle references to outside sound files. At the end of this partition you will find a listing of sounds located outside of the BCSAR including their full filepath. Still need to look into how this connects to the various sections within the INFO partition.
Given that information, there's definitely not enough to go off of for modifying or rebuilding the BCSAR. I feel like mapping out the INFO section would probably be the best bet for connecting file names to sound data, but I have not found any sort of pattern to go off of for the INFO partition. The only other alternative that I could think of for sound editing is getting the game to load in multiple archives like some 3DS games do, but that would present a whole lot of additional challenges. Has anyone else figured out anything regarding the BCSAR file structure, or found anything of interest regarding sound editing in Fates?

Additionally, I've started modifying the GameData.bin file in preparation for some stuff I'm planning on doing for the custom paralogue hack, but I thought the modifications might be of interest to some people here. I've moved the chapter and character tables to entirely new locations, which means that there's now room for new blocks to be added to those tables. I've left space for hundreds of entries at the end of each table, so there shouldn't be any need to move the tables again unless you want to do something crazy like add 300 new recruitable characters to the game. I'll leave the file here in case anyone's interested.
 

Attachments

  • GameData.7z
    46 KB · Views: 200
  • Like
Reactions: RainThunder

Koko-Kun

A Guppy
Member
Joined
Jun 10, 2016
Messages
122
Trophies
0
Location
Paradisum
XP
111
Country
United States
@thane98 This was solved already. Grab this and extract the cwav contents from the bcsar (this can be done manually too).
Then just use ctrtool:
Code:
ctrtool file.cwav --wav=file.wav
or
Code:
ctrtool file.bcwav --wav=file.wav
To convert a wav to a cwav file you need ctr_WaveConverter32 which is leaked on that iso site. Other than that, I don't think there's any public program that can convert multiple cwav/bcwav to wav at a time.

Edit: Oh here's proof https://mega.nz/#!dgA2ibiI!w5CAf6KS5n_-FbW0S8HGzD_XCqDKwKV1Fxq2exaxy5E . I think this is Owain?
 
Last edited by Koko-Kun,

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
@thane98 This was solved already. Grab this and extract the cwav contents from the bcsar (this can be done manually too).
Then just use ctrtool:
Code:
ctrtool file.cwav --wav=file.wav
or
Code:
ctrtool file.bcwav --wav=file.wav
To convert a wav to a cwav file you need ctr_WaveConverter32 which is leaked on that iso site. Other than that, I don't think there's any public program that can convert multiple cwav/bcwav to wav at a time.

Edit: Oh here's proof https://mega.nz/#!dgA2ibiI!w5CAf6KS5n_-FbW0S8HGzD_XCqDKwKV1Fxq2exaxy5E . I think this is Owain?
Oh, I already know how to convert the files with ctrtool. I'm talking about correctly unpacking each file from the BCSAR with the correct name - our current tools only provide the offset where the file was extracted from, which isn't really helpful if you need to rebuild the archive afterwards.
 

Koko-Kun

A Guppy
Member
Joined
Jun 10, 2016
Messages
122
Trophies
0
Location
Paradisum
XP
111
Country
United States
Oh, I already know how to convert the files with ctrtool. I'm talking about correctly unpacking each file from the BCSAR with the correct name - our current tools only provide the offset where the file was extracted from, which isn't really helpful if you need to rebuild the archive afterwards.
Woops mb. Gl on finding the names for each file :yay:
 

thane98

Well-Known Member
Member
Joined
Apr 23, 2016
Messages
617
Trophies
0
XP
1,526
Country
United States
@DeathCha0s25, would you be willing to walk me through how you actually build your custom DLC CIAs? I started digging around in some of Fates' DLC files, and I found some very small BCSAR files. I've started mapping out their file structure (I think that I've figured out the entire STRG partition), and I might try modifying them to see if I can insert a new sound once I figure out the INFO partition, but I'll need some way to test the modifications.
 

DeathChaos

Unmei wo koeru!
OP
Member
Joined
Oct 21, 2015
Messages
1,364
Trophies
0
Age
28
XP
1,724
Country
Puerto Rico
@DeathCha0s25, would you be willing to walk me through how you actually build your custom DLC CIAs? I started digging around in some of Fates' DLC files, and I found some very small BCSAR files. I've started mapping out their file structure (I think that I've figured out the entire STRG partition), and I might try modifying them to see if I can insert a new sound once I figure out the INFO partition, but I'll need some way to test the modifications.
Building a DLC is extremely easy.

First, make a file called rom.rsf and put this in it;
Code:
Option:
  MediaFootPadding: true
  EnableCrypt: false
SystemControlInfo:
  SaveDataSize: $(SaveSize)K

Next a file called DLC.rsf, with this in it;
Code:
BasicInfo:
  CompanyCode             : 00
  ProductCode             : CTR-M-BFXJ-00
  ContentType             : Application # Application / SystemUpdate / Manual / Child / Trial

TitleInfo:
  UniqueId                : 0x01795
  Category                : AddOnContents # Application / SystemApplication / Applet / Firmware / Base / DlpChild / Demo / Contents / SystemContents / SharedContents / AddOnContents / Patch / AutoUpdateContents

You also need the latest version of makerom and ctrtool (both should come together in the latest version of ctrtool)

All you need is to take an existing contents file from the actual DLC, for example, the USA one is c.0000.0000006e

here are a bunch of commands I use for this, you probably know how to get the content files off of them, so I'll just focus on rebuilding;
For example, for my "Awakening Assets" DLC entry, I made a content file 0020.0000bb00, to make this from a romfs just do;
Code:
makerom -f ncch -target t -rsf DLC.rsf -romfs romfs.bin -o c.0020.0000bb00

Do this for every content file that you have a new romfs.bin for, and once you have all the content files and you want to rebuild the CIA itself;
Code:
makerom -f cia -rsf rom.rsf -o editeddlc.cia -ckeyid 0 -major 0 -minor 10 -micro 0 -DSaveSize=0 -dlc -i c.0000.0000006e:0x0000:0x0000006e -i c.0020.0000bb00:0x0020:0x0000bb00 -i c.0021.0000bb01:0x0021:0x0000bb01 -i c.0022.0000bb02:0x0022:0x0000bb02 -i c.0023.0000bb03:0x0023:0x0000bb03 ...

And that should do it, although the DLC will show up as "?" and will say it takes 0 blocks of Space in System Settings, I think it might have to do with needing NCHH encryption, not really sure.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: roms wont boot with wood r4menu