mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 19:29:18 +01:00
*Fixed DVD access in IOS58 mode (needs AHBPROT)
*Cleaned up progress window source *Fixed compile warning on devkitPPC r22
This commit is contained in:
parent
4a3d3fb31b
commit
6540e252dc
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name> USB Loader GX</name>
|
<name> USB Loader GX</name>
|
||||||
<coder>USB Loader GX Team</coder>
|
<coder>USB Loader GX Team</coder>
|
||||||
<version>2.0 r1042</version>
|
<version>2.0 r1043</version>
|
||||||
<release_date>201101121930</release_date>
|
<release_date>201101131909</release_date>
|
||||||
<no_ios_reload/>
|
<no_ios_reload/>
|
||||||
<short_description>Loads games from USB-devices</short_description>
|
<short_description>Loads games from USB-devices</short_description>
|
||||||
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
|
||||||
|
Binary file not shown.
@ -103,7 +103,7 @@ bool ZipFile::ExtractAll(const char *dest)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ShowProgress(tr( "Extracting files..." ), 0, pointer + 1, done, uncompressed_size);
|
ShowProgress(tr( "Extracting files..." ), 0, pointer + 1, done, uncompressed_size, true);
|
||||||
|
|
||||||
if (uncompressed_size - done < blocksize) blocksize = uncompressed_size - done;
|
if (uncompressed_size - done < blocksize) blocksize = uncompressed_size - done;
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
extern s32 MagicPatches(s32);
|
||||||
void __exception_setreload(int t);
|
void __exception_setreload(int t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
MEM2_init(48);
|
MEM2_init(48);
|
||||||
__exception_setreload(20);
|
__exception_setreload(20);
|
||||||
|
MagicPatches(1);
|
||||||
InitVideo();
|
InitVideo();
|
||||||
InitGecko();
|
InitGecko();
|
||||||
USBGeckoOutput();
|
USBGeckoOutput();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "prompts/ProgressWindow.h"
|
#include "prompts/ProgressWindow.h"
|
||||||
#include "themes/CTheme.h"
|
#include "themes/CTheme.h"
|
||||||
|
|
||||||
float gamesize;
|
float gamesize = -1.0f;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuInstall
|
* MenuInstall
|
||||||
@ -79,12 +79,11 @@ int MenuInstall()
|
|||||||
char errortxt[50];
|
char errortxt[50];
|
||||||
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB", tr( "Game Size" ), gamesize, tr( "Free Space" ), freespace);
|
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB", tr( "Game Size" ), gamesize, tr( "Free Space" ), freespace);
|
||||||
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
|
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
|
||||||
return MENU_DISCLIST;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
USBStorage2_Watchdog(0);
|
USBStorage2_Watchdog(0);
|
||||||
SetupGameInstallProgress(gametxt, name);
|
StartProgress(gametxt, name, 0, true, true);
|
||||||
ret = WBFS_AddGame();
|
ret = WBFS_AddGame();
|
||||||
ProgressStop();
|
ProgressStop();
|
||||||
USBStorage2_Watchdog(1);
|
USBStorage2_Watchdog(1);
|
||||||
@ -92,7 +91,6 @@ int MenuInstall()
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
WindowPrompt(tr( "Install Error!" ), 0, tr( "Back" ));
|
WindowPrompt(tr( "Install Error!" ), 0, tr( "Back" ));
|
||||||
return MENU_DISCLIST;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -108,15 +106,13 @@ int MenuInstall()
|
|||||||
instsuccess->Stop();
|
instsuccess->Stop();
|
||||||
delete instsuccess;
|
delete instsuccess;
|
||||||
bgMusic->Resume();
|
bgMusic->Resume();
|
||||||
return MENU_DISCLIST;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return MENU_DISCLIST;
|
|
||||||
|
|
||||||
//Turn off the WiiLight
|
//Turn off the WiiLight
|
||||||
wiilight(0);
|
wiilight(0);
|
||||||
|
gamesize = -1.0f;
|
||||||
|
|
||||||
return MENU_DISCLIST;
|
return MENU_DISCLIST;
|
||||||
}
|
}
|
||||||
|
@ -18,101 +18,186 @@
|
|||||||
#include "usbloader/wbfs.h"
|
#include "usbloader/wbfs.h"
|
||||||
#include "usbloader/utils.h"
|
#include "usbloader/utils.h"
|
||||||
#include "themes/CTheme.h"
|
#include "themes/CTheme.h"
|
||||||
|
#include "utils/timer.h"
|
||||||
|
|
||||||
/*** Variables used only in this file ***/
|
/*** Variables used only in this file ***/
|
||||||
static lwp_t progressthread = LWP_THREAD_NULL;
|
static lwp_t progressthread = LWP_THREAD_NULL;
|
||||||
|
static mutex_t ProgressMutex = LWP_MUTEX_NULL;
|
||||||
static ProgressAbortCallback AbortCallback = NULL;
|
static ProgressAbortCallback AbortCallback = NULL;
|
||||||
static char progressTitle[100];
|
static const char * progressTitle = NULL;
|
||||||
static const char * progressMsg1 = NULL;
|
static const char * progressMsg1 = NULL;
|
||||||
static const char * progressMsg2 = NULL;
|
static const char * progressMsg2 = NULL;
|
||||||
static char progressTime[80];
|
static Timer ProgressTimer;
|
||||||
static char progressSizeLeft[80];
|
|
||||||
static char progressSpeed[15];
|
|
||||||
static int showProgress = 0;
|
static int showProgress = 0;
|
||||||
static f32 progressDone = 0.0;
|
static s64 progressDone = -1;
|
||||||
|
static s64 progressTotal = -1;
|
||||||
static bool showTime = false;
|
static bool showTime = false;
|
||||||
static bool showSize = false;
|
static bool showSize = false;
|
||||||
static bool changed = true;
|
static bool changed = true;
|
||||||
static s64 gameinstalldone = 0;
|
|
||||||
static s64 gameinstalltotal = -1;
|
|
||||||
static time_t start;
|
|
||||||
|
|
||||||
/*** Extern variables ***/
|
|
||||||
extern GuiWindow * mainWindow;
|
|
||||||
extern float gamesize;
|
extern float gamesize;
|
||||||
|
|
||||||
/*** Extern functions ***/
|
|
||||||
extern void ResumeGui();
|
|
||||||
extern void HaltGui();
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ProgressCallback mainly for gameinstallation. Can be used for other C app.
|
* StartProgress
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
extern "C" void ProgressCallback(s64 done, s64 total)
|
extern "C" void StartProgress(const char * title, const char * msg1, const char * msg2, bool swSize, bool swTime)
|
||||||
{
|
{
|
||||||
gameinstalldone = done;
|
progressTitle = title;
|
||||||
gameinstalltotal = total;
|
progressMsg1 = msg1;
|
||||||
|
progressMsg2 = msg2;
|
||||||
|
showSize = swSize;
|
||||||
|
showTime = swTime;
|
||||||
|
showProgress = 1;
|
||||||
|
ProgressTimer.reset();
|
||||||
|
|
||||||
|
LWP_ResumeThread(progressthread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* GameInstallProgress
|
* ShowProgress
|
||||||
* GameInstallValue updating function
|
*
|
||||||
|
* Callbackfunction for updating the progress values
|
||||||
|
* Use this function as standard callback
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static void GameInstallProgress()
|
extern "C" void ShowProgress(s64 done, s64 total)
|
||||||
{
|
{
|
||||||
if (gameinstalltotal <= 0) return;
|
LWP_MutexLock(ProgressMutex);
|
||||||
|
progressDone = done;
|
||||||
if (gameinstalldone > gameinstalltotal) gameinstalldone = gameinstalltotal;
|
progressTotal = total;
|
||||||
|
if(!done)
|
||||||
static u32 expected = 300;
|
|
||||||
|
|
||||||
u32 elapsed, h, m, s;
|
|
||||||
f32 speed = 0;
|
|
||||||
|
|
||||||
//Elapsed time
|
|
||||||
elapsed = time(0) - start;
|
|
||||||
|
|
||||||
//Calculate speed in MB/s
|
|
||||||
if (elapsed > 0) speed = KB_SIZE * gamesize * gameinstalldone / (gameinstalltotal * elapsed);
|
|
||||||
|
|
||||||
if (gameinstalldone != gameinstalltotal)
|
|
||||||
{
|
{
|
||||||
//Expected time
|
ProgressTimer.reset();
|
||||||
if (elapsed) expected = (expected * 3 + elapsed * gameinstalltotal / gameinstalldone) / 4;
|
LWP_ResumeThread(progressthread);
|
||||||
|
showProgress = 1;
|
||||||
//Remaining time
|
}
|
||||||
elapsed = (expected > elapsed) ? (expected - elapsed) : 0;
|
changed = true;
|
||||||
|
LWP_MutexUnlock(ProgressMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculate time values
|
void ShowProgress(const char *title, const char *msg1, const char *msg2, s64 done, s64 total, bool swSize, bool swTime)
|
||||||
h = elapsed / 3600;
|
{
|
||||||
m = (elapsed / 60) % 60;
|
if (total <= 0)
|
||||||
s = elapsed % 60;
|
return;
|
||||||
|
|
||||||
progressDone = 100.0 * gameinstalldone / gameinstalltotal;
|
else if (done > total)
|
||||||
|
done = total;
|
||||||
|
|
||||||
snprintf(progressTime, sizeof(progressTime), "%s %d:%02d:%02d", tr( "Time left:" ), h, m, s);
|
LWP_MutexLock(ProgressMutex);
|
||||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%.2fGB/%.2fGB",
|
|
||||||
gamesize * gameinstalldone / gameinstalltotal, gamesize);
|
progressDone = done;
|
||||||
snprintf(progressSpeed, sizeof(progressSpeed), "%.1fMB/s", speed);
|
progressTotal = total;
|
||||||
|
|
||||||
|
progressTitle = title;
|
||||||
|
progressMsg1 = msg1;
|
||||||
|
progressMsg2 = msg2;
|
||||||
|
|
||||||
|
showSize = swSize;
|
||||||
|
showTime = swTime;
|
||||||
|
|
||||||
|
if(!done)
|
||||||
|
{
|
||||||
|
ProgressTimer.reset();
|
||||||
|
LWP_ResumeThread(progressthread);
|
||||||
|
showProgress = 1;
|
||||||
|
}
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
|
LWP_MutexUnlock(ProgressMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SetupGameInstallProgress
|
* ProgressStop
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void SetupGameInstallProgress(char * title, char * game)
|
extern "C" void ProgressStop()
|
||||||
{
|
{
|
||||||
|
showProgress = 0;
|
||||||
|
progressTitle = NULL;
|
||||||
|
progressMsg1 = NULL;
|
||||||
|
progressMsg2 = NULL;
|
||||||
|
progressDone = -1;
|
||||||
|
progressTotal = -1;
|
||||||
|
showTime = false;
|
||||||
|
showSize = false;
|
||||||
|
|
||||||
strlcpy(progressTitle, title, sizeof(progressTitle));
|
// wait for thread to finish
|
||||||
progressMsg1 = game;
|
while (!LWP_ThreadIsSuspended(progressthread))
|
||||||
gameinstalltotal = 1;
|
usleep(100);
|
||||||
showProgress = 1;
|
}
|
||||||
showSize = true;
|
|
||||||
showTime = true;
|
/****************************************************************************
|
||||||
LWP_ResumeThread(progressthread);
|
* ProgressSetAbortCallback
|
||||||
start = time(0);
|
*
|
||||||
|
* Set a callback for the cancel button
|
||||||
|
***************************************************************************/
|
||||||
|
extern "C" void ProgressSetAbortCallback(ProgressAbortCallback callback)
|
||||||
|
{
|
||||||
|
AbortCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* UpdateProgressValues
|
||||||
|
***************************************************************************/
|
||||||
|
static void UpdateProgressValues(GuiImage *progressbarImg, GuiText *prTxt, GuiText *timeTxt, GuiText *speedTxt, GuiText *sizeTxt)
|
||||||
|
{
|
||||||
|
if(!changed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LWP_MutexLock(ProgressMutex);
|
||||||
|
changed = false;
|
||||||
|
s64 done = progressDone;
|
||||||
|
s64 total = progressTotal;
|
||||||
|
u32 speed = 0;
|
||||||
|
|
||||||
|
if(gamesize > 0.0f)
|
||||||
|
{
|
||||||
|
done = (s64) ((float) done / (float) total * gamesize * GB_SIZE);
|
||||||
|
total = (s64) (gamesize * GB_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Calculate speed in KB/s
|
||||||
|
if (ProgressTimer.elapsed() > 0.0f)
|
||||||
|
speed = (u32) (done/ProgressTimer.elapsed());
|
||||||
|
|
||||||
|
LWP_MutexUnlock(ProgressMutex);
|
||||||
|
|
||||||
|
u32 TimeLeft = 0;
|
||||||
|
if(speed > 0)
|
||||||
|
TimeLeft = (total-done)/speed;
|
||||||
|
|
||||||
|
u32 h = TimeLeft / 3600;
|
||||||
|
u32 m = (TimeLeft / 60) % 60;
|
||||||
|
u32 s = TimeLeft % 60;
|
||||||
|
|
||||||
|
float progressPercent = 100.0 * done / total;
|
||||||
|
|
||||||
|
prTxt->SetTextf("%.2f", progressPercent);
|
||||||
|
|
||||||
|
if (Settings.widescreen && Settings.wsprompt)
|
||||||
|
progressbarImg->SetSkew(0, 0, static_cast<int> (progressbarImg->GetWidth() * progressPercent * 0.8)
|
||||||
|
- progressbarImg->GetWidth(), 0, static_cast<int> (progressbarImg->GetWidth() * progressPercent
|
||||||
|
* 0.8) - progressbarImg->GetWidth(), 0, 0, 0);
|
||||||
|
else
|
||||||
|
progressbarImg->SetSkew(0, 0, static_cast<int> (progressbarImg->GetWidth() * progressPercent)
|
||||||
|
- progressbarImg->GetWidth(), 0, static_cast<int> (progressbarImg->GetWidth() * progressPercent)
|
||||||
|
- progressbarImg->GetWidth(), 0, 0, 0);
|
||||||
|
|
||||||
|
if (showTime == true)
|
||||||
|
{
|
||||||
|
timeTxt->SetTextf("%s %d:%02d:%02d", tr( "Time left:" ), h, m, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showSize == true)
|
||||||
|
{
|
||||||
|
if (total < MB_SIZE)
|
||||||
|
sizeTxt->SetTextf("%0.2fKB/%0.2fKB", done / KB_SIZE, total / KB_SIZE);
|
||||||
|
else if (total > MB_SIZE && total < GB_SIZE)
|
||||||
|
sizeTxt->SetTextf("%0.2fMB/%0.2fMB", done / MB_SIZE, total / MB_SIZE);
|
||||||
|
else
|
||||||
|
sizeTxt->SetTextf("%0.2fGB/%0.2fGB", done / GB_SIZE, total / GB_SIZE);
|
||||||
|
|
||||||
|
speedTxt->SetTextf("%dKB/s", (int) (speed/KB_SIZE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -255,42 +340,18 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
mainWindow->ChangeFocus(&promptWindow);
|
mainWindow->ChangeFocus(&promptWindow);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while (promptWindow.GetEffect() > 0)
|
while (promptWindow.GetEffect() > 0) usleep(100);
|
||||||
usleep(100);
|
|
||||||
|
|
||||||
int tmp;
|
|
||||||
while (showProgress)
|
while (showProgress)
|
||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
GameInstallProgress();
|
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
changed = false;
|
|
||||||
|
|
||||||
tmp = static_cast<int> (progressbarImg.GetWidth() * progressDone);
|
|
||||||
|
|
||||||
if (Settings.widescreen && Settings.wsprompt)
|
|
||||||
progressbarImg.SetSkew(0, 0, static_cast<int> (progressbarImg.GetWidth() * progressDone * 0.8)
|
|
||||||
- progressbarImg.GetWidth(), 0, static_cast<int> (progressbarImg.GetWidth() * progressDone
|
|
||||||
* 0.8) - progressbarImg.GetWidth(), 0, 0, 0);
|
|
||||||
else progressbarImg.SetSkew(0, 0, static_cast<int> (progressbarImg.GetWidth() * progressDone)
|
|
||||||
- progressbarImg.GetWidth(), 0, static_cast<int> (progressbarImg.GetWidth() * progressDone)
|
|
||||||
- progressbarImg.GetWidth(), 0, 0, 0);
|
|
||||||
|
|
||||||
prTxt.SetTextf("%.2f", progressDone);
|
|
||||||
|
|
||||||
if (showSize)
|
|
||||||
{
|
|
||||||
sizeTxt.SetText(progressSizeLeft);
|
|
||||||
speedTxt.SetText(progressSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showTime) timeTxt.SetText(progressTime);
|
|
||||||
|
|
||||||
if (progressMsg1) msg1Txt.SetText(progressMsg1);
|
if (progressMsg1) msg1Txt.SetText(progressMsg1);
|
||||||
if (progressMsg2) msg2Txt.SetText(progressMsg2);
|
if (progressMsg2) msg2Txt.SetText(progressMsg2);
|
||||||
|
|
||||||
|
UpdateProgressValues(&progressbarImg, &prTxt, &timeTxt, &speedTxt, &sizeTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cancelBtn.GetState() == STATE_CLICKED)
|
if(cancelBtn.GetState() == STATE_CLICKED)
|
||||||
@ -301,8 +362,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
}
|
}
|
||||||
|
|
||||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||||
while (promptWindow.GetEffect() > 0)
|
while (promptWindow.GetEffect() > 0) usleep(100);
|
||||||
usleep(100);
|
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&promptWindow);
|
mainWindow->Remove(&promptWindow);
|
||||||
@ -313,7 +373,6 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ProgressThread
|
* ProgressThread
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void * ProgressThread(void *arg)
|
static void * ProgressThread(void *arg)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
@ -326,107 +385,6 @@ static void * ProgressThread(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* ProgressStop
|
|
||||||
***************************************************************************/
|
|
||||||
void ProgressStop()
|
|
||||||
{
|
|
||||||
showProgress = 0;
|
|
||||||
strcpy(progressTitle, "");
|
|
||||||
progressMsg1 = NULL;
|
|
||||||
progressMsg2 = NULL;
|
|
||||||
gameinstalltotal = -1;
|
|
||||||
|
|
||||||
// wait for thread to finish
|
|
||||||
while (!LWP_ThreadIsSuspended(progressthread))
|
|
||||||
usleep(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* ShowProgress
|
|
||||||
*
|
|
||||||
* Callbackfunction for updating the progress values
|
|
||||||
* Use this function as standard callback
|
|
||||||
***************************************************************************/
|
|
||||||
void ShowProgress(const char *title, const char *msg1, const char *msg2, f32 done, f32 total, bool swSize, bool swTime)
|
|
||||||
{
|
|
||||||
if (total <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
else if (done > total) done = total;
|
|
||||||
|
|
||||||
showSize = swSize;
|
|
||||||
showTime = swTime;
|
|
||||||
|
|
||||||
if (title) strlcpy(progressTitle, title, sizeof(progressTitle));
|
|
||||||
progressMsg1 = msg1;
|
|
||||||
progressMsg2 = msg2;
|
|
||||||
|
|
||||||
static u32 expected;
|
|
||||||
|
|
||||||
u32 elapsed, h, m, s, speed = 0;
|
|
||||||
|
|
||||||
if (!done)
|
|
||||||
{
|
|
||||||
start = time(0);
|
|
||||||
expected = 300;
|
|
||||||
LWP_ResumeThread(progressthread);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Elapsed time
|
|
||||||
elapsed = time(0) - start;
|
|
||||||
|
|
||||||
//Calculate speed in KB/s
|
|
||||||
if (elapsed > 0) speed = done / (elapsed * KB_SIZE);
|
|
||||||
|
|
||||||
if (done != total)
|
|
||||||
{
|
|
||||||
//Expected time
|
|
||||||
if (elapsed) expected = (expected * 3 + elapsed * total / done) / 4;
|
|
||||||
|
|
||||||
//Remaining time
|
|
||||||
elapsed = (expected > elapsed) ? (expected - elapsed) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Calculate time values
|
|
||||||
h = elapsed / 3600;
|
|
||||||
m = (elapsed / 60) % 60;
|
|
||||||
s = elapsed % 60;
|
|
||||||
|
|
||||||
if (swTime == true)
|
|
||||||
{
|
|
||||||
snprintf(progressTime, sizeof(progressTime), "%s %d:%02d:%02d", tr( "Time left:" ), h, m, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (swSize == true)
|
|
||||||
{
|
|
||||||
if (total < MB_SIZE)
|
|
||||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fKB/%0.2fKB", done * done / total / KB_SIZE,
|
|
||||||
total / KB_SIZE);
|
|
||||||
else if (total > MB_SIZE && total < GB_SIZE)
|
|
||||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fMB/%0.2fMB", done * done / total / MB_SIZE,
|
|
||||||
total / MB_SIZE);
|
|
||||||
else snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fGB/%0.2fGB", done * done / total / GB_SIZE,
|
|
||||||
total / GB_SIZE);
|
|
||||||
|
|
||||||
snprintf(progressSpeed, sizeof(progressSpeed), "%dKB/s", speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
showProgress = 1;
|
|
||||||
progressDone = 100.0 * done / total;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* ProgressSetAbortCallback
|
|
||||||
*
|
|
||||||
* Set a callback for the cancel button
|
|
||||||
***************************************************************************/
|
|
||||||
void ProgressSetAbortCallback(ProgressAbortCallback callback)
|
|
||||||
{
|
|
||||||
AbortCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* InitProgressThread
|
* InitProgressThread
|
||||||
*
|
*
|
||||||
@ -434,6 +392,7 @@ void ProgressSetAbortCallback(ProgressAbortCallback callback)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void InitProgressThread()
|
void InitProgressThread()
|
||||||
{
|
{
|
||||||
|
LWP_MutexInit(&ProgressMutex, true);
|
||||||
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 16384, 80);
|
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 16384, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,4 +405,6 @@ void ExitProgressThread()
|
|||||||
{
|
{
|
||||||
LWP_JoinThread(progressthread, NULL);
|
LWP_JoinThread(progressthread, NULL);
|
||||||
progressthread = LWP_THREAD_NULL;
|
progressthread = LWP_THREAD_NULL;
|
||||||
|
LWP_MutexUnlock(ProgressMutex);
|
||||||
|
LWP_MutexDestroy(ProgressMutex);
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,20 @@
|
|||||||
|
|
||||||
typedef void (*ProgressAbortCallback)(void);
|
typedef void (*ProgressAbortCallback)(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
void InitProgressThread();
|
void InitProgressThread();
|
||||||
void ExitProgressThread();
|
void ExitProgressThread();
|
||||||
void SetupGameInstallProgress(char * titl, char * game);
|
void ShowProgress(const char *title, const char *msg1, const char *msg2, s64 done, s64 total, bool swSize = false, bool swTime = false);
|
||||||
void ShowProgress(const char *title, const char *msg1, const char *msg2, f32 done, f32 total, bool swSize = false,
|
|
||||||
bool swTime = false);
|
|
||||||
void ProgressStop();
|
|
||||||
void ProgressSetAbortCallback(ProgressAbortCallback callback);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ProgressCallback(s64 gameinstalldone, s64 gameinstalltotal);
|
void StartProgress(const char * title, const char * msg1, const char * msg2, bool swSize, bool swTime);
|
||||||
|
void ShowProgress(s64 done, s64 total);
|
||||||
|
void ProgressSetAbortCallback(ProgressAbortCallback callback);
|
||||||
|
void ProgressStop();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
#include "gecko.h"
|
#include "gecko.h"
|
||||||
#include "xml/xml.h"
|
#include "xml/xml.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
extern s32 MagicPatches(s32);
|
||||||
|
}
|
||||||
|
|
||||||
extern char game_partition[6];
|
extern char game_partition[6];
|
||||||
extern u8 load_from_fs;
|
extern u8 load_from_fs;
|
||||||
|
|
||||||
@ -106,6 +111,8 @@ void ExitApp(void)
|
|||||||
USB_Deinitialize();
|
USB_Deinitialize();
|
||||||
if(Settings.PlaylogUpdate)
|
if(Settings.PlaylogUpdate)
|
||||||
Playlog_Delete(); // Don't show USB Loader GX in the Wii message board
|
Playlog_Delete(); // Don't show USB Loader GX in the Wii message board
|
||||||
|
|
||||||
|
MagicPatches(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Reboot(void)
|
void Sys_Reboot(void)
|
||||||
|
@ -25,8 +25,8 @@ class GameList
|
|||||||
//! Gamelist scrolling operators
|
//! Gamelist scrolling operators
|
||||||
int operator+=(int i) { return (selectedGame = (selectedGame+i) % FilteredList.size()); }
|
int operator+=(int i) { return (selectedGame = (selectedGame+i) % FilteredList.size()); }
|
||||||
int operator-=(int i) { return (selectedGame = (selectedGame-i+FilteredList.size()) % FilteredList.size()); }
|
int operator-=(int i) { return (selectedGame = (selectedGame-i+FilteredList.size()) % FilteredList.size()); }
|
||||||
int operator++() { return (selectedGame = (++selectedGame) % FilteredList.size()); }
|
int operator++() { return (selectedGame = (selectedGame+1) % FilteredList.size()); }
|
||||||
int operator--() { return (selectedGame = ((--selectedGame)+FilteredList.size()) % FilteredList.size()); }
|
int operator--() { return (selectedGame = (selectedGame-1+FilteredList.size()) % FilteredList.size()); }
|
||||||
int operator++(int i) { return operator++(); }
|
int operator++(int i) { return operator++(); }
|
||||||
int operator--(int i) { return operator--(); }
|
int operator--(int i) { return operator--(); }
|
||||||
struct discHdr * GetCurrentSelected() const { return operator[](selectedGame); }
|
struct discHdr * GetCurrentSelected() const { return operator[](selectedGame); }
|
||||||
|
@ -186,7 +186,7 @@ s32 Wbfs_Fat::AddGame(void)
|
|||||||
|
|
||||||
wbfs_t *old_hdd = hdd;
|
wbfs_t *old_hdd = hdd;
|
||||||
hdd = part; // used by spinner
|
hdd = part; // used by spinner
|
||||||
ret = wbfs_add_disc(hdd, __ReadDVD, NULL, ProgressCallback, part_sel, 0);
|
ret = wbfs_add_disc(hdd, __ReadDVD, NULL, ShowProgress, part_sel, 0);
|
||||||
hdd = old_hdd;
|
hdd = old_hdd;
|
||||||
wbfs_trim(part);
|
wbfs_trim(part);
|
||||||
ClosePart(part);
|
ClosePart(part);
|
||||||
|
@ -111,7 +111,7 @@ s32 Wbfs_Wbfs::AddGame()
|
|||||||
partition_selector_t part_sel = (partition_selector_t) Settings.InstallPartitions;
|
partition_selector_t part_sel = (partition_selector_t) Settings.InstallPartitions;
|
||||||
|
|
||||||
/* Add game to device */
|
/* Add game to device */
|
||||||
ret = wbfs_add_disc(hdd, __ReadDVD, NULL, ProgressCallback, part_sel, 0);
|
ret = wbfs_add_disc(hdd, __ReadDVD, NULL, ShowProgress, part_sel, 0);
|
||||||
if (ret < 0) return ret;
|
if (ret < 0) return ret;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,11 +4,6 @@
|
|||||||
|
|
||||||
NandTitle NandTitles;
|
NandTitle NandTitles;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
extern s32 MagicPatches(s32);
|
|
||||||
}
|
|
||||||
|
|
||||||
static u8 tmd_buf[MAX_SIGNED_TMD_SIZE] ATTRIBUTE_ALIGN( 32 );
|
static u8 tmd_buf[MAX_SIGNED_TMD_SIZE] ATTRIBUTE_ALIGN( 32 );
|
||||||
|
|
||||||
//based on one from comex's nand formatter
|
//based on one from comex's nand formatter
|
||||||
@ -77,7 +72,6 @@ s32 NandTitle::Get()
|
|||||||
|
|
||||||
free(list);
|
free(list);
|
||||||
|
|
||||||
MagicPatches(1);
|
|
||||||
int language = CONF_GetLanguage();
|
int language = CONF_GetLanguage();
|
||||||
ISFS_Initialize();
|
ISFS_Initialize();
|
||||||
|
|
||||||
@ -96,7 +90,6 @@ s32 NandTitle::Get()
|
|||||||
ISFS_Deinitialize();
|
ISFS_Deinitialize();
|
||||||
//If not started from SystemMenu, create playlog while we got nand access.
|
//If not started from SystemMenu, create playlog while we got nand access.
|
||||||
Playlog_Create();
|
Playlog_Create();
|
||||||
MagicPatches(0);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user