Einstein icon indicating copy to clipboard operation
Einstein copied to clipboard

Gestalt doesn't report the proper version

Open FrankFromPdaSoft opened this issue 3 years ago • 2 comments

The subject says it all :-)

FrankFromPdaSoft avatar Feb 04 '22 23:02 FrankFromPdaSoft

Seems that Paul has already implemented something like this. I just found the code snippet below in my NewtTest code, which I think I got from Paul a long time ago. It seems that Paul has extended the NewtonScript Gestalt call, which normally only allows queries for system info and backlight.

However, this code snippet still shows Einstein version 2007.7 although I'm running 2022 4.17.

constant kGestaltArg_EinsteinEmulatorInfo := '[0x03000002, [struct,long], 1];
constant kDR1Version := 0x00010000;

/**
  * Determine if we're under Einstein Emulator, and if so, its version.
  *
  * @return	nil if we're on a hardware unit, the Einstein Emulator version
  *			otherwise.
  */
DefConst('kDetermineEinsteinEmulatorVersionFn,
	func() begin
		local theResult := Gestalt(kGestaltArg_EinsteinEmulatorInfo);
		if (theResult) then return theResult[0] else return nil;
	end
);

FrankFromPdaSoft avatar Feb 06 '22 20:02 FrankFromPdaSoft

This is a bug. The version is hardcoded here:

https://github.com/pguyot/Einstein/blob/master/Emulator/TNativePrimitives.cpp#L905

pguyot avatar Feb 12 '22 17:02 pguyot