Author Message

amilmand

00
Posts: 259

Location: ---
Occupation:
Age:
V$:
#151294   2018-11-13 07:01          
Almost there but as you found out (judging by the static cast to int) this function returns a float soo its no good for you the full call would be to get the address of the value and decode it as an int:
RawEdit.getI(the_car.getIndexedAddr(Chassis.IndexedData_Flags));
The clues would have been: LINK
And the comments in the chassis.java:
public static final int IndexedData_GearNumber = 0x20FC-0x304;
   //this is an int getIndexedData will return
     strange but the RawEdit.getI with getIndexedAddr will suffice
public static final int IndexedData_Flags = 0x70;//int

I dont know what your goal is with the flags but I found that access to this value is of a readonly manner as most of the flags the game updates each frame and invalidates any changes you try to force (though you can get interesting state indicators so to say, (whether the blinker is on, is the car running and some others)

As for checking function availability, you cant read arbitrary data from files so the actual function name is problematic but you can check for files present, ExhaustiveBits depends on the RawEdit class so you could check for
File.exsits("system\\Scripts\\lang\\RawEdit.class");
as a reasonable indicator, still if the game is not run with the Slrr_GI.exe you are hooped :/ I haven't made a way to detect that.
But there is no general check in the default game you can make to decide whether a function name is valid or not (or I dont know about it).


If I'm already writing I'll mention that I found a way to detect whether the car is flying or not (to be more precise I found a value in the WheelRef instance that is usually close to 0.0 when the car is in the air (it reports 0 if the game disables collision on the car (by the suspend command for example) it can also happen when the car is not moving so there is a constraint on it but its not that bad) :
WheelRef whl;
float sumPressure = 0.0;
for(int whl_i = 0; whl_i != 4; whl_i++)
{
	whl = player.car.chassis.getWheel(whl_i);
	float toad = RawEdit.getF(whl.ptr+344);
	if(toad < 0)
		toad *= -1.0;
	sumPressure += toad;
}
if(sumPressure <= 0.001)
{
	//player car is probably flying...
	Vector3 carVel = player.car.getVel();
	carVel.y = 0;
	if(carVel.length() > 5)
	{
		//player car is most probably flying...
	}
}