-Added translations for "Homebrew Channel is not installed" message

-Improved timing between messages
-Added support for GC/Classic controllers, and multiple remotes
-Changed "HD Edition" to "HacksDen Edition"
-Minor code cleanup
This commit is contained in:
Joostinonline 2014-06-19 17:47:13 +00:00
parent f7c14cb306
commit bc08e18949
12 changed files with 365 additions and 330 deletions

View File

@ -17,9 +17,9 @@ include $(DEVKITPPC)/wii_rules
#---------------------------------------------------------------------------------
TARGET := boot
BUILD := build
SOURCES := source source/gfx
SOURCES := source
DATA := data
INCLUDES := include source/gfx
INCLUDES := include
#---------------------------------------------------------------------------------
# options for code generation
@ -134,28 +134,7 @@ $(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o : %.png
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .ttf extension
#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
%.wad.o : %.wad
@echo $(notdir $<)
$(bin2o)
@ -163,38 +142,10 @@ $(OUTPUT).elf: $(OFILES)
@echo $(notdir $<)
$(bin2o)
%.certs.o : %.certs
@echo $(notdir $<)
$(bin2o)
%.sys.o : %.sys
@echo $(notdir $<)
$(bin2o)
%.dat.o : %.dat
@echo $(notdir $<)
$(bin2o)
%.tmd.o : %.tmd
@echo $(notdir $<)
$(bin2o)
%.tik.o : %.tik
@echo $(notdir $<)
$(bin2o)
%.bin.o : %.bin
@echo $(notdir $<)
$(bin2o)
%.cert.o : %.cert
@echo $(notdir $<)
$(bin2o)
%.app.o : %.app
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@ const char* TXT_SysMenu;
const char* TXT_SysMenu2;
const char* TXT_SysMenu3;
const char* TXT_HBF;
const char* TXT_NO_HBC;
const char* TXT_HBC;
const char* TXT_HBC_NEW;
const char* TXT_HBC_112;

View File

@ -1,3 +1,6 @@
#ifndef __SHA1_H__
#define __SHA1_H__
typedef struct {
unsigned long state[5];
unsigned long count[2];
@ -8,5 +11,6 @@ void SHA1Transform(unsigned long state[5], unsigned char buffer[64]);
void SHA1Init(SHA1_CTX* context);
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len);
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf);
#endif

View File

