void ControlManager::UpdateControlDevices() { auto lock = _deviceLock.AcquireSafe(); //Reset update flag EmulationSettings::NeedControllerUpdate(); bool hadKeyboard = HasKeyboard(); ControlManager::_controlDevices.clear(); ControlManager::RegisterControlDevice(_systemActionManager); bool fourScore = EmulationSettings::CheckFlag(EmulationFlags::HasFourScore); ConsoleType consoleType = EmulationSettings::GetConsoleType(); ExpansionPortDevice expansionDevice = EmulationSettings::GetExpansionDevice(); if(consoleType != ConsoleType::Famicom) { expansionDevice = ExpansionPortDevice::None; } else if(expansionDevice != ExpansionPortDevice::FourPlayerAdapter) { fourScore = false; } for(int i = 0; i < (fourScore ? 4 : 2); i++) { shared_ptr<BaseControlDevice> device = CreateControllerDevice(GetControllerType(i), i); if(device) { ControlManager::RegisterControlDevice(device); } } if(fourScore && consoleType == ConsoleType::Nes) { //FourScore is only used to provide the signature for reads past the first 16 reads ControlManager::RegisterControlDevice(shared_ptr<FourScore>(new FourScore())); } shared_ptr<BaseControlDevice> expDevice = CreateExpansionDevice(expansionDevice); if(expDevice) { ControlManager::RegisterControlDevice(expDevice); } bool hasKeyboard = HasKeyboard(); if(!hasKeyboard) { EmulationSettings::DisableKeyboardMode(); } else if(!hadKeyboard && hasKeyboard) { EmulationSettings::EnableKeyboardMode(); } if(_mapperControlDevice) { ControlManager::RegisterControlDevice(_mapperControlDevice); } if(std::dynamic_pointer_cast<FamilyBasicKeyboard>(expDevice)) { //Automatically connect the data recorder if the keyboard is connected ControlManager::RegisterControlDevice(shared_ptr<FamilyBasicDataRecorder>(new FamilyBasicDataRecorder())); } }
void SimFastForward() { if(HasKeyboard()) { double gs=GPS_INFO.Speed*10.0; if (gs<100) gs=100; FindLatitudeLongitude(GPS_INFO.Latitude, GPS_INFO.Longitude, GPS_INFO.TrackBearing, gs, &GPS_INFO.Latitude, &GPS_INFO.Longitude); } }