Add two more BGM

This commit is contained in:
RocketRobz 2021-06-27 23:17:27 -06:00
parent c96ded54c3
commit 9ccfe572e2
19 changed files with 94 additions and 27 deletions

Binary file not shown.

Binary file not shown.

View File

@ -5,26 +5,25 @@
extern sound *music;
extern sound *music_loop;
static bool music_loaded = false;
static bool music_loop_loaded = false;
extern bool dspfirmfound;
extern bool musicLoopPlaying;
void loadMusic(int num) {
if (music_loaded) {
music->stop();
delete music;
}
if (music_loop_loaded) {
music_loop->stop();
delete music_loop;
}
if (!dspfirmfound) return;
switch (num) {
case 0:
case 0: // Pokemon Stadium - Stadium Select
default:
music = new sound("romfs:/music/pkmnStadium/stadiumSel_start.wav", 0, false);
music_loop = new sound("romfs:/music/pkmnStadium/stadiumSel_loop.wav", 1, true);
break;
case 1: // MegaMan: Battle and Chase - The Straight Out
music = new sound("romfs:/music/mmBattleAndChase/straightOut_start.wav", 0, false);
music_loop = new sound("romfs:/music/mmBattleAndChase/straightOut_loop.wav", 1, true);
break;
case 2: // Mario Golf: Advance Tour - Marion Club
music = new sound("romfs:/music/marioGolfAdvanceTour/marionClub_start.wav", 0, false);
music_loop = new sound("romfs:/music/marioGolfAdvanceTour/marionClub_loop.wav", 1, true);
break;
}
music_loaded = true;
music_loop_loaded = true;
}

View File

