diff clojure/com/aurellem/gb/vbm.clj @ 250:b7f682bb3090

updated title and save_corruption to work with all the recent updates
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 03:49:33 -0500
parents 412ca096a9ba
children abd1ca8a25cc
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/vbm.clj	Mon Mar 26 03:09:26 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/vbm.clj	Mon Mar 26 03:49:33 2012 -0500
     1.3 @@ -6,7 +6,7 @@
     1.4  ;;;;;;;;;;;;; read vbm file 
     1.5  
     1.6  (def ^:dynamic *moves-cache*
     1.7 -     (File. user-home "proj/pokemon-escape/moves/"))
     1.8 +     (File. user-home "proj/vba-clojure/moves/"))
     1.9  
    1.10  (defn buttons [mask]
    1.11    (loop [buttons []
    1.12 @@ -60,11 +60,11 @@
    1.13              (recur (conj fixed mask) (drop 3 pending))
    1.14              (recur (conj fixed mask) (next pending)))))))
    1.15  
    1.16 -(defn moves->filename [frame]
    1.17 -  (File. *moves-cache* (format "%07d.vbm" frame)))
    1.18 +(defn moves-filename [name]
    1.19 +  (File. *moves-cache* (format "%s.vbm" name)))
    1.20  
    1.21 -(defn read-moves [frame]
    1.22 -  (let [target (moves->filename frame)]
    1.23 +(defn read-moves [name]
    1.24 +  (let [target (moves-filename name)]
    1.25      (if (.exists target)
    1.26        (vbm-buttons target))))
    1.27  ;;;;;;;;;;;;;; write moves to vbm file
    1.28 @@ -106,8 +106,8 @@
    1.29            vbm-trailer))]
    1.30      contents))
    1.31          
    1.32 -(defn write-moves! [moves]
    1.33 -  (let [target (moves->filename (count moves))]
    1.34 +(defn write-moves! [moves name]
    1.35 +  (let [target (moves-filename name)]
    1.36      (clojure.java.io/copy (buttons->vbm-bytes moves) target)
    1.37      target))
    1.38