All Projects → zeldaret → Botw

zeldaret / Botw

Decompilation of The Legend of Zelda: Breath of the Wild (Switch 1.5.0)

Programming Languages

cpp
1120 projects

Projects that are alternatives of or similar to Botw

Botw Re Notes
Reverse engineering notes and tools for The Legend of Zelda: Breath of the Wild
Stars: ✭ 78 (-67.63%)
Mutual labels:  nintendo-switch, reverse-engineering
Nintendoswitchrestapi
Reverse engineered REST API used in the Nintendo Switch app for iOS. Includes documentation on Splatoon 2's API.
Stars: ✭ 439 (+82.16%)
Mutual labels:  nintendo-switch, reverse-engineering
Opensteamcontroller
Steam Controller reverse engineering and customization project.
Stars: ✭ 253 (+4.98%)
Mutual labels:  nintendo-switch, reverse-engineering
Ghidra Switch Loader
Nintendo Switch loader for Ghidra
Stars: ✭ 146 (-39.42%)
Mutual labels:  nintendo-switch, reverse-engineering
Senseye
Dynamic Visual Debugging / Reverse Engineering Toolsuite
Stars: ✭ 234 (-2.9%)
Mutual labels:  reverse-engineering
Androidautoidrive
Implementations of some Android Auto features as unofficial IDrive apps
Stars: ✭ 226 (-6.22%)
Mutual labels:  reverse-engineering
Awesome Reverse Engineering
Reverse Engineering Resources About All Platforms(Windows/Linux/macOS/Android/iOS/IoT) And Every Aspect! (More than 3500 open source tools and 2300 posts&videos)
Stars: ✭ 2,954 (+1125.73%)
Mutual labels:  reverse-engineering
Vscode Frida
Unofficial frida extension for VSCode
Stars: ✭ 221 (-8.3%)
Mutual labels:  reverse-engineering
Il2cppdumper
Unity il2cpp reverse engineer
Stars: ✭ 3,362 (+1295.02%)
Mutual labels:  reverse-engineering
Invtero.net
inVtero.net: A high speed (Gbps) Forensics, Memory integrity & assurance. Includes offensive & defensive memory capabilities. Find/Extract processes, hypervisors (including nested) in memory dumps using microarchitechture independent Virtual Machiene Introspection techniques
Stars: ✭ 237 (-1.66%)
Mutual labels:  reverse-engineering
Dmg Cpu Inside
Reverse-engineered schematics for DMG-CPU-B
Stars: ✭ 230 (-4.56%)
Mutual labels:  reverse-engineering
Classinformer Ida7
ClassInformer backported for IDA Pro 7.0
Stars: ✭ 226 (-6.22%)
Mutual labels:  reverse-engineering
Sdsetup
The Ninite for your Nintendo Switch.
Stars: ✭ 234 (-2.9%)
Mutual labels:  nintendo-switch
Fhex
A Full-Featured HexEditor compatible with Linux/Windows/MacOS
Stars: ✭ 225 (-6.64%)
Mutual labels:  reverse-engineering
Injectopi
A set of tutorials about code injection for Windows.
Stars: ✭ 237 (-1.66%)
Mutual labels:  reverse-engineering
Librw
A re-implementation of the RenderWare Graphics engine
Stars: ✭ 223 (-7.47%)
Mutual labels:  reverse-engineering
Uofw
The unofficial Official FirmWare, a complete latest PSP firmware reverse engineering project
Stars: ✭ 230 (-4.56%)
Mutual labels:  reverse-engineering
Sniffrom
A tool for passive data capture and reconnaissance of serial flash chips. It is used in conjunction with a Saleae logic analyzer to reconstruct flash memory contents and extract contextual information about device operations.
Stars: ✭ 234 (-2.9%)
Mutual labels:  reverse-engineering
Shed
.NET runtime inspector
Stars: ✭ 229 (-4.98%)
Mutual labels:  reverse-engineering
Uefi retool
A tool for UEFI firmware reverse engineering
Stars: ✭ 227 (-5.81%)
Mutual labels:  reverse-engineering

The Legend of Zelda: Breath of the Wild

This is an experimental, WIP decompilation of The Legend of Zelda: Breath of the Wild v1.5.0 (Switch).

File names, class or function names and the file organization come from leftover strings. Unlike some other first-party games such as Super Mario Odyssey, all known public versions of U-King are completely stripped, so most names are just more or less educated guesses.

This repository does not contain game assets or RomFS content and cannot be used to play Breath of the Wild.

This project is only about the main executable which contains all game code and statically linked libraries. The RomFS and the SDK libraries are out of the scope of this project.

Progress: https://botw.link/progress

