コード例 #1
0
int DInputPad::TokenIn(uint8_t *buf, int len)
{
	int range = range_max(mType);

	// Setting to unpressed
	ZeroMemory(&mWheelData, sizeof(wheel_data_t));
	mWheelData.steering = range >> 1;
	mWheelData.clutch = 0xFF;
	mWheelData.throttle = 0xFF;
	mWheelData.brake = 0xFF;
	mWheelData.hatswitch = 0x8;

	//TODO Atleast GT4 detects DFP then
	if(sendCrap)
	{
		pad_copy_data(mType, buf, mWheelData);
		sendCrap = false;
		return len;
	}

	PollDevices();

	//Allow in both ports but warn in configure dialog that only one DX wheel is supported for now
	//if(idx == 0){
		//mWheelData.steering = 8191 + (int)(GetControl(STEERING, false)* 8191.0f) ;
		
		if(calibrating){
			//Alternate full extents
			if (alternate)calidata--;
			else calidata++;

			if(calidata>range-1 || calidata < 1) alternate = !alternate;  //invert

			mWheelData.steering = calidata;		//pass fake

			//breakout after 11 seconds
			if(GetTickCount()-calibrationtime > 11000){
				calibrating = false;
				mWheelData.steering = range >> 1;
			}
		}else{
コード例 #2
0
ファイル: titles.cpp プロジェクト: Luindy/priiloader
s8 CheckTitleOnSD(u64 id)
{
	//check Mounted Devices so that IF the SD is inserted it also gets mounted
	PollDevices();
	if (!(GetMountedValue() & 2)) //no SD mounted, lets bail out
		return -1;
	char title_ID[5];
	//Check app on SD. it might be there. not that it matters cause we can't boot from SD
	memset(title_ID,0,5);
	u32 title_l = id & 0xFFFFFFFF;
	memcpy(title_ID, &title_l, 4);
	for (s8 f=0; f<4; f++)
	{
		if(title_ID[f] < 0x20)
			title_ID[f] = '.';
		if(title_ID[f] > 0x7E)
			title_ID[f] = '.';
	}
	title_ID[4]='\0';
	char file[256] ATTRIBUTE_ALIGN(32);
	memset(file,0,256);
	sprintf(file, "fat:/private/wii/title/%s/content.bin", title_ID);
	FILE* SDHandler = fopen(file,"rb");
	if (SDHandler)
	{
		//content.bin is there meaning its on SD
		fclose(SDHandler);
		gprintf("CheckTitleOnSD : title is saved on SD\n");
		return 1;
	}
	else
	{
		//title isn't on SD either. ow well...
		gprintf("CheckTitleOnSD : content not found on NAND or SD for %08X\\%08X\n",(u32)(id >> 32),title_l);
		return 0;
	}
}