rlm@142: (ns com.aurellem.pokemon rlm@143: "Here I find out how pokemon are stored in memory." rlm@142: (:use (com.aurellem gb-driver vbm rlm@143: rival-name rlm@142: title save-corruption items assembly)) rlm@143: (:use com.aurellem.experiments.items) rlm@142: (:import [com.aurellem.gb_driver SaveState])) rlm@142: rlm@142: rlm@143: (def pidgeot-lvl-36 (mid-game)) rlm@142: rlm@142: rlm@143: (def pidgeot-lvl-37 (read-state "pidgeot-lvl-37")) rlm@143: rlm@143: rlm@143: (def pidgeot-lvl-38 (read-state "pidgeot-lvl-38")) rlm@143: rlm@143: rlm@143: (def pidgeot-lvl-39 (read-state "pidgeot-lvl-39")) rlm@143: rlm@143: rlm@143: (def pidgeot-lvl-40 (read-state "pidgeot-lvl-40")) rlm@143: rlm@143: rlm@143: (defn level-analysis [] rlm@143: (apply common-differences rlm@143: (map (comp vec memory) rlm@143: [pidgeot-lvl-36 rlm@143: pidgeot-lvl-37 rlm@143: pidgeot-lvl-38 rlm@143: pidgeot-lvl-39 rlm@143: pidgeot-lvl-40]))) rlm@143: rlm@143: ;; inconclusive -- implies that level is calculated from rlm@143: ;; some other values. rlm@143: rlm@143: rlm@143: (def name-pidgeotto (read-state "name-pidgeotto")) rlm@143: (def named-A (read-state "named-A")) rlm@143: (def named-B (read-state "named-B")) rlm@143: (def named-C (read-state "named-C")) rlm@143: (def named-D (read-state "named-D")) rlm@143: (def named-E (read-state "named-E")) rlm@143: (def named-F (read-state "named-F")) rlm@143: rlm@143: (defn name-analysis [] rlm@143: (apply common-differences rlm@143: (map (comp vec memory) rlm@143: [named-A rlm@143: named-B rlm@143: named-C rlm@143: named-D rlm@143: named-E rlm@143: named-F]))) rlm@143: rlm@143: ;; resluted in 3 separate locations that could rlm@143: ;; possibly hold the first letter of the pokemon's name rlm@143: rlm@143: 0xCF4A rlm@143: 0xD2EB rlm@143: 0xCEED rlm@143: rlm@143: ;; try changing each of them rlm@143: rlm@143: rlm@143: (defn test-cf4a [] rlm@143: (continue! rlm@143: (set-memory named-A 0xCF4A (character->character-code "Z")))) rlm@143: ;; result -- pidgeotto named "A" rlm@143: rlm@143: (defn test-d2eb [] rlm@143: (continue! rlm@143: (set-memory named-A 0xD2EB (character->character-code "Z")))) rlm@143: ;; result -- pidgeotto named "Z" rlm@143: rlm@143: (defn test-ceed [] rlm@143: (continue! rlm@143: (set-memory named-A 0xCEED (character->character-code "Z")))) rlm@143: ;; result -- pidgeotto named "A" rlm@143: rlm@143: (def sixth-pokemon-name-start 0xD2EB) rlm@143: rlm@143: rlm@143: (defn set-sixth-pokemon-name-first-character rlm@143: ([state character] rlm@143: (set-memory state sixth-pokemon-name-start rlm@143: (character->character-code character))) rlm@143: ([character] rlm@143: (set-sixth-pokemon-name-first-character @current-state rlm@143: character))) rlm@143: rlm@143: rlm@143: rlm@143: