Coder Social home page Coder Social logo

hyrule-builder's Introduction

Hyrule Builder

A mod building tool for The Legend of Zelda: Breath of the Wild.

Hyrule Builder is designed to help BOTW modders more easily manage and edit their project files. It can "unbuild"/"decompile" game files to a source-like format. All SARCs are extracted, all BYML, AAMP, or MSYT files are converted to YAML, and actor packs are specially unbuilt using canonical paths. The whole project can be easily rebuilt into usable mod, with a number of convenience features to smooth the process.

Setup

Download the latest release and extract the Hyrule Builder executable.

Project Management

Each mod you work on with Hyrule Builder is handled as its own project. Projects can be initialized from an existing mod, which will be unbuilt to the Hyrule Builder project format, or created fresh. Once a project is setup, it can be edited and built, with support for fast incremental rebuilds.

Hyrule Builder supports both Wii U and Switch mods, but each has a different format.

Wii U layout:

. (root mod folder)
├── content
│   └── (content folders, e.g. Actor, Pack, etc.)
└── aoc (for DLC files)
    └── (DLC folders, e.g. Map, Pack, etc.)

Switch layout (note: title IDs are case sensitive):

. (root mod folder)
├── 01007EF00011E000 (base game files)
│   └── romfs
│       └── (content folders, e.g. Actor, Pack, etc.)
└── 01007EF00011F001 (DLC files)
    └── romfs
        └── (content folders, e.g. Map, Pack, etc.)

Create a New Proejct

To create a new, blank mod project, run hyrule_builder init, which will prepare a new project in the current working directory. Pass the --be flag if creating a Wii U mod. The basic folder structure and an empty database of mod files will be created.

Initialize from Existing Mod Files

To turn existing mod files into a Hyrule Builder project, first make sure they are in the correct format as described above. Then run the init command with the -s/--source flag, e.g.:

hyrule_builder init -s BreathOfTheWild_VeryCleverMod

Further Usage Details

For details on initializing projects, see the help for the init command:

hyrule_builder init 0.9.0
Create a new source-like mod project

USAGE:
    hyrule-builder init [FLAGS] [OPTIONS] [directory]

FLAGS:
    -b, --be         Use big endian/Wii U mode
    -c, --config     Create default config.yml
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -s, --source <source>    Source mod folder to unbuild

ARGS:
    <directory>    Target folder to create project in [default: .]

Building

By default, when you build a project, the output files will be stored in the build folder of the project. For full information on building and its options, consult the usage info below:

hyrule_builder build 0.9.0
Build a mod from a source-like structure into binary game files 
Note: Flags can be set using a config.yml file. See readme for details

USAGE:
    hyrule-builder build [FLAGS] [OPTIONS] [--] [source]

FLAGS:
    -b, --be                 Use big endian/Wii U mode
    -h, --hard-warnings      Treat warnings as errors and abort
        --help               Prints help information
    -i, --ignore-warnings    Suppress warnings, show only errors
    -V, --version            Prints version information

OPTIONS:
    -o, --output <output>                   Output folder for built mod
    -t, --title-actors <title-actors>...    Comma separated list of custom actors to add to TitleBG.pack, e.g.
                                            `--title-actors=Weapon_Bow_001,Enemy_Golem_Senior`

ARGS:
    <source>    Source mod folder to build

Building a mod will automatically generate an updated RSTB file.

As the help says, instead of using command line arguments, you can also configure the build command by providing a config.yml file. It supports up to three sections, each of which is optional. The Meta section provides data that will be written into a rules.txt file in the output mod. The Flags section turns simple switchflags on by name in a list. The Options section is for flags that store arbitary values, like title-actors or output. An example config file is included below:

Meta: # specify data to go into a rules.txt file here
  name: A Mod
  description: My new mod
Flags: # list the switch flags you want turned on
  - be
  - ignore-warnings
Options: # provide values for customizable flags
  title-actors: Weapon_Bow_001,Enemy_Lizalfos_Senior
  output: test/TestMod_built

Adding Files to Projects

While it is possible to manually create new mod files or copy them in an unbuilt for from your game dump when adding new content, Hyrule Builder also includes asset management commands to simplify the process. To use this, first you will need to configure your game dump settings using the config command, e.g. hyrule_builder config import --from-bcml. (For more info on the config command, check the usage information with --help.)

