bool FTNoIR_Protocol::checkServerInstallationOK()
{   
	QSettings settings("Freetrack", "FreetrackClient");							// Registry settings (in HK_USER)
	QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location");	// Registry settings (in HK_USER)
	QString aLocation;															// Location of Client DLL

	qDebug() << "checkServerInstallationOK says: Starting Function";

    //
    // Write the path in the registry (for FreeTrack and FreeTrack20), for the game(s).
    //
    aLocation =  QCoreApplication::applicationDirPath() + "/";

    qDebug() << "checkServerInstallationOK says: used interface = " << intUsedInterface;
    switch (intUsedInterface) {
        case 0:									// Use both interfaces
            settings.setValue( "Path" , aLocation );
            settingsTIR.setValue( "Path" , aLocation );
            break;
        case 1:									// Use FreeTrack, disable TrackIR
            settings.setValue( "Path" , aLocation );
            settingsTIR.setValue( "Path" , "" );
            break;
        case 2:									// Use TrackIR, disable FreeTrack
            settings.setValue( "Path" , "" );
            settingsTIR.setValue( "Path" , aLocation );
            break;
        default:
            // should never be reached
        break;
    }

    //
    // TIRViews must be started first, or the NPClient DLL will never be loaded.
    //
    if (useTIRViews) {
        start_tirviews();
    }

    //
    // Check if TIRViews or dummy TrackIR.exe is required for this game
    //
    if (useDummyExe) {
        start_dummy();
    }
    
    if (!shm.success())
        return false;
    
    pMemData->data.DataID = 1;
    pMemData->data.CamWidth = 100;
    pMemData->data.CamHeight = 250;
    pMemData->GameID2 = 0;
    memset(pMemData->table, 0, 8);
    
	return true;
}
void FTControls::selectDLL() {
    QString fileName = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)"));

    //
    // Write the location of the file in the required Registry-key.
    //
    if (! fileName.isEmpty() ) {
        if (fileName.endsWith("NPClient.dll", Qt::CaseInsensitive) ) {
            QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location");			// Registry settings (in HK_USER)
            QString aLocation = fileName.left(fileName.length() - 12);							// Location of Client DLL

            settingsTIR.setValue( "Path" , aLocation );
        }
    }
}
Example #3
0
bool FTNoIR_Protocol::checkServerInstallationOK()
{   
	QSettings settings("Freetrack", "FreetrackClient");							// Registry settings (in HK_USER)
	QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location");	// Registry settings (in HK_USER)

    if (!shm.success())
        return false;

    QString aLocation =  QCoreApplication::applicationDirPath() + "/";

    switch (s.intUsedInterface) {
        case 0:									// Use both interfaces
            settings.setValue( "Path" , aLocation );
            settingsTIR.setValue( "Path" , aLocation );
            break;
        case 1:									// Use FreeTrack, disable TrackIR
            settings.setValue( "Path" , aLocation );
            settingsTIR.setValue( "Path" , "" );
            break;
        case 2:									// Use TrackIR, disable FreeTrack
            settings.setValue( "Path" , "" );
            settingsTIR.setValue( "Path" , aLocation );
            break;
        default:
            break;
    }

    if (s.useTIRViews) {
        start_tirviews();
    }

    // more games need the dummy executable than previously thought
    start_dummy();

    pMemData->data.DataID = 1;
    pMemData->data.CamWidth = 100;
    pMemData->data.CamHeight = 250;
    pMemData->GameID2 = 0;
    memset(pMemData->table, 0, 8);
    
	return true;
}