annotate clojure/com/aurellem/items.clj @ 98:08cd8be1edc1

renamed inspect.clj to items.clj
author Robert McIntyre <rlm@mit.edu>
date Mon, 12 Mar 2012 00:31:10 -0500
parents
children 9fad96094950
rev   line source
rlm@98 1 (ns com.aurellem.items
rlm@98 2 (:use (com.aurellem gb-driver vbm title))
rlm@98 3 ;; this is fucking bullshit
rlm@98 4 (:import [com.aurellem.gb_driver SaveState]))
rlm@98 5
rlm@98 6
rlm@98 7
rlm@98 8 (defn game-name []
rlm@98 9 (map char (subvec (vec (memory)) 0x134 0x142)))
rlm@98 10
rlm@98 11
rlm@98 12
rlm@98 13
rlm@98 14
rlm@98 15 (defn current-items [^SaveState state]
rlm@98 16 (set-state! state)
rlm@98 17
rlm@98 18
rlm@98 19 )
rlm@98 20
rlm@98 21
rlm@98 22
rlm@98 23 ;; try just buying five potions in sequence and see what changes
rlm@98 24 ;; each time.
rlm@98 25
rlm@98 26 (defn common-differences [& seqs]
rlm@98 27 (let [backbone (range (count (first seqs)))]
rlm@98 28 (filter
rlm@98 29 (comp (partial apply distinct?) second)
rlm@98 30 (zipmap backbone
rlm@98 31 (apply (partial map list) seqs)))))
rlm@98 32
rlm@98 33 ;; trying to find how items are represented in memory
rlm@98 34
rlm@98 35 (comment
rlm@98 36 (def empty-inventory @current-state)
rlm@98 37
rlm@98 38 (def one-potion @current-state)
rlm@98 39
rlm@98 40 (def two-potions @current-state)
rlm@98 41
rlm@98 42 (def three-potions @current-state)
rlm@98 43
rlm@98 44 (def four-potions @current-state)
rlm@98 45
rlm@98 46 (def five-potions @current-state)
rlm@98 47
rlm@98 48
rlm@98 49 ;; result
rlm@98 50 (def canidates
rlm@98 51 (apply common-differences
rlm@98 52 (map (comp vec memory)
rlm@98 53 [empty-inventory one-potion two-potions three-potions
rlm@98 54 four-potions five-potions])))
rlm@98 55
rlm@98 56 [55875 (37 15 49 27 14 44)]
rlm@98 57 [55876 (30 1 49 56 55 23)]
rlm@98 58 [49158 (154 191 78 135 70 73)]
rlm@98 59 [54087 (49 40 37 34 25 22)]
rlm@98 60 [49160 (7 24 59 243 50 217)]
rlm@98 61 [49704 (31 14 72 33 84 27)]
rlm@98 62 [49162 (126 159 183 110 176 179)]
rlm@98 63 [39984 (0 254 251 248 127 252)]
rlm@98 64 [49904 (29 72 64 78 1 95)]
rlm@98 65 [65491 (222 127 149 132 226 38)]
rlm@98 66 [65492 (44 20 89 11 253 163)]
rlm@98 67 [49335 (52 15 6 14 3 17)]
rlm@98 68 [49720 (78 152 96 60 83 103)]
rlm@98 69 [65304 (19 89 214 33 18 113)]
rlm@98 70 [53561 (132 185 145 162 159 183)]
rlm@98 71 [54046 (0 1 2 3 4 5)])
rlm@98 72
rlm@98 73 ;;; hmmmmmm...... I guess that the potion quantities are at 54046,
rlm@98 74 ;;;huh?
rlm@98 75
rlm@98 76
rlm@98 77
rlm@98 78 (def item-hack (read-state 7999))
rlm@98 79
rlm@98 80 (def item-hack2 (read-state 75882))
rlm@98 81
rlm@98 82 (defn get-mem []
rlm@98 83 (subvec (vec (memory @current-state)) 54040 (+ 54046 100)))
rlm@98 84
rlm@98 85
rlm@98 86 ;; potion -- 99
rlm@98 87 [0 16 0 0 1 20 99 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 88
rlm@98 89 ;; potion -- 95
rlm@98 90 [0 16 0 0 1 20 95 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 91
rlm@98 92 ;; potion -- 95
rlm@98 93 ;; pokeball -- 1
rlm@98 94 [0 16 0 0 2 20 95 4 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 95
rlm@98 96 ;; potion -- 95
rlm@98 97 ;; pokeball -- 10
rlm@98 98 [0 16 0 0 2 20 95 4 10 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 99
rlm@98 100
rlm@98 101 ;; pokeball -- 10
rlm@98 102 ;; potion -- 95
rlm@98 103 [0 16 0 0 2 4 10 20 95 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 104
rlm@98 105 ;; pokeball -- 10
rlm@98 106 ;; potion -- 95
rlm@98 107 ;; antidote -- 1
rlm@98 108
rlm@98 109 ;;prediction
rlm@98 110 ;;[0 16 0 0 3 4 10 20 95 ?? 1 255 0 0 0 0 0 ....]
rlm@98 111 [0 16 0 0 3 4 10 20 95 11 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]
rlm@98 112
rlm@98 113
rlm@98 114
rlm@98 115 ;; now it's time to learn the item codes
rlm@98 116
rlm@98 117 (def item-hack-3 (read-state 77557))
rlm@98 118 (defn show-item
rlm@98 119 "Run a saved pokemon with the first item replaced by the item named
rlm@98 120 by n."
rlm@98 121 [n]
rlm@98 122 (set-state! item-hack-3)
rlm@98 123 (let [mem (memory)]
rlm@98 124 (aset mem 54045 n)
rlm@98 125 (write-memory! mem))
rlm@98 126 (step)
rlm@98 127 (->> [[] @current-state]
rlm@98 128 (play-moves
rlm@98 129 [[:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
rlm@98 130 [] [] [] [] []])))
rlm@98 131
rlm@98 132
rlm@98 133 (defn get-item-names []
rlm@98 134 (dorun (map (fn [n] (println n)
rlm@98 135 (show-item n)
rlm@98 136 (Thread/sleep 5000))
rlm@98 137 (range 0x00 0xFF))))
rlm@98 138
rlm@98 139
rlm@98 140
rlm@98 141 ;; 0 garbage
rlm@98 142 ;; 1 master-ball
rlm@98 143 ;; 2 ultra-ball
rlm@98 144 ;; 3 great-ball
rlm@98 145 ;; 4 poke-ball
rlm@98 146 ;; 5 town-map
rlm@98 147 ;; 6 bicycle
rlm@98 148 ;; 7 ?????
rlm@98 149 ;; 8 safari-ball
rlm@98 150 ;; 9 pokedex
rlm@98 151 ;; 10 moon-stone
rlm@98 152 ;; 11 antidote
rlm@98 153 ;; 12 burn-heal
rlm@98 154 ;; 13 ice-heal
rlm@98 155 ;; 14 awakening
rlm@98 156 ;; 15 parlyz-heal
rlm@98 157 ;; 16 full-restore
rlm@98 158 ;; 17 max-potion
rlm@98 159 ;; 18 hyper-potion
rlm@98 160 ;; 19 super-potion
rlm@98 161 ;; 20 potion
rlm@98 162 ;; 21 boulderbadge
rlm@98 163 ;; 22 cascadebadge
rlm@98 164 ;; 23 thunderbadge
rlm@98 165 ;; 24 rainbowbadge
rlm@98 166 ;; 25 soulbadge
rlm@98 167 ;; 26 marshbadge
rlm@98 168 ;; 27 volcanobadge
rlm@98 169 ;; 28 earthbadge
rlm@98 170 ;; 29 escape-rope
rlm@98 171 ;; 30 repel
rlm@98 172 ;; 31 old amber
rlm@98 173 ;; 32 fire-stone
rlm@98 174 ;; 33 thunderstone
rlm@98 175 ;; 34 water-stone
rlm@98 176 ;; 35 hp-up
rlm@98 177 ;; 36 protein
rlm@98 178 ;; 37 iron
rlm@98 179 ;; 38 carbos
rlm@98 180 ;; 39 calcium
rlm@98 181 ;; 40 rare-candy
rlm@98 182 ;; 41 dome-fossil
rlm@98 183 ;; 42 helix-fossil
rlm@98 184 ;; 43 secret-key
rlm@98 185 ;; 44 ?????
rlm@98 186 ;; 45 bike-voucher
rlm@98 187 ;; 46 x-accuracy
rlm@98 188 ;; 47 leaf-stone
rlm@98 189 ;; 48 card-key
rlm@98 190 ;; 49 nugget
rlm@98 191 ;; 50 pp-up
rlm@98 192 ;; 51 poke-doll
rlm@98 193 ;; 52 full-heal
rlm@98 194 ;; 53 revive
rlm@98 195 ;; 54 max-revive
rlm@98 196 ;; 55 guard-spec.
rlm@98 197 ;; 56 super-repel
rlm@98 198 ;; 57 max-repel
rlm@98 199 ;; 58 dire-hit
rlm@98 200 ;; 59 coin
rlm@98 201 ;; 60 fresh-water
rlm@98 202 ;; 61 soda-pop
rlm@98 203 ;; 62 lemonade
rlm@98 204 ;; 63 s.s.ticket
rlm@98 205 ;; 64 gold-teeth
rlm@98 206 ;; 65 x-attach
rlm@98 207 ;; 66 x-defend
rlm@98 208 ;; 67 x-speed
rlm@98 209 ;; 68 x-special
rlm@98 210 ;; 69 coin-case
rlm@98 211 ;; 70 oak's-parcel
rlm@98 212 ;; 71 itemfinder
rlm@98 213 ;; 72 silph-scope
rlm@98 214 ;; 73 poke-flute
rlm@98 215 ;; 74 lift-key
rlm@98 216 ;; 75 exp.all
rlm@98 217 ;; 76 old-rod
rlm@98 218 ;; 77 good-rod
rlm@98 219 ;; 78 super-rod
rlm@98 220 ;; 79 pp-up
rlm@98 221 ;; 80 ether
rlm@98 222 ;; 81 max-ether
rlm@98 223 ;; 82 elixer
rlm@98 224 ;; 83 max-elixer
rlm@98 225 ;; 84 B2F
rlm@98 226 ;; 85 B1F
rlm@98 227 ;; 86 1F
rlm@98 228 ;; 87 2F
rlm@98 229 ;; 88 3F
rlm@98 230 ;; 89 4F
rlm@98 231 ;; 90 5F
rlm@98 232 ;; 91 6F
rlm@98 233 ;; 92 7F
rlm@98 234 ;; 93 8F
rlm@98 235 ;; 94 9F
rlm@98 236 ;; 95 10F
rlm@98 237 ;; 96 11F
rlm@98 238 ;; 97 B4F
rlm@98 239 ;; 98 garbage
rlm@98 240 ;; 99 garbage
rlm@98 241 ;; 100 garbage
rlm@98 242 ;; 101 garbage
rlm@98 243 ;; 102 garbage
rlm@98 244 ;; 103 garbage
rlm@98 245 ;; 104 garbage
rlm@98 246 ;; 105 garbage
rlm@98 247 ;; 106 garbage
rlm@98 248 ;; 107 garbage
rlm@98 249 ;; 108 garbage
rlm@98 250 ;; 109 garbage
rlm@98 251 ;; 110 garbage
rlm@98 252 ;; 111 garbage
rlm@98 253 ;; 112 garbage
rlm@98 254 ;; 113 garbage
rlm@98 255 ;; 114 garbage
rlm@98 256 ;; 115 garbage
rlm@98 257 ;; 116 garbage
rlm@98 258 ;; 117 garbage
rlm@98 259 ;; 118 garbage
rlm@98 260 ;; 119 4
rlm@98 261 ;; 120 garbage
rlm@98 262 ;; 121 garbage
rlm@98 263 ;; 122 slow
rlm@98 264 ;; 123 garbage
rlm@98 265 ;; 124 garbage
rlm@98 266 ;; 125 garbage
rlm@98 267 ;; 126 garbage
rlm@98 268 ;; 127 garbage
rlm@98 269 ;; 128 garbage
rlm@98 270 ;; 129 garbage
rlm@98 271 ;; 130 garbage
rlm@98 272 ;; 131 slow
rlm@98 273 ;; 132 slow
rlm@98 274 ;; 133 garbage
rlm@98 275 ;; 134 slow
rlm@98 276 ;; 135 garbage
rlm@98 277 ;; 136 garbage
rlm@98 278 ;; 137 slow
rlm@98 279 ;; 138 garbage
rlm@98 280 ;; 139 garbage
rlm@98 281 ;; 140 garbage
rlm@98 282 ;; 141 slow
rlm@98 283 ;; 142 garbage
rlm@98 284 ;; 143 garbage
rlm@98 285 ;; 144 garbage
rlm@98 286 ;; 145 garbage
rlm@98 287 ;; 146 garbage
rlm@98 288 ;; 147 garbage
rlm@98 289 ;; 148 garbage
rlm@98 290 ;; 149 garbage
rlm@98 291 ;; 150 slow
rlm@98 292 ;; 151 garbage
rlm@98 293 ;; 152 Q
rlm@98 294 ;; 153 garbage
rlm@98 295 ;; 154 garbage
rlm@98 296 ;; 155 garbage
rlm@98 297 ;; 156 garbage
rlm@98 298 ;; 157 garbage
rlm@98 299 ;; 158 garbage
rlm@98 300 ;; 159 garbage
rlm@98 301 ;; 160 garbage (alaphabet)
rlm@98 302 ;; 161 garbage
rlm@98 303 ;; 162 garbage
rlm@98 304 ;; 163 garbage
rlm@98 305 ;; 164 rival's
rlm@98 306 ;; 165 name?
rlm@98 307 ;; 166 nickname?
rlm@98 308 ;; 167 slow
rlm@98 309 ;; 168 garbage
rlm@98 310 ;; 169 slow
rlm@98 311 ;; 170 garbage
rlm@98 312 ;; 171 garbage
rlm@98 313 ;; 172 garbage
rlm@98 314 ;; 173 garbage
rlm@98 315 ;; 174 garbage
rlm@98 316 ;; 175 yellow
rlm@98 317 ;; 176 ash
rlm@98 318 ;; 177 jack
rlm@98 319 ;; 178 new-name
rlm@98 320 ;; 179 blue
rlm@98 321 ;; 180 gary
rlm@98 322 ;; 181 john
rlm@98 323 ;; 182 garbage
rlm@98 324 ;; 183 garbage
rlm@98 325 ;; 184 garbage
rlm@98 326 ;; 185 garbage
rlm@98 327 ;; 186 slow
rlm@98 328 ;; 187 garbage
rlm@98 329 ;; 188 garbage
rlm@98 330 ;; 189 garbage
rlm@98 331 ;; 190 garbage
rlm@98 332 ;; 191 garbage
rlm@98 333 ;; 192 garbage
rlm@98 334 ;; 193 garbage
rlm@98 335 ;; 194 garbage
rlm@98 336 ;; 195 slow
rlm@98 337 ;; 196 HM01
rlm@98 338 ;; 197 HM02
rlm@98 339 ;; 198 HM03
rlm@98 340 ;; 199 HM04
rlm@98 341 ;; 200 HM05
rlm@98 342 ;; 201 TM01
rlm@98 343 ;; 202 TM02
rlm@98 344 ;; 203 TM03
rlm@98 345 ;; 204 TM04
rlm@98 346 ;; 205 TM05
rlm@98 347 ;; 206 TM06
rlm@98 348 ;; 207 TM07
rlm@98 349 ;; 208 TM08
rlm@98 350 ;; 209 TM09
rlm@98 351 ;; 210 TM10
rlm@98 352 ;; 211 TM11
rlm@98 353 ;; 212 TM12
rlm@98 354 ;; 213 TM13
rlm@98 355 ;; 214 TM13
rlm@98 356 ;; 215 TM15
rlm@98 357 ;; 216 TM16
rlm@98 358 ;; 217 TM17
rlm@98 359 ;; 218 TM18
rlm@98 360 ;; 219 TM19
rlm@98 361 ;; 220 TM20
rlm@98 362 ;; 221 TM21
rlm@98 363 ;; 222 TM22
rlm@98 364 ;; 223 TM23
rlm@98 365 ;; 224 TM24
rlm@98 366 ;; 225 TM25
rlm@98 367 ;; 226 TM26
rlm@98 368 ;; 227 TM27
rlm@98 369 ;; 228 TM28
rlm@98 370 ;; 229 TM29
rlm@98 371 ;; 230 TM30
rlm@98 372 ;; 231 TM31
rlm@98 373 ;; 232 TM32
rlm@98 374 ;; 233 TM33
rlm@98 375 ;; 234 TM34
rlm@98 376 ;; 235 TM35
rlm@98 377 ;; 236 TM36
rlm@98 378 ;; 237 TM37
rlm@98 379 ;; 238 TM38
rlm@98 380 ;; 239 TM39
rlm@98 381 ;; 240 TM40
rlm@98 382 ;; 241 TM41
rlm@98 383 ;; 242 TM42
rlm@98 384 ;; 243 TM43
rlm@98 385 ;; 244 TM44
rlm@98 386 ;; 245 TM45
rlm@98 387 ;; 246 TM46
rlm@98 388 ;; 247 TM47
rlm@98 389 ;; 248 TM48
rlm@98 390 ;; 249 TM49
rlm@98 391 ;; 250 TM50
rlm@98 392 ;; 251 TM51
rlm@98 393 ;; 252 TM52
rlm@98 394 ;; 253 TM53
rlm@98 395 ;; 254 TM54
rlm@98 396 ;; 255 end-of-list-sentinel
rlm@98 397
rlm@98 398
rlm@98 399
rlm@98 400
rlm@98 401
rlm@98 402
rlm@98 403