Add lookup table for Rogue Squadron SNG Setup mappings

This commit is contained in:
Jack Andersen 2016-07-16 11:55:13 -10:00
parent 5bae40d3c3
commit b421412cac
3 changed files with 128 additions and 2 deletions

View File

@ -610,6 +610,120 @@ static void SwapN64Rom32(void* data, size_t size)
words[i] = SBig(words[i]);
}
struct RS1SongMapping
{
const char* name;
int songId;
} RS1Mappings[] =
{
{"logo1_SNG", 0},
{"roguetitle_SNG", 1},
{"roguetheme_SNG", 1},
{"title_SNG", 2},
{"hangar1_SNG", 3},
{"hangar2_SNG", 3},
{"hangar3_SNG", 3},
{"jingle01_SNG", 4},
{"jingle02_SNG", 4},
{"jingle03_SNG", 4},
{"jingle04_SNG", 4},
{"jingle05_SNG", 4},
{"jingle06_SNG", 4},
{"jingle07_SNG", 4},
{"jingle08_SNG", 4},
{"c1l1_theme_SNG", 4},
{"c1l1_prob1_SNG", 4},
{"c1l1_prob2_SNG", 4},
{"c1l1_spc01_SNG", 4},
{"c1l1_spc02_SNG", 4},
{"c1l2_theme_SNG", 5},
{"c1l2_spc01_SNG", 5},
{"c1l3_spc01_SNG", 6},
{"c1l3_theme_SNG", 6},
{"c1l4_spc01_SNG", 7},
{"c1l4_theme_SNG", 7},
{"action1_SNG", 7},
{"action1b_SNG", 7},
{"action2_SNG", 7},
{"action4_SNG", 7},
{"action5_SNG", 7},
{"action6_SNG", 7},
{"action7_SNG", 7},
{"c1l5_act01_SNG", 8},
{"c1l5_act02_SNG", 8},
{"c1l5_theme_SNG", 8},
{"c1l5_spc01_SNG", 8},
{"c2l1_theme_SNG", 9},
{"c2l1_spc01_SNG", 9},
{"imperial_SNG", 10},
{"c2l2_theme_SNG", 10},
{"c2l2_spc01_SNG", 10},
{"c3l5_theme_SNG", 10},
{"c2l3_theme_SNG", 11},
{"c2l3_spc01_SNG", 11},
{"c2l5_theme_SNG", 12},
{"c2l5_spc01_SNG", 12},
{"c5l1_start_SNG", 12},
{"c4l1_theme_SNG", 12},
{"c5l1_1_SNG", 12},
{"c5l1_2_SNG", 12},
{"c5l1_3_SNG", 12},
{"c3l1_theme_SNG", 13},
{"c5l2_theme_SNG", 13},
{"c5l2_spc01_SNG", 13},
{"c5l3_theme_SNG", 13},
{"c3l2_theme_SNG", 14},
{"silent01_SNG", 14},
{"silent02_SNG", 14},
{"c3l5_spc01_SNG", 14},
{"c3l4_theme_SNG", 14},
{"c3l4_spc01_SNG", 14},
{"credits_SNG", 20},
{"c1l1_cut1_SNG", 30},
{"c1l2_cut1_SNG", 30},
{"c1l3_cut1_SNG", 30},
{"c1l4_cut1_SNG", 30},
{"c1l5_cut1_SNG", 30},
{"c2l1_cut1_SNG", 30},
{"c2l2_cut1_SNG", 30},
{"c2l3_cut1_SNG", 30},
{"c2l5_cut1_SNG", 30},
{"c2l6_cut1_SNG", 30},
{"c3l1_cut1_SNG", 30},
{"c3l2_cut1_SNG", 30},
{"c3l3_cut1_SNG", 30},
{"c3l4_cut1_SNG", 30},
{"c3l5_cut1_SNG", 30},
{"c4l1_cut1_SNG", 30},
{"c5l1_cut1_SNG", 30},
{"c5l2_cut1_SNG", 30},
{"c5l3_cut1_SNG", 30},
{"extr_cut1_SNG", 30},
{"cut_jing1_SNG", 30},
{"cut_jing2_SNG", 30},
{"cut_seq1_SNG", 30},
{"cut_seq2_SNG", 30},
{"cut_seq3_SNG", 30},
{"cut_seq4_SNG", 30},
{"cut_seq5_SNG", 30},
{"cut_seq6_SNG", 30},
{"cut_seq7_SNG", 30},
{"cut_seq8_SNG", 30},
{}
};
static int LookupRS1SongId(const char* name)
{
RS1SongMapping* map = RS1Mappings;
while (map->name)
{
if (!strcmp(name, map->name))
return map->songId;
++map;
}
return -1;
}
static bool ValidateRS1PC(FILE* fp)
{
size_t endPos = FileLength(fp);
@ -742,7 +856,8 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadRS1
fread(song.get(), 1, entry.decompSz, fp);
SystemString name = StrToSys(entry.name);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), entry.decompSz, -1, -1));
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), entry.decompSz, -1,
LookupRS1SongId(entry.name)));
}
}
}
@ -963,7 +1078,8 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadRS1
}
SystemString name = StrToSys(ent.name);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), ent.decompSz, -1, -1));
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), ent.decompSz, -1,
LookupRS1SongId(ent.name)));
}
}
}

View File

@ -557,6 +557,15 @@ bool SoundMacroState::advance(Voice& vox, double dt)
m_midiDecay = cmd.m_data[1];
m_midiSustain = cmd.m_data[2];
m_midiRelease = cmd.m_data[3];
/* Bootstrap ADSR defaults here */
if (!vox.getCtrlValue(m_midiSustain))
{
vox.setCtrlValue(m_midiAttack, 10);
vox.setCtrlValue(m_midiSustain, 127);
vox.setCtrlValue(m_midiRelease, 10);
}
break;
}
case Op::RndNote:

View File

@ -1244,6 +1244,7 @@ size_t Voice::getTotalVoices() const
void Voice::kill()
{
m_voxState = VoiceState::Dead;
m_backendVoice->stop();
for (const std::shared_ptr<Voice>& vox : m_childVoices)
vox->kill();
}