Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

101 lines (87 sloc) 6.89 KB

Custom layouts

It's possible to alter the home menu and other applets appearence through layout patches, these are exported as json files, this way they can be embedded in .nxtheme files and used on every firmware.

Editing a layout

Layouts are .bflyt files stored inside the .szs files of the home menu. You need a tool capable of editing them, the most user-friendly one is Switch layout editor but there's also 3dskit and Wexos toolbox (there's a patched version on qcean as the official one doesn't support some layouts from firmwares past 5.X). Note that json files generated by 3dskit are not layout patches and won't work with the injector.
Layout editing is a trial and error process and pretty time consuming, to quickly test your theme you can use the remote install feature of the theme installer as it works with szs files as well.
You also have to test your layouts on multiple firmwares as they may behave differently.
Once your custom layout is ready you can use LayoutDiff
Here are some resources to get started:

Custom animations

Editing animations is supported as well, all three of the tools linked earlier support it but it's not as straight forward as layout editing, if you want to give it a try read the documentation from 3dskit.
Animations are the .bflan files in the szs files of the home menu.
When editing animations it's important to add new groups instead of using the ones already in the bflyt, this means that if you want to animate a group that's already in the layout you have to clone and rename it and use the renamed one for your animations, this is to improve compatibility in the future. Note that only groups inside of the RootGroup are supported by the differ, the bflyt format allows for groups inside of groups but we didn't find those in the home menu files.

Custom layouts and 8.X

The firmware 8.0 changed the behavior of some parts of the home menu and broke most layouts that changed the size or the position of the game icons, migush found a way to fix it, here's what he wrote:

Only x translation is a problem.
N_GameRoot scale controls the gameroot scrollwidth, so change x scale of it to like 0.00001 and change N_Game to 100000 to compensate: is doesn't scroll anymore.
RdtBase
    N_ScrollWindow
        width: 100000.0
    N_GameRoot 
        x Translation: p. Keep in mind N_Icon_00 at x=0
        x Scale: 0.00001
    N_Game
    x translation: 0 (!)
        x Scale: 100000.0
        N_Icon_xx
            x Translation: set the N_Icon_00 to x=0 and start from there. Keep in mind the scale of the RootPane in RdtBtnIconGame
        N_Icon_12
            L_BtnFlc
                x/y scale: same as RdtBtnIconGame
    Move the icons you want to hide to (1;9999). 
    Don't forget to change y and scale of other things like scrollwindow/area y translation as usual
Then to change size of the icons:
RdtBtnIconGame
    RootPane   
        x Scale: p
        y Scale: p
    B_Hit
        width/height: devide default by RootPane scale (Controls the 'cursor snap area'. Must be the right size to prevent the cursor from skipping an icon)
        x+y Scale: set it to the opposite of the width/height change (eg. width 264->132: scale 1->2) (controls the touch area)
       
RdtBtnFullLauncher
    ?Don't think you have to change anything here

As examples for 8.0-Compatible layouts you can use the layouts that have "Ready8X" flag from the layouts folder of the injector

Generating a layout patch with LayoutDiff

Once your custom layout is ready you can convert it to json for use with nxthemes.
You need your custom szs and the original szs you used as a base, the bg image doesn't matter.

  1. Open the Switch theme injector Windows app and enable the advanced tools
  2. In the szs patching tab open the PATCHED SZS
  3. Go to the advanced tab and click on the "Layout Diff" button, it will show a dialog to open another SZS, open the ORIGINAL one.
  4. If everything went ok you should be able to save your json patch.
  5. Open the json you just saved with a text editor and change the name and the author
  6. Look for bad panes in the json and manually remove them, they have a weird name or no properties. (this bug should have been fixed but checking anyway doesn't hurt) Use a json checker to make sure you didn't make any mistakes like skipping commas
  7. Save and share your layout

Note that if the output file is big (100-200kb) and it clearly contains more data than just the stuff you've edited you most likely used as original szs a file for a different firmware and the differ picked up the firmware differences, using that layout may fail or cause crashes, that's why it's important to use the original szs to dif

Extracting the layout from an nxtheme

If a theme uses a layout you like you can easily extract it with the injector:\

  1. Enable the advanced tools
  2. Go to the szs patching tab and click on open file, on the bottom right of the file open window select all files instead of szs and open the nxtheme file
  3. An error will pop up as it's not an szs theme but the data will be loaded in the advanced tab
  4. In the advanced tab you should see a file called layout.json, right click it and press extract

Supported properties

The layout patcher doesn't support all the properties of bflyt files, this is to avoid compatibility issues in the future, if you changed values not included in the following list they won't be detected by the differ :

  • Position
  • Rotation
  • Scale
  • Size
  • Visible
  • OriginX
  • OriginY
  • ParentOriginX
  • ParentOriginY

Only for picture panes (pic1) :

  • ColorTL : Top left vertex color
  • ColorTR : Top right vertex color
  • ColorBL : Bottom left vertex color
  • ColorBR : Bottom right vertex color

In addition, it's possible to change the order of panes via the PushBackPanes and PullFrontPanes Properties in the LayoutFilePatch json object (Aka the one that contains the FileName property) These two properties aren't supported by the differ and must be manually added, they're simple string arrays with the names of the panes to move. The panes won't be moved out of their parent.
Note that layouts are rendered top to bottom, this means that PullFrontPanes will move the panes to the start of the list and so they will be rendered behind, the name was chosen to match the action in the layout editor.\

For usd1 (user data) panes only float and int properties are supported.
Bflan animations are fully supported.
For materials only the ForegroundColor and BackgroundColor properties are supported

You can’t perform that action at this time.