return sError;
}
-namespace
-{
- /* declared as floats so the division isn't implicitly cast to int */
- float KILOBYTE = 1024;
- float MEGABYTE = 1024*KILOBYTE;
- float GIGABYTE = 1024*MEGABYTE;
-
- CString FormatByteValue( uint64_t iBytes )
- {
- CString sSuffix;
- float fShownSpace = 0.0f;
-
- if( iBytes > GIGABYTE )
- {
- fShownSpace = iBytes / GIGABYTE;
- sSuffix = "GB";
- }
- else if( iBytes > MEGABYTE )
- {
- fShownSpace = iBytes / MEGABYTE;
- sSuffix = "MB";
- }
- else if( iBytes > KILOBYTE )
- {
- fShownSpace = iBytes / KILOBYTE;
- sSuffix = "KB";
- }
- else
- {
- fShownSpace = float(iBytes);
- sSuffix = "bytes";
- }
-
- return ssprintf( "%.02f %s", fShownSpace, sSuffix.c_str() );
- }
-}
-
// XXX: we should probably take a parameter for these later on.
// for now, return the only disk space value that matters to us.
return ssprintf("%i", i) + sSuffix;
}
+namespace
+{
+ /* declared as floats so the division isn't implicitly cast to int */
+ float KILOBYTE = 1024;
+ float MEGABYTE = 1024*KILOBYTE;
+ float GIGABYTE = 1024*MEGABYTE;
+}
+
+CString FormatByteValue( uint64_t iBytes )
+{
+ CString sSuffix;
+ float fShownSpace = 0.0f;
+ if( iBytes > GIGABYTE )
+ {
+ fShownSpace = iBytes / GIGABYTE;
+ sSuffix = "GB";
+ }
+ else if( iBytes > MEGABYTE )
+ {
+ fShownSpace = iBytes / MEGABYTE;
+ sSuffix = "MB";
+ }
+ else if( iBytes > KILOBYTE )
+ {
+ fShownSpace = iBytes / KILOBYTE;
+ sSuffix = "KB";
+ }
+ else
+ {
+ fShownSpace = float(iBytes);
+ sSuffix = "bytes";
+ }
+ return ssprintf( "%.02f %s", fShownSpace, sSuffix.c_str() );
+}
+
+CString FormatByteRateValue( float fRate )
+{
+ CString sSuffix;
+ if( fRate > MEGABYTE )
+ {
+ fRate /= MEGABYTE;
+ sSuffix = "MB/s";
+ }
+ else if( fRate > KILOBYTE )
+ {
+ fRate /= KILOBYTE;
+ sSuffix = "kb/s";
+ }
+ else
+ {
+ sSuffix = "bytes/s";
+ }
+ return ssprintf( "%.02f %s", fRate, sSuffix.c_str() );
+}
+
struct tm GetLocalTime()
{
const time_t t = time(NULL);
CString Commify( int iNum );
CString FormatNumberAndSuffix( int i );
+CString FormatByteValue( uint64_t iBytes );
+CString FormatByteRateValue( float fRate );
+
struct tm GetLocalTime();
\r
CString g_CurXferFile;\r
CString g_CurSelection;\r
+unsigned long g_iLastCurrentBytes;\r
+RageTimer g_UpdateDuration;\r
\r
void UpdateXferProgress( unsigned long iCurrent, unsigned long iTotal )\r
{\r
if( DrawTimer.Ago() < DRAW_UPDATE_TIME )\r
return;\r
\r
+ float fXferRate = (iCurrent / g_UpdateDuration.Ago()) / 1024.0;\r
float fPercent = iCurrent / (iTotal/100);\r
- CString sMessage = ssprintf( "\n\n%s\n%.2f%%\n\n%s",\r
+\r
+ CString sMessage = ssprintf( "\n\n%s\n%.2f%% %s\n\n%s",\r
USER_PACK_WAIT_TEXT.GetValue().c_str(),\r
fPercent,\r
+ FormatByteRateValue(fXferRate).c_str(),\r
USER_PACK_CANCEL_TEXT.GetValue().c_str()\r
);\r
SCREENMAN->OverlayMessage( sMessage );\r
sError = ""; // ??\r
RageTimer start;\r
DrawTimer.Touch();\r
+ g_iLastCurrentBytes = 0;\r
+ g_UpdateDuration.Touch();\r
if (!UPACKMAN->TransferPack( g_CurXferFile, sSelection, UpdateXferProgress, sError ) )\r
{\r
SCREENMAN->SystemMessage( "Transfer error:\n" + sError );\r
EnableIntrinsicFunctions="true"\r
FavorSizeOrSpeed="2"\r
AdditionalIncludeDirectories=".;vorbis;libjpeg;"lua-5.0\include";libusb\include;BaseClasses"\r
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINDOWS;RELEASE"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINDOWS;RELEASE;_CRT_SECURE_NO_WARNINGS"\r
StringPooling="true"\r
MinimalRebuild="false"\r
ExceptionHandling="0"\r