Pokémon Crystal Source Code - diyhpl -...
Transcript of Pokémon Crystal Source Code - diyhpl -...
![Page 1: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/1.jpg)
Pokémon CrystalSource Code
https://github.com/kanzure/pokecrystal
![Page 2: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/2.jpg)
Prism (Why?)
http://www.rijon.com/prism/
![Page 3: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/3.jpg)
Goals
● Must compile back to the original ROM (byte-exact)
● Must be commented and understandable● Must separate code/data● No “dump-and-run”● Eventually: don't require the original ROM● Have fun
![Page 4: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/4.jpg)
IsInArray
![Page 5: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/5.jpg)
Multiply
![Page 6: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/6.jpg)
AddNTimes
![Page 7: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/7.jpg)
Map scripts
![Page 8: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/8.jpg)
Compiling
● rgbds● rgbasm ● z80asm.hs (in progress)● Custom preprocessor in awk (deprecated)● Custom preprocessor in python
![Page 9: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/9.jpg)
gbz80disasm
● Custom disassembler● Written in python● Symbol files● Stops at the end of functions● Could be used for other gb/gbc games
![Page 10: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/10.jpg)
crystal.py
● Grab bag of wonderful tools● Parsers of all sorts:
– Scripts
– Encoded text
– Asm output, for bulk disassembling all scripts associated with maps
– Automatic asm insertion into main.asm
● Almost complete unit testing coverage
![Page 11: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/11.jpg)
png.py
● ROM has compressed graphics● Decompression: yep● Compression: definitely● png support: yes● 2bpp● Things:
– Tilesets
– Palettes
– Backpics & frontpics
– Sprites
– Icons... etc.
![Page 12: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/12.jpg)
Music parser and dumper
![Page 13: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/13.jpg)
Bugcatcher
● IRC bot● Yells at you● Uses quotes from trainers inside the game
![Page 14: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/14.jpg)
vba-clojure / vba-linux
● Fork of vba-rerecording, which is a fork of vba● JVM bindings● Clojure!● Jython!● Cool functions: warp to any map, breakpoints,
watchpoints, screenshots, animated gifs
![Page 15: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/15.jpg)
Jython tool – keyboard optimizer● I like typing fast● Never really sure which way to go to type a
letter● Represent keyboard as graph, find shortest
sequence of possible button presses to type string.
![Page 16: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/16.jpg)
Weird stuff
● HTTP client (not disassembled)● SMTP client (not disassembled)
![Page 17: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/17.jpg)
Having fun, 1
![Page 18: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/18.jpg)
Having fun, oops
![Page 19: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/19.jpg)
Call graph
![Page 20: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/20.jpg)
Progress (Red)
http://diyhpl.us/~bryan/irc/pokered/result2.gif
![Page 21: Pokémon Crystal Source Code - diyhpl - diyhpluswikidiyhpl.us/~bryan/irc/pokecrystal/aha-pokemon-crystal.pdf · Goals Must compile back to the original ROM (byte-exact) Must be commented](https://reader031.fdocuments.net/reader031/viewer/2022030407/5a842f577f8b9aa5408b7d9a/html5/thumbnails/21.jpg)
Thank you.
https://github.com/kanzure/pokecrystal
irc: nucleus.kafuka.org #skeetendo
irc: #aha
me:
http://heybryan.org/
https://github.com/kanzure