# HG changeset patch # User Robert McIntyre # Date 1333801919 18000 # Node ID 25b7bb7da3b1b9ed69cfac792925e4c610228823 # Parent abd1ca8a25ccd5fde5c12303d3bcd4e63e7d9031 Fixed two major bugs related to restart events which were causing desync. The entire video now syncs properly. diff -r abd1ca8a25cc -r 25b7bb7da3b1 clojure/com/aurellem/gb/vbm.clj --- a/clojure/com/aurellem/gb/vbm.clj Sat Apr 07 05:42:26 2012 -0500 +++ b/clojure/com/aurellem/gb/vbm.clj Sat Apr 07 07:31:59 2012 -0500 @@ -56,7 +56,7 @@ pending buttons] (if (empty? pending) fixed (let [mask (first pending)] - (if (contains? (set (first pending)) :reset) + (if (contains? (set (first pending)) :restart) (recur (conj fixed mask) (drop 3 pending)) (recur (conj fixed mask) (next pending))))))) diff -r abd1ca8a25cc -r 25b7bb7da3b1 clojure/com/aurellem/run/bootstrap_0.clj --- a/clojure/com/aurellem/run/bootstrap_0.clj Sat Apr 07 05:42:26 2012 -0500 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Sat Apr 07 07:31:59 2012 -0500 @@ -352,8 +352,6 @@ (aget mem list-cursor-offset-address)))) ([] (list-offset @current-state))) - - (defn exp-item-selection [] (clojure.pprint/pprint (apply memory-compare @@ -433,7 +431,32 @@ (wait-until (partial set-cursor-relative 1)) (play-moves [[:a] []]))) -(defn-memo do-save-corruption +(defn restart + "Two button presses after a restart event are lost when converting to + VBM format. To compensate, step the state forward two steps." + [[moves state :as script]] + (->> [(concat moves [[:restart]]) + (run-moves state [[:restart] + + + ;;[] [] + + ])] + (do-nothing 2))) + +(defn restart + "The two button presses after a restart event are converted to + blanks. Due to weirdness with the VBM format. To compensate, ensure + that the two button presses after restart are both blanks." + [script] + (play-moves [[:restart] [] []] script)) + +(defn restart-wrong + [[moves state :as script]] + [(concat moves [[:restart] [] []]) + (run-moves state [[:restart]])]) + +(defn do-save-corruption ([] (do-save-corruption (walk-to-counter))) ([script] @@ -448,7 +471,8 @@ ;; 0xFF, allowing manipulation of non-pokemon data in RAM ;; via the pokemon interface. [[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] - [] [] [] [] [] [] [] [] [] [] [] [:select] [:restart]]) + [] [] [] [] [] [] [] [] [] [] [] []]) + (restart) (title) (first-difference [] [:start] AF) (first-difference [] [:a] AF)))) @@ -479,12 +503,12 @@ select-menu-entry scroll-text)) -(defn-memo corrupt-item-list +(defn corrupt-item-list "Corrupt the num-of-items variable by switching a corrupted pokemon into out-of-bounds memory." ([] (corrupt-item-list - (corrupted-checkpoint) - ;;(do-save-corruption) + ;;(corrupted-checkpoint) + (do-save-corruption) )) ([script] (->> script @@ -501,7 +525,7 @@ close-menu close-menu))) -(defn-memo get-lots-of-money +(defn get-lots-of-money "Sell 0xFE cancel buttons to make a tremendous amount of money." ([] (get-lots-of-money (corrupt-item-list))) ([script] @@ -520,7 +544,7 @@ (defn note [str script] (println str) script) -(defn-memo buy-bootstrapping-items +(defn buy-bootstrapping-items "Buy items that will become part of the bootstrapping program." ([] (buy-bootstrapping-items (get-lots-of-money))) @@ -550,7 +574,7 @@ (play-moves [[:b]]) end-text))) -(defn-memo corrupt-item-list-again +(defn corrupt-item-list-again ([] (corrupt-item-list-again (buy-bootstrapping-items))) ([script] (->> script @@ -577,8 +601,7 @@ ([script] (->> script ;; leave store - (walk [↓ ↓ → ↓]) - (do-nothing 1)))) + (walk [↓ ↓ → ↓])))) (defn force-encounter [direction script] (delayed-improbability-search @@ -586,7 +609,7 @@ #(search-string % "Wild") (partial move direction) script)) -(defn-memo fight-wild-pokemon +(defn fight-wild-pokemon ([] (fight-wild-pokemon (leave-viridian-store))) ([script] (->> script @@ -595,23 +618,26 @@ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓]) (force-encounter →)))) -(defn-memo run-from-pokemon +(defn run-from-pokemon ([] (run-from-pokemon (fight-wild-pokemon))) ([script] (->> script (scroll-text) + (play-moves [[:a]]) (wait-until select-menu-entry) (set-cursor 1) (first-difference [] → AF) (scroll-text) (scroll-text)))) -(defn-memo to-poke-center-computer +29952 + +(defn to-poke-center-computer ([] (to-poke-center-computer (run-from-pokemon))) ([script] (->> script - (walk-thru-grass [→ ↑]) + (walk-thru-grass [→ → ↑]) (walk [↑ ← ← ← ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ← ← diff -r abd1ca8a25cc -r 25b7bb7da3b1 moves/temp.vbm Binary file moves/temp.vbm has changed