Just like other decompilation projects, progress is tracked by looking at the percentage of decompiled bytes (the number of decompiled bytes divided by the total code size).

Goal

The goal of this project is to better understand game internals, aid with glitch hunting and document existing knowledge in something less fragile than an IDA database.

Considering the large size of the executable (~40MB), it is not expected to reach 100% progress within a reasonable timeframe.

As a result, the project is unlikely to produce a working executable in the near future. It will help with understanding and reverse engineering the game even in its incomplete state, but it will NOT help with playing BotW or porting the game to other platforms, which is explicitly a non-goal.

Currently, the focus is on decompiling AI classes and KingSystem framework code.

Frequently Asked Questions

Isn't this risky?

As with other game decompilations, this project is probably in a legal gray zone. However, the authors of this project believe that it is unlikely to bother NCL for the following reasons:

  • Contributing to this repository requires owning the game on a Switch console and dumping the executable.
  • This project is completely useless to anybody who does not have the game.
    • It cannot be used to play the game.
    • It does not give you any useful knowledge if you do not play the game or if you do not even have it.
  • This repository is only about the executable, which is less than 0.3% of the whole game (ExeFS+RomFS).
  • Even if the executable were fully decompiled, it would still not be possible to play the game without dumping the RomFS from a Switch.
  • This repository does not contain any original code from the executable.
    • Unlike some decompilation projects for older consoles, not even a single byte of assembly code is included from the original executable.
    • It only contains reimplemented functions that happen to match once compiled.
    • The compiler is Clang, so there are many, many, many ways to write a function and organize things while still getting the exact same code. In fact, while the source code happens to match the compiled code, it is possible and quite likely that the original codebase looks very different from this repository.
  • This is a large monolithic game so there is no other way of being accurate to the original logic without doing matching decompilation.
    • Clean room decompilation (having separate teams doing reverse engineering and implementation work) is not a solution when the goal is to follow the original logic as accurately as possible.
  • This project does not use any proprietary SDK or any leaked document at all.
    • The compiler is just Clang 4.0.1 which is open source and freely available on LLVM's website. The SDK compiler is not used.
    • Anyone who has had access to leaked information is not allowed to contribute.

Is this a matching decomp?

Given the impossibility of automatically splitting the assembly and generating a matching binary, the sheer size of the main executable and the usage of many software libraries, this project takes a different and somewhat experimental approach to matching decompilation.

Because meaningfully splitting the code is not feasible, the built executable currently only contains functions that have been decompiled and no effort is being made to put functions and data at the correct addresses.

Instead of trying to match the entire executable, each function is matched individually and source code is organized in whichever way makes the most sense. Libraries are not treated as being part of the game code, but as external dependencies. The result is that the codebase looks a lot more like a regular software project than a decompilation codebase. Since C++ code makes heavy use of inline functions and zero-cost abstractions that disappear in compiled code, contributors have a lot more leeway when it comes to organizing files and adding abstractions.

How easy is it to get matching code?

Compared to other decomp projects for older compilers: extremely easy. Clang is an extremely reasonable compiler with much fewer memes than older compilers such as IDO:

  • Stack reordering issues are extremely rare, given that AArch64 uses its registers a lot more efficiently. And even when the stack is used, things Just Work™ in the vast majority of cases.
  • Pure register allocation (regalloc) issues are almost non-existent. If you see something that looks like a regalloc problem, it usually means your code is not semantically equivalent.
  • No if (1) shenanigans.
  • No same line memes (codegen being different if two statements are put on the same line).
  • Whitespace doesn't matter.

In general, two equivalent constructs that should clearly produce the same code actually produce the exact same code. There are exceptions, of course, but many things simply do not matter at all for matching. Inline functions do sometimes affect codegen, though.

Getting perfect matches on the first try happens pretty routinely, even for medium-sized and large functions (>1kB).

Most functions tend to call several other inline functions, notably utility functions from sead; as many core sead modules have already been reversed, decompiling a function sometimes only requires recognizing those function calls: decompilation at a higher level of abstraction!

Building

Dependencies

Using Linux (or WSL) is recommended but not required. The rest of this guide assumes that you are using a Linux environment, though.

Building for Switch

  1. After cloning this repository, run: git submodule update --init --recursive
  2. env UKING_CLANG=$1 DEVKITA64=$2 cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=../ToolchainNX64.cmake -B build
    • Replace $1 with the path to the extracted Clang archive, such that $1/bin/clang exists.
    • Replace $2 with the path to devkitA64. On Linux, this is typically /opt/devkitpro/devkitA64.
  3. ninja -C build to start the build

On subsequent builds, just run ninja -C build from the project root.

THIS WILL NOT PRODUCE A PLAYABLE GAME.

Contributing

Contributing guidelines are available here.

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].