Giter Site home page Giter Site logo

botw-symbols's Introduction

botw-symbols

v150 badge v160 badge

Linker scripts (*.ld) for linking modules against BOTW 1.5.0 and 1.6.0

If you are looking for the legacy botw-link build tool, see the botw-link branch. I am working on a new build tool megaton

Download

Clone the repo with git. Add --depth 1 since the diffs might be large for generated files.

git clone https://github.com/Pistonight/botw-symbols --depth 1

Or add as a submodule to your repo

# with git
git submodule add --name botw-symbols --branch main https://github.com/Pistonight/botw-symbols <path>
# with magoo
magoo install https://github.com/Pistonight/botw-symbols <path> --name botw-symbols --branch main --depth 1

Usage

The symbols in the linker scripts are meant to be used with the headers in the decomp project.

The scripts are passed to the linker (ld) using the -T flag:

ld -T path/to/ld/ld150.ld

Or in a makefile (and you are probably using CXX, -Wl means pass the flag to the linker):

LDFLAGS = -Wl,-T path/to/ld/ld150.ld

Replace ld150.ld with ld160.ld for version 1.6.0. See version difference

When you call a function defined in those headers, the linker will use the address defined in the linker script to link your module, allowing it to jump to the function in the game's binary at run time.

If you are using the function symbol for hooking, declare it as extern "C" <return type> <mangled name> (<args>); and look for the mangled name in the linker script

Stubs

The linker scripts are generated based on the decomp project. For symbols that have not been decompiled yet, they are stubbed in the linker script as stub_<hex> where <hex> is the 8-digit address of the symbol.

For version 1.6.0, most symbols are stubbed because there's no decompilation done. If you figure out the address of a function in 1.6.0, feel free to contribute by adding it to listing_160.csv (using the mangled name from the decomp project)

The stubs are included in separate files. For example, if you need stubs from 1.6.0, also feed ld/ld160_stubs.ld to the linker.

Version Difference

Here are some differences and things to note when working with v1.5.0 versus v1.6.0:

  1. 1.6.0 has more stubs (see above)
  2. 1.6.0 is more optimized. It is possible that a function in 1.5.0 doesn't exist in 1.6.0 (either inlined or removed).
    • In that case, you can use the decomp project to include the implementation in your cpp files

Keeping Up to Date

The update.py script will update the linker scripts from listing_160.csv and the decomp project

pip install requests
python update.py

botw-symbols's People

Contributors

pistonight avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

makonede

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.