comparison clojure/com/aurellem/run/basic_choreo.clj @ 542:614eddc5b38c

working on generating first major video.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Jun 2012 16:08:56 -0500
parents cd557c922cec
children 6c379ee3d46e
comparison
equal deleted inserted replaced
541:cd557c922cec 542:614eddc5b38c
1 ;;;; "Basic Choreography" -- just show off audio/video
2
1 (ns com.aurellem.run.basic_choreo 3 (ns com.aurellem.run.basic_choreo
2 (:use (com.aurellem.gb saves gb-driver util constants 4 (:use (com.aurellem.gb saves gb-driver util constants
3 items vbm characters money 5 items vbm characters money
4 rlm-assembly)) 6 rlm-assembly))
5 (:use (com.aurellem.run util music title save-corruption 7 (:use (com.aurellem.run util music title save-corruption
6 bootstrap-0 bootstrap-1 image 8 bootstrap-0 bootstrap-1 image
7 ram-display)) 9 ram-display final-cut))
8 (:require clojure.string) 10 (:require clojure.string)
9 (:import [com.aurellem.gb.gb_driver SaveState]) 11 (:import [com.aurellem.gb.gb_driver SaveState])
10 (:import java.io.File)) 12 (:import java.io.File))
11 13
12
13
14 ;; take over game 14 ;; take over game
15 ;; [X] silence noise 15 ;; [X] silence noise
16 ;; [ ] run picture program to display pinkie pie mark 16 ;; [X] preload audio/video programs
17 ;; [ ] play pony song 17 ;; [X] run picture program to display pinkie pie mark
18 18 ;; [X] play pony song
19 19
20 (defn-memo silence-noise 20 (defn-memo silence-noise
21 ([] (silence-noise (relocate-main-bootstrap))) 21 ([] (silence-noise (launch-main-bootstrap-program)))
22 ([script] 22 ([script]
23 (->> script 23 (->> script
24 (write-RAM 0xFF1A [0 0 0])))) 24 (write-RAM 0xFF1A [0 0 0])
25 (relocate-main-bootstrap))))
25 26
26 (def music-program-start 0xC000) 27 (def music-program-start 0xC000)
27 (def image-program-start 0xCE00) 28 (def image-program-start 0xCE00)
28 29
29 (defn-memo write-pony-music-data 30 (defn-memo write-pony-music
30 ([] (write-pony-music-data (silence-noise))) 31 ([] (write-pony-music (silence-noise)))
31 ([script] 32 ([script]
32 (let [bytes (midi-bytes 33 (let [bytes (midi-bytes
33 pony-csv 34 pony-csv
34 0xC400 35 0xC400
35 0xC800 36 0xC800
36 0xCC00 37 0xCC00
37 0xC000)] 38 music-program-start)]
38 (->> script 39 (->> script
39 (write-RAM (:address (:voice-1 bytes)) 40 (write-RAM (:address (:voice-1 bytes))
40 (:data (:voice-1 bytes))) 41 (:data (:voice-1 bytes)))
41 (write-RAM (:address (:voice-2 bytes)) 42 (write-RAM (:address (:voice-2 bytes))
42 (:data (:voice-2 bytes))) 43 (:data (:voice-2 bytes)))
44 (:data (:noise bytes))) 45 (:data (:noise bytes)))
45 (write-RAM (:address (:kernel bytes)) 46 (write-RAM (:address (:kernel bytes))
46 (:data (:kernel bytes))))))) 47 (:data (:kernel bytes)))))))
47 48
48 (defn-memo write-image-display-program 49 (defn-memo write-image-display-program
49 ([] (write-image-display-program (write-pony-music-data))) 50 ([] (write-image-display-program (write-pony-music)))
50 ([script] 51 ([script]
51 (let [return-to-bootstrap 52 (let [goto-music
52 (flatten 53 (flatten
53 [0xC3 54 [0xC3
54 (disect-bytes-2 relocated-bootstrap-start)])] 55 (reverse (disect-bytes-2 music-program-start))])]
55 (->> script 56 (->> script
56 (write-RAM 57 (write-RAM
57 image-program-start 58 image-program-start
58 (concat 59 (concat
59 (display-image-kernel 60 (display-image-kernel
60 image-program-start 61 image-program-start
61 pinkie-pie-mark) 62 pinkie-pie-mark)
62 return-to-bootstrap)))))) 63 goto-music))))))
63 64
64 (defn-memo activate-media 65 (defn-memo activate-media
65 ([] (activate-media (write-image-display-program))) 66 ([] (activate-media (write-image-display-program)))
66 ([script] 67 ([script]
67 (->> script 68 (->> script
68 (transfer-control image-program-start) 69 (transfer-control image-program-start)
69 (do-nothing 100) 70 (do-nothing 1800))))
70 (transfer-control music-program-start))))
71 71
72 72
73
74 (def basic-render-dir
75 (File. user-home "proj/vba-clojure/render/basic"))
76
77 (defn basic-steps [] (first (activate-media)))
78
79 (defn basic-step-1! []
80 (render-files!
81 basic-render-dir
82 (root) (basic-steps)))
83
84 (defn basic-step-2! []
85 (generate-composite-frames!
86 basic-render-dir
87 basic-steps))
88
89 (defn basic-step-3! [] (final-cut! basic-render-dir))