mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 02:11:55 +01:00
*Added use of IOS58 for Loader option. It is enabled by default and can be disabled in the Loader Settings. If it is disabled the Boot/Standard cIOS is loaded on startup, after reading the config files.
WARNING: If you select to use IOS58 and you don't have IOS58 installed, the loader will be really really slow. *Fixed reseting of Theme/Fonts when pressing the SD Card button. It is now reloading it instead.
This commit is contained in:
parent
4b3120fccf
commit
3503f114ed
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>2.0 r1040</version>
|
||||
<release_date>201101091911</release_date>
|
||||
<version>2.0 r1041</version>
|
||||
<release_date>201101111755</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.
|
||||
|
@ -133,14 +133,24 @@ bool DeviceHandler::MountSD()
|
||||
return sd->Mount(0, DeviceName[SD], true);
|
||||
}
|
||||
|
||||
const DISC_INTERFACE * DeviceHandler::GetUSBInterface()
|
||||
{
|
||||
if(IOS_GetVersion() < 200)
|
||||
return &__io_usbstorage;
|
||||
|
||||
return &__io_usbstorage2;
|
||||
}
|
||||
|
||||
static inline bool USBSpinUp()
|
||||
{
|
||||
bool started = false;
|
||||
int retries = 400;
|
||||
|
||||
const DISC_INTERFACE * handle = DeviceHandler::GetUSBInterface();
|
||||
// wait 20 sec for the USB to spin up...stupid slow ass HDD
|
||||
do
|
||||
{
|
||||
started = (__io_usbstorage2.startup() && __io_usbstorage2.isInserted());
|
||||
started = (handle->startup() && handle->isInserted());
|
||||
if(started) break;
|
||||
usleep(50000);
|
||||
}
|
||||
@ -155,7 +165,7 @@ bool DeviceHandler::MountUSB(int pos, bool spinup)
|
||||
return false;
|
||||
|
||||
if(!usb)
|
||||
usb = new PartitionHandle(&__io_usbstorage2);
|
||||
usb = new PartitionHandle(GetUSBInterface());
|
||||
|
||||
if(usb->GetPartitionCount() < 1)
|
||||
{
|
||||
@ -176,7 +186,7 @@ bool DeviceHandler::MountAllUSB(bool spinup)
|
||||
return false;
|
||||
|
||||
if(!usb)
|
||||
usb = new PartitionHandle(&__io_usbstorage2);
|
||||
usb = new PartitionHandle(GetUSBInterface());
|
||||
|
||||
bool result = false;
|
||||
|
||||
|
@ -76,12 +76,13 @@ class DeviceHandler
|
||||
void UnMountSD() { if(sd) delete sd; sd = NULL; };
|
||||
void UnMountUSB(int pos);
|
||||
void UnMountAllUSB();
|
||||
PartitionHandle * GetSDHandle() { return sd; };
|
||||
PartitionHandle * GetUSBHandle() { return usb; };
|
||||
PartitionHandle * GetSDHandle() const { return sd; };
|
||||
PartitionHandle * GetUSBHandle() const { return usb; };
|
||||
static int GetUSBFilesystemType(int part);
|
||||
static int PathToDriveType(const char * path);
|
||||
static const char * GetFSName(int dev);
|
||||
static const char * PathToFSName(const char * path) { return GetFSName(PathToDriveType(path)); };
|
||||
static const DISC_INTERFACE * GetUSBInterface();
|
||||
private:
|
||||
DeviceHandler() : sd(0), usb(0) { };
|
||||
~DeviceHandler();
|
||||
|
@ -67,7 +67,7 @@ FreeTypeGX::FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize)
|
||||
FT_New_Memory_Face(ftLibrary, (FT_Byte *) fontBuffer, bufferSize, 0, &ftFace);
|
||||
|
||||
setVertexFormat(GX_VTXFMT1);
|
||||
ftKerningEnabled = FT_HAS_KERNING( ftFace );
|
||||
ftKerningEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,6 +329,7 @@ int16_t FreeTypeGX::getStyleOffsetHeight(int16_t format, uint16_t pixelSize)
|
||||
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
|
||||
* @return The number of characters printed.
|
||||
*/
|
||||
|
||||
uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, GXColor color,
|
||||
uint16_t textStyle, uint16_t textWidth, uint16_t widthLimit)
|
||||
{
|
||||
|
@ -106,6 +106,9 @@ int BootGame(const char * gameID)
|
||||
|
||||
delete dvdheader;
|
||||
dvdheader = NULL;
|
||||
|
||||
gameList.clear();
|
||||
|
||||
int ret = 0;
|
||||
|
||||
u8 videoChoice = Settings.videomode;
|
||||
|
@ -91,15 +91,16 @@ bool StartUpProcess::USBSpinUp()
|
||||
{
|
||||
bool started = false;
|
||||
int retries = 400;
|
||||
const DISC_INTERFACE * handle = DeviceHandler::GetUSBInterface();
|
||||
// wait 10 sec for the USB to spin up...stupid slow ass HDD
|
||||
do
|
||||
{
|
||||
started = (__io_usbstorage2.startup() && __io_usbstorage2.isInserted());
|
||||
started = (handle->startup() && handle->isInserted());
|
||||
usleep(50000);
|
||||
|
||||
if(retries < 400 && retries % 20 == 0)
|
||||
{
|
||||
messageTxt->SetTextf("Waiting for slow HDD: %i sec left\n", retries/20);
|
||||
messageTxt->SetTextf("Waiting for HDD: %i sec left\n", retries/20);
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
@ -117,23 +118,6 @@ bool StartUpProcess::Run()
|
||||
|
||||
bool StartUpProcess::Execute()
|
||||
{
|
||||
//! Now we startup the GUI so no need for console prints. Output only to gecko.
|
||||
USBGeckoOutput();
|
||||
|
||||
// Let's try loading some cIOS
|
||||
if (IosLoader::LoadAppCios() < 0)
|
||||
{
|
||||
titleTxt->SetText("WARNING!");
|
||||
messageTxt->SetMaxWidth(400, WRAP);
|
||||
messageTxt->SetText("USB Loader GX needs unstubbed cIOS 222 v4+ or 249 v9+. \
|
||||
We cannot determine the versions on your system, since you have no patched ios 36 or 236 installed. \
|
||||
Therefor, if loading of USB Loader GX fails, you probably have installed the 4.2 update, \
|
||||
and you should go figure out how to get some cios action going on\n\tin your Wii. \
|
||||
ERROR: No cIOS could be loaded. Exiting....");
|
||||
sleep(10);
|
||||
Sys_BackToLoader();
|
||||
}
|
||||
|
||||
SetTextf("Initialize sd card\n");
|
||||
DeviceHandler::Instance()->MountSD();
|
||||
|
||||
@ -147,21 +131,21 @@ bool StartUpProcess::Execute()
|
||||
gprintf("\tLoading game settings...%s\n", GameSettings.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
gprintf("\tLoading game statistics...%s\n", GameStatistics.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
|
||||
if(Settings.cios != IOS_GetVersion())
|
||||
if(!Settings.UseIOS58 && Settings.cios != IOS_GetVersion())
|
||||
{
|
||||
SetTextf("Loading cIOS %i\n", Settings.cios);
|
||||
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
DeviceHandler::DestroyInstance();
|
||||
|
||||
// Loading now the cios setup in the settings
|
||||
IosLoader::LoadAppCios();
|
||||
|
||||
SetTextf("Loaded cIOS %i R%i\n", IOS_GetVersion(), IOS_GetRevision());
|
||||
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
DeviceHandler::Instance()->MountSD();
|
||||
USBSpinUp();
|
||||
DeviceHandler::Instance()->MountAllUSB(false);
|
||||
}
|
||||
else
|
||||
SetTextf("Loaded cIOS %i R%i\n", IOS_GetVersion(), IOS_GetRevision());
|
||||
|
||||
gprintf("\tLoading font...%s\n", Theme::LoadFont(Settings.theme_path) ? "done" : "failed (using default)");
|
||||
gprintf("\tLoading theme...%s\n", Theme::Load(Settings.theme) ? "done" : "failed (using default)");
|
||||
|
@ -20,9 +20,7 @@ void gprintf(const char *format, ...)
|
||||
va_start(va, format);
|
||||
if((vasprintf(&tmp, format, va) >= 0) && tmp)
|
||||
{
|
||||
u32 level = IRQ_Disable();
|
||||
usb_sendbuffer(1, tmp, strlen(tmp));
|
||||
IRQ_Restore(level);
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
@ -36,11 +34,11 @@ bool InitGecko()
|
||||
if (geckoattached)
|
||||
{
|
||||
usb_flush(EXI_CHANNEL_1);
|
||||
CON_EnableGecko(1, false);
|
||||
geckoinit = true;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
char ascii(char s)
|
||||
@ -79,12 +77,7 @@ void hexdump(void *d, int len)
|
||||
static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||
{
|
||||
if(geckoinit && ptr)
|
||||
{
|
||||
u32 level;
|
||||
level = IRQ_Disable();
|
||||
usb_sendbuffer(1, ptr, len);
|
||||
IRQ_Restore(level);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -402,8 +402,7 @@ void GuiText::ScrollText()
|
||||
{
|
||||
textDyn[pos][i] = text[i];
|
||||
|
||||
currentWidth
|
||||
+= (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0x0000);
|
||||
currentWidth += (font ? font : fontSystem)->getCharWidth(text[i], currentSize, i > 0 ? text[i - 1] : 0x0000);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
@ -39,22 +39,6 @@ extern "C"
|
||||
|
||||
static int QuickGameBoot(const char * gameID)
|
||||
{
|
||||
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
||||
//its not really a headless mode. more like hairless.
|
||||
if (IosLoader::LoadAppCios() < 0)
|
||||
{
|
||||
printf("\n\tWARNING!\n");
|
||||
printf("\tUSB Loader GX needs unstubbed cIOS 222 v4+ or 249 v9+\n\n");
|
||||
|
||||
printf("\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.\n");
|
||||
printf("\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,\n");
|
||||
printf("\tand you should go figure out how to get some cios action going on\n\tin your Wii.\n");
|
||||
|
||||
printf("\tERROR: No cIOS could be loaded. Exiting....\n");
|
||||
sleep(10);
|
||||
Sys_BackToLoader();
|
||||
}
|
||||
|
||||
DeviceHandler::Instance()->MountAll();
|
||||
Settings.Load();
|
||||
|
||||
@ -64,10 +48,14 @@ static int QuickGameBoot(const char * gameID)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(IOS_GetVersion() != 58)
|
||||
IOS_ReloadIOS(58);
|
||||
|
||||
MEM2_init(48);
|
||||
__exception_setreload(20);
|
||||
InitVideo();
|
||||
InitGecko();
|
||||
USBGeckoOutput();
|
||||
NandTitles.Get();
|
||||
setlocale(LC_ALL, "en.UTF-8");
|
||||
|
||||
|
@ -793,7 +793,12 @@ int GameBrowseMenu::MainLoop()
|
||||
bgMusic->Pause();
|
||||
Settings.Save();
|
||||
DeviceHandler::Instance()->MountSD();
|
||||
Settings.Load();
|
||||
gprintf("\tLoading config...%s\n", Settings.Load() ? "done" : "failed");
|
||||
gprintf("\tLoading language...%s\n", Settings.LoadLanguage(Settings.language_path, CONSOLE_DEFAULT) ? "done" : "failed");
|
||||
gprintf("\tLoading game settings...%s\n", GameSettings.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
gprintf("\tLoading game statistics...%s\n", GameStatistics.Load(Settings.ConfigPath) ? "done" : "failed");
|
||||
gprintf("\tLoading font...%s\n", Theme::LoadFont(Settings.theme_path) ? "done" : "failed (using default)");
|
||||
gprintf("\tLoading theme...%s\n", Theme::Load(Settings.theme) ? "done" : "failed (using default)");
|
||||
bgMusic->Resume();
|
||||
wString oldFilter(gameList.GetCurrentFilter());
|
||||
gameList.FilterList(oldFilter.c_str());
|
||||
|
@ -112,9 +112,8 @@ void CSettings::SetDefault()
|
||||
InstallPartitions = ONLY_GAME_PARTITION;
|
||||
beta_upgrades = 0;
|
||||
PlaylogUpdate = 1;
|
||||
UseIOS58 = 1;
|
||||
widescreen = (CONF_GetAspectRatio() == CONF_ASPECT_16_9);
|
||||
|
||||
Theme::SetDefault(); //! We need to move this later
|
||||
}
|
||||
|
||||
bool CSettings::Load()
|
||||
@ -252,6 +251,7 @@ bool CSettings::Save()
|
||||
fprintf(file, "InstallPartitions = %08X\n ", InstallPartitions);
|
||||
fprintf(file, "beta_upgrades = %d\n ", beta_upgrades);
|
||||
fprintf(file, "PlaylogUpdate = %d\n ", PlaylogUpdate);
|
||||
fprintf(file, "UseIOS58 = %d\n ", UseIOS58);
|
||||
fprintf(file, "returnTo = %s\n ", returnTo);
|
||||
fclose(file);
|
||||
|
||||
@ -495,6 +495,11 @@ bool CSettings::SetSetting(char *name, char *value)
|
||||
if (sscanf(value, "%d", &i) == 1) PlaylogUpdate = i;
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(name, "UseIOS58") == 0)
|
||||
{
|
||||
if (sscanf(value, "%d", &i) == 1) UseIOS58 = i;
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(name, "InstallPartitions") == 0)
|
||||
{
|
||||
InstallPartitions = strtoul(value, 0, 16);
|
||||
|
@ -111,6 +111,7 @@ class CSettings
|
||||
short beta_upgrades;
|
||||
short PlaylogUpdate;
|
||||
short ShowFreeSpace;
|
||||
short UseIOS58;
|
||||
char returnTo[20];
|
||||
protected:
|
||||
bool ValidVersion(FILE * file);
|
||||
|
@ -111,6 +111,7 @@ LoaderSettings::LoaderSettings()
|
||||
Options->SetName(Idx++, "%s", tr( "Game Language" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Ocarina" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Use IOS58" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Boot/Standard" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Partition" ));
|
||||
Options->SetName(Idx++, "%s", tr( "Install directories" ));
|
||||
@ -158,6 +159,12 @@ void LoaderSettings::SetOptionValues()
|
||||
//! Settings: Ocarina
|
||||
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.ocarina] ));
|
||||
|
||||
//! Settings: Use IOS58
|
||||
if (Settings.godmode)
|
||||
Options->SetValue(Idx++, "%s", tr( OnOffText[Settings.UseIOS58] ));
|
||||
else
|
||||
Options->SetValue(Idx++, "********");
|
||||
|
||||
//! Settings: Boot/Standard
|
||||
if (Settings.godmode)
|
||||
Options->SetValue(Idx++, "IOS %i", Settings.cios);
|
||||
@ -240,6 +247,15 @@ int LoaderSettings::GetMenuInternal()
|
||||
if (++Settings.ocarina >= MAX_ON_OFF) Settings.ocarina = 0;
|
||||
}
|
||||
|
||||
//! Settings: Use IOS58
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
if(!Settings.godmode)
|
||||
return MENU_NONE;
|
||||
|
||||
if (++Settings.UseIOS58 >= MAX_ON_OFF) Settings.UseIOS58 = 0;
|
||||
}
|
||||
|
||||
//! Settings: Boot/Standard
|
||||
else if (ret == ++Idx)
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Controls/DeviceHandler.hpp"
|
||||
#include "FileOperations/fileops.h"
|
||||
#include "settings/CSettings.h"
|
||||
#include "settings/GameTitles.h"
|
||||
#include "settings/newtitles.h"
|
||||
#include "language/gettext.h"
|
||||
#include "network/networkops.h"
|
||||
@ -81,12 +82,12 @@ void AppCleanUp(void)
|
||||
delete pointer[i];
|
||||
|
||||
gettextCleanUp();
|
||||
CloseXMLDatabase();
|
||||
Theme::CleanUp();
|
||||
NewTitles::DestroyInstance();
|
||||
ThreadedTask::DestroyInstance();
|
||||
SoundHandler::DestroyInstance();
|
||||
DeinitNetwork();
|
||||
GameTitles.SetDefault();
|
||||
|
||||
ShutdownAudio();
|
||||
|
||||
|
@ -91,7 +91,7 @@ s32 IosLoader::LoadGameCios(s32 ios)
|
||||
// Unmount fat before reloading IOS.
|
||||
WBFS_Close();
|
||||
WDVD_Close();
|
||||
DeviceHandler::Instance()->UnMountAll();
|
||||
DeviceHandler::DestroyInstance();
|
||||
|
||||
ret = ReloadIosSafe(ios);
|
||||
|
||||
|
@ -253,7 +253,7 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 languageChoice, u8 pa
|
||||
{
|
||||
ret = WDVD_Read(offset, len, (doloffset << 2) + pos);
|
||||
|
||||
gamepatches(offset, len, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo, fix002);
|
||||
gamepatches(offset, len, videoSelected, languageChoice, patchcountrystring, vipatch, cheat, returnTo, fix002);
|
||||
|
||||
Remove_001_Protection(offset, len);
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <ogcsys.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "Controls/DeviceHandler.hpp"
|
||||
#include "usbloader/sdhc.h"
|
||||
#include "usbloader/usbstorage2.h"
|
||||
#include "wbfs_rw.h"
|
||||
@ -31,24 +32,23 @@ void Wbfs::GetProgressValue(s32 * d, s32 * m)
|
||||
s32 Wbfs::Init(u32 device)
|
||||
{
|
||||
s32 ret;
|
||||
const DISC_INTERFACE * handle = DeviceHandler::GetUSBInterface();
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case WBFS_DEVICE_USB:
|
||||
/* Initialize USB storage */
|
||||
ret = USBStorage2_Init();
|
||||
if (ret >= 0)
|
||||
ret = handle->startup();
|
||||
if (ret)
|
||||
{
|
||||
currentHandle = handle;
|
||||
/* Setup callbacks */
|
||||
readCallback = __ReadUSB;
|
||||
writeCallback = __WriteUSB;
|
||||
/* Device info */
|
||||
/* Get USB capacity */
|
||||
nb_sectors = USBStorage2_GetCapacity(§or_size);
|
||||
if (!nb_sectors) return -1;
|
||||
}
|
||||
else return ret;
|
||||
break;
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
case WBFS_DEVICE_SDHC:
|
||||
/* Initialize SDHC */
|
||||
ret = SDHC_Init();
|
||||
|
@ -13,6 +13,7 @@
|
||||
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)
|
||||
{
|
||||
@ -82,8 +83,8 @@ s32 __ReadUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
if (sectors > MAX_NB_SECTORS) sectors = MAX_NB_SECTORS;
|
||||
|
||||
/* USB read */
|
||||
ret = USBStorage2_ReadSectors(lba + cnt, sectors, ptr);
|
||||
if (ret < 0) return ret;
|
||||
ret = currentHandle->readSectors(lba + cnt, sectors, ptr);
|
||||
if (!ret) return -1;
|
||||
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
@ -107,8 +108,8 @@ s32 __WriteUSB(void *fp, u32 lba, u32 count, void *iobuf)
|
||||
if (sectors > MAX_NB_SECTORS) sectors = MAX_NB_SECTORS;
|
||||
|
||||
/* USB write */
|
||||
ret = USBStorage2_WriteSectors(lba + cnt, sectors, ptr);
|
||||
if (ret < 0) return ret;
|
||||
ret = currentHandle->writeSectors(lba + cnt, sectors, ptr);
|
||||
if (!ret) return -1;
|
||||
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
|
@ -11,6 +11,7 @@ extern "C"
|
||||
extern u32 sector_size;
|
||||
extern rw_sector_callback_t readCallback;
|
||||
extern rw_sector_callback_t writeCallback;
|
||||
extern const DISC_INTERFACE * currentHandle;
|
||||
|
||||
s32 __ReadDVD(void *fp, u32 lba, u32 len, void *iobuf);
|
||||
s32 __ReadUSB(void *fp, u32 lba, u32 count, void *iobuf);
|
||||
|
Loading…
Reference in New Issue
Block a user