Ejemplo n.º 1
0
BOOL	CMD_NESINFO (void)
{
	char Version[256];
	int i;
	OpenStatus(topHWnd);
	InitPort();
	if (HWVer == 1)
	{
		if (ParPort == -1)
		{
			StatusText("CopyNES did not return a version reply!");
			StatusOK();
			return FALSE;
		}
		else
		{
			StatusText("CopyNES did not return a version reply, assuming version 1");
			StatusOK();
			return TRUE;
		}
	}
	StatusText("Retrieving internal version string...");
	if (!WriteByteEx(0xA1,3,FALSE))
	{
		StatusText("Failed to request version string!");
		StatusOK();
		return FALSE;
	}

	for (i = 0; i < 256; i++)
	{
		if (!ReadByteEx(&Version[i],1,FALSE))
		{
			StatusText("Error reading version string!");
			StatusOK();
			return FALSE;
		}
		if (!Version[i])
			break;
	}
	StatusText(Version);

	StatusOK();
	return TRUE;
}
Ejemplo n.º 2
0
extern "C" BOOL WriteBlock (BYTE* blockdata, int size)
{
	int i;
	if (ParPort == -1)
	{
		DWORD BytesWritten = 0;
  		if(usb_timeout_error) return FALSE;
		FT_SetTimeouts(ftHandleA,10000,0);
		ftStatus = FT_Write(ftHandleA, (LPVOID)blockdata, size, &BytesWritten);
		if (ftStatus == FT_OK)
		{ 
			if (BytesWritten == size) 
			{ 
				// FT_Read OK
				return TRUE;
			} 
			else 
			{ 
				// FT_Write Timeout 
				MessageBox(topHWnd, "USB Error: Write Timeout", "WriteBlock", MB_OK | MB_ICONERROR);
				return FALSE;  
			} 
		} 
		else 
		{ 
			// FT_Write Failed 
			StatusText("FT STATUS = %i", ftStatus);
			MessageBox(topHWnd, "USB Error: Write Failed", "WriteBlock", MB_OK | MB_ICONERROR);
			return FALSE;  
		}
	}
	else
	{
		BOOL success;
		for (i = 0; i < size; i++)
		{
			success = WriteByteEx(blockdata[i], 10, TRUE);
			if (!success)
				return FALSE;
		}
		return TRUE;
	}
}
Ejemplo n.º 3
0
BOOL	WriteByteSilent (BYTE data)
{
	return WriteByteEx(data, 10, FALSE);
}
Ejemplo n.º 4
0
BOOL	WriteByte (BYTE data)
{
	return WriteByteEx(data, 10, TRUE);
}