NEstelami / ZAPD

Zelda Asset Processor for Decomp
MIT License
41 stars 33 forks source link

ZAPD: Zelda Asset Processor for Decomp

Compiling

Dependencies

ZAPD needs a compiler with C++17 support.

ZAPD has the following library dependencies:

In a Debian/Ubuntu based environment, those could be installed with the following command:

sudo apt install libpng-dev

On a Mac, you will need to install libpng with Homebrew or MacPorts; we currently only support Homebrew. You can run

brew install libpng

to install it via Homebrew.

Building

Linux / *nix

ZAPD uses the classic Makefile approach. To build just run make (or even better make -j for faster compilations).

You can configure a bit your ZAPD build with the following options:

As an example, if you want to build ZAPD with optimizations disabled and use the address sanitizer, you could use the following command:

make -j OPTIMIZATION_ON=0 ASAN=1

Windows

This repository contains vcxproj files for compiling under Visual Studio environments. See ZAPD/ZAPD.vcxproj.

Invoking ZAPD

ZAPD needs a File parsing mode to be passed as first parameter. The options are:

ZAPD also accepts the following list of extra parameters:

Additionally, you can pass the flag --version to see the current ZAPD version. If that flag is passed, ZAPD will ignore any other parameter passed.

Warning flags

ZAPD contains a variety of warning types, with similar syntax to GCC or Clang's compiler warnings. Warnings can have three levels:

Each warning type uses one of these by default, but can be modified with flags, similarly to GCC or Clang:

All warning types currently implemented, with their default levels:

Warning type Default level Description
-Wdeprecated Warn Deprecated features
-Whardcoded-generic-pointer Off A generic segmented pointer must be produced
-Whardcoded-pointer Warn ZAPD lacks the info to make a symbol, so must output a hardcoded pointer
-Wintersection Warn Two assets intersect
-Winvalid-attribute-value Err Attribute declared in XML is wrong
-Winvalid-extracted-data Err Extracted data does not have correct form
-Winvalid-jpeg Err JPEG file does not conform to the game's format requirements
-Winvalid-png Err Issues arising when processing PNG data
-Winvalid-xml Err XML has syntax errors
-Wmissing-attribute Warn Required attribute missing in XML tag
-Wmissing-offsets Warn Offset attribute missing in XML tag
-Wmissing-segment Warn Segment not given in File tag in XML
-Wnot-implemented Warn ZAPD does not currently support this feature
-Wunaccounted Off Large blocks of unaccounted
-Wunknown-attribute Warn Unknown attribute in XML entry tag

There are also errors that do not have a type, and cannot be disabled.

For example, here we have invoked ZAPD in the usual way to extract using a (rather badly-written) XML, but escalating -Wintersection to an error:

ZAPD warnings example