Shipwright/ZAPDTR
briaguya 4166dbf907
spockalicious (#2751)
* Rough mockup of LUS XML loading

* Updated code for merge

* Loading from FS support and custom DList WIP implementation

* Added current directory support to F3D and impl most of the dlist cmds

* WIP Skeleton support

* Almost done

* Rebase fixes

* Submodule updates

* HD Texture Support

* Fixes

* bump lus

* fix exporter build, header update

* soh builds

* setMesh image path cleanup

* Update soh/src/overlays/actors/ovl_player_actor/z_player.c

* Update soh/src/overlays/actors/ovl_player_actor/z_player.c

* Update OTRExporter/OTRExporter/Main.cpp

* Update ZAPDTR/ZAPD/ZResource.h

* Update soh/src/code/z_skelanime.c

* Update OTRExporter/OTRExporter/Main.cpp

* Fixed jpeg backgrounds and decreased icon buffer size

* Bump lus

* Increased even more the buffer because it crashes on long texts

* Removed print because sometimes the if is not triggered when the image is already byteswapped

* fix non-windows build

* fix build

Co-authored-by: Kenix <kenixwhisperwind@gmail.com>

* add hd checkbox

* Various fixes for custom model support (#23)

* Some fixes

* Updated LUS Version

* Fixed issue with Link Skirt on pause menu

* Added CVar for custom link model changes

* Fixed headers

* Additional header fixes

* Tweaks

* Unload HD game assets on scene transition. (#16)

* Unload game assets on scene transition.

* Bump LUS

* Unloads all HD assets on scene transition.

* Only unload hd assets if hd assets are turned on.

* Fixes issues on toggling between HD and non HD assets.

---------

Co-authored-by: briaguya <briaguya@alice>

* fix: actually load hd debug font (#27)

* fix: actually load hd debug font

* toggle debug text correctly

---------

Co-authored-by: briaguya <briaguya>

* Yes. (#28)

* Merge branch 'develop' into dev-to-ghost

* HD Skeleton Swapping and Language Fixes (#32)

* Yes.

* HD Skeleton Swapping and Language Fixes

* Test

* Fixed issues with ganon cape (#34)

* Fixed Bongo Bongo Crash (#35)

* Added HD Assets Toggle (#37)

* Ivan the Fairy - Coop Mode (#36)

* wip

* hookshotable ivan

* added hookshot item

* new items & changes & fixes & restored navi

* farore, din and nayru's spells are done

* fixed slingshot & bow

* added more items supported

* done with all main items

* bug fixes & ready

* added imgui button

* wip

* hookshotable ivan

* added hookshot item

* new items & changes & fixes & restored navi

* farore, din and nayru's spells are done

* fixed slingshot & bow

* added more items supported

* fix own dungeon items on shuffled boss rooms (#2683)

* bump lus (#2692)

* fix: lowercase package names for vcpkg (#2693)

vcpkg was throwing an error `error: invalid character in package name (must be lowercase, digits, '-')`
this updates our calls to `vcpkg_install_packages` to use lowercase package names instead of uppercase

* fix death mountain cloud in rando (#2691)

* Fix: Switch Age No Longer Reloads Start Room (#2679)

* [Reduced Clutter] Disable Hot/Underwater Warning Text (#2684)

* Disable Warning Text

* Moved to Reduced Clutter

* done with all main items

* bug fixes & ready

* fix: process roms in consistent order (#2696)

* chore: move rando savefile setup and document flags (#2697)

* remove rando save init from sram

* move rando savefile init logic and set more flags

* document flags for rando save creation

* Fix: Use correct fps value for frame interpolation with match refresh rate (#2694)

* Fix: Kak GS placement on construction site (#2695)

* added imgui button

* addressed kenix's comments

* fixed useless null

* added rupee dash mode in extra modes

* changed menu position

---------

Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com>

* LUS Scancodes (#42)

* Added HD Assets Toggle

* Switched out SDL for LUS scancodes

* Ivan tweaks (#45)

* Magic consumption slowed down;
Bosses now affected by Ivan's Din spell

* Adjust magic timer

* clean up imgui

* model fixes/improvements (#50)

* replace `gUseCustomLinkModel` with custom resource check

* handle adult/child

* bump lus

* fix model switching with tab

* use lus main

* fix carpet man (#52)

Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>

* get ship model and lus texture into soh.otr, use `gAuthenticLogo` to toggle between ship and authentic (#55)

* Use libultra features for CPU-modified textures (#40)

* Use libultra features for CPU-modified textures

* Comment

* bump lus on ghost (#58)

* fix: properly use `Interface_LoadActionLabel` to display start button text (#61)

* Changes hd -> alt for texture replacement. (#65)

* Changes hd -> alt for texture replacement.

* Renames variables in gfxprint for hd -> alt change.

* Update soh/soh/resource/type/Skeleton.cpp

---------

Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>

* Fixes kaleido dungeon maps (#67)

* skeleton stuff (#69)

* comment out wii u build (#70)

* bump lus (#71)

* Rework readme (#72)

* Update README.md

* docs

* put custom music docs somewhere

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* dark/light title image

* lus

* Update README.md

* Fixed vanilla minimap (#73)

* Fixed vanilla minimap

* Workaround for pulsing SD maps with non-broken HD maps.

---------

Co-authored-by: Christopher Leggett <chris@leggett.dev>

* Skeleton fix fixed (#75)

* WIP skelton patcher fix

* Fixes skeleton reference change.

* Adds const back to name in ResourceMgr_LoadSkeletonByName

---------

Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: Kenix <kenixwhisperwind@gmail.com>

* Fixes z_message_otr memory leak.

* Update soh/soh/z_message_OTR.cpp

* Update soh/src/code/game.c

* docs: add how to find otr files to switch instructions (#78)

* bump lus (#79)

* comment out RegisterBlendedTexture in king d (#80)

---------

Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com>
Co-authored-by: David Chavez <david@dcvz.io>
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com>
Co-authored-by: KiritoDv <kiritodev01@gmail.com>
Co-authored-by: briaguya <briaguya>
Co-authored-by: Ralphie Morell <stratomaster64@gmail.com>
Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com>
Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com>
Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>
Co-authored-by: Christopher Leggett <chris@leggett.dev>
Co-authored-by: Lywx <36680385+KiritoDv@users.noreply.github.com>
2023-04-27 19:20:41 -04:00
..
docs Update XMLs from upstream (#1448) 2022-09-18 23:29:24 -04:00
ExporterTest Linux/GCC Support (#28) 2022-05-11 13:18:24 -04:00
lib Add Support for macOS (#441) 2022-06-22 14:59:21 -04:00
ZAPD spockalicious (#2751) 2023-04-27 19:20:41 -04:00
.clang-format git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00
.gitignore git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00
.gitrepo git subrepo push ZAPDTR 2022-12-20 02:54:33 +01:00
copycheck.py git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00
Jenkinsfile git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00
LICENSE git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00
README.md git subrepo clone https://github.com/HarbourMasters/ZAPDTR.git 2022-03-22 02:54:48 +01:00

ZAPD: Zelda Asset Processor for Decomp

Compiling

Dependencies

ZAPD needs a compiler with C++17 support.

ZAPD has the following library dependencies:

  • libpng

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 clasic 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:

  • OPTIMIZATION_ON: If set to 0 optimizations will be disabled (compile with -O0). Any other value compiles with -O2. Defaults to 1.
  • ASAN: If it is set to a non-zero then ZAPD will be compiled with Address Sanitizer enabled (-fsanitize=address). Defaults to 0.
  • DEPRECATION_ON: If it is set to a zero then deprecation warnings will be disabled. Defaults to 1.
  • DEBUG: If non-zero, ZAPD will be compiled in development mode. This implies the following:
    • Debugging symbols enabled (-g3). They are disabled by default.
    • OPTIMIZATION_ON=0: Disables optimizations (-O0).
    • DEPRECATION_ON=0: Disables deprecation warnings.
  • LLD=1: builds with the LLVM linker ld.lld instead of the system default.

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:

  • e: "Extraction" mode.
    • In this mode, ZAPD expects a XML file as input, a folder as ouput and a path to the baserom files.
    • ZAPD will read the XML and use it as a guide to extract the contents of the specified asset file from the baserom folder.
  • bsf: "Build source file" mode.
    • This is an experimental mode.
    • It was going to be used to let you have XMLs that aren't just for extraction. Might get used, might not. Still need to experiment on that.
  • btex: "Build texture" mode.
    • In this mode, ZAPD expects a PNG file as input, a filename as ouput and a texture type parameter (-tt).
    • ZAPD will try to convert the given PNG into the contents of a uint64_t C array.
  • bren: "Build (render) background" mode.
    • In this mode, ZAPD expects a JPG file as input and a filename as ouput.
    • ZAPD will try to convert the given JPG into the contents of a uint64_t C array.
  • blb: "Build blob" mode.
    • In this mode, ZAPD expects a BIN file as input and a filename as ouput.
    • ZAPD will try to convert the given BIN into the contents of a uint8_t C array.
  • bovl: "Build overlay" mode.
    • In this mode, ZAPD expects an overlay C file as input, a filename as ouput and an overlay configuration path (-cfg).
    • ZAPD will generate a reloc .s file.

ZAPD also accepts the following list of extra parameters:

  • -i PATH / --inputpath PATH: Set input path.
  • -o PATH / --outputpath PATH: Set output path.
  • -b PATH / --baserompath: Set baserom path.
    • Can be used only in e or bsf modes.
  • -osf PATH: Set source output path. This is the path where the .c and .h files will be extracted to. If omitted, it will use the value passed to --outputpath parameter.
  • -gsf MODE: Generate source file during extraction. If MODE is 1, C source files will be generated.
    • Can be used only in e mode.
  • -crc / --output-crc: Outputs a CRC file for each extracted texture.
    • Can be used only in e or bsf modes.
  • -ulzdl MODE: Use "Legacy ZDisplayList" instead of libgfxd. Set MODE to 1 to enable it.
    • Can be used only in e or bsf modes.
  • -profile MODE: Enable profiling. Set MODE to 1 to enable it.
  • -uer MODE: Split resources into their individual components (enabled by default). Set MODE to non-1 to disable it.
  • -tt TYPE: Set texture type.
    • Can be used only in mode btex.
    • Valid values:
      • rgba32
      • rgb5a1
      • i4
      • i8
      • ia4
      • ia8
      • ia16
      • ci4
      • ci8
  • -cfg PATH: Set cfg path (for overlays).
    • Can be used only in bovl mode.
  • -rconf PATH Read Config File.
  • -eh: Enable error handler.
    • Only available in non-Windows environments.
  • -v MODE: Enable verbosity. Currently there are 3 possible values:
    • 0: Default. Completely silent (except for warnings and errors).
    • 1: Information.
    • 2 (and higher): Debug.
  • -wu / --warn-unaccounted: Enable warnings for each unaccounted block of data found.
    • Can be used only in e or bsf modes.
  • -vu / --verbose-unaccounted: Changes how unaccounteds are outputted. Max 4 bytes per line (a word) and add a comment with the offset of each of those lines.
    • Could be useful for looking at raw data or testing.
    • Can be used only in e or bsf modes.
  • -tm MODE: Test Mode (enables certain experimental features). To enable it, set MODE to 1.
  • -se / --set-exporter : Sets which exporter to use.
  • --gcc-compat : Enables GCC compatibly mode. Slower.
  • -us / --unaccounted-static : Mark unaccounted data as static
  • -s / --static : Mark every asset as static.
    • This behaviour can be overridden per asset using Static= in the respective XML node.
  • -W...: warning flags, see below

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:

  • Off (does not display anything)
  • Warn (print a warning but continue processing)
  • Err (behave like an error, i.e. print and throw an exception to crash ZAPD when occurs)

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

  • -Wfoo enables warnings of type foo
  • -Wno-foo disables warnings of type foo
  • -Werror=foo escalates foo to behave like an error
  • -Weverything enables all warnings (they may be turned off using -Wno- flags afterwards)
  • -Werror escalates all enabled warnings to errors

All warning types currently implemented, with their default levels:

Warning type Default level Description
-Wdeprecated Warn Deprecated features
-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