diff options
Diffstat (limited to '')
-rw-r--r-- | src/music.cpp | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/music.cpp b/src/music.cpp index f3089ca..5d8eab9 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -1,11 +1,13 @@ #include <game.h> #include <sfx.h> +#include "music.h" struct HijackedStream { //const char *original; //const char *originalFast; u32 stringOffset; u32 stringOffsetFast; + u32 infoOffset; u8 originalID; int streamID; }; @@ -100,16 +102,16 @@ const char* SongNameList [] = { Hijacker Hijackers[2] = { { { - {/*"athletic_lr.n.32.brstm", "athletic_fast_lr.n.32.brstm",*/ _I(0x4A8F8), _I(0x4A938), 4, STRM_BGM_ATHLETIC}, - {/*"BGM_SIRO.32.brstm", "BGM_SIRO_fast.32.brstm",*/ _I(0x4B2E8), _I(0x4B320), 10, STRM_BGM_SHIRO} + {/*"athletic_lr.n.32.brstm", "athletic_fast_lr.n.32.brstm",*/ _I(0x4A8F8), _I(0x4A938), _I(0x476C4), 4, STRM_BGM_ATHLETIC}, + {/*"BGM_SIRO.32.brstm", "BGM_SIRO_fast.32.brstm",*/ _I(0x4B2E8), _I(0x4B320), _I(0x48164), 10, STRM_BGM_SHIRO} }, 0, 0 }, { { - {/*"STRM_BGM_CHIJOU.brstm", "STRM_BGM_CHIJOU_FAST.brstm",*/ _I(0x4A83C), _I(0x4A8B4), 1, STRM_BGM_CHIJOU}, - {/*"STRM_BGM_CHIKA.brstm", "STRM_BGM_CHIKA_FAST.brstm",*/ _I(0x4A878), _I(0x4A780), 2, STRM_BGM_CHIKA}, + {/*"STRM_BGM_CHIJOU.brstm", "STRM_BGM_CHIJOU_FAST.brstm",*/ _I(0x4A83C), _I(0x4A8B4), 0, 1, STRM_BGM_CHIJOU}, + {/*"STRM_BGM_CHIKA.brstm", "STRM_BGM_CHIKA_FAST.brstm",*/ _I(0x4A878), _I(0x4A780), 0, 2, STRM_BGM_CHIKA}, }, 0, 0 } @@ -121,18 +123,9 @@ inline char *BrsarInfoOffset(u32 offset) { } void FixFilesize(u32 streamNameOffset); -u8 hijackMusicWithSongName(const char *songName, int themeID, bool hasFast, bool useDrums, int *wantRealStreamID); -extern "C" u8 after_course_getMusicForZone(u8 realThemeID) { - if (realThemeID < 100) - return realThemeID; - - bool usesDrums = (realThemeID >= 200); - return hijackMusicWithSongName(SongNameList[realThemeID-100], realThemeID, true, usesDrums, 0); -} - -u8 hijackMusicWithSongName(const char *songName, int themeID, bool hasFast, bool useDrums, int *wantRealStreamID) { - Hijacker *hj = &Hijackers[useDrums ? 1 : 0]; +u8 hijackMusicWithSongName(const char *songName, int themeID, bool hasFast, int channelCount, int trackCount, int *wantRealStreamID) { + Hijacker *hj = &Hijackers[channelCount==4?1:0]; // do we already have this theme in this slot? // if so, don't switch streams @@ -151,6 +144,15 @@ u8 hijackMusicWithSongName(const char *songName, int themeID, bool hasFast, bool // write the stream's info HijackedStream *stream = &hj->stream[hj->currentStream]; + if (stream->infoOffset) { + u16 *thing = (u16*)(BrsarInfoOffset(stream->infoOffset) + 4); + OSReport("Modifying stream info, at offset %x which is at pointer %x\n", stream->infoOffset, thing); + OSReport("It currently has: channel count %d, track bitfield 0x%x\n", thing[0], thing[1]); + thing[0] = channelCount; + thing[1] = (1 << trackCount) - 1; + OSReport("It has been set to: channel count %d, track bitfield 0x%x\n", thing[0], thing[1]); + } + sprintf(BrsarInfoOffset(stream->stringOffset), "new/%s.er", songName); sprintf(BrsarInfoOffset(stream->stringOffsetFast), hasFast?"new/%s_F.er":"new/%s.er", songName); @@ -189,3 +191,13 @@ void FixFilesize(u32 streamNameOffset) { } + +extern "C" u8 after_course_getMusicForZone(u8 realThemeID) { + if (realThemeID < 100) + return realThemeID; + + bool usesDrums = (realThemeID >= 200); + return hijackMusicWithSongName(SongNameList[realThemeID-100], realThemeID, true, usesDrums?4:2, usesDrums?2:1, 0); +} + + |