This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Refactor the LZ tools and fix BSSReader's eval shenanigans. #86
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
"whoops"
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): |
There was a problem hiding this comment.
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.
This is a little closer to the target compressor than before.
Conflicts: pokemontools/gfx.py
kanzure
added a commit
that referenced
this pull request
Mar 12, 2015
Refactor the LZ tools and fix BSSReader's eval shenanigans.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.