示例#1
0
void GeckoSendBuffer( char *buffer )
{
	int i = 0;
	while( buffer[i] != '\0' )
	{
		EXISendByte( buffer[i] );
		++i;
	}

	return;
}
示例#2
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
}