# HG changeset patch # User Robert McIntyre # Date 1335432949 18000 # Node ID 292ece432ac4d96957441eadbbd570289b58b908 # Parent 71878fbc277b3f9eb9652859781969f231de214a investigating the game's music. diff -r 71878fbc277b -r 292ece432ac4 clojure/com/aurellem/exp/music.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clojure/com/aurellem/exp/music.clj Thu Apr 26 04:35:49 2012 -0500 @@ -0,0 +1,92 @@ +(ns com.aurellem.exp.music + "scratchpad namespace" + (:use (com.aurellem.gb gb-driver util constants + assembly saves + items pokemon status types + characters species moves + pokedex money rival-name + text-speed badges + pokemon-presets + )) + + (:import java.io.File) + (:import [com.aurellem.gb.gb_driver SaveState])) + + + + +(defn analyze-music [] + (clojure.pprint/pprint + (map (fn [[addr nums]] + [(hex addr) nums]) + (apply harmonic-compare + (map read-state + ["song-1" "no-song-1" + "song-2" "no-song-2" + "song-3" "no-song-3" + "song-4"]))))) +;; there are only two addresses that alternate between only +;; two unique values: + +0xC0DE ;; lol code :) +0xC0DF + +;; perhaps they are the address of the current playing sound? + +;; after watching them for a while in different environments, +;; I can tell that they're definately music related, but they +;; _don't_ seem to be the address to the current track. +;; they generally change whenever a substantually different +;; sequence is played. maybe they control some high level +;; setting in the synthesizer? They are only affected by the +;; background music and not by pokemon cries, etc. + +0xC001 ;; seems to change along with the music, but is much +;; more stable than 0xC0DE and 0xC0DF. It _is_ +;; affected by sound effects. When a sound effect happens, +;; is sometimes does not return to its previous value when the sound +;; effect is done. + +0xC000 ;; does not seem to be affected by music + +;; maybe 0xC001 - something is loaded with the actual sounds? + + +;; replacing just the first 0xFF bytes starting at 0xC001 with those +;; found in celadon changes the music to celadon city. + +;; this can't be the actual music because it doesn't have enough +;; information. + +;; let's try to narrow down the bytes from the first 0xFF of celadon +;; starting at 0xC001 + +(def celadon-song + [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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 0 0 0 0 0 0 0 0 0 0]) + +(defn change-music-to-celadon + ([#^SaveState state start length] + + (set-memory-range state (+ 0xC001 start) + (take length (drop start celadon-song)))) + ([start length] + (continue! (change-music-to-celadon (read-state "rlm-viridian-forest-battle") + start length)))) + + + +;;0 0x90) blend between both, with end theme as well + +;; 0x05 0xEA is the limit to completely change song to celadon from +;; viridian forest + +;; 0x05 0xEA is also sufficient to change music to celadon from +;; a battle in viridian forest \ No newline at end of file diff -r 71878fbc277b -r 292ece432ac4 save-states/no-song-1.sav Binary file save-states/no-song-1.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/no-song-2.sav Binary file save-states/no-song-2.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/no-song-3.sav Binary file save-states/no-song-3.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/rlm-viridian-forest-battle.sav Binary file save-states/rlm-viridian-forest-battle.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/rlm-viridian-forest.sav Binary file save-states/rlm-viridian-forest.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/song-1.sav Binary file save-states/song-1.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/song-2.sav Binary file save-states/song-2.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/song-3.sav Binary file save-states/song-3.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/song-4.sav Binary file save-states/song-4.sav has changed diff -r 71878fbc277b -r 292ece432ac4 save-states/song-5.sav Binary file save-states/song-5.sav has changed