*Fixed display of partition size on WBFS partitions with a different wbfs sector size than 512bytes.

*Made the ProgressWindow for game installation more accurate
*Added displaying newly installed games (marked as new) on favorite list, so you don't have to change to full list when installing new games. (Thanks Cyan for the patch)
*Lot's a small fixes
*Added WDM Menu on game start. You can set it in the alternative DOL option (one new option there). The menu lists all DOLs on the disc and if a wdm file is provided in the WDM path (configurable in the settings) than the dol parameter and dol replacement name will be taken from the wdm. The DOLs that are not listed in the WDM but exist on the DISC will be listed at the end of the list.
*Added avoid of multiple app cleanup when game fails to boot

*Changed libfat to use FS info sector on FAT32 partitions. This speeds up the free space information getting to instant. For that the FS info sector has to have correct values. The values of all partitions where homebrews were writing to are currently incorrect because the official libfat does not support FS info sector (i submited a patch) (Windows does write it correct though). That is why there needs to be a synchronization of the FS info sector for partitions used with homebrews. For this purpose a new setting was added in the Loader Settings. You can synchronize all your FAT32 partitions on the USB with it once and you are done (if you don't write to that partition with current homebrews). After that you can enable free space display and it will be instant like on WBFS/NTFS/EXT partitions.
This commit is contained in:
dimok321 2011-01-16 13:12:07 +00:00
parent 6540e252dc
commit e6a87c05fe
36 changed files with 577 additions and 76 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>2.0 r1043</version>
<release_date>201101131909</release_date>
<version>2.0 r1044</version>
<release_date>201101141539</release_date>
<no_ios_reload/>
<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.

File diff suppressed because one or more lines are too long

View File

@ -332,7 +332,8 @@ void PartitionHandle::AddPartition(const char * name, u64 lba_start, u64 sec_cou
{
name = "WBFS";
part_type = 0xBF; //Override partition type on WBFS
sec_count = wbfs_ntohl(head->n_hd_sec);
//! correct sector size in physical sectors (512 bytes per sector)
sec_count = (u64) head->n_hd_sec * (u64) (1 << head->hd_sec_sz_s) / (u64) BYTES_PER_SECTOR;
}
else if(*((u16 *) (buffer + 0x1FE)) == 0x55AA)

View File

@ -1,4 +1,5 @@
#include "menu/menus.h"
#include "menu/WDMMenu.hpp"
#include "mload/mload.h"
#include "mload/mload_modules.h"
#include "system/IosLoader.h"
@ -35,7 +36,7 @@ extern int mountMethod;
static u32 BootPartition(char * dolpath, u8 videoselected, u8 languageChoice, u8 cheat, u8 vipatch, u8 patchcountrystring,
u8 alternatedol, u32 alternatedoloffset, u32 returnTo, u8 fix002)
{
gprintf("booting partition IOS %u v%u\n", IOS_GetVersion(), IOS_GetRevision());
gprintf("booting partition IOS %u r%u\n", IOS_GetVersion(), IOS_GetRevision());
entry_point p_entry;
s32 ret;
u64 offset;
@ -140,6 +141,9 @@ int BootGame(const char * gameID)
returnToLoaderGV = game_cfg->returnTo;
}
if(alternatedol == 3)
alternatedoloffset = WDMMenu::GetAlternateDolOffset();
if(iosChoice != IOS_GetVersion())
{
gprintf("Reloading into game cIOS: %i...\n", iosChoice);
@ -230,7 +234,7 @@ int BootGame(const char * gameID)
gprintf("Jumping to game entrypoint: 0x%08X.\n", AppEntrypoint);
return Disc_JumpToEntrypoint(videoChoice, enablecheat);
return Disc_JumpToEntrypoint(videoChoice, enablecheat, WDMMenu::GetDolParameter());
}
WDVD_ClosePartition();

Binary file not shown.

View File

@ -631,8 +631,7 @@ u32 wbfs_extract_disc(wbfs_disc_t*d, rw_sector_callback_t write_dst_wii_sector,
error: return 1;
}
float wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data,
partition_selector_t sel)
u64 wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data, partition_selector_t sel)
{
u8 *b;
int i;
@ -664,8 +663,6 @@ float wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, v
b = (u8 *) info;
read_src_wii_disc(callback_data, 0, 0x100, info->disc_header_copy);
//fprintf(stderr, "estimating %c%c%c%c%c%c %s...\n",b[0], b[1], b[2], b[3], b[4], b[5], b + 0x20);
for (i = 0; i < p->n_wbfs_sec_per_disc; i++)
{
if (block_used(used, i, wii_sec_per_wbfs_sect))
@ -673,16 +670,15 @@ float wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, v
tot++;
}
}
//memcpy(header, b,0x100);
error: if (d) wd_close_disc(d);
error:
if (d) wd_close_disc(d);
if (used) wbfs_free( used );
if (info) wbfs_iofree( info );
return tot * (((p->wbfs_sec_sz * 1.0) / p->hd_sec_sz) * 512);
return (u64) tot * (u64) p->wbfs_sec_sz;
}
u32 wbfs_size_disc(wbfs_t*p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data, partition_selector_t sel,
u32 *comp_size, u32 *real_size)
{

View File

@ -215,7 +215,7 @@ extern "C"
// remove some sanity checks
void wbfs_set_force_mode(int force);
float wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data,
u64 wbfs_estimate_disc(wbfs_t *p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data,
partition_selector_t sel);
// compressed and real size
u32 wbfs_size_disc(wbfs_t*p, read_wiidisc_callback_t read_src_wii_disc, void *callback_data,

View File

@ -169,7 +169,7 @@ static void do_files(wiidisc_t*d)
if(get_fst && !d->extracted_buffer)
{
d->extracted_buffer = malloc(fst_size);
d->extracted_buffer = wbfs_ioalloc(fst_size);
memcpy(d->extracted_buffer, fst, fst_size);
}
@ -264,6 +264,7 @@ static void do_disc(wiidisc_t*d)
magic = _be32(b + 24);
if (magic != 0x5D1C9EA3)
{
wbfs_iofree( b );
wbfs_error( "not a wii disc" );
return;
}

View File

@ -26,6 +26,7 @@
#include "utils/ShowError.h"
#include "utils/tools.h"
#include "utils/PasswordCheck.h"
#include "WDMMenu.hpp"
#include "gecko.h"
#include "menus.h"
#include "wpad.h"
@ -569,7 +570,7 @@ void GameBrowseMenu::ReloadBrowser()
favoriteBtn->SetPosition(Settings.widescreen ? thInt("288 - list layout favorite btn pos x widescreen") : thInt("260 - list layout favorite btn pos x"),
thInt("13 - list layout favorite btn pos y"));
searchBtn->SetPosition(Settings.widescreen ? thInt("320 - list layout search btn pos x widescreen") : thInt("300 - list layout search btn pos x"),
thInt("13 - list layout search btn pos x"));
thInt("13 - list layout search btn pos y"));
sortBtn->SetPosition(Settings.widescreen ? thInt("352 - list layout abc/sort btn pos x widescreen") : thInt("340 - list layout abc/sort btn pos x"),
thInt("13 - list layout abc/sort btn pos y"));
listBtn->SetPosition(Settings.widescreen ? thInt("384 - list layout list btn pos x widescreen") : thInt("380 - list layout list btn pos x"),
@ -1238,13 +1239,6 @@ int GameBrowseMenu::OpenClickedGame()
u8 alternatedol = OFF;
u8 ocarinaChoice = Settings.ocarina;
GameCFG* game_cfg = GameSettings.GetGameCFG(header->id);
if (game_cfg)
{
alternatedol = game_cfg->loadalternatedol;
ocarinaChoice = game_cfg->ocarina;
}
bool returnHere = true;// prompt to start game
int choice = -1;
@ -1273,18 +1267,37 @@ int GameBrowseMenu::OpenClickedGame()
if (choice == 1)
{
bool RunGame = true;
wiilight(0);
GameCFG* game_cfg = GameSettings.GetGameCFG(header->id);
if (game_cfg)
{
alternatedol = game_cfg->loadalternatedol;
ocarinaChoice = game_cfg->ocarina;
}
if(alternatedol == 3)
if(WDMMenu::Show(header) == 0)
{
RunGame = false;
returnHere = true;
}
if (alternatedol == 2)
CheckAlternativeDOL(IDfull);
if (ocarinaChoice != OFF)
if (RunGame && ocarinaChoice != OFF)
CheckOcarina(IDfull);
wiilight(0);
GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
GameStatistics.Save();
if(RunGame)
{
GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
GameStatistics.Save();
//Just calling that shuts down everything and starts game
BootGame(IDfull);
//Just calling that shuts down everything and starts game
BootGame(IDfull);
}
}
else if (choice == 2)
{

264
source/menu/WDMMenu.cpp Normal file
View File

@ -0,0 +1,264 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include <unistd.h>
#include "WDMMenu.hpp"
#include "FileOperations/fileops.h"
#include "menu/menus.h"
#include "themes/CTheme.h"
#include "language/gettext.h"
#include "usbloader/wbfs.h"
#include "libs/libwbfs/libwbfs.h"
#include "libs/libwbfs/wiidisc.h"
#include "usbloader/fstfile.h"
#include "settings/GameTitles.h"
#include "gecko.h"
u32 WDMMenu::AlternateDolOffset = 0;
u32 WDMMenu::AlternateDolParameter = 0;
WDMMenu::WDMMenu(const struct discHdr * header)
: GuiWindow(screenwidth, screenheight)
{
Options = new OptionList;
btnOutline = Resources::GetImageData("button_dialogue_box.png");
trigA = new GuiTrigger();
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigB = new GuiTrigger();
trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
defaultBtnTxt = new GuiText(tr("Default"), 22, (GXColor){0, 0, 0, 255});
defaultBtnImg = new GuiImage(btnOutline);
defaultBtn = new GuiButton(defaultBtnImg, defaultBtnImg, 2, 3, 130, 400, trigA, btnSoundOver, btnSoundClick2, 1);
defaultBtn->SetLabel(defaultBtnTxt);
Append(defaultBtn);
backBtnTxt = new GuiText(tr("Back"), 22, (GXColor){0, 0, 0, 255});
backBtnImg = new GuiImage(btnOutline);
backBtn = new GuiButton(backBtnImg, backBtnImg, 2, 3, -130, 400, trigA, btnSoundOver, btnSoundClick2, 1);
backBtn->SetLabel(backBtnTxt);
backBtn->SetTrigger(trigB);
Append(backBtn);
optionBrowser = new GuiCustomOptionBrowser(396, 280, Options, "bg_options_settings.png");
optionBrowser->SetPosition(0, 90);
optionBrowser->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
Append(optionBrowser);
SetEffect(EFFECT_FADE, 50);
char WDMPath[200];
snprintf(WDMPath, sizeof(WDMPath), "%s/%.3s.wdm", Settings.WDMpath, (char *) header->id);
if(!CheckFile(WDMPath))
{
snprintf(WDMPath, sizeof(WDMPath), "%s/%.6s.wdm", Settings.WDMpath, (char *) header->id);
if(!CheckFile(WDMPath))
snprintf(WDMPath, sizeof(WDMPath), "%s/%.4s.wdm", Settings.WDMpath, (char *) header->id);
}
wdmFile = new WDMFile(WDMPath);
CheckGameFiles(header);
}
WDMMenu::~WDMMenu()
{
ResumeGui();
SetEffect(EFFECT_FADE, -50);
while(this->GetEffect() > 0)
usleep(100);
HaltGui();
if(parentElement)
((GuiWindow *) parentElement)->Remove(this);
RemoveAll();
delete btnOutline;
delete backBtnTxt;
delete backBtnImg;
delete backBtn;
delete defaultBtnTxt;
delete defaultBtnImg;
delete defaultBtn;
delete trigA;
delete trigB;
delete optionBrowser;
delete wdmFile;
ResumeGui();
}
int WDMMenu::GetChoice()
{
if (shutdown)
Sys_Shutdown();
else if (reset)
Sys_Reboot();
if(backBtn->GetState() == STATE_CLICKED)
return 0;
else if(defaultBtn->GetState() == STATE_CLICKED)
return 1;
int choice = optionBrowser->GetClickedOption();
if(choice >= 0 && choice < (int) DOLOffsetList.size())
{
AlternateDolOffset = DOLOffsetList[choice].first;
AlternateDolParameter = DOLOffsetList[choice].second;
return 1;
}
return -1;
}
int WDMMenu::Show(const struct discHdr * header)
{
WDMMenu Menu(header);
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&Menu);
int ret = -1;
while(ret == -1)
{
usleep(100);
ret = Menu.GetChoice();
}
mainWindow->SetState(STATE_DEFAULT);
return ret;
}
static inline bool stringcompare(const char * replace, const char * dolname)
{
if(strlen(replace) == 0 || strlen(dolname) == 0)
return false;
for( ; *replace != 0 && *dolname != 0; replace++, dolname++)
{
if(*replace == '?')
continue;
if(toupper((int) *replace) != toupper((int) *dolname))
return false;
}
return true;
}
void WDMMenu::CheckGameFiles(const struct discHdr * header)
{
wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) header->id);
if (!disc)
{
WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
return;
}
wiidisc_t *wdisc = wd_open_disc((int(*)(void *, u32, u32, void *)) wbfs_disc_read, disc);
if (!wdisc)
{
WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
return;
}
FST_ENTRY * fstbuffer = (FST_ENTRY *) wd_get_fst(wdisc, ONLY_GAME_PARTITION);
if (!fstbuffer)
{
WindowPrompt(tr( "ERROR:" ), tr( "Not enough free memory." ), tr( "OK" ));
return;
}
wd_close_disc(wdisc);
WBFS_CloseDisc(disc);
int position = 0;
vector<pair<int, string> > FilesNotInWDM;
for(int i = 0; i < wdmFile->size(); ++i)
{
if(stringcompare(wdmFile->GetDolName(i), "main") == true)
{
DOLOffsetList.push_back(pair<int, int>(0, wdmFile->GetParameter(i)));
Options->SetName(position, "%i.", position+1);
Options->SetValue(position, wdmFile->GetReplaceName(i));
position++;
}
}
for (u32 i = 1; i < fstbuffer[0].filelen; i++)
{
//don't add files that aren't .dol to the list
const char * filename = fstfiles(fstbuffer, i);
const char * fileext = NULL;
if(filename)
fileext = strrchr(filename, '.');
if (fileext && strcasecmp(fileext, ".dol") == 0)
{
char NameCpy[strlen(filename)+1];
strcpy(NameCpy, filename);
char *extension = strrchr(NameCpy, '.');
if(extension) *extension = 0;
int j;
for(j = 0; j < wdmFile->size(); ++j)
{
if(stringcompare(wdmFile->GetDolName(j), NameCpy) == true)
{
DOLOffsetList.push_back(pair<int, int>(i, wdmFile->GetParameter(j)));
Options->SetName(position, "%i.", position+1);
Options->SetValue(position, wdmFile->GetReplaceName(j));
position++;
break;
}
}
if(j == wdmFile->size())
FilesNotInWDM.push_back(pair<int, string>(i, filename));
}
}
for(u32 i = 0; i < FilesNotInWDM.size(); ++i)
{
DOLOffsetList.push_back(pair<int, int>(FilesNotInWDM[i].first, 1));
Options->SetName(position, "%i.", position+1);
Options->SetValue(position, FilesNotInWDM[i].second.c_str());
position++;
}
free(fstbuffer);
}

44
source/menu/WDMMenu.hpp Normal file
View File

@ -0,0 +1,44 @@
#ifndef WDMMENU_HPP_
#define WDMMENU_HPP_
#include "libwiigui/gui.h"
#include "libwiigui/gui_customoptionbrowser.h"
#include "usbloader/disc.h"
#include "usbloader/WDMFile.hpp"
class WDMMenu : public GuiWindow
{
public:
WDMMenu(const struct discHdr * header);
~WDMMenu();
int GetChoice();
static int Show(const struct discHdr * header);
static u32 GetAlternateDolOffset() { return AlternateDolOffset; }
static u32 GetDolParameter() { return AlternateDolParameter; }
private:
void CheckGameFiles(const struct discHdr * header);
static u32 AlternateDolOffset;
static u32 AlternateDolParameter;
WDMFile * wdmFile;
vector<pair<int, int> > DOLOffsetList;
GuiImageData * btnOutline;
GuiTrigger * trigA;
GuiTrigger * trigB;
OptionList * Options;
GuiText * backBtnTxt;
GuiImage * backBtnImg;
GuiButton * backBtn;
GuiText * defaultBtnTxt;
GuiImage * defaultBtnImg;
GuiButton * defaultBtn;
GuiCustomOptionBrowser * optionBrowser;
};
#endif

View File

@ -7,7 +7,7 @@
#include "prompts/ProgressWindow.h"
#include "themes/CTheme.h"
float gamesize = -1.0f;
u64 gamesize = 0;
/****************************************************************************
* MenuInstall
@ -61,11 +61,11 @@ int MenuInstall()
f32 freespace, used;
WBFS_DiskSpace(&used, &freespace);
gamesize = WBFS_EstimeGameSize() / GB_SIZE;
gamesize = WBFS_EstimeGameSize();
char gametxt[50];
sprintf(gametxt, "%s : %.2fGB", name, gamesize);
sprintf(gametxt, "%s : %.2fGB", name, gamesize/GB_SIZE);
wiilight(1);
choice = WindowPrompt(tr( "Continue to install game?" ), gametxt, tr( "OK" ), tr( "Cancel" ));
@ -74,10 +74,10 @@ int MenuInstall()
{
sprintf(gametxt, "%s", tr( "Installing game:" ));
if (gamesize > freespace)
if (gamesize/GB_SIZE > freespace)
{
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/GB_SIZE, tr( "Free Space" ), freespace);
WindowPrompt(tr( "Not enough free space!" ), errortxt, tr( "OK" ));
}
else
@ -112,7 +112,7 @@ int MenuInstall()
//Turn off the WiiLight
wiilight(0);
gamesize = -1.0f;
gamesize = 0;
return MENU_DISCLIST;
}

View File

@ -75,9 +75,6 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si
const char * filename = fstfiles(fstbuffer, i);
const char * fileext = NULL;
if(filename)
gprintf("%s\n", filename);
if(filename)
fileext = strrchr(filename, '.');

View File

@ -35,8 +35,6 @@ static bool showTime = false;
static bool showSize = false;
static bool changed = true;
extern float gamesize;
/****************************************************************************
* StartProgress
***************************************************************************/
@ -143,16 +141,18 @@ static void UpdateProgressValues(GuiImage *progressbarImg, GuiText *prTxt, GuiTe
if(!changed)
return;
extern u64 gamesize;
LWP_MutexLock(ProgressMutex);
changed = false;
s64 done = progressDone;
s64 total = progressTotal;
u32 speed = 0;
if(gamesize > 0.0f)
if(gamesize > 0)
{
done = (s64) ((float) done / (float) total * gamesize * GB_SIZE);
total = (s64) (gamesize * GB_SIZE);
done = (s64) ((double) done / (double) total * (double) gamesize);
total = (s64) gamesize;
}
//Calculate speed in KB/s
@ -161,13 +161,16 @@ static void UpdateProgressValues(GuiImage *progressbarImg, GuiText *prTxt, GuiTe
LWP_MutexUnlock(ProgressMutex);
u32 TimeLeft = 0;
u32 TimeLeft = 0, h = 0, m = 0, s = 0;
if(speed > 0)
TimeLeft = (total-done)/speed;
u32 h = TimeLeft / 3600;
u32 m = (TimeLeft / 60) % 60;
u32 s = TimeLeft % 60;
if(TimeLeft > 0)
{
h = TimeLeft / 3600;
m = (TimeLeft / 60) % 60;
s = TimeLeft % 60;
}
float progressPercent = 100.0 * done / total;

View File

@ -65,6 +65,7 @@ void CSettings::SetDefault()
snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%s/txtcodes/", BootDevice);
snprintf(BcaCodepath, sizeof(BcaCodepath), "%s/bca/", BootDevice);
snprintf(WipCodepath, sizeof(WipCodepath), "%s/wip/", BootDevice);
snprintf(WDMpath, sizeof(WDMpath), "%s/wdm/", BootDevice);
snprintf(theme_path, sizeof(theme_path), "%stheme/", ConfigPath);
snprintf(dolpath, sizeof(dolpath), "%s/", BootDevice);
strcpy(theme, "");
@ -112,7 +113,7 @@ void CSettings::SetDefault()
InstallPartitions = ONLY_GAME_PARTITION;
beta_upgrades = 0;
PlaylogUpdate = 1;
UseIOS58 = 1;
UseIOS58 = 0;
widescreen = (CONF_GetAspectRatio() == CONF_ASPECT_16_9);
}
@ -236,6 +237,7 @@ bool CSettings::Save()
fprintf(file, "Cheatcodespath = %s\n ", Cheatcodespath);
fprintf(file, "BcaCodepath = %s\n ", BcaCodepath);
fprintf(file, "WipCodepath = %s\n ", WipCodepath);
fprintf(file, "WDMpath = %s\n ", WDMpath);
fprintf(file, "titlesOverride = %d\n ", titlesOverride);
fprintf(file, "patchcountrystrings = %d\n ", patchcountrystrings);
fprintf(file, "screensaver = %d\n ", screensaver);
@ -585,6 +587,11 @@ bool CSettings::SetSetting(char *name, char *value)
strcpy(WipCodepath, value);
return true;
}
else if (strcmp(name, "WDMpath") == 0)
{
strcpy(WDMpath, value);
return true;
}
else if (strcmp(name, "returnTo") == 0)
{
strcpy(returnTo, value);

View File

@ -95,6 +95,7 @@ class CSettings
char TxtCheatcodespath[100];
char BcaCodepath[100];
char WipCodepath[100];
char WDMpath[100];
short error002;
short titlesOverride; // db_titles
char db_url[200];

View File

@ -47,6 +47,7 @@ CustomPathsSM::CustomPathsSM()
Options->SetName(Idx++, tr("BCA Codes Path"));
Options->SetName(Idx++, tr("WIP Patches Path"));
Options->SetName(Idx++, tr("Languagefiles Path"));
Options->SetName(Idx++, tr("WDM Files Path"));
SetOptionValues();
}
@ -93,6 +94,9 @@ void CustomPathsSM::SetOptionValues()
//! Settings: Languagefiles Path
Options->SetValue(Idx++, Settings.languagefiles_path);
//! Settings: WDM Files Path
Options->SetValue(Idx++, Settings.WDMpath);
}
int CustomPathsSM::GetMenuInternal()
@ -205,6 +209,13 @@ int CustomPathsSM::GetMenuInternal()
ChangePath(Settings.languagefiles_path, sizeof(Settings.languagefiles_path));
}
//! Settings: WDM Files Path
else if (ret == ++Idx)
{
titleTxt->SetText(tr( "WDM Files Path" ));
ChangePath(Settings.WDMpath, sizeof(Settings.WDMpath));
}
//! Global set back of the titleTxt after a change
titleTxt->SetText(tr( "Custom Paths" ));
SetOptionValues();

View File

@ -83,6 +83,7 @@ static const char * AlternateDOLText[] =
trNOOP( "OFF" ),
trNOOP( "Select a DOL from Game" ),
trNOOP( "Load From SD/USB" ),
trNOOP( "List on Gamelaunch" ),
};
GameLoadSM::GameLoadSM(const char * GameID)
@ -326,7 +327,7 @@ int GameLoadSM::GetMenuInternal()
//! Settings: Alternate DOL
else if (ret == ++Idx)
{
if (++GameConfig.loadalternatedol > 2)
if (++GameConfig.loadalternatedol > 3)
GameConfig.loadalternatedol = 0;
}

View File

@ -22,9 +22,11 @@
* distribution.
***************************************************************************/
#include <unistd.h>
#include <sys/statvfs.h>
#include "LoaderSettings.hpp"
#include "Controls/DeviceHandler.hpp"
#include "settings/CSettings.h"
#include "prompts/ProgressWindow.h"
#include "prompts/PromptWindows.h"
#include "language/gettext.h"
#include "wad/nandtitle.h"
@ -121,6 +123,7 @@ LoaderSettings::LoaderSettings()
Options->SetName(Idx++, "%s", tr( "Install partitions" ));
Options->SetName(Idx++, "%s", tr( "Return To" ));
Options->SetName(Idx++, "%s", tr( "Messageboard Update" ));
Options->SetName(Idx++, "%s", tr( "Sync FAT32 FS Info" ));
SetOptionValues();
@ -206,6 +209,9 @@ void LoaderSettings::SetOptionValues()
//! Settings: Messageboard Update
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.PlaylogUpdate] ));
//! Settings: Sync FAT32 FS Info
Options->SetValue(Idx++, " ");
}
int LoaderSettings::GetMenuInternal()
@ -365,6 +371,31 @@ int LoaderSettings::GetMenuInternal()
if (++Settings.PlaylogUpdate >= MAX_ON_OFF) Settings.PlaylogUpdate = 0;
}
//! Settings: Sync FAT32 FS Info
else if (ret == ++Idx )
{
int choice = WindowPrompt(0, tr("Do you want to sync free space info sector on all FAT32 partitions?"), tr("Yes"), tr("Cancel"));
if(choice)
{
StartProgress(tr("Synchornizing..."), tr("Please wait..."), 0, false, false);
PartitionHandle * usb = DeviceHandler::Instance()->GetUSBHandle();
for(int i = 0; i < usb->GetPartitionCount(); ++i)
{
ShowProgress(i, usb->GetPartitionCount());
if(strncmp(usb->GetFSName(i), "FAT", 3) == 0)
{
struct statvfs stats;
char drive[20];
snprintf(drive, sizeof(drive), "%s:/", usb->MountName(i));
memset(&stats, 0, sizeof(stats));
memcpy(&stats.f_flag, "SCAN", 4);
statvfs(drive, &stats);
}
}
ProgressStop();
}
}
SetOptionValues();
return MENU_NONE;

View File

@ -68,6 +68,11 @@ void Sys_Init(void)
void AppCleanUp(void)
{
static bool app_clean = false;
if(app_clean)
return;
app_clean = true;
extern u8 mountMethod;
gprintf("Exiting main GUI. mountMethod = %d\n", mountMethod);

View File

@ -127,7 +127,15 @@ int GameList::FilterList(const wchar_t * gameFilter)
if (Settings.GameSort & SORT_FAVORITE)
{
GameStatus * GameStats = GameStatistics.GetGameStatus(header->id);
if (!GameStats || GameStats->FavoriteRank == 0) continue;
if (Settings.marknewtitles)
{
bool isNew = NewTitles::Instance()->IsNew(header->id);
if (!isNew && (!GameStats || GameStats->FavoriteRank == 0)) continue;
}
else
{
if (!GameStats || GameStats->FavoriteRank == 0) continue;
}
}
//ignore uLoader cfg "iso". i was told it is "__CFG_" but not confirmed

View File

@ -0,0 +1,75 @@
#include <stdlib.h>
#include <string.h>
#include "WDMFile.hpp"
static inline int GetNumber(const char * line)
{
while(*line == ' ') line++;
if(line[0] == '0' && (line[1] == 'x' || line[1] == 'X'))
return strtol(line, 0, 16);
else
return strtol(line, 0, 10);
}
WDMFile::WDMFile(const char * path)
{
FILE * file = fopen(path, "rb");
if(!file)
return;
char line[255];
int entry_number = 0;
int counter = 0;
WDMEntry Entry;
while (fgets(line, sizeof(line), file))
{
if(line[0] == '#')
continue;
entry_number++;
if(entry_number < 3)
continue;
if(counter == 0)
{
int strlength = strlen(line);
while(strlength > 0 && (line[strlength-1] == '\n' || line[strlength-1] == '\r' || line[strlength-1] == ' '))
{
line[strlength-1] = '\0';
strlength--;
}
Entry.ReplaceName = line;
}
else if(counter == 1)
{
int strlength = strlen(line);
while(strlength > 0 && (line[strlength-1] == '\n' || line[strlength-1] == '\r' || line[strlength-1] == ' '))
{
line[strlength-1] = '\0';
strlength--;
}
Entry.DolName = line;
}
else if(counter == 2)
{
Entry.Parameter = GetNumber(line);
WDMEntries.push_back(Entry);
}
else if(counter == 3)
{
//This is actually the place where submenus are described
//But we skip it because its never used
counter = 0;
continue;
}
counter++;
}
fclose(file);
}

View File

@ -0,0 +1,30 @@
#ifndef WDMFILE_HPP_
#define WDMFILE_HPP_
#include <stdio.h>
#include <gctypes.h>
#include <string>
#include <vector>
using namespace std;
class WDMFile
{
public:
WDMFile(const char * filepath);
const char * GetDolName(int pos) const { if(pos >= 0 && pos < (int) WDMEntries.size()) return WDMEntries[pos].DolName.c_str(); else return NULL; };
const char * GetReplaceName(int pos) const { if(pos >= 0 && pos < (int) WDMEntries.size()) return WDMEntries[pos].ReplaceName.c_str(); else return NULL; };
int GetParameter(int pos) const { if(pos >= 0 && pos < (int) WDMEntries.size()) return WDMEntries[pos].Parameter; else return 0; };
int size() const { return WDMEntries.size(); };
private:
struct WDMEntry
{
string DolName;
string ReplaceName;
int Parameter;
};
vector<WDMEntry> WDMEntries;
};
#endif

View File

@ -130,7 +130,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
if (dolbuffer) free(dolbuffer);
}
else if (alternatedol == 1)
else if ((alternatedol == 1 || alternatedol == 3) && alternatedoloffset != 0)
{
wip_reset_counter();
FST_ENTRY *fst = (FST_ENTRY *) *(u32 *) 0x80000038;

View File

@ -269,7 +269,7 @@ s32 Disc_IsWii(void)
return 0;
}
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat)
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat, u32 dolparameter)
{
/* Set an appropiate video mode */
__Disc_SetVMode(videoselected);
@ -290,6 +290,9 @@ s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat)
__IOS_ShutdownSubsystems();
__exception_closeall();
/* Originally from tueidj - taken from NeoGamme (thx) */
*(vu32*)0xCC003024 = dolparameter != 0 ? dolparameter : 1;
if (enablecheat)
{
__asm__(

View File

@ -53,7 +53,7 @@ extern "C"
s32 __Disc_FindPartition(u64 *outbuf);
void PatchCountryStrings(void *Address, int Size);
s32 __Disc_FindPartition(u64 *outbuf);
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat);
s32 Disc_JumpToEntrypoint(u8 videoselected, bool enablecheat, u32 dolparameter);
#ifdef __cplusplus
}

View File

@ -164,7 +164,7 @@ s32 WBFS_ReIDGame(u8 *discid, const void *newID)
return retval;
}
f32 WBFS_EstimeGameSize(void)
u64 WBFS_EstimeGameSize(void)
{
return current->EstimateGameSize();
}

View File

@ -35,7 +35,7 @@ extern "C"
s32 WBFS_DiskSpace(f32 *, f32 *);
s32 WBFS_RenameGame(u8 *, const void *);
s32 WBFS_ReIDGame(u8 *discid, const void *newID);
f32 WBFS_EstimeGameSize(void);
u64 WBFS_EstimeGameSize(void);
int WBFS_GetFragList(u8 *id);

View File

@ -61,7 +61,6 @@ s32 Wbfs::Init(u32 device)
/* Device info */
nb_sectors = 0;
sector_size = SDHC_SECTOR_SIZE;
}
else return -1;
break;

View File

@ -34,7 +34,7 @@ class Wbfs
virtual s32 DiskSpace(f32 *, f32 *) = 0;
virtual s32 RenameGame(u8 *, const void *) = 0;
virtual s32 ReIDGame(u8 *discid, const void *newID) = 0;
virtual f32 EstimateGameSize(void) = 0;
virtual u64 EstimateGameSize(void) = 0;
protected:
static u32 nb_sectors;
wbfs_t *hdd;

View File

@ -318,7 +318,7 @@ s32 Wbfs_Fat::ReIDGame(u8 *discid, const void *newID)
return ret;
}
f32 Wbfs_Fat::EstimateGameSize()
u64 Wbfs_Fat::EstimateGameSize()
{
wbfs_t *part = NULL;
u64 size = (u64) 143432 * 2 * 0x8000ULL;
@ -332,7 +332,12 @@ f32 Wbfs_Fat::EstimateGameSize()
wii_sec_sz = part->wii_sec_sz;
partition_selector_t part_sel = (partition_selector_t) Settings.InstallPartitions;
return wbfs_estimate_disc(part, __ReadDVD, NULL, part_sel);
u64 estimated_size = wbfs_estimate_disc(part, __ReadDVD, NULL, part_sel);
wbfs_close(part);
return estimated_size;
}
// TITLE [GAMEID]

View File

@ -29,7 +29,7 @@ class Wbfs_Fat: public Wbfs
s32 RenameGame(u8 *, const void *);
s32 ReIDGame(u8 *, const void *);
f32 EstimateGameSize();
u64 EstimateGameSize();
int GetFragList(u8 *);
virtual bool ShowFreeSpace(void);

View File

@ -10,15 +10,11 @@
/* Constants */
#define MAX_NB_SECTORS 32
u32 sector_size = 512;
rw_sector_callback_t readCallback = NULL;
rw_sector_callback_t writeCallback = NULL;
const DISC_INTERFACE * currentHandle = NULL;
void SetSectorSize(u32 size)
{
sector_size = size;
}
static const u32 sector_size = 512;
s32 __ReadDVD(void *fp, u32 lba, u32 len, void *iobuf)
{

View File

@ -8,7 +8,6 @@ extern "C"
#include "libs/libwbfs/libwbfs.h"
extern u32 sector_size;
extern rw_sector_callback_t readCallback;
extern rw_sector_callback_t writeCallback;
extern const DISC_INTERFACE * currentHandle;

View File

@ -4,24 +4,31 @@
#include "usbloader/wbfs.h"
#include "wbfs_rw.h"
extern u32 sector_size;
extern int wbfs_part_fs;
s32 Wbfs_Wbfs::Open()
{
wbfs_t *part = NULL;
u8 buffer[512];
memset(buffer, 0, sizeof(buffer));
wbfs_head_t *head = (wbfs_head_t *) buffer;
if(readCallback(NULL, lba, 1, buffer) < 0)
return -1;
if (head->magic != wbfs_htonl(WBFS_MAGIC))
return -1;
/* Open partition */
part = wbfs_open_partition(readCallback, writeCallback, NULL, sector_size, size, lba, 0);
part = wbfs_open_partition(readCallback, writeCallback, NULL, 512, head->n_hd_sec, lba, 0);
if (!part) return -1;
/* Close current hard disk */
Close();
hdd = part;
// Save the new sector size, so it will be used in read and write calls
sector_size = 1 << hdd->head->hd_sec_sz_s;
wbfs_part_fs = PART_FS_WBFS;
return 0;
@ -61,7 +68,7 @@ s32 Wbfs_Wbfs::Format()
wbfs_t *partition = NULL;
/* Reset partition */
partition = wbfs_open_partition(readCallback, writeCallback, NULL, sector_size, size, lba, 1);
partition = wbfs_open_partition(readCallback, writeCallback, NULL, 512, size, lba, 1);
if (!partition) return -1;
/* Free memory */
@ -176,7 +183,7 @@ s32 Wbfs_Wbfs::ReIDGame(u8 *discid, const void *newID)
return 0;
}
f32 Wbfs_Wbfs::EstimateGameSize()
u64 Wbfs_Wbfs::EstimateGameSize()
{
partition_selector_t part_sel = (partition_selector_t) Settings.InstallPartitions;
return wbfs_estimate_disc(hdd, __ReadDVD, NULL, part_sel);

View File

@ -29,7 +29,7 @@ class Wbfs_Wbfs: public Wbfs
s32 RenameGame(u8 *, const void *);
s32 ReIDGame(u8 *, const void *);
f32 EstimateGameSize();
u64 EstimateGameSize();
int GetFragList(u8 *id);
};