Page 1 of 1
[HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 8:53 am
by nicolaus
Hi all,
i need a bit help with converting a header file to PB.
In the Header file is the follow section
Code: Select all
enum class PenaltyShortcut : int {
None,
DriveThrough_Cutting,
StopAndGo_10_Cutting,
StopAndGo_20_Cutting,
StopAndGo_30_Cutting,
Disqualified_Cutting,
RemoveBestLaptime_Cutting,
DriveThrough_PitSpeeding,
StopAndGo_10_PitSpeeding,
StopAndGo_20_PitSpeeding,
StopAndGo_30_PitSpeeding,
Disqualified_PitSpeeding,
RemoveBestLaptime_PitSpeeding,
Disqualified_IgnoredMandatoryPit,
PostRaceTime,
Disqualified_Trolling,
Disqualified_PitEntry,
Disqualified_PitExit,
Disqualified_WrongWay,
DriveThrough_IgnoredDriverStint,
Disqualified_IgnoredDriverStint,
Disqualified_ExceededDriverStintLimit,
};
and a Structure what looks like thins:
Code: Select all
struct SPageFileGraphic
{
...
PenaltyShortcut penalty = PenaltyShortcut::None;
...
};
Can you please help me to translate this to PB?
Is the CPP "enum class" a simple enumeration in PB?
Thank you
Re: [HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 9:01 am
by Mijikai
Here:
Code: Select all
EnableExplicit
Enumeration PenaltyShortcut
#None
#DriveThrough_Cutting
#StopAndGo_10_Cutting
#StopAndGo_20_Cutting
#StopAndGo_30_Cutting
#Disqualified_Cutting
#RemoveBestLaptime_Cutting
#DriveThrough_PitSpeeding
#StopAndGo_10_PitSpeeding
#StopAndGo_20_PitSpeeding
#StopAndGo_30_PitSpeeding
#Disqualified_PitSpeeding
#RemoveBestLaptime_PitSpeeding
#Disqualified_IgnoredMandatoryPit
#PostRaceTime
#Disqualified_Trolling
#Disqualified_PitEntry
#Disqualified_PitExit
#Disqualified_WrongWay
#DriveThrough_IgnoredDriverStint
#Disqualified_IgnoredDriverStint
#Disqualified_ExceededDriverStintLimit
EndEnumeration
Structure SPageFileGraphic
penalty.l;<- check type!!!
EndStructure
Global spfg.SPageFileGraphic
spfg\penalty = #None
Is it for a hack?
Re: [HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 9:11 am
by nicolaus
Mijikai wrote:Here:
Is it for a hack?
First of all thank you, i will try it out.
No, it is not for a hack, it is for a official shared memory interface, from a game called Assetto Corsa Competitione (Race Sim), where i drive by my own in eSports.
With this shared memory interface it is posible to get a lot of telemetry data from the car and i want build a software to record and analysing this data and to see more detailed stuff in realtime.
More information can be found at
https://www.assettocorsa.net/forum/inde ... ion.59965/
br,
Nico
Re: [HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 9:21 am
by nicolaus
The full header looks like this
Code: Select all
#pragma once
enum class PenaltyShortcut : int {
None,
DriveThrough_Cutting,
StopAndGo_10_Cutting,
StopAndGo_20_Cutting,
StopAndGo_30_Cutting,
Disqualified_Cutting,
RemoveBestLaptime_Cutting,
DriveThrough_PitSpeeding,
StopAndGo_10_PitSpeeding,
StopAndGo_20_PitSpeeding,
StopAndGo_30_PitSpeeding,
Disqualified_PitSpeeding,
RemoveBestLaptime_PitSpeeding,
Disqualified_IgnoredMandatoryPit,
PostRaceTime,
Disqualified_Trolling,
Disqualified_PitEntry,
Disqualified_PitExit,
Disqualified_WrongWay,
DriveThrough_IgnoredDriverStint,
Disqualified_IgnoredDriverStint,
Disqualified_ExceededDriverStintLimit,
};
typedef int AC_STATUS;
#define AC_OFF 0
#define AC_REPLAY 1
#define AC_LIVE 2
#define AC_PAUSE 3
typedef int AC_SESSION_TYPE;
#define AC_UNKNOWN -1
#define AC_PRACTICE 0
#define AC_QUALIFY 1
#define AC_RACE 2
#define AC_HOTLAP 3
#define AC_TIME_ATTACK 4
#define AC_DRIFT 5
#define AC_DRAG 6
#define AC_HOTSTINT 7
#define AC_HOTLAPSUPERPOLE 8
typedef int AC_FLAG_TYPE;
#define AC_NO_FLAG 0
#define AC_BLUE_FLAG 1
#define AC_YELLOW_FLAG 2
#define AC_BLACK_FLAG 3
#define AC_WHITE_FLAG 4
#define AC_CHECKERED_FLAG 5
#define AC_PENALTY_FLAG 6
#pragma pack(push)
#pragma pack(4)
struct SPageFilePhysics
{
int packetId = 0;
float gas = 0;
float brake = 0;
float fuel = 0;
int gear = 0;
int rpms = 0;
float steerAngle = 0;
float speedKmh = 0;
float velocity[3];
float accG[3];
float wheelSlip[4];
float wheelLoad[4];
float wheelsPressure[4];
float wheelAngularSpeed[4];
float tyreWear[4];
float tyreDirtyLevel[4];
float tyreCoreTemperature[4];
float camberRAD[4];
float suspensionTravel[4];
float drs = 0;
float tc = 0;
float heading = 0;
float pitch = 0;
float roll = 0;
float cgHeight;
float carDamage[5];
int numberOfTyresOut = 0;
int pitLimiterOn = 0;
float abs = 0;
float kersCharge = 0;
float kersInput = 0;
int autoShifterOn = 0;
float rideHeight[2];
float turboBoost = 0;
float ballast = 0;
float airDensity = 0;
float airTemp = 0;
float roadTemp = 0;
float localAngularVel[3];
float finalFF = 0;
float performanceMeter = 0;
int engineBrake = 0;
int ersRecoveryLevel = 0;
int ersPowerLevel = 0;
int ersHeatCharging = 0;
int ersIsCharging = 0;
float kersCurrentKJ = 0;
int drsAvailable = 0;
int drsEnabled = 0;
float brakeTemp[4];
float clutch = 0;
float tyreTempI[4];
float tyreTempM[4];
float tyreTempO[4];
int isAIControlled;
float tyreContactPoint[4][3];
float tyreContactNormal[4][3];
float tyreContactHeading[4][3];
float brakeBias = 0;
float localVelocity[3];
int P2PActivations = 0;
int P2PStatus = 0;
int currentMaxRpm = 0;
float mz[4];
float fx[4];
float fy[4];
float slipRatio[4];
float slipAngle[4];
int tcinAction = 0;
int absInAction = 0;
float suspensionDamage[4];
float tyreTemp[4];
};
struct SPageFileGraphic
{
int packetId = 0;
AC_STATUS status = AC_OFF;
AC_SESSION_TYPE session = AC_PRACTICE;
wchar_t currentTime[15];
wchar_t lastTime[15];
wchar_t bestTime[15];
wchar_t split[15];
int completedLaps = 0;
int position = 0;
int iCurrentTime = 0;
int iLastTime = 0;
int iBestTime = 0;
float sessionTimeLeft = 0;
float distanceTraveled = 0;
int isInPit = 0;
int currentSectorIndex = 0;
int lastSectorTime = 0;
int numberOfLaps = 0;
wchar_t tyreCompound[33];
float replayTimeMultiplier = 0;
float normalizedCarPosition = 0;
int activeCars = 0;
float carCoordinates[60][3];
int carID[60];
int playerCarID = 0;
float penaltyTime = 0;
AC_FLAG_TYPE flag = AC_NO_FLAG;
PenaltyShortcut penalty = PenaltyShortcut::None;
int idealLineOn = 0;
int isInPitLane = 0;
float surfaceGrip = 0;
int mandatoryPitDone = 0;
float windSpeed = 0;
float windDirection = 0;
int isSetupMenuVisible = 0;
int mainDisplayIndex = 0;
int secondaryDisplayIndex = 0;
int TC = 0;
int TCCut = 0;
int EngineMap = 0;
int ABS = 0;
int fuelXLap = 0;
int rainLights = 0;
int flashingLights = 0;
int lightsStage = 0;
float exhaustTemperature = 0.0f;
int wiperLV = 0;
int DriverStintTotalTimeLeft = 0;
int DriverStintTimeLeft = 0;
int rainTyres = 0;
};
struct SPageFileStatic
{
wchar_t smVersion[15];
wchar_t acVersion[15];
// session static info
int numberOfSessions = 0;
int numCars = 0;
wchar_t carModel[33];
wchar_t track[33];
wchar_t playerName[33];
wchar_t playerSurname[33];
wchar_t playerNick[33];
int sectorCount = 0;
// car static info
float maxTorque = 0;
float maxPower = 0;
int maxRpm = 0;
float maxFuel = 0;
float suspensionMaxTravel[4];
float tyreRadius[4];
float maxTurboBoost = 0;
float deprecated_1 = -273;
float deprecated_2 = -273;
int penaltiesEnabled = 0;
float aidFuelRate = 0;
float aidTireRate = 0;
float aidMechanicalDamage = 0;
int aidAllowTyreBlankets = 0;
float aidStability = 0;
int aidAutoClutch = 0;
int aidAutoBlip = 0;
int hasDRS = 0;
int hasERS = 0;
int hasKERS = 0;
float kersMaxJ = 0;
int engineBrakeSettingsCount = 0;
int ersPowerControllerCount = 0;
float trackSPlineLength = 0;
wchar_t trackConfiguration[33];
float ersMaxJ = 0;
int isTimedRace = 0;
int hasExtraLap = 0;
wchar_t carSkin[33];
int reversedGridPositions = 0;
int PitWindowStart = 0;
int PitWindowEnd = 0;
int isOnline = 0;
};
#pragma pack(pop)
Re: [HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 9:22 am
by nicolaus
and my translation to PB (with your help) looks like this
Code: Select all
#AC_OFF = 0
#AC_REPLAY = 1
#AC_LIVE = 2
#AC_PAUSE = 3
#AC_PRACTICE = 0
#AC_QUALIFY = 1
#AC_RACE = 2
#AC_HOTLAP = 3
#AC_TIME_ATTACK = 4
#AC_DRIFT = 5
#AC_DRAG = 6
#AC_HOTSTINT = 7
#AC_HOTLAPSUPERPOLE = 8
#AC_NO_FLAG = 0
#AC_BLUE_FLAG = 1
#AC_YELLOW_FLAG = 2
#AC_BLACK_FLAG = 3
#AC_WHITE_FLAG = 4
#AC_CHECKERED_FLAG = 5
#AC_PENALTY_FLAG = 6
Enumeration PenaltyShortcut
#None
#DriveThrough_Cutting
#StopAndGo_10_Cutting
#StopAndGo_20_Cutting
#StopAndGo_30_Cutting
#Disqualified_Cutting
#RemoveBestLaptime_Cutting
#DriveThrough_PitSpeeding
#StopAndGo_10_PitSpeeding
#StopAndGo_20_PitSpeeding
#StopAndGo_30_PitSpeeding
#Disqualified_PitSpeeding
#RemoveBestLaptime_PitSpeeding
#Disqualified_IgnoredMandatoryPit
#PostRaceTime
#Disqualified_Trolling
#Disqualified_PitEntry
#Disqualified_PitExit
#Disqualified_WrongWay
#DriveThrough_IgnoredDriverStint
#Disqualified_IgnoredDriverStint
#Disqualified_ExceededDriverStintLimit
EndEnumeration
Structure SPageFilePhysics
packetId=0.l
gas=0.f
brake=0.f
fuel=0.f
gear=0.l
rpms=0.l
steerAngle=0.f
speedKmh=0.f
velocity.f[3]
accG.f[3]
wheelSlip.f[4]
wheelLoad.f[4]
wheelsPressure.f[4]
wheelAngularSpeed.f[4]
tyreWear.f[4]
tyreDirtyLevel.f[4]
tyreCoreTemperature.f[4]
camberRAD.f[4]
suspensionTravel.f[4]
drs=0.f
tc=0.f
heading=0.f
pitch=0.f
roll=0.f
cgHeight.f
carDamage.f[5]
numberOfTyresOut=0.l
pitLimiterOn=0.l
abs=0.f
kersCharge=0.f
kersInput=0.f
autoShifterOn=0.l
rideHeight.f[2]
turboBoost=0.f
ballast=0.f
airDensity=0.f
airTemp=0.f
roadTemp=0.f
localAngularVel.f[3]
finalFF=0.f
performanceMeter=0.f
engineBrake=0.l
ersRecoveryLevel=0.l
ersPowerLevel=0.l
ersHeatCharging=0.l
ersIsCharging=0.l
kersCurrentKJ=0.f
drsAvailable=0.l
drsEnabled=0.l
brakeTemp.f[4]
clutch=0.f
tyreTempI.f[4]
tyreTempM.f[4]
tyreTempO.f[4]
isAIControlled.l
tyreContactPoint.f[4][3]
tyreContactNormal.f[4][3]
tyreContactHeading.f[4][3]
brakeBias=0.f
localVelocity.f[3]
P2PActivations=0.l
P2PStatus=0.l
currentMaxRpm=0.l
mz.f[4]
fx.f[4]
fy.f[4]
slipRatio.f[4]
slipAngle.f[4]
tcinAction=0.l
absInAction=0.l
suspensionDamage.f[4]
tyreTemp.f[4]
EndStructure
Structure SPageFileGraphic
packetId=0.l
status=#AC_OFF
session=#AC_PRACTICE
currentTime.wchar_t[15]
lastTime.wchar_t[15]
bestTime.wchar_t[15]
split.wchar_t[15]
completedLaps=0.l
position=0.l
iCurrentTime=0.l
iLastTime=0.l
iBestTime=0.l
sessionTimeLeft=0.f
distanceTraveled=0.f
isInPit=0.l
currentSectorIndex=0.l
lastSectorTime=0.l
numberOfLaps=0.l
tyreCompound.wchar_t[33]
replayTimeMultiplier=0.f
normalizedCarPosition=0.f
activeCars=0.l
carCoordinates.f[60][3]
carID.l[60]
playerCarID=0.l
penaltyTime=0.f
flag=#AC_NO_FLAG
penalty.l
idealLineOn=0.l
isInPitLane=0.l
surfaceGrip=0.f
mandatoryPitDone=0.l
windSpeed=0.f
windDirection=0.f
isSetupMenuVisible=0.l
mainDisplayIndex=0.l
secondaryDisplayIndex=0.l
TC=0.l
TCCut=0.l
EngineMap=0.l
ABS=0.l
fuelXLap=0.l
rainLights=0.l
flashingLights=0.l
lightsStage=0.l
exhaustTemperature=0.0f.f
wiperLV=0.l
DriverStintTotalTimeLeft=0.l
DriverStintTimeLeft=0.l
rainTyres=0.l
EndStructure
Structure SPageFileStatic
smVersion.wchar_t[15]
acVersion.wchar_t[15]
numberOfSessions=0.l
numCars=0.l
carModel.wchar_t[33]
track.wchar_t[33]
playerName.wchar_t[33]
playerSurname.wchar_t[33]
playerNick.wchar_t[33]
sectorCount=0.l
maxTorque=0.f
maxPower=0.f
maxRpm=0.l
maxFuel=0.f
suspensionMaxTravel.f[4]
tyreRadius.f[4]
maxTurboBoost=0.f
deprecated_1=-273.f
deprecated_2=-273.f
penaltiesEnabled=0.l
aidFuelRate=0.f
aidTireRate=0.f
aidMechanicalDamage=0.f
aidAllowTyreBlankets=0.l
aidStability=0.f
aidAutoClutch=0.l
aidAutoBlip=0.l
hasDRS=0.l
hasERS=0.l
hasKERS=0.l
kersMaxJ=0.f
engineBrakeSettingsCount=0.l
ersPowerControllerCount=0.l
trackSPlineLength=0.f
trackConfiguration.wchar_t[33]
ersMaxJ=0.f
isTimedRace=0.l
hasExtraLap=0.l
carSkin.wchar_t[33]
reversedGridPositions=0.l
PitWindowStart=0.l
PitWindowEnd=0.l
isOnline=0.l
EndStructure
Re: [HELP] Converting a cpp header file
Posted: Fri Sep 20, 2019 9:42 am
by Mijikai
I also tried to translate it, i hope it works
Code: Select all
Enumeration PenaltyShortcut
#PenaltyShortcut_None
#PenaltyShortcut_DriveThrough_Cutting
#PenaltyShortcut_StopAndGo_10_Cutting
#PenaltyShortcut_StopAndGo_20_Cutting
#PenaltyShortcut_StopAndGo_30_Cutting
#PenaltyShortcut_Disqualified_Cutting
#PenaltyShortcut_RemoveBestLaptime_Cutting
#PenaltyShortcut_DriveThrough_PitSpeeding
#PenaltyShortcut_StopAndGo_10_PitSpeeding
#PenaltyShortcut_StopAndGo_20_PitSpeeding
#PenaltyShortcut_StopAndGo_30_PitSpeeding
#PenaltyShortcut_Disqualified_PitSpeeding
#PenaltyShortcut_RemoveBestLaptime_PitSpeeding
#PenaltyShortcut_Disqualified_IgnoredMandatoryPit
#PenaltyShortcut_PostRaceTime
#PenaltyShortcut_Disqualified_Trolling
#PenaltyShortcut_Disqualified_PitEntry
#PenaltyShortcut_Disqualified_PitExit
#PenaltyShortcut_Disqualified_WrongWay
#PenaltyShortcut_DriveThrough_IgnoredDriverStint
#PenaltyShortcut_Disqualified_IgnoredDriverStint
#PenaltyShortcut_Disqualified_ExceededDriverStintLimit
EndEnumeration
#AC_OFF = 0
#AC_REPLAY = 1
#AC_LIVE = 2
#AC_PAUSE = 3
#AC_UNKNOWN = -1
#AC_PRACTICE = 0
#AC_QUALIFY = 1
#AC_RACE = 2
#AC_HOTLAP = 3
#AC_TIME_ATTACK = 4
#AC_DRIFT = 5
#AC_DRAG = 6
#AC_HOTSTINT = 7
#AC_HOTLAPSUPERPOLE = 8
#AC_NO_FLAG = 0
#AC_BLUE_FLAG = 1
#AC_YELLOW_FLAG = 2
#AC_BLACK_FLAG = 3
#AC_WHITE_FLAG = 4
#AC_CHECKERED_FLAG = 5
#AC_PENALTY_FLAG = 6
Structure SPageFilePhysics
packetId.l
gas.f
brake.f
fuel.f
gear.l
rpms.l
steerAngle.f
speedKmh.f
velocity.f[3]
accG.f[3]
wheelSlip.f[4]
wheelLoad.f[4]
wheelsPressure.f[4]
wheelAngularSpeed.f[4]
tyreWear.f[4]
tyreDirtyLevel.f[4]
tyreCoreTemperature.f[4]
camberRAD.f[4]
suspensionTravel.f[4]
drs.f
tc.f
heading.f
pitch.f
roll.f
cgHeight.f
carDamage.f[5]
numberOfTyresOut.l
pitLimiterOn.l
abs.f
kersCharge.f
kersInput.f
autoShifterOn.l
rideHeight.f[2]
turboBoost.f
ballast.f
airDensity.f
airTemp.f
roadTemp.f
localAngularVel.f[3]
finalFF.f
performanceMeter.f
engineBrake.l
ersRecoveryLevel.l
ersPowerLevel.l
ersHeatCharging.l
ersIsCharging.l
kersCurrentKJ.f
drsAvailable.l
drsEnabled.l
brakeTemp.f[4]
clutch.f
tyreTempI.f[4]
tyreTempM.f[4]
tyreTempO.f[4]
isAIControlled.l
Array tyreContactPoint.f(4,3)
Array tyreContactNormal.f(4,3)
Array tyreContactHeading.f(4,3)
brakeBias.f
localVelocity.f[3]
P2PActivations.l
P2PStatus.l
currentMaxRpm.l
mz.f[4]
fx.f[4]
fy.f[4]
slipRatio.f[4]
slipAngle.f[4]
tcinAction.l
absInAction.l
suspensionDamage.f[4]
tyreTemp.f[4]
EndStructure
Structure SPageFileGraphic
packetId.l
status.l
session.l
currentTime.u[15]
lastTime.u[15]
bestTime.u[15]
split.u[15]
completedLaps.l
position.l
iCurrentTime.l
iLastTime.l
iBestTime.l
sessionTimeLeft.f
distanceTraveled.f
isInPit.l
currentSectorIndex.l
lastSectorTime.l
numberOfLaps.l
tyreCompound.u[33]
replayTimeMultiplier.f
normalizedCarPosition.f
activeCars.l
Array carCoordinates.f(60,3)
carID.l[60]
playerCarID.l
penaltyTime.f
flag.l
penalty.l
idealLineOn.l
isInPitLane.l
surfaceGrip.f
mandatoryPitDone.f
windSpeed.f
windDirection.f
isSetupMenuVisible.l
mainDisplayIndex.l
secondaryDisplayIndex.l
TC.l
TCCut.l
EngineMap.l
ABS.l
fuelXLap.l
rainLights.l
flashingLights.l
lightsStage.l
exhaustTemperature.f
wiperLV.l
DriverStintTotalTimeLeft.l
DriverStintTimeLeft.l
rainTyres.l
EndStructure
Structure SPageFileStatic
smVersion.u[15]
acVersion.u[15]
numberOfSessions.l
numCars.l
carModel.u[33]
track.u[33]
playerName.u[33]
playerSurname.u[33]
playerNick.u[33]
sectorCount.l
maxTorque.f
maxPower.f
maxRpm.l
maxFuel.f
suspensionMaxTravel.f[4]
tyreRadius.f[4]
maxTurboBoost.f
deprecated_1.f
deprecated_2.f
penaltiesEnabled.l
aidFuelRate.f
aidTireRate.f
aidMechanicalDamage.f
aidAllowTyreBlankets.l
aidStability.f
aidAutoClutch.l
aidAutoBlip.l
hasDRS.l
hasERS.l
hasKERS.l
kersMaxJ.f
engineBrakeSettingsCount.l
ersPowerControllerCount.l
trackSPlineLength.f
trackConfiguration.u[33]
ersMaxJ.f
isTimedRace.l
hasExtraLap.l
carSkin.u[33]
reversedGridPositions.l
PitWindowStart.l
PitWindowEnd.l
isOnline.l
EndStructure