changeset 212:8523faa122b0

fixed compilaition error in dylan's code
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 18:06:37 -0500
parents 661d35f1b56e
children 57258c269bcb 62969eb07e04
files clojure/com/aurellem/exp/item_bridge.clj clojure/com/aurellem/gb/pokemon.clj clojure/com/aurellem/gb/species.clj clojure/com/aurellem/gb/util.clj save-states/jiggly-0-pp.sav save-states/jiggly-1-pp.sav save-states/jiggly-15-pp.sav save-states/jiggly-2-pp.sav save-states/jiggly-3-pp.sav save-states/jiggly-4-pp.sav save-states/jiggly-lvl-3.sav save-states/jiggly-struggle-once.sav save-states/syn-jiggly-0-pp.sav save-states/syn-jiggly-1-pp.sav save-states/syn-jiggly-2-pp.sav save-states/syn-jiggly-3-pp.sav save-states/syn-jiggly-4-pp.sav
diffstat 17 files changed, 86 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/exp/item_bridge.clj	Fri Mar 23 05:58:41 2012 -0500
     1.2 +++ b/clojure/com/aurellem/exp/item_bridge.clj	Fri Mar 23 18:06:37 2012 -0500
     1.3 @@ -119,15 +119,11 @@
     1.4  (defn mid-game-corrupt []
     1.5    (read-state "corrupt-mid-game"))
     1.6  
     1.7 -(defn prepare-memory
     1.8 -  ([^SaveState state]
     1.9 -     (-> state
    1.10 -         (set-memory-range 0xD31D (loop-program))
    1.11 -         (set-memory-range 0xD336 [0x1D 0xD3])))
    1.12 -  ([] (prepare-memory @current-state)))
    1.13 +
    1.14       
    1.15  
    1.16  
    1.17 +
    1.18  (defn test-memory-fun [n]
    1.19    (capture-program-counter
    1.20     (set-memory-range
    1.21 @@ -141,3 +137,29 @@
    1.22  ;;(def bad (test-memory-fun 18000))
    1.23  
    1.24  
    1.25 +
    1.26 +(defn menu-open-state []
    1.27 +  (read-state "menu-open"))
    1.28 +
    1.29 +(defn prepare-memory
    1.30 +  ([^SaveState state]
    1.31 +     (-> state
    1.32 +         (set-memory-range 0xD31D (loop-program))
    1.33 +         (set-memory-range 0xD36D [0x1D 0xD3])))
    1.34 +  ([] (prepare-memory @current-state)))
    1.35 +
    1.36 +
    1.37 +(defn succesful-PC-capture
    1.38 +  "This function demonstrates successful PC capturing by
    1.39 +   setting 0xD36D to the value of the start location of
    1.40 +   a specially prepared program.
    1.41 +
    1.42 +   You must run the function and then exit the open menu
    1.43 +   to see the effect."
    1.44 +  []
    1.45 +  (dorun
    1.46 +   (map #(println (Integer/toHexString %))
    1.47 +        (capture-program-counter 
    1.48 +         (prepare-memory (menu-open-state))
    1.49 +         9000000))))
    1.50 +			      
    1.51 \ No newline at end of file
     2.1 --- a/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 05:58:41 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/pokemon.clj	Fri Mar 23 18:06:37 2012 -0500
     2.3 @@ -447,6 +447,56 @@
     2.4             (give-moves-pps poke-num (:moves pokemon*))
     2.5             (give-status poke-num (:status pokemon*))
     2.6             (give-stats  poke-num (:stats  pokemon*))
     2.7 -           (give-experience poke-num (:experience pokemon*)))))
     2.8 +           (give-experience poke-num (:experience pokemon*))
     2.9 +
    2.10 +           ;; this was 11 dec
    2.11 +           (set-memory (+ 0xD16D
    2.12 +                          (* pokemon-record-width poke-num))
    2.13 +                          0x00))))
    2.14    ([poke-num pokemon]
    2.15 -     (give-pokemon @current-state poke-num pokemon)))
    2.16 \ No newline at end of file
    2.17 +     (give-pokemon @current-state poke-num pokemon)))
    2.18 +
    2.19 +(defn edit-pokemon
    2.20 +  ([^SaveState state poke-num new-pokemon-data]
    2.21 +     (give-pokemon state poke-num
    2.22 +                   (merge (pokemon state poke-num)
    2.23 +                          new-pokemon-data)))
    2.24 +  ([poke-num new-pokemon-data]
    2.25 +     (edit-pokemon @current-state poke-num new-pokemon-data)))
    2.26 +
    2.27 +
    2.28 +
    2.29 +(def jiggly-lvl-3 (read-state "jiggly-lvl-3"))
    2.30 +
    2.31 +(def jiggly-4-pp (read-state "jiggly-4-pp"))
    2.32 +
    2.33 +(def jiggly-3-pp (read-state "jiggly-3-pp"))
    2.34 +
    2.35 +(def jiggly-2-pp (read-state "jiggly-2-pp"))
    2.36 +
    2.37 +(def jiggly-1-pp (read-state "jiggly-1-pp"))
    2.38 +
    2.39 +(def jiggly-0-pp (read-state "jiggly-0-pp"))
    2.40 +
    2.41 +(def jiggly-struggle-once (read-state "jiggly-struggle-once"))
    2.42 +
    2.43 +
    2.44 +(def poke-syn-jiggly-4-pp
    2.45 +  {:name "JIGGLYPUFF", :species :jigglypuff, :species2 :jigglypuff,
    2.46 +   :status :normal,
    2.47 +   :moves [[:sing {:pp-ups 0, :current-pp 4}]],
    2.48 +   :dv {:attack 8, :defense 7, :speed 4, :special 12, :hp 4},
    2.49 +   :experience {:main-exp 21, :hp-exp 0, :attack-exp 0, :defense-exp
    2.50 +                0, :speed-exp 0, :special-exp 0}, 
    2.51 +   :type [:normal],
    2.52 +   :original-trainer "RLM",
    2.53 +   :stats {:level 3, :current-hp 5, :hp 20, :attack 8, :defense 6,
    2.54 +           :speed 6, :special 7}, 
    2.55 +   :ID 5195})
    2.56 +  
    2.57 +
    2.58 +(def syn-jiggly-4-pp (read-state "syn-jiggly-4-pp"))
    2.59 +(def syn-jiggly-3-pp (read-state "syn-jiggly-3-pp"))
    2.60 +(def syn-jiggly-2-pp (read-state "syn-jiggly-2-pp"))
    2.61 +(def syn-jiggly-1-pp (read-state "syn-jiggly-1-pp"))
    2.62 +(def syn-jiggly-0-pp (read-state "syn-jiggly-0-pp")) 
    2.63 \ No newline at end of file
     3.1 --- a/clojure/com/aurellem/gb/species.clj	Fri Mar 23 05:58:41 2012 -0500
     3.2 +++ b/clojure/com/aurellem/gb/species.clj	Fri Mar 23 18:06:37 2012 -0500
     3.3 @@ -12,7 +12,7 @@
     3.4                      (take (* count-species name-length)
     3.5                            (drop 0xE8000
     3.6                                  (rom(root)))))))) 
     3.7 -)
     3.8 +
     3.9  (def hxc-items
    3.10    "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    3.11    (map character-codes->str
     4.1 --- a/clojure/com/aurellem/gb/util.clj	Fri Mar 23 05:58:41 2012 -0500
     4.2 +++ b/clojure/com/aurellem/gb/util.clj	Fri Mar 23 18:06:37 2012 -0500
     4.3 @@ -106,6 +106,11 @@
     4.4       (zipmap backbone
     4.5               (apply (partial map list) seqs)))))
     4.6  
     4.7 +(defn temporal-compare [& states]
     4.8 +  (apply common-differences
     4.9 +         (map (comp vec memory)
    4.10 +              states)))
    4.11 +
    4.12  (defn mid-game []
    4.13    (read-state "mid-game"))
    4.14  
     5.1 Binary file save-states/jiggly-0-pp.sav has changed
     6.1 Binary file save-states/jiggly-1-pp.sav has changed
     7.1 Binary file save-states/jiggly-15-pp.sav has changed
     8.1 Binary file save-states/jiggly-2-pp.sav has changed
     9.1 Binary file save-states/jiggly-3-pp.sav has changed
    10.1 Binary file save-states/jiggly-4-pp.sav has changed
    11.1 Binary file save-states/jiggly-lvl-3.sav has changed
    12.1 Binary file save-states/jiggly-struggle-once.sav has changed
    13.1 Binary file save-states/syn-jiggly-0-pp.sav has changed
    14.1 Binary file save-states/syn-jiggly-1-pp.sav has changed
    15.1 Binary file save-states/syn-jiggly-2-pp.sav has changed
    16.1 Binary file save-states/syn-jiggly-3-pp.sav has changed
    17.1 Binary file save-states/syn-jiggly-4-pp.sav has changed