rlm@95: (ns com.aurellem.inspect rlm@95: (:use (com.aurellem gb-driver vbm)) rlm@95: ;; this is fucking bullshit rlm@95: (:import [com.aurellem.gb_driver SaveState])) rlm@95: rlm@95: rlm@95: rlm@95: (defn game-name [] rlm@95: (map char (subvec (vec (memory)) 0x134 0x142))) rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: (defn current-items [^SaveState state] rlm@95: (set-state! state) rlm@95: rlm@95: rlm@95: ) rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: rlm@95: ;; try just buying five potions in sequence and see what changes rlm@95: ;; each time. rlm@95: rlm@95: (defn common-differences [& seqs] rlm@95: (let [backbone (range (count (first seqs)))] rlm@95: (filter rlm@95: (comp (partial apply distinct?) second) rlm@95: (zipmap backbone rlm@95: (apply (partial map list) seqs))))) rlm@95: rlm@95: ;; trying to find how items are represented in memory rlm@95: rlm@95: (def empty-inventory @current-state) rlm@95: rlm@95: (def one-potion @current-state) rlm@95: rlm@95: (def two-potions @current-state) rlm@95: rlm@95: (def three-potions @current-state) rlm@95: rlm@95: (def four-potions @current-state) rlm@95: rlm@95: (def five-potions @current-state) rlm@95: rlm@95: rlm@95: ;; result rlm@95: (def canidates rlm@95: (apply common-differences rlm@95: (map (comp vec memory) rlm@95: [empty-inventory one-potion two-potions three-potions rlm@95: four-potions five-potions]))) rlm@95: rlm@95: (comment rlm@95: [55875 (37 15 49 27 14 44)] rlm@95: [55876 (30 1 49 56 55 23)] rlm@95: [49158 (154 191 78 135 70 73)] rlm@95: [54087 (49 40 37 34 25 22)] rlm@95: [49160 (7 24 59 243 50 217)] rlm@95: [49704 (31 14 72 33 84 27)] rlm@95: [49162 (126 159 183 110 176 179)] rlm@95: [39984 (0 254 251 248 127 252)] rlm@95: [49904 (29 72 64 78 1 95)] rlm@95: [65491 (222 127 149 132 226 38)] rlm@95: [65492 (44 20 89 11 253 163)] rlm@95: [49335 (52 15 6 14 3 17)] rlm@95: [49720 (78 152 96 60 83 103)] rlm@95: [65304 (19 89 214 33 18 113)] rlm@95: [53561 (132 185 145 162 159 183)] rlm@95: [54046 (0 1 2 3 4 5)]) rlm@95: rlm@95: ;;; hmmmmmm...... I guess that the potion quantities are at 54046, huh?