changeset 336:25b7bb7da3b1

Fixed two major bugs related to restart events which were causing desync. The entire video now syncs properly.
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Apr 2012 07:31:59 -0500
parents abd1ca8a25cc
children 2dd40f6b6a1f
files clojure/com/aurellem/gb/vbm.clj clojure/com/aurellem/run/bootstrap_0.clj moves/temp.vbm
diffstat 3 files changed, 43 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/vbm.clj	Sat Apr 07 05:42:26 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/vbm.clj	Sat Apr 07 07:31:59 2012 -0500
     1.3 @@ -56,7 +56,7 @@
     1.4           pending buttons]
     1.5      (if (empty? pending) fixed
     1.6          (let [mask (first pending)]
     1.7 -          (if (contains? (set (first pending)) :reset)
     1.8 +          (if (contains? (set (first pending)) :restart)
     1.9              (recur (conj fixed mask) (drop 3 pending))
    1.10              (recur (conj fixed mask) (next pending)))))))
    1.11  
     2.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj	Sat Apr 07 05:42:26 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj	Sat Apr 07 07:31:59 2012 -0500
     2.3 @@ -352,8 +352,6 @@
     2.4            (aget mem list-cursor-offset-address))))
     2.5    ([] (list-offset @current-state)))
     2.6  
     2.7 -
     2.8 -
     2.9  (defn exp-item-selection []
    2.10    (clojure.pprint/pprint
    2.11     (apply memory-compare
    2.12 @@ -433,7 +431,32 @@
    2.13         (wait-until (partial set-cursor-relative 1))
    2.14         (play-moves [[:a] []])))
    2.15  
    2.16 -(defn-memo do-save-corruption
    2.17 +(defn restart
    2.18 +  "Two button presses after a restart event are lost when converting to
    2.19 +   VBM format.  To compensate, step the state forward two steps."
    2.20 +  [[moves state :as script]]
    2.21 +  (->> [(concat moves [[:restart]])
    2.22 +        (run-moves state [[:restart]
    2.23 +
    2.24 +
    2.25 +                          ;;[] []
    2.26 +
    2.27 +                          ])]
    2.28 +       (do-nothing 2)))
    2.29 +
    2.30 +(defn restart
    2.31 +  "The two button presses after a restart event are converted to
    2.32 +   blanks. Due to weirdness with the VBM format. To compensate, ensure
    2.33 +   that the two button presses after restart are both blanks."
    2.34 +  [script]
    2.35 +  (play-moves [[:restart] [] []] script))
    2.36 +
    2.37 +(defn restart-wrong
    2.38 +  [[moves state :as script]]
    2.39 +  [(concat moves [[:restart] [] []])
    2.40 +   (run-moves state [[:restart]])])
    2.41 +    
    2.42 +(defn do-save-corruption
    2.43    ([] (do-save-corruption
    2.44         (walk-to-counter)))
    2.45    ([script]
    2.46 @@ -448,7 +471,8 @@
    2.47             ;; 0xFF, allowing manipulation of non-pokemon data in RAM
    2.48             ;; via the pokemon interface.
    2.49             [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
    2.50 -            [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]])
    2.51 +            [] [] [] [] [] [] [] [] [] [] [] []])
    2.52 +          (restart)
    2.53            (title)
    2.54            (first-difference [] [:start] AF)
    2.55            (first-difference [] [:a] AF))))
    2.56 @@ -479,12 +503,12 @@
    2.57         select-menu-entry
    2.58         scroll-text))
    2.59  
    2.60 -(defn-memo corrupt-item-list
    2.61 +(defn corrupt-item-list
    2.62    "Corrupt the num-of-items variable by switching a corrupted pokemon
    2.63     into out-of-bounds memory."
    2.64    ([] (corrupt-item-list
    2.65 -       (corrupted-checkpoint)
    2.66 -       ;;(do-save-corruption)
    2.67 +       ;;(corrupted-checkpoint)
    2.68 +       (do-save-corruption)
    2.69         ))
    2.70    ([script]
    2.71       (->> script
    2.72 @@ -501,7 +525,7 @@
    2.73            close-menu
    2.74            close-menu)))
    2.75  
    2.76 -(defn-memo get-lots-of-money
    2.77 +(defn get-lots-of-money
    2.78    "Sell 0xFE cancel buttons to make a tremendous amount of money."
    2.79    ([] (get-lots-of-money (corrupt-item-list)))
    2.80    ([script]
    2.81 @@ -520,7 +544,7 @@
    2.82  (defn note [str script]
    2.83    (println str) script)
    2.84  
    2.85 -(defn-memo buy-bootstrapping-items
    2.86 +(defn buy-bootstrapping-items
    2.87    "Buy items that will become part of the bootstrapping
    2.88     program."
    2.89    ([] (buy-bootstrapping-items (get-lots-of-money)))
    2.90 @@ -550,7 +574,7 @@
    2.91            (play-moves [[:b]])
    2.92            end-text)))
    2.93  
    2.94 -(defn-memo corrupt-item-list-again
    2.95 +(defn corrupt-item-list-again
    2.96    ([] (corrupt-item-list-again (buy-bootstrapping-items)))
    2.97    ([script]
    2.98       (->> script
    2.99 @@ -577,8 +601,7 @@
   2.100    ([script]
   2.101       (->> script
   2.102            ;; leave store
   2.103 -          (walk [↓ ↓ → ↓])
   2.104 -          (do-nothing 1))))
   2.105 +          (walk [↓ ↓ → ↓]))))
   2.106  
   2.107  (defn force-encounter [direction script]
   2.108    (delayed-improbability-search
   2.109 @@ -586,7 +609,7 @@
   2.110     #(search-string % "Wild")
   2.111     (partial move direction) script))
   2.112                                  
   2.113 -(defn-memo fight-wild-pokemon
   2.114 +(defn fight-wild-pokemon
   2.115    ([] (fight-wild-pokemon (leave-viridian-store)))
   2.116    ([script]
   2.117       (->> script
   2.118 @@ -595,23 +618,26 @@
   2.119                   ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓])
   2.120            (force-encounter →))))
   2.121  
   2.122 -(defn-memo run-from-pokemon
   2.123 +(defn run-from-pokemon
   2.124    ([] (run-from-pokemon (fight-wild-pokemon)))
   2.125    ([script]
   2.126       (->> script
   2.127            (scroll-text)
   2.128 +          (play-moves [[:a]])
   2.129            (wait-until select-menu-entry)
   2.130            (set-cursor 1)
   2.131            (first-difference [] → AF)
   2.132            (scroll-text)
   2.133            (scroll-text))))
   2.134  
   2.135 -(defn-memo to-poke-center-computer
   2.136 +29952
   2.137 +
   2.138 +(defn to-poke-center-computer
   2.139    ([] (to-poke-center-computer
   2.140         (run-from-pokemon)))
   2.141    ([script]
   2.142       (->> script
   2.143 -          (walk-thru-grass [→ ↑])
   2.144 +          (walk-thru-grass [→ → ↑])
   2.145            (walk [↑ ← ← ←
   2.146                   ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
   2.147                   ← ←
     3.1 Binary file moves/temp.vbm has changed