rlm@145
|
1 (ns com.aurellem.exp.pokemon
|
rlm@145
|
2 "Here I find out how pokemon are stored in memory."
|
rlm@145
|
3 (:use (com.aurellem.gb gb-driver items assembly util
|
rlm@145
|
4 characters))
|
rlm@145
|
5 (:import [com.aurellem.gb.gb_driver SaveState]))
|
rlm@145
|
6
|
rlm@145
|
7
|
rlm@145
|
8 (def pidgeot-lvl-36 (mid-game))
|
rlm@145
|
9
|
rlm@145
|
10
|
rlm@145
|
11 (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37"))
|
rlm@145
|
12
|
rlm@145
|
13
|
rlm@145
|
14 (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38"))
|
rlm@145
|
15
|
rlm@145
|
16
|
rlm@145
|
17 (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39"))
|
rlm@145
|
18
|
rlm@145
|
19
|
rlm@145
|
20 (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40"))
|
rlm@145
|
21
|
rlm@145
|
22
|
rlm@145
|
23 (defn level-analysis []
|
rlm@145
|
24 (apply common-differences
|
rlm@145
|
25 (map (comp vec memory)
|
rlm@145
|
26 [pidgeot-lvl-36
|
rlm@145
|
27 pidgeot-lvl-37
|
rlm@145
|
28 pidgeot-lvl-38
|
rlm@145
|
29 pidgeot-lvl-39
|
rlm@145
|
30 pidgeot-lvl-40])))
|
rlm@145
|
31
|
rlm@145
|
32 ;; inconclusive -- implies that level is calculated from
|
rlm@145
|
33 ;; some other values.
|
rlm@145
|
34
|
rlm@145
|
35
|
rlm@145
|
36 (def name-pidgeotto (read-state "name-pidgeotto"))
|
rlm@145
|
37 (def named-A (read-state "named-A"))
|
rlm@145
|
38 (def named-B (read-state "named-B"))
|
rlm@145
|
39 (def named-C (read-state "named-C"))
|
rlm@145
|
40 (def named-D (read-state "named-D"))
|
rlm@145
|
41 (def named-E (read-state "named-E"))
|
rlm@145
|
42 (def named-F (read-state "named-F"))
|
rlm@145
|
43
|
rlm@145
|
44 (defn name-analysis []
|
rlm@145
|
45 (apply common-differences
|
rlm@145
|
46 (map (comp vec memory)
|
rlm@145
|
47 [named-A
|
rlm@145
|
48 named-B
|
rlm@145
|
49 named-C
|
rlm@145
|
50 named-D
|
rlm@145
|
51 named-E
|
rlm@145
|
52 named-F])))
|
rlm@145
|
53
|
rlm@145
|
54 ;; resluted in 3 separate locations that could
|
rlm@145
|
55 ;; possibly hold the first letter of the pokemon's name
|
rlm@145
|
56
|
rlm@145
|
57 0xCF4A
|
rlm@145
|
58 0xD2EB
|
rlm@145
|
59 0xCEED
|
rlm@145
|
60
|
rlm@145
|
61 ;; try changing each of them
|
rlm@145
|
62
|
rlm@145
|
63
|
rlm@145
|
64 (defn test-cf4a []
|
rlm@145
|
65 (continue!
|
rlm@145
|
66 (set-memory named-A 0xCF4A (character->character-code "Z"))))
|
rlm@145
|
67 ;; result -- pidgeotto named "A"
|
rlm@145
|
68
|
rlm@145
|
69 (defn test-d2eb []
|
rlm@145
|
70 (continue!
|
rlm@145
|
71 (set-memory named-A 0xD2EB (character->character-code "Z"))))
|
rlm@145
|
72 ;; result -- pidgeotto named "Z"
|
rlm@145
|
73
|
rlm@145
|
74 (defn test-ceed []
|
rlm@145
|
75 (continue!
|
rlm@145
|
76 (set-memory named-A 0xCEED (character->character-code "Z"))))
|
rlm@145
|
77 ;; result -- pidgeotto named "A"
|
rlm@145
|
78
|
rlm@145
|
79 (def sixth-pokemon-name-start 0xD2EB)
|
rlm@145
|
80
|
rlm@145
|
81
|
rlm@145
|
82 (defn set-sixth-pokemon-name-first-character
|
rlm@145
|
83 ([state character]
|
rlm@145
|
84 (set-memory state sixth-pokemon-name-start
|
rlm@145
|
85 (character->character-code character)))
|
rlm@145
|
86 ([character]
|
rlm@145
|
87 (set-sixth-pokemon-name-first-character @current-state
|
rlm@145
|
88 character)))
|
rlm@145
|
89
|
rlm@145
|
90
|
rlm@145
|
91
|
rlm@145
|
92
|