pokémon crystal source code - diyhpl -...

21
Pokémon Crystal Source Code https://github.com/kanzure/pokecrystal

Upload: tranthuan

Post on 14-Feb-2018

215 views

Category:

Documents


1 download

TRANSCRIPT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thank you.

https://github.com/kanzure/pokecrystal

irc: nucleus.kafuka.org #skeetendo

irc: #aha

me:

http://heybryan.org/

https://github.com/kanzure