Once your game dump settings are configured, you can use the add command to add content from your dump. Usage information:

hyrule_builder add 0.9.0
Add new content to the active mod project

USAGE:
    hyrule-builder add [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -p, --project <project>    Project folder to add to [default: .]

SUBCOMMANDS:
    actor        Add an actor to the current project, either modifying a vanilla actor or duplicating it as a new
                 one
    actorinfo    Adds unbuilt actor info to the current project
    event        Add an event to the current project, either modifying a vanilla event or duplicating it as a new
                 one
    help         Prints this message or the help of the given subcommand(s)
    map          Add a map unit to the current project
    pack         Add a root game pack to the mod (e.g. `Bootup.pack`, `AocMainField.pack`, etc.)

Notes on Project Layout

Most of a Hyrule Builder project layout will be familiar to anyone who has worked with BOTW mods, especially graphic packs, before. However, the following aspects are unique to Hyrule Builder:

  • ActorInfo.product.sbyml becomes the Actor/ActorInfo folder with individual YAML files for each actor. The hash list is handled automatically. Simply adding a new YAML file to the folder will add it to the actor list and hash list.
  • EventInfo.product.sbyml works roughly the same way, under Event/EventInfo.
  • Most SARC files are unbuilt in place with their original filename, e.g. Pack/TitleBG.pack simply becomes a folder with the same name. However, actor packs are unbuilt fully into the Actor folder and rebuilt from their actor link files. For example, if you were to make a new copy of Actor/ActorLink/Enemy_Lizalfos_Senior.bxml.yml in your project and name it Enemy_Lizalfos_Geezer.bxml.yml, this change alone would cause the build process to create a new actor pack at Actor/Pack/Enemy_Lizalfos_Geezer.sbactorpack.
  • Some SARC files which are parsed by standard Nintendo libraries instead of the BOTW resource system will not be unbuilt for safety reasons.

License

This software is licensed under the terms of the GNU General Public License, version 3 or later.

hyrule-builder's People

Contributors

nicenenerd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hyrule-builder's Issues

Building Mod Abrupts Early

Using v0.9.0

I'm running the following command .\hyrule-builder.exe build Second-Wind

This results in the following occuring:

Scanning project files
Loading actor info
Checking actor packs
Building 2933 actor packs
PS D:\User\Desktop\BOTW Editing\projects\~Second Wind\~Main>

The built project only contains a few actors:

image

Standalone Sarc Builder doesn't build .slash files

If I unbuild a SARC with the unbuild_sarc command it leaves behind a .slash file for the empty sub directory in gamedata.ssarc, and a .align file for something else. However, if I rebuild this directory with build_sarc it just adds the .slash and .align files to the built sarc file instead of evaluating them like hyrule_builder build does.

`--output` flag ignored in `build` command

Specifying a path via --output when using the build command seems to have no effect -- the tool always builds into the default output directory.

This occurs in both the Python version installed from pip and the Rust version installed from the rust branch.

Support for `options` directory

For mod creators that utilize the options feature of BCML/UKMM, it would be convenient if Hyrule Builder handled the options directory as a group of "sub-projects".

More specifically, if Hyrule Builder detects the presence of an options directory in a project it is building/unbuilding, it should (attempt to) perform whatever operation it is performing on the main project on the sub-projects as well.

One difference would be that the sub-projects, if they were allowed to have a separate config file at all, would not be allowed to specify a separate output directory because (by nature of being sub-projects) they would need to remain associated with their parent.

Build_sarc not building the same file

There seems to be a problem when rebuilding sarc files, as whenever I rebuild, the binary structure of the new file seems to be different from what it originally was, when I don't even change anything. The files seem to work fine ingame (although I haven't tested an extensive list), but if I want to create a BNP, a lot of unchanged files are treated as modified.

Add Havok support

With botw_havok, we can now convert .hkx files to/from binary formats. Suggest adding support to hyrule_builder, so that most havok data can also be converted/ported between game formats.

Application Error when unbuilding project

Using v0.9.0

