Code Monkey home page Code Monkey logo

pokemon-reverse-engineering-tools's People

Contributors

cnelsonsic avatar dannye avatar eevee avatar huderlem avatar iimarckus avatar kanzure avatar katlabs avatar luckytyphlosion avatar sanqui avatar yenatch avatar zmarvel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pokemon-reverse-engineering-tools's Issues

SyntaxError: invalid syntax, File "extras/pokemontools/gfx.py", line 71

Not sure which repo to post this issue in. I'm using pret/pokemontcg but the issue is happening in pret/pokemon-reverse-engineering-tools or extras submodule.

Upon running make I get this error:

  File "extras/pokemontools/gfx.py", line 71
    tiles = sorted(enumerate(tiles), key= lambda (i, tile): i % width)
                                                 ^
SyntaxError: invalid syntax
Makefile:20: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1

But i see that the current extras is referencing an old version of pokemon-reverse-engineering-tools. Maybe I can update it to the newest version or perhaps the whole project has been abandoned in which case I shouldn't really do much with it.

pcm.py should handle arbitrary .wav files

Currently, it assumes the .wav file has a sample rate of 22050, a sample width of 1 byte, and 1 channel. It should be able to at least handle arbitrary sample rates and sample widths.

dump_sections.py doesn't calculate last_bank

$ python dump_sections.py
Traceback (most recent call last):
  File "dump_sections.py", line 126, in <module>
    output = dump_sections(baserom)
  File "dump_sections.py", line 83, in dump_sections
    last_bank = calculate_bank_quantity(path, bank_size=bank_size)
  File "dump_sections.py", line 46, in calculate_bank_quantity
    return float(os.lstat(path).st_size) / bank_size
OSError: [Errno 2] No such file or directory: 'baserom.gbc'

and then:

$ python dump_sections.py
Traceback (most recent call last):
  File "dump_sections.py", line 126, in <module>
    output = dump_sections(baserom)
  File "dump_sections.py", line 92, in dump_sections
    banks = range(initial_bank, last_bank)
TypeError: range() integer end argument expected, got float.

wtf?


Above report is from pokecrystal issue 141.

gfx.py does not check for .pal files when building .2bpp

When rebuilding .2bpp files in pokecrystal/gfx/pics, gfx.py does not take into account the presence of a .pal file. Instead, it completely overwrites the existing file, resulting in a garbage build. It also overwrites the bitmask.asm and frames.asm files, which breaks pic animations.

rgbds-style inline macro definitions

Currently, adding and using a new macro in kanzure/pokecrystal requires the user to add a class to pokemontools/crystal.py.

Sometimes using a macro is the easiest way to arrange arbitrary data structures. For that purpose the macro does not need to be persistent and is best defined inline. bentley/rgbds already lets you do this, like so:

move: MACRO
        db \1 ; animation
        db \2 ; effect
        db \3 ; power
        db \4 ; type
        db \5 * $ff / 100 ; accuracy (percent)
        db \6 ; pp
        db \7 * $ff / 100  ; effect chance (percent)
ENDM
        move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0

Apparently depending on rgbds is undesirable, and depending on pokemontools is not. In that case, this should be implemented in pokemontools.

Store which params were used to generate .sav files

Not all .sav files are created the same. The decorator should save in a metadata file an entry about what parameters were used when calling a function. Then, when loading a save state to skip a function, only load a save state that matches the parameters. If that combination of parameters hasn't been played and saved yet, then play it.

There might be parameters that don't influence the save state structure, in which case, the skippable decorator should be given a list of which params don't matter.

@skippable(ignore=["some_param"])
def play_part5(self, some_param=None):

Make the tests use sample asm files

Some of the tests work against asm files from kanzure/pokecrystal and therefore fail because the files aren't present.

Instead of copying the asm files into the repo, make a tests/data/ folder with sample asm for each of the different situations that get tested.

README doesn't describe the current project

The README is falling behind. The current README is a leftover from pokecrystal/extras/README.md back when everything was shoved into the extras/ path in pokecrystal.

Things the README should include:

  • installation via pip
  • use of pokemontools in pokered and pokecrystal
  • use of pokemontools outside of pokered/pokecrystal
  • organization of the project
  • how to run the tests
  • licensing status
  • calling preprocessor
  • calling gbz80disasm

gbz80disasm.py not working for pokered

$ python extras/pokemontools/gbz80disasm.py 48c19
Traceback (most recent call last):
File "extras/pokemontools/gbz80disasm.py", line 934, in
disasm.initialize()
File "extras/pokemontools/gbz80disasm.py", line 619, in initialize
self.wram.initialize()
File "/home/Daniel/pokered/extras/pokemontools/wram.py", line 108, in initialize
self.setup_hram_constants()
File "/home/Daniel/pokered/extras/pokemontools/wram.py", line 149, in setup_hram_constants
self.hram_constants = self.read_hram_constants()
File "/home/Daniel/pokered/extras/pokemontools/wram.py", line 142, in read_hram_constants
hram_constants = read_constants(self.paths["hram"])
File "/home/Daniel/pokered/extras/pokemontools/wram.py", line 80, in read_constants
with open(filepath, "r") as file_handler:
IOError: [Errno 2] No such file or directory: '/home/Daniel/pokered/hram.asm'
Aborted (core dumped)