@ -45,7 +45,7 @@ bool dspfirmfound = false;
bool exiting = false;
bool musicPlayStarted = false;
static bool musicPlaying = false;
static bool musicLoopPlaying = false;
bool musicLoopPlaying = false;
static int musicLoopDelay = 0;
bool clearTop = true; // Disable in order to render a second character
bool renderTop = true; // Disable to prevent second character from flickering
@ -75,7 +75,7 @@ void saveSettings(void) {
void Play_Music(void) {
if (musicPlaying && !musicLoopPlaying) {
musicLoopDelay++;
if (musicLoopDelay>60 && !ndspChnIsPlaying(0)) {
if (musicLoopDelay>5 && !ndspChnIsPlaying(0)) {
music_loop->play();
musicLoopPlaying = true;
}
@ -87,6 +87,10 @@ void Play_Music(void) {
}
void Stop_Music(void) {
if (dspfirmfound) {
music->~sound();
music_loop->~sound();
}
musicPlayStarted = false;
musicPlaying = false;
musicLoopPlaying = false;
@ -149,10 +153,6 @@ void renderTopScreenSubPixels(void) {
shiftBySubPixel = false;
}
bool ss2SaveFound = false;
bool ss3SaveFound = false;
bool ss4SaveFound = false;
static bool runThreads = true;
void controlThread(void) {

View File

@ -0,0 +1,9 @@
const char* marioGolfAdvanceTourBgmNames[] = {
"Marion Club",
"",
"",
};
int marioGolfAdvanceTourBgmNums[] = {
2,
};

View File

@ -0,0 +1,9 @@
const char* mmBattleAndChaseBgmNames[] = {
"The Straight Out",
"",
"",
};
int mmBattleAndChaseBgmNums[] = {
1,
};

View File

@ -25,6 +25,7 @@ private:
const char* import_characterFileName(void) const;
const char* import_SS2CharacterNames(int i) const;
const char* NESCharacterNames(int i) const;
const char* mmBattleAndChaseTitle(void) const;
const char* pkmnStadiumTitle(void) const;
const char* ss1Title(void) const;
const char* ss2Title(void) const;

View File

@ -4,10 +4,27 @@
#include <unistd.h>
void loadMusic(int num) {
const char* startName = "";
const char* loopName = "";
u32 sampleRate = 0;
switch (num) {
case 0:
case 0: // Pokemon Stadium - Stadium Select
default:
snd().loadStream("nitro:/music/pkmnStadium/stadiumSel_start.raw", "nitro:/music/pkmnStadium/stadiumSel_loop.raw", 22050, true);
startName = "nitro:/music/pkmnStadium/stadiumSel_start.raw";
loopName = "nitro:/music/pkmnStadium/stadiumSel_loop.raw";
sampleRate = 32000;
break;
case 1: // MegaMan: Battle and Chase - The Straight Out
startName = "nitro:/music/mmBattleAndChase/straightOut_start.raw";
loopName = "nitro:/music/mmBattleAndChase/straightOut_loop.raw";
sampleRate = 44100;
break;
case 2: // Mario Golf: Advance Tour - Marion Club
startName = "nitro:/music/marioGolfAdvanceTour/marionClub_start.raw";
loopName = "nitro:/music/marioGolfAdvanceTour/marionClub_loop.raw";
sampleRate = 48000;
break;
}
snd().loadStream(startName, loopName, sampleRate, true);
}

View File

@ -116,8 +116,8 @@ void SoundControl::loadStream(const char* path, const char* loopPath, u32 sample
fseek(stream_source, 0, SEEK_SET);
stream.sampling_rate = sampleRate; // 22050Hz
stream.buffer_length = 1600; // should be adequate
stream.sampling_rate = sampleRate; // ?????Hz
stream.buffer_length = 0x1000; // should be adequate
stream.callback = on_stream_request;
stream.format = MM_STREAM_16BIT_MONO; // select format
stream.timer = MM_TIMER0; // use timer0

View File

@ -137,7 +137,7 @@ nitroFSInit(const char *ndsfile)
chdirpathid = NITROROOT;
ndsFileLastpos = 0;
ndsFile = NULL;
bool headerFirst = ((strncmp((const char *)0x02FFFC38, __NDSHeader->gameCode, 4) == 0)
/*bool headerFirst = ((strncmp((const char *)0x02FFFC38, __NDSHeader->gameCode, 4) == 0)
&& (*(u16*)0x02FFFC36 == __NDSHeader->headerCRC16));
if (!isDSiMode() || headerFirst)
{
@ -162,7 +162,7 @@ nitroFSInit(const char *ndsfile)
AddDevice(&nitroFSdevoptab);
return (1);
}
}
}*/
if (isDSiMode() && ndsfile == NULL)
{
// Try SDNAND path

View File

@ -30,6 +30,8 @@
#include "pdarkBgNames.h"
#include "smBgNames.h"
#include "marioGolfAdvanceTourBgmNames.h"
#include "mmBattleAndChaseBgmNames.h"
#include "pkmnStadiumBgmNames.h"
#include <unistd.h>
@ -74,6 +76,7 @@ static bool redrawText = true;
extern bool ditherlaceOnVBlank;
int characterLimit = 1;
#else
static bool musicPlayOnce = false;
int characterLimit = 4;
#endif
@ -110,6 +113,8 @@ static u8 charPageOrder[] = {
};
static u8 bgmPageOrder[] = {
2, // Mario Golf: Advance Tour
1, // MegaMan: Battle and Chase
0, // Pokemon Stadium
};
@ -138,6 +143,8 @@ void PhotoStudio::getMaxChars() {
// Music
switch (bgmPageOrder[bgm_highlightedGame]) {
case 0:
case 1:
case 2:
import_totalCharacters = 0;
break;
}
@ -479,6 +486,15 @@ const char* PhotoStudio::NESCharacterNames(int i) const {
}
}
const char* PhotoStudio::mmBattleAndChaseTitle(void) const {
switch (sysRegion) {
default:
return "MegaMan: Battle and Chase";
case CFG_REGION_JPN:
return "Rockman: Battle and Chase";
}
}
const char* PhotoStudio::pkmnStadiumTitle(void) const {
switch (sysRegion) {
default:
@ -668,6 +684,10 @@ const char* PhotoStudio::bgmGameTitle(void) const {
switch (bgmPageOrder[bgm_highlightedGame]) {
case 0:
return pkmnStadiumTitle();
case 1:
return mmBattleAndChaseTitle();
case 2:
return "Mario Golf: Advance Tour";
}
return "???";
}
@ -740,6 +760,10 @@ const char* PhotoStudio::bgmName(int i) const {
switch (bgmPageOrder[bgm_highlightedGame]) {
case 0:
return pkmnStadiumBgmNames[i];
case 1:
return mmBattleAndChaseBgmNames[i];
case 2:
return marioGolfAdvanceTourBgmNames[i];
}
return "???";
}
@ -768,6 +792,10 @@ int PhotoStudio::getBgmNum(void) const {
switch (bgmPageOrder[bgm_highlightedGame]) {
case 0:
return pkmnStadiumBgmNums[bgmList_cursorPosition];
case 1:
return mmBattleAndChaseBgmNums[bgmList_cursorPosition];
case 2:
return marioGolfAdvanceTourBgmNums[bgmList_cursorPosition];
}
return 0;
}
@ -1032,10 +1060,11 @@ void PhotoStudio::Draw(void) const {
#else
animateBg = bgCanAnimate;
if (!musicPlayStarted) {
if (!musicPlayStarted && !musicPlayOnce) {
extern void Play_Music();
Play_Music();
musicPlayStarted = true;
musicPlayOnce = true;
}
if (renderTop) {
@ -1342,6 +1371,9 @@ void PhotoStudio::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
extern void Stop_Music(void);
Stop_Music();
loadMusic(getBgmNum());
#ifndef NDS
musicPlayStarted = true;
#endif
}
if (hDown & KEY_DLEFT) {