When attempting to unbuild a project with the following command:
.\hyrule-builder.exe init -b -s "D:\User\Desktop\BOTW Editing\projects\~Second Wind\~Main\Second-Wind_Build" ".\Second-Wind-Test"
I'll get the following error:
image

Cannot convert json to rstb

I don't know why... But the "json_to_rstb" don't work for me, i son't know if it's normal or not.

PS C:\Users\valen\Desktop\Zelda Modding\Mods> json_to_rstb -o table.rsizetable merged.json
Traceback (most recent call last):
File "c:\users\valen\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\valen\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\valen\AppData\Local\Programs\Python\Python37\Scripts\json_to_rstb.exe_main
.py", line 7, in
File "c:\users\valen\appdata\local\programs\python\python37\lib\site-packages\hyrule_builder\rstb_main.py", line 43, in json_to_rstb
table = builder.load_rstb(be=args.be, file=in_file)
AttributeError: module 'hyrule_builder.builder' has no attribute 'load_rstb'

Actor Info entries not found?

I'm am getting a File Not Found error when unbuilding actors.

The most recent case being AirWallcreature.sbactorpack when unbuilding I am consistently getting the following error.

Traceback (most recent call last):
  File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\hyrule_builder.exe\__main__.py", line 7, in <module>
  File "c:\python\lib\site-packages\hyrule_builder\__main__.py", line 91, in main
    args.func(args)
  File "c:\python\lib\site-packages\hyrule_builder\unbuilder.py", line 265, in unbuild_mod
    _unbuild_actorinfo(mod, content, out)
  File "c:\python\lib\site-packages\hyrule_builder\unbuilder.py", line 120, in _unbuild_actorinfo
    output.write_text(oead.byml.to_text(actor), encoding="utf-8")
  File "c:\python\lib\pathlib.py", line 1240, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "c:\python\lib\pathlib.py", line 1208, in open
    opener=self._opener)
  File "c:\python\lib\pathlib.py", line 1063, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\HP USER\\source\\repos\\BotW Actor Collision Generator .NET 5.0 - Async\\BotW Actor Collision Generator\\bin\\Debug\\net5.0-windows\\temp\\Build\\AirWallCreature_unbuilt\\content\\Actor\\ActorInfo\\DgnObj_DLC_IbutsuEx_BossBattleRoomDownloadTerminalBody_A_01.info.yml'

Said file does not exist, but the entry is present in ActroInfo.product.sbyml.
After this, I tried building it again without making any changes. And the following error occurred.

Failed to build content/Actor/ActorInfo/TwnObj_HyruleCastleObject_SwitchShutterFence_Iron_S_A_01.info.yml. [Errno 2] No such file or directory: 'build\\content\\Actor\\ActorInfo\\TwnObj_HyruleCastleObject_SwitchShutterFence_Iron_S_A_01.info'

This file does exist though, so I'm not sure what happened here.

Freezing on "Building AAMP and BYML files..."

Hey, it's me again.

So I'm trying to rebuild a bunch of actors and I'm having it freeze on "Building AAMP and BYML files...".

If I try and close the window, it does throw an error.
Now, I think due to the odd format of the error shown that it's thrown multiple times over time, but suppressed until I try and close the window.

The output:

Removing old build...
Scanning source files...
Copying miscellaneous files...
Building AAMP and BYML files...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\python\lib\multiprocessing\spawn.py", line 99, in spawn_main
Traceback (most recent call last):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <module>
  File "c:\python\lib\multiprocessing\spawn.py", line 99, in spawn_main
  File "c:\python\lib\multiprocessing\spawn.py", line 99, in spawn_main
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
  File "c:\python\lib\multiprocessing\reduction.py", line 87, in steal_handle
  File "c:\python\lib\multiprocessing\reduction.py", line 87, in steal_handle
  File "c:\python\lib\multiprocessing\reduction.py", line 87, in steal_handle
    _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
    _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
    _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] Access is denied
PermissionError: [WinError 5] Access is denied
PermissionError: [WinError 5] Access is denied

At this time the "build" folder contents are re-encoded files.

I tried running as admin, but it seems to just freeze. Pressing close the first time does nothing, the second terminating the console.

Thanks ~ Marcus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.