view clojure/com/aurellem/pokemon.clj @ 143:cd930ed1fd4d

determined location of sixth pokemon's name's first character.
author Robert McIntyre <rlm@mit.edu>
date Mon, 19 Mar 2012 20:30:37 -0500
parents b12d2408fd9b
children
line wrap: on
line source
1 (ns com.aurellem.pokemon
2 "Here I find out how pokemon are stored in memory."
3 (:use (com.aurellem gb-driver vbm
4 rival-name
5 title save-corruption items assembly))
6 (:use com.aurellem.experiments.items)
7 (:import [com.aurellem.gb_driver SaveState]))
10 (def pidgeot-lvl-36 (mid-game))
13 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
16 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))
19 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))
22 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))
25 (defn level-analysis []
26 (apply common-differences
27 (map (comp vec memory)
28 [pidgeot-lvl-36
29 pidgeot-lvl-37
30 pidgeot-lvl-38
31 pidgeot-lvl-39
32 pidgeot-lvl-40])))
34 ;; inconclusive -- implies that level is calculated from
35 ;; some other values.
38 (def name-pidgeotto (read-state "name-pidgeotto"))
39 (def named-A (read-state "named-A"))
40 (def named-B (read-state "named-B"))
41 (def named-C (read-state "named-C"))
42 (def named-D (read-state "named-D"))
43 (def named-E (read-state "named-E"))
44 (def named-F (read-state "named-F"))
46 (defn name-analysis []
47 (apply common-differences
48 (map (comp vec memory)
49 [named-A
50 named-B
51 named-C
52 named-D
53 named-E
54 named-F])))
56 ;; resluted in 3 separate locations that could
57 ;; possibly hold the first letter of the pokemon's name
59 0xCF4A
60 0xD2EB
61 0xCEED
63 ;; try changing each of them
66 (defn test-cf4a []
67 (continue!
68 (set-memory named-A 0xCF4A (character->character-code "Z"))))
69 ;; result -- pidgeotto named "A"
71 (defn test-d2eb []
72 (continue!
73 (set-memory named-A 0xD2EB (character->character-code "Z"))))
74 ;; result -- pidgeotto named "Z"
76 (defn test-ceed []
77 (continue!
78 (set-memory named-A 0xCEED (character->character-code "Z"))))
79 ;; result -- pidgeotto named "A"
81 (def sixth-pokemon-name-start 0xD2EB)
84 (defn set-sixth-pokemon-name-first-character
85 ([state character]
86 (set-memory state sixth-pokemon-name-start
87 (character->character-code character)))
88 ([character]
89 (set-sixth-pokemon-name-first-character @current-state
90 character)))