comparison 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
comparison
equal deleted inserted replaced
142:b12d2408fd9b 143:cd930ed1fd4d
1 (ns com.aurellem.pokemon 1 (ns com.aurellem.pokemon
2 "Here I find out how pokemon are stored in memory."
2 (:use (com.aurellem gb-driver vbm 3 (:use (com.aurellem gb-driver vbm
4 rival-name
3 title save-corruption items assembly)) 5 title save-corruption items assembly))
6 (:use com.aurellem.experiments.items)
4 (:import [com.aurellem.gb_driver SaveState])) 7 (:import [com.aurellem.gb_driver SaveState]))
8
9
10 (def pidgeot-lvl-36 (mid-game))
11
12
13 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
14
15
16 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))
17
18
19 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))
20
21
22 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))
23
24
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])))
33
34 ;; inconclusive -- implies that level is calculated from
35 ;; some other values.
36
37
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"))
45
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])))
55
56 ;; resluted in 3 separate locations that could
57 ;; possibly hold the first letter of the pokemon's name
58
59 0xCF4A
60 0xD2EB
61 0xCEED
62
63 ;; try changing each of them
64
65
66 (defn test-cf4a []
67 (continue!
68 (set-memory named-A 0xCF4A (character->character-code "Z"))))
69 ;; result -- pidgeotto named "A"
70
71 (defn test-d2eb []
72 (continue!
73 (set-memory named-A 0xD2EB (character->character-code "Z"))))
74 ;; result -- pidgeotto named "Z"
75
76 (defn test-ceed []
77 (continue!
78 (set-memory named-A 0xCEED (character->character-code "Z"))))
79 ;; result -- pidgeotto named "A"
80
81 (def sixth-pokemon-name-start 0xD2EB)
82
83
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)))
5 91
6 92
7 93
8 94