Mercurial > vba-clojure
comparison clojure/com/aurellem/exp/music.clj @ 440:292ece432ac4
investigating the game's music.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 26 Apr 2012 04:35:49 -0500 |
parents | |
children | e682c9ed3056 |
comparison
equal
deleted
inserted
replaced
439:71878fbc277b | 440:292ece432ac4 |
---|---|
1 (ns com.aurellem.exp.music | |
2 "scratchpad namespace" | |
3 (:use (com.aurellem.gb gb-driver util constants | |
4 assembly saves | |
5 items pokemon status types | |
6 characters species moves | |
7 pokedex money rival-name | |
8 text-speed badges | |
9 pokemon-presets | |
10 )) | |
11 | |
12 (:import java.io.File) | |
13 (:import [com.aurellem.gb.gb_driver SaveState])) | |
14 | |
15 | |
16 | |
17 | |
18 (defn analyze-music [] | |
19 (clojure.pprint/pprint | |
20 (map (fn [[addr nums]] | |
21 [(hex addr) nums]) | |
22 (apply harmonic-compare | |
23 (map read-state | |
24 ["song-1" "no-song-1" | |
25 "song-2" "no-song-2" | |
26 "song-3" "no-song-3" | |
27 "song-4"]))))) | |
28 ;; there are only two addresses that alternate between only | |
29 ;; two unique values: | |
30 | |
31 0xC0DE ;; lol code :) | |
32 0xC0DF | |
33 | |
34 ;; perhaps they are the address of the current playing sound? | |
35 | |
36 ;; after watching them for a while in different environments, | |
37 ;; I can tell that they're definately music related, but they | |
38 ;; _don't_ seem to be the address to the current track. | |
39 ;; they generally change whenever a substantually different | |
40 ;; sequence is played. maybe they control some high level | |
41 ;; setting in the synthesizer? They are only affected by the | |
42 ;; background music and not by pokemon cries, etc. | |
43 | |
44 0xC001 ;; seems to change along with the music, but is much | |
45 ;; more stable than 0xC0DE and 0xC0DF. It _is_ | |
46 ;; affected by sound effects. When a sound effect happens, | |
47 ;; is sometimes does not return to its previous value when the sound | |
48 ;; effect is done. | |
49 | |
50 0xC000 ;; does not seem to be affected by music | |
51 | |
52 ;; maybe 0xC001 - something is loaded with the actual sounds? | |
53 | |
54 | |
55 ;; replacing just the first 0xFF bytes starting at 0xC001 with those | |
56 ;; found in celadon changes the music to celadon city. | |
57 | |
58 ;; this can't be the actual music because it doesn't have enough | |
59 ;; information. | |
60 | |
61 ;; let's try to narrow down the bytes from the first 0xFF of celadon | |
62 ;; starting at 0xC001 | |
63 | |
64 (def celadon-song | |
65 [202 0 0 255 0 178 117 40 118 158 118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
66 0 0 0 0 0 0 0 0 0 0 0 202 202 202 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 | |
67 0 0 0 0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
68 0 0 0 0 0 0 0 0 0 0 0 0 115 88 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
69 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 1 1 1 1 1 | |
71 1 1 1 1 1 1 1 1 12 12 12 1 1 1 1 1 128 128 128 0 0 0 0 0 5 4 4 0 4 3 | |
72 4 0 178 194 32 0 180 196 32 0 3 0 0 144 1 0 66 31 0 2 2 32 48 0 0 0 | |
73 0 0 0 0 0 0 0 0 0 0]) | |
74 | |
75 (defn change-music-to-celadon | |
76 ([#^SaveState state start length] | |
77 | |
78 (set-memory-range state (+ 0xC001 start) | |
79 (take length (drop start celadon-song)))) | |
80 ([start length] | |
81 (continue! (change-music-to-celadon (read-state "rlm-viridian-forest-battle") | |
82 start length)))) | |
83 | |
84 | |
85 | |
86 ;;0 0x90) blend between both, with end theme as well | |
87 | |
88 ;; 0x05 0xEA is the limit to completely change song to celadon from | |
89 ;; viridian forest | |
90 | |
91 ;; 0x05 0xEA is also sufficient to change music to celadon from | |
92 ;; a battle in viridian forest |