* Added QuadForce version detection up to v4.1

* Added QuadForce USB Support
* Optimized DM/DML/QF detection code
This commit is contained in:
Cyan 2013-05-26 12:34:21 +00:00
parent 304c0ef5ec
commit 96b36741d4
6 changed files with 136 additions and 122 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>3.0 r1214</version> <version>3.0 r1215</version>
<release_date>20130430170233</release_date> <release_date>20130526121306</release_date>
<!-- // remove this line to enable arguments <!-- // remove this line to enable arguments
<arguments> <arguments>
<arg>--ios=250</arg> <arg>--ios=250</arg>

View File

@ -239,7 +239,7 @@ u32 GCGames::LoadAllGames(void)
//! Display only one game if it is present on both SD and USB. //! Display only one game if it is present on both SD and USB.
if(memcmp(HeaderList[n].id, sdGCList[i].id, 6) == 0) if(memcmp(HeaderList[n].id, sdGCList[i].id, 6) == 0)
{ {
if(IosLoader::GetMIOSInfo() == DIOS_MIOS) // DIOS MIOS - Show only the game on USB if(IosLoader::GetMIOSInfo() == DIOS_MIOS || IosLoader::GetMIOSInfo() == QUADFORCE_USB) // DIOS MIOS - Show only the game on USB
{ {
break; break;
} }

View File

@ -76,6 +76,9 @@ static const char * DMLVersions[] =
"v2.9+", // DML 2.9 "v2.9+", // DML 2.9
"v2.9+", // DM 2.9 "v2.9+", // DM 2.9
"v2.0", // QuadForce v2.0 "v2.0", // QuadForce v2.0
"v3.0", // QuadForce v3.0
"v4.0+", // QuadForce v4.0 SD
"v4.1", // QuadForce v4.1 USB
}; };
@ -301,6 +304,8 @@ void WindowCredits()
snprintf(GCInfo, sizeof(GCInfo), "DIOS-MIOS Lite %s", DMLVersions[IosLoader::GetDMLVersion()]); snprintf(GCInfo, sizeof(GCInfo), "DIOS-MIOS Lite %s", DMLVersions[IosLoader::GetDMLVersion()]);
else if (currentMIOS == QUADFORCE) else if (currentMIOS == QUADFORCE)
snprintf(GCInfo, sizeof(GCInfo), "QuadForce %s", DMLVersions[IosLoader::GetDMLVersion()]); snprintf(GCInfo, sizeof(GCInfo), "QuadForce %s", DMLVersions[IosLoader::GetDMLVersion()]);
else if (currentMIOS == QUADFORCE_USB)
snprintf(GCInfo, sizeof(GCInfo), "QuadForce USB %s", DMLVersions[IosLoader::GetDMLVersion()]);
// Check if Devolution is available // Check if Devolution is available
char DEVO_loader_path[100]; char DEVO_loader_path[100];

View File

@ -245,18 +245,26 @@ u8 IosLoader::GetMIOSInfo(bool checkedOnBoot)
else if((*(u32*)(appfile+i)) == 'Quad' && (*(u32*)(appfile+i+4)) == 'Forc') else if((*(u32*)(appfile+i)) == 'Quad' && (*(u32*)(appfile+i+4)) == 'Forc')
{ {
currentMIOS = QUADFORCE; currentMIOS = QUADFORCE;
if((*(u32*)(appfile+i+8)) == 'e 2.') // QuadForce 2.0 char* QF_version = (char*)(appfile+i+10);
{ gprintf("QuadForce v%.1f \n", atof(QF_version));
gprintf("QuadForce v2.0 \n"); if(atof(QF_version) >= 4.0) currentDMLVersion = DML_VERSION_QUAD_4_0;
currentDMLVersion = DML_VERSION_QUAD_2_0; else if(atof(QF_version) == 3.0) currentDMLVersion = DML_VERSION_QUAD_3_0;
} else if(atof(QF_version) == 2.0) currentDMLVersion = DML_VERSION_QUAD_2_0;
else // QuadForce 0.1 else currentDMLVersion = DML_VERSION_QUAD_0_1;
{
gprintf("QuadForce v0.1 \n");
currentDMLVersion = DML_VERSION_QUAD_0_1;
}
break; break;
} }
else if((*(u32*)(appfile+i)) == 'GCLo' && (*(u32*)(appfile+i+4)) == 'ader')
{
// QuadForce USB v4.1 binary doesn't have QF version, checking: GCLoader....Built : %s %s.....May 26 2013.00:15:28
if((*(u32*)(appfile+i+32)) == 'May ' && (*(u32*)(appfile+i+44)) == '00:1' && (*(u32*)(appfile+i+48)) == '5:28')
{
currentMIOS = QUADFORCE_USB;
gprintf("QuadForce USB v4.1\n");
currentDMLVersion = DML_VERSION_QUAD_4_1;
break;
}
}
} }
free(appfile); free(appfile);
} }
@ -279,24 +287,15 @@ u8 IosLoader::GetDMLVersion(char* releaseDate)
return currentDMLVersion; return currentDMLVersion;
} }
// Current installed version
gprintf("built on %s\n", releaseDate);
struct tm time; struct tm time;
strptime(releaseDate, "%b %d %Y %H:%M:%S", &time);
time_t unixTime = mktime(&time);
// Timestamp of DML r52 if(currentMIOS == DIOS_MIOS)
strptime("Mar 7 2012 19:36:06", "%b %d %Y %H:%M:%S", &time); {
const time_t dml_r52_time = mktime(&time);
// Timestamp of DML 1.2
strptime("Apr 24 2012 19:44:08", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_2_time = mktime(&time);
// Timestamp of DML 1.4b
strptime("May 7 2012 21:12:47", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_4b_time = mktime(&time);
// Timestamp of DML 1.5
strptime("Jun 14 2012 00:05:09", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_5_time = mktime(&time);
// Timestamp of DM 2.0 // Timestamp of DM 2.0
strptime("Jun 23 2012 19:43:21", "%b %d %Y %H:%M:%S", &time); strptime("Jun 23 2012 19:43:21", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_0_time = mktime(&time); const time_t dm_2_0_time = mktime(&time);
@ -313,50 +312,22 @@ u8 IosLoader::GetDMLVersion(char* releaseDate)
strptime("Jul 20 2012 14:49:47", "%b %d %Y %H:%M:%S", &time); strptime("Jul 20 2012 14:49:47", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_2_2_time = mktime(&time); const time_t dm_2_2_2_time = mktime(&time);
// Timestamp of DML 2.2 initial release
strptime("Aug 6 2012 15:19:17", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_2_time = mktime(&time);
// Timestamp of DML 2.2 update1
strptime("Aug 13 2012 00:12:46", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_2_1_time = mktime(&time);
// Timestamp of DML 2.3 mirror link
strptime("Sep 24 2012 13:13:42", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_3m_time = mktime(&time);
// Timestamp of DM 2.3 // Timestamp of DM 2.3
strptime("Sep 24 2012 15:51:54", "%b %d %Y %H:%M:%S", &time); strptime("Sep 24 2012 15:51:54", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_3_time = mktime(&time); const time_t dm_2_3_time = mktime(&time);
// Timestamp of DML 2.3 main link
strptime("Sep 25 2012 03:03:41", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_3_time = mktime(&time);
// Timestamp of DM 2.4 // Timestamp of DM 2.4
strptime("Oct 21 2012 22:57:12", "%b %d %Y %H:%M:%S", &time); strptime("Oct 21 2012 22:57:12", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_4_time = mktime(&time); const time_t dm_2_4_time = mktime(&time);
// Timestamp of DML 2.4
strptime("Oct 21 2012 22:57:17", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_4_time = mktime(&time);
// Timestamp of DM 2.5 // Timestamp of DM 2.5
strptime("Nov 9 2012 21:18:52", "%b %d %Y %H:%M:%S", &time); strptime("Nov 9 2012 21:18:52", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_5_time = mktime(&time); const time_t dm_2_5_time = mktime(&time);
// Timestamp of DML 2.5
strptime("Nov 9 2012 21:18:56", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_5_time = mktime(&time);
// Timestamp of DM 2.6.0 // Timestamp of DM 2.6.0
strptime("Dec 1 2012 01:52:53", "%b %d %Y %H:%M:%S", &time); strptime("Dec 1 2012 01:52:53", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_6_0_time = mktime(&time); const time_t dm_2_6_0_time = mktime(&time);
// Timestamp of DML 2.6
strptime("Dec 1 2012 16:22:29", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_6_time = mktime(&time);
// Timestamp of DM 2.6.1 // Timestamp of DM 2.6.1
strptime("Dec 1 2012 16:42:34", "%b %d %Y %H:%M:%S", &time); strptime("Dec 1 2012 16:42:34", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_6_1_time = mktime(&time); const time_t dm_2_6_1_time = mktime(&time);
@ -365,35 +336,14 @@ u8 IosLoader::GetDMLVersion(char* releaseDate)
strptime("Feb 20 2013 14:54:33", "%b %d %Y %H:%M:%S", &time); strptime("Feb 20 2013 14:54:33", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_7_time = mktime(&time); const time_t dm_2_7_time = mktime(&time);
// Timestamp of DML 2.7
strptime("Feb 21 2013 03:13:49", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_7_time = mktime(&time);
// Timestamp of DML 2.8
strptime("Feb 24 2013 13:30:29", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_8_time = mktime(&time);
// Timestamp of DM 2.8 // Timestamp of DM 2.8
strptime("Feb 24 2013 14:17:03", "%b %d %Y %H:%M:%S", &time); strptime("Feb 24 2013 14:17:03", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_8_time = mktime(&time); const time_t dm_2_8_time = mktime(&time);
// Timestamp of DML 2.9
strptime("Apr 5 2013 18:20:33", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_9_time = mktime(&time);
// Timestamp of DM 2.9 // Timestamp of DM 2.9
strptime("Apr 5 2013 18:29:35", "%b %d %Y %H:%M:%S", &time); strptime("Apr 5 2013 18:29:35", "%b %d %Y %H:%M:%S", &time);
const time_t dm_2_9_time = mktime(&time); const time_t dm_2_9_time = mktime(&time);
// Current installed version
gprintf("built on %s\n", releaseDate);
strptime(releaseDate, "%b %d %Y %H:%M:%S", &time);
time_t unixTime = mktime(&time);
if(currentMIOS == DIOS_MIOS)
{
if(difftime(unixTime, dm_2_9_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_9; if(difftime(unixTime, dm_2_9_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_9;
else if(difftime(unixTime, dm_2_8_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_8; else if(difftime(unixTime, dm_2_8_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_8;
else if(difftime(unixTime, dm_2_7_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_7; else if(difftime(unixTime, dm_2_7_time) >= 0) currentDMLVersion = DML_VERSION_DM_2_7;
@ -409,6 +359,61 @@ u8 IosLoader::GetDMLVersion(char* releaseDate)
} }
else if(currentMIOS == DIOS_MIOS_LITE) else if(currentMIOS == DIOS_MIOS_LITE)
{ {
// Timestamp of DML r52
strptime("Mar 7 2012 19:36:06", "%b %d %Y %H:%M:%S", &time);
const time_t dml_r52_time = mktime(&time);
// Timestamp of DML 1.2
strptime("Apr 24 2012 19:44:08", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_2_time = mktime(&time);
// Timestamp of DML 1.4b
strptime("May 7 2012 21:12:47", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_4b_time = mktime(&time);
// Timestamp of DML 1.5
strptime("Jun 14 2012 00:05:09", "%b %d %Y %H:%M:%S", &time);
const time_t dml_1_5_time = mktime(&time);
// Timestamp of DML 2.2 initial release
strptime("Aug 6 2012 15:19:17", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_2_time = mktime(&time);
// Timestamp of DML 2.2 update1
strptime("Aug 13 2012 00:12:46", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_2_1_time = mktime(&time);
// Timestamp of DML 2.3 mirror link
strptime("Sep 24 2012 13:13:42", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_3m_time = mktime(&time);
// Timestamp of DML 2.3 main link
strptime("Sep 25 2012 03:03:41", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_3_time = mktime(&time);
// Timestamp of DML 2.4
strptime("Oct 21 2012 22:57:17", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_4_time = mktime(&time);
// Timestamp of DML 2.5
strptime("Nov 9 2012 21:18:56", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_5_time = mktime(&time);
// Timestamp of DML 2.6
strptime("Dec 1 2012 16:22:29", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_6_time = mktime(&time);
// Timestamp of DML 2.7
strptime("Feb 21 2013 03:13:49", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_7_time = mktime(&time);
// Timestamp of DML 2.8
strptime("Feb 24 2013 13:30:29", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_8_time = mktime(&time);
// Timestamp of DML 2.9
strptime("Apr 5 2013 18:20:33", "%b %d %Y %H:%M:%S", &time);
const time_t dml_2_9_time = mktime(&time);
if(difftime(unixTime, dml_2_9_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_9; if(difftime(unixTime, dml_2_9_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_9;
else if(difftime(unixTime, dml_2_8_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_8; else if(difftime(unixTime, dml_2_8_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_8;
else if(difftime(unixTime, dml_2_7_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_7; else if(difftime(unixTime, dml_2_7_time) >= 0) currentDMLVersion = DML_VERSION_DML_2_7;

View File

@ -12,6 +12,7 @@ enum MiosInfo
DIOS_MIOS, DIOS_MIOS,
DIOS_MIOS_LITE, DIOS_MIOS_LITE,
QUADFORCE, QUADFORCE,
QUADFORCE_USB,
}; };
enum DMLVersions enum DMLVersions
@ -60,6 +61,9 @@ enum DMLVersions
DML_VERSION_DML_2_9, // Apr 5 2013 18:20:33 DML_VERSION_DML_2_9, // Apr 5 2013 18:20:33
DML_VERSION_DM_2_9, // Apr 5 2013 18:29:35 DML_VERSION_DM_2_9, // Apr 5 2013 18:29:35
DML_VERSION_QUAD_2_0, // Apr 30 2013 17:31:32 DML_VERSION_QUAD_2_0, // Apr 30 2013 17:31:32
DML_VERSION_QUAD_3_0, // May 8 2013 22:21:44
DML_VERSION_QUAD_4_0, // May 12 2013 20:22:57
DML_VERSION_QUAD_4_1, // May 26 2013 ??:??:?? (USB)
DML_VERSION_MAX_VERSION, DML_VERSION_MAX_VERSION,
}; };

View File

@ -77,7 +77,7 @@ int GameBooter::BootGCMode(struct discHdr *gameHdr)
// DIOS MIOS (Lite) and QuadForce // DIOS MIOS (Lite) and QuadForce
int currentMIOS = IosLoader::GetMIOSInfo(); int currentMIOS = IosLoader::GetMIOSInfo();
if(currentMIOS == DIOS_MIOS || currentMIOS == DIOS_MIOS_LITE || currentMIOS == QUADFORCE) if(currentMIOS == DIOS_MIOS || currentMIOS == DIOS_MIOS_LITE || currentMIOS == QUADFORCE || currentMIOS == QUADFORCE_USB)
return BootDIOSMIOS(gameHdr); return BootDIOSMIOS(gameHdr);
// MIOS or Wiigator cMIOS // MIOS or Wiigator cMIOS
@ -431,7 +431,7 @@ int GameBooter::BootDIOSMIOS(struct discHdr *gameHdr)
int currentMIOS = IosLoader::GetMIOSInfo(); int currentMIOS = IosLoader::GetMIOSInfo();
// DIOS MIOS // DIOS MIOS
if(currentMIOS == DIOS_MIOS) if(currentMIOS == DIOS_MIOS || currentMIOS == QUADFORCE_USB)
{ {
// Check Main GameCube Path location // Check Main GameCube Path location
if(strncmp(Settings.GameCubePath, "sd", 2) == 0 || strncmp(DeviceHandler::PathToFSName(Settings.GameCubePath), "FAT", 3) != 0) if(strncmp(Settings.GameCubePath, "sd", 2) == 0 || strncmp(DeviceHandler::PathToFSName(Settings.GameCubePath), "FAT", 3) != 0)