项目作者: tgorochowik

项目描述 :
Extract and manipulate strings found in Pokemon ROMs.
高级语言: Python
项目地址: git://github.com/tgorochowik/pokestrings.git
创建时间: 2021-04-26T19:45:59Z
项目社区:https://github.com/tgorochowik/pokestrings

开源协议:MIT License

下载


pokestrings utilities

This repository contains small Pokemon string manipulation utilities.

pokestrings can be used to find string sequences in Pokemon ROMs (GB and GBC is supported).

pokecodec can be used to encode and decode arbitrary hex sequence to and from Game Boy Pokemon encodings.

installation

The easiest way to install this is using pip:

  1. pip install git+https://github.com/tgorochowik/pokestrings --user

Running without installation is also possible:

  1. python -m pokestrings strings # to run pokestrings
  2. python -m pokestrings codec # to run pokecodec

To run tests locally (not against the installed package), use:

  1. python -m pytest tests/

pokestrings

  1. $ pokestrings --help
  2. usage: pokestrings [-h] [--generation GENERATION] [--bytes BYTES] [--show-offset] [--e-acute] [--no-reduce] file
  3. Extract strings from Pokemon ROMs.
  4. positional arguments:
  5. file
  6. optional arguments:
  7. -h, --help show this help message and exit
  8. --generation GENERATION, -g GENERATION
  9. game generation, supported generations: 1 (GB), 2 (GBC) (default: 1)
  10. --bytes BYTES, -n BYTES
  11. number of minimum consecutive characters to be printed (default: 4)
  12. --show-offset, -o print the offset before each string (default: False)
  13. --e-acute, -e do not convert é to regular e (default: False)
  14. --no-reduce do not reduce multiple consecutive 0xff chars (encoding for 9) (default: True)

Example usage:

  1. $ pokestrings pokered.gbc | grep -i slowpoke -a2
  2. FEAROW
  3. PIDGEY
  4. SLOWPOKE
  5. KADABRA
  6. GRAVELER
  7. --
  8. even now!
  9. We nicknamed the
  10. WARDEN SLOWPOKE.
  11. He and SLOWPOKE
  12. both lok vacant!
  13. SLOWPOKE is very
  14. knowledgeable
  15. about PokeMON!
  16. --
  17. fosils of rare,
  18. extinct PokeMON!
  19. SLOWPOKE came in,
  20. but I couldnt
  21. understand him.
  22. --
  23. young in a pouch
  24. on its bely.
  25. Name: SLOWPOKE
  26. Friendly and very
  27. slow moving.
  28. --
  29. The SHELDER that
  30. is latched onto
  31. SLOWPOKEs tail
  32. is said to fed
  33. on the hosts left

pokecodec

  1. pokecodec --help
  2. usage: pokecodec [-h] [--generation GENERATION] (--decode | --encode) data
  3. Decode and encode Pokemon strings.
  4. positional arguments:
  5. data
  6. optional arguments:
  7. -h, --help show this help message and exit
  8. --generation GENERATION, -g GENERATION
  9. game generation, supported generations: 1 (GB), 2 (GBC) (default: 1)
  10. --decode, -d hex data to decode (default: False)
  11. --encode, -e string to encode as hex data (default: False)

Example usage:

  1. $ pokecodec -e "This is awesome!"
  2. 93a7a8b27fa8b27fa0b6a4b2aeaca4e7
  3. $ pokecodec -d 93a7a8b27fa8b27fa0b6a4b2aeaca4e7
  4. This is awesome!

Python library

Both the codec and scanner can be used as a library.