just some cleanup.
This commit is contained in:
@@ -57,7 +57,6 @@ struct DateTime
|
|||||||
bool FromString( const RString sDateTime );
|
bool FromString( const RString sDateTime );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+12
-17
@@ -272,7 +272,7 @@ static void SearchForDifficulty( RString sTag, Steps *pOut )
|
|||||||
{
|
{
|
||||||
sTag.MakeLower();
|
sTag.MakeLower();
|
||||||
|
|
||||||
/* Only match "Light" in parentheses. */
|
// Only match "Light" in parentheses.
|
||||||
if( sTag.find( "(light" ) != sTag.npos )
|
if( sTag.find( "(light" ) != sTag.npos )
|
||||||
{
|
{
|
||||||
pOut->SetDifficulty( Difficulty_Easy );
|
pOut->SetDifficulty( Difficulty_Easy );
|
||||||
@@ -332,16 +332,14 @@ enum
|
|||||||
BMS_TRACK_STOP = 9
|
BMS_TRACK_STOP = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* Time signatures are often abused to tweak sync. Real time signatures should
|
||||||
* Time signatures are often abused to tweak sync. Real time signatures should
|
|
||||||
* cause us to adjust the row offsets so one beat remains one beat. Fake time signatures,
|
* cause us to adjust the row offsets so one beat remains one beat. Fake time signatures,
|
||||||
* like 1.001 or 0.999, should be removed and converted to BPM changes. This is much
|
* like 1.001 or 0.999, should be removed and converted to BPM changes. This is much
|
||||||
* more accurate, and prevents the whole song from being shifted off of the beat, causing
|
* more accurate, and prevents the whole song from being shifted off of the beat, causing
|
||||||
* BeatToNoteType to be wrong.
|
* BeatToNoteType to be wrong.
|
||||||
*
|
*
|
||||||
* Evaluate each time signature, and guess which time signatures should be converted
|
* Evaluate each time signature, and guess which time signatures should be converted
|
||||||
* to BPM changes. This isn't perfect, but errors aren't fatal.
|
* to BPM changes. This isn't perfect, but errors aren't fatal. */
|
||||||
*/
|
|
||||||
static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, MeasureToTimeSig_t &sigAdjustmentsOut )
|
static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, MeasureToTimeSig_t &sigAdjustmentsOut )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -353,7 +351,6 @@ static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, Me
|
|||||||
{
|
{
|
||||||
int iMeasure = it->first;
|
int iMeasure = it->first;
|
||||||
float fFactor = it->second;
|
float fFactor = it->second;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
static const float ValidFactors[] =
|
static const float ValidFactors[] =
|
||||||
{
|
{
|
||||||
@@ -377,7 +374,7 @@ static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, Me
|
|||||||
/* Alternate approach that I tried first: see if the ratio is sane. However,
|
/* Alternate approach that I tried first: see if the ratio is sane. However,
|
||||||
* some songs have values like "1.4", which comes out to 7/4 and is not a valid
|
* some songs have values like "1.4", which comes out to 7/4 and is not a valid
|
||||||
* time signature. */
|
* time signature. */
|
||||||
/* Convert the factor to a ratio, and reduce it. */
|
// Convert the factor to a ratio, and reduce it.
|
||||||
int iNum = lrintf( fFactor * 1000 ), iDen = 1000;
|
int iNum = lrintf( fFactor * 1000 ), iDen = 1000;
|
||||||
int iDiv = gcd( iNum, iDen );
|
int iDiv = gcd( iNum, iDen );
|
||||||
iNum /= iDiv;
|
iNum /= iDiv;
|
||||||
@@ -525,9 +522,8 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
}
|
}
|
||||||
/* This handles the hold notes in the RDM TYPE 1 style,
|
/* This handles the hold notes in the RDM TYPE 1 style,
|
||||||
* like how uBMplay handles it. Different BMS simulators
|
* like how uBMplay handles it. Different BMS simulators
|
||||||
* supports hold notes differently. see
|
* support hold notes differently. see
|
||||||
* http://nvyu.net/rdm/ex.php for more info.
|
* http://nvyu.net/rdm/ex.php for more info. */
|
||||||
*/
|
|
||||||
else if( iHoldStarts[bmsTrack] != -1 )
|
else if( iHoldStarts[bmsTrack] != -1 )
|
||||||
{
|
{
|
||||||
// This is ending a hold.
|
// This is ending a hold.
|
||||||
@@ -563,7 +559,7 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath );
|
out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath );
|
||||||
if( out.m_StepsType == StepsType_beat_single5 && GetTagFromMap( mapNameToData, "#title", sData ) )
|
if( out.m_StepsType == StepsType_beat_single5 && GetTagFromMap( mapNameToData, "#title", sData ) )
|
||||||
{
|
{
|
||||||
/* Hack: guess at 6-panel. */
|
// Hack: guess at 6-panel.
|
||||||
|
|
||||||
// extract the Steps description (looks like 'Music <BASIC>')
|
// extract the Steps description (looks like 'Music <BASIC>')
|
||||||
const size_t iOpenBracket = sData.find_first_of( "<(" );
|
const size_t iOpenBracket = sData.find_first_of( "<(" );
|
||||||
@@ -795,7 +791,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
|
|||||||
LOG->Trace( "Inserting keysound index %u '%s'", unsigned(out.m_vsKeysoundFile.size()-1), sWavID.c_str() );
|
LOG->Trace( "Inserting keysound index %u '%s'", unsigned(out.m_vsKeysoundFile.size()-1), sWavID.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Time signature tags affect all other global timing tags, so read them first. */
|
// Time signature tags affect all other global timing tags, so read them first.
|
||||||
MeasureToTimeSig_t mapMeasureToTimeSig;
|
MeasureToTimeSig_t mapMeasureToTimeSig;
|
||||||
ReadTimeSigs( mapNameToData, mapMeasureToTimeSig );
|
ReadTimeSigs( mapNameToData, mapMeasureToTimeSig );
|
||||||
|
|
||||||
@@ -950,7 +946,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we're done reading BPMs, factor out weird time signatures. */
|
// Now that we're done reading BPMs, factor out weird time signatures.
|
||||||
SetTimeSigAdjustments( mapMeasureToTimeSig, out, sigAdjustmentsOut );
|
SetTimeSigAdjustments( mapMeasureToTimeSig, out, sigAdjustmentsOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1003,7 +999,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
* called to begin with. */
|
* called to begin with. */
|
||||||
ASSERT( arrayBMSFileNames.size() );
|
ASSERT( arrayBMSFileNames.size() );
|
||||||
|
|
||||||
/* Read all BMS files. */
|
// Read all BMS files.
|
||||||
vector<NameToData_t> aBMSData;
|
vector<NameToData_t> aBMSData;
|
||||||
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -1021,7 +1017,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
LOG->UserLog( "Song", sDir, "has BMS files with inconsistent titles." );
|
LOG->UserLog( "Song", sDir, "has BMS files with inconsistent titles." );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a Steps for each. */
|
// Create a Steps for each.
|
||||||
vector<Steps*> apSteps;
|
vector<Steps*> apSteps;
|
||||||
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
||||||
apSteps.push_back( new Steps );
|
apSteps.push_back( new Steps );
|
||||||
@@ -1073,7 +1069,7 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
// As said before, all bets are off.
|
// As said before, all bets are off.
|
||||||
// From here on in, it's nothing but guesswork.
|
// From here on in, it's nothing but guesswork.
|
||||||
|
|
||||||
/* Try to figure out the difficulty of each file. */
|
// Try to figure out the difficulty of each file.
|
||||||
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
// XXX: Is this really effective if Common Substring parsing failed?
|
// XXX: Is this really effective if Common Substring parsing failed?
|
||||||
@@ -1121,7 +1117,6 @@ bool BMSLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
ConvertString( out.m_sArtist, "utf-8,japanese" );
|
ConvertString( out.m_sArtist, "utf-8,japanese" );
|
||||||
ConvertString( out.m_sGenre, "utf-8,japanese" );
|
ConvertString( out.m_sGenre, "utf-8,japanese" );
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,21 +4,19 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
/*
|
/* Implement threaded read-ahead buffering.
|
||||||
* Implement threaded read-ahead buffering.
|
|
||||||
*
|
*
|
||||||
* If a buffer is low on data, keep filling until it has a g_iMinFillFrames.
|
* If a buffer is low on data, keep filling until it has a g_iMinFillFrames.
|
||||||
* Once beyond that, fill at a rate relative to realtime.
|
* Once beyond that, fill at a rate relative to realtime.
|
||||||
*
|
*
|
||||||
* This allows a stream to have a large buffer, for higher reliability, without
|
* This allows a stream to have a large buffer, for higher reliability, without
|
||||||
* causing major CPU bursts when the stream starts or underruns. Filling 32k
|
* causing major CPU bursts when the stream starts or underruns. Filling 32k
|
||||||
* takes more CPU than filling 4k frames, and may cause a skip.
|
* takes more CPU than filling 4k frames, and may cause a skip. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* The amount of data to read at once: */
|
// The amount of data to read at once:
|
||||||
static const unsigned g_iReadBlockSizeFrames = 1024;
|
static const unsigned g_iReadBlockSizeFrames = 1024;
|
||||||
|
|
||||||
/* The maximum number of frames to buffer: */
|
// The maximum number of frames to buffer:
|
||||||
static const int g_iStreamingBufferFrames = 1024*32;
|
static const int g_iStreamingBufferFrames = 1024*32;
|
||||||
|
|
||||||
/* When a sound has fewer than g_iMinFillFrames buffered, buffer at maximum speed.
|
/* When a sound has fewer than g_iMinFillFrames buffered, buffer at maximum speed.
|
||||||
@@ -200,7 +198,7 @@ void RageSoundReader_ThreadedBuffer::BufferingThread()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill some data. */
|
// Fill some data.
|
||||||
m_bFilling = true;
|
m_bFilling = true;
|
||||||
|
|
||||||
int iFramesToFill = g_iReadBlockSizeFrames;
|
int iFramesToFill = g_iReadBlockSizeFrames;
|
||||||
@@ -209,11 +207,11 @@ void RageSoundReader_ThreadedBuffer::BufferingThread()
|
|||||||
|
|
||||||
int iRet = FillFrames( iFramesToFill );
|
int iRet = FillFrames( iFramesToFill );
|
||||||
|
|
||||||
/* Release m_bFilling, and signal the event to wake anyone waiting for it. */
|
// Release m_bFilling, and signal the event to wake anyone waiting for it.
|
||||||
m_bFilling = false;
|
m_bFilling = false;
|
||||||
m_Event.Broadcast();
|
m_Event.Broadcast();
|
||||||
|
|
||||||
/* On error or end of file, stop buffering the sound. */
|
// On error or end of file, stop buffering the sound.
|
||||||
if( iRet < 0 )
|
if( iRet < 0 )
|
||||||
{
|
{
|
||||||
m_bEnabled = false;
|
m_bEnabled = false;
|
||||||
@@ -253,7 +251,7 @@ int RageSoundReader_ThreadedBuffer::FillFrames( int iFrames )
|
|||||||
|
|
||||||
if( iRet == 0 )
|
if( iRet == 0 )
|
||||||
break;
|
break;
|
||||||
/* On error or end of file, stop buffering the sound. */
|
// On error or end of file, stop buffering the sound.
|
||||||
if( iRet < 0 )
|
if( iRet < 0 )
|
||||||
return iRet;
|
return iRet;
|
||||||
|
|
||||||
@@ -277,7 +275,7 @@ int RageSoundReader_ThreadedBuffer::FillBlock()
|
|||||||
m_Event.Unlock();
|
m_Event.Unlock();
|
||||||
|
|
||||||
{
|
{
|
||||||
/* We own m_pSource, even after unlocking, because m_bFilling is true. */
|
// We own m_pSource, even after unlocking, because m_bFilling is true.
|
||||||
unsigned iBufSize;
|
unsigned iBufSize;
|
||||||
float *pBuf = m_DataBuffer.get_write_pointer( &iBufSize );
|
float *pBuf = m_DataBuffer.get_write_pointer( &iBufSize );
|
||||||
ASSERT( (iBufSize % iSamplesPerFrame) == 0 );
|
ASSERT( (iBufSize % iSamplesPerFrame) == 0 );
|
||||||
@@ -288,7 +286,7 @@ int RageSoundReader_ThreadedBuffer::FillBlock()
|
|||||||
|
|
||||||
if( iGotFrames > 0 )
|
if( iGotFrames > 0 )
|
||||||
{
|
{
|
||||||
/* Add the data to the buffer. */
|
// Add the data to the buffer.
|
||||||
m_DataBuffer.advance_write_pointer( iGotFrames * iSamplesPerFrame );
|
m_DataBuffer.advance_write_pointer( iGotFrames * iSamplesPerFrame );
|
||||||
if( iNextSourceFrame != m_StreamPosition.back().iPositionOfFirstFrame + m_StreamPosition.back().iFramesBuffered ||
|
if( iNextSourceFrame != m_StreamPosition.back().iPositionOfFirstFrame + m_StreamPosition.back().iFramesBuffered ||
|
||||||
fRate != m_StreamPosition.back().fRate )
|
fRate != m_StreamPosition.back().fRate )
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
|
|||||||
|
|
||||||
/* The theme's logical resolution specifies the minimum screen width and
|
/* The theme's logical resolution specifies the minimum screen width and
|
||||||
* the minimum screen height with a 4:3 aspect ratio. Scale just one
|
* the minimum screen height with a 4:3 aspect ratio. Scale just one
|
||||||
* of the dimensions up to meet the requested aspect ratio.
|
* of the dimensions up to meet the requested aspect ratio. */
|
||||||
*/
|
|
||||||
|
|
||||||
/* The theme resolution isn't necessarily 4:3; a natively widescreen
|
/* The theme resolution isn't necessarily 4:3; a natively widescreen
|
||||||
* theme would have eg. 16:9 or 16:10.
|
* theme would have eg. 16:9 or 16:10.
|
||||||
@@ -25,9 +24,10 @@ float ScreenDimensions::GetThemeAspectRatio()
|
|||||||
return THEME_NATIVE_ASPECT;
|
return THEME_NATIVE_ASPECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ceilf was originally lrintf. However, lrintf causes odd resolutions like
|
/* ceilf was originally lrintf. However, lrintf causes odd resolutions like
|
||||||
// 639x480 (4:3) and 853x480 (16:9). ceilf gives the correct values of 640x480
|
* 639x480 (4:3) and 853x480 (16:9). ceilf gives the correct values of 640x480
|
||||||
// and 854x480 respectively. -aj
|
* and 854x480 (should really be 852 so that SCREEN_CENTER_X == 426 and not 427)
|
||||||
|
* respectively. -aj */
|
||||||
float ScreenDimensions::GetScreenWidth()
|
float ScreenDimensions::GetScreenWidth()
|
||||||
{
|
{
|
||||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||||
@@ -50,7 +50,7 @@ float ScreenDimensions::GetScreenHeight()
|
|||||||
|
|
||||||
void ScreenDimensions::ReloadScreenDimensions()
|
void ScreenDimensions::ReloadScreenDimensions()
|
||||||
{
|
{
|
||||||
/* Important: explicitly refresh cached metrics that we use. */
|
// Important: explicitly refresh cached metrics that we use.
|
||||||
THEME_SCREEN_WIDTH.Read();
|
THEME_SCREEN_WIDTH.Read();
|
||||||
THEME_SCREEN_HEIGHT.Read();
|
THEME_SCREEN_HEIGHT.Read();
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -91,15 +91,13 @@ static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", fal
|
|||||||
|
|
||||||
void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
||||||
{
|
{
|
||||||
/*
|
/* We can't rely on there being full-screen video modes that give us square
|
||||||
* We can't rely on there being full-screen video modes that give us square
|
|
||||||
* pixels at non-4:3 aspects. The lowest non-4:3 resolution my new laptop
|
* pixels at non-4:3 aspects. The lowest non-4:3 resolution my new laptop
|
||||||
* with Radeon supports is 1280x720. In most cases, we'll using a 4:3
|
* with Radeon supports is 1280x720. In most cases, we'll using a 4:3
|
||||||
* resolution when full-screen let the monitor stretch to the correct aspect.
|
* resolution when full-screen let the monitor stretch to the correct aspect.
|
||||||
* When windowed (no monitor stretching), we will tweak the width so that
|
* When windowed (no monitor stretching), we will tweak the width so that
|
||||||
* we get square pixels.
|
* we get square pixels.
|
||||||
* -Chris
|
* -Chris */
|
||||||
*/
|
|
||||||
int iWidth = PREFSMAN->m_iDisplayWidth;
|
int iWidth = PREFSMAN->m_iDisplayWidth;
|
||||||
if( PREFSMAN->m_bWindowed )
|
if( PREFSMAN->m_bWindowed )
|
||||||
{
|
{
|
||||||
@@ -159,14 +157,12 @@ static void StoreActualGraphicOptions()
|
|||||||
{
|
{
|
||||||
/* Store the settings that RageDisplay was actually able to use so that
|
/* Store the settings that RageDisplay was actually able to use so that
|
||||||
* we don't go through the process of auto-detecting a usable video mode
|
* we don't go through the process of auto-detecting a usable video mode
|
||||||
* every time.
|
* every time. */
|
||||||
*/
|
|
||||||
const VideoModeParams ¶ms = DISPLAY->GetActualVideoModeParams();
|
const VideoModeParams ¶ms = DISPLAY->GetActualVideoModeParams();
|
||||||
PREFSMAN->m_bWindowed .Set( params.windowed );
|
PREFSMAN->m_bWindowed.Set( params.windowed );
|
||||||
|
|
||||||
/* If we're windowed, we may have tweaked the width based on the aspect ratio.
|
/* If we're windowed, we may have tweaked the width based on the aspect ratio.
|
||||||
* Don't save this new value over the preferred value.
|
* Don't save this new value over the preferred value. */
|
||||||
*/
|
|
||||||
if( !PREFSMAN->m_bWindowed )
|
if( !PREFSMAN->m_bWindowed )
|
||||||
{
|
{
|
||||||
PREFSMAN->m_iDisplayWidth .Set( params.width );
|
PREFSMAN->m_iDisplayWidth .Set( params.width );
|
||||||
|
|||||||
Reference in New Issue
Block a user