mirror of https://github.com/zeldaret/botw.git
parent
71fc0f35e8
commit
80bf9236a3
12
README.md
12
README.md
|
@ -140,7 +140,7 @@ The instructions below assume that you are using Linux (native or WSL) or macOS.
|
|||
* Ninja
|
||||
* CMake 3.13+
|
||||
* If you are on Ubuntu 18.04, you must first [update CMake by using the official CMake APT repository](https://apt.kitware.com/).
|
||||
* [Optional] ccache (to speed up builds)
|
||||
* ccache (to speed up builds)
|
||||
|
||||
Ubuntu users can install those dependencies by running:
|
||||
|
||||
|
@ -148,12 +148,18 @@ Ubuntu users can install those dependencies by running:
|
|||
sudo apt install python3 ninja-build cmake ccache
|
||||
```
|
||||
|
||||
Additionally, you'll also need:
|
||||
|
||||
* A Rust toolchain ([follow the instructions here](https://www.rust-lang.org/tools/install))
|
||||
|
||||
### 2. Set up the project
|
||||
|
||||
1. Clone this repository. If you are using WSL, please clone the repo *inside* WSL, *not* on the Windows side (for performance reasons).
|
||||
|
||||
2. Run `git submodule update --init --recursive`
|
||||
|
||||
3. Run `cargo install --path tools/viking`
|
||||
|
||||
Next, you'll need to acquire the **original 1.5.0 or 1.6.0 `main` NSO executable**.
|
||||
|
||||
* To dump it from a Switch, follow [the instructions on the wiki](https://zeldamods.org/wiki/Help:Dumping_games#Dumping_binaries_.28executable_files.29).
|
||||
|
@ -161,7 +167,7 @@ sudo apt install python3 ninja-build cmake ccache
|
|||
* The decompressed 1.5.0 NSO has the following SHA256 hash: `d9fa308d0ee7c0ab081c66d987523385e1afe06f66731bbfa32628438521c106`
|
||||
* If you have a compressed NSO or a 1.6.0 executable, don't worry about this.
|
||||
|
||||
3. Run `tools/setup.py [path to the NSO]`
|
||||
4. Run `tools/setup.py [path to the NSO]`
|
||||
* This will:
|
||||
* convert the executable if necessary
|
||||
* set up [Clang 4.0.1](https://releases.llvm.org/download.html#4.0.1) by downloading it from the official LLVM website
|
||||
|
@ -178,7 +184,7 @@ ninja -C build
|
|||
|
||||
By default, Ninja will perform a multithreaded build. There is no need to pass -j manually.
|
||||
|
||||
To check whether everything built correctly, just run `tools/check.py` after the build completes.
|
||||
To check whether everything built correctly, just run `botw-check` after the build completes.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
from colorama import Fore
|
||||
|
||||
import util.elf
|
||||
import util.checker
|
||||
from util import utils
|
||||
|
||||
|
||||
def check_function(checker: util.checker.FunctionChecker, addr: int, size: int, name: str,
|
||||
base_fn: Optional[util.elf.Function] = None) -> bool:
|
||||
if base_fn is None:
|
||||
try:
|
||||
base_fn = util.elf.get_fn_from_base_elf(addr, size)
|
||||
except KeyError:
|
||||
utils.print_error(f"couldn't find base function 0x{addr:016x} for {utils.format_symbol_name_for_msg(name)}")
|
||||
return False
|
||||
|
||||
my_fn = util.elf.get_fn_from_my_elf(name)
|
||||
return checker.check(base_fn, my_fn)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
failed = False
|
||||
|
||||
nonmatching_fns_with_dump = {p.stem: util.elf.Function(p.read_bytes(), 0) for p in
|
||||
(utils.get_repo_root() / "expected").glob("*.bin")}
|
||||
|
||||
checker = util.checker.FunctionChecker(log_mismatch_cause=True)
|
||||
|
||||
for func in utils.get_functions():
|
||||
if not func.decomp_name:
|
||||
continue
|
||||
|
||||
try:
|
||||
util.elf.get_fn_from_my_elf(func.decomp_name)
|
||||
except KeyError:
|
||||
utils.warn(f"couldn't find {utils.format_symbol_name_for_msg(func.decomp_name)}")
|
||||
continue
|
||||
|
||||
if func.status == utils.FunctionStatus.Matching:
|
||||
if not check_function(checker, func.addr, func.size, func.decomp_name):
|
||||
utils.print_error(
|
||||
f"function {utils.format_symbol_name_for_msg(func.decomp_name)} is marked as matching but does not match")
|
||||
a1, a2, reason = checker.get_mismatch()
|
||||
if a1 != -1:
|
||||
sys.stderr.write(f" at {a1 | 0x7100000000:#x} : {Fore.CYAN}{reason}{Fore.RESET}\n")
|
||||
failed = True
|
||||
elif func.status == utils.FunctionStatus.Equivalent or func.status == utils.FunctionStatus.NonMatching:
|
||||
if check_function(checker, func.addr, func.size, func.decomp_name):
|
||||
utils.print_note(
|
||||
f"function {utils.format_symbol_name_for_msg(func.decomp_name)} is marked as non-matching but matches")
|
||||
|
||||
fn_dump = nonmatching_fns_with_dump.get(func.decomp_name, None)
|
||||
if fn_dump is not None and not check_function(checker, func.addr, len(fn_dump), func.decomp_name, fn_dump):
|
||||
utils.print_error(
|
||||
f"function {utils.format_symbol_name_for_msg(func.decomp_name)} does not match expected output")
|
||||
failed = True
|
||||
|
||||
if failed:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue