pret / pokecrystal

Disassembly of Pokémon Crystal
https://pret.github.io/pokecrystal/
2.1k stars 795 forks source link

gfx.py produces an "undefined global" on recompressing front pics #339

Closed MissingNoGuy55 closed 7 years ago

MissingNoGuy55 commented 8 years ago

This seems to be an odd problem I've been having, not sure if it's just me? Also using gfx.py in the root directory.

$ python gfx.py 2bpp gfx/pics/moltres/front.png Traceback (most recent call last): File "gfx.py", line 171, in main(_get_args().dict) File "gfx.py", line 161, in main method(filename, _args) File "gfx.py", line 121, in to_2bpp elif ext == '.png': gfx.export_png_to_2bpp(filename, *kwargs) File "/cygdrive/c/Users/Missing/Dropbox/private stuff/disassembly_projects/pokecrystal/extras/pokemontools/gfx.py", line 532, in export_png_to_2bpp frame_text, bitmask_text = get_pic_animation(tmap, arguments['pic_dimensions']) NameError: global name 'get_pic_animation' is not defined

yenatch commented 8 years ago

Thanks for catching this.

yenatch commented 8 years ago

By the way, you're going to get errors about the new pics being too big. This is normal. Our compressor is not very effective. The only other one we've found is Lunar Compress, which is closed source.

In the meantime, you'll need to move the new pics into another bank. Crystal has some checks in place to keep you from using banks other than the ones already designated in gfx/pics.asm, so I suggest clearing out Pics 19.

MissingNoGuy55 commented 8 years ago

Alright, I'll do that and get back to you on it. Thanks.

MissingNoGuy55 commented 8 years ago

Hello again, I moved them to Pics 19 and it's working out. I'm still getting the python error after updating the files though with gfx.py which is the only obstacle with recompressing the front sprites; it's the same error, too.

yenatch commented 8 years ago

The commits weren't tagged, but you want to be at c5fb2c947ffcdd0ddd80319a24a6acbe828d9598 at least

MissingNoGuy55 commented 8 years ago

That worked, thank you. I forgot to update the reverse engineering tools.

MissingNoGuy55 commented 8 years ago

Also, any idea why my sprites look like this? It's supposed to be MissingNo and the sprite is 56x96 as it should be.

bgb00010

yenatch commented 8 years ago

Off the top of my head, there are two things.

  1. The game totally ignores the pic height in base stats when unrolling it. It assumes the width is also the height.
  2. The png code for pokemon pics also does this to figure out animations, but using the png width. This is probably less desirable. You can either add an edge case in gfx.py:filepath_rules or move the image to a different directory (all it does is check that it's in gfx/pics/*/).
  3. The box there is only 56x72.
yenatch commented 7 years ago

gfx.py is no longer used for compression.