[Help] Completing my Tri Force Heroes patch

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by HelpTheWretched, Jun 26, 2017.

  1. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    72
    28
    Feb 4, 2010
    Canada
    I've been working on a Purple Link patch for Tri Force Heroes (thread here) for a while now, and it seems I've hit the wall of my abilities to complete it.

    Most parts of the patch involved a lot of experimenting and figuring things out myself, beyond what many of the available ROM-hacking programs can do.

    For example: Ohana3DS is excellent for viewing character models and it includes a texture replacer. But when using it to extract textures, any portions with 0% opacity have their colour values ignored, and re-inserting these textures leaves black spots on the models in-game. I wondered if the alpha channel even mattered since the textures aren't transparent in-game, and it turns out the alpha channel is used as a specular map! I had to find another program to dump the textures intact. Also, Ohana3DS does a gnarly compression job when replacing ETC1-encoded textures, so I had to find a way to encode them first with higher quality, then replace then in the models via hex editor, after which I discovered that Link's outfit textures have 5 mipmap levels, not 4 as Ohana3DS reported.

    Anyway! I'm going to list the remaining parts of my patch and share whatever details I've found out so far. If anybody's able to help or willing to try, that'd be swell!


    1. Home Menu banner
    [​IMG]
    I posted a thread about this (here) but it had no replies. Basically, I've edited banner.bin to include the Purple Link and logo. However, this only shows up on the Home Menu if I insert it into the base game. My patch is a RomFS edit of the game's DLC/update, which doesn't include its own banner. I can't figure out how to add this edited banner.bin to the update, or if it's even possible.

    Also, the background oval cycles between the 3 Links' colours, so it still appears green at times. (The oval's texture is actually yellow for some reason.) Loading the banner in Every File Explorer indicates that it has 3 "Lights", which I presume are what controls those colours, but I haven't found a way to view or edit their data.


    2. Layout files

    Tri Force Heroes uses the Wii U extensions BFLYT, BFLAN and BFLIM for its Layout files instead of the usual BCLYT and so on. They appear to use little-endian values like other 3DS files.

    I've looked into BCLYT file structure here (https://3dbrew.org/wiki/CLYT_format) and while there's little documentation of BFLYT files, they're based on Wii BRLYT, shown here. (http://wiki.tockdom.com/wiki/BRLYT_(File_Format)). Tri Force Heroes files resemble those file structures but seem to be some differences - many sections don't have the lengths listed in those Wikis, and the tools listed can't seem to read them.

    I've read @RosaliinaDaHacker64 's thread (here) which explains the screen coordinates, but when it comes to colour values I'm not sure what to look for. 4-byte RGBA values? Floating-point numbers?


    2a. Touchscreen panels

    These are most likely coloured via Layout files. I've found various related images in the ROM, for different player setups.

    [​IMG]
    A 3-player game uses these:

    [​IMG]
    course_player_base00 for the other players' panels

    [​IMG]
    course_player_base01 for your player, displayed in your colour (with the slightly brownish hue)

    [​IMG]
    PlayerBaseEdge00 making up the outline on your panel
    Constructed example:
    [​IMG]


    [​IMG]
    A 1-player game uses these:

    [​IMG]
    CoursePBaseSingle00 for all 3 panels, coloured for the active player

    [​IMG] [​IMG]
    PBaseSingleEdge00 & PBaseSingleEdge01 making up the outline for all 3 panels; all coloured, but partially transparent for the inactive players.
    Constructed example:
    [​IMG]


    There are also these images:

    [​IMG]
    ArenaPlayerBase00

    [​IMG]
    ArenaPlayerBase01

    The "Arena" label refers to Coliseum battles, but I don't have any screenshots from there. Presumably they also use some outline graphics like the others.

    There seem to be some relevant files in Archive/Common/Lyt_Game.arc:
    Gm_ArenaPlayerBase00.bflyt
    Gm_ArenaPlayerBase01.bflyt
    Gm_CoursePlayerBase00.bflyt
    Gm_CoursePlayerBase01.bflyt
    Gm_CoursePlayerBase02.bflyt
    Gm_CoursePlaySingle_B.bflyt
    Gm_ArenaPlayerBase00_*.bflan
    Gm_ArenaPlayerBase01_*.bflan
    Gm_CoursePlayerBase00_*.bflan
    Gm_CoursePlayerBase01_*.bflan
    Gm_CoursePlayerBase02_*.bflan


    2b. Link checkers

    There are "outline" images that show where the other players are.
    [​IMG]

    [​IMG]
    LinkChecker_00: Any offscreen players have Link's face, surrounded by this outline in their colour, at the edge of the screen. The outline rotates to point directly to that Link.

    [​IMG]
    LinkChecker_01: This is used when an offscreen player hits the "Over Here!" icon. If the player is onscreen, the coloured outline seen on the speech bubble is a part of that speech bubble image. But if they're offscreen, the game superimposes this outline, coloured via Layout files, to be able to point in the player's direction.


    2c. Onscreen text

    Whenever a Link totems, takes damage, gets certain items, or various other actions, a text string scrolls across the screen. The Link's name appears in their colour. This is probably done through Layout files, but I don't know where to look for the colour values.


    3. Particle effects

    Inside the RegionBoot.szs archive, there's a folder called Effects/ which contains five .ptcl files. I presume these stand for "particle", and by looking through them quickly in a hex editor, they contain references to things listed below.

    Judging by how some of the encoded sections look, they might also contain some related textures, as there are a bunch mentioned below that I haven't found anywhere else.

    I can't find any documentation on .ptcl files, just a couple mentions of them being used in Pokémon as well. It looks like the beginning of the files contain pointers to the data they contain.


    3a. Switching doppels

    When you switch between the doppels in a 1-player game, a "beam" quickly shoots between the two doppels. It starts as the colour of the old doppel and fades into the colour of the new doppel as it moves. The beam emits some particles and has a sphere at its head.

    Here it is, appearing green when I switch to Purple Link:
    [​IMG]

    Once the switch happens, there's a little puff of smoke around the player, also in their colour. This is not to be confused with the yellow "shine" that briefly appears inside the puff:
    [​IMG]


    3b. Platform effect

    When a player walks on a specific-coloured platform, as shown, a small ring in their colour pulsates around their feet. If you look closely, you'll see there's green at the outline, and also in a spot directly under Link's feet.

    [​IMG]

    It might be located in the same region as the Dunewalker Duds' sand ring effect, wherever that is.


    3c. More glowing stuff

    Prismantus has orbs that are coloured by textures, but their glow seems to be a particle effect.
    [​IMG]

    The magic ball that The Lady throws around has this glow too:
    [​IMG]
    Here you can see that it acts as a light source.

    There are also some sparks trailing it. When the magic ball hits the ground, it shocks the player with a coloured lightning strike:
    [​IMG]
    You can see that right below Link, the lightning texture starts to repeat, which indicates that it probably is, in fact, a texture.

    The magic ball's model only includes the textures on the sphere itself. However, packed in with the Sky Temple 4's files is ObjBigMadamBall.tlb, which seems to make some references to players' colours.


    3d. This thing

    [​IMG]
    Could be a particle effect as well. The texture doesn't appear in the enemy's model, any of the stage files, or common texture files.
     
    jamezfat and RosaliinaDaHacker64 like this.
  2. Filo97

    Filo97 Zelda's totally my sister! Not lying!

    Member
    3,724
    1,227
    Oct 8, 2015
    Italy
    Hyrule Castle
    For the wiiu extensions you could ask someone who is decently good at wiiu hacking
     
  3. RosaliinaDaHacker64

    RosaliinaDaHacker64 3DS font intermediate/expert

    Member
    617
    305
    Oct 7, 2015
    Ireland
    F:\gm9\out
    Those aren't actual Wii U filetypes, BFLYT is probably Font List (FNL1), like BFFNT (font) is FINF for header that Mario & Luigi Paper Jam uses.

    Not just 'Binary Cafe Layout', 'Binary Cafe Font', or 'Binary Cafe Layout Image', it's still 3DS' filetypes, these structures are very similar to other files that start with second letter "C" for format types (CTR, example; BCLYT is Binary CTR Layout). Cafe = Wii U codename, CTR = 3DS codename


    My information might be inaccurate, though, so don't call me genius :/
     
    Last edited by RosaliinaDaHacker64, Jun 26, 2017
    HelpTheWretched likes this.
  4. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    72
    28
    Feb 4, 2010
    Canada
    When I look at the BFLYT and BFLAN files in a hex editor, they have very similar structures to the "C" versions of LaYouT and Layout ANimation files. But not exactly the same as those Wiki documents.

    So, clearly they aren't Wii U files, but they're not typical of 3DS files. There are enough differences to be confusing and unable to load in the common programs. :P

    I don't expect anyone to take a thorough look, but I could post a few of them if anyone wants to see...
     
    RosaliinaDaHacker64 likes this.
  5. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    72
    28
    Feb 4, 2010
    Canada
  6. jamezfat

    jamezfat GBAtemp Regular

    Member
    157
    53
    Nov 11, 2016
    United States
    Still stuck in 2009...
    Wow, this is great! I'd be happy to help in any way I can!
     
    HelpTheWretched likes this.
  7. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    72
    28
    Feb 4, 2010
    Canada
    Thanks Jamez! Although at this point it's just "See if you can make sense of this". :P

    Some of the Layout files that may be relevant are in the link above. If you'd like to look at any other files, let me know and I'll send them!
     
  8. jamezfat

    jamezfat GBAtemp Regular

    Member
    157
    53
    Nov 11, 2016
    United States
    Still stuck in 2009...
    oh wow, my sinserist of apology, as i totally missed this being sent !

    i may be quite late to the task at hand, but i will definitely take a look at it!
    i may not be the best at straight programming, but ive got quite a bit of experience with romhacks and the such, so ill see if i can find anything!
     
    HelpTheWretched likes this.