Don't use eval() in read_bss_sections

kanzure@deathfortress:~/code/pokecrystal$ python extras/pokemontools/gbz80disasm.py 0x45f
Traceback (most recent call last):
  File "extras/pokemontools/gbz80disasm.py", line 934, in <module>
    disasm.initialize()
  File "extras/pokemontools/gbz80disasm.py", line 619, in initialize
    self.wram.initialize()
  File "/home/kanzure/code/pokecrystal/extras/pokemontools/wram.py", line 106, in initialize
    self.setup_wram_sections()
  File "/home/kanzure/code/pokecrystal/extras/pokemontools/wram.py", line 128, in setup_wram_sections
    self.wram_sections = self.read_wram_sections()
  File "/home/kanzure/code/pokecrystal/extras/pokemontools/wram.py", line 121, in read_wram_sections
    wram_sections = read_bss_sections(wram_content)
  File "/home/kanzure/code/pokecrystal/extras/pokemontools/wram.py", line 48, in read_bss_sections
    length = eval(line[3:line.find(';')].replace('$','0x'))
  File "<string>", line 1, in <module>
NameError: name 'OBJECT_LENGTH' is not defined

Using eval is wrong many times over. Let's use something else.

BSSReader reads literally everything

Not sure if this is a problem in my OS but a preprocessor somehow don't let me make it with this error:

Traceback (most recent call last):
    File "prequeue.py", line 11, in <module>
        import preprocessor
    File "/home/pigu/pokecrystal/preprocessor.py", line 30, in <module>
    from extras.pokemontools.battle_animations import (
    File "/home/pigu/pokecrystal/extras/pokemontools/battle_animations.py", line 43, in <module>
        objs  = { k: v for k, v in anims.items() if 'ANIM_OBJ' in v }
    File "/home/pigu/pokecrystal/extras/pokemontools/battle_animations.py", line 43, in <dictcomp>
        objs  = { k: v for k, v in anims.items() if 'ANIM_OBJ' in v }
TypeError: argument of type 'int' is not iterable

So I decided to print anims variable, it appears that it contains constant entries and every Python builtins entries as well...

http://pastebin.com/3nWbPHjK

So, is there a way to work around this problem?

PNG signature error on Windows

From 94d767f16157de2a1c6bd000687c39e0fefd3d12 Mon Sep 17 00:00:00 2001
From: Tauwasser <[email protected]>
Date: Sun, 28 Feb 2016 23:14:53 +0100
Subject: [PATCH] gfx.py: PNGs should be opened in binary mode

PNG files were opened as text files, thus the signature 0x0D 0x0A bytes were swallowed depending on OS.

Signed-off-by: Tauwasser <[email protected]>

---
 pokemontools/gfx.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pokemontools/gfx.py b/pokemontools/gfx.py
index 3f221d6..6f78b7f 100644
--- a/pokemontools/gfx.py
+++ b/pokemontools/gfx.py
@@ -594,7 +594,7 @@ def png_to_2bpp(filein, **kwargs):
     arguments.update(kwargs)

     if type(filein) is str:
-        filein = open(filein)
+        filein = open(filein, 'rb')

     assert type(filein) is file

-- 

Error on Recompiling with gfx.py

I found your handy source code and followed the instructions but when compiliing I get this error involving gfx.py here's what the terminal tells me...

$ make
Traceback (most recent call last):
File "extras/pokemontools/gfx.py", line 1442, in
main()
File "extras/pokemontools/gfx.py", line 1438, in main
method(args.filenames)
File "extras/pokemontools/gfx.py", line 1366, in convert_to_2bpp
export_png_to_2bpp(filename)
File "extras/pokemontools/gfx.py", line 994, in export_png_to_2bpp
image, arguments = png_to_2bpp(filein, *arguments)
File "extras/pokemontools/gfx.py", line 1073, in png_to_2bpp
width, height, rgba, info = png.Reader(filein).asRGBA8()
AttributeError: 'module' object has no attribute 'Reader'
Makefile:79: recipe for target 'red/main.o' failed
make: *
* [red/main.o] Error 1

I'm not sure what the issue is, normally I'm decent at deciphering code but this one has me stumped.

Consolidate label-processing code

The label processing code in extras/ is getting ridiculous. There are a few separate locations where label processing code is implemented:

  • class Label in crystal.py
  • miscellaneous functions in crystal.py
  • various unit tests in crystal.py
  • labels.py
  • class RomStr in romstr.py

These should be consolidated and merged into one location. I bet there might even be one or two functions that are conceptually similar.


Above issue is from pret/pokecrystal#37

Tests should pass

The tests aren't passing and this is bad. Needs to be fixed very soon.

lz compression bug. Reverse command is broken.

When I was making my own crystal hack, I noticed that the logo have a problem.

This logo is a compressed graphics, so I decided to dump this file to see what command that caused this problem and found out that all of the problem pixels are the part of reverse (0x6) command.

I tried to make the compression routine in gfx.py to not to score and do the reverse command then compress it. No problems found.

I concluded that there was a problem in reverse compression routine in gfx.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.