mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-21 18:59:15 +01:00
Display the HDD size correctly
This commit is contained in:
parent
e0e6815b8f
commit
ec5ed33c3b
@ -40,7 +40,6 @@
|
||||
#include "sys.h"
|
||||
|
||||
struct discHdr *dvdheader = NULL;
|
||||
static bool Exiting = false;
|
||||
|
||||
GameBrowseMenu::GameBrowseMenu()
|
||||
: GuiWindow(screenwidth, screenheight)
|
||||
@ -48,7 +47,6 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
returnMenu = MENU_NONE;
|
||||
gameSelectedOld = -1;
|
||||
lastrawtime = 0;
|
||||
Exiting = false;
|
||||
show_searchwindow = false;
|
||||
gameBrowser = NULL;
|
||||
searchBar = NULL;
|
||||
@ -115,6 +113,8 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
usedSpaceTxt = new GuiText(" ", 18, thColor("r=55 g=190 b=237 a=255 - hdd info color"));
|
||||
usedSpaceTxt->SetAlignment(thAlign("center - hdd info align hor"), thAlign("top - hdd info align ver"));
|
||||
usedSpaceTxt->SetPosition(thInt("0 - hdd info pos x"), thInt("400 - hdd info pos y"));
|
||||
usedSpaceTxt->SetVisible(false);
|
||||
SetFreeSpace(0.0f, 0.0f);
|
||||
|
||||
gamecntTxt = new GuiText((char *) NULL, 18, thColor("r=55 g=190 b=237 a=255 - game count color"));
|
||||
gamecntBtn = new GuiButton(100, 18);
|
||||
@ -366,7 +366,6 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
|
||||
GameBrowseMenu::~GameBrowseMenu()
|
||||
{
|
||||
Exiting = true;
|
||||
ResumeGui();
|
||||
|
||||
SetEffect(EFFECT_FADE, -20);
|
||||
@ -850,6 +849,8 @@ void GameBrowseMenu::ReloadBrowser()
|
||||
Append(usedSpaceTxt);
|
||||
if (thInt("1 - show game count: 1 for on and 0 for off") == 1) //force show game cnt info
|
||||
Append(gamecntBtn);
|
||||
if (!Settings.ShowGameCount)
|
||||
Remove(gamecntBtn);
|
||||
if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_SD_RELOAD_BUTTON))
|
||||
Append(sdcardBtn);
|
||||
Append(poweroffBtn);
|
||||
@ -1685,32 +1686,23 @@ void GameBrowseMenu::UpdateCallback(void * e)
|
||||
}
|
||||
}
|
||||
|
||||
void GameBrowseMenu::UpdateFreeSpace(void * arg)
|
||||
void GameBrowseMenu::SetFreeSpace(float freespace, float used)
|
||||
{
|
||||
char spaceinfo[30];
|
||||
spaceinfo[0] = 0;
|
||||
|
||||
if(Settings.ShowFreeSpace)
|
||||
{
|
||||
float freespace = 0.0, used = 0.0;
|
||||
int ret = WBFS_DiskSpace(&used, &freespace);
|
||||
if(ret >= 0)
|
||||
{
|
||||
if (strcmp(Settings.db_language, "JA") == 0)
|
||||
{
|
||||
// needs to be "total...used" for Japanese
|
||||
snprintf(spaceinfo, sizeof(spaceinfo), "%.2fGB %s %.2fGB %s", (freespace + used), tr( "of" ), freespace, tr( "free" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(spaceinfo, sizeof(spaceinfo), "%.2fGB %s %.2fGB %s", freespace, tr( "of" ), (freespace + used), tr( "free" ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Exiting)
|
||||
return;
|
||||
|
||||
usedSpaceTxt->SetText(spaceinfo);
|
||||
if (strcmp(Settings.db_language, "JA") == 0)
|
||||
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace + used, tr( "of" ), freespace, tr( "free" )));
|
||||
else
|
||||
usedSpaceTxt->SetText(fmt("%.2fGB %s %.2fGB %s", freespace, tr( "of" ), freespace + used, tr( "free" )));
|
||||
}
|
||||
|
||||
void GameBrowseMenu::UpdateFreeSpace(void * arg)
|
||||
{
|
||||
if (Settings.ShowFreeSpace)
|
||||
{
|
||||
float freespace = 0.0, used = 0.0;
|
||||
usedSpaceTxt->SetVisible(true);
|
||||
int ret = WBFS_DiskSpace(&used, &freespace);
|
||||
if (ret >= 0)
|
||||
SetFreeSpace(freespace, used);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ class GameBrowseMenu : public GuiWindow
|
||||
void LoadCover(struct discHdr *header);
|
||||
void CheckDiscSlotUpdate();
|
||||
void UpdateFreeSpace(void *arg);
|
||||
void SetFreeSpace(float freespace, float used);
|
||||
void UpdateClock();
|
||||
static void UpdateCallback(void * e);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user