Exemple #1
0
void PolfHack()
{		
	float OutputValue;

#if POLF_RAM_TUNING
	if(pRamVariables->POLFRamFlag = 0x01)
	{
		OutputValue = Pull3DHooked(&FuelRamTable, *pEngineLoad, *pEngineSpeed);
	}
	else
	{
#endif
	
	OutputValue	= BlendAndSwitch(FuelTableGroup, *pEngineLoad, *pEngineSpeed);
		
#if POLF_RAM_TUNING
	}
#endif
	pRamVariables->LCFuelEnrich = Pull3DHooked(&LCFuelEnrichTable, *pVehicleSpeed, *pEngineSpeed) * pRamVariables->LCFuelEnrichMultiplier;
	
	if(pRamVariables->LCFuelMode == LCFuelModeCompensated)
	{
		OutputValue += pRamVariables->LCFuelEnrich;
	}
	//Now run existing code!
	
	pRamVariables->PolfTarget = OutputValue;
	
	if(pRamVariables->PolfHackEnabled == 0)
		pRamVariables->PolfOutput = pRamVariables->PolfTarget;
	else
		pRamVariables->PolfOutput = Pull3DHooked((void*)PrimaryOEMPolfTable, *pEngineLoad, *pEngineSpeed);	
		
	PolfHooked();
}
Exemple #2
0
void TargetBoostHack()
{
		//Calculated gear is a BYTE!
	float cgear = (char)*pCurrentGear;
	float PGTBComp;
	float TargetBoost;

	#if PGWG_RAMTUNING
		if(pRamVariables->PGWGRamFlag = 0x01)
		{
			PGTBComp = Pull3DHooked(&PGTBRamTable, cgear, *pEngineSpeed);
		}
		else
		{
	#endif
		
	#if SWITCH_HACKS
		PGTBComp = BlendAndSwitch(PGTBTableGroup, cgear, *pEngineSpeed);
	#else
		PGTBComp = Pull3DHooked(PGTBTable1i, cgear, *pEngineSpeed);
	#endif
		
	#if PGTB_RAMTUNING
		}
	#endif
	
	
	#if TARGET_BOOST_RAMTUNING
		if(pRamVariables->TargetBoostRamFlag = 0x01)
		{
			TargetBoost = Pull3DHooked(&TargetBoostRamTable, *pReqTorque, *pEngineSpeed);
		}
		else
		{
	#endif

	#if SWITCH_HACKS
		TargetBoost = BlendAndSwitch(TargetBoostTableGroup, *pReqTorque, *pEngineSpeed);
	#else
		TargetBoost = Pull3DHooked(TargetBoostTable1i, *pReqTorque, *pEngineSpeed);
	#endif
	
	#if TARGET_BOOST_RAMTUNING
		}
	#endif
	
	pRamVariables->PGTBComp = PGTBComp;
	pRamVariables->TargetBoost = TargetBoost * PGTBComp;
	
}
Exemple #3
0
float SwitchSelect(TableSubSet tss, float xLookup, float yLookup)
{
	float OutputValue;
		switch(pRamVariables->MapSwitch)
		{
			case MapSwitch3:
			OutputValue = Pull3DHooked(tss.TableSS, xLookup, yLookup);
			break;
			
			case MapSwitch2:
			OutputValue = Pull3DHooked(tss.TableS, xLookup, yLookup);
			break;
			
			default:
			OutputValue = Pull3DHooked(tss.TableI, xLookup, yLookup);
			break;
		}
	return OutputValue;
}
Exemple #4
0
float Pull3DRamHook(float* table, float xLookup, float yLookup)
{
	//Check if r4 is ram or not??
	//WARNING: cannot use LOOKUP TABLES in this region (pRamVariables)!!!
	//Lookup tables must be static or this needs to change.
	if(((void*)table > (void*)&(pRamVariables->MasterInitFlag)) && ((void*)table < (void*)&(pRamVariables->RamHoleEndMarker)))
	{
		return *table;
	}
	else
	{
		return Pull3DHooked((ThreeDTable*)table, xLookup, yLookup);
	}
}
Exemple #5
0
float ComputeMassAirFlow(TwoDTable* MafScalingTable, float MafVoltage)
{
    pRamVariables->MafFromSensor = Pull2DHooked(MafScalingTable,MafVoltage);

#if VE_RAMTUNING
    if(pRamVariables->VERamFlag == 0x01)
    {
        pRamVariables->VolumetricEfficiency = Pull3DHooked(&VolumetricEfficiencyRamTable, *pManifoldAbsolutePressure, *pEngineSpeed);
    }
    else
    {
#endif

#if SWITCH_HACKS
        pRamVariables->VolumetricEfficiency = BlendAndSwitch(VETableGroup, *pManifoldAbsolutePressure, *pEngineSpeed);
#else
        pRamVariables->VolumetricEfficiency = Pull3DHooked(&VolumetricEfficiencyTable1, *pManifoldAbsolutePressure, *pEngineSpeed);
#endif

#if VE_RAMTUNING
    }
#endif

    float intakeAirTempInKelvin = (*pIntakeAirTemp) + CelsiusToKelvin;

    pRamVariables->AtmosphericCompensation = Pull3DHooked(&AtmosphericCompensationTable, *pManifoldAbsolutePressure, *pAtmoPress);
#if SD_DMAP
    pRamVariables->DeltaMapCompensation = Pull3DHooked(&SDDeltaMapTable, *pDeltaMap, *pEngineSpeed);
#endif

    pRamVariables->MafFromSpeedDensity =
        Displacement *
        (*pEngineSpeed) *
        (*pManifoldAbsolutePressure) *
        pRamVariables->VolumetricEfficiency *
        pRamVariables->AtmosphericCompensation *
#if SD_DMAP
        pRamVariables->DeltaMapCompensation *
#endif
        SpeedDensityConstant / intakeAirTempInKelvin;

#if VE_RAMTUNING
    if (pRamVariables->MafMode == MafModeSpeedDensity || pRamVariables->VERamFlag == 0x01)
#else
    if (pRamVariables->MafMode == MafModeSpeedDensity)
#endif
    {
        return pRamVariables->MafFromSpeedDensity;
    }
    else if (pRamVariables->MafMode == MafModeBlending)
    {
        pRamVariables->SDMafBlendRatio = Pull3DHooked(&SDBlendingTable, *pManifoldAbsolutePressure, *pEngineSpeed);

        pRamVariables->SDMafFromBlend =
            ((pRamVariables->MafFromSpeedDensity * pRamVariables->SDMafBlendRatio) +
             (pRamVariables->MafFromSensor *
              (1 - pRamVariables->SDMafBlendRatio)));

        return pRamVariables->SDMafFromBlend;
    }
    else
    {
        return pRamVariables->MafFromSensor;
    }
}
Exemple #6
0
void WGDCHack()
{

#if WGDC_MAIN_HOOK
EcuHacksMain();
#endif

#if BOOST_HACKS	

	//Calculated gear is a BYTE!
	float cgear = (char)*pCurrentGear;
	float PGWGInitial;
	float PGWGMax;
	float WGDCInitialComp;
	float WGDCMaxComp;

	#if PGWG_RAMTUNING
		if(pRamVariables->PGWGRamFlag = 0x01)
		{
			PGWGInitial = Pull3DHooked(&PGWGRamTable, cgear, *pEngineSpeed);
			PGWGMax = PGWGInitial;
		}
		else
		{
	#endif
	
	#if SWITCH_HACKS
		PGWGInitial = BlendAndSwitch(PGWGTableGroup, cgear, *pEngineSpeed);
		PGWGMax = PGWGInitial;
	#else
		PGWGInitial = Pull3DHooked(PGWGTable1i, cgear, *pEngineSpeed);
		PGWGMax = PGWGInitial;
	#endif

	#if PGWG_RAMTUNING
		}
	#endif


	#if WGDC_RAMTUNING
		if(pRamVariables->WGDCInitialRamFlag = 0x01)
		{
			WGDCInitialComp = Pull3DHooked(&WGDCInitialRamTable, *pReqTorque, *pEngineSpeed);
			WGDCMaxComp = Pull3DHooked(&WGDCMaxRamTable, *pReqTorque, *pEngineSpeed);
		}
		else
		{
	#endif
	
	#if SWITCH_HACKS
		WGDCInitialComp = BlendAndSwitch(WGDCInitialTableGroup, *pReqTorque, *pEngineSpeed);
		WGDCMaxComp = BlendAndSwitch(WGDCMaxTableGroup, *pReqTorque, *pEngineSpeed);
	#else
		WGDCInitialComp = Pull3DHooked(WGDCInitialTable1i, *pReqTorque, *pEngineSpeed);
		WGDCMaxComp = Pull3DHooked(WGDCMaxTable1i, *pReqTorque, *pEngineSpeed);
	#endif
	
	#if WGDC_RAMTUNING
		}
	#endif
	
	pRamVariables->PGWGMaxComp = WGDCMaxComp;
	pRamVariables->PGWGInitialComp = WGDCInitialComp;
	PGWGInitial *= WGDCInitialComp;
	PGWGMax *= WGDCMaxComp;
	pRamVariables->WGDCInitialTarget = PGWGInitial;
	pRamVariables->WGDCMaxTarget = PGWGMax;
	
	if(pRamVariables->BoostHackEnabled == HackEnabled)
	{
		#if PROG_MODE
		if(pRamVariables->ValetMode == ValetModeEnabled)
		{
			pRamVariables->WGDCInitialOutput = WGDCInitialComp * Pull3DHooked(&PGWGTableValetMode, *pReqTorque, *pEngineSpeed);
			pRamVariables->WGDCMaxOutput = WGDCMaxComp * Pull3DHooked(&PGWGTableValetMode, *pReqTorque, *pEngineSpeed);
		}
		#endif
		#if WGDC_LOCK
		#if PROG_MODE
		else
		#else
		else if
		#endif
		//Apply locks
		(*pEngineSpeed < RPMLockWGDC && *pThrottlePlate > ThrottleLockWGDC)
		{
			pRamVariables->WGDCInitialOutput = 100.0;
			pRamVariables->WGDCMaxOutput = 100.0;
		}
		#endif
		#if WGDC_LOCK || PROG_MODE
		else
		#endif
		{
			pRamVariables->WGDCInitialOutput = PGWGInitial;
			pRamVariables->WGDCMaxOutput = PGWGMax;	
		}
	}
	else
	{
Exemple #7
0
			pRamVariables->WGDCInitialOutput = 100.0;
			pRamVariables->WGDCMaxOutput = 100.0;
		}
		#endif
		#if WGDC_LOCK || PROG_MODE
		else
		#endif
		{
			pRamVariables->WGDCInitialOutput = PGWGInitial;
			pRamVariables->WGDCMaxOutput = PGWGMax;	
		}
	}
	else
	{
		//TODO: Might need to use conditionals here! Do some roms use Requested Torque lookups??
		pRamVariables->WGDCInitialOutput = Pull3DHooked((void*)OEMWGDCInitialTable, *pThrottlePlate, *pEngineSpeed);
		pRamVariables->WGDCMaxOutput = Pull3DHooked((void*)OEMWGDCMaxTable, *pThrottlePlate, *pEngineSpeed);	
	}
		
#endif

	//Finish Pulling WGDC
	WGDCHooked();
	
#if BOOST_HACKS
	TargetBoostHack();
#endif
}

#if BOOST_HACKS
void TargetBoostHack()
Exemple #8
0
void WGDCHack()
{

EcuHacksMain();

#if BOOST_HACKS	

	//Calculated gear is a BYTE!
	float cgear = (char)*pCurrentGear;
	float PGWGComp;
	float WGDCInitial;
	float WGDCMax;

	#if PGWG_RAMTUNING
		if(pRamVariables->PGWGRamFlag = 0x01)
		{
			PGWGComp = Pull3DHooked(&PGWGRamTable, cgear, *pEngineSpeed);
		}
		else
		{
	#endif
	
	#if SWITCH_HACKS
		PGWGComp = BlendAndSwitch(PGWGTableGroup, cgear, *pEngineSpeed);
	#else
		PGWGComp = Pull3DHooked(PGWGTable1i, cgear, *pEngineSpeed);
	#endif

	#if PGWG_RAMTUNING
		}
	#endif


	#if WGDC_RAMTUNING
		if(pRamVariables->WGDCInitialRamFlag = 0x01)
		{
			WGDCInitial = Pull3DHooked(&WGDCInitialRamTable, *pReqTorque, *pEngineSpeed);
			WGDCMax = Pull3DHooked(&WGDCMaxRamTable, *pReqTorque, *pEngineSpeed);
		}
		else
		{
	#endif
	
	#if SWITCH_HACKS
		WGDCInitial = BlendAndSwitch(WGDCInitialTableGroup, *pReqTorque, *pEngineSpeed);
		WGDCMax = BlendAndSwitch(WGDCMaxTableGroup, *pReqTorque, *pEngineSpeed);
	#else
		WGDCInitial = Pull3DHooked(WGDCInitialTable1i, *pReqTorque, *pEngineSpeed);
		WGDCMax = Pull3DHooked(WGDCMaxTable1i, *pReqTorque, *pEngineSpeed);
	#endif
	
	#if WGDC_RAMTUNING
		}
	#endif
	
	pRamVariables->PGWGComp = PGWGComp;
	
	#if WGDC_LOCK
	//Apply locks
	if(*pEngineSpeed < RPMLockWGDC && *pThrottlePlate > ThrottleLockWGDC)
	{
		pRamVariables->WGDCInitial = 100.0;
		pRamVariables->WGDCMax = 100.0;
	}
	else{
	#endif
	
	pRamVariables->WGDCInitial = WGDCInitial * PGWGComp;
	pRamVariables->WGDCMax = WGDCMax * PGWGComp;
	
	#if WGDC_LOCK
	}
	#endif
	
#endif

	//Finish Pulling WGDC
	WGDCHooked();
	
#if BOOST_HACKS
	TargetBoostHack();
#endif
}