diff --git a/include/sys.h b/include/sys.h index 8afdca9..a46f185 100644 --- a/include/sys.h +++ b/include/sys.h @@ -120,7 +120,6 @@ typedef struct _U8Entry extern const char *Regions[]; extern u8 sysMenuInfoContent; -extern bool debug; #ifdef __cplusplus extern "C" diff --git a/include/tools.h b/include/tools.h index 912ee53..75b8af5 100644 --- a/include/tools.h +++ b/include/tools.h @@ -10,11 +10,25 @@ extern "C" #define DI_BUTTONS_HELD 0 #define DI_BUTTONS_DOWN 1 +#define CHECK_ARG(X) (!strncmp((X), argv[i], sizeof((X))-1)) +#define CHECK_ARG_VAL(X) (argv[i] + sizeof((X))-1) + +typedef struct { + bool forceNoAHBPROT; + bool debug; + int skipIOSlist[513]; + int skipIOScnt; +} arguments_t; + +extern arguments_t arguments; + void logfile(const char *format, ...); void *allocate_memory(u32 size); int NandStartup(void); void NandShutdown(void); u32 DetectInput(u8 DownOrHeld); +void sort(u64 *titles, u32 cnt); +void formatDate(u32 date, char ReportBuffer[200][100]); #ifdef __cplusplus } diff --git a/source/sysCheck.c b/source/sysCheck.c index 4008f7b..1682ba0 100644 --- a/source/sysCheck.c +++ b/source/sysCheck.c @@ -40,72 +40,32 @@ extern bool geckoinit; extern void __exception_setreload(int t); static u32 current_time = 0; -void formatDate(u32 date, char ReportBuffer[200][100]) { - char temp[8] = {0}; - char day[2] = {0}; - char month[2] = {0}; - char year[4] = {0}; - - sprintf(temp, "%08x", date); - sprintf(year, "%c%c%c%c", temp[0], temp[1], temp[2], temp[3]); - sprintf(month, "%c%c", temp[4], temp[5]); - sprintf(day, "%c%c", temp[6], temp[7]); - - gprintf("MONTH: %s\n", month); - gprintf("DAY: %s\n", day); - gprintf("YEAR: %s\n", year); - logfile("MONTH: %s\r\n", month); - logfile("DAY: %s\r\n", day); - logfile("YEAR: %s\r\n", year); - - char result[10] = {0}; - - switch (CONF_GetLanguage()) { - case CONF_LANG_GERMAN: - case CONF_LANG_ITALIAN: - case CONF_LANG_SPANISH: - sprintf(result, "%s.%s.%s", day, month, year); - break; - default: - sprintf(result, "%s.%s.%s", month, day, year); // You don't say "I was born 1990 January 1" The year comes last - break; - } - gprintf("String: %s\n", result); - logfile("String: %s\r\n", result); - if (strlen(result) > 1) - sprintf(ReportBuffer[DVD], TXT_DVD, result); - else - sprintf(ReportBuffer[DVD], TXT_NoDVD); -} - -inline void sort(u64 *titles, u32 cnt) { - int i, j; - u64 tmp; - for (i = 0; i < cnt -1; ++i) { - for (j = 0; j < cnt - i - 1; ++j) { - if (titles[j] > titles[j + 1]) { - tmp = titles[j]; - titles[j] = titles[j + 1]; - titles[j + 1] = tmp; - } - } - } -} // Main int main(int argc, char **argv) { __exception_setreload(2); - bool forceNoAHBPROT = false; + arguments.forceNoAHBPROT = false; + memset(arguments.skipIOSlist, 0, sizeof(arguments.skipIOSlist)); + arguments.skipIOScnt = 0; + arguments.debug = false; + geckoinit = InitGecko(); if(argc>=1){ int i; for(i=0; i 0) { + for (i = nbTitles; i--;) { + titleID = titles[i] & 0xFFFFFFFF; + if(titleID == arguments.skipIOSlist[arguments.skipIOScnt - 1]) { + logfile("Skipped IOS %i, titles[%i] = %i\r\n", arguments.skipIOSlist[arguments.skipIOScnt - 1], i, titles[i]); + titles[i] = 0; + SystemInfo.countIOS--; + arguments.skipIOScnt--; + break; + } + } + } + CheckTime(current_time, 600); // Sort IOS titles printLoading(MSG_SortTitles); UpdateTime(); - - u64 *newTitles = memalign(32, SystemInfo.countIOS*sizeof(u64)); + + u64 *newTitles = memalign(32, (SystemInfo.countIOS)*sizeof(u64)); u32 cnt = 0; for (i = 0; i < nbTitles; i++) { if (titles[i] > 0) { diff --git a/source/tools.c b/source/tools.c index b92c458..498ab1a 100644 --- a/source/tools.c +++ b/source/tools.c @@ -30,11 +30,11 @@ // Variables bool NandInitialized = false; -bool debug = false; +arguments_t arguments; void logfile(const char *format, ...) { - if (!debug) return; + if (!arguments.debug) return; MountSD(); FILE *f; f= fopen("SD:/sysCheckDebug.log", "a"); @@ -90,7 +90,6 @@ void NandShutdown(void) u32 DetectInput(u8 DownOrHeld) { u32 pressed = 0; u16 gcpressed = 0; - VIDEO_WaitVSync(); // Wii Remote (and Classic Controller) take precedence over GC to save time if (WPAD_ScanPads() > WPAD_ERR_NONE) // Scan the Wii remotes. If there any problems, skip checking buttons { @@ -149,3 +148,55 @@ u32 DetectInput(u8 DownOrHeld) { } return pressed; } + +void formatDate(u32 date, char ReportBuffer[200][100]) { + char temp[8] = {0}; + char day[2] = {0}; + char month[2] = {0}; + char year[4] = {0}; + + sprintf(temp, "%08x", date); + sprintf(year, "%c%c%c%c", temp[0], temp[1], temp[2], temp[3]); + sprintf(month, "%c%c", temp[4], temp[5]); + sprintf(day, "%c%c", temp[6], temp[7]); + + gprintf("MONTH: %s\n", month); + gprintf("DAY: %s\n", day); + gprintf("YEAR: %s\n", year); + logfile("MONTH: %s\r\n", month); + logfile("DAY: %s\r\n", day); + logfile("YEAR: %s\r\n", year); + + char result[10] = {0}; + + switch (CONF_GetLanguage()) { + case CONF_LANG_GERMAN: + case CONF_LANG_ITALIAN: + case CONF_LANG_SPANISH: + sprintf(result, "%s.%s.%s", day, month, year); + break; + default: + sprintf(result, "%s.%s.%s", month, day, year); // You don't say "I was born 1990 January 1" The year comes last + break; + } + gprintf("String: %s\n", result); + logfile("String: %s\r\n", result); + if (strlen(result) > 1) + sprintf(ReportBuffer[DVD], TXT_DVD, result); + else + sprintf(ReportBuffer[DVD], TXT_NoDVD); +} + +inline void sort(u64 *titles, u32 cnt) { + int i, j; + u64 tmp; + for (i = 0; i < cnt -1; ++i) { + for (j = 0; j < cnt - i - 1; ++j) { + if (titles[j] > titles[j + 1]) { + tmp = titles[j]; + titles[j] = titles[j + 1]; + titles[j + 1] = tmp; + } + } + } +} \ No newline at end of file