Skip to content

Latest commit

 

History

History
91 lines (78 loc) · 6.58 KB

CustomLayouts.md

File metadata and controls

91 lines (78 loc) · 6.58 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:

Generating a layout patch with LayoutDiff

Once your custom layout is ready you can convert it to json for use with nxthemes.

The layout editor has an user friendly tool to do it, just open your modified SZS then click on Tools -> Layout diff -> This is the edited layout. In the window that appears select the original SZS and clcik on generate diff.

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 diff

Extracting the layout from an nxtheme

If a theme uses a layout you like you can easily extract it with the injector, as of version 4.4 go to the nxtheme extraction tab, click on extract nxtheme, select the file and where to extract it and confirm. Once it's done you're looking for the layout.json file.

Editing existing JSON layouts

Open the target szs file in the LayoutEditor. If you used NXThemesInstaller at least once you'll fild the szs for your firmware in themes/systemData on your sd card.
From the window that appears click tools -> Load JSON patch and open the json file.
When you're done create a new layout patch with LayoutDiff as explained earlier.
The file names for each part are listed in the wiki: https://github.com/exelix11/SwitchThemeInjector/wiki

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: it doesn't scroll anymore.
RdtBase
    N_ScrollWindow
        width: 100000.0 - This makes the allapps button behave properly
    N_GameRoot 
        x Translation: <set where your first icon should be> - 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
        x/y Scale: devide default by by RootPane scale (controls the touch area)
        width/height: multiply default by RootPane scale (Controls the 'cursor snap area'. Must be the right size to prevent the cursor from skipping an icon)

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

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) and text panes (txt1) :

  • ColorTL : Top left color
  • ColorTR : Top right color
  • ColorBL : Bottom left color
  • ColorBR : Bottom right 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), this isn'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