mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 19:29:18 +01:00
a66a30a771
*added support to control screen pointer with gc pad or classic controller. you are always able to control as long as the corresponding wii control does not point to the screen (e.g. wiimote 1 not pointing to screen -> gcpad/classic controller 1 can control pointer 1). a speed factor is added to the gui option. need feedback about a proper default value, currently 15% (only tested gc pad on dolphin-emu) *fix reinit of cheatcount on download of new file *moved installation window to be on top of main window *added game installation cancel *added nand extract cancel *added back extract of save feature for a real nand channels *added auto position of progress window messages in vertical direction depending of how many are used at the same time
125 lines
3.1 KiB
C++
125 lines
3.1 KiB
C++
#include "menus.h"
|
|
#include "usbloader/usbstorage2.h"
|
|
#include "usbloader/wbfs.h"
|
|
#include "usbloader/disc.h"
|
|
#include "usbloader/utils.h"
|
|
#include "usbloader/GameList.h"
|
|
#include "prompts/ProgressWindow.h"
|
|
#include "themes/CTheme.h"
|
|
|
|
extern int install_abort_signal;
|
|
float gamesize = 0.0f;
|
|
|
|
/****************************************************************************
|
|
* MenuInstall
|
|
***************************************************************************/
|
|
|
|
int MenuInstall()
|
|
{
|
|
gprintf("\nMenuInstall()");
|
|
|
|
static struct discHdr headerdisc ATTRIBUTE_ALIGN( 32 );
|
|
|
|
Disc_SetUSB(NULL);
|
|
|
|
int ret, choice = 0;
|
|
char name[200];
|
|
|
|
ret = DiscWait(tr( "Insert Disk" ), tr( "Waiting..." ), tr( "Cancel" ), 0, 0);
|
|
if (ret < 0)
|
|
{
|
|
WindowPrompt(tr( "Error reading Disc" ), 0, tr( "Back" ));
|
|
return MENU_DISCLIST;
|
|
}
|
|
ret = Disc_Open();
|
|
if (ret < 0)
|
|
{
|
|
WindowPrompt(tr( "Could not open Disc" ), 0, tr( "Back" ));
|
|
return MENU_DISCLIST;
|
|
}
|
|
|
|
ret = Disc_IsWii();
|
|
if (ret < 0)
|
|
{
|
|
choice = WindowPrompt(tr( "Not a Wii Disc" ), tr( "Insert a Wii Disc!" ), tr( "OK" ), tr( "Back" ));
|
|
|
|
if (choice == 1)
|
|
return MenuInstall();
|
|
else
|
|
return MENU_DISCLIST;
|
|
}
|
|
|
|
Disc_ReadHeader(&headerdisc);
|
|
snprintf(name, sizeof(name), "%s", headerdisc.title);
|
|
|
|
ret = WBFS_CheckGame(headerdisc.id);
|
|
if (ret)
|
|
{
|
|
WindowPrompt(tr( "Game is already installed:" ), name, tr( "Back" ));
|
|
return MENU_DISCLIST;
|
|
}
|
|
|
|
f32 freespace, used;
|
|
|
|
WBFS_DiskSpace(&used, &freespace);
|
|
gamesize = (float) WBFS_EstimeGameSize();
|
|
|
|
char gametxt[50];
|
|
|
|
sprintf(gametxt, "%s : %.2fGB", name, gamesize/GB_SIZE);
|
|
|
|
wiilight(1);
|
|
choice = WindowPrompt(tr( "Continue to install game?" ), gametxt, tr( "OK" ), tr( "Cancel" ));
|
|
|
|
if (choice == 1)
|
|
{
|
|
sprintf(gametxt, "%s", tr( "Installing game:" ));
|
|
|
|
if (gamesize/GB_SIZE > freespace)
|
|
{
|
|
char errortxt[50];
|
|
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB", tr( "Game Size" ), gamesize/GB_SIZE, tr( "Free Space" ), freespace);
|
|
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
|
|
}
|
|
else
|
|
{
|
|
StartProgress(gametxt, name, 0, true, true);
|
|
ProgressCancelEnable(true);
|
|
ret = WBFS_AddGame();
|
|
ProgressCancelEnable(false);
|
|
ProgressStop();
|
|
wiilight(0);
|
|
if (install_abort_signal)
|
|
{
|
|
WindowPrompt(tr( "Install Canceled" ), 0, tr( "OK" ));
|
|
}
|
|
else if (ret != 0)
|
|
{
|
|
WindowPrompt(tr( "Install Error!" ), 0, tr( "Back" ));
|
|
}
|
|
else
|
|
{
|
|
ShowProgress(tr("Install finished"), name, tr("Reloading game list now, please wait..."), gamesize, gamesize, true, true);
|
|
gameList.ReadGameList(); //get the entries again
|
|
gameList.FilterList();
|
|
GuiSound * instsuccess = NULL;
|
|
bgMusic->Pause();
|
|
instsuccess = new GuiSound(Resources::GetFile("success.ogg"), Resources::GetFileSize("success.ogg"), Settings.sfxvolume);
|
|
instsuccess->SetVolume(Settings.sfxvolume);
|
|
instsuccess->SetLoop(0);
|
|
instsuccess->Play();
|
|
WindowPrompt(tr( "Successfully installed:" ), name, tr( "OK" ));
|
|
instsuccess->Stop();
|
|
delete instsuccess;
|
|
bgMusic->Resume();
|
|
}
|
|
}
|
|
}
|
|
|
|
//Turn off the WiiLight
|
|
wiilight(0);
|
|
gamesize = 0.0f;
|
|
|
|
return MENU_DISCLIST;
|
|
}
|