From a8d4cda158f55247632cf5f43dd9ca1a9a3f8b50 Mon Sep 17 00:00:00 2001 From: Patrick McIlroy Date: Fri, 13 Aug 2010 04:03:19 +0000 Subject: [PATCH] - Add available free space in /UserPacks dir to ScreenArcadeDiagnostics git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg/branches/dev@792 83fadc84-e282-4d84-a09a-c4228d6ae7e5 --- .../ScreenArcadeDiagnostics overlay.xml | 125 +++++++++++++++++++++ src/DiagnosticsUtil.cpp | 34 ++++++ src/DiagnosticsUtil.h | 1 + 3 files changed, 160 insertions(+) create mode 100644 Themes/home/BGAnimations/ScreenArcadeDiagnostics overlay.xml diff --git a/Themes/home/BGAnimations/ScreenArcadeDiagnostics overlay.xml b/Themes/home/BGAnimations/ScreenArcadeDiagnostics overlay.xml new file mode 100644 index 00000000..a59cfa27 --- /dev/null +++ b/Themes/home/BGAnimations/ScreenArcadeDiagnostics overlay.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + GetNumMachineScores + diff --git a/src/DiagnosticsUtil.cpp b/src/DiagnosticsUtil.cpp index 8c32e8c6..96638e91 100644 --- a/src/DiagnosticsUtil.cpp +++ b/src/DiagnosticsUtil.cpp @@ -49,6 +49,39 @@ CString DiagnosticsUtil::GetIP() return sError; } +CString DiagnosticsUtil::GetFreeDiskSpace() +{ + uint64_t iDiskSpace = HOOKS->GetDiskSpaceFree( "/UserPacks" ); + double fShownSpace = 0.0; + + CString sSuffix = " bytes", sAmount = "0"; + + if ( (iDiskSpace / (1024*1024*1000)) > 0 ) + { + fShownSpace = iDiskSpace / (1024*1024*1000); + sSuffix = "GB"; + sAmount = ssprintf("%.02f", fShownSpace); + } + else if ( (iDiskSpace / (1024*1024)) > 0 ) + { + fShownSpace = iDiskSpace / (1024*1024); + sSuffix = "MB"; + sAmount = ssprintf("%.02f", fShownSpace); + } + else if ( (iDiskSpace / 1024) > 0 ) + { + fShownSpace = iDiskSpace / 1024; + sSuffix = "Kb"; + sAmount = ssprintf("%.02f", fShownSpace); + } + else + { + sAmount = ssprintf("%llu", iDiskSpace); + } + + return ssprintf("%s %s", sAmount.c_str(), sSuffix.c_str()); +} + int DiagnosticsUtil::GetRevision() { // default value if a patch value can't be found/loaded @@ -220,6 +253,7 @@ void SetProgramGlobals( lua_State* L ) LuaFunction_NoArgs( GetUptime, SecondsToHHMMSS( (int)RageTimer::GetTimeSinceStart() ) ); LuaFunction_NoArgs( GetNumIOErrors, ITGIO::m_iInputErrorCount ); +LuaFunction_NoArgs( GetFreeDiskSpace, DiagnosticsUtil::GetFreeDiskSpace() ); // product name function LuaFunction_NoArgs( GetProductName, DiagnosticsUtil::GetProductName() ); diff --git a/src/DiagnosticsUtil.h b/src/DiagnosticsUtil.h index c194875e..0eee8325 100644 --- a/src/DiagnosticsUtil.h +++ b/src/DiagnosticsUtil.h @@ -11,6 +11,7 @@ namespace DiagnosticsUtil int GetRevision(); CString GetIP(); + CString GetFreeDiskSpace(); CString GetInputType(); CString GetProductName(); -- 2.11.0