Exemplo n.º 1
0
int gprintf( const char *str, ... )
{
	if( IsWiiU() )
	{
		if(wiiu_done == true)
			return 0;

		// We're running on a vWii, log the results to a file
		
		// Open the file if it hasn't been already
		if (nl_log == NULL)
		{
			char LogPath[20];
			sprintf(LogPath, "%s:/nloader.log", GetRootDevice());
			nl_log = fopen(LogPath, "w");
		}
		if (nl_log != NULL)
		{
			va_list ap;
			va_start(ap,str);
			vfprintf(nl_log, str, ap); // No need for a buffer, goes straight to the file
			// Flushes the stream so we don't have to wait for the file to close or it to fill
			fflush(nl_log);
			va_end(ap);
		} else {
			return -1; // Couldn't open the file
		}
	} else {
		// We're running on a real Wii, send the results to a USB Gecko
		if(!GeckoFound)
			return 0; // No USB Gecko found

		char astr[4096] = {0};

		va_list ap;
		va_start(ap,str);
		vsnprintf(astr, sizeof(astr), str, ap);
		va_end(ap);
		int i = 0;
		while( astr[i] != '\0' )
		{
			EXISendByte( astr[i] );
			++i;
		}
	}

	return 1; // Everything went okay
}
Exemplo n.º 2
0
u32 TRISetupGames(char *Path, u32 CurDICMD, u32 ISOShift)
{
	u32 res = 0;
	FILE *f = NULL;
	u32 DOLOffset = 0;
	if(CurDICMD)
	{
		ReadRealDisc((u8*)&DOLOffset, 0x420+ISOShift, 4, CurDICMD);
		DOLOffset+=ISOShift;
	}
	else
	{
		char FullPath[300];
		snprintf(FullPath, sizeof(FullPath), "%s:%s", GetRootDevice(), Path);
		f = fopen(FullPath, "rb");
		if(f != NULL)
		{
			fseek(f, 0x420+ISOShift, SEEK_SET);
			fread(&DOLOffset, 1, 4, f);
			DOLOffset+=ISOShift;
		}
		else
		{
			char FSTPath[300];
			snprintf(FSTPath, sizeof(FSTPath), "%ssys/main.dol", FullPath);
			f = fopen(FSTPath, "rb");
		}
		if(f == NULL)
			return 0;
	}

	char SaveFile[128];
	if(DOLRead32(0x210320, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Mario Kart GP1\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_GP1);
		CreateNewFile(SaveFile, 0x45);
	}
	else if(DOLRead32(0x25C0AC, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Mario Kart GP2\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_GP2);
		CreateNewFile(SaveFile, 0x45);
	}
	else if(DOLRead32(0x1821C4, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Unk)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_UNK);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x181E60, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Rev C)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_RVC);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x18275C, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Rev E)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_RVE);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x01C2DF4, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 3 Ver 2002\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS3V02);
		CreateNewFile(SaveFile, 0x12);
	}
	else if(DOLRead32(0x01CF1C4, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 (Japan)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4JAP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x1C5514, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 (Export)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4EXP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x24B248, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 Ver 2006 (Japan)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4V06JAP);
		CreateNewFile(SaveFile, 0x2E);
	}
	else if(DOLRead32(0x20D7E8, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 Ver 2006 (Export)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4V06EXP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x26B3F4, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Gekitou Pro Yakyuu (Rev B)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_YAKRVB);
		CreateNewFile(SaveFile, 0xF5);
	}
	else if(DOLRead32(0x26D9B4, DOLOffset, f, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Gekitou Pro Yakyuu (Rev C)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_YAKRVC);
		CreateNewFile(SaveFile, 0x100);
	}

	if(f != NULL)
		fclose(f);
	return res;
}
Exemplo n.º 3
0
u32 TRISetupGames(char *Path, u32 CurDICMD, u32 ISOShift)
{
	u32 res = 0;
	u32 DOLOffset = 0;
	FIL f;
	FIL *fp = NULL;
	UINT read;
	FRESULT fres = FR_DISK_ERR;

	if(CurDICMD)
	{
		ReadRealDisc((u8*)&DOLOffset, 0x420+ISOShift, 4, CurDICMD);
		DOLOffset+=ISOShift;
	}
	else
	{
		char FullPath[260];
		snprintf(FullPath, sizeof(FullPath), "%s:%s", GetRootDevice(), Path);
		fres = f_open_char(&f, FullPath, FA_READ|FA_OPEN_EXISTING);
		if (fres == FR_OK)
		{
			f_lseek(&f, 0x420+ISOShift);
			f_read(&f, &DOLOffset, 4, &read);
			DOLOffset+=ISOShift;
		}
		else
		{
			char FSTPath[260];
			snprintf(FSTPath, sizeof(FSTPath), "%ssys/main.dol", FullPath);
			fres = f_open_char(&f, FSTPath, FA_READ|FA_OPEN_EXISTING);
		}

		if (fres != FR_OK)
			return 0;
		fp = &f;
	}

	// Create the save file if it doesn't already exist.
	char SaveFile[128];
	if(DOLRead32(0x210320, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Mario Kart Arcade GP (Feb 14 2006 13:09:48)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_GP1);
		CreateNewFile(SaveFile, 0x45);
	}
	else if(DOLRead32(0x25C0AC, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Mario Kart Arcade GP 2 (Feb 7 2007 02:47:24)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_GP2);
		CreateNewFile(SaveFile, 0x45);
	}
	else if(DOLRead32(0x181E60, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Rev C)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_RVC);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x1821C4, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Rev D)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_RVD);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x18275C, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:F-Zero AX (Rev E)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), CARD_NAME_AX);
		CreateNewFile(SaveFile, 0xCF);
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_AX_RVE);
		CreateNewFile(SaveFile, 0x2A);
	}
	else if(DOLRead32(0x01C2DF4, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 3 Ver 2002\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS3V02);
		CreateNewFile(SaveFile, 0x12);
	}
	else if(DOLRead32(0x01CF1C4, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 (Japan)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4JAP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x1C5514, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 (Export)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4EXP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x24B248, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 Ver 2006 (Japan)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4V06JAP);
		CreateNewFile(SaveFile, 0x2E);
	}
	else if(DOLRead32(0x20D7E8, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Virtua Striker 4 Ver 2006 (Export)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_VS4V06EXP);
		CreateNewFile(SaveFile, 0x2B);
	}
	else if(DOLRead32(0x26B3F4, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Gekitou Pro Yakyuu (Rev B)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_YAKRVB);
		CreateNewFile(SaveFile, 0xF5);
	}
	else if(DOLRead32(0x26D9B4, DOLOffset, fp, CurDICMD) == 0x386000A8)
	{
		res = 1;
		gprintf("TRI:Gekitou Pro Yakyuu (Rev C)\r\n");
		snprintf(SaveFile, sizeof(SaveFile), "%s:%s", GetRootDevice(), SETTINGS_YAKRVC);
		CreateNewFile(SaveFile, 0x100);
	}

	if (fres == FR_OK)
		f_close(&f);
	return res;
}