bool LH_MonitoringSource_Fraps::doUpdate() { #ifndef Q_OS_WIN return false; #else HMODULE frapsDLL; FRAPS_SHARED_DATA *fsd; #ifdef Q_PROCESSOR_X86_32 frapsDLL = GetModuleHandleA("FRAPS32.DLL"); #else frapsDLL = GetModuleHandleA("FRAPS64.DLL"); #endif bool resultVal = false; setDataAvailable(frapsDLL != NULL); if(!dataAvailable()) // Not running pingFraps(); else { FrapsSharedData = (FRAPS_SHARED_DATA *(WINAPI *)()) GetProcAddress(frapsDLL, "FrapsSharedData"); if (!FrapsSharedData) { qWarning() << "This version of Fraps is incompatible with LCDHost: Fraps 1.9C or later is required!"; } else { fsd = FrapsSharedData(); updateValue("Current FPS","","",(int)fsd->currentFPS, fps_); updateValue("Game Name","","",fsd->gameName); //updateValue("Total Frames","","",(int)fsd->totalFrames); //updateValue("Time of Last Frame","","",(int)fsd->timeOfLastFrame); resultVal = true; } } return resultVal; #endif }
bool LH_FrapsData::getData(float& value, QString& text, QString& units) { #ifdef Q_WS_WIN HMODULE frapsDLL; FRAPS_SHARED_DATA *fsd; frapsDLL = GetModuleHandleA("FRAPS32.DLL"); value = 0; text = "N/A"; units = ""; float resultVal = false; if (!frapsDLL) { //setup_FPS_->setValue("Not running"); pingFraps(); resultVal = false; } else { FrapsSharedData = (FRAPS_SHARED_DATA *(WINAPI *)()) GetProcAddress(frapsDLL, "FrapsSharedData"); if (!FrapsSharedData){ //setup_FPS_->setValue("Needs Fraps 1.9C or later!"); resultVal = false; } else { if(ui_->value(mon_item) == -1) { //setup_FPS_->setValue("No option selected"); resultVal = false; } else { fsd = FrapsSharedData(); text = ""; if(ui_->valueText(mon_item) == "Current FPS") { value = fsd->currentFPS; units = "FPS"; } if(ui_->valueText(mon_item) == "Game Name") text = QString(fsd->gameName); if(ui_->valueText(mon_item) == "Total Frames") value = fsd->totalFrames; if(ui_->valueText(mon_item) == "Time of Last Frame") value = fsd->timeOfLastFrame; //setup_FPS_->setValue((text==""? QString::number(value) : text) + units); resultVal = true; } } } return resultVal; #else Q_UNUSED(value); Q_UNUSED(text); Q_UNUSED(units); return false; #endif }