NEstelami / ZAPD

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

ZAPD can't handle CI formats where the palette and textures are in different files #158

Closed Dragorn421 closed 2 years ago

Dragorn421 commented 3 years ago

Example: many in deku tree, eg CI8 texture in room 0 at 0xE1C0 uses palette in scene file at 0xB810

Idea on how to solve: I am not familiar with the code base, but I think TlutOffset should be gotten rid of and replaced with just a Tlut attribute that would point to the right palette using the Name attribute of the Texture node used in the xml file to describe it. This could work in my mind because in the oot decomp repo the scene and map files are all in a single xml

Example of above idea with above example:

<Root>
    <File Name="ydan_scene" Segment="2">
        <Scene Name="ydan_scene"/>
        <Texture Name="dekuTreeWallTexTLUT" OutName="dekuTreeWallTexTLUT" Format="rgba16" Width="256" Height="1" Offset="0xB810"/>
    </File>
    <File Name="ydan_room_0" Segment="3">
        <Room Name="ydan_room_0" Offset="0x0"/>
        <Texture Name="dekuTreeWallTex" OutName="dekuTreeWallTex" Format="ci8" Width="32" Height="64" Offset="0xE1C0" Tlut="dekuTreeWallTexTLUT"/>
    </File>
    <!-- ... other rooms ... -->
</Root>
AngheloAlf commented 3 years ago

Nice suggestion, but ZAPD works mostly by handling the assets by their offsets. That's the reason TlutOffset exists. Changing this to support searching by asset name may not be that easy to implement, or at least not trivial.

One way I can think of to implement this would be extending TlutOffset so it can use segmented addresses too. Considering your example it would work like:

        <Texture Name="dekuTreeWallTex" OutName="dekuTreeWallTex" Format="ci8" Width="32" Height="64" Offset="0xE1C0" TlutOffset="0x0200B810"/>