The mload/ehcmodule update is now complete, thanks to dimok. You need to update Hermes cIOS 222/223 to v4 if you use it because it works the same as in uloader, only v4 is supported.

You may have to delete your main configuration file before updating if you had v3 installed. For some games, you will have to use 222 instead of 223 (RB instruments, GH 5) if you had 222 v3.
If you think you need an external ehcmodule.elf, you can put it in SD:/apps/usbloader_gx/ and it will be loaded.

Fixed crash when setting a custom path using the folder button (issue 864).
Fixed black screen when starting the loader from HBC a long time after powering the Wii and the HDD went to sleep (tested on a WD 2,5") (possible fix for issue 881).
This commit is contained in:
lustar.mii 2009-09-30 03:57:15 +00:00
parent 2b47c635ed
commit b83a379014
9 changed files with 1338 additions and 766 deletions

File diff suppressed because one or more lines are too long

View File

@ -71,7 +71,9 @@ static void BootUpProblems()
ret2 = IOS_ReloadIOS(249);
if (ret2 < 0) {
ret2 = IOS_ReloadIOS(222);
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret2 <0) {
boottext.SetText("ERROR: cIOS could not be loaded!");
bootimage.Draw();
@ -135,11 +137,15 @@ main(int argc, char *argv[]) {
/** PAD_Init has to be before InitVideo don't move that **/
PAD_Init(); // initialize PAD/WPAD
USBDevice_deInit();// seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
ret = IOS_ReloadIOS(249);
if (ret < 0) {
ret = IOS_ReloadIOS(222);
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret <0) {
printf("\n\tERROR: cIOS could not be loaded!\n");
sleep(5);
@ -151,8 +157,9 @@ main(int argc, char *argv[]) {
if (ret < 0) {
ret = IOS_ReloadIOS(222);
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret < 0) {
InitVideo(); // Initialise video
Menu_Render();
@ -192,8 +199,10 @@ main(int argc, char *argv[]) {
SDCard_deInit();// unmount SD for reloading IOS
USBDevice_deInit();// unmount USB for reloading IOS
ret = IOS_ReloadIOS(222);
SDCard_Init();
load_ehc_module();
if (ret < 0) {
SDCard_deInit();
Settings.cios = ios249;
ret = IOS_ReloadIOS(249);
}
@ -206,6 +215,7 @@ main(int argc, char *argv[]) {
if (ret < 0) {
Settings.cios = ios222;
ret = IOS_ReloadIOS(222);
SDCard_Init();
load_ehc_module();
}
SDCard_Init(); // now mount SD:/

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
#define size_ehcmodule 18412
#define size_ehcmodule 32432
extern unsigned char ehcmodule[18412];
extern unsigned char ehcmodule[32432];

View File

@ -17,14 +17,18 @@
#include "mload.h"
#include "ehcmodule.h"
//#include "ehcmodule_elf.h"
#include "dip_plugin.h"
#include <malloc.h>
static const char mload_fs[] ATTRIBUTE_ALIGN(32) = "/dev/mload";
static u32 patch_datas[8] ATTRIBUTE_ALIGN(32);
static s32 mload_fd = -1;
static s32 hid = -1;
static data_elf my_data_elf;
static int thread_id = -1;
void *external_ehcmodule= NULL;
int size_external_ehcmodule=0;
/*--------------------------------------------------------------------------------------------------------------*/
@ -513,14 +517,52 @@ static u32 ios_38[16] ATTRIBUTE_ALIGN(32)=
int load_ehc_module()
{
int is_ios=0;
if (mload_module(ehcmodule, size_ehcmodule)<0) return -1;
/*
if (mload_init() >= 0) {
data_elf my_data_elf;
mload_elf((void *) ehcmodule_elf, &my_data_elf);
mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, 0x47);
FILE *fp;
if(!external_ehcmodule)
{
fp=fopen("SD:/apps/usbloader_gx/ehcmodule.elf","rb");
if(fp==NULL)
fp=fopen("SD:/apps/usbloadergx/ehcmodule.elf","rb");
if(fp!=NULL)
{
fseek(fp, 0, SEEK_END);
size_external_ehcmodule = ftell(fp);
external_ehcmodule = memalign(32, size_external_ehcmodule);
if(!external_ehcmodule)
{fclose(fp);}
else
{
fseek(fp, 0, SEEK_SET);
if(fread(external_ehcmodule,1, size_external_ehcmodule ,fp)!=size_external_ehcmodule)
{free(external_ehcmodule); external_ehcmodule=NULL;}
fclose(fp);
}
*/
}
}
if(!external_ehcmodule)
{
if(mload_init()<0) return -1;
mload_elf((void *) ehcmodule, &my_data_elf);
thread_id = mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
if(thread_id < 0) return -1;
}
else
{
if(mload_init()<0) return -1;
mload_elf((void *) external_ehcmodule, &my_data_elf);
thread_id = mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
if(thread_id<0) return -1;
}
usleep(350*1000);
// Test for IOS
mload_seek(0x20207c84, SEEK_SET);
mload_read(patch_datas, 4);

View File

@ -414,18 +414,28 @@ main:
mainWindow->Remove(&w);
ResumeGui();
char newfolder[100];
char oldfolder[100];
sprintf(newfolder,"%s/",var);
strcpy(oldfolder,newfolder);
int result = OnScreenKeyboard(newfolder,100,0);
if ( result == 1 ) {
int len = (strlen(newfolder)-1);
if (newfolder[len] !='/')
strncat (newfolder, "/", 1);
char* pos = newfolder;
char root[6];
sprintf(root,"%s/",browser.rootdir);
if (len > 0 && strcmp(oldfolder,newfolder)!=0 && strstr(newfolder,root) == pos && strstr(newfolder,"//") == NULL) {
struct stat st;
if (stat(newfolder, &st) != 0) {
if (subfoldercreate(newfolder) != 1) {
WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
break;
}
} else {
break;
}
}
}

View File

@ -474,11 +474,11 @@ int MenuSettings() {
options2.SetName(4, "%s",tr("Flip-X"));
options2.SetName(5, "%s",tr("Prompts Buttons"));
options2.SetName(6, "%s",tr("Keyboard"));
options2.SetName(7, "%s",tr("Discimages Download"));
options2.SetName(7, "%s",tr("Disc Artwork Download"));
options2.SetName(8, "%s",tr("Wiilight"));
options2.SetName(9, "%s",tr("Rumble"));
options2.SetName(10, "%s",tr("AutoInit Network"));
options2.SetName(11, "%s",tr("Titles from XML"));
options2.SetName(11, "%s",tr("Titles from WiiTDB"));
options2.SetName(12, "%s",tr("Screensaver"));
for (int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
optionBrowser2.SetScrollbar(1);
@ -1177,12 +1177,12 @@ int MenuSettings() {
// if (Settings.godmode)
options2.SetName(0, "%s", tr("3D Cover Path"));
options2.SetName(1, "%s", tr("2D Cover Path"));
options2.SetName(2, "%s", tr("Discimage Path"));
options2.SetName(3, "%s", tr("ThemePath"));
options2.SetName(4, "%s", tr("XMLPath"));
options2.SetName(5, "%s", tr("Updatepath"));
options2.SetName(6, "%s", tr("Cheatcodes Path"));
options2.SetName(7, "%s", tr("TXTCheatcodes Path"));
options2.SetName(2, "%s", tr("Disc Artwork Path"));
options2.SetName(3, "%s", tr("Theme Path"));
options2.SetName(4, "%s", tr("WiiTDB Path"));
options2.SetName(5, "%s", tr("Update Path"));
options2.SetName(6, "%s", tr("GCT Cheatcodes Path"));
options2.SetName(7, "%s", tr("TXT Cheatcodes Path"));
options2.SetName(8, "%s", tr("Dol Path"));
options2.SetName(9, "%s", tr("Homebrew Apps Path"));
for (int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL);
@ -1255,7 +1255,6 @@ int MenuSettings() {
strlcpy(entered, Settings.covers_path, sizeof(entered));
titleTxt.SetText(tr("3D Cover Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1264,14 +1263,14 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.covers_path, entered, sizeof(Settings.covers_path));
WindowPrompt(tr("Coverpath Changed"),0,tr("OK"));
WindowPrompt(tr("Cover Path Changed"),0,tr("OK"));
// if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
}
} else {
WindowPrompt(tr("Coverpath Change"),tr("Console should be unlocked to modify it."),tr("OK"));
WindowPrompt(tr("Cover Path Change"),tr("Console should be unlocked to modify it."),tr("OK"));
}
break;
case 1:
@ -1291,14 +1290,14 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.covers2d_path, entered, sizeof(Settings.covers2d_path));
WindowPrompt(tr("Coverpath Changed"),0,tr("OK"));
WindowPrompt(tr("Cover Path Changed"),0,tr("OK"));
// if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
}
} else {
WindowPrompt(tr("Coverpath Change"),tr("Console should be unlocked to modify it."),tr("OK"));
WindowPrompt(tr("Cover Path Change"),tr("Console should be unlocked to modify it."),tr("OK"));
}
break;
case 2:
@ -1307,9 +1306,8 @@ int MenuSettings() {
w.Remove(&backBtn);
char entered[43] = "";
strlcpy(entered, Settings.disc_path, sizeof(entered));
titleTxt.SetText(tr("Discimage Path"));
titleTxt.SetText(tr("Disc Artwork Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered, 43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1318,14 +1316,14 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.disc_path, entered, sizeof(Settings.disc_path));
WindowPrompt(tr("Discpath Changed"),0,tr("OK"));
WindowPrompt(tr("Disc Path Changed"),0,tr("OK"));
// if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
}
} else {
WindowPrompt(tr("Discpath change"),tr("Console should be unlocked to modify it."),tr("OK"));
WindowPrompt(tr("Disc Path change"),tr("Console should be unlocked to modify it."),tr("OK"));
}
break;
case 3:
@ -1333,10 +1331,9 @@ int MenuSettings() {
w.Remove(&optionBrowser2);
w.Remove(&backBtn);
char entered[43] = "";
titleTxt.SetText(tr("ThemePath"));
titleTxt.SetText(tr("Theme Path"));
strlcpy(entered, CFG.theme_path, sizeof(entered));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered, 43,0);
HaltGui();
w.RemoveAll();
if ( result == 1 ) {
@ -1344,7 +1341,7 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
WindowPrompt(tr("Themepath Changed"),0,tr("OK"));
WindowPrompt(tr("Theme Path Changed"),0,tr("OK"));
// if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
@ -1383,7 +1380,7 @@ int MenuSettings() {
w.Append(&optionBrowser2);
ResumeGui();
} else {
WindowPrompt(tr("Themepath change"),tr("Console should be unlocked to modify it."),tr("OK"));
WindowPrompt(tr("Theme Path change"),tr("Console should be unlocked to modify it."),tr("OK"));
}
break;
case 4:
@ -1391,10 +1388,9 @@ int MenuSettings() {
w.Remove(&optionBrowser2);
w.Remove(&backBtn);
char entered[43] = "";
titleTxt.SetText(tr("XMLPath"));
titleTxt.SetText(tr("WiiTDB Path"));
strlcpy(entered, Settings.titlestxt_path, sizeof(entered));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
w.Append(&optionBrowser2);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&backBtn);
@ -1403,7 +1399,7 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.titlestxt_path, entered, sizeof(Settings.titlestxt_path));
WindowPrompt(tr("XMLPath changed."),0,tr("OK"));
WindowPrompt(tr("WiiTDB Path changed."),0,tr("OK"));
// if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
@ -1415,7 +1411,7 @@ int MenuSettings() {
}
}
} else {
WindowPrompt(tr("XMLPath change"),tr("Console should be unlocked to modify it."),tr("OK"));
WindowPrompt(tr("WiiTDB Path change"),tr("Console should be unlocked to modify it."),tr("OK"));
}
break;
case 5:
@ -1426,7 +1422,6 @@ int MenuSettings() {
strlcpy(entered, Settings.update_path, sizeof(entered));
titleTxt.SetText(tr("Updatepath"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1446,9 +1441,8 @@ int MenuSettings() {
w.Remove(&backBtn);
char entered[43] = "";
strlcpy(entered, Settings.Cheatcodespath, sizeof(entered));
titleTxt.SetText(tr("Cheatcodes Path"));
titleTxt.SetText(tr("GCT Cheatcodes Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1457,7 +1451,7 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.Cheatcodespath, entered, sizeof(Settings.Cheatcodespath));
WindowPrompt(tr("Cheatcodes Path changed"),0,tr("OK"));
WindowPrompt(tr("GCT Cheatcodes Path changed"),0,tr("OK"));
}
} else
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
@ -1468,9 +1462,8 @@ int MenuSettings() {
w.Remove(&backBtn);
char entered[43] = "";
strlcpy(entered, Settings.TxtCheatcodespath, sizeof(entered));
titleTxt.SetText(tr("TXTCheatcodes Path"));
titleTxt.SetText(tr("TXT Cheatcodes Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1479,7 +1472,7 @@ int MenuSettings() {
if (entered[len] !='/')
strncat (entered, "/", 1);
strlcpy(Settings.TxtCheatcodespath, entered, sizeof(Settings.TxtCheatcodespath));
WindowPrompt(tr("TXTCheatcodes Path changed"),0,tr("OK"));
WindowPrompt(tr("TXT Cheatcodes Path changed"),0,tr("OK"));
}
} else
WindowPrompt(0,tr("Console should be unlocked to modify it."),tr("OK"));
@ -1492,7 +1485,6 @@ int MenuSettings() {
strlcpy(entered, Settings.dolpath, sizeof(entered));
titleTxt.SetText(tr("Dol Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -1519,7 +1511,6 @@ int MenuSettings() {
strlcpy(entered, Settings.homebrewapps_path, sizeof(entered));
titleTxt.SetText(tr("Homebrew Apps Path"));
int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered,43,0);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&optionBrowser2);
w.Append(&backBtn);
@ -2319,9 +2310,9 @@ int GameSettings(struct discHdr * header) {
for (int i = 0; i <= MAXOPTIONS-1; i++) options2.SetName(i, NULL);
options2.SetName(0,"%s", tr("Uninstall Game"));
options2.SetName(1,"%s", tr("Reset Playcounter"));
options2.SetName(2,"%s", tr("Delete Boxart"));
options2.SetName(3,"%s", tr("Delete Discart"));
options2.SetName(4,"%s", tr("Delete CheatTxt"));
options2.SetName(2,"%s", tr("Delete Cover Artwork"));
options2.SetName(3,"%s", tr("Delete Disc Artwork"));
options2.SetName(4,"%s", tr("Delete Cheat TXT"));
options2.SetName(5,"%s", tr("Delete Cheat GCT"));
for (int i = 0; i <= MAXOPTIONS-1; i++) options2.SetValue(i, NULL);
w.Append(&optionBrowser2);

View File

@ -344,7 +344,7 @@ void Global_Default(void) {
Settings.patchcountrystrings = 0;
Settings.gridRows = 3;
Settings.error002 = 0;
Settings.titlesOverride = 0;
Settings.titlesOverride = 1;
snprintf(Settings.db_url, sizeof(Settings.db_url), empty);
snprintf(Settings.db_language, sizeof(Settings.db_language), empty);
Settings.db_JPtoEN = 0;
@ -1563,7 +1563,7 @@ bool cfg_load_global() {
Settings.volume = 80;
Settings.sfxvolume = 80;
Settings.titlesOverride = 0;
Settings.titlesOverride = 1;
char * empty = "";
snprintf(Settings.db_url, sizeof(Settings.db_url), empty);
snprintf(Settings.db_language, sizeof(Settings.db_language), empty);

View File

@ -42,14 +42,17 @@ distribution.
#define USB_IOCTL_UMS_UNMOUNT (UMS_BASE+0x10)
#define USB_IOCTL_UMS_WATCHDOG (UMS_BASE+0x80)
#define UMS_HEAPSIZE 0x10000
#define UMS_HEAPSIZE 0x1000
/* Variables */
static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb/ehc";
static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2";
static char fs2[] ATTRIBUTE_ALIGN(32) = "/dev/usb/ehc";
static s32 hid = -1, fd = -1;
static u32 sector_size;
extern void* SYS_AllocArena2MemLo(u32 size,u32 align);
static void *mem2_ptr=NULL;
inline s32 __USBStorage_isMEM2Buffer(const void *buffer) {
u32 high_addr = ((u32)buffer) >> 24;
@ -89,6 +92,8 @@ s32 USBStorage_Init(void) {
/* Open USB device */
fd = IOS_Open(fs, 0);
if (fd < 0)
fd = IOS_Open(fs2, 0);
if (fd < 0)
return fd;
@ -145,6 +150,7 @@ void USBStorage_Deinit(void) {
}
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
void *buf = (void *)buffer;
u32 len = (sector_size * numSectors);
@ -153,11 +159,11 @@ s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
/* Device not opened */
if (fd < 0)
return fd;
if(!mem2_ptr) mem2_ptr=SYS_AllocArena2MemLo(2048*256,32);
/* MEM1 buffer */
if (!__USBStorage_isMEM2Buffer(buffer)) {
/* Allocate memory */
buf = iosAlloc(hid, len);
buf = mem2_ptr; //iosAlloc(hid, len);
if (!buf)
return IPC_ENOMEM;
}
@ -168,13 +174,14 @@ s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
/* Copy data */
if (buf != buffer) {
memcpy(buffer, buf, len);
iosFree(hid, buf);
//iosFree(hid, buf);
}
return ret;
}
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) {
void *buf = (void *)buffer;
u32 len = (sector_size * numSectors);
@ -183,11 +190,13 @@ s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) {
/* Device not opened */
if (fd < 0)
return fd;
if(!mem2_ptr) mem2_ptr = SYS_AllocArena2MemLo(2048*256,32);
/* MEM1 buffer */
if (!__USBStorage_isMEM2Buffer(buffer)) {
/* Allocate memory */
buf = iosAlloc(hid, len);
buf = mem2_ptr; //buf = iosAlloc(hid, len);
if (!buf)
return IPC_ENOMEM;