escape # in first keysound entry, fixed ADPCM reader and make PMS load more correctly.
- [NoteField] fix build warnings, and change the maximum number of displayed notes after the receptor to 64. - [Player] fix build warnings. - [NotesLoaderSSC, NotesWriterSSC] The MSD file reader seems to treat # that comes directly after : as new tag, and as many PMS and BMS files has keysounds which filename starts with #, so it looks like this: #KEYSOUNDS:#bgm.wav,01.wav,02.wav,.. The MSD parser will see it as 2 different tags. So I added a backslash in front of the # sign if it's at the start when saving and remove it when loading. - [RageSoundReader_WAV] ADPCM now works very well and doesn't return error when end of file is reached anymore. - [Steps] Use BMS loader when loading the note data.
This commit is contained in:
+3
-3
@@ -673,7 +673,7 @@ void NoteField::DrawBGChangeText( const float fBeat, const RString sNewBGName )
|
||||
m_textMeasureNumber.Draw();
|
||||
}
|
||||
|
||||
CacheNoteStat GetNumNotesFromBeginning( const PlayerState *pPlayerState, float beat )
|
||||
static CacheNoteStat GetNumNotesFromBeginning( const PlayerState *pPlayerState, float beat )
|
||||
{
|
||||
// XXX: I realized that I have copied and pasted my binary search code 3 times already.
|
||||
// how can we abstract this?
|
||||
@@ -700,7 +700,7 @@ CacheNoteStat GetNumNotesFromBeginning( const PlayerState *pPlayerState, float b
|
||||
return dummy;
|
||||
}
|
||||
|
||||
int GetNumNotesRange( const PlayerState* pPlayerState, float fLow, float fHigh )
|
||||
static int GetNumNotesRange( const PlayerState* pPlayerState, float fLow, float fHigh )
|
||||
{
|
||||
CacheNoteStat low = GetNumNotesFromBeginning( pPlayerState, fLow );
|
||||
CacheNoteStat high = GetNumNotesFromBeginning( pPlayerState, fHigh );
|
||||
@@ -720,7 +720,7 @@ float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistance
|
||||
}
|
||||
|
||||
const int NUM_ITERATIONS = 24;
|
||||
const int MAX_NOTES_AFTER = 32;
|
||||
const int MAX_NOTES_AFTER = 64;
|
||||
|
||||
float fFirstBeatToDraw = fLow;
|
||||
|
||||
|
||||
@@ -432,7 +432,11 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
|
||||
else if( sValueName=="KEYSOUNDS" )
|
||||
{
|
||||
split( sParams[1], ",", out.m_vsKeysoundFile );
|
||||
RString keysounds = sParams[1];
|
||||
if( keysounds.length() >= 2 && keysounds.substr(0, 2) == "\\#" )
|
||||
keysounds = keysounds.substr(1);
|
||||
split( keysounds, ",", out.m_vsKeysoundFile );
|
||||
fprintf(stderr, "%s : %d\n", sPath.c_str(), out.m_vsKeysoundFile.size());
|
||||
}
|
||||
|
||||
// Attacks loaded from file
|
||||
|
||||
@@ -303,6 +303,12 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
|
||||
f.Write( "#KEYSOUNDS:" );
|
||||
for( unsigned i=0; i<out.m_vsKeysoundFile.size(); i++ )
|
||||
{
|
||||
// some keysound files has the first sound that starts with #,
|
||||
// which makes MsdFile fail parsing the whole declaration.
|
||||
// in this case, add a backslash at the front
|
||||
// (#KEYSOUNDS:\#bgm.wav,01.wav,02.wav,..) and handle that on load.
|
||||
if( i == 0 && out.m_vsKeysoundFile[i].size() > 0 && out.m_vsKeysoundFile[i][0] == '#' )
|
||||
f.Write("\\");
|
||||
f.Write( out.m_vsKeysoundFile[i] );
|
||||
if( i != out.m_vsKeysoundFile.size()-1 )
|
||||
f.Write( "," );
|
||||
|
||||
+1
-1
@@ -1441,7 +1441,7 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector<TrackRowTap
|
||||
// Possibly fixed.
|
||||
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
||||
{
|
||||
float factor = (tn.subType == TapNote::hold_head_roll ? 2.0 * fLifeFraction : 10.0f * fLifeFraction - 8.5f);
|
||||
float factor = (tn.subType == TapNote::hold_head_roll ? 2.0f * fLifeFraction : 10.0f * fLifeFraction - 8.5f);
|
||||
// todo: Make sure the player's volume settings are respected. -aj
|
||||
m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", max(0.0f, min(1.0f, factor)));
|
||||
}
|
||||
|
||||
@@ -250,6 +250,10 @@ public:
|
||||
ASSERT_M( m_iBufferUsed == m_iBufferAvail, ssprintf("%i", m_iBufferUsed) );
|
||||
|
||||
m_iBufferUsed = m_iBufferAvail = 0;
|
||||
m_sError = "";
|
||||
|
||||
if( m_File.Tell() >= m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos || m_File.AtEOF() )
|
||||
return true; /* past the data chunk */
|
||||
|
||||
int8_t iPredictor[2];
|
||||
int16_t iDelta[2], iSamp1[2], iSamp2[2];
|
||||
@@ -265,9 +269,6 @@ public:
|
||||
if( m_sError.size() != 0 )
|
||||
return false;
|
||||
|
||||
if( m_File.Tell() >= m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos || m_File.AtEOF() )
|
||||
return true; /* past the data chunk */
|
||||
|
||||
float *pBuffer = m_pBuffer;
|
||||
int iCoef1[2], iCoef2[2];
|
||||
for( int i = 0; i < m_WavData.m_iChannels; ++i )
|
||||
@@ -410,7 +411,7 @@ public:
|
||||
|
||||
{
|
||||
const int iByte = iBlock*m_WavData.m_iBlockAlign;
|
||||
if( iByte > m_WavData.m_iDataChunkSize )
|
||||
if( iByte >= m_WavData.m_iDataChunkSize )
|
||||
{
|
||||
/* Past EOF. */
|
||||
SetEOF();
|
||||
@@ -419,7 +420,6 @@ public:
|
||||
m_File.Seek( iByte+m_WavData.m_iDataChunkPos );
|
||||
}
|
||||
|
||||
m_sError = ""; // please forget my errors, let's read again
|
||||
if( !DecodeADPCMBlock() )
|
||||
return -1;
|
||||
|
||||
|
||||
+1
-5
@@ -130,14 +130,10 @@ bool Steps::GetNoteDataFromSimfile()
|
||||
{
|
||||
return KSFLoader::LoadNoteDataFromSimfile(stepFile, *this);
|
||||
}
|
||||
else if (extension == "bms" || extension == "bml" || extension == "bme")
|
||||
else if (extension == "bms" || extension == "bml" || extension == "bme" || extension == "pms")
|
||||
{
|
||||
return BMSLoader::LoadNoteDataFromSimfile(stepFile, *this);
|
||||
}
|
||||
else if (extension == "pms")
|
||||
{
|
||||
return PMSLoader::LoadNoteDataFromSimfile(stepFile, *this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user