*Lots of fixes, like Issue 1330 and Issue 1224

I can't remember which one are fixed so please check if your issue is fixed and report.
This commit is contained in:
dimok321 2010-01-07 18:20:26 +00:00
parent 3661e7c584
commit c7fc442724
4 changed files with 25 additions and 38 deletions

View File

@ -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 r887</version> <version>1.0 r889</version>
<release_date>201001070923</release_date> <release_date>201001071534</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.

View File

@ -125,6 +125,10 @@ int main(int argc, char *argv[])
MEM2_init(36); // Initialize 36 MB MEM2_init(36); // Initialize 36 MB
MEM2_takeBigOnes(true); MEM2_takeBigOnes(true);
printf("\n\tInitialize USB (wake up)");
USBDevice_Init();// seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
USBDevice_deInit();
s32 ret; s32 ret;
bool bootDevice_found=false; bool bootDevice_found=false;
@ -141,11 +145,6 @@ int main(int argc, char *argv[])
/** PAD_Init has to be before InitVideo don't move that **/ /** PAD_Init has to be before InitVideo don't move that **/
PAD_Init(); // initialize PAD/WPAD PAD_Init(); // initialize PAD/WPAD
printf("\n\tInitialize USB (wake up)");
USBDevice_Init();// seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
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 = CheckForCIOS(); ret = CheckForCIOS();
printf("\n\tInitialize sd card"); printf("\n\tInitialize sd card");
@ -166,18 +165,6 @@ int main(int argc, char *argv[])
printf("\n\tConfiguration file is on %s", bootDevice); printf("\n\tConfiguration file is on %s", bootDevice);
} }
// Try opening and closing the configuration file here
// to prevent a crash dump later on - giantpune
// how the fuck is this supposed to help? - dimok
char GXGlobal_cfg[26];
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
FILE *fp = fopen(GXGlobal_cfg, "r");
if (fp)
{
fclose(fp);
printf("\n\tConfiguration file is on %s", bootDevice);
}
gettextCleanUp(); gettextCleanUp();
printf("\n\tLoading configuration..."); printf("\n\tLoading configuration...");
CFG_Load(); CFG_Load();

View File

@ -118,12 +118,6 @@ int CheckPartition()
if (ret2 < 0) if (ret2 < 0)
return ret2; return ret2;
// open database if needed, load titles if needed
if(isInserted(bootDevice))
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);
__Menu_GetEntries(0);
hddState = 1; hddState = 1;
return hddState; return hddState;
@ -163,6 +157,10 @@ static void * CheckDevices (void *arg)
{ {
if(CheckHDD() >= 0) if(CheckHDD() >= 0)
{ {
// open database if needed, load titles if needed
if(isInserted(bootDevice))
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride == 1 ? true: false, true);
checkthreadState = 1; checkthreadState = 1;
} }
} }

View File

@ -45,12 +45,12 @@ char alternatedname[40];
#define TITLE_MAX 200 #define TITLE_MAX 200
struct ID_Title { struct ID_Title {
u8 id[5]; char id[6];
char title[TITLE_MAX]; char title[TITLE_MAX];
}; };
struct ID_Control { struct ID_Control {
u8 id[5]; char id[6];
u8 block; u8 block;
}; };
// renamed titles // renamed titles
@ -158,7 +158,7 @@ bool cfg_bool(char *name, short *var) {
} }
void cfg_int(char *name, short *var, int count) { void cfg_int(char *name, short *var, int count) {
char tmp[5]; char tmp[6];
short i; short i;
if (count > 10) //avoid overflow if (count > 10) //avoid overflow
@ -392,20 +392,25 @@ char *cfg_get_title(u8 *id)
int i; int i;
for (i=0; i<num_title; i++) { for (i=0; i<num_title; i++) {
if (memcmp(id, cfg_title[i].id, 4) == 0) { if (memcmp(id, cfg_title[i].id, 6) == 0) {
return cfg_title[i].title; return cfg_title[i].title;
} }
} }
return NULL; return NULL;
} }
char *get_title(struct discHdr *header) { char *get_title(struct discHdr *header)
{
if(!header)
return NULL;
char *title = cfg_get_title(header->id); char *title = cfg_get_title(header->id);
if (title) return title; if (title) return title;
return header->title; return header->title;
} }
void title_set(char *id, char *title) { void title_set(char *id, char *title)
{
char *idt = cfg_get_title((u8*)id); char *idt = cfg_get_title((u8*)id);
if (idt) { if (idt) {
// replace // replace
@ -418,8 +423,7 @@ void title_set(char *id, char *title) {
return; return;
} }
// add // add
memcpy(cfg_title[num_title].id, id, 4); strcpy(cfg_title[num_title].id, id);
cfg_title[num_title].id[4] = 0;
strlcpy(cfg_title[num_title].title, title, TITLE_MAX); strlcpy(cfg_title[num_title].title, title, TITLE_MAX);
num_title++; num_title++;
} }
@ -428,8 +432,7 @@ void title_set(char *id, char *title) {
void titles_default() { void titles_default() {
int i; int i;
for (i=0; i<num_title; i++) { for (i=0; i<num_title; i++) {
memcpy(cfg_title[i].id, "", 4); memset(cfg_title[i].id, 0, 6);
cfg_title[i].id[4] = 0;
strlcpy(cfg_title[i].title, "", TITLE_MAX); strlcpy(cfg_title[i].title, "", TITLE_MAX);
} }
} }
@ -437,7 +440,7 @@ void titles_default() {
u8 cfg_get_block(u8 *id) { u8 cfg_get_block(u8 *id) {
int i; int i;
for (i=0; i<num_control; i++) { for (i=0; i<num_control; i++) {
if (memcmp(id, cfg_control[i].id, 4) == 0) { if (memcmp(id, cfg_control[i].id, 6) == 0) {
return cfg_control[i].block; return cfg_control[i].block;
} }
} }
@ -1506,8 +1509,7 @@ void parental_set(char *name, char *val) {
return; return;
} }
// add // add
memcpy(cfg_control[num_control].id, id, 4); strcpy(cfg_control[num_control].id, (char*) id);
cfg_control[num_control].id[4] = 0;
cfg_control[num_control].block = opt_c; cfg_control[num_control].block = opt_c;
num_control++; num_control++;
} }