mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 12:46:53 +01:00
*Fixed InstallProgress to show size and speed again
*Added intern GameTitle rename for .wbfs files on FAT32 *Added intern GameID change for .wbfs files on FAT32
This commit is contained in:
parent
b4b5b5389c
commit
b70af2d71d
@ -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>1.0 r840</version>
|
<version>1.0 r841</version>
|
||||||
<release_date>200911212330</release_date>
|
<release_date>200911221220</release_date>
|
||||||
<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.
|
||||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -39,7 +39,6 @@ GuiSound * bgMusic = NULL;
|
|||||||
GuiSound *btnClick2 = NULL;
|
GuiSound *btnClick2 = NULL;
|
||||||
|
|
||||||
struct discHdr *dvdheader = NULL;
|
struct discHdr *dvdheader = NULL;
|
||||||
float gamesize;
|
|
||||||
int currentMenu;
|
int currentMenu;
|
||||||
u8 mountMethod=0;
|
u8 mountMethod=0;
|
||||||
|
|
||||||
@ -372,7 +371,7 @@ int MainMenu(int menu) {
|
|||||||
struct discHdr *header = (mountMethod?dvdheader:&gameList[gameSelected]);
|
struct discHdr *header = (mountMethod?dvdheader:&gameList[gameSelected]);
|
||||||
|
|
||||||
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
|
||||||
|
|
||||||
if (game_cfg) {
|
if (game_cfg) {
|
||||||
videoChoice = game_cfg->video;
|
videoChoice = game_cfg->video;
|
||||||
languageChoice = game_cfg->language;
|
languageChoice = game_cfg->language;
|
||||||
@ -593,7 +592,7 @@ int MainMenu(int menu) {
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Sys_LoadMenu();
|
Sys_LoadMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Returning entry point: 0x%0x\n", ret);
|
printf("Returning entry point: 0x%0x\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,154 +1,156 @@
|
|||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
#include "usbloader/usbstorage.h"
|
#include "usbloader/usbstorage.h"
|
||||||
#include "usbloader/wbfs.h"
|
#include "usbloader/wbfs.h"
|
||||||
#include "usbloader/disc.h"
|
#include "usbloader/disc.h"
|
||||||
#include "usbloader/utils.h"
|
#include "usbloader/utils.h"
|
||||||
#include "usbloader/getentries.h"
|
#include "usbloader/getentries.h"
|
||||||
#include "prompts/ProgressWindow.h"
|
#include "prompts/ProgressWindow.h"
|
||||||
|
|
||||||
/****************************************************************************
|
float gamesize;
|
||||||
* MenuInstall
|
|
||||||
***************************************************************************/
|
/****************************************************************************
|
||||||
|
* MenuInstall
|
||||||
int MenuInstall() {
|
***************************************************************************/
|
||||||
gprintf("\nMenuInstall()");
|
|
||||||
|
int MenuInstall() {
|
||||||
int menu = MENU_NONE;
|
gprintf("\nMenuInstall()");
|
||||||
static struct discHdr headerdisc ATTRIBUTE_ALIGN(32);
|
|
||||||
|
int menu = MENU_NONE;
|
||||||
Disc_SetUSB(NULL);
|
static struct discHdr headerdisc ATTRIBUTE_ALIGN(32);
|
||||||
|
|
||||||
int ret, choice = 0;
|
Disc_SetUSB(NULL);
|
||||||
char name[200];
|
|
||||||
|
int ret, choice = 0;
|
||||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
char name[200];
|
||||||
|
|
||||||
char imgPath[100];
|
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||||
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
|
char imgPath[100];
|
||||||
GuiImageData battery(imgPath, battery_png);
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
|
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
|
||||||
GuiImageData batteryBar(imgPath, battery_bar_png);
|
GuiImageData battery(imgPath, battery_png);
|
||||||
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
|
||||||
GuiImageData batteryRed(imgPath, battery_red_png);
|
GuiImageData batteryBar(imgPath, battery_bar_png);
|
||||||
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path);
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
|
||||||
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
|
GuiImageData batteryRed(imgPath, battery_red_png);
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path);
|
||||||
HaltGui();
|
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
|
||||||
GuiWindow w(screenwidth, screenheight);
|
|
||||||
|
HaltGui();
|
||||||
mainWindow->Append(&w);
|
GuiWindow w(screenwidth, screenheight);
|
||||||
|
|
||||||
ResumeGui();
|
mainWindow->Append(&w);
|
||||||
|
|
||||||
while (menu == MENU_NONE) {
|
ResumeGui();
|
||||||
VIDEO_WaitVSync ();
|
|
||||||
|
while (menu == MENU_NONE) {
|
||||||
ret = DiscWait(tr("Insert Disk"),tr("Waiting..."),tr("Cancel"),0,0);
|
VIDEO_WaitVSync ();
|
||||||
if (ret < 0) {
|
|
||||||
WindowPrompt (tr("Error reading Disc"),0,tr("Back"));
|
ret = DiscWait(tr("Insert Disk"),tr("Waiting..."),tr("Cancel"),0,0);
|
||||||
menu = MENU_DISCLIST;
|
if (ret < 0) {
|
||||||
break;
|
WindowPrompt (tr("Error reading Disc"),0,tr("Back"));
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
ret = Disc_Open();
|
break;
|
||||||
if (ret < 0) {
|
}
|
||||||
WindowPrompt (tr("Could not open Disc"),0,tr("Back"));
|
ret = Disc_Open();
|
||||||
menu = MENU_DISCLIST;
|
if (ret < 0) {
|
||||||
break;
|
WindowPrompt (tr("Could not open Disc"),0,tr("Back"));
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
|
break;
|
||||||
ret = Disc_IsWii();
|
}
|
||||||
if (ret < 0) {
|
|
||||||
choice = WindowPrompt (tr("Not a Wii Disc"),tr("Insert a Wii Disc!"),tr("OK"),tr("Back"));
|
ret = Disc_IsWii();
|
||||||
|
if (ret < 0) {
|
||||||
if (choice == 1) {
|
choice = WindowPrompt (tr("Not a Wii Disc"),tr("Insert a Wii Disc!"),tr("OK"),tr("Back"));
|
||||||
menu = MENU_INSTALL;
|
|
||||||
break;
|
if (choice == 1) {
|
||||||
} else
|
menu = MENU_INSTALL;
|
||||||
menu = MENU_DISCLIST;
|
break;
|
||||||
break;
|
} else
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
|
break;
|
||||||
Disc_ReadHeader(&headerdisc);
|
}
|
||||||
snprintf(name, sizeof(name), "%s", headerdisc.title);
|
|
||||||
|
Disc_ReadHeader(&headerdisc);
|
||||||
ret = WBFS_CheckGame(headerdisc.id);
|
snprintf(name, sizeof(name), "%s", headerdisc.title);
|
||||||
if (ret) {
|
|
||||||
WindowPrompt (tr("Game is already installed:"),name,tr("Back"));
|
ret = WBFS_CheckGame(headerdisc.id);
|
||||||
menu = MENU_DISCLIST;
|
if (ret) {
|
||||||
break;
|
WindowPrompt (tr("Game is already installed:"),name,tr("Back"));
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
|
break;
|
||||||
f32 freespace, used;
|
}
|
||||||
|
|
||||||
WBFS_DiskSpace(&used, &freespace);
|
f32 freespace, used;
|
||||||
float gamesize = WBFS_EstimeGameSize()/GB_SIZE;
|
|
||||||
|
WBFS_DiskSpace(&used, &freespace);
|
||||||
char gametxt[50];
|
gamesize = WBFS_EstimeGameSize()/GB_SIZE;
|
||||||
|
|
||||||
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
|
char gametxt[50];
|
||||||
|
|
||||||
wiilight(1);
|
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
|
||||||
choice = WindowPrompt(tr("Continue to install game?"),gametxt,tr("OK"),tr("Cancel"));
|
|
||||||
|
wiilight(1);
|
||||||
if (choice == 1) {
|
choice = WindowPrompt(tr("Continue to install game?"),gametxt,tr("OK"),tr("Cancel"));
|
||||||
|
|
||||||
sprintf(gametxt, "%s", tr("Installing game:"));
|
if (choice == 1) {
|
||||||
|
|
||||||
if (gamesize > freespace) {
|
sprintf(gametxt, "%s", tr("Installing game:"));
|
||||||
char errortxt[50];
|
|
||||||
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB",tr("Game Size"), gamesize, tr("Free Space"), freespace);
|
if (gamesize > freespace) {
|
||||||
WindowPrompt(tr("Not enough free space!"),errortxt,tr("OK"));
|
char errortxt[50];
|
||||||
menu = MENU_DISCLIST;
|
sprintf(errortxt, "%s: %.2fGB, %s: %.2fGB",tr("Game Size"), gamesize, tr("Free Space"), freespace);
|
||||||
break;
|
WindowPrompt(tr("Not enough free space!"),errortxt,tr("OK"));
|
||||||
} else {
|
menu = MENU_DISCLIST;
|
||||||
USBStorage_Watchdog(0);
|
break;
|
||||||
SetupGameInstallProgress(gametxt, name);
|
} else {
|
||||||
ret = WBFS_AddGame();
|
USBStorage_Watchdog(0);
|
||||||
ProgressStop();
|
SetupGameInstallProgress(gametxt, name);
|
||||||
USBStorage_Watchdog(1);
|
ret = WBFS_AddGame();
|
||||||
wiilight(0);
|
ProgressStop();
|
||||||
if (ret != 0) {
|
USBStorage_Watchdog(1);
|
||||||
WindowPrompt(tr("Install Error!"),0,tr("Back"));
|
wiilight(0);
|
||||||
menu = MENU_DISCLIST;
|
if (ret != 0) {
|
||||||
break;
|
WindowPrompt(tr("Install Error!"),0,tr("Back"));
|
||||||
} else {
|
menu = MENU_DISCLIST;
|
||||||
__Menu_GetEntries(); //get the entries again
|
break;
|
||||||
GuiSound * instsuccess = NULL;
|
} else {
|
||||||
bgMusic->Pause();
|
__Menu_GetEntries(); //get the entries again
|
||||||
instsuccess = new GuiSound(success_ogg, success_ogg_size, Settings.sfxvolume);
|
GuiSound * instsuccess = NULL;
|
||||||
instsuccess->SetVolume(Settings.sfxvolume);
|
bgMusic->Pause();
|
||||||
instsuccess->SetLoop(0);
|
instsuccess = new GuiSound(success_ogg, success_ogg_size, Settings.sfxvolume);
|
||||||
instsuccess->Play();
|
instsuccess->SetVolume(Settings.sfxvolume);
|
||||||
WindowPrompt (tr("Successfully installed:"),name,tr("OK"));
|
instsuccess->SetLoop(0);
|
||||||
instsuccess->Stop();
|
instsuccess->Play();
|
||||||
delete instsuccess;
|
WindowPrompt (tr("Successfully installed:"),name,tr("OK"));
|
||||||
bgMusic->Resume();
|
instsuccess->Stop();
|
||||||
menu = MENU_DISCLIST;
|
delete instsuccess;
|
||||||
break;
|
bgMusic->Resume();
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
}
|
break;
|
||||||
} else {
|
}
|
||||||
menu = MENU_DISCLIST;
|
}
|
||||||
break;
|
} else {
|
||||||
}
|
menu = MENU_DISCLIST;
|
||||||
|
break;
|
||||||
if (shutdown == 1) {
|
}
|
||||||
wiilight(0);
|
|
||||||
Sys_Shutdown();
|
if (shutdown == 1) {
|
||||||
}
|
wiilight(0);
|
||||||
if (reset == 1) {
|
Sys_Shutdown();
|
||||||
wiilight(0);
|
}
|
||||||
Sys_Reboot();
|
if (reset == 1) {
|
||||||
}
|
wiilight(0);
|
||||||
}
|
Sys_Reboot();
|
||||||
|
}
|
||||||
//Turn off the WiiLight
|
}
|
||||||
wiilight(0);
|
|
||||||
|
//Turn off the WiiLight
|
||||||
HaltGui();
|
wiilight(0);
|
||||||
|
|
||||||
mainWindow->Remove(&w);
|
HaltGui();
|
||||||
ResumeGui();
|
|
||||||
return menu;
|
mainWindow->Remove(&w);
|
||||||
}
|
ResumeGui();
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
@ -305,7 +305,7 @@ s32 WBFS_OpenPart(u32 part_fat, u32 part_idx, u32 part_lba, u32 part_size, char
|
|||||||
wbfs_part_fat = part_fat;
|
wbfs_part_fat = part_fat;
|
||||||
wbfs_part_idx = part_idx;
|
wbfs_part_idx = part_idx;
|
||||||
wbfs_part_lba = part_lba;
|
wbfs_part_lba = part_lba;
|
||||||
|
|
||||||
sprintf(partition, "%s%d", wbfs_part_fat ? "FAT" : "WBFS", wbfs_part_idx);
|
sprintf(partition, "%s%d", wbfs_part_fat ? "FAT" : "WBFS", wbfs_part_idx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -551,8 +551,12 @@ s32 WBFS_DiskSpace(f32 *used, f32 *free) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_RenameGame(u8 *discid, const void *newname) {
|
s32 WBFS_RenameGame(u8 *discid, const void *newname)
|
||||||
if (wbfs_part_fat) return -1;
|
{
|
||||||
|
if (wbfs_part_fat)
|
||||||
|
{
|
||||||
|
return WBFS_FAT_RenameGame(discid, newname);
|
||||||
|
}
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
@ -566,8 +570,12 @@ s32 WBFS_RenameGame(u8 *discid, const void *newname) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 WBFS_ReIDGame(u8 *discid, const void *newID) {
|
s32 WBFS_ReIDGame(u8 *discid, const void *newID)
|
||||||
if (wbfs_part_fat) return -1;
|
{
|
||||||
|
if (wbfs_part_fat)
|
||||||
|
{
|
||||||
|
return WBFS_FAT_ReIDGame(discid, newID);
|
||||||
|
}
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
|
|
||||||
|
@ -100,21 +100,21 @@ s32 _WBFS_FAT_GetHeadersCount(void *outbuf, u32 *count, u32 len)
|
|||||||
cnt++;
|
cnt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no title found, read it from wbfs file directly
|
// no title found, read it from wbfs file directly
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
fseek(fp, 512, SEEK_SET);
|
fseek(fp, 512, SEEK_SET);
|
||||||
fread(&tmpHdr, sizeof(struct discHdr), 1, fp);
|
fread(&tmpHdr, sizeof(struct discHdr), 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if (tmpHdr.magic == 0x5D1C9EA3 && (memcmp(tmpHdr.id, id, 6) == 0)) {
|
if (tmpHdr.magic == 0x5D1C9EA3 && (memcmp(tmpHdr.id, id, 6) == 0)) {
|
||||||
memcpy(ptr, &tmpHdr, hdrsize);
|
memcpy(ptr, &tmpHdr, hdrsize);
|
||||||
cnt++;
|
cnt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no title found, read it from wbfs file
|
// no title found, read it from wbfs file
|
||||||
// but this is a little bit slower
|
// but this is a little bit slower
|
||||||
// open 'partition' file
|
// open 'partition' file
|
||||||
@ -217,7 +217,7 @@ wbfs_t* WBFS_FAT_OpenPart(u8 *id)
|
|||||||
if (ret) return NULL;
|
if (ret) return NULL;
|
||||||
part = wbfs_open_partition(
|
part = wbfs_open_partition(
|
||||||
split_read_sector,
|
split_read_sector,
|
||||||
nop_write_sector, //readonly //split_write_sector,
|
split_write_sector, //readonly //split_write_sector,
|
||||||
&split, fat_sector_size, split.total_sec, 0, 0);
|
&split, fat_sector_size, split.total_sec, 0, 0);
|
||||||
if (!part) {
|
if (!part) {
|
||||||
split_close(&split);
|
split_close(&split);
|
||||||
@ -272,7 +272,7 @@ s32 WBFS_FAT_RemoveGame(u8 *discid)
|
|||||||
WBFS_FAT_fname(discid, fname, sizeof(fname));
|
WBFS_FAT_fname(discid, fname, sizeof(fname));
|
||||||
split_create(&split, fname, 0, 0, true);
|
split_create(&split, fname, 0, 0, true);
|
||||||
split_close(&split);
|
split_close(&split);
|
||||||
|
|
||||||
// Reset FAT stats
|
// Reset FAT stats
|
||||||
wbfs_fat_vfs_have = 0;
|
wbfs_fat_vfs_have = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -315,7 +315,7 @@ s32 WBFS_FAT_DVD_Size(u64 *comp_size, u64 *real_size)
|
|||||||
wbfs_t *part = NULL;
|
wbfs_t *part = NULL;
|
||||||
u64 size = (u64)143432*2*0x8000ULL;
|
u64 size = (u64)143432*2*0x8000ULL;
|
||||||
u32 n_sector = size / fat_sector_size;
|
u32 n_sector = size / fat_sector_size;
|
||||||
u32 wii_sec_sz;
|
u32 wii_sec_sz;
|
||||||
|
|
||||||
// init a temporary dummy part
|
// init a temporary dummy part
|
||||||
// as a placeholder for wbfs_size_disc
|
// as a placeholder for wbfs_size_disc
|
||||||
@ -337,3 +337,50 @@ s32 WBFS_FAT_DVD_Size(u64 *comp_size, u64 *real_size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 WBFS_FAT_RenameGame(u8 *discid, const void *newname)
|
||||||
|
{
|
||||||
|
wbfs_t *part = WBFS_FAT_OpenPart(discid);
|
||||||
|
if (!part)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
s32 ret = wbfs_ren_disc(part, discid,(u8*)newname);
|
||||||
|
|
||||||
|
WBFS_FAT_ClosePart(part);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 WBFS_FAT_ReIDGame(u8 *discid, const void *newID)
|
||||||
|
{
|
||||||
|
wbfs_t *part = WBFS_FAT_OpenPart(discid);
|
||||||
|
if (!part)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
s32 ret = wbfs_rID_disc(part, discid,(u8*)newID);
|
||||||
|
|
||||||
|
WBFS_FAT_ClosePart(part);
|
||||||
|
|
||||||
|
if(ret == 0)
|
||||||
|
{
|
||||||
|
char fname[100];
|
||||||
|
char fnamenew[100];
|
||||||
|
s32 cnt = 0x31;
|
||||||
|
|
||||||
|
WBFS_FAT_fname(discid, fname, sizeof(fname));
|
||||||
|
WBFS_FAT_fname((u8*) newID, fnamenew, sizeof(fnamenew));
|
||||||
|
|
||||||
|
int stringlength = strlen(fname);
|
||||||
|
|
||||||
|
while(rename(fname, fnamenew) == 0)
|
||||||
|
{
|
||||||
|
fname[stringlength] = cnt;
|
||||||
|
fname[stringlength+1] = 0;
|
||||||
|
fnamenew[stringlength] = cnt;
|
||||||
|
fnamenew[stringlength+1] = 0;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -11,5 +11,7 @@ s32 WBFS_FAT_DiskSpace(f32 *used, f32 *free);
|
|||||||
s32 WBFS_FAT_RemoveGame(u8 *discid);
|
s32 WBFS_FAT_RemoveGame(u8 *discid);
|
||||||
s32 WBFS_FAT_AddGame(void);
|
s32 WBFS_FAT_AddGame(void);
|
||||||
s32 WBFS_FAT_DVD_Size(u64 *comp_size, u64 *real_size);
|
s32 WBFS_FAT_DVD_Size(u64 *comp_size, u64 *real_size);
|
||||||
|
s32 WBFS_FAT_RenameGame(u8 *discid, const void *newname);
|
||||||
|
s32 WBFS_FAT_ReIDGame(u8 *discid, const void *newID);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user