@ -1,13 +1,16 @@
#ifndef _TOOLS_H_
#define _TOOLS_H_
#define AHB_ACCESS ((*(vu32*)0xcd800064 == 0xFFFFFFFF) ? 1 : 0)
#include <ogc\lwp_watchdog.h>
#define AHB_ACCESS (*(vu32*)0xcd800064 == 0xFFFFFFFF)
#define MEM_REG_BASE 0xd8b4000
#define MEM_PROT (MEM_REG_BASE + 0x20a)
#define HOLLYWOOD_VERSION (vu32*)0x80003138
#define LOADER_STUB (vu32*)0x80001800
#define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE)
#define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0])))
#define CheckTime(X,Y) while(!(ticks_to_millisecs(diff_ticks((X), gettick())) > (Y)))
// Turn upper and lower into a full title ID
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
@ -19,6 +22,10 @@
#define FULL_TITLE_ID(titleId) ((u32)(titleId))
#define TITLE_ID2(titleId) ((u32)((titleId) >> 32))
// Values for DetectInput
#define DI_BUTTONS_HELD 0
#define DI_BUTTONS_DOWN 1
enum {
APP_TITLE = 0,
APP_IOS,
@ -54,6 +61,16 @@ enum {
HBF_THBF
};
enum {
TID_CBOOT2 = 252, // cBoot252
TID_NANDEMU,
TID_BOOTMII,
TID_BC = 256,
TID_MIOS,
TID_NAND = 512,
TID_WFS
};
typedef struct {
s32 revision;
bool isStub;
@ -112,6 +129,7 @@ extern "C"
#endif
// Prototypes
u32 DetectInput(u8 DownOrHeld);
char GetSysMenuRegion(u32 sysVersion);
bool GetCertificates(void);
u32 GetSysMenuVersion(void);

View File

@ -1,12 +1,12 @@
#ifndef __TMDIDENT_H__
#define __TMDIDENT_H__
#define base_number 122
typedef struct {
u32 hashes[5];
u32 base;
char info[0x10];
} iosHashes;
typedef struct _iosinfo_t {
@ -143,3 +143,5 @@ static iosHashes iosHash[base_number] = {
{{0x97f4ad1a, 0x437842a8, 0x015435c7, 0xa2b25178, 0x3564265d}, 20, "rev 12" }, // IOS20 rev 212
{{0xe42a9e18, 0xa967eb9c, 0x94769498, 0x917c9ab9, 0x6169e7ca}, 11, "rev 10" } // IOS11 rev 10
};
#endif

View File

@ -5,24 +5,19 @@
#include "languages.h"
// CONF_LANG_JAPANESE
// CONF_LANG_ENGLISH
// CONF_LANG_GERMAN
// CONF_LANG_FRENCH
// CONF_LANG_SPANISH
// CONF_LANG_ITALIAN
// CONF_LANG_DUTCH
// CONF_LANG_SIMP_CHINESE
// CONF_LANG_TRAD_CHINESE
// CONF_LANG_KOREAN
// !!! Doens't support special chars... !!!
// !!! Doesn't support special chars... !!!
// !!! Don't change the order of the parameters !!!
int initLanguages(struct tm today)
{
TXT_AppVersion = "v2.2.1 HD Edition";
TXT_AppVersion = "v2.2.1 HacksDen Edition";
switch (CONF_GetLanguage())
{
case CONF_LANG_GERMAN:
@ -50,6 +45,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "Systemmenue %1.1f%c (v%d)";
TXT_SysMenu2 = "Systemmenue %s%s (v%d)";
TXT_SysMenu3 = "Systemmenue %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "Homebrewkanal ist nicht installiert";
TXT_HBF = "HomebrewFilter rev%d benutzt IOS58";
TXT_HBC = "Homebrewkanal 1.0.%d benutzt IOS%d";
TXT_HBC_NEW = "Homebrewkanal 1.1.0 benutzt IOS%d";
@ -127,6 +123,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "Menu Systeme %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu Systeme %s%s (v%d)";
TXT_SysMenu3 = "Menu Systeme %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "Chaine Homebrew n'est pas installé";
TXT_HBC = "Chaine Homebrew 1.0.%d utilise IOS%d";
TXT_HBC_NEW = "Chaine Homebrew 1.1.0 utilise IOS%d";
TXT_HBC_112 = "Chaine Channel 1.1.%d utilise IOS%d";
@ -202,6 +199,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "Menu di sistema %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu di sistema %s%s (v%d)";
TXT_SysMenu3 = "Menu di sistema %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "Non è installato Canale Homebrew";
TXT_HBC = "Canale Homebrew 1.0.%d appoggiato all'IOS%d";
TXT_HBC_NEW = "Canale Homebrew 1.1.0 appoggiato all'IOS%d";
TXT_HBC_112 = "Canale Homebrew 1.1.%d appoggiato all'IOS%d";
@ -277,6 +275,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "Menu de Sistema %1.1f%c (v%d)";
TXT_SysMenu2 = "Menu de Sistema %s%s (v%d)";
TXT_SysMenu3 = "Menu de Sistema %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "No está instalado el Canal Homebrew";
TXT_HBC = "Canal Homebrew 1.0.%d corriendo en IOS%d";
TXT_HBC_NEW = "Canal Homebrew 1.1.0 corriendo en IOS%d";
TXT_HBC_112 = "Canal Homebrew 1.1.%d corriendo en %d";
@ -352,6 +351,7 @@ int initLanguages(struct tm today)
TXT_SysMenu = "System Menu %1.1f%c (v%d)";
TXT_SysMenu2 = "System Menu %s%s (v%d)";
TXT_SysMenu3 = "System Menu %1.1f%c (v%d, Info: v%d %s)";
TXT_NO_HBC = "Homebrew Channel is not installed";
TXT_HBC = "Homebrew Channel 1.0.%d running on IOS%d";
TXT_HBC_NEW = "Homebrew Channel 1.1.0 running on IOS%d";
TXT_HBC_112 = "Homebrew Channel 1.1.%d running on IOS%d";

View File

@ -10,7 +10,6 @@
#include <network.h>
#include <ogc/machine/processor.h>
#include <ogc/conf.h>
#include <wiiuse/wpad.h>
#include <ctype.h>
#include "sys.h"

View File

@ -8,6 +8,7 @@
#include <ogc/conf.h>
#include <ogc/es.h>
#include <ogc/ios.h>
#include <ogc/pad.h>
#include <wiiuse/wpad.h>
#include <stdlib.h>
#include <stdarg.h>
@ -36,9 +37,8 @@
extern bool geckoinit;
extern void __exception_setreload(int t);
static u64 current_time = 0;
int get_title_ios(u64 title) {
s32 ret, fd;
@ -101,8 +101,7 @@ bool getInfoFromContent(IOS *ios) {
ret = read_file_from_nand(filepath, &buffer, &filesize);
iosinfo = (iosinfo_t *)(buffer);
if (ret >= 0 && ios->titleID == 252 && ios->num_contents == 1) {
//const char *checkStr = "bootcb2";
if (ret >= 0 && ios->titleID == TID_CBOOT2 && ios->num_contents == 1) {
int i;
for (i = 0; i < filesize - sizeof("bootcb2")-1; i++)
{
@ -224,8 +223,9 @@ int main(int argc, char **argv)
// Get the console region
printLoading(MSG_GetConsoleRegion);
usleep(200000);
current_time = gettick();
SystemInfo.systemRegion = CONF_GetRegion();
CheckTime(current_time, 200000);
SystemInfo.shopcode = 0;
if (!CONF_GetShopCode(&SystemInfo.shopcode)) {
@ -236,12 +236,15 @@ int main(int argc, char **argv)
// Get the system menu version
printLoading(MSG_GetSysMenuVer);
usleep(200000);
current_time = gettick();
SystemInfo.sysMenuVer = GetSysMenuVersion();
CheckTime(current_time, 200000);
sysMenu systemmenu;
printLoading(MSG_GetHBCVer);
usleep(200000);
current_time = gettick();
homebrew_t homebrew;
homebrew.hbcversion = 0;
homebrew.hbfversion = 0;
@ -313,26 +316,31 @@ int main(int argc, char **argv)
SystemInfo.sysNinVersion = GetSysMenuNintendoVersion(SystemInfo.sysMenuVer);
SystemInfo.sysMenuRegion = GetSysMenuRegion(SystemInfo.sysMenuVer);
CheckTime(current_time, 200000);
// Get the running IOS version and revision
printLoading(MSG_GetRunningIOS);
current_time = gettick();
u32 runningIOS = IOS_GetVersion();
u32 runningIOSRevision = IOS_GetRevision();
printLoading(MSG_GetRunningIOS);
usleep(200000);
CheckTime(current_time, 200000);
// Get the console ID
printLoading(MSG_GetConsoleID);
usleep(200000);
current_time = gettick();
SystemInfo.deviceID = GetDeviceID();
CheckTime(current_time, 200000);
// Get the boot2 version
printLoading(MSG_GetBoot2);
usleep(200000);
current_time = gettick();
SystemInfo.boot2version = GetBoot2Version();
CheckTime(current_time, 200000);
// Get number of titles
printLoading(MSG_GetNrOfTitles);
usleep(200000);
current_time = gettick();
u32 tempTitles;
if (ES_GetNumTitles(&tempTitles) < 0) {
@ -354,10 +362,11 @@ int main(int argc, char **argv)
deinitGUI();
exit(1);
}
CheckTime(current_time, 200000);
// Get list of titles
printLoading(MSG_GetTitleList);
usleep(200000);
current_time = gettick();
if (ES_GetTitles(titles, nbTitles) < 0) {
printError(ERR_GetTitleList);
sleep(5);
@ -400,10 +409,11 @@ int main(int argc, char **argv)
}
SystemInfo.countIOS++;
}
CheckTime(current_time, 200000);
// Sort IOS titles
printLoading(MSG_SortTitles);
//usleep(200000);
current_time = gettick();
u64 *newTitles = memalign(32, SystemInfo.countIOS*sizeof(u64));
u32 cnt = 0;
@ -419,7 +429,6 @@ int main(int argc, char **argv)
IOS ios[SystemInfo.countIOS];
// ios Liste initialisieren
//for (i = 0; i < countIOS; i++) {
for (i = SystemInfo.countIOS; i--;) { // Should be slightly faster
ios[i].infoContent = 0;
ios[i].titleID = 0;
@ -498,16 +507,14 @@ int main(int argc, char **argv)
ios[i].isStub = true;
else
{
ios[i].isStub = (ios[i].titleID != 256 && ios[i].titleID != 257 && ios[i].titleID != 512 && ios[i].titleID != 513 && titleSize < 0x100000);
ios[i].isStub = (ios[i].titleID != TID_BC && ios[i].titleID != TID_MIOS && ios[i].titleID != TID_NAND && ios[i].titleID != TID_WFS && titleSize < 0x100000);
if (ios[i].isStub) {
gprintf("is stub\n");
logfile("is stub\r\n");
}
}
if (!ios[i].isStub || ios[i].titleID == 252) {
if (SystemInfo.nandAccess)
if (!getInfoFromContent(&ios[i])) {
if ((!ios[i].isStub || ios[i].titleID == TID_CBOOT2) && (SystemInfo.nandAccess) && (!getInfoFromContent(&ios[i]))) {
// Hash des TMDs abrufen
iosTMD->title_id = ((u64)(1) << 32) | 249;
brute_tmd(iosTMD);
@ -515,12 +522,12 @@ int main(int argc, char **argv)
sha1 hash;
SHA1((u8 *)iosTMDBuffer, tmdSize, hash);
sprintf(HashLogBuffer[lines], "IOS%d get_ios_base: \n%x %x %x %x, %x %x %x %x, %x %x %x %x, %x %x %x %x, %x %x %x %x\n", ios[i].titleID, (char)hash[0], (char)hash[1], (char)hash[2], (char)hash[3], (char)hash[4], (char)hash[5], (char)hash[6], (char)hash[7], (char)hash[8], (char)hash[9], (char)hash[10], (char)hash[11], (char)hash[12], (char)hash[13], (char)hash[14], (char)hash[15], (char)hash[16], (char)hash[17], (char)hash[18], (char)hash[19]);
sprintf(HashLogBuffer[lines], "IOS%d base hash: \r\n%x %x %x %x, %x %x %x %x, %x %x %x %x, %x %x %x %x, %x %x %x %x\r\n", ios[i].titleID, hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15], hash[16], hash[17], hash[18], hash[19]);
lines++;
for (j = 0;j < base_number;j++)
{
// Hashes berprfen
// Check hashes
if (memcmp((void *)hash, (u32 *)&iosHash[j].hashes, sizeof(sha1)) == 0)
{
if (ios[i].titleID != iosHash[j].base)
@ -531,11 +538,9 @@ int main(int argc, char **argv)
}
}
}
}
free(iosTMDBuffer);
if (ios[i].titleID == 256 || ios[i].titleID == 257) SystemInfo.countBCMIOS++;
if (ios[i].titleID == TID_BC || ios[i].titleID == TID_MIOS) SystemInfo.countBCMIOS++;
if (ios[i].isStub && !(iosTMD->title_version == 31338) && !(iosTMD->title_version == 65281) && !(iosTMD->title_version == 65535)) SystemInfo.countStubs++;
}
@ -575,7 +580,7 @@ int main(int argc, char **argv)
// Try to identify the cIOS by the info put in by the installer/ModMii
sysMenuInfoContent = *(u8 *)((u32)iosTMDBuffer+0x1E7);
sprintf(filepath, "/title/%08x/%08x/content/%08x.app", 0x00000001, 2, sysMenuInfoContent);
gprintf("/title/%08x/%08x/content/%08x.app\n", 0x00000001, 2, sysMenuInfoContent);
gprintf(filepath);
ret = read_file_from_nand(filepath, &buffer, &filesize);
sysInfo = (iosinfo_t *)(buffer);
@ -583,7 +588,6 @@ int main(int argc, char **argv)
{
systemmenu.realRevision = sysInfo->version;
systemmenu.hasInfo = true;
//strcpy(systemmenu.info, sysInfo->name);
sprintf(systemmenu.info, "%s%s", sysInfo->name, sysInfo->versionstring);
if (buffer != NULL) free(buffer);
} else {
@ -597,10 +601,11 @@ int main(int argc, char **argv)
SystemInfo.countTitles = nbTitles;
nbTitles = SystemInfo.countIOS;
CheckTime(current_time, 200000);
// Get the certificates from the NAND
printLoading(MSG_GetCertificates);
usleep(200000);
CheckTime(current_time, 200000);
if (!GetCertificates()) {
printError(ERR_GetCertificates);
sleep(5);
@ -610,6 +615,7 @@ int main(int argc, char **argv)
//Select an IOS to test
WPAD_Init();
PAD_Init();
int selectedIOS = -1;
u32 wpressed;
time_t starttime;
@ -620,9 +626,7 @@ int main(int argc, char **argv)
bool completeReport = true;
while (difftime (time(NULL),starttime) < 15) {
//while(1) {
WPAD_ScanPads();
wpressed = WPAD_ButtonsHeld(0);
wpressed = DetectInput(DI_BUTTONS_HELD);
usleep(50000);
if (wpressed & WPAD_BUTTON_RIGHT && selectedIOS < (nbTitles-1)){
@ -633,10 +637,10 @@ int main(int argc, char **argv)
switch (titleID)
{
case 256:
case TID_BC:
sprintf(MSG_Buffer, "BC");
break;
case 257:
case TID_MIOS:
sprintf(MSG_Buffer, "MIOS");
break;
default:
@ -655,10 +659,10 @@ int main(int argc, char **argv)
switch (titleID)
{
case 256:
case TID_BC:
sprintf(MSG_Buffer, "BC");
break;
case 257:
case TID_MIOS:
sprintf(MSG_Buffer, "MIOS");
break;
default:
@ -706,14 +710,18 @@ int main(int argc, char **argv)
{
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
if (ios[i].titleID == 256) sprintf(MSG_Buffer2, "BC");
else if (ios[i].titleID == 257) sprintf(MSG_Buffer2, "MIOS");
if (ios[i].titleID == TID_BC) sprintf(MSG_Buffer2, "BC");
else if (ios[i].titleID == TID_MIOS) sprintf(MSG_Buffer2, "MIOS");
else sprintf(MSG_Buffer2, "IOS%d", ios[i].titleID);
sprintf(MSG_Buffer, MSG_TestingIOS, MSG_Buffer2);
printLoadingBar(MSG_Buffer, (100.0/(nbTitles-1)*(i+1)));
if (ios[i].isStub || ios[i].titleID == 256 || ios[i].titleID == 257)
if (ios[i].isStub ||
ios[i].titleID == TID_BC ||
ios[i].titleID == TID_MIOS ||
ios[i].titleID == TID_NAND ||
ios[i].titleID == TID_WFS)
{
ios[i].infoFakeSignature = false;
ios[i].infoESIdentify = false;
@ -770,7 +778,7 @@ int main(int argc, char **argv)
NandStartup();
int k = 0;
for (k = 0; k < nbTitles; k++) {
if ((ios[i].isStub || ios[i].titleID == 256 || ios[i].titleID == 257) && ios[i].titleID != 252) continue;
if ((ios[i].isStub || ios[i].titleID == TID_BC || ios[i].titleID == TID_MIOS) && ios[i].titleID != TID_CBOOT2) continue;
getInfoFromContent(&ios[k]);
}
NandShutdown();
@ -796,8 +804,9 @@ int main(int argc, char **argv)
usleep(200000);
//--Generate Report--
current_time=gettick();
printLoading(MSG_GenerateReport);
usleep(200000);
char ReportBuffer[200][100] = {{0}};
@ -975,7 +984,7 @@ int main(int argc, char **argv)
sprintf(ReportBuffer[PRIILOADER], TXT_PreFiix);
if (homebrew.hbc == HBC_NONE || homebrew.hbcversion == 0)
sprintf(ReportBuffer[HBC], "Homebrew Channel is not installed");
sprintf(ReportBuffer[HBC], TXT_NO_HBC);
else if (homebrew.hbcIOS == 0)
sprintf(ReportBuffer[HBC], TXT_HBC_STUB);
else if (homebrew.hbc == HBC_LULZ)
@ -1004,9 +1013,9 @@ int main(int argc, char **argv)
lineOffset = i + LAST;
if (selectedIOS > -1) i = selectedIOS; //If specific IOS is selected
if (ios[i].titleID == 256) {
if (ios[i].titleID == TID_BC) {
sprintf(ReportBuffer[lineOffset], "BC v%d", ios[i].revision);
} else if (ios[i].titleID == 257) {
} else if (ios[i].titleID == TID_MIOS) {
sprintf(ReportBuffer[lineOffset], "MIOS v%d%s", ios[i].revision, SystemInfo.miosInfo);
} else if ((ios[i].titleID==222 || ios[i].titleID==224 || ios[i].titleID==223 || ios[i].titleID==202 || ios[i].titleID==225) && ios[i].baseIOS == 75) {
sprintf(ReportBuffer[lineOffset], "IOS%d[38+37] (rev %d, Info: %s):", ios[i].titleID, ios[i].revision, ios[i].info);
@ -1033,9 +1042,9 @@ int main(int argc, char **argv)
}
// Check BootMii As IOS (BootMii As IOS is installed on IOS254 rev 31338)
if (ios[i].titleID == 254 && (ios[i].revision == 31338 || ios[i].revision == 65281))
if (ios[i].titleID == TID_BOOTMII && (ios[i].revision == 31338 || ios[i].revision == 65281))
strcat (ReportBuffer[lineOffset]," BootMii");
else if (ios[i].titleID == 253 && ios[i].revision == 65535)
else if (ios[i].titleID == TID_NANDEMU && ios[i].revision == 65535)
strcat (ReportBuffer[lineOffset]," NANDEmu");
else
{
@ -1045,7 +1054,7 @@ int main(int argc, char **argv)
} else if (ios[i].isStub && strcmp(ios[i].info, "NULL") != 0) {
gprintf("2. titleID: %d %s\n", ios[i].titleID, ios[i].info);
strcat (ReportBuffer[lineOffset], ios[i].info);
} else if(ios[i].titleID != 256 && ios[i].titleID != 257) {
} else if(ios[i].titleID != TID_BC && ios[i].titleID != TID_MIOS) {
if(ios[i].infoFakeSignature) strcat(ReportBuffer[lineOffset], TXT_Trucha);
if(ios[i].infoESIdentify) strcat(ReportBuffer[lineOffset], TXT_ES);
if(ios[i].infoFlashAccess) strcat(ReportBuffer[lineOffset], TXT_Flash);
@ -1062,15 +1071,17 @@ int main(int argc, char **argv)
int NumLines = lineOffset+1;
sprintf(ReportBuffer[NumLines], TXT_ReportDate);
CheckTime(current_time, 200000);
// Mount the SD Card
current_time=gettick();
printLoading(MSG_MountSD);
usleep(200000);
MountSD();
CheckTime(current_time, 200000);
// Initialise the FAT file system
current_time=gettick();
printLoading(MSG_InitFAT);
usleep(200000);
if (!fatInitDefault())
{
sprintf(MSG_Buffer, ERR_InitFAT);
@ -1080,6 +1091,7 @@ int main(int argc, char **argv)
} else {
//chdir("/");
// Create the report
CheckTime(current_time, 200000);
FILE *file = fopen(REPORT, "w");
if(!file)
@ -1097,6 +1109,7 @@ int main(int argc, char **argv)
fclose(file);
printEndSuccess(MSG_ReportSuccess);
CheckTime(current_time, 200000);
}
// Create hash log
@ -1115,8 +1128,9 @@ int main(int argc, char **argv)
}
// Close the report
fclose(file);
current_time=gettick();
printEndSuccess(MSG_ReportSuccess);
CheckTime(current_time, 200000);
}
}
@ -1125,8 +1139,7 @@ int main(int argc, char **argv)
WPAD_Init();
bool reportIsDisplayed = false;
while (1) {
WPAD_ScanPads();
wpressed = WPAD_ButtonsHeld(0);
wpressed = DetectInput(DI_BUTTONS_HELD);
// Return to the loader
if (wpressed & WPAD_BUTTON_HOME) {

View File

@ -86,3 +86,66 @@ void NandShutdown(void)
NandInitialized = false;
}
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
{
if (DownOrHeld == DI_BUTTONS_DOWN) {
pressed = WPAD_ButtonsDown(0) | WPAD_ButtonsDown(1) | WPAD_ButtonsDown(2) | WPAD_ButtonsDown(3); //Store pressed buttons
} else {
pressed = WPAD_ButtonsHeld(0) | WPAD_ButtonsHeld(1) | WPAD_ButtonsHeld(2) | WPAD_ButtonsHeld(3); //Store pressed buttons
}
// Convert to wiimote values
if (pressed & WPAD_CLASSIC_BUTTON_ZR) pressed |= WPAD_BUTTON_PLUS;
if (pressed & WPAD_CLASSIC_BUTTON_ZL) pressed |= WPAD_BUTTON_MINUS;
if (pressed & WPAD_CLASSIC_BUTTON_PLUS) pressed |= WPAD_BUTTON_PLUS;
if (pressed & WPAD_CLASSIC_BUTTON_MINUS) pressed |= WPAD_BUTTON_MINUS;
if (pressed & WPAD_CLASSIC_BUTTON_A) pressed |= WPAD_BUTTON_A;
if (pressed & WPAD_CLASSIC_BUTTON_B) pressed |= WPAD_BUTTON_B;
if (pressed & WPAD_CLASSIC_BUTTON_X) pressed |= WPAD_BUTTON_2;
if (pressed & WPAD_CLASSIC_BUTTON_Y) pressed |= WPAD_BUTTON_1;
if (pressed & WPAD_CLASSIC_BUTTON_HOME) pressed |= WPAD_BUTTON_HOME;
if (pressed & WPAD_CLASSIC_BUTTON_UP) pressed |= WPAD_BUTTON_UP;
if (pressed & WPAD_CLASSIC_BUTTON_DOWN) pressed |= WPAD_BUTTON_DOWN;
if (pressed & WPAD_CLASSIC_BUTTON_LEFT) pressed |= WPAD_BUTTON_LEFT;
if (pressed & WPAD_CLASSIC_BUTTON_RIGHT) pressed |= WPAD_BUTTON_RIGHT;
}
// Return Classic Controller and Wii Remote values
if (pressed) return pressed;
// No buttons on the Wii remote or Classic Controller were pressed
if (PAD_ScanPads() > PAD_ERR_NONE)
{
if (DownOrHeld == DI_BUTTONS_HELD) {
gcpressed = PAD_ButtonsHeld(0) | PAD_ButtonsHeld(1) | PAD_ButtonsHeld(2) | PAD_ButtonsHeld(3); //Store pressed buttons
} else {
gcpressed = PAD_ButtonsDown(0) | PAD_ButtonsDown(1) | PAD_ButtonsDown(2) | PAD_ButtonsDown(3); //Store pressed buttons
}
if (gcpressed) {
// Button on GC controller was pressed
if (gcpressed & PAD_TRIGGER_Z) pressed |= WPAD_NUNCHUK_BUTTON_Z;
if (gcpressed & PAD_TRIGGER_R) pressed |= WPAD_BUTTON_PLUS;
if (gcpressed & PAD_TRIGGER_L) pressed |= WPAD_BUTTON_MINUS;
if (gcpressed & PAD_BUTTON_A) pressed |= WPAD_BUTTON_A;
if (gcpressed & PAD_BUTTON_B) pressed |= WPAD_BUTTON_B;
if (gcpressed & PAD_BUTTON_X) pressed |= WPAD_BUTTON_1;
if (gcpressed & PAD_BUTTON_Y) pressed |= WPAD_BUTTON_2;
if (gcpressed & PAD_BUTTON_MENU) pressed |= WPAD_BUTTON_HOME;
if (gcpressed & PAD_BUTTON_UP) pressed |= WPAD_BUTTON_UP;
if (gcpressed & PAD_BUTTON_LEFT) pressed |= WPAD_BUTTON_LEFT;
if (gcpressed & PAD_BUTTON_DOWN) pressed |= WPAD_BUTTON_DOWN;
if (gcpressed & PAD_BUTTON_RIGHT) pressed |= WPAD_BUTTON_RIGHT;
}
}
return pressed;
}

View File

@ -5,7 +5,6 @@
#include <malloc.h>
#include <network.h>
#include "update.h"
#include "gecko.h"
#include "http.h"

View File

@ -53,7 +53,7 @@ char *url_encode(char *str) {
void transmitSyscheck(char ReportBuffer[200][100], int *lines) {
printLoadingBar(TXT_Upload, 0);
gprintf("TempReport bauen\n");
gprintf("TempReport built\n");
int i = 0;
int strl = 0;
@ -62,7 +62,7 @@ void transmitSyscheck(char ReportBuffer[200][100], int *lines) {
strl += strlen(ReportBuffer[i]);
strl += strlen("\n");
}
printLoadingBar(TXT_Upload, 5);
printLoadingBar(TXT_Upload, 20);
char tempReport[strl];
memset(tempReport, 0, strl);
for (i = 0; i <= *lines; i++) {
@ -70,25 +70,24 @@ void transmitSyscheck(char ReportBuffer[200][100], int *lines) {
strcat(tempReport, ReportBuffer[i]);
strcat(tempReport, "\n");
}
printLoadingBar(TXT_Upload, 30);
printLoadingBar(TXT_Upload, 40);
net_init();
printLoadingBar(TXT_Upload, 60);
gprintf("OK\n");
char *encodedReport = url_encode(tempReport);
char bufTransmit[18+strlen(encodedReport)];
char password[12] = {0};
//char password[12] = {0};
gprintf("OK2\n");
sprintf(bufTransmit, "password=%s&syscheck=%s", password, encodedReport);
//sprintf(bufTransmit, "password=%s&syscheck=%s", password, encodedReport);
sprintf(bufTransmit, "password=B277eNGp789a&syscheck=%s", encodedReport);
gprintf("bufTransmit: %s ENDE len:%u\n", bufTransmit, strlen(bufTransmit));
gprintf("OK3\n");
char host[48] = {"\0"};
char host[48];
sprintf(host, "http://syscheck.softwii.de/syscheck_receiver.php");
http_post(host, 1024, bufTransmit);
printLoadingBar(TXT_Upload, 80);
gprintf("OK4\n");
gprintf("\n");
gprintf("OK4\n\n");
u32 http_status;
u8* outbuf;
@ -106,35 +105,21 @@ void transmitSyscheck(char ReportBuffer[200][100], int *lines) {
free(outbuf);
gprintf("len: %d, String: %s\n", lenght, ReportBuffer[*lines]);
u32 wpressed;
//u32 wpressed;
if (!strncmp(ReportBuffer[*lines], "ERROR: ", 7)) {
char temp[100];
strncpy(temp, ReportBuffer[*lines]+7, 100);
char temp[100] = {0};
strncpy(temp, ReportBuffer[*lines]+7, sizeof(temp));
printUploadError(temp);
memset(ReportBuffer[*lines], 0, 100);
(*lines)--;
(*lines)--;
while (1) {
WPAD_ScanPads();
wpressed = WPAD_ButtonsHeld(0);
if (wpressed & WPAD_BUTTON_A) {
break;
}
}
} else {
printUploadSuccess(ReportBuffer[*lines]);
}
while (1) {
WPAD_ScanPads();
wpressed = WPAD_ButtonsHeld(0);
if (wpressed & WPAD_BUTTON_A) {
break;
if (DetectInput(DI_BUTTONS_HELD) & WPAD_BUTTON_A) break;
}
}
}
free(encodedReport);
net_deinit();
}