Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Refactor the LZ tools and fix BSSReader's eval shenanigans. #86

Merged
merged 14 commits into from
Mar 12, 2015

Conversation

yenatch
Copy link
Contributor

@yenatch yenatch commented Dec 12, 2014

  • Relatively more accurate compression
  • Generate relevant pic animation data (frames.asm, bitmask.asm) from images
  • gfx.yaml

re BSSReader: Obviously the correct solution (besides ditching eval) is to occupy the __builtins__ key. So that all keys can be real constants (i.e. when reversing the dict, as in #85) the dict is instead copied when passed into eval. In retrospect, the __builtins__ key could just be removed once BSSReader is done.

Accidentally forgot to zfill either half of pointer_part, which would return malformed addresses.

Fixes de39f7c.
Speed, readability, accuracy and compression are all improved.

Also fix an off-by-one error in repeat commands in the compressor.
Eval should really not be used in the first place, but at least it works again.

Fixes 82b78e5, which replaced the constants_to_dict method with BSSReader.
Truncate colors in a palette beyond the limit of 4.

Make palette sorting more accurate by taking the sum of the hues rather than by luminance. Ultimately, palette order is up to the whim of whoever was drawing in the tile editor at the time, but this is a reasonable estimation.
Keys count both as path nodes and attributes depending on context.

An example gfx.yaml:

```
gfx:
    pics:
        pal_file: normal.pal
        pic_dimensions: yes
        animate: yes
        stupid_bitmask_hack: [dewgong, lugia]
    pc:
        literal_only: yes
```

Here, all graphics matching gfx/pics/.../*.png will use palette gfx/pics/.../normal.pal and be interpreted as animated pics. gfx/pc.2bpp will compress using only the `literal` command.

If gfx.yaml doesn't exist, current behavior is unchanged. Filename arguments override yaml.
return asms


def parse(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parse should have a docstring.

kanzure added a commit that referenced this pull request Mar 12, 2015
Refactor the LZ tools and fix BSSReader's eval shenanigans.
@kanzure kanzure merged commit 46492bd into pret:master Mar 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants