This commit is contained in:
Sanky 2013-05-07 14:23:10 +02:00
commit acdb00c5dc
215 changed files with 28769 additions and 2363 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# No monkey business with line endings
* -text

6
.gitignore vendored
View File

@ -26,8 +26,10 @@ extras/*.json
# for any of the poor souls with save game files in their working directory
baserom.sgm
baserom.sav
pokered.sgm
pokered.sav
baserom.rtc
pokecrystal.sgm
pokecrystal.sav
pokecrystal.rtc
# for vim configuration
# url: http://www.vim.org/scripts/script.php?script_id=441

View File

@ -1,4 +1,21 @@
# Linux
# Getting Started
Compiling requires a certain Pokemon Crystal ROM:
```
Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc
md5: 9f2922b235a5eeb78d65594e82ef5dde
```
Save it as `baserom.gbc` in the repository.
Feel free to ask us on nucleus.kafuka.org #skeetendo if something goes wrong (remember to tell where)!
Don't know how to use IRC? Try [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo).
## Linux
```bash
sudo apt-get install make gcc bison git python python-setuptools
@ -24,153 +41,38 @@ cd pokecrystal
# install python requirements
pip install -r requirements.txt
```
To compile the ROM from ASM source:
```
make clean && make
```
# Windows
Follow these instructions to install `pokecrystal` on Microsoft Windows. Once
installed, you can run `make` to compile `main.asm` into a ROM.
## Installing cygwin
Cygwin provides a virtual linux environment on Windows systems. Just get
`setup.exe`: http://cygwin.com/install.html
During the install:
1. Keep the defaults.
2. It shouldn't matter which mirror you choose, but http://mirrors.kernel.org
seems to work.
3. Select the packages listed below.
You'll be presented with a package selection screen. Select the following
packages (hint: there's a search box).
1. `python` (installed by default)
2. `gcc` and `gcc-core` (under devel)
3. `byacc` (under devel)
4. `make` (under devel)
5. `wget` (under web)
6. `git` (under devel)
7. `mercurial` (optional, if you wish to work with pokered as well)
Let cygwin finish the install. Might take a sec while all packages are
downloading.
## Installing other requirements
Launch cygwin (bash). Maybe you know your way around the linux terminal. If not, a
crash course:
```bash
# list files in current directory
ls
# show current directory
pwd
# change directory
cd /away/we/go
```
The next step is building `rgbds`, the GB assembler. Type:
```bash
# download rgbds source code
git clone git://github.com/bentley/rgbds.git
# compile rgbds
cd rgbds
YACC=byacc make
# make rgbds accessible for all time
export PATH=$PATH:`pwd`
echo "export PATH=$PATH:`pwd`" >> ~/.bashrc
# check if rgbasm is installed now
which rgbasm
```
If that fails (it shouldn't), you can download binaries like so:
```bash
# download rgbds binaries
wget http://diyhpl.us/~bryan/irc/pokered/rgbds/rgbds.zip --output-document=rgbds.zip
# unzip
unzip rgbds.zip
# make rgbds accessible for all time
export PATH=$PATH:`pwd`/rgbds
echo "export PATH=$PATH:`pwd`/rgbds" >> ~/.bashrc
# clean up that zip file
rm rgbds.zip
```
The next step is to install `unittest2`, unless you installed python2.7
earlier:
```bash
cd ~
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
easy_install unittest2
```
Now you should be able to build `pokecrystal` for the first time:
```bash
cd ~
git clone git://github.com/kanzure/pokecrystal.git
cd pokecrystal
```
The final requirement is downloading a certain Pokemon Crystal ROM:
```
Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc
md5: 9f2922b235a5eeb78d65594e82ef5dde
```
Save it as `C:\cygwin\home\(your username)\pokecrystal\baserom.gbc`. You can
check the md5 of a file by typing `md5sum baserom.gbc`.
To compile the ROM from ASM source, type:
```bash
make
```
That will take between 3 and 15 seconds, depending on your computer. If you see
`cmp baserom.gbc pokecrystal.gbc` as the last line, the build was successful!
Rejoice!
`cmp baserom.gbc pokecrystal.gbc` as the last line, the build was successful! Rejoice!
Now you may try messing around with `main.asm`, or just do whatever you wanted
to.
To build again, you should use the following command:
## Windows
```bash
make clean && make
```
Set up [GitHub for Windows](http://windows.github.com/) and clone this repository.
Feel free to ask us on nucleus.kafuka.org #skeetendo if something goes wrong
(remember to tell where)! Don't know how to use IRC? Try
[mibbit](http://mibbit.com/) or something.
If you haven't already, get [Python 2.7](http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi) ([64-bit](http://www.python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi)).
# Contributing changes
Extract the following files from the [RGBDS](https://github.com/downloads/bentley/rgbds/rgbds-0.0.1.zip) package into the repository:
`rgbasm.exe`
`rgbds.exe`
`rgbfix.exe`
`rgblink.exe`
## Setting up a public git repo
Install [make](http://gnuwin32.sourceforge.net/downlinks/make.php) for Windows.
To compile the ROM from ASM source, run `pokecrystal.bat`.
That will take between 3 and 15 seconds, depending on your computer. If you see
`FC: no differences encountered`, the build was successful! Rejoice!
Now you may try messing around with `main.asm`, or just do whatever you wanted to.
# Contributions are welcome!
For those uninitiated with git-based collaboration, and who do not want to setup a server to host git repositories, use GitHub. Register on GitHub and follow [this tutorial to setup ssh keys](https://help.github.com/articles/generating-ssh-keys). Then go to [the pokecrystal repo](https://github.com/kanzure/pokecrystal) and click the giant "fork" button. This will bring you to a page with some instructions regarding `git remote` (follow these steps in your pokecrystal folder).

View File

@ -1,6 +1,7 @@
.SUFFIXES: .asm .tx .o .gbc .png .2bpp .lz
TEXTFILES = text/sweethoney.tx \
TEXTFILES = \
text/sweethoney.tx \
text/phone/bill.tx \
text/phone/elm.tx \
text/phone/mom.tx \
@ -10,7 +11,8 @@ TEXTFILES = text/sweethoney.tx \
text/common_3.tx \
main.tx
VERTGFX = gfx/pics/%.png \
VERTGFX = \
gfx/pics/%.png \
gfx/trainers/%.png
HORIZGFX = $(filter-out gfx/%.png, $(VERTGFX))
@ -24,10 +26,16 @@ HORIZGFX = $(filter-out gfx/%.png, $(VERTGFX))
# so take care to reorganize accordingly
all: pokecrystal.gbc
cmp baserom.gbc $<
win: pokecrystal.gbc
fc baserom.gbc $<
clean:
rm -f main.tx pokecrystal.o pokecrystal.gbc ${TEXTFILES}
winclean:
del main.tx pokecrystal.o pokecrystal.gbc .\text\sweethoney.tx .\text\phone\bill.tx .\text\phone\elm.tx .\text\phone\mom.tx .\text\phone\trainers1.tx .\text\common.tx .\text\common_2.tx .\text\common_3.tx
pokecrystal.o: pokecrystal.asm constants.asm wram.asm ${TEXTFILES}
rgbasm -o pokecrystal.o pokecrystal.asm
@ -38,21 +46,20 @@ pokecrystal.o: pokecrystal.asm constants.asm wram.asm ${TEXTFILES}
pokecrystal.gbc: pokecrystal.o
rgblink -o $@ $<
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
cmp baserom.gbc $@
lzs: ${VERTGFX} ${HORIZGFX}
pngs:
cd extras; python gfx.py mass-decompress; python gfx.py dump-pngs
cd extras && python gfx.py mass-decompress && python gfx.py dump-pngs
front.png: tiles.png
cd extras; python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp
cd extras && python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp
tiles.png:
cd extras; python gfx.py png-to-2bpp $@
.png: ${VERTGFX}
cd extras; python gfx.py png-to-lz --vert $@
.png: ${HORIZGFX}
cd extras; python gfx.py png-to-lz $@
cd extras && python gfx.py png-to-2bpp $@
.png:: ${VERTGFX}
cd extras && python gfx.py png-to-lz --vert $@
.png:: ${HORIZGFX}
cd extras && python gfx.py png-to-lz $@

View File

@ -4,65 +4,30 @@ This is a hand-crafted disassembly of Pokémon Crystal.
The source code in this project successfully converts back into a ROM image. All source code is meticulously commented.
## Base ROM
The following ROM is required for compiling:
```
Pokemon - Crystal Version (UE) (V1.0) [C][!].gbc
md5: 9f2922b235a5eeb78d65594e82ef5dde
```
Eventually this will not be necessary.
## Installing
Simple.
``` bash
sudo apt-get install make gcc bison git python python-setuptools
# unittest2 is required if using python2.6
sudo easy_install unittest2
sudo easy_install pip
# download rgbds source code
git clone git://github.com/bentley/rgbds.git
# compile rgbds
cd rgbds
make
sudo make install
# check if rgbasm is installed now
which rgbasm
# download pokecrystal
git clone https://github.com/kanzure/pokecrystal.git
cd pokecrystal
pip install -r requirements.txt
make clean && make
```
Also, there are [Windows installation instructions](https://github.com/kanzure/pokecrystal/blob/master/INSTALL.md).
## Assembling
* To assemble, first install RGBDS and put it in your path. The version of RGBDS needed is [rgbds-linux](https://github.com/bentley/rgbds/).
* Next, copy the Pokémon ROM to this directory as "baserom.gbc".
* Then run "make" in your shell.
* This will output a file named "pokecrystal.gbc".
## See also
* disassembly of [Pokémon Red](http://bitbucket.org/iimarckus/pokered).
## Contributing
* Hang out with us on IRC, nucleus.kafuka.org #skeetendo ([or use mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo))
* Hang out with us on IRC:
`nucleus.kafuka.org #skeetendo`
(or use [mibbit](http://chat.mibbit.com/?server=nucleus.kafuka.org&channel=#skeetendo)).
* Are we missing something? Make a pull request! Contributions are welcome.
* Tackle some [issues](https://github.com/kanzure/pokecrystal/issues)!

View File

@ -1,212 +1,213 @@
; e927c
dbw $3c, $4b3f ; dex fanfare 50-79
dbw $3c, $4c2f ; item
dbw $3c, $4c89 ; caught mon
dbw $3c, $4941 ; pokeballs placed on table
dbw $3c, $4947 ; potion
dbw $3c, $494a ; full heal
dbw $3c, $494d ; menu
dbw $3c, $4950 ; read text
dbw $3c, $4950 ; read text
dbw $3c, $4bd5 ; dex fanfare 20-49
dbw $3c, $4cea ; dex fanfare 80-109
dbw $3c, $4953 ; poison
dbw $3c, $4956 ; got safari balls
dbw $3c, $4959 ; boot pc
dbw $3c, $495c ; shut down pc
dbw $3c, $495f ; choose pc option
dbw $3c, $4962 ; bide / escape rope
dbw $3c, $4965 ; push button
dbw $3c, $4968 ; second part of itemfinder
dbw $3c, $496b ; warp to
dbw $3c, $496e ; warp from
dbw $3c, $4971 ; change dex mode
dbw $3c, $4974 ; jump over ledge
dbw $3c, $4977 ; grass rustle
dbw $3c, $497a ; fly
dbw $3c, $497d ; wrong
dbw $3c, $4983 ; squeak
dbw $3c, $4986 ; strength
dbw $3c, $4989 ; boat
dbw $3c, $498f ; wall open
dbw $3c, $4992 ; place puzzle piece down
dbw $3c, $4995 ; enter door
dbw $3c, $4998 ; switch pokemon
dbw $3c, $499e ; score tally? ; sounds like something out of game corner
dbw $3c, $49a4 ; buy/sell
dbw $3c, $49ad ; exit building
dbw $3c, $49aa ; bump
dbw $3c, $49b0 ; save
dbw $3c, $49f8 ; pokeflute
dbw $3c, $49fb ; elevator end
dbw $3c, $49fe ; throw ball
dbw $3c, $4a04 ; smokescreen
dbw $3c, $4a0a ; ; something skidding on water?
dbw $3c, $4a10 ; run
dbw $3c, $4a13 ; slot machine start
dbw $3c, $4dbe ; fanfare
dbw $3c, $4a3d ; peck
dbw $3c, $4a40 ; kinesis
dbw $3c, $4a43 ; lick
dbw $3c, $4a46 ; pound
dbw $3c, $4a49 ; move puzzle piece
dbw $3c, $4a4c ; comet punch
dbw $3c, $4a4f ; mega punch
dbw $3c, $4a52 ; scratch
dbw $3c, $4a55 ; vicegrip
dbw $3c, $4a58 ; razor wind
dbw $3c, $4a5b ; cut
dbw $3c, $4a5e ; wing attack
dbw $3c, $4a61 ; whirlwind
dbw $3c, $4a64 ; bind
dbw $3c, $4a67 ; vine whip
dbw $3c, $4a6a ; double kick
dbw $3c, $4a6d ; mega kick
dbw $3c, $4a70 ; headbutt
dbw $3c, $4a73 ; horn attack
dbw $3c, $4a76 ; tackle
dbw $3c, $4a79 ; poison sting
dbw $3c, $4a7c ; poisonpowder
dbw $3c, $4a7f ; doubleslap
dbw $3c, $4a82 ; bite
dbw $3c, $4a88 ; jump kick
dbw $3c, $4a8b ; stomp
dbw $3c, $4a8e ; tail whip
dbw $3c, $4a91 ; karate chop
dbw $3c, $4a94 ; submission
dbw $3c, $4a97 ; water gun
dbw $3c, $4a9d ; swords dance
dbw $3c, $4aa0 ; thunder
dbw $3c, $4aa3 ; supersonic
dbw $3c, $4aac ; leer
dbw $3c, $4ab5 ; ember
dbw $3c, $4abb ; bubblebeam
dbw $3c, $4ac4 ; hydro pump
dbw $3c, $4aca ; surf
dbw $3c, $4ad3 ; psybeam
dbw $3c, $4adc ; leech seed
dbw $3c, $4ae5 ; thundershock
dbw $3c, $4aee ; psychic
dbw $3c, $4af7 ; screech
dbw $3c, $4afd ; bone club
dbw $3c, $4b03 ; sharpen
dbw $3c, $4b09 ; egg bomb
dbw $3c, $4b12 ; sing
dbw $3c, $4b18 ; sky attack
dbw $3c, $4b21 ; hyper beam
dbw $3c, $4b24 ; shine
dbw $3c, $4a1c ;
dbw $3c, $4a1f ; $60
dbw $3c, $4a22 ; tap
dbw $3c, $4a25 ; tap
dbw $3c, $4a28 ; burn ; that is not a burn
dbw $3c, $4a2b ; title screen sound
dbw $3c, $4a2e ; similar to $60
dbw $3c, $4a31 ; get coin from slots
dbw $3c, $4a34 ; pay day
dbw $3c, $4a3a ; metronome
dbw $3c, $4a19 ; call
dbw $3c, $4b2d ; hang up
dbw $3c, $4b30 ; no signal
dbw $3c, $4b2a ; sandstorm
dbw $3c, $4b33 ; elevator
dbw $3c, $52b4 ; protect
dbw $3c, $52f6 ; sketch
dbw $3c, $5314 ; rain dance
dbw $3c, $5334 ; aeroblast
dbw $3c, $5352 ; spark
dbw $3c, $5360 ; curse
dbw $3c, $537d ; rage
dbw $3c, $539c ; thief
dbw $3c, $53b0 ; thief
dbw $3c, $53ca ; spider web
dbw $3c, $53f7 ; mind reader
dbw $3c, $541d ; nighmare
dbw $3c, $5453 ; snore
dbw $3c, $5469 ; sweet kiss
dbw $3c, $547f ; sweet kiss
dbw $3c, $54a5 ; belly drum
dbw $3c, $54ba ;
dbw $3c, $54d0 ; sludge bomb
dbw $3c, $54f5 ; foresight
dbw $3c, $5515 ; spite
dbw $3c, $553a ; outrage
dbw $3c, $554d ; perish song
dbw $3c, $5570 ; giga drain
dbw $3c, $55b4 ; attract
dbw $3c, $55cc ; kinesis
dbw $3c, $55de ; zap cannon
dbw $3c, $55ef ; mean look
dbw $3c, $5621 ; heal bell
dbw $3c, $5637 ; return
dbw $3c, $5653 ; exp bar
dbw $3c, $567f ; milk drink
dbw $3c, $569f ; present
dbw $3c, $56b9 ; morning sun
dbw $3c, $4b3f ; level up
dbw $3c, $4b86 ; key item
dbw $3c, $4d56 ; fanfare
dbw $3c, $4dc7 ; register phone #
dbw $3c, $4e26 ; 3rd place
dbw $3c, $4e66 ; get egg from daycare man
dbw $3c, $4e66 ; get egg from daycare lady
dbw $3c, $4edc ; move deleted
dbw $3c, $4f5e ; 2nd place
dbw $3c, $4fe2 ; 1st place
dbw $3c, $5069 ; choose a card
dbw $3c, $5104 ; get tm
dbw $3c, $517d ; get badge
dbw $3c, $5236 ; quit slots
dbw $3c, $5775 ; nothing
dbw $3c, $5878 ; dex fanfare <20
dbw $3c, $58d2 ; dex fanfare 140-169
dbw $3c, $5951 ; dex fanfare 170-199
dbw $3c, $59d6 ; dex fanfare 200-229
dbw $3c, $5a66 ; dex fanfare >=230
dbw $3c, $5784 ; evolved
dbw $3c, $579b ; master ball
dbw $3c, $57c0 ; egg crack
dbw $3c, $57d9 ; charizard fireball (gs intro)
dbw $3c, $57ff ; pokemon appears (gs intro)
dbw $3c, $5818 ; flash
dbw $3c, $5846 ; game freak logo
dbw $3c, $5b33 ; not very effective
dbw $3c, $5b40 ; damage
dbw $3c, $5b50 ; super effective
dbw $3c, $5b63 ; ball bounce
dbw $3c, $56df ; moonlight
dbw $3c, $56fd ; encore
dbw $3c, $5721 ; beat up
dbw $3c, $574c ; batom pass
dbw $3c, $4944 ; ball wiggle
dbw $3c, $5734 ; sweet scent
dbw $3c, $5bb3 ; sweet scent
dbw $3c, $5bec ; hit end of exp bar
dbw $3c, $5c10 ; give trademon
dbw $3c, $5c3e ; get trademon
dbw $3c, $5c6c ; train arrived
dbw $3c, $675b ; stop slot
dbw $3c, $5cb4 ; 2 boops
dbw $3c, $6769 ; glass ting
dbw $3c, $6773 ; 2 glass ting
dbw $3c, $4b3f ; Dex Fanfare 50-79
dbw $3c, $4c2f ; Item
dbw $3c, $4c89 ; Caught Mon
dbw $3c, $4941 ; Pokeballs Placed On Table
dbw $3c, $4947 ; Potion
dbw $3c, $494a ; Full Heal
dbw $3c, $494d ; Menu
dbw $3c, $4950 ; Read Text
dbw $3c, $4950 ; Read Text 2
dbw $3c, $4bd5 ; Dex Fanfare 20-49
dbw $3c, $4cea ; Dex Fanfare 80-109
dbw $3c, $4953 ; Poison
dbw $3c, $4956 ; Got Safari Balls
dbw $3c, $4959 ; Boot Pc
dbw $3c, $495c ; Shut Down Pc
dbw $3c, $495f ; Choose Pc Option
dbw $3c, $4962 ; Escape Rope
dbw $3c, $4965 ; Push Button
dbw $3c, $4968 ; Second Part Of Itemfinder
dbw $3c, $496b ; Warp To
dbw $3c, $496e ; Warp From
dbw $3c, $4971 ; Change Dex Mode
dbw $3c, $4974 ; Jump Over Ledge
dbw $3c, $4977 ; Grass Rustle
dbw $3c, $497a ; Fly
dbw $3c, $497d ; Wrong
dbw $3c, $4983 ; Squeak
dbw $3c, $4986 ; Strength
dbw $3c, $4989 ; Boat
dbw $3c, $498f ; Wall Open
dbw $3c, $4992 ; Place Puzzle Piece Down
dbw $3c, $4995 ; Enter Door
dbw $3c, $4998 ; Switch Pokemon
dbw $3c, $499e ; Tally
dbw $3c, $49a4 ; Transaction
dbw $3c, $49ad ; Exit Building
dbw $3c, $49aa ; Bump
dbw $3c, $49b0 ; Save
dbw $3c, $49f8 ; Pokeflute
dbw $3c, $49fb ; Elevator End
dbw $3c, $49fe ; Throw Ball
dbw $3c, $4a04 ; Ball Poof
dbw $3c, $4a0a ; Unknown 3A
dbw $3c, $4a10 ; Run
dbw $3c, $4a13 ; Slot Machine Start
dbw $3c, $4dbe ; Fanfare
dbw $3c, $4a3d ; Peck
dbw $3c, $4a40 ; Kinesis
dbw $3c, $4a43 ; Lick
dbw $3c, $4a46 ; Pound
dbw $3c, $4a49 ; Move Puzzle Piece
dbw $3c, $4a4c ; Comet Punch
dbw $3c, $4a4f ; Mega Punch
dbw $3c, $4a52 ; Scratch
dbw $3c, $4a55 ; Vicegrip
dbw $3c, $4a58 ; Razor Wind
dbw $3c, $4a5b ; Cut
dbw $3c, $4a5e ; Wing Attack
dbw $3c, $4a61 ; Whirlwind
dbw $3c, $4a64 ; Bind
dbw $3c, $4a67 ; Vine Whip
dbw $3c, $4a6a ; Double Kick
dbw $3c, $4a6d ; Mega Kick
dbw $3c, $4a70 ; Headbutt
dbw $3c, $4a73 ; Horn Attack
dbw $3c, $4a76 ; Tackle
dbw $3c, $4a79 ; Poison Sting
dbw $3c, $4a7c ; Powder
dbw $3c, $4a7f ; Doubleslap
dbw $3c, $4a82 ; Bite
dbw $3c, $4a88 ; Jump Kick
dbw $3c, $4a8b ; Stomp
dbw $3c, $4a8e ; Tail Whip
dbw $3c, $4a91 ; Karate Chop
dbw $3c, $4a94 ; Submission
dbw $3c, $4a97 ; Water Gun
dbw $3c, $4a9d ; Swords Dance
dbw $3c, $4aa0 ; Thunder
dbw $3c, $4aa3 ; Supersonic
dbw $3c, $4aac ; Leer
dbw $3c, $4ab5 ; Ember
dbw $3c, $4abb ; Bubblebeam
dbw $3c, $4ac4 ; Hydro Pump
dbw $3c, $4aca ; Surf
dbw $3c, $4ad3 ; Psybeam
dbw $3c, $4adc ; Charge
dbw $3c, $4ae5 ; Thundershock
dbw $3c, $4aee ; Psychic
dbw $3c, $4af7 ; Screech
dbw $3c, $4afd ; Bone Club
dbw $3c, $4b03 ; Sharpen
dbw $3c, $4b09 ; Egg Bomb
dbw $3c, $4b12 ; Sing
dbw $3c, $4b18 ; Hyper Beam
dbw $3c, $4b21 ; Shine
dbw $3c, $4b24 ; Unknown 5F
dbw $3c, $4a1c ; Unknown 60
dbw $3c, $4a1f ; Unknown 61
dbw $3c, $4a22 ; Unknown 62
dbw $3c, $4a25 ; Unknown 63
dbw $3c, $4a28 ; Burn
dbw $3c, $4a2b ; Title Screen Entrance
dbw $3c, $4a2e ; Unknown 66
dbw $3c, $4a31 ; Get Coin From Slots
dbw $3c, $4a34 ; Pay Day
dbw $3c, $4a3a ; Metronome
dbw $3c, $4a19 ; Call
dbw $3c, $4b2d ; Hang Up
dbw $3c, $4b30 ; No Signal
dbw $3c, $4b2a ; Sandstorm
dbw $3c, $4b33 ; Elevator
dbw $3c, $52b4 ; Protect
dbw $3c, $52f6 ; Sketch
dbw $3c, $5314 ; Rain Dance
dbw $3c, $5334 ; Aeroblast
dbw $3c, $5352 ; Spark
dbw $3c, $5360 ; Curse
dbw $3c, $537d ; Rage
dbw $3c, $539c ; Thief
dbw $3c, $53b0 ; Thief 2
dbw $3c, $53ca ; Spider Web
dbw $3c, $53f7 ; Mind Reader
dbw $3c, $541d ; Nightmare
dbw $3c, $5453 ; Snore
dbw $3c, $5469 ; Sweet Kiss
dbw $3c, $547f ; Sweet Kiss 2
dbw $3c, $54a5 ; Belly Drum
dbw $3c, $54ba ; Unknown 7F
dbw $3c, $54d0 ; Sludge Bomb
dbw $3c, $54f5 ; Foresight
dbw $3c, $5515 ; Spite
dbw $3c, $553a ; Outrage
dbw $3c, $554d ; Perish Song
dbw $3c, $5570 ; Giga Drain
dbw $3c, $55b4 ; Attract
dbw $3c, $55cc ; Kinesis 2
dbw $3c, $55de ; Zap Cannon
dbw $3c, $55ef ; Mean Look
dbw $3c, $5621 ; Heal Bell
dbw $3c, $5637 ; Return
dbw $3c, $5653 ; Exp Bar
dbw $3c, $567f ; Milk Drink
dbw $3c, $569f ; Present
dbw $3c, $56b9 ; Morning Sun
dbw $3c, $4b3f ; Level Up
dbw $3c, $4b86 ; Key Item
dbw $3c, $4d56 ; Fanfare 2
dbw $3c, $4dc7 ; Register Phone #
dbw $3c, $4e26 ; 3Rd Place
dbw $3c, $4e66 ; Get Egg From Daycare Man
dbw $3c, $4e66 ; Get Egg From Daycare Lady
dbw $3c, $4edc ; Move Deleted
dbw $3c, $4f5e ; 2Nd Place
dbw $3c, $4fe2 ; 1St Place
dbw $3c, $5069 ; Choose A Card
dbw $3c, $5104 ; Get Tm
dbw $3c, $517d ; Get Badge
dbw $3c, $5236 ; Quit Slots
dbw $3c, $5775 ; Egg Crack
dbw $3c, $5878 ; Dex Fanfare < 20
dbw $3c, $58d2 ; Dex Fanfare 140-169
dbw $3c, $5951 ; Dex Fanfare 170-199
dbw $3c, $59d6 ; Dex Fanfare 200-229
dbw $3c, $5a66 ; Dex Fanfare 230 +
dbw $3c, $5784 ; Evolved
dbw $3c, $579b ; Master Ball
dbw $3c, $57c0 ; Egg Hatch
dbw $3c, $57d9 ; Gs Intro Charizard Fireball
dbw $3c, $57ff ; Gs Intro Pokemon Appears
dbw $3c, $5818 ; Flash
dbw $3c, $5846 ; Game Freak Logo Gs
dbw $3c, $5b33 ; Not Very Effective
dbw $3c, $5b40 ; Damage
dbw $3c, $5b50 ; Super Effective
dbw $3c, $5b63 ; Ball Bounce
dbw $3c, $56df ; Moonlight
dbw $3c, $56fd ; Encore
dbw $3c, $5721 ; Beat Up
dbw $3c, $574c ; Baton Pass
dbw $3c, $4944 ; Ball Wiggle
dbw $3c, $5734 ; Sweet Scent
dbw $3c, $5bb3 ; Sweet Scent 2
dbw $3c, $5bec ; Hit End Of Exp Bar
dbw $3c, $5c10 ; Give Trademon
dbw $3c, $5c3e ; Get Trademon
dbw $3c, $5c6c ; Train Arrived
dbw $3c, $675b ; Stop Slot
dbw $3c, $5cb4 ; 2 Boops
dbw $3c, $6769 ; Glass Ting
dbw $3c, $6773 ; Glass Ting 2
; Crystal adds the following SFX:
dbw $5e, $582d ; intro unown 1
dbw $5e, $583e ; intro unown 2
dbw $5e, $584f ; intro unown 3
dbw $5e, $586e ; boop
dbw $5e, $5888 ; game freak ditto transform
dbw $5e, $58a0 ; intro suicune 1
dbw $5e, $58aa ; intro pichu
dbw $5e, $58c0 ; intro suicune 2
dbw $5e, $58f4 ; intro suicune 3
dbw $5e, $5907 ; game freak ditto bounce
dbw $5e, $591d ; intro suicune 4
dbw $5e, $5942 ; game freak presents
dbw $5e, $5961 ; tingle
dbw $3c, $5cd0 ; sand?
dbw $5e, $597c ; two pc beeps
dbw $5e, $5992 ; 4 note ditty
dbw $5e, $59cb ; twinkle
dbw $5e, $582d ; Intro Unown 1
dbw $5e, $583e ; Intro Unown 2
dbw $5e, $584f ; Intro Unown 3
dbw $5e, $586e ; Ditto Pop Up
dbw $5e, $5888 ; Ditto Transform
dbw $5e, $58a0 ; Intro Suicune 1
dbw $5e, $58aa ; Intro Pichu
dbw $5e, $58c0 ; Intro Suicune 2
dbw $5e, $58f4 ; Intro Suicune 3
dbw $5e, $5907 ; Ditto Bounce
dbw $5e, $591d ; Intro Suicune 4
dbw $5e, $5942 ; Game Freak Presents
dbw $5e, $5961 ; Tingle
dbw $3c, $5cd0 ; Unknown Cb
dbw $5e, $597c ; Two Pc Beeps
dbw $5e, $5992 ; 4 Note Ditty
dbw $5e, $59cb ; Twinkle
; e94e9

3362
battle/ai/scoring.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
; 3fd28
dw BattleCommand01 ; 34084
dw BattleCommand02 ; 343db
dw BattleCommand03 ; 34541
dw BattleCommand04 ; 34555
dw BattleCommand05 ; 34631
dw BattleCommand06 ; 352dc
dw BattleCommand07 ; 346d2
dw BattleCommand08 ; 34cfd
dw BattleCommand09 ; 34d32
dw BattleCommand0a ; 34eee
dw BattleCommand0b ; 34f60
dw BattleCommand0c ; 35004
dw BattleCommand0d ; 35023
dw BattleCommand0e ; 3505e
dw BattleCommand0f ; 35175
dw BattleCommand10 ; 351ad
dw BattleCommand11 ; 351c0
dw BattleCommand12 ; 35250
dw BattleCommand13 ; 35eee
dw BattleCommand14 ; 35e5c
dw BattleCommand15 ; 35fff
dw BattleCommand16 ; 36008
dw BattleCommand17 ; 3608c
dw BattleCommand18 ; 36102
dw BattleCommand19 ; 36165
dw BattleCommand1a ; 37380
dw BattleCommand1b ; 373c9
dw BattleCommand1c ; 361e4
dw BattleCommand1d ; 362e3
dw BattleCommand1e ; 3705c
dw BattleCommand1f ; 3707f
dw BattleCommand20 ; 3710e
dw BattleCommand21 ; 36671
dw BattleCommand22 ; 366e5
dw BattleCommand23 ; 3680f
dw BattleCommand24 ; 369b6
dw BattleCommand25 ; 36aa0
dw BattleCommand26 ; 36af3
dw BattleCommand27 ; 36cb2
dw BattleCommand28 ; 36c7e
dw BattleCommand29 ; 36c98
dw BattleCommand2a ; 36d3b
dw BattleCommand2b ; 36d1d
dw BattleCommand2c ; 3713e
dw BattleCommand2d ; 371cd
dw BattleCommand2e ; 372fc
dw BattleCommand2f ; 35f2c
dw BattleCommand30 ; 36dc7
dw BattleCommand31 ; 36e7c
dw BattleCommand32 ; 36f0b
dw BattleCommand33 ; 36f46
dw BattleCommand34 ; 37418
dw BattleCommand35 ; 36f9d
dw BattleCommand36 ; 36fe1
dw BattleCommand37 ; 36fed
dw BattleCommand38 ; 37e85
dw BattleCommand39 ; 36b4d
dw BattleCommand3a ; 36b3a
dw BattleCommand3b ; 36c2d
dw BattleCommand3c ; 36c2c
dw BattleCommand3d ; 36751
dw BattleCommand3e ; 3671a
dw BattleCommand3f ; 35726
dw BattleCommand40 ; 35813
dw BattleCommand41 ; 35864
dw BattleCommand42 ; 35926
dw BattleCommand43 ; 359d0
dw BattleCommand44 ; 359e6
dw BattleCommand45 ; 35a53
dw BattleCommand46 ; 35a74
dw BattleCommand47 ; 35b16
dw BattleCommand48 ; 35b33
dw BattleCommand49 ; 35bff
dw BattleCommand4a ; 35c0f
dw BattleCommand4b ; 35c94
dw BattleCommand4c ; 35cc9
dw BattleCommand4d ; 36ac9
dw BattleCommand4e ; 346b2
dw BattleCommand4f ; 346cd
dw BattleCommand50 ; 37492
dw BattleCommand51 ; 37517
dw BattleCommand52 ; 37536
dw BattleCommand53 ; 37563
dw BattleCommand54 ; 37588
dw BattleCommand55 ; 37618
dw BattleCommand56 ; 37683
dw BattleCommand57 ; 376a0
dw BattleCommand58 ; 376c2
dw BattleCommand59 ; 376f8
dw BattleCommand5a ; 3766f
dw BattleCommand5b ; 37718
dw BattleCommand5c ; 37734
dw BattleCommand5d ; 37791
dw BattleCommand5e ; 37792
dw BattleCommand5f ; 377ce
dw BattleCommand60 ; 3784b
dw BattleCommand61 ; 37874
dw BattleCommand62 ; 35612
dw BattleCommand63 ; 3790e
dw BattleCommand64 ; 37939
dw BattleCommand65 ; 37972
dw BattleCommand66 ; 37991
dw BattleCommand67 ; 379c9
dw BattleCommand68 ; 37b1d
dw BattleCommand69 ; 37b39
dw BattleCommand6a ; 37b74
dw BattleCommand6b ; 37b78
dw BattleCommand6c ; 37b7c
dw BattleCommand6d ; 37be8
dw BattleCommand6e ; 37bf4
dw BattleCommand6f ; 37c07
dw BattleCommand70 ; 361ac
dw BattleCommand71 ; 361b0
dw BattleCommand72 ; 361b4
dw BattleCommand73 ; 361b8
dw BattleCommand74 ; 361bc
dw BattleCommand75 ; 361c0
dw BattleCommand76 ; 361c4
dw BattleCommand77 ; 361c8
dw BattleCommand78 ; 361cc
dw BattleCommand79 ; 361d0
dw BattleCommand7a ; 361d4
dw BattleCommand7b ; 361d8
dw BattleCommand7c ; 361dc
dw BattleCommand7d ; 361e0
dw BattleCommand7e ; 362ad
dw BattleCommand7f ; 362b1
dw BattleCommand80 ; 362b5
dw BattleCommand81 ; 362b9
dw BattleCommand82 ; 362bd
dw BattleCommand83 ; 362c1
dw BattleCommand84 ; 362c5
dw BattleCommand85 ; 362c9
dw BattleCommand86 ; 362cd
dw BattleCommand87 ; 362d1
dw BattleCommand88 ; 362d5
dw BattleCommand89 ; 362d9
dw BattleCommand8a ; 362dd
dw BattleCommand8b ; 362e1
dw BattleCommand8c ; 363b8
dw BattleCommand8d ; 363e9
dw BattleCommand8e ; 3644c
dw BattleCommand8f ; 3646a
dw BattleCommand90 ; 34ecc
dw BattleCommand91 ; 34fdb
dw BattleCommand92 ; 34fd1
dw BattleCommand93 ; 34ffd
dw BattleCommand94 ; 36a82
dw BattleCommand95 ; 37c1a
dw BattleCommand96 ; 37c55
dw BattleCommand97 ; 36f1d
dw BattleCommand98 ; 36f25
dw BattleCommand99 ; 36f2f
dw BattleCommand9a ; 37c95
dw BattleCommand9b ; 37d0d
dw BattleCommand9c ; 37d34
dw BattleCommand9d ; 37ce6
dw BattleCommand9e ; 37d02
dw BattleCommand9f ; 37d94
dw BattleCommanda0 ; 36778
dw BattleCommanda1 ; 35461
dw BattleCommanda2 ; 3527b
dw BattleCommanda3 ; 34833
dw BattleCommanda4 ; 36500
dw BattleCommanda5 ; 35165
dw BattleCommanda6 ; 365af
dw BattleCommanda7 ; 365c3
dw BattleCommanda8 ; 355b5
dw BattleCommanda9 ; 355d5
dw BattleCommandaa ; 37e80
dw BattleCommandab ; 34f57
dw BattleCommandac ; 3658f
dw BattleCommandad ; 351a5
dw BattleCommandae ; 35197
dw BattleCommandaf ; 365a7
; 3fe86

11209
battle/effect_commands.asm Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
dw NormalHit
dw DoSleep
dw PoisonHit
dw LeechHit
dw BurnHit
dw FreezeHit
dw ParalyzeHit
dw Explosion
dw DreamEater
dw MirrorMove
dw AttackUp
dw DefenseUp
dw SpeedUp
dw Growth
dw SpecialDefenseUp
dw AccuracyUp
dw EvasionUp
dw NormalHit
dw Growl
dw DefenseDown
dw StringShot
dw SpecialAttackDown
dw SpecialDefenseDown
dw AccuracyDown
dw SweetScent
dw Haze
dw Bide
dw Rampage
dw Whirlwind
dw MultiHit
dw Conversion
dw FlinchHit
dw Heal
dw Toxic
dw PayDay
dw LightScreen
dw TriAttack
dw NormalHit
dw OHKOHit
dw RazorWind
dw SuperFang
dw StaticDamage
dw Bind
dw NormalHit
dw MultiHit
dw NormalHit
dw Mist
dw FocusEnergy
dw RecoilHit
dw DoConfuse
dw SwordsDance
dw DefenseUp2
dw Agility
dw SpecialAttackUp2
dw Amnesia
dw AccuracyUp2
dw EvasionUp2
dw Transform
dw Charm
dw Screech
dw SpeedDown2
dw SpecialAttackDown2
dw SpecialDefenseDown2
dw AccuracyDown2
dw EvasionDown2
dw Reflect
dw DoPoison
dw DoParalyze
dw AuroraBeam
dw DefenseDownHit
dw SpeedDownHit
dw SpecialAttackDownHit
dw SpecialDefenseDownHit
dw AccuracyDownHit
dw EvasionDownHit
dw SkyAttack
dw ConfuseHit
dw Twineedle
dw NormalHit
dw Substitute
dw HyperBeam
dw Rage
dw Mimic
dw Metronome
dw LeechSeed
dw Splash
dw Disable
dw StaticDamage
dw Psywave
dw Counter
dw Encore
dw PainSplit
dw Snore
dw Conversion2
dw LockOn
dw Sketch
dw DefrostOpponent
dw SleepTalk
dw DestinyBond
dw Reversal
dw Spite
dw FalseSwipe
dw HealBell
dw NormalHit
dw TripleKick
dw Thief
dw MeanLook
dw Nightmare
dw FlameWheel
dw Curse
dw NormalHit
dw Protect
dw Spikes
dw Foresight
dw PerishSong
dw Sandstorm
dw Endure
dw Rollout
dw Swagger
dw FuryCutter
dw Attract
dw Return
dw Present
dw Frustration
dw Safeguard
dw SacredFire
dw Magnitude
dw BatonPass
dw Pursuit
dw RapidSpin
dw NormalHit
dw NormalHit
dw MorningSun
dw Synthesis
dw Moonlight
dw HiddenPower
dw RainDance
dw SunnyDay
dw SteelWing
dw MetalClaw
dw Ancientpower
dw FakeOut
dw BellyDrum
dw PsychUp
dw MirrorCoat
dw SkullBash
dw Twister
dw Earthquake
dw FutureSight
dw Gust
dw Stomp
dw Solarbeam
dw Thunder
dw Teleport
dw BeatUp
dw Fly
dw DefenseCurl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -98,6 +98,8 @@ chars = {
0xE9: "&",
0xEA: "é",
0xEB: "",
0xED: "",
0xEE: "",
0xEF: "",
0xF0: "¥",
0xF1: "×",

View File

@ -1471,7 +1471,7 @@ ScriptPointerLabelAfterBank.parse = _parse_script_pointer_bytes
class PointerLabelToScriptPointer(PointerLabelParam):
def parse(self):
PointerLabelParam.parse(self)
address = calculate_pointer_from_bytes_at(self.address, bank=self.bank)
address = calculate_pointer_from_bytes_at(self.parsed_address, bank=self.bank)
address2 = calculate_pointer_from_bytes_at(address, bank="reverse") # maybe not "reverse"?
self.script = parse_script_engine_script_at(address2, origin=False, map_group=self.map_group, map_id=self.map_id, force=self.force, debug=self.debug)
@ -2912,7 +2912,7 @@ music_command_enders = [0xEA, 0xEB, 0xEE, 0xFC, 0xFF,]
# special case for 0xFD (if loopchannel.count = 0, break)
def create_music_command_classes(debug=False):
klasses = [GivePoke]
klasses = []
for (byte, cmd) in music_commands_new.items():
cmd_name = cmd[0].replace(" ", "_")
params = {"id": byte, "size": 1, "end": byte in music_command_enders, "macro_name": cmd_name}
@ -2938,6 +2938,221 @@ def create_music_command_classes(debug=False):
return klasses
music_classes = create_music_command_classes()
effect_commands = {
0x1: ['checkturn'],
0x2: ['checkobedience'],
0x3: ['usedmovetext'],
0x4: ['doturn'],
0x5: ['critical'],
0x6: ['damagestats'],
0x7: ['stab'],
0x8: ['damagevariation'],
0x9: ['checkhit'],
0xa: ['effect0x0a'],
0xb: ['effect0x0b'],
0xc: ['effect0x0c'],
0xd: ['resulttext'],
0xe: ['checkfaint'],
0xf: ['criticaltext'],
0x10: ['supereffectivetext'],
0x11: ['checkdestinybond'],
0x12: ['buildopponentrage'],
0x13: ['poisontarget'],
0x14: ['sleeptarget'],
0x15: ['draintarget'],
0x16: ['eatdream'],
0x17: ['burntarget'],
0x18: ['freezetarget'],
0x19: ['paralyzetarget'],
0x1a: ['selfdestruct'],
0x1b: ['mirrormove'],
0x1c: ['statup'],
0x1d: ['statdown'],
0x1e: ['payday'],
0x1f: ['conversion'],
0x20: ['resetstats'],
0x21: ['storeenergy'],
0x22: ['unleashenergy'],
0x23: ['forceswitch'],
0x24: ['endloop'],
0x25: ['flinchtarget'],
0x26: ['ohko'],
0x27: ['recoil'],
0x28: ['mist'],
0x29: ['focusenergy'],
0x2a: ['confuse'],
0x2b: ['confusetarget'],
0x2c: ['heal'],
0x2d: ['transform'],
0x2e: ['screen'],
0x2f: ['poison'],
0x30: ['paralyze'],
0x31: ['substitute'],
0x32: ['rechargenextturn'],
0x33: ['mimic'],
0x34: ['metronome'],
0x35: ['leechseed'],
0x36: ['splash'],
0x37: ['disable'],
0x38: ['cleartext'],
0x39: ['charge'],
0x3a: ['checkcharge'],
0x3b: ['traptarget'],
0x3c: ['effect0x3c'],
0x3d: ['rampage'],
0x3e: ['checkrampage'],
0x3f: ['constantdamage'],
0x40: ['counter'],
0x41: ['encore'],
0x42: ['painsplit'],
0x43: ['snore'],
0x44: ['conversion2'],
0x45: ['lockon'],
0x46: ['sketch'],
0x47: ['defrostopponent'],
0x48: ['sleeptalk'],
0x49: ['destinybond'],
0x4a: ['spite'],
0x4b: ['falseswipe'],
0x4c: ['healbell'],
0x4d: ['kingsrock'],
0x4e: ['triplekick'],
0x4f: ['kickcounter'],
0x50: ['thief'],
0x51: ['arenatrap'],
0x52: ['nightmare'],
0x53: ['defrost'],
0x54: ['curse'],
0x55: ['protect'],
0x56: ['spikes'],
0x57: ['foresight'],
0x58: ['perishsong'],
0x59: ['startsandstorm'],
0x5a: ['endure'],
0x5b: ['checkcurl'],
0x5c: ['rolloutpower'],
0x5d: ['effect0x5d'],
0x5e: ['furycutter'],
0x5f: ['attract'],
0x60: ['happinesspower'],
0x61: ['present'],
0x62: ['damagecalc'],
0x63: ['frustrationpower'],
0x64: ['safeguard'],
0x65: ['checksafeguard'],
0x66: ['getmagnitude'],
0x67: ['batonpass'],
0x68: ['pursuit'],
0x69: ['clearhazards'],
0x6a: ['healmorn'],
0x6b: ['healday'],
0x6c: ['healnite'],
0x6d: ['hiddenpower'],
0x6e: ['startrain'],
0x6f: ['startsun'],
0x70: ['attackup'],
0x71: ['defenseup'],
0x72: ['speedup'],
0x73: ['specialattackup'],
0x74: ['specialdefenseup'],
0x75: ['accuracyup'],
0x76: ['evasionup'],
0x77: ['attackup2'],
0x78: ['defenseup2'],
0x79: ['speedup2'],
0x7a: ['specialattackup2'],
0x7b: ['specialdefenseup2'],
0x7c: ['accuracyup2'],
0x7d: ['evasionup2'],
0x7e: ['attackdown'],
0x7f: ['defensedown'],
0x80: ['speeddown'],
0x81: ['specialattackdown'],
0x82: ['specialdefensedown'],
0x83: ['accuracydown'],
0x84: ['evasiondown'],
0x85: ['attackdown2'],
0x86: ['defensedown2'],
0x87: ['speeddown2'],
0x88: ['specialattackdown2'],
0x89: ['specialdefensedown2'],
0x8a: ['accuracydown2'],
0x8b: ['evasiondown2'],
0x8c: ['statmessageuser'],
0x8d: ['statmessagetarget'],
0x8e: ['statupfailtext'],
0x8f: ['statdownfailtext'],
0x90: ['effectchance'],
0x91: ['effect0x91'],
0x92: ['effect0x92'],
0x93: ['switchturn'],
0x94: ['fakeout'],
0x95: ['bellydrum'],
0x96: ['psychup'],
0x97: ['rage'],
0x98: ['doubleflyingdamage'],
0x99: ['doubleundergrounddamage'],
0x9a: ['mirrorcoat'],
0x9b: ['checkfuturesight'],
0x9c: ['futuresight'],
0x9d: ['doubleminimizedamage'],
0x9e: ['skipsuncharge'],
0x9f: ['thunderaccuracy'],
0xa0: ['teleport'],
0xa1: ['beatup'],
0xa2: ['ragedamage'],
0xa3: ['effect0xa3'],
0xa4: ['allstatsup'],
0xa5: ['effect0xa5'],
0xa6: ['effect0xa6'],
0xa7: ['effect0xa7'],
0xa8: ['effect0xa8'],
0xa9: ['clearmissdamage'],
0xaa: ['wait'],
0xab: ['hittarget'],
0xac: ['tristatuschance'],
0xad: ['supereffectivelooptext'],
0xae: ['startloop'],
0xaf: ['curl'],
0xfe: ['endturn'],
0xff: ['endmove'],
}
effect_command_enders = [0xFF,]
def create_effect_command_classes(debug=False):
klasses = []
for (byte, cmd) in effect_commands.items():
cmd_name = cmd[0].replace(" ", "_")
params = {
"id": byte,
"size": 1,
"end": byte in effect_command_enders,
"macro_name": cmd_name
}
params["param_types"] = {}
if len(cmd) > 1:
param_types = cmd[1:]
for (i, each) in enumerate(param_types):
thing = {"name": each[0], "class": each[1]}
params["param_types"][i] = thing
if debug:
print "each is: " + str(each)
print "thing[class] is: " + str(thing["class"])
params["size"] += thing["class"].size
klass_name = cmd_name+"Command"
klass = classobj(klass_name, (Command,), params)
globals()[klass_name] = klass
klasses.append(klass)
# later an individual klass will be instantiated to handle something
return klasses
effect_classes = create_effect_command_classes()
def generate_macros(filename="../script_macros.asm"):
"""generates all macros based on commands
this is dumped into script_macros.asm"""
@ -6201,7 +6416,7 @@ def parse_map_header_by_id(*args, **kwargs):
elif len(args) == 1 and type(args[0]) == str:
map_group = int(args[0].split(".")[0])
map_id = int(args[0].split(".")[1])
else:
elif map_group == None and map_id == None:
raise Exception("dunno what to do with input")
offset = map_names[map_group]["offset"]
map_header_offset = offset + ((map_id - 1) * map_header_byte_size)

View File

@ -1436,8 +1436,8 @@ def mass_to_colored_png(debug=False):
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
if name[:5]+'.pal' in files:
to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
if os.path.splitext(name)[0]+'.pal' in files:
to_png(os.path.join(root, name), None, os.path.join(root, os.path.splitext(name)[0]+'.pal'))
else:
to_png(os.path.join(root, name))
@ -1459,26 +1459,26 @@ def mass_to_colored_png(debug=False):
def mass_decompress(debug=False):
for root, dirs, files in os.walk('../gfx/'):
for file in files:
if 'lz' in file:
for name in files:
if 'lz' in name:
if '/pics' in root:
if 'front' in file:
if 'front' in name:
id = root.split('pics/')[1][:3]
if id != 'egg':
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
else:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
to_file(root+'/'+'front.2bpp', de.pic)
to_file(root+'/'+'tiles.2bpp', de.animtiles)
elif 'back' in file:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(root+'/'+'back.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
to_file(os.path.join(root, 'front.2bpp'), de.pic)
to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles)
elif 'back' in name:
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(os.path.join(root, 'back.2bpp'), de.output)
elif '/trainers' in root or '/fx' in root:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(root+'/'+file[:-3]+'.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
else:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read())
to_file(root+file[:-3]+'.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read())
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
def append_terminator_to_lzs(directory):
# fix lzs that were extracted with a missing terminator

View File

@ -104,6 +104,11 @@ Gb.loadVBA()
from vba_config import *
try:
import vba_keyboard as keyboard
except ImportError:
print "Not loading the keyboard module (which uses networkx)."
if not os.path.exists(rom_path):
raise Exception("rom_path is not configured properly; edit vba_config.py?")
@ -163,10 +168,14 @@ def button_combiner(buttons):
buttons.replace("select", "")
result |= button_masks["select"]
if isinstance(buttons, list):
if len(buttons) > 9:
raise Exception("can't combine more than 9 buttons at a time")
for each in buttons:
result |= button_masks[each]
print "button: " + str(result)
#print "button: " + str(result)
return result
def load_rom(path=None):
@ -434,6 +443,69 @@ def press(buttons, steplimit=1):
for step_counter in range(0, steplimit):
Gb.step(number)
def get_buttons():
"""
Returns the currentButtons[0] value (an integer with bits set for which
buttons are currently pressed).
"""
return Gb.getCurrentButtons()
class State(RomList):
name = None
class Recording:
def __init__(self):
self.frames = []
self.states = {}
def _get_frame_count(self):
return len(self.frames)
frame_count = property(fget=_get_frame_count)
def save(self, name=None):
"""
Saves the current state.
"""
state = State(get_state())
state.name = name
self.states[self.frame_count] = state
def load(self, name):
"""
Loads a state by name in the state list.
"""
for state in self.states.items():
if state.name == name:
set_state(state)
return state
return False
def step(self, stepcount=1, first_frame=0, replay=False):
"""
Records button presses for each frame.
"""
if replay:
stepcount = len(self.frames[first_name:])
for counter in range(first_frame, stepcount):
if replay:
press(self.frames[counter], steplimit=0)
else:
self.frames.append(get_buttons())
nstep(1)
def replay_from(self, thing):
"""
Replays based on a State or the name of a saved state.
"""
if isinstance(thing, State):
set_state(thing)
else:
thing = self.load(thing)
frame_id = self.states.index(thing)
self.step(first_frame=frame_id, replay=True)
class Registers:
order = [
"pc",
@ -564,6 +636,66 @@ def call(bank, address):
else:
registers["pc"] = address
class cheats:
"""
Helpers to manage the cheating infrastructure.
import vba; vba.load_rom(); vba.cheats.add_gameshark("0100CFCF", "text speedup 1"); vba.cheats.add_gameshark("0101CCCF", "text speedup 2"); vba.go()
"""
@staticmethod
def enable(id):
"""
void gbCheatEnable(int i)
"""
Gb.cheatEnable(id)
@staticmethod
def disable(id):
"""
void gbCheatDisable(int i)
"""
Gb.cheatDisable(id)
@staticmethod
def load_file(filename):
"""
Loads a .clt file. By default each cheat is disabled.
"""
Gb.loadCheatsFromFile(filename)
@staticmethod
def remove_all():
"""
Removes all cheats from memory.
void gbCheatRemoveAll()
"""
Gb.cheatRemoveAll()
@staticmethod
def remove_cheat(id):
"""
Removes a specific cheat from memory by id.
void gbCheatRemove(int i)
"""
Gb.cheatRemove(id)
@staticmethod
def add_gamegenie(code, description=""):
"""
void gbAddGgCheat(const char *code, const char *desc)
"""
Gb.cheatAddGamegenie(code, description)
@staticmethod
def add_gameshark(code, description=""):
"""
gbAddGsCheat(const char *code, const char *desc)
"""
Gb.cheatAddGameshark(code, description)
class crystal:
"""
Just a simple namespace to store a bunch of functions for Pokémon Crystal.
@ -766,6 +898,25 @@ class crystal:
return output
@staticmethod
def keyboard_apply(button_sequence):
"""
Applies a sequence of buttons to the on-screen keyboard.
"""
for buttons in button_sequence:
press(buttons)
nstep(2)
press([])
@staticmethod
def write(something="TrAiNeR"):
"""
Uses a planning algorithm to type out a word in the most efficient way
possible.
"""
button_sequence = keyboard.plan_typing(something)
crystal.keyboard_apply([[x] for x in button_sequence])
@staticmethod
def set_partymon2():
"""
@ -836,6 +987,14 @@ class TestEmulator(unittest.TestCase):
self.assertTrue("TRAINER" in text)
class TestWriter(unittest.TestCase):
def test_very_basic(self):
button_sequence = keyboard.plan_typing("an")
expected_result = ["select", "a", "d", "r", "r", "r", "r", "a"]
self.assertEqual(len(expected_result), len(button_sequence))
self.assertEqual(expected_result, button_sequence)
if __name__ == "__main__":
unittest.main()

View File

@ -2,13 +2,10 @@
# -*- encoding: utf-8 -*-
import os
# by default we assume the user has things in their $HOME
home = os.path.expanduser("~") # or System.getProperty("user.home")
# by default we assume the user has vba in pokecrystal/extras
project_path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
# and that the pokecrystal project folder is in there somewhere
project_path = os.path.join(home, os.path.join("code", "pokecrystal"))
# save states are in ~/code/pokecrystal/save-states/
# save states are in pokecrystal/save-states/
save_state_path = os.path.join(project_path, "save-states")
# where is your rom?

563
extras/vba_keyboard.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,26 @@
; Graciously aped from http://nocash.emubase.de/pandocs.htm .
; MBC3
MBC3SRamEnable EQU $0000
MBC3RomBank EQU $2000
MBC3SRamBank EQU $4000
MBC3LatchClock EQU $6000
MBC3RTC EQU $a000
SRAM_DISABLE EQU $00
SRAM_ENABLE EQU $0a
RTC_S EQU $08 ; Seconds 0-59 (0-3Bh)
RTC_M EQU $09 ; Minutes 0-59 (0-3Bh)
RTC_H EQU $0a ; Hours 0-23 (0-17h)
RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh)
RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag
; Bit 0 Most significant bit of Day Counter (Bit 8)
; Bit 6 Halt (0=Active, 1=Stop Timer)
; Bit 7 Day Counter Carry Bit (1=Counter Overflow)
; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)
rSB EQU $ff01 ; Serial transfer data (R/W)
rSC EQU $ff02 ; Serial Transfer Control (R/W)

Some files were not shown because too many files have changed in this diff Show More