How to rebuild a Sarc with Padding

Discussion in 'Wii U - Tutorials' started by KillzXGaming, Aug 23, 2017.

  1. KillzXGaming
    OP

    KillzXGaming GBAtemp Advanced Maniac

    Member
    6
    Jan 2, 2016
    United States
    I haven't quite found an in depth tutorial on this so i figured i might as well.

    Padding is often found in many files under the extensions of .szs, .sarc, .pack, and many more. If you save these file with a program like Wii U zip or some other program that repacks these without padding, your game will crash.

    Instances of padding I noticed:
    Warning: Spoilers inside!

    Alright now lets figure out if a sarc needs padding, what value it needs, and where it is located in hex.


    You will need:
    HxD (or similar)
    smb123w64gb's modified uwizard that has padding feature.
    Yaz0dec

    Now open your file in hex. If it shows "Yaz0" in hex then you should decompress it by dragging it into yaz0dec.exe. You can alternatively look at the padding value at 0x0A but i suggest doing this instead just in case.

    Now open that output file in hex. it should say "SARC" in it on the right.

    There are 4 bytes at 0x0E. This is the padding value highlighted in red and should be where your value is too.

    [​IMG]

    So this file uses a padding value of 0x2000. A file without padding generally will have either nothing but 0s or a bunch of hex numbers with no zeros. The best way to figure it out however is to resave the original sarc without padding applied and see if it works or not since there still isn't an exact way of knowing.

    So we need to apply our padding value on repacking. Put all files you extracted into one folder.

    [​IMG]

    Then we need to open Uwizard and type our padding value.

    [​IMG]

    Click on PACK .pack (Adjustable Padding)

    Then select your folder.

    [​IMG]

    Now save it as a .sarc.

    Then reopen it in hex.

    [​IMG]

    The value should remain the same as before. This means it worked!

    If your file was previously Yaz0 compressed, re-compress it with this (made by smb123w64gb).

    And lastly rename your files with extensions as they were originally.
    In this case mine was Font_EU.sbfarc.
     
    Last edited by KillzXGaming, Mar 12, 2018
  2. RosaliinaDaHacker64

    RosaliinaDaHacker64 3DS hacker.

    Member
    3
    Oct 7, 2015
    Ireland
    /dev/null
    Great tutorial. I used to repack SARC incorrectly lol. I'mma try getting custom BFLYT layout position working on Super Mario 3D World.
     
  3. Bkool999

    Bkool999 GBAtemp Regular

    Member
    3
    Oct 3, 2014
    United States
    Worth noting: Splatoon also uses a padding of 0x2000. Might wanna add that in.
     
  4. shadster

    shadster Member

    Newcomer
    2
    Oct 17, 2009
    United States
    That value isn't padding, and it actually starts at 0x0C.
    That declares the offset of where the beginning of the node/file data starts.
    Essentially, what that padding tool does is changes all the position offsets and pads section down.

    So it's related to padding, but actually just a fixed offset position where to start...
    This makes things a little tedious for us programmers... but appears to be only for certain file types
    Luckily the node start/end offsets go by whatever the datastart is, so easy fix.

    Which makes me wonder, why Nintendo is actually wasting space by adding unnecessary padding in the first place.
    Perhaps programmers ran into an issue where they needed to hardcode the data offset.
     
    Last edited by shadster, Nov 11, 2017
  5. shadster

    shadster Member

    Newcomer
    2
    Oct 17, 2009
    United States
    DarthDub and KillzXGaming like this.
  6. kavid

    kavid GBAtemp Advanced Fan

    Member
    3
    Sep 28, 2008
    Switzerland
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice